Guest User

overlappingPairs in Smalltalk

a guest
May 23rd, 2020
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. coll := #(1 2 3 4 5 6).
  2.  
  3. overlappingPairs := (coll overlappingPairsCollect: [ :a :b  | {a. b} ]).
  4.  
  5. overlappingPairs2 := OrderedCollection empty.
  6. (Polygon vertices: coll) segmentsDo: [ :a :b |
  7.     overlappingPairs2 add: { a. b }
  8. ].
  9. overlappingPairs2 removeLast.
  10.  
  11. overlappingPairs2 >>> overlappingPairs.
Add Comment
Please, Sign In to add comment