The Software Engineering of Mathematica(reference.wolfram.com) |
The Software Engineering of Mathematica(reference.wolfram.com) |
I wonder if this is the case because of dedication to backwards compatibility or because the original syntax was based on some fundamental mathematical concepts that are sound and thus don't change the same way most APIs do. Can anyone with more Mathematica experience weigh in?
I spent the summer of 2000 interning at Wolfram. I wrote coverage tests for over 60,000 lines of the Mathematica source code in areas ranging from functional programming operations to advanced numerical functions. My experience was that the source code was incredibly clean and well organized across the board.
a = {1,2,3};
Which is represented internally as an 'M expression' of List[1,2,3] (obtainable through FullForm[a], or its head through Head[a])?Is that it?
I didn't realise that was a named concept. It does make sense to have a completely unified internal representation underneath the syntactic sugar, since you'd need everything to be in that form for the term rewriting system to work.
Thanks!
To your question, it's not so much that V6 is opening documents written in V1, it's more that V6 of the language runs V1 code. Viewed through that lens, it's not such a surprise. K&R C still compiles, after all. (In fact, certain peripheral pieces of older code won't actually work in newer versions. It's not uncommon for old notebooks to require some changes.)
The fundamental heart of Mathematica and its language is quite unusual: it is a Term Rewriting System (TRS.) There's a good set of examples here [1] but basically a TRS works by the repeated application of matching patterns to expression terms and modifying them with replacement rules. The language's flexibility comes from the clever use of those rules.
You can do amazing things with it very easily if you follow its way. It's pretty unique in the world of programming languages and a 30 day trial will be fun for anyone interested in experimenting with languages.
[1] http://www.cs.swan.ac.uk/~csneal/SystemSpec/termrewriting.ht...
I would say it's mostly the former. I don't see anything unusually mathematical about Mathematica syntax.
Also, a good, simple & versatile syntax was chosen in the first place, so there was little need to change it. The syntax doesn't look too remarkable now, but Mathematica is 24 years old, so clearly some very good decisions were made in its initial design.
SMP is intended to be close to conventional mathematics. The fundamental operations of mathematics are included among the 100 or so primitives of the language, together with about 250 mathematical functions. Direct use of these primitives alone suffices in some simple calculations, such as those in Figure 1. However, as in mathematics itself, higher level constructs and operations must be defined to cover the immense variety of methods and calculations encountered in practice. SMP was designed at a fundamental level to make use of the notations and mechanisms developed in mathematics for such definitions.
http://www.stephenwolfram.com/publications/articles/computin...
As a multi-paradigm language they can add new functionality without having to replace old. The global namespace has thousands of functions, being able to add to that makes fixing problems more a matter of finding good names than a matter of finding "the right way" of doing something. E.g. Block and Module [3].
These are small advantages that perhaps most API and language designers don't have.
[1] http://tex.loria.fr/historique/interviews/knuth-clb1993.html
[2] http://javascript.crockford.com/remedial.html
[3] http://forums.wolfram.com/mathgroup/archive/2010/Dec/msg0070...
Compare that to e.g. windows, with its BlaEx, BlaEx2, etc functions, or a typical database, where a zillion flags control what language dialect they follow, how exactly NULLs behave, etc, or filesystems (for example, Apple's HFS has a bug in its filename sorting that has been faithfully copied for decades now)
[1] http://reference.wolfram.com/mathematica/tutorial/TheInterna...
Disclaimer: I'm a developer for Mathics
That's quite an understatement.
Wolfram, et al really thinks they are hot shit.
In[1]:= FullForm[Hold[a={1,2,3}]]
Out[1]//FullForm= Hold[Set[a,List[1,2,3]]]