Re:Elixir, a functional metaprogramming-aware language built...
by colanderman on Saturday April 27, 2013 @02:16PM
(#5618555)
Mm, last time I used Racket (then PLT Scheme) macros I did not encounter those features… the only "looping" I saw was limited to the "..." construct (which is a finite expansion), and all branching was lexical (i.e. branching couldn't be used to form infinite loops). If I am incorrect then I retract my Racket example.
[ Parent
| on HN ]
Re:Elixir, a functional metaprogramming-aware language built...
by klibertp on Sunday April 28, 2013 @08:24AM
(#5620978)
You're most likely incorrect - I cannot be sure about Racket back when it wasn't called that, but Scheme hygienic macro systems - those created with SYNTAX-RULES - are Turing complete. Look here for a "primer" which explains how to 'loop' (by means of recursion) and branch with pattern matching. At the end of a tutorial you can find basic Scheme interpreter written as a set of Scheme macros.
For example, in terms of this macro system, you can (and you could for a long time) define a simplest non-terminating macro like this:
(define-syntax loop
(syntax-rules ()
((loop) (loop))))
Racket Macro Stepper gives a following warning when used to step through the macro expansion: Macro expansion has taken a suspiciously large number of steps.
Click Stop to stop macro expansion and see the steps taken so far, or
click Continue to let it run a bit longer.