Coder Social home page Coder Social logo

psp-std's Introduction

psp.std - a non-standard library

Build Status codecov Join the chat

Background

The scala standard library is deficient in many ways. This library is an attempt to rebuild it with some attention given to consistency, performance, and correctness. See views for some details. See overview for the project layout.

Usage

Suggested contents for a basic build.sbt follows. Note that the console transcript as seen requires more project code than this. The standard scala repl can't handle -Yno-imports, so psp-std derives a new console task from ammonite.

              scalaVersion :=  "2.12.1"
                 resolvers +=  Opts.resolver.sonatypeReleases
             scalacOptions ++= Seq("-language:_", "-Yno-predef")
initialCommands in console :=  "import psp.std._, all._, StdShow._"
       libraryDependencies +=  "org.improving" %% "psp-std" % "0.6.1"

Then sbt console and you can look around. [Not at the moment.]

% sbt console
psp-std repl (ammonite 0.5.7, scala 2.11.8, jvm 1.8.0_92)

psp> val xs = 1 to 20 splitAfter 10.size
xs: Split[Int] = [ 1, 2, 3, ... ] / [ 11, 12, 13, ... ]

psp> xs mapLeft (_ dropRight 8) join
res0: View[Int] = [ 1, 2, 11, ... ]

psp> xs.zip filterRight (_ % 3 === 0)
res1: Zip[Int, Int] = [ 2 -> 12, 5 -> 15, 8 -> 18 ]

psp> val ys = zipCross(1 to 3, view("a", "bb"))
ys: Zip[Int, String] = [ 1 -> a, 1 -> bb, 2 -> a, 2 -> bb, 3 -> a, 3 -> bb ]

psp> val zs = ys eqBy (x => x, _.length)
same: Zip[Int, String] = [ 1 -> a, 2 -> bb ]

psp> zs.rights joinWith '/'
res2: String = a/bb

Requirements

scala 2.12, java 8, sbt 0.13.13+

psp-std's People

Contributors

paulp avatar dwijnand avatar eecolor avatar gildegoma avatar gitter-badger avatar

Watchers

Gábor Bakos avatar  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.