Skip to content

Instantly share code, notes, and snippets.

@martinklepsch
Created March 3, 2011 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinklepsch/852054 to your computer and use it in GitHub Desktop.
Save martinklepsch/852054 to your computer and use it in GitHub Desktop.
The function should find the helpdesk that needs the smallest amount of time (bTime)
to fulfill an order with a specified type of concern (d).
art() returns the type of concern of a given order.
dorders should hold all orders with the specified concern d.
FUN fastest: seq[order] ** (concern -> bool) -> nat
DEF fastest(orders, d) ==
LET
dorders == filter(\\x. d(art(x)))(orders)
IN
desk(reduce(\\ x, y. IF bTime(x) < bTime(y) THEN x ELSE y,
ft(dorders))(dorders))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment