While many functional/haskell paradigms don’t translate, there are a few techniques that JS can benefit from.
QUnit is especially useful for regression testing:…
Although Erlang leaves us with a lot of work to do, it still provided a few solutions. One of these is the concept of distributed OTP applications. Distributed OTP applications, or just distributed applications when in the context of OTP, allow to define takeover and failover mechanisms. We’ll see what that means, how that works, and write a little demo app to go with it.
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
I decided to approach this problem in a number of different languages.
var sum = 0; for (i =...
Consider the following function in Erlang that calculates the Nth Fibonacci number.
fib(0) -> 0; %% Base case 0.
fib(1) -> 1; %% Base case 1.
fib(N) when N > 0 -> fib(N - 1) + fib(N - 2).
Now notice how long running
Something important to understand is…
Why functional is better? So many reasons, one comes here: Programming languages are not made for computers, they are for humans to formulate generic solutions computers can solve faster in the details. The imperative style formulates the steps the computer has to follow, the functional style formulates the generic solution as such. Imperative style wants you to act like a machine, functional style allows you to think like a human.
Not only does creating a DSL make querying easy (particularly with complex conditions), but it also insulates your application from change in a few important ways. Especially in the initial, exploratory stages of a project, it is common to change and evolve a data schema, and NoSQL environments make this very simple. Using a DSL will shield your code from these changes; you only need to change the DSL “atoms” that the schema change affects.
In case you missed it, Foursquare open sourced they type-safe Scala DSL for MongoDB.
Original title and link: Creating a Query DSL Using Clojure and MongoDB ( ©myNoSQL)
I learned lisp and functional programming on Clojure a couple of years ago, but I’m not keen on the JVM, particularly the memory consumption, so I dropped it, and reverted to haXe, targetting Js and nodejs with my type sigs; coding in a…
cool link collection!