A fairer comparison:

   , til *: til (, til -: til %:) 5 
25 2.5 2.23607
   (*: , -: , %:) 5
25 2.5 2.23607

Fork still wins. And that's before we consider
the dyadic case.



----- Original Message -----
From: Roger Hui <[email protected]>
Date: Wednesday, March 11, 2009 22:16
Subject: Re: [Jprogramming] algebraic formalism excluding trains
To: Programming forum <[email protected]>

> Another example:
> 
>    , til *: til -: 5
> 25 2.5
>    (*:5),(-:5)
> 25 2.5
>    (*: , -:) 5
> 25 2.5
> 
> So far it looks like til is at least competitive with fork.
> Suppose you want f,g,h?  For fork, it's
>    (*: , -: , %:) 5
> 25 2.5 2.23607
> 
> For til,
>    , til (, til *: til -:) til %: 5
> 25 2.5 2.23607
> 
> That little displacement of the , from the middle
> to the left, in the expression , til f til g to effect f,g ,
> manifests undesirable consequences when you
> have to do f,g,h or f0,f1,f2,f3 etc.
> 
> 
> 
> ----- Original Message -----
> From: Roger Hui <[email protected]>
> Date: Wednesday, March 11, 2009 22:00
> Subject: Re: [Jprogramming] algebraic formalism excluding trains
> To: Programming forum <[email protected]>
> 
> > From  http://keiapl.org/rhui/remember.htm#fork0
> > 
> > ... 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.  ...
> > 
> > There are ways to create "fork-like" structures in J
> > using a conjunction.  That is, it is possible to have 
> > a "simpler" language by removing row 5 of the parse table 
> > http://www.jsoftware.com/help/dictionary/dicte.htm
> > but fork is so overwhelmingly important and useful
> > and it is worth the extra parse rule.
> > 
> > A conjunction that resembles (f &&& g) is the "til" 
> > operator in Rationalized APL.  See pages 36 and 37 in 
> > http://www.jsoftware.com/jwiki/Doc/Rationalized_APL
> > Til can be modeled in J as follows:
> > 
> > til=: 2 : 0
> >  (v y) u y
> > :
> >  (v y) u x
> > )
> > 
> > For example:
> >    f=: ('(f '&,)@(,&')')@":
> >    g=: ('(g '&,)@(,&')')@":
> >    comma=: , (','&,)
> > 
> >    comma til f til g 5
> > (f 5),(g 5)
> > 
> > But fork is much better.
> > 
> > 
> > 
> > ----- Original Message -----
> > From: Tracy Harms <[email protected]>
> > Date: Wednesday, March 11, 2009 12:05
> > Subject: [Jprogramming] algebraic formalism excluding trains
> > To: Programming forum <[email protected]>
> > 
> > > I've been asked whether a particular combinator can be 
> written 
> > readily> in J without relying on verb trains. I've replied in 
> > the 
> > > negative, but
> > > I'd like to put this before the J community so that my 
> answer 
> > > may be
> > > corrected if wrong, or perhaps supplemented.
> > > 
> > > Here is the entire conversation between me and Conal 
> Elliott, 
> > to date:
> > > 
> > > TH:  Rereading John Backus 1977; section 12.9 stands out. 
> > > Is that
> > > aspect of this much-lauded paper applied in Haskell?  ... 
> > > Does Haskell
> > > follow Backus' advice (esp. 12.9)?
> > > 
> > > CE:   I love that backus paper. which advice in 12.9 
> > > in particular?
> > > 
> > > TH:  I hear Backus advise an algebraic form, more 
> > > restrictive than
> > > systems of Church or Curry, so that equivalence (e.g.) is 
> more 
> > plain.> 
> > > CE:  I hear the same. Haskell does not follow that advice.
> > > 
> > > TH:  Backus' example is [f , g]o h = [f o h , g o h] which 
> > > I can write
> > > in J as (f;g)@h -: (f...@h;g...@h) How would I code it in Haskell?
> > > 
> > > CE:  it's called (&&&) in haskell and works for all arrows. on
> > > functions, it's (f &&& g) x = (f x , g x). See 
> > > http://bit.ly/11G2IH .
> > > and yes, (f &&& g) . h == (f . h &&& g . h)
> > > 
> > > TH:  Thanks for identifying (&&&). I think there is no 
> > > equiv. symbol
> > > in J. Instead, that meaning is implied syntactically; called 
> "fork".> > 
> > > CE:  if "fork" weren't already in J, could you define it 
> > > and use it
> > > conveniently?
> > > 
> > > TH:  No. J's verb trains (e.g. fork) allow separation-and-
> > > rejoining to
> > > be put in terms of functions, not structures of resulting values.
> > > 
> > > 
> > > My question to the J forum is: Have I erred or overlooked 
> anything?

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to