Ian Clark wrote:
>  Why didn't the blind old boomer simply use "Find..."?
>  --they'll say.

I would've left the verb unchanged, and subordinated it into another
function that merely passed the global to it as an argument (assuming you
didn't need to update the global).   

Raul wrote:
> niladic=: (0 :) (1 :0)
>  assert.-.'m n u v x y'e.&;:m
>  3 :m
> )
>
> This is an adjective.  Its argument should be
> a string, a boxed list of strings or 0 (in which
> case it must be followed by a script)

Couple notes:
        *  Since you're always returning a monadic verb, there is no reason
to check for any local name except  y  , and you probably don't want to
preclude access to (ill-considered) globals named x u m etc.
        *  The adverb won't actually work if its input is boxed.  You'd
probably want to say something along the lines of  'y' e.&;:S:0 m  but I
haven't tested that either.
        *  Even this doesn't go far enough, because, for example, I could
cheat by passing in  ' ''y''~  ''  .  What we really want is to remove the
possibility of referring to y  -- and this is easily achieved by the simple
expedient of removing  y  .  Taking a cue from   load_z_  , we could write

         niladic=: (0 :) (1 :0)
            3 : (' erase ''y'' '; m)
         )

Of course, this would cause errors at run time, as opposed to define time
like the assert method.  So we could try to get the best of both worlds:

         niladic=: (0 :) (1 :0)
            assert m e.&;:S:0 'y'
            3 : (' erase ''y'' '; m)
         )

But again, I haven't tested this*.  

-Dan

*  And it immediately occurs to me that it might break if the input were
LF-delimited as opposed to boxed sentences or a plain sentence.  So maybe we
want to get a little fancier:

         niladic=: (0 :) (1 :0)
                lv  =. 3 : m  NB.  Hoping this can't ever have side effects.

                s   =. {:"1 (1) 5!:7 <'lv'
                assert. -. 'y' e.&;:S:0 s 
                3 : s
        )
   
And yet again, this is untested.

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

Reply via email to