Was attempting to write an ETHIOPIAN NIGGER-SCALE SOLUTION to the problem posed by the OP of this thread: http://dis.4chan.org/read/prog/1195330684/ when I ran into a really odd bug: n,t=io.read("*number"),{}
while n~=0 do table.insert(t,n) end
for i,v in ipairs(t) do print(i,v) end
Run this code, it will prompt you for a number, enter one and hit return: it will eat as much memory and CPU cycles as possible.
>>5
Since you seem like an expertHaskellProgrammer to me, please explain the datatype stuff to me, I really don't get it.
Like here:
findElement :: (a -> Bool) -> [a] -> Maybe a
findElement p [] = Nothing
findElement p (x:xs) =
if p x then Just x
else findElement p xs
Explain (a -> Bool) -> [a] -> Maybe a to me. I think that it should take a list of as and a boolean predicate and return a single value a, so [code]([a] -> Bool) -> Maybe a[code]. Why am I wrong?
Name:
Anonymous2007-11-19 16:18
>>6 (a -> Bool) -> [a] -> Maybe a
boolean predicate list of as single value a (if any)
>>13
Omg wtf (ò_ó) UH UH BAKA NEKO THAT’S BULLSHITE!! We r expart programmers here =^____^= haskell ftw!!!!!!! ** (*O*)/ I loooev abstrect concepts (^________<) ^_________________^;;;;;;;;;;;;;;;;
Name:
Anonymous2007-11-19 16:58
>>6
In the Haskell type system, (->) is an operator that takes two types and creates a function. It is right associative. With this knowledge, you can deconstruct the type (a -> Bool) -> [a] -> Maybe a. Taking associativity into account this is: (a -> Bool) -> ([a] -> Maybe a)[code]
So this function takes a function from [code]a to Bool, and returns a function from [a] to Maybe a. By uncurrying, we can see that this is raelly a function that takes two arguments -- a function from a to Bool, and [a]. The return value is Maybe a.
function blue_water()
{
while(1) // a loop that is always true
{
if (fox.position == in_blue_water) // if the fox is in the blue water
{
fox.health = 0; // the fox dies as it's health is being set to 0
}
if (fox.position != in_blue_water) // if the fox is not in the blue water
{
fox.wants_to_get_wet = true; // flag being set to true to make the fox want to get wet
}
>>32
That post was made to alert my fellow 4channers that there was something to be gained by finding where that code snippet comes from, and in addition to give a direct link for their convenience.
It was not made to show off my "google-fu" (of which indeed little is needed for this task), so your summary of my post is incorrect. Therefore I feel that your outrage is uncalled for, and hope to recieve your apologies forthwith.