Knowing that:
[]
denotes an array
[A|B]
extracts the first element of the array in A
and the rest of the array in B
[X, Y] ++ [Z]
creates a concatenated array [X, Y, Z]
[ X || X <- [1, 2, 3, 4], X > 2]
returns the array [3, 4]
(read: create a array
with the following [1, 2, 3, 4]
values that are greater than 2)
What is the name of this algorithm?
bla([A|B]) -> bla([ X || X <- B, X < A]) ++ [A] ++ bla([ X || X <- B, X >= A]);
bla([]) -> [].