Skip to content

Commit

Permalink
remove wrong condition in prewalk
Browse files Browse the repository at this point in the history
  • Loading branch information
chengchingwen committed Dec 22, 2021
1 parent 7031449 commit 5eeb0ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ julia> prewalk(x -> @show(x) isa Integer ? StructWalk.LeafNode(x // 2) : x isa T
x = (3, 5)
x = 4
x = 6
2 => 3
2//1 => 3//1

```

Expand Down
8 changes: 2 additions & 6 deletions src/StructWalk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,14 @@ julia> prewalk(x -> @show(x) isa Integer ? StructWalk.LeafNode(x // 2) : x isa T
x = (3, 5)
x = 4
x = 6
2 => 3
2//1 => 3//1
```
See also: [`postwalk`](@ref), [`LeafNode`](@ref)
"""
prewalk(f, x) = prewalk(f, WalkStyle, x)
function prewalk(f, style, x)
y = f(x)
y == x && return x
return walk(identity, style, y, x -> prewalk(f, style, x))
end
prewalk(f, style, x) = walk(identity, style, f(x), x -> prewalk(f, style, x))


@specialize
Expand Down

2 comments on commit 5eeb0ea

@chengchingwen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/51047

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 5eeb0eac34992475742cd3ae9b747247f3b9954a
git push origin v0.1.0

Please sign in to comment.