> Something about hex and dec are making vertical lists instead of horizontal
> lists, so join gets confused.
> 
>   hex =: '0123456789abcdef' {~ 16 16 #: ]
>   dec =: '0123456789' {~ 10 10 #: ]
> 
>   hex (1 2 3)
> 01
> 02
> 03
> 
> Why do hex and dec make transposed lists? Can they be rewritten to not do 
> this?

If hex made "horizontal lists", it would not be a list -- it would be a single 
character string, without any spaces between the two string hexadecimal 
representations.

Alternatively, hex could produce a box, using rank 1 to force the "horizontal" 
shape.

   hex =: [: < "1 hc {~ 16 16 #: ]
   hex 22
┌──┐
│16│
└──┘
   hex 22 23
┌──┬──┐
│16│17│
└──┴──┘
   hex 22 23 24
┌──┬──┬──┐
│16│17│18│
└──┴──┴──┘

Now, if you want to catenate them, open the boxes, append a space to each, and 
ravel the results, or use another "join" function as suggested previously.

   ,' ',"1~>hex 22+i.5
16 17 18 19 1a 

Alan

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to