Monoid instances by kaki

(use srfi-1)(map(^n(let*(`(^l`(,(#0=string-join l","))),(^f(map(.$ f string ucs->char)(iota n 97)))(a" `mappend` ")(m(^x #`"Monoid ,x"))'(^s(^p #`",p,s")))(print"instance ("(#0#,m", ")") => "(m`,+)" where
    mempty = "`(make-list n"mempty")"
    "`,'1 a`,'2" = "`,(^x #`",|x|1,a,|x|2")"
")))(iota 25 2))

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page