From 2c814d8829cd2892dbd61eed46a7285846a9a5ca Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Thu, 1 Aug 2024 10:13:06 -0700 Subject: [PATCH] Add comments with ';' --- doc/DRAWL.md | 1 + images/apple/DRAWL.po | Bin 143360 -> 143360 bytes src/lisp/defun.lisp | 3 +++ src/lisp/fact.lisp | 3 +++ src/lisp/gcd.lisp | 5 ++++- src/lisp/list.lisp | 3 +++ src/lisp/loop.lisp | 9 +++++++++ src/lisp/lores.lisp | 13 +++++++++++++ src/lisp/maplist.lisp | 3 +++ src/lisp/minmax.lisp | 3 +++ src/lisp/prog.lisp | 6 ++++++ src/lisp/s-expr.pla | 1 + src/lisp/set.lisp | 3 +++ 13 files changed, 52 insertions(+), 1 deletion(-) diff --git a/doc/DRAWL.md b/doc/DRAWL.md index 0b02850..dda4b0b 100644 --- a/doc/DRAWL.md +++ b/doc/DRAWL.md @@ -26,6 +26,7 @@ However, the code is partitioned to allow for easy extension so some of these mi - LoRes Apple II graphics - Ctrl-C break into running program - MACROs for meta-programming. See [defun.lisp](https://github.com/dschmenk/PLASMA/blob/master/src/lisp/defun.lisp) +- End-of-line comment using ';' The DRAWL implementation comes with the following built-in functions: diff --git a/images/apple/DRAWL.po b/images/apple/DRAWL.po index 11e9c783973440fc12e5572755d9ed6facbf8fd7..2db745999192ad182c254bb3b9a82abeee8d25d4 100644 GIT binary patch delta 4338 zcma*qeNJXY7HWpuCuOQhC4VpbLVpBj-l;tqA*Ai8Y*dj zG~CW^TlP9~;(92xw#`*hP!U+IPF9-zAxBGVJ8h-g*KA{(Pj^;dBX3Pi(;}t>ikA znK*8>?GppjdAZ8FBo;@ms7Uif4>;{(^xEJ-lIP~7u_M`G3=<{{%dWClj+uMlWh~ zH(f}(HGVgB7#c`|ws|+rGuTL?_QGze(MD~-9(tG_)4tzBy)-niq>JWIt1Z7Z-cRPm zt;FBvgn5RQ_nD1;R&N_t`s0-o`H@Drt%S5Kd+D!fqW1M(nn!nQN&D!1G^G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^thiKRt1ZpE;ddP=Lc-PzU0sRSc zAB-eY8=Qd)k;HQ~l6h`KGU-2vQ=SOC?q8YI{X z+hG^{4til!43S2I2GSr4jPP^V0IkpoU&auRN-an+YT}7gE2QyiH<60fM0y44;B|N# zehd5IICQ~v6g)y9jU^r-Rw1d-CdUer7VS8+rdT3PKs*U!FCd-`b6^2fLoFa zB8`PASQ}3~jq!ry-icsOyh7TKWGl48CAbN<;9JN^AW~@p@zf?Hdp0Bp(iX&96BN=t z(67l{ICKBlcbigV2 zGklB*Hxrrk72`+5iEt3P!DV2ZP*Okp$Yau zGaQ3XI1eAeRk#74!`E;h{tXX-q~evq7%0=?hXG7538sSuN}(JU!eUqsb+8uJ!)EZn zPS^|0&<3aYvMzcLzk9^<+<$EQ(O++9@;B_b*UmBV&&JNNf4Re!35ntK`YvDUaw!l=nZPW8WLgV%{I1ti#0o$1q`OJ)fvx zlliY1drOY~g0cm28J{e$2YgK!E92P_te$r(*mOQHiX|op_-pgcVSndd!6n?Fs0;TN OM6pYH@3| x y) , (gcd y x)) ((eq (rem y x) 0) , x) diff --git a/src/lisp/list.lisp b/src/lisp/list.lisp index c41ae23..8e5a9b0 100644 --- a/src/lisp/list.lisp +++ b/src/lisp/list.lisp @@ -1,3 +1,6 @@ +; +; Example from LISP 1.5 manual +; (define (equal (lambda (x y) (cond ((and (atom x) (atom y)) (eq x y)) diff --git a/src/lisp/loop.lisp b/src/lisp/loop.lisp index b4025ce..d4aed29 100644 --- a/src/lisp/loop.lisp +++ b/src/lisp/loop.lisp @@ -1,8 +1,14 @@ (DEFINE + ; + ; TAIL LOOP RECURSION + ; (TAILLOOP (LAMBDA (I M) (COND ((AND (< I M) (PRIN I)),(TAILLOOP (+ 1 I) M)) (T,(- I 1))) )) + ; + ; ITERATE INSIDE PROG() + ; (PROGLOOP (LAMBDA (I M) (PROG () A (PRIN I) @@ -10,6 +16,9 @@ (IF (< I M) (GO A)) (RETURN (- I 1)) ))) + ; + ; FOR LOOP EXTENSION + ; (FORLOOP (LAMBDA (I M) (FOR I I 1 (< I M) (PRIN I)) )) diff --git a/src/lisp/lores.lisp b/src/lisp/lores.lisp index 69fbb8a..5b02d62 100644 --- a/src/lisp/lores.lisp +++ b/src/lisp/lores.lisp @@ -1,3 +1,6 @@ +; +; LORES GRAPHICS TRIG PLOTTING EXAMPLE +; (DEFINE (PLOTFUNC (LAMBDA (FN) (PROG (I X Y) @@ -10,9 +13,17 @@ (RETURN 0) ) )) + ; + ; USE FUNCTION TO PASS IN LAMBDA EQUATIONS + ; BEST OPTION FOR GENERIC CASE + ; (PLOTSIN (LAMBDA () (PLOTFUNC (FUNCTION (LAMBDA (S) (SIN (* S PI))))) )) + ; + ; USE QUOTE TO PASS IN LAMBDA EQUATION + ; ONLY APPLICABLE IF NO FREE VARIABLES + ; (PLOTCOS (LAMBDA () (PLOTFUNC '(LAMBDA (S) (COS (* S PI)))) )) @@ -22,3 +33,5 @@ (PLOTSIN) (COLOR 9) (PLOTCOS) +; RETURN TO TEXT MODE - UNCOMMENT NEXT LINE +; (GR F) diff --git a/src/lisp/maplist.lisp b/src/lisp/maplist.lisp index dfecc4e..357081b 100644 --- a/src/lisp/maplist.lisp +++ b/src/lisp/maplist.lisp @@ -1,3 +1,6 @@ +; +; Sample from LISP 1.5 Manual +; (define (ydot (lambda (x y) diff --git a/src/lisp/minmax.lisp b/src/lisp/minmax.lisp index 1391741..7975105 100644 --- a/src/lisp/minmax.lisp +++ b/src/lisp/minmax.lisp @@ -1,3 +1,6 @@ +; +; ALTERNATIVE MIN/MAX USING LIST ARGUMENT +; (DEFINE (MINL (LAMBDA (M L) (COND ((NULL L), M) diff --git a/src/lisp/prog.lisp b/src/lisp/prog.lisp index c00f698..0146add 100644 --- a/src/lisp/prog.lisp +++ b/src/lisp/prog.lisp @@ -1,5 +1,8 @@ (define (lengthc (lambda (l) + ; + ; Use cond() inside prog() + ; (prog (u v) (setq v 0) (setq u l) @@ -10,6 +13,9 @@ ) )) (lengthi (lambda (l) + ; + ; Use if/then/else inside prog() + ; (prog (u v) (setq v 0) (setq u l) diff --git a/src/lisp/s-expr.pla b/src/lisp/s-expr.pla index db4725b..a640bd7 100644 --- a/src/lisp/s-expr.pla +++ b/src/lisp/s-expr.pla @@ -559,6 +559,7 @@ export def parse_expr(evalptr, level, refill)#2 // return evalptr, exprptr elemptr = NULL when ^evalptr is 0 + is ';' // Comment to end of line if level evalptr = refill() // Refill input buffer else diff --git a/src/lisp/set.lisp b/src/lisp/set.lisp index f36c1e8..2ea9bff 100644 --- a/src/lisp/set.lisp +++ b/src/lisp/set.lisp @@ -1,3 +1,6 @@ +; +; Example from LISP 1.5 manual +; (define (member (lambda (a x) (cond ((null x) , f)