Is LISP still practiced/used in todays world, or is it a legacy language
Yes, it is, but you have to know where to look. People who use LISP don't tend to shout too loudly about it but there's a handful of examples of a few high-profile startups having used it to great effect over the last 20 years.
It is also very popular with small companies in Europe.
Well, BASIC had LET for assignment as part of the syntax from the start in 1964, so that would predate the use of let in Lisp, which as Chris Jester-Young points out didn't appear until the 1970s according to Evolution of Lisp.
I don't believe COBOL, Fortran, or ALGOL have LET in their syntax either. So I'm going to go with BASIC.
It is very much like learning math will improve your analytic skills and learning latin/classic literature will improve your writing skills.
People who designed those languages have thought hard about what does writing a program means. And those languages are the results of those researches.
That said, learning Java will also make you a better programmer. ...
I'd like to add a theoretical point of view: In classical lambda calculi, let is just syntactic sugar. For example
let x = N in M
can be rewritten simply as
So its first appearance in early (functional) languages isn't that interesting.
However, it become very important with the invention of Hindley-Milner type system and its type inference ...
Many Lispers will tell you that what makes Lisp special is homoiconicity, which means that the code's syntax is represented using the same data structures as other data. For example, here's a simple function (using Scheme syntax) for calculating the hypotenuse of a right-angled triangle with the given side lengths:
(define (hypot x y)
(sqrt (+ (square x) (...
A canonical reference for this type of question is Paul Graham's What Made Lisp Different. The two remaining key features of Lisp that are not widely available, according to this article at the time of its writing, are:
8. A notation for code using trees of symbols.
9. The whole language always available. There is no real distinction between read-...
The simple answer to your question is to try Lisp, preferably in conjunction with SICP. Then you will be enlightened.
Code is Data
Most languages make a sharp distinction between code and data; Lisp does not. This makes it possible to, for example, trivially write a Lisp parser in Lisp, and to manipulate Lisp code within Lisp. The best ...
A dissenting opinion: Lisp's homoiconicity is far less of a useful thing than most Lisp fans would have you believe.
To understand syntactic macros, it's important to understand compilers. The job of a compiler is to turn human-readable code into executable code. From a very high-level perspective, this has two overall phases: parsing and code generation....
Lisp is the oldest language of these having LET now. But BASIC was the first that got it, for Lisp had obtained it much later.
In Ada Lovelace Analytical Engine (1843) - no LET, a program looks as:
N0 6 N1 1 N2 1 × L1 L0 S1 L0 L2 S0 L2 L0 CB?11 '
In Plankalkül of Zuse (1943-45) the program looks:
P1 max3 (V0[:8.0],V1[:8.0],V2[:8.0]) → R0[:8.0]
It's difficult to assess technologies when you don't have deep experience of them, but of course that's exactly when you have to make your decisions, so there's no simple answer to that dilemma.
You cite two concerns: performance and usability. I'll try to address both below.
Firstly, performance. Performance of course depends not only on the language but ...
A decorator is basically just a function.
Example in Common Lisp:
(defun attributes (keywords function)
(loop for (key value) in keywords
do (setf (get function key) value))
In above the function is a symbol (which would be returned by DEFUN) and we put the attributes on the symbol's property list.
Now we can write it around a ...
At the risk of giving a "me too" answer, if you try it you'll see...
If you study computer languages, you're likely to get the impression that it's at least half about parsing.
If you learn Lisp, you'll realize parsing the surface syntax is nothing more than a convenience for people (like most of us) who don't like Lots of Irritating Single Parentheses.
In the context of the paper you linked, the words "micro-coded machine" would almost certainly refer to a Lisp Machine.
At the time Lisp was beginning to get a foothold, it was hoped that it would be run (in the general case) on machines that were designed specifically to execute Lisp instructions, rather than computers with a more general instruction set ...
The question is a difficult one to answer, as someone would have to know all languages in order to know that no other has a particular feature available in Lisp, so the following is based on the languages I have experience with.
Off the top of my head, conditions are something that I haven't seen in any other language. Think 'exceptions', but where the ...
tl;dr Learning new stuff can only make you a better programmer, but being a better programmer is not about the languages you can write code in.
What are the advantages of using LISP and Haskell?
Homoiconic code. This allows structured self-modifying code.
Syntax-aware macros. They allow rewriting of boilerplate code.
Pragmatism. CL is ...
Well, between those three, Lisp definitely had it first. Haskell came about in the 80s, and Clojure in the 00s, and let had been around long before either of those dates. :-)
As to whether Lisp was the language to have invented it, I can't vouch for that yet, but I'll do some research and see. :-)
Update: According to Evolution of Lisp (see page 46), it ...
You are confusing two different concepts in your question. Macros are not about compiling code at runtime. They are the exact opposite: they are about running code at compile time.
So, in this case, the problem is the opposite one: it's not about making the compiler part of the program, rather it is about making the macro-program part of the compiler. You ...
Compiling higher level languages to lower level ones is cake. There's countless examples of it being done. Without going off on much of a tangent, we can point to early C++ compilers that compiled down to C.
When you start throwing "clean" and "readable" into the mix, however, things get really tough. Clean, readable code expresses the meaning and intent ...
They do make computers like that. It's called an FPGA. Of course, FPGAs support both sequential and combinational logic, but there's nothing preventing you from just using the combinational portion as you're suggesting.
In practice, however, sequential logic (the kind with state) is extremely useful even at the chip level. For one thing, it significantly ...
Quote returns data which you should not modify, and which may share structure between themselves.
E.g. if you have a file which contains
(define l1 '(1 2 3))
(define l2 '(4 2 3))
then the compiler is permitted to allocate l1 and l2 in a way that they share their common tail (cdr l1) and (cdr l2) and/or in the read-only memory.
Modification of such ...
Stock hardware basically means "not customized," as you surmised. Which customizations it refers to depends on the context. In the context of the paper, it means a computer which is not micro-codable. Micro code is to machine code as assembly is to a high-level language. It breaks down each instruction into smaller parts. On most processors, the ...
When you learn languages that are outside of the paradigm that you usually operate, it will open your mind to alternative solutions in your day to day and may even help you understand some features in your language of choice better. Just knowing those languages aren't going to make you a better programmer unless you can take the lessons you learned from ...
Byte code weaving and macros are two different things.
Byte code weaving is a way to intercept function calls, so that you can inject some sort of functionality (generally a cross-cutting concern such as logging) into a function call, either before or after the function is executed. Byte code weaving is done at the byte code level, which means that it ...
Literal notation for vectors and maps (ie, square brackets and curly braces) are just read-time sugar, and anything you can represent with that notation can also be represented with S-expressions. As a result, there's no loss of power or homoiconicity, and indeed reader macros (which I understand are even more powerful) are available in a number of lisps.
Maybe an objective (if indirect) measure would be useful here. Consider the sizes of the specifications for the languages.
Racket is basically an implementation of R6RS Scheme. The R6RS specification is 90 pages long, total. Of that, about 25 pages are devoted to the language proper, and about 30 more are devoted to its standard library. Along with that, ...
The Lisp family of languages is a fuzzy concept. The key aspects seems to be
Support for functional programming
Homoiconic (The text <=> The AST, eg Lisp's love of parens)
The big place where Scala falls down in is 3. Scala is hilariously not homoiconic and this is not a bad thing necessarily.
It does have one ...
Why is the study of an interpreter that is written in the language it
interprets so emphasized?
In general, studying an interpreter gives you insight into its language and features.
In general, studying code in a programming language is like practicing a spoken language by listening and reading: it familiarizes you with what that language can do, how it's ...
Reference counting is basically never sufficient for managing memory due to cycles. If a language has mutation we can essentially create a structure like
| | |
| Head | Tail |
| | |
| | |
I put way too much effort into this lousy ...
Macros have the advantage to be expanded at compile time
The idea of Lisp macros is to be able to fully expand them at compile time. Then no compiler is needed at runtime. Most Lisp systems allow you to fully compile code. The compilation step includes the macro expansion phase. There is no expansion needed at runtime.
Often Lisp systems include a compiler,...