ref: 73c6d49bb6ef0b41559f7acd5929accbb4697bc7
parent: 121f68645db7dd9e18ce34f502f70002b63c3a52
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Aug 12 13:13:58 EDT 2012
Improve formatting of 'examples' sections of docs.
--- a/doc/lang.txt
+++ b/doc/lang.txt
@@ -637,41 +637,49 @@
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:
--
⑨