mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
add Roc wiring
This commit is contained in:
parent
c8287032b6
commit
e7523ad41d
11 changed files with 77 additions and 10 deletions
|
@ -67,6 +67,7 @@ pub fn builtin_defs_map(symbol: Symbol, var_store: &mut VarStore) -> Option<Def>
|
|||
STR_TO_UTF8 => str_to_utf8,
|
||||
STR_FROM_FLOAT=> str_from_float,
|
||||
STR_REPEAT => str_repeat,
|
||||
STR_TRIM => str_trim,
|
||||
LIST_LEN => list_len,
|
||||
LIST_GET => list_get,
|
||||
LIST_SET => list_set,
|
||||
|
@ -1236,6 +1237,26 @@ fn str_split(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
|||
)
|
||||
}
|
||||
|
||||
/// Str.trim : Str -> Str
|
||||
fn str_trim(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||
// TODO GIESCH understand when/why this can be reused
|
||||
let str_var = var_store.fresh();
|
||||
|
||||
let body = RunLowLevel {
|
||||
op: LowLevel::StrTrim,
|
||||
args: vec![(str_var, Var(Symbol::ARG_1))],
|
||||
ret_var: str_var,
|
||||
};
|
||||
|
||||
defn(
|
||||
symbol,
|
||||
vec![(str_var, Symbol::ARG_1)],
|
||||
var_store,
|
||||
body,
|
||||
str_var,
|
||||
)
|
||||
}
|
||||
|
||||
/// Str.repeat : Str, Nat -> Str
|
||||
fn str_repeat(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||
let str_var = var_store.fresh();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue