Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 531

How can I skip a term with List.Map in OCAML?

$
0
0

Suppose I have some code like this:

List.map (fun e -> if (e <> 1) then e + 1 else (*add nothing to the list*))

Is there a way to do this? If so, how?

I want to both manipulate the item if it matches some criteria and ignore it if it does not. Thus List.filter wouldn't seem to be the solution.


Viewing all articles
Browse latest Browse all 531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>