[EMAIL PROTECTED] wrote: > I'd like to introduce a blog post by Stephen Wolfram, on the design > process of Mathematica. In particular, he touches on the importance of > naming of functions. > > ? Ten Thousand Hours of Design Reviews (2008 Jan 10) by Stephen > Wolfram > http://blog.wolfram.com/2008/01/10/ten-thousand-hours-of-design-reviews/ > > The issue is fitting here today, in our discussion of ?closure? > terminology recently, as well the jargons ?lisp 1 vs lisp2? (multi- > meaning space vs single-meaning space), ?tail recursion?, ?currying?, > ?lambda?, that perennially crop up here and elsewhere in computer > language forums in wild misunderstanding and brouhaha. > > The functions in Mathematica, are usually very well-name, in contrast > to most other computing languages.
The mathematical functions are well named but many of the general programming constructs are not even well defined, let alone well named. For example, overloaded "Gamma" in Mathematica vs "gammainc" in MATLAB for the incomplete gamma functions. > In particular, the naming in > Mathematica, as Stephen Wolfram implied in his blog above, takes the > perspective of naming by capturing the essense, or mathematical > essence, of the keyword in question. (as opposed to, naming it > according to convention, which often came from historical happenings) > When a thing is well-named from the perspective of what it actually > ?mathematically? is, as opposed to historical developments, it avoids > vast amount of potential confusion. > > Let me give a few example. > > ? ?lambda?, widely used as a keyword in functional languages, is named > just ?Function? in Mathematica. The ?lambda? happend to be called so > in the field of symbolic logic, is due to use of the greek letter > lambda ??? by happenstance. The word does not convey what it means. > While, the name ?Function?, stands for the mathematical concept of > ?function? as is. Look at the "function" keyword in OCaml and F#. They also pattern match over their input whereas Mathematica does not allow this in "Function". > ? Module, Block, in Mathematica is in lisp's various ?let*?. The > lisp's keywords ?let?, is based on the English word ?let?. That word > is one of the English word with multitudes of meanings. If you look up > its definition in a dictionary, you'll see that it means many > disparate things. One of them, as in ?let's go?, has the meaning of > ?permit; to cause to; allow?. This meaning is rather vague from a > mathematical sense. Mathematica's choice of Module, Block, is based on > the idea that it builds a self-contained segment of code. (however, > the choice of Block as keyword here isn't perfect, since the word also > has meanings like ?obstruct; jam?) Bad example. Mathematica's "Block" implements what we all know as "Scope". Mathematica's "Module" implements something most people have never needed to learn (rewriting a subexpression with uniquely tagged identifiers to disambiguate them from externals): In[1] := Module[{a}, a] Out[1] = a$617 > ? Functions that takes elements out of list are variously named First, > Rest, Last, Extract, Part, Take, Select, Cases, DeleteCases... as > opposed to ?car?, ?cdr?, ?filter?, ?filter?, ?pop?, ?shift?, > ?unshift?, in lisps and perl and other langs. You are comparing arrays in Mathematica to lists in other functional languages. Mathematica is often asymptotically slower as a consequence, with "Rest" being O(n): In[1] := AbsoluteTiming[Rest[Range[1, 1000000]];] Out[1] = {0.219, Null} The equivalents over lists are all O(1) in SML, OCaml, F#, Haskell, Scala, Lisp and Scheme and is called the "tail" of a list. For example, in F#: > time List.tl [1 .. 1000000];; Took 0ms val it : int list = ... Perhaps the best example I can think of to substantiate your original point is simple comparison because Mathematica allows: a < b < c I wish other languages did. -- Dr Jon D Harrop, Flying Frog Consultancy http://www.ffconsultancy.com/products/?u -- http://mail.python.org/mailman/listinfo/python-list