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

2012-05-29 Thread Richard O'Keefe
On 30/05/2012, at 10:16 AM, Eric Rasmussen wrote: > One idea (contrived and silly though it is) is modeling a Courier that > delivers message to Persons. There is a standard default reply for all > Persons, some individuals have their own default reply, and there are > conditional replies based

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

2012-05-29 Thread Eric Rasmussen
I added a Scala solution since Haskell is already well represented. Regarding exercises that are easier in OO, I don't think you'll find one that a good Haskell programmer can't match in a functional style. But if you make simulation the goal of the exercise (rather than writing a program that tak

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

2012-05-27 Thread Alexander Solla
On Sun, May 27, 2012 at 7:07 PM, Richard O'Keefe wrote: > > On 26/05/2012, at 4:16 AM, David Turner wrote: > > > > I don't. I think the trouble is that classes don't add value in > exercises of this size. > > This was the key point, I think. > In this example, there wasn't any significant behavio

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

2012-05-27 Thread Richard O'Keefe
On 26/05/2012, at 4:16 AM, David Turner wrote: > > I don't. I think the trouble is that classes don't add value in exercises of > this size. This was the key point, I think. In this example, there wasn't any significant behaviour that could be moved to superclasses. For that matter, whether a

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

2012-05-27 Thread Ketil Malde
Andreas Pauley writes: > Do you know of an exercise where classes would add value? Something > fairly small, roughly similar in size to this exercise. AFAICR, the motivating example for OO (in Simula) was simulating an environment where different entities interact - I think the case was queues i

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

2012-05-25 Thread David Turner
On 24/05/2012 18:56, Andreas Pauley wrote: I've used quite a few OO languages. I like to think that I *am* an OO programmer. But this exercise struck me from the beginning as something where classes would add nothing but bulk. As a fan of Smalltalk, I have to say that the Smalltalk version con

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

2012-05-24 Thread Andreas Pauley
On Wed, May 23, 2012 at 11:37 PM, Richard O'Keefe wrote: > > On 21/05/2012, at 5:33 AM, Andreas Pauley wrote: >> With this in mind I've created a programming exercise where I imagine >> an OO programmer would use an object hierarchy with subtype >> polymorphism as part of the solution. > > Being u

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

2012-05-23 Thread Richard O'Keefe
On 21/05/2012, at 5:33 AM, Andreas Pauley wrote: > With this in mind I've created a programming exercise where I imagine > an OO programmer would use an object hierarchy with subtype > polymorphism as part of the solution. Being unfamiliar with git, I've submitted an AWK answer by e-mail. I've u

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

2012-05-20 Thread Andreas Pauley
On Mon, May 21, 2012 at 12:54 AM, Artyom Kazak wrote: > Andreas Pauley писал(а) в своём письме 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 ann

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

2012-05-20 Thread Artyom Kazak
Andreas Pauley писал(а) в своём письме 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

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

2012-05-20 Thread Artyom Kazak
Challenge accepted! I have written a solution in Haskell; please merge :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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

2012-05-20 Thread Andreas Pauley
Hi all, I'm in the process of learning how to approach problems from a functional perspective, coming from an Object Oriented background (mostly Smalltalk). One of the general concerns/questions raised when talking to people in a similar position is: "How do I design/model a problem when I don't