-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indexing Grammar in combination with vector construction using [...]
causes ambiguous syntax.
#109
Comments
I'm very aware - I haven't really figured out a good path forward. I'm at an impasse with this syntax. This is described in this issue, but it warrants having it's own dedicated issue. I'm glad you honed in on it as well, I'd love to have other ideas bouncing around this. I really want this syntax to make more sense because I found the I'd really like to retire
I don't have good answers to these, so for now it remains a wide-open experiment. |
The only way I see to both avoid introducing scalars and to not have a dedicated For example: > l <- list(1, 2, 3)
> l[1]
[1] 1
> l[1:1]
[[1]]
[1] 1 However, this then gets a little tricky when the argument passed to > l <- list(1, 2, 3)
> ii <- 1:2
> l[ii]
# Error: Must have length 1
> l[ii[1]:ii[length(ii)]] # needless to say this is extremely ugly, but this could be made prettier
[[1]]
[1] 1 2
> ii1 <- 1
l[ii1]
[1] 1 I am not sure that this is then altogether much different from the
Maybe this would be an argument to construct vectors with
Agreed! However, maybe we can introduce scalars without moving far away from this idea.
|
Yeah, this has sort of been what I've been leaning toward, so it's good to hear you reinforce that direction. As I think about it more, I think we'll have
Certainly - especially if those basic types all implement Cool, well that's about all the confirmation I needed. I think |
Just that I don't forget it: The |
We might be able to keep it, since it applies to the I imagine that any I'm not sure I agree that |
I think it would be really cool if we could conceptualize a Scalar as a 0-dimensional array. Not necessarily in the internal representation for which I agree that overhead should be as minimal as possible, but in terms of its semantics.
Yes I think that makes sense! |
Yeah, that's how I see it too. I think we'll have distinct data types, but I think the broadcasting should operate such that a 0-dim array is operationally identical, at least for broadcasting/recycling operations like mathematical operators. |
Was reading Designing Types for R, Empirically (Vitek, et. al., 2020) today and just wanted to highlight some of their conclusions (Section 6.1.1). It's worth a read through all their commentary, but there are at least two that might inform a direction for this project: Supporting the inclusion of an explicit missing/naSimilar to
Supporting the introduction of a Scalar
|
thanks so much for sharing this, the title sound fascinating. maybe we could even try to reach out to Jan vitek? |
Because
[[
can be used with a single number like1
and[
with a vector like[1]
, it is not clear what the expressionx[[1]]
represents, i.e. does it call[[
or[
.The text was updated successfully, but these errors were encountered: