Closed abrudz closed 3 years ago
That's pretty cool, I've been looking for a way to express something like this! I'll look into it.
If you like that, and Unicode symbols, then you might like APL
APL seems fun! Maybe I'll try it some day.
Also, if I implement Iverson brackets, it might also be useful to be able to do recursion... That could actually be pretty useful
There, seems to work now! Having comparison operators will be useful for other features as well.
>> x = 1/3
>> [0 < x ≤ 1/3]*π + [x ≠ 1]
4.1415926536
An Iverson Bracket is simply a predicate in square brackets which evaluates to 0 if false or 1 if true. It is great for defining functions in multiple pieces, for example
f(x)=x[x<0]+x^2[x>0]
: