From pscott at common-lisp.net Wed Dec 14 21:15:22 2005 From: pscott at common-lisp.net (Peter Scott) Date: Wed, 14 Dec 2005 22:15:22 +0100 (CET) Subject: [cl-utilities-cvs] CVS update: cl-utilities/extremum.lisp Message-ID: <20051214211522.E8A3E8857A@common-lisp.net> Update of /project/cl-utilities/cvsroot/cl-utilities In directory common-lisp.net:/tmp/cvs-serv23548 Modified Files: extremum.lisp Log Message: Big improvement to the documentation. I actually added a manual instead of simply telling people to look at the Cliki pages. Also added a little more argument checking to N-MOST-EXTREME function. Date: Wed Dec 14 22:15:15 2005 Author: pscott Index: cl-utilities/extremum.lisp diff -u cl-utilities/extremum.lisp:1.9 cl-utilities/extremum.lisp:1.10 --- cl-utilities/extremum.lisp:1.9 Wed Nov 30 01:07:15 2005 +++ cl-utilities/extremum.lisp Wed Dec 14 22:15:15 2005 @@ -154,6 +154,7 @@ elements in the relevant part of the sequence, this will return all the elements it can and signal the warning N-MOST-EXTREME-NOT-ENOUGH-ELEMENTS" + (check-type n (integer 0)) (with-check-length (sequence start end) ;; This is faster on vectors than on lists. (let ((sequence (subseq sequence start end))) From pscott at common-lisp.net Wed Dec 14 21:15:24 2005 From: pscott at common-lisp.net (Peter Scott) Date: Wed, 14 Dec 2005 22:15:24 +0100 (CET) Subject: [cl-utilities-cvs] CVS update: cl-utilities/doc/compose.html cl-utilities/doc/copy-array.html cl-utilities/doc/expt-mod.html cl-utilities/doc/index.html cl-utilities/doc/once-only.html cl-utilities/doc/rotate-byte.html cl-utilities/doc/style.css cl-utilities/doc/with-unique-names.html cl-utilities/doc/collecting.html cl-utilities/doc/extremum.html cl-utilities/doc/read-delimited.html cl-utilities/doc/split-sequence.html Message-ID: <20051214211524.4A85588586@common-lisp.net> Update of /project/cl-utilities/cvsroot/cl-utilities/doc In directory common-lisp.net:/tmp/cvs-serv23548/doc Modified Files: collecting.html extremum.html read-delimited.html split-sequence.html Added Files: compose.html copy-array.html expt-mod.html index.html once-only.html rotate-byte.html style.css with-unique-names.html Log Message: Big improvement to the documentation. I actually added a manual instead of simply telling people to look at the Cliki pages. Also added a little more argument checking to N-MOST-EXTREME function. Date: Wed Dec 14 22:15:19 2005 Author: pscott Index: cl-utilities/doc/collecting.html diff -u cl-utilities/doc/collecting.html:1.1 cl-utilities/doc/collecting.html:1.2 --- cl-utilities/doc/collecting.html:1.1 Mon Aug 29 22:18:18 2005 +++ cl-utilities/doc/collecting.html Wed Dec 14 22:15:16 2005 @@ -43,6 +43,19 @@

If the collector names are not all symbols, a type-error will be signalled. +

Examples: + +

+(collecting (dotimes (x 10) (collect x))) => (0 1 2 3 4 5 6 7 8 9)
+
+(multiple-value-bind (a b)
+    (with-collectors (x y)
+      (x 1)
+      (y 2)
+      (x 3))
+  (append a b)) => (1 2 3)
+
+

Implementation notes:

Opinions differ on how a collection macro should work. There are @@ -59,5 +72,7 @@ and you can't nest them to get the same effect as multiple collection since it always uses the collect function. If you want to collect into multiple lists, use the with-collect macro.

+ +
Manual Index

