Skip to content

Commit

Permalink
type declarations for join and concat
Browse files Browse the repository at this point in the history
  • Loading branch information
vindarel committed Oct 23, 2020
1 parent e6f9c67 commit 51feb40
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions str.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,17 @@
Remove newlines."
(ppcre:regex-replace-all "\\s+" s " "))

(declaim (ftype (function (&rest (or string))
(or string))
concat))
(defun concat (&rest strings)
"Join all the string arguments into one string."
(apply #'concatenate 'string strings))

(declaim (ftype (function ((or character string)
(cons string))
string)
join))
(defun join (separator strings)
"Join all the strings of the list with a separator."
(let ((separator (replace-all "~" "~~" (string separator))))
Expand Down

0 comments on commit 51feb40

Please sign in to comment.