Begin a new Kumite
Search
About
  • Filter by Language:
  • 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.

Ruby lambda function

Code
Diff
  • remove = -> (s) do
      s.gsub(/[^a-z]/, "")
    end
  • 1
    remove = lambda s: ''.join(x for x in s if x.islower())
    
    1+
    remove = -> (s) do
    
    2+
      s.gsub(/[^a-z]/, "")
    
    3+
    end
    

Ruby lambda function

Code
Diff
  • digital_root = -> (n) do
      n < 10 ? n : digital_root.(n.digits.sum) 
    end
  • 1
    digital_root=lambda n:digital_root(sum(map(int, str(n))))if n>9 else n
    
    1+
    digital_root = -> (n) do
    
    2+
      n < 10 ? n : digital_root.(n.digits.sum) 
    
    3+
    end
    
Code
Diff
  • def prod(numbers)
      numbers.reduce(:*) || 0
    end
        
  • 1
    from functools import reduce
    
    2
    from operator import mul
    
    3
    4
    def prod(numbers):
    
    5
        return reduce(mul, numbers or [0], 1)
    
    1+
    def prod(numbers)
    
    2+
      numbers.reduce(:*) || 0
    
    3+
    end
    
    66
        
    
Code
Diff
  • def final_price(price)
      (price*(1.1+(price>=1e3 ? 0.3 : 0))).round(2)
    end
  • 1
    def final_price(price):
    
    2
        return round(price*(1.1+(0.3 if price>=1e3 else 0)), 2)
    
    1+
    def final_price(price)
    
    2+
      (price*(1.1+(price>=1e3 ? 0.3 : 0))).round(2)
    
    3+
    end
    

lambda function in Ruby

Code
Diff
  • f = -> (s, n) do
      s * n
    end
    
  • 1
    f=str.__mul__
    
    1+
    f = -> (s, n) do
    
    2+
      s * n
    
    3+
    end
    

0

Code
Diff
  • def rubegoldberg()
      0 ** 0
    end
  • 11
    def rubegoldberg()
    
    2
        return rand(1..10**rand(1..10)) ** 0
    
    2+
      0 ** 0
    
    33
    end
    

Recent Moves:

Code
Diff
  • def numberplatereader(s)
      /[A-Z]{2}\d{2}\s[A-Z]{3}/ === s
    end
  • 1
    numberplatereader=lambda*p:bool(__import__('re').match("[A-Z]{2}\d{2}\s[A-Z]{3}",*p))
    
    1+
    def numberplatereader(s)
    
    2+
      /[A-Z]{2}\d{2}\s[A-Z]{3}/ === s
    
    3+
    end
    

Recent Moves:

This kumite is redundant TBH

Code
Diff
  • from operator import add
  • 1
    add = lambda x,y: x+y
    
    1+
    from operator import add