2 ;;; Copyright (c) 2005--2007, by A.J. Rossini <blindglobe@gmail.com>
3 ;;; See COPYRIGHT file for any additional restrictions (BSD license).
4 ;;; Since 1991, ANSI was finally finished. Edited for ANSI Common Lisp.
6 (defpackage :lisp-stat-types
8 (:export fixnump check-nonneg-fixnum check-one-fixnum
9 check-one-real check-one-number check-sequence
))
11 (in-package :lisp-stat-types
)
14 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16 ;;;; Type Checking Functions
18 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20 ;;; Moved out of lsbasics.lsp
24 Returns T if X is a fixnum; NIL otherwise."
25 (declare (inline typep
))
28 (defun check-nonneg-fixnum (x)
29 (if (and (fixnump x
) (<= 0 x
)) x
(error "not a non-negative fixnum")))
31 (defun check-one-fixnum (x)
32 (if (not (fixnump x
)) (error "not a fixnum - ~a" x
)))
34 (defun check-one-real (a)
35 (if (not (or (rationalp a
) (floatp a
)))
36 (error "not a real number ~s" a
)
39 (defun check-one-number (a)
41 (error "not a number ~s" a
)
44 (defun check-sequence (a)
45 (if (not (or (vectorp a
) (consp a
))) (error "not a sequence - ~s" a
)))