Special code is recognized in different places. Most of it is during execution of a conjunction or adverb (including the implied 'fork' conjunction). So.
sch =: m&i. turns into special code when & is processed. & recognizes the special operands and creates a pointer to the special routine. Something like a =: x m} a is different. It is recognized during parsing rather than during execution. Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dan Bron > Sent: Tuesday, April 01, 2008 1:57 PM > To: Programming forum > Subject: [Jprogramming] Limits of special code? > > Ambrus and I were just having a discussion in IRC. Can > someone describe to me how special code support is > implemented in the interpreter? > > In particular, at what point is special code recognized? I > thought the parser only looked at the top 4 tokens on the > stack. If they matched a production rule, they're executed > to produce the proper part of speech. > > If that's so, then how are special sequences longer than 4 > tokens recognized? For example, > http://www.jsoftware.com/help/dictionary/special.htm lists: > > ;@:(<@u;.n) > > which, even if u were a single token, is longer than 4 > tokens. Another obvious example is > > ([: f g h i j k l m n o ....) > > that's got "special code", too. > > Can any train at all be given "special semantics"? In > particular, I'm thinking of juxtaposed nouns. Could this > "special sequence recognizer" be leveraged to assign meaning to > > 1 2 3 'hi there' a: 'these are juxtaposed nouns' > > without requiring unbounded (infinite) lookahead in the interpreter? > > I'm not requesting juxtaposed nouns as a feature, I'm > wondering if it's technically feasible. And if not, what is > the difference between the cases of recognizing special code > and juxtaposed nouns? > > -Dan > > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
