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

Sequence function predicate arg order



Our mailer just returned this as never having gotten to COMMON-LISP.
I don't know if Moon's reply made it either:
-----------

The following issue was encountered today by David Andre.  He wanted
to find the position of first element in a string which was not an element of a list
he had in hand.  This is Zetalisp's STRING-SEARCH-NOT-SET.  The generic
sequence searcher in Common Lisp, the only one that exist, is 
POSITION.

 POSITION item sequence &key :test-not .....

So he would have given #'MEMBER as :test-not, except that the language
specifies that MEMBER will be called on arguments in the order of
the representing objects in the original argument list, which is wrong
for this application.

The strict definition of argument order for tests of :test/:test-not is
of course necessary for these functions to be useful with non-symmetric
tests.  Unfortunately, some tests cannot thus be used.

 Oops.

Possible outcomes:
  1.  Magic keyword to sequence functions to reverse test arg order?  ECCH!
  2.  More string-specific primitives.
  3.  Maybe he should have said :test #'(lambda (x y)(member y x)).