c-cube/ocaml-containers

reduce function for cclist?

nilsbecker opened this issue · 1 comments

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.

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.