# [racket] Optimizations at the library level.

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
optimisations.
>* 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.
N.
PS: Looking forward to more numerical code in Racket.