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

Taking a look at Igloo testing framework.

I think there must be some automatical header generation going on here...

template <class T, class U>
auto add(const T& x, const U& y) {
  return x + y;
}
Bugs
//
#include <algorithm>
#include <iterator>
#include <random>
#include <vector>

void run() {
  using namespace std;
  // this is a source of true random numbers
  random_device rd;
  // it's used to generate a seed for an engine
  default_random_engine eng(rd());
  // distribution is applied to a generator to generate random numbers
  uniform_int_distribution<int> dist(1, 10);
  vector<int> xs;
  for (unsigned i = 0; i < 20; i++)
    xs.push_back(dist(eng));
  for (int x : xs)
    cout << x << ' ';
  cout << '\n';
}

void run2() {
  using namespace std;
  default_random_engine eng{random_device()()};
  uniform_int_distribution<int> dist(1, 10);
  auto rand10 = [&eng, &dist]() { return dist(eng); };
  vector<int> xs;
  generate_n(back_inserter(xs), 20, rand10);
  copy(cbegin(xs), cend(xs), ostream_iterator<int>(cout, " "));
  cout << '\n';
}

Test of the codewars array test case

var array = ['codewars'];
let rec sumMult i k n = if i + k < n then i + sumMult (i + k) k n else i

let sumOfMultiples list n = list |> List.map(fun x -> sumMult 0 x n) |> List.sum

printfn "%A" (sumOfMultiples [1; 2; 3] 10)
let rec sumMult i k n = if i + k < n then i + sumMult (i + k) k n else i

let sumOfMultiples list n = list |> List.map(fun x -> sumMult 0 x n) |> List.sum

let v = sumOfMultiples [7; 13; 17] 20

printfn "%A" v

Contains random dart tests

class Person {
  String firstName;
  String lastName;
  
  Person(this.firstName,this.lastName);
}
Parsing
Algorithms
Logic
Strings
Monads
Data Structures
Functional Programming

http://www.willamette.edu/~fruehr/haskell/seuss.html

A parser for a thing
Is a function from a string
To a list of pairs
Of things and strings!

This monadic parser is missing many basic functions and several important typeclass instances.

{-# LANGUAGE DeriveFunctor, TupleSections #-}
module MonadicParsing where

newtype Parser a = Parser { runParser :: String -> [(a, String)] }
    deriving Functor
    
instance Monad Parser where
    return a = Parser $ return . (a,)
    Parser p >>= f = Parser $ \s -> concatMap (uncurry (runParser.f)) $ p s
wichuFailed Tests

F# Basics 2

let addOne = fun x -> x + 1

let value = addOne <| 1 |> addOne

printfn "%i" value
let rec print list = 
    match list with
    | [] -> ()
    | head::rest -> head |> printfn "%O"; print(rest)

print [1; 5; 7]