To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE/YASS documentationlist_compose

list_compose (integer count, function composer) ⇒ list

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

First available: Version 1.10.1


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

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

There are no comments on this page.

New comment
Code previewClose
Feedback 👍
Comments are sent via email to me.