Perform calculations at compile time and load the result

From: Adam Warner (usenet_at_consulting.net.nz)
Date: 10/27/04


Date: Wed, 27 Oct 2004 12:30:36 +1300

Hi all,

What's the idiom (without forcing read-time evaluation or dumping a new
Lisp image) to perform a lengthy calculation at compile time and return
the externalizable result at load time?

(eval-when (:compile-toplevel :load-toplevel :execute)
  (defvar *variable* ...lengthy calculation...))

The above approach computes everything at compile time and every time the
file is loaded in a new image.

Thanks,
Adam



Relevant Pages

  • Re: Perform calculations at compile time and load the result
    ... > Lisp image) to perform a lengthy calculation at compile time and return ... > The above approach computes everything at compile time and every time the ... (defmacro macro-time-value (&body body) ...
    (comp.lang.lisp)
  • Re: Larkin, Power BASIC cannot be THAT good:
    ... execute as the calculation is done at compile time, ... Even with an interpreted language, it is only parsed once; ... saved tokenized code. ...
    (sci.electronics.design)
  • Re: Larkin, Power BASIC cannot be THAT good:
    ... execute as the calculation is done at compile time, ... Even with an interpreted language, it is only parsed once;  if the ... saved tokenized code. ...
    (sci.electronics.design)
  • Re: Larkin, Power BASIC cannot be THAT good:
    ... execute as the calculation is done at compile time, ... Even with an interpreted language, it is only parsed once;  if the ... saved tokenized code. ...
    (sci.electronics.design)
  • Re: Constant evaluation
    ... return mass * g * height; ... My question is the mass*g part will be calculate at compile time or ... And if I use const double mass=2.4 instead, ... calculation of mass*g at compile time regardless of whether you use a ...
    (microsoft.public.vc.language)