Henrixounez / v-lisp

Lisp interpretor in V
6 stars 0 forks source link

add lambda feature #3

Closed forthlee closed 6 months ago

forthlee commented 2 years ago
vlisp> (define combine (lambda (f) (lambda (x y) (cond ((eq? x '()) (quote ())) (#t (f (list (car x) (car y)) ((combine f) (cdr x) (cdr y))))))))
combine
vlisp> (define zip (combine cons))
zip
vlisp> (zip (list 1 2 3 4) (list 5 6 7 8))
([1, 5] [2, 6] [3, 7] [4, 8])