switchB?

8 views
Skip to first unread message

Fred Janon

unread,
Nov 13, 2009, 4:08:28 AM11/13/09
to fla...@googlegroups.com
switchB(sourceBB) -> Behavior a

sourceBB :: Behavior (Behavior a)

When the value of a time varying value is time varying itself, which is common when dealing DOM objects.

---------------------------

Any idea?

Thanks

Fred

Arjun Guha

unread,
Nov 13, 2009, 9:58:42 AM11/13/09
to fla...@googlegroups.com
I think the filters demo (which is documented in the OOPSLA paper) is
a relatively tame use of switch:

http://www.flapjax-lang.org/demos/index.html#filters

The OOPSLA paper discusses the compiled code, where switchB is
inserted by the compiler. So, check out the library-mode code:

http://www.flapjax-lang.org/try/index.html?edit=filters.html

This expression in particular:

subFilter.liftB(function(x) { return x.pred; }).switchB()};};

subFilter is a behavior (since we're lifting it, it must be a
behavior). Moreover, subFilter is a behavior of objects, x with a
field x.pred, which is itself a behavior.

Do you see why this is problem? Once you understand the problem, I
think switchB will make more sense, since it solves this "behavior
inside a behavior" problem.

Arjun
> --
> Flapjax home page: www.flapjax-lang.org
> Flapjax list: groups.google.com/group/flapjax
> Post: fla...@googlegroups.com
> Unsubscribe: flapjax-u...@googlegroups.com

Reply all
Reply to author
Forward
0 new messages