Why is the use of Maybe/Option not so pervasive in Clojure? [closed]

Clojure is not statically typed, so doesn’t need the strict this/that/whatever type declarations that are necessary in haskell (and, I gather, Scala). If you want to return a string, you return a string; if you return nil instead, that’s okay too. “Functional” does not correspond exactly to “strict compile-time typing”. They are orthogonal concepts, and … Read more

How do I implement graphs and graph algorithms in a functional programming language?

You might check out how Martin Erwig’s Haskell functional graph library does things. For instance, its shortest-path functions are all pure, and you can see the source code for how it’s implemented. Another option, like fmark mentioned, is to use an abstraction which allows you to implement pure functions in terms of state. He mentions … Read more

What are the performance impacts of ‘functional’ Rust?

TL;DR A functional implementation can be faster than your original procedural implementation, in certain cases. Why is the functional style so much slower than the imperative style? Is there some problem with the functional implementation which is causing such a huge slowdown? As Matthieu M. already pointed out, the important thing to note is that … Read more

Why is the raising of an exception a side effect?

Purity is only violated if you observe the exception, and make a decision based on it that changes the control flow. Actually throwing an exception value is referentially transparent — it is semantically equivalent to non-termination or other so-called bottom values. If a (pure) function is not total, then it evaluates to a bottom value. … Read more

Are there problems that cannot be written using tail recursion?

Yes, actually you can take some code and convert every function call—and every return—into a tail call. What you end up with is called continuation-passing style, or CPS. For example, here’s a function containing two recursive calls: (define (count-tree t) (if (pair? t) (+ (count-tree (car t)) (count-tree (cdr t))) 1)) And here’s how it … Read more

What are the core concepts in functional programming?

There’s no community consensus on what are the essential concepts in functional programming. In Why Functional Programming Matters (PDF), John Hughes argues that they are higher-order functions and lazy evaluation. In Wearing the Hair Shirt: A Retrospective on Haskell, Simon Peyton Jones says the real essential is not laziness but purity. Richard Bird would agree. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)