p j wrote:
> References would be a useful feature

J has references -- names are references.

As an added bonus, values in memory mapped files are treated in a
reference-like fashion.

> lets define r: as a monad to return a reference to its
> right argument ...

If you want a reference rather than a value, why not simply quote
the name?

Put differently, in verb :'x+y', x and y are references to the right
argument.  That's probably not the reference you were thinking of, but
J isn't so good at mind reading.  At least, not in this version... 

A bit more seriously, here are some cases to consider:

[1] The right argument is calculated on the fly.

[2] and then a name is assigned this value.

[3] and then another name is assigned this value

[4] and then the value referred to by a name is used in another
locale.

(etc.)

> r: could be an adverb or conjunction.

You have this for verbs:

   ref=: `''
   a=+/%#
   a ref

Doing this for nouns would essentially mean that nouns are just
another flavor of verb (one that takes no arguments).  One problem
with this approach is that a combination of nouns and verbs would
form a train rather than causing the verbs to be executed.  On the
one hand, this would solve an earlier problem (where irrational
results are not represented exactly), on the other hand you'd have to
do something like fix each such train before you could see the result.  

Of course, other possible implementation strategies are possible...
but one of them is already implemented:  quote the names you want to
serve as references.

> I guess it can be defined now without language support
> as long as you are willing to call it with variables
> inside quotes.

Yes.

And the `'' method seems to work just fine for verbs.

> An unrelated seemingly small touch that could be
> helpful is letting the explicit define process handle
> nested definitions by having a definenested enum.
> myverb=: monad definenested NB. 3 : 1
>   myprivateverb=. 3 : 0
> 
> )
>))

Hmm... I've been thinking about such things too, but have yet to come
up with what I think is a significant reason to use them.

> This could hopefully let us define multiple classes
> inside general files, as well as private explicit
> verbs only useful in narrow scopes.

Of course, both are already possible.

-- 
Raul


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

Reply via email to