Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Nested arrays

9 views
Skip to first unread message

KW Heuer

unread,
May 19, 1986, 10:13:47 AM5/19/86
to
In article <3...@water.UUCP> water!ljdickey (Lee Dickey) writes:
>GCOS APL allows things of the sort list <- (a;b;c)
>[In IBM's APL2] one uses "strand notation" ... list2 <- a b c

Neither of these notations allows you to write a zero- or one-element list.
(I know, you can't directly write a zero- or one-element vector either*.)
You can get around that by changing the notation to "{a;b;c}". But this
still seems inelegant.

>[Sharp APL has] new primitives called enclose and disclose. The result of
>enclose is always a scalar. Disclose is a left inverse of enclose.

I find this one easiest to understand. Enclose always returns a scalar of
(new) type "tree"; arrays are still homogeneous but the scalars in a tree
array may disclose to any object; the "standard scalar" of type tree (the
filler value for overtake or expand, corresponding to numeric zero and
character blank) is the enclosure of an empty tree. This is the "grounded"
tree model.

There's also a "floating" tree model, whose main distinction is that for any
scalar foo, foo equals enclose foo. (In the grounded model, "0" "<0" "<<0"
(monadic "<" is enclose) are all distinct objects, and ">0" gives a domain
error.) I think this causes unnecessary complications -- you have to allow
true heterogeneous arrays, and I think the "first" element is distinguished.

Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint
*I lied. '' denotes a zero-element character vector. What you can't write
is a numeric vector of length zero or one, or a character vector of length
one, as a constant. Or any array of higher rank. Are 2D lists permitted in
GCOS APL or APL2? Does "2 2 rho {a;b;c;d}" work?

Lee Dickey

unread,
May 21, 1986, 11:04:05 PM5/21/86
to
Question:
> ... Are 2D lists permitted in
> (1) GCOS APL or
> (2) APL2?
> Does "2 2 rho {a;b;c;d}" work?

Answer:
(1) No.
(2) I dunno. Does anybody else ?

moews_2

unread,
May 23, 1986, 12:05:33 AM5/23/86
to
In article <8...@bentley.UUCP> k...@bentley.UUCP (KW Heuer) writes:
>...

>
>I find this one easiest to understand. Enclose always returns a scalar of
>(new) type "tree"; arrays are still homogeneous but the scalars in a tree
>array may disclose to any object; the "standard scalar" of type tree (the
>filler value for overtake or expand, corresponding to numeric zero and
>character blank) is the enclosure of an empty tree. This is the "grounded"
>tree model....

>
>Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint

Uh, but what exactly is the "empty tree"? If we define

<scalar> ::= <number> | <character> | enclose(<array>)

<array> ::= n-dimensional array of (<scalar>)'s, n >= 0

then there IS no empty tree --- every enclosure has an array inside it. If
you want a "default" scalar of type tree, I think you'd be better off
reintroducing ONE object x0 satisfying x0 = >x0, and letting that be the
default value. (Is this perhaps what you meant?)
--
David Moews mo...@h-sc4.harvard.EDU ...!seismo!harvard!h-sc4

KW Heuer

unread,
May 27, 1986, 2:24:48 PM5/27/86
to
In article <9...@h-sc2.UUCP> h-sc2!moews_2 writes:
>In article <8...@bentley.UUCP> k...@bentley.UUCP (KW Heuer) writes:
>>I find this one easiest to understand. Enclose always returns a scalar of
>>(new) type "tree"; arrays are still homogeneous but the scalars in a tree
>>array may disclose to any object; the "standard scalar" of type tree (the
>>filler value for overtake or expand, corresponding to numeric zero and
>>character blank) is the enclosure of an empty tree. This is the "grounded"
>>tree model....
>
> Uh, but what exactly is the "empty tree"? If we define
> <scalar> ::= <number> | <character> | enclose(<array>)
> <array> ::= n-dimensional array of (<scalar>)'s, n >= 0
>then there IS no empty tree --- every enclosure has an array inside it.

By "empty tree" I meant "zero-length vector of type tree." The "standard
tree scalar" is ENCLOSE 0 RHO ENCLOSE anything. Sorry about the confusion.

0 new messages