Permalink
Browse files

Use (,) notation and make Automaton2.elm a bit more concise.

  • Loading branch information...
1 parent f7ae1fd commit 9dc0c4ff4b3a107cc2f7c67cc0d5c8410f833e28 Evan Czaplicki committed Oct 7, 2012
Showing with 9 additions and 12 deletions.
  1. +1 −1 public/blog/test/Automaton.elm
  2. +8 −11 public/blog/test/Automaton2.elm
@@ -2,7 +2,7 @@
import Automaton
-input = lift2 (\a b -> (a,b)) Mouse.isDown Mouse.position
+input = lift2 (,) Mouse.isDown Mouse.position
formsAutomaton =
combine $ map dragForm
@@ -19,17 +19,14 @@ formsAutomaton =
in init' [] fstep
allInput =
- let { commands =
- let { step decr incr = if decr then Decr else
- if incr then Incr else Idnt }
- in lift2 step pressLess pressMore
- ; pos = lift2 (\x y -> (x,y)) (randomize 0 400 commands)
- (randomize 0 400 commands)
- ; color = lift3 rgb (randomize 0 255 commands)
- (randomize 0 255 commands)
- (randomize 0 255 commands)
- ; mouse = lift2 (\a b -> (a,b)) Mouse.isDown Mouse.position }
- in lift4 (\a b c d -> (a,b,c,d)) commands pos color mouse
+ let { commands = let step less more = if less then Decr else
+ if more then Incr else Idnt
+ in lift2 step pressLess pressMore
+ ; rand n = randomize 0 n commands
+ ; pos = lift2 (,) (rand 400) (rand 400)
+ ; color = lift3 rgb (rand 255) (rand 255) (rand 255)
+ ; mouse = lift2 (,) Mouse.isDown Mouse.position }
+ in lift4 (,,,) commands pos color mouse
controls =
container 400 50 middle $

0 comments on commit 9dc0c4f

Please sign in to comment.