Live data from Hacker News

Show HN: Algorithm Cookbook in Rust

github.com

21–30 of 73 posts

Re: Show HN: Algorithm Cookbook in Rust

#21

Thank you. But it seems not finished? I am trying to implement some basic data structures and algorithms in Rust, but the compiler nearly kills me. Is there any data structure & algorithms implementation tutorials for Rust newbies, like Learning_ Rust_With_Entirely_Too_Many_Linked_Lists[1]? [1]: http://cglab.ca/~abeinges/blah/too-many-lists/book/README.ht...

Data structures and algorithms are possibly the hardest part of Rust to dive into unless you have a really good reason. The best advice for newbies is to learn with other stuff and use existing algorithms. Of course, if you are trying to implement stuff for a class or something similar then you might be out of luck, and might consider trying the Rust IRC and such to work through the errors as they come up.

Re: Show HN: Algorithm Cookbook in Rust

#22
post #20
post #13

Earlier quoted context omitted.

Yeah, it's a pretty poor way to represent Rust to an audience that is ostensibly it's target audience.

Fair point, it's fixed now.

Would be a stronger argument if you had a better rating on CF :) As of now I will stick to the Petr / Egor philosophy.

Re: Show HN: Algorithm Cookbook in Rust

#24

Thank you. But it seems not finished? I am trying to implement some basic data structures and algorithms in Rust, but the compiler nearly kills me. Is there any data structure & algorithms implementation tutorials for Rust newbies, like Learning_ Rust_With_Entirely_Too_Many_Linked_Lists[1]? [1]: http://cglab.ca/~abeinges/blah/too-many-lists/book/README.ht...

Data structures and algorithms are possibly the hardest part of Rust to dive into unless you have a really good reason. The best advice for newbies is to learn with other stuff and use existing algorithms. Of course, if you are trying to implement stuff for a class or something similar then you might be out of luck, and might consider trying the Rust IRC and such to work through the errors as they come up.

So what is the point of a language in which things are hard to implement?

Re: Show HN: Algorithm Cookbook in Rust

#25
post #20

Earlier quoted context omitted.

Fair point, it's fixed now.

Would be a stronger argument if you had a better rating on CF :) As of now I will stick to the Petr / Egor philosophy.

What's their philosophy? I think Petr was using C# at some point.

Re: Show HN: Algorithm Cookbook in Rust

#26

Thank you. But it seems not finished? I am trying to implement some basic data structures and algorithms in Rust, but the compiler nearly kills me. Is there any data structure & algorithms implementation tutorials for Rust newbies, like Learning_ Rust_With_Entirely_Too_Many_Linked_Lists[1]? [1]: http://cglab.ca/~abeinges/blah/too-many-lists/book/README.ht...

Data structures and algorithms are possibly the hardest part of Rust to dive into unless you have a really good reason. The best advice for newbies is to learn with other stuff and use existing algorithms. Of course, if you are trying to implement stuff for a class or something similar then you might be out of luck, and might consider trying the Rust IRC and such to work through the errors as they come up.

I made this cookbook specifically to show it doesn't have to be so hard. While designing an industrial-strength data structure library is an advanced skill, there are easier ways to implement the core ideas that should suffice for contest and coursework purposes. Very few people have to build actual libraries.

Re: Show HN: Algorithm Cookbook in Rust

#27
post #25

Earlier quoted context omitted.

Would be a stronger argument if you had a better rating on CF :) As of now I will stick to the Petr / Egor philosophy.

What's their philosophy? I think Petr was using C# at some point.

Well I would say their philosophy first of all relies on strong tools. Intellij with CHelper plugin allows for simpler testing and also has incredibly powerful debugging as I am sure you have seen in their screencasts.

Also I think they sort of show the value of Java's simpler approach with everything being a reference in terms of writing code quickly. The alternative approach that C++ competitors use relies on a very specific style unlike what production code at say Google uses, with pointers used as sparingly as possible. With everything being a reference it is much easier to work with graphs for instance.

To me Rust goes even further into the C++ direction where it becomes more and more difficult to quickly write code that compiles. With Java I have no issue writing 100 lines and having everything compile the first time around, particularly with an editor like Intellij. With C++ even Clion struggles significantly with producing helpful info, simply due to the complexity of C++.

Anyway don’t have enough time to really eloquently think through all aspects of this. Also I was just kidding about CF rating, you are far better than me obviously.

Re: Show HN: Algorithm Cookbook in Rust

#28
post #11

To add to the list, here's my rust-noob implementation of the Kalman filter. https://github.com/rbagd/rust-linearkalman

GPL3 means it's not very reusable in any projects that aren't GPL3. Have you considered a BSD or MIT license? or CC0 if you want to get code reuse? Or at the very least LGPL2

Re: Show HN: Algorithm Cookbook in Rust

#29

Earlier quoted context omitted.

Data structures and algorithms are possibly the hardest part of Rust to dive into unless you have a really good reason. The best advice for newbies is to learn with other stuff and use existing algorithms. Of course, if you are trying to implement stuff for a class or something similar then you might be out of luck, and might consider trying the Rust IRC and such to work through the errors as they come up.

So what is the point of a language in which things are hard to implement?

It's not any harder to correctly implement a data structure, even an "advanced" one, in Rust-with-unsafe than it is in C++-with-exceptions. I don't know where this meme comes from.

Re: Show HN: Algorithm Cookbook in Rust

#30
post #19

Offtopic/meta. I'm wondering about a technology that allows us to NOT re-implement an algorithm cookbook every time a new language shows up.

yea, I'm convinced it's possible to at least save a ton of work there. Probably not for optimized libs, but something is much better than nothing.

Rust though might be an example where such a thing wouldn't work (had it already existed), since the type system is legitimately different. But some things might work, and even a test suite you could develop against would be wonderful.

Post reply on HN