I wrote:
> Though I think I'll use gerunds as a left-hand argument

Henry responded:
> OK in this case, but in general the left side is a string, 
> not an unboxed gerund.

Yes, but I was thinking of providing a utitlity verb on the page to cover
that issue.  Something like this:

           AxBx =: 4 : 'y 128!:2~ (<x)`:(6)1 :''5!:5<117{a.'' '&.>

           ]`]`|: AxBx 3$<i.2 2
        +---+---+---+
        |0 1|0 1|0 2|
        |2 3|2 3|1 3|
        +---+---+---+

This has a some advantages:  one, it's consistent with J's philosophy viz
arrays of verbs; i.e. we use gerunds.  Two, because  `  is a conjunction,
you can often write   foo`bar`baz AxBx ...  instead of  ('foo';'bar';'baz')
128!:2&.>  ...  which is shorter and cleaner.  Three, it doesn't raise the
problem of nested quotes.  Four, unquoted source code is amenable to syntax
highlighting, and its error checking will occur earlier than quoted code. 
This last is particularly important if you're going to be passing code
around, rather than writing and using it on the same line.

On the other hand,  AxBx  is another name you'd have to depend upon, whereas 
128!:2  is primitive and stand-alone.

All that said, my comment was a knee jerk reaction: quoting source
(unnecessarily) seems wrong to me.  I'm not sure why, but I avoid it unless
the cost is too high.  Nor am I alone.  Witness the comments in the Lev and
Dex thread:

Neville Holmes wrote in:
http://www.jsoftware.com/pipermail/programming/2007-December/009274.html
>  but what is repellant is the 1 : ' ' in your example above.  This
> excrescence,
>  especially the enclosing apostrophes, is a complete put-off 

Jose wrote in:
http://www.jsoftware.com/pipermail/programming/2007-December/009234.html
>  The disadvantages are that arguments are strings representations (e.g.
> '+/')

I agree with them, but I can't articulate the reason.  Maybe I should
rethink it.  (Not likely)

-Dan
-- 
View this message in context: 
http://www.nabble.com/How-to-apply-different-verbs-to-a-boxed-sequence--tp14918558s24193p14930765.html
Sent from the J Programming mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to