Re: [stack] array theory question

John Cowan <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
John Nowak scripsit:

> What I'm hoping might make sense here is making the atom 'y'  
> equivalent to '{y}'. This would allow the second form of '&' shown  
> above to be used in the general case. Do you think that may be  
> workable? Is it comparable to what Nial or APL do?

Ah^2.  What you want is Algol 68's "rowing coercion" ("row" being A68
jargon for vector, or 1-D array).  This coercion transforms a non-row
value into the corresponding row value with one element.  It's applicable
only where the type is uniquely known at compile time: in A68 jargon,
in the following "strong contexts":

o	the actual parameters of a function call
o	a type cast
o	the RHS of an assignment, contant declaration, or variable
	declaration with an initializer
o	the body of a procedure (which is an expression in A68)
o	all the arms of an if- or case-expression except one
o	either side, but not both, of an identity expression

It's interesting note that A68, as of the Revised Report, has two kinds
of 2-D arrays:  "row row of <whatever>", which is a C-style rectangular
matrix, and "row of row of <whatever>", which is a Java-style vector of
pointers to vectors.  (These are the names of the types, not the way you
write them in declarations.)  Consequently, there are four kinds of 3-D
arrays, and in general 2^(k-1) kinds of rank-k arrays.

-- 
MEET US AT POINT ORANGE AT MIDNIGHT BRING YOUR DUCK OR PREPARE TO FACE WUGGUMS
John Cowan      [email protected]      http://www.ccil.org/~cowan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.