7 ms·
tl;dr: The Wolfram Language is an ok 30-year-old language with a huge standard library. You can do really amazing things in a single line of code... as long as
by one-more-minute 11y ago
tl;dr: The Wolfram Language is an ok 30-year-old language with a huge standard library. You can do really amazing things in a single line of code... as long as there's a built-in function to do that thing. Hmm.
I actually really like Mathematica as a tool for symbolic/mathematical stuff – they're the best at what they do best. But all this Wolfram Language stuff is just way overblown, and realistically a proprietary standard library – however huge – just can't compete with the open source ecosystems of Python and friends.
- coliveira 11y agoI think you would appreciate the language better if you understood that it is just Lisp with a slightly different syntax. They do everything using symbols, and all functions are decomposed into symbols for head and arguments. In my point of view, Wolfram language is a combination of many of the great concepts from Lisp and Prolog, which makes it very useful for knowledge representation.
- jordigh 11y agoIt's just about the only living mostly lisp implemented with mexps instead of sexps. But it sure is overhyped and it being proprietary is a huge drawback.
- lispm 11y agoLisp is not a rule-based term rewrite system.
- gertef 11y agoIt can be, if you define the appropriate macros
- lispm 11y ago'macros' don't buy you much in that case. you'll need a few functions, too. But that's not the point anyway - you can implement lots of things on top of Lisp. Lisp is based on a specific evaluation model. Not term rewriting. The way macros are computed is slightly related (since they take source and return source), but that's all.
- tokipin 11y agoMathematica has lisp essentially as a subset built on top of its rewrite system. In other words its rewrite system is so powerful that lisp can be naturally threaded into it. In particular the symbolic nature of the language means that everything is first class, functions and function constructions ("functional programming") and expressions in general ("macros") being just basic cases.
- gohrt 11y agoCan the user define a macro in Mathematica language?
- evanb 11y agoIt's not quite so clear as that. In Mma you can give special meanings to any patterns of symbols you like, which is very much like defining a macro.
- taliesinb 11y agoThere aren't read-time macros (yet). I'm actually in the process of designing a new package system that solves this (among many other problems).
- tokipin 11y agothe concept of "macros" in Mathematica doesn't really exist as its own concept because the whole system is based on rewriting structure. for example, the ReplaceAll function[1] which is commonly used in idiomatic code is basically an in-place macro definition and execution, yet it wouldn't occur to most people that it's anything special. if you're trying to make a traditional macro, you would implement it as a function with the HoldFirst et al attribute. an important thing to know is that ReplaceAll uses arbitrary structural patterns. it's not a simple "turn every a into b". you can say things like "turn every application of the symbol F on an even number into an application of G on that number divided by two". expr /. F[n_?EvenQ] :> G[n/2] [1] https://reference.wolfram.com/language/ref/ReplaceAll.html https://reference.wolfram.com/language/ref/ReplaceAll.html
- lispm 11y ago
- deleted 11y ago[deleted]
- outworlder 11y ago> tl;dr: The Wolfram Language is an ok 30-year-old language I don't think it is just 'OK'. It is lispy, with a HEAVY emphasis on symbolic computation. I have yet to see anything even remotely similar to it. EDIT: There's also the visualization aspect. Things like Jupyter (formerly iPython) come close, but still can't do things like render video. If you don't want to read the article, there's this video: https://youtu.be/_P9HqHVPeik?t=67 https://youtu.be/_P9HqHVPeik?t=67 (initial ego trip skipped) (Another edit: fix typo)
- ngoldbaum 11y agoJust a head's up: it's Jupyter, not Jupyther.
- hyperion2010 11y agoThey are working on video support but are still at the research stage.
- peterjmag 11y agoGreat video, but I think the question on everyone's mind is: is it symbolic?
- frik 11y agoThe language agnostic Jupyter with its interactive notebook comes close to Mathematica's environment. http://jupyter.org/ http://jupyter.org/ Jupyter supports Python and other languages like Julia (https://github.com/JuliaLang/IJulia.jl https://github.com/JuliaLang/IJulia.jl ). I don't know if there are JS and Lua bindings but both would lend themself because of their first class functions and functional language features.
- stared 11y agoFor JavaScript it is easy - just start a cell with "%%javascript", see e.g. http://nbviewer.ipython.org/github/davidrpugh/cookbook-code/blob/master/notebooks/chapter03_notebook/03_controls.ipynb http://nbviewer.ipython.org/github/davidrpugh/cookbook-code/...
- 11y ago
- BringTheTanks 11y ago> realistically a proprietary standard library – however huge – just can't compete with the open source ecosystems of Python and friends. It's not competing with Python, it's language as a service. Instead of downloading dependencies, you just have them. They're hooked to live data sources, zero configuration. This has a lot of potential, and it doesn't need to be its own language, but it doesn't hurt much.
- frik 11y agoThe Mathematica I know (v5, v6) were usable completely offline. Can one use the recent Mathematica version in an offline mode? How many parts are really part of the online service? I guess the WolframAlpha style data sources (country, city, etc. db sources).
- fsloth 11y ago"a proprietary standard library – however huge – just can't compete with the open source ecosystems of Python and friends." Depends on what one needs. If data crunching ala R and Pandas is all one needs - maybe. But I've not found an open source platform that would do all Mathematica does as efficiently (as measured by development time). Also, if a software package brings value to a company, there is no reason they would not pay to use it if it brings obvious value above it's fixed cost.
- jwr 11y agoAgreed. Although I would not fully agree on Wolfram Language being fully "ok". As a long-time lisper (Clojure, previously Common Lisp) and a heavy Mathematica user I do appreciate the lispy aspects of WL. Yes, you can even write macros, although the syntax is painful. I use Mathematica to solve specific kinds of problems. If there is lots of math involved, for immediate visualization, for data and problem exploration. But I always find it needlessly painful. The most important drawbacks are: * The language syntax isn't as good as a sexp-based lisp. Editing complex expressions is needlessly complex and doesn't even compare to structured editing with paredit in Emacs. * The interpreter is slow. Really slow. Sure, if you call a matrix math routine, it will be OK, but try rearranging large data structures and you'll end up waiting a lot. * The editor is a disaster. I seriously don't know how people can stand it and how come the company invests so little in it. A single mismatched bracket can mean ten minutes of hunting for the problem. Code jumps around on screen all the time, seemingly with no logic to it. Syntax highlighting is nearly non-existent. It's a complete trainwreck and I don't understand why this isn't seen by the company as a huge problem. * Debugging support: what debugging support? * Hash-maps: these were only added recently (!!!) and they are not what I'd expect in a modern language. For example, if you want to do a map lookup, and your keys aren't strings, you need to wrap them in Key[]. Come on. I also found that it's very difficult to achieve any kind of code reuse. The process of getting from a prototype to a library has so much friction that people tend to avoid it. I find that I use Mathematica for a limited range of problems. If I could have Mathematica's library in Clojure with a graphical REPL, I'd pick that any day (Clojuratica is a project aiming for that). Also, I don't really get the whole "Wolfram Language" vs Mathematica distinction. All the demos I see are demos of Mathematica, mostly of its huge and useful library.
- taliesinb 11y ago> * The language syntax isn't as good as a sexp-based lisp. Editing complex expressions is needlessly complex and doesn't even compare to structured editing with paredit in Emacs. Did you know that the frontend lets you double/triple/etc click to select outward up the AST? You can also press ctrl+period to do this. It's indeed not paredit, but you can do most paredity things using this single primitive and copy/paste, and it's not too painful (and it would only take a weekend to make a package that implements paredit). Other than the lack of paredit, could you be more specific about the syntax isn't good? You can always use FullForm if you want to write things in an sexp way. I think the equivalence between prefix form (f /@ x, f @ x, f @@ x), and FullForm (Map[x, y], f[x], Apply[f, x]), and postfix form (x // f) is a nice degree of freedom when beatifying code. Sames goes for composition (f /* g, or g @* f). Functions tell a story and having to write that story in exactly one austere syntactic way is in my view a disadvantage for making the story clear and satisfying. > * The interpreter is slow. Really slow. Sure, if you call a matrix math routine, it will be OK, but try rearranging large data structures and you'll end up waiting a lot. I haven't done benchmarks recently but we're probably in the same ballpark as (C)Python. Maybe a bit slower. But if you'd consider using Python for a task it's also likely to be handled by Mathematica just fine. In many cases there is plenty-optimized C code doing the heavy lifting, like if you use our machine learning functions or anything with matrices (or vectors/lists, or tensors, or ByteArrays, or Images, or Graphs, or ... :) ). As usual, interpreted languages can even win when they allow you to describe a computation at a high level, and have that be executed by some smart JIT compiler. Julia leads the way, of course, but we're working on similar things ourselves, particularly for Dataset (http://reference.wolfram.com/language/ref/Dataset.html http://reference.wolfram.com/language/ref/Dataset.html). > * Debugging support: what debugging support? There is a built-in debugger in the frontend, under the "Debug" menu, that actually does a fair job of showing where in your expression the evaluator is at. I admit that I don't use it much, partly because I've got a much more ambitious prototype of a thing that produces a browseable execution history. Hopefully that's only a few point versions away, I just have such a crazy number of projects.. sigh. > * The editor is a disaster. I seriously don't know how people can stand it and how come the company invests so little in it. A single mismatched bracket can mean ten minutes of hunting for the problem. Code jumps around on screen all the time, seemingly with no logic to it. That's because you're probably using Input cells. Input cells are for one- or two-line inputs. Use Code cells for large bodies of code. They don't do automatic indenting and won't jump around. If you wish to complain that this isn't obvious enough, I entirely agree with you! It takes too long to discover the 'right way of doing things', which is a UX and design failing. And simple stuff like Tab on a selection of multiple lines doesn't work. I use Eclipse (for which there is a plugin), or Sublime Text. > Syntax highlighting is nearly non-existent. Syntax highlighting isn't non-existent, at all. I'm not sure where you get that from. Some examples of things that are highlighted: * Misspelled functions (functions without definitions are blue) * Invalid numbers of function args * Invalid options to functions (options=keyword parameters) * Scoped variables for Block, Module, With, DynamicModule, Table, Do, etc * Symbol shadowing (a variable in a Module shadowing another module, etc) * Invalid graphics and typesetting and GUI elements And beyond that, various little red arrows appear when you write something that couldn't parse. > It's a complete trainwreck and I don't understand why this isn't seen by the company as a huge problem. "Trainwreck" really seems hyperbolic. Whatever our faults, one of the things people tend to agree about is that we've innovated with the frontend, and others are only now catching up with IPython, Light table, etc. And they have a long way to go. The frontend has reflow, a box language, cascading stylesheets, and something resembling FRP (though a bit less clean, perhaps). It's really not far off from HTML in its flexibility and power. > Hash-maps: these were only added recently (!!!) and they are not what I'd expect in a modern language. For example, if you want to do a map lookup, and your keys aren't strings, you need to wrap them in Key[]. Come on. Good thing we waited, though, if we had added associative arrays 15 years ago we wouldn't have had datastructures like HAMTs to achieve both immutability and efficiency. I'm puzzled. Both the subvalue lookup (assoc[x]) and the Lookup function (Lookup[assoc, key, default]) don't require a Key wrapper, and those are the dominant ways to use associations. Key wrappers are only required when using e.g. Part, to distinguish e.g. the key All from the part spec All. What other behavior would you have wanted? And design-wise, I actually think we nailed the design. There are all sorts of nice equivalences of the form Values[f[assoc]] === f[Values[assoc]] that give an association a well-defined 'kinematics' -- they are like ordinary numerically-indexed expressions (e.g. Part[f[a,b,c],2] is b), but the indices are now arbitrary expressions. That essentially forces your hand with respect to many existing functions, like Sort, Map, Partition, Take, Drop, and so on. And that makes them seem cleaner than in many other languages, which mostly treat associative arrays as little more than bags of tuples (e.g. mapping over a hashmap in Clojure is not terribly useful or efficient). Plus, the order-preserving is just nice, even if there is a performance cost. > I find that I use Mathematica for a limited range of problems. If I could have Mathematica's library in Clojure with a graphical REPL, I'd pick that any day (Clojuratica is a project aiming for that). Clojuratica was developed by a friend of mine. Sadly he's moved on to other things. It's pretty easy to build something similar on top of JLink, though, see http://reference.wolfram.com/language/JLink/tutorial/WritingJavaProgramsThatUseTheWolframLanguage.html http://reference.wolfram.com/language/JLink/tutorial/Writing... If you're a big Clojure user you may be interested in Session -- https://medium.com/@kovasb/session-1a12997a5f70 https://medium.com/@kovasb/session-1a12997a5f70 -- that's a project by another friend of mine who used to work at Wolfram and now is an active member of the Clojure community.
- EGreg 11y agoNo, you are missing the point, as I did before. This is really a LANGUAGE - in the sense that the symbols themselves can rely on account the vast knowledge base to determine their meaning. When you and I speak in the English language, many times our terms come together to make sense in a certain way that relies not just on the context in the text but also background knowledge. Those who don't have this background knowledge won't understand what the sentence MEANS. Yes, you can think of the semantics of the typed expressions as "the language" and the rest as a standard library. But that will still leave you in the mindset of programming computers using long programs of esoteric text when you need something done - and that is over 30 years old. Consider this - calling this a language encourages regular people to learn it, much like English, with its vocabulary, and use it.