X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=utils.lisp;h=92f9f994598d591b5b886fcdc28bbba4fb87735c;hb=d3d73d3ab232a53d1e625f6f57b712c31d6e0f00;hp=d201033e9cd3750f770d6c2ced5e6ace72e7dcc8;hpb=5c954ef78b1ea675a6f3f12c118b053665a38f39;p=reversi.git diff --git a/utils.lisp b/utils.lisp index d201033..92f9f99 100644 --- a/utils.lisp +++ b/utils.lisp @@ -1,23 +1,23 @@ ;;;;*************************************************************************** ;;;; ;;;; FILE IDENTIFICATION -;;;; +;;;; ;;;; Name: reversi-base.lisp ;;;; Purpose: Basic functions for reversi ;;;; Programer: Kevin M. Rosenberg ;;;; Date Started: 1 Nov 2001 ;;;; -;;;; $Id: utils.lisp,v 1.3 2002/10/25 12:39:15 kevin Exp $ +;;;; $Id$ ;;;; -;;;; 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")) @@ -42,9 +42,10 @@ Like mapcon, but uses append instead of nconc." (apply #'append (mapcar fn list))) -(defun random-elt (seq) - "Pick a random element out of a sequence." - (elt seq (random (length seq)))) +(defun random-nth (list) + (declare (list list)) + "Pick a random element out of a list." + (nth (random (length list)) list)) (defun concat-symbol (&rest args) "Concatenate symbols or strings to form an interned symbol" @@ -77,9 +78,9 @@ (let ((output (when list (format nil "~A" (car list))))) (dolist (obj (rest list)) (setq output (concatenate 'string output - (format nil "~A" separator) - (format nil "~A" obj)))) + (format nil "~A" separator) + (format nil "~A" obj)))) output)) - +