YIj54yALOJxEsY20eU@lemm.ee to Programmer Humor@programming.dev · 9 months agoGive me Options or give me deathlemm.eeimagemessage-square66fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageGive me Options or give me deathlemm.eeYIj54yALOJxEsY20eU@lemm.ee to Programmer Humor@programming.dev · 9 months agomessage-square66fedilink
minus-squareanton@lemmy.blahaj.zonelinkfedilinkarrow-up0·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 !)
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.The return type of an infinitely recursive function / infinite loops is ⊥, a type that by definition has no values. (Known in rust as
!
)