I hereby claim:
- I am zach-klippenstein on github.
- I am zachklipp (https://keybase.io/zachklipp) on keybase.
- I have a public key whose fingerprint is 01D0 C5AB 55E9 29A5 2337 E6CC 0EDD 53ED 8CE1 CD26
To claim this, I am signing this object:
| class CoroutineNamesTest { | |
| @Test fun coroutineNames() { | |
| runBlocking(CoroutineName("parent")) { | |
| println("parent: $coroutineContext") | |
| launch { | |
| println("unnamed child: $coroutineContext") | |
| } | |
| launch(CoroutineName("named child")) { |
| package com.zachklipp.coroutines | |
| import kotlinx.coroutines.experimental.DisposableHandle | |
| import kotlinx.coroutines.experimental.intrinsics.startCoroutineCancellable | |
| import kotlinx.coroutines.experimental.selects.SelectClause0 | |
| import kotlinx.coroutines.experimental.selects.SelectClause1 | |
| import kotlinx.coroutines.experimental.selects.SelectClause2 | |
| import kotlinx.coroutines.experimental.selects.SelectInstance | |
| /** |
| #!/bin/zsh | |
| if [ "$1" = '-h' ]; then | |
| cat <<-EOF | |
| Usage: git-edit <branch> [args-to-commit] | |
| e.g. If your tree looks like this: | |
| * cc3cd23 (HEAD -> feat1) Feature 1.2 | |
| * 53f56c1 Feature 1 | |
| * 08355e5 (master) Initial commit. |
| //usr/local/bin/go run $0 "$@"; exit | |
| /* | |
| Terminal program that plays a sine wave. | |
| The pitch and volume can be controlled (help is shown in the UI). | |
| Installation: | |
| go get github.com/gizak/termui |
| package com.example.funcstack | |
| import java.util.NoSuchElementException | |
| public trait FunctionalStack<out T> { | |
| public val size: Int | |
| public fun pop(): Pair<T, FunctionalStack<T>> | |
| } | |
| /** |
| package source_bench_test | |
| import ( | |
| "github.com/stretchr/testify/require" | |
| "math/rand" | |
| "sync" | |
| "testing" | |
| ) | |
| // See https://golang.org/src/math/rand/rand.go |
| package main | |
| import ( | |
| "math" | |
| "math/rand" | |
| "runtime" | |
| "testing" | |
| ) | |
| const DELTA_MULT = 10000000000 |
I hereby claim:
To claim this, I am signing this object:
| Problem: N independent sources of elements that need to be sorted. Each source has an unknown length, | |
| and reading the next element takes a long time. Here are some approaches to sorting this: | |
| 1. Basic, naïve mergesort: | |
| if (lists.size > 2) { | |
| merge_all(for (list1, list2 <- lists.grouped_by_2) { | |
| yield merge(list1, list2) | |
| } | |
| } else { | |
| yield min(list1.peek, list2.peek) |
| /* | |
| This is my first attempt at implementing clumping – once with folding, | |
| once with iterators. Clumping is what I've called grouping elements by | |
| an arbitrary function on them, much like groupBy, but preserving their order. | |
| e.g. [a,a,b,a,a,a].clump == [[a,a],[b],[a,a,a]] | |
| I'm just getting into functional programming, so this might have a different name. | |
| While the folding method is more "functionally" and concise, I'm not certain | |
| it provides the same laziness as the iterator one. | |
| I'm not sure exactly what calling view on an iterable does. I imagine it's unnecessary, |