Ignore:
Timestamp:
Aug 13, 2008, 7:00:06 AM (11 years ago)
Author:
gb
Message:

From working-0711: STRUCTURE-TYPEP is two separate loops.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-pred.lisp

    r10406 r10458  
    10031003;;; (If you've ever been "conused", I'm sure you know just how painful
    10041004;;; that can be.)
    1005 
    1006 ;;; In the short term (bootstrapping), expect TYPE to be a a SYMBOL.
    1007 ;;; If THING is a structure instance (has typecode subtag-struct),
    1008 ;;; its 0th element is either a list of symbols (traditional, legacy
    1009 ;;; case) or a list of CLASS-CELLs.
    10101005(defun structure-typep (thing type)
    10111006  (if (= (the fixnum (typecode thing)) target::subtag-struct)
    1012     (dolist (i (%svref thing 0))
    1013       (if (or (eq i type)
    1014               (and (not (symbolp i))
    1015                    (eq (class-cell-name i) type)))
    1016         (return t)))))
     1007
     1008
     1009    (let* ((types (%svref thing 0)))
     1010      (if (typep type 'symbol)
     1011        (dolist (x types)
     1012          (when (eq (class-cell-name x) type)
     1013            (return t)))
     1014        (dolist (x types)
     1015          (when (eq x type)
     1016            (return t)))))))
    10171017
    10181018
Note: See TracChangeset for help on using the changeset viewer.