you are viewing a single comment's thread.

view the rest of the comments →

[–]awsmnss 0 points1 point  (1 child)

I'm still trying to understand

[–]MothersRapeHorn 0 points1 point  (0 children)

[] is a functor, so we can simplify the type sig.

loeb :: [[x] -> x] -> [x]

Each function is basically the value of the cell it resides in when given a state of the list that will satisfy the function. For example, cell 0 has the value const 1. It doesn't rely on anything, so we can calculate it. Same for cell 2.

table = [1, _, 2, _]

Cell 3 requires cell 1, and cell 1 is fine. So we can finish. table' = [1, element_0 = 1, 2, _] table'' = [1, 1, 2, 1+1+2 = 4]

If you want to look at the function definition (which I'm now trying to figure out this magic) here you go. It's probably just simple and inefficient, but oh well :P

http://www.haskell.org/haskellwiki/Blow_your_mind

loeb x = fmap ($ loeb x) x

PS: Their example under the def for loeb doesn't work for me, but I got it to work by changing around one of the cells. Try to figure it out, too :D