NOTE: I have moved the blog to http://rubynations.blogspot.com. This post appears there in a more final form, with some updates based on feedback on reddit. To avoid further confusion, I have removed the text from the post here.
Filed under: Haskell, Ruby/Rails | 2 Comments
Search
-
You are currently browsing the Rubynations weblog archives.
Just to point out that Haskell doesn’t actually disaprove of your local variables, in case anyone got that impression. In fact, the let-construct is designed to introduce exactly that. To give a contrived example, here’s a function in C++ and its translation to Haskell:
int foo(int i) {int j, k;
j = i * 5;
k = pow(j,2);
return k + 1;
}
foo :: Int -> Int
foo i =
let j = i * 5
k = j ^ 2
in k + 1
True, and thanks for pointing that out. I’ve moved the blog to http://rubynations.blogspot.com, and updated the article just a bit. I hope that it makes things a bit clearer.