[Haskell-cafe] is value evaluated?
Nikhil Patil
patil.nikhil at gmail.com
Fri May 8 00:49:19 EDT 2009
Hi,
I am curious to know if there is a function in Haskell to find if a certain
value has already been evaluated. The function I need would have the type:
> (?!) :: a -> Bool
And I expect it to be such that the following terminates after printing the
first 101 fibonacci numbers.
> fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
>
> main = do print $ fibs !! 100
> print $ takeWhile (?!) fibs
Although I guess I can imagine the following not terminating:
> print $ filter (?!) fibs
I would find such a function immensely useful in "printing out" my infinite lists.
Thanks!
nikhil
More information about the Haskell-Cafe
mailing list