News for hackers. Stuff that matters.

tikue_

Re:Rust 2018 is here, but what is it? on Thursday December 06, 2018 @07:00PM (#18623792)
Backwards-compatibly changing existing features feels qualitatively the same to me as adding new features. In either case you can ignore them until you need to work on a codebase that uses them.
Re:How an Engineering Company Chose to Migrate to D on Wednesday June 20, 2018 @05:49PM (#17360116)
At least in Rust, capture granularity is per-variable, so I think closures don't contain a stack frame pointer? Though, I'm not sure why this would matter to a user evaluating Rust's closures vs. D's nested fns?
Re:Announcing Rust 1.19 on Thursday July 20, 2017 @05:33PM (#14816479)
Saying library authors are content with their absence is probably a bit too strong. There's not really another option, and I doubt many folks would choose not to author libraries for this reason alone. I personally have found their absence annoying when writing Rust libraries.

I'd probably be in favor of a hard cap on # of function arguments. :)

Re:N-queen puzzle in 4 lines of Scala on Sunday April 10, 2016 @04:25PM (#11467997)
Functional typically implies higher-order functions, of which there are none in that Python code.
Re:Dropbox’s Exodus from the Amazon Cloud on Tuesday March 15, 2016 @01:40AM (#11287658)
What's it like working with Rust full-time? Is it similar to using any other language for a job? Do you find yourself enjoying coding more? Do you get unnecessarily caught up in micro-optimizations for things you wouldn't blink at in Go/Java?
Re:Announcing Rust 1.2 on Friday August 07, 2015 @04:47PM (#10024924)
Every language has different idioms. In many cases, what works in C++ doesn't work in Rust. Generally, anything the book says is bad you should take as qualified to mean bad in the context of Rust programming, not programming at large.
They have them in the Czech Republic, too. I've been on one in Prague.
Re:Announcing Rust 1.0 Beta on Friday April 03, 2015 @07:41PM (#9319235)
I wish `and_then` were named `flat_map` so badly.
Re:A Quick Comparison of Nim vs. Rust on Wednesday January 14, 2015 @03:51AM (#8885050)
Also seems like you could benefit from the entry() api (available on both BTreeMap and HashMap):

http://doc.rust-lang.org/std/collections/struct.BTreeMap.htm...

I think the example used in the docs is your exact use case.

This bit:

  let found = match map.get_mut(..) {
    ..
  }
  if !found {
    ..
  }
can be replaced with

  match map.entry(word) {
      Occupied(mut view) => { *view.get_mut() += 1; }
      Vacant(view) => { view.insert(1); }
  }