Status: FixReviewNeeded
Owner: [hidden email] Labels: Type-Bug New issue 5877 by [hidden email]: piecesCutWhere: http://code.google.com/p/pharo/issues/detail?id=5877 Eliot Miranda uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-eem.473.mcz ==================== Summary ==================== Name: Collections-eem.473 Author: eem Time: 28 April 2012, 5:02:56.235 pm UUID: 6fa8cab9-1079-4bba-9fe4-0a96fcd47256 Ancestors: Collections-eem.472 A reimplementation of Travis Griggs' piecesCutWhere:[do:] =============== Diff against Collections-eem.472 =============== Item was added: + ----- Method: SequenceableCollection>>piecesCutWhere: (in category 'enumerating') ----- + piecesCutWhere: binaryBlock + "Answer substrings of the receiver derived from cutting the receiver + at points where binaryBlock answers true for adjacent elements." + + | pieces | + pieces := OrderedCollection new. + self piecesCutWhere: binaryBlock + do: [:piece| + pieces add: piece]. + ^pieces + + "'Now is the time for all good people to come to the aid of the cause of world peace. It is just fine, even desirable, to love your country, if that means wanting it to play a beneficial role in the course of world events and be the best possible example of a good society. But if it means wanting dominion over the rest of the world, it is not love but defensiveness or self-glorification, and will lead only to oblivion.' + piecesCutWhere: [:a :b| a = $. and: [b isSeparator]]"! Item was added: + ----- Method: SequenceableCollection>>piecesCutWhere:do: (in category 'enumerating') ----- + piecesCutWhere: binaryBlock do: pieceBlock + "Evaluate pieceBlock with substrings of the receiver derived from cutting the + receiver at points where binaryBlock answers true for adjacent elements." + + | size lastCut this next | + (size := self size) <= 1 ifTrue: + [size = 1 ifTrue: + [pieceBlock value: self]. + ^self]. + lastCut := 1. + this := self at: 1. + 2 to: size do: + [:i| + next := self at: i. + (binaryBlock value: this value: next) ifTrue: + [pieceBlock value: (self copyFrom: lastCut to: i - 1). + lastCut := i]. + this := next]. + pieceBlock value: (self copyFrom: lastCut to: size)! _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Updates:
Status: Workneeded Comment #1 on issue 5877 by [hidden email]: piecesCutWhere: http://code.google.com/p/pharo/issues/detail?id=5877 as this post contains no machine readable code, it is moved to "Work needed". Next step: make machine readable code. _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Updates:
Status: FixReviewNeeded Comment #2 on issue 5877 by [hidden email]: piecesCutWhere: http://code.google.com/p/pharo/issues/detail?id=5877 (No comment was entered for this change.) _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #3 on issue 5877 by [hidden email]: piecesCutWhere: http://code.google.com/p/pharo/issues/detail?id=5877 (No comment was entered for this change.) Attachments: Collection.StephaneDucasse.1.cs 1.6 KB _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Updates:
Status: FixToInclude Labels: Milestone-2.0 Comment #4 on issue 5877 by [hidden email]: piecesCutWhere: http://code.google.com/p/pharo/issues/detail?id=5877 (No comment was entered for this change.) _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Comment #5 on issue 5877 by [hidden email]: piecesCutWhere: http://code.google.com/p/pharo/issues/detail?id=5877 in 20082 _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Updates:
Status: Integrated Comment #6 on issue 5877 by [hidden email]: piecesCutWhere: http://code.google.com/p/pharo/issues/detail?id=5877 (No comment was entered for this change.) _______________________________________________ Pharo-bugtracker mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker |
Free forum by Nabble | Edit this page |