Live data from Hacker News

A Quine in Fortran 90

medium.com

11–14 of 14 posts

Re: A Quine in Fortran 90

#11

Earlier quoted context omitted.

I didn't mean that you could output to a file -- I meant that, knowing the name of the file the program is saved to (which is possible using facilities available in many modern languages, not sure about Fortran), you can ingest that file and print out its contents (to STDOUT for example). It feels like cheating, but it's also probably the easiest way to get a true quine which'll always work even if you modify parts o…

Many years ago, I attempted to cheat this way when writing a JScript quine- but it didn't work because the Windows Scripting Host keeps the source file open while interpreting it, which meant the script couldn't open its own source file because the file was already open in another program! A proper quine, though, doesn't require input.

A multiquine does require you to give input in order to determine what language to output. Although it will output the current file if no input is giving. More info @ https://en.wikipedia.org/wiki/Quine_(computing)#Multiquines

Re: A Quine in Fortran 90

#12
print "(2a, 2('2459093414108622880,2821560280312525352,3180149544576887847,1684956475', a))",2459093414108622880,2821560280312525352,3180149544576887847,1684956475;end

Re: A Quine in Fortran 90

#13

Earlier quoted context omitted.

Many years ago, I attempted to cheat this way when writing a JScript quine- but it didn't work because the Windows Scripting Host keeps the source file open while interpreting it, which meant the script couldn't open its own source file because the file was already open in another program! A proper quine, though, doesn't require input.

A multiquine does require you to give input in order to determine what language to output. Although it will output the current file if no input is giving. More info @ https://en.wikipedia.org/wiki/Quine_(computing)#Multiquines

The definition of a multiquine specifically disallows passing in source code as input, though. The input to a multiquine is strictly for selecting which sub-quine to run, or which output set to calculate, and is not used in any way to influence the calculation of the selected output.
Post reply on HN