I tried to write a (simple, i.e. without eqan?) one? function like such:
(define one?
(lambda (n)
((= 1 n))))
But the above doesn’t work though because when I call it like such:
(one? 1)
I get greeted with this error:
procedure application: expected procedure, given: #t (no arguments)
The correct way (from The Little Schemer) to write it is:
(define one?
(lambda (n)
(cond
(else (= 1 n)))))
Why is there a need to use a cond with an else clause, instead of just returning (= 1 n) ?
There isn’t any reason why you would want to do that. I’ll check my copy of TLS when I get home to see if I can divine what’s going on, but you’re not missing anything fundamental about
condor anything.Response to your note above: It’s not working because you have an extra set of parentheses in the body of the lambda. It should be
The extra parentheses in your version mean that instead of returning the value
#tor#f, you’re trying to call that value as a function with no arguments.