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

How do you say "ignore"?



    Date: Mon, 11 Dec 89 22:05:51 CST
    From: "RDP%ALAN.LAAC-AI.Dialnet.Symbolics.COM"%ALAN.kahuna.DECNET.LOCKHEED.COM@Warbucks.AI.SRI.COM

    Does anyone have a standard idiom that they use when ignoring variables
    in a destructuring pattern in LOOP?

    For example:

    (DEFUN IGNORE-TEST ()
      (LOOP FOR (X IGNORE) IN '((A B) (C D))
	    COLLECT X))

    The way this is currently written the compiler will complain:

    For Function IGNORE-TEST
      While compiling (SETQ IGNORE (CAR #:TEMP)):
	The variable IGNORE is unknown and has been assumed SPECIAL

In a destructuring pattern, NIL can be used to ignore a portion of the
structure, e.g.

(LOOP FOR (X NIL) IN '((A B) (C D))
      COLLECT X))

Also, you can use the SCL function IGNORE:

(LOOP FOR (X Y) IN '((A B) (C D))
      DO (IGNORE Y)
      COLLECT X))

                                                barmar