[REBOL] Problem with try [ open/direct/binary tcp://... ] Re:(8)
From: joel:neely:fedex at: 3-Oct-2000 6:48
Errmm... I'm not so sure it's a bug!
[Al--Bri--xtra--co--nz] wrote:
> eventi wrote:
> > And I havn't seen an elegant way to concatenate binary! type data.
> > Join would be nice.
> >
> > >> probe join #{012345} [ #{0123} ]
> > #{012345237B303132337D}
>
> Have you tried 'join? Like this:
>
> >> join #{012345} #{0123}
> == #{0123450123}
>
> It seems simpler to me. BUT! It also looks to me that you've found
> a bug in rebol, that seems odd.
>
>> foo: probe join #{012345} [ #{0123} ]
#{012345237B303132337D}
== #{012345237B303132337D}
OK, that's the odd-looking thingie. What does it actually contain?
>> foreach c foo [
[ use [cc] [
[ cc: to-char c
[ print [c "^-" enbase/base to-string cc 16 "^-" cc]
[ ]
[ ]
1 01
35 23 #
69 45 E
35 23 #
123 7B {
48 30 0
49 31 1
50 32 2
51 33 3
125 7D }
So, it appears that join took the content of the block, converted it
to a string, and concatenated the bytes of the string onto the binary
value that was its first argument, and gave back that result.
Compare and contrast with
>> join #{32} [1234]
== #{3231323334}
and
>> foo: probe join #{012345} #{0123}
#{0123450123}
== #{0123450123}
-jn-