Skip to content

Instantly share code, notes, and snippets.

@verus
Created February 1, 2012 08:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save verus/1715972 to your computer and use it in GitHub Desktop.
Save verus/1715972 to your computer and use it in GitHub Desktop.
Wavelet transform in Haskell
import System.Environment
haar:: [Int] -> [Int]
haar l = aux l [] []
where aux [s] [] d = s : d
aux [] s d = aux s [] d
aux (h1:h2:t) s d = aux t ((h1 + h2) : s) ((h1 - h2) : d)
aux _ _ _ = []
array = [2, -3]
main::IO ()
main = putStrLn $ show $ haar(array)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment