(define-builtin string-upcase (x)
(code "make_lisp_string(xstring(" x ").toUpperCase())"))
-(define-raw-builtin slice (vector a &optional b)
- (js!selfcall
- "var vector = " (ls-compile vector) ";" *newline*
- "var a = " (ls-compile a) ";" *newline*
- "var b;" *newline*
- (when b (code "b = " (ls-compile b) ";" *newline*))
- "return vector.slice(a,b);" *newline*))
-
(define-raw-builtin funcall (func &rest args)
(js!selfcall
"var f = " (ls-compile func) ";" *newline*
(rplacd pointer ())
drop-a))))
(copy-list (nthcdr a seq))))
- ((arrayp seq)
- (if b
- (slice seq a b)
- (slice seq a)))
+ ((vectorp seq)
+ (let* ((b (or b (length seq)))
+ (size (- b a))
+ (new (make-array size :element-type (array-element-type seq))))
+ (do ((i 0 (1+ i))
+ (j a (1+ j)))
+ ((= j b) new)
+ (aset new i (aref seq j)))))
(t (not-seq-error seq))))