My Impression Of Lisp from Mathematica
(My First Encounter and Impression of Lisp)
[The following gives a brief outline of one aspect of my computing experience. In particular, it outlines my first encounter and impression of the lisp language. This was originally written as a reply tangential to a thread in the online forum comp.lang.lisp]
Here's some personal story about how i ventured into lisp and my first impression.
The path of my computing experience is kinda unusual like most other things about me. In 1991, i was 23, and was attending a 2-year community college in California. (DeAnza College and Foothill college) (i have never had highschool (more or less never had a _chance_ to, actually.))
During these college years (which is about 1991 to 1994, rather unusually long for a 2-year community college), i've took all math courses they offered (roughly equivalent to math classes of first 2 years in a 4 years university; culminating in multi-var calculus and a intro course on Differential Equations and Linear Algebra, but no Abstract Algebra nor Analysis proper), but i've never took any computer science courses. (i think i might have taken a Pascal course)
It is also during the early 1990s, i started to learn programing on my own. My first “language” is the one in HP-28s programable scientific calculator. I remember having wrote a program to solve the 8-queens problem all on my own. (without knowing or heard of the term back-tracking) [see HP-28S Advanced Scientific Calculator]
And, during these years i bought Mathematica (because i heard it's the best math tool and i love math and wanted to have the best tool). I taught myself Mathematica and wrote some programs for visualizing plane curves, which later got me hired at Wolfram Research in 1995 as a intern. (See: Visual Dictionary of Special Plane Curves)
By 1997, i'm one of the world's top Mathematica-programing expert. But the curious thing is that, i have absolutely no idea what is a compiler, parser, lexer, and absolutely have no faintest idea how Operating System worked or its basic structure or purpose in technical terms, and have absolutely no idea how networking worked. Do not even have a practical concept of what's a computing protocol (such as TCP/IP, HTTP/FTP, NFS …etc.). Absolutely do not know anything about “unix”, and vividly remember that i don't know what is “tar” and “gzip” (just knew that these are in some exotic “unix workstations” and some mysterious org or movement called “GNU”). (during all these years up to 1997, i was using Mac, being what a Mac fan might call a “power user” (as a computer user (as opposed to a programer); and using the mouse; in the days when Macs are just Finder and Multi-Finder, and used by Desktop publishing, with MacUser and MacWorld magazines publishing tricks and software application reviews etc. (e.g. Microsoft Word, Word Perfect, Nesus Writer, WordStar, Lotus 123, Excell and Wingz Spreadsheets…etc)))
I must stress, i have absolutely no concrete idea about anything that a normal computer science student would know in his first or second year. I do not have any concrete idea what IS a language specification (such as Java lang spec or Common Lisp “Hyperspec” or Emacs Lisp Reference Manual, etc) I have close to absolutely no knowledge to how ANY other computing languages. Put in another way, i wouldn't know how to write a Hello Word in any other language. I do not know, what exactly is compiling and linking, just knew they are something “real” programing languages have to do before a program can run. I have no notion of what's a “white paper”, “functional programing”, and DO NOT understand (or even heard of) the meaning of “side effect” (in the context of functional programing). (i vividly recall, the first time i heard the term “side effect”, is in 1995 when i was trying to describe, in some verbose manner, a nature of the code i wrote, to Methamtica creator Stephen Wolfram (in the sense a student is trying to present his idea), and he said “[you mean] side effect …”, and i was like “Yeah, exactly, ‘side effect’!” (and feeling enlightened how the phrase described the situation well).)
The gist of this is that, from my programing experience from 1991 to about 1997, i learned programing only in HP-28s and Mathematica, by mostly the shear reading of their manuals from cover to cover (practically several times), while having just about no concept of any basic computer science ideas. (However, I am familiar of many computing related mathematical concepts, such as algorithm, algorithm efficiency order (typically expressed as “computation complexity” or “O(n)”), because i love math and have studied some discrete/finite math on my own. (But, for example, i do not at the time know Algorithms that are typically taught to CS students, such as sorting algorithms. I have tried to read Knuth's Art Of Programing but it was pretty incomprehensible (To understand Knuth's books, one has to be familiar with assembly languages, since he uses MMX, which is a artificial assembly language).))
From about 1997 onwards, i started to study most of these things, starting with unix and perl, by sheer reading of the manuals and documentations and industrial books (e.g. O'Reilly) and hands on coding in them. (by 2000, i'm a fair expert of unix admin and perl, with knowledge in SQL/database, working knowledge of IP protocols… etc, actually working in start-ups in Silicon Valley's tech boom since late 1998, to write web-based applications (e-store).)
Ok, the main point i started to write this personal history, is my first encounter with Lisp. (the previous paragraphs are just intro.)
Although lacking a formal or conventional education, i'm by birth highly intelligent and by nature very curious. This means i have read a lot of books or texts or literature i have in contact with and in library (was a avid library visitor), such as the massive number of programing FAQs and FAQs of other subjects (such as BDSM) etc. (FAQs were widely popular in the 1990s, somewhat analogous to today's Wikipedia) So, it is very present in my awareness, that there is a language called Lisp, associated with the phrase Artificial Intelligence (the very phrase, at face value, excites me greatly), and is supposed to be extremely powerful and beautiful. And, at the time, i have heard, that Scheme, is the most beautiful and elegant language that exists. (this was my FAQ reading impression) And, i heard that the book “The Structure and Interpretation of Computer Programs” by Harold Abelson et al, is the best computer science book. So, i started to read it and learn Scheme.
Remember, at the time i'm a master of Mathematica _the language_ itself (what one would call a “application programer”), yet do not know much about the typical concepts and knowledge taught to college students as “computer science”. When i started to learn Scheme, the first thing that hit me is the cons business. To me, who are accustomed to Mathematica, finding the cons business weird and unwieldy. It puzzled me. I was thinking, how can a elegant language have this? Certainly in Mathematica i can create, extract, manipulate nested lists (tree structure) far more easily. At the time, since i barely have basic knowledge of any computer science subjects, i was greatly puzzled about the situation. (in fact made a newsgroup post in comp.lang.scheme, tentatively trying to find the answer (and was flamed by one Erik Naggum) (this is 1998-01))
(this short personal account is not supposed to be a pitch for Mathematica. It just came out that way. There are, of course other langs, depending on context and area of application, are equal quality as Mathematica. For example, i would think erlang, OCaml, DYLAN etc would qualify, but i just have not actually learned these)
(gee, i just typed as quickly as possible and it came out to be over 1 thousand words of a brief personal bio of my computing experiences. Good for me! The original intention was just to describe my first impression of Scheme)
A Mathematica Programer's View of Lisp
The Mathematica language is very similar to lisp. In fact, one could say it's a lisp too. It shares the essential quality of lisp, namely: uniformly nested syntax, programs are largely based on manipulating lists, entities are symbolic, program is data and data is program. From a Mathematica expert's point of view (me), the first thing that seems odd of lisp is the low-level-ness. Perhaps in order of the low level impression:
- ① The cons business. (lists are made up of cons cells and it is necessary for the programer to understand this to write any non-trivial lisp program) (info "(elisp) Cons Cells")
- ② No universal high level treatment of lists. (In Mathematica, there are a system of functions to extract or manipulate (nested) lists considered as trees. e.g. getting all elements at a level, or arbitrary set of nodes of a tree. All these based on a tree index concept. (i.e. first branch's second branch's third's branch will be 1,2,3. See http://reference.wolfram.com/mathematica/guide/ElementsOfLists.html. Such coherent manipulation of generic list is sometimes called Array programming languages that began with APL.) In lisp, programers use cons, car, cdr, caadr, etc. That is bizarre and downright stupid.) (lisps do have higher level list manipulation functions to various degree and consistency, such as “nth” and few others. But in general, due to the fact that lists are made of cons cells, and consequently necessates the concept of “proper list” and “improper list”, and also the frequent use of car, cdr, etc, its not possible to use high-level list functions without knowing the structure of the list.)
- ③ The syntax is a bit quirky. In particular, a Mathematica programer sees that sometimes list is written as “(list a b c)”, but sometimes there's this oddity “'(a b c)” (which is syntactically equivalent to “(quote (list a b c))”). And, when mapping a function, sometimes the programer also needs to put the apostrophe in front. (A Mathematica programer would think, if a function (e.g. “map”) that takes another function as argument, why would the function require the programer to put the apostrophe, whereas the function itself could be designed to not evaluate that argument.)
- ④ A behind-the-scenes model of computation. Namely, lisp the language deals with the concept of “lisp objects”, and there's a “print syntax” that represent these objects. (and a “read syntax” that reads a code into these objects) [see Meaning of Object in Computer Languages]
I think these are probably most odd things in lisp for a Mathematica programer on the first exposure.
A short summary of my comp lang experiences, counting only serious involvement, say, few hours a day doing real jobs:
- 1991 to 1994, HP-28S.
- ~1992 to 1998, Mathematica.
- 1996 to now, HTML (and later years related css, xml)
- 1998 to 2004, Perl, sql, apache, bash, whole unix admin shebang.
- 2001, 2005, Java.
- 2005 to 2006, Python.
- 2006 to now, emacs lisp.
Xah's Programing Language Tutorials Index