Coder Social home page Coder Social logo

Do we need a `rfind_map`? about itertools HOT 5 CLOSED

Xenira avatar Xenira commented on August 20, 2024
Do we need a `rfind_map`?

from itertools.

Comments (5)

scottmcm avatar scottmcm commented on August 20, 2024 1

I've never sure where to stop for adding the reverse versions of things. Like rall and rany feel clearly superfluous, yet rposition is worth it because it's not just .rev().position.

This started me thinking "well why don't you want to write .rev().find_map?", where my guess is that the biggest reason is that rev takes self. So here's a stab at asking libs-api to let you write .as_rev().find_map instead, which would hopefully lessen the need to add more r versions of things: rust-lang/libs-team#385

from itertools.

Philippe-Cholet avatar Philippe-Cholet commented on August 20, 2024

I think the std lib dismissed the idea, probably not more efficient than the alternative. I don't know where to find the info though.

The only thing related I have is #818 (comment) where we had the same thought.

Is it really missing though?

from itertools.

Xenira avatar Xenira commented on August 20, 2024

Just struck me as odd, that there is find_map and no rfind_map. But guess rev() works fine as well and keeps the trait concise.

from itertools.

Xenira avatar Xenira commented on August 20, 2024

Well, maybe a bit constructed, but rall and rany could make sense if you know elements are not evenly distributed and the iterator may short circuit earlier :P

from itertools.

scottmcm avatar scottmcm commented on August 20, 2024

Yeah, not saying that you'd never want to run them backwards, just that they seems unusual enough to not need a dedicated method on DoubleEndedIterator.

from itertools.

Related Issues (20)

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.