Haskell
I'm Currently learning Haskell, Haskell is a pure functional language I am working my way through two books on Haskell the first is Learn you a Haskell for Great Good, a humorous title but very good the second is Real World Haskell, Haskell despite it's pure approach has good I/O and can do windowed programming i.e. X11 coding using Monads, more on that after I get that far in the books. so far I have written a echo program:
-- file: ch04/Echo.hs
import System.Environment (getArgs)
main = mainWith
where mainWith = do
args <- getArgs
putStrLn (printargs args)
where printargs [] = []
printargs [x] = x
printargs (x:xs) = x ++ " " ++ printargs xs
I then reduced the above example to
-- file: ch04/Echo2.hs
import System.Environment (getArgs)
main = do
args <- getArgs
putStrLn (printargs args)
where printargs [] = []
printargs [x] = x
printargs (x:xs) = x ++ " " ++ printargs xs
and I just realised I can further reduce this to
-- file: ch04/Echo3.hs
import System.Environment (getArgs)
main = do
args <- getArgs
putStrLn (unwords args)
I have also done numerous examples more latter