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
Code
Diff
  • object FindMultiples:
      def findMultiples: Int => Int = n =>
        (0 until n by 2).filter(i => (i%4)*(i%6) == 0).sum
    
    • object FindMultiples:
    • def findMultiples(n: Int): Int =
    • Seq.range(0, n).filter(i => i % 4 == 0 || i % 6 == 0).sum
    • def findMultiples: Int => Int = n =>
    • (0 until n by 2).filter(i => (i%4)*(i%6) == 0).sum
Code
Diff
  • fn lol() -> fn() -> fn() -> fn() -> u32 {
        ||||||100
    }
    • fn lol() -> fn() -> fn() -> fn() -> u32 {
    • fn lol() -> fn() -> fn() -> u32 {
    • fn lol() -> fn() -> u32 {
    • fn lol() -> u32 {
    • 100
    • }
    • lol
    • }
    • lol
    • }
    • lol
    • ||||||100
    • }
Fundamentals
Strings
Code
Diff
  • reverse_string = lambda string: __import__('functools').reduce(lambda a, b: b + a, string)
    • def reverse_string(string): return string[::-1] #real 1 line anwser
    • reverse_string = lambda string: __import__('functools').reduce(lambda a, b: b + a, string)
Code
Diff
  • use std::ops::Add;
    use num::traits::Zero;
    
    fn sum<T: Copy + Add + Zero>(arr: &[T]) -> T {
        arr.iter().fold(T::zero(), |a, n| a + *n)
    }
    
    • use std::iter::Sum;
    • use std::ops::Add;
    • use num::traits::Zero;
    • fn sum<T: Copy + Sum>(arr: &[T]) -> T {
    • arr.iter().copied().sum()
    • fn sum<T: Copy + Add + Zero>(arr: &[T]) -> T {
    • arr.iter().fold(T::zero(), |a, n| a + *n)
    • }

A Code to combine a string and integer. Where W is result.

Code
Diff
  • #include <string.h>
    #include <stdlib.h>
    char *fanis(char* r, int k) {
        char* w = malloc(strlen(r) + 1);
        if (w != NULL) {
            char* p = w;
            while (*r) { *p++ = k + *r++;}
            *p = '\0'; w = realloc(w, strlen(w) + 1);}return w;}
    
    
    • #include <string.h>
    • #include <stdlib.h>
    • char *fanis(char* r, int k) {
    • char* w = malloc(strlen(r) + 1);
    • if (w != NULL) {
    • char* p = w;
    • while (*r) { *p++ = k + *r++;}
    • *p = '\0'; w = realloc(w, strlen(w) + 1);}return w;}