[racket] TLS "atom?" definition for Scheme does not work in DrRacket

From: Alexander D. Knauth (alexander at knauth.org)
Date: Tue Mar 3 15:21:17 EST 2015

This works for me:
(define atom? (lambda (arg1)
                (and (not (pair? arg1))
                     (not (null? arg1)))))


On Mar 3, 2015, at 3:16 PM, Rufus <rlaggren at mail.com> wrote:

> On page 10 of TLS there is a note defining the "atom?" function for the
> reader to use w/Lisp or Scheme. The definition for Scheme (which is the
> most likely one to use for DrR) does not work. To fix one must remove
> the parens that open at the "and". Apparently the DrR
> compiler/interpreter sees them as an attempt to invoke a function and
> that's not correct here. I don't know if other Lisp versions would find
> the code in the book correct.
> 
> In the text below XXX shows where I removed a set of parens to make the
> function work.
> 
> (define atom? (lambda (arg1)
>               XXX and (not (pair? arg1))
>                       (not (null? arg1))
>               XXX
>              )
> )
> 
> 
> Rufus
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users


Posted on the users mailing list.