Make It Better


Make It Better

We’re working through Seven Languages in Seven Weeks in our lunch-and-learn book club at work. I just finished the material on Prolog.

This is a language I really want to like, but it’s frustrating.

Take for example the Fibonacci sequence. Why do I have to write

fib(N,F) :-
   succ(N1,N), succ(N2,N1), fib(N1,F1), fib(N2,F2),

instead of

F(n) = F(n-1) + F(n-2)?

(Above code is from

Both expressions are recursive. One’s obvious, one isn’t.

There are classes of problems (multiple constraints, expert systems, etc.) for which Prolog is well-suited. Some of its features have been incorporated into modern languages (particularly functional languages such as F#), but only some. We need more easy-to-use declarative models - look what LINQ did for C#.

Programming languages are still overly difficult to learn and insufficiently expressive. Many are filled with “noise” that detracts from the content. Most are mired in our imperative C-based past.

Prolog is effectively an evolutionary dead-end, and it shouldn’t be. But it, and our other languages, need to be better.

Update - April 4, 2012

I’ve since seen a cleaner way to do this in Prolog; the above example may be dated.

Your Host:
Copyright © 2000-2013 by William Sorensen. All rights reserved.