Skip to content

Add support for tuple operations - #197

Open
GaspardCulis wants to merge 7 commits into
ISibboI:mainfrom
GaspardCulis:main
Open

Add support for tuple operations#197
GaspardCulis wants to merge 7 commits into
ISibboI:mainfrom
GaspardCulis:main

Conversation

@GaspardCulis

Copy link
Copy Markdown

Add support for Add and Sub operations on Value::Tuple.

@ISibboI

ISibboI commented Feb 14, 2026

Copy link
Copy Markdown
Owner

This is a great idea, but should we use builtin functions instead of operators for this? Because for strings, the + operator indicates concatenation. So for tuples, users may also expect it to mean concatenation. I would propose function names piecewise_add and piecewise_sub.

@GaspardCulis

Copy link
Copy Markdown
Author

Hi, thanks for the feedback! My idea was that the Tuples would just apply the opcode to each of the tuple element pairs (granted the two tuples have the same length). For now it works with Add and Sub, but I was also imagining multiplication and divison (every operator with two arguments really). We could also add support for single argument operators, where the operator is again, applied to each tuple element. And to my opinion the builtin functions should be used for less common operations, like concat, or maybe also the dot_product.

Please tell me your thoughts and I'll try to implement those as best as I can :)

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

Successfully merging this pull request may close these issues.

2 participants