Comment on Give me Options or give me death
xlash123@sh.itjust.works 10 months ago
Imagine getting segmentation faults at runtime
This post was brought to you by the Rust crew
Comment on Give me Options or give me death
xlash123@sh.itjust.works 10 months ago
Imagine getting segmentation faults at runtime
This post was brought to you by the Rust crew
PoolloverNathan@programming.dev 10 months ago
Neither does Haskell, and Haskell won’t waste time doing something that doesn’t matter.
anton@lemmy.blahaj.zone 10 months ago
Imagine using a linked list as your default sequential container.
Rust iterators are lazy btw.
PoolloverNathan@programming.dev 10 months ago
You can’t random-access an iterator and use it again later. Can Rust compute the value of calling a function an infinite number of times?
— former rustacean
Lauchmelder@feddit.de 10 months ago
it can compute the number of times I needed to compute the value of calling a function an infinite number of times.
println!("0");
anton@lemmy.blahaj.zone 10 months ago
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
!
)