Clarifying function contracts for s/s/d callers

This commit is contained in:
Jay McCarthy 2011-06-21 13:31:47 -06:00
parent 73f6a2b392
commit 39aea2e6c1
15 changed files with 48 additions and 48 deletions

View File

@ -393,7 +393,7 @@ web-server/insta
(define (start request)
(show-counter 0 request))
@code:comment{show-counter: number request -> doesn't}
@code:comment{show-counter: number request -> doesn't return}
@code:comment{Displays a number that's hyperlinked: when the link is pressed,}
@code:comment{returns a new page with the incremented number.}
(define (show-counter n request)
@ -1205,7 +1205,7 @@ And @racket[(formlet-process new-post-formlet _request)] where @racket[_request]
We can use @racket[new-post-formlet] in @racket[render-blog-page] as follows:
@racketblock[
@code:comment{render-blog-page: blog request -> doesn't}
@code:comment{render-blog-page: blog request -> doesn't return}
@code:comment{Sends an HTML page of the content of the}
@code:comment{blog.}
(define (render-blog-page a-blog request)

View File

@ -2,7 +2,7 @@
(require "dummy-3.rkt")
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays
;; all of the web content.
(define (start request)
@ -12,7 +12,7 @@
"the-blog-data.sqlite"))
request))
;; render-blog-page: blog request -> doesn't
;; render-blog-page: blog request -> doesn't return
;; Produces an HTML page of the content of the
;; blog.
(define (render-blog-page a-blog request)
@ -38,7 +38,7 @@
(send/suspend/dispatch response-generator)))
;; render-post-detail-page: post request -> doesn't
;; render-post-detail-page: post request -> doesn't return
;; Consumes a post and produces a detail page of the post.
;; The user will be able to either insert new comments
;; or go back to render-blog-page.
@ -75,7 +75,7 @@
(send/suspend/dispatch response-generator)))
;; render-confirm-add-comment-page :
;; blog comment post request -> doesn't
;; blog comment post request -> doesn't return
;; Consumes a comment that we intend to add to a post, as well
;; as the request. If the user follows through, adds a comment
;; and goes back to the display page. Otherwise, goes back to

View File

@ -2,7 +2,7 @@
(require "model-3.rkt")
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays
;; all of the web content.
(define (start request)
@ -12,7 +12,7 @@
"the-blog-data.sqlite"))
request))
;; render-blog-page: blog request -> doesn't
;; render-blog-page: blog request -> doesn't return
;; Produces an HTML page of the content of the
;; blog.
(define (render-blog-page a-blog request)
@ -38,7 +38,7 @@
(send/suspend/dispatch response-generator)))
;; render-post-detail-page: post request -> doesn't
;; render-post-detail-page: post request -> doesn't return
;; Consumes a post and produces a detail page of the post.
;; The user will be able to either insert new comments
;; or go back to render-blog-page.
@ -75,7 +75,7 @@
(send/suspend/dispatch response-generator)))
;; render-confirm-add-comment-page :
;; blog comment post request -> doesn't
;; blog comment post request -> doesn't return
;; Consumes a comment that we intend to add to a post, as well
;; as the request. If the user follows through, adds a comment
;; and goes back to the display page. Otherwise, goes back to

View File

@ -3,7 +3,7 @@
(require web-server/formlets
"model-3.rkt")
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays
;; all of the web content.
(define (start request)
@ -21,7 +21,7 @@
,{input-string . => . body})
(values title body)))
;; render-blog-page: blog request -> doesn't
;; render-blog-page: blog request -> doesn't return
;; Produces an HTML page of the content of the
;; blog.
(define (render-blog-page a-blog request)
@ -49,7 +49,7 @@
(define new-comment-formlet
input-string)
;; render-post-detail-page: post request -> doesn't
;; render-post-detail-page: post request -> doesn't return
;; Consumes a post and produces a detail page of the post.
;; The user will be able to either insert new comments
;; or go back to render-blog-page.
@ -83,7 +83,7 @@
(send/suspend/dispatch response-generator)))
;; render-confirm-add-comment-page :
;; blog comment post request -> doesn't
;; blog comment post request -> doesn't return
;; Consumes a comment that we intend to add to a post, as well
;; as the request. If the user follows through, adds a comment
;; and goes back to the display page. Otherwise, goes back to

