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.
module NCR where --Combinations nCr comb:: Integer -> Integer -> Integer comb n r | n/=r = (factorial n) `div` (factorial r * factorial (n-r) ) | n==r = (factorial n) `div` (factorial r) factorial n= foldl (*) 1 [1..n]
- module NCR where
- --Combinations nCr
- comb:: Integer -> Integer -> Integer
comb n r | n/=r = (foldl (*) 1 [1..n]) `div` ((foldl (*) 1 [1..r]) * (foldl (*) 1 [1..(n-r)]))| n==r = (foldl (*) 1 [1..n]) `div` ((foldl (*) 1 [1..r]))- comb n r | n/=r = (factorial n) `div` (factorial r * factorial (n-r) )
- | n==r = (factorial n) `div` (factorial r)
- factorial n= foldl (*) 1 [1..n]
Allow for passing parents into the constructor. Also, add some spaces to make code consistent. Also, avoid mutating parents array, just for the sake of it.
class Human { constructor (firstName = '', lastName = '', parents = []) { this.firstName = firstName; this.lastName = lastName; this.parents = parents; // modern family. who takes parental care? } filterMyFamily(humans) { return humans.filter(human => human.lastName === this.lastName) } hasParent(p) { return this.parents.some(parent => parent === p); } hasChild(c) { return c.hasParent(this); } addParent(p) { if (!this.hasParent(p)) this.parents = [ ...this.parents, p ]; return this; } }
- class Human {
constructor (firstName = '', lastName = '') {- constructor (firstName = '', lastName = '', parents = []) {
- this.firstName = firstName;
- this.lastName = lastName;
this.parents = []; // modern family. who takes parental care?- this.parents = parents; // modern family. who takes parental care?
- }
- filterMyFamily(humans) {
- return humans.filter(human => human.lastName === this.lastName)
- }
addParent(p){if (!this.hasParent(p)) this.parents.push(p);return this;- hasParent(p) {
- return this.parents.some(parent => parent === p);
- }
hasChild(c){- hasChild(c) {
- return c.hasParent(this);
- }
hasParent(p){return this.parents.some(parent => parent === p);- addParent(p) {
- if (!this.hasParent(p)) this.parents = [ ...this.parents, p ];
- return this;
- }
- }
package main import "fmt" func main() { var age int fmt.Printf("Enter your age on Earth: ") _, err := fmt.Scanf("%d", &age) if (err != nil) { fmt.Println(err) } age = age * 365 / 687 fmt.Printf("Your age on the surface of Mars is %d years old.\n", age) }
- package main
- import "fmt"
- func main() {
age := 28 * 365 / 687fmt.Printf("My age on the surface of Mars is %d years old.", age)- var age int
- fmt.Printf("Enter your age on Earth: ")
- _, err := fmt.Scanf("%d", &age)
- if (err != nil) {
- fmt.Println(err)
- }
- age = age * 365 / 687
- fmt.Printf("Your age on the surface of Mars is %d years old.
- ", age)
- }