Predefined function reference

list_compose

A reference entry for list_compose

Predefined function · list

list_compose (integer count, function composer) ⇒ list

Produces a list containing a specified number of values created from the composer function.

Examples

This function can speed up development of complex lists, including the sequence of doubling numbers:

YASS
$l = list_compose(100, function($i, $previous) {
  if ($previous == null)
    return 1
  else
    return $previous * 2
  end if
})