[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Compiler inlining
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] Compiler inlining |
Date: |
Wed, 25 Oct 2006 08:21:09 +0200 |
On 10/23/06, John Cowan <address@hidden> wrote:
I understand that part now. I'm really more interested in getting
the compiler to inline my modified definition:
(define basic-cdr cdr)
(define (cdr x)
(cond
(null? x) x)
(pair? x) (basic-cdr x))
(symbol? x) (val (##sys#slot sym 2)))))
and similarly for "car" except without the symbol support.
You could use "define-inline" (but be careful of recursion,
i.e. expand into a lower-level version of "cdr", if you need
the original one, just like you to above). Unfortunately syntax-case
can't handle "define-inline" (treats it like "define") and you
have to use "include" to import the inline-definitions.
Alternatively, if you are more adventerous, you can use the
codewalk egg to perform arbitrary transformations on your code
or even write compiler-rewriting rules (which is somewhat more
involved).
cheers,
felix
--
http://galinha.ucpel.tche.br:8081/blog/blog.ssp