-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Make the reverse function call more useful #518
Make the reverse function call more useful #518
Conversation
Very nice. I hadn't thought of that!
I'd be okay with that. I don't think Let's go with a breaking change (instead of providing
Is there anything that you would suggest changing now? The list feature is not even released officially, so I'm happy to change function signatures/names/etc. |
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.
Very nice. Feel free to rewrite some (list-related) Numbat code using this new feature. But that is not a must, of course. I'm fine merging this as is
I looked at all the functions in I think we can merge now, I’ll do another PR to rename the operator so it's easier to revert if we need to.
Huum yes it's a bit harder on french keyboard as well I guess 🤔 But IMO
|
5ecdc17
to
889705b
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.
Thank you
Hey, coming back to this one thousand years later. So I guess we weren't wrong about that in the end 😁 |
Cool. Thank you for the feedback. |
Hey, while working on #515, I didn't like the API around lists, especially the way we don't chain calls, which makes the code very hard to read.
With this PR, the following chunks of code are equivalent:
It's clearly inspired by the
|>
operator of OCaml; I believe Haskell has something similar with the$
or&
operator as well.Obviously, it's not as clean as in these two languages since numbat uses parens to call functions.
But it still works, and it should become even more useful once we have closures.
Note
For the future, we should take care while designing the APIs (and especially the list/set/map APIs) that the data structure is always the last parameter
Also, I think I already asked you a long time ago and forgot the answer, but what do you think of renaming (or duplicating) this operator with another symbol?
I’ve never seen
//
anywhere else, and it doesn't ring a bell at all when I use it. I would be way more comfortable with the arroy of OCaml|>
, which shows its intent more clearly.