Re: [Jprogramming] Applying different verbs to different items.

2019-05-04 Thread R.E. Boss
: vrijdag 3 mei 2019 14:43 > Aan: Programming forum > Onderwerp: Re: [Jprogramming] Applying different verbs to different items. > > I like the solution > > c=: 1 : ',/ y u/. ~i.# y’ > > Seems to work fine.Except for where the gerund is something like > >

Re: [Jprogramming] Applying different verbs to different items.

2019-05-04 Thread jjj .
Thanks for the warm welcome guys! I’ve missed you too! I haven’t been far, and there isn’t a device I own without J installed on it ;)  -Dan PS: As for what took me so long: honestly, the medium. Email is massively inconvenient relative to alternatives available in 2019. I also don’t think we’r

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Jose Mario Quintana
Welcome back indeed! What took you so long Dan? ;) On Fri, May 3, 2019 at 11:10 AM Vijay Lulla wrote: > Welcome back, Dan! Great to see you back on the forums after a long time! > I have learned a lot from your emails and your code scripts...and I > expect to learn more from your future eng

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Jose Mario Quintana
This verb might accomplish what you want, process=. 4 : '(x ; (5!:1)<''y'')`:6'"0 *: ` -: `^ process 3 1 0 9 0.5 1 *: ` -: `^ process i.3 5 0 1 4 9 16 2.5 33.5 4 4.5 22026.5 59874.1 162755 442413 1.2026e6 I there a tacit (verb) count

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread 'Pascal Jasmin' via Programming
adverb trains need parenthesizing of adverbs (outer parens below are superfluous, but prove anonymity) *: ` -: `^ (/.("1)(&.|:)) i.3 5 On Friday, May 3, 2019, 2:54:21 a.m. EDT, Piet de Jong wrote: Thanks for looking at this.  The problem (or maybe I misunderstand) with this solution

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Raul Miller
For repeating items, you can reshape the short argument so it matches the long argument. FYI, -- Raul On Fri, May 3, 2019 at 5:04 AM Ric Sherlock wrote: > > I think /.~ works fine until there are repeated items. So >g=: *:`-:`^ >c=: /.~ >g c 3 1 0 3 NB. probably not the desired r

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Vijay Lulla
Welcome back, Dan! Great to see you back on the forums after a long time! I have learned a lot from your emails and your code scripts...and I expect to learn more from your future engagement. Cordially, Vijay. On Fri, May 3, 2019 at 9:55 AM jjj . wrote: > I haven't read this whole thread, so

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread jjj .
I haven't read this whole thread, so apologies if this has already been covered, but many many moons ago I wrote a util to do this: https://code.jsoftware.com/wiki/User:Dan_Bron/Snippets/DOOG    g=. *: ` -: `^    y=. 3 1 0    g Across y 9 0.5 1 It's more general than that, but Across wa

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Piet de Jong
> > R.E. Boss > > >> -Oorspronkelijk bericht- >> Van: Programming >> Namens Piet de Jong >> Verzonden: vrijdag 3 mei 2019 11:20 >> Aan: Programming forum >> Onderwerp: Re: [Jprogramming] Applying different verbs to different items. >

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Louis de Forcrand
This subject regularly pops up every now and then, and it reminds me of something I wrote a little while back that might interest you. I found a couple of errors in them (oops) so I’m copying them here in hope that they are of help to you. They aren’t pretty or succinct but they work. (Code at b

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread R.E. Boss
orspronkelijk bericht- > Van: Programming > Namens Piet de Jong > Verzonden: vrijdag 3 mei 2019 11:20 > Aan: Programming forum > Onderwerp: Re: [Jprogramming] Applying different verbs to different items. > > Thanks for pointing the problem with repeated items. > > “resp

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Ric Sherlock
This thread http://www.jsoftware.com/pipermail/programming/2009-August/015981.html suggests that there isn't an obvious elegant way to do this. Especially if you want a dyadic solution. For me the take home result was the following verb which ended up in my utility box which I find more elegant th

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Piet de Jong
Thanks for pointing the problem with repeated items. “respectively” (I looked at the code) appears to be a long complicated explicitly defined conjunction. I was hoping for something succinct and elegant that I could add to my bag of tricks (and understanding). > On 3 May 2019, at 7:04 pm,

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Ric Sherlock
I think /.~ works fine until there are repeated items. So g=: *:`-:`^ c=: /.~ g c 3 1 0 3 NB. probably not the desired result 9 9 0.5 0 1 0 Using respectively works ok and also allows for dyadic verb use in the gerund. c2=: respectively ] g c2 3 1 0 3 9 0.5 1 9 g c2 i. 3 4 0 1

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread R.E. Boss
Re: [Jprogramming] Applying different verbs to different items. > > Following all the suggestions, the following seems to get close >g=. *: ` -: `^ >c=. /.~ > > g c i.3 4 > 0 2 4 6 > > 2 2.5 3 3.5 > > 16 18 20 22 > >$ g c i.3 4 > 3 1 4 > &g

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Piet de Jong
Following all the suggestions, the following seems to get close g=. *: ` -: `^ c=. /.~ g c i.3 4 0 2 4 6 2 2.5 3 3.5 16 18 20 22 $ g c i.3 4 3 1 4 The only annoying thing are the final dimensions, fixed up with ,”2 > On 3 May 2019, at 5:04 pm, Piet de Jong wrote: > > c=:((128!:2)&.

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread Piet de Jong
c=:((128!:2)&.><)”0 seems to work great. Will have to work out exactly why it works — don’t understand the why the rank 0 boxing makes things happen the right way. > On 3 May 2019, at 2:32 pm, Gilles Kirouac wrote: > > or (not as simple) > > c=: (128!:2)&.>< > > g c"0 y > > ┌─┬───┬─┐ >

Re: [Jprogramming] Applying different verbs to different items.

2019-05-03 Thread 'Rob Hodgkinson' via Programming
Yes, a little tricky due to gerund binding with oblique. If you really want a “c” for now (someone else may suggest a tacit way overnight) you can use explicit as here; c=: 4 : '(x/."1 &. |:)y’ g=. *: ` -: `^ y=. 3 1 0 ] yy=.3 2$2#yy 3 3 1 1 0 0 g c y 9 0.5 1 g c yy 9 9 0.5

Re: [Jprogramming] Applying different verbs to different items.

2019-05-02 Thread Piet de Jong
Thanks for looking at this. The problem (or maybe I misunderstand) with this solution is that there is no real “c” in the sense that g c y is the required answer.That is *:`-:`^ (/."1 &. |:) i. 3 5 (where c is the stuff in brackets) doesn’t work. > On 3 May 2019, at 3:58 pm,

Re: [Jprogramming] Applying different verbs to different items.

2019-05-02 Thread 'robert therriault' via Programming
Hi Piet, I am not sure how simple it is, but combining Rob's excellent insight on oblique with Transpose, Under and rank 1 you get this: (*:`-:`^ /.)"1 &. |: i. 3 5 0 1 4 9 16 2.5 33.5 4 4.5 22026.5 59874.1 162755 442413 1.2026e6 The tr

Re: [Jprogramming] Applying different verbs to different items.

2019-05-02 Thread Piet de Jong
Thanks! But it doesn’t appear to generalise to applying successive verbs in the gerund to successive >>items<< in y. (I checked the dictionary re /. and it talks of “collections” of y. Not sure what that means) For example if y is i.3 5 then I’d like the first verb in the gerund to apply

Re: [Jprogramming] Applying different verbs to different items.

2019-05-02 Thread Ric Sherlock
Another option load 'misc/miscutils/utils' +:`-:`^ respectively] 3 1 0 6 0.5 1 NB. or if the results of each cell are different shapes ... +:`-:`^ respectively> 3 1 0 +-+---+-+ |6|0.5|1| +-+---+-+ The spec for the conjunction respectively as given in the script: NB. u is gerund, v is a

Re: [Jprogramming] Applying different verbs to different items.

2019-05-02 Thread Gilles Kirouac
or (not as simple) c=: (128!:2)&.>< g c"0 y ┌─┬───┬─┐ │9│0.5│1│ └─┴───┴─┘ Try removing "0 Le 2019-05-02 à 22:35, 'Rob Hodgkinson' via Programming a écrit : > Hi Piet, not ignorant at all ! > > Try using oblique (an obscure feature is that the u in u/. can be a gerund, > in which case it is

Re: [Jprogramming] Applying different verbs to different items.

2019-05-02 Thread 'Rob Hodgkinson' via Programming
Hi Piet, not ignorant at all ! Try using oblique (an obscure feature is that the u in u/. can be a gerund, in which case it is evoked cell wise); g=. *: ` -: `^ y=. 3 1 0 g /. y 9 0.5 1 Found in Section 15 of https://www.jsoftware.com/books/pdf/brief.pdf

[Jprogramming] Applying different verbs to different items.

2019-05-02 Thread pietdion
Hopefully not an ignorant question. Am looking for a simple (tacit, non complicated) construction (verb? adverb? conjunction?) “c" that takes a gerund and applies the successive verbs in the gerund to successive items. A simple example is g=. *: ` -: `^ y=. 3 1 0 g c y 9 0.5 1