Ja, REST is CDR, basically (and FIRST is CAR). The Common Lisp HyperSpec says “rest is often preferred stylistically over cdr when the argument is to being subjectively viewed as a list rather than as a cons.”

The similarities between Prolog and Erlang are to be expected, of course, given Erlang’s history as starting out as a hacked up concurrent Prolog.

It’s the lack of the notion of a function that returns something that makes my implementation look so yuck. It’s pretty much a straight-up translation of the Erlang version.

And Danie, kudos for the clever insight! I spent too long thinking how to do the obvious and tedious iterate-over-list way of summing before realising how your Haskell implementation worked.