{
    Let prim_arity name.
        Match (MAP.search prim_arities name)
        | `just.{_ arity} arity
        | `nothing (die (STRING.concat ["No such primitive \"" name "\"."]))
        ;
}

Where

Let prim_arities.
    Let construct_map arity_list.
        (LIST.reduce arity_list MAP.empty
            Func map arity. (MAP.insert map arity))
    In
    (construct_map
        [
            {"die" 1}
            {"file_create" 1}
            {"file_open" 1}
            {"file_close" 1}
            {"file_read_all" 1}
            {"file_write" 2}
            {"string_length" 1}
            {"string_fetch" 2}
            {"string_equal" 2}
            {"string_compare" 2}
            {"string_append" 2}
            {"string_clip" 3}
            {"negate" 1}
            {"ref_new" 1}
            {"ref_fetch" 1}
            {"ref_store" 2}
            {"multiply" 2}
            {"add" 2}
            {"less" 2}
            {"less_or_equal" 2}
            {"greater" 2}
            {"greater_or_equal" 2}
            {"equal" 2}
            {"cons" 2}
            {"print_line" 1}
            {"show_integer" 1}
        ])

Where

Let MAP.
    (SEARCH.MAP STRING.compare
        Func {key _}. key)

Let die. Prim die

Where

Let LIST. Package "list"
Let SEARCH. Package "search"
Let STRING. Package "string"