A Big Smile ... Ruby and Erlang

A big smile appeared on my face tonight after typing the following: -module(math1). -export([factorial/1]). factorial(0) -> 1; factorial(N) -> N * factorial(N-1). def factorial(n) return 1 if n == 0 n * factorial(n-1) end Maybe not so obvious. But check this out: -module(temp). -export([convert/2]). convert({fahrenheit, Temp}, celsius) -> {celsius, 5 * (Temp -32) / 9}; convert({celsius, Temp}, fahrenheit) -> {fahrenheit, 32 + Temp * 9 / 5}; convert({reaumur, Temp}, celsius) -> {celsius, 10 * Temp / 8}; convert({celsius, Temp}, reaumur) -> {reaumur, 8 * Temp / 10}; convert({X, _}, Y) -> {cannot,convert,X,to,Y}....

August 25, 2006