summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2012-08-12 17:13:58 -0400
committerOri Bernstein <ori@eigenstate.org>2012-08-12 17:13:58 -0400
commit8868c12c8b4ea8264cae4d5793bb07b65280a5a4 (patch)
tree9db38cc1db4ab7976d29985ca2d76143bef051d8 /doc
parent811878b20e27b0166743838019da6a4134967918 (diff)
downloadmc-8868c12c8b4ea8264cae4d5793bb07b65280a5a4.tar.gz
Improve formatting of 'examples' sections of docs.
Diffstat (limited to 'doc')
-rw-r--r--doc/lang.txt62
1 files changed, 35 insertions, 27 deletions
diff --git a/doc/lang.txt b/doc/lang.txt
index 5c90dd9..5d5f411 100644
--- a/doc/lang.txt
+++ b/doc/lang.txt
@@ -637,41 +637,49 @@ TABLE OF CONTENTS:
5.1. Hello World:
- use std
- const main = {
- std.put("Hello World!\n")
- -> 0
- }
+ use std
+ const main = {
+ std.put("Hello World!\n")
+ -> 0
+ }
+
+ TODO: DESCRIBE CONSTRUCTS.
5.2. Conditions
- const intmax = {a, b
- if a > b
- -> a
- else
- -> b
- ;;
- }
+ use std
+ const intmax = {a, b
+ if a > b
+ -> a
+ else
+ -> b
+ ;;
+ }
- const main = {
- var x = 123
- var y = 456
- std.put("The max of %i, %i is %i\n", x, y, max(x, y))
- }
+ const main = {
+ var x = 123
+ var y = 456
+ std.put("The max of %i, %i is %i\n", x, y, max(x, y))
+ }
+
+ TODO: DESCRIBE CONSTRUCTS.
5.3. Looping
- const innerprod = {a, b
- var i
- var sum
- for i = 0; i < a.len; i++
- sum += a[i]*b[i]
- ;;
- }
+ use std
+ const innerprod = {a, b
+ var i
+ var sum
+ for i = 0; i < a.len; i++
+ sum += a[i]*b[i]
+ ;;
+ }
+
+ const main = {
+ std.put("The inner product is %i\n", innerprod([1,2,3], [4,5,6]))
+ }
- const main = {
- std.put("The inner product is %i\n", innerprod([1,2,3], [4,5,6]))
- }
+ TODO: DESCRIBE CONSTRUCTS.
6. STYLE GUIDE: