Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

by cddr

10 views
Skip to first unread message

Robert L.

unread,
Sep 17, 2017, 7:26:42 PM9/17/17
to
A monkey (Peter Seibel <pe...@gigamonkeys.com>) wrote:

> > But yuck, what's with all the gensyms?!?! The whole point of lifting
> > the body of the code is to insulate it from the LOOP's lexical
> > environment:
> >
> > (defmacro dolist-by-cddr ((var list &optional retform) &body body)
> > `(let ((body (lambda (,var) ,@body))
> > (retval (lambda (,var) ,@retform))
> > (list ,list))
> > (loop for elt in list by #'cddr
> > do (body elt)
> > finally (return (retval nil)))))
>
> Uh, don't you need some FUNCALLs? This isn't c.l.s you know.



(define (for-each-cddr func the-list)
(match the-list
[`(,a ,b . ,z) (func a) (for-each-cddr func z)]
[`(,a) (func a)]
[_ #f]))

(for-each-cddr println '(0 b 4 c 8 j 9))

0
4
8
9

--
[I]n Norway ... a straight white man was gang raped by Somali immigrants ...,
and now that one of the immigrants' prison term is ending he is opposing his
deportation. www.renseradioarchives.com/dduke/
0 new messages