4 ms·
module Fibonacci def simple(0) 0 end def simple(1) 1 end def simple(n) simple(n - 1) + simple(n - 2)
by apgwoz 18y ago
module Fibonacci
def simple(0)
0
end
def simple(1)
1
end
def simple(n)
simple(n - 1) + simple(n - 2)
end
end
Ruby style syntax for this example seems too verbose when you consider the succinctness of:
fib(0) -> 0;
fib(1) -> 1;
fib(N) when N > 0 -> fib(N-1) + fib(N-2) .
- Xichekolas 18y agoVery true, but the appeal, to me, of Reia is better string/regex support than currently available in Erlang. At least that was stated in their goals somewhere, and admittedly my Erlang-fu is fairly weak, so I could be missing something awesome in that area.
- apgwoz 18y agoI think it's a general consensus that Erlang does not handle dealing with strings very nicely. If Reia can abstract those problems away then it will probably gain a lot of traction. Probably much more than Lisp <del>For</del> Flavoured Erlang, unfortunately.