View File

@ -10,7 +10,7 @@
(list (post "First Post" "This is my first post")
(post "Second Post" "This is another post")))
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays all of the
;; web content.
(define (start request)
@ -22,7 +22,7 @@
(post (extract-binding/single 'title bindings)
(extract-binding/single 'body bindings)))
;; render-blog-page: blog request -> doesn't
;; render-blog-page: blog request -> doesn't return
;; Consumes a blog and a request, and produces an HTML page
;; of the content of the blog.
(define (render-blog-page a-blog request)

View File

@ -21,7 +21,7 @@
(set-blog-posts! a-blog
(cons a-post (blog-posts a-blog))))
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays
;; all of the web content.
(define (start request)
@ -33,7 +33,7 @@
(post (extract-binding/single 'title bindings)
(extract-binding/single 'body bindings)))
;; render-blog-page: request -> doesn't
;; render-blog-page: request -> doesn't return
;; Produces an HTML page of the content of the BLOG.
(define (render-blog-page request)
(local [(define (response-generator make-url)

View File

@ -35,14 +35,14 @@
a-post
(append (post-comments a-post) (list a-comment))))
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request, and produces a page that displays
;; all of the web content.
(define (start request)
(render-blog-page request))
;; render-blog-page: request -> doesn't
;; Produces an doesn't page of the content of the
;; render-blog-page: request -> doesn't return
;; Produces an HTML page of the content of the
;; BLOG.
(define (render-blog-page request)
(local [(define (response-generator make-url)
@ -71,7 +71,7 @@
(send/suspend/dispatch response-generator)))
;; render-post-detail-page: post request -> doesn't
;; render-post-detail-page: post request -> doesn't return
;; Consumes a post and request, and produces a detail page
;; of the post. The user will be able to insert new comments.
(define (render-post-detail-page a-post request)

View File

@ -35,13 +35,13 @@
a-post
(append (post-comments a-post) (list a-comment))))
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays
;; all of the web content.
(define (start request)
(render-blog-page request))
;; render-blog-page: request -> doesn't
;; render-blog-page: request -> doesn't return
;; Produces an HTML page of the content of the
;; BLOG.
(define (render-blog-page request)
@ -71,7 +71,7 @@
(send/suspend/dispatch response-generator)))
;; render-post-detail-page: post request -> doesn't
;; render-post-detail-page: post request -> doesn't return
;; Consumes a post and produces a detail page of the post.
;; The user will be able to either insert new comments
;; or go back to render-blog-page.
@ -107,7 +107,7 @@
(send/suspend/dispatch response-generator)))
;; render-confirm-add-comment-page :
;; comment post request -> doesn't
;; comment post request -> doesn't return
;; Consumes a comment that we intend to add to a post, as well
;; as the request. If the user follows through, adds a comment
;; and goes back to the display page. Otherwise, goes back to

View File

@ -35,14 +35,14 @@
a-post
(append (post-comments a-post) (list a-comment))))
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays
;; all of the web content.
(define (start request)
(render-blog-page request))
;; render-blog-page: request -> doesn't
;; Produces an doesn't page of the content of the
;; render-blog-page: request -> doesn't return
;; Produces an HTML page of the content of the
;; BLOG.
(define (render-blog-page request)
(local [(define (response-generator make-url)
@ -71,7 +71,7 @@
(send/suspend/dispatch response-generator)))
;; render-post-detail-page: post request -> doesn't
;; render-post-detail-page: post request -> doesn't return
;; Consumes a post and produces a detail page of the post.
;; The user will be able to either insert new comments
;; or go back to render-blog-page.
@ -107,7 +107,7 @@
(send/suspend/dispatch response-generator)))
;; render-confirm-add-comment-page :
;; comment post request -> doesn't
;; comment post request -> doesn't return
;; Consumes a comment that we intend to add to a post, as well
;; as the request. If the user follows through, adds a comment
;; and goes back to the display page. Otherwise, goes back to

View File

@ -2,13 +2,13 @@
(require "model.rkt")
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays
;; all of the web content.
(define (start request)
(render-blog-page request))
;; render-blog-page: request -> doesn't
;; render-blog-page: request -> doesn't return
;; Produces an HTML page of the content of the
;; BLOG.
(define (render-blog-page request)
@ -38,7 +38,7 @@
(send/suspend/dispatch response-generator)))
;; render-post-detail-page: post request -> doesn't
;; render-post-detail-page: post request -> doesn't return
;; Consumes a post and produces a detail page of the post.
;; The user will be able to either insert new comments
;; or go back to render-blog-page.
@ -74,7 +74,7 @@
(send/suspend/dispatch response-generator)))
;; render-confirm-add-comment-page :
;; comment post request -> doesn't
;; comment post request -> doesn't return
;; Consumes a comment that we intend to add to a post, as well
;; as the request. If the user follows through, adds a comment
;; and goes back to the display page. Otherwise, goes back to

View File

@ -2,7 +2,7 @@
(require "model-2.rkt")
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays
;; all of the web content.
(define (start request)
@ -12,7 +12,7 @@
"the-blog-data.db"))
request))
;; render-blog-page: blog request -> doesn't
;; render-blog-page: blog request -> doesn't return
;; Produces an HTML page of the content of the
;; blog.
(define (render-blog-page a-blog request)
@ -38,7 +38,7 @@
(send/suspend/dispatch response-generator)))
;; render-post-detail-page: post request -> doesn't
;; render-post-detail-page: post request -> doesn't return
;; Consumes a post and produces a detail page of the post.
;; The user will be able to either insert new comments
;; or go back to render-blog-page.
@ -75,7 +75,7 @@
(send/suspend/dispatch response-generator)))
;; render-confirm-add-comment-page :
;; blog comment post request -> doesn't
;; blog comment post request -> doesn't return
;; Consumes a comment that we intend to add to a post, as well
;; as the request. If the user follows through, adds a comment
;; and goes back to the display page. Otherwise, goes back to

