Skip to main content

contains

contains(
@llll ## required
@depth ## required
@mindepth 1
@maxdepth 1
) -> llll/null

Returns a summary of the data types contained in an llll. The return value is encoded as a bit field, with the following values:

  • 1: null
  • 2: integer
  • 4: rational
  • 8: double (float)
  • 16: symbol
  • 32: sublist
  • 256: pitch.

By default, only the contents of the root level are considered. This can be changed with the @mindepth and @maxdepth arguments.


Arguments

  • @llll [llll] (required)
  • @depth [int/llll/null] (required)
  • @mindepth [int] (default: 1)
  • @maxdepth [int] (default: 1)

Output

Summary of the data types contained in an llll. [llll/null]

warning

contains is a built-in function in the bell programming language and is not unique or exclusive to bellplay~. As such, contains will return null without raising an error if required arguments are not provided.


Usage

contains(1); ## 2
contains(1/2); ## 4
contains(1.1); ## 8
contains('a'); ## 16
contains('a' 1); ## 18
contains([1 2]); ## 32
contains([1 2] 'b') ## 48