Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Thomas Costigliola
Yet another way is to use apply, although there will be no implicit cyclic extension of the gerund... +:`-:`% 128!:2 each 1 2 3 ┌─┬─┬┐ │2│1│0.33│ └─┴─┴┘ On Wed, Jan 23, 2013 at 10:36 PM, Dan Bron wrote: > After the verb @ gerund behavior was decommissioned in J5, I wrot

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Dan Bron
After the verb @ gerund behavior was decommissioned in J5, I wrote a utility to emulate it. As a use case for the utility, I implemented an adverb which lets you apply successive verbs (a gerund) to a corresponding list of nouns. The underlying mechanism is ;. (similar to the /. approach Thomas

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Raul Miller
The gerund/. approach being discussed in other messages is interesting. -- Raul On Wed, Jan 23, 2013 at 5:03 PM, R.E. Boss wrote: > You apply the verbs which make the gerund, to the items. > Perhaps I should have set " ... apply a set of gerunds to a noun." > > > R.E. Boss > > >> -Oorspronk

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Marshall Lochbaum
You're right about the 3 : error--I make that mistake far too often. However, you missed my statement afterward that apply should be used with rank _1. The "0 _ on apply is not there for loop control, and I know that normal `:0 will have the same results. It's just to clarify how apply works, sinc

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread bob therriault
Thomas, Funny how you see what you want to see, when you think you have a solution :) How about this: <"0@|:@(+:`*:`%/.) 3 4 5 +-+--+---+ |6|16|0.2| +-+--+---+ or if no boxing required: |:@(+:`*:`%/.) 3 4 5 6 16 0.2 I agree that it is not quite as clean as it used to be. Cheers, bob

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread R.E. Boss
That was what I came up to myself, more or less, but I thought I was overlooking a tacit construction. You know perhaps the puzzles of trying with a few given numbers to build another given number by using only elementary mathematical operators and an arbitrary amount of (matching) parentheses.

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread R.E. Boss
You apply the verbs which make the gerund, to the items. Perhaps I should have set " ... apply a set of gerunds to a noun." R.E. Boss > -Oorspronkelijk bericht- > Van: programming-boun...@forums.jsoftware.com > [mailto:programming-boun...@forums.jsoftware.com] Namens bob therriault >

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Raul Miller
On Wed, Jan 23, 2013 at 3:51 PM, Thomas Costigliola wrote: > BTW, I miss being able to do this > > <@(+:`*:`%)/. 3 4 5 NB. Removed from language! You could use something like this: Atop=: 2 :0 if. _1 = nc<'m' do. m=. {.u`'' end. if. _1 = nc<'n' do. n=. {.v`'' end. m (4 :'{. (x`:6)@(y`:6)`'

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Thomas Costigliola
On Wed, Jan 23, 2013 at 4:05 PM, bob therriault wrote: > Nice Thomas, > > I had not thought of oblique. > > You can still do this, although it is clunkier: > > <@(+:`*:`%/.) 3 4 5 > +---+ > | 6| > | 16| > |0.2| > +---+ > I was hoping to box each row as you attempted below... ><@(+:`*:`%/."

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread bob therriault
Nice Thomas, I had not thought of oblique. You can still do this, although it is clunkier: <@(+:`*:`%/.) 3 4 5 +---+ | 6| | 16| |0.2| +---+ <@(+:`*:`%/."0) 3 4 5 +-+-+--+ |6|8|10| +-+-+--+ or better, +:`*:`%/. each 3 4 5 NB. each is &.> +-+-+--+ |6|8|10| +-+-+--+ Cheers, bob On 201

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread greg heil
Do you mean taking a set of objects, eg o=:7 8 1 and applying a gerund of verbs eg g=: +`|.`3: to it? Like g `:0 o 7 8 1 1 8 7 3 0 0 ? greg ~krsnadas.org -- from:Thomas Costigliola to: J Programming Forum date:23 January 2013 12:51 subject: Re: [Jprogrammin

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Thomas Costigliola
I use /. (Oblique-Key ) with a gerund for this since the obliques of rank 1 arrays are the items. wrote: > This sounds sensible, but if you tested your code, you should notice two > things: > > First, 3 :'x,y' gives a domain error or a value error (depending on > context). To fix this you have

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Raul Miller
This sounds sensible, but if you tested your code, you should notice two things: First, 3 :'x,y' gives a domain error or a value error (depending on context). To fix this you have several options: You can remove the x -- probably not what you want. You can change the 3 to a 4 -- probably the si

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Marshall Lochbaum
I think you mean to apply each gerund to a corresponding item of the argument? In any case, I would suggest just making an apply verb apply =: 3 : 'x`:0 y' "0 _ and applying it with the appropriate rank (_1 by my interpretation). Since you understand rank, this is a general solution to an entire

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Aai
Perhaps a mapping like ((%:`*:`:0) ; (>:`<:`+:`:0)) [ 1 2 3 ┌─┬─┐ │1 1.41421 1.73205│2 3 4│ │1 4 9│0 1 2│ │ │2 4 6│ └─┴─┘ On 23-01-13 18:29, R.E. Boss wrote: In http://www.jsoftware.com/help/dictionar

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread Raul Miller
On Wed, Jan 23, 2013 at 12:29 PM, R.E. Boss wrote: > In > http://www.jsoftware.com/help/dictionary/d612.htm (`: n) is explained, but > how do I apply a set of gerunds to one set of items? That's what already happens, but if you want to match t

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread bob therriault
Do you mean matching the gerunds to the corresponding items? My initial take would be to apply m `:0 to atoms using rank "0 and then take the diagonal of the result. (<0 1)&|:@:(+`*`|`:0"0) 2 3 4 2 1 4 Cheers, bob On 2013-01-23, at 9:29 AM, R.E. Boss wrote: > In

[Jprogramming] applying >1 gerunds to a set of items

2013-01-23 Thread R.E. Boss
In http://www.jsoftware.com/help/dictionary/d612.htm (`: n) is explained, but how do I apply a set of gerunds to one set of items? R.E. Boss -- For information about J f

Re: [Jprogramming] [Jprogrammingou Hermitian from triangular

2013-01-23 Thread km
Related: ic5 =: [: , [: j./&i:/ +. ic5 1j2 _1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2 Kip Sent from my iPad On Jan 23, 2013, at 3:06 AM, "Linda Alvord" wrote: > Also: > > g=: 13 :',(i:0{+.y)j./i:1{+.y' > g > [: , ([: i: 0 { +.) j./ [: i: 1 { +. > g 1j2 >

Re: [Jprogramming] [Jprogrammingou Hermitian from triangular

2013-01-23 Thread km
Not bad! Kip Sent from my iPad On Jan 23, 2013, at 3:06 AM, "Linda Alvord" wrote: > Also: > > g=: 13 :',(i:0{+.y)j./i:1{+.y' > g > [: , ([: i: 0 { +.) j./ [: i: 1 { +. > g 1j2 > _1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2 > > > Linda > > -Original Message---

Re: [Jprogramming] [Jprogrammingou Hermitian from triangular

2013-01-23 Thread Linda Alvord
Also: g=: 13 :',(i:0{+.y)j./i:1{+.y' g [: , ([: i: 0 { +.) j./ [: i: 1 { +. g 1j2 _1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2 Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Beh