Created
January 6, 2024 02:59
-
-
Save cdegroot/7ad1db85c160c0a6626d07eb8a81e637 to your computer and use it in GitHub Desktop.
Lisp 1.5 funargs example from https://web.archive.org/web/20211202101850/http://web.sonoma.edu/users/l/luvisi/lisp/lisp15.tar.gz
This file contains 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
TEST FUNARG | |
define (( | |
(double (lambda (x) (plus x x))) | |
)) | |
double (6) | |
deflist (( | |
(test-fexpr (lambda (args alist) | |
(prog () (print args) (print alist)))) | |
) FEXPR) | |
define (( | |
(test1 (lambda (a) (test-fexpr b c))) | |
)) | |
test1 (6) | |
define (( | |
(make-adder (lambda (x) (make-closure))) | |
(make-closure (lambda () (function (lambda (y) (addx y))))) | |
(addx (lambda (z) (plus x z))) | |
(do-test (lambda () (prog (a) | |
(setq a (make-adder 4)) | |
(print (a 2)) | |
(print (a 3)) | |
(setq a (make-adder 5)) | |
(print (a 2)) | |
(print (a 3))))) | |
)) | |
do-test () | |
define (( | |
(make-box (lambda (x) (function (lambda () (return-x))))) | |
(return-x (lambda () x)) | |
(test-box (lambda () (prog (f) | |
(setq f (make-box 5)) | |
(print (f))))) | |
)) | |
test-box () | |
STOP | |
FIN END OF LISP RUN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment