From 819a2e6a967b8770e921d24f150a063fdace130b Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 14 Nov 2013 17:58:12 +0900 Subject: [PATCH] add vectro funtion --- piclib/built-in.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/piclib/built-in.scm b/piclib/built-in.scm index 42d71cb4..9e84c567 100644 --- a/piclib/built-in.scm +++ b/piclib/built-in.scm @@ -286,6 +286,8 @@ (let ((n (exact (sqrt k)))) (values n (- k (square n))))) +;;; 6.3 Booleans + (define (boolean=? . objs) (define (every pred list) (if (null? list) @@ -296,6 +298,7 @@ (or (every (lambda (x) (eq? x #t)) objs) (every (lambda (x) (eq? x #f)) objs))) +;;; 6.5. Symbols (define (symbol=? . objs) (define (every pred list) @@ -311,3 +314,14 @@ (eq? x sym))) (cdr objs)) #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))))))