I made some effort trying to come up with one myself, but didn’t manage to do so, so just reprinting some simples one here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #lang racket
; https://www.nyx.net/~gthompso/self_scheme.txt ((lambda (x) `(,x ',x)) '(lambda (x) `(,x ',x)))
((lambda (x) `(,(reverse x) ',x)) '(`(,(reverse x) ',x) (x) lambda))
(define (my-eval e) (eval e (make-base-namespace)))
(define quine-1 ((lambda (x) `(,x ',x)) '(lambda (x) `(,x ',x))))
(define quine-2 ((lambda (x) `(,(reverse x) ',x)) '(`(,(reverse x) ',x) (x) lambda)))
(define (is-quine? e) (and (equal? e (my-eval e)) (equal? e (my-eval (my-eval e)))))
(is-quine? quine-1) (is-quine? quine-2)
|