Re: [Haskell-cafe] Learning C after Haskell

Thanks, Minh. So are things like recursion and memory sharing typically out
the window?
Also, I don't see how thinking about type classes will help, without the
benefits of polymorphism.
-Chad
---------- Forwarded message ----------
From: minh thu
Ok, so I'm doing things somewhat backward. I've been using Haskell for a while now, whenever I get a chance to. But in order to become more involved in high-performance computing projects at my work, I need to learn C.
I've heard a lot of people say that experience in Haskell can improve one's abilities in other languages, but I also wonder how different the C "way of doing things" is different from Haskell's.
My question is, as I learn C, are there any particular Haskell concepts I should keep in the back of my mind, or is it better to approach C from scratch?
Thanks in advance!
Preparing for a foot-shooting, Chad
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Chad Scherrer "Time flies like an arrow; fruit flies like a banana" -- Groucho Marx

Thanks, Minh. So are things like recursion and memory sharing typically out the window?
Recursion works in C, but every function call pushes stack, so recursive depth is limited by RAM (compare to tail call optimization in many functional programming languages where the stack frame is reused if code is written iteratively with an accumulator). Most of the time for performance (and to be idiomatic) in C you will just write for and while loops and modify state in place. Welcom to C. Jared. -- http://www.updike.org/~jared/ reverse ")-:"

On Mon, 2006-06-12 at 14:48 -0700, Jared Updike wrote:
Thanks, Minh. So are things like recursion and memory sharing typically out the window?
Recursion works in C, but every function call pushes stack, so recursive depth is limited by RAM (compare to tail call optimization in many functional programming languages where the stack frame is reused if code is written iteratively with an accumulator). Most of the time for performance (and to be idiomatic) in C you will just write for and while loops and modify state in place. Welcom to C.
GCC can do a limited tail-call optimisation these days. It covers the obvious self tail call case and I believe some less trivial cases but it's not as comprehensive as in a typical functional language compiler. Duncan
participants (3)
-
Chad Scherrer
-
Duncan Coutts
-
Jared Updike