Index: cl-utilities/doc/extremum.html diff -u cl-utilities/doc/extremum.html:1.1 cl-utilities/doc/extremum.html:1.2 --- cl-utilities/doc/extremum.html:1.1 Mon Aug 29 22:18:18 2005 +++ cl-utilities/doc/extremum.html Wed Dec 14 22:15:18 2005 @@ -1,17 +1,19 @@ - Function EXTREMUM + Function EXTREMUM, EXTREMA, N-MOST-EXTREME -

Function EXTREMUM

+

Function EXTREMUM, EXTREMA, N-MOST-EXTREME

Syntax:

extremum sequence predicate &key key (start 0) end => morally-smallest-element

+

extrema sequence predicate &key key (start 0) end => morally-smallest-elements

+

n-most-extreme n sequence predicate &key key (start 0) end => n-smallest-elements

Arguments and Values:

@@ -32,6 +34,22 @@ http://www.lisp.org/HyperSpec/Body/fun_sortcm_stable-sort.html">sort using predicate and key +

morally-smallest-elements---the identical elements of +sequence that would appear first if the sequence were ordered +according to sort +using predicate and key. If predicate states that +neither of two objects is before the other, they are considered +identical. + +n---a positive integer

+ +n-smallest-elements---the n elements of sequence that +would appear first if the sequence were ordered according to sort +using predicate and key +

Description:

@@ -82,6 +100,18 @@ predicate (subseq sequence start end) :key key) 0) except when sequence is empty (see Exceptional Situations), but may use faster (less asymptotically complex) algorithms to find this answer. + +

extrema is similar to extremum, but it returns a list +of values. There can be more than one extremum, as determined by +predicate, and with extremum the choice of which +extremum to return is arbitrary. extrema returns all the +possible values which predicate determines to be equal. + +

n-most-extreme returns a list of n values without +testing for equality. It orders sequence in the same way as +extremum and extrema, then returns the first n +elements of the sorted sequence. +

Exceptional situations:

@@ -94,6 +124,14 @@

Should be prepared to signal an error of type type-error if sequence is not a proper sequence. +

If there are fewer than n values in the part of +sequence that n-most-extreme may operate on, it returns +all the values it can in sorted order and signals the warning +n-most-extreme-not-enough-elements. This warning stores the +given values for n and the relevant subsequence, and they may +be accessed with n-most-extreme-not-enough-elements-n and +n-most-extreme-not-enough-elements-subsequence, respectively. +

Implementation notes:

There are two implementations of this function included in @@ -111,5 +149,7 @@

Don't worry about the performance of passing #'identity as key. This is optimized by a compiler macro.

+ +
Manual Index

Index: cl-utilities/doc/read-delimited.html diff -u cl-utilities/doc/read-delimited.html:1.1 cl-utilities/doc/read-delimited.html:1.2 --- cl-utilities/doc/read-delimited.html:1.1 Mon Aug 29 22:18:18 2005 +++ cl-utilities/doc/read-delimited.html Wed Dec 14 22:15:18 2005 @@ -83,4 +83,6 @@ it is more efficient. If you need something more high-level, this could be built on top of read-delimited fairly easily.

+
Manual Index

+ Index: cl-utilities/doc/split-sequence.html diff -u cl-utilities/doc/split-sequence.html:1.1 cl-utilities/doc/split-sequence.html:1.2 --- cl-utilities/doc/split-sequence.html:1.1 Mon Aug 29 22:18:18 2005 +++ cl-utilities/doc/split-sequence.html Wed Dec 14 22:15:18 2005 @@ -84,4 +84,6 @@ it, or even just complain about it on the mailing list---something might get done.

+
Manual Index

