Browse Source

Project 16

completed
Craige McWhirter 7 months ago
parent
commit
1a0d1cc646
Signed by: craige GPG Key ID: 7DBA9F5689EFB6AA
  1. 10
      dropEvery.hs

10
dropEvery.hs

@ -0,0 +1,10 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-- Drop every N'th element from a list.
dropEvery :: [a] -> Int -> [a]
dropEvery xs n
| length xs < n = xs
| otherwise = take (n-1) xs ++ dropEvery (drop n xs) n
Loading…
Cancel
Save