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
  • remainder=lambda x,y:x%y if y else-1
    • def remainder(x, y):
    • return x - (x // y) * y if y else -1
    • remainder=lambda x,y:x%y if y else-1
Code
Diff
  • or16=lambda a,b:''.join(max(a[i],b[i])for i in range(16))
    • def or16(a, b):
    • out = ['0'] * 16
    • for i in range(16):
    • out[i] = max(a[i] , b[i])
    • return ''.join(out)
    • or16=lambda a,b:''.join(max(a[i],b[i])for i in range(16))
Code
Diff
  • greatest=lambda a:int(''.join(map(str,sorted(a,reverse=True))))
    • from typing import List
    • def greatest(lst: List[int]) -> int:
    • nums=[0]*10
    • for i in lst:
    • nums[i]+=1
    • result=0
    • for digit, num in reversed(list(enumerate(nums))):
    • print(digit, num)
    • for j in range(num):
    • result*=10
    • result+=digit
    • return result
    • greatest=lambda a:int(''.join(map(str,sorted(a,reverse=True))))
Code
Diff
  • const numMinusSeven = num => Math.ceil(num/7);
    
    • function numMinusSeven(num) {
    • return Math.ceil(num/7);
    • }
    • const numMinusSeven = num => Math.ceil(num/7);
Code
Diff
  • fun returnInt(int:Int): Int{
        return int
    }
    • fun Int.returnInt() = this
    • fun returnInt(int:Int): Int{
    • return int
    • }
Code
Diff
  • USING: kernel parser sequences quotations prettyprint fry ;
    QUALIFIED-WITH: tools.testest tt
    IN: testest.extras
    
    
    : wrap-it ( quot -- wrapped )
      '[ tt:it#{ _ dip tt:}# ] ;
      
    : wrap-describe ( quot -- wrapped )
      '[ tt:describe#{ _ dip tt:}# ] ;
    
    SYNTAX: it#{ \ tt:}# parse-until >quotation wrap-it suffix! \ call suffix! ;
    SYNTAX: describe#{ \ tt:}# parse-until >quotation wrap-describe suffix! \ call suffix! ;
    • USING: kernel parser sequences quotations prettyprint fry ;
    • QUALIFIED-WITH: tools.testest tt
    • IN: testest.extras
    • : wrap-it ( quot -- wrapped )
    • '[ tt:it#{ _ dip tt:}# ] ;
    • : wrap-describe ( quot -- wrapped )
    • '[ tt:describe#{ _ dip tt:}# ] ;
    • SYNTAX: it#{ \ tt:}# parse-until >quotation wrap-it suffix! \ call suffix! ;
    • SYNTAX: describe#{ \ tt:}# parse-until >quotation wrap-describe suffix! \ call suffix! ;
    • SYNTAX: describe#{ \ tt:}# parse-until >quotation wrap-describe suffix! \ call suffix! ;

clojure

Code
Diff
  • module Solution where
    
    fizzbuzz :: [String] -> Int -> Int -> [String]
    fizzbuzz acc i n
      | n < i = acc
      | otherwise = fizzbuzz (s : acc) i (n - 1)
      where
        s = case (mod n 3, mod n 5) of
          (0, 0) -> "fizzbuzz"
          (0, _) -> "fizz"
          (_, 0) -> "buzz"
          _ -> show n
    • def rec(acc,i,n):
    • done=i>n
    • match done:
    • case True:
    • return acc
    • case _:
    • fb=not (i%3 or i%5)
    • f=not i%3
    • b=not i%5
    • match fb:
    • case True:
    • return rec(acc+["fizzbuzz"],i+1,n)
    • case _:
    • match f:
    • case True:
    • return rec(acc+["fizz"],i+1,n)
    • case _:
    • match b:
    • case True:
    • return rec(acc+["buzz"],i+1,n)
    • case _:
    • return rec(acc+[str(i)],i+1,n)
    • def fizzbuzz(n):
    • return rec([],1,n)
    • # def fizzbuzz(n):
    • # acc=[]
    • # i=1
    • # while i<=n:
    • # if not (i%3 or i%5):
    • # acc.append("fizzbuzz")
    • # elif not i%3:
    • # acc.append("fizz")
    • # elif not i%5:
    • # acc.append("buzz")
    • # else:
    • # acc.append(str(i))
    • # i+=1
    • # return acc
    • module Solution where
    • fizzbuzz :: [String] -> Int -> Int -> [String]
    • fizzbuzz acc i n
    • | n < i = acc
    • | otherwise = fizzbuzz (s : acc) i (n - 1)
    • where
    • s = case (mod n 3, mod n 5) of
    • (0, 0) -> "fizzbuzz"
    • (0, _) -> "fizz"
    • (_, 0) -> "buzz"
    • _ -> show n