Tips for golfing in Jolf
Know your auto-assigning variables!
Jolf has many ways to "auto assign" variables. The standard one is γ
, which takes the value of the next expression. Β
is the same thing, but converts the next expression to a number.
Also, ζ
(zeta) is a variable initialized to -1/12
(guess why), and can be re-assigned with Ζ
(Zeta).
For example, let's say you want to compare I
(the input string) to an operation over itself. For now, let's see if I + I = reverse(I + I)
. This is written as, conventionally:
=+II_+II
But this can be golfed down to:
=γ+II_γ
Use @
@
is a command that takes the next character in the source code and returns that character's code point. (For example, @X
returns 88.) This is often very useful since you can express any number between 0 and 255 in two bytes.
Read the source
As of right now, there are a lot of undocumented things -- the mysterious m
module among them, which has a lot of builtins. However, they do exist in the source, and it's really not hard to read once you get the hang of it, so read the source.