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.

Failed Tests

### Output elapsed time in timed out tests

``````def solution_function():
return 0``````

### lol

idk

``````def solution(a):
return a ** a``````

``print('hi')``

### A function that returns the min of an array

``````Imports NUnit.Framework

Module Test
public function MinF(x, n)
dim min as integer
dim i as integer

min = x(0)

for i = 1 to n
if x(i) < min then
min = x(i)
end if
next

return min
end function
End Module``````

### C++ function that returns the mean of an array

``````#include <iostream>

double Mean(double x[], int n){
double sum = 0;

for(int i = 0; i < n; i++){
sum += x[i];
}

return sum / n;
}``````

### Passing around infinite lists

Define a function that takes a stream of numbers and returns a stream of those numbers all zeroed out.

### Intent

Pass infinite lists between JS, LC and JS.
Back in JS, a prefix of the infinite list is taken for testing.

A slightly more elegant solution would transmogrify the LC export to a JS `Generator` object, over which I could define `take : Generator => Generator`, which I could feed to `Array.from` to finally result in a finite array that can be tested. But this'll do for now.

### Encodings

• purity: `LetRec`
• numEncoding: `BinaryScott`
• export constructor `cons : x -> (() -> Stream x) -> Stream x`
and deconstructor `foldr : (x -> (() -> z) -> z) - Stream x -> z`
for your `Stream` encoding.
Because folding a stream never reaches the end, there is no initial value, and only short-circuiting can prevent divergence.
``````#import scott-stream.lc
cons = \ x xs . \ cons . cons x xs
foldr = \ fn xxs . xxs \ x xs . fn x (foldr fn xs)
map = \ fn . foldr ( \ x . cons (fn x) )

#export zero-out : Stream Number -> Stream Number
zero-out = map ( \ _ . 0 )

#export scott-stream.lc
# import into JS is eager and `xs ()` would evaluate `()`, so I need a dummy undefined
undefined = \ _ . ()
cons = \ x xs . \ cons . cons x (xs undefined)
foldr = \ fn xxs . xxs \ x xs . fn x ( \ _ . foldr fn xs )``````

### Katie Camel Case

``````def to_camel_case(text):
k = text.split("-")
p = case_loop(k)
j = p.split("_")
m = case_loop(j)
return m

def case_loop(k):
p = []

for i,item in enumerate(k):
if i == 0:
p.append(item)
continue
# print(i,item)
a = item[0].upper()
b = item[1:]
c = f"{a}{b}"
p.append(c)
d = "".join(p)
return d``````

### mardrew's Kumite #3

You have a nested list of items and need to find out how many layers of nesting there is.

For example

[1,2] = 1
[[1,2],[3,4]] = 2
[[[1,2],[3,4]],[[1,2],[3,4]]] = 3

``````def get_nesting_layers(lst):
for item in lst:
if type(item) == type([]):
return 1+get_nesting_layers(item)

return 1``````

### Tiyezrun's Kumite #4

``````def assert_equals(a,b):
return a+b``````
Failed Tests

### Ignored SIGSEGV

``````#include <ctype.h>
#include <string.h>

void drop_caps(char *dest, const char *src) {
unsigned in_word = 0;
for (unsigned i = 0; i < strlen(src) + 1000; i++, src++, dest++) {
if (*src == ' ' || (!in_word && strcspn(src, " ") <= 2)) in_word = 0, *dest = *src;
else if (in_word) *dest = tolower(*src);
else in_word = 1, *dest = toupper(*src);
}
*dest = '\0';
}``````