Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun common-2d-vector-p (S)
- "Takes an S-expression \(list\) and returns T if it is a two-elemented single-level list of floats and NIL otherwise."
- (cond
- ((atom S) nil) ; Seeing an atom (or a plain NIL)? Not a 2d-vector.
- ((null (car S)) nil) ; Non-empty list containing NIL as its CAR? Not a 2d-vector.
- ((atom (cdr S)) nil) ; NEL containing atomic CDR? Not a 2d-vector - more like 1d-vector or a plain dp.
- (T (cond ; CAR and CDR are both not NIL, good! Seeking for atomic CAR & CADR next.
- ((and (atom (car S)) (atom (cadr S))) (cond
- ((and (floatp (car S)) (floatp (cadr S))) T)
- (T nil)))
- (T nil)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement