diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-10-24 02:47:52 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-10-24 03:35:40 +0000 |
| commit | 1ab69bfb730ebad450024918a43580e4aeb0d56d (patch) | |
| tree | a215ae17dfaef1fd016df05316742d311e001884 /lib/Utilities.ml | |
| parent | eb7ad043880a0a846864c7b648e59c2a29610c51 (diff) | |
| download | RNT-1ab69bfb730ebad450024918a43580e4aeb0d56d.tar.gz RNT-1ab69bfb730ebad450024918a43580e4aeb0d56d.zip | |
Steal a `filter_map` implementation from Karuta
Diffstat (limited to 'lib/Utilities.ml')
| -rw-r--r-- | lib/Utilities.ml | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Utilities.ml b/lib/Utilities.ml index 8f278a3..8b6b08e 100644 --- a/lib/Utilities.ml +++ b/lib/Utilities.ml @@ -86,6 +86,12 @@ module FingerTree = struct let join ss sep = BatFingerTree.print ~first:"" ~last:"" ~sep BatIO.nwrite |> Fun.flip BatIO.to_string ss + + let filter_map f = + BatFingerTree.fold_left + (fun acc elem -> + match f elem with None -> acc | Some result -> BatFingerTree.snoc acc result) + BatFingerTree.empty end module Atomic = struct |
