1
2
3
4
5
6
7
8
9
10
11
12
13
|
# coding=utf-8
name = 'pivoting/4'
slug = 'split a list according to the pivot'
description = '''\
<p><code>pivoting(P, L, S, G)</code>: the list <code>S</code> contains the elements of <code>L</code> <em>smaller or equal to</em> <code>P</code>, and the list <code>G</code> contains the elements of <code>L</code> <em>greater than</em> <code>P</code>. The order of elements in <code>S</code> and <code>G</code> should be the same as in <code>L</code>.</p>
<pre>
?- pivoting(4, [1,4,5,8,6,4,2], S, G).
S = [1,4,4,2], G = [5,8,6].
</pre>'''
hint = {}
|