thmsaguiar/SeparateList
Function that separates a list into two lists, one will contain the highest values and the other smaller.
SeparateList
Linguagem: Prolog
The function separa is a recursive function that receives three lists (X, Y, Z) and one element (W). We determine the first list X, and the element W.
If the element contained in X is greater than or equal to W the same element will be contained in Y, and if the element is less than W it will be contained in Z.
Then the elements of Y will be greater than or equal to W, and the elements of Z will be smaller than W.
A função separa é uma função recursiva que recebe três listas(X,Y,Z) e um elemento(W). Determinamos a primeira lista X, e o elemento W. Se o elemento contido em X for maior ou igual que W o mesmo elemento será contido em Y, e se o elemento for menor que W será contido em Z. Logo os elementos de Y serão maiores ou iguais a W e os elementos de Z serão menores que W.