Language amusements
I've been working on my language, Impulse, and can now finally evaluate somewhat amusing expressions:
Impulse
(1..10) map: n [n is-even?] -> n * n
Impulse
f = x -> (1..x) each: n -> puts: x + nRuby
f eval: 5
f = lambda { |x| (1..x).each { |n| puts n * n } }The Ruby version isn't bad, but it's sure got lots of curlies and bars. Ultimately I want to support predicate blocks, which only evaluate if the predicate is true:
f.call 5
(1..10) map: n [n is-even?] -> n * n
0 Comments:
Post a Comment
<< Home