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
Numbers
Data Types
Integers
Code
Diff
  • class Odd
      def odd(n)
        n % 2 == 1
      end
    end
    • public static class Kata
    • {
    • public static bool IsOdd(int input)
    • {
    • return ((input % 10 == 1) || (input % 10 == 3) || (input % 10 == 5) || (input % 10 == 7) || (input % 10 == 9));
    • }
    • }
    • class Odd
    • def odd(n)
    • n % 2 == 1
    • end
    • end

Find maximum element of a list in Haskell

Code
Diff
  • module FindMaxNumber where
    
    find_max :: Ord a => [a] -> a
    find_max = maximum
    • def find_max(arr):
    • return 0
    • module FindMaxNumber where
    • find_max :: Ord a => [a] -> a
    • find_max = maximum
Code
Diff
  • function returnhundred() {
      return Number('Ā'.charCodeAt(0).toString(16));
    }
    • function returnhundred() {
    • return 10 ** 2;
    • return Number('Ā'.charCodeAt(0).toString(16));
    • }
Code
Diff
  • const main = () => {
    
      let a = [1, 2, 3];
      
      let b = [4, 5, 6];
      
      let c = [7, 8, 9];
    
      // converter para ES6  
      let d = [...a, ...b, ...c];
    
      
      return d.join(',');
    }
    • const main = () => {
    • let a = [1, 2, 3];
    • let b = [4, 5, 6];
    • let c = [7, 8, 9];
    • // converter para ES6
    • var d = a.concat(b).concat(c);
    • // converter para ES6
    • let d = [...a, ...b, ...c];
    • return d.join(',');
    • }
Code
Diff
  • class Component {
      constructor(dom) {
          this.dom = dom;
      }
      
      onCreate() {
        console.log('onCreate from parent class');
        return 'missing';
      }
      
      static on(event, callback) {
        callback();
      }
      
      async emit(event, data) {}
    }
    
    class Title extends Component {
      onCreate() {
        super.onCreate();
        return 'super!';
      }
    }
    
    
    • class Component {
    • constructor(dom) {
    • this.dom = dom;
    • }
    • onCreate() {
    • console.log('onCreate from parent class');
    • return 'missing';
    • }
    • static on(event, callback) {
    • callback();
    • }
    • async emit(event, data) {}
    • }
    • class Title extends Component {
    • onCreate() {
    • super.onCreate();
    • return 'super!';
    • }
    • }
Code
Diff
  • class Component {
      constructor(dom){
        this.dom = dom;
      }
      
      onCreate() {
        return this.dom;
      }
    }
    
    const comp = new Component();
    comp.onCreate();
    • function Component(dom) {
    • this.dom = dom;
    • this.onCreate = function() {
    • class Component {
    • constructor(dom){
    • this.dom = dom;
    • }
    • onCreate() {
    • return this.dom;
    • }
    • }
    • }
    • const comp = new Component();
    • comp.onCreate();
Code
Diff
  • var title = 'UOL - O melhor conteúdo';
    
    var share = {
      fb: {
        title
      },
      twitter: {
        tweet: title
      }
    };
    • var title = 'UOL - O melhor conteúdo';
    • var share = {
    • fb: {
    • title: title
    • title
    • },
    • twitter: {
    • tweet: title
    • }
    • };
Code
Diff
  • let results = [
      {materia: {conteudo: {titulo: 'São Paulo'}}, tags: [1, 2, 3]},
      {materia: {conteudo: {}}, tags: [3, 2]},
      {materia: {conteudo: {titulo: 'Rio de Janeiro'}}, tags: [3, 2]},
    ];
    
    // for (const result of results) {
    //   let titulo = result.materia.conteudo.titulo || 'Brasil
      
    for (const {materia: {conteudo: {titulo =  'Brasil'}}} of results) { 
      console.log(titulo);
    }
    • let results = [
    • {materia: {conteudo: {titulo: 'São Paulo'}}, tags: [1, 2, 3]},
    • {materia: {conteudo: {}}, tags: [3, 2]},
    • {materia: {conteudo: {titulo: 'Rio de Janeiro'}}, tags: [3, 2]},
    • ];
    • for (const result of results) {
    • let titulo = result.materia.conteudo.titulo || 'Brasil';
    • // for (const result of results) {
    • // let titulo = result.materia.conteudo.titulo || 'Brasil
    • for (const {materia: {conteudo: {titulo = 'Brasil'}}} of results) {
    • console.log(titulo);
    • }
Code
Diff
  • var bg = 'gray';
      
    var css = `
      <style>
        body {
          background: ${bg};
          color: black;
        }
      </style>
    `;
    • var bg = 'gray';
    • var css = '' +
    • '<style>' +
    • 'body {' +
    • ' background: '+ bg + ';' +
    • ' color: black;'
    • '}' +
    • '</style>';
    • var css = `
    • <style>
    • body {
    • background: ${bg};
    • color: black;
    • }
    • </style>
    • `;