Hi Tom,
> I'm not sure why mapping the function is not satisfactory -- It would
> create a new Behavior, who's internals contain only the two elements
> from the list -- that would expose to the garbage collector that the
> second element has no reference from this behavior any more, and thus
> the whole behavior could be collected.
We must be talking at cross purposes here: there is no way that
deleting the *output* from one of the behaviours from a list
of outputs would cause the underlying behavior whose output no longer
is observed to be garbage collected. After all, that list of
three numbers is just a normal value: why should removing one of
its elements, so to speak, affect the producer of the list?
But if we have a list of running behaviors or signals, and that list
is changed, then yes, of course we get the desired behavior (this
is what Yampa does).
So maybe that's what you mean?
> That's a yes. My first answer to how to implement the resetting
> counter would be someting along the lines of this, but I'm not
certain > it's dead right:
>
> e = (1+) <$ mouseClick
> e' = (const 0) <$ <some event>
> b = accumB 0 (e `mappend` e')
>
> i.e. b is the behavior got by adding 1 every time the mouse click
> event occurs, but resetting to 0 whenever <some event> occurs.
Hmm. Looks somewhat complicated to me.
Anyway, it doesn't really answer the fundamental question: how
does one start a behavior/signal function at a particular point in time?
I consider the fact that Yampa, through supporting both signals and
signal functions, provides simple yet flexible answers to the question
when a signal function starts to be one of its key strengths over
Classical FRP and maybe then also over Reactive.
Best,
/Henrik
--
Henrik Nilsson
School of Computer Science
The University of Nottingham
n...@cs.nott.ac.uk
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe