Crates.io | lisp_iter |
lib.rs | lisp_iter |
version | 0.1.0 |
source | src |
created_at | 2022-11-02 20:44:56.427444 |
updated_at | 2022-11-02 20:44:56.427444 |
description | Single-pass no-alloc iterator for simple lisp or lisp-like expressions |
homepage | |
repository | https://github.com/DMClVG/lisp_iter |
max_upload_size | |
id | 703747 |
size | 8,161 |
lisp_iter
Single-pass no-alloc iterator for simple lisp or lisp-like expressions.
use lisp_iter::LispIter;
fn main() {
let mut iter = LispIter::new(r#"(this-is-a-identifier :a 123 "wow") ; :a is shorthand for "a" "#);
let mut list = iter.next().unwrap().into_iter(); // Retrieve first list in iterator
println!("{:?}", list.next().unwrap()); // Identifier("this-is-a-identifier")
println!("{:?}", list.next().unwrap()); // Quote("a")
println!("{:?}", list.next().unwrap()); // Integer(0)
println!("{:?}", list.next().unwrap()); // Quote("wow")
}
Useful to glance over anything lispy with minimal to 0 overhead.