Commit 57b773fb authored by Pascal J. Bourguignon's avatar Pascal J. Bourguignon

Replaced implementation of concat.

parent 953813ae
......@@ -687,8 +687,13 @@ RETURN: true if there was such an entry, or false otherwise.
(defun indentation (level leftp)
(format nil "~{~A~}" (loop :repeat level :collect (if leftp "| " " "))))
(defun concat (&rest args)
(apply (function concatenate) 'string args))
(defun concat (&rest items)
(with-output-to-string (*standard-output*)
(dolist (item items)
(typecase item
(string (write-string item))
(sequence (write-sequence item))
(t (with-standard-io-syntax (format t "~A" item)))))))
(defun string-butlast (str)
(if (plusp (length str))
......
......@@ -1630,17 +1630,15 @@ POST: (<= start index end)
(defmacro sconc (&rest args)
"Concatenate strings."
`(concatenate 'string ,@args))
(defun concat (&rest args)
"Concatenate anything into a string."
(apply (function concatenate) 'string
(mapcar (lambda (item)
(if (typep item 'sequence)
item
(format nil "~A" item))) args)))
`(concat ,@args))
(defun concat (&rest items)
(with-output-to-string (*standard-output*)
(dolist (item items)
(typecase item
(string (write-string item))
(sequence (write-sequence item))
(t (with-standard-io-syntax (format t "~A" item)))))))
(defmacro scase (keyform &rest clauses)
"
......
......@@ -1052,7 +1052,10 @@ that are accessible by the user."
(defun concat (&rest items)
(with-output-to-string (*standard-output*)
(dolist (item items)
(write-string item))))
(typecase item
(string (write-string item))
(sequence (write-sequence item))
(t (with-standard-io-syntax (format t "~A" item)))))))
(defun mapconcat (function sequence separator)
(etypecase sequence
......
......@@ -715,13 +715,13 @@ that are accessible by the user."
:name nil :type nil :version nil)
rootpath nil)))
(defun concat (&rest args)
"Concatenate anything into a string."
(apply (function concatenate) 'string
(mapcar (lambda (item)
(if (typep item 'sequence)
item
(format nil "~A" item))) args)))
(defun concat (&rest items)
(with-output-to-string (*standard-output*)
(dolist (item items)
(typecase item
(string (write-string item))
(sequence (write-sequence item))
(t (with-standard-io-syntax (format t "~A" item)))))))
(defun mapconcat (function sequence separator)
;; 1- mon_key on irc://irc.freenode.org/#lisp signaled that nil are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment