in reply to On the rejected additions to List::Util

Just let me say that the any() implementation in List::MoreUtils is more general than the one described in the list of rejected functions.

Specifically in List::MoreUtils it takes a block, and evaluates that for every list item, and returns true if the block returned true once. The one described in List::Util just gives true when any of the list items is true, so

List::MoreUtils::any is roughly like List::Util::proposed_any map BLOCK LIST

except that it's optimized.

That's not as trivial (ok, it's only slightly more complicated) as Graham puts it, which is why I never understood his point.

Replies are listed 'Best First'.
Re^2: On the rejected additions to List::Util
by Prof Vince (Friar) on May 08, 2009 at 07:44 UTC
    List::MoreUtils::any() also stops looking as soon as one of the blocks returned true. Check :

    perl -MList::MoreUtils=any -E 'any { say $_; $_ < 5 ? 0 : 1 } 1 .. 10'