Common Lisp Recipes by Edmund Weitz

Common Lisp Recipes by Edmund Weitz

Author:Edmund Weitz
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


Solution

Just do it!

For an example, let’s suppose you’ve written an implementation of the gamma function9 that uses its Taylor series to approximate its values. This is reasonably fast and accurate but will produce results like 5.999991410072404D0 for (GAMMA 4); whereas you know that for positive integers, you could use the factorial function for an exact result (which would be 6 in this case). This is how GAMMA could look like:

And as we’ve now used the factorial function (a recursive version of which must, by some age-old rule, appear in every Lisp book) let’s implement it as a generic function for another example:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.