diff --git a/Cargo.lock b/Cargo.lock index 5339e790..9e50ad62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -222,9 +222,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "im_ternary_tree" -version = "0.0.1-a2" +version = "0.0.1-a3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "047ce6cd3066d45196d7b08e014547b36ab5ad64cd65fe9fa3aab07ddf31b8bf" +checksum = "ba6dabade3a7b2059ab2557052f8a6c9970d4f5aa4b1aab66a5b38205e0e1870" [[package]] name = "inotify" diff --git a/Cargo.toml b/Cargo.toml index 5437e2ec..8a59f47f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ notify = "4.0.17" walkdir = "2" hex = "0.4.3" rpds = "0.10.0" -im_ternary_tree = "0.0.1-a2" +im_ternary_tree = "0.0.1-a3" # im_ternary_tree = { path = "/Users/chen/repo/calcit-lang/ternary-tree" } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] diff --git a/src/builtins/syntax.rs b/src/builtins/syntax.rs index 6d1edd26..7421b53a 100644 --- a/src/builtins/syntax.rs +++ b/src/builtins/syntax.rs @@ -303,10 +303,10 @@ pub fn call_try(expr: &CalcitItems, scope: &CalcitScope, file_ns: &str, call_sta let err_data = Calcit::Str(failure.msg.to_owned().into_boxed_str()); match f { Calcit::Fn(_, def_ns, _, def_scope, args, body) => { - let values = TernaryTreeList::from(&vec![err_data]); + let values = TernaryTreeList::from(&[err_data]); runner::run_fn(&values, &def_scope, &args, &body, &def_ns, call_stack) } - Calcit::Proc(proc) => builtins::handle_proc(&proc, &TernaryTreeList::from(&vec![err_data]), call_stack), + Calcit::Proc(proc) => builtins::handle_proc(&proc, &TernaryTreeList::from(&[err_data]), call_stack), a => CalcitErr::err_str(format!("try expected a function handler, got: {}", a)), } } diff --git a/src/runner/preprocess.rs b/src/runner/preprocess.rs index 8c5c9189..10b758e6 100644 --- a/src/runner/preprocess.rs +++ b/src/runner/preprocess.rs @@ -346,7 +346,7 @@ fn process_list_call( (_, Some(Calcit::Fn(f_name, _name_ns, _id, _scope, f_args, _f_body))) => { check_fn_args(&f_args, &args, file_ns, &f_name, &def_name, check_warnings); - let mut ys = TernaryTreeList::from(&vec![head_form]); + let mut ys = TernaryTreeList::from(&[head_form]); for a in &args { let (form, _v) = preprocess_expr(a, scope_defs, file_ns, check_warnings, call_stack)?; ys = ys.push(form); @@ -354,7 +354,7 @@ fn process_list_call( Ok((Calcit::List(ys), None)) } (_, _) => { - let mut ys = TernaryTreeList::from(&vec![head_form]); + let mut ys = TernaryTreeList::from(&[head_form]); for a in &args { let (form, _v) = preprocess_expr(a, scope_defs, file_ns, check_warnings, call_stack)?; ys = ys.push(form); @@ -454,7 +454,7 @@ pub fn preprocess_each_items( check_warnings: &RefCell>, call_stack: &CallStackVec, ) -> Result { - let mut xs: CalcitItems = TernaryTreeList::from(&vec![Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); + let mut xs: CalcitItems = TernaryTreeList::from(&[Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); for a in args { let (form, _v) = preprocess_expr(a, scope_defs, file_ns, check_warnings, call_stack)?; xs = xs.push(form); @@ -472,7 +472,7 @@ pub fn preprocess_defn( call_stack: &CallStackVec, ) -> Result { // println!("defn args: {}", primes::CrListWrap(args.to_owned())); - let mut xs: CalcitItems = TernaryTreeList::from(&vec![Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); + let mut xs: CalcitItems = TernaryTreeList::from(&[Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); match (args.get(0), args.get(1)) { (Some(Calcit::Symbol(def_name, def_name_ns, at_def, _)), Some(Calcit::List(ys))) => { let mut body_defs: HashSet> = scope_defs.to_owned(); @@ -550,7 +550,7 @@ pub fn preprocess_call_let( check_warnings: &RefCell>, call_stack: &CallStackVec, ) -> Result { - let mut xs: CalcitItems = TernaryTreeList::from(&vec![Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); + let mut xs: CalcitItems = TernaryTreeList::from(&[Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); let mut body_defs: HashSet> = scope_defs.to_owned(); let binding = match args.get(0) { Some(Calcit::Nil) => Calcit::Nil, @@ -559,7 +559,7 @@ pub fn preprocess_call_let( check_symbol(sym, args, check_warnings); body_defs.insert(sym.to_owned()); let (form, _v) = preprocess_expr(a, &body_defs, file_ns, check_warnings, call_stack)?; - Calcit::List(TernaryTreeList::from(&vec![ys[0].to_owned(), form])) + Calcit::List(TernaryTreeList::from(&[ys[0].to_owned(), form])) } (a, b) => { return Err(CalcitErr::use_msg_stack( @@ -604,7 +604,7 @@ pub fn preprocess_quote( _scope_defs: &HashSet>, _file_ns: &str, ) -> Result { - let mut xs: CalcitItems = TernaryTreeList::from(&vec![Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); + let mut xs: CalcitItems = TernaryTreeList::from(&[Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); for a in args { xs = xs.push(a.to_owned()); } @@ -620,7 +620,7 @@ pub fn preprocess_defatom( check_warnings: &RefCell>, call_stack: &CallStackVec, ) -> Result { - let mut xs: CalcitItems = TernaryTreeList::from(&vec![Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); + let mut xs: CalcitItems = TernaryTreeList::from(&[Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); for a in args { // TODO let (form, _v) = preprocess_expr(a, scope_defs, file_ns, check_warnings, call_stack)?; @@ -639,7 +639,7 @@ pub fn preprocess_quasiquote( check_warnings: &RefCell>, call_stack: &CallStackVec, ) -> Result { - let mut xs: CalcitItems = TernaryTreeList::from(&vec![Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); + let mut xs: CalcitItems = TernaryTreeList::from(&[Calcit::Syntax(head.to_owned(), head_ns.to_owned().into())]); for a in args { xs = xs.push(preprocess_quasiquote_internal(a, scope_defs, file_ns, check_warnings, call_stack)?); }