I hereby claim:
- I am made2591 on github.
- I am made2591 (https://keybase.io/made2591) on keybase.
- I have a public key whose fingerprint is 465F 151A 2CB3 B5E3 3A13 83ED D623 0745 6844 BE6C
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| func f1(x int) (int, string) { | |
| return x + 1, fmt.Sprintf("%d+1", x) |
| ... | |
| func f1(x int) (int, string) { | |
| return x + 1, fmt.Sprintf("%d+1", x) | |
| } | |
| func f2(x int) (int, string) { |
| ... | |
| x := 0 | |
| log := "Ops: " | |
| res, log1 := f1(x) | |
| log += log1 + "; " | |
| res, log2 := f2(res) | |
| log += log2 + "; " |
| ... | |
| func unit(x int) *Log { | |
| return &Log{Val: x, Op: ""} | |
| } | |
| func bind(x *Log, f Increment) *Log { |
| ... | |
| type Increment func(y int) (int, string) | |
| type Log struct { | |
| Val int | |
| Op string | |
| } | |
| ... |
| ... | |
| func unit(x int) *Log { | |
| return &Log{Val: x, Op: ""} | |
| } | |
| ... |
| ... | |
| func bind(x *Log, f Increment) *Log { | |
| val, op := f(x.Val) | |
| return &Log{Val: val, Op: fmt.Sprintf("%s%s; ", x.Op, op)} | |
| } | |
| ... |
| ... | |
| // no more required and not repeated | |
| log += log2 + "; " | |
| log += log3 + "; " | |
| ... |
| ... | |
| x := 0 | |
| fmt.Printf("%s\n", bind(bind(bind(unit(x), f1), f2), f3).ToString()) | |
| ... |