Skip to content

Commit

Permalink
ready for v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Abbott committed Apr 1, 2020
1 parent 8a7e483 commit 4d63da5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AxisKeys"
uuid = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5"
license = "MIT"
version = "0.1.0"
version = "0.1.1"

[deps]
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ There are also a numer of special selectors, which work like this:
| one nearest | `B[time = 3]` | `B(time = Near(17.0))` | vector |
| all in a range | `B[2:5, :]` | `B(Interval(14,25), :)` | matrix |
| all matching | `B[3:end, Not(3)]` | `B(>(17), !=(33))` | matrix |
| mixture | `B[1, Key('β')]` | `B(Index[1], 'β')` | scalar |
| mixture | `B[1, Key(33)]` | `B(Index[1], 33)` | scalar |
| non-scalar | `B[iter=[1, 3]]` | `B(iter=[31, 33])` | matrix |

Here `Interval(13,18)` can also be written `13..18`, it's from [IntervalSets.jl](https://github.com/JuliaMath/IntervalSets.jl).
Expand All @@ -61,12 +61,12 @@ i.e. it does not drop a dimension, even if there is exactly one match.

By default lookup returns a view, while indexing returns a copy unless you add `@views`.
This means that you can write into the array with `B(time = <=(18)) .= 0`.
For scalar output, you cannot of course write `B(13.0, 'α') = 0`
as this parsed as a function definition, but you can write `B(13.0, 'α', :) .= 0`
For scalar output, you cannot of course write `B(13.0, 33) = 0`
as this parsed as a function definition, but you can write `B(13.0, 33, :) .= 0`
as a trailing colon makes a zero-dimensional view.

The selectors `Index[i]` and `Key(k)` allow mixing of indexing & lookup,
and `setindex!` via `B[Key(13.0), Key('α')] = 0`.
and `setindex!` via `B[Key(13.0), Key(33)] = 0`.
Any selectors can now be used within indexing, for instance `B[time = >(17)]`,
but they will not select dimension based on type, i.e. `A[Key(:left)]` is an error.
You may also write `Index[end]` but not `Index[end-1]` sadly.
Expand Down

0 comments on commit 4d63da5

Please sign in to comment.