7

i heard you like lambdas

Submitted by no_defun_allowed in church_of_alonzo_church (edited )

so i made some conses with lambdas so you can represent your lambdas with conses with more lambdas

;; still waiting for swindle's currying syntax to be part of
;; main Scheme tbh
(define ((cons a d) f)
  (f a d))
;; normal non-currying Scheme ]:
(define (cons a d)
  (lambda (f) (f a d)))
;; car & cdr are the same either way, idk
;; how to make those prettier
(define (car c) (c (lambda (a d) a)))
(define (cdr c) (c (lambda (a d) d)))

edit: i dunno any haskell but i know Standard ML so here's a port

fun cons a d f = f a d;
fun car c = c (fn a => fn d => a);
fun cdr c = c (fn a => fn d => d);

Comments

You must log in or register to comment.