Hi Phil,
This should work:
>> rejoin [v1 v2 v3]
== #{01237B30337D237B34347D}
but it doesn't, due to a bug acknowledged by Carl. Until it gets fixed
the best I can think of is to use:
rejoin-fixed: func [
"Reduces and joins a block of values."
block [any-block!] "Values to reduce and join"
/local result
][
if empty? block [return ""]
either series? result: first block: reduce block [
result: copy :result
][
result: form result
]
either any-block? :result [
foreach i next block [
insert tail :result :i
]
][
foreach i next block [
if any-block? i [i: rejoin-fixed i]
append result i
]
]
:result
]
>> rejoin-fixed [v1 v2 v3]
== #{010344}
This "fixed" version of REJOIN shows a couple of other differences,
which I think are improvements:
>> rejoin []
** Script Error: Out of range or past end.
** Where: append either series? first block
>> rejoin-fixed []
== ""
>> rejoin [[1 2 3][4 5 6][7 8 9]]
== [1 2 3 [4 5 6] [7 8 9]]
>> rejoin-fixed [[1 2 3][4 5 6][7 8 9]]
== [1 2 3 4 5 6 7 8 9]
>> rejoin-fixed [0 [1 2 3][4 5 6][7 8 9]]
== "0123456789"
>> rejoin [0 [1 2 3][4 5 6][7 8 9]]
== "01 2 34 5 67 8 9"
>> rejoin ['a/b/c 'd/e/f 'g/h/i]
** Script Error: Cannot use path on word! value.
** Where: insert tail series :value
>> rejoin-fixed ['a/b/c 'd/e/f 'g/h/i]
== a/b/c/d/e/f/g/h/i
I'd be very grateful to hear opinions or suggestions.
Eric
>Suggestions !!!
>
>v1: #{01}
>v2: #{03}
>v3: #{44}
>
>What's the most efficient way of concatenating v1, v2 and v3
>
>Obviously, I can use:
>
>append v1 v2
>append v1 v3
>
>However, if I have X vars to concatenate this is unwieldy.
>
>Phil Hayes