
That strikes me as being bad in a "I'm violating the Halting Problem" sort of way- but I'm not sure how. Is there some contradictory construction that could be built from such a function? Nikhil Patil wrote:
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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe