crude hack to allow Carlos and my home directories. Feel free to add more.
[CommonLispStat.git] / lstypes.lsp
blob89050292022de6a43d32c80975acfe91c8dd2f30
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))
14 (in-package :lisp-stat-types)
16 ;;; Type Checking Functions
17 ;;; (Moved out of lsbasics.lsp, placed there by initial design).
19 (defun fixnump (x)
20 "Args: (x)
21 Returns T if X is a fixnum; NIL otherwise."
22 (declare (inline typep))
23 (typep x 'fixnum))
25 (defun check-nonneg-fixnum (x)
26 (if (and (fixnump x) (<= 0 x))
28 (error "not a non-negative fixnum")))
30 (defun check-one-fixnum (x)
31 (if (not (fixnump x))
32 (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)
37 t))
39 (defun check-one-number (a)
40 (if (not (numberp a))
41 (error "not a number ~s" a)
42 t))