[Haskell-cafe] Hints for Euler Problem 11

Jim Burton jim at sdf-eu.org
Fri Jul 20 11:46:31 EDT 2007



Jim Burton wrote:
> 
> 
> Ronald Guida wrote:
>> 
>> Hi, again.
>> 
>> I started looking at the Euler problems [1].  I had no trouble with
>> problems 1 through 10, but I'm stuck on problem 11.  I am aware that
>> the solutions are available ([2]), but I would rather not look just
>> yet.
>> [...]
>> 
>> 
> 
> FWIW I used a 2D array and a function to retrieve the values in every
> direction from a given row,col, for each direction valid for that array
> index. Getting the 4 vals in each direction is done by iterating 2
> functions on the (row,col) index to move in the right direction I.e., 
> 
> vals (row,col) = north : south : ... : []
>   where north = if toohigh then [] else stream (subtract 1) (id)
>            south = if toolow then [] else stream (+1) (id)
>            .......
> 
> 
where `stream' is badly named -- rather than a stream it's the 4 vals in
that direction.

-- 
View this message in context: http://www.nabble.com/Hints-for-Euler-Problem-11-tf4114963.html#a11710683
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list