9:13 PM
Idea I had while getting ready to shower: an expression with _
in it is automatically a function, and they can be identified like _1
, _2
, _a
, _ab
, _b
, that sort of thing.
The reasoning is that it's kinda annoying to have to type lambda x:x+2
in Python, for example. Why not just _+2
?
Trying to think of an example where this would be useful.
Ah, also, regarding \track
, I think I could do it this way:
Keeping in mind that \track
needs a sequence, a condition, and an action.
\track[condition](sequence){action}
\track[_>\max($)](\collatz(200)){print(_)}
I think $
could mean "itself".
So like x = [0,1]+\addByDiffs($)
would generate the Fibonacci sequence.
And again, like _
, identifiers can be appended to distinguish them.
Ah-ha, okay, I have an example for _
'd identifiers.
\map( _1**2+_2, \zip( [0,1,2,3], [6,7,8,9] ;; => [6,8,12,18]
$
identifiers would be useful when doing something like a,b = $2,$1+$2
.
...is it me or did I just write the Fibonacci sequence?
I must make this possible.
Oh, regarding how the interpreter will know which is which, identifiers will be sorted lexicographically and the first "thing" will go to the first one, second to second, etc.