From aa68b4fa9a94a5f9a9f4b1ea12395770ab363845 Mon Sep 17 00:00:00 2001 From: Vladimir Sedach Date: Mon, 14 Sep 2009 12:12:00 -0600 Subject: [PATCH] Replaced redundant string functions in utils.lisp with standard/library ones. --- src/utils.lisp | 20 -------------------- t/ref2test.lisp | 14 +++++++------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/utils.lisp b/src/utils.lisp index 37e996b..2f77f80 100644 --- a/src/utils.lisp +++ b/src/utils.lisp @@ -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 diff --git a/t/ref2test.lisp b/t/ref2test.lisp index 7c761a8..a654524 100644 --- a/t/ref2test.lisp +++ b/t/ref2test.lisp @@ -41,14 +41,14 @@ :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 -- 2.20.1