
Hi all! I'm new to Haskell... absolutely new. I need some practice, but little problem seems to me like unresolvable... Is there some tutorial of "Exercise, set of resolutions" pairs type? My english is very bat, so there is it in a picture: Exercise 1: hello world Hint: use 'putStrLn' Resolution 1.1 Resolution 1.2 Exercise 2: write functions 'max_num', 'solve_quad_equation', 'reverse_ary' Hint: (Explanation of some technics) Res... Excercise 3: Use do-notation to reverse word in a line read from stdin Hint: Use Exercise 2... (Explain how 'do' works and what to do in common error sitations) So, in a word: I need a tutorial for dummies Now, my current problem is: my program for solving quadratic equation won't compile... import System solve_qe :: Maybe (Double, Double, Double) -> Maybe (Double, Double) solve_qe Nothing = Nothing solve_qe (a, b, c) | d >= 0 = Just ((-b + (sqrt d)) / (2 * a), (-b - (sqrt d)) / (2 * a)) | otherwise = Nothing where d = b^2 - 4*a*c evalArgs :: [String] -> Maybe (Double, Double, Double) evalArgs (a:b:c:[]) = (read a, read b, read c) evalArgs _ = Nothing main = do args <- getArgs print (solve_qe (evalArgs args))

So, in a word: I need a tutorial for dummies
I don't know of any tutorials like you have described. Perhaps someone else does?
Now, my current problem is: my program for solving quadratic equation won't compile...
You left out some 'Just' constructors. import System solve_qe :: Maybe (Double, Double, Double) -> Maybe (Double, Double) solve_qe Nothing = Nothing --solve_qe (a, b, c) solve_qe (Just (a, b, c)) | d >= 0 = Just ((-b + (sqrt d)) / (2 * a), (-b - (sqrt d)) / (2 * a)) | otherwise = Nothing where d = b^2 - 4*a*c evalArgs :: [String] -> Maybe (Double, Double, Double) --evalArgs (a:b:c:[]) = (read a, read b, read c) evalArgs (a:b:c:[]) = Just (read a, read b, read c) evalArgs _ = Nothing main = do args <- getArgs print (solve_qe (evalArgs args))

"M'G" == Matej 'Yin' Gagyi
writes:
M'G> Hi all! M'G> I'm new to Haskell... absolutely new. I need some practice, but little M'G> problem seems to me like unresolvable... Is there some tutorial of M'G> "Exercise, set of resolutions" pairs type? Tutorial from http://www.isi.edu/~hdaume/htut/ has set of exercises after each chapter. It was probably the best tutorial on Haskell I tried when I started learning Haskell a couple months ago. -- Ilya Martynov, ilya@iponweb.net CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org
participants (3)
-
Ilya Martynov
-
Matej 'Yin' Gagyi
-
robert dockins