> 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.

Tracy, &&& is not an equivalent of fork.  Notice that even if (f;g)@h 
from J translates as (f &&& g) . h, one still cannot translate (f g h)
from J into some expression involving &&& since &&& takes only
two functions for its arguments.   (f g h) from J could be translated
with help of the class arrow referred to in the link above as:

f &&& h >>> arr (uncurry (g))

In this example, however, class Arrow alone won't do it since we 
use >>> from the Category class from which Arrow is derived.

The choice of the Backus' example led you two to translation of 
FL idioms into J and Haskell idioms.

-- 
View this message in context: 
http://www.nabble.com/algebraic-formalism-excluding-trains-tp22462258s24193p22471471.html
Sent from the J Programming mailing list archive at Nabble.com.

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

Reply via email to