12

I'm listening to the lectures of an interesting Coursera class called "Programming Languages," taught by someone called Dan Grossman at the University of Washington. It's about functional languages, and it is making me appreciate Mathematica in a new way.

The initial part of the course talks about SML (Standard Meta Language), which is similar to Mathematica, but has static type checking (I wouldn't have known what this was before the course), doesn't allow "rebinding" of values, and of course, doesn't have all of our functions.

There is a SML construction called "let," which seems like Module or Block. For example,
..... let val x = 2 in x +2 end
defines the x as having the value of 2 only inside the let expression. I'm interested in finding out more about how it compares/differs.

Most questions asked here are about using an often exotic function - useful for people wanting to know about how to use that function, but not useful for deepening our understanding of Mathematica itself. I think we should encourage questions and discussion that explore these "deeper" issues.

3
  • 2
    I think it would make perfect sense to ask this type of questions in cases where you have seen some elegant / powerful code in some other language (perhaps having some similarities to Mathematica), and now would like to see how something similar can be achieved with Mathematica. This would bring some new techniques / ideas from other languages into our rather closed world, and IMO would definitely be a good thing - as long as you can clearly explain what does the original code in another language do and which constructs in that language make this possible. Commented Oct 13, 2013 at 13:55
  • Thanks for your comment Commented Oct 13, 2013 at 14:59
  • Perhaps interesting: I think let comes from the language lisp. I've seen a few posts where Leonid used his own Let. This is one. I would love to see conversion tables of functions from mathematica to other languages on the main site. Commented Oct 14, 2013 at 12:54

2 Answers 2

2

Comparative programming linguistics is an interesting subject, but as I understand the mandate of this site, such discussions are not appropriate here. If my understanding is wrong, then Help Center > Asking clearly needs some revision.

3
  • 1
    I don't think that comparing the syntax of Mathematica to another language would be very useful, if that's what you were referring to. I was thinking more about something like what why the decision was made to allowed the binding of new values to variables in Mathematica when it is prohibited in SML, Haskell, OCaml, and other functional languages? That seems to be a deep question (I'm learning). These seem like Leonid Shifrin / Mr. Wizard kinds of questions. Commented Oct 13, 2013 at 2:48
  • Perhaps Shifrin or Mr.Wizard can answer your question on variable bindings. Perhaps only Stephan Wolfram or some senior developer at WRI can. I think it would be a good chat discussion, but not a good question topic.
    – m_goldberg
    Commented Oct 13, 2013 at 3:03
  • 11
    @GeorgeWolfe: the devil is in the wording. If you ask "why the decision was made to …" then you will likely get answers like m_goldberg's. If you change the wording slightly: "what are the advantages and disadvantages of this Mathematica behavior?" then (I think) a lot of people will jump in.
    – Hector
    Commented Oct 13, 2013 at 14:03
1

I have started to understand Maxima recently and it has really surprised me about how close is Mathematica to Maxima(earlier Macsyma). I found out that Stephen had earlier worked on Macsyma(comment from Kent M Pitman) for some time. Stephen and his team preferred C over lisp.

1) Sample function def,

fun(x):=block([local_variables],(..code here...),return(variable))

It took me just one function definition to know rest about function definition in maxima. Use of letis from lisp.

2) variables are type free and removed with Remove in Mathematica, kill in maxima.HoldForm has '<function/variable>as complement in Maxima which actually come from lisp again.HoldRelease[%] has ev(%) as complement.

3) Ability to compile function is present in both.

4) In terms of GUI the concept of cell is exactly similar to cell in maxima which uses WxMaxima for GUI widgets.Point important here is that both have absolutely same way of dealing with GUI.

5) Both support pattern matching and manipulate command which originally came first with Macsyma.

These are just some of the points that both share too much. It didn't take me more than 10 days to be familiar with Maxima just because I have had some hand over Mathematica, though it might not be the case while learning Matlab.

The most important thing is that you can learn how it has been coded rather than just learning how to use it. In my opinion its the most important of all. Learning other tools just adds to the first tool.

You must log in to answer this question.

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