on master help sign in
Add `count` function.
commitf71a08a037d0cc0c049e3a013b30758db28c3dd2 authorevancz <info@elm-lang.org> dateThu 4 Oct 2012, 21:55 (14 years ago) parentc7ffd7e
1 file changed+3
core-elm/Automaton.elm+3
core-elm/Automaton.elm+3
@@ -26,6 +26,7 @@ combine :: Container c => c (Automaton a b) -> Automaton a (c b)
2626init :: b -> (a -> b -> b) -> Automaton a b
2727init' :: s -> (a -> s -> (b,s)) -> Automaton a b
2828
29+count :: Automaton a Int
2930draggable :: Form -> Automaton (Bool,(Int,Int)) Form
3031
3132--}
@@ -48,3 +49,5 @@ init s step =
4849
4950init' s step =
5051 Automaton (\a -> let (b,s') = step a s in (b, init s' step))
52+
53+count = init 0 (\_ c -> c + 1)