Skip to content

Instantly share code, notes, and snippets.

-- splitWith even [0,1,3,5,0,0,7,7,0,0] >>> [[1,3,5], [7,7]]
splitWith :: (a -> Bool) -> [a] -> [[a]]
splitWith f list = splitWithIter f ansl [] list
splitWithIter :: (a -> Bool) -> ([[a]] -> a -> [[a]]) -> [[a]] -> [a] -> [[a]]
splitWithIter _ _ xs [] = xs
splitWithIter f o xs (l:ls)
| f l = splitWithIter f ansl xs ls
| otherwise = splitWithIter f atlsl (o xs l) ls
(def players
[{:id 1 :health 100} {:id 2 :health 90}])
(def game
{:players players})
(def current-game
(atom game))
(defn kill-player
(def burton)
burton ; Le Var Burton!