[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7.5.21 SRFI-31 - A special form ‘rec’ for recursive evaluation
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>
This document was generated on April 20, 2013 using texi2html 5.0.