User loginNavigation |
Postfix lambdasHere is a paper explaining the addition of lambdas to Forth. In the non-academic space, my language Enchilada has postfix lambdas via the eager macro operator. Interestingly, Enchilada can avoid the name capturing problems that plague Lisp macros (although some Lisp hackers love name capturing). Moreover, the detection of name capturing is done very efficiently in Enchilada. Enchilada macros bind with numbers and lists but not with other macros or operators. But because Enchilada lists hold expressions, macros can be indirectly bound to other macros. Here is a simple (postfix) Enchilada macro: 5 3 {a b=b a - +} 5 {a=3 a - +} 3 5 - + 3 _5 + _2 macro variables have lexical scope: 1 2 3 {a={b={c=a b c}}} 1 2 {b={c=3 b c}} 1 {c=3 2 c} 3 2 1 macros can be reduced eagerly: [1] [2] [3] {a b c==[a] b [c] + +} [1] [2] [3] {a b c==[a] b [c] + +} [1] [2] {a b==[a] b [[3]] + +} [1] {a==[a;2;[3]]} [[1];2;[3]] and name clashes are avoided by automatic alpha-conversion: 1 2 {a==[a] {a b=a b}} 1 2 {a=={aa=aa [a]}} 1 {aa=aa [2]} 1 [2] passing and lifting(^) a macro into another macro: 1 2 [{a b==b a}] {d e f==[d] [e] f ^} 1 2 [{a b==b a}] {d e f==[d] [e] f ^} 1 2 {d e==[e] [d]} 1 {d==[2] [d]} [2] [1] Enchilada started as a language similar in design to the Joy language. But I think with macros on board it boosts the expressive power of Lisp. By Robbert van Dalen at 2006-12-31 15:08 | LtU Forum | previous forum topic | next forum topic | other blogs | 6288 reads
|
Browse archives
Active forum topics |
Recent comments
22 weeks 6 days ago
22 weeks 6 days ago
22 weeks 6 days ago
45 weeks 19 hours ago
49 weeks 2 days ago
50 weeks 6 days ago
50 weeks 6 days ago
1 year 1 week ago
1 year 6 weeks ago
1 year 6 weeks ago