Inline comments follow... > Hi all ! > > I tried out the functionality of Jx and got some problems. > I expected these two expressions to be equivalent, but got syntax error > on the second. > > +(".. '/') 1 2 3 > 6 > +(".. [: / ]:) 1 2 3
One issue is that ]: is an adverb and adverbs can only act on nouns and verbs. Adverbs and conjunctions must be provided as atomic representations or equivalent. The current documentation is incomplete and will be fixed; thank you for noticing this problem. To wit, the adverb can be boxed using ]: as follows, an=. <@:((":0) ,&< ]) NB. Atomizing a noun (or verb, adverb or conjunction) [: (/an) ]: NB. (/an) is the Jx train (a v) ┌─┐ │/│ └─┘ or, [: (/("..inv)) ]: ┌─┐ │/│ └─┘ ([: (/("..inv)) ]:) -: (([: (/an) ]:)) 1 A single / can be boxed directly as well, /< ┌─┐ │/│ └─┘ (/<) -: ([: (/("..inv)) ]:) 1 Another issue is that evoke (`:6), and consequently ".. , does not act on boxed adverbs, ".. (/<) |domain error | "..(/<) (/<) (`:6) |domain error | (/<)(`:6) So, one has to write, for instance, +(".. (/an)) 1 2 3 6 Jx version 1.1, not yet released, allows adverbs and conjunctions to act on boxed verbs, adverbs and conjunctions (see [0] for the motivation), JVERSION Installer: j602a_win.exe Engine: j806/j64/windows/beta/BEST/Jx/2017-08-15T16:31:59 Library: 6.02.023 +(".. (/<)) 1 2 3 6 > |syntax error > | +("..[:/]:)1 2 3 > > I had problems with Knot until I recognized that it is `. and not `: as > the description says. > > "|`:|Knot (Gerund) – is similar to the J primitive|`|(tie) except that a > non-boxed noun argument is first replaced by its atomic representation." > > +`.1 > > ┌─┬─────┐ > │+│┌─┬─┐│ > │ ││0│1││ > │ │└─┴─┘│ > └─┴─────┘ > Right, the documentation will be fixed; thank you for the feedback. > I had problems with Cloak. I managed to use it but didn't understand > what it is for. > > AtDot=: 2 : (':';'[ v^:_1 u at v') > > 1 0 1 -AtDot# 4 5 6 > > _4 0 _6 > > 1 0 1 -(2 ?: 5!:1<'AtDot')# 4 5 6 > > _4 0 _6 > > > The example gives syntax error. Missing parenthesis. > > (;:'ver conj adv')=. _3 _2 _1<@?:"0) 0 > > |syntax error > > | (;:'ver conj adv')=: _3 _2 _1<@?:"0)0 > > (;:'ver conj adv')=. _3 _2 _1<@?:("0) 0 Right, I used this properly in the Appendix of my post [1] but somehow a parenthesis got missing in the documentation; it will be fixed. > > ver > > (_3?:0) > > conj > > (_2?:0) > > adv > > (_1?:0) > > > I guess you can use Jx to define adverbs and conjunctions in tacit code, > but I didn't understand how. > The verb ver verbs adverbs (as monadic verbs) and conjunctions (as dyadic verbs), conj and adv are the reverse operations (i.e., adv adverbs a monadic verb and conj conjuncts a dyadic verb) so to speak. This might help to clarify the concepts a little, u (/ver)adv NB. (/ver) is an (a v) Jx train u/ u (ver(<'/'))adv NB. ver acting on an atomic representation u/ u ((ver adv)@:)conj v NB. ((ver adv)@:) is an (a c) Jx train u@:v u (ver(<'@:'))conj v NB. ver acting on an atomic representation u@:v You got it right, adv and conj allows one to write any arbitrary tacit adverbs and conjunctions by reducing those to writing tacit verbs (i.e., u adv and v conj where u is monadic verb and v is dyadic verb). What makes it easy is the fact that primitive nonnumerical verbs are higher-order functions (i.e., able to act on nouns verbs adverbs and conjunctions, or produce nouns verbs adverbs and conjunctions, or both but the official interpreters makes it almost impossible to use them as such; Jx makes it easy). For example, toj ": adv toj $ (toj ": adv) 3 fix=. f.ver toJ ":@:fix adv ((10{a.) I.@(e.&(13{a.))@]} ])@:(#~ -.@((13 10{a.)&E.@,)) $(toJ ":@:fix adv) 57 u (,&:<)conj v NB. Boxing u and v ┌─┬─┐ │u│v│ └─┴─┘ $(u (,&:<)conj v) 2 dex=. ]conj type'dex' ┌───────────┐ │conjunction│ └───────────┘ + dex - - lev=. [conj + lev - + You might like to check also the Appendix I mentioned for more examples. > > Cheers, > > Erling I really appreciate your interest and patience. References [0] [Jprogramming] Boxed verbs as alternate gerunds Jose Mario Quintana http://www.jsoftware.com/pipermail/programming/2017-August/048145.html [1] [Jprogramming] Jx version 1.0 release Jose Mario Quintana http://www.jsoftware.com/pipermail/programming/2017-August/048143.html On Fri, Aug 18, 2017 at 9:08 AM, Erling Hellenäs <erl...@erlinghellenas.se> wrote: > Hi all ! > > I tried out the functionality of Jx and got some problems. > I expected these two expressions to be equivalent, but got syntax error on > the second. > > +(".. '/') 1 2 3 > 6 > +(".. [: / ]:) 1 2 3 > |syntax error > | +("..[:/]:)1 2 3 > > I had problems with Knot until I recognized that it is `. and not `: as > the description says. > > "|`:|Knot (Gerund) – is similar to the J primitive|`|(tie) except that a > non-boxed noun argument is first replaced by its atomic representation." > > +`.1 > > ┌─┬─────┐ > │+│┌─┬─┐│ > │ ││0│1││ > │ │└─┴─┘│ > └─┴─────┘ > > I had problems with Cloak. I managed to use it but didn't understand what > it is for. > > AtDot=: 2 : (':';'[ v^:_1 u@v') > > 1 0 1 -AtDot# 4 5 6 > > _4 0 _6 > > 1 0 1 -(2 ?: 5!:1<'AtDot')# 4 5 6 > > _4 0 _6 > > > The example gives syntax error. Missing parenthesis. > > (;:'ver conj adv')=. _3 _2 _1<@?:"0) 0 > > |syntax error > > | (;:'ver conj adv')=: _3 _2 _1<@?:"0)0 > > (;:'ver conj adv')=. _3 _2 _1<@?:("0) 0 > > ver > > (_3?:0) > > conj > > (_2?:0) > > adv > > (_1?:0) > > > I guess you can use Jx to define adverbs and conjunctions in tacit code, > but I didn't understand how. > > > Cheers, > > Erling > > > > On 2017-08-01 22:55, Jose Mario Quintana wrote: > >> A brief description of the Jx v1.0 extensions, together with links to a >> Windows 64 bit dll, a Unix 64 bit so binaries and the patch corresponding >> to the J806 source can be found at, >> http://www.2bestsystems.com/foundation/j/jx1 >> >> Summary >> >> - Spelling >> - Names with unicode characters >> - Primitives >> Added =.. =:: $:: [. ]. ]: ".. ":: `. ?: i.. O. >> Extended ~ $. >> - Foreign >> Added 104!:5 Unnamed Execution >> >> - Trains >> a v Added (different from Jx v0) >> a a Extended (different from Jx v0) >> c a Resurrected >> a c a Resurrected >> >> The Jx v0 page, >> http://www.2bestsystems.com/foundation/j/jx0 >> will be removed in the near future >> >> Time permitting, there will be soon a script with assertions for those who >> want to verify binaries targeted for other platforms and I will try to >> illustrate the facilities in action with some scripts. >> >> >> >> >> On Sat, Mar 8, 2014 at 11:40 PM, Jose Mario Quintana < >> jose.mario.quint...@gmail.com> wrote: >> >> The patches, a Windows 32-bit DLL, a cheatsheet, 32 and 64 bit Unix >>> libraries are found at: >>> >>> >>> http://www.2bestsystems.com/foundation/j/ >>> >>> >>> For more details and demonstration code, see the article in the Journal >>> of >>> J: http://journalofj.com/index.php/vol-2-no-2-october-2013 (only the >>> definition of the new conjunction knot (`.) has been slightly modified >>> for >>> the release). >>> >>> >>> >>> ---------------------------------------------------------------------- >> 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