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