So I found this Haskell answer on SO that did cartesian product and got this (seemingly working) Scala code
def cartProdMulti(left: VList, right: VList)(using Context): VList =
// Based off of stackoverflow.com/a/20516638
// TODO generalize to a finite list of infinite lists
val lhs = makeIterable(left)
val rhs = makeIterable(right)
val prodIt = lhs.iterator.map(l => rhs.iterator.map(r => VList(l, r)))
val touched = mut.ListBuffer.empty[Iterator[VAny]]
def gen(): LazyList[VAny] =
touched.filterInPlace(_.hasNext)
val diag = touched.map(_.next()).to(LazyList)
Could you have a look over it and see if it's the same behavior?
You are to accept, on standard input, one number. You will then output the negation of that number. Your code will do nothing else. You may accept various formats if you wish (like "one" or ("uno+2.4e10i"). You may also output it how ever you wish. Note that these formats mush have existed somewh...
What if on the new vyxal 3 interpreter, we could have a new like "tabs" layout where you can move the inputs and output and stuff wherever you want and make a nice layout
@lyxal The current implementation can be the main cartesian product function, yeah. I was planning on generalizing it to work on a list of lists but that can be done later
I mean, even just making the tabs forced to be in one column on mobile would work
+ making the side bar hideable
oh and making it so that there's no fixed height
+ disabling moving tabs on mobile
Something like that kinda
The tabs layout also has the advantages of being unique among a sea of TIO styled pages and also allowing the option for user defined tabs to be a possibility