Why can you just not write  
   
    myvar =: 1 2 3 

?

Why would you be able to remember to write  myvar assign 1 2 3   but not  myvar 
=: 1 2 3   ?  Can you elaborate on the problem?

In any case, a cute but silly way to acheive your end is:

           assign  =: 1 : '({. u`[) =: y'
        
which, unlike Raul's suggestion, does not require the name to be quoted:

           myvar
        |value error: myvar

           V       =: 3 : 'myvar assign 1 2 3' 
           V 0
        1 2 3

           myvar
        1 2 3

but DOES require that the name be previously undefined.  Running the example 
again produces:

           V 0
        |domain error: V
        |   ({.    u`[)=:y
           
or, worse:

           innocent_bystander =: 'some important data'
           myvar   =: {.;:'innocent_bystander'

           V 0
        1 2 3

           myvar 
        +------------------+
        |innocent_bystander|
        +------------------+

           innocent_bystander 
        1 2 3
           

(actually, the requirement is that the name is stacked by name instead of by 
value, so  myvar  could previously have been undefined or a [non-special] 
proverb.)

So quoting the name, as in Raul's solution, is more robust and general.  
However, you can still run into trouble with locatives.  

So the quesiton is truly:  Why can you just not write  myvar =: 1 2 3   ?  What 
specific problem are you trying to solve? 

-Dan

PS:  If you're trying to write a cover to  =:  so that you can use an APL-style 
arrow, the only solution is string substitution in the program text.  A name 
can nave have the same class (part of speech) as  =: (which makes sense, 
because  =:  needs a higher precedence than a name, or   name=: ...  couldn't 
work).
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to