Sujet : Re: loop macro and multiple-value-bind
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp comp.lang.schemeDate : 26. Sep 2024, 21:44:08
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vd4h2n$c7sv$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
Iterate is a more lispy superset of loop. For instance you can do this:
(iter
(for a from 10 to 20)
(for (values q r) = (truncate a 3))
(format t "~d ~d~%" q r))
3 1
3 2
4 0
4 1
4 2
5 0
5 1
5 2
6 0
6 1
6 2
Gauche Scheme
(use srfi-197) ;; chain-lambda
(for-each
(chain-lambda (div-and-mod _ 3) (format #t "~d ~d~%" _ _))
(iota 11 10))
3 1
3 2
4 0
4 1
4 2
5 0
5 1
5 2
6 0
6 1
6 2