Why couldn't you get Irish girl to model it? I'd buy if you did.
lolpande
@lolpande
Best posts made by lolpande
Latest posts made by lolpande
-
RE: "Send me teh codez" t-shirt
-
RE: Great Interview Question... Who is your favorite person in history?
My favorite person in history is ME!!!! :-)
Do i get the job? :-P
-
RE: WTF in Haskell
[quote user="Iago"]
you might use the "nub" function to remove duplicate elements from the list, then compare its length before and after to count the number of equal values that were removed.
[/quote]
Now, THAT is elegant!
-
RE: WTF in Haskell
Ooh! Interesting.... But you can't do that. Something similar would work in Prolog though.
See, with functional programming, the function parameters need to be different, because you are gonna use those parameters inside the function definition, so you just HAVE to have a way to identify which parameter is which one.
In declarative languages like Prolog, there IS no function 'definition', just the declaration, so code like that one can be used to check if parameters are equal...
-
RE: WTF in Haskell
And now I broke the interpreter! I made howManyOfTwoEqual using howManyEqual and howManyEqual using howManyOfTwoEqual in the same script! Call stack overflow in my first script! Beat that!!!
Now I wanted to have more fun, so I made another function bool allDifferent(int, int, int) that uses howManyEqual and used THAT in howManyEqual... 3 way dependency! Faster stack overflow!
-
WTF in Haskell
Its my first day of learning Haskell and I just wrote these 2 functions-
howManyEqual :: Int -> Int -> Int -> Int howManyEqual a b c | (a == b) && (b == c) = 3 | (a == b) && not(b == c) || (b == c) && not(c == a) || (c == a) && not(a == b) = 2 | not(a == b) && not(b == c) && not(c == a) = 0 -- Is this ugly or what! howManyOfTwoEqual :: Int -> Int -> Int howManyOfTwoEqual a b | (howManyEqual a a b) == 2 = 0 | (howManyEqual a a b) == 3 = 2
Now, I don't even know if what I'm doing is WTF-ey or not. Basically what this code does is use a function int howManyEqual(int, int, int) to calculate the function int howManyOfTwoEqual(int, int)!
So... is this a WTF??? Because I really can't figure out if this is good functional programming or bad! Help me!!!