Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
Trust the World's Fastest VPN with Your Internet Security & Freedom - A Lifetime Subscription of PureVPN at 88% off. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. ×

Comment Re:Mmmm, Kay. (Score 1) 439

This is the idea: let x=the list of all incoming messages. Let f be a function that takes a message and the last result, and produces a result, that is some actions and a state. Now, the code for a client is foldr1 f x. Of course, the fun is in programming the function f, but that is why an infinite lazy list is awesome. You don't have to manually make the code for waiting for the next message etc, all that boring stuff no useful person wants to write anyway.

This example is extremely simplified of course, but it's the general idea. I have an IRC bot that operates basically on that principle. It is an infinite loop of taking the next message and using it. Since it is lazy, it doesn't keep looping super fast, it only evaluates the next message as soon as it exists (i.e. when the bot gets a message from the server)

Slashdot Top Deals

Adding features does not necessarily increase functionality -- it just makes the manuals thicker.

Working...