For Programmers: Free Programming Magazines  


Home > Archive > Scheme > April 2006 > total newb question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author total newb question
isaac2004

2006-04-09, 7:06 pm

hi im just learning scheme and i get errors that say
reference to undefined identifier: a
i have no clue what this means here is a function that throws this

(define member?
(lambda (e S)
(cond ( (null? S) #f )
; If S is empty, nothing is a
; member of it.
( (eq? e (car S)) #t )
; If the first element of the
; set is the element sought
; that element is a member of S.
(else
; Otherwise, remove the first
; element of S and try again.
(member? e (cdr S))))))

(member (a b c d) (e f g))

thanks for the help

Brian Harvey

2006-04-09, 7:06 pm

"isaac2004" <isaac_2004@yahoo.com> writes:
>reference to undefined identifier: a
>
> (member (a b c d) (e f g))


(a b c d) means "call the procedure named A with the arguments B, C, and D."

What you probably meant was '(a b c d) which is an abbreviation for
(quote (a b c d)) which means "take the list (a b c d) as data rather than
as a Scheme expression to be evaluated."

(posted and mailed)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com