Hey guys, got a bit of a coursework problem here, which I can't for the life of me seem to figure out. I know you don't want to be helping people do their coursework, so I'll take any hints, or even code in another language to help me. I need, in Haskell, to write a function that will print it's own definition. I have no idea where to go with this! Obviously, the more you write, the more you have to print out. The only thing I can think of at the minute is something clever with string multiplication, but I"m really stuck. Any help?
You mean like a quine? Couldn't you write it in a real language, like C where you can use the preprocessor? Solution (don't read it unless you want to cheat): Spoiler main=putStr(p++show(p))where p="main=putStr(p++show(p))where p="
Awesome, I knew there'd be a name for it. That haskell solution is very simliar to what I was attempting, I was close! Thanks.