diff --git a/src/builtins/lists.rs b/src/builtins/lists.rs index 45343bc5..bbd6a93d 100644 --- a/src/builtins/lists.rs +++ b/src/builtins/lists.rs @@ -193,7 +193,7 @@ pub fn foldl(xs: &CalcitItems, call_stack: &CallStackList) -> Result { for x in xs { - let values = TernaryTreeList::from(&vec![ret, x.to_owned()]); + let values = TernaryTreeList::from(&[ret, x.to_owned()]); ret = runner::run_fn(&values, scope, args, body, def_ns.to_owned(), call_stack)?; } Ok(ret) @@ -201,7 +201,7 @@ pub fn foldl(xs: &CalcitItems, call_stack: &CallStackList) -> Result { for x in xs { // println!("foldl args, {} {}", ret, x.to_owned()); - ret = builtins::handle_proc(proc, &TernaryTreeList::from(&vec![ret, x.to_owned()]), call_stack)?; + ret = builtins::handle_proc(proc, &TernaryTreeList::from(&[ret, x.to_owned()]), call_stack)?; } Ok(ret) } @@ -213,7 +213,7 @@ pub fn foldl(xs: &CalcitItems, call_stack: &CallStackList) -> Result { for x in xs { - let values = TernaryTreeList::from(&vec![ret, x.to_owned()]); + let values = TernaryTreeList::from(&[ret, x.to_owned()]); ret = runner::run_fn(&values, scope, args, body, def_ns.to_owned(), call_stack)?; } Ok(ret) @@ -221,7 +221,7 @@ pub fn foldl(xs: &CalcitItems, call_stack: &CallStackList) -> Result { for x in xs { // println!("foldl args, {} {}", ret, x.to_owned()); - ret = builtins::handle_proc(proc, &TernaryTreeList::from(&vec![ret, x.to_owned()]), call_stack)?; + ret = builtins::handle_proc(proc, &TernaryTreeList::from(&[ret, x.to_owned()]), call_stack)?; } Ok(ret) } @@ -233,7 +233,7 @@ pub fn foldl(xs: &CalcitItems, call_stack: &CallStackList) -> Result { for (k, x) in xs { - let values = TernaryTreeList::from(&vec![ret, Calcit::List(TernaryTreeList::from(&vec![k.to_owned(), x.to_owned()]))]); + let values = TernaryTreeList::from(&[ret, Calcit::List(TernaryTreeList::from(&[k.to_owned(), x.to_owned()]))]); ret = runner::run_fn(&values, scope, args, body, def_ns.to_owned(), call_stack)?; } Ok(ret) @@ -243,7 +243,7 @@ pub fn foldl(xs: &CalcitItems, call_stack: &CallStackList) -> Result Result { let mut state = acc.to_owned(); for x in xs { - let values = TernaryTreeList::from(&vec![state, x.to_owned()]); + let values = TernaryTreeList::from(&[state, x.to_owned()]); let pair = runner::run_fn(&values, scope, args, body, def_ns.to_owned(), call_stack)?; match pair { Calcit::Tuple(x0, x1) => match &*x0 { @@ -316,7 +316,7 @@ pub fn foldl_shortcut(xs: &CalcitItems, call_stack: &CallStackList) -> Result { let mut state = acc.to_owned(); for x in xs { - let values = TernaryTreeList::from(&vec![state, x.to_owned()]); + let values = TernaryTreeList::from(&[state, x.to_owned()]); let pair = runner::run_fn(&values, scope, args, body, def_ns.to_owned(), call_stack)?; match pair { Calcit::Tuple(x0, x1) => match &*x0 { @@ -353,7 +353,7 @@ pub fn foldl_shortcut(xs: &CalcitItems, call_stack: &CallStackList) -> Result { let mut state = acc.to_owned(); for (k, x) in xs { - let values = TernaryTreeList::from(&vec![state, Calcit::List(TernaryTreeList::from(&vec![k.to_owned(), x.to_owned()]))]); + let values = TernaryTreeList::from(&[state, Calcit::List(TernaryTreeList::from(&[k.to_owned(), x.to_owned()]))]); let pair = runner::run_fn(&values, scope, args, body, def_ns.to_owned(), call_stack)?; match pair { Calcit::Tuple(x0, x1) => match &*x0 { @@ -413,7 +413,7 @@ pub fn foldr_shortcut(xs: &CalcitItems, call_stack: &CallStackList) -> Result match &*x0 { @@ -467,7 +467,7 @@ pub fn sort(xs: &CalcitItems, call_stack: &CallStackList) -> Result { let mut xs2: Vec<&Calcit> = xs.into_iter().collect::>(); xs2.sort_by(|a, b| -> Ordering { - let values = TernaryTreeList::from(&vec![a.to_owned().to_owned(), b.to_owned().to_owned()]); + let values = TernaryTreeList::from(&[a.to_owned().to_owned(), b.to_owned().to_owned()]); let v = runner::run_fn(&values, scope, args, body, def_ns.to_owned(), call_stack); match v { Ok(Calcit::Number(x)) if x < 0.0 => Ordering::Less, @@ -493,7 +493,7 @@ pub fn sort(xs: &CalcitItems, call_stack: &CallStackList) -> Result { let mut xs2: Vec<&Calcit> = xs.into_iter().collect::>(); xs2.sort_by(|a, b| -> Ordering { - let values = TernaryTreeList::from(&vec![a.to_owned().to_owned(), b.to_owned().to_owned()]); + let values = TernaryTreeList::from(&[a.to_owned().to_owned(), b.to_owned().to_owned()]); let v = builtins::handle_proc(proc, &values, call_stack); match v { Ok(Calcit::Number(x)) if x < 0.0 => Ordering::Less, diff --git a/src/builtins/maps.rs b/src/builtins/maps.rs index 6cd88816..8d4cc024 100644 --- a/src/builtins/maps.rs +++ b/src/builtins/maps.rs @@ -142,7 +142,7 @@ pub fn to_list(xs: &CalcitItems) -> Result { Some(Calcit::Map(m)) => { let mut ys: TernaryTreeList = TernaryTreeList::Empty; for (k, v) in m { - let zs: TernaryTreeList = TernaryTreeList::from(&vec![k.to_owned(), v.to_owned()]); + let zs: TernaryTreeList = TernaryTreeList::from(&[k.to_owned(), v.to_owned()]); ys = ys.push(Calcit::List(zs)); } Ok(Calcit::List(ys)) @@ -196,7 +196,7 @@ pub fn first(xs: &CalcitItems) -> Result { match xs.get(0) { Some(Calcit::Map(ys)) => match ys.iter().next() { // TODO order may not be stable enough - Some((k, v)) => Ok(Calcit::List(TernaryTreeList::from(&vec![k.to_owned(), v.to_owned()]))), + Some((k, v)) => Ok(Calcit::List(TernaryTreeList::from(&[k.to_owned(), v.to_owned()]))), None => Ok(Calcit::Nil), }, Some(a) => CalcitErr::err_str(format!("map:first expected a map, got: {}", a)), diff --git a/src/builtins/refs.rs b/src/builtins/refs.rs index 6720d986..70f1585b 100644 --- a/src/builtins/refs.rs +++ b/src/builtins/refs.rs @@ -35,7 +35,7 @@ fn modify_ref(path: Arc, v: Calcit, call_stack: &CallStackList) -> Result<( Calcit::Fn { def_ns, scope, args, body, .. } => { - let values = TernaryTreeList::from(&vec![v.to_owned(), prev.to_owned()]); + let values = TernaryTreeList::from(&[v.to_owned(), prev.to_owned()]); runner::run_fn(&values, scope, args, body, def_ns.to_owned(), call_stack)?; } a => { diff --git a/src/runner/preprocess.rs b/src/runner/preprocess.rs index 24b89e57..81701383 100644 --- a/src/runner/preprocess.rs +++ b/src/runner/preprocess.rs @@ -315,7 +315,7 @@ fn process_list_call( match (head_form.to_owned(), head_evaled) { (Calcit::Keyword(..), _) => { if args.len() == 1 { - let code = Calcit::List(TernaryTreeList::from(&vec![ + let code = Calcit::List(TernaryTreeList::from(&[ Calcit::Symbol { sym: String::from("get").into(), ns: String::from(primes::CORE_NS).into(),