focus expression text field at startup -> version 1.2
[LeanCalc.git] / help / size
1 NAME
2     size - number of elements in value
3
4 SYNOPSIS
5     size(x)
6
7 TYPES
8     x           any
9
10     return      integer
11
12 DESCRIPTION
13     For the different types of value x may have, size(x) is defined as follows:
14
15         null            0
16         real number     1
17         complex number  1
18         string          length of string (not counding the trailing \0)
19         matrix          number of elements
20         list            number of members
21         association     number of (elements, value) pairs
22         object          value returned by xx_size(x) if x of type xx
23         file            length of the file in octets
24         rand state      1
25         random state    1
26         config state    1
27         hash state      1
28         block           numer of octets of data it currently holds
29         octet           1
30         named block     numer of octets of data it currently holds
31
32 EXAMPLE
33     > print size(null()), size(3), size(2 - 7i), size("abc")
34     0 1 1 1
35
36     > mat M[2,3]
37     > print size(M), size(list()), size(list(2,3,4))
38     6 0 3
39
40     > A = assoc()
41     > A[1] = 3, A[1,2] = 6, A["three"] = 5
42     > print size(A)
43     3
44
45     > obj point {x,y}
46     > obj point P = {4,-5}
47     > define point_size(a) = abs(a.x) + abs(a.y)
48     > print size(P)
49     9
50
51 LIMITS
52     none
53
54 LINK LIBRARY
55     none
56
57 SEE ALSO
58     list, mat, assoc, obj, sizeof, memsize
59