From 987222b6b33db4080492c243f2b6d62fd7264576 Mon Sep 17 00:00:00 2001 From: Rain Mark Date: Wed, 23 Feb 2022 21:02:46 +0800 Subject: [PATCH] loop example Signed-off-by: Rain Mark --- README.md | 20 +++++++++++++++++--- example/{prog.lisp => loop.lisp} | 1 - 2 files changed, 17 insertions(+), 4 deletions(-) rename example/{prog.lisp => loop.lisp} (82%) diff --git a/README.md b/README.md index 9516c06..7a5067c 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,6 @@ $ ./build.sh # example -> lambda.lisp - ```lisp (progn (define abc (lambda (a b c) (+ a (+ b c)))) @@ -27,7 +25,23 @@ $ ./lispoo example/lambda.lisp 18 ``` -> quote.lisp +```lisp +(progn + (set! i 3) + (while i (progn (message i) (set! i (+ i -1)))) + (progn (set! x 0) (message (if x 1 2))) + (message (progn (+ 1 1) (+ 2 2))) + ) +``` + +```sh +$ ./lispoo example/loop.lisp +3 +2 +1 +2 +4 +``` ```lisp (progn diff --git a/example/prog.lisp b/example/loop.lisp similarity index 82% rename from example/prog.lisp rename to example/loop.lisp index 91ef6e2..509effd 100644 --- a/example/prog.lisp +++ b/example/loop.lisp @@ -2,6 +2,5 @@ (set! i 3) (while i (progn (message i) (set! i (+ i -1)))) (progn (set! x 0) (message (if x 1 2))) - (progn (set! x 1) (message x)) (message (progn (+ 1 1) (+ 2 2))) )