(defun get-universal-time ()
(+ (get-unix-time) 2208988800))
-(defun concat (&rest strs)
- (!reduce #'concat-two strs ""))
-
(defun values-list (list)
(values-array (list-to-vector list)))
(when b (code "b = " (ls-compile b) ";" *newline*))
"return vector.slice(a,b);" *newline*))
-(define-builtin char (string index)
- (code string "[" index "]"))
-
-(define-builtin concat-two (string1 string2)
- (js!selfcall
- "var r = " string1 ".concat(" string2 ");" *newline*
- "r.stringp = 1;"
- "return r;" *newline*))
-
(define-raw-builtin funcall (func &rest args)
(js!selfcall
"var f = " (ls-compile func) ";" *newline*
(defun make-string (n &key initial-element)
(make-array n :element-type 'character :initial-element initial-element))
+(defun char (string index)
+ (unless (stringp string) (error "~S is not a string" string))
+ (storage-vector-ref string index))
+
(defun string (x)
(cond ((stringp x) x)
((symbolp x) (symbol-name x))
`(aset ,g!string ,g!index ,g!value)
`(char ,g!string ,g!index))))
-(defun concatenate-two (string1 string2)
+
+(defun concat-two (string1 string2)
(let* ((len1 (length string1))
(len2 (length string2))
(string (make-array (+ len1 len2) :element-type 'character))
(aset string i (char string2 j))
(incf i))
string))
+
+(defun concat (&rest strs)
+ (!reduce #'concat-two strs ""))