Skip to content

sigma-andex/scala-fast-vect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

scala-fast-vect πŸ†

Fast, type-safe vector libary for Scala. This library is a port of my Purescript library purescript-fast-vect and both libs are heavily inspired by Idris. A vector is list with its size encoded in the type.

Usage

import fastvect.*
import fastvect.list.{given, *}

val zero: Vect[0, String] = Vect.empty[String]
val one: Vect[1, String] = Vect.singleton("a")
val h: String = one.head
val as: Vect[100, String] = Vect.replicate[100, String]("a")
val bs: Vect[200, String] = Vect.replicate[200, String]("b")
val cs: Vect[300, String] = as ++ bs
val ds = cs.drop[99]
val es: String = as.index[99]
val l1: String = Vect.singleton("a").last
val fives: Option[Vect[5, String]] =
  Vect.from[5, String](List("a", "b", "c", "d"))
val xs: Vect[3, String] = (Vect.replicate("a"): Vect[2, String]) :+ "b"
val ys: Vect[4, String] = "c" +: xs
val zs = Vect.from[5, Int](List(1,2,3,4))

About

Fast πŸ†, type-safe vectors for Scala

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages