A simple Prolog interpreter written with javascript (ECMAScript5).
helper functions to fold (reduce) trees