[Haskell-cafe] A functional programming solution for Mr and Mrs Hollingberry

Artyom Kazak artyom.kazak at gmail.com
Mon May 21 00:54:27 CEST 2012


Andreas Pauley <apauley at gmail.com> писал(а) в своём письме Sun, 20 May  
2012 20:33:13 +0300:

> I want to see how elegant a solution I can get in a functional
> language, given that the problem description is not really elegant at
> all. It has a few annoying exceptions to the normal rules, typical of
> what one might get in a real specification from some client.

After taking a look at other solutions, I feel like I will have to explain
myself, so I’d better do that without prompting :)

   - nothing was said about meaningful error messages, so I didn’t bother.
   - I had decided against defining constants like  
`supplier_markup_percentage_modification`
     separately; `PremiumSupplierIDs` and markup table are defined locally  
in the `calc`
     function, too. The latter two issues are fixed in the next version, as  
someone
     may consider them to be against elegance.
   - surprisingly, all solutions use explicit comparisons to determine the  
product
     category. While it is okay for continuous ranges of codes, it doesn’t  
scale and
     not really elegant. Fixed as well.



More information about the Haskell-Cafe mailing list