My proposal is roughly identical to Jose's 2nd proposal, with the possible enhancement/difference that: where A1 and A2 are trains of 0 or more adverbs (a a... a), then
The conjunction (A1 c A2) would be equivalent to the explicit 2 : 'u A1 c v A2' Though I'm likely oversimplifying, this would only change the current parsing implementation from syntax error to conjunction. The 3rd proposal (a v) is interesting. I'd guess it could be implemented without a drastic parsing change. Or within the above change, and called with (v Atop a) where Atop =: 1 : '(u y) & u)' (I think) While I don't completely understand the first proposal it did cause me to attempt a new tacit version of coerce =: 2 : '[`[email protected]' this at least parses: (]`)(@.]) but < (]`)(@.])(0=L.) 2 ┌─┐ │1│ NB. returns result of test instead of y └─┘ instead of: < coerce (0=L.) 2 ┌─┐ │2│ └─┘ ----- Original Message ----- From: Raul Miller <[email protected]> To: Programming forum <[email protected]> Cc: Sent: Thursday, October 10, 2013 9:26:34 AM Subject: Re: [Jprogramming] How to make this conjunction tacit http://www.jsoftware.com/pipermail/programming/2013-February/031684.html might interest you. -- Raul On Thu, Oct 10, 2013 at 8:11 AM, Pascal Jasmin <[email protected]> wrote: > creating a conjunction tacitly is hacky or impossible. currently the train > (a c) is a syntax error. What I'd suggest instead is that it be treated as a > conjunction. So the explicit (2 : ']`[email protected]') could be written as (]`@.) > > If 1 conjunction is present in what whould otherwise be an adverb train, then > the train should be a conjunction whose right v argument will be lifted into > the train and placed to the right of the individual conjunction inside the > train > > More generally, an adverb train that includes a conjunction is a conjunction > that you may bind as any other conjunction (u (a a c)) becomes the adverb ((u > a a) c), and (a a c)v becomes 'a a c v', and (c a)v would be the adverb '(c > v) a' > > > > the above was a refinement to this musing: > > What I would suggest instead is that @: be a "super conjunction". If it was > deemed that a tacit version of: 'u a c v' is worthwhile, then (a c @:) would > do it. (c @:) would make the adverbe (c v), and (@: c) would make the adverb > (u c). One actual usefulness for this might be: (c1 @:) (c2 @:) v1 v2 might > turn into (c1 v1) (c2 v2) or just (c1 v1) (c1 v1). >> >> An alternative to @: as "super conjunction" would be [: . ([: c a a a a) >> and (a a a a c [:) > > > > ----- Original Message ----- > From: Raul Miller <[email protected]> > To: Programming forum <[email protected]> > Cc: > Sent: Thursday, October 10, 2013 12:14:48 AM > Subject: Re: [Jprogramming] How to make this conjunction tacit > > I do not have any reasonable idea what you are talking about here. > > Can you give some examples? > > Thanks, > > -- > Raul > > On Wed, Oct 9, 2013 at 9:48 PM, Pascal Jasmin <[email protected]> wrote: >> A bit more on the super- conjunction idea, it turns out that it is not quite >> needed. Instead, >> >> (a a c a) should be a conjunction interpreted as (a a (c (v a))) where v is >> the right hand verb. The total train would be: '(u a a) c (v a)' >> >> it could also be possible to understand (c1 c2) as (u c1) (c2 v), and if so >> then >> >> (a a c1 a c2 a) would be: '(u a a c1) a (c2 v a)' >> >> There could not be more than 2 conjunctions in an adverb train without the >> super conjunction ([: or ]:) idea, but 2 is a big increase over 0. >> >> >> ----- Original Message ----- >> From: Pascal Jasmin <[email protected]> >> To: "[email protected]" <[email protected]> >> Cc: >> Sent: Monday, October 7, 2013 5:10:47 PM >> Subject: Re: [Jprogramming] How to make this conjunction tacit >> >> >> >> Regarding the archeology archive, not all of those seem like good ideas. >> What I would suggest instead is that @: be a "super conjunction". If it was >> deemed that a tacit version of: 'u a c v' is worthwhile, then (a c @:) would >> do it. (c @:) would make the adverbe (c v), and (@: c) would make the >> adverb (u c). One actual usefulness for this might be: (c1 @:) (c2 @:) v1 >> v2 might turn into (c1 v1) (c2 v2) or just (c1 v1) (c1 v1). >> >> An alternative to @: as "super conjunction" would be [: . ([: c a a a a) >> and (a a a a c [:) >> >> >> ----- Original Message ----- >> From: Dan Bron <[email protected]> >> To: [email protected] >> Cc: >> Sent: Monday, October 7, 2013 4:23:36 PM >> Subject: Re: [Jprogramming] How to make this conjunction tacit >> >> Pascal asked: >>> How to make this conjunction tacit >>> coerce =: 2 : ']`[email protected]' >> >> >> coerce =: ^: >> >> < coerce (0=L.) 2 >> +-+ >> |2| >> +-+ >> < coerce (0=L.) <2 >> +-+ >> |2| >> +-+ >> >> This particular coercion is also available as a ready-made utility in the >> standard library as "boxopen" and its cousin "boxxopen" (which is the same >> except it leaves empty arguments unboxed). >> >> Note that it was trivial to write coerce tacitly because we have a primitive >> conjunction that fits the bill (obviating the need for a user-defined >> conjunction). In the general case, it is not possible to write tacit >> conjunctions. To understand why, read through section §II.F in the DoJ, and >> note that while there are rules for producing tacit verbs (e.g. "fork" for >> +/ # %) and adverbs (e.g. "adverb train" for /\) there are no rules which >> produce conjunctions. >> >> That said, it may be possible to synthesize or simulate a tacit conjunction >> through a series of tacit adverbs, e.g.: >> >> shanghai=.(`]) (`(;:'`@.')) (@.(0 2 1 3)) >> >> (0=L.) < yyy >> >> <`]@.(0 = L.) >> >> But these tend to be very convoluted, difficult to both write and >> understand, and will commonly involve some degree of quoted code anyway, so >> it is just as well (actually, better) to write them explicitly in the first >> place. >> >> One more note: depending on your needs, you might prefer (0<L.) to (0=L.) . >> The former boxes only unboxed nouns; the latter boxes unboxed nouns as well >> as anything with a depth _greater_ than one (e.g. try <<2, <<<2, etc). >> >> -Dan >> >> PS: In the good old days, §II.F contained a long and rich table of >> interpretations for various trains (i.e. sequences of words/word-classes) >> which made it possible, among other things, to write conjunctions tacitly. >> >> Again, these turned out to be convoluted and difficult, and consequently >> infrequently used in practice. In turn, it was decided that the cost of >> supporting the trains table (i.e. scanning all the possibilities for every >> single sentence of J executed) was worth less than they were worth, so the >> decision was made to remove it and simplify both the language and the >> interpreter. >> >> That happened in J5, I believe. Anyway, for those interested in >> archaeology, or simply in what the language used to permit, check out the >> old trains table available at [1] and reproduced below. The rows having >> product="conj" were all the ways a J programmer could express conjunctions >> tacitly. >> >> [1] Cache of J4 Dictionary §II.F: >> http://www.cs.trinity.edu/About/The_Courses/cs2322/jdoc/dict/dictf.htm >> >> Train Product Interpretation >> -------- ------- --------------------- >> N0 V1 N2 noun x V1 y >> V0 V1 V2 verb (x V0 y) V1 (x V2 y) >> V0 V1 C2 conj V0 V1 (x C2 y) >> A0 V1 V2 adv (x A0) V1 V2 >> C0 V1 V2 conj (x C0 y) V1 V2 >> C0 V1 C2 conj (x C0 y) V1 (x C2 y) >> A0 A1 V2 conj (x A0) (y A1) V2 >> A0 A1 A2 adv ((x A0) A1) A2 >> C0 A1 A2 conj ((x C0 y) A1) A2 >> N0 C1 N2 verb x (N0 C1 N2) y >> N0 C1 V2 verb x (N0 C1 V2) y >> N0 C1 A2 adv N0 C1 (x A2) >> N0 C1 C2 conj N0 C1 (x C2 y) >> V0 C1 N2 verb x (V0 C1 N2) y >> V0 C1 V2 verb x (V0 C1 V2) y >> V0 C1 A2 adv V0 C1 (x A2) >> V0 C1 C2 conj V0 C1 (x C2 y) >> A0 C1 N2 adv (x A0) C1 N2 >> A0 C1 V2 adv (x A0) C1 V2 >> A0 C1 A2 conj (x A0) C1 (y A2) >> A0 C1 C2 conj (x A0) C1 (x C2 y) >> C0 C1 N2 conj (x C0 y) C1 N2 >> C0 C1 V2 conj (x C0 y) C1 V2 >> C0 C1 A2 conj (x C0 y) C1 (y A2) >> C0 C1 C2 conj (x C0 y) C1 (x C2 y) >> N0 A1 verb x (N0 A1) y >> N0 C1 adv N0 C1 x >> V0 N1 noun V0 y >> V0 V1 verb x (or y) V0 V1 y >> V0 A1 verb x (V0 A1) y >> V0 C1 adv V0 C1 x >> A0 V1 adv (x A0) V1 >> A0 A1 adv (x A0) A1 >> A0 C1 adv (x A0) C1 x >> C0 N1 adv x C0 N1 >> C0 V1 adv x C0 V1 >> C0 A1 conj (x C0 y) A1 >> >> >> ---------------------------------------------------------------------- >> 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 > ---------------------------------------------------------------------- > 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
