From 6eeb209c2b68678aa9cd7be1dc7a7cb750ce1a35 Mon Sep 17 00:00:00 2001 From: mitty Date: Tue, 19 Oct 2010 13:11:51 +0000 Subject: [PATCH] * BNF for "Advanced Student" of DrRacket * from http://docs.racket-lang.org/htdp-langs/advanced.html with Firefox 3.6.10 git-svn-id: https://lab.mitty.jp/svn/lab/vendor@70 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- DrRacket/advanced.html | 13 + DrRacket/advanced_files/racket.css | 188 ++++++++++++ DrRacket/advanced_files/scribble-common.js | 153 ++++++++++ DrRacket/advanced_files/scribble.css | 429 ++++++++++++++++++++++++++++ 4 files changed, 783 insertions(+) create mode 100644 DrRacket/advanced.html create mode 100644 DrRacket/advanced_files/racket.css create mode 100644 DrRacket/advanced_files/scribble-common.js create mode 100644 DrRacket/advanced_files/scribble.css diff --git a/DrRacket/advanced.html b/DrRacket/advanced.html new file mode 100644 index 0000000..6de6341 --- /dev/null +++ b/DrRacket/advanced.html @@ -0,0 +1,13 @@ + + +5 Advanced Student

5 Advanced Student

  program = def-or-expr ...
     
  def-or-expr = definition
  | expr
  | test-case
  | library-require
     
  definition = (define (id id id ...) expr)
  | (define id expr)
  | (define-struct id (id ...))
     
  expr = (begin expr expr ...)
  | (begin0 expr expr ...)
  | (set! id expr)
  | (delay expr)
  | (lambda (id ...) expr)
  | (λ (id ...) expr)
  | (local [definition ...] expr)
  | (letrec ([id expr] ...) expr)
  | (shared ([id expr] ...) expr)
  | (let ([id expr] ...) expr)
  | (let id ([id expr] ...) expr)
  | (let* ([id expr] ...) expr)
  | (recur id ([id expr] ...) expr)
  | (expr expr ...) ; function call
  | (cond [expr expr] ... [expr expr])
  | (cond [expr expr] ... [else expr])
  | 
(case expr [(choice choice ...) expr] ...
           [(choice choice ...) expr])
  | 
(case expr [(choice choice ...) expr] ...
           [else expr])
  | (if expr expr expr)
  | (when expr expr)
  | (unless expr expr)
  | (and expr expr expr ...)
  | (or expr expr expr ...)
  | (time expr)
  | empty
  | id ; identifier
  | prim-op ; primitive operation
  | â€™quoted ; quoted value
  | `quasiquoted ; quasiquote
  | number
  | true
  | false
  | string
  | character
     
  choice = id ; treated as a symbol
  | number
     
  quoted = id
  | number
  | string
  | character
  | (quoted ...)
  | â€™quoted
  | `quoted
  | ,quoted
  | ,@quoted
     
  quasiquoted = id
  | number
  | string
  | character
  | (quasiquoted ...)
  | â€™quasiquoted
  | `quasiquoted
  | ,expr
  | ,@expr
     
  test-case = (check-expect expr expr)
  | (check-within expr expr expr)
  | (check-member-of expr expr ...)
  | (check-range expr expr expr)
  | (check-error expr expr)
     
  library-require = (require string)
  | (require (lib string string ...))
  | (require (planet string package))
     
  package = (string string number number)

An id is a sequence of characters not including a +space or one of the following:
   " , ' ` +( ) [ ] +{ } | ; +#
A number is a number such as 123, 3/2, or +5.5.
A string is enclosed by a pair of ". Unlike +symbols, strings may be split into characters and manipulated by a +variety of primitive functions. For example, "abcdef", +"This is a string", and "This is a string with \" inside" are all strings.
A character begins with #\ and has the +name of the character. For example, #\a, #\b, +and #\space are characters.

