diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-03-08 16:50:22 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-03-08 16:50:22 -0800 |
commit | 1d079fc574a35f39fd52e3de23a1c8bfa45238ae (patch) | |
tree | e64f2775b4a757183a1279265ec3b9812571120c | |
parent | f7d4db3408cfcc0a027266435e4ac54a0828c8cb (diff) | |
download | mu-1d079fc574a35f39fd52e3de23a1c8bfa45238ae.tar.gz |
2742
-rw-r--r-- | Readme.md | 43 | ||||
-rw-r--r-- | html/fork.png | bin | 0 -> 19933 bytes | |||
-rw-r--r-- | html/tangle.png | bin | 0 -> 42367 bytes |
3 files changed, 2 insertions, 41 deletions
diff --git a/Readme.md b/Readme.md index c47ef1cd..64124181 100644 --- a/Readme.md +++ b/Readme.md @@ -443,31 +443,7 @@ something like this: An alternative way to define factorial is by inserting *labels* and later inserting code at them. - ```nim - def factorial [ - local-scope - n:number <- next-ingredient - { - <base-case> - } - <recursive-case> - ] - - after <base-case> [ - # if n=0 return 1 - zero?:boolean <- equal n, 0 - break-unless zero? - return 1 - ] - - after <recursive-case> [ - # return n * factorial(n-1) - x:number <- subtract n, 1 - subresult:number <- factorial x - result:number <- multiply subresult, n - return result - ] - ``` +<img alt='literate programming' src='html/tangle.png'> (You'll find this version in `tangle.mu`.) @@ -480,22 +456,7 @@ names for inserting code at. Another example, this time with concurrency. - ``` - def main [ - start-running thread2 - { - $print 34 - loop - } - ] - - def thread2 [ - { - $print 35 - loop - } - ] - ``` +<img alt='forking concurrent routines' src='html/fork.png'> ```shell $ ./mu fork.mu diff --git a/html/fork.png b/html/fork.png new file mode 100644 index 00000000..f7bfcf5c --- /dev/null +++ b/html/fork.png Binary files differdiff --git a/html/tangle.png b/html/tangle.png new file mode 100644 index 00000000..beda9eb0 --- /dev/null +++ b/html/tangle.png Binary files differ |