Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).

×

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

by FLAGGR (#25078881) Attached to: Why Lazy Functional Programming Languages Rule
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)

When you go out to buy, don't show your silver.

Working...