add join function to stdlib
Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
parent
386d0900a9
commit
3d0d8d8215
4 changed files with 18 additions and 2 deletions
|
|
@ -146,3 +146,13 @@ adds a directory to PATH'
|
|||
(rem (cdr path-iter)))
|
||||
(echo pat)
|
||||
(set (q path-iter) (pop rem))))))
|
||||
|
||||
(def join
|
||||
'concatenates list elements into a string, while
|
||||
interspersing a provided delimiter in between elements'
|
||||
(list delim)
|
||||
(reduce (lambda (res elem)
|
||||
(if (eq? (strlen res) 0)
|
||||
(string elem)
|
||||
(concat res delim elem)))
|
||||
list))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue