Talk:TPLHBPTBOTEW
Jump to navigation
Jump to search
Element removal
I'm trying to write a compiler, and I've noticed some problems. In commands like:
The proof for the element of the name x and value 2 being in set P has been proven weak.
the most obvious interpretation is to raise an error if the element x in P is not 2. However, this means items cannot be removed unless you already know their value, which would cause difficulties for Turing-completeness. Plokmijnuhby (talk) 11:26, 8 December 2018 (UTC)
- I am not a creator of this language, so this is just a suggestion for the creators, but how about an additional command like:
The proof for the size of set P being n has been proven weak
? It would remove the last element of the set if it contains n elements, do nothing otherwise. Also, I think raising an error in your example above if 'x: 2' is not in set P is not required. The end result should be no 'x: 2' in set P, if that was already true, there is no error, the statement is still valid. Salpynx (talk) 08:06, 9 December 2018 (UTC)
- I've had another look, and there are some clues what to do on the page. For example: "The above is equivalent to
x = 2; if x in P: ...; elif x not in P: ...
in Python 3. " This implies that the namex
is used to set a global of2
, and then an element inP
with any name and a value of2
is removed. In the statements related to arithmetic, it appears thatP
is completely ignored, which seems a little odd, but at least I can understand it. Plokmijnuhby (talk) 11:53, 9 December 2018 (UTC)
- Hmmm, I followed that through and am wondering if the Python was meant to be
if 'x' in P and P['x'] == 2: ...
? but what you say about any value of 2 is removed makes sense given the example on the page. I don't understand the statement under 'concept' "each element's value must be different. Their names do not have to be different." This seems to contradict the explode example:{a: "H", b: "e", c: "l", d: "l", e: "o"}
which has twol
values, and a sequence of unique keys. The Truth Machine example assigns 0 or 1 to a set P without providing a name too, and I don't see where in the commands that is enabled. Now I'm trying to figure out constitutes valid sets -- there appears to be a contradiction somewhere?
- Hmmm, I followed that through and am wondering if the Python was meant to be
{'x': 1, 'x': 2}
seems permissible by "Their names do not have to be different." but I can't see how that won't cause problems{'d': l, 'e': 'l'}
permitted by example but contradicted by "each element's value must be different."?{0, 1}
by the Truth-machine example? but uses an unlisted command? has been proven to be in set P
. Should 1st line of Truth Machine be:The element of the name x and value 0|1 has been proven to be in set P.
I don't know if that is better, but if unnamed values are permitted in sets, that command should be documented, or perhaps un-named assignments are auto-assigned a name like inexpand
? I think that would work too, but needs documentation if so. By the spirit of the language I think these need to be named somehow, so plain{0, 1}
can't be a valid set, but I could be wrong.
- I'm not meaning to be discouraging, I know it is difficult to come up with a spec before an implementation. I think this language is a nice concept, and has already been fun to explore. I hope an interpreter is made for it, and would like to help make it possible and come up with some examples! Please keep going :) Salpynx (talk) 21:28, 9 December 2018 (UTC)
- Now I'm wondering if a Set is simply a python3 dict with key and value swapped? That's kinda neat and if deliberate explains some of the statements. That would make 1 valid, but 2 not.The explode example would have to be
{a: "H", b: "e", c: "l", d: "o"}
, or the keyc
gets skipped because there is a dupe value? maybe evenc: "ll"
? I think that helps with the element removal problem. User:Gamer can you confirm if that was the intent for Set, being a key:value swapped dict, where only values are unique? Salpynx (talk) 21:42, 9 December 2018 (UTC)
- Now I'm wondering if a Set is simply a python3 dict with key and value swapped? That's kinda neat and if deliberate explains some of the statements. That would make 1 valid, but 2 not.The explode example would have to be
- I'm not meaning to be discouraging, I know it is difficult to come up with a spec before an implementation. I think this language is a nice concept, and has already been fun to explore. I hope an interpreter is made for it, and would like to help make it possible and come up with some examples! Please keep going :) Salpynx (talk) 21:28, 9 December 2018 (UTC)
Turing completeness
I've noticed that you cannot have a set with an arbitrary number of values, as each value must have a unique name. This would seem to restrict the language to a finite state machine. Plokmijnuhby (talk) 11:26, 8 December 2018 (UTC)
- Upon closer inspection, Turing completeness may be possible using arbitrarily large numbers as values. I can't help but feel this wasn't the intended solution, though. Plokmijnuhby (talk) 11:14, 9 December 2018 (UTC)
- I don't think this threatens the language's Turing completeness. While Sets might not be as flexible as they could be (not a bad thing -- they may have other interesting features), just having element values combined with the conditionals and loops should be sufficient. More complex data structures should be possible to create out of elements, or sets, or combination of the two. Salpynx (talk) 21:49, 9 December 2018 (UTC)