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
// As long as the functions work on Promise values, you don't need to use `.then/.chain`. | |
// In fact, I'd say that using `.then` directly is usually an anti-pattern, as you can easily liftN(fn) | |
var tweets = getTweetsFor("swannodette") | |
var firstUrl = expandUrl(first(parseUrls(tweets))) | |
var response = httpGet(firstUrl) | |
response.then(function(data) { console.log("Most recent link text: ", data) } | |
,function(error) { console.log("Error with the twitterverse: ", error) }) | |
/* The CLJS |
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
// This is a really bad implementation of a simple algebraic data type in Dart please don't kill meee~ | |
class None implements Option<None> { | |
map(f) => this; | |
operator >= (f) => this; | |
operator | (x) => x; | |
None(); | |
} | |
class Option<T> { | |
final value; |
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
fruits = <[ apple orange ]> | |
# This should be a comment | |
people = <[ Chris Alice ]> | |
# This should be another comment |
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
function findElement(node, stepper) { | |
var x | |
return isRoot(node)? stepper(node) | |
: x = stepper(node)? x | |
: /* otherwise */ findElement(node.parentNode, stepper) | |
} | |
function findNextSibling(node) { | |
return findElement(node, function(el) { return el.nextSibling }) | |
} |