/racket-5-0-2-bin-i386-osx-mac-dmg/collects/mzlib/scribblings/compat.scrbl

http://github.com/smorin/f4f.arc · Racket · 96 lines · 65 code · 31 blank · 0 comment · 2 complexity · 6dd588472396ed675de8a96d812d48ac MD5 · raw file

  1. #lang scribble/doc
  2. @(require "common.rkt"
  3. scribble/eval
  4. (for-label mzlib/compat))
  5. @(define compat-eval (make-base-eval))
  6. @interaction-eval[#:eval compat-eval (require mzlib/compat)]
  7. @mzlib[#:mode title compat]
  8. The @schememodname[mzlib/compat] library defines a number of
  9. procedures and syntactic forms that are commonly provided by other
  10. Scheme implementations. Most of the procedures are aliases for
  11. @schememodname[mzscheme] procedures.
  12. @deftogether[(
  13. @defproc[(=? [n number?] ...+) boolean?]
  14. @defproc[(<? [n real?] ...+) boolean?]
  15. @defproc[(>? [n real?] ...+) boolean?]
  16. @defproc[(<=? [n real?] ...+) boolean?]
  17. @defproc[(>=? [n real?] ...+) boolean?]
  18. )]{
  19. Same as @scheme[=], @scheme[<], etc.}
  20. @deftogether[(
  21. @defproc[(1+ [n number?]) number?]
  22. @defproc[(1- [n number?]) number?]
  23. )]{
  24. Same as @scheme[add1] and @scheme[sub1].}
  25. @defproc[(gentmp [base (or/c string? symbol?) "g"]) symbol?]{
  26. Same as @scheme[gensym].}
  27. @defproc[(flush-output-port [o output-port? (current-output-port)]) void?]{
  28. Same as @scheme[flush-output].}
  29. @defproc[(real-time) exact-integer?]{
  30. Same as @scheme[current-milliseconds].}
  31. @defproc[(atom? [v any/c]) any]{
  32. Same as @scheme[(not (pair? v))] (which does not actually imply an
  33. atomic value).}
  34. @defform*[[(define-structure (name-id field-id ...))
  35. (define-structure (name-id field-id ...)
  36. ((init-field-id init-expr) ...))]]{
  37. Like @scheme[define-struct], except that the @scheme[name-id] is moved
  38. inside the parenthesis for fields. In addition,
  39. @scheme[init-field-id]s can be specified with automatic initial-value
  40. expression.
  41. The @scheme[init-field-id]s do not have corresponding arguments for
  42. the @schemeidfont{make-}@scheme[name-id] constructor. Instead, each
  43. @scheme[init-field-id]'s @scheme[init-expr] is evaluated to obtain the
  44. field's value when the constructor is called. The @scheme[field-id]s
  45. are bound in @scheme[init-expr]s, but not other
  46. @scheme[init-field-id]s.
  47. @examples[
  48. #:eval compat-eval
  49. (define-structure (add left right) ([sum (+ left right)]))
  50. (add-sum (make-add 3 6))
  51. ]}
  52. @deftogether[(
  53. @defproc[(getprop [sym symbol?][property symbol?][default any/c #f]) any/c]
  54. @defproc[(putprop [sym symbol?][property symbol?][value any/c]) void?]
  55. )]{
  56. The @scheme[getprop] function gets a property value associated with
  57. @scheme[sym]. The @scheme[property] argument names the property to be
  58. found. If the property is not found, @scheme[default] is returned.
  59. The properties obtained with @scheme[getprop] are the ones installed
  60. with @scheme[putprop].}
  61. @defproc[(new-cafe [eval-handler (any/c . -> . any) #f]) any]{
  62. Emulates Chez Scheme's @scheme[new-cafe] by installing
  63. @scheme[eval-handler] into the @scheme[current-eval] parameter while
  64. running @scheme[read-eval-print]. In addition, @scheme[current-exit]
  65. is set to escape from the call to @scheme[new-cafe].}