Skip to content

Commit

Permalink
fixup queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Krastanov committed Nov 19, 2023
1 parent 6b3a4ba commit 61102b8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/queries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ julia> r = Register(10);
tag!(r[2], :symbol, 4, 5);
julia> queryall(r, :symbol, ❓, ❓)
2-element Vector{Tuple{RegRef, QuantumSavory.Tag}}:
(Slot 1, SymbolIntInt(:symbol, 2, 3)::QuantumSavory.Tag)
(Slot 2, SymbolIntInt(:symbol, 4, 5)::QuantumSavory.Tag)
2-element Vector{NamedTuple{(:slot, :tag), Tuple{RegRef, QuantumSavory.Tag}}}:
(slot = Slot 1, tag = SymbolIntInt(:symbol, 2, 3)::QuantumSavory.Tag)
(slot = Slot 2, tag = SymbolIntInt(:symbol, 4, 5)::QuantumSavory.Tag)
julia> queryall(r, :symbol, ❓, >(4))
1-element Vector{Tuple{RegRef, QuantumSavory.Tag}}:
(Slot 2, SymbolIntInt(:symbol, 4, 5)::QuantumSavory.Tag)
1-element Vector{NamedTuple{(:slot, :tag), Tuple{RegRef, QuantumSavory.Tag}}}:
(slot = Slot 2, tag = SymbolIntInt(:symbol, 4, 5)::QuantumSavory.Tag)
julia> queryall(r, :symbol, ❓, >(5))
Tuple{RegRef, QuantumSavory.Tag}[]
NamedTuple{(:slot, :tag), Tuple{RegRef, QuantumSavory.Tag}}[]
```
"""
queryall(args...; kwargs...) = query(args..., Val{true}(); kwargs...)
Expand All @@ -59,15 +59,17 @@ julia> r = Register(10);
tag!(r[1], :symbol, 2, 3);
tag!(r[2], :symbol, 4, 5);
julia> query(r, :symbol, 4, 5)
(Slot 2, SymbolIntInt(:symbol, 4, 5)::QuantumSavory.Tag)
(slot = Slot 2, tag = SymbolIntInt(:symbol, 4, 5)::QuantumSavory.Tag)
julia> lock(r[1]);
julia> query(r, :symbol, 4, 5; locked=false) |> isnothing
false
julia> query(r, :symbol, ❓, 3)
(Slot 1, SymbolIntInt(:symbol, 2, 3)::QuantumSavory.Tag)
(slot = Slot 1, tag = SymbolIntInt(:symbol, 2, 3)::QuantumSavory.Tag)
julia> query(r, :symbol, ❓, 3; assigned=true) |> isnothing
true
Expand All @@ -84,7 +86,7 @@ julia> query(r, Int, 4, >(7)) |> isnothing
true
julia> query(r, Int, 4, <(7))
(Slot 5, TypeIntInt(Int64, 4, 5)::QuantumSavory.Tag)
(slot = Slot 5, tag = TypeIntInt(Int64, 4, 5)::QuantumSavory.Tag)
```
See also: [`queryall`](@ref), [`tag!`](@ref), [`tag_types`](@ref), [`Wildcard`](@ref)
Expand Down

0 comments on commit 61102b8

Please sign in to comment.