« first day (1210 days earlier)      last day (565 days later) » 

13:46
Behold, the nastiness of porting python generators to scala
  def cartesianProduct(left: VAny, right: VAny)(using ctx: Context): VList =
    val leftList = makeIterable(left)
    val rightList = makeIterable(right)

    val result = LazyList.unfold(
      BigInt(0),
      Option[BigInt](null),
      Option[BigInt](null),
      BigInt(0),
      BigInt(0)
    )(state =>
      var (
        diagNum,
        lhsMax,
        rhsMax,
        lhsStart,
        lhsEnd
      ) = state

      lhsStart =
        if rhsMax.isDefined then BigInt(0).max(diagNum - rhsMax.get)
Lyxal pushed a commit to Vyxal/v3-momentum-branch-2: Implement the v2 version of cartesian product
Lyxal pushed a commit to Vyxal/v3-momentum-branch-2: Remove debug comment
Turns out I did need a Tuple5 after all
it's just a Tuple5 of [BigInt, Option[BigInt], Option[BigInt], BigInt, BigInt] instead :p
> [1,2,3] [4,5,6,7] cart
[[1|4]|[1|5]|[2|4]|[1|6]|[2|5]|[3|4]|[1|7]|[2|6]|[3|5]|[2|7]|[3|6]|[3|7]]
It works
 
4 hours later…
18:01
@lyxal you can just use yield if you use the python 3 compiler instead.
 
1 hour later…
19:21
@TheEmptyStringPhotographer vyxal 3 is written in Scala
 
4 hours later…
23:18
Todo: make function literals be recognised as a nilad
Helps with nilad moving and arity binding
Also, I need to look into if function parameters are actually being read and accessed correctly
@TheThonnu I mean, we do include a free copy of the python language in v3, so maybe it's plausible
See? That's clearly python evaluation

« first day (1210 days earlier)      last day (565 days later) »