Warning: This is the manual of the legacy Guile 2.0 series. You may want to read the manual of the current stable series instead.
Next: SRFI-34, Previous: SRFI-30, Up: SRFI Support [Contents][Index]
SRFI-31 defines a special form that can be used to create self-referential expressions more conveniently. The syntax is as follows:
<rec expression> --> (rec <variable> <expression>) <rec expression> --> (rec (<variable>+) <body>)
The first syntax can be used to create self-referential expressions, for example:
guile> (define tmp (rec ones (cons 1 (delay ones))))
The second syntax can be used to create anonymous recursive functions:
guile> (define tmp (rec (display-n item n) (if (positive? n) (begin (display n) (display-n (- n 1)))))) guile> (tmp 42 3) 424242 guile>