Weeks five and six of the Hacker School experiment:
- Negated index
- URL shortener
- Graph traversal
- Machine learning
Trying to implement a new {idx::Negated Index} type for Julia lang
After solving 12 Project Euler problems, I decided to dive into the deep-end and work on a complicated real-world Julia problem. One of my goals for this Hacker School batch is to contribute to an open source project, so…
What is a negated index? A proposed new type to the Julia language, such that the negated index [!x] would strip the member whose position has the same value as the index [x], creating a vector slice with the member removed.
This involves defining methods for the ! operator to negate indices (int, range, vector…) by converting them to a NegatedIndex type, as well as methods for getindex (and perhaps setindex, in, maximum, minimum…) to handle this new type (idx::NegatedIndex).
For example: a[!idx] will return a vector of all elements that are not in idx.
a = [1,2,5,7]
a[!1] = [2,5,7]
a[!(2:3)] = [1,7]
a[![1,7]] = [2,5]
Details: https://github.com/JuliaLang/julia/issues/1032