YIj54yALOJxEsY20eU@lemm.ee to Programmer Humor@programming.dev · 1 year agoGive me Options or give me deathlemm.eeimagemessage-square66fedilinkarrow-up12arrow-down10
arrow-up12arrow-down1imageGive me Options or give me deathlemm.eeYIj54yALOJxEsY20eU@lemm.ee to Programmer Humor@programming.dev · 1 year agomessage-square66fedilink
minus-squareanton@lemmy.blahaj.zonelinkfedilinkarrow-up0·1 year 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
!
)