Monads/Writer monad: Difference between revisions
Content added Content deleted
m (→{{header|Nim}}) |
mNo edit summary |
||
Line 671: | Line 671: | ||
proc bindWith(f: (x: float) -> float; log: string): WriterBind = |
proc bindWith(f: (x: float) -> float; log: string): WriterBind = |
||
result = (a: WriterUnit) => (f(a[0), a[1] & log) |
result = (a: WriterUnit) => (f(a[0]), a[1] & log) |
||
func doneWith(x: int): |
func doneWith(x: int): WriterUnit = |
||
(x.float, "") |
(x.float, "") |
||