Hi, I am new to Erlang world. When I think about how we need to solve the following problem (and there is a long list of similar ones), I think that this is really inefficient, because we are talking about big recursion. Apparently, a language like C / Java doesn't need a clumsy recursion to solve this problem, but with Erlang (I think there could be another functional programming language too?), You should do it this way.
Example 3 - Add
This program combines two lists:
append([], List) -> List;
append([First|Rest], List) -> [First | append(Rest,List)].
Can someone give an explanation why this is not a problem?
charlie
source
share