Implements iterate function from Haskell's Prelude. The function generates an infinite sequence by applying a function to the initial value (first) and then to the result of previous application.
203 people like thisPosted: 14 years ago by Nick Palladinos
Haskell-inspired infinite sequences
47 people like thisPosted: 13 years ago by Nick Palladinos
The const function is simple, but you can use it to make your code more legible. In this example we convert a unary function to a function of arity 2 (that ignores the second argument). Also by using the flip function from Haskell (which is equally easy to define) you can ignore the first argument.
119 people like thisPosted: 14 years ago by Alex Muscar