add missing function spec, but needs real code.
[CommonLispStat.git] / lstypes.lsp
blobe3b5ceb03d2ca4bacb81a220149d0544a5262dda
1 ;;; -*- mode: lisp -*-
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 (in-package :cl-user)
9 (defpackage :lisp-stat-types
10 (:use :common-lisp)
11 (:export fixnump check-nonneg-fixnum check-one-fixnum
12 check-one-real check-one-number
15 ))
17 (in-package :lisp-stat-types)
19 ;;; Type Checking Functions
20 ;;; (Moved out of lsbasics.lsp, placed there by initial design).
22 (defun fixnump (x)
23 "Args: (x)
24 Returns T if X is a fixnum; NIL otherwise."
25 (declare (inline typep))
26 (typep x 'fixnum))
28 (defun check-nonneg-fixnum (x)
29 (if (and (fixnump x) (<= 0 x))
31 (error "not a non-negative fixnum")))
33 (defun check-one-fixnum (x)
34 (if (not (fixnump x))
35 (error "not a fixnum - ~a" x)))
37 (defun check-one-real (a)
38 (if (not (or (rationalp a) (floatp a)))
39 (error "not a real number ~s" a)
40 t))
42 (defun check-one-number (a)
43 (if (not (numberp a))
44 (error "not a number ~s" a)
45 t))