X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=utils.lisp;h=92f9f994598d591b5b886fcdc28bbba4fb87735c;hb=a8b65e823b3a59faba717887aee3a8a4a8cf0a28;hp=247722415a707252417378d1fefa378d61431a4e;hpb=48b1a775e575a66bc154620107a8e27321ea306c;p=reversi.git diff --git a/utils.lisp b/utils.lisp index 2477224..92f9f99 100644 --- a/utils.lisp +++ b/utils.lisp @@ -1,15 +1,15 @@ ;;;;*************************************************************************** ;;;; ;;;; 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.4 2003/05/06 15:51:20 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 @@ -18,8 +18,6 @@ (in-package #:reversi) -(eval-when (:compile-toplevel) - (declaim (optimize (safety 1) (space 0) (speed 3) (compilation-speed 0)))) (defmacro missing-argument () `(error "Missing an argument to a constructor")) @@ -44,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" @@ -79,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)) - +