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] Is there an 'inverse" to evoke

2019-05-03 Thread 'Pascal Jasmin' via Programming
there is this: names '' IFJ6 IFQT  names added by: searchvar =: 3 : 0 nms {::~ :: (''"_) 1 i.~ > ( wrote: (This probably shows my ignorance,) but if y is a variable then y points to some values.  I’d like to know “the pointer” rather than "the values”.    I very/extremely vaguely under

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] ambivalent tacit verb with Self-Reference

2019-05-03 Thread 'robert therriault' via Programming
Adding to Raul's solution, it can be simplified a little by removing the excess ]'s pad =: (1&$:) : ((0,.~0,.0,~0,]) ^:[ ) pad i. 3 4 0 0 0 0 0 0 0 0 1 2 3 0 0 4 5 6 7 0 0 8 9 10 11 0 0 0 0 0 0 0 > On May 3, 2019, at 9:37 AM, Raul Miller wrote: > > pad =: (1&$:@]) : ((0,.~0,.

Re: [Jprogramming] ambivalent tacit verb with Self-Reference

2019-05-03 Thread Raul Miller
pad =: (1&$:@]) : ((0,.~0,.0,~0,]) ^:[ ]) Thanks, -- Raul On Fri, May 3, 2019 at 12:35 PM Brian Schott wrote: > > How do I create the verb `pad` below so that the first and the last > expressions below produce the same result? > >pad =: (1&$:@]) : (0,.~0,.0,~0,]) ^:[ ] >$ 1 pad i.

[Jprogramming] ambivalent tacit verb with Self-Reference

2019-05-03 Thread Brian Schott
How do I create the verb `pad` below so that the first and the last expressions below produce the same result? pad =: (1&$:@]) : (0,.~0,.0,~0,]) ^:[ ] $ 1 pad i. 3 4 5 6 $ 2 pad i. 3 4 7 8 $ pad i. 3 4 3 4 25 26 -- (B=) --

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] Is there an 'inverse" to evoke

2019-05-03 Thread jjj .
The list of names is finite, and accessible with reflection tools.  That is, ultimately, "inverse" of ". is ". and the inverse of ~ is ~ (both of these statements are wrong, the latter wronger than the former). Seeing as you're using "variable", I'll take it you're only interested in "reverse-e

Re: [Jprogramming] Is there an 'inverse" to evoke

2019-05-03 Thread Devon McCormick
Based on what Henry says, this means J cannot distinguish between: var=. i.3 'var' -: v var and 'var' -: v i.3 If you are willing to live with false positives, you could do something ridiculous like this: nl 0 +---+-+++--+ |BASEDSK|DBGFL|DEBUGSTARTUP|IFJ6|ISW

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

2019-05-03 Thread Piet de Jong
I like the solution c=: 1 : ',/ y u/. ~i.# y’ Seems to work fine.Except for where the gerund is something like g=.(+/)`(-/) It appears that in this case rank information is required as in g=.(+/“1)`(-/“1) > On 3 May 2019, at 9:24 pm, R.E. Boss wrote: > > What about > > c=: 1 : ',/ y

Re: [Jprogramming] Is there an 'inverse" to evoke

2019-05-03 Thread Henry Rich
A noun is replaced by its value before the sentence is executed. Henry Rich On 5/3/2019 8:28 AM, Piet de Jong wrote: (This probably shows my ignorance,) but if y is a variable then y points to some values. I’d like to know “the pointer” rather than "the values”.I very/extremely vaguely

Re: [Jprogramming] Is there an 'inverse" to evoke

2019-05-03 Thread Piet de Jong
(This probably shows my ignorance,) but if y is a variable then y points to some values. I’d like to know “the pointer” rather than "the values”.I very/extremely vaguely understand these things work on stacks with the y values loaded on a stack before v gets to act on them. That is why pe

Re: [Jprogramming] Is there an 'inverse" to evoke

2019-05-03 Thread Henry Rich
Impossible - v never sees y, only its value. Henry Rich On 5/3/2019 6:58 AM, Piet de Jong wrote: If m is the name (ie string) of a variable then ‘m'~ is the value of the variable. Is there an “inverse" to this? That is I want a verb v (or adverb or conjunction) so that if y is a variable th

Re: [Jprogramming] Is there an 'inverse" to evoke

2019-05-03 Thread Piet de Jong
Yes, I want v (or adverb or conjunction) such that ‘var’-: v var is 1. Similar to var -: “. ‘var’ being 1.So in a sense I want the inverse of “. (“undo” ?) > On 3 May 2019, at 9:42 pm, Louis de Forcrand wrote: > > If you mean a textual representation of the array y, check ": . >

Re: [Jprogramming] Is there an 'inverse" to evoke

2019-05-03 Thread Louis de Forcrand
If you mean a textual representation of the array y, check ": . Otherwise if you want something like this var=: i.3 'var' -: v var 1 then I doubt that such a v exists. Cheers, Louis > On 3 May 2019, at 12:58, Piet de Jong wrote: > > If m is the name (ie string) of a variable then ‘m'~ i

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
What about c=: 1 : ',/ y u/. ~i.# y' *:`-:`^ c 3 2 1 0 3 2 1 9 1 2.7182818 0 1.5 7.3890561 1 It is one of the repeating questions in this forum and IIRC this solution was provided by Dan Bron (pity he is less active on this forum then he used to be). R.E. Boss > -Oorspronkelijk berich

[Jprogramming] Is there an 'inverse" to evoke

2019-05-03 Thread Piet de Jong
If m is the name (ie string) of a variable then ‘m'~ is the value of the variable. Is there an “inverse" to this? That is I want a verb v (or adverb or conjunction) so that if y is a variable then v y is the name (ie string) of the variable.

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
*:`-:`^/.~ 3 5$ 2 4 4 16 4 16 4 4 16 4 16 4 2 1 2 1 2 0 0 0 0 0 Is not what you want, I presume. R.E. Boss > -Oorspronkelijk bericht- > Van: Programming > Namens Piet de Jong > Verzonden: vrijdag 3 mei 2019 10:16 > Aan: Programming forum > Onderwerp: Re: [Jprogramming] Appl

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