News for hackers. Stuff that matters.
Re:A Default Identity Value for Programming by npryce on Thursday December 19, 2013 @10:37AM (#6935205)
J has a similar feature: when applied to an empty array, /+ returns 0 and /* returns 1.

J doesn't have user-defined types. In a language with user-defined types, you would probably have to declare which operations are monoids.

Re:A Default Identity Value for Programming by dvberkel on Thursday December 19, 2013 @11:12AM (#6935499)
I would concur with npryce. I your structure would adhere to the monoid interface and the default value could be cast automatically to the corresponding identity this will work. It wouldn't even break mathematics