Mercurial > urweb
comparison src/list_key_fn.sml @ 2277:6bce459ca581
Add new files missing from previous commit.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Mon, 09 Nov 2015 13:38:04 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2276:c05f9a5e0f0f | 2277:6bce459ca581 |
---|---|
1 functor ListKeyFn(K : ORD_KEY) | |
2 : ORD_KEY where type ord_key = K.ord_key list = struct | |
3 | |
4 type ord_key = K.ord_key list | |
5 | |
6 val rec compare = | |
7 fn ([], []) => EQUAL | |
8 | ([], _) => LESS | |
9 | (_, []) => GREATER | |
10 | (x::xs, y::ys) => case K.compare (x, y) of | |
11 EQUAL => compare (xs, ys) | |
12 | ord => ord | |
13 | |
14 end |