infinite-sequence

Generating an infinite sequence in Haskell

I know that infinite sequences are possible in Haskell - however, I'm not entirely sure how to generate one Given a method generate::Integer->Integer which take an integer and produces the next integer in the sequence, how would I build an infinite sequence out of this? ...

Searching strategy in an infinte list

I am listening to a 3rd party web-service, when the services starts it generates a stream of objects which I am receiving. I have to search for a specific object within given amount of time and do some processing if the object is found or throw an error in any of the below condition: The web-service stops and I haven't found the object...

Detecting repetition with infinite input

What is the most optimal way to find repetition in a infinite sequence of integers? i.e. if in the infinite sequence the number '5' appears twice then we will return 'false' the first time and 'true' the second time. In the end what we need is a function that returns 'true' if the integer appeared before and 'false' if the function rec...

Whats the point of lazy-seq in clojure?

I am looking through some example Fibonacci sequence clojure code: (def fibs (lazy-cat [1 2] (map + fibs (rest fibs)))) I generally understand what is going on, but don't get the point of lazy-cat. I know that lazy-cat is a macro that is translating to something like this: (def fibs (concat (lazy-seq [1 2]) (lazy-seq (map + fibs ...

Consequences of an infinite loop on Google App Engine?

I am not a Google App Engine user. However, I understand you're billed for CPU time and other resources. What are the consequences if you happen to create an infinite loop? Will Google ever terminate it, or will you have to do it yourself manually somehow? I'm a hobbyist developer worried about a small error that might end up costing hu...