From 391cf9c5b8cbd79891e5adc05c5cf3c7a204ada8 Mon Sep 17 00:00:00 2001 From: Eric Ng Date: Wed, 31 Oct 2018 22:43:02 -0400 Subject: [PATCH 1/2] me trying out erlang --- Algorithms/helloworld.erl | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Algorithms/helloworld.erl diff --git a/Algorithms/helloworld.erl b/Algorithms/helloworld.erl new file mode 100644 index 0000000..70267bd --- /dev/null +++ b/Algorithms/helloworld.erl @@ -0,0 +1,6 @@ +-module(hello_world). +-compile(export_all). + + +hello() -> + io:format("hello world~n"). \ No newline at end of file From 145f00d15b27c06e6d264a142e6b816b3fd0d572 Mon Sep 17 00:00:00 2001 From: Eric Ng Date: Wed, 31 Oct 2018 23:34:26 -0400 Subject: [PATCH 2/2] erlang is tough --- Algorithms/hello_world_n_times.erl | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Algorithms/hello_world_n_times.erl diff --git a/Algorithms/hello_world_n_times.erl b/Algorithms/hello_world_n_times.erl new file mode 100644 index 0000000..f804ca2 --- /dev/null +++ b/Algorithms/hello_world_n_times.erl @@ -0,0 +1,11 @@ +-module(solution). +-export([main/0]). + +print_hello(N) -> + [io:format("Hello World~n") || _ <- lists:seq(1,N)]. + +main() -> + {N, _} = string:to_integer(string:chomp(io:get_line(""))), + + print_hello(N), + ok. \ No newline at end of file