From 1aebaea21cf70d65f948a7c3659473eaf5143d01 Mon Sep 17 00:00:00 2001 From: kballou Date: Sat, 19 Mar 2016 02:24:44 -0600 Subject: Use hd/1 and tl/1 over Enum.at --- src/code/2/fib_itr.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.1