Apr. 10th, 2006

gusl: (Default)
given a, fn, l, test

Consider:
1: (member a (mapcar fn l) :test test)
2: (exists #'(lambda (x) (test a (funcall fn x))) l)

If fn is purely-functional code (i.e. no side-effects), then these two are the same, since they evaluate to the same thing. The former is easier to write, but the latter is more efficient. A declarative language should allow you to express things the former way, and yet compute it efficiently.

Are there Lisp code optimizers that work by doing this kind of code rewriting?

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags