summaryrefslogtreecommitdiff
path: root/prolog/problems/lists/max_2/common.py
blob: 73c39a2afbfeaaba9178828b5226dff67e6276da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# coding=utf-8

id = 109
group = 'lists'
number = 16
visible = True
facts = None

solution = '''\
max([X], X).
max([H|T], Max):-
  max(T, Max1),
  ( H > Max1, Max is H
    ;
    H =< Max1, Max is Max1 ).
'''