Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ challenge [HASKELL]

Name: Anonymous 2008-05-09 13:15

Use the loeb function:
loeb :: Functor a => a (a x -> x) -> a x
loeb x = fmap (\a -> a (loeb x)) x


To implement a basic spreadsheet processor. The processor should accept input of the form:
|##|A        |B    |C   |D       |
|01|(* B1 C1)|2    |3   |(* A1 2)|

The output from this example should be:
|##|A      |B    |C   |D     |
|01|6      |2    |3   |12    |

Cells may contain number literals, references to other cells of the form <letter><number>, or function applications of the form (<function> *<args>).

Name: Anonymous 2008-05-11 10:06


            ?
     ___/|
 ?   \o_O| . o O ( how can you explain loeb in "words" ? )
      \  |        
     f | | ?
     |_| |


>Loeb takes a functor of functions, applies them to the result of loebing that functor of functions, and returns the functor of results.

that's basically it, it's a literal translation of the code (heh, i wonder if you could machine-translate haskell :)). but if these words and concepts don't mean anything to you ("functor"?), it won't make things any clearer.

if you want to understand what loeb is all about you'll need more background knowledge (types, you need to know *all* about haskell's type system). here's a thread i started earlier that probably gave rise to this: http://dis.4chan.org/read/prog/1210284504/1- , it contains some more information, but probably not enough so you could get it.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List