DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
GROUP - Group Like Elements In A Block
group: func [
{Returns a block of sub-blocks with items partitioned by value.}
block [any-block!]
/local result
][
result: copy []
; First, build up a list of keys, with a place for values
; to go with each key.
foreach item block [
if not find/only/skip result item 2 [
repend result [item copy []]
]
]
; Add items to the block associated with each key.
foreach item block [append/only select result item item]
result
]





