Slide 7
Slide 7 text
Top-level
Programming
Paradigms
Imperative Functional Logic
These are the “three kings”. Any other
paradigms are adapted inside the existing
ones. Procedural programming, for example,
assumes the use of procedures as
opposed to jumps - but it makes sense
only within the imperative paradigm.
Event driven paradigm, on the other side,
assumes programming responses to events
- but these have to be expressed in either
imperative, functional, or logical way.
var line := readLine();
var x := parseInt(line);
var x2 := x*x;
printLine(x2);
pow2 :: Int -> Int
pow2 x = x*x
pow4 :: Int -> Int
pow4 = pow2 . pow2
higher(A, B) :-
higher(A, C),
higher(C, B).
higher(tom, sue).
higher(sue, jenny).
? higher(X, jenny)