X-Git-Url: http://git.kpe.io/?p=reversi.git;a=blobdiff_plain;f=utils.lisp;h=8cd387dc1063b78b36cafaa73789a1c40bb94a73;hp=1a904e54232ca76a991ac61a9dbd71526365e921;hb=d92820d39c18a373611b5bfb018631cffe3e4bcd;hpb=1758cfb593196dd65c70199aa1ebd90cbd6e7ee5 diff --git a/utils.lisp b/utils.lisp index 1a904e5..8cd387d 100644 --- a/utils.lisp +++ b/utils.lisp @@ -7,19 +7,21 @@ ;;;; Programer: Kevin M. Rosenberg ;;;; Date Started: 1 Nov 2001 ;;;; -;;;; $Id: utils.lisp,v 1.2 2002/10/25 09:23:39 kevin Exp $ +;;;; $Id: utils.lisp,v 1.6 2003/06/12 13:08:43 kevin Exp $ ;;;; -;;;; This file is Copyright (c) 2001-2002 by Kevin M. Rosenberg +;;;; This file is Copyright (c) 2001-2003 by Kevin M. Rosenberg ;;;; ;;;; Reversi users are granted the rights to distribute and use this software ;;;; as governed by the terms of the Lisp Lesser GNU Public License ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;;*************************************************************************** -(in-package :reversi) -(declaim (optimize (safety 1) (debug 3) (speed 3) (compilation-speed 0))) +(in-package #:reversi) +(defmacro missing-argument () + `(error "Missing an argument to a constructor")) + ;; Anaphoric macros (defmacro aif (test then &optional else) @@ -40,9 +42,10 @@ Like mapcon, but uses append instead of nconc." (apply #'append (mapcar fn list))) -(defun random-elt (seq) +(defun random-nth (seq) + (declare (list seq)) "Pick a random element out of a sequence." - (elt seq (random (length seq)))) + (nth (random (length seq)) nth)) (defun concat-symbol (&rest args) "Concatenate symbols or strings to form an interned symbol"