6
Shouts

Creating an English-like Math DSL

published 730 days, 20 hours, 26 minutes ago posted by KodefuGuruKodefuGuru 733 days, 52 minutes ago
Wednesday, May 25, 2011 7:43:28 AM GMT Monday, May 23, 2011 3:17:10 AM GMT

The answer to life, the universe, and everything is well-known as 42. There are a myriad of questions that lead to this answer, and my favorite is perhaps the percent of leet pi. I wanted to be able to write this in C# as close to English as possible. Since I had no way to write my own keywords, the closest I could devise was the following bit of code.double percent = 0.01; var answer = percent.Of().Leet().Pi(); The tricky part here is deciding what to do about the Of() method. It represents an operati...

category: How To | clicked: 0 | | source: www.kodefuguru.com | show counter code
tags: Extension Methods, functional, partial application