# My first quine

I finally got around to writing a quine today, it turned out to be not
so daunting once given a good chunk of thought and some
experimentation. It’s not particularly pretty (well, in fact it’s very
ugly indeed,) but it is *mine*!

```
= "\n\\\"main = let f a b = (take b . drop a) n in putStrLn $ f 6 4 ++ reverse (f 1 2) ++ [n!!6] ++ (replicate 3 . head . tail) n ++ drop 2 n ++ [n!!2] ++ take 1 n ++ drop 3 n"
n = let f a b = (take b . drop a) n in putStrLn $ f 6 4 ++ reverse (f 1 2) ++ [n!!6] ++ (replicate 3 . head . tail) n ++ drop 2 n ++ [n!!2] ++ take 1 n ++ drop 3 n main
```

I later realised it could be done much better by using two `putStrLn`

s
and a `show`

to avoid having to encode special characters in the first
string. Therefore I present my *second* quine!

```
= "main = putStrLn ((take 4 . drop 3) n ++ show n) >> putStrLn n"
n = putStrLn ((take 4 . drop 3) n ++ show n) >> putStrLn n main
```

Much more readable!

Afterwards, looking for comparable ones, I found this quine, and a rather neat one-liner, both of which use essentially the same tricks.

Paul —