"In tables, (foo 0 1) already means the same thing as (or foo.0 1). But hmm, maybe you're not interested in slicing tables. That's fine, then. ^_^"
What would a table slice even mean? They're not even ordered. The closest thing would be a table that has a subset of the keys of another table, but that wouldn't use numeric indexing.
---
"The other issue was that I think at some point you were using (foo 0) to mean a one-element slice, and that would definitely be ambiguous with regular old indexing."
I was? (foo 0) should always be an element, not a slice. Ah well, it doesn't matter. If I did use that, I was incorrect.
I'll note that (del (foo 0)) is equivalent to (= (foo 0 1) nil) so perhaps that confused you.
---
"Arc's 'cut accepts start and stop positions, and your slicing examples instead use a start position and a length."
They did? I always thought of it as being a start/end position, like cut. So for instance:
The way I'm doing it is, the number of elements is the end minus the start, so for instance, in the example above, 5 - 2 is 3, so it removed 3 elements, starting at position 2. This is exactly how cut behaves:
(= foo '(1 2 3 4 5 6))
(cut foo 2 5) -> (3 4 5)
In fact, I think it'd be a good idea for lists/strings in functional position to just delegate to cut, so (foo 2 5) would be the same as (cut foo 2 5)
Well, sure, but you wouldn't use numeric indices to refer to that. :P It might be something like this:
(subset x 'foo 'bar 'qux)
As opposed to:
(x 0 1)
Which would be slice notation, which would work only on ordered sequences, like lists.
Which isn't to say that table subsets would be a bad idea, just that it's a different idea from list slicing, so there shouldn't be any ambiguities with slice notation (which was one of rocketnia's concerns).
You could implement subsetting at function position, in which case it would be ambiguous. I already use :default in wart, so I don't care too much about that :) But yeah I hadn't thought of how to create ranges of keys. This may not be a good idea. You can't distinguish table lookup from a subset table with just one key/val, for example.