Jose wrote:
>  Using your very own anonymous evocation 
>  tool ( 
> http://www.jsoftware.com/pipermail/programming/2007-November/008816.html ) as 
> an 
>  example:
>
>     '<x'ae NB. Here it comes...
>  +-+
>  |1|
>  +-+

Yeah, this is a problem.  I issued a warning about it in the script linked
from the message you reference:

>  http://www.jsoftware.com/svn/DanBron/trunk/environment/anonymous_evoke.ijs
>  NB.  More strictly speaking  m ae  is equivalent to:
>  NB.
>  NB.    (1) 1 : (m"_ (1) )  NB.  There is some normalization of  m  first.
>  NB.
>  NB.  That is, it is not tacit; it invokes the explicit interpreter by 
>  NB.  using  :  .  So technically  'u' ae  should   return the global 
>  NB.  value of  u  (or an undefined verb is  u  is not defined globally),
>  NB.  but it doesn't.  It returns the argument to the adverb; that is,
>  NB.  1  .  OTOH, it lets you use control words.

but I didn't call the problem out in the post itself.  In the message body,
I just wanted to focus on "nameless" feature of the utility; I figured
anyone who wanted to know more (ha!) would read the script.

One trivial way to resolve this issue is to redefine  ae  such that it's
effectively equivalent to  (1) 1 : ( ('4!:55 ;: ''x u m'' ' ; m"_) (1) ) 
.   But frankly, it's always bothered me that  ae  depended on  :  in the
first place.  This is just one symptom of that illness [1].

More than just an "anonymous" evoke, I want a truly tacit evoke.  When
writing  ae  I dismissed the possibility off the bat, because I thought
the deprecation of the trains table made tacit conjunctions inexpressible
(which means  ae  wouldn't be able to evoke arbitrary expressions,
including those producing conjunctions).

But I saw your message this morning and an idea occured to me.  It is
possible to evoke conjunctions using adverbs, if you're willing to quote
your conjunctions (which obviously you're willing to do, because you're
trying to evoke a string).  For example:

           at =. ;:'@'
           at (`:6)
        @
           + at (`:6) *
        +...@*
           
>From here it was an easy leap to truly tacit (and still anonymous)
evocation:

           ae =: + 1 : (LF -.~ 0 : 0)
        ((((((("_)(`''))(<@((,'0') ; <@])`))(`(<(,'0');0)))(`:
        6))(('@.' ; (,&<&((,'0') ; <@]) ((;:'()') >@:{.^:(1 = 
        #)L:1^:_@:(>@:{.L:1)@:((('';1) <@:,;.1 ] <@:(}.@:}:^:(
        1 < #));.2&>~ (= <./)&.>@:{:)L:1^:(1 + >./@:>@:{:))@:(
        i...@#@] ,&< +/\@:(-/)@:(=/)) ]))@:((((,'0') ; <@])@:".@
        :]^:[&.>~ ([: (('''' = {.) +. (':' ~: {:) *. '_0123456
        789' e.~ {.)@|: 2 {.&> ]))@:;:))`))(`:6))(@.1 0 2)    
        )

Note this definition doesn't use  :  (the one on the first line is
obviously just so I could post the code without worrying about linewrap --
in my script this is all one long line, with no  :  ).

To use your earlier examples, Jose:

           x=. @[

           y=. @]

           '<y'ae NB. OK...
        <@]

           '<x'ae NB. also OK
        <@[
           
For the curious, the mechanism is essentially  (;:m)@.(fancy nested boxes) 
and calculating the fancy nested boxes comprises the majority of the code.
  This obscure feature of  @.  was the key insight, the rest was just
stamp collecting (which is why it's so long; I just slapped the fancy box
calculator together, I'm sure it can be improved).  And I now realize that
 @.  is a powerful tool in any adverbial programmer's kit, on par with (if
not surpassing)  `:6  .  Note the trailing  @.(1 0 2)  in the definition
of  ae  .

In fact, note the key use of  @.n  in Viktor's triumph earlier today [2]:

>  eachd=:@.0(&.>)/("_1)(@:,.)

For the curioser, more implementation details are available at 
http://www.jsoftware.com/svn/DanBron/trunk/environment/anonymous_evoke2.ijs
 .  I'd be interested in a better, briefer definition of  nestToBox  if
anyone wants to contribute.  Please note that I'm only interested in
implementations that are entirely tacit, fully fixable, and eschew  $:  
(even though this is a very recursive-flavored problem).

Note that I haven't tested the new  ae  much.  It's probably got sharp
corners.  I already know it doesn't handle punctuation, aside from parens.
 We could easily extend it to handle comments (NB.), but I don't imagine
it'll be trivial (or even possible?) to handle copulae (=.=:).  

-Dan

[1] Another would be that  :  introduces a[nother] local context, which
means if you evoke code referencing local variables, it will fail.  The
benefit of tacit code is that it works the same way everywhere.  The
analogy is to  ".'some code'  .  This doesn't mess with the current
context (namespace [3]) or anything else; the effect is exactly as if 
".'some code'  were written as  some code  in the first place.  Same thing
for  ae  , only it can produce any part of speech.

[2]  http://www.jsoftware.com/pipermail/programming/2009-August/015993.html

[3]  What is the proper J term for "namespace"?  Is it locale?  Does that
include the anonymous locales introduced by explicit context?  "Local
locale" doesn't sound right.  "Transient locale"?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to