Skip to content

Commit

Permalink
* README.md: update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
swannodette committed Oct 28, 2011
1 parent 5edc28c commit 67afdab
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions README.md
Expand Up @@ -285,31 +285,18 @@ For example, this syntax is illegal:
Matching single variables
---

`clojure.core.match/match-1` is sugar over `match` that allows pattern matching over a single variable, without
an "extra" pair of `[]` around the occurrences and each pattern row.
Matching single variables is simple:

```clojure
(let [x 3]
(match-1 x
1 :a0
2 :a1
:else :a2))
(match x
1 :a0
2 :a1
:else :a2))
;=> :a2
```

This is equivalent to the following `match`.

```clojure
(let [x 3]
(match [x]
[1] :a0
[2] :a1
:else :a2))
;=> :a2
```

As shown, :else clauses are special, in that they are not wrapped in `[]`.

Note that :else clauses are special and never need to be wrapped.

Road Map
----
Expand Down

0 comments on commit 67afdab

Please sign in to comment.