5 ms·
So, I want to learn Rust. I am a C# / Python programmer, experienced. Are there any particular set of problems that I can solve systematically, so that I can l
by kumarvvr 6y ago
So, I want to learn Rust. I am a C# / Python programmer, experienced.
Are there any particular set of problems that I can solve systematically, so that I can learn all the features of Rust?
- xvedejas 6y agoTrying to implement anything in Rust will set you up for a crash-course. Even the simplest non-trivial programs will introduce you to the Rust borrow checker, a major feature absent in C# / Python.
- steveklabnik 6y agohttps://doc.rust-lang.org/stable/book/ https://doc.rust-lang.org/stable/book/ is not purely problems, but does have some problem chapters. (I am a co-author.) https://doc.rust-lang.org/stable/rust-by-example/ https://doc.rust-lang.org/stable/rust-by-example/ is the "by example" introduction, which is all about sample programs, but feels a bit dated, IMHO. Still not incorrect, but not up-to-date. You may also like the O'Reilly book, or Rust In Action, which use more fully-featured example programs more heavily than The Book does.
- jxcl 6y agoI was super impressed by the O’Reilly book, which throws you right in to writing a multithreaded Mandelbrot set plotter. It also goes through writing a multithreaded HTTP server. Pretty neat!
- somurzakov 6y agotry to write ETL in rust
- adamnemecek 6y agoTry to do some graphics programing with thr backend of your choice. There is also this cool nanovg port https://github.com/cytecbg/gpucanvas https://github.com/cytecbg/gpucanvas. Run the demo in examples to see the nanovg demo.
- deleted 6y ago[deleted]
- shawnz 6y agoYou could try this: https://github.com/rust-lang/rustlings https://github.com/rust-lang/rustlings
- jandrese 6y agoOne thing I'd be wary of is Googling error messages and taking answers from Stack Exchange. Rust has mutated (heh) a fair bit over the years and many SE answers to noob problems are obsolete and sometimes incorrect. At the very least check the datestamp on any answer and be wary of anything more than a year or two old. This goes double if the answer has some extremely awkward looking syntax with lots of modifiers and underscores sprinkled throughout. There's probably a better way to do it now, or an alternative solution that works better. Or maybe you're just trying to do something that Rust makes hard, like concurrent processing on a shared data structure. The manual is safer even though it's harder to find your exact problem and solution, especially when you're just starting out.
- shepmaster 6y agoI literally spend tens of hours a week on Stack Overflow ensuring this isn’t the case, or if it is that it’s clearly notated. As always, feel free to drop into the Rust Stack Overflow chat room[1], or any of the official Rust discussion channels, and ping me or other Stack Overflow contributors to review and update answers. 1: https://chat.stackoverflow.com/rooms/62927/rust https://chat.stackoverflow.com/rooms/62927/rust
- rmdashrfstar 6y agoYou are awesome!
- paledot 6y agoSeconded. I've been learning on SO heavily lately as I'm writing my first real Rust program (an IRC bot/client/server/not sure yet), and I was impressed by how many questions and answers had been updated with notes about things being potentially out of date. Not something that I think I've ever seen in the PHP land from whence I came.
- gchamonlive 6y agoI like to implement something I have already done before. In my case, the ID3 algorithm has a nice balance of challenge, experience and documentation available. You could try to write it for a specific case, where you structure your data, and then apply it to a generic case.
- datanecdote 6y agoI am in similar boat. Python centric data scientist. Very tempted to try to learn Rust so I can accelerate certain ETL tasks. Question for Rust experts: On what ETL tasks would you expect Rust to outperform Numpy, Numba, and Cython? What are the characteristics of a workload that sees order-of-magnitude speed ups from switching to Rust?
- brundolf 6y agoI'm far from an expert, but I would not expect hand-written Rust code to outperform Numpy. Not because it's Rust and Numpy is written in C, but because Numpy has been deeply optimized over many years by many people and your custom code would not have been. When it comes to performance Rust is generally comparable to C++, as a baseline. It's not going to give you some dramatic advantage that offsets the code-maturity factor. Now, if you're doing lots of computation in Python itself - not within the confines of Numpy - that's where you might see a significant speed boost. Again, I don't know precisely how Rust and Cython would compare, but I would very much expect Rust to be significantly faster, just as I would very much expect C++ to be significantly faster.
- datanecdote 6y agoI deal with a lot of ragged data that is hard to vectorize, and currently write cython kernels when the inner loops take too long. Sounds like Rust might be faster than cython? Thanks for the feedback.
- Fiahil 6y ago
- smabie 6y agoWrite a chip8 emulator in Rust.
- BiosElement 6y agoYou might check out https://exercism.io/tracks/rust https://exercism.io/tracks/rust . Some are a little heavy in the math department but personally I've always found test drive learning useful when learning a new language thanks to instant feedback.
- brundolf 6y agoOnce you've learned the basics (plenty of links in the siblings, including the official Rust Book), this is a key (and entertaining!) unofficial resource that really hammered home for me the ways that Rust is different from the C family when it comes to working with references: https://rust-unofficial.github.io/too-many-lists/ https://rust-unofficial.github.io/too-many-lists/ It also taught me about Boxes and Rc's, which are essential for certain kinds of things, and which I don't remember being covered in the main Rust Book at all
- steveklabnik 6y agohttps://doc.rust-lang.org/stable/book/ch15-01-box.html https://doc.rust-lang.org/stable/book/ch15-01-box.html https://doc.rust-lang.org/stable/book/ch15-04-rc.html https://doc.rust-lang.org/stable/book/ch15-04-rc.html
- brundolf 6y agoYeah, I figured they were probably in there somewhere. It's possible I read the book before they were added, or that I skipped them (I glossed over some of the final chapters), or it's possible I just didn't fully grasp how important they were until I followed the linked-list tutorial. What I like about the latter is how closely it steps through the problem-solving process within the context of a very familiar task, teaching you at each stage 1) why the borrow-checker is upset and 2) what tool you need to apply in order to satisfy it. If the Book taught me "what is Rust and what are its features?", this taught me "how do I use Rust in practice?".
- steveklabnik 6y agoOh yeah, don't get me wrong, the linked-list tutorial is amazing. :)
- apendleton 6y agoMeta-answer: my default when picking up a new language is usually to learn just enough to be able to start writing code, and then learn new things piecemeal as necessary to solve whatever thing I'm working on, and it sounds like you're hoping to do something like that here. I found that approach for Rust in particular to not work well at all, and have colleagues who've reported the same. There are some fairly complicated, fundamental concepts that are unique to Rust that I think need to be tackled before you can really do much of anything (mostly borrowing and lifetimes), and that's not immediately obvious from starter programs -- because of lifetime elision, some early programs can look deceptively familiar, but there's a bunch of barely-hidden complexity there, and as soon as you start to stray from the tutorial path, you'll run headfirst into a wall of compiler errors that you're not yet equipped to understand. For Rust I'd highly recommend just reading a book cover to cover first (either TRPL or the O'Reilly one), and then starting to write code.