Never been to DZone Snippets before?

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

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

multi-level-sort function

    multi-level-sort: func [
        "Returns a copy of the block, sorted on the given items (all ascending)"
        block   [any-block!]
        offsets [any-block!]
        /local idx result
    ][
        idx: make block length? block
        repeat i length? block [
            append idx append/only reduce [i] excerpt block/:i offsets
        ]
        sort/skip/compare idx 2 2
        result: make block length? block
        foreach [index data] idx [
            append/only result block/:index
        ]
        result
    ]
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS