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

Snippets has posted 5883 posts at DZone. View Full User Profile

Cmp-length - Compare The Length Of Two Series And Return -1, 0, Or 1, To Support Stable Sorts By Length

10.02.2006
| 3337 views |
  • submit to reddit
        
    ; Support func for stable sort comparator
    cmp-length: func [a [series!] b [series!] /local len-a len-b] [
        len-a: length? a
        len-b: length? b
        case [
            len-a < len-b [-1]
            len-a > len-b [1]
            len-a = len-b [0]
        ]
    ]