[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sequence functions

Here is an idea I would like to bounce off people.

The optional arguments given to the sequence functions are of two general
kinds: (1) specify subranges of the sequences to operate on; (2) specify
comparison predicates.  These choices tend to be completely orthogonal
in that it would appear equally likely to want to specify (1) without (2)
as to want to specify (2) without (1).  Therefore it is probably not
acceptable to choose a fixed ortder for them as simple optional arguments.

It is this problem that led me to propose the "functional-style" sequence
functions.  The minor claimed advantage was that the generated functions
might be useful as arguments to other functionals, particularly MAP.  The
primary motivation, however, was that this would syntactically allow
two distinct places for optional arguments, as:
   ((FREMOVE ...predicate optionals...) sequence ...subrange optionals...)

Here I propose to solve this problem in a different way, which is simply
to remove the subrange optionals entirely.  If you want to operate on a
subsequence, you have to use SUBSEQ to specify the subrange.  (Of course,
this won't work for the REPLACE function, which is in-place destructive.)
Given this, consistently reorganize the argument list so that the sequence
comes first.  This would give:
and so on.

(1) Unfamiliar argument order.
(2) Using SUBSEQ admittedlt is not as efficient as the subrange arguments
("but good a compiler could...").
(3) This doesn't allow you to elide EQL or EQUAL or whatever the chosen
default is.

Any takers?