1
0
Fork 0
mirror of https://github.com/emacs-twist/org-babel.git synced 2024-12-14 11:07:30 +00:00
org-babel/nix/splitWith.nix
2021-12-03 22:44:34 +09:00

11 lines
285 B
Nix

pred:
with builtins;
let
go = before: rest:
if (length rest == 0)
then { inherit before; sep = null; after = [ ]; }
else if pred (head rest)
then { inherit before; sep = head rest; after = tail rest; }
else (go (before ++ [ (head rest) ]) (tail rest));
in
go [ ]