[racket] Optimizations at the library level.

From: Noel Welsh (noelwelsh at gmail.com)
Date: Tue Aug 31 11:29:45 EDT 2010

On Tue, Aug 31, 2010 at 4:22 PM, Patrick Li <patrickli.2001 at gmail.com> wrote:
> But this starts to clutter up the library. Is it possible to provide this
> optimization at the library level for the users? eg. somehow recognize that
> whenever the user writes (matrix-transpose-multiply A B)  I can replace it
> with the internal function (matrix-transpose-multiply* A B)?

You can do this with macrology. Basically, matrix-multiply should
become an identifier macro with some special cases to handle known

> and (let ([AT (matrix-transpose A)) (matrix-multiply AT B))   with
>  (matrix-transpose-multiply* A B)

I don't know if this will work with my proposed scheme. I think macro
expansions occurs before inlining.

I'm curious to read what others suggest. You could define a whole
language like Typed Racket, but that is probably too much work for
what you want.


PS: Looking forward to more numerical code in Racket.

Posted on the users mailing list.