steveklabnik/frappuccino — pull request #19 by seadowg (2013-06-24 04:16:10+00:00)
Title: Add #sample to Property

This adds a `#sample` method to Property that allows a Property to be sampled using an input Stream. This essentially allows for declarative polling of a Property. For instance, you could poll some text on a clock tick event and write it out:

message.sample(clock_tick).on_value do |value|
puts message
end

One nice little note is that it actually allows a 'discrete' Stream to be converted to a 'continuous' Property and then back again:

Property.new(ini, stream).sample(stream) == stream

This is kind of silly but its also a nice example of the FRP world all coming together.