viewing paste nested-qq-test.scm | Scheme

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
(display '(SECTION 4 2 6))
(display "\nNested QQ tests\n")
 
;(test '(a `(b ,(+ 1 2) ,(foo 4 d) e) f) 'quasiquote `(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f))
;(test '(a `(b ,x ,'y d) e) 'quasiquote (let ((name1 'x) (name2 'y)) `(a `(b ,,name1 ,',name2 d) e)))
(define (qqtest q1 q2)
    (let ((a (lambda l (cons 'a l)))
          (d 3) (e 4) (f 5) (y 24))
        (test (eval q1) 'nested-quasiquote (eval q2))))
 
(define foo cons)
(qqtest '(a `(b ,(+ 1 2) ,(foo 4 d) e) f)
        `(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f))
(define foo +)
(qqtest '(a `(b ,(+ 1 2) ,(foo 4 d) e) f)
        `(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f))
(qqtest '(a `(b ,x ,'y d) e)
        (let ((name1 'x) (name2 'y)) `(a `(b ,,name1 ,',name2 d) e)))
 
Viewed 343 times, submitted by unknown.