PROGRAMMATIC AND DIRECT MANIPULATION
TOGETHER AT LAST
Ravi Chugh, Brian Hempel, Mitchell Spradlin, Jacob Albers
TOGETHER AT LAST Ravi Chugh, Brian Hempel, Mitchell Spradlin, Jacob - - PowerPoint PPT Presentation
PROGRAMMATIC AND DIRECT MANIPULATION TOGETHER AT LAST Ravi Chugh, Brian Hempel, Mitchell Spradlin, Jacob Albers Program 2 Program 2 Changed Program Program 2 Changed Program Program 2 Changed Changed Program Program Program
PROGRAMMATIC AND DIRECT MANIPULATION
Ravi Chugh, Brian Hempel, Mitchell Spradlin, Jacob Albers
Program
2
Program
2
Program
2
Changed Program
Program
2
Changed Program
Program
2
Changed Program Changed Program (again)
Program
2
Changed Program Changed Program (again)
Program
2
Changed Program Changed Program (again) Changed Program
(again again)
Program
2
Changed Program Changed Program (again) Changed Program
(again again)
Program
3
Program
3
Program
3
Program
3
Changed Program
Program
3
Changed Program
Program
3
Changed Program
4
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
5
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
6
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
7
x2 = 110
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
8
x2 = 110 x2’ = 155
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
8
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
x2’ = 155 x2 = 110
xi = 155
9
x2’ = 155
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
10
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = if i=2 then 155 else x0+i*sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
x2’ = 155
11
let (x0, y0, w, h, sep, n) = (95, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
x2’ = 155
12
let (x0, y0, w, h, sep, n) = (95, 120, 20, 90, 52.5, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
x2’ = 155
13
let (x0, y0, w, h, sep, n) = (65, 120, 20, 90, 55, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
x2’ = 155
14
let (x0, y0, w, h, sep, n) = (75, 120, 20, 90, 40, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
x2’ = 155
15
let (x0, y0, w, h, sep, n) = (95, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
x2’ = 155
16
xi ↦ if i=2 then 155 else x0 + i * sep x0 ↦ 75, sep ↦ 40 x0 ↦ 55, sep ↦ 50 x0 ↦ …, sep ↦ … x0 ↦ 95 sep ↦ 52.5
x2’ = 155
17
xi ↦ if i=2 then 155 else x0 + i * sep
x0 ↦ 75, sep ↦ 40 x0 ↦ 55, sep ↦ 50 x0 ↦ …, sep ↦ … x0 ↦ 95 sep ↦ 52.5
x2’ = 155
18
x0 ↦ 75, sep ↦ 40 x0 ↦ 55, sep ↦ 50 x0 ↦ …, sep ↦ … x0 ↦ 95 sep ↦ 52.5
x2’ = 155
xi ↦ if i=2 then 155 else x0 + i * sep
19
xi ↦ if i=2 then 155 else x0 + i * sep x0 ↦ 75, sep ↦ 40 x0 ↦ 55, sep ↦ 50 x0 ↦ …, sep ↦ … x0 ↦ 95 sep ↦ 52.5
x2’ = 155
20
xi ↦ if i=2 then 155 else x0 + i * sep x0 ↦ 75, sep ↦ 40 x0 ↦ 55, sep ↦ 50 x0 ↦ …, sep ↦ … x0 ↦ 95 sep ↦ 52.5
x2’ = 155
21
x0 ↦ 95 sep ↦ 52.5
x2’ = 155
22
x2’ = 155
23
x2’ = 155
24
x2’ = 155
x0 ↦ 95 sep ↦ 52.5
25
x2’ = 155
x0 ↦ 95 sep ↦ 52.5
26
27
x0 ↦ … sep ↦ …
28
x0 ↦ … sep ↦ …
29
x0 ↦ … sep ↦ …
30
x0 ↦ … sep ↦ …
31
x0 ↦ … sep ↦ …
32
x0 ↦ … sep ↦ …
33
x0 ↦ … sep ↦ …
34
x0 ↦ … sep ↦ …
35
36
sep x0 x0 x0 sep
37
!
!
!
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
x2 = 110
38
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
x2 = 110
38
39
40
41
42
x0 + 2*sep
x2 =
43
110x0 + 2*sep 110
x0 x0 sep
x0 + 2*sep
x2 =
44
110x0 + 2*sep 110
x0 x0 sep
45
x0 x0 sep
=
x0 + 2*sep
x2 = 110x0 + 2*sep 110
46
x0 x0 sep
=
sep x0 + 2*
47
x0 x0 sep
=
sep
155
x0 + 2*
=
sep
155
+ 2*
x0
48
x0 x0 sep
= 155
+ 2*30
x0
49
x0 x0 sep
= 155
+ 2*30
x0
50
95
x0 x0 sep
51
= 155
+ 2*30
x0
95
52
t ::= x | t1 + t2 | t1 * t2 | sin t | pow t1 t2
...
52
t ::= x
| t1 + t2 | t1 * t2 | sin t | pow t1 t2
...
52
!
53
54
54
...
55
56
5*sin(x) = n x*(y + y2) = n x2 = n
56
5*sin(x) = n x*(y + y2) = n x*(x + y2) = n x2 = n x*x = n
56
5*sin(x) = n x*(y + y2) = n x*(x + y2) = n x2 = n x*x = n
57
!
!
!
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
58
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
58
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
58
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
58
x0 sep
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
58
x0 sep
x0let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
58
x0 sep
x0 seplet (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
58
x0 sep x0let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
58
x0 sep x0let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
User Changes Output;
58
x0 sep x0let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
User Changes Output;
58
= 155
+ 2*30
x0
x0 sep x0let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
Solve Trace Equation;
User Changes Output;
58
= 155
+ 2*30
x0
x0 sep x0let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
Solve Trace Equation;
User Changes Output;
58
= 155
+ 2*30
x0
95
x0 sep x0let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
Solve Trace Equation; Apply Small Update;
User Changes Output;
58
95
x0 sep x0let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
Solve Trace Equation; Apply Small Update;
Re-run and Render User Changes Output;
58
95
x0 sep x0let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
Solve Trace Equation; Apply Small Update;
Re-run and Render User Changes Output;
58
95
59
87
103
Just google “sketch n sketch”
https://ravichugh.github.io/sketch-n-sketch
104
105
106
107
Program
107
Program
108
108
108
Program
108
Program
109
Program
110
Program
PROGRAMMATIC AND DIRECT MANIPULATION
111
112
113
114
View Data
115
116
Program
117
Program
117
Program
117
Program
117
Changed Program
Program
117
Changed Program
Program
117
Changed Program
Program
117
Changed Program
let (x0, y0, w, h, sep, n) = (50, 120, 20, 90, 30, 3)
!
let boxi i = let xi = x0 + i * sep in rect 'lightblue' xi y0 w h
!
map boxi (zeroTo n)
Solve Trace Equation; Apply Small Update;
Re-run and Render User Changes Output;
118
= 155
+ 2*30
x0
95
x0 sep
119
120
Before After Histograms Figure 9. The goal of each task (Ferris Wheel, Keyboard,
121
Operation Min Med Avg Max Parse 9 ms 53 ms 77 ms 520 ms Eval <1 ms 5 ms 12 ms 165 ms Prepare 1 ms 13 ms 200 ms 6,789 ms Solve <1 ms <1 ms <1 ms 14 ms
122
Unique Pre-Equations 4,574 Outside Fragment 919 20% Inside Fragment 3,655 No Solution for d = 1 194 4% Solution for d = 1 3,461 No Solution for d = 100 438 10% Solution for d = 100 3,023 66%
123