> What provoked your doubt? In learning J, I've stumbled from one false assumption to another. Mainly about verb composition. Were I to be the only person to experience this, it could be put down to a weak intellect. But if my experience is not uncommon, it points to a need for J documentation to be better.
Just today, whilst testing an explication utility I have on the chocks, I thought I'd stumbled on yet another unwarranted assumption I'd been making in the code. It was one I could not easily check from the standard reference material. To be sure I needed to ask on the forum. The problem with J documentation as it's structured, is that to compose 2 verbs you naturally think of a conjunction -- and J has a wealth of those. Far more than APL. If you want to choose a suitable conjunction you can read its description in Voc. But hooks and forks, especially Capped Fork, compose verbs too, yet they're not documented in a comparable way. You have to be au-fait with the Dic chapter on Trains, or Chapter 40 of JforC. It's my contention that experienced programmers learn a new language by reading the reference manual as they go along, one feature at a time. They don't digest an armful of primers or textbooks up-front, no matter how exciting and readable. Learning J, that approach just happens to induce a blind spot over Capped Fork -- and verb-trains in general. Ian On Thu, Nov 29, 2012 at 5:44 PM, Dan Bron <j...@bron.us> wrote: > Right. For this reason (or similar ones, like when g is a train), I phrase > the identity as ([: f g) ↔ f@:(g) . > > As to where this is stated: well, it's recorded informally in innumerable > documents and J learning materials. If you're looking for formal > guarantees in canonical material (the DoJ), you'll have to arrive at the > equivalence through a chain of logic. > > First, we have the the definition of capped fork in §II.F, following the > definition of non-capped fork [1]: > > (A) "If f is a cap ([:) the capped branch simplifies the forks to > i. g h y and > ii. g x h y" > (B) "The ranks of the hook and fork are infinite." > > Then, we have the definition of @: in the vocabulary [2]: > > (C) "@: is equivalent to @ except that ranks are infinite." > > Which refers back to the definition of @, which is given in the Vocabulary > as [3]: > > (D) " u@v y ↔ u v y" > (E) "x u@v y ↔ u x v y . > > So, after adjusting for the different names given to the verbs, we the > following correspondences: > > (Ai) "([: f g) y ↔ g h y" vs (D) "f@g y ↔ f g y" > (Aii) "x ([: f g) y ↔ g x h y" vs (E) "x f@g y ↔ u f g y" > > (B) "The ranks of the hook and fork are infinite" vs > (C) "@: is equivalent to @ except that ranks are infinite." > > Which, as far as I can tell, establishes the identity ([: f g) ↔ f@:g > (provided we heed the advice given in latter's definition, i.e. "because a > conjunction applies to the entity immediately to its right, expressions to > the right of conjunctions commonly require parenthesization.") > > What provoked your doubt? > > -Dan > > [1] §II.F, definition of trains > http://www.jsoftware.com/help/dictionary/dictf.htm > > [2] Vocabulary entry for @: > http://www.jsoftware.com/help/dictionary/d622.htm > > [3] Vocabulary entry for @ > http://www.jsoftware.com/help/dictionary/d620.htm > > -----Original Message----- > From: programming-boun...@forums.jsoftware.com [mailto:programming- > boun...@forums.jsoftware.com] On Behalf Of bob therriault > Sent: Thursday, November 29, 2012 12:00 PM > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] @: and capped fork > > HI Ian, > > If your v includes an adverb such as / the long left reach of conjunctions > could get you into trouble. That would be part of the parsing rules for > verbs vs conjunctions. > > (+:@:+/) 3 4 5 > 42 > ([:+:+/) 3 4 5 > 24 > > Cheers, bob > > On 2012-11-29, at 8:49 AM, Ian Clark wrote: > >> Department of Sudden Doubts... >> >> If u and v are verbs, do (u@:v) and ([: u v) really behave the same >> under all circumstances? >> >> If so, where would I go to find this fact written up? >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm