On Fri, Jun 18, 2010 at 4:10 PM, Dan Bron <[email protected]> wrote: ... > U =: (strand (<'[:')) (eg 1) > > but I can't. When I try to apply it, I get a syntax error. Can someone > help me understand why, and how to work around it?
Here's my understanding of this, but it could be wrong. Let's call stc=: strand (<'[:') NB. an adverb eg1=: eg 1 NB. an adverb for the sake of brevity, now U =: stc eg1 NB. an adverb If you write [: f g h stc it works because of this. First, (h stc) is taken by the grammar as an adverb call, the adverb is called, and returns a new adverb. Then, that adverb is called with g, the resulting adverb with f etc. But suppose you write [: f g h U then U has the value of an adverb train, which is an adverb itself, so the grammer calls it with h as the argument, and this h U call evaluates to (h stc) eg1. Now (h stc) is an adverb, so you get a syntax error because the adverb eg1 can't be called with an adverb. If you want to fix this, I think you'd have to see how strand works and generalize it so it can do what you want, returning intermediate adverbs until it meets the terminator word, and applying eg1 only at the end. Ambrus ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
