Skip to content

Instantly share code, notes, and snippets.

@rebolek
Last active February 7, 2018 10:11
Show Gist options
  • Select an option

  • Save rebolek/da7f38e0e7a641000ad70a43660f2abc to your computer and use it in GitHub Desktop.

Select an option

Save rebolek/da7f38e0e7a641000ad70a43660f2abc to your computer and use it in GitHub Desktop.
Red[]
join: func [
"Reduce values in a block and joins them into a string"
block [block!]
/with "Add delimiter between values"
delimiter
/trim "Remove NONE values"
] [
if empty? block [return ""]
block: reduce block
if trim [block: system/words/trim block]
if with [
with: make block! 2 * length? block
foreach value block [repend with [value delimiter]]
block: head remove back tail with
]
append copy "" block
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment