I didn't know what you meant by right to left.  Returning to your question,

 >         When longer trains of verbs (and other language components) are
 >         created in Tacit J, why is the fork/hook grammar better than
 >         right to left grammar?
 >
 >      I haven't come across any explanation of the reason for the
 > change in grammar.

the following from Roger's Remembering Ken Iverson ( 
http://keiapl.org/rhui/remember.htm#sec1 ) may help.  Roger is remembering the 
implementation of J:

Ken and I had in mind to implement A Dictionary of APL [8] together with hooks 
and forks (phrasal forms) [20]. For years, Ken had struggled to find a way to 
write f+g as in calculus, from the “scalar operators” in Operators and 
Functions 
[5, section 4], through the “til” operator in Practical Uses of a Model of APL 
[6] and Rationalized APL [7, p. 18], and finally forks. Forks are defined as 
follows:
          (f g h) y     <-->     (f y) g (h y)
        x (f g h) y     <-->     (x f y) g (x h y)
Moreover, (f g p q r) <--> (f g (p q r)) . Thus to write f+g as in calculus, 
one 
writes f+g in J. Ken and Eugene McDonnell worked out the details on the long 
plane ride back from APL88 in Sydney, Australia, with Ken coming up with the 
initial idea on waking up from a nap.

The choice to implement forks was fortuitous and fortunate. We realized only 
later [32] that forks made tacit expressions (operator expressions) complete in 
the following sense: any sentence involving one or two arguments that did not 
use its arguments as an argument to an operator, can be written tacitly with 
fork and @: (compose) and [ (left) and ] (right) and constant functions. If @: 
were replaced by the equivalent special fork [: f g , then a sentence can be 
written as an unbroken train (sequence of forks).


Don Watson wrote:
> Hi Kip,
> 
>         You said:
> 
>> To me, forks and trains are part of the right to left grammar, so your
>> question really puzzles me!  Something like
> 
>>    ([: %: [: +/ *:) 3 4  NB. The square root of the sum of squares of 3 4
>> 5
> 
>     A true right to left that parallels interactive J would be:
> 
>         (%: +/ *:) 3 4
> 5
> 
>     Evaluated as follows:
> 
>     Square the list:    9 16
>     Sum the list:        25
>     Square root:         5
> 
>     With tacit J
> 
>         1)    Three verbs together in parentheses form a fork, so you have
>                 to stop it after two verbs with [:
>         2)    Two verbs together form a hook, so you have to stop the hook
>                 with another [:
> 
>         ([: %: [: +/ *:) 3 4
> 
>     My point has always been that in simple cases fork/hook grammar is
> wordier and more difficult to understand.
> 
>     That says nothing about complex examples, which I accept will probably 
> be better expressed in fork/hook grammar. I am hoping to get some examples 
> that will prove that point.
> 
>         Don
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to