Subject: Re: Am I missing something about (loop ... maximizing ...) ?
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 22 Mar 2006 21:49:05 -0600
Newsgroups: comp.lang.lisp
Message-ID: <Z7-dnTXQyp8sh7_ZRVn-hg@speakeasy.net>
jonrock <jonrock@gmail.com> wrote:
+---------------
| I came right back here when I realized that
|   (defun find-maximizing-item (list fun)
|     (reduce #'max list :key fun))
| was what I was originally looking for, but I see you beat me to it.
+---------------

Except that only tells you what the maximum function value was,
not which item produced it! [...which is what I thought the original
question was.] That is, with this version:

    > (find-maximizing-item '(3 -4 2 5 -7 1 2) (lambda (x) (* x x)))

    49
    > 

doesn't tell you it was the "-7" that caused this result.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607