Created
December 2, 2011 00:48
-
-
Save UnkindPartition/1421070 to your computer and use it in GitHub Desktop.
Map in Scheme (CPS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; In reply to https://gist.github.com/1405389 | |
(define (map f lst) | |
(letrec | |
((go (lambda (lst k) | |
(if (null? lst) | |
(k '()) | |
(go (cdr lst) | |
(lambda (rest) | |
(k (cons (f (car lst)) rest)))))))) | |
(go lst (lambda (x) x)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment