Re: Announcement Loop Facility
Lassi Kortela 16 Aug 2022 10:17 UTC
> Out of curiosity, do you plan to call it 'loop'? That will probably
> break all my code, I should start renaming my named lets to 'lp' :)
At least in R7RS, the following seems to work as intended:
(import (scheme base) (scheme write))
(define-syntax loop
(syntax-rules ()
((loop . ignored)
(syntax-error "No loop for you!"))))
(define (my-iota n)
(let loop ((n n) (list '()))
(let ((n (- n 1)))
(if (negative? n) list (loop n (cons n list))))))
(write (my-iota 10))
(newline)