[Haskell-cafe] is value evaluated?
jfredett at gmail.com
Fri May 8 01:33:05 EDT 2009
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
could be built from such a function?
Nikhil Patil wrote:
> 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.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 296 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090508/30a96a9a/jfredett.vcf
More information about the Haskell-Cafe