this post was submitted on 14 Feb 2024
531 points (96.7% liked)

Programmer Humor

19606 readers
845 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] PoolloverNathan@programming.dev 7 points 9 months ago (6 children)

Neither does Haskell, and Haskell won't waste time doing something that doesn't matter.

[–] anton@lemmy.blahaj.zone 2 points 9 months ago (5 children)

Imagine using a linked list as your default sequential container.
Rust iterators are lazy btw.

[–] PoolloverNathan@programming.dev 1 points 9 months ago (4 children)

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 2 points 9 months ago* (last edited 9 months ago) (1 children)

it can compute how often I needed to compute the value of calling a function an infinite number of times.

println!("0");
[–] PoolloverNathan@programming.dev 0 points 9 months ago

If you've used a parser library's recursive parser, you have infinite calls right there. If it supplies a recursive-parser function, that function is a type-limited equivalent to fix, which performs the infinite call operation. Your Rust library most likely implements recursion using hidden mutability, but in Haskell, your parsers can remain infinitely-recursive while still referencing themselves and immutable.

Also, we get to ask people if they know what a monad is.

load more comments (2 replies)
load more comments (2 replies)
load more comments (2 replies)