better echo
This commit is contained in:
parent
4f6622730a
commit
da0709c4db
1 changed files with 5 additions and 6 deletions
|
|
@ -22,12 +22,11 @@ pub const ECHO_DOCSTRING: &str =
|
||||||
"traverses any number of arguments. Prints their evaluated values on a new line for each.";
|
"traverses any number of arguments. Prints their evaluated values on a new line for each.";
|
||||||
|
|
||||||
pub fn echo_callback(ast: &Seg, _syms: &mut SymTable) -> Result<Ctr, String> {
|
pub fn echo_callback(ast: &Seg, _syms: &mut SymTable) -> Result<Ctr, String> {
|
||||||
if ast.len() == 1 {
|
ast.circuit(&mut |arg: &Ctr| match arg {
|
||||||
println!("{}", ast.car);
|
Ctr::String(s) => print!("{}", s) == (),
|
||||||
} else {
|
_ => print!("{}", arg) == (),
|
||||||
ast.circuit(&mut |arg: &Ctr| print!("{}", arg) == ());
|
});
|
||||||
}
|
println!();
|
||||||
|
|
||||||
Ok(Ctr::None)
|
Ok(Ctr::None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue