/[gcl]/gcl/ansi-tests/ansi-aux.lsp
ViewVC logotype

Diff of /gcl/ansi-tests/ansi-aux.lsp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.64 by pfdietz, Thu Jun 5 11:24:14 2003 UTC revision 1.65 by pfdietz, Tue Jun 10 00:05:35 2003 UTC
# Line 405  the condition to go uncaught if it canno Line 405  the condition to go uncaught if it canno
405  (defun symbol< (x &rest args)  (defun symbol< (x &rest args)
406    (apply #'string< (symbol-name x) (mapcar #'symbol-name args)))    (apply #'string< (symbol-name x) (mapcar #'symbol-name args)))
407    
 (defun random-from-seq (seq)  
   "Generate a random member of a sequence."  
   (let ((len (length seq)))  
     (assert (> len 0))  
     (elt seq (random len))))  
   
 (defmacro random-case (&body cases)  
   (let ((len (length cases)))  
     (assert (> len 0))  
     `(case (random ,len)  
        ,@(loop for i from 0 for e in cases collect `(,i ,e))  
        (t (error "Can't happen?! (in random-case~%")))))  
   
 (defun coin (&optional (n 2))  
   "Flip an n-sided coin."  
   (eql (random n) 0))  
   
 ;;; Randomly permute a sequence  
 (defun random-permute (seq)  
   (setq seq (copy-seq seq))  
   (let ((len (length seq)))  
     (loop for i from len downto 2  
           do (let ((r (random i)))  
                (rotatef (elt seq r) (elt seq (1- i))))))  
   seq)  
408    
409  (defun make-list-expr (args)  (defun make-list-expr (args)
410    "Build an expression for computing (LIST . args), but that evades    "Build an expression for computing (LIST . args), but that evades

Legend:
Removed from v.1.64  
changed lines
  Added in v.1.65

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26