Skip to content

Instantly share code, notes, and snippets.

@ksauzz
Created July 9, 2011 05:46
Show Gist options
  • Save ksauzz/1073372 to your computer and use it in GitHub Desktop.
Save ksauzz/1073372 to your computer and use it in GitHub Desktop.
sleep sort by erlang.
-module(sleep_sort).
-export([sort/1, wait/1]).
sort([]) ->
"sleep sort!!";
sort([H|T]) ->
spawn(sleep, wait, [H]),
sort(T).
wait(Time) ->
timer:sleep(Time*100),
io:format("~w~n", [Time]).
@ksauzz
Copy link
Author

ksauzz commented Jul 9, 2011

Erlangだとすごくシンプルに書けますね :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment