Skip to content
This repository has been archived by the owner. It is now read-only.
psp's non-standard standard library (for scala)
Scala Shell
Branch: master
Clone or download
Latest commit 9ba4b07 Mar 16, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ci
benchmark Update config of and run scalafmt. Mar 30, 2017
bin
doc
macros/src
project
std/src
.codecov.yml
.gitignore Added eclipse related entries to .gitignore Feb 14, 2015
.scalafmt.conf
.travis.yml sbt 1.0, scala 2.12.3. Sep 24, 2017
LICENSE
README.md Commit to 2.12. Mar 30, 2017
build.sbt

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+

You can’t perform that action at this time.