-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Simplifying the standard library with multi-arity functions #418
Comments
I kinda like the "_by" suffix, but I like this too. We should find all opportunities for simplification using multi-arities. For example: |
These are the potential changes I've found so far:
Paraphrasing whoever played the Napster guy, "Drop the [1] I'm not entirely sure if I understand how |
Re:
so that
which works:
And that's very nice indeed. |
With that, +1 to all of your list. |
Also, |
@slapresta good point! |
Actually, what we want for |
Yes, we should want Here's one way to define
|
I think Anyway, there's a starting point over at #426; perhaps we should keep working over there. I used the definition of |
Regarding |
@nicowilliams wrote:
In awk, perl, ruby, javascript and no doubt other jq peers, For example, if we go with ", " as join's default, as Nico suggests, then it might make sense to choose " , *" or perhaps "\s,\s_" as the default for split. Or, following awk, python, ruby, etc, split's default would be "\s+". (_) For your reference, here is an extract from ruby's documentation about split:
Footnote
|
My suggestion is simple: functions that are identical save for an optional parameter (such as all functions that end with
_by
) could drop that prefix and become multi-arity functions, that is, functions that accept several definitions with a varying number of parameters. For example, this could be the manual entry formin / max / min_by / max_by
:I've started working on it. Is everyone okay with this? @nicowilliams
The text was updated successfully, but these errors were encountered: