Just to be complete, Dyalog also allows the insertion
of a dynamic function (DFN) "inline"; however it requires explicit params:
DYALOG APL J6.01
2{⍺+⍵}3 2(4 : 'x.+y.')3
5 5
{⍺+⍵} / 2 3 4 (4 : 'x.+y.')/ 2 3 4
9 9
2{+}3 2(+)3
SYNTAX ERROR 5
2{+}3
∧
~ Gilles
---------- Original Message -----------
From: "Morten Kromberg" <[EMAIL PROTECTED]>
To: "'Chat forum'" <[email protected]>
Sent: Thu, 27 Dec 2007 15:59:47 +0100
Subject: RE: [Jchat] J readability
> Sorry, did not explain that very well. Unlike most APL systems,
> Dyalog allows the result of an expression to be a function/verb. So
> as J allows you to write:
>
> add =: +
>
> Dyalog allows
>
> add←+
> or add←{a+w}
>
> Now, while ". in J seems not to want to return verbs or (and you CAN
> understand its reluctance), the Dyalog execute primitive is less
> picky ("Explicit" in J seems a rather odd beast too, even the term
> "special syntax" doesn't quite seem sufficient to describe the
> workings of 3:0 :-)). So you can write:
>
> add←exec'{a+w}'
>
> ... after which:
>
> add/1 2 3
> 6
>
> ... and if you load up the dfns workspace which contains a "user-
> defined" rank operator (http://www.dyalog.dk/dfnsdws/n_rank.htm):
>
> 1 2 (add rank 0 1) 2 2 {reshape} 10 20 30 40
> 11 21
> 32 42
>
> Morten
>
> -----Original Message-----
> From: Raul Miller [mailto:[EMAIL PROTECTED]
> Sent: 24. december 2007 14:09
> To: Chat forum
> Subject: Re: [Jchat] J readability
>
> On Dec 24, 2007 4:53 AM, Morten Kromberg <[EMAIL PROTECTED]> wrote:
> > Also, I don't see how 3: can be "more flexible than DFNS".
> > I can use execute to turn a string into a DFN, which surely
> > gives me the same functionality as 3: ?
>
> I am not familiar enough with the syntactic capabilities of Dyalog's
> execute to say for sure.
>
> But, 3 : can be used in place, with modifiers or any other part
> of J's execution capability.
>
> Also, I tend to think of 3 : not as an entity to itself but as
> an instance of the : operator. So things that hold for 3 :
> also hold for 0 :, for 1 :, for 2 :, for 4 : and maybe for 13 :
> (I do tend to think of u : as something not so related,
> because u : does not treat strings, nor boxed strings,
> nor 0 in the same fashion as the other : forms treat
> them.)
>
> Anyways, can you use ({thorn}DFN)/1 2 3 in Dyalog,
> as a simple example? (Practical examples in
> J are more likely to use the rank conjunction, but I do
> not want to push this into territory I know is currently
> irrelevant.)
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
------- End of Original Message -------
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm