Archives for November, 2008

From foldl to difference lists

Sunday, November 9th, 2008

Most declarative languages have lists. Usually this lists are either a nil atom (empty list) or a cons (a couple whose second element is a list). It is easy to see how we can append things to the head of the list.
In my former article we explored lists and foldl. Indeed, it is clear that [...]

Declarative Programming, Programming, Prolog | No Comments

Accumulators and Foldl in declarative languages

Saturday, November 8th, 2008

Using accumulators in declarative programming is common. Basically it is possible to convert not tail recursive functions into tail recursive ones using an accumulator.
Consider a very simple procedure: sum numbers in a list. The naive implementation is:
naive_sum([]) ->
0;
naive_sum([H|T]) ->
H + naive_sum(T).
This one is not tail recursive. Every [...]

Declarative Programming, Erlang, Functional Programming, Haskell, Programming, Prolog | Comments Off

Extol of Declarativeness

Thursday, November 6th, 2008

Far too many programmers underestimate the beauty of declarative programming. This is something which cames from the industry: functional languages are traditionally under-employed and perceived as academic choices. In fact a lot of research has been done with Lisp and Prolog (mostly in U.S.A. and Europe respectively) in AI and formal languages fields.
However, declarative languages [...]

Declarative Programming, Erlang, Functional Programming, Haskell, Open Source and Free Software, Programming | No Comments

Do not program defensively. (Sure?)

Saturday, November 1st, 2008

How it is true that pragmatics matters in programming! That is to say, best practices in a given environment/platform may be bad practices in another. For example the following lines are quoted from Erlang’s Programming Rules as recommended from Ericsson:
A defensive program is one where the programmer does not “trust” the input data to the [...]

Declarative Programming, Erlang, Functional Programming, Programming | No Comments

Recent Posts

Blogroll

Siti amici

Misc

Recent Comments

Categories

Enrico Franchi graduated in Maths and Computer Science and is now studying for a Computet Science MSc (though because of italian bureaucracy that very course is to be cancelled).

RiK0's Tech Temple is using WP-Gravatar