Replaced redundant string functions in utils.lisp with
authorVladimir Sedach <vsedach@gmail.com>
Mon, 14 Sep 2009 18:12:00 +0000 (12:12 -0600)
committerVladimir Sedach <vsedach@gmail.com>
Mon, 14 Sep 2009 18:12:00 +0000 (12:12 -0600)
standard/library ones.

src/utils.lisp
t/ref2test.lisp

index 37e996b..2f77f80 100644 (file)
@@ -1,25 +1,5 @@
 (in-package "PARENSCRIPT")
 
-(defun string-join (strings separator)
-  (format nil "~{~}" (format nil "~~a~~^~a" separator) strings))
-
-(defun string-split (string separators &key (keep-separators nil) (remove-empty-subseqs nil))
-  (do ((len (length string))
-       (i 0 (1+ i))
-       (last 0)
-       res)
-      ((= i len)
-       (let ((split (if (> i last)
-                     (cons (subseq string last i) res)
-                     res)))
-         (nreverse (if remove-empty-subseqs
-                       (delete "" split :test #'string-equal)
-                       split))))
-    (when (member (char string i) separators)
-      (push (subseq string last i) res)
-      (when keep-separators (push (string (char string i)) res))
-      (setf last (1+ i)))))
-
 (let ((cache (make-hash-table :test 'eq)))
   (defun symbol-name-to-js-string (symbol)
     "Given a Lisp symbol or string, produces to a valid JavaScript
index 7c761a8..a654524 100644 (file)
                                      :test #'char=)))
            (strip-indentation (str indentation)
              (if indentation
-                 (parenscript::string-join (mapcar #'(lambda (str)
-                                          (if (> (length str) indentation)
-                                              (subseq str indentation)
-                                              str))
-                                      (parenscript::string-split str (list #\Newline)))
-                              (string #\Newline))
+                 (format nil "~{~A~^
+~}"
+                         (mapcar (lambda (str)
+                                   (if (> (length str) indentation)
+                                       (subseq str indentation)
+                                       str))
+                                 (cl-ppcre:split "\\n" str)))
                  str))
-
            (make-test ()
              (let* ((sep-pos (search "=>" built))
                     (cr-before-sep  (when sep-pos