-
Notifications
You must be signed in to change notification settings - Fork 106
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
List_nonempty module #1057
Comments
Apparently there is one in Core_kernel: https://github.com/janestreet/core_kernel/tree/master/nonempty_list |
One way to start resolving this issue would be to agree on the interface, which I believe should be a subset of batList. |
Indeed, I see no reason why we should not aim for a subset of BatList as far as API goes. |
If the data structure definition is like Core's one, the advantage I see is
that the implementation
for many functions is pretty much just calling the corresponding function
from BatList.
And since BatList has a lot of functions, that would be nice to
simplify/speedup the implementation.
…On Wed, Jan 19, 2022 at 10:53 PM Cedric Cellier ***@***.***> wrote:
Indeed, I see no reason why we should not aim for a subset of BatList as
far as API goes.
What seams less obvious to me is what should be the actual encoding.
Should a non empty list be an item + a normal list (as in Core's
implementation it seems), which has the advantage of offering a free
conversion from/to lists ; or should a list be either the last item or an
item + a non empty list, which seems marginally cleaner and makes the
definition "safer" (it can then be public and allow users to pattern match
directly).
—
Reply to this email directly, view it on GitHub
<#1057 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFUFADMVFPPJJXSCG3FIWTUW2647ANCNFSM5HBDTMJA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
This makes a lot of sense. |
I have started some work here: https://github.com/UnixJunkie/batteries-included/tree/non_empty_list |
from https://discuss.ocaml.org/t/share-your-crazy-ocaml-code-snippet/8116/38 :
I too think it would be useful.
The text was updated successfully, but these errors were encountered: