diff options
author | kballou <kballou@devnulllabs.io> | 2016-03-19 02:24:44 -0600 |
---|---|---|
committer | kballou <kballou@devnulllabs.io> | 2016-03-19 02:24:44 -0600 |
commit | 1aebaea21cf70d65f948a7c3659473eaf5143d01 (patch) | |
tree | a5838d4c54581147ee69d7cc251cb476643e458c | |
parent | e2bd535199f3d54440b7e55d1386736ee84e8e31 (diff) | |
download | func-w-elixir-1aebaea21cf70d65f948a7c3659473eaf5143d01.tar.gz func-w-elixir-1aebaea21cf70d65f948a7c3659473eaf5143d01.tar.xz |
Use hd/1 and tl/1 over Enum.at
-rw-r--r-- | src/code/2/fib_itr.exs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/code/2/fib_itr.exs b/src/code/2/fib_itr.exs index affd347..11c68cb 100644 --- a/src/code/2/fib_itr.exs +++ b/src/code/2/fib_itr.exs @@ -7,7 +7,7 @@ defmodule Fib do hd(acc) end defp compute_seq(n, i, acc) do - compute_seq(n, i+1, [Enum.at(acc, 0) + Enum.at(acc, 1) | acc]) + compute_seq(n, i+1, [hd(acc) + (acc |> tl |> hd) | acc]) end end |