News for hackers. Stuff that matters.
Re:Lisp is not functional (2010) by kazinator on Wednesday February 08, 2017 @10:05AM (#13598699)
This is mostly wrong. Lisp is mistermed "functional language" due to schools which teach freshmen some subset of a Lisp dialect which they must use in a pure way to solve homework problems: no variable assignment, no loops. The second thing you hear from people after "functional language" is things like "oh yes Lisp. I remember all the recursion; it was elegant".

Lisp is in fact organized around the idea of a function being a pure function and it was that way from the beginning.

This is why the sequential execution of forms with side effects has dedicated macros/operators with names like prog and progn. These provide "the program feature": giving step by step procedural instructions that tell the machine what to do, rather than an expression which computes a value. The only reason to use (progn x1 x2 ... y) is that x1 x2 ... have side effects. If they only compute values that are discarded, the whole thing may be optimized down to just y.

Also, there is a funny quirk in the terminology whereby Lisp people still refer to the arguments of cond as being "cond pairs", even though you can write procedural bodies consisting of multiple forms, and it has been that way for decades:

   (cond
     (this-condition do-this and-do-this yield-this-value) ;; triplet, not pair
     (that-condition do-that and-do-that yield-that-value)
     ...)
The "cond pairs" terminology persists because cond was originally restricted to pairs! Except for the aspect that it evaluated the conditions in left to right order, it was inherently oriented toward handling the cases in functional programming: upon finding a true expression, it evaluated its result counterpart, and yielded that value. In "pure Lisp" programming, cond will still be used that way.

Of course, even ancient Lisp had rplaca and rplacd to mutate conses, and set and setq to mutate variables. The 1960 Lisp 1.5 manual describes arrays (indexed from zero (damn it!) and mutable).

Calling Lisp "least functional" is completely silly, since it was the first tool which enabled computer scientists to translate pure recursion on paper directly into executable code. There are countless languages which might take such a title, by virtue of having no support for functional programming.

Re:Lisp is not functional (2010) by reikonomusha on Wednesday February 08, 2017 @02:22PM (#13601171)
Common Lisp, which the author is referring to, definitely was not organized around functions being pure. Common Lisp actually doesn't have a lot of high-order functions either. A notable exclusion was COMPOSE.

McCarthy's original Lisp was organized around purity, but that preceded Common Lisp by many decades. And, while some names carried over from the original Lisp, Common Lisp had no intention to replicate all of the intents and virtues of McCarthy's Lisp. Even before CL was made, millions of lines of application code had been written in a number of dialects, which had nothing to do with translating math or anything like that.

Re:Lisp is not functional (2010) by kazinator on Wednesday February 08, 2017 @06:55PM (#13603381)
Common Lisp has a functional argument in every library function that takes a :test and/or :key. (Even if these are not specified, they are understood to have functional default values like #'identity and #'eql). And of course apply, mapcar and other applicator friends have a functional arguments. All these things tend to be front-and-center in everyday Lisp programming, hardly "also have" features.
Re:Lisp is not functional (2010) by nitroll on Wednesday February 08, 2017 @10:21PM (#13604387)
Having higher order functions is not really what makes a language functional.
Re:Lisp is not functional (2010) by lispm on Wednesday February 08, 2017 @05:38PM (#13602883)
Lisp I of 1960 had SET and SETQ. It wasn't pure.