?(?-) (Applicative order rules) <> ((?x) (?y) <=!=>) (<> ?x ?y) <> ((?x) ?. <=!=>) (<> ?x (?.)) <> (?x ?y <=!=>) (<> ?x ?y) <> (<!> ?x ?y) ((?x) (?y) ?(?x ?x) <=!=>) ?((?0 ?1 ?:) ?:) 1024 1024 size ?(?-) (First we may begin by getting the mouse position) ?(?-) (Math) <> $color1 ((color #ffffff)) <> $color2 ((color #000000)) <> $color3 ((color #ff0000)) <> $color4 ((color #00ff00)) <> $color5 ((color #0000ff)) <> $color6 ((color #72dec2)) ?(?-) (the merveilles color) <> $screen-size ((number 1024)) <> (sqrt-intermed (?i) (?n) (1) (?x)) ((?i) (2) `-) <> (sqrt-intermed (?i) (?n) (0) (1)) ((?i) (1) `-) <> (sqrt-intermed (?i) (?n) (0) (0)) (sqrt-intermed ((?i) (1) `+) (?n) ((?n) ((?i) (?i) `*) `<) ((?n) ((?i) (?i) `*) `=)) <> (sqrt (?n)) (sqrt-intermed (1) (?n) (0) (0)) <> (square (?x)) ((?x) (?x) `*) <> (distance (?a ?b) (?c ?d)) (sqrt ((square ((?c) (?a) `-)) (square ((?d) (?b) `-)) `+)) <> (read-event ?~) (handle-event ?~ read-event Any) <> ((state ((?a ?b) ?s) ?t debouncing) handle-event (Touch (?x ?y ?z))) ((state ((?x ?y) ?s) ?t listening)) <> ((state ?s ?t listening) handle-event (Touch (?x ?y 1))) ((state ((?x ?y) ?s) ?t debouncing)) ?(?-) ( c - Clear q - quit 1 - Circle 2 - line 3 - triangle 4 - quadrangle 5 - fill-circle r - Rotate-color-pRev t - roTate-color-nexT ) <> ((state ?s ?t ?f) handle-event (Key (?x c))) (draw fill-rect (number 0) (number 0) $screen-size $screen-size $color2 draw-ui (state () ?t listening)) <> ((state ?s ?f) handle-event (Key (?x q))) (cmd quit) <> ((state ?s (?t ?r) ?f) handle-event (Key (?x 1))) (draw-ui (state () (circle ?r) ?f)) <> ((state ?s (?t ?r) ?f) handle-event (Key (?x 2))) (draw-ui (state () (line ?r) ?f)) <> ((state ?s (?t ?r) ?f) handle-event (Key (?x 3))) (draw-ui (state () (triangle ?r) ?f)) <> ((state ?s (?t ?r) ?f) handle-event (Key (?x 4))) (draw-ui (state () (quadrangle ?r) ?f)) <> ((state ?s (?t ?r) ?f) handle-event (Key (?x 5))) (draw-ui (state () (fill-circle ?r) ?f)) <!> (next-color $color1) ($color2) <!> (next-color $color2) ($color3) <!> (next-color $color3) ($color4) <!> (next-color $color4) ($color5) <!> (next-color $color5) ($color6) <!> (next-color $color6) ($color1) <!> (prev-color $color1) ($color6) <!> (prev-color $color2) ($color1) <!> (prev-color $color3) ($color2) <!> (prev-color $color4) ($color3) <!> (prev-color $color5) ($color4) <!> (prev-color $color6) ($color5) <> ((state ?s (?t ?r) ?f) handle-event (Key (?x r))) (draw-ui (state ?s (?t prev-color ?r) ?f)) <> ((state ?s (?t ?r) ?f) handle-event (Key (?x t))) (draw-ui (state ?s (?t next-color ?r) ?f)) <> (draw-ui (state ?s (?t ?r) ?f)) ( draw-brush-icon ?t draw-color-dot ?r (state ?s (?t ?r) ?f)) <!> (draw-color-dot $color2) (draw fill-circ $icon-position-1 (number 6) $color2 draw circ $icon-position-1 (number 5) $color1) <!> (draw-color-dot (color ?c)) (draw fill-circ $icon-position-1 (number 6) (color ?c)) <> clear-brush-icon (draw fill-rect (number 10) $screen-size (number 54) `- (number 16) (number 16) $color2) <> (draw-brush-icon line) ( clear-brush-icon draw line (number 10) $screen-size (number 42) `- (number 22) $screen-size (number 54) `- $color1 ) <> (draw-brush-icon quadrangle) ( clear-brush-icon draw rect (number 10) $screen-size (number 54) `- (number 12) (number 12) $color1 ) <> (draw-brush-icon triangle) ( clear-brush-icon draw line (number 10) $screen-size (number 42) `- (number 16) $screen-size (number 54) `- $color1 draw line (number 16) $screen-size (number 54) `- (number 22) $screen-size (number 42) `- $color1 draw line (number 10) $screen-size (number 42) `- (number 22) $screen-size (number 42) `- $color1 ) <> (draw-brush-icon circle) ( clear-brush-icon draw circ (number 16) $screen-size (number 48) `- (number 6) $color1 ) <> (draw-brush-icon fill-circle) ( clear-brush-icon draw fill-circ (number 16) $screen-size (number 48) `- (number 6) $color1 ) <> $icon-position-1 ((number 16) $screen-size (number 16) `-) ?(?-) (c) <> (handle-event ?x) () <> (state ((?a ?b) ((?c ?d) ?s)) (circle ?r) listening) (draw circ (number ?c) (number ?d) (number distance (?a ?b) (?c ?d)) ?r state ?s (circle ?r) listening) <> (state ((?a ?b) ((?c ?d) ?s)) (fill-circle ?r) listening) (draw fill-circ (number ?c) (number ?d) (number distance (?a ?b) (?c ?d)) ?r state ?s (fill-circle ?r) listening) <> (state ((?a ?b) ((?c ?d) ?s)) (line ?r) listening) (draw line (number ?a) (number ?b) (number ?c) (number ?d) ?r state ?s (line ?r) listening) <> (state ((?a ?b) ((?c ?d) ((?e ?f) ?s))) (triangle ?r) listening) (draw line (number ?a) (number ?b) (number ?c) (number ?d) ?r draw line (number ?c) (number ?d) (number ?e) (number ?f) ?r draw line (number ?e) (number ?f) (number ?a) (number ?b) ?r state ?s (triangle ?r) listening) <> (state ((?a ?b) ((?c ?d) ((?e ?f) ((?g ?h) ?s)))) (quadrangle ?r) listening) (draw line (number ?a) (number ?b) (number ?c) (number ?d) ?r draw line (number ?c) (number ?d) (number ?e) (number ?f) ?r draw line (number ?e) (number ?f) (number ?g) (number ?h) ?r draw line (number ?g) (number ?h) (number ?a) (number ?b) ?r state ?s (quadrangle ?r) listening) ?(?-) (Action handlers) <> (draw ?: (number ?0) (number ?1) (number ?2) (number ?3) (color ?4)) ?: <> (draw ?: (number ?0) (number ?1) (number ?2) (color ?3)) ?: <> (draw ?: (number ?0) (number ?1) (color ?2)) ?: <> ((?0) (?1) `?:) ?: <> ((number ?0) (number ?1) `?:) ((number ?:)) <> (dec (number ?x)) ((number ?x) (number 1) `-) <> (inc (number ?x)) ((number ?x) (number 1) `+) <> (cmd ?:) ?: draw fill-rect (number 0) (number 0) $screen-size $screen-size $color2 draw-ui (state () (circle $color1) listening) read-event Any