diff options
author | jgart | 2021-12-29 01:23:36 -0500 |
---|---|---|
committer | jgart | 2021-12-29 01:23:36 -0500 |
commit | f3e9633e94b03dd4178f6970436be6e265541261 (patch) | |
tree | be8124fe4da28dddee01be43db0d2d1313b29a81 /topics | |
parent | 2469f5b057e3d2f8799bb694476aa9d24a8a1cc2 (diff) | |
download | gn-gemtext-f3e9633e94b03dd4178f6970436be6e265541261.tar.gz |
Add init for lisp for schemers topic
Diffstat (limited to 'topics')
-rw-r--r-- | topics/lisp/lisp4schemers.gmi | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/topics/lisp/lisp4schemers.gmi b/topics/lisp/lisp4schemers.gmi new file mode 100644 index 0000000..e776915 --- /dev/null +++ b/topics/lisp/lisp4schemers.gmi @@ -0,0 +1,40 @@ +# Lisp For Schemers + +## iota + +### In Scheme + +``` +scheme@(guile-user)> (iota 12) + +$1 = (0 1 2 3 4 5 6 7 8 9 10 11) +``` + +### In Common Lisp + +``` +CL-USER: (loop for i below 12 collect i) + +(0 1 2 3 4 5 6 7 8 9 10 11) + +CL-USER: (macroexpand '(loop for i below 12 collect i)) + +(BLOCK NIL + (LET ((I 0)) + (DECLARE (IGNORABLE I) + (TYPE (AND NUMBER REAL) I)) + (SB-LOOP::WITH-LOOP-LIST-COLLECTION-HEAD (#:LOOP-LIST-HEAD-493 + #:LOOP-LIST-TAIL-494) + (TAGBODY + SB-LOOP::NEXT-LOOP + (WHEN (>= I '12) (GO SB-LOOP::END-LOOP)) + (SB-LOOP::LOOP-COLLECT-RPLACD + (#:LOOP-LIST-HEAD-493 #:LOOP-LIST-TAIL-494) (LIST I)) + (SB-LOOP::LOOP-DESETQ I (1+ I)) + (GO SB-LOOP::NEXT-LOOP) + SB-LOOP::END-LOOP + (RETURN-FROM NIL + (SB-LOOP::LOOP-COLLECT-ANSWER #:LOOP-LIST-HEAD-493)))))) +T +``` + |