Question: I'm new to scala, I'm used to coding in Haskell instead, the code below is my Haskell code, I'm turning my old Haskell files to

I'm new to scala, I'm used to coding in Haskell instead, the code below is my Haskell code, I'm turning my old Haskell files to Scala, can someone help me out? how will it look like if I have to turn it in to Scala code or Scala pseudocode?

This is my Haskell code:

howManyShuffles :: ([Integer] -> [Integer]) -> [Integer] -> [Integer] -> Integer

howManyShuffles func l1 l2 = delta func l1 l2 0

where delta func l1 l2 n

| l1 == l2 = n

| n > 100 = error "Cannot achieve shuffle."

| otherwise = delta func (func l1) l2 (n + 1)

[howManyShuffles is a function which takes three parameters: a shuffle function (such as outshuffle or inshuffle), and two lists of even size. It keeps applying the shuffle function on the first of the two lists, until it becomes identical to the second list, and returns the count of the number of shuffles that were required.]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!