~harrison-rt/sapidlib/fluffos

« back to all changes in this revision

Viewing changes to doc/efuns/arrays/allocate.3

  • Committer: Yucong Sun
  • Author(s): Carl Lucas
  • Date: 2017-10-20 02:52:35 UTC
  • Revision ID: git-v1:97d03a5b286dcc01bc12e868820cbe280ee86286
update documentation for allocate() efun (#399)

* update documentation for allocate() efun

* typo fix in allocate man file

* fix signature in allocate man page

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
allocate() - allocate an array
6
6
 
7
7
.SH SYNOPSIS
8
 
mixed *allocate( int size );
 
8
varargs mixed *allocate( int size, void | mixed value );
9
9
 
10
10
.SH DESCRIPTION
11
11
Allocate an array of <size> elements.  The number of elements must be >= 0
12
12
and not bigger than a system maximum (usually ~10000).  All elements are
13
 
initialized to 0.
 
13
initialized to 0 by default.
 
14
 
 
15
If the optional second argument is provided, the values are initialized to
 
16
that argument, unless the second argument is a functional. In that case, the
 
17
functional will be evaluated for each array element, with the first argument
 
18
passed to the functional being the number of the array element.
 
19
 
 
20
Example: allocate( 5, (: $1 + 3 :) ) => ({ 3, 4, 5, 6, 7 })
14
21
 
15
22
.SH SEE ALSO
16
23
sizeof(3), allocate_mapping(3)