3 ms·
Probably worth noting that there's already an SRFI for this. [0] And that macro will work on any Scheme implementing the standard since about '98. (define-
by shakna 1y ago
Probably worth noting that there's already an SRFI for this. [0] And that macro will work on any Scheme implementing the standard since about '98.
(define-syntax rec
(syntax-rules ()
((rec (NAME . VARIABLES) . BODY)
(letrec ( (NAME (lambda VARIABLES . BODY)) ) NAME))
((rec NAME EXPRESSION)
(letrec ( (NAME EXPRESSION) ) NAME))))
[0] https://srfi.schemers.org/srfi-31/srfi-31.html https://srfi.schemers.org/srfi-31/srfi-31.html
- skrishnamurthi 1y ago1. This isn't the same. `rec` names the function. This does not name the function. The point is to illustrate how the name-capture works. 2. The README literally says "Don't Use This Macro!" and references `rec` to use instead: https://github.com/shriram/anonymous-recursive-function?tab=readme-ov-file#dont-use-this-macro https://github.com/shriram/anonymous-recursive-function?tab=...