Command: forallindexed

NEST HelpDesk Command Index NEST Quick Reference

Name:
 forallindexed - Call a procedure for each element of a list/string

Synopsis:
     [v1,...,vn] {f} forallindexed ->  f(0,v1),...,f(n-1,vn)

Parameters:
     [v1,...,vn] - list of n arbitrary objects or string
     {f}         - function which can operate on the elements of the
                   array. f is not required to return a specific number
		   of values.

Description:
     For each element of the input array, forallindexed calls f with
     two arguments, the element and its index within the list/string.
     forallindexed is similar to forall, only that the index of the
     element is also passed to the function f.

     Alternatives: Functions forallindexed_a for a list, forallindexed_s
     for a string (both undocumented) -> behaviour and synopsis are the same.

Examples:

   [(a) (b)]  {} forallindexed -> (a) 0 (b) 1

Author:
    Marc-Oliver Gewaltig

References:
 The Red Book

SeeAlso:Map MapIndexed Table forall NestList FoldList
Source:
 /home/abuild/rpmbuild/BUILD/nest-2.4.1/sli/slicontrol.cc

NEST HelpDesk Command Index NEST Quick Reference

© 2000-2010 The NEST Initiative