~eshel/eshellisp

90c605e0d30021468ba92a4ad7f098362345de3a — Eshel Yaron 2 years ago 867db67
Add fib test case
2 files changed, 8 insertions(+), 0 deletions(-)

M Makefile
A lisp/fib.eshellisp
M Makefile => Makefile +1 -0
@@ 13,6 13,7 @@ lint:

check: lint $(PACKAGE)
	./$(PACKAGE) lisp/giga.eshellisp 2>&1 | grep -q 1073741824
	./$(PACKAGE) lisp/fib.eshellisp  2>&1 | grep -q 7896325826131730509282738943634332893686268675876375

$(PACKAGE): $(SOURCES)
	$(PROLOG) --undefined=error -O -o eshellisp -c prolog/$(PACKAGE)/main.pl

A lisp/fib.eshellisp => lisp/fib.eshellisp +7 -0
@@ 0,0 1,7 @@
(define fib (n)
     (if (<= n 1) 0 (fib1 0 1 1 n)))

(define fib1 (f1 f2 i to)
     (if (<= to i) f2 (fib1 f2 (+ f1 f2) (+ i 1) to)))

(fib 250)
\ No newline at end of file