A Tail of Recursion in Erlang (a C# developer's observations)

A group of us at VHT has been meeting weekly, reviewing some Erlang basics and running through examples. Even though it means giving up a lunch hour, over a dozen people have still been showing up to learn and help each other. Two of us were recently challenged to figure out a couple problems in Erlang without using obvious built-in functions: Determine the length of a list. (without using length([1,2,3]).) Reverse the list. (without using lists:reverse([1,2,3]).) We looked into it, and even shared what we found with the group a week later. This »

Recursion can bite you big time if you're not careful

I started taking a Programming Languages MOOC, which aims to teach similarities between all languages through examples in ML. While illustrating the benefits of ML’s LET command, the instructor presented this intentionally poorly written algorithm for finding the maximum value in a list: // Let Expressions to Avoid Repeated Computation fun bad_max (xs : int list) = if null x then 0 else if null (tl xs) then hd xs else if hd xs > bad_max(tl xs) then hd xs else bad_max(tl xs) Around 25-30 numbers, it gets reallllly slow. I figured I’d translate it to »