Added optional args to string->vector

This commit is contained in:
Justin Ethier 2016-08-30 17:07:46 -04:00
parent def5bba06a
commit 0c941d2e8d

View file

@ -773,11 +773,9 @@
(loop (+ i 1) (loop (+ i 1)
(cons (string-ref str i) lst)))))) (cons (string-ref str i) lst))))))
(loop start '()))) (loop start '())))
;; TODO: need to extend string->list to take optional start/end args,
;; then modify this function to work with optional args, too
(define (string->vector str . opts) (define (string->vector str . opts)
(list->vector (list->vector
(string->list str))) (apply string->list (cons str opts))))
(define (string-copy str . opts) (define (string-copy str . opts)
(letrec ((len (string-length str)) (letrec ((len (string-length str))
(start (if (> (length opts) 0) (car opts) 0)) (start (if (> (length opts) 0) (car opts) 0))