psp's non-standard standard library (for scala)
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.ci sbt 1.0, scala 2.12.3. Sep 24, 2017
benchmark Update config of and run scalafmt. Mar 30, 2017
bin Add scalafmt. May 9, 2016
doc Doc, etc. May 20, 2016
macros/src Update config of and run scalafmt. Mar 30, 2017
project scala 2.12.4, sbt 1.1.0. Jan 8, 2018
std/src
.codecov.yml Maybe fix codecov yaml. May 11, 2016
.gitignore Added eclipse related entries to .gitignore Feb 14, 2015
.scalafmt.conf Update config of and run scalafmt. Mar 30, 2017
.travis.yml sbt 1.0, scala 2.12.3. Sep 24, 2017
LICENSE Initial Import Aug 9, 2014
README.md Commit to 2.12. Mar 30, 2017
build.sbt scala 2.12.4, sbt 1.1.0. Jan 8, 2018

README.md

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+