When I have to introduce Mathematica to someone who is/isn't a programmer, I usually have a hard time to provide a useful description. Stating that it is a

  • high level programming language & symbolic computer algebra system

is often not enough for more sophisticated programmers. They ask various questions about stuff that most people using only Mathematica might never heard before, as it is designed not to burden the user with things that are specific for platforms but not for mathematics. It would be useful to have a reference list here listing most important properties/specifics that might be useful for others coming from different programming backgrounds. Like: Mathematica is weakly typed, non-declarative, and it allows for ragged lists, it has automatic garbage collection, it doesn't use pointers, it does not facilitate object-oriented programming (though it can be implemented), etc.

Question:

Is there a (more-or-less exhaustive) list of categories that partition the space of programming languages and in which Mathematica can be placed somewhat accurately according to its specifications?

share
2  
I wouldn't really agree that Mathematica is weakly typed--or at least not in the sense that many other languages are. For example, "1" + 1 does not give 2 or "2" in Mathematica. I consider it more a case of being strongly typed, except that (nearly) all types are derived from a single very general super-type so that in practice one can treat it as being (nearly) untyped. –  Oleksandr R. Feb 28 '12 at 18:13
    
@Oleksandr That's a good point, but OTOH "1"+1 does not result in an error either - which is what usually happens in the strongly-typed languages. I think that typing as a notion does not fully apply to Mathematica because it is a term-rewriting system which emulates some other programming paradigms, and this is why it is not clear how to categorize it. –  Leonid Shifrin Feb 28 '12 at 18:19
    
@Leonid Yes, I couldn't agree more. For me, the fact that Mathematica is a term-rewriting system is the foremost characteristic distinguishing it from most other languages. Actually, I think this also makes it difficult to classify the data model as being based on either mutable or immutable structures. –  Oleksandr R. Feb 28 '12 at 18:50
    
@Oleksandr Yes, another good point, totally agree. –  Leonid Shifrin Feb 28 '12 at 19:16
    
Every programming language has a basic notion of "values" which algorithms written in that language are designed to manipulate; types are then nothing more that collections of those values. In Mathematica, expressions (defined loosely as "anything the interpreter will accept for evaluation") represent the language's values, and types are implemented in terms of Mathematica's pattern sub-language. Oleksandr's argument argues persuasively for not classifying Mathematica as a weakly-typed language; Mathematica is clearly not a statically-typed lanugage either. –  StackExchanger May 9 '12 at 6:24
add comment

1 Answer 1

up vote 16 down vote accepted

Mathematica's programming language finally got some official definition with the new name introduced: specification of the Wolfram Language (bottom of page).


I would single out these criteria (this is my subjective judgement for the categories below):

  • Purpose: scientific programming, data manipulation, but also general-purpose
  • License: proprietary
  • Standard: defined by a single implementation
  • How close to the hardware: extremely high-level (garbage-collected, no explicit references, optimized for symbolic programming)
  • Platform dependence - Cross-platform (except certain file formats etc).
  • Supported on
    • Windows
    • Linux
    • Mac OS
    • some other platforms
  • Performance: Varies dramatically, from that close to custom C code, to much slower, depending on the problem, programming techniques used, and programmer's skills. On the average, a reasonably competent Mathematica programmer can count on performance within a factor of 10 slower than C/C++, for typical programming tasks.
  • Core execution model: term-rewriting, infinite (fixed-point) evaluation
  • Paradigm: multi-paradigm - rule-based, functional, imperative, logical
  • Has similarities with: Lisp, Prolog, APL
  • Type system: weakly dynamically typed (untyped)
  • Module-system and namespaces: Yes, through Mathematica contexts and packages.
  • Compiled/interpreted: Interpreted, plus a small subset of the language may be compiled to byte-code or C (native code)
  • Can create stand-alone executables?: For the compilable subset - yes, otherwise - through Mathematica player (which may or may not qualify as a stand-alone executable, depending on the case and on a definition of stand-alone - some form of Mathematica run-time will have to accompany the application code in any case in this scanario).
  • Data structures support: does support immutable data structures based on a generic Mathematica expressions, plus several special-purpose efficient data structures such as sparse arrays and packed arrays. Does not support mutable data structures (structs etc)
  • Object-oriented programming support: no, but there are third-party OO language extensions.
  • Meta-programming facilities: yes - code-as-data, introspection, code-generation
  • Availability of (third-party) libraries: yes, but limited
  • Concurrency model: coarse-grained (parallel evaluation, a separate kernel launched for each available core, a number of high-level parallel programming primitives available), fine-grained for compiled code - through native threads and automatic parallelization available in Compile - but limited to the code amenable to Compile
  • FFI (foreign function interface): Yes. Can load external libraries (wrapper C code is needed) through LibraryLink.
  • Interoperability: C (MathLink/LibraryLink), Java (J/Link), .Net (.Net/Link)
  • Database connectivity: Yes, through DatabaseLink (uses JDBC internally).
  • Development tools: Interactive Front-End with cell-based interface and syntax-highlighting, Eclipse-based WolframWorkbench IDE for larger projects, the latter having integrated profiler, debugger, and unit testing support. Workbench also supports hybrid project development, in particular Java/Mathematica.

I probably missed some important categories, so everyone should feel free to add some.

share
    
About the CDF player: "which may or may not qualify as a stand-alone executable, depending on the case" - what do you mean by that? I wouldn't say something is stand-alone, if it needs an "interpreter" 100+ MB big, and is generally not supplied with the OS and is limited even if it is free. –  István Zachar Feb 28 '12 at 17:44
    
@Istvan I meant Mathematica player, which is not quite the CDF player (Player Pro, while non-free, has far fewer limitations than CDF player), but anyways - for some cases / applications 100Mb interpreter (run-time) coming with the app may be ok, for others not. –  Leonid Shifrin Feb 28 '12 at 17:47
    
Oh, I see your point, ok. –  István Zachar Feb 28 '12 at 18:01
1  
Suggest add "execution model: term rewriting" as opposed to, say lambda calculus or object-oriented or pure functional. –  Reb.Cabin Mar 2 '12 at 20:21
    
@Reb.Cabin Thanks, added. –  Leonid Shifrin Mar 2 '12 at 20:35
    
What do you mean by scientific programming? I'm not really familiar with that term. –  Andrew MacFie Mar 3 '12 at 3:55
5  
@AndrewMacFie It's one where you start off by writing sloppy code to merely get the job done and only worry about improving/commenting if someone else has a need for the same code :P –  rm -rf Mar 3 '12 at 13:55
    
@LeonidShifrin: Could you make this community wiki? –  Mechanical snail Nov 30 '12 at 19:54
    
@Mechanicalsnail Sure. Done. –  Leonid Shifrin Nov 30 '12 at 20:01
    
Could add RLink :-) –  Sjoerd C. de Vries Dec 1 '12 at 9:16
    
@Leonid "Does not support mutable data structures ..." What is your opinion about Graph objects? Do they behave as structs? I agree, that they are a late addstion to the system, and maybe they don't represent the overall trend of data types, but nevertheless they exist. –  István Zachar Apr 24 '13 at 23:04
    
@IstvánZachar They might behave as structs to some extent, since you can define and change properties. But they are too special-purpose to serve as general mutable structs, I think. Besides, mutability does not generally play well with idiomatic Mathematica programming, and that is reflected in many ways, from performance to the loss of expressiveness. This is a tough problem, although I think it is solvable. –  Leonid Shifrin Apr 24 '13 at 23:10
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .