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

shorten

Code
Diff
  • isEven=n=>n%1==0?!(n%2):{}.a
    • isEven = num => num%1===0?!(num%2):undefined
    • isEven=n=>n%1==0?!(n%2):{}.a
Code
Diff
  • import java.util.*;
    
    class Vehicle {
    
        int currentSpeed;
        Road currentRoad = new Road(60);
    
        public void setCurrentSpeed(int... accelerations) {
            currentSpeed = Arrays.stream(accelerations).sum();
        }
        
        public int getCurrentSpeed() {
            return currentSpeed;
        }
    
        public boolean isWithinSpeedLimit() {
            return currentSpeed <= currentRoad.speedLimit;
        }
    }
    
    final class Road {
    
        int speedLimit;
    
        public Road(int speedLimit) {
            this.speedLimit = speedLimit;
        }
    }
    
    • import java.util.*;
    • /**
    • an object of class blah
    • author
    • date
    • */
    • class Vehicle {
    • /**I make up the class invariant, I describe speed limit*/
    • final int SPEED_LIMIT = 60;
    • /**I make up the class invariant, i describe current speed*/
    • int currentSpeed;
    • public void setCurrentSpeed(int[] accelerations) {
    • currentSpeed = Arrays.stream(accelerations).sum();
    • }
    • /**i describe current speed*/
    • public int getCurrentSpeed() {
    • return currentSpeed;
    • }
    • /**i describe within speed limit*/
    • public boolean isWithinSpeedLimit() {
    • return getCurrentSpeed() <= SPEED_LIMIT;
    • }
    • int currentSpeed;
    • Road currentRoad = new Road(60);
    • public void setCurrentSpeed(int... accelerations) {
    • currentSpeed = Arrays.stream(accelerations).sum();
    • }
    • public int getCurrentSpeed() {
    • return currentSpeed;
    • }
    • public boolean isWithinSpeedLimit() {
    • return currentSpeed <= currentRoad.speedLimit;
    • }
    • }
    • final class Road {
    • int speedLimit;
    • public Road(int speedLimit) {
    • this.speedLimit = speedLimit;
    • }
    • }
Fundamentals
Mathematics
Code
Diff
  • const isDivisible = (a,n) => !(a%n)
    • function isDivisible(a,n){
    • return a%n == 0;
    • }
    • const isDivisible = (a,n) => !(a%n)

aaaaaaaaaaaaaaaaaaaaaaaaa

Code
Diff
  • unsigned long long div2(unsigned long long a) {
      return a?a/((a/a)+(a/a)):a;
    }
    • unsigned long long div2(unsigned long long a) {
    • return a / 2;
    • return a?a/((a/a)+(a/a)):a;
    • }

I don't think mine is correct since the "golfed" part was the return type.

Code
Diff
  • fn foo()->i8{1}
    • fn foo()->i32{1}
    • fn foo()->i8{1}

Readable

Code
Diff
  • public static class Kata 
    {
      public static int SameCase(char a, char b)
      {
        if (!char.IsLetter(a) || !char.IsLetter(b))
          return -1;
        return char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
      }
    }
    • public static class Kata
    • {
    • public static int SameCase(char a, char b) =>
    • (!char.IsLetter(a) || !char.IsLetter(b)) ? -1 :
    • (char.IsLower(a) == char.IsLower(b)) ? 1 : 0;
    • public static int SameCase(char a, char b)
    • {
    • if (!char.IsLetter(a) || !char.IsLetter(b))
    • return -1;
    • return char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
    • }
    • }
Code
Diff
  • fun return_int(i: Int) = i
    • fn return_int(i: i32) -> i32 { i }
    • fun return_int(i: Int) = i