Viktor, > The choice of the Backus' example led you two to translation of > FL idioms into J and Haskell idioms.
It seems to me that Backus' example was abstract, not an FL expression, but I agree if you are saying that each language will bear peculiarities as code is written to express this single concept. > 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. If I understand &&& to some degree, it not only receives two functions as arguments but results in two distinct function-results. What I definitely do not understand is how such "parallel" functions are subsequently managed in Haskell, nor am I working here to learn that. The similarity I see (or, mistakenly imagine) between &&& and fork turns on the fact that a fork divides and rejoins computation. The center tine of the fork is where the dual results of the paired function get dealt with. This rejoining or converging aspect of fork is not, I think, part of the semantics of &&&. In the previously posted Twitter discussion I proposed that fork is akin to &&& in order to correct the impression that Link (;) can be taken as equivalent to &&&. Readers unfamiliar with J might think that because ; occurred in my J example in the same location as &&& occurs in the Haskell construction. I'll study you comments further, and I thank you for them. The difficulties of understanding allegedly basic function relationships across these two different functional languages have been much greater and more persistent than I'd anticipated. The fact that I have been stubbornly trying to see everything in terms of J presumably has contributed to this. Tracy On Thu, Mar 12, 2009 at 2:49 AM, Viktor Cerovski <[email protected]> wrote: > >> 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 > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
