GithubHelp home page GithubHelp logo

classicvalues / swift-se0270-range-set Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apple/swift-se0270-range-set

0.0 1.0 0.0 30 KB

Swift Evolution preview package for SE-0270.

License: Apache License 2.0

Swift 100.00%

swift-se0270-range-set's Introduction

SE0270_RangeSet

SE0270_RangeSet is a standalone library that implements the Swift Evolution proposal SE-0270: Add Collection Operations on Noncontiguous Elements. You can use this package independently, or as part of the standard library preview package.

Functionality

SE0270_RangeSet provides operations on noncontiguous subranges of collections, such as subranges(where:) and moveSubranges(_:to:), as well as the supporting RangeSet type.

import SE0270_RangeSet

var numbers = [10, 12, -5, 14, -3, -9, 15]
let negatives = numbers.subranges(where: { $0 < 0 })
// numbers[negatives].count == 3

numbers.moveSubranges(negatives, to: 0)
// numbers == [-5, -3, -9, 10, 12, 14, 15]

Usage

You can add this library as a dependency to any Swift package. Add this line to the dependencies parameter in your Package.swift file:

.package(
    url: "https://github.com/apple/swift-se0270-range-set",
    from: "1.0.0"),

Next, add the module as a dependency for your targets that will use the library:

.product(name: "SE0270_RangeSet", package: "swift-se0270-range-set"),

You can now use import SE0270_RangeSet to make the library available in any Swift file.

Contributing

Contributions to this package and the standard library preview package are welcomed and encouraged!

swift-se0270-range-set's People

Contributors

glessard avatar natecook1000 avatar classicvalues avatar mend-bolt-for-github[bot] avatar

Watchers

 avatar

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.