[alexandria.git] updated branch master: 107eb17 fix docstring of IOTA
Nikodemus Siivola
nsiivola at common-lisp.net
Sat Jan 26 14:26:51 UTC 2013
The branch master has been updated:
via 107eb17cefb15e9a66b1301b970d5ca3aefc42d3 (commit)
via 6ff804073bf43faa91059ae78c8aa4f096462a7e (commit)
via 17a5957f85ceac9b26861dfbce00ee7bab79d7e7 (commit)
via 70b033c7561826fb4f90eba10c36b33c1471d399 (commit)
via e22dcde8b0646e4d023a2652fcf7be1c1e707f10 (commit)
via 7fc0d5c03c5fe1377a38aabd326dbb8d18e873de (commit)
via e1da77b014a2b53acdfe5f92e971cdefabd65a15 (commit)
from 0c39310ebc2de5543157e6b862e909036b39d936 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 107eb17cefb15e9a66b1301b970d5ca3aefc42d3
Author: Nikodemus Siivola <nikodemus at random-state.net>
Date: Sat Jan 26 16:25:56 2013 +0200
fix docstring of IOTA
commit 6ff804073bf43faa91059ae78c8aa4f096462a7e
Author: Nikodemus Siivola <nikodemus at random-state.net>
Date: Sat Jan 26 15:46:01 2013 +0200
fix contagion in IOTA when step is a complex integer and start is a float
commit 17a5957f85ceac9b26861dfbce00ee7bab79d7e7
Author: Michael Stevens <mstevens at etla.org>
Date: Sun Oct 14 14:09:31 2012 +0100
Improve spelling
commit 70b033c7561826fb4f90eba10c36b33c1471d399
Author: Nikodemus Siivola <nikodemus at random-state.net>
Date: Sat Jan 26 15:33:48 2013 +0200
document restrictions on GAUSSIAN-RANDOM
commit e22dcde8b0646e4d023a2652fcf7be1c1e707f10
Author: Nikodemus Siivola <nikodemus at random-state.net>
Date: Sat Jan 26 15:24:33 2013 +0200
FORMAT-SYMBOL now uses WITH-STANDARD-IO-SYNTAX
commit 7fc0d5c03c5fe1377a38aabd326dbb8d18e873de
Author: Nikodemus Siivola <nikodemus at random-state.net>
Date: Sat Jan 26 15:10:59 2013 +0200
fix starts-with-subseq :start1 and :start2
commit e1da77b014a2b53acdfe5f92e971cdefabd65a15
Author: Jan Moringen <jmoringe at techfak.uni-bielefeld.de>
Date: Mon Jun 18 19:27:04 2012 +0200
update doc/alexandria.texinfo
add IO chapter containing READ-FILE-INTO-{STRING,BYTE-VECTOR}
change include/fun-alexandria-ensure-gethash.texinfo
-> include/macro-alexandria-ensure-gethash.texinfo
-----------------------------------------------------------------------
Summary of changes:
README | 4 ++--
doc/alexandria.texinfo | 28 ++++++++++++++++++----------
numbers.lisp | 14 +++++++++-----
sequences.lisp | 2 +-
symbols.lisp | 16 ++++++++++------
tests.lisp | 33 +++++++++++++++++++++++++++++++++
6 files changed, 73 insertions(+), 24 deletions(-)
diff --git a/README b/README
index 8081c60..59e49ab 100644
--- a/README
+++ b/README
@@ -14,7 +14,7 @@ meet the following constraints:
include anaphoric constructs, loop-like binding macros, etc.
* Portable: Alexandria limits itself to portable parts of Common
- Lisp. Even apparently conservative and usefull functions remain
+ Lisp. Even apparently conservative and useful functions remain
outside the scope of Alexandria if they cannot be implemented
portably. Portability is here defined as portable within a
conforming implementation: implementation bugs are not considered
@@ -48,5 +48,5 @@ Patches:
done and /why/, and when fixing a bug or adding a feature you should
also include a test-case.
- Be adviced though that right now new features are unlikely to be
+ Be advised though that right now new features are unlikely to be
accepted until 1.0 is officially out of the door.
diff --git a/doc/alexandria.texinfo b/doc/alexandria.texinfo
index 792139c..4468b0e 100644
--- a/doc/alexandria.texinfo
+++ b/doc/alexandria.texinfo
@@ -81,15 +81,16 @@ terms and conditions:
@insertcopying
@menu
-* Hash Tables::
-* Data and Control Flow::
-* Conses::
-* Sequences::
-* Macro Writing::
-* Symbols::
-* Arrays::
-* Types::
-* Numbers::
+* Hash Tables::
+* Data and Control Flow::
+* Conses::
+* Sequences::
+* IO::
+* Macro Writing::
+* Symbols::
+* Arrays::
+* Types::
+* Numbers::
@end menu
@end ifnottex
@@ -98,7 +99,7 @@ terms and conditions:
@comment node-name, next, previous, up
@chapter Hash Tables
- at include include/fun-alexandria-ensure-gethash.texinfo
+ at include include/macro-alexandria-ensure-gethash.texinfo
@include include/fun-alexandria-copy-hash-table.texinfo
@include include/fun-alexandria-maphash-keys.texinfo
@include include/fun-alexandria-maphash-values.texinfo
@@ -204,6 +205,13 @@ terms and conditions:
@include include/fun-alexandria-map-derangements.texinfo
@include include/fun-alexandria-map-permutations.texinfo
+ at node IO
+ at comment node-name, next, previous, up
+ at chapter IO
+
+ at include include/fun-alexandria-read-file-into-string.texinfo
+ at include include/fun-alexandria-read-file-into-byte-vector.texinfo
+
@node Macro Writing
@comment node-name, next, previous, up
@chapter Macro Writing
diff --git a/numbers.lisp b/numbers.lisp
index 03430cc..7210123 100644
--- a/numbers.lisp
+++ b/numbers.lisp
@@ -13,7 +13,11 @@ MIN and MAX if NUMBER is greater then MAX, otherwise returns NUMBER."
(defun gaussian-random (&optional min max)
"Returns two gaussian random double floats as the primary and secondary value,
optionally constrained by MIN and MAX. Gaussian random numbers form a standard
-normal distribution around 0.0d0."
+normal distribution around 0.0d0.
+
+Sufficiently positive MIN or negative MAX will cause the algorithm used to
+take a very long time. If MIN is positive it should be close to zero, and
+similarly if MAX is negative it should be close to zero."
(labels ((gauss ()
(loop
for x1 = (- (random 2.0d0) 1.0d0)
@@ -48,15 +52,15 @@ and STEP. START defaults to 0 and STEP to 1.
Examples:
- (iota 4) => (0 1 2 3 4)
+ (iota 4) => (0 1 2 3)
(iota 3 :start 1 :step 1.0) => (1.0 2.0 3.0)
(iota 3 :start -1 :step -1/2) => (-1 -3/2 -2)
"
(declare (type (integer 0) n) (number start step))
(loop repeat n
- ;; KLUDGE: get numeric contagion right for the first element too
- for i = (+ start (- step step)) then (+ i step)
- collect i))
+ ;; KLUDGE: get numeric contagion right for the first element too
+ for i = (+ (- (+ start step) step)) then (+ i step)
+ collect i))
(declaim (inline map-iota))
(defun map-iota (function n &key (start 0) (step 1))
diff --git a/sequences.lisp b/sequences.lisp
index 8b9a443..94c16b9 100644
--- a/sequences.lisp
+++ b/sequences.lisp
@@ -289,7 +289,7 @@ displaced array pointing to the sequence after PREFIX."
(let ((sequence-length (length sequence))
(prefix-length (length prefix)))
(if (<= prefix-length sequence-length)
- (let ((mismatch (apply #'mismatch sequence prefix args)))
+ (let ((mismatch (apply #'mismatch prefix sequence args)))
(if mismatch
(if (< mismatch prefix-length)
(values nil nil)
diff --git a/symbols.lisp b/symbols.lisp
index e612afc..5733d3e 100644
--- a/symbols.lisp
+++ b/symbols.lisp
@@ -21,12 +21,16 @@ Example:
(declaim (inline format-symbol))
(defun format-symbol (package control &rest arguments)
- "Constructs a string by applying ARGUMENTS to string designator
-CONTROL as if by FORMAT, and then creates a symbol named by that
-string. If PACKAGE is NIL, returns an uninterned symbol, if package is
-T, returns a symbol interned in the current package, and otherwise
-returns a symbol interned in the package designated by PACKAGE."
- (maybe-intern (apply #'format nil (string control) arguments) package))
+ "Constructs a string by applying ARGUMENTS to string designator CONTROL as
+if by FORMAT within WITH-STANDARD-IO-SYNTAX, and then creates a symbol named
+by that string.
+
+If PACKAGE is NIL, returns an uninterned symbol, if package is T, returns a
+symbol interned in the current package, and otherwise returns a symbol
+interned in the package designated by PACKAGE."
+ (maybe-intern (with-standard-io-syntax
+ (apply #'format nil (string control) arguments))
+ package))
(defun make-keyword (name)
"Interns the string designated by NAME in the KEYWORD package."
diff --git a/tests.lisp b/tests.lisp
index 7ffe30f..f203aad 100644
--- a/tests.lisp
+++ b/tests.lisp
@@ -1852,3 +1852,36 @@
(incf n))
n)
13)
+
+(deftest starts-with-subseq.start1
+ (starts-with-subseq "foo" "oop" :start1 1)
+ t
+ nil)
+
+(deftest starts-with-subseq.start2
+ (starts-with-subseq "foo" "xfoop" :start2 1)
+ t
+ nil)
+
+(deftest format-symbol.print-case-bound
+ (let ((upper (intern "FOO-BAR"))
+ (lower (intern "foo-bar"))
+ (*print-escape* nil))
+ (values
+ (let ((*print-case* :downcase))
+ (and (eq upper (format-symbol t "~A" upper))
+ (eq lower (format-symbol t "~A" lower))))
+ (let ((*print-case* :upcase))
+ (and (eq upper (format-symbol t "~A" upper))
+ (eq lower (format-symbol t "~A" lower))))
+ (let ((*print-case* :capitalize))
+ (and (eq upper (format-symbol t "~A" upper))
+ (eq lower (format-symbol t "~A" lower))))))
+ t
+ t
+ t)
+
+(deftest iota.fp-start-and-complex-integer-step
+ (equal '(#C(0.0 0.0) #C(0.0 2.0) #C(0.0 4.0))
+ (iota 3 :start 0.0 :step #C(0 2)))
+ t)
--
Alexandria hooks/post-receive
More information about the alexandria-cvs
mailing list