On Wed, 7 May 2008 16:13:36 -0700 (PDT), "[EMAIL PROTECTED]" <[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. 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. Lambda is not a function - it is a function constructor. A better name for it might be MAKE-FUNCTION. I (and probably anyone else you might ask) will agree that the term "lambda" is not indicative of it's meaning, but it's meaning is not synonymous with "function" as you suggest. I suspect Mathematica of just following historical convention itself. Mathematica uses the term inappropriately just as it was (ab)used in Pascal (circa 1970). I'm not aware of earlier (ab)uses but there probably were some. >• 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”) "Let" is the preferred mathematical term for introducing a variable. Lisp uses it in that meaning. What a word means or doesn't in English is not particularly relevant to its use in another language. There are many instances of two human languages using identical looking words with very different meanings. Why should computer languages be immune? >• 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. Lisp has "first" and "rest" - which are just synonyms for "car" and "cdr". Older programmers typically prefer car and cdr for historical reasons, but few object to the use of first and rest except for semantic reasons - Lisp does not have a list data type, lists are aggregates constructed from a primitive pair data type. Pairs can be used to construct trees as well as lists and "rest" has little meaning for a tree. When used with lists, first and rest are meaningful terms and no one will object to them. Besides which, you easily create synonyms for car and cdr (and virtually any other Lisp function) with no more burden on the reader of your code than using a C macro. You can call them "first and rest", or "first and second", or "left and right", or "red and black" or whatever else makes sense for your data. People coming to Lisp from other languages often complain of macros that they have to learn "a new language" every time they read a program. But in fact, the same is true in all languages - the reader always has to learn the user-defined functions and how they are used to make sense of the code. In that sense Lisp is no different from any other language. Common Lisp doesn't have "filter". Even so, with respect to the merits of calling a function "extract" or "select" versus "filter", I think that's just a matter of familiarity. The term "filter" conveys a more general idea than the others and can, by parameterization, perform either function. >The above are some examples. The thing to note is that, Mathematica's >choices are often such that the word stands for the meaning themselves >in some logical and independent way as much as possible, without >having dependent on a particular computer science field's context or >history. One easy way to confirm this, is taking a keyword and ask a >wide audience, who doesn't know about the language or even unfamiliar >of computer programing, to guess what it means. The wide audience can >be made up of mathematicians, scientists, engineers, programers, >laymen. This general audience, are more likely to guess correctly what >Mathematica's keyword is meant in the language, than the the name used >in other computer languages who's naming choices goes by convention or >context. > >(for example, Perl's naming heavily relies on unix culture (grep, >pipe, hash...), while functional lang's namings are typically heavily >based on the field of mathematical logic (e.g. lambda, currying, >closure, monad, ...). Lisp's cons, car, cdr, are based on computer >hardware (this particular naming, caused a major damage to the lisp >language to this day). (Other examples: pop, shift are based on >computer science jargon of “stack”. Grep is from Global Regular >Expression Print, while Regular Expression is from theoretical >computer science of Automata... The name regex has done major hidden >damage to the computing industry, in the sense that if it have just >called it “string patterns”, then a lot explanations, literatures, >confusions, would have been avoided.)) > >(Note: Keywords or functions in Mathematica are not necessarily always >best named. Nor are there always one absolute choice as best, as there >are many other considerations, such as the force of wide existing >convention, the context where the function are used, brevity, >limitations of English language, different scientific context (e.g. >math, physics, engineering), or even human preferences.) > >---------------------------- > >Many of the issues regarding the importance and effects of >terminology's quality, i've wrote about since about 2000. Here are the >relevant essays: > >• Jargons of Info Tech Industry > http://xahlee.org/UnixResource_dir/writ/jargons.html > >• The Jargon “Lisp1” vs “Lisp2” > http://xahlee.org/emacs/lisp1_vs_lisp2.html > >• The Term Curring In Computer Science > http://xahlee.org/UnixResource_dir/writ/currying.html > >• What Is Closure In A Programing Language > http://xahlee.org/UnixResource_dir/writ/closure.html > >• What are OOP's Jargons and Complexities > http://xahlee.org/Periodic_dosage_dir/t2/oop.html > >• Sun Microsystem's abuse of term “API” and “Interface” > http://xahlee.org/java-a-day/interface.html > >• Math Terminology and Naming of Things > http://xahlee.org/cmaci/notation/math_namings.html > > Xah > [EMAIL PROTECTED] >? http://xahlee.org/ > >? George -- for email reply remove "/" from address -- http://mail.python.org/mailman/listinfo/python-list