1use crate::syntax::AlephTree as at;
2
3pub mod syntax;
4pub mod effects;
5pub mod types;
6pub mod hash;
7
8pub fn gen_list_expr_sep(ast_list: Vec<Box<at>>, f: fn(at, i64) -> String, sep: &str) -> String {
9 format!("{}", ast_list.into_iter().map(|e| f(*e, 0)).collect::<Vec<String>>().join(sep))
10}
11
12pub fn gen_list_expr(ast_list: Vec<Box<at>>, f: fn(at, i64) -> String) -> String {
13 gen_list_expr_sep(ast_list, f, " ")
14}
15
16pub fn comp_indent_sep(indent: i64, sep: String) -> String {
18 let mut res = "".to_string();
19 for _ in 0..indent {
20 res.push_str(&sep);
21 }
22 res
23}
24
25pub fn comp_indent(indent: i64) -> String {
27 comp_indent_sep(indent, String::from(" "))
28}