default.txt 469 B

1234567891011121314151617181920212223242526
  1. structure List : LIST =
  2. struct
  3. val op + = InlineT.DfltInt.+
  4. datatype list = datatype list
  5. exception Empty = Empty
  6. fun last [] = raise Empty
  7. | last [x] = x
  8. | last (_::r) = last r
  9. fun loop ([], []) = EQUAL
  10. | loop ([], _) = LESS
  11. | loop (_, []) = GREATER
  12. | loop (x :: xs, y :: ys) =
  13. (case compare (x, y) of
  14. EQUAL => loop (xs, ys)
  15. | unequal => unequal)
  16. in
  17. loop
  18. end
  19. end (* structure List *)