Somewhat surprisingly (to me)
av2=: 1 : 'm*-~'
also works the same way.
Cheers, bob
On 2010-12-14, at 4:48 PM, Tikkanz wrote:
> Or just
> adv2 =: 1 : (':';'m*y-x')
>
> See http://www.jsoftware.com/help/dictionary/d310n.htm
> and http://www.jsoftware.com/help/dictionary/dicth.htm
>
> On Wed, Dec 15, 2010 at 1:39 PM, bill lam <[email protected]> wrote:
>> In pre-historic J, multi-line explicit definition was defined as array of
>> boxed strings.
>> adv2=: 1 : ('';':';'m*y-x')
>>
>> Срд, 15 Дек 2010, Graham Parkhouse писал(а):
>>> How can I write an adverb that returns a noun from 3 noun arguments x, m and
>>> y as a *one liner*?
>>>
>>> Just 2 arguments is fine:
>>> adv1=: 1 : 'm*y'
>>> 3 adv1 10
>>> 30
>>>
>>> 3 arguments like this doesn't work:
>>> adv2=: 1 : 'm*y-x'
>>> 5 (3) adv2 10
>>> |domain error
>>> | 5 (3)adv2 10
>>>
>>> Giving it a body works:
>>> adv3=: 1 : 0
>>> :
>>> m*y-x
>>> )
>>> 5 (3) adv3 10
>>> 15
>>>
>>> Is there a way to do it as one liner?
>>>
>>> Regards
>>>
>>> Graham Parkhouse
>>>
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> --
>> regards,
>> ====================================================
>> GPG key 1024D/4434BAB3 2008-08-24
>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm