Michele Pasin / Quotes

Macros in lisp

Another beauty of Lisp is its macro facility. I’ve not seen its like in any other language. Because the forms of code and data are equivalent, Lisps macro are not just text substitution, they allow you to modify code structure at compile-time. It’s like having a compiler construction kit as part of the core language, using types and routines identical to what you use in the runtime environment. Compare this to a language like C , where, despite the power of its template meta-language, it employs such a radically different set of tools from the core language that even seasoned C programmers often have little hope of understanding it.

But why is all this necessary? Why do I need to be able to perform compile-time substitutions with a macro, when I can do the same things at runtime with a function? It comes down to evaluation: Before a function is called in Lisp, each of its arguments must be evaluated to yield a concrete value. In fact, it requires that they be evaluated in order1 before the function is ever called.

Say I wanted to write a function called doif, which evaluates its second argument only if the first argument evaluates to true. In Lisp this requires a macro, because an ordinary function call would evaluate that argument in either case:

(defun doif (x y) (if x y)) ; WRONG: both x and y have been evaluated already (defmacro doif (x y) `(if ,x ,y)) ; Right: y is only evaluated if x is true

Saved 16 November 2014 / newartisans.com ↗

#language #Lisp #argument #function

Fortran and Lisp

The history of programming begins with two languages with two completely different philosophies and goals: Fortran and Lisp. Both languages come from…

A Bit Of History — The Adventures Of A Pythonista In Schemeland V0.1 Documentation #Lisp #computation #language

Programming languages are habits of mind

What's so great about Lisp? And if Lisp is so great, why doesn't everyone use it? These sound like rhetorical questions, but actually they have…

Beating The Averages #language #Lisp

Artifacts have proper functions

notion of (technical) artifact. We are aware that many such notions have been discussed in the literature, but the one by Baker [20] works well for us…

Towards An Ontology Of Software: A Requirements Engineering Perspective #artifacts #objects #notion #function

Form should be constrained by function

It is true, as we just have seen, that function doesn’t necessarily determine form. But it is also true that the form of a technological object must depend on…

The Functional Art: An Introduction To Information Graphics And Visualization #function #form #visualization

Ideology

Historian Mario Liverani reminds us that “ideology has the function of presenting exploitation in a favorable light to the exploited, as advantageous to the…

In The Name Of Love | Jacobin #function #light #ideology

Minds are like carburetors, thermostats and clocks

another appeal of the functionalist account of mental states is that it seemed to assimilate the mental realm to a very familiar realm of human functional…

Mind: A Brief Introduction (John R. Searle) #functionalism #function #machine