Create a gist now

Instantly share code, notes, and snippets.

Quine Relay
(self-referential-version-of
'(lambda (self)
(format t
"#include <stdio.h>~%int main(){printf(\"%s\",~(~s~));}"
(remove #\newline (prin1-to-string self)))))
=>
((lambda (self)
(format t "#include <stdio.h>~%int main(){printf(\"%s\",~(~s~));}"
(remove #\newline (prin1-to-string self))))
((lambda (a)
(let ((b `',a))
(let ((ab `(,a ,b)))
`(,'(lambda (self)
(format t
"#include <stdio.h>~%int main(){printf(\"%s\",~(~s~));}"
(remove #\newline (prin1-to-string self))))
,ab))))
'(lambda (a)
(let ((b `',a))
(let ((ab `(,a ,b)))
`(,'(lambda (self)
(format t
"#include <stdio.h>~%int main(){printf(\"%s\",~(~s~));}"
(remove #\newline (prin1-to-string self))))
,ab))))))
=>
#include <stdio.h>
int main(){printf("%s","((lambda (self) (format t \"#include <stdio.h>~%int main(){printf(\\\"%s\\\",~(~s~));}\" (remove #\\newline (prin1-to-string self)))) ((lambda (a) (let ((b `',a)) (let ((ab `(,a ,b))) `(,'(lambda (self) (format t \"#include <stdio.h>~%int main(){printf(\\\"%s\\\",~(~s~));}\" (remove #\\newline (prin1-to-string self)))) ,ab)))) '(lambda (a) (let ((b `',a)) (let ((ab `(,a ,b))) `(,'(lambda (self) (format t \"#include <stdio.h>~%int main(){printf(\\\"%s\\\",~(~s~));}\" (remove #\\newline (prin1-to-string self)))) ,ab))))))");}
=>
((lambda (self) (format t "#include <stdio.h>~%int main(){printf(\"%s\",~(~s~));}" (remove #\newline (prin1-to-string self)))) ((lambda (a) (let ((b `',a)) (let ((ab `(,a ,b))) `(,'(lambda (self) (format t "#include <stdio.h>~%int main(){printf(\"%s\",~(~s~));}" (remove #\newline (prin1-to-string self)))) ,ab)))) '(lambda (a) (let ((b `',a)) (let ((ab `(,a ,b))) `(,'(lambda (self) (format t "#include <stdio.h>~%int main(){printf(\"%s\",~(~s~));}" (remove #\newline (prin1-to-string self)))) ,ab))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment