Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created June 9, 2015 12:59
Show Gist options
  • Save xuwei-k/45616dddc87131c22aa0 to your computer and use it in GitHub Desktop.
Save xuwei-k/45616dddc87131c22aa0 to your computer and use it in GitHub Desktop.
functional java F1 Arbitrary
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import fj._, test._
import fj._
import test._
scala> Arbitrary.arbArray(Arbitrary.arbF(Coarbitrary.coarbInteger, Arbitrary.arbInteger)).gen.gen(100, Rand.standard).array.map(_.asInstanceOf[fj.F[Integer, Integer]]).map{f => (1 to 5).map{a => f.f(a)}} foreach println
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Vector(36, -68, -33, 63, 98)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment