All examples
Language

Explicit binary data and text encoding

Encode Unicode text explicitly, inspect immutable bytes, search byte patterns and choose integer byte order.

Download .aner source
bytes_basic.aner
let packet: Bytes = Bytes.from_values(values: List(0, 127, 255))
let text = Bytes.encode_utf8(text: "café")
print(packet.hex())
print(text.len())
print(text.decode_utf8())
print(text.slice(0, 3).hex())
print(text.find(Bytes.from_hex("c3a9")))
let encoded = Bytes.from_i64(value: -42, byte_order: "big")
print(encoded.hex())
print(encoded.to_i64(byte_order: "big"))
print(type(packet))
print(dtype(packet))

Make it your experiment.

With Aner installed, save this program as examples/bytes_basic.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/bytes_basic.aner
aner run examples/bytes_basic.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Use the compatible native Aner development engine with import free temporal, binary, Range, Optional and Result values, and VS Code extension 0.1.37 or newer. No import is required. Calendar values use Gregorian and explicit fixed offset contracts; Bytes uses strict explicit text encoding; Range is lazy; outcome payload access is checked. See each separate native value reference for exact ownership, resource limits and time/space complexity.

Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner