There seem to be two big camps that preach a "learn this weird new programming paradigm because it'll help you see things from a new perspective and will make you a better engineer" message: the lispy languages, and the ML-like languages. Both of these languages categories give you functional programming as well as metaprogramming, which is great. Having tried both, I've found that the ML-derived languages tend to ha…
There are also plenty of Lisp programmers that think that it's a real tool to solve real problems, not just an educational oddity. There are a bunch of Lisps out there, and plenty of them are by no means toys. My laptop's initial RAM disk and init system are Scheme programs.
Alan Kay on Lisp
71–80 of 207 posts
Re: Alan Kay on Lisp
#72Actually, I am missing the simplicity of Lisp and Smalltalk in todays languages. From what I remember, they both have a fairly simple but universal syntax, which can be written for Lisp as ([operator] [argument1] [argument2] [argumentN]) and for Smalltalk as [object] [message] So far I haven't seen anything like that for languages with the C-like syntax. Don't get me wrong. For example I love Go, but sometimes I miss…
So you could build simple data processing apps with LISP, but nowadays writing a program is not just about algorithms but in fact mostly about utilizing APIs provided by device and service vendors.
When you build an iPhone app with Objective-C, you use the [object] [message] paradigm but it's still complex, and it's not because of the message passing paradigm itself, but because of the complex Cocoa APIs it needs to use.
Re: Alan Kay on Lisp
#73This is really well written and seems to agree with the traditional FP lore. I'm curious what led Alan Kay then to OOP in Smalltalk.
Whatever Alan Kay thinks OOP is, it isn't what we think it is.
I suspect that there are a lot of people still around who encountered other OOP models before C++ and it's derivatives became dominant for whom that's not really true.
Re: Alan Kay on Lisp
#74Re: Alan Kay on Lisp
#75Earlier quoted context omitted.
ML has metaprogramming? The only thing I know approaching that is template haskell, which is a weak form of metaprogramming (still powerful obviously). Meanwhile, lisp is metaprogramming. No, it's not useful in many (or even most) applications, but when it is useful, you can bet there's some type of analogous pattern for a lisp-type language. Certainly still useful to learn along side ML. :) Hell, the best quote to i…
> ML has metaprogramming? The only thing I know approaching that is template haskell, which is a weak form of metaprogramming (still powerful obviously). Of course, it has had it for a very long time (a decade at least?), see camlp4/camlp5.
How easy is camlp4/5 metaprogramming to read and write compared to Lisp macros?
This reminds me of Alan Perlis' admonition to "beware of the Turing tar-pit in which everything is possible but nothing of interest is easy."[1] and of a question John McCarthy asked Peter Norvig after the latter's talk about how Python was a Lisp:
"When he finished Peter took questions and to my surprise called first on the rumpled old guy who had wandered in just before the talk began and eased himself into a chair just across the aisle from me and a few rows up.
This guy had wild white hair and a scraggly white beard and looked hopelessly lost as if he had gotten separated from the tour group and wandered in mostly to rest his feet and just a little to see what we were all up to. My first thought was that he would be terribly disappointed by our bizarre topic and my second thought was that he would be about the right age, Stanford is just down the road, I think he is still at Stanford -- could it be?
"Yes, John?" Peter said.
I won't pretend to remember Lisp inventor John McCarthy's exact words which is odd because there were only about ten but he simply asked if Python could gracefully manipulate Python code as data.
"No, John, it can't," said Peter and nothing more, graciously assenting to the professor's critique, and McCarthy said no more though Peter waited a moment to see if he would and in the silence a thousand words were said."[2]
[1] - https://en.wikipedia.org/wiki/Turing_tarpit
[2] - http://smuglispweeny.blogspot.com/2008/02/ooh-ooh-my-turn-wh...
Re: Alan Kay on Lisp
#76Actually, I am missing the simplicity of Lisp and Smalltalk in todays languages. From what I remember, they both have a fairly simple but universal syntax, which can be written for Lisp as ([operator] [argument1] [argument2] [argumentN]) and for Smalltalk as [object] [message] So far I haven't seen anything like that for languages with the C-like syntax. Don't get me wrong. For example I love Go, but sometimes I miss…
For example, here are some of the distinct syntax forms in Racket (Scheme):
(+ 3 4) # Procedure call
(lambda (x) (+ x x)) # Lambda expression
# See also case-lambda
(let ((x 23) (y 42)) # Variable binding
(+ x y)) # And also:
# let*, letrec, letrec*, let-values,
# let*-values, let-syntax, letrec-syntax, local
(set! x 4) # Assignment (mutating)
(define x 23) # Defined value
(define (f x) # Defined procedure
(+ x 42))
(quote a) # Quotation
(#%datum . 10) # Quotation (keywords prohibited)
# Conditionals
(if (> 2 3) 'yes 'no)
(cond ((> 3 2) 'greater)
(( cadr) # Test clause
(else #f)) # Else clause
# Guarded evaluation
(when (positive? -5)
(display "hi"))
(unless (positive? 5)
(display "hi"))
# Dispatch
(case (+ 7 5)
[(1 2 3) 'small]
[(10 11 12) 'big])
# Sequencing
(define x 0)
(begin (set! x 5)
(+ x 1))
# See also: begin0, begin-for-syntax
# Iterations and Comprehensions
# for, for/and, for/or, for/vector, for/hash, for/hasheq ...
# Modules and imports
(module id module-path form ...)
(require ...)
(provide ...)
As you can see, although the language consistently uses parentheses, it has similar syntax structure to other languages: assignments, definitions, functions, switch/case, etc. Some of the syntax forms above have multiple variations, as well.Re: Alan Kay on Lisp
#77Earlier quoted context omitted.
smalltalk cutest feature is the named parameter syntax trick (I don't like tricks but let's make an exception). make-range from: 10 to: 20 calss (make-range.from:to 10 20) or something similar. Free nanodsls smalltalk simplicity lies in that the metamodel is actually human reasoning friendly, even while dynamic, you have a clear picture of what's gonna happen in case of errors etc. It didn't please visual age users,…
"smalltalk cutest feature is the named parameter syntax trick..." make-range from: 10 to: 20 calss (make-range.from:to 10 20) or something similar. Free nanodsls For the uninitiated among us, what does that do and what's so magic about it?
1 to: 10.
Sends the "to:" message to the number 1 with the parameter 10. Returns a range representing the numbers from 1 to 10. You can then iterate that range with by sending it the "do:" message with a block argument. 1 to: 10 do:[ :i | ].
And so on. Looks a lot like syntax for a for-loop, but is just message sends to collections with keyword syntax. Every type of collection implements do: (and collect:, select:, reject: etc.) Conditionals work the same way: 1 > 0 ifTrue: [ ]
Sends the ifTrue: message to the result of 1 >0. This will be the true object, which is the sole instance of the True class (subclass of Boolean). The True class defines ifTrue: so that it executes the block. Conversely, the False class defines ifTrue: so that it does nothing, ignoring the block.The fact that what is usually syntax is just message sends means that you can define your own messaging protocols in libraries that also look like syntax.
Dan Ingalls explains: https://youtu.be/P2mh92d-T3Y?t=574
Also, the Grace language expands on this concept by allowing effectively regular expressions of these keyword parameters. Really quite nifty.
Re: Alan Kay on Lisp
#78Earlier quoted context omitted.
smalltalk cutest feature is the named parameter syntax trick (I don't like tricks but let's make an exception). make-range from: 10 to: 20 calss (make-range.from:to 10 20) or something similar. Free nanodsls smalltalk simplicity lies in that the metamodel is actually human reasoning friendly, even while dynamic, you have a clear picture of what's gonna happen in case of errors etc. It didn't please visual age users,…
"smalltalk cutest feature is the named parameter syntax trick..." make-range from: 10 to: 20 calss (make-range.from:to 10 20) or something similar. Free nanodsls For the uninitiated among us, what does that do and what's so magic about it?
That’s a fairly trivial example but it demonstrates how readability is improved. You can imagine how this becomes even more useful with methods that take many parameters.
An interesting document to look at regarding this is Swift’s guidelines on naming methods.
Re: Alan Kay on Lisp
#79Earlier quoted context omitted.
"smalltalk cutest feature is the named parameter syntax trick..." make-range from: 10 to: 20 calss (make-range.from:to 10 20) or something similar. Free nanodsls For the uninitiated among us, what does that do and what's so magic about it?
You can put the parameter names in method calls, which makes for much more readable code. Like a makeRange method may take parameters `from` and `to`, when calling this method you could do `makeRange(from: 0, to:10)`. That’s a fairly trivial example but it demonstrates how readability is improved. You can imagine how this becomes even more useful with methods that take many parameters. An interesting document to look…
Is that something like keyword arguments in Lisp?
Re: Alan Kay on Lisp
#80Actually, I am missing the simplicity of Lisp and Smalltalk in todays languages. From what I remember, they both have a fairly simple but universal syntax, which can be written for Lisp as ([operator] [argument1] [argument2] [argumentN]) and for Smalltalk as [object] [message] So far I haven't seen anything like that for languages with the C-like syntax. Don't get me wrong. For example I love Go, but sometimes I miss…