PreludeJS

Test de rendimiento

Operaciones sobre listas

map(function (it) { return it + 1; }, [1, 2, 3]) == []

concat(['a', 'b', 'c'], [1, 2, 3]) == []

filter(function (e) { return e % 2 == 0; }, [1, 2, 3, 4]) == []

head([1, 2, 3, 4]) == []

last([1, 2, 3, 4]) == []

tail([1, 2, 3, 4]) == []

init([1, 2, 3, 4]) == []

length([1, 2, 3, 4]) == []

reverse([1, 2, 3, 4]) == []

Plegados

foldl(function (ac, it) { return ac + it;}, 0, [1, 2, 3, 4]) ==

foldl1(function (ac, it) { return ac + it;}, [1, 2, 3, 4]) ==

foldr(function (ac, it) { return ac + it;}, 0, [1, 2, 3, 4]) ==

foldr1(function (ac, it) { return ac + it;}, [1, 2, 3, 4]) ==

Plegados especiales

and([true, false, true, true]) ==

or([true, false, true, true]) ==

any(function (e) { return e % 2 == 0; }, [1, 2, 3, 5]) ==

all(function (e) { return e % 2 == 0; }, [1, 3, 5, 7]) ==

sum([1, 3, 5, 7]) ==

product([1, 3, 5, 7]) ==

flatten([[1, 2], [3, 4], [5, 6]]) == []

maximum([1, 2, 3, 4]) ==

minimum([1, 2, 3, 4]) ==

Construyendo vectores

scanl(function (ac, it) { return ac + it; }, 0, [1, 2, 3, 4]) == []

scanl1(function (ac, it) { return ac + it; }, [1, 2, 3, 4]) == []

scanr(function (ac, it) { return ac + it; }, 0, [1, 2, 3, 4]) == []

scanr1(function (ac, it) { return ac + it; }, [1, 2, 3, 4]) == []

repeat('a') == [...]

replicate(10, 'a') == []

cycle([1, 2, 3]) == [...]

Sublistas

take(10, cycle("abc")) == []

drop(3, [1, 2, 3, 4, 5]) == []

splitAt(3, [1, 2, 3, 4, 5]) == []

takeWhile(function (it) { return it < 4; }, [1, 2, 3, 4, 5]) == []

dropWhile(function (it) { return it <= 2; }, [1, 2, 3, 4, 5]) == []

span(function (it) { return it <= 2; }, [1, 2, 3, 4, 5]) == []

unSpan(function (it) { return it > 2; }, [1, 2, 3, 4, 5]) == []

Buscando en vectores

elem(0, [1, 2, 3, 4, 5]) == []

notElem(0, [1, 2, 3, 4, 5]) == []

Comprimiendo y descomprimiendo vectores

zip("abcd", [1, 2, 3]) == []

zipN([1, 2, 3], "abcd", [5, 6, 7, 8 ,9]) == []

zip3("abcd", [1, 2, 3], "xyztu") == []

zipWith(function (x, y) { return x + y; }, [1, 2, 3], [4, 5, 6]) == []

zipWith3(function (x, y, z) { return x + y + z; }, [1, 2, 3], [4, 5, 6], "abcdef") == []

zipWithN(function (x, y, z, u) { return ((x + y) * z) + u; }, [1, 2, 3], [4, 5, 6], [7, 8, 9], "abcdef") == []

zipWithN2(function (x, y, z, u) { return ((x + y) * z) + u; }, [1, 2, 3], [4, 5, 6], [7, 8, 9], "abcdef") == []

unzip([['a', 1],['b', 2],['c', 3]]) == []

unzip3([['a', 1, 'x'],['b', 2, 'y'],['c', 3, 'z']]) == []

Otros juegos

map(length, ["a", "bc", "def"]) == []

foldl(function (ac) { return ac + 1;}, 0, [1, 2, 3, 4]) ==

foldr1(function (ac, it) { return ac + it; }, "abcde") == ""

Documentación

Estadísticas

Calculando estadísticas...