* added last-pair primitive
This commit is contained in:
parent
126b7aa8fa
commit
3c4986ff89
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -871,6 +871,23 @@ reference-implementation:
|
|||
(lambda (x)
|
||||
(race x x x '()))))
|
||||
|
||||
(primitive-set! 'last-pair
|
||||
(letrec ([race
|
||||
(lambda (h t ls last)
|
||||
(if (pair? h)
|
||||
(let ([h ($cdr h)] [last h])
|
||||
(if (pair? h)
|
||||
(if (not (eq? h t))
|
||||
(race ($cdr h) ($cdr t) ls h)
|
||||
(error 'last-pair "~s is a circular list" ls))
|
||||
last))
|
||||
last))])
|
||||
(lambda (x)
|
||||
(if (pair? x)
|
||||
(let ([d (cdr x)])
|
||||
(race d d x x))
|
||||
(error 'last-pair "~s is not a pair" x)))))
|
||||
|
||||
(primitive-set! 'memq
|
||||
(letrec ([race
|
||||
(lambda (h t ls x)
|
||||
|
@ -1604,6 +1621,8 @@ reference-implementation:
|
|||
(append ls ls*)])))
|
||||
|
||||
|
||||
|
||||
|
||||
(primitive-set! 'list->vector
|
||||
(letrec ([race
|
||||
(lambda (h t ls n)
|
||||
|
|
|
@ -85,6 +85,7 @@
|
|||
file-exists? delete-file + - add1 sub1 * / expt
|
||||
quotient+remainder quotient remainder modulo number? positive?
|
||||
negative? zero? number->string logand = < > <= >=
|
||||
last-pair
|
||||
make-guardian weak-cons collect
|
||||
interrupt-handler
|
||||
time-it
|
||||
|
|
Loading…
Reference in New Issue