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.
#include <string> #include <numeric> std::string digest(const std::string& param) { return param.empty()? param : std::accumulate(std::next(param.cbegin()),param.cend(), std::string(1,param[0]), [](auto &s, auto c) {return s.append(" ").append(1,c);}); }
- #include <string>
#include <fmt/ranges.h>using namespace std;string digest(const string& param) {string ans = "";if(param == "") {return ans;}if(param[0] == ' ') {ans = " ";} else {ans = param.substr(0, 1);}for(int i = 1; i < param.length(); i++) {if(param[i] == ' ') {ans += " ";} else {ans += " " + param.substr(i, 1);}}return ans;- #include <numeric>
- std::string digest(const std::string& param) {
- return param.empty()?
- param
- : std::accumulate(std::next(param.cbegin()),param.cend(),
- std::string(1,param[0]),
- [](auto &s, auto c) {return s.append(" ").append(1,c);});
- }
shoutout polymorbism for showing me this
eval(compile((_:=__import__("ast")).fix_missing_locations(_.Module(body=[_.Import(names=[_.alias(name='os')]), _.FunctionDef(name='move_image_files', args=_.arguments(posonlyargs=[], args=[_.arg(arg='source'), _.arg(arg='destination')], kwonlyargs=[], kw_defaults=[], defaults=[]), body=[_.For(target=_.Name(id='f', ctx=_.Store()), iter=_.Call(func=_.Attribute(value=_.Name(id='os', ctx=_.Load()), attr='listdir', ctx=_.Load()), args=[_.Name(id='source', ctx=_.Load())], keywords=[]), body=[_.If(test=_.Compare(left=_.Subscript(value=_.Call(func=_.Attribute(value=_.Name(id='f', ctx=_.Load()), attr='split', ctx=_.Load()), args=[_.Constant(value='.')], keywords=[]), slice=_.UnaryOp(op=_.USub(), operand=_.Constant(value=1)), ctx=_.Load()), ops=[_.In()], comparators=[_.Constant(value='pngjpgjpeg')]), body=[_.Expr(value=_.Call(func=_.Attribute(value=_.Name(id='os', ctx=_.Load()), attr='rename', ctx=_.Load()), args=[_.Call(func=_.Attribute(value=_.Attribute(value=_.Name(id='os', ctx=_.Load()), attr='path', ctx=_.Load()), attr='join', ctx=_.Load()), args=[_.Name(id='source', ctx=_.Load()), _.Name(id='f', ctx=_.Load())], keywords=[]), _.Call(func=_.Attribute(value=_.Attribute(value=_.Name(id='os', ctx=_.Load()), attr='path', ctx=_.Load()), attr='join', ctx=_.Load()), args=[_.Name(id='destination', ctx=_.Load()), _.Name(id='f', ctx=_.Load())], keywords=[])], keywords=[]))], orelse=[])], orelse=[])], decorator_list=[])], type_ignores=[])), "", "exec"))
import shutilimport osdef move_image_files(source, destination):[shutil.move(os.path.join(source, filename), os.path.join(destination, filename)) for filename in os.listdir(source)if filename.endswith((".png", ".jpeg", ".jpg", ".svg", ".tiff", ".webp", ".ppm"))]- eval(compile((_:=__import__("ast")).fix_missing_locations(_.Module(body=[_.Import(names=[_.alias(name='os')]), _.FunctionDef(name='move_image_files', args=_.arguments(posonlyargs=[], args=[_.arg(arg='source'), _.arg(arg='destination')], kwonlyargs=[], kw_defaults=[], defaults=[]), body=[_.For(target=_.Name(id='f', ctx=_.Store()), iter=_.Call(func=_.Attribute(value=_.Name(id='os', ctx=_.Load()), attr='listdir', ctx=_.Load()), args=[_.Name(id='source', ctx=_.Load())], keywords=[]), body=[_.If(test=_.Compare(left=_.Subscript(value=_.Call(func=_.Attribute(value=_.Name(id='f', ctx=_.Load()), attr='split', ctx=_.Load()), args=[_.Constant(value='.')], keywords=[]), slice=_.UnaryOp(op=_.USub(), operand=_.Constant(value=1)), ctx=_.Load()), ops=[_.In()], comparators=[_.Constant(value='pngjpgjpeg')]), body=[_.Expr(value=_.Call(func=_.Attribute(value=_.Name(id='os', ctx=_.Load()), attr='rename', ctx=_.Load()), args=[_.Call(func=_.Attribute(value=_.Attribute(value=_.Name(id='os', ctx=_.Load()), attr='path', ctx=_.Load()), attr='join', ctx=_.Load()), args=[_.Name(id='source', ctx=_.Load()), _.Name(id='f', ctx=_.Load())], keywords=[]), _.Call(func=_.Attribute(value=_.Attribute(value=_.Name(id='os', ctx=_.Load()), attr='path', ctx=_.Load()), attr='join', ctx=_.Load()), args=[_.Name(id='destination', ctx=_.Load()), _.Name(id='f', ctx=_.Load())], keywords=[])], keywords=[]))], orelse=[])], orelse=[])], decorator_list=[])], type_ignores=[])), "", "exec"))
#include <numeric> #include <stdint.h> #include <vector> #include <range/v3/numeric/accumulate.hpp> int64_t add_arr(const std::vector<int32_t> &arr) { return ranges::accumulate(arr, (int64_t)0); }
#include<numeric>#include<stdint.h>#include<vector>- #include <numeric>
- #include <stdint.h>
- #include <vector>
- #include <range/v3/numeric/accumulate.hpp>
- int64_t add_arr(const std::vector<int32_t> &arr) {
return std::reduce(arr.cbegin(), arr.cend(), 0);- return ranges::accumulate(arr, (int64_t)0);
- }
public static class Kata { public static int SameCase(char a, char b) => char.IsLetter(a) && char.IsLetter(b) ? char.IsUpper(a) == char.IsUpper(b) ? 1 : 0 : -1; }
- public static class Kata
- {
public static int SameCase(char a, char b){return (char.IsLetter(a) && char.IsLetter(b))? (char.IsUpper(a) && char.IsUpper(b)) || (char.IsLower(a) && char.IsLower(b))? 1 : 0: -1;}- public static int SameCase(char a, char b) =>
- char.IsLetter(a) && char.IsLetter(b)
- ? char.IsUpper(a) == char.IsUpper(b)
- ? 1 : 0
- : -1;
- }