started on Str.toNum

This commit is contained in:
Anton-4 2021-12-01 15:15:30 +01:00
parent 68e2701948
commit eaf4e57759
7 changed files with 29 additions and 0 deletions

View file

@ -68,6 +68,7 @@ pub fn builtin_defs_map(symbol: Symbol, var_store: &mut VarStore) -> Option<Def>
STR_TRIM => str_trim,
STR_TRIM_LEFT => str_trim_left,
STR_TRIM_RIGHT => str_trim_right,
STR_TO_NUM => str_to_num,
LIST_LEN => list_len,
LIST_GET => list_get,
LIST_SET => list_set,
@ -1323,6 +1324,11 @@ fn str_trim_right(symbol: Symbol, var_store: &mut VarStore) -> Def {
lowlevel_1(symbol, LowLevel::StrTrimRight, var_store)
}
/// Str.toNum : Str -> Result (Num a) [ ExpectedNum a ]*
fn str_to_num(symbol: Symbol, var_store: &mut VarStore) -> Def {
lowlevel_1(symbol, LowLevel::StrToNum, var_store)
}
/// Str.repeat : Str, Nat -> Str
fn str_repeat(symbol: Symbol, var_store: &mut VarStore) -> Def {
let str_var = var_store.fresh();