• anton@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    0
    ·
    9 months ago

    You can’t random-access an iterator and use it again later.

    If your specific use case really needs random access to a list while lazy computing the elements just wrap them in Lazy and put them in a vector.

    Can Rust compute the value of calling a function an infinite number of times?

    The return type of an infinitely recursive function / infinite loops is ⊥, a type that by definition has no values. (Known in rust as !)