Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Roger Hui
0j_40 ": x: ".40$'1234567890' 1.2345678901234568469964621180726096691200e39 0j_40 ": ". 'x',~ 40$'1234567890' 1.2345678901234567890123456789012345678900e39 Extended precision behaviour is explicit because they consume an order of magnitude more resource, and it is undesirable for users t

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Dan Bron
Does it? Even for integral arguments (i.e. where the internal datatype guarantees that the numbers are whole)? Any idea why? How did you discover this conversion? -Dan Please excuse typos; composed on a handheld device. On Sep 15, 2013, at 4:47 PM, Raul Miller wrote: > On Sun, Sep 15, 2013

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Raul Miller
On Sun, Sep 15, 2013 at 10:42 AM, Dan Bron wrote: > Yep. Put an 'x' behind or a 'x:' in front. Note, also, that x: in front generates a floating point representation of the number as an intermediate result. This would be good in contexts where too much precision was undesirable (where we think

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Alex Giannakopoulos
Thanks for pointing that out, Dan! On 15 September 2013 15:42, Dan Bron wrote: Now, while these two sentences are theoretically fungible, and &.": is cute, > in reality ":^:_1 is monad ". , which is dangerous (":^:_1 '1!:55 ...' > for > example). > > So, if I were going to apply this code to u

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Dan Bron
vice-versa). -Dan -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Alex Giannakopoulos Sent: Sunday, September 15, 2013 9:48 AM To: J Programming forum Subject: Re: [Jprogramming] Joining up a rank-1 array of int

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Alex Giannakopoulos
Yup that did it! ":^:_1 'x',~ -.&' ' ": 1234567 456789 23345567 34446 12345674567892334556734446 Shoulda thought of it! Cheers, Raul! On 15 September 2013 14:40, Raul Miller wrote: > On Sun, Sep 15, 2013 at 9:34 AM, Alex Giannakopoulos > wrote: > > How can I incorporate an x: (or equiva

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Raul Miller
On Sun, Sep 15, 2013 at 9:34 AM, Alex Giannakopoulos wrote: > How can I incorporate an x: (or equivalent) into the "ijoin" verb, to > ensure correct bignums? You might append an 'x' to the right hand side of the numeric string? Thanks, -- Raul -- ---

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-15 Thread Alex Giannakopoulos
n > > -Original Message- > From: programming-boun...@forums.jsoftware.com > [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of R.E. Boss > Sent: Monday, September 09, 2013 5:28 AM > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Joining up a rank-1 array of integer

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-09 Thread Dan Bron
un...@forums.jsoftware.com] On Behalf Of Dan Bron Sent: maandag 9 september 2013 5:48 To: programm...@jsoftware.com Subject: Re: [Jprogramming] Joining up a rank-1 array of integers That's one of my favorite J idioms! A similarly elegant phrase arising from the use of -. is (, '/' -.~ {:)

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-09 Thread R.E. Boss
Dan Bron Sent: maandag 9 september 2013 5:48 To: programm...@jsoftware.com Subject: Re: [Jprogramming] Joining up a rank-1 array of integers That's one of my favorite J idioms! A similarly elegant phrase arising from the use of -. is (, '/' -.~ {:) '/some/path' . This ensures all

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Dan Bron
That's one of my favorite J idioms! A similarly elegant phrase arising from the use of -. is (, '/' -.~ {:) '/some/path' . This ensures all paths end in a slash, without duplicating slashes in paths that are already in canonical form. To appreciate its elegance, write an analogous function on a

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread bill lam
I used the fork [-.-. for interesetion. (-. twice again) Вс, 08 сен 2013, Joey K Tuttle писал(а): > Another (related, and also using -. (twice!)) expression that I use a > lot for getting just the digits from a string - > >digits=: -.&(a.-.'0123456789') > >digits ": 23 45 6 > 23456 > >

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Joey K Tuttle
Another (related, and also using -. (twice!)) expression that I use a lot for getting just the digits from a string - digits=: -.&(a.-.'0123456789') digits ": 23 45 6 23456 On 2013/09/08 19:54 , Alex Giannakopoulos wrote: That 'less' verb is very useful, I'd never had occasion to use i

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
That 'less' verb is very useful, I'd never had occasion to use it until now! It could have been a bit more hyped up in the documentation, though, I'd never even seen it used before! (blush) On 9 September 2013 03:46, Alex Giannakopoulos wrote: > Ah, OK, now I got it! > > (": 23 45 6) -. ' ' > >

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
Ah, OK, now I got it! (": 23 45 6) -. ' ' 23456 It wasn't working because I used the empty string '' instead of the blank string ' '. Doh! On 9 September 2013 03:31, bob therriault wrote: > Well Dan usually comes up with the really insightful answers, but what I > see happening is that

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
Also it works inline, e.g. -.&' ' &. ": 12 3 4 67 09 0 9 but not in a definition, i.e. ijoin =: ;@cut &. ": works, but ijoin =: (-.&'') &. ": does not. On 9 September 2013 03:14, Dan Bron wrote: > Try -.&' ' in place of ;@cut > > -Dan > > Please excuse typos; composed on a handheld device.

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread bob therriault
Well Dan usually comes up with the really insightful answers, but what I see happening is that & is forcing the ' ' as the right argument. When you supply your right argument it moves to the left side of -. and then the ' ' (empty spaces) are removed. Hope this helps, bob On 2013-09-08, at 7:

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
Great, thanks very much! How does that parse, though? I don't follow. I see a "hook"? of (NOT bond) and , although it's obviously not a hook since '' is not a verb. What am I missing? On 9 September 2013 03:14, Dan Bron wrote: > Try -.&' ' in place of ;@cut > > -Dan > > Please excuse typos;

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread bob therriault
On second thought this would work for single integers into a number, but if you wanted to stay with a string, Dan's solution is the better way to go. Cheers, bob On 2013-09-08, at 7:15 PM, bob therriault wrote: > Hi Alex, > > For base 10 this might work. > > t=: 3 4 5 6 > 10 #. t > 3456 >

[Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Alex Giannakopoulos
Hi - I need to join up a list of integers (presented as a rank-1 array) into a single number. At the moment I am using the following, ;@ cut &. ": which works, but I wonder if there is something better, not using the supplied 'cut' verb, which seems like overkill. Any suggestions hints pointers

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread bob therriault
Hi Alex, For base 10 this might work. t=: 3 4 5 6 10 #. t 3456 Cheers, bob On 2013-09-08, at 7:07 PM, Alex Giannakopoulos wrote: > Hi - I need to join up a list of integers (presented as a rank-1 array) > into a single number. > > At the moment I am using the following, > > ;@ cut &. "

Re: [Jprogramming] Joining up a rank-1 array of integers

2013-09-08 Thread Dan Bron
Try -.&' ' in place of ;@cut -Dan Please excuse typos; composed on a handheld device. On Sep 8, 2013, at 10:07 PM, Alex Giannakopoulos wrote: > Hi - I need to join up a list of integers (presented as a rank-1 array) > into a single number. > > At the moment I am using the following, > > ;@