Last active
June 21, 2019 14:53
-
-
Save nedzadarek/126da5fa8cb92a9ce4b9e2665c17817b to your computer and use it in GitHub Desktop.
rejoin using mold
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rejoin*: func ["Reduces and joins a block of values." | |
block [block!] "Values to reduce and join" | |
][ | |
if empty? block: reduce block [return block] | |
append either (series? first block) [copy first block] [ | |
mold first block | |
] next block] | |
some_word: "foo:" | |
word: to-word "some_word" | |
lit-word: to-lit-word "some_lit-word" | |
path: [to[something 42]] | |
path1: to-path [path to something] | |
lit-path: to-lit-path [lit path to something] | |
string: "str" | |
tag: <tag> | |
file: %file | |
bl: [a b c] | |
probe rejoin* [ | |
word | |
":foo:" | |
] | |
"some_word:foo:" | |
; "some_word:foo:" | |
probe rejoin* [ | |
'word | |
":foo:" | |
] | |
"word:foo:" | |
; "word:foo:" | |
probe rejoin* [ | |
lit-word | |
":foo:" | |
] | |
"'some_lit-word:foo:" | |
; "'some_lit-word:foo:" | |
probe rejoin* [ | |
lit-word | |
":foo:" | |
] | |
"'some_lit-word:foo:" | |
; "'some_lit-word:foo:" | |
probe rejoin* [ | |
path1 | |
":foo:" | |
] | |
path/to/something/":foo:" | |
; path/to/something/":foo:" | |
probe rejoin* [ | |
lit-path | |
":foo:" | |
] | |
'lit/path/to/something/":foo:" | |
; 'lit/path/to/something/":foo:" | |
probe rejoin* [ | |
string | |
":foo:" | |
] | |
"str:foo:" | |
; "str:foo:" | |
probe rejoin* [ | |
tag | |
":foo:" | |
] | |
<tag:foo:> | |
; <tag:foo:> | |
probe rejoin* [ | |
file | |
":foo:" | |
] | |
%file:foo: | |
; %file:foo: | |
probe rejoin* [ | |
bl | |
":foo:" | |
] | |
[a b c ":foo:"] | |
; [a b c ":foo:"] | |
rejoin* [#foo 3] | |
; "#foo3" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment