Just for the sake of pointing out what my idea was,
it would work like this (answers embedded):
Am 09.02.22 um 00:02 schrieb Jan-Pieter Jacobs:
The biggest problem I see is finding a good use for such null value.
In many cases where a null value would make sense, J/APL found a different
way of making something useful out of what would otherwise be an error,
e.g.
'abcX' {~ 0 1 2 i. 0 2 1 0 3 0 100
acbaXaX
i. could return null if not found, but would not allow indexing an array
returning a default value X as above.
that’s fine, nothing to change here
i. shouldn’t return _. in these cases
It could as well be used for non-defined names, but this would get in the
way of undefined names being interpreted as verbs.
does anything depend on that interpretation?
if so, non-defined names may stay the way they are
Another issue I see is that it would not have a type (or even more fun, it
could be referring to itself as type). What would the effect be of having
such value inside other arrays? E.g.:
_. 0} i. 5
Your answers seem much lua-inspired, like non-defined names being nil,
and type(nil) returning nil; _. would be one alternative but you
could also spell it out ('undetermined', 'void' or 'none', maybe?)
so you always get a rank-1 literal array
Your example would return _.
(dyadic 0} has ranks _ _, and the only left cell contains _.)
Would it be transparently converted to the "destination-type"?
Kinda yes: that’s what I wanted to say when I called it “generic.”
It can be part of arrays of any type.
That said, I guess we have a precedent for type confusion with empty values:
'', i. 3
0 1 2
$''{i. 3
0
That fits well with what I said:
empty values should be “generic” as well
But the “confusion” which I consider desirable only goes that far.
5 {. i.0
0 0 0 0 0
it always stays numeric, with 0 fill (and this sees good use in J code)
Curious to see what comes up more on this deceivingly simple concept of
null.
Jan-Pieter
On Tue, Feb 8, 2022, 22:08 Henry Rich <henryhr...@gmail.com> wrote:
Don't worry - I don't expect we will ever find a spec that will make _.
fit easily into the primitives. But it doesn't hurt to think about it.
128!:5 will also check for NaN.
Henry Rich
--
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
----------------------
mail written using NEO
neo-layout.org
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm