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.
Convert Words To DuckDuckGo Query - ES6
When a human gives a list of words separated by commas, the computer sends back a list of DuckDuckGo™ images queries links.
searchDuckLinks("Dublin,Palerme,Cholet")
searchDuckLinks = (str) => str
.split(',')
.map(word => `https://duckduckgo.com/?q=${word}&iax=1&ia=images`)
describe("Solution", () => {
it("should test for something", () => {
Test.assertEquals(searchDuckLinks("orange")[0], "https://duckduckgo.com/?q=orange&iax=1&ia=images")
Test.assertEquals(searchDuckLinks("Dublin,Palerme,Cholet")[1], "https://duckduckgo.com/?q=Palerme&iax=1&ia=images")
Test.assertEquals(searchDuckLinks("Dublin,Palerme,Cholet")[2], "https://duckduckgo.com/?q=Cholet&iax=1&ia=images")
})
})
let (|Int|_|) str = match System.Int32.TryParse(str) with | (true, int) -> Some(int) | _ -> None
let (|Bool|_|) str = match System.Boolean.TryParse(str) with | (true, bool) -> Some(bool) | _ -> None
let parse s =
match s with
| Bool b -> printfn "%-10s%b" "Bool" b
| Int i -> printfn "%-10s%i" "Int" i
| _ -> printfn "%-10s%O" "???" s
parse "0"
parse "1"
parse "2"
parse "3"
parse "123"
parse "-123"
parse "True"
parse "true"
parse "False"
parse "False"
parse "hello"
printfn "%*s" 5 "*"
printfn "%*s" 6 "***"
printfn "%*s" 7 "*****"
printfn "%*s" 8 "*******"
printfn "%*s" 9 "*********"
require "big_int"
describe "Solution" do
it "should work" do
"it works".should eq "it works"
end
end
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)
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 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
[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)
int f() { }
Describe(t) {
It(t1) {
Assert::That(true, Equals(true));
}
It(t2) {
Assert::That(f(), Equals(0));
Assert::That(false, Equals(true));
}
};
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