Commit 2f2c875b authored by liam's avatar liam
Browse files

Add combination-list to turn a combination into a CL list.

git-svn-id: svn+ssh://pop/opt/space/mathematics/gsl/trunk@3025 a3d8a0fb-c1db-0310-ace7-a616afeb9e30
parent 4608e81e
......@@ -3,7 +3,7 @@
; description: Combinations
; date: Sun Mar 26 2006 - 11:51
; author: Liam M. Healy
; modified: Thu Apr 6 2006 - 22:44
; modified: Thu Apr 6 2006 - 23:17
;********************************************************
;;; $Id: $
......@@ -61,6 +61,11 @@
:c-return-value :return
:documentation "The ith element of the combination.")
(defunx combination-list (combination)
"The combination as a list."
(loop for j below (combination-size combination)
collect (gsl-aref combination j)))
;;;;****************************************************************************
;;;; Combination properties
;;;;****************************************************************************
......@@ -130,8 +135,7 @@
(loop for i from 0 to 4
do
(with-data (comb combination (4 i) t)
(loop repeat 20
do
(loop do
(princ "{")
(loop for j below (combination-size comb) do
(princ (gsl-aref comb j)))
......@@ -139,4 +143,13 @@
while (combination-next comb))))
{}{0}{1}{2}{3}{01}{02}{03}{12}{13}{23}{012}{013}{023}{123}{0123}
(loop for i from 0 to 4
append
(with-data (comb combination (4 i) t)
(loop collect (combination-list comb)
while (combination-next comb))))
(NIL (0) (1) (2) (3) (0 1) (0 2) (0 3) (1 2) (1 3) (2 3)
(0 1 2) (0 1 3) (0 2 3) (1 2 3) (0 1 2 3))
|#
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment