From 6dcf5c7945ca506cc36d51266afe572bf77d3e54 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 4 Dec 2017 02:44:09 -0800 Subject: [PATCH] print list --- src/rukka_lang/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/rukka_lang/mod.rs b/src/rukka_lang/mod.rs index 5cb88a2..4245197 100644 --- a/src/rukka_lang/mod.rs +++ b/src/rukka_lang/mod.rs @@ -3,6 +3,7 @@ use schala_lib::{ProgrammingLanguageInterface, EvalOptions, ReplOutput}; use std::iter::Peekable; use std::vec::IntoIter; use std::str::Chars; +use std::fmt::Write; pub struct EvaluatorState { } @@ -104,7 +105,15 @@ impl Sexp { &SymbolAtom(ref sym) => format!("{}", sym), &StringAtom(ref s) => format!("\"{}\"", s), &NumberAtom(ref n) => format!("{}", n), - &List(ref sexprs) => format!(""), + &List(ref sexprs) => { + let mut output = String::new(); + write!(&mut output, "("); + for sexpr in sexprs.iter() { + write!(&mut output, "{}", sexpr.print()); + } + write!(&mut output, ")"); + output + } } } }