Skip to content

Go over Quiet, All, and Part docs#1354

Merged
rocky merged 4 commits intomasterfrom
combinatorica-2.0-prereqs
May 9, 2021
Merged

Go over Quiet, All, and Part docs#1354
rocky merged 4 commits intomasterfrom
combinatorica-2.0-prereqs

Conversation

@rocky
Copy link
Member

@rocky rocky commented May 4, 2021

These are prerequisites for having Combinatorica V2.0 to load without
given errors.

Combinatorica v2.0 (the version that is on par with the latest book) is
starting to work, although testing shows it is not as good as v0.9 yet.

These are prerequisites for having Combinatorica V2.0 to load without
given errors.

Combinatorica v2.0 (the version that is on par with the latest book) is
starting to work, although testing shows it is not as good as v0.9 yet.
@rocky rocky requested a review from mmatera May 4, 2021 22:36
@rocky
Copy link
Member Author

rocky commented May 4, 2021

@mmatera I am guessing the All and Subsets should be unprotected by virtue of the error messages seen when trying to load Combinatorica V2.0. So please double check. @axelclk if you are listing and want to advice I would be appreciative.

After this lands in master, I may put in another PR to add Combinatrica 2.0. Testing shows that right now, it isn't working as well as v0.9. And add that test will slow down testing even more. So I want to separate this part which is independent of a Combinatorica 2.0 review and possible merge.

@mmatera
Copy link
Contributor

mmatera commented May 4, 2021

@mmatera I am guessing the All and Subsets should be unprotected by virtue of the error messages seen when trying to load Combinatorica V2.0. So please double check. @axelclk if you are listing and want to advice I would be appreciative.

After this lands in master, I may put in another PR to add Combinatrica 2.0. Testing shows that right now, it isn't working as well as v0.9. And add that test will slow down testing even more. So I want to separate this part which is independent of a Combinatorica 2.0 review and possible merge.

@rocky, can you provide a minimal example to see what is going on with these symbols?

In[1]:= ??  All
All is a setting used for certain options. In Part and related functions, All
   specifies all parts at a particular level. 

Attributes[All] = {Protected}
 In[2]:=  ??Subsets
Subsets[list] gives a list of all possible subsets of list. 
Subsets[list, n] gives all subsets containing at most n elements. 
Subsets[list, {n}] gives all subsets containing exactly n elements. 
Subsets[list, {n   , n   }] gives all subsets containing between n
                min   max                                         min
     and n    elements. 
          max
Subsets[list, nspec, s] limits the result to the first s subsets. 
                                                       th
Subsets[list, nspec, {s}] gives if possible the s   subset. 

Attributes[Subsets] = {Protected}

@rocky
Copy link
Member Author

rocky commented May 4, 2021

@mmatera I am guessing the All and Subsets should be unprotected by virtue of the error messages seen when trying to load Combinatorica V2.0. So please double check. @axelclk if you are listing and want to advice I would be appreciative.
After this lands in master, I may put in another PR to add Combinatrica 2.0. Testing shows that right now, it isn't working as well as v0.9. And add that test will slow down testing even more. So I want to separate this part which is independent of a Combinatorica 2.0 review and possible merge.

@rocky, can you provide a minimal example to see what is going on with these symbols?

In[1]:= ??  All
All is a setting used for certain options. In Part and related functions, All
   specifies all parts at a particular level. 

Attributes[All] = {Protected}
 In[2]:=  ??Subsets
Subsets[list] gives a list of all possible subsets of list. 
Subsets[list, n] gives all subsets containing at most n elements. 
Subsets[list, {n}] gives all subsets containing exactly n elements. 
Subsets[list, {n   , n   }] gives all subsets containing between n
                min   max                                         min
     and n    elements. 
          max
Subsets[list, nspec, s] limits the result to the first s subsets. 
                                                       th
Subsets[list, nspec, {s}] gives if possible the s   subset. 

Attributes[Subsets] = {Protected}

Given that All and Subsets are Protected I have removed this in
2d5d421

The combinatorica-2.0 has the code for Combinatorica. Doing a Get on this gives in part: ...

In[1]:= Get["DiscreteMath`CombinatoricaV2.0`", Trace-> True]
DiscreteMath`CombinatoricaV2.0`
    1: (* :Title: Combinatorica 
   ... 
   91: All::usage = "All is an option to inform certain functions to return all solutions, instead of just the first one."
Set::write: Tag All in All::usage is Protected.
  ... 
 1002: Subsets[l_List] := GrayCode[l]
SetDelayed::write: Tag Subsets in Subsets[l_List] is Protected.
SetDelayed::write: Tag Subsets in Subsets[n_Integer] is Protected.
 1007: LexicographicSubsets[{},s_List] := s
...
 2108: Degrees[Graph[g_,_]] := Map[(Apply[Plus,#])&, g]
 2110: GraphicQ[s_List] := False /; (Min[s] < 0) || (Max[s] >= Length[s])
Syntax::com: Warning: comma encountered with no adjacent expression. The expression will be treated as Null (line 2131 of "/src/external-vcs/github/mathics/Mathics/mathics/packages/DiscreteMath/CombinatoricaV2.0.m").
 2142: RealizeDegreeSequence[d_List,seed_Integer] :=


@rocky rocky changed the title Unprotect All and Subsets.. Go over Quiet, All, and Part docs May 4, 2021
Since these should not be unprotected...
@rocky rocky force-pushed the combinatorica-2.0-prereqs branch from 2d5d421 to 8f94d19 Compare May 4, 2021 23:20
@rocky
Copy link
Member Author

rocky commented May 5, 2021

One other thought regarding the discrepency with Combinatorica v2.0 and WL specs: it is possible that at the time Combinatorica 2.0 was written everything was fine. I think in Wolfram's subsequent revisions of Combinatorica, it added namespaces to everything which would include both All (becoming Combinatorica`All) and Subset.

So it is possible that the better avenue would be to have this Mathics release compatibilty package which restores properties as they were when Combinatorica 2.0 was written.

@rocky rocky merged commit d69ab0e into master May 9, 2021
@rocky rocky deleted the combinatorica-2.0-prereqs branch May 12, 2021 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants