Code: Select all
(define-macro (curry-all f)
(letex (f1 f lst (map string (args)))
(fn (z) (eval-string (append "(" (name 'f1) " " (join 'lst " ") " " (name 'z) ")")))))
((curry-all + 1 2 3 4) 5)
> 15
Code: Select all
(define-macro (curry-all f)
(letex (f1 f lst (map string (args)))
(fn (z) (eval-string (append "(" (name 'f1) " " (join 'lst " ") " " (name 'z) ")")))))
((curry-all + 1 2 3 4) 5)
> 15
Code: Select all
(define (curry-all f)
(append (lambda (z)) (list (cons f (append (args) '(z))))))
((curry-all + 1 2 3 4) 5) => 15
Code: Select all
(define (curry-all f)
(letex (body (cons f (append (args) '(z))))
(lambda (z) body)))
Code: Select all
(define (curry-all f)
(append (lambda (z)) (list (cons f (append (args) '(z))))))
(curry-all + 1)
=> (lambda (z) (+ <40E3BF> 1 z))
that is the way an evaluated built-in function symbol gets displayed (the internal machine hex-adddress). If you would quote it, you wouldn't see it:Btw, why is there 40E3BF in the expression?
Code: Select all
(define (curry-all f)
(append (lambda (z)) (list (cons f (append (args) '(z))))))
(curry-all '+ 1)
=> (lambda (z) (+ 1 z))
Code: Select all
(format "%x" (last (dump +)))