Programming

9 thoughts
last posted July 1, 2015, 3:08 p.m.

6 later thoughts

0

There is also a lot of beauty in the polymorphic defined recursive functions I first saw in Erlang:

-module(fib).
-export([fib/1]).

fib(1) -> 1;
fib(2) -> 1;
fib(N) -> fib(N - 2) + fib(N - 1).

Similarily, there is also a lot of beautyness when we consider logical programming and this substitution and unification stuff in Prolog. I first saw this, when I learned about contraint satisfaction problems.

append([], X, X).
append([X|XS], YS, [X|ZS]) :- append(XS, YS, ZS).

% ?- append([], [1, 2], [1, 2]).
% true.

% ?- append([6], [1, 2], [6, 1, 2]).
% true.

% ?- append(X, [1, 2], [6, 1, 2]).
% X = [6] ;

  • Petra Hofstedt, Armin Wolf (2007): "Einführung in die Constraint-Programmierung", Springer

2 earlier thoughts