Liking cljdoc? Tell your friends :D

derrida.core

### Destructuring Destructuring
raw docstring

deconstructclj/s

(deconstruct binding-form & {:keys [as-map]})

Returns symbols bound in a binding form, either as a flat sequence and in the same order as in the binding form, or as a map if the :as-map option is set.

(deconstruct '[a & {:keys [x] y :_y :or {x 1} :as m}])
;; => '[a x y m]
(deconstruct '[a & {:keys [x] y :_y :or {x 1} :as m}] :as-map true)
;; => '{:a a :x x :y y :m m}
Returns symbols bound in a binding form, either as a flat sequence
and in the same order as in the binding form, or as a map if the
`:as-map` option is set.

```clojure
(deconstruct '[a & {:keys [x] y :_y :or {x 1} :as m}])
;; => '[a x y m]
(deconstruct '[a & {:keys [x] y :_y :or {x 1} :as m}] :as-map true)
;; => '{:a a :x x :y y :m m}
```
sourceraw docstring

disentangleclj/s

(disentangle binding-form)

Parses one level of destructuring.

(disentangle '[a b & [c]])
=> '{:items [a b], :more [c]}

(disentangle '{:keys [a] b :b [c1 c2] :c :or {d 1} :as m})
=> '{:items [a b [c1 c2]],
     :as m,
     :or {d 1},
     :mapping {a :a, b :b, [c1 c2] :c}}
Parses one level of destructuring.

```clojure
(disentangle '[a b & [c]])
=> '{:items [a b], :more [c]}

(disentangle '{:keys [a] b :b [c1 c2] :c :or {d 1} :as m})
=> '{:items [a b [c1 c2]],
     :as m,
     :or {d 1},
     :mapping {a :a, b :b, [c1 c2] :c}}
```
sourceraw docstring

effaceclj/s

(efface binding-form & syms)

Removes given symbols from a binding form.

(efface '[a & more :as all]                 'more 'all) ;; => '[a]
(efface '[[a b] & more :as all]             '[a all])   ;; => '[[b] & more]
(efface '{:keys [a] b :b :or {a 1} :as all} 'a)         ;; => '{b :b :as all}
Removes given symbols from a binding form.

```clojure
(efface '[a & more :as all]                 'more 'all) ;; => '[a]
(efface '[[a b] & more :as all]             '[a all])   ;; => '[[b] & more]
(efface '{:keys [a] b :b :or {a 1} :as all} 'a)         ;; => '{b :b :as all}
```
sourceraw docstring

efface-exceptclj/s

(efface-except binding-form & syms)

Similarly to efface, removes all but the given syms from the binding form.

Similarly to [[efface]], removes all but the given syms from the
binding form.
sourceraw docstring

entangleclj/s

(entangle m)

Undoes what disentangle does.

(entangle '{:items [a b]})
;; => [a b]
(entangle '{:items [a b] :or {b 1}, :mapping {a :a b :b}})
;; => {a :a, b :b, :or {b 1}}
Undoes what [[disentangle]] does.

```clojure
(entangle '{:items [a b]})
;; => [a b]
(entangle '{:items [a b] :or {b 1}, :mapping {a :a b :b}})
;; => {a :a, b :b, :or {b 1}}
```
sourceraw docstring

restructureclj/s

(restructure binding-form mapping)

Undoes what [[destructure]] does.

(restructure '[x & {:keys [a b] c :cc d :d :or {d 3}}]
             '{x 0 a 1 b 2 c 3})

(restructure '[x & {:keys [a b] c :cc d :d :or {d 3}}]
             {:x 0 :a 1 :b 2 :c 3})

(restructure '[x & {:keys [a b] c :cc d :d :or {d 3}}]
             '[x 0 a 1 b 2 c 3])

;; => [0 :a 1 :b 2 :cc 3 :d nil]
Undoes what [[destructure]] does.

```clojure
(restructure '[x & {:keys [a b] c :cc d :d :or {d 3}}]
             '{x 0 a 1 b 2 c 3})

(restructure '[x & {:keys [a b] c :cc d :d :or {d 3}}]
             {:x 0 :a 1 :b 2 :c 3})

(restructure '[x & {:keys [a b] c :cc d :d :or {d 3}}]
             '[x 0 a 1 b 2 c 3])

;; => [0 :a 1 :b 2 :cc 3 :d nil]
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close