(Homer Wilson Smith) writes:

Quote:

> Would someone be so kind as to explain to me why

> 5 = emptyset take 5?

I will try to answer in an informal way, without going into anything

deep. But first, I must correct something that is implicit in the

question, which may in part be leading to the difficulty. The data

objects in APL are arrays, some of which may be empty, and not sets.

Now to address the question.

In general, if R <- A take B , and A take B is defined,

then A is the shape of R. For instance, if you do

V <- 3 take 5

you get a vector with three numbers. That is, 3 = shape V .

Now, the shape of all scalars is the empty vector, and that

explains it, because if A is the empty vector, (I think that

is what you meant when you said "emptyset"), _shape_ of A take 5

is the same as the shape of A reshape 5 , and this gives something

with content 5 whose shape is the empty vector, just like all scalars.

This property is useful for generating elements used for indexing

an array. For example the sapes of MAT[,1;] and MAT[1;] are

not the same. Sometimes, after a brutish calculation, you might

find that I is a one element vector and you want to use it to

extract a row vector from a matrix. The form MAT[I;] will

get you a one row matrix, and not a vector. However,

the form MAT[ (iota 0) rho I ; ] will yield the desired vector.

Question 2.

[why is]

Quote:

> 1 = emptyset belongsto 'abcdef'

I don't get this result. Again, I think you mean empty vector, not

emptyset. Looking at the meaning of "R <- A elt B" the shape

of R is the same as the shape of A. For example, if A

is a matrix, then A elt B is a matrix. Likewise, if A is

an empty array, then R is an empty array, with no elements in it,

and it does not equal 1.

Question 3:

[why is]

Quote:

Students in my elementary mathematics courses seem always to find it

easy to accept the idea that the sum of the entries in an empty list

of numbers should be 0. The answer is because this is the identity

element for the given operation. But they seem not to have thought

about the analogous question for multiplication: Why should the

product over the empty list be 1. The answer (again) is that this is

the identity element for the given operation. Now think, what is the

identity element for "and" ? Whatever that element is, let us call it

"i", it has to satisfy the identity

x <--> x and i

for every element in the domain. In this case the domain has only two

elements, and it is true that both of these identities hold:

1 <--> 1 and 1

0 <--> 0 and 1

but it is not true that both these hold,

1 <--> 1 and 0

0 <--> 0 and 0

because one of them fails to be true. This answers your question

then, because 1 is the identity element for "and". An amusing related

question is "what is the identity element for "min" or "smaller of".

We want the identity:

x <--> x min i

for all numbers x. So what should the identity i be?

--

Prof. Leroy J.{*filter*}ey, Faculty of Mathematics, U of Waterloo, Canada N2L 3G1