Skip to content

Commit 2d2c40e

Browse files
committed
also add a docstring note
1 parent a057d08 commit 2d2c40e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Functors.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,16 @@ This function walks (maps) over `xs` calling the continuation `f'` to continue t
182182
julia> fmap(x -> 10x, m, walk=(f, x) -> x isa Bar ? x : Functors._default_walk(f, x))
183183
Foo(Bar([1, 2, 3]), (40, 50, Bar(Foo(6, 7))))
184184
```
185+
186+
The behaviour when the same node appears twice can be altered by giving a value
187+
to the `prune` keyword, which is then used in place of all but the first:
188+
189+
```jldoctest
190+
julia> twice = [1, 2];
191+
192+
julia> fmap(float, (x = twice, y = [1,2], z = twice); prune = missing)
193+
(x = [1.0, 2.0], y = [1.0, 2.0], z = missing)
194+
```
185195
"""
186196
fmap
187197

0 commit comments

Comments
 (0)