lib-export.scm 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. (define-library (test export)
  2. (export fifty-five list-4-values test-guard
  3. make-foo foo? foo-x set-foo-x! foo-y pfoo)
  4. (import (scheme base) (scheme write))
  5. (begin
  6. (define-syntax fifty-five
  7. (syntax-rules ()
  8. ((_) 55)))
  9. (define-record-type <foo>
  10. (make-foo x y)
  11. foo?
  12. (x foo-x set-foo-x!)
  13. (y foo-y))
  14. (define (list-4-values)
  15. (let-values (((a b c d)
  16. (values 0 1 2 3)))
  17. (list a b c d)))
  18. (define (test-guard)
  19. (guard
  20. (exn (#t #t))
  21. 'g-5))
  22. (define psomething (make-parameter #t))
  23. (define (pfoo)
  24. (parameterize ((psomething #f))
  25. (display "parameter psomething: ") (display (psomething)) (newline))
  26. (display "parameter psomething: ") (display (psomething)) (newline))
  27. ))
  28. (import (scheme base)
  29. (scheme write)
  30. (test export))
  31. (display (fifty-five))
  32. (newline)
  33. ;; Output: 55
  34. (let ((bar (make-foo 3 7)))
  35. (set-foo-x! bar 5)
  36. (display (foo-x bar))
  37. (newline))
  38. ;; Output: 5
  39. (write (list-4-values)) (newline)
  40. ;; Output: (0 1 2 3)
  41. (display (test-guard)) (newline)
  42. ;; Output: g-5
  43. (pfoo)
  44. ;; Output: parameter psomething: #f
  45. ;; Output: parameter psomething: #t