Open
Description
Description
These two Set assignments, when they exist together, seem to match differently in Mathics3 than in wolframscript:
Bug[n_Integer,_] := Print["Negative ", n] /; (n<0)
Bug[n_Integer,maxpart_Integer] := Print["Integer ", n]
How to Reproduce
In mathics:
In[1]:= Bug[n_Integer,_] := Print["Negative ", n] /; (n<0)
Out[1]= None
In[2]:= Bug[-5, 3]
Negative -5
Out[2]= None
In[3]:= Bug[n_Integer,maxpart_Integer] := Print["Integer ", n]
Out[3]= None
In[4]:= Bug[-5, 3]
Integer -5
Out[4]= None
In wolframscript:
In[1]:= Bug[n_Integer,_] := Print["Negative ", n] /; (n<0)
In[2]:= Bug[-5, 3]
Negative -5
In[3]:= Bug[n_Integer,maxpart_Integer] := Print["Integer ", n]
In[4]:= Bug[-5, 3]
Negative -5
What's going on, and why?
Expected behavior
The wolframscript behavior
Workarounds
In combinatoria V0.9 basically the two Set statements were combined into one Set statement with an explicit If
test.
Additional context
Noticed in getting Combinatorical V0.9's Partitions[]
function working.
Metadata
Assignees
Labels
No labels
Activity