This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Foobar(v) { | |
v(this.resolve.bind(this), this.error.bind(this)) | |
} | |
Foobar.prototype.resolve = function(v) { | |
this.value = v | |
this.resolveFunction(v) | |
} | |
Foobar.prototype.error = function(v) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func mergesort<T: Comparable>(_ input: [T] ) -> [T] { | |
guard input.count > 1 else { | |
return input | |
} | |
let midPoint:Int = input.count / 2 | |
let tempLeft = Array(input[..<midPoint]) | |
let tempRight = Array(input[midPoint...]) | |
let left = mergesort(tempLeft) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ELF > |