Spis treści

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