[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Avoiding combinatorics
- To: GSB at MIT-MC
- Subject: Avoiding combinatorics
- From: Kent M. Pitman <KMP at MIT-MC>
- Date: Tue, 17 Feb 81 22:37:00 GMT
- Cc: BUG-LISP at MIT-MC
- Original-date: 17 February 1981 17:37-EST
Try this...
(DEFUN DPL? (X)
(IF (ATOM X) ()
(DO ((L (CDR X) (CDR L))
(FLAG NIL)
(LL (CDR X) (CDDR LL)))
((NULL LL) T)
(IF (OR (ATOM LL) (ATOM (CDR LL)))
(RETURN NIL) ; bad format
(IF FLAG (IF (EQ L LL) (RETURN NIL)) ;circular
(SETQ FLAG T))))))