View File

@ -2,7 +2,7 @@
(require "model-2.rkt")
;; start: request -> doesn't
;; start: request -> doesn't return
;; Consumes a request and produces a page that displays
;; all of the web content.
(define (start request)
@ -12,7 +12,7 @@
"the-blog-data.db"))
request))
;; render-blog-page: blog request -> doesn't
;; render-blog-page: blog request -> doesn't return
;; Sends an HTML page of the content of the
;; blog.
(define (render-blog-page a-blog request)
@ -38,7 +38,7 @@
(send/suspend/dispatch response-generator))
;; render-post-detail-page: post request -> doesn't
;; render-post-detail-page: post request -> doesn't return
;; Consumes a post and produces a detail page of the post.
;; The user will be able to either insert new comments
;; or go back to render-blog-page.
@ -75,7 +75,7 @@
(send/suspend/dispatch response-generator))
;; render-confirm-add-comment-page :
;; blog comment post request -> doesn't
;; blog comment post request -> doesn't return
;; Consumes a comment that we intend to add to a post, as well
;; as the request. If the user follows through, adds a comment
;; and goes back to the display page. Otherwise, goes back to

View File

@ -14,11 +14,11 @@
(define ROSTER (roster '("kathi" "shriram" "dan")))
;; start: request -> doesn't
;; start: request -> doesn't return
(define (start request)
(show-roster request))
;; show-roster: request -> doesn't
;; show-roster: request -> doesn't return
(define (show-roster request)
(local [(define (response-generator make-url)
(response/xexpr

View File

@ -3,7 +3,7 @@
(define (start request)
(show-counter 0))
;; show-counter: number -> doesn't
;; show-counter: number -> doesn't return
(define (show-counter n)
(send/suspend/dispatch
(lambda (make-url)

View File

@ -14,11 +14,11 @@
(define ROSTER (roster '("kathi" "shriram" "dan")))
;; start: request -> doesn't
;; start: request -> doesn't return
(define (start request)
(show-roster request))
;; show-roster: request -> doesn't
;; show-roster: request -> doesn't return
(define (show-roster request)
(local [(define (response-generator make-url)
(response/xexpr