[alexandria-devel] [PATCH] Fix for a bug in map-permutations

Juan M. Bello Rivas jmbr at superadditive.com
Sat May 10 13:11:23 UTC 2008


Hi,

The function map-permutations wasn't working.  The attached patch
fixes it.

Regards,

-- 
Juan M. Bello Rivas
-------------- next part --------------

New patches:

[Fixed a bug in map-permutations.
Juan M. Bello Rivas <jmbr at superadditive.com>**20080510130109] {
hunk ./sequences.lisp 345
-                     (if (evenp n-1)
-                         (loop for i from 0 upto n-1
-                               do (permute seq n-1)
-                                  (if (evenp n-1)
-                                      (rotatef (elt seq 0) (elt seq n-1))
-                                      (rotatef (elt seq i) (elt seq n-1))))))))
+                     (loop for i from 0 upto n-1
+                           do (permute seq n-1)
+                           (if (evenp n-1)
+                               (rotatef (elt seq 0) (elt seq n-1))
+                               (rotatef (elt seq i) (elt seq n-1)))))))
}

Context:

[Fix some glitches with simple-reader-error and add comment why there's no :report for it.
attila.lendvai at gmail.com**20080401110518] 
[Added simple-reader-error
attila.lendvai at gmail.com**20080327192821] 
[alexandria-export-unwind-protect-case.diff
Tobias C. Rittweiler <tcr at freebits.de>**20080311195448
 
 	* package.lisp: Export UNWIND-PROTECT-CASE.
] 
[alexandria-unwind-protect-case.diff
Tobias C. Rittweiler <tcr at freebits.de>**20080311154836
 
 	* conditions.lisp (unwind-protect-case): New macro. Similiar to
 	CL:UNWIND-PROTECT except that it's possible to explicitly specify
 	under which circumstances cleanup operations are run.
 
 	* tests.lisp (unwind-protect-case.1-5): New test cases.
] 
[Fix dependency: previous patch to CDR5 in types.lisp uses ensure-car from lists.lisp
attila.lendvai at gmail.com**20080314115151] 
[alexandria-cdr5-types.diff
Tobias C. Rittweiler <tcr at freebits.de>**20080313203602
 
 	* types.lisp: Fix quoting problem introduced by Attila's last
 	patch; additionally add automatically generated docstrings to all
 	the types defined.
 
 	* tests.lisp (cdr5.*): New test cases.
] 
[One level less quote in the implementation of the CDR5 types macro
attila.lendvai at gmail.com**20080313160255] 
[alexandria-parse-body.diff
Tobias C. Rittweiler <tcr at freebits.de>**20080311093924
 
 * macros.lisp (parse-body): Don't use ALEXANDRIA:STARTS-WITH.
 
     The reason is that this way PARSE-BODY is a completely 
     standalone definition, and can hence be used in consequent
     macro definitions within the Alexandria project without
     having to worrying if `sequences.lisp' has already been
     loaded (where STARTS-WITH is defined.)
 
] 
[alexandria-copy-hashtable.diff
Tobias C. Rittweiler <tcr at freebits.de>**20080311143832
 
 	* hash-tables.lisp (copy-hash-table): Added new &key arg :KEY;
 	it's run on each element before it's stored in the new HT.
 	Additionally, make all &key args get their default even when
 	NIL was passed for them.
 
 	* tests.lisp (copy-hash-table.2): New test case.
 	
] 
[More elegant implementation for remove-from-plist by Michael Weber.
attila.lendvai at gmail.com**20080312091456] 
[alexandria-define-constant-testcase.diff
Tobias C. Rittweiler <tcr at freebits.de>**20080311151906
 
 	* tests.lisp (define-constant.1): Adapted to latest changes;
 	argument to :KEY is now evaluated.
] 
[Optimize sequence-of-length-p, make it inlinable
attila.lendvai at gmail.com**20080310181353] 
[fix docstring typos in numbers.lisp (patch by Tobias C. Rittweiler)
attila.lendvai at gmail.com**20080310180012] 
[Fix define-constant thinko, thanks for Tobias C. Rittweiler for pointing it out.
attila.lendvai at gmail.com**20080310141844] 
[Extract the body of define-constant macro into a function to avoid some warnings.
attila.lendvai at gmail.com**20080310134214
 (Based on patch by Tobias C. Rittweiler)
] 
[Fix autodoc argument list of remove-from-plistf and delete-from-plistf.
attila.lendvai at gmail.com**20080301111034
 Patch by Michael Weber.
] 
[FEATUREP accept any compound test specifier, not just the keywords :AND, :OR and :NOT.
attila.lendvai at gmail.com**20080301105651
 Patch by Stelian Ionescu.
] 
[Fix file dependencies in the .asd
attila.lendvai at gmail.com**20080301105628] 
[Added an almost full implementation of CDR5
attila.lendvai at gmail.com**20080301100637] 
[fix removef and deletef not to use an inline lambda
nikodemus at random-state.net**20080223171025
 
  CLHS says the third argument to DEFINE-MODIFY-MACRO must be a symbol.
  Reported by Chun Tian.
 
] 
[fix WHICHEVER
Nikodemus Siivola <nikodemus at random-state.net>**20080217071955
 
  * More efficient with constant arguments.
 
  * Respect lexical environment with non-constant arguments.
 
] 
[extended ONCE-ONLY
Nikodemus Siivola <nikodemus at random-state.net>**20080217071829
 
  * Support (once-only ((nx x)) ...) style also.
 
] 
[new macro: DOPLIST
Nikodemus Siivola <nikodemus at random-state.net>**20080217071024
 
  * Like DOLIST, but iterates over plists.
 
] 
[fix tests: DELETEF.1 modified constant data
Nikodemus Siivola <nikodemus at random-state.net>**20080217070803
 
  * ...so that running tests multiple times caused unrelated tests to fail
    due to coalesced constants being frobbed. Gah.
 
] 
[Extract the function name of KEY too, not just TEST in GENERATE-SWITCH-BODY.
attila.lendvai at gmail.com**20080209201446
 Patch by Stelian Ionescu.
] 
[fix dependency: macros.lisp is using MAKE-GENSYM-LIST from symbols.lisp
attila.lendvai at gmail.com**20071221100634] 
[NTH-VALUE-OR
Nikodemus Siivola <nikodemus at random-state.net>**20071219132132
 
  * Thanks to Andreas Fuchs -- I only took the liberty of changing the name from
    MULTIPLE-VALUE-OR to NTH-VALUE-OR.
 
] 
[fix SANS -> REMOVE-FROM-PLIST in tests
Nikodemus Siivola <nikodemus at random-state.net>**20071219130641
 
  * So SANS is now REMOVE-FROM-PLIST.
 
    ...I have to say that I'm still not sure I like this:
 
      (remove-from-plist x y) ; which is the plist?
 
    The common usage in REMOVE &co is to put the element designators
    first. This is confusing.
 
    Maybe we really want both:
 
     function SANS plist &rest keys
     function REMOVE-FROM-PLIST keys plist
 
] 
[fix MAKE-GENSYM-LIST when called without the second argument
Nikodemus Siivola <nikodemus at random-state.net>**20071219130559
 
  * plus a test-case
 
] 
[better SHUFFLE
Nikodemus Siivola <nikodemus at random-state.net>**20071219125911
 
  * Thanks to Sean Ross: implement the Fisher/Yates/Knuth algorithm
    correctly.
 
  * As penance, specialize for lists as well: travel along the list,
    swapping towards the end -- marginally more efficient then swapping
    along the whole length.
 
] 
[ENSURE-GETHASH
Nikodemus Siivola <nikodemus at random-state.net>**20071219125800
 
  * new function: like GETHASH, but saves the default value in table if
    key is not found.* 
 
] 
[fixed and robustified tests
Nikodemus Siivola <nikodemus at random-state.net>**20071219125512] 
[Switch the argument order of STARTS/ENDS-WITH-SUBSEQ to that it matches STARTS/ENDS-WITH.
attila.lendvai at gmail.com**20071126135259] 
[Fix map-permutations typo.
levente.meszaros at gmail.com**20071102163851] 
[fix: darcs merge conflict was recorded into package.lisp
attila.lendvai at gmail.com**20071031173831] 
[Merge conflicts around the conditions
attila.lendvai at gmail.com**20071001122707] 
[Simplify IGNORE-SOME-CONDITIONS's docstring.
Luis Oliveira <loliveira at common-lisp.net>**20070823040556] 
[New macro: IGNORE-SOME-CONDITIONS
Luis Oliveira <loliveira at common-lisp.net>**20070726171110] 
[New macro: NCONCF
Luis Oliveira <loliveira at common-lisp.net>**20070720003523
 
 - Added respective documentation to the manual.
 - New test: NCONCF.1
] 
[New function: FEATUREP
Luis Oliveira <loliveira at common-lisp.net>**20070720003420
 
 Added respective documentation in manual as well.
] 
[New macro: COERCEF
Luis Oliveira <loliveira at common-lisp.net>**20070720003607
 
 Added respective documentation to the manual.
] 
[Small fix to REQUIRED-ARGUMENT's control string.
Luis Oliveira <loliveira at common-lisp.net>**20070823040500] 
[Fix some type declarations for CLISP-compatibility.
Stelian Ionescu <sionescu at common-lisp.net>**20070806160206
 Type declareations like ((or fixnum null) bar) or (unsigned-byte foo)
 don't work on CLISP. Must use (type unsigned-byte foo) instead.
] 
[Remove trailing whitespace in source code
Luis Oliveira <loliveira at common-lisp.net>**20070711140350] 
[Renamed errors.lisp to conditions.lisp
attila.lendvai at gmail.com**20070827161429] 
[Added simple-style-warning function and condition.
attila.lendvai at gmail.com**20070827005343] 
[sane named-lambda
Nikodemus Siivola <nikodemus at random-state.net>**20070809171107] 
[Use a shared expander for the SWITCH macros
attila.lendvai at gmail.com**20070802120334
  - support #'eq and 'eq style :test arg
  - support T and OTHERWISE clause instead of the :default keyword arg
] 
[Make define-constant understand :test 'string= and #'string=. Feel free to 'darcs undo' it if it's considered too dwim'y.
attila.lendvai at gmail.com**20070706215246] 
[DECLAIM, not DECLARE.
Nikodemus Siivola <nikodemus at random-state.net>**20070703103139] 
[Combinations, permutations, and derangements
Nikodemus Siivola <nikodemus at random-state.net>**20070701122604] 
[Factorial, binomial-coefficient, subfactorial, and count-permutations.
Nikodemus Siivola <nikodemus at random-state.net>**20070701122419] 
[Compiler-macro for OF-TYPE
Nikodemus Siivola <nikodemus at random-state.net>**20070701122227] 
[ENSURE-CAR
Nikodemus Siivola <nikodemus at random-state.net>**20070701122110] 
[ENSURE-FUNCTION
Nikodemus Siivola <nikodemus at random-state.net>**20070701121903] 
[Documentation and comment tweaks
Nikodemus Siivola <nikodemus at random-state.net>**20070701121316] 
[deftype for ARRAY-LENGTH
Nikodemus Siivola <nikodemus at random-state.net>**20070701120827] 
[Added starts-with-subseq and ends-with-subseq
attila.lendvai at gmail.com**20070625193029] 
[Added delete-from-plist, delete-from-plistf, remove-from-plistf.
attila.lendvai at gmail.com**20070625191357] 
[MAP-IOTA, misc. fixes, and tests up to 100% coverage
Nikodemus Siivola <nikodemus at random-state.net>**20070601143059] 
[Nothing Can Stop The Progressive Revolution
Nikodemus Siivola <nikodemus at random-state.net>**20070601123336
 
 Added:
  * XOR
  * WHICHEVER
  * SWITCH, ESWITCH, CSWItCH
  * UNIONF, NUNIONF
  * ALIST-PLIST, PLIST-ALIST
  * ENSURE-CONS
  * NAMED-LAMDBA
  * DEFINE-CONSTANT
  * STRING-DESIGNATOR
 
 Note:
  Documentation strings of many new operators are sorely lacking, particularly
  NAMED-LAMBDA and *SWITCH.
 
] 
[Added a faster loop based remove-from-plist
attila.lendvai at gmail.com**20070501144915] 
[Added a REMOVE-FROM-PLIST (same as SANS)
attila.lendvai at gmail.com**20070501143706] 
[Docstring typo
attila.lendvai at gmail.com**20070501143516] 
[Fix when-let documentation string.
langstefan at gmx.at**20070318132238] 
[Patch by Tayssin John Gabbour, fixing two typos.
Nikodemus Siivola <nikodemus at random-state.net>**20070318015005] 
[with-gensyms
Nikodemus Siivola <nikodemus at random-state.net>**20070225160042] 
[required-argument
Nikodemus Siivola <nikodemus at random-state.net>**20070225160010] 
[IF-LET, IF-LET*, WHEN-LET, and WHEN-LET*
Nikodemus Siivola <nikodemus at sb-studio.net>**20061107104944] 
[Extended parse-body with a :whole arg, report multiple docstring error.
attila.lendvai at gmail.com**20061022105744] 
[Added (declare (ignore sub)) for type=
attila.lendvai at gmail.com**20061017155937] 
[SETF-functions for lastcar, first-elt, and last-elt. :KEY and :TEST for starts-with and ends-with
Nikodemus Siivola <nikodemus at sb-studio.net>**20061017155126] 
[new: flatten, map-product, setp. fixed: set-equal
Nikodemus Siivola <nikodemus at sb-studio.net>**20061016150600] 
[REMOVE-KEYS renamed to SANS, with new --arguably better-- argument order
Nikodemus Siivola <nikodemus at sb-studio.net>**20061016125413] 
[ROTATE-RIGHT and ROTATE-LEFT replaced by a single function ROTATE
Nikodemus Siivola <nikodemus at sb-studio.net>**20061016123238] 
[variance and standard-deviation biased by default, documentation fixes for both
Nikodemus Siivola <nikodemus at sb-studio.net>**20061016114618] 
[documentation
Nikodemus Siivola <nikodemus at sb-studio.net>**20061015215052] 
[Added .boring and added public_html to it, so you can darcs get it into your local alexandria repo
attila.lendvai at gmail.com**20061015170133] 
[tests passing
Nikodemus Siivola <nikodemus at sb-studio.net>**20061015160607] 
[initial version
Nikodemus Siivola <nikodemus at sb-studio.net>**20061015154202] 
Patch bundle hash:
26cb78f56c59746145ec2104e67f4c0b20cb6837
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://mailman.common-lisp.net/pipermail/alexandria-devel/attachments/20080510/2df8709c/attachment.sig>


More information about the alexandria-devel mailing list