Atom

convert()

Converts or checks a runtime representation.

Signature

convert(descriptor, value)

Parameters

A built-in descriptor and a value. See the type descriptor table for accepted conversions.

Returns

The converted value, or the original for an identity conversion.

Behavior

Numeric conversion checks range and integer exactness. Converting to string uses Atom's display representation.

Errors

Invalid numeric text, incompatible descriptor, out-of-range value or fractional integer conversion.

Example

Atom
assert(type(convert(u16, '255')) == u16)