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

case using other equality-testing predicates



    Date: Wed, 21 May 86 14:14 EDT
    From: David A. Moon <Moon@SCRC-STONY-BROOK.ARPA>

	Date: Tue, 20 May 1986  23:45 EDT
	From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>


	    I'm sure some people will jump all over me for suggesting this,
	    but it might be better to allow CASE to accept a :TEST keyword.  Which
	    of these three syntaxes do you-all prefer?

	      (selector item equalp ("foo" ...) ...)

	      (case item :test #'equalp ("foo" ...) ...)

	      (cond ((equalp item "foo") ...) ...)

	I think that mixing keywords into a construct like Case that already has
	a complex syntax is likely to cause confusion.  

    I agree.  But the other alternatives cause confusion, too.

							I would prefer adding a
	new construct CASE-TEST that would look like

	(case-test #'equalp item ("foo" ...) ...)

	This is similar to your Selector, but without the odd treatment of the
	test function, and the name emphasizes the close parallel to Case.  I
	think it is best to put the test function before the item -- other
	things in the language put the testing function first.

    So where would additional options, such as :KEY and an option that
    controls whether or not the keys at the heads of the clauses are
    evaluated, go in your syntax?

    I guess it's obvious why Common Lisp doesn't currently have a way to do this
    -- no one has thought of a syntax for it that anyone else likes.

(seleckter object (:key -- :test ---)
    ("foo" ...