ihb2032/MoonFrame/expr does not have a README file
pub struct Expr {
// private fields
}pub struct WhenThen {
// private fields
}pub struct WhenThenElse {
// private fields
}test "col: renders as a reference" {
inspect(col("qty").to_string(), content="col(qty)")
}test "cols: shorthand for the reference list" {
debug_inspect(
cols(["a", "b"]).map(e => e.to_string()),
content="[\"col(a)\", \"col(b)\"]",
)
}test "lit: embeds any Scalar" {
inspect(lit(@types.Scalar::Int(3L)).to_string(), content="3")
}test "lit_bool: renders bare" {
inspect(lit_bool(true).to_string(), content="true")
}test "lit_float: whole values keep their point" {
inspect(lit_float(2.0).to_string(), content="2.0")
}test "lit_int: renders bare" {
inspect(lit_int(5L).to_string(), content="5")
}test "lit_series: names its column after the series" {
let s = @series.Series::from_ints("score", [1, 2])
inspect(lit_series(s).output_name(), content="score")
}test "lit_str: renders quoted" {
inspect(lit_str("ab").to_string(), content="\"ab\"")
}test "map_many: drops to a host closure" {
let total = map_many(label="total", [col("a"), col("b")], cells => {
@types.Scalar::Int(cells[0].as_int() + cells[1].as_int())
})
inspect(total.to_string(), content="map(\"total\", [col(a), col(b)])")
}test "when: the chain is the only construction route" {
let tagged = when(col("qty").gt(lit_int(5)))
.then(lit_str("big"))
.otherwise(lit_str("small"))
inspect(
tagged.to_string(),
content="when((col(qty) > 5)).then(\"big\").otherwise(\"small\")",
)
}Install
Download zipA lightweight DataFrame and tabular-data library for MoonBit
Dependencies