Re: merits of Lisp vs Python
- From: André Thieme <address.good.until.2006.dec.22@xxxxxxxxxxx>
- Date: Tue, 12 Dec 2006 19:20:31 +0100
Jon Harrop schrieb:
André Thieme wrote:Well, macros are one (big) thing that Lisp has and which many other
languages don't have. Their are other things too, and some of them are
in Python as well, which is a very nice scripting language.
I think s-exprs and EVAL are the main things that Lisp has and that other
languages don't. Note that most other languages don't have these because
they were deemed to be a bad trade-off three decades ago. ;-)
Often macros save just some bits of code. Saving one loc is not much you
might say. But think about it the other way around.
How would you like it to call doodleShooble() each time before you use
the if statement? Of course you would not like it. The good thing about
Lisp is, that you can eliminate this pattern.
You can eliminate that pattern with a HOF, of course. You don't need macros.
let if' p e1 e2 =
force (if p then e1 else e2)
I see, I expressed it in a way that make you think that a HOF could eliminate it.
I just wanted to show that it is not good to have some extra work to do.
Your idea was to abstract it away.
Let me try with my non-existant ocaml skills to explain what I mean.
Let's say you have a function f that takes a function object.
When you now call f and want to pass a throw away function you would
want to create an anonymous function.
As I understand it this can be done with "(fun arg -> arg + 1)" or
How can you factor out the "(fun)" with a HOF?