[Haskell-cafe] Infinite grid

Henning Thielemann schlepptop at henning-thielemann.de
Mon Dec 29 19:23:03 EST 2008


Martijn van Steenbergen schrieb:
> Hello,
> 
> I would like to construct an infinite two-dimensional grid of nodes,
> where a node looks like this:
> 
>> data Node = Node
>>   { north :: Node
>>   , east  :: Node
>>   , south :: Node
>>   , west  :: Node
>>   }
> 
> in such a way that for every node n in the grid it doesn't matter how I
> travel to n, I always end up in the same memory location for that node.
> 
> I suspect another way of saying that is that
> 
>> let f = f . north . east . south . west in f origin
> 
> should run in constant space. I hope this makes the problem clear. :-)

A dungeon game? :-)



More information about the Haskell-Cafe mailing list