A prim-op is one of:

 Numbers: Integers, Rationals, Reals, Complex, Exacts, Inexacts

  < :  (real real real ... -> boolean)

  <= :  (real real real ... -> boolean)

  = :  (number number number ... -> boolean)

  > :  (real real real ... -> boolean)

  >= :  (real real ... -> boolean)

  abs :  (real -> real)

  acos :  (number -> number)

  add1 :  (number -> number)

  angle :  (number -> real)

  asin :  (number -> number)

  atan :  (number -> number)

  ceiling :  (real -> integer)

  complex? :  (any -> boolean)

  conjugate :  (number -> number)

  cos :  (number -> number)

  cosh :  (number -> number)

  current-seconds :  (-> integer)

  denominator :  (rat -> integer)

  e :  real

  even? :  (integer -> boolean)

  exact->inexact :  (number -> number)

  exact? :  (number -> boolean)

  exp :  (number -> number)

  expt :  (number number -> number)

  floor :  (real -> integer)

  gcd :  (integer integer ... -> integer)

  imag-part :  (number -> real)

  inexact->exact :  (number -> number)

  inexact? :  (number -> boolean)

  integer->char :  (integer -> char)

  integer-sqrt :  (number -> integer)

  integer? :  (any -> boolean)

  lcm :  (integer integer ... -> integer)

  log :  (number -> number)

  magnitude :  (number -> real)

  make-polar :  (real real -> number)

  make-rectangular :  (real real -> number)

  max :  (real real ... -> real)

  min :  (real real ... -> real)

  modulo :  (integer integer -> integer)

  negative? :  (number -> boolean)

  number->string :  (number -> string)

  number? :  (any -> boolean)

  numerator :  (rat -> integer)

  odd? :  (integer -> boolean)

  pi :  real

  positive? :  (number -> boolean)

  quotient :  (integer integer -> integer)

  random : 

(case->
 (integer -> integer)
 (-> (and/c real inexact? (>/c 0) (</c 1))))

  rational? :  (any -> boolean)

  real-part :  (number -> real)

  real? :  (any -> boolean)

  remainder :  (integer integer -> integer)

  round :  (real -> integer)

  sgn :  (real -> (union 1 1.0 0 0.0 -1 -1.0))

  sin :  (number -> number)

  sinh :  (number -> number)

  sqr :  (number -> number)

  sqrt :  (number -> number)

  sub1 :  (number -> number)

  tan :  (number -> number)

  zero? :  (number -> boolean)

 Booleans

  boolean=? :  (boolean boolean -> boolean)

  boolean? :  (any -> boolean)

  false? :  (any -> boolean)

  not :  (boolean -> boolean)

 Symbols

  symbol->string :  (symbol -> string)

  symbol=? :  (symbol symbol -> boolean)

  symbol? :  (any -> boolean)

 Lists

  append :  ((listof any) ... -> (listof any))

  assoc :  (any (listof any) -> (listof any) or false)

  assq : 

(X
 (listof (cons X Y))
 ->
 (union false (cons X Y)))

  caaar : 

((cons
  (cons (cons W (listof Z)) (listof Y))
  (listof X))
 ->
 W)

  caadr : 

((cons
  (cons (cons W (listof Z)) (listof Y))
  (listof X))
 ->
 (listof Z))

  caar :  ((cons (cons Z (listof Y)) (listof X)) -> Z)

  cadar : 

((cons (cons W (cons Z (listof Y))) (listof X))
 ->
 Z)

  cadddr :  ((listof Y) -> Y)

  caddr :  ((cons W (cons Z (cons Y (listof X)))) -> Y)

  cadr :  ((cons Z (cons Y (listof X))) -> Y)

  car :  ((cons Y (listof X)) -> Y)

  cdaar : 

((cons
  (cons (cons W (listof Z)) (listof Y))
  (listof X))
 ->
 (listof Z))

  cdadr : 

((cons W (cons (cons Z (listof Y)) (listof X)))
 ->
 (listof Y))

  cdar : 

((cons (cons Z (listof Y)) (listof X))
 ->
 (listof Y))

  cddar : 

((cons (cons W (cons Z (listof Y))) (listof X))
 ->
 (listof Y))

  cdddr : 

