Skip to content

Commit

Permalink
added history to modified handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
mfelleisen committed Sep 28, 2014
1 parent 2ea8dc0 commit 6f3335e
Showing 1 changed file with 46 additions and 8 deletions.
54 changes: 46 additions & 8 deletions pkgs/htdp-pkgs/htdp-doc/teachpack/2htdp/scribblings/universe.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -1207,8 +1207,14 @@ The mandatory clauses of a @racket[universe] server description are
universe. The event handler is called with the current state and the
joining iworld, which isn't on the list yet. In particular, the handler may
reject a @tech{world} program from participating in a @tech{universe},
by simply returning the given state or by immediately including the new world in the third field of the resulting @racket[bundle] structure.}
}
by simply returning the given state or by immediately including the new world in the third field of the resulting @racket[bundle] structure.

@history[
#:changed
"1.1"
"allow universe handlers to return a plain universe state"]

}}

@item{
@defform[(on-msg msg-expr)
Expand All @@ -1217,7 +1223,14 @@ The mandatory clauses of a @racket[universe] server description are
tells DrRacket to apply @racket[msg-expr] to the current state of the
universe, the world
@racket[w] that sent the message, and the message itself.
}

@history[
#:changed
"1.1"
"allow universe handlers to return a plain universe state"]

}

}]
All proper event handlers produce a state of the universe or a
@emph{bundle}. The state of the universe is safe-guarded by the server until the next event, and the mails
Expand All @@ -1243,15 +1256,29 @@ optional handlers:
(on-tick tick-expr)
#:contracts
([tick-expr (-> (unsyntax @tech{UniverseState}) (or/c (unsyntax @tech{UniverseState}) bundle?))])]{
tells DrRacket to apply @racket[tick-expr] to the current state of the universe.}
tells DrRacket to apply @racket[tick-expr] to the current state of the
universe.

@history[
#:changed
"1.1"
"allow universe handlers to return a plain universe state"]
}

@defform/none[#:literals (on-tick)
(on-tick tick-expr rate-expr)
#:contracts
([tick-expr (-> (unsyntax @tech{UniverseState}) (or/c (unsyntax @tech{UniverseState}) bundle?))]
[rate-expr (and/c real? positive?)])]{
tells DrRacket to apply @racket[tick-expr] as above; the clock ticks
every @racket[rate-expr] seconds.}
every @racket[rate-expr] seconds.

@history[
#:changed
"1.1"
"allow universe handlers to return a plain universe state"]

}

@defform/none[#:literals (on-tick)
(on-tick tick-expr rate-expr)
Expand All @@ -1261,9 +1288,14 @@ optional handlers:
[limit-expr (and/c integer? positive?)])]{
tells DrRacket to apply @racket[tick-expr] as above; the clock ticks
every @racket[rate-expr] seconds. The universe stops when the clock has
ticked more than @scheme[limit-expr] times.}
}
ticked more than @scheme[limit-expr] times.

@history[
#:changed
"1.1"
"allow universe handlers to return a plain universe state"]
}
}

@item{
@defform[#:literals (on-disconnect)
Expand All @@ -1275,7 +1307,13 @@ optional handlers:
is the current state of the universe server, while the second argument is
the (representation of the) world that got disconnected. The resulting
bundle usually includes this second argument in the third field, telling
DrRacket not to wait for messages from this world anymore.}
DrRacket not to wait for messages from this world anymore.

@history[
#:changed
"1.1"
"allow universe handlers to return a plain universe state"]
}
}

@item{
Expand Down

0 comments on commit 6f3335e

Please sign in to comment.