cl-interpret: Change print to print without newline, add new println builtin

This commit is contained in:
John 2024-07-09 06:13:05 -05:00
parent 6b16c55d97
commit 0beb121f32

View File

@ -16,6 +16,14 @@ builtins! {
const MISC; const MISC;
/// Unstable variadic print function /// Unstable variadic print function
pub fn print<_, args> () -> IResult<ConValue> { pub fn print<_, args> () -> IResult<ConValue> {
let mut out = stdout().lock();
for arg in args {
write!(out, "{arg}").ok();
}
Ok(ConValue::Empty)
}
/// Unstable variadic println function
pub fn println<_, args> () -> IResult<ConValue> {
let mut out = stdout().lock(); let mut out = stdout().lock();
for arg in args { for arg in args {
write!(out, "{arg}").ok(); write!(out, "{arg}").ok();