Commits
Click on a commit to change the comparison range✨ feat(lang): add 8 useful utility functions and macros
Add new utility functions and macros to builtin.mq:
- reject: Filters out elements matching a condition (opposite of filter)
- partition: Splits array into [matching, not_matching] based on condition
- get_or: Safely gets dict value with default fallback
- times: Executes expression n times and returns array of results
- between: Checks if value is between min and max (inclusive)
- not_empty: Checks if value is not empty (opposite of is_empty)
- sum_by: Sums array elements after applying transformation function
- index_by: Creates dictionary indexed by key extracted from elements
All functions include comprehensive tests covering edge cases and typical usage patterns. ♻️ refactor(lang): remove when macro from builtin.mq
Remove the when macro and its associated test as it's redundant with the existing if expression syntax. ♻️ refactor(lang): convert compact_map to function and remove not_empty macro Update crates/mq-lang/builtin.mq
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> ♻️ refactor(lang): convert index_by from macro to function ♻️ refactor(lang): convert get_or, default_to, and between from macros to functions
Converts three macros to simpler function implementations:
- default_to: returns default value if input is None or empty
- get_or: safely gets dict value with default fallback
- between: checks if value is within min/max range (inclusive)