hawkw / seax

A VM-based runtime environment for functional programming languages
http://hawkweisman.me/seax/
MIT License
45 stars 5 forks source link

Implement std::iter::FromIterator for List #57

Closed hawkw closed 9 years ago

hawkw commented 9 years ago

There are a bunch of times in the Scheme compiler codebase where a List<T> is built from a Vec<T>. Since this happens more than once, it probably ought to be made into a reusable function.

I was originally considering writing a function in the Scheme package for turning a Vec<T> into a List<T>, but then I realized that the Rust standard library already had me covered with the std::Iter::FromIterator trait. I should probably implement this trait for List.

hawkw commented 9 years ago

I should really also go ahead and add a lot of the Rust standard library's collection traits for List.

hawkw commented 9 years ago

This works as of d009dbd, but the list is built in reversed order. This is due to that you can't place a DoubleEndedIterator type bound on IntoIter, and therefore there's no way to reverse the source iterator.

hawkw commented 9 years ago

Finished by #60.