> You could do the same thing with a tail recursive function

Well, that's one way of putting it. This is what a native Erlang implementation of fibonaci numbers looks like:

-module(fib).
-export([fib/1]).

fib(0) -> [{0,0} | []];
fib(1) -> [{1,1} | fib(0)];
fib(N) when is_iteger(N) andalso N > 0 -> fib1(2,N,fib(1)).

fib1(N,N,[{_K1,V1},{_K2,V2} | _T]=Acc) -> lists:reverse([{N,V1+V2} | Acc]);
fib1(I,N,[{_K1,V1},{_K2,V2} | _T]=Acc) -> fib1(I+1,N,[{I,V1+V2} | Acc]).

It is not that you COULD do it with recursive functions - recursive functions are the native idiom of functional programming - it is how you DO do it.

Erlang is a functional programming language and as such it does a lot of list processing. Where imperative or OO programmers use for loops functional programmers work on lists, a lot. Yes, it will seem strange at first, but that the nature of the beast.

It is worth understanding why it looks odd:

* it uses pattern matching (what's that?)

* the function fib/1 has 3 clauses and fib1/3 has 2 (WTF?)

* it contains list operations (eh?)

Unless you understand those three things you can't write Erlang. Syntatic sugar to hide them from you is not your friend here.

The function fib/1 has three clauses - if N is 0 or 1 it returns the starting elements of the fibonaci sequence. If it is an integer greater than that it calculates the sequence using the function fib1/3

The function fib1/3 has 2 clauses. The first is the terminal clause - when I have counted up from 2 to N return the sequence.

The second clause is the recursive clause, calculate the current fibonaci number, stick it on the end of the list of all the fibonaci numbers calculated so far, and call myself for the next value up.

Acc is a list
[{I,V1+V2} | Acc] is a new list
with the new value {I,V1+V2} at the head of it.

In the function clauses of fib/3 I pattern match out the last 2 values of the fibonaci sequence as they are what I need.

Going into the clause the accumulator list looks like this:

[{11,89}, {10,55}, {9,34}....]

I need the last two values to calculate the current one, so I do a pattern match:

[{_K1,V1},{_K2,V2} | T] = Acc

(There is an Erlang convention that 'variables' whose names start with '_' are scratch - you are not going to use them, this is why my key values are called '_K1' and '_K2').

Pattern matching says 'if this pattern matches' stick the appropriate values from the righthand side into the as-yet unmatched 'variables' of the left hand side. Because V1 and V2 have not yet been given a value they aquire the values of 89 and 55 in this instance.

The terminal clause (ie the first clause of fib1/3) also uses pattern matching:

fib1(N,N,Acc) ->

This clause is only executed when the first 2 parameters are the same.

The mistake you are making is thinking that Erlang doesn't have a for loop like Javascript or Ruby, when the real difference is that Erlang doesn't have an '=' operator like Javascript or Ruby. In Erlang '=' is a pattern matching operator. You can't set the value of an Erlang 'variable' to anything, but that doesn't matter because Erlang doesn't have variables.

Pattern matching as a core language feature has as a consequence an absence of variables, which has as a consequence the absence of for loops.

Throwing out the baby of pattern matching for the bathwater of for loops is to miss the point big style.

Learn to love lists, learn to write recursive functions, learn to pattern match - you can't do functional programming without them.