-
Notifications
You must be signed in to change notification settings - Fork 45
How can a lambda call itself? #60
Copy link
Copy link
Open
Description
I'm trying to create a function that returns a function that calls itself. I tried this:
(define (multo ex) (let ((f (lambda (n) (if
(= 0 n)
1
(* ex (f (- n 1))))))) f))
(println "~s" ((multo 3) 3))But it doesn't work because the lambda can't refer to f inside the definition. How do I achieve this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels