Monads/Writer monad: Difference between revisions
Content added Content deleted
(J draft) |
m (→ES5) |
||
Line 94: | Line 94: | ||
log_half = loggingVersion(half, "divided by 2"); |
log_half = loggingVersion(half, "divided by 2"); |
||
Line 131: | Line 130: | ||
// and then nests function applications (working from right to left) |
// and then nests function applications (working from right to left) |
||
function logCompose(lstFunctions, value) { |
function logCompose(lstFunctions, value) { |
||
return lstFunctions |
return lstFunctions.reduceRight( |
||
writerBind, |
|||
writerUnit(value) |
|||
); |
|||
} |
} |
||