Coder Social home page Coder Social logo

cookbook's Introduction

cookbook

A collection of delicious recipes for the Rust programming language. Bon Appétit.

Todo

A list of topics that are worth considering. Some of these topics have been taken from the Python 3 Cookbook.

  • ** Iterators **
    • Finding the largest or smallest N Items in an Slice, Iterator, or Range(?) object like a Set.
    • Implementing a Priority Queue (Constructing an iterator problem).
    • Implementing a mutable iterator.
    • Intersecting Hasmaps? Union of Hashmaps?
    • Deduplicating items in an iterator.
    • Finding most requently occuring item in slice or general iterator.
    • Doing a "GroupBy" while iterating over product types.
    • Expanding a list, ie: using flat_map, like x.iter().flat_map(|&n| vec![n, n+1, n+2]).collect().
  • borrowck issues! D:
    • Borrowed self in if {} else {} clasue SO ref
    • Mutating self after borrowing self. SO ref
    • Using lifetimes to control your borrows. SO ref
    • Good question, what's the morale of the story? SO ref
    • When to clarify when you need iter, into_iter, or iter_mut? SO ref
    • Coerce multiple iterators, and iterator proxy. Ie, why doesn't this work:
      for y in if reverse { (0..4).rev() } else { 0..4 } { ..
      
      https://is.gd/ScNcpy -steveklabnik
  • Closures Closures Closures!!
    • Functions that return functions, see this SO ref
    • Get some good examples from this post here
  • ** Uncategorized **
    • Caching function return values. Hygiene?

cookbook's People

Contributors

cbreeden avatar

Stargazers

Med0paW avatar Maciej Wereski avatar Grzegorz Wierzowiecki avatar Chang-Jae Lee avatar Yaskhan avatar Nathan Moos avatar

Watchers

Nathan Moos avatar James Cloos avatar  avatar

Forkers

moosingin3space

cookbook's Issues

Iterator/Vec examples

  • Iterate while appending, imperative
  • Iterate while appending, functional
  • Remove elements in-place
  • Filter
  • Borrowck concerns when passing Iterators around
  • Accumulator pattern (fold)
  • Demonstrate what flat_map means

If you can think of any more, leave them in the comments.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.