Skip to content
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

Built-in product/tuple types and unit types #78

Closed
nsbgn opened this issue Mar 2, 2022 · 2 comments
Closed

Built-in product/tuple types and unit types #78

nsbgn opened this issue Mar 2, 2022 · 2 comments

Comments

@nsbgn
Copy link
Contributor

nsbgn commented Mar 2, 2022

It is possible to have a user-defined Tuple type that allows types like Map(Tuple(A, B), C). This is useful, because CCT types like R3a(X, Y, Z) are more intuitively expressed as Map(X, Tuple(Y, Z)). The downside is that every n-tuple would have to be explicitly defined, and a shorter notation (ie (Y, Z)) would not be possible. A built-in tuple type (to go along with the Function type) would make the library more user-friendly.

@nsbgn
Copy link
Contributor Author

nsbgn commented Mar 11, 2022

Alternatively, overloading * to refer to the tuple type, as in Map(X, Y * Z), might be even better. It mirrors the Cartesian product symbol ×, which is the natural symbol for tuple types in mathematics (if not in programming languages), there's fewer parentheses, and it's easier to implement (since adding * for longer tuples will just make nested tuples).

The downside is that it might be confusing with ** being the function arrow, and parsing needing to take this into account. Also, implicitly creating nested tuples is undesirable when you actually need explicitly nested tuples. It is possible to not create nested tuples but add to an existing tuple instead, but then how do you create nested tuples?

nsbgn added a commit that referenced this issue Mar 11, 2022
This means that the user can always write `A * B * C` for the type of
tuples `(a, b, c)` of values of those respective types.

This is a quick implementation for issue #78. Parsing is not yet
implemented!
@nsbgn nsbgn changed the title Accept arbitrary length tuples as types Built-in product/tuple types and unit types Mar 11, 2022
nsbgn added a commit that referenced this issue May 5, 2022
@nsbgn nsbgn added this to the Version 0.2: RDF support milestone Jun 1, 2022
@nsbgn
Copy link
Contributor Author

nsbgn commented Jun 16, 2022

Product types are now parsed; this issue is otherwise subsumed by #79.

@nsbgn nsbgn closed this as completed Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant