count function
How many elements of a list equal a value.
How to write it
count(list, x)
- list
- The list. Takes a list.
- x
- The value to count. Takes an expression.
Examples
count([1, 2, 1], 1)In the solver,
Open in the solvercount([1, 2, 1], 1)gives2.
Related functions
- dimensions
The size of a list or a matrix, level by level.
- constant_array
A list of copies of a value.
- drop
A list without its first elements.
- complement
The elements of a list that are in none of the others.
- first
The first element of a list.
- apply
Replace the head of an expression, or the brackets of a list, with a function.