This file contains 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
// Just an experiment for composing if else in a more structured way | |
// usage | |
var isLoadMoreAllowed = false | |
func loadMore() { | |
print("loading more") | |
} | |
when(isLoadMoreAllowed) | |
.then { loadMore() } |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<h2>The XMLHttpRequest Object</h2> | |
<div id="container"></div> | |
<p id="demo">Let AJAX change this text.</p> | |
</div> |
This file contains 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
//https://github.com/bow-swift/bow/blob/1ba8474eb3ae4c0344f625510818758786d469ac/Sources/Bow/Syntax/Curry.swift | |
public func curry<A, B, C>(_ fun: @escaping (A, B) -> C) -> (A) -> (B) -> C { | |
return { a in | |
return { b in | |
return fun(a, b) | |
} | |
} | |
} | |
public func curry1<A, B, C>() -> ( @escaping (A, B) -> C) -> (A) -> (B) -> C { |