Raul wrote:
> __: is a spelling error, instead of a constant
> function which returns the minimum possible value.
Kip suggested:
> __"_
Ric suggested:
> -...@_:
Raul's been around a while, I'm sure he's aware he can create verbs with a
constant value of __ . I imagine he's asking for a primitive __: because
it wouldn't require parens in his proposed use case, to wit:
> f :: __:
whereas the proposed alternatives would (i.e. you'd need f :: (__"_) or f
:: (-@:_:) ).
Kip wrote:
> I imagine the reasoning behind this is similar to why {: doesn't have a
dyadic form analogous to {. .
I imagine it's because the general pattern for J primitives (words with a
nameclass) are either unadorned, singular glyphs (non-alphanumeric printable
ASCII characters), or an inflected root, where the root can be any single
printable ASCII char.
The key observation is while the inflection can be multi-character (any
non-empty string of dots and colons), as in {:: or p.. , the root always
seems to be a single character. J words with multi-character roots tend to
be punctuation (as in NB. or while. or for_xyz.), and are always inflected
with a single dot.
The word __: would break this pattern, having a nameclass, but having a
multi-character root (prefix with multi glyphs). It would even break the
pattern observed in punctuation (being inflected with a colon rather than a
dot [1]).
Rather than introduce such an anomaly, I favor Raul's earlier suggestion
that f :: n (n is a noun) be defined as f :: (n"_) ([2]). If the
perennial suggestion that f@:n (et al) be defined as f@:(n"_) ([3-4]) it
would create a nice, consistent convenience.
-Dan
[1] Interesting historical fact: it seems that punctuation uses a single
dot
because multi-character roots inflected with a single colon used to mean
"single assignment names"; see Martin's post at
http://www.jsoftware.com/pipermail/programming/2010-January/017953.html
To round out the lineup, we'll observe that of course uninflected
alphanumeric words are either user-assignable names, or numeric
constants,
depending on their first character, and that multi-character roots with
multiple inflection are simply unnecessary, given that it's likely more
useful (readable, mnemonic) to extend a punctuation word's root than
its inflection (cf while. vs whilest. ).
[2] I have a vague memory Raul suggested f :: n <==> f :: (n"_) but I
can't seem to find a reference right now. Does anyone else remember such a
suggestion?
[3] f@:n :
http://www.jsoftware.com/jwiki/System/Interpreter/Requests06#v.40nshortcutfo
rbind
[4] f@:n redux :
http://www.jsoftware.com/jwiki/System/Interpreter/Requests#Allow.40withnounr
ightargument
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm