slurp-forward-fully-into
function
rewrite-clj.paredit/slurp-forward-fully-into
(slurp-forward-fully-into [zloc] [zloc opts])Return `zloc` with all right sibling nodes of nearest eligible sequence slurped into that sequence else `zloc` unchanged.
See also [[slurp-forward-into]].
Optional `opts` specify:
- `:from`
- `:parent` (default) starts search from parent of `zloc` then upward
- `:current` starts search from `zloc` then upward to allow slurping into empty sequences
Generic behavior:
- `[1 [2 |3 4] 5 6] 7 => [1 [2 |3 4 5 6]] 7` Slurp from parent
- `[[[|1 2]] 3 4] 5 => [[[|1 2 3 5]]] 5` Slurp from ancestor
With `:from :current`:
- `[1 |[] 2 3] 4 5 => [1 |[2 3]] 4 5` Slurp into current empty sequence
- `[1 |[2 3]] 4 5 => [1 |[2 3 4 5]]` Slurp into current non-empty sequence
With `:from :parent` (default):
- `[[1 |[]] 2 3] 4 5 => [[1 |[] 2 3] 4 5` Slurp into parent
Examples
No examples yet. Be the first to add one!