Ad
  • Custom User Avatar

    I used the above image to build an SVG and inline it in the description. See fork

  • Custom User Avatar

    Approved.

  • Custom User Avatar

    The first part is here

    When the underlying iterator is complete, the value attribute of the raised StopIteration instance becomes the value of the yield expression. It can be either set explicitly when raising StopIteration, or automatically when the subiterator is a generator (by returning a value from the subgenerator).

    My understanding (which may be wrong) of the second part is that tee simply returns new iterables which create their own StopIteration exception, rather than it erasing data from the original StopIteration exception and reraising it.

  • Custom User Avatar

    send in Python is a method of generators, and not of iterables, which is why it is "removed" (because tee accepts and returns iterables, not specifically generators). In JS the equivalent of send is simply the argument to next, and is therefore a part of the iterable protocol. It of course doesn't make sense for a cloned iterable to pass on any sent values, so the option would either be to just ignore any sent values, or have solutions enforce no sent value by requiring they throw an error or something.

  • Custom User Avatar

    This makes sense if the aim is to exactly mimic itertools.tee. But if the aim is to simply "clone" iterators, then it seems logical to me that if the original iterator returns a value, then so should its clones. But I agree that either way it should be tested.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    There are 5 ways of taking four out of five numbers ( numbers at different indices are treated as different ).

  • Custom User Avatar

    Not bad. You spelt "corresponding" wrong. The difficulty is talking around the implied solution ..

  • Custom User Avatar

    It was that mischievous dinglerat wasnt it. He's always up to no good.

  • Custom User Avatar

    I had a go at Completely reworking the description. Let me know what you think. Anyone can feel free to fork this to make further improvements.

  • Custom User Avatar

    The description is very badly worded. It is combinations (not permutations) and combinations are made not by values, but by indexes. So a 0 at position 1 is considered different to a 0 at position 2.

  • Custom User Avatar

    Python Fork

    • Fixes typo in description
    • Explicitely imports from solution and preloaded
    • Slightly restructures tests to add @it blocks (this makes it look like lots changed in full tests, but that is mostly just indent)
    • Added one simple fixed test for product types with more than 2 subtypes (since both I and TFeld below ran into problems with this, only in the random tests)

    Very nice kata btw :)

  • Custom User Avatar

    Reminds me of Monty Hall problem for some reason. These probability problems do my head in.

  • Custom User Avatar

    Yeah I thought it might have been a very deliberate choice

  • Loading more items...