I have a few questions about Haskell — Tail Recursion, Varibles and Functions, and Immutable Varibles.


I have a few questions about Haskell — Tail Recursion, Varibles and Functions, and Immutable Varibles.

For the last few days I have been messing with functional programming, mostly in Haskell. And I have a few questions Haskell does not have loops, instead it uses tail recursion. But isn't standard looping better than tail recursion because there is no chance for a stack overflow. I also would make the case that a 'while' loop in C/C++ reads better than tail recursion. Variables are functions in haskell that immediately return a value. What is the advantage of doing this rather than making functions expressions like in ocaml (let add = fun x y -> x + y;; VS. add x y = x + y) and using standard variables. Why is everything immutable? I actually find it quite useful to be able to manipulate the value of something. So what is the philosophical (and practical) reason for making everything immutable.

Submitted July 17, 2017 at 05:59AM by bashisbest
via reddit http://ift.tt/2t86gJs

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s