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.

wichuFailed Tests

tryParseInt

let tryParseInt s = 
   try
      let i = System.Int32.Parse s
      Some i
   with _ -> None

let v1 = tryParseInt "1"
printfn "%O" v1
printfn "%O" v1.Value
printfn "%O" v1.IsSome
printfn "%O" v1.IsNone

printfn ""

let v2 = tryParseInt "?"
printfn "%O" v2
printfn "%O" v2.IsSome
printfn "%O" v2.IsNone
int f() { }
[for i in 1 .. 30 -> if i % 3 = 0 && i % 5 = 0 then "FizzBuzz" elif i % 3 = 0 then "Fizz" elif i % 5 = 0 then "Buzz" else i.ToString()] |> List.map(fun v -> printfn "%s" v)
let add n x = x + n
let times n x = x * n

let f1 = add 1 >> times 2
let f2 = add 1 << times 2

printfn "%i" (f1 2) // (2+1)*2
printfn "%i" (f2 2) // 2*2+1
let add x y = x + y

let add1 = add 1
let add2 = add 2
let add3 = add 3
let add1and2and3 = add1 >> add2 >> add3

printfn "%i" (0 |> add1and2and3)
let add x y = x + y


let add1 = add 1
let add2 = add 2
let add3 = add 3


printfn "%i" (add1 1)
printfn "%i" (add2 1)
printfn "%i" (add3 1)
Code
Diff
  • public class Primes {
      public static boolean isAPrime(int number) {    
        if (number == 1) {
          return false;
        }
      
        if (number == 2) {
          return true;
        }
        
        if (number % 2 == 0) {
          return false;
        }
      
        for (int i = 3; i*i <= number; i += 2) {
          if (number % i == 0)
            return false;
        }
        
        return true;
      }
    }
  • 11
    public class Primes {
    
    2
      public static boolean isAPrime(int number) {
    
    3
        for (int i=2;i*i<=number;i++)
    
    4
        {
    
    2+
      public static boolean isAPrime(int number) {    
    
    3+
        if (number == 1) {
    
    4+
          return false;
    
    5+
        }
    
    6+
      
    
    7+
        if (number == 2) {
    
    8+
          return true;
    
    9+
        }
    
    10+
        
    
    11+
        if (number % 2 == 0) {
    
    12+
          return false;
    
    13+
        }
    
    14+
      
    
    15+
        for (int i = 3; i*i <= number; i += 2) {
    
    55
          if (number % i == 0)
    
    66
            return false;
    
    77
        }
    
    88
        
    
    99
        return true;
    
    1010
      }
    
    1111
    }
    

Recent Moves:

Code
Diff
  • function fizzbuzzy(n) {
      var three = Math.floor(n/3)+1;
      var five = Math.floor(n/5)+1;
      return three+five;
    }
  • 11
    function fizzbuzzy(n) {
    
    2
      //insert code here
    
    2+
      var three = Math.floor(n/3)+1;
    
    3+
      var five = Math.floor(n/5)+1;
    
    4+
      return three+five;
    
    33
    }