-
Notifications
You must be signed in to change notification settings - Fork 85
Extend the stdlib #896
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
base: master
Are you sure you want to change the base?
Extend the stdlib #896
Conversation
4c600fa to
97ce922
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much @vincent-botbol ! The CI is still not green and I put some polish suggestions below, but we're close :)
|
|
||
| ## Transforms a `MonthYear` into a `date` by choosing the first day of the | ||
| ## month. | ||
| declaration to_first_day_of_month |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't we decide to move these functions into their own MonthYear module ? Because right now this function is called with the syntax Date.to_first_day_of_month, which is confusing to read because it does not mention that the argument is a MonthYear.
stdlib/date_en.catala_en
Outdated
| ## Returns `true` if the date occurs after the first day of the given month (included). | ||
| ## **Example:** `is_after_the_first_day_of_month of may_2025, |2025-06-15| = true` | ||
| ## **Example:** `is_after_the_first_day_of_month of may_2025, |2025-05-01| = true` | ||
| ## **Example:** `is_after_the_first_day_of_month of may_2025, |2025-04-30| = false` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://github.com/CatalaLang/catala/blob/master/stdlib/README.md this should rather be :
## Returns `true` if the date occurs after the first day of the given month (included).
## **Examples:**
## * `is_after_the_first_day_of_month of may_2025, |2025-06-15| = true`
## * `is_after_the_first_day_of_month of may_2025, |2025-05-01| = true`
## * `is_after_the_first_day_of_month of may_2025, |2025-04-30| = false`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same above and below
stdlib/list_en.catala_en
Outdated
| ## **Example**: `sequence of 3, 6` is the list `[3; 4; 5]` | ||
| ## **Edge-case**: if `end <= begin`, the returned list is empty | ||
| ## **Example:** `sequence of 3, 6 = [3; 4; 5]` | ||
| ## **Edge-case**: if `end <= begin`, the returned list is empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://github.com/CatalaLang/catala/blob/master/stdlib/README.md we decided to remove the **Edge-case** item and simply put the edge case description in the main message describing the goal of the function and how it does it.
catala-format as of 2b19f5c
those are sensible to the 'date rounding mode', that can't be set, at the moment, when calling functions
afe1bcf to
a3057f3
Compare
This PR fixes a few typos on the stdlib and refactor + add functions, namely (en/fr):
List.reverse/List.inversemonth_to_int=>month_to_integer(en only)MonthOfYear/MoisDansAnnée=>MonthYear/MoisAnnée+ a bunch utility functionsfrom_month_and_year/depuis_mois_et_annéefrom_year/depuis_annéeoverlap/chevauchepredicatecover/englobepredicateis_(before|after)/est_(avant|après)predicates.Sister PR: CatalaLang/catala-book#24