vile / scheme / testdata / frontends / libraries.scm
26 lines · 26 sloc · 941 bytes · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1(define-library (front state)
2 (export count bump! next literal token)
3 (import (scheme base))
4 (begin
5 (define count 0)
6 (define token 1)
7 (define (bump!) (set! count (+ count 1)) count)
8 (define-syntax next (syntax-rules () ((_) (bump!))))
9 (define-syntax literal
10 (syntax-rules (token) ((_ token) #t) ((_ other) #f)))))
11(define-library (front aliases)
12 (export (rename count shared) bump!)
13 (import (only (front state) count bump!)))
14(define count 999)
15(define bump! #f)
16(define token 1)
17(import (prefix (front aliases) a:)
18 (rename (except (front state) count bump!) (token renamed-token)))
19(define first (next))
20(define second (a:bump!))
21(define third (next))
22(define e (environment '(only (scheme base) +)))
23(list first second third a:shared count
24 (literal renamed-token) (literal token)
25 (eval '(+ 20 22) e)
26 (cond-expand ((and vile (library (front state))) 'present) (else 'missing)))
27