H.Merijn Brand writes:
: On Wed, 2 May 2001 08:05:29 -0700 (PDT), Larry Wall <[EMAIL PROTECTED]> wrote:
: > Michael G Schwern writes:
: > : (grep {...} @stuff)[0] will work, but its inelegant.
: > 
: > It's inelegant only because the slice doesn't know how to tell the
: > iterator it only needs one value.  If it did know, you'd call it
: > elegant.  :-)
: 
: IIRC, that optimization is not even considered for reasons of many people

Whoever it is that is not considering it does not include me.  :-)

: wanting the side effects of grep/map finishing over all elements (which could
: of course be from a tied array or database connection)

If we do that kind of optimization, then we would certainly provide
some kind of easy syntax to defeat it.  But I'd say that, by and large,
it's precisely when you're dealing with a slow database connection that
you could use all the clever optimization you can get, because the
unintended work gets magnified along with the intended, and the stakes
are higher.

Larry

Reply via email to