Skip to content
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

reduce function for cclist? #305

Closed
nilsbecker opened this issue May 11, 2020 · 1 comment · Fixed by #343
Closed

reduce function for cclist? #305

nilsbecker opened this issue May 11, 2020 · 1 comment · Fixed by #343

Comments

@nilsbecker
Copy link
Contributor

does CCList need this function:

fun f -> function
| [] -> None
| h::t -> Some (CCList.fold_left f h t)

? i've seen this called 'reduce'. it's just a minor specialization of fold but is quite frequent in my personal experience.

@c-cube
Copy link
Owner

c-cube commented May 11, 2020

Why not, in which case I'd have reduce and reduce_exn I suppose. I'd rather reach for that when I already know the list is not empty.

kwshi added a commit to kwshi/ocaml-containers that referenced this issue Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants