X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fstring.lisp;h=8fe63688dd31ad102ca31773f434927b62abd6c1;hb=6475d2c606e3295d58ce44c069271fd617d9d00f;hp=8bead9b5573383120cf35282e09b0d0041052152;hpb=65fcf13c9c86650a2df27e8c1fc435aff6cc1e5e;p=jscl.git diff --git a/src/string.lisp b/src/string.lisp index 8bead9b..8fe6368 100644 --- a/src/string.lisp +++ b/src/string.lisp @@ -13,6 +13,15 @@ ;; You should have received a copy of the GNU General Public License ;; along with JSCL. If not, see . +(defun stringp (s) + (stringp s)) + +(defun make-string (n &key initial-element) + (make-array n :element-type 'character :initial-element initial-element)) + +;; (defun char-to-string (x) +;; (make-string 1 :initial-element x)) + (defun string (x) (cond ((stringp x) x) ((symbolp x) (symbol-name x)) @@ -38,9 +47,6 @@ (when (and (= i (1- len-1)) (> len-2 len-1)) (return-from string< (1+ i)))))))) -(defun stringp (s) - (stringp s)) - (define-setf-expander char (string index) (let ((g!string (gensym)) (g!index (gensym)) @@ -50,3 +56,16 @@ (list g!value) `(aset ,g!string ,g!index ,g!value) `(char ,g!string ,g!index)))) + +(defun concatenate-two (string1 string2) + (let* ((len1 (length string1)) + (len2 (length string2)) + (string (make-array (+ len1 len2) :element-type 'character)) + (i 0)) + (dotimes (j len1) + (aset string i (char string1 j)) + (incf i)) + (dotimes (j len2) + (aset string i (char string2 j)) + (incf i)) + string))