japt
japt copied to clipboard
Characters without meaning should be interpreted as strings
This is more of a feature-request but my idea is: characters that would throw a syntax error, should be converted to strings:
*+UqR
"*"+UqR
Like in this example, the *
operator would never at the very start of a program so it can be considered a string.
Another example, this time with emojis
U===🦄
U==="🦄"
because I can't imagine a case where a unicorn would be in the middle of a program
Hmm, that's a pretty good idea, but idk how easy it would be to pull off. Remember that one of +-*%&|^
etc. after a lowercase letter already transpiles to a function. I guess we could just say if the previous character is non-existent, a semicolon, a curly or square bracket, or another operator, change it to a string. (The last one requires the current char to not be +
or -
.)
Also, LOL at your second example ;)
This has been done partially done, if only for another reason; I found that the easiest way to make auto-functions (e.g. mp2
, map by using .p(2)
on each item) shorter to use was to transpile the first char(s) to a string, then let the function decide what to do with it. So now you can use a lowercase letter or operator as the first argument in a function and it will interpret it as a single-char string. See here for example usage