Skip to content

Commit fa802d3

Browse files
authored
Merge pull request #153 from musm/patch-1
Update pattern-matching.md
2 parents 3b5287d + 816ab24 commit fa802d3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/src/pattern-matching.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ end
1616
If you know what you're doing, you can pull out the name and fields via:
1717

1818
```julia
19-
julia> if isexpr(ex.args[2], :struct)
19+
julia> if Meta.isexpr(ex.args[2], :struct)
2020
(ex.args[2].args[2], ex.args[2].args[3].args)
2121
end
22-
(:Foo,{:( # line 3:),:(x::Int),:( # line 4:),:y})
22+
(:Foo, Any[:(#= line 3 =#), :(x::Int), :(#= line 4 =#), :y])
2323
```
2424

2525
But this is hard to write – since you have to deconstruct the `type`
@@ -37,7 +37,7 @@ julia> @capture(ex, struct T_ fields__ end)
3737
true
3838

3939
julia> T, fields
40-
(:Foo, [:(x::Int), :y])
40+
(:Foo, Any[:(x::Int), :y])
4141
```
4242

4343
Symbols like `T_` underscore are treated as catchalls which match any

0 commit comments

Comments
 (0)