[racket] Macro + function automation
On 2013-07-10, at 10:49 PM, Roman Klochkov <kalimehtar at mail.ru> wrote:
> Do you think, that Racket will do pure calculations in compile-time?
>
> For example, if I write
>
> (+ x (* 2 3 4) (sin 20))
>
> will it be optimized to
>
> (+ x 24.912945250727628) ?
>
> Or I have to use define-syntax to do it?
I doubt that it does this particular optimization because addition is not associative on floating point numbers. For example:
> (define x 0.1)
> (+ x 0.2 0.3)
0.6000000000000001
> (+ x (+ 0.2 0.3))
0.6
Marc