Skip to content

Commit

Permalink
README: add ->>as-> to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoz03 committed Dec 5, 2023
1 parent 5461233 commit daa8d55
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -319,6 +319,7 @@ or readability.
* [`->>`](#--x-optional-form-rest-more) `(x &optional form &rest more)`
* [`-->`](#---x-rest-forms) `(x &rest forms)`
* [`-as->`](#-as--value-variable-rest-forms) `(value variable &rest forms)`
* [`->>as->`](#->>as->variable-rest-forms-value) `(value forms ... value)`
* [`-some->`](#-some--x-optional-form-rest-more) `(x &optional form &rest more)`
* [`-some->>`](#-some--x-optional-form-rest-more) `(x &optional form &rest more)`
* [`-some-->`](#-some---expr-rest-forms) `(expr &rest forms)`
Expand Down Expand Up @@ -2528,6 +2529,17 @@ In the first form, bind `variable` to `value`. In the second form, bind
(-as-> 3 my-var) ;; => 3
```

#### ->>as-> (variable forms ... value)
Ending with VALUE, thread VARIABLE through all the other FORMS.
Variant of `-as->` but intended for use with `->>`.

```el
(->>as-> i (+ i 1) 1) ;; => 2
;; ^ unintuitive on its own.
(->> 1 (->>as-> i (+ i 1))) ;; => 2
(->> "def" (->>as-> string (concat "abc" string "ghi"))) ;; => "abcdefghi"
```

#### -some-> `(x &optional form &rest more)`

When expr is non-`nil`, thread it through the first form (via [`->`](#--x-optional-form-rest-more)),
Expand Down

0 comments on commit daa8d55

Please sign in to comment.