Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tailrec fun <T, R> Iterable<T>.mapWithConsIter(result: Cons<R>, src: Iterator<T>, cb: (T) -> R): List<R> {
- if (!src.hasNext()) {
- return result
- }
- val e = src.next()
- return mapWithConsIter(Cons<R>(cb(e), result), src, cb)
- }
Add Comment
Please, Sign In to add comment