I fail to see how this is going to convince anybody who hasn't tried lisp to give it a shot. This cartoon can be summarised as "All languages are accumulating bugs while lisp has some magic X and Y that provide a way around them." A blub user will think "yeah whatever", IMHO.
My thoughts exactly, but I'd add this: I love and respect Lisp; I've written my fair share of it. There is absolutely nothing inherently magical in Lisp that prevent you from introducing bugs. You can just as easily make a logic error in your code that results in a bug. Bugs happen. Bugs will happen. There is no silver bullet. The only way to reduce bugs is to test thoroughly. tl;dr: nice cartoon, "lisp means no bugs…
How Lisp is Going to Save the World
91–100 of 239 posts
Re: How Lisp is Going to Save the World
#92I had Haskell as the subject in my intro course at university (my first experience with functional programming). I've tinkered a bit with it since then as well, and I'm at the "somewhat intuitive grasp of monad transformers" state. I tried Clojure some week ago through the Clojure koans that were posted here. Compared to Haskell I found the syntax very obtuse and it was not obvious why Lisp would be more powerful tha…
Re: How Lisp is Going to Save the World
#93I had Haskell as the subject in my intro course at university (my first experience with functional programming). I've tinkered a bit with it since then as well, and I'm at the "somewhat intuitive grasp of monad transformers" state. I tried Clojure some week ago through the Clojure koans that were posted here. Compared to Haskell I found the syntax very obtuse and it was not obvious why Lisp would be more powerful tha…
I would advise checking out the problems at http://www.4clojure.com/ over the koans. You will definitely find some challenging problems. The nice thing about these is that you can look at how other users all solving the problems, which helps to convey a sense of style. I haven't done a problem in awhile, but I oftentimes gotten something out of looking at solutions from 'amalloy' and 'chouser' in particular. Of cours…
Re: How Lisp is Going to Save the World
#94Earlier quoted context omitted.
> If it is so good why ain't it is used more? * Weird syntax (for most people). * No free implementations existed during a key period (80s, 90s) so no initial traction, no useful libraries and killer apps which would pull the whole ecosystem. Implementations didnt even exist for commodity hardware. * The commercial implementations cost too much, so they suffocated the ecosystem. People preferred coding for free in C…
> * No free implementations existed during a key period (80s, 90s) so no initial traction, no useful libraries and killer apps which would pull the whole ecosystem. Implementations didnt even exist for commodity hardware. Emacs LISP (OK, a limited dialect) was available and so was CMUCL (full implementation), which I believe was used for teaching in 1992 when I first got in contact with LISP at our uni ... Also, back…
Re: How Lisp is Going to Save the World
#95Earlier quoted context omitted.
Did you read the manual? http://www.gnu.org/software/mit-scheme/documentation/mit-sch... It's not as easy as setting breakpoints in an IDE like Eclipse and using a visual debugger there, but it's definitely a workable command-line debugger. You just need a little patience in order learn how to use it, and also probably have a pretty good understanding of Scheme's execution model, but that would be true for debugging…
> Did you read the manual? For real? > It's not as easy as setting breakpoints in an IDE I don't use an IDE. I'm comparing against command line tools for scripting languages, Haskell and Common Lisp. Some fail more helpfully than others.
Re: How Lisp is Going to Save the World
#96Earlier quoted context omitted.
> No competitive free implementation existed able to take a leading position and bootstrap the ecosystem, like gcc, cpython, perl and javac did for their respective language ecosystems. it was never a goal in the Lisp community to develop a single unified or leading implementation. This has nothing to do with 'free software' or not.
"it was never a goal in the Lisp community to develop a single unified or leading implementation" ...and that's one reason it hasn't ever achieved critical mass: it's so easy to write software that only works on one implementation that the various CLs effectively compete with each other on the same level that each is competing with other rapid development languages. It wasn't CL vs Python vs PHP, but instead CMUCL vs…
CL implementations can share a lot of code.
I've just compiled Mark Tarver's Shen in another Lisp by just changing less than ten lines of code. It took me ten minutes.
Re: How Lisp is Going to Save the World
#97Am I the only one having a hard time reading lisp? Non-functional programs read like plain English. Particularly Python but I just can't get my head around the functional ones.
The Main difference is, a functional programs mainly talks about what things are, not what they do. For instance:
// C(++)
int square(int n)
{
return n * n;
}
-- Haskell
square :: Int -> Int
square n = n * n
The C code reads like a procedure to follow: "return n times n to whoever called you" (I'm anthropomorphising square(), here). The Haskell code reads like a description: "the square of n is n times n".That was the first major difficulty. Now the second one: functional code is often like reversed imperative code:
// C(++)
int compute(int n)
{
int x = foo(n);
int y = bar(x);
int z = baz(y);
return z;
}
-- Haskell
compute :: Int -> Int
compute n = baz (bar (foo n))
-- alternate definition
compute n = baz . bar . foo $ n
where g . f = \x -> g (f x) -- function composition
f $ x = f x -- function application
So, in the Haskell code, you see that the data flows from right to left, instead of top to bottom. Like Unix pipes, only reversed.The final difficulty is getting used to the fact that functions are passed around directly. In C++, Java, or Python, we often pass around objects, who may or may not hold the same methods than the others that where passed around in the same way (that's polymorphism). Subtype polymorphism is neat, but most often, you need it because you want one method to change depending on various factors. A simpler way to do this is pass around the function directly.
That leads to some powerful, though uncommon in the imperative world, idioms. For instance, you can write your own customized loops. Imagine for instance that you want to process lists in Haskell:
-- A List is either
data List a = Empty -- an empty node,
| Cons a (List a) -- or a cons cell,
-- with an element and a list.
Now let's process the list inc-all :: List Int -> List Int
inc-all Empty = Empty
inc-all (Cons e l) = Cons (foo e + 1) (inc-all l)
dbl-all :: List Int -> List Int
dbl-all Empty = Empty
dbl-all (Cons e l) = Cons (foo e * e) (inc-all l)
See how much they have in common? There's a way to factor out that, with a map: map (a -> b) -> List a -> list b
map f Empty = Empty
map f (Cons e l) = Cons (f e) (map f l)
Note that the first argument is a function, hence the (a -> b) between parentheses. Using it is very simple: inc-all l = map (λe -> e + 1) l
dbl-all l = map (λe -> e * e) l
And Haskell can make it even more concise, with what we call partial application. Haskell functions actually have only one argument. Multiple arguments are simulated by having the function return another function. Here: add :: Int -> (Int -> Int)
add x = λy -> (x + y)
Which is the same as: add :: Int -> Int -> Int
add x y = x + y
Or even add :: Int -> Int -> Int
add = λx -> (λy -> (x + y))
So, inc-all and dbl-all above can be written as: inc-all = map (λe -> e + 1)
dbl-all = map (λe -> e * e)
Without those fundamentals, one doesn't stand a chance at understanding real world functional code. It's just too different. It's no harder, though. The main difficulty here is to change your mindset.Now I haven't talked about macros…
Re: How Lisp is Going to Save the World
#98Earlier quoted context omitted.
I attended TechMesh 2012 in London. The creators of Haskell were there, and there was a number of other Haskell talks. They were almost all about how to model state, I/O, etc. One of the Haskell creators also created Quickcheck, a generative testing tool where tests are written in Haskell. He talked about how he found state related bugs in Riak. Rich Hickey, author of Clojure, was there, he keynoted about state. I'd…
[aside] that looks like it was a very interesting conference. i can't find much related info. will it be annual? are they spreading to other places? who was behind it? [edit:] it seems to be an indie thing http://techmeshconf.com/techmesh-london-2012/contact/
It was _really_ good, you should definitely check it out :)
Re: How Lisp is Going to Save the World
#99Re: How Lisp is Going to Save the World
#100I had Haskell as the subject in my intro course at university (my first experience with functional programming). I've tinkered a bit with it since then as well, and I'm at the "somewhat intuitive grasp of monad transformers" state. I tried Clojure some week ago through the Clojure koans that were posted here. Compared to Haskell I found the syntax very obtuse and it was not obvious why Lisp would be more powerful tha…
The easiest answer to that is, there's no syntax, which makes reimplementing your own Lisp parser trivial (one single function call, in fact). This in turn makes reimplementing your own Lisp, inline in Lisp, similarly trivial.
That sounds like something out of an SICP exercise - and it is - but the same properties make it easier to reason about your code in a way that's far more abstract than other languages let you. Once you start treating your code as data that other parts of your code can manipulate, you can start refactoring in ways that simply aren't possible in other languages. This explanation by a well-known Perl programmer explains it very well: http://lists.warhead.org.uk/pipermail/iwe/2005-July/000130.h...
Another way I've heard it (this may have been pg, but I can't remember), is that, when writing idiomatic Lisp, you first think, "What language would make solving this problem really easy?" and then proceed to implement that language.