Amelia asked:

>  Is there a way to make a program run without having 
>  to supply it with a value like that?  

In short:  you can include the line  main 5  at the bottom of your script.  
Then, when you load the script, your program will run.

But no:  In J, there is no way for two consecutive identical lines to produce 
different results, unless the lines contain two or more J tokens *.

Putting it another way:  if you have a line with only one J token on it, and 
you type it twice in a row, you cannot ever get different results from the two 
lines.

This is easy to see if we take a reductionist approach:  a single J token is 
either a built-in J primitive, or it's a user-defined name with an arbitrary 
definition.  Primitives never change their definition (good thing!).  And the 
dictionary of J explicitly states, at  
http://www.jsoftware.com/help/dictionary/dict2.htm that: 

    Entry of a name alone displays its value. 

Displaying its value precludes changing its value.  The syntax rules of J do 
not permit "execution" of lone name.

More narrowly, the rule of thumb is:

  A verb always requires an argument to run, 
  even if it ignores that argument.

Which means, to make J programs run without additional typing, the last line of 
the program has to be an invocation with an argument, as I indicated at the 
beginning of this message.

-Dan

*  Except for certain very specific, very obscure cases which depend upon 
changes in the host system.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to