Algosim documentation: last

last

Returns the last or the N last elements of an ordered container.

Syntax

The returned value is an lvalue.

Description

Examples

sort(frequencies(compute(RandomInt(1000000)^2, n, 1, 1000000) @ digits @ last))
(0, 99581)
(1, 200067)
(4, 200294)
(5, 99928)
(6, 200237)
(9, 199893)
Alice ≔ ExampleData("Alice in Wonderland") \ 50
ALICE’S ADVENTURES IN WONDERLAND

Lewis Carroll
…
sort(frequencies(words(Alice) @ characters @ last @ UpperCase))
(A, 679)
(B, 5)
(C, 8)
(D, 3207)
(E, 5732)
(F, 836)
(G, 1018)
(H, 658)
(I, 415)
(K, 379)
(L, 671)
(M, 332)
(N, 1791)
(O, 1314)
(P, 209)
(Q, 1)
(R, 1504)
(S, 2211)
(T, 3266)
(U, 363)
(V, 2)
(W, 356)
(X, 15)
(Y, 1416)
last(ColorGradient(1, 10, "white", "black"), 3)
rgba(0.224, 0.224, 0.224, 1.000)
rgba(0.110, 0.110, 0.110, 1.000)
rgba(0.000, 0.000, 0.000, 1.000)

See also