Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A Default Identity Value for Programming (silvrback.com)
2 points by farginay on Dec 19, 2013 | hide | past | favorite | 2 comments


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.


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




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: