This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def players | |
[{:id 1 :health 100} {:id 2 :health 90}]) | |
(def game | |
{:players players}) | |
(def current-game | |
(atom game)) | |
(defn kill-player |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def burton) | |
burton ; Le Var Burton! |
OlderNewer