Skip to content

Instantly share code, notes, and snippets.

View Quafadas's full-sized avatar

Simon Parten Quafadas

  • Schroders
  • Zürich
View GitHub Profile
@Quafadas
Quafadas / scautableGSoC2025.md
Last active September 1, 2025 09:08 — forked from Kvintochka/scautableGSoC2025.md
GSoC2025: A Pandas Experience. SCala AUto TABLE

A Pandas Experience. SCala AUto TABLE

Introduction

Scautable aims to make working with tabular data in Scala more convenient and intuitive. The idea came from the desire to bring the CSV-handling experience closer to the the "pythonic" Pandas-like experience, while leveraging the (statically, strongly typed) strengths of the Scala ecosystem.

The focus was on ensuring compile-time validation of data structures. This required using Scala’s type system and macros, which enable automatic type derivation from data using new features (specifically NamedTuples) released in scala 3.7.x.

Summary Report

{
"$schema": "https://vega.github.io/schema/vega-lite/v6.json",
"data": {"url": "data/cars.json"},
"hconcat": [
{
"mark": {"type":"bar", "tooltip": true},
"encoding": {
"x": {
"bin": {"maxbins": 15},
"field": "Horsepower",
val tr = "1" *: "2" *: "3" *: EmptyTuple *: EmptyTuple
println(tr)
println(s"Arity of the tuple: ${tr.productArity}")
println(tr)
println
val ts = Tuple1("1") :* "2" :* "3" :* EmptyTuple :* EmptyTuple
println(ts)
println(s"Arity of the tuple: ${ts.productArity}")
println(ts)
//> using scala 3.6.1
//> using dep io.github.quafadas::vecxt::0.0.22
//> using javaOpt --add-modules=jdk.incubator.vector
//> using dep org.typelevel::spire::0.18.0
//> using platform jvm
import vecxt.all.*
import narr.*
import vecxt.BoundsCheck.DoBoundsCheck.no
@Quafadas
Quafadas / upickleTest.scala
Last active July 24, 2023 10:17
test upickle
//> using dep com.lihaoyi::upickle::3.1.2
import upickle.default.*
sealed trait DPage
case class UserPage(userId: Int) extends DPage
case object LoginPage extends DPage
implicit val UserPageRW: ReadWriter[UserPage] = macroRW
implicit val rw: ReadWriter[DPage] = macroRW
@Quafadas
Quafadas / SaddleTest.scala
Last active June 16, 2023 07:12
Experiment with saddle
import org.saddle._
import cats.syntax.all._
import org.saddle.ops.BinOps._
import scautable.{*, given}
import viz.extensions.*
import viz.PlotTargets.desktopBrowser
@main def SaddleTest =
//val v = .map(_.toDouble).toArray
val x = Vec( 1 to 10 :_* )
//> using dep "com.lihaoyi::upickle:3.0.0"
object OptionPickler extends upickle.AttributeTagged {
import upickle.default.Writer
import upickle.default.Reader
override implicit def OptionWriter[T: Writer]: Writer[Option[T]] =
implicitly[Writer[T]].comap[Option[T]] {
case None => null.asInstanceOf[T]
case Some(x) => x
//> using dep "com.lihaoyi::upickle:3.0.0"
import upickle.default.*
case class ChildData(
val a: BreakyBreaky
) derives ReadWriter
case class BreakyBreaky() derives ReadWriter
@main def runMe = {
@Quafadas
Quafadas / BigTwiddle.sc
Last active January 27, 2023 10:36
Make a big skunk twiddle given
@main def test(arity: Int) =
val useableLetters = ('A' to 'Z').filterNot(in => in == 'M' | in == 'P').mkString("")
//println(useableLetters)
//println(useableLetters.combinations(1).take(10).toList)
def calculateType(arity: Int) =
val combs = if (arity > useableLetters.length ) 2 else 1
//println(combs)
val combinations = useableLetters.mkString("").combinations(combs).take(arity).toList
val makeTypes = combinations.map(_.mkString(""))
@Quafadas
Quafadas / TopLevel.scala
Last active January 19, 2023 08:50
Works locally, struggles in CI
package quicktype
import scala.util.Try
import io.circe.syntax._
import io.circe._
import cats.syntax.functor._
// For serialising string unions
given [A <: Singleton](using A <:< String): Decoder[A] = Decoder.decodeString.emapTry(x => Try(x.asInstanceOf[A]))
given [A <: Singleton](using ev: A <:< String): Encoder[A] = Encoder.encodeString.contramap(ev)