add vectro funtion
This commit is contained in:
parent
4d6c2d99fe
commit
819a2e6a96
|
@ -286,6 +286,8 @@
|
||||||
(let ((n (exact (sqrt k))))
|
(let ((n (exact (sqrt k))))
|
||||||
(values n (- k (square n)))))
|
(values n (- k (square n)))))
|
||||||
|
|
||||||
|
;;; 6.3 Booleans
|
||||||
|
|
||||||
(define (boolean=? . objs)
|
(define (boolean=? . objs)
|
||||||
(define (every pred list)
|
(define (every pred list)
|
||||||
(if (null? list)
|
(if (null? list)
|
||||||
|
@ -296,6 +298,7 @@
|
||||||
(or (every (lambda (x) (eq? x #t)) objs)
|
(or (every (lambda (x) (eq? x #t)) objs)
|
||||||
(every (lambda (x) (eq? x #f)) objs)))
|
(every (lambda (x) (eq? x #f)) objs)))
|
||||||
|
|
||||||
|
;;; 6.5. Symbols
|
||||||
|
|
||||||
(define (symbol=? . objs)
|
(define (symbol=? . objs)
|
||||||
(define (every pred list)
|
(define (every pred list)
|
||||||
|
@ -311,3 +314,14 @@
|
||||||
(eq? x sym)))
|
(eq? x sym)))
|
||||||
(cdr objs))
|
(cdr objs))
|
||||||
#f)))
|
#f)))
|
||||||
|
|
||||||
|
;;; 6.8. Vector
|
||||||
|
|
||||||
|
(define (vector . objs)
|
||||||
|
(let ((len (length objs)))
|
||||||
|
(let ((v (make-vector len)))
|
||||||
|
(do ((i 0 (+ i 1))
|
||||||
|
(l objs (cdr l)))
|
||||||
|
((< i len)
|
||||||
|
v)
|
||||||
|
(vector-set! v i (car l))))))
|
||||||
|
|
Loading…
Reference in New Issue