On 12/11/06, Dan Bron <[EMAIL PROTECTED]> wrote:
Chris Burke provided a locale-based solution which seems exactly what
your solution aspires to:

    http://www.jsoftware.com/pipermail/programming/2006-January/000636.html

SNIP
Note the critical use of parentheses on the last line:

>   3 : (n,'=:',n,'+y.')
SNIP
Grokked it! Thanks

I noticed that Chris' solution also uses the sentence
(n)=. m.

I have seen this before but have found no documentation on this. It
seems related to the ability to use strand notion in single quotes as
the LHA to a copula to label an array of items. Any references?

Oleg Kobchenko improved Chris' solution by removing the requirement
for globals:

     http://www.jsoftware.com/jwiki/FrequentlyAskedQuestions/LexicalClosure
Here I notice the sentence
a&(4 : 'n__x=: n__x + y')
very clever!! Again not read in documentation anywhere - much still to
discover :-)

hence it is impossible for any other entity in J to interfere with the
operation of verbs derived from Oleg's adverb (as was specified by
Graham in the original challenge).
Why is this different form my or Chris' solutions regarding locales?
In the other version Oleg uses acc_dat global which is more easliy
accessible than a numbered locale.

And if line count is very important to you, Oleg's solution can be
reduced to a single line:

     accgen=:1 :'a&(4 :''n__x=:n__x+y'')2 :''u''n__a=:m[a=.18!:3$~0'

which is silly and unreadable but acheives its end.
How does the 2:''u'' bit work?

By the way, Oleg's solution IS up on the wiki:

    http://www.jsoftware.com/jwiki/FrequentlyAskedQuestions/LexicalClosure

But apparently all your wiki-searches are coming up with my "solution"
instead:

    http://www.jsoftware.com/jwiki/DanBron/Temp/LexicalClosure

which probably means I should remove it (and I will), so that others
are not led astray.  But that also means whatever you're searching for
IS on my page, but NOT on the "canonical" page.  For what did you
search?  What search strings did you enter?

I recall searcing for "closure" or "closures" really cant remember.
Did spend some time looking but clearly not enough.
Also used my rollyo j langauge search as well.
www.rollyo.com/martinfreedman/j_language/

We should optimize the canonical page to come up at the top of the
results for such queries.  And maybe the page should be moved from
/FrequentlyAskedQuestions/  to Henry Rich's /Guides/LanguageFAQ  ?  Is
this appropriate material for that page?

-Dan

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



--
martin

"Reality is that which, when you stop believing in it, doesn't go away" PK Dick
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to