Advertisement
31ph4n70m

minimun_of_two.erl

Nov 21st, 2019
1,865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 1.67 KB | None | 0 0
  1. % erlang solution to codeabbey challenge 4
  2. -module(main).
  3. -import(lists,[min/1]).
  4. -import(string, [tokens/2]).
  5. -export([main/1]).
  6.  
  7. main([_]) ->
  8.     I1 = 30,
  9.     I2 = "3539875 -2913804 9970403 -1271892 2259745 -5041103 6135274 6702733 -7705887 7333693 9011193 -5815604 -4443223 -3369396 6454782 5927252 8752154 8363617 -4610650 9748221 6825533 -3597316 6931901 7542523 -2603266 9437222 5903501 9517359 -8975159 -2311126 8014504 4564716 4775069 7984907 -6707176 -2965185 -7056195 9428098 -6262451 -4762083 6761791 -7251257 -577687 -7681432 -620653 -4122904 8245820 -1868499 -5759287 -6364830 -2120277 -8933753 37854 -5188376 8608770 7434587 -5751153 4512272 6951946 -4726312",
  10.     I3 = string:tokens(I2, " "),
  11.     erlang:display(min([lists:nth(1, I3), lists:nth(2, I3)])),
  12.     erlang:display(min([lists:nth(3, I3), lists:nth(4, I3)])),
  13.     erlang:display(min([lists:nth(5, I3), lists:nth(6, I3)])),
  14.     erlang:display(min([lists:nth(7, I3), lists:nth(8, I3)])),
  15.     erlang:display(min([lists:nth(9, I3), lists:nth(10, I3)])),
  16.     erlang:display(min([lists:nth(11, I3), lists:nth(12, I3)])),
  17.     erlang:display(min([lists:nth(13, I3), lists:nth(14, I3)])),
  18.     erlang:display(min([lists:nth(15, I3), lists:nth(16, I3)])),
  19.     erlang:display(min([lists:nth(17, I3), lists:nth(18, I3)])),
  20.     erlang:display(min([lists:nth(19, I3), lists:nth(20, I3)])),
  21.     erlang:display(min([lists:nth(21, I3), lists:nth(22, I3)])),
  22.     erlang:display(min([lists:nth(23, I3), lists:nth(24, I3)])),
  23.     erlang:display(min([lists:nth(25, I3), lists:nth(26, I3)])),
  24.     erlang:display(min([lists:nth(27, I3), lists:nth(28, I3)])),
  25.     erlang:display(min([lists:nth(29, I3), lists:nth(30, I3)])),
  26. init:stop() .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement