Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
aminit
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
by
aminit
12y ago
Your examples are a little misleading. // Imperative: (essence of it) x = 0; x = x + 1; y = x; // Procedural: x = 0; inc(x); return x; // Functional: return inc(x); // Declarative: select x + 1;
2.
▲
by
aminit
12y ago
Your examples are a little misleading. // Imperative: (essence of it) x = 0; x = x + 1; return x; // Procedural x = 0; inc(x); return x; // Functional return inc(x); // declarative select x + 1; --- M
3.
▲
by
aminit
12y ago
Your examples are a little misleading. // Imperative: (essence of it) x = 0; x = x + 1; return x; // Procedural x = 0; inc(x); return x; // Functional return inc(x); // declarative select x + 1; --- M
4.
▲
by
aminit
12y ago
I exaggerated a little with this randomness. Let me explain: Given the same input Prolog program and imperative (Pascal?) one will give the same results. Because Prolog is imperative. Non-imparative languages give estimated results (actuall
5.
▲
by
aminit
12y ago
Prolog functions are a little more advanced 'if' statements. Flow of the execution is always the same. Data may be processed in a different order, but the rest is purely imperative. Logic never changes.
6.
▲
by
aminit
12y ago
Which language is not imperative then? The only program writtten in non-imperative language I can think of would return random values (of random type, also not known to mankind, including total destruction and creation of life) and crashed