on master help sign in
update bit-rotted 15 minute tutorial

references #269

commit563d6d84862b63571652747d4538513cde348e83 authorAgentM <agentm@themactionfaction.com> dateTue 27 Oct 2020, 00:01 (6 years ago) parenta79cfdf
1 file changed+61−60
docs/15_minute_tutorial.markdown+61−60
docs/15_minute_tutorial.markdown+61−60
@@ -10,6 +10,12 @@ Thank you for evaluating Project:M36, a new relational algebra engine written in
1010
1111## Download and Install
1212
13+Run a pre-built docker image:
14+
15+```docker run -it projectm36/project-m36 tutd```
16+
17+or build it yourself:
18+
1319```bash
1420git clone https://github.com/agentm/project-m36.git
1521cabal sandbox init
@@ -29,15 +35,7 @@ Note that TutorialD is strongly-typed- no type coercions take place automaticall
2935TutorialD (master/main): :importexample date
3036```
3137
32−or
33−
34−```
35−TutorialD (master/main): :importtud "scripts/DateExamples.tutd"
36−```
37−
38−```:importtutd``` (do not skip typing the preceding colon), loads a file which contains a script written in the TutorialD dialect used by Project:M36 and executes it to change the state of the database. In this case, the relations "s" (supplier), "p" (product), and "sp" (suppliers-products) are now loaded.
39−
40−```:importexample date``` loads the date example directly without any file I/O, so it is safe to use with the websocket server.
38+```:importexample``` (do not skip typing the preceding colon), loads a built-in example schema and executes it to change the state of the database. In this case, the relations "s" (supplier), "p" (product), and "sp" (suppliers-products) are now loaded.
4139
4240### Execute Relational Expressions
4341
@@ -164,7 +162,7 @@ Database context expressions change the state of the database, much like "CREATE
164162#### Create a Relation Variable
165163
166164```
167−TutorialD (master/main): x:=relation{name Text, age Int}{tuple{name "Steve", age 40},tuple{name "Mike", age 31}}
165+TutorialD (master/main): x:=relation{name Text, age Integer}{tuple{name "Steve", age 40},tuple{name "Mike", age 31}}
168166TutorialD (master/main): :showexpr x
169167┌────────┬──────────┐
170168│age::Int│name::Text│
@@ -179,23 +177,25 @@ This is similar to SQL's "CREATE TABLE" operator.
179177#### Insert Additional Tuples
180178
181179```
182−TutorialD (master/main): x:=relation{name Text, age Int}{tuple{name "Steve", age 40},tuple{name "Mike", age 31}}
180+TutorialD (master/main): x:=relation{name Text, age Integer}{tuple{name "Steve", age 40},tuple{name "Mike", age 31}}
183181TutorialD (master/main): :showexpr x
184−┌────────┬──────────┐
185−│age::Int│name::Text│
186−├────────┼──────────┤
187−│40 │"Steve" │
188−│31 │"Mike" │
189−└────────┴──────────┘
182+┌────────────┬──────────┐
183+│age::Integer│name::Text│
184+├────────────┼──────────┤
185+│31 │"Mike" │
186+│40 │"Steve" │
187+└────────────┴──────────┘
188+
190189TutorialD (master/main): insert x relation{tuple{name "Bob", age 24}}
191190TutorialD (master/main): :showexpr x
192−┌────────┬──────────┐
193−│age::Int│name::Text│
194−├────────┼──────────┤
195−│40 │"Steve" │
196−│24 │"Bob" │
197−│31 │"Mike" │
198−└────────┴──────────┘
191+┌────────────┬──────────┐
192+│age::Integer│name::Text│
193+├────────────┼──────────┤
194+│31 │"Mike" │
195+│40 │"Steve" │
196+│24 │"Bob" │
197+└────────────┴──────────┘
198+
199199```
200200
201201Note that the relational insertion is identical to "x:=x union relation{...}".
@@ -204,50 +204,51 @@ Note that the relational insertion is identical to "x:=x union relation{...}".
204204
205205```
206206TutorialD (master/main): :showexpr s
207−┌──────────┬────────┬───────────┬───────────┐
208−│city::Text│s#::Text│sname::Text│status::Int│
209−├──────────┼────────┼───────────┼───────────┤
210−│"Paris" │"S2" │"Jones" │10 │
211−│"Paris" │"S3" │"Blake" │30 │
212−│"London" │"S1" │"Smith" │20 │
213−│"London" │"S4" │"Clark" │20 │
214−│"Athens" │"S5" │"Adams" │30 │
215−└──────────┴────────┴───────────┴───────────┘
207+┌──────────┬────────┬───────────┬───────────────┐
208+│city::Text│s#::Text│sname::Text│status::Integer│
209+├──────────┼────────┼───────────┼───────────────┤
210+│"London" │"S1" │"Smith" │20 │
211+│"Athens" │"S5" │"Adams" │30 │
212+│"Paris" │"S3" │"Blake" │30 │
213+│"London" │"S4" │"Clark" │20 │
214+│"Paris" │"S2" │"Jones" │10 │
215+└──────────┴────────┴───────────┴───────────────┘
216216TutorialD (master/main): update s where city="London" (status:=35)
217217TutorialD (master/main): :showexpr s
218−┌──────────┬────────┬───────────┬───────────┐
219−│city::Text│s#::Text│sname::Text│status::Int│
220−├──────────┼────────┼───────────┼───────────┤
221−│"London" │"S4" │"Clark" │35 │
222−│"London" │"S1" │"Smith" │35 │
223−│"Paris" │"S2" │"Jones" │10 │
224−│"Paris" │"S3" │"Blake" │30 │
225−│"Athens" │"S5" │"Adams" │30 │
226−└──────────┴────────┴───────────┴───────────┘
218+┌──────────┬────────┬───────────┬───────────────┐
219+│city::Text│s#::Text│sname::Text│status::Integer│
220+├──────────┼────────┼───────────┼───────────────┤
221+│"Athens" │"S5" │"Adams" │30 │
222+│"London" │"S1" │"Smith" │35 │
223+│"London" │"S4" │"Clark" │35 │
224+│"Paris" │"S3" │"Blake" │30 │
225+│"Paris" │"S2" │"Jones" │10 │
226+└──────────┴────────┴───────────┴───────────────┘
227+
227228```
228229#### Deleting Tuples from a Relation Variable
229230
230231```
231232TutorialD (master/main): :showexpr s
232−┌──────────┬────────┬───────────┬───────────┐
233−│city::Text│s#::Text│sname::Text│status::Int│
234−├──────────┼────────┼───────────┼───────────┤
235−│"Paris" │"S2" │"Jones" │10 │
236−│"Paris" │"S3" │"Blake" │30 │
237−│"London" │"S1" │"Smith" │20 │
238−│"London" │"S4" │"Clark" │20 │
239−│"Athens" │"S5" │"Adams" │30 │
240−└──────────┴────────┴───────────┴───────────┘
233+┌──────────┬────────┬───────────┬───────────────┐
234+│city::Text│s#::Text│sname::Text│status::Integer│
235+├──────────┼────────┼───────────┼───────────────┤
236+│"Paris" │"S2" │"Jones" │10 │
237+│"Paris" │"S3" │"Blake" │30 │
238+│"London" │"S1" │"Smith" │20 │
239+│"Athens" │"S5" │"Adams" │30 │
240+│"London" │"S4" │"Clark" │20 │
241+└──────────┴────────┴───────────┴───────────────┘
241242TutorialD (master/main): delete s where sname="Adams"
242243TutorialD (master/main): :showexpr s
243−┌──────────┬────────┬───────────┬───────────┐
244−│city::Text│s#::Text│sname::Text│status::Int│
245−├──────────┼────────┼───────────┼───────────┤
246−│"Paris" │"S2" │"Jones" │10 │
247−│"Paris" │"S3" │"Blake" │30 │
248−│"London" │"S1" │"Smith" │20 │
249−│"London" │"S4" │"Clark" │20 │
250−└──────────┴────────┴───────────┴───────────┘
244+┌──────────┬────────┬───────────┬───────────────┐
245+│city::Text│s#::Text│sname::Text│status::Integer│
246+├──────────┼────────┼───────────┼───────────────┤
247+│"Paris" │"S2" │"Jones" │10 │
248+│"London" │"S4" │"Clark" │20 │
249+│"Paris" │"S3" │"Blake" │30 │
250+│"London" │"S1" │"Smith" │20 │
251+└──────────┴────────┴───────────┴───────────────┘
251252```
252253
253254### Execute Transaction Graph Expressions
@@ -270,7 +271,7 @@ TutorialD (master/main): :rollback
270271
271272```
272273TutorialD (master/main): :branch experimental
273−TutorialD (experimental): employee:=relation{name Text, salary Int}
274+TutorialD (experimental): employee:=relation{name Text, salary Integer}
274275TutorialD (experimental): :commit
275276```
276277