Re: Request for comment: follow-up to Summer of Code



matthewknox@xxxxxxxxx writes:

>2 ways, really. One is that a good lisp implementation produces code
>with approximately the same effeciency characteristics as a that
>produced by a good C compiler, when given properly annotated lisp
>source. This can be contrasted with, say, perl, or ruby, or python,
>which do not, in my experience, produce very effecient code.

Well. There's little preventing someone from writing a compiler that
outputs machine code for one of those languages aswell, imho.

>The second is that there are a number of lisp operations that
>correspond directly to fairly simple machine instructions. As I
>understand it (cdr x) grabs whatever is stored at (the address stored
>in x) - c, where c is some constant that I cannot recall (5, maybe?) on

So, you mentioned Haskell as being "much farther away from any actual
machine". What is different with Haskell's "tail" that makes Lisp's
"cdr" so much nearer to the machine? (You give that as an example, not
I). I'd actually say that the "tail" is "nearer to the machine" simply
because the Haskell compiler doesn't have to deal with type checks at
runtime (which cdr normally has to) and as such can emit tighter
machine code.

>Scheme has the same thing-a tail call compiles down to a goto. I do

Tail call optimizations are provided in most functional language
compilers.

>not think that scheme and lisp are as close to the machine as they
>could be, but they are both excellent in this regard. I also mention

I'd say that Common Lisp (as standardized) aswell as Scheme (in R5RS)
are actually rather far from the machine. A real implementation might
of course extend the standard and provide mechanisms for dealing with
machine objects (such as word-sized integers, bytes etc.) but apart
from that, CL (and Scheme) are just as abstract as Haskell, ML, and
what have you. Not that I consider that abstraction level as bad, of
course.

mkb.
.



Relevant Pages

  • Re: Java connected Lisp
    ... versions of GNU Classpath and SBCL, ... Invent a nice and fast interface for calls from Lisp to Java and back. ... The trick could be to hack the compiler so that it recognizes accesses ... Rewrite the "compiler" ...
    (comp.lang.lisp)
  • Re: Reflections on a classic Lisp Paper
    ... its Lisp-1 semantics than defmacro, but would not serve CL as well. ... fexprs into those languages. ... this was the Lisp Machine's philosphy that led to offering ... do changes that the compiler cannot know, ...
    (comp.lang.lisp)
  • Re: Which programming language is better to start
    ... How does Lisp handle monomorphic types? ... If you don't specify a variable to have a type then the compiler ... ML does a lot of pattern match optimisations which, ... These operation would be done by representing the data as lists ...
    (comp.programming)
  • Places=lvalues and Pop11 (was months ago: Requesting advice how to clean up C code for vali
    ... there are equivalence classes of values modulo ... In fact the optimizing compiler could eliminate the ... character, or EBCDIC character, or IBM-PC character, or Latin-1 ... and I'm pleased you've essentially adopted the lisp ...
    (comp.lang.c)
  • Re: Which programming language is better to start
    ... >>> As a performance measure a common lisp compiler will assign static ... How does Lisp handle monomorphic types? ... ML does a lot of pattern match optimisations which, ... Complete monomorphisation isn't common in the ML world, ...
    (comp.programming)