How do I disable overflow checking?

Functions like + will always check for overflow (except for float inputs). There's no way to globally disable this.
To allow overflow in a specific case, use functions like wrap-add.

import keen/bits main void() log wrap-add::nat8 255, 1

How do I disable asserts?

Asserts can't be globally disabled.
If there are certain expensive asserts in your program that you might want to turn off, you will have to come up with a way to make them conditional.

main void() if expensive-asserts assert every 1 .. 100, it < 100 expensive-asserts bool() = true

How do I do nothing?

() is the empty void value.

main void() ()

How do I parse JSON or Kid files?

Parsing functions are in keen/parse.

import keen/parse main void() log parse json, "[1, 2]"

How do I test if a string is a substring of another?

There are often not string-specific functions when a generic collection function will work. In this case, you can use contains-seq to test for a substring.

main void() log contains-seq "coworker", "cow"

Why are log and print different?

log is allowed anywhere. This only writes to stderr and is not considered the program's output, so it isn't considered a true side effect. print is the program's actual output and so is considered a true side effect.

Why does the standard library not use interfaces or contexts?

The standard library is used by all Keen programs, but the best interfaces to use depends on specific circumstances.
So instead, the standard library just defines global functions and leaves abstraction to the programmer.

Why can't I compare mutable values with ==?

To avoid confusion. It's unclear whether == on mutable values should compare the contents or the identity.
To compare the identity, use reference-equal. (This is unsafe in general, but can be trusted for mutable values.)
To compare the contents, convert to immutable values and compare those.

import keen/unsafe main void() a nat mut[] = 1, 2 b nat mut[] = 1, 2 log trusted reference-equal a, b log a.to::nat[] == b.to::nat[]

Why are enum and flags types different?

In Keen, an enum type is guaranteed to have one of the listed values. A flags type can have any combination of values.

Why can't I use a mutable type as a map key?

If you mutated the object, its hash could change, making it unretrievable.
If you need to associate some data with mutable values (and can't just add it as a field), you could give the values an identity property and key the map by the identity.

main void() the identity-provider = 0, values my-type[] = (64,), (151,) map string[nat] = (values[0].id, "a"), (values[1].id, "b") for v in values log v.value, map[v.id] identity-provider record mut -last-id mut nat get-next-id nat() identity-provider the::identity-provider.last-id +:= 1 the::identity-provider.last-id my-type record mut id nat value mut nat new my-type(value nat) identity-provider get-next-id, value