[Haskell-cafe] Roman Numeral Problem

Roel van Dijk vandijk.roel at gmail.com
Mon Jun 24 09:11:57 CEST 2013

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.


1 - http://hackage.haskell.org/package/roman-numerals

On 24 June 2013 08:43, Christopher Howard <christopher.howard at 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130624/afbd329a/attachment.htm>

More information about the Haskell-Cafe mailing list