▲ 427 ▼ Infallible Code (feddit.uk) submitted 1 year ago by sirico@feddit.uk to c/programmerhumor@lemmy.ml 122 comments fedilink hide all child comments
[–] myotheraccount@lemmy.world 111 points 1 year ago (3 children) ftfy bool IsEven(int number) { return !IsOdd(number); } bool IsOdd(int number) { return !IsEven(number); } permalink fedilink source hideshow 3 child comments replies: [–] balsoft@lemmy.ml 15 points 1 year ago* (2 children) You kid, but Idris2 documentation literally proposes almost this exact impl: https://idris2.readthedocs.io/en/latest/tutorial/typesfuns.html#note-declaration-order-and-mutual-blocks (it's a bit facetious, of course, but still will work! the actual impl in the language is a lot more boring: https://github.com/idris-lang/Idris2/blob/main/libs/base/Data/Integral.idr) permalink fedilink source parent hideshow 2 child comments replies: [–] myotheraccount@lemmy.world 4 points 1 year ago (1 child) I hadn't seen Idris2. Thank you for providing me with a new rabbit hole! permalink fedilink source parent hideshow 1 child comment replies: [–] balsoft@lemmy.ml 3 points 1 year ago I'm glad to tell more people about it. It's really quite amazing (I could write a somewhat complex algorithm and prove some properties about it in a couple afternoons, despite limited formal verification experience) and I'm sure that in 20 odd years the ideas behind it will make it into mainstream languages, just as with ML/Haskell. permalink fedilink source parent
[–] balsoft@lemmy.ml 15 points 1 year ago* (2 children) You kid, but Idris2 documentation literally proposes almost this exact impl: https://idris2.readthedocs.io/en/latest/tutorial/typesfuns.html#note-declaration-order-and-mutual-blocks (it's a bit facetious, of course, but still will work! the actual impl in the language is a lot more boring: https://github.com/idris-lang/Idris2/blob/main/libs/base/Data/Integral.idr) permalink fedilink source parent hideshow 2 child comments replies: [–] myotheraccount@lemmy.world 4 points 1 year ago (1 child) I hadn't seen Idris2. Thank you for providing me with a new rabbit hole! permalink fedilink source parent hideshow 1 child comment replies: [–] balsoft@lemmy.ml 3 points 1 year ago I'm glad to tell more people about it. It's really quite amazing (I could write a somewhat complex algorithm and prove some properties about it in a couple afternoons, despite limited formal verification experience) and I'm sure that in 20 odd years the ideas behind it will make it into mainstream languages, just as with ML/Haskell. permalink fedilink source parent
[–] myotheraccount@lemmy.world 4 points 1 year ago (1 child) I hadn't seen Idris2. Thank you for providing me with a new rabbit hole! permalink fedilink source parent hideshow 1 child comment replies: [–] balsoft@lemmy.ml 3 points 1 year ago I'm glad to tell more people about it. It's really quite amazing (I could write a somewhat complex algorithm and prove some properties about it in a couple afternoons, despite limited formal verification experience) and I'm sure that in 20 odd years the ideas behind it will make it into mainstream languages, just as with ML/Haskell. permalink fedilink source parent
[–] balsoft@lemmy.ml 3 points 1 year ago I'm glad to tell more people about it. It's really quite amazing (I could write a somewhat complex algorithm and prove some properties about it in a couple afternoons, despite limited formal verification experience) and I'm sure that in 20 odd years the ideas behind it will make it into mainstream languages, just as with ML/Haskell. permalink fedilink source parent