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

Comments

@tel
Copy link

@tel 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 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.

@tel
Copy link
Author

@tel 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants