[Haskell-beginners] Mastermind

Mike Houghton mike_k_houghton at yahoo.co.uk
Mon Mar 23 23:13:46 UTC 2015


Thanks guys - I think the light has just gone on!
;)

> On 23 Mar 2015, at 22:57, Ngoc Dao <ngocdaothanh at gmail.com> wrote:
> 
> Mike,
> 
> You may have noticed Frerich was saying about recursion.
> I will provide you some more topics/keywords so that you can
> investigate further:
> 
> You should practise writing the recursion in 2 ways:
> normal recursion and tail recursion (to avoid stackoverflow when the
> recursion depth is large)
> 
> For the tail recursion, you use the accumulator pattern, which is very
> common in functional programming.
> 
> On Tue, Mar 24, 2015 at 7:46 AM, Frerich Raabe <raabe at froglogic.com> wrote:
>> Hi Mike,
>> 
>> On 2015-03-23 23:06, Mike Houghton wrote:
>>> 
>>> I’m working through http://www.seas.upenn.edu/~cis194/hw/02-lists.pdf [1]
>>> - the homework for the CIS 194 Haskell course.
>>> I ‘stuck’ on question 6!
>>> If anyone has done this I’d really appreciate a pointer to solving it.
>> 
>> 
>> Just thinking out loud:
>> 
>> Consider that to get all lists of length 2, you could add (e.g. prepend)
>> each of the six colors to each of the lists of length 1. And to get each of
>> the lists of length 1 you prepend each of the six colors to each of the
>> lists of length 0.
>> 
>> Does that help? :-)
>> 
>> --
>> Frerich Raabe - raabe at froglogic.com
>> www.froglogic.com - Multi-Platform GUI Testing
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners



More information about the Beginners mailing list