((cons W (cons Z (cons Y (listof X))))
 ->
 (listof X))

  cddr :  ((cons Z (cons Y (listof X))) -> (listof X))

  cdr :  ((cons Y (listof X)) -> (listof X))

  cons :  (X (listof X) -> (listof X))

  cons? :  (any -> boolean)

  eighth :  ((listof Y) -> Y)

  empty? :  (any -> boolean)

  fifth :  ((listof Y) -> Y)

  first :  ((cons Y (listof X)) -> Y)

  fourth :  ((listof Y) -> Y)

  length :  ((listof any) -> number)

  list :  (any ... -> (listof any))

  list* :  (any ... (listof any) -> (listof any))

  list-ref :  ((listof X) natural-number -> X)

  list? :  (any -> boolean)

  make-list :  (natural-number any -> (listof any))

  member :  (any (listof any) -> boolean)

  member? :  (any (listof any) -> boolean)

  memq :  (any (listof any) -> (union false list))

  memv :  (any (listof any) -> (union false list))

  null :  empty

  null? :  (any -> boolean)

  pair? :  (any -> boolean)

  remove :  (any (listof any) -> (listof any))

  rest :  ((cons Y (listof X)) -> (listof X))

  reverse :  ((listof any) -> list)

  second :  ((cons Z (cons Y (listof X))) -> Y)

  seventh :  ((listof Y) -> Y)

  sixth :  ((listof Y) -> Y)

  third :  ((cons W (cons Z (cons Y (listof X)))) -> Y)

 Posns

  make-posn :  (number number -> posn)

  posn :  signature

  posn-x :  (posn -> number)

  posn-y :  (posn -> number)

  posn? :  (anything -> boolean)

  set-posn-x! :  (posn number -> void)

  set-posn-y! :  (posn number -> void)

 Characters

  char->integer :  (char -> integer)

  char-alphabetic? :  (char -> boolean)

  char-ci<=? :  (char char char ... -> boolean)

  char-ci<? :  (char char char ... -> boolean)

  char-ci=? :  (char char char ... -> boolean)

  char-ci>=? :  (char char char ... -> boolean)

  char-ci>? :  (char char char ... -> boolean)

  char-downcase :  (char -> char)

  char-lower-case? :  (char -> boolean)

  char-numeric? :  (char -> boolean)

  char-upcase :  (char -> char)

  char-upper-case? :  (char -> boolean)

  char-whitespace? :  (char -> boolean)

  char<=? :  (char char char ... -> boolean)

  char<? :  (char char char ... -> boolean)

  char=? :  (char char char ... -> boolean)

  char>=? :  (char char char ... -> boolean)

  char>? :  (char char char ... -> boolean)

  char? :  (any -> boolean)

 Strings

  explode :  (string -> (listof string))

  format :  (string any ... -> string)

  implode :  ((listof string) -> string)

  int->string :  (integer -> string)

  list->string :  ((listof char) -> string)

  make-string :  (nat char -> string)

  replicate :  (nat string -> string)

  string :  (char ... -> string)

  string->int :  (string -> integer)

  string->list :  (string -> (listof char))

  string->number :  (string -> (union number false))

  string->symbol :  (string -> symbol)

  string-alphabetic? :  (string -> boolean)

  string-append :  (string ... -> string)

  string-ci<=? :  (string string string ... -> boolean)

  string-ci<? :  (string string string ... -> boolean)

  string-ci=? :  (string string string ... -> boolean)

  string-ci>=? :  (string string string ... -> boolean)

  string-ci>? :  (string string string ... -> boolean)

  string-copy :  (string -> string)

  string-ith :  (string nat -> string)

  string-length :  (string -> nat)

  string-lower-case? :  (string -> boolean)

  string-numeric? :  (string -> boolean)

  string-ref :  (string nat -> char)

  string-upper-case? :  (string -> boolean)

  string-whitespace? :  (string -> boolean)

  string<=? :  (string string string ... -> boolean)

  string<? :  (string string string ... -> boolean)

  string=? :  (string string string ... -> boolean)

  string>=? :  (string string string ... -> boolean)

  string>? :  (string string string ... -> boolean)

  string? :  (any -> boolean)

  substring :  (string nat nat -> string)

 Images

  image=? :  (image image -> boolean)

  image? :  (any -> boolean)

 Misc

  =~ :  (real real non-negative-real -> boolean)

  current-milliseconds :  (-> exact-integer)

  eof :  eof

  eof-object? :  (any -> boolean)

  eq? :  (any any -> boolean)

  equal? :  (any any -> boolean)

  equal~? :  (any any non-negative-real -> boolean)

  eqv? :  (any any -> boolean)

  error :  (any ... -> void)

  exit :  (-> void)

  force :  (delay -> any)

  gensym :  (-> symbol?)

  identity :  (any -> any)

  promise? :  (any -> boolean)

  sleep :  (-> positive-number void)

  struct? :  (any -> boolean)

  void :  (-> void)

  void? :  (any -> boolean)

 Numbers (relaxed conditions)

  * :  (number ... -> number)

  + :  (number ... -> number)

  - :  (number ... -> number)

  / :  (number ... -> number)

 Higher-Order Functions

  andmap :  ((X -> boolean) (listof X) -> boolean)

  apply : 

