Skip to content

Commit 285ffad

Browse files
committed
Reinstate a test; comment Combinatorica code
1 parent 0eb406b commit 285ffad

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

mathics/packages/DiscreteMath/CombinatoricaV0.9.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,10 +1233,11 @@
12331233

12341234
ShapeOfTableau[t_List] := Map[Length,t]
12351235

1236+
(* Section 2.3.1 Insertion and Deletion, Page 64 *)
12361237
InsertIntoTableau[e_Integer,{}] := { {e} }
12371238

12381239
InsertIntoTableau[e_Integer, t1_?TableauQ] :=
1239-
Module[{item=e,row=0,col,t=t1},
1240+
Block[{item=e,row=0,col,t=t1},
12401241
While [row < Length[t],
12411242
row++;
12421243
If [Last[t[[row]]] <= item,

test/package/test_combinatorica.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,11 @@ def test_special_classes_of_permutations_1_4():
382382
"{0, 1, 2, 9, 44, 265, 1854, 14833, 133496, 1334961}",
383383
"NumberOfDerangements; 1.4.2, Page 33",
384384
),
385-
# This works, interactively, but not in test. Why?
386-
# (
387-
# "Table[ N[ NumberOfDerangements[i]/(i!) ], {i, 1, 10} ]",
388-
# "{0., 0.5, 0.333333, 0.375, 0.366667, 0.368056, 0.367857, 0.367882, 0.367879, 0.367879}",
389-
# "Confused Secretary 1.4.2, Page 34",
390-
# ),
385+
(
386+
"Table[ N[ NumberOfDerangements[i]/(i!) ], {i, 1, 10} ]",
387+
"{0., 0.5, 0.333333, 0.375, 0.366667, 0.368056, 0.367857, 0.367882, 0.367879, 0.367879}",
388+
"Confused Secretary 1.4.2, Page 34",
389+
),
391390
(
392391
"Table[Round[n!/N[E]], {n, 1, 10}]",
393392
"{0, 1, 2, 9, 44, 265, 1854, 14833, 133496, 1334961}",
@@ -496,7 +495,10 @@ def test_2_1_to_2_3():
496495

497496
for str_expr, str_expected, message in (
498497
(
499-
# 2.1.1 - 2.1.3 are broken
498+
# 2.1.1 uses Partitions which is broken
499+
# 2.1.2 Ferrers Diagrams can't be tested easily and robustly here
500+
# easily
501+
# 2.1.3 uses Partitions which is broken
500502
"PartitionsP[10]",
501503
"NumberOfPartitions[10]",
502504
"Counting Partitions 2.1.4, Page 57",
@@ -509,12 +511,12 @@ def test_2_1_to_2_3():
509511
(
510512
"TableauQ[{{1,2,5}, {3,4,5}, {6}}]",
511513
"True",
512-
"Young Tableau 2.3, Page 63",
514+
"Young Tableau 2.3, Page 64",
513515
),
514516
(
515517
"TableauQ[{{1,2,5,9,10}, {5,4,7,13}, {4,8,12},{11}}]",
516518
"False",
517-
"Young Tableau 2.3, Page 63",
519+
"Young Tableau 2.3, Page 64",
518520
),
519521
# Need to not evaluate expected which reformats \n's
520522
# (

0 commit comments

Comments
 (0)