Skip to content

Commit c876d21

Browse files
committed
CombinatoricaSmall -> DiscreteMath`CombinatoricaLite
And added a few more tests.
1 parent 7d86f60 commit c876d21

5 files changed

Lines changed: 18 additions & 6 deletions

File tree

mathics/builtin/scoping.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ class ContextPath(Predefined):
466466
467467
#> x`x = 1; x
468468
= x
469-
>> $ContextPath = {"x`"};
470-
>> x
469+
#> $ContextPath = {"x`"};
470+
#> x
471471
= 1
472472
#> System`$ContextPath
473473
= {x`}
@@ -494,6 +494,7 @@ class Begin(Builtin):
494494
495495
>> Begin["test`"]
496496
= test`
497+
X> {$Context, $ContextPath}
497498
>> Context[newsymbol]
498499
= test`
499500
>> End[]

mathics/packages/CombinatoricaSmall/Kernel/init.m

Lines changed: 0 additions & 1 deletion
This file was deleted.

mathics/packages/CombinatoricaSmall/CombinatoricaSmall.m renamed to mathics/packages/DiscreteMath/CombinatoricaLite.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(* ::Package:: *)
22

3-
(* :Title: Combinatorica Light *)
3+
(* :Title: Combinatorica Lite *)
44

55
(* :Summary:
66
This is a stripped-down version of Combinatorica.
@@ -27,7 +27,7 @@
2727
incidental, or consequential damages.
2828
*)
2929

30-
BeginPackage["CombinatoricaSmall`"]
30+
BeginPackage["DiscreteMath`CombinatoricaLite`"]
3131

3232
PermutationQ::usage = "PermutationQ[p] yields True if p is a list representing a permutation and False otherwise."
3333
PermutationQ[e_List] := (Sort[e] === Range[Length[e]])
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Get[ "DiscreteMath`CombinatoricaLite`"]

test/test_evaluation.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_quit():
149149
def test_combinatorica():
150150
# Permutation[3] doesn't work
151151
session.evaluate("""
152-
Needs["CombinatoricaSmall`"]
152+
Needs["DiscreteMath`CombinatoricaLite`"]
153153
""")
154154

155155
permutations3 = r"{{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}"
@@ -164,5 +164,16 @@ def test_combinatorica():
164164
"{1, 2, 3, 4, 5}",
165165
"InversePermute"
166166
),
167+
(
168+
"MinimumChangePermutations[{a,b,c}]",
169+
"{{a, b, c}, {b, a, c}, {c, a, b}, {a, c, b}, {b, c, a}, {c, b, a}}",
170+
"MinimumChangePermuations"
171+
),
172+
(
173+
"Subsets[{1,2,3}]",
174+
"{{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}",
175+
"Subsets"
176+
),
177+
167178
):
168179
test_evaluation(str_expr, str_expected, message)

0 commit comments

Comments
 (0)