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, > > ;@

[Jprogramming] Using PLOT package: how to position text

2013-09-08 Thread Ian Shannon
Hi there, I am using the PLOT package. When using the pd commands text, textc and textr, we have ... Argument is x y text, where x y are coordinates relative to the current window. with x, y element of [0 .. 1000] or pixels (using x suffix). This is fine for some situations, but I would like

Re: [Jprogramming] Bayesian inference?

2013-09-08 Thread Bill Harris
"Shaw, Ewart" writes: > [This is a belated follow-up to posts by Bill Harris & Mike Day, Aug 30th & > 31st] > > I think Mike Day's probably right in recommending following up links > between J, R & BUGS. Note also the recently published (August 2007) > paperback "Bayesian Computation with R" by

[Jprogramming] Grids in Plot

2013-09-08 Thread David Vincent-Jones
I am trying to change the grid x and y spacing in the plot routine and am having a problem finding the correct option. Help would be appreciated. David -- For information about J forums see http://www.jsoftware.com/forums.htm