Skip to content

Instantly share code, notes, and snippets.

@Gozala
Created January 6, 2013 05:06
Show Gist options
  • Save Gozala/4465354 to your computer and use it in GitHub Desktop.
Save Gozala/4465354 to your computer and use it in GitHub Desktop.
Introspection for reducibles
function introspect(source, alias) {
return reducible(function(next, initial) {
return reduce(source, function(value, result) {
if (value === end) console.log(alias, "<<", value)
if (isError(value)) console.log(alias, "\u26A1", value)
result = next(value, result)
if (isReduced(result)) console.log(alias, "\u2702", result.value)
return result
}, intial)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment