projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/lisp: Add floats
[fw/altos]
/
src
/
lisp
/
ao_lisp_const.lisp
diff --git
a/src/lisp/ao_lisp_const.lisp
b/src/lisp/ao_lisp_const.lisp
index 191ef00581ff2b602fa3a295cb1455fb2601a258..9fb7634c5858e1cd7d4d76330b8ab72953ad9da6 100644
(file)
--- 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 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
)
; simple math operators
@@
-152,9
+159,6
@@
(odd? 3)
(odd? -1)
(odd? 3)
(odd? -1)
-(define exact? number?)
-(defun inexact? (x) #f)
-
; (if <condition> <if-true>)
; (if <condition> <if-true> <if-false)
; (if <condition> <if-true>)
; (if <condition> <if-true> <if-false)
@@
-264,6
+268,7
@@
(let ((x 1)) x)
(let ((x 1)) x)
+(define let* let)
; boolean operators
(define or (lexpr (l)
; boolean operators
(define or (lexpr (l)