this post was submitted on 21 Dec 2024
19 points (95.2% liked)

Rust Programming

8239 readers
3 users here now

founded 5 years ago
MODERATORS
 

Hello,

I have started learning Rust. I have only made a fibonaci series program so far but I would make more complex program as I progress in learning Rust :D

top 12 comments
sorted by: hot top controversial new old
[–] trevor@lemmy.blahaj.zone 8 points 4 days ago (1 children)

I had a pretty good time rewriting various coreutils in Rust. I liked it because the difficulty of doing so ranges from something as easy as the true command, where you simply exit with a success status, to more challenging stuff like writing a basic shell.

Granted, it's not that complicated to write CLIs with simple inputs and outputs, so maybe it's not valuable for others but it certainly helped me understand Rust better than before.

[–] kionite231@lemmy.ca 1 points 4 days ago

I am also thinking about making an IRC bot in Rust but I don't have enough experience to do so yet

[–] Azzk1kr@feddit.nl 3 points 4 days ago

My first non-trivial program in Rust was a Markov chain. Right now I'm trying to build a REST API with Actix and a Mongo database. So far it has been an interesting experience.

[–] fool@programming.dev 9 points 5 days ago (1 children)
[–] livingcoder@programming.dev 2 points 1 day ago

There is a market for a game engine that uses algebraic variables and geometry to guarantee purely accurate collision detection. That said, a bit of searching shows that it's going to be much slower then current approximate approaches.

When I'm curious about a language, I usually first build some implementation of a perceptron or basic neural network, as well as a (usually very bad) text editor.

I feel like once I have those behind me, I've got some fundamentals and can dive deeper into what makes the specific language actually special :)

[–] gratux@lemmy.blahaj.zone 5 points 5 days ago (1 children)

perhaps a simple turn based card game with the ability to add custom cards

[–] Rogue@feddit.uk 2 points 4 days ago* (last edited 4 days ago)

Single player blackjack against the dealer is a good choice.

The basic rules of the game are easy to implement so the payoff is quick and you can extend it later with additional complexity if you like.

  • Aces as 1 or 11
  • splitting doubles
  • Betting
  • Random card, single deck, multiple decks etc
  • Dealer logic as AI
  • Player AI with card counting
[–] Ephera@lemmy.ml 2 points 5 days ago (1 children)

Turn the Fibonacci series into an Iterator. >:)

[–] kionite231@lemmy.ca 2 points 5 days ago (1 children)

that could be a good exercise, I haven't got the needed knowledge to do so, but I will keep this in mind.

[–] Ephera@lemmy.ml 4 points 5 days ago

Yeah, it's a bit of a stretch goal. 🙃

When I learn a new language, I like to implement the Sieve of Erastothenes (which is a simple algorithm for finding prime numbers), and I had done so with Rust. Two years or so later, I looked back at that code and thought, damn, that looks like a Java dev wrote it.

Then I realized the most idiomatic way of implementing that would be an iterator. This was actually an interesting challenge, because typically Sieve of Erastothenes uses an upper bound, which I didn't want to have.
But yeah, it was also just wild to me, how much different the iterator code looked (and in many ways, how much better it was). It was just really cool to see, how much I had progressed in those two years.

[–] iii@mander.xyz 0 points 5 days ago

1+1=2 1+2=3 2+3=5