diff options
| author | Keith Packard <keithp@keithp.com> | 2017-11-18 22:00:44 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-11-18 22:00:44 -0800 | 
| commit | 12a1f6ad48f2b924f71239effeb90afca75a090f (patch) | |
| tree | da4d42d66f10698b5f38c0bc9b60cf1f01fa7b02 /src/lisp/ao_lisp_const.lisp | |
| parent | 5f8f0ed5cd5d4b4f793c602ed09f9b4bdb98f7e8 (diff) | |
altos/lisp: Fix some scheme compat issues
flush -> flush-output
nth -> list-ref (oh, and add list-tail)
add let* (same as let for now)
write control chars in octal
make hanoi example work
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lisp/ao_lisp_const.lisp')
| -rw-r--r-- | src/lisp/ao_lisp_const.lisp | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/src/lisp/ao_lisp_const.lisp b/src/lisp/ao_lisp_const.lisp index 191ef005..861a4fc8 100644 --- a/src/lisp/ao_lisp_const.lisp +++ b/src/lisp/ao_lisp_const.lisp @@ -60,10 +60,17 @@  (defun caddr (l) (car (cdr (cdr l)))) -(defun nth (list n) -  (cond ((= n 0) (car list)) -	((nth (cdr list) (1- n))) -	) +(define list-tail (lambda (x k) +		    (if (zero? k) +			x +		      (list-tail (cdr x (- k 1))) +		      ) +		    ) +  ) + +(define list-ref (lambda (x k) +		   (car (list-tail x k)) +		   )    )  					; simple math operators @@ -264,6 +271,7 @@  (let ((x 1)) x) +(define let* let)  					; boolean operators  (define or (lexpr (l) | 
