daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest May 16th, 2018 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {- successively select elements from xs and remove one in each result list -}
  2.  
  3. import List
  4.  
  5. removeEach :: [a] -> [[a]]
  6. removeEach xs =
  7.    zipWith (++) (List.inits xs) (tail (List.tails xs))
  8.  
  9. alternate :: (Num a) => [a] -> [a]
  10. alternate = zipWith id (cycle [id, negate])
  11.  
  12. det :: (Num a) => [[a]] -> a
  13. det [] = 1
  14. det m  = sum (alternate
  15.                  (zipWith (*) (map head m)
  16.                      (map det (removeEach (map tail m)))))
RAW Paste Data
Top