What’s the difference between “equal (=)” and “identical (==)” in ocaml?

I don’t know exactly how x.equals(y) works in Java. If it does a “deep” comparison, then the analogy is pretty close. One thing to be careful of is that physical equality is a slippery concept in OCaml (and functional languages in general). The compiler and runtime system are going to move values around, and may … Read more

I just don’t get continuations!

Imagine if every single line in your program was a separate function. Each accepts, as a parameter, the next line/function to execute. Using this model, you can “pause” execution at any line and continue it later. You can also do inventive things like temporarily hop up the execution stack to retrieve a value, or save … Read more

What is the most minimal functional programming language?

It depends on what you mean by minimal. To start with, the ancestor of functional languages is, first and foremost, mathematical logic. The computational use of certain logics came after the fact. In a sense, many mathematical systems (the cores of which are usually quite minimal) could be called functional languages. But I doubt that’s … Read more

What are the alternative of monads to use IO in pure functional programming?

What alternatives are there to monads for I/O in a pure functional language? I’m aware of two alternatives in the literature: One is a so-called linear type system. The idea is that a value of linear type must be used exactly one time: you can’t ignore it, and you can’t use it twice. With this … Read more

Learning functional/Clojure programming – practical exercises? [closed]

4clojure was launched recently. It takes a lot of inspiration from Functional Koans, and several of the puzzles from 99 Lisp Problems; but it improves on both by providing a learning experience for which you need only your browser. Problems vary in difficulty from language tutorials like What is the second element of this list? … Read more

SOLID for functional programming

As far as I know (I’m no expert), SOLID principles do not tell anything about state. They should be applicable as well in a functional programming languages. They’re more advice about how to achieve modularity. Some of them are rather obvious or at least well-known. Single-responsibility is the UNIX principle “do one thing and do … Read more

What is the “pin” operator for, and are Elixir variables mutable?

The data in Elixir is still immutable, but there are couple of shorthands, that let you type less or don’t worry about finding new names. In Erlang, you could often see code like this: SortedList = sort(List), FilteredList = filter(SortedList), List3 = do_something_with(FilteredList), List4 = another_thing_with(List3) In Elixir, you could just write: list = sort(list) … Read more

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