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 14:12

Name: Anonymous 2008-05-11 14:12

Name: Anonymous 2008-05-11 14:12

Name: Anonymous 2008-05-11 14:12

Name: Anonymous 2008-05-11 14:12

Name: Anonymous 2008-05-11 14:12

Name: Anonymous 2008-05-11 14:12

Name: Anonymous 2008-05-11 14:12

Name: Anonymous 2008-05-11 14:13

Name: Anonymous 2008-05-11 14:13

Name: Anonymous 2008-05-11 14:13

Name: Anonymous 2008-05-11 14:13

Name: Anonymous 2008-05-11 20:49

>>32
[quote]As with any Haskell concept, understanding it is just a matter of getting past all the intellectual masturbation on the part of the tutorial writer.[/quote]
So true.

Also, that was a great explanation of loeb.

Name: Anonymous 2008-05-11 22:05

>>32
First explanation of any Haskell concept that has made sense.

Name: Anonymous 2008-05-13 18:50

>>32
So this magic function that the Haskellites are jizzing everywhere about is just memoization?

Name: Trollbot9000 2009-07-01 11:14


sheet processor The processor should accept input  of the form  f handle param1.

Name: Anonymous 2009-07-01 11:56

>>32
So, loeb gives each function in the functor the entire functor of results of all functions?
Doesn't seem very practical to me.

Name: Anonymous 2009-07-01 12:11

>>57
You just haven't reached our level of Satori yet. You need to lrn2Haskell.

Name: Anonymous 2009-07-01 12:59

>>32
As a base case, at least one function must ignore its argument.
Well, not exactly: loeb [length] = [1]. And then there's loeb [(1:) . head] = [repeat 1], or loeb [(1:) . head . tail, (2:) . head] = [cycle [1,2]].

Name: hasklol 2009-07-01 14:02

>>8
Haskell was made without side-effects (lol pure). Then everyone was like, "Fuck, we need sonuvabitching side-effects to do any goddamn thing!" So they let them back in. But then they were like, "Shit, lazy evaluation means crap is happening in fucked-up ways we can't motherfucking cocksucking asshole dick predict!" Hence, monads.

IOW: Monads are a way of [doing what every other language already does by] separating purity and impurity in a lazy language.

...

For the sake of clarity. XD XD XD

Name: Anonymous 2009-07-01 14:31

>>60
facepalm.txt

Name: Anonymous 2009-07-01 14:39

>>60
Nice try, thanks for playing. Monads actually have nothing to do with laziness, and everything to do with passing around arguments you don't care about, especially in recursive code.

Name: !MILKRIBS4k 2009-07-01 16:23

I don't "get" what is up with this HASKELL meme! Why is it so good! Is it better than C! Why is it not on as many platforms as C if it's so good! Is this all just a /prog/ meme!

Name: Anonymous 2009-07-01 16:29

>>63
You have no idea what you're getting into. If you tried to understand Haskell, your head (do anuses have heads?) would explode.

Name: Anonymous 2009-07-01 16:30

>>63
/prog/
You are a quick learner. Get the fuck back to lounge.

Name: !MILKRIBS4k 2009-07-01 16:35

>>64
Are you trying to say HASKELL is some sort of secret club(like /b/) that only the best programmers can use! NO THANK YOU

Name: Anonymous 2009-07-01 16:37

>>66
What I am trying to say now is that you should learn to use the question mark.
And please don't compare Haskell to /b/.
Also, how the hell is /b/ like a secret club?

Name: !MILKRIBS4k 2009-07-01 16:41

>>67
Jeepers I was using sarcasm! Well what is so great about HASKELL! Is it just a meme!

Name: HASKELL MEME FAN 2009-07-01 16:46

>>68
f@(_:fs) = 0 : 1 : zipWith (+) f fs
FACTORIALS!

Name: !MILKRIBS4k 2009-07-01 16:51

>>69
JEEPERS CREEPERS! I just read the wiki on FACTORIALS and I did not understand one thing it said!

Name: Anonymous 2009-07-01 17:00

>>69
f@(_:fs) = 0 : 1 : zipWith (+) f fs
FACTORIALS!

4/10, I nearly didn't notice.

Name: Anonymous 2009-07-01 18:32

>>62
Nice try
So, 4/10? 5/10?
Monads actually have nothing to do with laziness...
Ah, 10/10.

Name: Anonymous 2009-07-01 21:44

>>68
loeb :: Functor a => a (a x -> x) -> a x
loeb x = fmap (\a -> a (loeb x)) x

Name: Anonymous 2009-07-01 21:52

>>72
It's true. Monads are a constuction in category theory.

Name: Anonymous 2009-07-01 22:16

>>72
You have in fact not been trolled. Haskell's monads are completely orthogonal to laziness; in fact, Haskell has some strict monads.

Now if you wanted to implement monads in a language without closures, then you'd be fucked. It would be like trying to compile Ruby.

Name: Anonymous 2009-07-01 22:25

>>75
not been trolled
Lessee:
XD
Stupid smiley? Check.
Laziness and monads
Tying together completely unrelated things? Check.
So then they were like...
Fake history? Check.
>>8
Responding to a post from a zillion years ago? Check.

Yep, sure isn't trollan in here.

Name: Anonymous 2009-07-01 22:57

>>76
Excuse me sir, >>60-chan was clearly a troll, but >>62-chan was probably not. But what do I know?

Name: Anonymous 2009-07-01 23:38

loeb = fix (fmap . flip id =<<)

Name: Anonymous 2009-07-02 0:00

>>78
Add a type signature

Name: Anonymous 2009-07-02 0:45

>>79
loeb :: Functor f => f (f a -> a) -> f a
loeb = fix (fmap . flip id =<<)

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