Changes between Version 1 and Version 2 of Challenge
- Timestamp:
- 03/11/19 15:54:00 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Challenge
v1 v2 21 21 22 22 `$spawn stmt`:: 23 create a new process executing stmt. Returns a $proc. 23 creates a new process executing the statement. Returns a value of type `$proc` 24 referencing the new process. 24 25 25 26 `$wait($proc p)`:: 26 block until process p terminates27 blocks until process p terminates 27 28 28 $parfor (int i:a..b) f(.. i ..); 29 spawns threads calling f, one for each i in a..b,30 waits for them to terminate 29 `$parfor (int i:a..b) stmt`:: 30 spawns threads, one for each i in the range a..b, each executing `stmt`. 31 Waits for them to terminate. 31 32 32 assertions: 33 Use either C's assert (include <assert.h>) or CIVL's $assert. 34 They mean the same thing. 33 `$assert(expr)`:: 34 An assertion. This is treated exactly the same as C's `assert`, except with 35 the latter you must include `assert.h`. CIVL-C has a richer assertion 36 language that C---e.g., you can use quantifiers. 35 37 36 Quantification: $forall and $exists. Examples: 37 $forall (double x | x>0) x>1 38 $forall (int i | a<=i && i<=b) p(i) 39 $forall (int i:a..b) p(i) 38 `$forall` and `$exists`:: 39 Mean what you think. Here are some examples to show the syntax: 40 * `$forall (double x | x>1) x>0` -- for all doubles x that are greater than 1, x is greater than 0 41 * `$forall (int i | a<=i && i<=b) p(i)` -- for all i between a and b (inclusive), p(i) holds 42 * `$forall (int i:a..b) p(i)` -- same as above, but more convenient 40 43 41 44
