Module Talon.Row

Row-wise computations using an applicative interface.

Applicative interface

val return : 'a -> 'a row

return x is a computation that produces x for every row.

val apply : ('a -> 'b) row -> 'a row -> 'b row

apply f x is the computation that applies f to x for each row.

val map : 'a row -> f:('a -> 'b) -> 'b row

map x ~f is the computation that applies f to each row's value from x.

val map2 : 'a row -> 'b row -> f:('a -> 'b -> 'c) -> 'c row

map2 x y ~f is the computation that applies f to corresponding values from x and y.

val map3 : 'a row -> 'b row -> 'c row -> f:('a -> 'b -> 'c -> 'd) -> 'd row

map3 x y z ~f combines three computations with f.

val both : 'a row -> 'b row -> ('a * 'b) row

both x y is the computation that pairs values from x and y.

Column accessors

val float32 : string -> float row

float32 name extracts float32 values from column name.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not float32 type.

val float64 : string -> float row

float64 name extracts float64 values from column name.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not float64 type.

val int32 : string -> int32 row

int32 name extracts int32 values from column name.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not int32 type.

val int64 : string -> int64 row

int64 name extracts int64 values from column name.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not int64 type.

val string : string -> string row

string name extracts string values from column name.

Note. Null values are converted to empty strings.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not string type.

val bool : string -> bool row

bool name extracts boolean values from column name.

Note. Null values are converted to false.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not boolean type.

val number : string -> float row

number name extracts numeric values from column name, coercing all numeric types to float.

Note. Null values become nan.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not a numeric type.

Row information

val index : int row

index is the current row index (0-based).

val sequence : 'a row list -> 'a list row

sequence xs is the computation that collects values from all computations in xs into a list.

val fold_list : 'a row list -> init:'b -> f:('b -> 'a -> 'b) -> 'b row

fold_list xs ~init ~f folds f over the computations in xs without creating an intermediate list.

Option-based accessors

These accessors return None for null values instead of using placeholder values. Use these when you need to distinguish genuine values from missing data.

val float32_opt : string -> float option row

float32_opt name extracts float32 values as options from column name. None for null values.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not float32 type.

val float64_opt : string -> float option row

float64_opt name extracts float64 values as options from column name. None for null values.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not float64 type.

val int32_opt : string -> int32 option row

int32_opt name extracts int32 values as options from column name. None for null values.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not int32 type.

val int64_opt : string -> int64 option row

int64_opt name extracts int64 values as options from column name. None for null values.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not int64 type.

val string_opt : string -> string option row

string_opt name extracts string values as options from column name. None for null values.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not string type.

val bool_opt : string -> bool option row

bool_opt name extracts boolean values as options from column name. None for null values.

Raises Not_found if the column does not exist. Raises Invalid_argument if the column is not boolean type.