Teledyne LeCroy Protocol Analyzers File-Based Decoding User Manual User Manual
Page 21
File-based Decoding User Manual
Chapter 4: Operators
LeCroy Corporation
15
List Operators
sizeof()
Number of
elements
Any
Integer
sizeof([1, 2, 3]) = 3
sizeof('0011223344') = 5
sizeof("string") = 6
sizeof(12) = 1
sizeof([1, [2, 3]]) = 2
*Note: the last example demonstrates that the
sizeof() operator returns the shallow count of a
complex list.
head()
Head
List
Any
head([1, 2, 3]) = 1
*Note: the Head of a list is the first item in the list.
tail()
Tail
List
List
tail([1, 2, 3]) = [2, 3]
*Note: the Tail of a list includes everything except
the Head.
first()
Returns the first
element of the list
and resets the list
iterator to the
beginning of the list
List
Any
list = [1, 2, 3];
for( item = first(list);
more(list); item = next(list) )
{
ProcessItem( item );
}
next()
Returns the next
element of the list
relative to the
previous position of
the list iterator
List
Any
list = [1, 2, 3];
for( item = first(list);
more(list); item = next(list) )
{
ProcessItem( item );
}
more()
Returns a non-zero
value if the list
iterator did not
reach the bounds
of the list
List
Integer
list = [1, 2, 3];
for( item = first(list);
more(list); item = next(list) )
{
ProcessItem( item );
}
last()
Returns the last
element of the list
and resets the
position of the list
iterator to the end
of the list
List
Any
list = [1, 2, 3];
for( item = last(list);
more(list); item = prev(list) )
{
ProcessItem( item );
}
prev()
Returns the
previous element in
the list relative to
the previous
position of the list
iterator
List
Any
list = [1, 2, 3];
for( item = last(list);
more(list); item = prev(list) )
{
ProcessItem( item );
}
Operator
Symbol
Description
Operand Types
Result
Types Examples
Table 4.2 Operators (Continued)