> +:`-:`% 128!:2 each 1 2 3

Remember that 128!:2 takes strings, not atomic reps, as left arguments.  

So this works if all your verbs are primitive or named, but not when they're 
anonymous and compound.  For example:

   +/`-:`% 128!:2 each 1 2 3
|domain error
|   +/`-:`%    128!:2 each 1 2 3

However, it is possible to build and execute arbitrary noun phrases from 
gerunds with a tacit verb. I'll be busy today, so I'll leave that as a little 
puzzle.  

-Dan


Please excuse typos; composed on a handheld device.

On Jan 23, 2013, at 10:56 PM, Thomas Costigliola <[email protected]> wrote:

> 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.333333│
> └─┴─┴────────┘
> 
> 
> 
> On Wed, Jan 23, 2013 at 10:36 PM, Dan Bron <[email protected]> wrote:
> 
>> 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 outlined, but a little more flexible).
>> 
>> More details here:  http://www.jsoftware.com/jwiki/DanBron/Snippets/DOOG . 
>> Caveat: I haven't tested this with J7 - in fact, I haven't even run it
>> in years.
>> 
>> -Dan
>> 
>> -----Original Message-----
>> From: [email protected] [mailto:
>> [email protected]] On Behalf Of bob therriault
>> Sent: Wednesday, January 23, 2013 5:06 PM
>> To: [email protected]
>> Subject: Re: [Jprogramming] applying >1 gerunds to a set of items
>> 
>> 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
>> 
>> On 2013-01-23, at 1:29 PM, Thomas Costigliola wrote:
>> 
>>> On Wed, Jan 23, 2013 at 4:05 PM, bob therriault <[email protected]
>>> 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...
>>> 
>>> 
>>>>  <@(+:`*:`%/."0) 3 4 5
>>>> +-+-+--+
>>>> |6|8|10|
>>>> +-+-+--+
>>>> 
>>>> or better,
>>>> 
>>>> +:`*:`%/. each 3 4 5  NB. each  is &.>
>>>> +-+-+--+
>>>> |6|8|10|
>>>> +-+-+--+
>>>> 
>>>> 
>>>> 
>>> ... but these don't work correctly. If you look at the output it
>>> doesn't match your first example. +:`*:`%/. applies at rank zero, so
>>> each application applies the whole gerund to jus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to