[Pharo-project] Issue 3641 in pharo: possible new implementation of reduce:
Status: Accepted Owner: stephane...@gmail.com Labels: Milestone-1.3 New issue 3641 by stephane...@gmail.com: possible new implementation of reduce: http://code.google.com/p/pharo/issues/detail?id=3641 there is already a version of reduce: made by lukas and I would like to know the difference with this one (proposed by eliot because squeak did not got reduce:) if people can comment on speed... and whatever it would be good. Collection>>reduce: binaryBlock "Apply the argument, binaryBlock cumulatively to the elements of the receiver. For sequenceable collections the elements will be used in order, for unordered collections the order is unspecified." | first nextValue | first := true. self do: [ :each | first ifTrue: [ nextValue := each. first := false ] ifFalse: [ nextValue := binaryBlock value: nextValue value: each ] ]. first ifTrue: [ self errorEmptyCollection ]. ^nextValue! !
Updates: Status: closed Comment #1 on issue 3641 by stephane...@gmail.com: possible new implementation of reduce: http://code.google.com/p/pharo/issues/detail?id=3641 in fact levente already analysed that version to propose the one in the other bug entry and that is in squeak.
participants (1)
-
pharoï¼ googlecode.com