+ From pscott at common-lisp.net Wed Dec 14 21:44:12 2005 From: pscott at common-lisp.net (Peter Scott) Date: Wed, 14 Dec 2005 22:44:12 +0100 (CET) Subject: [cl-utilities-cvs] CVS update: cl-utilities/package.sh Message-ID: <20051214214412.003558857A@common-lisp.net> Update of /project/cl-utilities/cvsroot/cl-utilities In directory common-lisp.net:/tmp/cvs-serv25898 Modified Files: package.sh Log Message: Updated the packaging instructions a little. This is for my own use only, BTW. It would probably be almost useless for anyone else. Date: Wed Dec 14 22:44:12 2005 Author: pscott Index: cl-utilities/package.sh diff -u cl-utilities/package.sh:1.5 cl-utilities/package.sh:1.6 --- cl-utilities/package.sh:1.5 Mon Nov 28 22:45:49 2005 +++ cl-utilities/package.sh Wed Dec 14 22:44:12 2005 @@ -1,17 +1,19 @@ #!/bin/sh -mkdir cl-utilities-1.2 -cp cl-utilities.asd package.sh collecting.lisp split-sequence.lisp expt-mod.lisp package.lisp compose.lisp extremum.lisp read-delimited.lisp test.lisp copy-array.lisp once-only.lisp rotate-byte.lisp with-unique-names.lisp README cl-utilities-1.2/ +mkdir cl-utilities-1.2.1 +mkdir cl-utilities-1.2.1/doc +cp cl-utilities.asd package.sh collecting.lisp split-sequence.lisp expt-mod.lisp package.lisp compose.lisp extremum.lisp read-delimited.lisp test.lisp copy-array.lisp once-only.lisp rotate-byte.lisp with-unique-names.lisp README cl-utilities-1.2.1/ +cp doc/collecting.html doc/expt-mod.html doc/read-delimited.html doc/with-unique-names.html doc/compose.html doc/extremum.html doc/rotate-byte.html doc/copy-array.html doc/index.html doc/split-sequence.html doc/once-only.html doc/style.css cl-utilities-1.2.1/doc/ rm -f cl-utilities-latest.tar.gz cl-utilities-latest.tar.gz.asc -tar -czvf cl-utilities-1.2.tar.gz cl-utilities-1.2/ -ln -s ~/hacking/lisp/cl-utilities/cl-utilities-1.2.tar.gz ~/hacking/lisp/cl-utilities/cl-utilities-latest.tar.gz -gpg -b -a ~/hacking/lisp/cl-utilities/cl-utilities-1.2.tar.gz -ln -s ~/hacking/lisp/cl-utilities/cl-utilities-1.2.tar.gz.asc ~/hacking/lisp/cl-utilities/cl-utilities-latest.tar.gz.asc -rm -Rf cl-utilities-1.2/ +tar -czvf cl-utilities-1.2.1.tar.gz cl-utilities-1.2.1/ +ln -s ~/hacking/lisp/cl-utilities/cl-utilities-1.2.1.tar.gz ~/hacking/lisp/cl-utilities/cl-utilities-latest.tar.gz +gpg -b -a ~/hacking/lisp/cl-utilities/cl-utilities-1.2.1.tar.gz +ln -s ~/hacking/lisp/cl-utilities/cl-utilities-1.2.1.tar.gz.asc ~/hacking/lisp/cl-utilities/cl-utilities-latest.tar.gz.asc +rm -Rf cl-utilities-1.2.1/ -scp cl-utilities-1.2.tar.gz pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-1.2.tar.gz -scp cl-utilities-1.2.tar.gz.asc pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-1.2.tar.gz.asc +scp cl-utilities-1.2.1.tar.gz pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-1.2.1.tar.gz +scp cl-utilities-1.2.1.tar.gz.asc pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-1.2.1.tar.gz.asc scp cl-utilities-latest.tar.gz pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-latest.tar.gz scp cl-utilities-latest.tar.gz.asc pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-latest.tar.gz.asc From pscott at common-lisp.net Wed Dec 28 23:34:30 2005 From: pscott at common-lisp.net (Peter Scott) Date: Thu, 29 Dec 2005 00:34:30 +0100 (CET) Subject: [cl-utilities-cvs] CVS update: cl-utilities/cl-utilities.asd cl-utilities/package.lisp cl-utilities/package.sh cl-utilities/rotate-byte.lisp Message-ID: <20051228233430.61D7E8856A@common-lisp.net> Update of /project/cl-utilities/cvsroot/cl-utilities In directory common-lisp.net:/tmp/cvs-serv3004 Modified Files: cl-utilities.asd package.lisp package.sh rotate-byte.lisp Log Message: 1. Now this doesn't assume that SBCL has sb-rotate-byte, which was causing some problems. Thanks to Gary King and John Wiseman for finding this problem in a certain version of SBCL on ppc. 2. If :split-sequence-deprecated is added to *features* before compiling cl-utilities, it will create a :split-sequence package which exports the usual split-sequence interface. This is for easy backward compatibility. If you do not add :split-sequence-deprecated to *features*, it will leave split-sequence alone. Thanks to Greg Pfeil for the idea and some of the code. Date: Thu Dec 29 00:34:29 2005 Author: pscott Index: cl-utilities/cl-utilities.asd diff -u cl-utilities/cl-utilities.asd:1.3 cl-utilities/cl-utilities.asd:1.4 --- cl-utilities/cl-utilities.asd:1.3 Mon Aug 29 22:14:47 2005 +++ cl-utilities/cl-utilities.asd Thu Dec 29 00:34:28 2005 @@ -21,7 +21,13 @@ (:file "once-only" :depends-on ("package")) (:file "rotate-byte" :depends-on ("package")) (:file "copy-array" :depends-on ("package")) - (:file "compose" :depends-on ("package"))) - ;; On SBCL, we can speed up byte rotation by using its - ;; implementation of rotate-byte. - :depends-on (#+sbcl :sb-rotate-byte)) \ No newline at end of file + (:file "compose" :depends-on ("package")))) + +;; Sometimes we can accelerate byte rotation on SBCL by using the +;; SB-ROTATE-BYTE extension. This loads it. +#+sbcl +(eval-when (:compile-toplevel :load-toplevel :execute) + (handler-case (progn + (require :sb-rotate-byte) + (pushnew :sbcl-uses-sb-rotate-byte *features*)) + (error () (delete :sbcl-uses-sb-rotate-byte *features*)))) \ No newline at end of file Index: cl-utilities/package.lisp diff -u cl-utilities/package.lisp:1.5 cl-utilities/package.lisp:1.6 --- cl-utilities/package.lisp:1.5 Mon Nov 28 22:45:49 2005 +++ cl-utilities/package.lisp Thu Dec 29 00:34:29 2005 @@ -39,4 +39,11 @@ #:copy-array - #:compose)) \ No newline at end of file + #:compose)) + +#+split-sequence-deprecated +(defpackage :split-sequence + (:documentation "This package mimics SPLIT-SEQUENCE for compatibility with +packages that expect that system.") + (:use :cl-utilities) + (:export #:split-sequence #:split-sequence-if #:split-sequence-if-not)) Index: cl-utilities/package.sh diff -u cl-utilities/package.sh:1.6 cl-utilities/package.sh:1.7 --- cl-utilities/package.sh:1.6 Wed Dec 14 22:44:12 2005 +++ cl-utilities/package.sh Thu Dec 29 00:34:29 2005 @@ -1,19 +1,21 @@ #!/bin/sh -mkdir cl-utilities-1.2.1 -mkdir cl-utilities-1.2.1/doc -cp cl-utilities.asd package.sh collecting.lisp split-sequence.lisp expt-mod.lisp package.lisp compose.lisp extremum.lisp read-delimited.lisp test.lisp copy-array.lisp once-only.lisp rotate-byte.lisp with-unique-names.lisp README cl-utilities-1.2.1/ -cp doc/collecting.html doc/expt-mod.html doc/read-delimited.html doc/with-unique-names.html doc/compose.html doc/extremum.html doc/rotate-byte.html doc/copy-array.html doc/index.html doc/split-sequence.html doc/once-only.html doc/style.css cl-utilities-1.2.1/doc/ +mkdir cl-utilities-1.2.3 +mkdir cl-utilities-1.2.3/doc +cp cl-utilities.asd package.sh collecting.lisp split-sequence.lisp expt-mod.lisp package.lisp compose.lisp extremum.lisp read-delimited.lisp test.lisp copy-array.lisp once-only.lisp rotate-byte.lisp with-unique-names.lisp README cl-utilities-1.2.3/ +cp doc/collecting.html doc/expt-mod.html doc/read-delimited.html doc/with-unique-names.html doc/compose.html doc/extremum.html doc/rotate-byte.html doc/copy-array.html doc/index.html doc/split-sequence.html doc/once-only.html doc/style.css cl-utilities-1.2.3/doc/ rm -f cl-utilities-latest.tar.gz cl-utilities-latest.tar.gz.asc -tar -czvf cl-utilities-1.2.1.tar.gz cl-utilities-1.2.1/ -ln -s ~/hacking/lisp/cl-utilities/cl-utilities-1.2.1.tar.gz ~/hacking/lisp/cl-utilities/cl-utilities-latest.tar.gz -gpg -b -a ~/hacking/lisp/cl-utilities/cl-utilities-1.2.1.tar.gz -ln -s ~/hacking/lisp/cl-utilities/cl-utilities-1.2.1.tar.gz.asc ~/hacking/lisp/cl-utilities/cl-utilities-latest.tar.gz.asc -rm -Rf cl-utilities-1.2.1/ +tar -czvf cl-utilities-1.2.3.tar.gz cl-utilities-1.2.3/ +ln -s ~/hacking/lisp/cl-utilities/cl-utilities-1.2.3.tar.gz ~/hacking/lisp/cl-utilities/cl-utilities-latest.tar.gz +gpg -b -a ~/hacking/lisp/cl-utilities/cl-utilities-1.2.3.tar.gz +ln -s ~/hacking/lisp/cl-utilities/cl-utilities-1.2.3.tar.gz.asc ~/hacking/lisp/cl-utilities/cl-utilities-latest.tar.gz.asc +rm -Rf cl-utilities-1.2.3/ -scp cl-utilities-1.2.1.tar.gz pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-1.2.1.tar.gz -scp cl-utilities-1.2.1.tar.gz.asc pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-1.2.1.tar.gz.asc +scp cl-utilities-1.2.3.tar.gz pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-1.2.3.tar.gz +scp cl-utilities-1.2.3.tar.gz.asc pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-1.2.3.tar.gz.asc +scp cl-utilities-latest.tar.gz pscott at common-lisp.net:/project/cl-utilities/ftp/cl-utilities-1.2.3.tar.gz +scp cl-utilities-latest.tar.gz.asc pscott at common-lisp.net:/project/cl-utilities/ftp/cl-utilities-1.2.3.tar.gz.asc scp cl-utilities-latest.tar.gz pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-latest.tar.gz scp cl-utilities-latest.tar.gz.asc pscott at common-lisp.net:/project/cl-utilities/public_html/cl-utilities-latest.tar.gz.asc Index: cl-utilities/rotate-byte.lisp diff -u cl-utilities/rotate-byte.lisp:1.1.1.1 cl-utilities/rotate-byte.lisp:1.2 --- cl-utilities/rotate-byte.lisp:1.1.1.1 Mon May 9 23:26:29 2005 +++ cl-utilities/rotate-byte.lisp Thu Dec 29 00:34:29 2005 @@ -22,8 +22,8 @@ bytespec integer)))) ;; On SBCL, we use the SB-ROTATE-BYTE extension. - #+sbcl (sb-rotate-byte:rotate-byte count bytespec integer)) + #+sbcl-uses-sb-rotate-byte (sb-rotate-byte:rotate-byte count bytespec integer)) ;; If we're using the SB-ROTATE-BYTE extension, we should inline our ;; call and let SBCL handle optimization from there. -#+sbcl (declaim (inline rotate-byte)) \ No newline at end of file +#+sbcl-uses-sb-rotate-byte (declaim (inline rotate-byte)) \ No newline at end of file