[iterate-devel] PATCH: support (finding (values ...))

Max Mikhanosha max at openchat.com
Tue May 29 18:41:58 UTC 2007


Hi,

I was optimizing my code and noticed that I got a bunch of brute force
searches for an extremum of a function of more then one value like so:

(bind (((best-x best-y best-z)
  (iter outer
    (for x ...)
      (iter (for y ...)
        (iter (for z ...)
           (in outer
             (finding (list x y z) maximizing (objective x y z))))))))
  ...)

The above code is causing excessive consing in the (list x y z) part
and one can't specify (values) instead.

With the attached patch I can write:

(bind (((values best-x best-y best-z)
  (iter outer
    (for x ...)
      (iter (for y ...)
        (iter (for z ...)
           (in outer
             (finding (values x y z) maximizing (objective x y z))))))
  ...)

which does not cons and results in faster code. 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: finding-values.patch
Type: application/octet-stream
Size: 9739 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/iterate-devel/attachments/20070529/9deb1a96/attachment.obj>
-------------- next part --------------

Regards,
  Max
  
             
  

   
           


More information about the iterate-devel mailing list