I am a scheme newbie currently reading "The Little Schemer" The book provides the function for atom as follows.
------- atom.scm---------------- (define atom? (lambda (x) (and (not (pair? x)) (not null? x)))) --------------------------------
However when I use it with Gambit, it shows the following error message. as follows:
---------------------------------------------------- Gambit v4.5.3
(load "atom.scm")
"/home/joetex/atom.scm"
(atom? 'h)
*** ERROR IN atom?, "atom.scm"@3.10 -- Wrong number of arguments passed to procedure (not '#<procedure #2 pair?> 'h) 1> ----------------------------------------------------
What exactly has gone wrong here? Please ignore this email if this is the wrong mailing list. Thank you, - Joe
Afficher les réponses par date
Hallo,
On Sat, Jan 30, 2010 at 8:41 PM, joe tex joetex1@gmail.com wrote:
I am a scheme newbie currently reading "The Little Schemer" The book provides the function for atom as follows.
------- atom.scm---------------- (define atom? (lambda (x) (and (not (pair? x)) (not null? x))))
However when I use it with Gambit, it shows the following error message. as follows:
Change (not null? x) to (not (null? x)).
Cheers,
On Sat, 2010-01-30 at 17:41 -0500, joe tex wrote:
I am a scheme newbie currently reading "The Little Schemer" The book provides the function for atom as follows.
------- atom.scm---------------- (define atom? (lambda (x) (and (not (pair? x)) (not null? x))))
It should be (not (null? x))
Brad