Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.5K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Different behavior of Switch when moved inside a package?

Posted 2 years ago

The following code runs as intended in Mathematica, but always runs the switch default value when moved into a package. Is there a problem with using a list as a switch argument in the Wolfram Language? Is there a more appropriate way to write this code for a Mathematica package?

DebugSwitch[{classification_,algorithm_}]:= Module[{},
   Echo[{classification,algorithm}];
   Switch[{classification,algorithm},
         {Parabolic,Native}, Echo["NativeParabolic[f,n,z,p,4]"],
         {Hyperbolic,Native}, Echo["NativeHyperbolic[f,n,z,p,4]"],
         {Parabolic,Symbolic}, Echo["SymbolicParabolic[f,n,z,p,4]"],
         {Hyperbolic,Symbolic}, Echo["SymbolicHyperbolic[f,n,z,p,4]"],   
         _, Echo["Symbolic[f,n,z,p,4]"]
      ]; 
  ]
POSTED BY: Daniel Geisler
2 Replies

Thank you Eric, I published all my symbols as you suggested and now the code works.

POSTED BY: Daniel Geisler
Posted 2 years ago
POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard