Created
May 12, 2021 22:30
-
-
Save baileywickham/d6d346b1529509cbf4bc8afa1610a74a to your computer and use it in GitHub Desktop.
fixed point map
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
(define fpmap | |
(lambda args | |
(map (lambda (iter) | |
(apply (first args) iter (remove-last (rest args)))) (last args)))) | |
(define (remove-last l) | |
(reverse (rest (reverse l)))) | |
(define (add-two a b) | |
(+ a b)) | |
;; (fpmap procedure [fixed points ...] list) | |
(fpmap add-two 2 '(1 2 3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment