;;;;***************************************************************************
;;;;
;;;; 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
(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"))
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"
(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))
-
+