Ad
  • Custom User Avatar

    This solution fails for ambiguous sampling.

    signal = "11111111000000"
    discrete = map length . group $ signal
    
    minimum discrete == 6
    foldl' gcd 0 discrete == 2
    
  • Custom User Avatar

    There's an option to switch to TypeScript ES6, which supports String.prototype.repeat.

  • Custom User Avatar

    I had the same problem, but it just means there's something else wrong with your code.

    Sometimes the errors you get back don't make any sense.

  • Custom User Avatar

    prop_ext_eq n k = n >= 1 && n <= 10000 && k >= 1 && k <= 100 ==> twoByN n k == twoByN' n k
    It generates integers by

    instance Arbitrary Integer where
      arbitrary = arbitrarySizedIntegral
      shrink    = shrinkIntegral
    

    where

    arbitrarySizedIntegral =
      sized $ \n ->
      inBounds fromInteger (choose (-toInteger n, toInteger n))
    

    first, then checks the constraint, so the upper bound of n is about 100 here.

  • Custom User Avatar

    prop_ext_eq n k = n >= 1 && n <= 10000 && k >= 1 && k <= 100 ==> twoByN n k == twoByN' n k
    It generates integers by

    instance Arbitrary Integer where
      arbitrary = arbitrarySizedIntegral
      shrink    = shrinkIntegral
    

    where

    arbitrarySizedIntegral =
      sized $ \n ->
      inBounds fromInteger (choose (-toInteger n, toInteger n))
    

    first, then checks the constraint, so the upper bound of n is about 100 here.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution