Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {- successively select elements from xs and remove one in each result list -}
- import List
- removeEach :: [a] -> [[a]]
- removeEach xs =
- zipWith (++) (List.inits xs) (tail (List.tails xs))
- alternate :: (Num a) => [a] -> [a]
- alternate = zipWith id (cycle [id, negate])
- det :: (Num a) => [[a]] -> a
- det [] = 1
- det m = sum (alternate
- (zipWith (*) (map head m)
- (map det (removeEach (map tail m)))))
Add Comment
Please, Sign In to add comment