diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-06-27 08:32:44 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-06-27 08:32:44 -0700 |
commit | 0237be29aa2dc4827b9d83e6e3eeca08d8e7153e (patch) | |
tree | e9bc48e3314e474e2156f204da2581c7a289a986 | |
parent | 1b82006eae5beae752d1a06ce5d7b26d0f4144ef (diff) | |
download | mu-0237be29aa2dc4827b9d83e6e3eeca08d8e7153e.tar.gz |
.
-rw-r--r-- | shell/README.md | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/shell/README.md b/shell/README.md index d48c5d85..c2cae46f 100644 --- a/shell/README.md +++ b/shell/README.md @@ -116,7 +116,7 @@ The Mu shell supports infix operators: => 4 ``` -You don't need spaces around infix ops: +You don't need spaces around infix operators: ``` 3+1 => 4 @@ -132,7 +132,7 @@ To see how an expression is parsed, quote it: => (+ 3 1) ``` -You can create your own infix ops: +You can create your own infix operators: ``` def (a <> b) (not (a = b)) @@ -158,11 +158,17 @@ Infix operators also work in prefix position: => 4 ``` -To pass infix operators to higher-order functions, wrap them in parens. A -silly example: +As a special case, operators can be unary. A silly example: ``` -def (+++ x) # silly name +def (+++ x) x+1 + ++++4 +=> 5 +``` + +To pass operators to higher-order functions, wrap them in parens +``` (map1 (+++) '(1 2 3)) => (2 3 4) ``` |