Sets sum

Description

Showing how to find sum of two sets

Source: PROLOG str. 190 Wydawnictwo PLJ Warszawa 1991 ISBN 83-85190-63-5

Download

Program source code: sets_sum.pl

Listing

suma([], X, X).
suma([X|R], Y, Z) :- member(X, Y), !, suma(R, Y, Z).
suma([X|R], Y, [X|Z]) :- suma(R, Y, Z).
 
test :- suma([1, 2, 3], [2, 4], C).

Comments

pl/prolog/pllib/sets_sum.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0