import System.Environment
import Data.Char
main = do
arg:_ <- getArgs
putStrLn (arg ++ " is " ++ (result arg))
where result arg = if check arg then "correct" else "incorrect"
check arg = dotOrDigit `all` arg && oneOrZeroDots arg
dotOrDigit = (`elem` ['0'..'9'] ++ ['.'])
oneOrZeroDots = (<=1) . length . (filter ('.'==))
As you might have realized, I started to learn Haskell. One of the most fun things to do in any programming language is creating some kind of audible side effects with a program. Already back in the days when I started programming, I always played around with audio when toying around with a new language. I have found a wonderful set of lecture slides about haskell and multimedia programming, called school of expression. Inspired by the slides about functional music I implemented a little song. Ahh ... and yes it is intended to sound slightly strange . I used the synthesis toolkit to transform the music to real noise, simply by piping skini message to std-out. I used this command line to achieve the results audible in the table: sven@hhi1214a:~/Mukke$ ghc -o test1 test1.hs && ./test1 | stk-demo Plucked -n 16 -or -ip Sound samples: Plucked play Clarinet play Whistle(attention very crazy!) play As always the source... stueck = anfang :+: mitte :+: ende anfang = groovy :+: (Trans ...
Comments