Skip to content

Commit 7d86f60

Browse files
committed
Redo as a non-autoloaded package
Thanks for the great suggestion @MMatura
1 parent ca9b652 commit 7d86f60

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

mathics/autoload/combinatorica/README.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

mathics/autoload/combinatorica/CombinatoricaSmall.m renamed to mathics/packages/CombinatoricaSmall/CombinatoricaSmall.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
(*
2-
This is a stripped-down version of Combinatorica
1+
(* ::Package:: *)
2+
3+
(* :Title: Combinatorica Light *)
4+
5+
(* :Summary:
6+
This is a stripped-down version of Combinatorica.
37
48
Perhaps one day we'll be support the full thing, as an import.
59
@@ -22,7 +26,8 @@
2226
distributors and dealers shall in no event be liable for any indirect,
2327
incidental, or consequential damages.
2428
*)
25-
Begin["CombinatoricaSmall`"]
29+
30+
BeginPackage["CombinatoricaSmall`"]
2631

2732
PermutationQ::usage = "PermutationQ[p] yields True if p is a list representing a permutation and False otherwise."
2833
PermutationQ[e_List] := (Sort[e] === Range[Length[e]])
@@ -212,6 +217,5 @@
212217
]
213218
]
214219
*)
215-
End[]
216220

217-
If[! MemberQ[$ContextPath, "CombinatoricaSmall`"] AppendTo[$ContextPath, "CombinatoricaSmall`"]]
221+
EndPackage[]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Get[ "CombinatoricaSmall`CombinatoricaSmall`"]

test/test_evaluation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ def test_quit():
148148

149149
def test_combinatorica():
150150
# Permutation[3] doesn't work
151+
session.evaluate("""
152+
Needs["CombinatoricaSmall`"]
153+
""")
154+
151155
permutations3 = r"{{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}"
152156
for str_expr, str_expected, message in (
153157
(

0 commit comments

Comments
 (0)