Live data from Hacker News

Show HN: Algorithm Cookbook in Rust

github.com

41–50 of 73 posts

Re: Show HN: Algorithm Cookbook in Rust

#41
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.

I'm pretty sure any technology that could do that would also obviate programmers for most tasks, since it apparently understands how to program and learn new programming technologies well enough to implement algorithms both correctly and idiomatically based on a specification.

Re: Show HN: Algorithm Cookbook in Rust

#42

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.

> Data structures and algorithms are possibly the hardest part of Rust to dive into

What else is there?

Re: Show HN: Algorithm Cookbook in Rust

#43

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?

[deleted]

Re: Show HN: Algorithm Cookbook in Rust

#44
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.

Like dynamic libraries and FFI? Reimplementing algorithms is the only viable way to get them completely in a new language. It's also the only viable way to improve them.

Re: Show HN: Algorithm Cookbook in Rust

#45
post #42

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.

> Data structures and algorithms are possibly the hardest part of Rust to dive into What else is there?

I think it was too much for the. to say "Data structures AND algorithms". It is mostly data structures that can be difficult.

Re: Show HN: Algorithm Cookbook in Rust

#46
post #42

Earlier quoted context omitted.

> Data structures and algorithms are possibly the hardest part of Rust to dive into What else is there?

I think it was too much for the. to say "Data structures AND algorithms". It is mostly data structures that can be difficult.

Agreed. It's very unnatural to represent data structures with circular references, or pointers in general. I had to re-think how I approach certain problems to make it more Rust-friendly.

Re: Show HN: Algorithm Cookbook in Rust

#47
post #12

"My other goal is to show developers that C++ and Java kinda suck" -- really?!

Rust is one of my favorite programming language, and yet I learned how much I missed java after learning Rust. The fact that everything is dynamically dispatched and non-primitives are referential type allows you to program things without thinking too much. Plus, JIT & Hotspot can optimize these away - perform stack allocations for local objects and short-circuit dynamic dispatch for nonvirtual functions.

That said, my biggest Rust-gripe has been writing recursive / self-referential data structures. Borrow system is just not very convenient for that and you end up restructing the code to be a bit more Rust-friendly.

Re: Show HN: Algorithm Cookbook in Rust

#48
post #12

"My other goal is to show developers that C++ and Java kinda suck" -- really?!

It's not achieving it though. The code could be more idiomatic and the project could have a better file organization.

Suggestions are welcome; I'm still learning Rust.

To put context around my provocative comment earlier: I write C++ professionally. C++ is the right choice for my organization, though for purely historical reasons. In the long run, I think we'd all be better off if Rust or similar languages replaced their predecessors. So my comment came from a place of personal frustration, the same that led me to find Rust in the first place.

The old wording was too negative; I'm just excited to show that contest programming, which one might imagine to be hard to translate, is not only practical but indeed arguably nicer in Rust.

Re: Show HN: Algorithm Cookbook in Rust

#50
post #48

Earlier quoted context omitted.

It's not achieving it though. The code could be more idiomatic and the project could have a better file organization.

Suggestions are welcome; I'm still learning Rust. To put context around my provocative comment earlier: I write C++ professionally. C++ is the right choice for my organization, though for purely historical reasons. In the long run, I think we'd all be better off if Rust or similar languages replaced their predecessors. So my comment came from a place of personal frustration, the same that led me to find Rust in the f…

Just be careful to not adapt the michaelochurch approach. Very risky :)
Post reply on HN