ruschm 0.2.0

Scheme(R7RS-small) interpretor/compiler rust implementation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::{
    fs::File,
    io::{BufRead, BufReader},
    path::Path,
};

pub fn file_char_stream(path: &Path) -> Result<impl Iterator<Item = char>, std::io::Error> {
    let f = BufReader::new(File::open(path)?);
    Ok(f.lines().flat_map(|line| {
        line.unwrap()
            .chars()
            .chain(std::iter::once('\n'))
            .collect::<Vec<_>>()
            .into_iter()
    }))
}