annotate 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
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