From "The Little Schemer" to newLISP
Posted: Mon May 25, 2020 9:15 am
I am reading the book "The Little Schemer" (yes, i know newLISP is different from Scheme...but i'm learning)
Until chapter 8 i had no problem to translate the code in newLISP.
But now i have the following function:
Calling it in the following way:
I got an error:
Instead the correct output should be:
Can you help me to solve this problem?
Thanks
cameyo
Until chapter 8 i had no problem to translate the code in newLISP.
But now i have the following function:
Code: Select all
(define (rember-f test?)
(lambda (a l)
(cond
((null? l) '())
((test? (first l) a) (rest l))
(true (cons (first l) ((rember-f test?) a (rest l)))))))
Code: Select all
((rember-f =) 'tuna '(shrimp salad and tuna salad))
Code: Select all
ERR: invalid function : (test? (first l) a)
Code: Select all
(shrimp salad and salad)
Thanks
cameyo