Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site inmet Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!ima!inmet!bhyde From: bhyde@inmet.UUCP Newsgroups: net.lang.prolog Subject: Reduce? Message-ID: <5300002@inmet> Date: Fri, 23-May-86 21:43:00 EDT Article-I.D.: inmet.5300002 Posted: Fri May 23 21:43:00 1986 Date-Received: Sun, 25-May-86 18:25:47 EDT Lines: 21 Nf-ID: #N:inmet:5300002:000:571 Nf-From: inmet.UUCP!bhyde May 23 21:43:00 1986 Consider this. : plus_reduce([1,2,3],Result)? N = 6. : Not too hard to write. But what if I want to write a more general reduce like this one: : reduce( 0, % Intial value Left, Right, % Input variables in the subexpressions InnerResult is Left + Right, % The unit reduction. InnerResult, % Result of subexpressions. [1, 2, 3], Result )? N = 6. : I am unable to see how to write this (with out asserting a new clause during the execution). This is a very general function once you have it. Any ideas? - ben hyde, cambridge.