A arrayish value is anything that represents an AnvlArray
or can be converted to one.
Specifically, these values are arrayish:
AnvlArray: a concrete array holding data on a device.R objects:
numeric(1)andlogical(1)which represent scalars.numericandlogicalR arrays.
Use is_arrayish() to check whether a value is arrayish.
The group words the parameter descriptions use are listed below;
dtypes gives the categories they are built from, and
default_dtypes() the default an R value materializes at.
Details
During jit(), GraphBox is also arrayish, but it is simply the
trace-time representation of an AnvlArray.
Data Type Vocabulary
Where a page says which data types an argument takes, it names a group of them with a single word:
any data type – all of them:
bool, the signed and unsigned integers, and the floats.numeric – signed integer, unsigned integer and float.
integer – signed and unsigned integer.
integerish – boolean and integer, signed or unsigned.
signed numeric – signed integer and float.
float – the whole float category:
f32andf64.boolean –
bool, the only member of its category.
Examples
# AnvlArray objects are arrayish
is_arrayish(nv_array(1:4))
#> [1] TRUE
# scalar R literals are arrayish by default
is_arrayish(1.5)
#> [1] TRUE
# R arrays are arrayish by default
is_arrayish(array(1.5))
#> [1] TRUE
# R arrays
is_arrayish(array(1:4), convert_ok = TRUE)
#> [1] TRUE
is_arrayish(array(1:4), convert_ok = FALSE)
#> [1] FALSE
# length 1 vectors
is_arrayish(1.5, convert_ok = FALSE)
#> [1] FALSE
is_arrayish(1.5, convert_ok = TRUE)
#> [1] TRUE