Mercurial > urweb
annotate src/list_key_fn.sml @ 2307:6ae9a2784a45
Return to working version mode
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 20 Dec 2015 14:39:50 -0500 |
parents | 6bce459ca581 |
children |
rev | line source |
---|---|
ziv@2277 | 1 functor ListKeyFn(K : ORD_KEY) |
ziv@2277 | 2 : ORD_KEY where type ord_key = K.ord_key list = struct |
ziv@2277 | 3 |
ziv@2277 | 4 type ord_key = K.ord_key list |
ziv@2277 | 5 |
ziv@2277 | 6 val rec compare = |
ziv@2277 | 7 fn ([], []) => EQUAL |
ziv@2277 | 8 | ([], _) => LESS |
ziv@2277 | 9 | (_, []) => GREATER |
ziv@2277 | 10 | (x::xs, y::ys) => case K.compare (x, y) of |
ziv@2277 | 11 EQUAL => compare (xs, ys) |
ziv@2277 | 12 | ord => ord |
ziv@2277 | 13 |
ziv@2277 | 14 end |