((X-1 ... X-N -> Y)
 X-1
 ...
 X-i
 (list X-i+1 ... X-N)
 ->
 Y)

  argmax :  ((X -> real) (listof X) -> X)

  argmin :  ((X -> real) (listof X) -> X)

  build-list :  (nat (nat -> X) -> (listof X))

  build-string :  (nat (nat -> char) -> string)

  compose : 

((Y-1 -> Z)
 ...
 (Y-N -> Y-N-1)
 (X-1 ... X-N -> Y-N)
 ->
 (X-1 ... X-N -> Z))

  filter :  ((X -> boolean) (listof X) -> (listof X))

  foldl :  ((X Y -> Y) Y (listof X) -> Y)

  foldr :  ((X Y -> Y) Y (listof X) -> Y)

  for-each :  ((any ... -> any) (listof any) ... -> void)

  map :  ((X ... -> Z) (listof X) ... -> (listof Z))

  memf : 

((X -> boolean)
 (listof X)
 ->
 (union false (listof X)))

  ormap :  ((X -> boolean) (listof X) -> boolean)

  procedure? :  (any -> boolean)

  quicksort :  ((listof X) (X X -> boolean) -> (listof X))

  sort :  ((listof X) (X X -> boolean) -> (listof X))

 Reading and Printing

  display :  (any -> void)

  newline :  (-> void)

  pretty-print :  (any -> void)

  print :  (any -> void)

  printf :  (string any ... -> void)

  read :  (-> sexp)

  with-input-from-file :  (string (-> any) -> any)

  with-input-from-string :  (string (-> any) -> any)

  with-output-to-file :  (string (-> any) -> any)

  with-output-to-string :  (string (-> any) -> any)

  write :  (any -> void)

 Vectors

  build-vector :  (nat (nat -> X) -> (vectorof X))

  make-vector :  (number X -> (vectorof X))

  vector :  (X ... -> (vector X ...))

  vector-length :  ((vector X) -> nat)

  vector-ref :  ((vector X) nat -> X)

  vector-set! :  ((vectorof X) nat X -> void)

  vector? :  (any -> boolean)

 Boxes

  box :  (any -> box)

  box? :  (any -> boolean)

  set-box! :  (box any -> void)

  unbox :  (box -> any)

 Hash Tables

  hash-copy :  (hash -> hash)

  hash-count :  (hash -> integer)

  hash-eq? :  (hash -> boolean)

  hash-equal? :  (hash -> boolean)

  hash-eqv? :  (hash -> boolean)

  hash-for-each :  ((hash X Y) (X Y -> any) -> void)

  hash-has-key? :  ((hash X Y) X -> boolean)

  hash-map :  ((hash X Y) (X Y -> A) -> (listof A))

  hash-ref : 

(case->
 ((hash X Y) X -> Y)
 ((hash X Y) X Y -> Y)
 ((hash X Y) X (-> Y) -> Y))

  hash-ref! : 

