car cdr cons from little LISPer
(define cons (lambda (u v) (lambda (b) (cond (b u) (#t v))))) (define lunch (cons 'apple '())) (define car (lambda (l) (l #t))) (define cdr (lambda (l) (l #f)))
DZone Snippets > frontera000 > scheme
12158 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
(define cons (lambda (u v) (lambda (b) (cond (b u) (#t v))))) (define lunch (cons 'apple '())) (define car (lambda (l) (l #t))) (define cdr (lambda (l) (l #f)))
(define Y (lambda (f) (let ((future (lambda (future) (f (lambda (arg) ((future future) arg)))))) (future future)))) ((Y (lambda (factorial) (lambda (n) (if (= n 0) 1 (* n (factorial (- n 1))))))) 42)