{ : encode_small_integer : prim_arity : prim_short_name } Where Define (encode_small_integer n) [2 * n] Define (prim_arity name) Match (MAP.search prim_arities name) | 'just.{_ arity} arity | 'nothing (die (STRING.concat [Right "No such primitive \"" & name & "\"." & 'nil])) ; Define (prim_short_name name) Match (MAP.search prim_short_names name) | 'just.{_ short_name} short_name | 'nothing (die (STRING.concat [Right "No such primitive \"" & name & "\"." & 'nil])) ; Where Let prim_arities Define (construct_map arity_list) (LIST.reduce arity_list MAP.empty MAP.insert) In (construct_map [Right {"die" 1} & {"command_argc" 1} & {"command_argv" 1} & {"file_create" 1} & {"file_open" 1} & {"file_close" 1} & {"file_read_all" 1} & {"file_write" 2} & {"file_write_byte" 2} & {"string_length" 1} & {"string_fetch" 2} & {"string_equal" 2} & {"string_compare" 2} & {"string_append" 2} & {"string_clip" 3} & {"scratchpad_new" 1} & {"scratchpad_size" 1} & {"scratchpad_store_uint8" 3} & {"scratchpad_fetch_uint8" 2} & {"scratchpad_store_int8" 3} & {"scratchpad_fetch_int8" 2} & {"scratchpad_store_uint16_le" 3} & {"scratchpad_fetch_uint16_le" 2} & {"scratchpad_store_int16_le" 3} & {"scratchpad_fetch_int16_le" 2} & {"scratchpad_store_uint32_le" 3} & {"scratchpad_fetch_uint32_le" 2} & {"scratchpad_store_int32_le" 3} & {"scratchpad_fetch_int32_le" 2} & {"scratchpad_store_uint64_le" 3} & {"scratchpad_fetch_uint64_le" 2} & {"scratchpad_store_int64_le" 3} & {"scratchpad_fetch_int64_le" 2} & {"negate" 1} & {"quotient" 2} & {"remainder" 2} & {"multiply" 2} & {"add" 2} & {"subtract" 2} & {"less" 2} & {"less_or_equal" 2} & {"greater" 2} & {"greater_or_equal" 2} & {"equal" 2} & {"print" 1} & {"print_line" 1} & {"show_integer" 1} & 'nil]) Let prim_short_names Define (construct_map list) (LIST.reduce list MAP.empty MAP.insert) In (construct_map [Right {"die" "s26"} & {"command_argc" "s40"} & {"command_argv" "s24"} & {"print" "s18"} & {"print_line" "s79"} & {"file_create" "s20"} & {"file_open" "s23"} & {"file_close" "s92"} & {"file_read_all" "s28"} & {"file_write" "s97"} & {"file_write_byte" "s77"} & {"show_integer" "s12"} & {"multiply" "s93"} & {"add" "s19"} & {"subtract" "s47"} & {"negate" "s84"} & {"quotient" "s91"} & {"remainder" "s43"} & {"equal" "s50"} & {"less" "s10"} & {"less_or_equal" "s63"} & {"greater" "s61"} & {"greater_or_equal" "s55"} & {"string_length" "s65"} & {"string_fetch" "s69"} & {"string_compare" "s37"} & {"string_equal" "s45"} & {"string_append" "s25"} & {"string_clip" "s44"} & {"scratchpad_new" "s38"} & {"scratchpad_size" "s14"} & {"scratchpad_store_uint8" "s42"} & {"scratchpad_fetch_uint8" "s13"} & {"scratchpad_store_int8" "s76"} & {"scratchpad_fetch_int8" "s46"} & {"scratchpad_store_uint16_le" "s54"} & {"scratchpad_fetch_uint16_le" "s29"} & {"scratchpad_store_int16_le" "s08"} & {"scratchpad_fetch_int16_le" "s98"} & {"scratchpad_store_uint32_le" "s74"} & {"scratchpad_fetch_uint32_le" "s01"} & {"scratchpad_store_int32_le" "s17"} & {"scratchpad_fetch_int32_le" "s59"} & {"scratchpad_store_uint64_le" "s21"} & {"scratchpad_fetch_uint64_le" "s99"} & {"scratchpad_store_int64_le" "s58"} & {"scratchpad_fetch_int64_le" "s80"} & 'nil]) Where Let MAP (SEARCH.MAP STRING.compare Func {{key _}} key) Let die OS.die Where Let LIST Package "list" Let OS Package "os" Let SEARCH Package "search" Let STRING Package "string"