diff options
author | Keith Packard <keithp@keithp.com> | 2017-11-19 21:07:23 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-11-19 21:07:23 -0800 |
commit | 5f9f97cc2d43936d1941da3a9a130c279bc70b99 (patch) | |
tree | ac3855090137cc5dd1c8aefb618dbbf11c656893 /src | |
parent | 6d2f271a45759bd792d299f04a424d3382ef4798 (diff) |
altos/test: Update to build altos lisp test app
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/test/Makefile | 2 | ||||
-rw-r--r-- | src/test/hanoi.lisp | 15 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/test/Makefile b/src/test/Makefile index 9fe886b9..4ac2c893 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -104,7 +104,7 @@ AO_LISP_SRCS=$(LISP_SRCS) ao_lisp_test.c AO_LISP_OBJS=$(AO_LISP_SRCS:.c=.o) ao_lisp_test: $(AO_LISP_OBJS) - cc $(CFLAGS) -o $@ $(AO_LISP_OBJS) + cc $(CFLAGS) -o $@ $(AO_LISP_OBJS) -lm $(AO_LISP_OBJS): $(LISP_HDRS) ao_lisp_const.h diff --git a/src/test/hanoi.lisp b/src/test/hanoi.lisp index e873c796..02e16876 100644 --- a/src/test/hanoi.lisp +++ b/src/test/hanoi.lisp @@ -41,7 +41,8 @@ (define towers ()) -(define 1- (lambda (x) (- x 1))) +(define one- (lambda (x) (- x 1))) +(define one+ (lambda (x) (+ x 1))) ; Display one tower, clearing any ; space above it @@ -49,13 +50,13 @@ (cond ((= 0 clear) (cond ((not (null? tower)) (display-string x y (car tower)) - (display-tower x (1+ y) 0 (cdr tower)) + (display-tower x (one+ y) 0 (cdr tower)) ) ) ) (else (display-string x y " ") - (display-tower x (1+ y) (1- clear) tower) + (display-tower x (one+ y) (one- clear) tower) ) ) ) @@ -106,7 +107,7 @@ (define replace (lambda (list pos member) (cond ((= pos 0) (cons member (cdr list))) - ((cons (car list) (replace (cdr list) (1- pos) member))) + ((cons (car list) (replace (cdr list) (one- pos) member))) ) ) ) @@ -125,7 +126,7 @@ (set! towers (replace towers from from-tower)) (set! towers (replace towers to to-tower)) (display-hanoi) -; (delay move-delay) + (delay move-delay) ) ) ) @@ -137,9 +138,9 @@ (move-piece from to) ) (else - (_hanoi (1- n) from use to) + (_hanoi (one- n) from use to) (_hanoi 1 from to use) - (_hanoi (1- n) use to from) + (_hanoi (one- n) use to from) ) ) ) |