Hi Christopher, I made a small library to convert between strings and roman numerals [1]. It didn't use much abstraction. I mainly used some type-classes so multiple string-like types can be parsed. The numerals themselves are basically a concatenation of value symbols. The order from high to low is not even strictly necessary in order to parse a roman numeral. One insight was to handle exceptions like "IV", "IX", "XL" etc. as separate symbols. It would be interesting if you could parse roman numerals using a dedicated parsing library and come up with something shorter and/or more elegant/readable than my little library. Regards, Roel 1 - http://hackage.haskell.org/package/roman-numerals On 24 June 2013 08:43, Christopher Howard <christopher.howard@frigidcode.com
wrote:
Hi. I am working on some practice programming problems, and one is the Roman numeral problem: write a program that converts Roman numerals into their (arabic) numeral equivalent. I imagine I could hack something together, but I was trying to think about the problem a bit more deeply. I don't know much about parsing, but I was wondering if this problem matched up with some kind of parsing or grammar or other generic approach to thinking about the problem. (I once read something about Context Free Grammars, which was rather interesting.) I can do more of my own research if I can get some initial guidance.
-- frigidcode.com
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe