Remix.run Logo
gucci-on-fleek 5 hours ago

> Python is a much better language than Wolfram

Different languages are better at different things, so it rarely makes much sense to say that one language is better than another in general. Python is definitely much better than Mathematica for "typical" imperative programming tasks (web servers, CLI programs, CRUD apps, etc.), but Mathematica is much better at data processing, symbolic manipulation, drawing plots, and other similar tasks.

> there is no real scoping (even different notebooks share all variables, Module[] is incredibly clumsy)

Scoping is indeed an absolute mess, and the thing that I personally find the most irritating about the language.

> no real control flow (If[] is just a function)

You're meant to program Mathematica by using patterns and operating on lists as a whole, so you should rarely need to use branching/control flow/If[]. It's a very different style of programming that takes quite a while to get used to, but it works really well for some tasks.

> no real error handling

For input validation, you should use the pattern features to make it impossible to even call the function with invalid input. And for errors in computation, it often makes the most sense to return "Undefined", "Null", "Infinity", or something similar, and then propagate that through the rest of the expression.

> The notebooks are also difficult to version control (unreadable diffs for minor changes)

Mathematica notebooks tend to do slightly better with version control than Jupyter Notebooks, although they're both terrible. You can work around this with Git clean/smudge filters, or you can just use ".wls"/".py" files directly.

jimbokun an hour ago | parent | next [-]

For writing production code, I find good scoping rules non-negotiable. And error handling, monitoring etc has to be well thought out before deploying at scale.

So as great as Mathematica sounds for interactive math and science computations, sounds like a poor tool for building systems that will be deployed and used by many people.

qbit42 an hour ago | parent [-]

That is a fair assessment. By and large it is used for the former. It is super handy in the exploratory phase of certain kinds of mathematical research.

cricalix 3 hours ago | parent | prev [-]

On the note of Jupyter notebooks and version control - there was a talk at this year's Pycon Ireland about using a built in cleaner for notebooks when committing the JSON (discard the cell results), and then dropping the whole lot into a CI system utilising remote execution (and Bazel or similar) to run and cache the outputs. Was a talk from CodeThink. No video up yet though. Scenario was reproducible notebooks for processing data from a system under test.