aboutsummaryrefslogtreecommitdiffhomepage
path: root/README.md
diff options
context:
space:
mode:
authorMike Beller <bellermike@gmail.com>2021-01-11 11:13:34 -0500
committerMike Beller <bellermike@gmail.com>2021-01-11 11:13:34 -0500
commitc30252007e7d60e2a7fb2ae21c430b49f60ae74d (patch)
treebff739750b9ac58d792fab260ad202de5a3a8925 /README.md
parentWorking versions of misc/timeit and misc/set* (diff)
Include set* and timeit in README. Remove debugging output
in test suite.
Diffstat (limited to 'README.md')
-rw-r--r--README.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4cb100a..dbf918d 100644
--- a/README.md
+++ b/README.md
@@ -106,4 +106,32 @@ Remove indentation after concatenating the arguments.
hohoho
```))))) => "ho\n hoho\n hohoho"
+### timeit
+
+Time code execution using os/clock, and print the result.
+Returns the value of the timed expression.
+
+```
+repl> (misc/timeit (sum (seq [i :range [1 1000000]] (math/sqrt i))))
+Elapsed time: 0.0718288 seconds
+6.66666e+08
+```
+
+### set*
+
+Allow parallel mutation of multiple mutable variables. (All right
+hand sides are computed before setting the left hand sides.)
+
+```
+# you can use it with vars
+(var a 2)
+(var b 3)
+(misc/set* [a b] [b (+ a b)])
+[a b] => [3 5]
+
+# or you can use it with arrays, for example:
+(def x @[2 3])
+(misc/set* [[x 0] [x 1]] [(in x 1) (+ (in x 0) (in x 1))])
+x => @[3 5]
+```