* moved set-car! and set-cdr! to ikarus.pairs

This commit is contained in:
Abdulaziz Ghuloum 2007-05-05 05:15:53 -04:00
parent fd5c6a1e47
commit 71ca0c1e06
3 changed files with 16 additions and 15 deletions

Binary file not shown.

View File

@ -69,18 +69,6 @@
ls
(f x (cdr ls)))))))
(primitive-set! 'set-car!
(lambda (x y)
(unless (pair? x)
(error 'set-car! "~s is not a pair" x))
($set-car! x y)))
(primitive-set! 'set-cdr!
(lambda (x y)
(unless (pair? x)
(error 'set-cdr! "~s is not a pair" x))
($set-cdr! x y)))
(primitive-set! 'vector-ref
(lambda (v i)
(unless (vector? v)

View File

@ -2,16 +2,29 @@
(library (ikarus pairs)
(export
cons
cons set-car! set-cdr!
car cdr caar cdar cadr cddr caaar cdaar cadar cddar caadr cdadr
caddr cdddr caaaar cdaaar cadaar cddaar caadar cdadar caddar
cdddar caaadr cdaadr cadadr cddadr caaddr cdaddr cadddr cddddr)
(import
(only (ikarus) define if lambda pair? error quote let)
(rename (only (scheme) cons $car $cdr)
(only (ikarus) define if lambda pair? error quote let unless)
(rename (only (scheme) cons $car $cdr $set-car! $set-cdr!)
(cons sys:cons)))
(define cons (lambda (x y) (sys:cons x y)))
(define set-car!
(lambda (x y)
(unless (pair? x)
(error 'set-car! "~s is not a pair" x))
($set-car! x y)))
(define set-cdr!
(lambda (x y)
(unless (pair? x)
(error 'set-cdr! "~s is not a pair" x))
($set-cdr! x y)))
(define err
(lambda (who x)
(error who "invalid list structure ~s" x)))