- That was a concrete question, so it should have
been put under a separate subject.
 - It is related to programming, so it should be in Programming forum
 - If anyone has nothing to say concretely on the subject,
related to J language, better stay away from this thread (I don't mean John).
 
Variables are called "names" in J: pronoun, provers, etc. 
 
   nc  NB. To get a name class, there is a "name class" conjunction
4!:0

   b=. 1
   c=. +
   nc ;:'b c'  NB. Class is the same you put on right of explicit definition ":"
0 3

   a + 1
|value error: a
|       a+1
   nc <'a'  NB. undefined (unassigned) name returns _1
_1

You can have a "default for name" conjunction which can
substitute avalue unless the name is defined.

   a dn 2 + 1
3
   b dn 2 + 1
2

If name is a verb the "adverse" (::) will also work
   2 d 1
|value error: d
|   2     d 1
   2 d ::+ 1
3

Null is assigned in languages with reference types,
as pointers to nothing.
In J contents of names is always a value type.
So to "clear" a name, you simple erase it.
 
   erase <'b'
1
   b + 1
|value error: b
|       b+1


----- Original Message ----
From: John Randall <[EMAIL PROTECTED]>
To: General forum <[email protected]>
Sent: Tuesday, June 20, 2006 7:42:02 PM
Subject: Re: [Jgeneral] Mathematical Roots of J & more musings


dly wrote:
> By undefined in J
> do you mean a variable to which no value has been assigned?
> an attribute that is defined for some but not all?
> is it associated with something like null which you can test for?
> how does J handle the undefined?

J sometimes assigns definite values to expressions some would consider
indeterminate.  For heated debate on this topic, search the archives for
discussions on 0^0 (I do not want to reopen it).

J has a primitive -. (Indeterminate).  The Dictionary entry, in full, reads:

The indeterminate _. results from expressions such as _-_ (infinity minus
infinity) and from expressions (such as 3+_.) in which an indeterminate
argument occurs.

The official advice from Roger is:

However, use of the indeterminate at any time in any circumstance is not
recommend.  I consider it a data virus, almost as bad as -0 (minus 0).

Best wishes,

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

Reply via email to