Skip to main content

Module stdlib

Module stdlib 

Source
Expand description

blue’s string and number core.

tatara-lisp ships arithmetic, comparison, list and trig primitives and no string operations at all — no length, no concatenation, no case conversion, no number parsing. For a language whose surface is Ruby’s, that is the largest parity gap there is: String is the most-used type in Ruby by a wide margin.

§Why these live in blue and not in tatara-lisp

The fleet rule is to extend the substrate rather than re-implement, and generic helpers belong upstream. These are not generic: the semantics are blue’s, and they are Ruby’s semantics specifically.

The clearest case is length. Ruby’s String#length counts characters; Rust’s str::len counts bytes; Elixir’s String.length/1 counts grapheme clusters. Three languages, three answers, all defensible. Blue owes its users Ruby’s answer, and encoding that choice into tatara-lisp would push one language’s convention onto every other consumer of the substrate.

Promoting a genuinely encoding-neutral core upstream later stays open; the character-counting ones are blue’s by right.

§Character, not byte, not grapheme

Every index and length here is in Unicode scalar values (Rust char). That matches Ruby for the overwhelming majority of text and is stated rather than left to be discovered — a length that silently returns bytes is the bug that only appears once a user types a non-ASCII character.

Grapheme clusters (Elixir’s choice) would need a segmentation table; where the two differ — a family emoji, a combining accent — blue reports scalar values. a_combining_sequence_counts_scalars_not_graphemes pins it.

Functions§

install_blue_stdlib
Install blue’s string and number core.