From 188a05ec883c355ec5cb005f4d91834eca5cac51 Mon Sep 17 00:00:00 2001 From: Simon Parten Date: Thu, 12 Dec 2024 20:44:12 +0100 Subject: [PATCH] . --- build.mill | 10 +++++++++- jsSite/src/BenchmarkPlots.scala | 2 ++ jsSite/src/PlotElements.scala | 4 ++-- jsSite/src/facade.scala | 2 ++ site/docs/_docs/benchmarks/sum.mdoc.md | 1 + site/docs/_docs/examples.mdoc.md | 4 ++-- vecxt/js/src/array.scala | 10 ---------- vecxt/jvm/src/arrays.scala | 1 + 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/build.mill b/build.mill index 5b323ad..156369e 100644 --- a/build.mill +++ b/build.mill @@ -1,7 +1,7 @@ import mill.scalalib.publish.Scope.Test import $ivy.`com.github.lolgab::mill-crossplatform::0.2.4` -import $ivy.`io.github.quafadas:millSite_mill0.12_2.13:0.0.36` +import $ivy.`io.github.quafadas:millSite_mill0.12_2.13:0.0.37-DIRTYafea46f4` import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0` import $ivy.`com.lihaoyi::mill-contrib-jmh:` import $ivy.`com.goyeau::mill-scalafix::0.4.2` @@ -178,6 +178,12 @@ object jsSite extends SiteJSModule { override def moduleDeps = Seq(vecxt.js, vecxtensions.js) override def scalaVersion = vecxt.js.scalaVersion override def scalaJSVersion = vecxt.js.scalaJSVersion + + override def scalaJsCompilerVersion: String = "3.6.2" + + + // override def allScalacOptions: T[Seq[String]] = super.allScalacOptions`() ++ Seq("-experimental", "-language:experimental.namedTuples") + override def scalacOptions: T[Seq[String]] = super.scalacOptions() ++ Seq("-experimental", "-language:experimental.namedTuples") override def moduleKind = ModuleKind.ESModule override def ivyDeps = super.ivyDeps() ++ Agg( ivy"org.scala-js::scalajs-dom::2.8.0", @@ -206,4 +212,6 @@ object site extends SiteModule { override def moduleDeps = Seq(vecxt.jvm) override def scalaDocOptions = super.scalaDocOptions + override def scalacOptions: T[Seq[String]] = super.scalacOptions() ++ Seq("-experimental", "-language:experimental.namedTuples") + } \ No newline at end of file diff --git a/jsSite/src/BenchmarkPlots.scala b/jsSite/src/BenchmarkPlots.scala index 2d52745..40b988e 100644 --- a/jsSite/src/BenchmarkPlots.scala +++ b/jsSite/src/BenchmarkPlots.scala @@ -4,7 +4,9 @@ import scala.NamedTuple.AnyNamedTuple import scala.annotation.meta.field import upickle.default.* import NamedTupleReadWriter.given +import scala.annotation.experimental +@experimental() object BenchmarkPlots: def addScalarBenchmark: String = val thePlot = BenchmarkPlotElements.schema ++ diff --git a/jsSite/src/PlotElements.scala b/jsSite/src/PlotElements.scala index 00e0894..0c359d2 100644 --- a/jsSite/src/PlotElements.scala +++ b/jsSite/src/PlotElements.scala @@ -1,13 +1,13 @@ package vecxt.plot -import scala.NamedTuple.* +// import scala.NamedTuple.* import scala.annotation.meta.field import upickle.default.* import NamedTupleReadWriter.given import scala.collection.immutable.Stream.Empty object BenchmarkPlotElements: - final val schema = (`$schema` = "https://vega.github.io/schema/vega-lite/v5.json") + final val schema: ($schema: String) = (`$schema` = "https://vega.github.io/schema/vega-lite/v5.json") val fakeData = ( data = ( diff --git a/jsSite/src/facade.scala b/jsSite/src/facade.scala index 1e2823d..2e493fd 100644 --- a/jsSite/src/facade.scala +++ b/jsSite/src/facade.scala @@ -27,7 +27,9 @@ import org.scalajs.dom.Element import scala.util.Random import org.scalajs.dom.Element import org.scalajs.dom.XMLHttpRequest +import scala.annotation.experimental +@experimental() object showJsDocs: def apply(path: String, node: Element, width: Int = 50) = val child = dom.document.createElement("div") diff --git a/site/docs/_docs/benchmarks/sum.mdoc.md b/site/docs/_docs/benchmarks/sum.mdoc.md index cf4d0d1..bf88e19 100644 --- a/site/docs/_docs/benchmarks/sum.mdoc.md +++ b/site/docs/_docs/benchmarks/sum.mdoc.md @@ -18,6 +18,7 @@ And the function left in vexct over time (against regressions) ```scala mdoc:js sc:nocompile import vecxt.plot.* import vecxt.facades.* + showJsDocs.fromSpec(BenchmarkPlots.sumBenchmarkOverTime, node) ``` diff --git a/site/docs/_docs/examples.mdoc.md b/site/docs/_docs/examples.mdoc.md index 06fa443..1b74223 100644 --- a/site/docs/_docs/examples.mdoc.md +++ b/site/docs/_docs/examples.mdoc.md @@ -33,9 +33,9 @@ cosineSimilarity(v1, v2) (v1(v1 <= 2)).printArr ``` -And Ints +And Ints. Note that the API here is more limited at the moment. -```scala mdoc +```scala mdoc:reset import vecxt.all.* import narr.* import vecxt.BoundsCheck.DoBoundsCheck.yes diff --git a/vecxt/js/src/array.scala b/vecxt/js/src/array.scala index 085ac1b..604b133 100644 --- a/vecxt/js/src/array.scala +++ b/vecxt/js/src/array.scala @@ -75,16 +75,6 @@ object arrays: end for result end || - - // def copy: Array[Boolean] = - // val copyOfThisVector: Array[Boolean] = new Array[Boolean](vec.length) - // var i = 0 - // while i < vec.length do - // copyOfThisVector(i) = vec(i) - // i = i + 1 - // end while - // copyOfThisVector - // end copy end extension extension (vec: NArray[Double]) diff --git a/vecxt/jvm/src/arrays.scala b/vecxt/jvm/src/arrays.scala index ab032d4..2fbc286 100644 --- a/vecxt/jvm/src/arrays.scala +++ b/vecxt/jvm/src/arrays.scala @@ -132,6 +132,7 @@ object arrays: end extension extension (vec: Array[Int]) + inline def =:=(num: Int): Array[Boolean] = logicalIdx(VectorOperators.EQ, num)