### This functional stuff is gonna take a while to comprehend.

#### by Gilbert Keith

*GS> flip mod 3 6

0

*GS> flip mod 6 3

3

*GS> flip (/) 6 3

0.5

*GS> flip (/) 3 6

2.0

So essentially flip takes the function in the first parameter, evaluates it with param #3 as the first parameter of the operation and #2 as the second.

Wacko.

There’s this list concatenation operator of sorts:

*GS> (++) [1] [2]

[1,2]

*GS> flip (++) [1] [2]

[2,1]

*GS>

The corollary is that commutative operations should be indifferent to the input. And this checks out.

*GS> flip (+) 3 6

9

*GS> flip (+) 6 3

9

Then of course, there’s crazy stuff like this:

http://stackoverflow.com/questions/12339822/why-does-haskells-flip-id-has-this-type

I did solve the first project Euler question in Haskell, which was pretty fun. The code is pretty.

--Project Euler Problem #1

```
```problem1 :: [Int] -> Int

problem1 [] = 0

problem1 (x:xs) = remainder x + problem1 xs

`remainder :: Int -> Int`

remainder x | (rem x 3 == 0) = x

| (rem x 5 == 0) = x

| otherwise = 0

Pretty sure this should be possible without recursion too, I just haven’t learned looping in Haskell.

Gautam Kandlikar