3 ;;; Copyright (c) 2005--2007, by A.J. Rossini <blindglobe@gmail.com>
4 ;;; See COPYRIGHT file for any additional restrictions (BSD license).
5 ;;; Since 1991, ANSI was finally finished. Edited for ANSI Common Lisp.
7 (defpackage :lisp-stat-types
9 (:export fixnump check-nonneg-fixnum check-one-fixnum
10 check-one-real check-one-number check-sequence
))
12 (in-package #:lisp-stat-types
)
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17 ;;;; Type Checking Functions
19 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21 ;;; Moved out of lsbasics.lsp
25 Returns T if X is a fixnum; NIL otherwise."
26 (declare (inline typep
))
29 (defun check-nonneg-fixnum (x)
30 (if (and (fixnump x
) (<= 0 x
)) x
(error "not a non-negative fixnum")))
32 (defun check-one-fixnum (x)
33 (if (not (fixnump x
)) (error "not a fixnum - ~a" x
)))
35 (defun check-one-real (a)
36 (if (not (or (rationalp a
) (floatp a
)))
37 (error "not a real number ~s" a
)
40 (defun check-one-number (a)
42 (error "not a number ~s" a
)
45 (defun check-sequence (a)
46 (if (not (or (vectorp a
) (consp a
))) (error "not a sequence - ~s" a
)))