i1 = apply(1 .. 5, i->i^2) o1 = 1,4,9,16,25 o1 : Sequence
i2 = apply({1,3,5,7}, i->i^2) o2 = {1,9,25,49} o2 : List
apply(v,w,f) -- produces, from lists or sequences v and w, a list z in which the i-th element w_i is obtained by evaluating f(v_i,w_i). If v and w are lists of the same class, then the result is also of that class. If v and w are sequences, then so is the result.
i3 = apply(1 .. 5, a .. e, identity) o3 = (1,a),(2,b),(3,c),(4,d),(5,e) o3 : Sequence
i4 = apply({1,3,5,7}, i->i^2) o4 = {1,9,25,49} o4 : List
apply(n,f) -- equivalent to apply(list (0 .. n-1),f), for an integer n.
See also scan, select, any, all, and member.
apply(x,f) -- produces a new hash table y from an hash table x by applying the function f to each of the values of x. This means that if x#k === v then y#k === f(v). If f(v) is null, then no entry is made in y.
See also @.
Go to main index.
Go to concepts index.