We've started using type theory terminology, so I thought I'd go over
the definitions I use for "types", "sum types" and "product types".

A "type" is an enumeration of possible values.

For example, an 8 bit literal can represent 2^8 distinct values, while
a 32 bit integer can represent 2^32 distinct values.

A "sum type" is a type which can represent one of a set of values. So
a sum type that let you represent either an 8 bit literal or a 32 bit
integer can represent (2^8)+(2^32) possible values. J arrays are sum
types in the sense that they can represent any of a variety of
possible underlying array types.

A "product type" is a type that can reprsent a sequence of values. So
a pair of 32 bit integers can represent (2^32)*(2^32) possible values.
J arrays are product types in the sense that each additional element
in the array represents an additional set of possible values.

Now, traditional type theory sort of peters out here. Anything is
possible, which means the burden is on the programmer to impose any
additional structure.

Meanwhile, J arrays carry considerable structure but are somewhat
intractable to deal with, using that sort of type theory. You might be
tempted to call J arrays "infinite types" though they really aren't
because of machine limitations. Or maybe they could be called
"polynomial types" though that term also doesn't really do them
justice.

Conceptually, the J array type is a type of the form C*i0*i1*i2*...
where C represents the sum of various element type and i0, i1, ..
represents the dimensions.

But boxed arrays mean that C is incredibly large.

Anyways, the net result is that I have never gotten very far when I
have tried to find a useful application for type theory.

But I never find a shortage of people willing to tell me how wonderful
it is, nor how wrong I am. Which is maybe a bit amazing since they
rarely have the patience to get past the promotional issues.

Meanwhile, other people are creating amazing things, and those are the
people I want to be learning from.

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to