diff -r 386578673083 -r 4b229d12de7f Collection.st --- a/Collection.st Wed Mar 05 14:19:29 2014 +0100 +++ b/Collection.st Wed Mar 05 14:19:49 2014 +0100 @@ -2449,12 +2449,11 @@ " ! -detect:generatorBlock forWhich:testBlock ifNone:exceptionBlock +detect:generatorBlock forWhich:testBlock ifNone:exceptionValue "evaluate generatorBlock for each element in the receiver until testBlock returns true for it; in this case return the value from generatorBlock, which caused the true evaluation. - If none of the test evaluations returns true, return the result of the - evaluation of the exceptionBlock" + If none of the test evaluations returns true, return the value from exceptionValue" self do:[:each | |val| @@ -2462,7 +2461,7 @@ val := generatorBlock value:each. (testBlock value:val) ifTrue:[^ val]. ]. - ^ exceptionBlock value + ^ exceptionValue value " #(2 3 4) detect:[:n | n squared] forWhich:[:nsq | nsq odd] ifNone:['sorry'] @@ -2475,17 +2474,16 @@ " ! -detect:aOneArgBlock ifNone:exceptionBlock +detect:aOneArgBlock ifNone:exceptionValue "evaluate the argument, aBlock for each element in the receiver until the block returns true; in this case return the element which caused the true evaluation. - If none of the evaluations returns true, return the result of the - evaluation of the exceptionBlock" + If none of the evaluations returns true, return the value from exceptionValue" self do:[:each | (aOneArgBlock value:each) ifTrue:[^ each]. ]. - ^ exceptionBlock value + ^ exceptionValue value " #(1 2 3 4) detect:[:n | n odd] ifNone:['sorry'] @@ -2543,17 +2541,16 @@ " ! -detectLast:aBlock ifNone:exceptionBlock +detectLast:aBlock ifNone:exceptionValue "evaluate the argument, aBlock for each element in the receiver until the block returns true; in this case return the element which caused the true evaluation. The elements are processed in reverse order. - If none of the evaluations returns true, return the result of the - evaluation of the exceptionBlock" + If none of the evaluations returns true, return the value from exceptionValue" self reverseDo:[:each | (aBlock value:each) ifTrue:[^ each]. ]. - ^ exceptionBlock value + ^ exceptionValue value " #(1 2 3 4) detectLast:[:n | n odd] ifNone:['sorry'] @@ -3298,16 +3295,16 @@ "Created: / 07-08-2010 / 16:26:15 / cg" ! -select:aBlock ifNone:exceptionBlock +select:aBlock ifNone:exceptionValue "try a new collection with all elements from the receiver, for which the argument aBlock evaluates to true. If none of the elements passes - the check of aBlock, return the result of evaluating exceptionBlock. + the check of aBlock, return the value from exceptionValue. See also: #removeAllFoundIn: and #removeAllSuchThat:" |newCollection| newCollection := self select:aBlock. - newCollection isEmpty ifTrue:[^ exceptionBlock value]. + newCollection isEmpty ifTrue:[^ exceptionValue value]. ^ newCollection " @@ -5546,11 +5543,11 @@ !Collection class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.333 2014-03-05 13:14:02 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.334 2014-03-05 13:19:49 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.333 2014-03-05 13:14:02 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.334 2014-03-05 13:19:49 cg Exp $' ! !