Get element

Description

Finding element in list

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

Download

Program source code: get_element.pl

Listing

znajdz(_, [], _) :- !, fail.
znajdz(1, [X|_], X) :- !.
znajdz(N, [_|O], X) :- M is N-1, znajdz(M, O, X).
 
test :- znajdz(3, [11, 34, 51, 17, 29], X).

Comments

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