(case->
 ((hash X Y) X Y -> Y)
 ((hash X Y) X (-> Y) -> Y))

  hash-remove! :  ((hash X Y) X -> void)

  hash-set! :  ((hash X Y) X Y -> void)

  hash-update! : 

(case->
 ((hash X Y) X (Y -> Y) -> void)
 ((hash X Y) X (Y -> Y) Y -> void)
 ((hash X Y) X (Y -> Y) (-> Y) -> void))

  hash? :  (any -> boolean)

  make-hash :  ((listof (list X Y)) -> (hash X Y))

  make-hasheq :  ((listof (list X Y)) -> (hash X Y))

  make-hasheqv :  ((listof (list X Y)) -> (hash X Y))

 
\ No newline at end of file diff --git a/DrRacket/advanced_files/racket.css b/DrRacket/advanced_files/racket.css new file mode 100644 index 0000000..0644698 --- /dev/null +++ b/DrRacket/advanced_files/racket.css @@ -0,0 +1,188 @@ + +/* See the beginning of "scribble.css". */ + +/* Monospace: */ +.RktIn, .RktRdr, .RktPn, .RktMeta, +.RktMod, .RktKw, .RktVar, .RktSym, +.RktRes, .RktOut, .RktCmt, .RktVal { + font-family: monospace; +} + +/* Serif: */ +.inheritedlbl { + font-family: serif; +} + +/* ---------------------------------------- */ +/* Inherited methods, left margin */ + +.inherited { + width: 100%; + margin-top: 0.5em; + text-align: left; + background-color: #ECF5F5; +} + +.inherited td { + font-size: 82%; + padding-left: 1em; + text-indent: -0.8em; + padding-right: 0.2em; +} + +.inheritedlbl { + font-style: italic; +} + +/* ---------------------------------------- */ +/* Racket text styles */ + +.RktIn { + color: #cc6633; + background-color: #eeeeee; +} + +.RktInBG { + background-color: #eeeeee; +} + +.RktRdr { +} + +.RktPn { + color: #843c24; +} + +.RktMeta { + color: black; +} + +.RktMod { + color: black; +} + +.RktOpt { + color: black; +} + +.RktKw { + color: black; + font-weight: bold; +} + +.RktErr { + color: red; + font-style: italic; +} + +.RktVar { + color: #262680; + font-style: italic; +} + +.RktSym { + color: #262680; +} + +.RktValLink { + text-decoration: none; + color: blue; +} + +.RktModLink { + text-decoration: none; + color: blue; +} + +.RktStxLink { + text-decoration: none; + color: black; + font-weight: bold; +} + +.RktRes { + color: #0000af; +} + +.RktOut { + color: #960096; +} + +.RktCmt { + color: #c2741f; +} + +.RktVal { + color: #228b22; +} + +/* ---------------------------------------- */ +/* Some inline styles */ + +.together { + width: 100%; +} + +.prototype td { + vertical-align: text-top; +} +.longprototype td { + vertical-align: bottom; +} + +.RktBlk td { + vertical-align: baseline; +} + +.argcontract td { + vertical-align: text-top; +} + +.highlighted { + background-color: #ddddff; +} + +.defmodule { + width: 100%; + background-color: #F5F5DC; +} + +.specgrammar { + float: right; +} + +.RBibliography td { + vertical-align: text-top; +} + +.leftindent { + margin-left: 1em; + margin-right: 0em; +} + +.insetpara { + margin-left: 1em; + margin-right: 1em; +} + +.Rfilebox { + margin-left: 1em; + margin-right: 1em; +} + +.Rfiletitle { + text-align: right; + margin: 0em 0em 0em 0em; +} + +.Rfilename { + border-top: 1px solid #6C8585; + border-right: 1px solid #6C8585; + padding-left: 0.5em; + padding-right: 0.5em; + background-color: #ECF5F5; +} + +.Rfilecontent { + margin: 0em 0em 0em 0em; +} diff --git a/DrRacket/advanced_files/scribble-common.js b/DrRacket/advanced_files/scribble-common.js new file mode 100644 index 0000000..09c3390 --- /dev/null +++ b/DrRacket/advanced_files/scribble-common.js @@ -0,0 +1,153 @@ +// Common functionality for PLT documentation pages + +// Page Parameters ------------------------------------------------------------ + +var page_query_string = + (location.href.search(/\?([^#]+)(?:#|$)/) >= 0) && RegExp.$1; + +var page_args = + ((function(){ + if (!page_query_string) return []; + var args = page_query_string.split(/[&;]/); + for (var i=0; i= 0) args[i] = [a.substring(0,p), a.substring(p+1)]; + else args[i] = [a, false]; + } + return args; + })()); + +function GetPageArg(key, def) { + for (var i=0; i= 0 && cur.substring(0,eql) == key) + return unescape(cur.substring(eql+1)); + } + return def; +} + +function SetCookie(key, val) { + var d = new Date(); + d.setTime(d.getTime()+(365*24*60*60*1000)); + try { + document.cookie = + key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/"; + } catch (e) {} +} + +// note that this always stores a directory name, ending with a "/" +function SetPLTRoot(ver, relative) { + var root = location.protocol + "//" + location.host + + NormalizePath(location.pathname.replace(/[^\/]*$/, relative)); + SetCookie("PLT_Root."+ver, root); +} + +// adding index.html works because of the above +function GotoPLTRoot(ver, relative) { + var u = GetCookie("PLT_Root."+ver, null); + if (u == null) return true; // no cookie: use plain up link + // the relative path is optional, default goes to the toplevel start page + if (!relative) relative = "index.html"; + location = u + relative; + return false; +} + +// Utilities ------------------------------------------------------------------ + +normalize_rxs = [/\/\/+/g, /\/\.(\/|$)/, /\/[^\/]*\/\.\.(\/|$)/]; +function NormalizePath(path) { + var tmp, i; + for (i = 0; i < normalize_rxs.length; i++) + while ((tmp = path.replace(normalize_rxs[i], "/")) != path) path = tmp; + return path; +} + +// `noscript' is problematic in some browsers (always renders as a +// block), use this hack instead (does not always work!) +// document.write(""); + +// Interactions --------------------------------------------------------------- + +function DoSearchKey(event, field, ver, top_path) { + var val = field.value; + if (event && event.keyCode == 13) { + var u = GetCookie("PLT_Root."+ver, null); + if (u == null) u = top_path; // default: go to the top path + u += "search/index.html?q=" + escape(val); + if (page_query_string) u += "&" + page_query_string; + location = u; + return false; + } + return true; +} + +function TocviewToggle(glyph, id) { + var s = document.getElementById(id).style; + var expand = s.display == "none"; + s.display = expand ? "block" : "none"; + glyph.innerHTML = expand ? "▼" : "►"; +} + +// Page Init ------------------------------------------------------------------ + +// Note: could make a function that inspects and uses window.onload to chain to +// a previous one, but this file needs to be required first anyway, since it +// contains utilities for all other files. +var on_load_funcs = []; +function AddOnLoad(fun) { on_load_funcs.push(fun); } +window.onload = function() { + for (var i=0; i + .techinside doesn't work with IE, so use both (and IE doesn't + work with inherit in the second one, so use blue directly) */ +.techinside { color: black; } +.techinside:hover { color: blue; } +.techoutside:hover>.techinside { color: inherit; } + +.SCentered { + text-align: center; +} + +.imageleft { + float: left; + margin-right: 0.3em; +} + +.Smaller{ + font-size: 82%; +} + +.Larger{ + font-size: 122%; +} + +/* A hack, inserted to break some Scheme ids: */ +.mywbr { + width: 0; + font-size: 1px; +} + +.compact li p { + margin: 0em; + padding: 0em; +} + +.noborder img { + border: 0; +} + +.SAuthorListBox { + position: relative; + float: right; + left: 2em; + top: -2.5em; + height: 0em; + width: 13em; + margin: 0em -13em 0em 0em; +} +.SAuthorList { + font-size: 82%; +} +.SAuthorList:before { + content: "by "; +} +.author { + display: inline; + white-space: nowrap; +} -- 1.7.9.5