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

Documentation on -> operator #32

Open
tel opened this issue Apr 15, 2021 · 2 comments
Open

Documentation on -> operator #32

tel opened this issue Apr 15, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@tel
Copy link

tel commented Apr 15, 2021

The tutorial uses at one point the -> operator.

# Finding most popular name for each year.
@OrderBy(TopNameByYear, "year");
TopNameByYear(year) ArgMax= name -> NameCountByYear(name:, year:);

While this seems to be a variant on the functional aggregation method, it's not documented anywhere. Is there a more complete language reference that can be linked?

Thanks!

@EvgSkv
Copy link
Owner

EvgSkv commented Apr 15, 2021

Thank you for bringing this up. We will create a reference to make looking up meaning of functions easier.

Meanwhile as for the "->" operator: it's just a streamlined syntax for writing structure {arg:, value:}. E.g. the program

Q("hello" -> "world");

results in a table:


col0
{'arg': 'hello', 'value': 'world'}

Aggregating operator ArgMax takes in a single argument, which has to be a struct {arg:, value:}, it then finds an arg that has maximal value. So the program that you cited could be written as

# Finding most popular name for each year.
@OrderBy(TopNameByYear, "year");
TopNameByYear(year) ArgMax= {arg: name, value: NameCountByYear(name:, year:)};

Leaving the issue open, as we need formal documentation.
Meanwhile let me know if you have further questions.

@EvgSkv EvgSkv added documentation Improvements or additions to documentation good first issue Good for newcomers labels Apr 15, 2021
@tel
Copy link
Author

tel commented Apr 15, 2021

Awesome, that's helpful! I had seen that struct behavior happening but didn't realize that it was being caused directly by ->. That makes sense now, though doubles as a need for functions like ArgMax needing documentation (sooner or later) as well.

EvgSkv pushed a commit that referenced this issue Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants