Next: About this document Up: The Proteus NS Grammar Previous: Notes on Multiple

Notes on Allowing Arbitrary Patterns in Generators

Assume there is a tuple-type with, say, the type signature: ( int, int, [int] )

Say that the sequence is a 3D location, and I want to find it's distance from the origin. I could say:

Everyone agrees that (1) and (2) are legal, and I think I'm the only one arguing for (3). An alternative for (3) is

but that's even longer.

After trying to write the alternatives down for this, I must ask, is (3) harder or easier to understand than the others? Even if I had named fields for the tuple (e.g., instead of ), I think that the wordiness of it is distracting.

Note that, from the data-parallel point of view, (2) is perfect, since it leads to (5):

A very concise statement indeed!

Alternative (4) gives me an urge to use sequence pattern matching and write

or more simply
Wed Aug 31 15:43:33 EDT 1994