Closed montymxb closed 3 years ago
As an added note, tuple projections would likely need an additional entry on the tutorials to introduce them. Syntax highlighting on the front-end would need to be changed slightly to allow '#' to be marked as an operator.
I agree with most of the details except tuple projections should produce subsets of the original tuple.
I am guessing you wrote that because the spec has the line
The purpose of tuple projection is to extract a single value or a sub-tuple of values from a tuple
But honestly, that seems like an arbitrary restriction. If a user wants to expand a tuple, why stop them?
I thought this as well at first, but I changed my mind after some reading.
It depends what theory you're basing it off of. My interpretation is that from projections in relational algebra, in which it can be thought of as reducing the original attributes and keeping the projected attributes. However, you are probably coming from projections as term constructors, and also maybe set theory? I think in that case the tuple projection here is akin to a composition of single tuple projections; which makes your case viable behavior. Either way, it's good we figure out exactly what the behavior should be for this. I'm okay with either approach, so long as our basis is clear.
Maybe Martin can weigh in with his thoughts.
On Mar 19, 2021, at 4:18 PM, Benjamin Wilson Friedman @.***> wrote:
I thought this as well at first, but I changed my mind after some reading.
It depends what theory you're basing it off of. My interpretation is that from projections in relational algebra, in which it can be thought of as reducing the original attributes and keeping the projected attributes. However, you are probably coming from projections as term constructors, and also maybe set theory? I think in that case the tuple projection here is akin to a composition of single tuple projections; which makes your case viable behavior. Either way, it's good we figure out exactly what the behavior should be for this. I'm okay with either approach, so long as our basis is clear.
Maybe Martin can weigh in with his thoughts.
I think we should use the more general interpretation.
-- Martin
Since BoGL is a teaching language, I think we should drop tuple selectors from the language.
Tuple selectors remain to be added into the language, per the official spec. This quickly describes the features, and some conditions we want to maintain when they are implemented.
Single Tuple Projection
Selects a single element from a tuple
(1,(2,3))#2 == (2,3)
Tuple Projection
Selects a tuple of elements from a tuple.
(A,B,C)#(1,2) == (A,B)
or(A,B,C)#(3,2,1) == (C,B,A)
is okay, but(A,B,C)#(1,1,2,2,3,3)
is not a valid projection (may need further details).