Hacker Newsnew | past | comments | ask | show | jobs | submit | madiyar's commentslogin

This is probably obvious and it isn't 100% alternative to Javascript syntax, but you can leverage Default trait to come a bit closer:

  #[derive(Default)]
  struct Person {
      name: String,
      email: Option<String>,
  }

  fn main() {
      let person = Person {
          name: "John Doe".to_owned(),
          ..Default::default()
      };
  }


The deal breaker with `..Default::default()` is that it only works for structs without any required fields.

Forgetting a required field just means you get the dummy value from Default, that is, if you even manage to implement Default for the struct at all (the required fields may not have a sensible default value)


It would be really nice if .. could be a shortcut for ..Default::default() which would match the syntax of pattern matching.


This collection of Jupyter notebooks that reproduces graphics and implements algorithms from the book could be a nice supplementary resource. https://github.com/maitbayev/the-elements-of-statistical-lea...


Dang, I was really hoping to find examples of the MCMC methods in Ch. 8.

A strong point in the "Introduction to Statistical Learning" by the authors is that each chapter ends with example programs in R (albeit with a fair number of typos).


One free alternative is Snapchat app. I am using it as a camera app as well as a camera roll (Memories).


I can also recommend https://github.com/maitbayev/the-elements-of-statistical-lea... as a supplementary resource that reproduces graphics and implements algorithms from scratch from the book.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: