Skip to main content

BYNK_STRING_SRC

Constant BYNK_STRING_SRC 

Source
pub const BYNK_STRING_SRC: &str = "commons bynk.string {\n\t---\n\tConcatenates `parts` into one string, inserting `sep` between adjacent\n\telements. Returns the empty string for an empty list.\n\t---\n\tfn join(parts: List[String], sep: String) -> String {\n\t\tlet init: Option[String] = None\n\t\tparts.fold(init, (acc, p) => match acc {\n\t\t\tSome(s) => Some(s.concat(sep).concat(p)),\n\t\t\tNone => Some(p),\n\t\t}).getOrElse(\"\")\n\t}\n}\n";
Expand description

bynk.string — Bynk-written helpers over the v0.22a string kernel (concat, the List fold, and the Option kernel methods). The kernel itself is compiler built-in (ADR 0046); only derived helpers live here. join folds to Option[String] so empty-string elements are joined faithfully (a bare "" accumulator could not tell “nothing yet” from “first element was empty”).