List linking 3

Description

Linking two lists of the same length.

Source: Learn prolog now!, 2001, (course available on-line)

Download

Program source code: list_linking_3.pl

Listing

combine1([],[],[]).
combine1([H1|T1],[H2|T2],[H1, H2|T3]):-combine1(T1,T2,T3).
 
combine2([],[],[]).
combine2([H1|T1],[H2|T2],[[H1,H2]|T3]):-combine2(T1,T2,T3).
 
combine3([],[],[]).
combine3([H1|T1],[H2|T2],[join(H1,H2)|T3]):-combine3(T1,T2,T3).

Comments

pl/prolog/pllib/list_linking_3.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