Re: Very poor Lisp performance
- From: Peter Seibel <peter@xxxxxxxxxxxxxxx>
- Date: Fri, 19 Aug 2005 17:06:52 GMT
Jon Harrop <usenet@xxxxxxxxxxxxxx> writes:
> Ulrich Hobelmann wrote:
>> Jon Harrop wrote:
>>> Joe Marshall wrote:
>>>> Infix macros are *hard*.
>>>
>>> Do you mean it is difficult to implement infix in Lisp?
>>
>> No, others mentioned that *there are* infix parsers (reader macros) for
>> Lisp. Most people don't use them I guess :D
>
> Then why are they "hard"? Perhaps I misunderstood Joe. I thought he meant it
> was difficult to implement infix operators in Lisp. Now I'm thinking maybe
> he meant it is easy to implement infix operators but it is then difficult
> to write macros that use infix syntax?
I think the latter is what he meant; if a good chunk of the syntax of
your language is infix it's harder to write macros because the macros
need to keep track of what kind of operators are being used in the
code being generated and emit differently structured code
depending. Whereas with a regular syntax (such as prefix) it's, well,
more regular.
> Presumably that is a Lisp-specific problem because Mathematica has no
> problem using infix notation...
I'm not sure it's been established that Mathematica has macros that
are similar in power to Lisp's macros. If you want to see what an
honest attempt to combine infix operators with Lisp-style macros looks
like you should check out Dylan or (more recently) the Java Syntactic
Extender[1]. However to understand the comparison you'll, of course,
have to learn something about Common Lisp macros. And if you really
want to go to town, look into Scheme's various macro systems which
offer a slightly different take on the problem.
>>>> You need to learn the prefix notation *anyway* (because code that
>>>> operates on code needs to operate at the abstract syntax level,
>>>> which in lisp is naturally prefix-notated lists).
>>>
>>> So Lisp is rather tied to the built-in prefix notation.
>>
>> Not at all. Implement whatever syntax you want. If you don't like Lisp
>> syntax at all use a complete, different syntax (and language) like Dylan.
>
> So you disagree with Joe saying that "lisp is naturally prefix-notated
> lists". You believe that prefix/infix/postfix makes no difference in Lisp?
Not that it makes no difference. Rother, on one hand Lisp by default
uses a syntax based on prefix-notated lists. A bunch of other language
features (such as macros) then take advantage of that default
syntax. On the other hand, Lisp is flexible enough that you can
implement a different surface syntax fairly easily if you really want
to. However, you shouldn't be surprised when you find that the other
features of the language, that co-evolved with the standard prefix
syntax are hard to duplicate or translate into your new syntax. You
may want to look up Guy Steele's and Richard Gabriel's paper in the
History of Programming Langugaes II proceedings where, among other
things, they talk about the tendency of new Lispers to go through a
rite of passage of implementing their own syntax and then abandoning
it when they discover that you lose a lot more than just the surface
syntax when you abandon the prefix notation.
-Peter
[1] <http://people.csail.mit.edu/jrb/jse/index.htm>
--
Peter Seibel * peter@xxxxxxxxxxxxxxx
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp * http://www.gigamonkeys.com/book/
.
- Follow-Ups:
- Re: Very poor Lisp performance
- From: Brian Downing
- Re: Very poor Lisp performance
- References:
- Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Svenne Krap
- Re: Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Ulrich Hobelmann
- Re: Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Förster vom Silberwald
- Re: Very poor Lisp performance
- From: Michael Sullivan
- Re: Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Hartmann Schaffer
- Re: Very poor Lisp performance
- From: Jamie Border
- Re: Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Christophe Rhodes
- Re: Very poor Lisp performance
- From: Joe Marshall
- Re: Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Tayssir John Gabbour
- Re: Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Joe Marshall
- Re: Very poor Lisp performance
- From: Jon Harrop
- Re: Very poor Lisp performance
- From: Ulrich Hobelmann
- Re: Very poor Lisp performance
- From: Jon Harrop
- Very poor Lisp performance
- Prev by Date: "Pattern arguments" in Common Lisp (Re: Ray tracer in Stalin)
- Next by Date: Re: Very poor Lisp performance
- Previous by thread: Re: Very poor Lisp performance
- Next by thread: Re: Very poor Lisp performance
- Index(es):
Relevant Pages
|