thank you. I'm still not able to combine into one line (which IIUC can be done
with verb defines)
flag1_z_ =: 0 [ controlA_z_ =: 1 : ('flag1_z_ =: 1';'o=. u y';'flag1_z_ =:
0';'o')
btw, The dyad version define is:
(flag1_z_ =: 0) [ controlA_z_ =: 1 : ('flag1_z_ =: 1';'o=. u y';'flag1_z_ =:
0';'o';':';'flag1_z_ =: 1';'o=. x u y';'flag1_z_ =: 0';'o')
----- Original Message -----
From: Don Guinn <[email protected]>
To: General forum <[email protected]>
Cc:
Sent: Friday, September 13, 2013 12:18:34 PM
Subject: Re: [Jgeneral] Bug in adverb define
Need to add parens.
controlA_z_ =: 1 : ('flag1_z_ =: 1';'o=. u y';'flag1_z_ =: 0';'o')
On Fri, Sep 13, 2013 at 9:18 AM, Pascal Jasmin <[email protected]>wrote:
> The following in a script should work according to
> http://www.jsoftware.com/help/dictionary/dicth.htm
> flag1_z_ =: 0
> controlA_z_ =: 1 : 'flag1_z_ =: 1';'o=. u y';'flag1_z_ =: 0';'o'
>
> It results in a syntax error script in J7. The syntax error can be
> eliminated by changing 1 : to 3 :
>
> The adverb (and definition) works as a 4 line definition. Its purpose is
> to send control flags to a verb which changes its behaviour if called with
> the adverb. The importance of getting it on one line is that supporting
> dyads would take a multiline definition 10 lines with the ending ), and its
> the type of utility function that can be cloned to control2A control3A and
> so, single line definitions are more reusable.
>
> The multiline version is:
> controlA_z_ =: 1 : 0
> flag1_z_ =: 1
> o=. u y
> flag1_z_ =: 0
> o
> )
>
> Ideally I'd like to be able to write a definition line such as:
>
> flag1_z_ =: 0 [ controlA_z_ =: 1 : 'flag1_z_ =: 1';'o=. u y';'flag1_z_ =:
> 0';'o'
>
> (which does load if '1 :' changed to '3 :')
> ----------------------------------------------------------------------
> 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