 - (defun Q_1 (LST WORD_T)
- (SETQ j 0 k 0)
- (while (and (/= (cadr (nth j lst)) word_t) (< j (length lst)))
- (setq j (1+ j))
- )
- (if (= (cadr (nth j lst)) word_t)
- (last (nth j lst))
- nil
- )
- )
- ;这是另一种:
- (defun Q_1 (lst word_t)
- (setq j 0 k nil tl (length lst))
- (while (< j tl)
- (if (= (cadr(nth j lst)) word_t)
- (setq k j j tl)
- )
- )
- (if k
- (last(nth k lst))
- k
- )
- )
|