Start a new Kumite
AllAgda (Beta)BF (Beta)CCFML (Beta)ClojureCOBOL (Beta)CoffeeScriptCommonLisp (Beta)CoqC++CrystalC#D (Beta)DartElixirElm (Beta)Erlang (Beta)Factor (Beta)Forth (Beta)Fortran (Beta)F#GoGroovyHaskellHaxe (Beta)Idris (Beta)JavaJavaScriptJulia (Beta)Kotlinλ Calculus (Beta)LeanLuaNASMNim (Beta)Objective-C (Beta)OCaml (Beta)Pascal (Beta)Perl (Beta)PHPPowerShell (Beta)Prolog (Beta)PureScript (Beta)PythonR (Beta)RacketRaku (Beta)Reason (Beta)RISC-V (Beta)RubyRustScalaShellSolidity (Beta)SQLSwiftTypeScriptVB (Beta)
Show only mine

Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

Ad
Ad
Fundamentals
Code
Diff
  • d=lambda:"⚅"               
    • d=lambda:"⚅" # chosen by fair dice roll.
    • # guaranteed to be random.
    • d=lambda:"⚅"
Code
Diff
  • m=(a,b)->a*b+1
    {:m}
    • -- Moonscript!
    • multiply_and_add_one = (a, b) -> a * b + 1
    • { :multiply_and_add_one }
    • m=(a,b)->a*b+1
    • {:m}
Lists
Code
Diff
  • #include <vector>
    
    void re_arrange(std::vector<int>& data) {
        std::sort(data.begin(), data.end(), [](int x, int y) { return std::make_pair(x % 2 != 0, x) < std::make_pair(y % 2 != 0, y); });
    }
    • #include <vector>
    • void re_arrange(std::vector<int>& data) {
    • auto it = std::partition(data.begin(), data.end(), [](int x) { return x % 2 == 0; });
    • std::sort(data.begin(), it);
    • std::sort(it, data.end());
    • std::sort(data.begin(), data.end(), [](int x, int y) { return std::make_pair(x % 2 != 0, x) < std::make_pair(y % 2 != 0, y); });
    • }
Test Cases
Diff
  • import org.junit.jupiter.params.ParameterizedTest;
    import org.junit.jupiter.params.provider.Arguments;
    import org.junit.jupiter.params.provider.MethodSource;
    
    import java.util.stream.Stream;
    
    import static org.assertj.core.api.Assertions.assertThat;
    
    
    class SolutionTest {
      
        @ParameterizedTest
        @MethodSource("testCases")
        public void expectedValueForTestCase(String inputName, String expectedOutputValue) {
            assertThat(greet.greet(inputName))
                    .as("It should return the expected value for %s", inputName)
                    .isEqualTo(expectedOutputValue);
        }
    
        public static Stream<Arguments> testCases() {
            return Stream.of(
                    Arguments.of("Reemu", "hello my name is Reemu"),
                    Arguments.of("Pepo", "hello my name is Pepo"),
                    Arguments.of("Delacroix", "hello my name is Delacroix"),
                    Arguments.of("Toto", "hello my name is Toto")
            );
        }
    
        private final Greet greet = new Greet();
    }
    
    • import org.junit.jupiter.params.ParameterizedTest;
    • import org.junit.jupiter.params.provider.Arguments;
    • import org.junit.jupiter.params.provider.MethodSource;
    • import java.util.stream.Stream;
    • import static org.assertj.core.api.Assertions.assertThat;
    • class SolutionTest {
    • @ParameterizedTest
    • @MethodSource("testCases")
    • public void it_should_return_the_expected_value_for_test_case(String inputName, String expectedOutputValue) {
    • public void expectedValueForTestCase(String inputName, String expectedOutputValue) {
    • assertThat(greet.greet(inputName))
    • .as("It should return the expected value for %s", inputName)
    • .isEqualTo(expectedOutputValue);
    • }
    • public static Stream<Arguments> testCases() {
    • return Stream.of(
    • Arguments.of("Reemu", "hello my name is Reemu"),
    • Arguments.of("Pepo", "hello my name is Pepo"),
    • Arguments.of("Delacroix", "hello my name is Delacroix"),
    • Arguments.of("Toto", "hello my name is Toto")
    • );
    • }
    • private final Greet greet = new Greet();
    • }
Code
Diff
  • a=lambda x:1
    • above_two=lambda x:1
    • a=lambda x:1