News for hackers. Stuff that matters.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by n-e-w on Thursday December 16, 2021 @07:58AM (#29577671)
I've enjoyed developing in the language professionally for many years. Truly, few things allow as rapid prototyping with such efficacy for so few lines across so many domains in a unified interface. There are some brilliantly innovative things across the language and, once you really get into the weeds of how to write efficient functional code, some of the things you can do are incredible.

Two things, though. Firstly, they are very stubborn on condoning a community to coalesce around the language other than through 'official' Wolfram channels. This comes from the big man himself, no doubt. As much as they want to drive adoption by coming up with (what they think are) "cool" sounding initiatives, they will never get devs to break from their core workflows and tools to do things the Wolfram way. There is no first-class support for daily-driver editing (vscode, emacs etc etc) for large-scale projects (other than an ancient eclipse package). Brenton Bostick at Wolfram has done some truly first class work in closing this gap though.

Secondly, this is the first major release that is a bit 'ho-hum' for a while. And it's reflective of the fact that whatever Stephen's pet interests are at a particular point in time will get attention in a release. For example, V11 was huge on Machine Learning and AI...now it barely gets a mention or extra development. Because SW is so focused on his Physics Project, this will likley be the case for a while.

To anyone thinking about using the language -- dive in. It's brilliant and expressive and fun. It's satisfying. You can do cool stuff. It just becomes very difficult when you want to scale it.

Anyone from WRI reading this: please, please, please let the community develop organically and support the toolchain everyone has wanted for so long. Or don't. But you need us more than we need you. Oh, and simplify the product line -- what a nightmare for newcomers to navigate. :-)

Re:Launching Version 13.0 of Wolfram Language and Mathematica by agambrahma on Thursday December 16, 2021 @12:31PM (#29580948)
I recently got into it and it is exhilarating.

There's so much to it that it's easy to get lost. I don't even care for the "deep math" parts of it, it has _so many_ APIs for real-world data that "plain old exploration" is super-fun with it.

It'll also be great for anyone looking for "creative coding" (typically Processing.js etc is used for this), since the Graphics abilities are so quick and easy.

It has "a different shape" w.r.t. the languages and tools that are commonly used for programming, but it is a beast.

Highly recommend to anyone curious.

Also, https://www.wolfram.com/language/elementary-introduction/2nd... (free to read online, though I read it on paper) was helpful to me, browse through it to get a feel for what it's like to use it.

Re:Launching Version 13.0 of Wolfram Language and Mathematica by 6gvONxR4sf7o on Thursday December 16, 2021 @07:08PM (#29585833)
I haven’t used it in years, but I remember the Manipulate functionality being so great for exploring things. Its weird evaluation model always gave that some warts, but it was very useful nonetheless.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by disentanglement on Thursday December 16, 2021 @02:43PM (#29582859)
Perhaps I can add a counterpoint before anybody gets too excited and spends too much money on a tool they might not enjoy.

Having used Mathematica quite a bit for doing symbolic computation, my opinion on it is pretty much opposite to yours. While the extensive standard library is certainly nice, I think that the programming language used to access it is one of the worst programming languages in the world - certainly the worst I have ever used. I have never seen any other programming language where the basic scoping and evaluation rules are so badly designed and error-prone as in Mathematica.

Re:Launching Version 13.0 of Wolfram Language and Mathematica by ModernMech on Thursday December 16, 2021 @02:57PM (#29583086)
Can you elaborate as to what you dislike about scoping and eval rules? Asking as a language designer.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by jjoonathan on Thursday December 16, 2021 @03:12PM (#29583251)
Global scope (really global -- even between windows) is the default and the encapsulation tools are not particularly easy or convenient to use and not heavily promoted in the example material.

This leads to a dynamic where anyone without the CS background to recognize the foot-gun and the discipline to disarm it winds up with awful spaghetti code and the all-to-familiar consequences: a big blob of unmaintainable mystery code that becomes more and more difficult to modify until all project time is spent merely keeping it working rather than improving upon it.

We might laugh about this kind of newbie mistake here on HN, but even extremely intelligent people can't be experts at everything and the sheer number of physicist-hours and mathematician-hours I've seen needlessly flushed down this particular toilet is really quite unfortunate.

Re:Launching Version 13.0 of Wolfram Language and Mathematica by pfortuny on Thursday December 16, 2021 @04:06PM (#29583920)
Thanks for this comment. Have the same experience at a Maths Department.

Each run of some specific code is “ouch, we must try and see when we have the time to understand how it works and how each error is handled.” Just because it is soooo difficult to properly write a module.

Re:Launching Version 13.0 of Wolfram Language and Mathematica by zorked on Friday December 17, 2021 @03:11AM (#29589315)
> really global -- even between windows

This isn't the language though. A runtime in Mathematica is called a kernel. By default, Mathematica uses one. I think base licenses allow you to run two simultaneous runtimes and you can buy more. When you start a new window you have to pick the kernel, it doesn't launch its own like Jupyter would do.

This is an annoyance with Mathematica: it's proprietary software so it's in a world of license servers, license keys, artificial limits and paid upgrades.

Re:Launching Version 13.0 of Wolfram Language and Mathematica by disentanglement on Thursday December 16, 2021 @03:28PM (#29583439)
The main issue with the evaluation rules is that Mathematica doesn't distinguish between creating a symbolic expression and evaluating code. That is if I type

  f[x]

and the function `f` is not defined, Mathematica will not give me an error but instead just assume that I meant to create a symbolic expression. If you know some Lisp, just imagine that everything came with an implicit `quote` which would automatically get invoked whenever a unbound variable or function would we encountered.

That issue alone has caused me so many errors simply from mistyping some function or variable name. For simple expressions, such bugs are pretty obvious to spot but if the same occurs deep inside a chain of function calls, this often lead to completely wrong results because the bug got masked by some other manipulations I did on the result of the function call.

Of course, there are tons of hacks and ad-hoc workarounds in Mathematica to get around this (imho fundamentally broken) behaviour to the tune of "just stick another `Evaluate` here" or "just change the function definition from `g[x_]` to `g[x_?NumericQ]` to call the function only when the argument is numeric and otherwise leave it unevaluated".

The situation with the scoping rules is not much better. Consider for instance the following code:

  y = 1;
  expression = Module[{y},1+y]; (* Module creates a new scope in which y is unbound *)

Can you guess what happens if I print out `expression` now?

  Print[expression]
  1+y$4066
Yes, Mathematica has just renamed our variable. If now we wanted to set `y` in our expression to some concrete value, of course the obvious thing to try doesn't work, but just gives me some bullshit:

  Print[ReplaceAll[expression, y->10]]
  10+y$4066
These are all only some simple examples of why doing any kind of metaprogramming in Mathematica just sucks.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by mrjangles on Friday December 17, 2021 @06:43AM (#29590900)
Mathematica doesn't suck, it is just an extremely large language and it takes years to learn how to use it properly.

Anyway, to solve your first problem, add the definition f[_]:= Throw["Your error message here"}

To solve your second problem, use Block instead of Module (though in your simple example given here the solution is to just use neither).

Re:Launching Version 13.0 of Wolfram Language and Mathematica by nextaccountic on Thursday December 16, 2021 @05:02PM (#29584603)
> and the function `f` is not defined, Mathematica will not give me an error but instead just assume that I meant to create a symbolic expression.

I've dreamed about creating a language like this, but had to give up because it makes diagnostics impossible in case o typos and things like that..

My best bet now is to have some quote syntax to make a symbol stand for an abstract symbol, like

1 + x -- this sums 1 with x, and errors if x is unbound

1 + 'x -- this is an abstract expression, doesn't care if x is bound or not

Like lisp, except with some first class support to things like derive(1 + 'x, 'x), and, well, every operator needs to respect quoted symbols.. even if + were a user-defined operator or function, 1 + 'x needs to return (the AST) 1 + 'x. I suppose this is the same as Mathematica, except that Mathematica doesn't need quoting

Re:Launching Version 13.0 of Wolfram Language and Mathematica by Smaug123 on Thursday December 16, 2021 @06:22PM (#29585424)
I don't really know what more you wanted from `Module[{y}, 1+y] /. y -> 10`. You've explicitly asked for a new symbol that is unrelated to the global one, and then replaced any occurrences of the global one with 10. Of course there are no occurrences of the global one.

I claim any semantics which resulted in `11` would be extremely confusing, because it would imply the following also resulting in `11`, which is obvious nonsense:

    y = 10;
    Module[{y}, 1+y]
Re:Launching Version 13.0 of Wolfram Language and Mathematica by disentanglement on Friday December 17, 2021 @01:57AM (#29588827)
> I claim any semantics which resulted in `11` would be extremely confusing, because it would imply the following also resulting in `11`, which is obvious nonsense:

> y = 10; > Module[{y}, 1+y]

Yes that is precisely the point: because of Mathematicas weird evaluation model, you cannot have ordinary lexical scope as in every other programming language, but the only sensible thing to do is to rename variables under the hood. It is then very easy to leak those renamed variables accidentally in the global scope where you cannot do anything useful with them, because the symbols `y` in the global scope and in the subscope are different.

Another point that the example was meant to illustrate is that once you assign some value to a variable, you can no longer do symbolic manipulation with it (note that in the example, we have replaced 1 by 10 in the end).

Re:Launching Version 13.0 of Wolfram Language and Mathematica by rexpress on Thursday December 16, 2021 @06:47PM (#29585649)
Just wondering if this is an example where you are looking for dynamic scope instead of lexical scope? E.g:

y = 1;

expression = Block[{y},1+y];

Print[expression]

2

There are also the 'formal' symbols, e.g. https://reference.wolfram.com/language/ref/character/FormalY... if you want a symbol that will never be assigned a value but can still be substituted using ReplaceAll etc.

Re:Launching Version 13.0 of Wolfram Language and Mathematica by leephillips on Thursday December 16, 2021 @11:07AM (#29579625)
I looked all over their website, but could’t find a link to download the source for the Wolfram Language so I can compile it. Do you have a link?
Re:Launching Version 13.0 of Wolfram Language and Mathematica by trymas on Thursday December 16, 2021 @11:16AM (#29579756)
Someone will correct me if I am wrong, but Wolfram products are proprietary (read - you need to buy the license or subscribe to it), just like MATLAB.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by leephillips on Thursday December 16, 2021 @11:20AM (#29579831)
If it’s not open source then it’s a non-starter, it doesn’t matter how cool it is. This is not an ideological free software stance, it’s a recognition that science has embraced the utility of open source tools and rejected black boxes. It’s essential for reproducibility and transparency in research. It’s no longer enough to provide your code in a paper supplement or on GitHub; the entire chain must be available for inspection, including the language itself.

EDIT: One common exception to this principle is the use of proprietary C or Fortran compilers for high performance.

Re:Launching Version 13.0 of Wolfram Language and Mathematica by kzrdude on Thursday December 16, 2021 @11:30AM (#29580017)
They tried to get it out for freeon the raspi but I guess the uptake was really quite low. Either way the program for that has basically ended. https://www.wolfram.com/raspberry-pi/
Re:Launching Version 13.0 of Wolfram Language and Mathematica by leephillips on Thursday December 16, 2021 @11:34AM (#29580072)
I don’t see any source there. Was is open source or just beer-free?
Re:Launching Version 13.0 of Wolfram Language and Mathematica by Smaug123 on Thursday December 16, 2021 @11:36AM (#29580113)
It is not and has never been open-source. In fact they wrote https://blog.wolfram.com/2019/04/02/why-wolfram-tech-isnt-op... .
Re:Launching Version 13.0 of Wolfram Language and Mathematica by agentdrek on Thursday December 16, 2021 @02:55PM (#29583048)
I'm aghast at this point: https://blog.wolfram.com/2019/04/02/why-wolfram-tech-isnt-op...

The blog post was probably literally written in and hosted entirely on open source software which were highly innovative at their earlier stages and continue to be highly innovative. This is a very self-serving presentation of an idea. Also, I officially dislike the word innovation.

Re:Launching Version 13.0 of Wolfram Language and Mathematica by throway453sde on Thursday December 16, 2021 @12:03PM (#29580499)
Its a good thing that it did not take off. Using something for free without source code is the bad thing that could happen to pi wrt to its mission.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by carry_bit on Thursday December 16, 2021 @12:24PM (#29580838)
The Pi is built on a foundation of binary blobs. As I read it, https://www.raspberrypi.org/about/ is a lot more focused on free-as-beer than free-as-speech.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by kzrdude on Thursday December 16, 2021 @01:59PM (#29582285)
They are giving a lot, I respect them a lot for that. They are practical about it too, of course, compromises have to be made everywhere.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by Jeff_Brown on Thursday December 16, 2021 @03:04PM (#29583172)
Does this mean SAS will finally die?
Re:Launching Version 13.0 of Wolfram Language and Mathematica by the-dude on Thursday December 16, 2021 @11:45AM (#29580227)
Aren't you already perfectly aware this is not open source? From your profile I must assume you are.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by leephillips on Thursday December 16, 2021 @11:49AM (#29580284)
Why do you say that?
Re:Launching Version 13.0 of Wolfram Language and Mathematica by the-dude on Thursday December 16, 2021 @11:53AM (#29580337)
Because apparently you are writing a book about Julia. I assume people who write books about a language which are also in vogue in the scientific community, they are aware of the eco-system of said community. Mathematica is not exactly a new kid on the block.

Why don't you answer the question?

Re:Launching Version 13.0 of Wolfram Language and Mathematica by leephillips on Thursday December 16, 2021 @12:02PM (#29580476)
The answer is that I did not know, and that’s why I asked. Mathematica is not a big part of the scientific research world as far as I’m aware. I don’t know anyone who uses it in physics research, for example. The last time I played around with Mathematica was in graduate school before Linux existed, when closed source and proprietary solutions were the norm. Back then I don‘t think there was anything like the Wolfram Language independent of the Mathematica product. So when I heard that this language now existed, I wondered if it was open and, therefore, something that might be interesting to use in research. From your tone I suspect that you won’t believe any of this. I’ll leave it up to your fevered imagination to divine how much I care about that.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by carry_bit on Thursday December 16, 2021 @12:52PM (#29581308)
The "Wolfram Language" name is essentially just a rebranding of Mathematica to highlight the fact that it does way more than just math now.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by carry_bit on Thursday December 16, 2021 @08:34AM (#29577915)
I've heard they're working on creating an uncurated paclet repository, and the new paclet tools would appear to be the first step of that. Once that is complete we should finally have something similar npm.
Re:Launching Version 13.0 of Wolfram Language and Mathematica by ezequiel-garzon on Thursday December 16, 2021 @11:22AM (#29579857)
“I've enjoyed developing in the language professionally for many years.”

And I’ve enjoyed your wonderful post, thank you. HN can be truly amazing. I know, I know, upvotes are for that… ‘Tis the season, or something.