Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -module(sleepsort).
- -export([sort/1]).
- % hacky short (still readable) sleepsort, see http://news.ycombinator.com/item?id=2657738
- sort(Xs) ->
- [ timer:send_after(N, {sorted,N}) || N <- Xs ],
- [ fun() -> receive {sorted, N} -> N end end() || _ <- Xs ].
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement