Displaying 2 results from an estimated 2 matches for "dunder".
Did you mean:
under
2024 Apr 23
1
x[0]: Can '0' be made an allowed index in R?
...ing blocks abound unless we accept each language as a world
of its own in which different design and implementation choices were made.
If you take a language like Python and ask how to support 1-based objects,
you might well come up with a rather different solution including using
hooks such as the dunder variables they made easily accessible, making a
subclass, using a decorator and so on.
Having said that, consider that there are many successful examples in R
where packages have augmented doing things in ways different than base R and
different does not have to be better or worse but can have a...
2024 Apr 23
2
x[0]: Can '0' be made an allowed index in R?
Hello Peter,
Unless I too misunderstand your point, negative indices for removal do
work with the Oarray package (though -0 doesn't work to remove the 0th
element, since -0 == 0 -- perhaps what you meant):
> library(Oarray)
> v <- Oarray(1:10, offset=0)
> v
[0,] [1,] [2,] [3,] [4,] [5,] [6,] [7,] [8,] [9,]
1 2 3 4 5 6 7 8 9 10
> dim(v)