www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 40556076097a869a13ca70690cbece82f8ff02c9
parent ef2de270fd03cc7ce7a91990055fa7642b7af72c
Author: Georges Dupéron <georges.duperon@gmail.com>
Date:   Thu, 22 Jun 2017 12:45:33 +0200

Accidentally had an unnecessary WXME file.

Diffstat:
Mscribblings/tr.scrbl | 7908++++++-------------------------------------------------------------------------
1 file changed, 604 insertions(+), 7304 deletions(-)

diff --git a/scribblings/tr.scrbl b/scribblings/tr.scrbl @@ -1,7306 +1,605 @@ -#reader(lib"read.ss""wxme")WXME0108 ## -#| - This file uses the GRacket editor format. - Open this file in DrRacket version 6.9.0.4 or later to read it. +#lang scribble/manual - Most likely, it was created by saving a program in DrRacket, - and it probably contains a program with non-text elements - (such as images or comment boxes). +@require["util.rkt" + (for-label (only-meta-in 0 typed/racket)) + scribble/example + racket/string] +@(use-mathjax) - http://racket-lang.org/ -|# - 25 7 #"wxtext\0" -3 1 6 #"wxtab\0" -1 1 8 #"wximage\0" -2 0 8 #"wxmedia\0" -4 1 34 #"(lib \"syntax-browser.ss\" \"mrlib\")\0" -1 0 36 #"(lib \"cache-image-snip.ss\" \"mrlib\")\0" -1 0 68 -( - #"((lib \"image-core.ss\" \"mrlib\") (lib \"image-core-wxme.rkt\" \"mr" - #"lib\"))\0" -) 1 0 16 #"drscheme:number\0" -3 0 44 #"(lib \"number-snip.ss\" \"drscheme\" \"private\")\0" -1 0 36 #"(lib \"comment-snip.ss\" \"framework\")\0" -1 0 93 -( - #"((lib \"collapsed-snipclass.ss\" \"framework\") (lib \"collapsed-sni" - #"pclass-wxme.ss\" \"framework\"))\0" -) 0 0 43 #"(lib \"collapsed-snipclass.ss\" \"framework\")\0" -0 0 19 #"drscheme:sexp-snip\0" -0 0 29 #"drscheme:bindings-snipclass%\0" -1 0 101 -( - #"((lib \"ellipsis-snip.rkt\" \"drracket\" \"private\") (lib \"ellipsi" - #"s-snip-wxme.rkt\" \"drracket\" \"private\"))\0" -) 2 0 88 -( - #"((lib \"pict-snip.rkt\" \"drracket\" \"private\") (lib \"pict-snip.r" - #"kt\" \"drracket\" \"private\"))\0" -) 0 0 55 -#"((lib \"snip.rkt\" \"pict\") (lib \"snip-wxme.rkt\" \"pict\"))\0" -1 0 34 #"(lib \"bullet-snip.rkt\" \"browser\")\0" -0 0 25 #"(lib \"matrix.ss\" \"htdp\")\0" -1 0 22 #"drscheme:lambda-snip%\0" -1 0 29 #"drclickable-string-snipclass\0" -0 0 26 #"drracket:spacer-snipclass\0" -0 0 57 -#"(lib \"hrule-snip.rkt\" \"macro-debugger\" \"syntax-browser\")\0" -1 0 18 #"java-comment-box%\0" -1 0 23 #"java-interactions-box%\0" -1 0 1 6 #"wxloc\0" - 0 0 70 0 1 #"\0" -0 75 1 #"\0" -0 12 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 0 9 -#"Standard\0" -0 75 10 #"Monospace\0" -0 13 90 -1 90 -1 3 -1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 255 255 255 1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 -1 -1 2 24 -#"framework:default-color\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 15 -#"text:ports out\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 150 0 150 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1.0 0 -1 -1 93 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 255 0 0 0 0 0 -1 --1 2 15 #"text:ports err\0" -0 -1 1 #"\0" -1 0 -1 -1 93 -1 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 17 -#"text:ports value\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 175 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 --1 2 27 #"Matching Parenthesis Style\0" -0 -1 1 #"\0" -1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 34 139 34 0 0 0 -1 --1 2 1 #"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 37 -#"framework:syntax-color:scheme:symbol\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 38 -#"framework:syntax-color:scheme:keyword\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 -38 #"framework:syntax-color:scheme:comment\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 37 -#"framework:syntax-color:scheme:string\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 35 -#"framework:syntax-color:scheme:text\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 39 -#"framework:syntax-color:scheme:constant\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 41 128 38 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 49 -#"framework:syntax-color:scheme:hash-colon-keyword\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 42 -#"framework:syntax-color:scheme:parenthesis\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 132 60 36 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 36 -#"framework:syntax-color:scheme:error\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 36 -#"framework:syntax-color:scheme:other\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 16 -#"Misspelled Text\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2 -38 #"drracket:check-syntax:lexically-bound\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 81 112 203 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 28 -#"drracket:check-syntax:set!d\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 37 -#"drracket:check-syntax:unused-require\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 36 -#"drracket:check-syntax:free-variable\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 31 -#"drracket:check-syntax:imported\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 68 0 203 0 0 0 -1 -1 2 47 -#"drracket:check-syntax:my-obligation-style-pref\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 178 34 34 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 50 -#"drracket:check-syntax:their-obligation-style-pref\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 116 0 0 0 0 -1 -1 2 48 -#"drracket:check-syntax:unk-obligation-style-pref\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2 -49 #"drracket:check-syntax:both-obligation-style-pref\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 139 142 28 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 -41 #"profj:syntax-colors:scheme:block-comment\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 35 -#"profj:syntax-colors:scheme:keyword\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 139 0 139 0 0 0 -1 -1 2 37 -#"profj:syntax-colors:scheme:prim-type\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 139 0 139 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 38 -#"profj:syntax-colors:scheme:identifier\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 38 38 128 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 34 139 34 0 0 0 -1 -1 2 34 -#"profj:syntax-colors:scheme:string\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 34 139 34 0 0 0 -1 -1 2 35 -#"profj:syntax-colors:scheme:literal\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 34 139 34 0 0 0 -1 -1 2 35 -#"profj:syntax-colors:scheme:comment\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 194 116 31 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 33 -#"profj:syntax-colors:scheme:error\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 255 0 0 0 0 0 -1 -1 2 35 -#"profj:syntax-colors:scheme:default\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 37 -#"profj:syntax-colors:scheme:uncovered\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 35 -#"profj:syntax-colors:scheme:covered\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 139 0 139 0 0 0 -1 -1 2 37 -#"plt:module-language:test-coverage-on\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -1 -1 2 1 -#"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 1 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 2 38 -#"plt:module-language:test-coverage-off\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 93 -1 -1 0 1 0 0 0 1 0 0 0 0 0 0 255 165 0 0 0 0 -1 -1 4 1 -#"\0" -0 71 1 #"\0" -1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 1.0 1.0 1.0 1.0 1.0 1.0 0 0 0 0 0 0 --1 -1 4 1 #"\0" -0 -1 1 #"\0" -1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1 --1 4 1 #"\0" -0 71 1 #"\0" -1.0 0 -1 -1 -1 -1 -1 -1 1 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 0 255 0 0 0 -1 --1 4 1 #"\0" -0 71 1 #"\0" -1.0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1.0 1.0 1.0 0 100 0 0 0 0 -1 --1 2 1 #"\0" -0 -1 1 #"\0" -1 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 1 1 1 200 0 0 0 0 0 -1 -1 4 1 -#"\0" -0 -1 1 #"\0" -1.0 0 92 -1 -1 -1 -1 -1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 255 255 0 -1 -1 - 0 6971 0 28 3 21 #"#lang scribble/manual" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 1 #"@" -0 0 15 3 7 #"require" -0 0 24 3 1 #"[" -0 0 19 3 10 #"\"util.rkt\"" -0 0 24 29 1 #"\n" -0 0 24 3 10 #" (" -0 0 14 3 9 #"for-label" -0 0 24 3 2 #" (" -0 0 14 3 12 #"only-meta-in" -0 0 24 3 1 #" " -0 0 21 3 1 #"0" -0 0 24 3 1 #" " -0 0 14 3 12 #"typed/racket" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 9 #" " -0 0 14 3 16 #"scribble/example" -0 0 24 29 1 #"\n" -0 0 24 3 9 #" " -0 0 14 3 13 #"racket/string" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #"@(" -0 0 14 3 11 #"use-mathjax" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #"@(" -0 0 15 3 6 #"define" -0 0 24 3 1 #" " -0 0 14 3 7 #"tr-eval" -0 0 24 3 2 #" (" -0 0 14 3 17 #"make-eval-factory" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 12 #"typed/racket" -0 0 24 3 3 #")))" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 1 #"@" -0 0 14 3 5 #"title" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:style" -0 0 24 3 2 #" (" -0 0 14 3 10 #"with-html5" -0 0 24 3 1 #" " -0 0 14 3 16 #"manual-doc-style" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 7 #" " -0 0 23 3 9 #"#:version" -0 0 24 3 2 #" (" -0 0 14 3 12 #"version-text" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 7 #" " -0 0 23 3 5 #"#:tag" -0 0 24 3 1 #" " -0 0 19 3 9 #"\"tr-chap\"" -0 0 24 3 4 #"]{@|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 2 #"|}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 20 3 2 #"We" -0 0 20 3 1 #" " -0 0 20 3 5 #"start" -0 0 20 3 1 #" " -0 0 20 3 4 #"this" -0 0 20 3 1 #" " -0 0 20 3 7 #"section" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 1 #" " -0 0 20 3 4 #"some" -0 0 20 3 1 #" " -0 0 20 3 8 #"history:" -0 0 20 3 1 #" " -0 0 20 3 4 #"Lisp" -0 0 20 3 2 #", " -0 0 24 3 1 #"@" -0 0 14 3 4 #"emph" -0 0 24 3 1 #"{" -0 0 20 3 3 #"the" -0 0 24 3 1 #"}" -0 0 20 3 1 #" " -0 0 20 3 8 #"language" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 5 #" lots" -0 0 24 29 1 #"\n" -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 11 #"parentheses" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 7 #"shortly" -0 0 20 3 1 #" " -0 0 20 3 10 #"following " -0 0 29 3 7 #"Fortran" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 3 #"one" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"first" -0 0 20 3 11 #" high-level" -0 0 24 29 1 #"\n" -0 0 20 3 11 #"programming" -0 0 20 3 1 #" " -0 0 20 3 9 #"languages" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"was" -0 0 20 3 1 #" " -0 0 20 3 9 #"initially" -0 0 20 3 1 #" " -0 0 20 3 8 #"designed" -0 0 20 3 1 #" " -0 0 20 3 7 #"between" -0 0 20 3 1 #" " -0 0 20 3 4 #"1956" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 4 #"1958" -0 0 20 3 1 #"," -0 0 20 3 4 #" and" -0 0 24 29 1 #"\n" -0 0 20 3 12 #"subsequently" -0 0 20 3 12 #" implemented" -0 0 24 3 1 #"@" -0 0 14 3 5 #"~cite" -0 0 24 3 1 #"[" -0 0 19 3 21 #"\"McCarthyHistoryLisp\"" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 20 3 1 #" " -0 0 20 3 8 #"Dialects" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 5 #" Lisp" -0 0 24 29 1 #"\n" -0 0 20 3 9 #"generally" -0 0 20 3 1 #" " -0 0 20 3 7 #"support" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 7 #"variety" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 11 #"programming" -0 0 20 3 1 #" " -0 0 20 3 9 #"paradigms" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 9 #"including" -0 0 20 3 2 #" (" -0 0 20 3 3 #"but" -0 0 20 3 4 #" not" -0 0 24 29 1 #"\n" -0 0 20 3 7 #"limited" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 2 #") " -0 0 20 3 10 #"functional" -0 0 20 3 1 #" " -0 0 20 3 11 #"programming" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 15 #"object-oriented" -0 0 20 3 1 #" " -0 0 20 3 11 #"programming" -0 0 20 3 2 #" (" -0 0 20 3 4 #"e.g." -0 0 20 3 4 #" via" -0 0 24 29 1 #"\n" -0 0 29 3 4 #"CLOS" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 6 #"Common" -0 0 20 3 1 #" " -0 0 20 3 4 #"Lisp" -0 0 20 3 1 #" " -0 0 20 3 6 #"Object" -0 0 20 3 1 #" " -0 0 20 3 6 #"System" -0 0 20 3 1 #")" -0 0 20 3 1 #"." -0 0 20 3 1 #" " -0 0 20 3 3 #"One" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"most " -0 0 29 3 10 #"proeminent" -0 0 20 3 8 #" aspects" -0 0 24 29 1 #"\n" -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 4 #"Lisp" -0 0 20 3 1 #" " -0 0 20 3 3 #"is " -0 0 29 3 13 #"homoiconicity" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"fact" -0 0 20 3 1 #" " -0 0 20 3 4 #"that" -0 0 20 3 1 #" " -0 0 20 3 8 #"programs" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 4 #"data" -0 0 20 3 1 #" " -0 0 20 3 10 #"structures" -0 0 20 3 1 #" " -0 0 20 3 4 #"look" -0 0 20 3 4 #" the" -0 0 24 29 1 #"\n" -0 0 20 3 5 #"same." -0 0 20 3 1 #" " -0 0 20 3 4 #"This" -0 0 20 3 1 #" " -0 0 20 3 7 #"enables" -0 0 20 3 1 #" " -0 0 20 3 8 #"programs" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 6 #"easily" -0 0 20 3 1 #" " -0 0 20 3 10 #"manipulate" -0 0 20 3 1 #" " -0 0 20 3 5 #"other" -0 0 20 3 1 #" " -0 0 20 3 8 #"programs" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"led" -0 0 20 3 3 #" to" -0 0 24 29 1 #"\n" -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 9 #"extensive" -0 0 20 3 1 #" " -0 0 20 3 3 #"use" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 7 #"macros." -0 0 20 3 1 #" " -0 0 20 3 4 #"Uses" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 6 #"macros" -0 0 20 3 1 #" " -0 0 20 3 7 #"usually" -0 0 20 3 1 #" " -0 0 20 3 4 #"look" -0 0 20 3 1 #" " -0 0 20 3 4 #"like" -0 0 20 3 9 #" function" -0 0 24 29 1 #"\n" -0 0 20 3 12 #"applications" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"but" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 7 #"instead" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 8 #"invoking" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 6 #"target" -0 0 20 3 1 #" " -0 0 20 3 8 #"function" -0 0 20 3 1 #" " -0 0 20 3 2 #"at" -0 0 20 3 1 #" " -0 0 20 3 8 #"run-time" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 6 #" macro" -0 0 24 29 1 #"\n" -0 0 20 3 4 #"will" -0 0 20 3 1 #" " -0 0 20 3 7 #"perform" -0 0 20 3 1 #" " -0 0 20 3 4 #"some" -0 0 20 3 1 #" " -0 0 20 3 11 #"computation" -0 0 20 3 1 #" " -0 0 20 3 2 #"at" -0 0 20 3 1 #" " -0 0 20 3 12 #"compile-time" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 6 #"expand" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 4 #"some" -0 0 20 3 1 #" " -0 0 20 3 3 #"new" -0 0 20 3 1 #" " -0 0 20 3 5 #"code," -0 0 24 29 1 #"\n" -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 8 #"injected" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 11 #"replacement" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"macro" -0 0 20 3 1 #"'" -0 0 20 3 1 #"s" -0 0 20 3 5 #" use." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 20 3 3 #"The" -0 0 20 3 1 #" " -0 0 20 3 3 #"two" -0 0 20 3 1 #" " -0 0 20 3 4 #"main" -0 0 20 3 1 #" " -0 0 20 3 8 #"dialects" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 4 #"Lisp" -0 0 20 3 1 #" " -0 0 20 3 3 #"are" -0 0 20 3 1 #" " -0 0 20 3 6 #"Common" -0 0 20 3 1 #" " -0 0 20 3 4 #"Lisp" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 7 #"Scheme." -0 0 20 3 1 #" " -0 0 20 3 6 #"Scheme" -0 0 20 3 1 #" " -0 0 20 3 7 #"follows" -0 0 20 3 2 #" a" -0 0 24 29 1 #"\n" -0 0 20 3 10 #"minimalist" -0 0 20 3 1 #" " -0 0 20 3 10 #"philosophy" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"where" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 5 #"small" -0 0 20 3 1 #" " -0 0 20 3 4 #"core" -0 0 20 3 3 #" is" -0 0 24 29 1 #"\n" -0 0 20 3 12 #"standardised" -0 0 24 3 1 #"@" -0 0 14 3 5 #"~cite" -0 0 24 3 1 #"[" -0 0 19 3 5 #"\"r5rs" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 19 3 5 #"\"r6rs" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 19 3 5 #"\"r7rs" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 12 #"subsequently" -0 0 20 3 1 #" " -0 0 20 3 8 #"extended" -0 0 20 3 1 #" " -0 0 20 3 3 #"via" -0 0 20 3 7 #" macros" -0 0 24 29 1 #"\n" -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 10 #"additional" -0 0 20 3 1 #" " -0 0 20 3 8 #"function" -0 0 20 3 13 #" definitions." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 20 3 6 #"Racket" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 8 #"formerly" -0 0 20 3 1 #" " -0 0 20 3 6 #"named " -0 0 29 3 3 #"PLT" -0 0 20 3 1 #" " -0 0 20 3 6 #"Scheme" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 7 #"started" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 6 #"Scheme" -0 0 20 3 1 #" " -0 0 20 3 15 #"implementation." -0 0 20 3 7 #" Racket" -0 0 24 29 1 #"\n" -0 0 20 3 7 #"evolved" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 6 #"Racket" -0 0 20 3 10 #" Manifesto" -0 0 24 3 1 #"@" -0 0 14 3 5 #"~cite" -0 0 24 3 1 #"[" -0 0 19 3 16 #"\"racketmanifesto" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 8 #"presents" -0 0 20 3 1 #" " -0 0 20 3 2 #"it" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 2 #" a" -0 0 24 29 1 #"\n" -0 0 20 3 2 #"``" -0 0 20 3 20 #"programming-language" -0 0 20 3 1 #" " -0 0 20 3 11 #"programming" -0 0 20 3 1 #" " -0 0 20 3 8 #"language" -0 0 20 3 2 #"''" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 8 #"language" -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 5 #"helps" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 4 #" the" -0 0 24 29 1 #"\n" -0 0 20 3 8 #"creation" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 5 #"small" -0 0 20 3 1 #" " -0 0 20 3 10 #"linguistic" -0 0 20 3 1 #" " -0 0 20 3 10 #"extensions" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 4 #"well" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 8 #"entirely" -0 0 20 3 1 #" " -0 0 20 3 3 #"new" -0 0 20 3 1 #" " -0 0 20 3 10 #"languages." -0 0 20 3 4 #" The" -0 0 24 29 1 #"\n" -0 0 20 3 6 #"Racket" -0 0 20 3 1 #" " -0 0 20 3 9 #"ecosystem" -0 0 20 3 1 #" " -0 0 20 3 8 #"features" -0 0 20 3 1 #" " -0 0 20 3 4 #"many" -0 0 20 3 1 #" " -0 0 20 3 9 #"languages" -0 0 20 3 1 #" " -0 0 20 3 8 #"covering" -0 0 20 3 1 #" " -0 0 20 3 4 #"many" -0 0 20 3 11 #" paradigms:" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 1 #"@" -0 0 14 3 8 #"itemlist" -0 0 24 3 1 #"[" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 4 #"item" -0 0 24 3 1 #"{" -0 0 20 3 4 #"The " -0 0 24 3 1 #"@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 11 #"racket/base" -0 0 24 3 1 #"]" -0 0 20 3 40 #" language is a full-featured programming" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 56 #"language which mostly encourages functional programming." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 4 #"item" -0 0 24 3 2 #"{@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 12 #"racket/class" -0 0 24 3 1 #"]" -0 0 20 3 11 #" implements" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 8 #"\"classes" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 23 3 5 #"#:doc" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 3 #"lib" -0 0 24 3 1 #" " -0 0 19 3 30 #"\"scribblings/guide/guide.scrbl" -0 0 19 3 1 #"\"" -0 0 24 3 3 #")]{" -0 0 20 3 2 #"an" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 22 #"object-oriented system" -0 0 24 3 1 #"}" -0 0 20 3 19 #", implemented atop " -0 0 24 3 1 #"@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 11 #"racket/base" -0 0 24 3 1 #"]" -0 0 20 3 6 #" using" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 51 #"macros, and can be used along with the rest of the " -0 0 24 3 1 #"@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 11 #"racket/base" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"language." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 4 #"item" -0 0 24 3 2 #"{@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 7 #"racklog" -0 0 24 3 1 #"]" -0 0 20 3 48 #" is a logic programming language in the style of" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 29 3 6 #"prolog" -0 0 20 3 57 #". The Racket ecosystem also includes an implementation of" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 7 #"datalog" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 4 #"item" -0 0 24 3 2 #"{@" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 4 #"\"top" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 23 3 5 #"#:doc" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 3 #"lib" -0 0 24 3 1 #" " -0 0 19 3 36 #"\"scribblings/scribble/scribble.scrbl" -0 0 19 3 1 #"\"" -0 0 24 3 3 #")]{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 8 #"Scribble" -0 0 24 3 1 #"}" -0 0 20 3 34 #" can be seen as an alternative to " -0 0 24 3 2 #"@|" -0 0 14 3 5 #"LaTeX" -0 0 24 3 1 #"|" -0 0 20 3 23 #", and is used to create" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"the " -0 0 24 3 1 #"@" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 4 #"\"top" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 23 3 5 #"#:doc" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 3 #"lib" -0 0 24 3 1 #" " -0 0 19 3 29 #"\"scribblings/main/start.scrbl" -0 0 19 3 1 #"\"" -0 0 24 3 3 #")]{" -0 0 20 3 6 #"Racket" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 13 #"documentation" -0 0 24 3 1 #"}" -0 0 20 3 63 -#". It also supports literate programming, by embedding chunks of" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 71 -( - #"code in the document which are then aggregated together. This thesis" - #" is" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 31 #"in fact written using Scribble." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 4 #"item" -0 0 24 3 2 #"{@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 9 #"slideshow" -0 0 24 3 1 #"]" -0 0 20 3 6 #" is a " -0 0 24 3 1 #"@" -0 0 15 3 7 #"deftech" -0 0 24 3 1 #"{" -0 0 29 3 3 #"DSL" -0 0 24 3 1 #"}" -0 0 20 3 27 #" (domain-specific language)" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 74 -( - #"for the creation of presentations, and can be thought as an alternat" - #"ive to" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 29 3 6 #"Beamer" -0 0 20 3 5 #" and " -0 0 29 3 6 #"SliTeX" -0 0 20 3 1 #"." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 4 #"item" -0 0 24 3 2 #"{@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 4 #"r5rs" -0 0 24 3 1 #"]" -0 0 20 3 5 #" and " -0 0 24 3 1 #"@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 4 #"r6rs" -0 0 24 3 1 #"]" -0 0 20 3 23 #" are implementations of" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 35 #"the corresponding scheme standards." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 4 #"item" -0 0 24 3 2 #"{@" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 4 #"\"top" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 23 3 5 #"#:doc" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 3 #"lib" -0 0 24 3 1 #" " -0 0 19 3 18 #"\"redex/redex.scrbl" -0 0 19 3 1 #"\"" -0 0 24 3 3 #")]{" -0 0 29 3 5 #"Redex" -0 0 24 3 1 #"}" -0 0 20 3 5 #" is a" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 7 #"usetech" -0 0 24 3 1 #"{" -0 0 29 3 3 #"DSL" -0 0 24 3 1 #"}" -0 0 20 3 44 #" which allows the specification of reduction" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 74 -( - #"semantics for programming languages. It features tools to explore an" - #"d test" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 22 #"the defined semantics." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 4 #"item" -0 0 24 3 3 #"{@|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 2 #"|@" -0 0 14 3 5 #"~cite" -0 0 24 3 1 #"[" -0 0 19 3 28 #"\"tobin-hochstadt_design_2008" -0 0 19 3 1 #"\"" -0 0 24 29 1 #"\n" -0 0 24 3 28 #" " -0 0 19 3 27 #"\"tobin-hochstadt_typed_2010" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 22 #" is a typed variant of" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"the main " -0 0 24 3 1 #"@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"]" -0 0 20 3 45 #" language. It is implemented as a macro which" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 76 -( - #"takes over the whole body of the program. That macro fully expands a" - #"ll other" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 32 #"macros in the program, and then " -0 0 29 3 10 #"typechecks" -0 0 20 3 22 #" the expanded program." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 4 #"item" -0 0 24 3 2 #"{@" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 4 #"\"top" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 23 3 5 #"#:doc" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 3 #"lib" -0 0 24 3 1 #" " -0 0 19 3 38 #"\"turnstile/scribblings/turnstile.scrbl" -0 0 19 3 1 #"\"" -0 0 24 3 3 #")]{" -0 0 24 29 1 #"\n" -0 0 24 3 5 #" @|" -0 0 14 3 9 #"Turnstile" -0 0 24 3 2 #"|}" -0 0 20 3 55 #" allows the creation of new typed languages. It takes a" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 36 #"different approach when compared to " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 22 #", and threads the type" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 73 -( - #"information through assignments and special forms, in order to be ab" - #"le to" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 29 3 9 #"typecheck" -0 0 20 3 62 -#" the program during expansion, instead of doing so afterwards." -0 0 24 3 2 #"}]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 20 3 2 #"In" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 9 #"remainder" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 4 #"this" -0 0 20 3 1 #" " -0 0 20 3 7 #"section" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 2 #"we" -0 0 20 3 1 #" " -0 0 20 3 4 #"will" -0 0 20 3 1 #" " -0 0 20 3 7 #"present" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 8 #"features" -0 0 20 3 3 #" of" -0 0 24 29 1 #"\n" -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #"'" -0 0 20 3 1 #"s" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 6 #"system" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 4 #"then" -0 0 20 3 1 #" " -0 0 20 3 7 #"present" -0 0 20 3 1 #" " -0 0 20 3 6 #"formal" -0 0 20 3 1 #" " -0 0 20 3 9 #"semantics" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 7 #" subset" -0 0 24 29 1 #"\n" -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 5 #"those" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 6 #"namely" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"part" -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 8 #"relevant" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 3 #"our" -0 0 20 3 6 #" work." -0 0 24 29 1 #"\n" -0 0 24 3 1 #"@" -0 0 14 3 9 #"other-doc" -0 0 24 3 1 #"[" -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 3 #"lib" -0 0 24 3 1 #" " -0 0 19 3 40 #"\"typed-racket/scribblings/ts-guide.scrbl" -0 0 19 3 1 #"\"" -0 0 24 3 2 #")]" -0 0 20 3 4 #" and" -0 0 24 29 1 #"\n" -0 0 24 3 1 #"@" -0 0 14 3 9 #"other-doc" -0 0 24 3 1 #"[" -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 3 #"lib" -0 0 24 3 1 #" " -0 0 19 3 44 #"\"typed-racket/scribblings/ts-reference.scrbl" -0 0 19 3 1 #"\"" -0 0 24 3 2 #")]" -0 0 20 3 1 #" " -0 0 20 3 7 #"provide" -0 0 20 3 5 #" good" -0 0 24 29 1 #"\n" -0 0 20 3 13 #"documentation" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 11 #"programmers" -0 0 20 3 1 #" " -0 0 20 3 3 #"who" -0 0 20 3 1 #" " -0 0 20 3 6 #"desire" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 4 #"use " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 9 #"; we will" -0 0 24 29 1 #"\n" -0 0 20 3 9 #"therefore" -0 0 20 3 1 #" " -0 0 20 3 4 #"keep" -0 0 20 3 1 #" " -0 0 20 3 3 #"our" -0 0 20 3 1 #" " -0 0 20 3 8 #"overview" -0 0 20 3 1 #" " -0 0 20 3 8 #"succinct" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 5 #"gloss" -0 0 20 3 1 #" " -0 0 20 3 4 #"over" -0 0 20 3 1 #" " -0 0 20 3 4 #"most" -0 0 20 3 9 #" details." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 1 #"@" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"{" -0 0 20 3 38 #"Overview of Typed Racket's type system" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"{" -0 0 20 3 22 #"Simple primitive types" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"Typedracket" -0 0 20 3 57 #" has types matching Racket's baggage of primitive values:" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"Number" -0 0 24 3 1 #"]" -0 0 20 3 2 #", " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #"]" -0 0 20 3 2 #", " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 4 #"Char" -0 0 24 3 1 #"]" -0 0 20 3 2 #", " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"String" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 4 #"Void" -0 0 24 3 2 #"]@" -0 0 14 3 4 #"note" -0 0 24 3 1 #"{" -0 0 20 3 4 #"The " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 4 #"Void" -0 0 24 3 1 #"]" -0 0 20 3 35 #" type contains only a single value," -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 28 3 2 #"#," -0 0 24 3 1 #"(" -0 0 14 3 4 #"void" -0 0 24 3 2 #")]" -0 0 20 3 27 #", and is equivalent to the " -0 0 24 3 1 #"@" -0 0 14 3 8 #"racketid" -0 0 24 3 1 #"[" -0 0 14 3 4 #"void" -0 0 24 3 1 #"]" -0 0 20 3 8 #" type in" -0 0 24 29 1 #"\n" -0 0 24 3 5 #" @|" -0 0 14 3 10 #"C-language" -0 0 24 3 1 #"|" -0 0 20 3 26 #". It is the equivalent of " -0 0 24 3 1 #"@" -0 0 14 3 8 #"racketid" -0 0 24 3 1 #"[" -0 0 15 3 4 #"unit" -0 0 24 3 1 #"]" -0 0 20 3 4 #" of " -0 0 24 3 1 #"@" -0 0 14 3 4 #"CAML" -0 0 20 3 4 #" and" -0 0 24 29 1 #"\n" -0 0 24 3 5 #" @|" -0 0 14 3 7 #"haskell" -0 0 24 3 1 #"|" -0 0 20 3 65 -#", and is often used as the return type of functions which perform" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 45 #"side-effects. It should not be confused with " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 12 #", the bottom" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 71 -( - #"type which is not inhabited by any value, and is similar to the type" - #" of" -) 0 0 24 29 1 #"\n" -0 0 24 3 5 #" @|" -0 0 14 3 7 #"haskell" -0 0 24 3 1 #"|" -0 0 20 3 3 #"'s " -0 0 24 3 1 #"@" -0 0 14 3 8 #"racketid" -0 0 24 3 1 #"[" -0 0 14 3 9 #"undefined" -0 0 24 3 1 #"]" -0 0 20 3 2 #". " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 24 #" can be used for example" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 76 -( - #"as the type of functions which never return \342\200\224 in that way" - #" it is similar to" -) 0 0 24 29 1 #"\n" -0 0 24 3 5 #" @|" -0 0 14 3 10 #"C-language" -0 0 24 3 1 #"|" -0 0 20 3 3 #"'s " -0 0 24 3 1 #"@" -0 0 14 3 2 #"tt" -0 0 24 3 1 #"[" -0 0 19 3 1 #"\"" -0 0 19 3 13 #"__attribute__" -0 0 19 3 3 #" ((" -0 0 19 3 14 #"__noreturn__))" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 24 3 1 #"}" -0 0 20 3 11 #" and so on." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 3 #"ann" -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 12 #" " -0 0 21 3 3 #"243" -0 0 24 29 1 #"\n" -0 0 24 3 12 #" " -0 0 19 3 13 #"\"Hello world\"" -0 0 24 29 1 #"\n" -0 0 24 3 12 #" " -0 0 21 3 1 #"#" -0 0 21 3 2 #"\\c" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 43 #"\"The void function produces the void value\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 43 #"\"Void values on their own are not printed,\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 46 #"\"so we place it in a list to make it visible.\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 4 #"list" -0 0 24 3 2 #" (" -0 0 14 3 4 #"void" -0 0 24 3 3 #"))]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"For" -0 0 20 3 1 #" " -0 0 20 3 7 #"numbers" -0 0 20 3 2 #", " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 6 #"offers" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 2 #"``" -0 0 20 3 7 #"numeric" -0 0 20 3 1 #" " -0 0 20 3 5 #"tower" -0 0 20 3 2 #"''" -0 0 20 3 3 #" of" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 21 #"partially-overlapping" -0 0 20 3 1 #" " -0 0 20 3 7 #"types: " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 16 #"Positive-Integer" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 7 #"subtype" -0 0 20 3 3 #" of" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Integer" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 6 #"itself" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 7 #"subtype" -0 0 20 3 1 #" " -0 0 20 3 3 #"of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"Number" -0 0 24 3 1 #"]" -0 0 20 3 2 #". " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 4 #"Zero" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 10 #"containing" -0 0 20 3 1 #" " -0 0 20 3 4 #"only" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 6 #"number" -0 0 20 3 1 #" " -0 0 20 3 1 #"0" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 4 #"both" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 7 #"subtype" -0 0 20 3 3 #" of" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 19 #"Nonnegative-Integer" -0 0 24 3 1 #"]" -0 0 20 3 2 #" (" -0 0 20 3 7 #"numbers" -0 0 20 3 1 #" " -0 0 20 3 3 #"\342\211\245" -0 0 20 3 1 #" " -0 0 20 3 1 #"0" -0 0 20 3 2 #") " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 19 #"Nonpositive-Integer" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 1 #"(" -0 0 20 3 7 #"numbers" -0 0 20 3 1 #" " -0 0 20 3 3 #"\342\211\244" -0 0 20 3 1 #" " -0 0 20 3 1 #"0" -0 0 20 3 2 #")." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 4 #"also" -0 0 20 3 1 #" " -0 0 20 3 8 #"includes" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 9 #"singleton" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 4 #"each" -0 0 20 3 1 #" " -0 0 20 3 9 #"primitive" -0 0 20 3 1 #" " -0 0 20 3 5 #"value" -0 0 20 3 3 #" of" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"these" -0 0 20 3 1 #" " -0 0 20 3 6 #"types:" -0 0 20 3 1 #" " -0 0 20 3 2 #"we" -0 0 20 3 1 #" " -0 0 20 3 7 #"already" -0 0 20 3 1 #" " -0 0 20 3 10 #"mentioned " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 4 #"Zero" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 2 #"an" -0 0 20 3 1 #" " -0 0 20 3 5 #"alias" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 4 #" the" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"0" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 5 #"type." -0 0 20 3 1 #" " -0 0 20 3 5 #"Every" -0 0 20 3 1 #" " -0 0 20 3 6 #"number" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 9 #"character" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 6 #"string" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 7 #"boolean" -0 0 20 3 1 #" " -0 0 20 3 5 #"value" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 5 #" used" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 4 #"only" -0 0 20 3 1 #" " -0 0 20 3 9 #"inhabited" -0 0 20 3 1 #" " -0 0 20 3 2 #"by" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"same" -0 0 20 3 1 #" " -0 0 20 3 6 #"number" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 9 #"character" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 6 #"string" -0 0 20 3 3 #" or" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"boolean" -0 0 20 3 1 #" " -0 0 20 3 6 #"value." -0 0 20 3 1 #" " -0 0 20 3 3 #"For" -0 0 20 3 1 #" " -0 0 20 3 7 #"example" -0 0 20 3 2 #", " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 3 #"243" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 7 #"belongs" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 9 #"singleton" -0 0 20 3 5 #" type" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 3 #"243" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 7 #"subtype" -0 0 20 3 1 #" " -0 0 20 3 3 #"of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 16 #"Positive-Integer" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 12 #" " -0 0 21 3 1 #"0" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 3 #"ann" -0 0 24 3 1 #" " -0 0 21 3 3 #"243" -0 0 24 3 1 #" " -0 0 21 3 3 #"243" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 12 #" " -0 0 21 3 2 #"#t" -0 0 24 3 2 #"]}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"{" -0 0 20 3 15 #"Pairs and lists" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 76 -( - #"Pairs are the central data structure of most Lisp dialects. They are" - #" used to" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 43 #"build linked lists of pairs, terminated by " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"'" -0 0 24 3 3 #"()]" -0 0 20 3 23 #", the null element. The" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 26 #"null element has the type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 4 #"Null" -0 0 24 3 1 #"]" -0 0 20 3 38 #", while the pairs which build the list" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 14 #"have the type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 2 #"_A" -0 0 24 3 1 #" " -0 0 14 3 2 #"_B" -0 0 24 3 2 #")]" -0 0 20 3 8 #", where " -0 0 24 3 1 #"@" -0 0 14 3 8 #"racketid" -0 0 24 3 1 #"[" -0 0 14 3 2 #"_A" -0 0 24 3 1 #"]" -0 0 20 3 5 #" and " -0 0 24 3 1 #"@" -0 0 14 3 8 #"racketid" -0 0 24 3 1 #"[" -0 0 14 3 2 #"_B" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 73 -( - #"are replaced by the actual types for the first and second elements o" - #"f the" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 40 #"pair. For example, the pair built using " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 4 #"cons" -0 0 24 3 1 #" " -0 0 21 3 3 #"729" -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 2 #")]" -0 0 20 3 7 #", which" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"contains " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 3 #"729" -0 0 24 3 1 #"]" -0 0 20 3 27 #" as its first element, and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 5 #"#true" -0 0 24 3 1 #"]" -0 0 20 3 14 #" as its second" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 22 #"element, has the type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #")]" -0 0 20 3 19 #", or using the most" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 25 #"precise singleton types, " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 21 3 3 #"729" -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 2 #")]" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 4 #"cons" -0 0 24 3 1 #" " -0 0 21 3 3 #"729" -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 12 #" " -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 21 3 3 #"729" -0 0 24 3 1 #" " -0 0 28 3 1 #"." -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 2 #")]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 13 #"Heterogeneous" -0 0 20 3 1 #" " -0 0 20 3 6 #"linked" -0 0 20 3 1 #" " -0 0 20 3 5 #"lists" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 5 #"fixed" -0 0 20 3 1 #" " -0 0 20 3 6 #"length" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 5 #"given" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 7 #"precise" -0 0 20 3 1 #" " -0 0 20 3 7 #"type by" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"nesting" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"same" -0 0 20 3 1 #" " -0 0 20 3 6 #"number" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 5 #"pairs" -0 0 20 3 1 #" " -0 0 20 3 2 #"at" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 6 #"level." -0 0 20 3 1 #" " -0 0 20 3 3 #"For" -0 0 20 3 1 #" " -0 0 20 3 7 #"example" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 8 #"the list" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"built" -0 0 20 3 6 #" with " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 4 #"list" -0 0 24 3 1 #" " -0 0 21 3 2 #"81" -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 5 #"hello" -0 0 24 3 2 #")]" -0 0 20 3 1 #" " -0 0 20 3 3 #"has" -0 0 20 3 1 #" " -0 0 20 3 8 #"the type" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 4 #"List" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 2 #")]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 9 #"shorthand" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 8 #"the type" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 1 #" " -0 0 14 3 4 #"Null" -0 0 24 3 4 #")))]" -0 0 20 3 1 #"." -0 0 20 3 1 #" " -0 0 20 3 8 #"Lists in" -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 4 #"thus" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 4 #"seen" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 10 #"equivalent" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 5 #"chain" -0 0 20 3 1 #" " -0 0 20 3 9 #"of nested" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"2-tuples" -0 0 20 3 1 #" " -0 0 20 3 2 #"in" -0 0 20 3 1 #" " -0 0 20 3 9 #"languages" -0 0 20 3 6 #" like " -0 0 24 3 2 #"@|" -0 0 14 3 4 #"CAML" -0 0 24 3 1 #"|" -0 0 20 3 4 #" or " -0 0 24 3 2 #"@|" -0 0 14 3 7 #"haskell" -0 0 24 3 1 #"|" -0 0 20 3 1 #"." -0 0 20 3 5 #" The " -0 0 29 3 6 #"analog" -0 0 20 3 3 #" in" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 15 #"object-oriented" -0 0 20 3 1 #" " -0 0 20 3 9 #"languages" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 1 #" " -0 0 20 3 7 #"support" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 8 #"generics" -0 0 20 3 1 #" " -0 0 20 3 5 #"would" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 7 #"a class" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 2 #"tt" -0 0 24 3 1 #"[" -0 0 19 3 1 #"\"" -0 0 19 3 6 #"Pair<A" -0 0 19 3 1 #"," -0 0 19 3 3 #" B>" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"where" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 7 #"generic" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 10 #" argument " -0 0 24 3 1 #"@" -0 0 14 3 8 #"racketid" -0 0 24 3 1 #"[" -0 0 14 3 1 #"B" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 8 #"could be" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 12 #"instantiated" -0 0 20 3 1 #" " -0 0 20 3 2 #"by" -0 0 20 3 1 #" " -0 0 20 3 7 #"another" -0 0 20 3 1 #" " -0 0 20 3 8 #"instance" -0 0 20 3 4 #" of " -0 0 24 3 1 #"@" -0 0 14 3 2 #"tt" -0 0 24 3 1 #"[" -0 0 19 3 5 #"\"Pair" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 7 #" so on." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 4 #"cons" -0 0 24 3 1 #" " -0 0 21 3 2 #"81" -0 0 24 3 2 #" (" -0 0 14 3 4 #"cons" -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 2 #" (" -0 0 14 3 4 #"cons" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 5 #"hello" -0 0 24 3 1 #" " -0 0 14 3 4 #"null" -0 0 24 3 3 #")))" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 3 #"ann" -0 0 24 3 2 #" (" -0 0 14 3 4 #"list" -0 0 24 3 1 #" " -0 0 21 3 2 #"81" -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 5 #"hello" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 18 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 1 #" " -0 0 14 3 4 #"Null" -0 0 24 3 5 #"))))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"The" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 15 #"variable-length" -0 0 20 3 1 #" " -0 0 20 3 11 #"homogeneous" -0 0 20 3 1 #" " -0 0 20 3 6 #"linked" -0 0 20 3 1 #" " -0 0 20 3 5 #"lists" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 9 #"described" -0 0 20 3 6 #" using" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"Listof" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 9 #"operator." -0 0 20 3 1 #" " -0 0 20 3 3 #"The" -0 0 20 3 1 #" " -0 0 20 3 5 #"type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Listof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 2 #")]" -0 0 20 3 3 #" is" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 10 #"equivalent" -0 0 20 3 1 #" " -0 0 20 3 3 #"to " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"Rec" -0 0 24 3 1 #" " -0 0 14 3 1 #"R" -0 0 24 3 2 #" (" -0 0 14 3 1 #"U" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 1 #"R" -0 0 24 3 2 #") " -0 0 14 3 4 #"Null" -0 0 24 3 3 #"))]" -0 0 20 3 1 #"." -0 0 20 3 1 #" " -0 0 20 3 4 #"The " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"Rec" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 8 #"operator" -0 0 20 3 1 #" " -0 0 20 3 10 #"describes " -0 0 24 3 1 #"@" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 32 #"\"tr-presentation-recursive-types" -0 0 19 3 1 #"\"" -0 0 24 3 2 #"]{" -0 0 20 3 9 #"recursive" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 5 #"types" -0 0 24 3 1 #"}" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 4 #"and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"U" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 10 #"describes " -0 0 24 3 1 #"@" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 23 #"\"tr-presentation-unions" -0 0 19 3 1 #"\"" -0 0 24 3 2 #"]{" -0 0 20 3 6 #"unions" -0 0 24 3 1 #"}" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"Both" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 5 #"these" -0 0 20 3 1 #" " -0 0 20 3 8 #"features" -0 0 20 3 1 #" " -0 0 20 3 3 #"are" -0 0 20 3 1 #" " -0 0 20 3 9 #"described" -0 0 20 3 1 #" " -0 0 20 3 5 #"below" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 3 #"now" -0 0 20 3 1 #" " -0 0 20 3 2 #"we" -0 0 20 3 1 #" " -0 0 20 3 4 #"will" -0 0 20 3 1 #" " -0 0 20 3 6 #"simply" -0 0 20 3 1 #" " -0 0 20 3 3 #"say" -0 0 20 3 5 #" that" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 10 #"previously" -0 0 20 3 1 #" " -0 0 20 3 5 #"given" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 9 #"recursive" -0 0 20 3 1 #" " -0 0 20 3 5 #"type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"R" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 2 #" a" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 1 #"R" -0 0 24 3 2 #")]" -0 0 20 3 1 #" " -0 0 20 3 3 #"or " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 4 #"Null" -0 0 24 3 1 #"]" -0 0 20 3 2 #" (" -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 9 #"terminate" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 6 #"linked" -0 0 20 3 1 #" " -0 0 20 3 4 #"list" -0 0 20 3 2 #")." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 3 #"ann" -0 0 24 3 2 #" (" -0 0 14 3 5 #"range" -0 0 24 3 1 #" " -0 0 21 3 1 #"0" -0 0 24 3 1 #" " -0 0 21 3 1 #"5" -0 0 24 3 3 #") (" -0 0 14 3 6 #"Listof" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 4 #"))]}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"{" -0 0 20 3 7 #"Symbols" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 30 #"Another of Racket's primitive " -0 0 29 3 9 #"datatypes" -0 0 20 3 33 #" is symbols. Symbols are interned" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 78 -( - #"strings: two occurrences of a symbol produce values which are pointe" - #"r-equal if" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 59 -#"the symbols are equal (i.e. they represent the same string)" -0 0 24 3 1 #"@" -0 0 14 3 4 #"note" -0 0 24 3 1 #"{" -0 0 20 3 12 #"This is true" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 43 #"with the exception of symbols created with " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"gensym" -0 0 24 3 1 #"]" -0 0 20 3 14 #" and the like." -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"gensym" -0 0 24 3 1 #"]" -0 0 20 3 61 -#" produces a fresh symbol which is not interned, and therefore" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 75 -( - #"different from all existing symbols, and different from all symbols " - #"created" -) 0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 14 #"in the future." -0 0 24 3 1 #"}" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 1 #"|" -0 0 20 3 14 #" includes the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"Symbol" -0 0 24 3 1 #"]" -0 0 20 3 27 #" type, to which all symbols" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 73 -( - #"belong. Additionally, there is a singleton type for each symbol: the" - #" type" -) 0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"'" -0 0 14 3 3 #"foo" -0 0 24 3 1 #"]" -0 0 20 3 33 #" is only inhabited by the symbol " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"'" -0 0 14 3 3 #"foo" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 12 #" " -0 0 21 3 1 #"'" -0 0 14 3 3 #"foo" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 73 -( - #"Singleton types containing symbols can be seen as similar to constru" - #"ctors" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 21 #"without arguments in " -0 0 24 3 2 #"@|" -0 0 14 3 4 #"CAML" -0 0 24 3 1 #"|" -0 0 20 3 5 #" and " -0 0 24 3 2 #"@|" -0 0 14 3 7 #"haskell" -0 0 24 3 1 #"|" -0 0 20 3 25 #", and as globally unique " -0 0 29 3 4 #"enum" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 77 -( - #"values in object-oriented languages. The main difference resides in " - #"the scope" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 76 -( - #"of the declaration: two constructor declarations with identical name" - #"s in two" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 75 -( - #"separate files will usually give distinct types and values. Similarl" - #"y, when" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 22 #"using the ``type-safe " -0 0 29 3 4 #"enum" -0 0 20 3 42 #"'' design pattern, two otherwise identical" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 19 #"declarations of an " -0 0 29 3 4 #"enum" -0 0 20 3 52 #" will yield objects of different types. In contrast," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 46 #"two uses of an interned symbols in Racket and " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 13 #" will produce" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 65 -#"identical values and types. A way of seeing this is that symbols " -0 0 20 3 4 #"are " -0 0 20 3 7 #"similar" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"to" -0 0 20 3 18 #" constructors (in " -0 0 20 3 4 #"the " -0 0 20 3 11 #"functional " -0 0 20 3 12 #"programming " -0 0 20 3 10 #"sense) or " -0 0 29 3 5 #"enums" -0 0 20 3 10 #" which are" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 29 #"implicitly declared globally." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"module" -0 0 24 3 1 #" " -0 0 14 3 2 #"m1" -0 0 24 3 1 #" " -0 0 14 3 12 #"typed/racket" -0 0 24 29 1 #"\n" -0 0 24 3 15 #" (" -0 0 15 3 6 #"define" -0 0 24 3 1 #" " -0 0 14 3 4 #"sym1" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 3 #"foo" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 15 #" (" -0 0 14 3 7 #"provide" -0 0 24 3 1 #" " -0 0 14 3 4 #"sym1" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"module" -0 0 24 3 1 #" " -0 0 14 3 2 #"m2" -0 0 24 3 1 #" " -0 0 14 3 12 #"typed/racket" -0 0 24 29 1 #"\n" -0 0 24 3 15 #" (" -0 0 15 3 6 #"define" -0 0 24 3 1 #" " -0 0 14 3 4 #"sym2" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 3 #"foo" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 15 #" (" -0 0 14 3 7 #"provide" -0 0 24 3 1 #" " -0 0 14 3 4 #"sym2" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 7 #"require" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"m1" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"m2" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 49 #"\"The tow independent uses of 'foo are identical:\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 3 #"eq?" -0 0 24 3 1 #" " -0 0 14 3 4 #"sym1" -0 0 24 3 1 #" " -0 0 14 3 4 #"sym2" -0 0 24 3 2 #")]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" }" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"[" -0 0 23 3 5 #"#:tag" -0 0 24 3 1 #" " -0 0 19 3 23 #"\"tr-presentation-unions" -0 0 19 3 1 #"\"" -0 0 24 3 2 #"]{" -0 0 20 3 6 #"Unions" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 77 -( - #"These singleton types may not seem very useful on their own. They ca" - #"n however" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 65 -#"be combined together with union types, which are built using the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"U" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 14 #"type operator." -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 15 #"The union type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"0" -0 0 24 3 1 #" " -0 0 21 3 1 #"1" -0 0 24 3 1 #" " -0 0 21 3 1 #"2" -0 0 24 3 2 #")]" -0 0 20 3 28 #" is inhabited by the values " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"0" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"1" -0 0 24 3 1 #"]" -0 0 20 3 5 #" and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"2" -0 0 24 3 1 #"]" -0 0 20 3 29 #", and by no other value. The " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #"]" -0 0 20 3 8 #" type is" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 20 #"actually defined as " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 1 #" " -0 0 21 3 6 #"#false" -0 0 24 3 2 #")]" -0 0 20 3 33 #", i.e. the union of the singleton" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 21 #"types containing the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 5 #"#true" -0 0 24 3 1 #"]" -0 0 20 3 5 #" and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 6 #"#false" -0 0 24 3 1 #"]" -0 0 20 3 22 #" values, respectively." -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"The " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 57 #" type, which is not inhabited by any value, is defined as" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 16 #"the empty union " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 2 #")]" -0 0 20 3 11 #". The type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"Any" -0 0 24 3 1 #"]" -0 0 20 3 25 #" is the top type, i.e. it" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 78 -( - #"is a super-type of all other types, and can be seen as a large union" - #" including" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 73 -( - #"all other types, including those which will be declared later or in " - #"other" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 14 #"units of code." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 69 -( - #"Unions of symbols are similar to variants which contain zero-argumen" - #"t" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 17 #"constructors, in " -0 0 24 3 2 #"@|" -0 0 14 3 4 #"CAML" -0 0 24 3 1 #"|" -0 0 20 3 4 #" or " -0 0 24 3 2 #"@|" -0 0 14 3 7 #"haskell" -0 0 24 3 1 #"|" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"define" -0 0 24 3 1 #" " -0 0 14 3 1 #"v" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 2 #" (" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 3 #"foo" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 3 #"bar" -0 0 24 3 2 #") " -0 0 21 3 1 #"'" -0 0 14 3 3 #"foo" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 12 #" " -0 0 14 3 1 #"v" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 4 #"set!" -0 0 24 3 1 #" " -0 0 14 3 1 #"v" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 3 #"bar" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 12 #" " -0 0 14 3 1 #"v" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 5 #"\"This" -0 0 19 3 1 #" " -0 0 19 3 6 #"throws" -0 0 19 3 1 #" " -0 0 19 3 2 #"an" -0 0 19 3 1 #" " -0 0 19 3 5 #"error" -0 0 19 3 1 #" " -0 0 19 3 2 #"at" -0 0 19 3 14 #" compile-time:" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 10 #"eval:error" -0 0 24 3 2 #" (" -0 0 14 3 4 #"set!" -0 0 24 3 1 #" " -0 0 14 3 1 #"v" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 4 #"oops" -0 0 24 3 3 #"))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 1 #"A" -0 0 20 3 1 #" " -0 0 20 3 5 #"union" -0 0 20 3 1 #" " -0 0 20 3 4 #"such" -0 0 20 3 1 #" " -0 0 20 3 3 #"as " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"ca" -0 0 24 3 2 #" (" -0 0 14 3 4 #"List" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"cb" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 3 #") (" -0 0 14 3 4 #"List" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"cc" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 3 #"))]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 4 #"seen" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 7 #"roughly" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 10 #"equivalent" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 7 #"variant" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 1 #" " -0 0 20 3 5 #"three" -0 0 20 3 1 #" " -0 0 20 3 13 #"constructors," -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"racketid" -0 0 24 3 1 #"[" -0 0 14 3 2 #"ca" -0 0 24 3 1 #"]" -0 0 20 3 2 #", " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 2 #"cb" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 4 #"and " -0 0 24 3 1 #"@" -0 0 14 3 8 #"racketid" -0 0 24 3 1 #"[" -0 0 14 3 2 #"cc" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"where" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"first" -0 0 20 3 1 #" " -0 0 20 3 3 #"has" -0 0 20 3 3 #" no" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"arguments" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 6 #"second" -0 0 20 3 1 #" " -0 0 20 3 3 #"has" -0 0 20 3 1 #" " -0 0 20 3 3 #"one" -0 0 20 3 1 #" " -0 0 20 3 8 #"argument" -0 0 20 3 2 #" (" -0 0 20 3 2 #"a " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"Number" -0 0 24 3 1 #"]" -0 0 20 3 1 #")" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"third" -0 0 20 3 4 #" has" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"two" -0 0 20 3 1 #" " -0 0 20 3 9 #"arguments" -0 0 20 3 2 #" (" -0 0 20 3 2 #"a " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"String" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 2 #"a " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"Symbol" -0 0 24 3 1 #"]" -0 0 20 3 2 #")." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"The" -0 0 20 3 1 #" " -0 0 20 3 4 #"main" -0 0 20 3 1 #" " -0 0 20 3 10 #"difference" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 4 #"that" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 6 #"symbol" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 4 #"used" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 5 #"parts" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 7 #"several" -0 0 20 3 1 #" " -0 0 20 3 7 #"unions," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"e.g. " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 2 #")]" -0 0 20 3 1 #" " -0 0 20 3 4 #"and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"c" -0 0 24 3 2 #")]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"while" -0 0 20 3 1 #" " -0 0 20 3 12 #"constructors" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 6 #" often" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"only" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 4 #"part" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 7 #"variant" -0 0 20 3 1 #" " -0 0 20 3 4 #"used" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 7 #"declare" -0 0 20 3 1 #" " -0 0 20 3 5 #"them." -0 0 20 3 1 #" " -0 0 20 3 6 #"Unions" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 7 #"symbols" -0 0 20 3 1 #" " -0 0 20 3 3 #"are" -0 0 20 3 3 #" in" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"this" -0 0 20 3 1 #" " -0 0 20 3 5 #"sense" -0 0 20 3 1 #" " -0 0 20 3 6 #"closer" -0 0 20 3 1 #" " -0 0 20 3 3 #"to " -0 0 24 3 2 #"@|" -0 0 14 3 4 #"CAML" -0 0 24 3 1 #"|" -0 0 20 3 1 #"'" -0 0 20 3 1 #"s" -0 0 20 3 1 #" " -0 0 20 3 9 #"so-called" -0 0 20 3 12 #" polymorphic" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"variants" -0 0 24 3 1 #"@" -0 0 14 3 5 #"~cite" -0 0 24 3 1 #"[" -0 0 19 3 21 #"\"minskyRealWorldOCaml" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 4 #"than" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 7 #"regular" -0 0 20 3 10 #" variants." -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 11 #"define-type" -0 0 24 3 1 #" " -0 0 14 3 10 #"my-variant" -0 0 24 3 2 #" (" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"ca" -0 0 24 29 1 #"\n" -0 0 24 3 40 #" (" -0 0 14 3 4 #"List" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"cb" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 40 #" (" -0 0 14 3 4 #"List" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"cc" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 3 #")))" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"define" -0 0 24 3 1 #" " -0 0 14 3 4 #"v\342\202\201" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 1 #" " -0 0 14 3 10 #"my-variant" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"ca" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"define" -0 0 24 3 1 #" " -0 0 14 3 4 #"v\342\202\202" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 1 #" " -0 0 14 3 10 #"my-variant" -0 0 24 3 2 #" (" -0 0 14 3 4 #"list" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"cb" -0 0 24 3 1 #" " -0 0 21 3 4 #"2187" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"define" -0 0 24 3 1 #" " -0 0 14 3 2 #"v3" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 1 #" " -0 0 14 3 10 #"my-variant" -0 0 24 3 2 #" (" -0 0 14 3 4 #"list" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 2 #"cc" -0 0 24 3 1 #" " -0 0 19 3 6 #"\"Hello" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 5 #"world" -0 0 24 3 3 #"))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"Finally" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 2 #"it" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 8 #"possible" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 3 #"mix" -0 0 20 3 1 #" " -0 0 20 3 9 #"different" -0 0 20 3 1 #" " -0 0 20 3 5 #"sorts" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 5 #"types" -0 0 20 3 1 #" " -0 0 20 3 6 #"within" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 5 #" same" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"union:" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"0" -0 0 24 3 1 #" " -0 0 21 3 5 #"#true" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 5 #"other" -0 0 24 3 2 #")]" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 9 #"inhabited" -0 0 20 3 1 #" " -0 0 20 3 2 #"by" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 7 #" number" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"0" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 8 #"boolean " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 5 #"#true" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 7 #"symbol " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"'" -0 0 14 3 5 #"other" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 11 #"Translating" -0 0 20 3 1 #" " -0 0 20 3 4 #"such" -0 0 20 3 1 #" " -0 0 20 3 2 #"an" -0 0 20 3 1 #" " -0 0 20 3 5 #"union" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 8 #"language" -0 0 20 3 1 #" " -0 0 20 3 5 #"like " -0 0 24 3 2 #"@|" -0 0 14 3 4 #"CAML" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 5 #"could" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 4 #"done" -0 0 20 3 3 #" by" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 10 #"explicitly" -0 0 20 3 1 #" " -0 0 20 3 7 #"tagging" -0 0 20 3 1 #" " -0 0 20 3 4 #"each" -0 0 20 3 1 #" " -0 0 20 3 4 #"case" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"union" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 8 #"distinct" -0 0 20 3 13 #" constructor." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 19 #"Implementation-wise" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"all" -0 0 20 3 1 #" " -0 0 20 3 6 #"values" -0 0 20 3 1 #" " -0 0 20 3 2 #"in" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 9 #"so-called" -0 0 20 3 3 #" ``" -0 0 29 3 7 #"untyped" -0 0 20 3 2 #"''" -0 0 20 3 1 #" " -0 0 20 3 7 #"version" -0 0 20 3 3 #" of" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"Racket" -0 0 20 3 1 #" " -0 0 20 3 3 #"are" -0 0 20 3 1 #" " -0 0 20 3 7 #"tagged:" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 3 #"few" -0 0 20 3 1 #" " -0 0 20 3 4 #"bits" -0 0 20 3 1 #" " -0 0 20 3 6 #"within" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"value" -0 0 20 3 1 #"'" -0 0 20 3 1 #"s" -0 0 20 3 1 #" " -0 0 20 3 14 #"representation" -0 0 20 3 1 #" " -0 0 20 3 3 #"are" -0 0 20 3 9 #" reserved" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 4 #"used" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 6 #"encode" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"value" -0 0 20 3 1 #"'" -0 0 20 3 1 #"s" -0 0 20 3 1 #" " -0 0 20 3 5 #"type." -0 0 20 3 1 #" " -0 0 20 3 4 #"When" -0 0 20 3 1 #" " -0 0 20 3 11 #"considering" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 6 #"target" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 8 #" pointer" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"in" -0 0 20 3 1 #" " -0 0 20 3 6 #"memory" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 6 #"Racket" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 9 #"therefore" -0 0 20 3 1 #" " -0 0 20 3 4 #"able" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 9 #"determine" -0 0 20 3 1 #" " -0 0 20 3 2 #"if" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 10 #"pointed-to" -0 0 20 3 1 #" " -0 0 20 3 5 #"value" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 2 #" a" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"number" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 7 #"boolean" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 6 #"string" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 6 #"symbol" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 2 #"so" -0 0 20 3 1 #" " -0 0 20 3 3 #"on." -0 0 20 3 1 #" " -0 0 20 3 5 #"Typed" -0 0 20 3 1 #" " -0 0 20 3 6 #"Racket" -0 0 20 3 1 #" " -0 0 20 3 9 #"preserves" -0 0 20 3 6 #" these" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"run-time" -0 0 20 3 1 #" " -0 0 20 3 5 #"tags." -0 0 20 3 1 #" " -0 0 20 3 4 #"They" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 4 #"then" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 4 #"used" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 6 #"detect" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 8 #"concrete" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 6 #" value" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"when" -0 0 20 3 1 #" " -0 0 20 3 3 #"its" -0 0 20 3 1 #" " -0 0 20 3 6 #"static" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 6 #"union." -0 0 20 3 1 #" " -0 0 20 3 4 #"This" -0 0 20 3 1 #" " -0 0 20 3 9 #"detection" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 4 #"done" -0 0 20 3 1 #" " -0 0 20 3 6 #"simply" -0 0 20 3 1 #" " -0 0 20 3 2 #"by" -0 0 20 3 6 #" using" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"Racket" -0 0 20 3 1 #"'" -0 0 20 3 1 #"s" -0 0 20 3 1 #" " -0 0 20 3 12 #"predicates: " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"number?" -0 0 24 3 1 #"]" -0 0 20 3 2 #", " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"string?" -0 0 24 3 1 #"]" -0 0 20 3 2 #", " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"symbol?" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"etc." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"{" -0 0 20 3 13 #"Intersections" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 74 -( - #"Intersections are the converse of unions: instead of allowing a mixt" - #"ure of" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 68 -#"values of different types, an intersection type, described using the" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #"]" -0 0 20 3 61 -#" type operator, only allows values which belong to all types." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 22 #"The intersection type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 14 3 19 #"Nonnegative-Integer" -0 0 24 3 1 #" " -0 0 14 3 19 #"Nonpositive-Integer" -0 0 24 3 2 #")]" -0 0 20 3 3 #" is" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 19 #"the singleton type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"0" -0 0 24 3 1 #"]" -0 0 20 3 22 #". The intersection of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"c" -0 0 24 3 2 #")]" -0 0 20 3 4 #" and" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"c" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"d" -0 0 24 3 2 #")]" -0 0 20 3 9 #" will be " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"c" -0 0 24 3 2 #")]" -0 0 20 3 5 #", as " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 1 #"]" -0 0 20 3 4 #" and" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 1 #"'" -0 0 14 3 1 #"c" -0 0 24 3 1 #"]" -0 0 20 3 23 #" belong to both unions." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 24 29 1 #"\n" -0 0 24 3 1 #" " -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 5 #":type" -0 0 19 3 1 #" " -0 0 19 3 5 #"shows" -0 0 19 3 1 #" " -0 0 19 3 3 #"the" -0 0 19 3 1 #" " -0 0 19 3 5 #"given" -0 0 19 3 1 #" " -0 0 19 3 4 #"type" -0 0 19 3 1 #"," -0 0 19 3 1 #" " -0 0 19 3 2 #"or" -0 0 19 3 1 #" " -0 0 19 3 1 #"a" -0 0 19 3 1 #" " -0 0 19 3 10 #"simplified" -0 0 19 3 1 #" " -0 0 19 3 7 #"version" -0 0 19 3 1 #" " -0 0 19 3 2 #"of" -0 0 19 3 3 #" it" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 5 #":type" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 2 #" (" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"c" -0 0 24 3 3 #") (" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"c" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"d" -0 0 24 3 4 #")))]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 4 #"able" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 6 #"reduce" -0 0 20 3 1 #" " -0 0 20 3 4 #"some" -0 0 20 3 1 #" " -0 0 20 3 13 #"intersections" -0 0 20 3 1 #" " -0 0 20 3 4 #"such" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 17 #"those given above" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"at" -0 0 20 3 1 #" " -0 0 20 3 13 #"compile-time." -0 0 20 3 1 #" " -0 0 20 3 7 #"However" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 2 #"in" -0 0 20 3 1 #" " -0 0 20 3 4 #"some" -0 0 20 3 1 #" " -0 0 20 3 5 #"cases" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 2 #"it" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 6 #"forced" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 21 #"keep the intersection" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 6 #"as-is." -0 0 20 3 1 #" " -0 0 20 3 13 #"For example, " -0 0 29 3 7 #"structs" -0 0 20 3 2 #" (" -0 0 24 3 1 #"@" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 24 #"\"tr-presentation-structs" -0 0 19 3 1 #"\"" -0 0 24 3 2 #"]{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 29 3 10 #"describled" -0 0 20 3 6 #" below" -0 0 24 3 1 #"}" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"using" -0 0 20 3 1 #" " -0 0 20 3 7 #"special" -0 0 20 3 1 #" " -0 0 20 3 10 #"properties" -0 0 20 3 1 #"," -0 0 20 3 28 #" impersonate functions. This" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 24 #"mechanism is similar to " -0 0 29 3 5 #"PHP's" -0 0 20 3 1 #" " -0 0 24 3 1 #"@" -0 0 14 3 2 #"tt" -0 0 24 3 1 #"[" -0 0 19 3 9 #"\"__invoke" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 20 #" ability to overload" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 2 #"tt" -0 0 24 3 1 #"[" -0 0 19 3 1 #"\"" -0 0 19 3 10 #"operator()" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 4 #" in " -0 0 24 3 2 #"@|" -0 0 14 3 3 #"CPP" -0 0 24 3 1 #"|" -0 0 20 3 2 #". " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 4 #"does" -0 0 20 3 1 #" " -0 0 20 3 3 #"not" -0 0 20 3 1 #" " -0 0 20 3 6 #"handle" -0 0 20 3 17 #" these properties" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 1 #"(" -0 0 20 3 3 #"yet" -0 0 20 3 1 #")" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 9 #"therefore" -0 0 20 3 7 #" cannot" -0 0 20 3 10 #" determine" -0 0 20 3 1 #" " -0 0 20 3 7 #"whether" -0 0 20 3 9 #" a given " -0 0 29 3 6 #"struct" -0 0 20 3 10 #" type also" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 12 #"impersonates" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 8 #"function" -0 0 20 3 1 #" " -0 0 20 3 2 #"or" -0 0 20 3 5 #" not." -0 0 20 3 5 #" This" -0 0 20 3 1 #" " -0 0 20 3 5 #"means" -0 0 20 3 1 #" " -0 0 20 3 4 #"that" -0 0 20 3 17 #" the intersection" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 14 3 1 #"s" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 3 #"))]" -0 0 20 3 8 #", where " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"s" -0 0 24 3 1 #"]" -0 0 20 3 6 #" is a " -0 0 29 3 6 #"struct" -0 0 20 3 1 #" " -0 0 20 3 5 #"type," -0 0 20 3 10 #" cannot be" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 11 #"reduced to " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 10 #", because " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 6 #"cannot" -0 0 20 3 18 #" determine whether" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"the " -0 0 29 3 6 #"struct" -0 0 20 3 1 #" " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"s" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 3 #"act" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 2 #" a" -0 0 20 3 17 #" function or not." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"Another" -0 0 20 3 17 #" situation where " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 6 #"cannot" -0 0 20 3 1 #" " -0 0 20 3 6 #"reduce" -0 0 20 3 1 #" " -0 0 20 3 24 #"the intersection is when" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 16 #"intersecting two" -0 0 20 3 17 #" function types (" -0 0 24 3 1 #"@" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 26 #"\"tr-presentation-functions" -0 0 19 3 1 #"\"" -0 0 24 3 2 #"]{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 15 #"presented below" -0 0 24 3 1 #"}" -0 0 20 3 2 #")." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 1 #"[" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 3 #") (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 3 #") (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 3 #"))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"The" -0 0 20 3 1 #" " -0 0 20 3 5 #"first" -0 0 20 3 1 #" " -0 0 20 3 12 #"intersection" -0 0 20 3 1 #" " -0 0 20 3 5 #"seems" -0 0 20 3 1 #" " -0 0 20 3 4 #"like" -0 0 20 3 1 #" " -0 0 20 3 5 #"could" -0 0 20 3 1 #" " -0 0 20 3 16 #"be simplified to" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 3 #") (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 2 #")]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 6 #"second" -0 0 20 3 1 #" " -0 0 20 3 12 #"one could be" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 14 #"simplified to " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 2 #" (" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #") " -0 0 14 3 6 #"String" -0 0 24 3 2 #")]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 23 #"however the equivalence" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"between" -0 0 20 3 1 #" " -0 0 20 3 5 #"these" -0 0 20 3 1 #" " -0 0 20 3 5 #"types" -0 0 20 3 1 #" " -0 0 20 3 3 #"has" -0 0 20 3 1 #" " -0 0 20 3 3 #"not" -0 0 20 3 1 #" " -0 0 20 3 4 #"been" -0 0 20 3 1 #" " -0 0 20 3 11 #"implemented" -0 0 20 3 1 #" " -0 0 20 3 9 #"(yet) in " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 8 #"so we do" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"not" -0 0 20 3 1 #" " -0 0 20 3 4 #"rely" -0 0 20 3 1 #" " -0 0 20 3 2 #"on" -0 0 20 3 1 #" " -0 0 20 3 5 #"them." -0 0 20 3 1 #" " -0 0 20 3 4 #"Note" -0 0 20 3 1 #" " -0 0 20 3 4 #"that" -0 0 20 3 1 #" " -0 0 20 3 4 #"this" -0 0 20 3 1 #" " -0 0 20 3 5 #"issue" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 3 #"not" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 9 #"soundness" -0 0 20 3 1 #" " -0 0 20 3 14 #"issue: it only" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"prevents" -0 0 20 3 1 #" " -0 0 20 3 7 #"passing" -0 0 20 3 1 #" " -0 0 20 3 6 #"values" -0 0 20 3 2 #" " -0 0 20 3 5 #"types" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 4 #"they" -0 0 20 3 1 #" " -0 0 20 3 6 #"belong" -0 0 20 3 1 #" " -0 0 20 3 2 #"in" -0 0 20 3 1 #" " -0 0 20 3 17 #"principle, but it" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"cannot" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 9 #"exploited" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 6 #"assign" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 5 #"value" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 8 #"variable" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 1 #" " -0 0 20 3 21 #"an incompatible type." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"Finally," -0 0 20 3 1 #" " -0 0 20 3 4 #"when" -0 0 20 3 1 #" " -0 0 20 3 4 #"some" -0 0 20 3 1 #" " -0 0 20 3 5 #"types" -0 0 20 3 1 #" " -0 0 20 3 3 #"are" -0 0 20 3 1 #" " -0 0 20 3 11 #"intersected" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 26 #"polymorphic type variable," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 12 #"intersection" -0 0 20 3 1 #" " -0 0 20 3 6 #"cannot" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 8 #"computed" -0 0 20 3 1 #" " -0 0 20 3 5 #"until" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 19 #"polymorphic type is" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 13 #"instantiated." -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"When " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 4 #"able" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 7 #"perform" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 30 #"simplification, occurrences of" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 1 #"(" -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 6 #"bottom" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 2 #") " -0 0 20 3 9 #"propagate" -0 0 20 3 1 #" " -0 0 20 3 8 #"outwards" -0 0 20 3 1 #" " -0 0 20 3 2 #"in" -0 0 20 3 1 #" " -0 0 20 3 4 #"some" -0 0 20 3 1 #" " -0 0 20 3 16 #"cases, pairs and" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 29 3 6 #"struct" -0 0 20 3 1 #" " -0 0 20 3 5 #"types" -0 0 20 3 15 #" which contain " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 3 #"one" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 20 #"their elements being" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 13 #"collapsed to " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 20 3 1 #" " -0 0 20 3 4 #"This" -0 0 20 3 16 #" propagation of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 7 #" starts" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"from" -0 0 20 3 16 #" occurrences of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 2 #"in" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"parts" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 20 #"resulting type which" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"are" -0 0 20 3 1 #" " -0 0 20 3 9 #"traversed" -0 0 20 3 1 #" " -0 0 20 3 2 #"by" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 12 #"intersection" -0 0 20 3 1 #" " -0 0 20 3 9 #"operator." -0 0 20 3 1 #" " -0 0 20 3 2 #"It" -0 0 20 3 1 #" " -0 0 20 3 9 #"collapses" -0 0 20 3 1 #" " -0 0 20 3 20 #"the containing pairs" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"and " -0 0 29 3 6 #"struct" -0 0 20 3 10 #" types to " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 6 #"moving" -0 0 20 3 1 #" " -0 0 20 3 8 #"outwards" -0 0 20 3 11 #" until the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"operator" -0 0 20 3 1 #" " -0 0 20 3 6 #"itself" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 8 #"reached." -0 0 20 3 1 #" " -0 0 20 3 2 #"In" -0 0 20 3 1 #" " -0 0 20 3 10 #"principle," -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 11 #"propagation" -0 0 20 3 1 #" " -0 0 20 3 5 #"could" -0 0 20 3 1 #" " -0 0 20 3 10 #"go on past" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"that" -0 0 20 3 1 #" " -0 0 20 3 6 #"point," -0 0 20 3 1 #" " -0 0 20 3 3 #"but" -0 0 20 3 1 #" " -0 0 20 3 4 #"this" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 3 #"not" -0 0 20 3 1 #" " -0 0 20 3 11 #"implemented" -0 0 20 3 8 #" yet in " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 2 #"|@" -0 0 14 3 4 #"note" -0 0 24 3 1 #"{" -0 0 20 3 3 #"See" -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @" -0 0 14 3 9 #"hyperlink" -0 0 24 3 1 #"[" -0 0 19 3 50 #"\"https://github.com/racket/typed-racket/issues/552" -0 0 19 3 1 #"\"" -0 0 24 3 2 #"]{" -0 0 20 3 10 #"Issue #552" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 3 #"on " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 54 #"'s GitHub repository for more details on what prevents" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 46 #"implementing a more aggressive propagation of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 24 3 1 #"}" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"The type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 2 #")]" -0 0 20 3 1 #" " -0 0 20 3 9 #"therefore" -0 0 20 3 1 #" " -0 0 20 3 4 #"gets" -0 0 20 3 1 #" " -0 0 20 3 14 #"simplified to " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 9 #"the type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"x" -0 0 24 3 3 #") (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"x" -0 0 24 3 3 #"))]" -0 0 20 3 1 #" " -0 0 20 3 4 #"also" -0 0 20 3 14 #" simplifies to" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 2 #" (" -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 9 #"initially" -0 0 20 3 1 #" " -0 0 20 3 6 #"pushes" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 12 #"intersection" -0 0 20 3 9 #" down the" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"pairs" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 2 #"so" -0 0 20 3 1 #" " -0 0 20 3 4 #"that" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 14 #"first becomes " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Pairof" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 3 #") (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"x" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"x" -0 0 24 3 3 #"))]" -0 0 20 3 1 #"," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 14 #"simplified to " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"x" -0 0 24 3 2 #")]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 14 #" occurrence of" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 10 #"propagates" -0 0 20 3 1 #" " -0 0 20 3 8 #"outwards" -0 0 20 3 1 #")" -0 0 20 3 1 #"." -0 0 20 3 1 #" " -0 0 20 3 8 #"However," -0 0 20 3 1 #" " -0 0 20 3 2 #"if" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"user" -0 0 20 3 19 #" directly specifies" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"the type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Pairof" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 2 #") " -0 0 14 3 7 #"Integer" -0 0 24 3 2 #")]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 2 #"it" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 14 #" simplified to" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 2 #")]" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 8 #"but the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 4 #"does" -0 0 20 3 14 #" not propagate" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"outwards" -0 0 20 3 1 #" " -0 0 20 3 6 #"beyond" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 7 #"initial" -0 0 20 3 1 #" " -0 0 20 3 7 #"use of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 5 #":type" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 5 #":type" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"x" -0 0 24 3 3 #") (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"x" -0 0 24 3 3 #")))" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 5 #":type" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 2 #") " -0 0 14 3 7 #"Integer" -0 0 24 3 3 #"))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"A " -0 0 20 3 7 #"simple " -0 0 20 3 11 #"workaround " -0 0 20 3 8 #"exists: " -0 0 20 3 4 #"the " -0 0 20 3 6 #"outer " -0 0 20 3 6 #"type, " -0 0 20 3 27 #"which could be collapsed to" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 9 #", can be " -0 0 20 3 12 #"intersected " -0 0 20 3 6 #"again " -0 0 20 3 7 #"with a " -0 0 20 3 8 #"type of " -0 0 20 3 4 #"the " -0 0 20 3 15 #"same shape. The" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"outer " -0 0 20 3 13 #"intersection " -0 0 20 3 5 #"will " -0 0 20 3 9 #"traverse " -0 0 20 3 5 #"both " -0 0 20 3 30 #"types (the desired one and the" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 16 #"``shape''), and " -0 0 20 3 23 #"propagate the leftover " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Nothing" -0 0 24 3 1 #"]" -0 0 20 3 13 #" further out." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 5 #":type" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 2 #") " -0 0 14 3 7 #"Integer" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 5 #":type" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"a" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"b" -0 0 24 3 2 #") " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 23 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 3 #"Any" -0 0 24 3 1 #" " -0 0 14 3 3 #"Any" -0 0 24 3 4 #")))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"These " -0 0 20 3 14 #"intersections " -0 0 20 3 8 #"are not " -0 0 20 3 5 #"very " -0 0 20 3 42 #"interesting on their own, as in most cases" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"it" -0 0 20 3 4 #" is " -0 0 20 3 12 #"possible to " -0 0 20 3 12 #"express the " -0 0 20 3 10 #"resulting " -0 0 20 3 11 #"simplified " -0 0 20 3 5 #"type " -0 0 20 3 17 #"without using the" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 13 #"intersection " -0 0 20 3 15 #"operator. They " -0 0 20 3 7 #"become " -0 0 20 3 5 #"more " -0 0 20 3 7 #"useful " -0 0 20 3 5 #"when " -0 0 20 3 22 #"mixed with polymorphic" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"types: " -0 0 20 3 15 #"intersecting a " -0 0 20 3 12 #"polymorphic " -0 0 20 3 5 #"type " -0 0 20 3 9 #"variable " -0 0 20 3 29 #"with another type can be used" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"to " -0 0 20 3 9 #"restrict " -0 0 20 3 4 #"the " -0 0 20 3 7 #"actual " -0 0 20 3 34 #"values that may be used. The type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 14 3 1 #"A" -0 0 24 3 1 #" " -0 0 14 3 1 #"T" -0 0 24 3 2 #")]" -0 0 20 3 1 #"," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"where " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"A" -0 0 24 3 1 #"]" -0 0 20 3 6 #" is a " -0 0 20 3 30 #"polymorphic type variable and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"T" -0 0 24 3 1 #"]" -0 0 20 3 10 #" is a type" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"defined " -0 0 20 3 14 #"elsewhere, is " -0 0 20 3 14 #"equivalent to " -0 0 20 3 11 #"the use of " -0 0 20 3 26 #"bounded type parameters in" -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @|" -0 0 14 3 4 #"java" -0 0 24 3 1 #"|" -0 0 20 3 4 #" or " -0 0 24 3 2 #"@|" -0 0 14 3 6 #"csharp" -0 0 24 3 1 #"|" -0 0 20 3 5 #". In " -0 0 24 3 2 #"@|" -0 0 14 3 6 #"csharp" -0 0 24 3 1 #"|" -0 0 20 3 2 #", " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 7 #"example" -0 0 20 3 11 #", the type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\210\251" -0 0 24 3 1 #" " -0 0 14 3 1 #"A" -0 0 24 3 1 #" " -0 0 14 3 1 #"T" -0 0 24 3 2 #")]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"would be " -0 0 20 3 17 #"written using an " -0 0 24 3 1 #"@" -0 0 14 3 2 #"tt" -0 0 24 3 1 #"[" -0 0 19 3 1 #"\"" -0 0 19 3 5 #"where" -0 0 19 3 1 #" " -0 0 19 3 1 #"A" -0 0 19 3 1 #" " -0 0 19 3 1 #":" -0 0 19 3 2 #" T" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 8 #" clause." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 1 #" " -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"[" -0 0 23 3 5 #"#:tag" -0 0 24 3 1 #" " -0 0 19 3 24 #"\"tr-presentation-structs" -0 0 19 3 1 #"\"" -0 0 24 3 2 #"]{" -0 0 29 3 7 #"Structs" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 21 #"Racket also supports " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 15 3 6 #"struct" -0 0 24 3 1 #"]" -0 0 20 3 36 #"s, which are mappings from fields to" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 10 #"values. A " -0 0 29 3 6 #"struct" -0 0 20 3 33 #" is further distinguished by its " -0 0 29 3 6 #"struct" -0 0 20 3 23 #" type: instances of two" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 29 3 6 #"struct" -0 0 20 3 72 -( - #" types with the same name and fields, declared in separate files, ca" - #"n be" -) 0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 58 -#"differentiated using the predicates associated with these " -0 0 29 3 7 #"structs" -0 0 20 3 2 #". " -0 0 29 3 7 #"Structs" -0 0 20 3 3 #" in" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 26 #"Racket can be seen as the " -0 0 29 3 6 #"analog" -0 0 20 3 42 #" of classes containing only fields (but no" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 12 #"methods) in " -0 0 24 3 1 #"@" -0 0 14 3 6 #"csharp" -0 0 20 3 4 #" or " -0 0 24 3 2 #"@|" -0 0 14 3 4 #"java" -0 0 24 3 1 #"|" -0 0 20 3 47 #". Such classes are sometimes called ``Plain Old" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 22 #"Data (POD) Objects''. " -0 0 29 3 7 #"Structs" -0 0 20 3 42 #" belong to a single-inheritance hierarchy:" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 17 #"instances of the " -0 0 29 3 11 #"descendents" -0 0 20 3 6 #" of a " -0 0 29 3 6 #"struct" -0 0 20 3 29 #" type are recognised by their" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 29 #"ancestor's predicate. When a " -0 0 29 3 6 #"struct" -0 0 20 3 39 #" inherits from another, it includes its" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 53 #"parent's fields, and can add extra fields of its own." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"Each " -0 0 29 3 6 #"struct" -0 0 20 3 22 #" declaration within a " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 30 #" program additionally declares" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 19 #"corresponding type." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"struct" -0 0 24 3 1 #" " -0 0 14 3 6 #"parent" -0 0 24 3 3 #" ([" -0 0 14 3 8 #"field\342\202\201" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 3 #")])" -0 0 24 29 1 #"\n" -0 0 24 3 14 #" " -0 0 23 3 13 #"#:transparent" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"struct" -0 0 24 3 1 #" " -0 0 14 3 1 #"s" -0 0 24 3 1 #" " -0 0 14 3 6 #"parent" -0 0 24 3 3 #" ([" -0 0 14 3 8 #"field\342\202\202" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 31 #" [" -0 0 14 3 8 #"field\342\202\203" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 2 #"])" -0 0 24 29 1 #"\n" -0 0 24 3 14 #" " -0 0 23 3 13 #"#:transparent" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 1 #"s" -0 0 24 3 2 #" (" -0 0 14 3 4 #"cons" -0 0 24 3 1 #" " -0 0 19 3 2 #"\"x" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"y" -0 0 24 3 2 #") " -0 0 21 3 3 #"123" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"z" -0 0 24 3 2 #")]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"In " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 2 #", " -0 0 29 3 7 #"structs" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 4 #"have" -0 0 20 3 1 #" " -0 0 20 3 11 #"polymorphic" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 9 #"arguments" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 7 #" can be" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"used" -0 0 20 3 1 #" " -0 0 20 3 6 #"inside" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"types" -0 0 20 3 1 #" " -0 0 20 3 7 #"of the " -0 0 29 3 8 #"struct's" -0 0 20 3 8 #" fields." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"struct" -0 0 24 3 2 #" (" -0 0 14 3 1 #"A" -0 0 24 3 1 #" " -0 0 14 3 1 #"B" -0 0 24 3 2 #") " -0 0 14 3 6 #"poly-s" -0 0 24 3 3 #" ([" -0 0 14 3 8 #"field\342\202\201" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 1 #"A" -0 0 24 3 1 #" " -0 0 14 3 1 #"B" -0 0 24 3 2 #")]" -0 0 24 29 1 #"\n" -0 0 24 3 35 #" [" -0 0 14 3 8 #"field\342\202\202" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 35 #" [" -0 0 14 3 8 #"field\342\202\203" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 1 #" " -0 0 14 3 1 #"B" -0 0 24 3 2 #"])" -0 0 24 29 1 #"\n" -0 0 24 3 14 #" " -0 0 23 3 13 #"#:transparent" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 14 3 6 #"poly-s" -0 0 24 3 2 #" (" -0 0 14 3 4 #"cons" -0 0 24 3 1 #" " -0 0 19 3 2 #"\"x" -0 0 19 3 1 #"\"" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"y" -0 0 24 3 2 #") " -0 0 21 3 3 #"123" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 14 3 1 #"z" -0 0 24 3 2 #")]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"Racket" -0 0 20 3 17 #" further supports" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 4 #"tech" -0 0 24 3 1 #"[" -0 0 23 3 5 #"#:doc" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 3 #"lib" -0 0 24 3 1 #" " -0 0 19 3 38 #"\"scribblings/reference/reference.scrbl" -0 0 19 3 1 #"\"" -0 0 24 3 3 #")]{" -0 0 29 3 6 #"struct" -0 0 20 3 5 #" type" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 10 #"properties" -0 0 24 3 1 #"}" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 4 #"seen" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 7 #"limited" -0 0 20 3 1 #" " -0 0 20 3 4 #"form" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 6 #"method" -0 0 20 3 1 #" " -0 0 20 3 11 #"definitions" -0 0 20 3 6 #" for a" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 29 3 6 #"struct" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 7 #"thereby" -0 0 20 3 1 #" " -0 0 20 3 6 #"making" -0 0 20 3 1 #" " -0 0 20 3 4 #"them" -0 0 20 3 1 #" " -0 0 20 3 6 #"closer" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 4 #"real" -0 0 20 3 1 #" " -0 0 20 3 8 #"objects." -0 0 20 3 1 #" " -0 0 20 3 9 #"The same " -0 0 29 3 6 #"struct" -0 0 20 3 5 #" type" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"property" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 11 #"implemented" -0 0 20 3 1 #" " -0 0 20 3 8 #"by many " -0 0 29 3 7 #"structs" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 11 #"declaration" -0 0 20 3 1 #" " -0 0 20 3 5 #"of a " -0 0 29 3 6 #"struct" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 8 #"property" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 9 #"therefore" -0 0 20 3 1 #" " -0 0 20 3 7 #"roughly" -0 0 20 3 1 #" " -0 0 20 3 10 #"equivalent" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 11 #"declaration" -0 0 20 3 6 #" of an" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"interface" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 15 #" single method." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 29 3 6 #"Struct" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 10 #"properties" -0 0 20 3 1 #" " -0 0 20 3 3 #"are" -0 0 20 3 1 #" " -0 0 20 3 5 #"often" -0 0 20 3 1 #" " -0 0 20 3 10 #"considered" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 9 #"low-level" -0 0 20 3 1 #" " -0 0 20 3 9 #"mechanism" -0 0 20 3 11 #" in Racket." -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"Among" -0 0 20 3 1 #" " -0 0 20 3 5 #"other" -0 0 20 3 1 #" " -0 0 20 3 6 #"things" -0 0 20 3 4 #", a " -0 0 29 3 6 #"struct" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 8 #"property" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 4 #"only" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 4 #"used" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 6 #"define" -0 0 20 3 9 #" a single" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"property" -0 0 20 3 1 #" " -0 0 20 3 2 #"at" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 5 #"time." -0 0 20 3 1 #" " -0 0 20 3 4 #"When" -0 0 20 3 1 #" " -0 0 20 3 8 #"multiple" -0 0 20 3 1 #" " -0 0 20 3 2 #"``" -0 0 20 3 7 #"methods" -0 0 20 3 2 #"''" -0 0 20 3 1 #" " -0 0 20 3 4 #"have" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 7 #"defined" -0 0 20 3 1 #" " -0 0 20 3 2 #"at" -0 0 20 3 10 #" once (for" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"example" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 4 #"when" -0 0 20 3 1 #" " -0 0 20 3 13 #"defining the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 15 #"prop:equal+hash" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 8 #"property" -0 0 20 3 1 #"," -0 0 20 3 15 #" which requires" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 10 #"definition" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 2 #"an" -0 0 20 3 1 #" " -0 0 20 3 8 #"equality" -0 0 20 3 1 #" " -0 0 20 3 10 #"comparison" -0 0 20 3 1 #" " -0 0 20 3 8 #"function" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"two" -0 0 20 3 1 #" " -0 0 20 3 7 #"hashing" -0 0 20 3 12 #" functions)," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"these" -0 0 20 3 1 #" " -0 0 20 3 3 #"can" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 7 #"grouped" -0 0 20 3 1 #" " -0 0 20 3 8 #"together" -0 0 20 3 1 #" " -0 0 20 3 2 #"in" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 4 #"list" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 9 #"functions" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 4 #"then" -0 0 20 3 8 #" used as" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 8 #"property" -0 0 20 3 9 #"'s value." -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"``" -0 0 24 3 1 #"@" -0 0 14 3 7 #"seclink" -0 0 24 3 1 #"[" -0 0 19 3 16 #"\"struct-generics" -0 0 19 3 1 #"\"" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" " -0 0 23 3 5 #"#:doc" -0 0 24 3 1 #" " -0 0 21 3 1 #"'" -0 0 24 3 1 #"(" -0 0 14 3 3 #"lib" -0 0 24 3 1 #" " -0 0 19 3 38 #"\"scribblings/reference/reference.scrbl" -0 0 19 3 1 #"\"" -0 0 24 3 3 #")]{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 18 #"Generic interfaces" -0 0 24 3 1 #"}" -0 0 20 3 2 #"''" -0 0 20 3 1 #" " -0 0 20 3 3 #"are" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 12 #"higher-level" -0 0 20 3 1 #" " -0 0 20 3 7 #"feature" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 5 #"among" -0 0 20 3 13 #" other things" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"allow" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 10 #"definition" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 8 #"multiple" -0 0 20 3 1 #" " -0 0 20 3 2 #"``" -0 0 20 3 7 #"methods" -0 0 20 3 2 #"''" -0 0 20 3 1 #" " -0 0 20 3 2 #"as" -0 0 20 3 1 #" " -0 0 20 3 4 #"part" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 15 #" single generic" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"interface" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 6 #"offers" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 10 #"friendlier" -0 0 20 3 1 #" " -0 0 20 3 3 #"API" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 10 #"specifying" -0 0 20 3 1 #" " -0 0 20 3 13 #"the ``generic" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"interface" -0 0 20 3 2 #"''" -0 0 20 3 1 #" " -0 0 20 3 6 #"itself" -0 0 20 3 2 #" (" -0 0 20 3 4 #"i.e." -0 0 20 3 1 #" " -0 0 20 3 4 #"what" -0 0 20 3 1 #" " -0 0 20 3 6 #"Object" -0 0 20 3 1 #" " -0 0 20 3 8 #"Oriented" -0 0 20 3 1 #" " -0 0 20 3 9 #"languages" -0 0 20 3 1 #" " -0 0 20 3 8 #"call an " -0 0 29 3 9 #"interfece" -0 0 20 3 5 #"), as" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 10 #"specifying" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 14 #"implementation" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 16 #" said interface." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 13 #"unfortunately" -0 0 20 3 1 #" " -0 0 20 3 6 #"offers" -0 0 20 3 1 #" " -0 0 20 3 2 #"no" -0 0 20 3 1 #" " -0 0 20 3 12 #"support for " -0 0 29 3 6 #"struct" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 15 #" properties and" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"generic" -0 0 20 3 1 #" " -0 0 20 3 10 #"interfaces" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 4 #"now." -0 0 20 3 1 #" " -0 0 20 3 2 #"It" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 10 #"impossible" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 6 #"assert" -0 0 20 3 1 #" " -0 0 20 3 7 #"that a " -0 0 29 3 6 #"struct" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 10 #"implements" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 5 #"given" -0 0 20 3 1 #" " -0 0 20 3 8 #"property" -0 0 20 3 1 #" " -0 0 20 3 2 #"at" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 5 #"level" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 2 #"it" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 4 #"also" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 12 #" example not" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"possible" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 8 #"describe" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 8 #"function" -0 0 20 3 1 #" " -0 0 20 3 14 #"accepting any " -0 0 29 3 6 #"struct" -0 0 20 3 13 #" implementing" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 5 #"given" -0 0 20 3 1 #" " -0 0 20 3 8 #"property" -0 0 20 3 1 #" " -0 0 20 3 2 #"or" -0 0 20 3 1 #" " -0 0 20 3 7 #"generic" -0 0 20 3 1 #" " -0 0 20 3 10 #"interface." -0 0 20 3 1 #" " -0 0 20 3 7 #"Finally" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 2 #"no" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 6 #"checks" -0 0 20 3 14 #" are performed" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"on" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 4 #"body" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 1 #" " -0 0 20 3 9 #"functions" -0 0 20 3 1 #" " -0 0 20 3 5 #"bound" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 4 #"such" -0 0 20 3 1 #" " -0 0 20 3 10 #"properties" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 5 #"check" -0 0 20 3 14 #" verifies that" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 8 #"function" -0 0 20 3 1 #" " -0 0 20 3 14 #"implementation" -0 0 20 3 1 #" " -0 0 20 3 4 #"with" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 5 #"right" -0 0 20 3 1 #" " -0 0 20 3 9 #"signature" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 8 #"supplied" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 8 #" a given" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 16 #"property. Since " -0 0 29 3 6 #"struct" -0 0 20 3 1 #" " -0 0 20 3 4 #"type" -0 0 20 3 1 #" " -0 0 20 3 10 #"properties" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 8 #"generics" -0 0 20 3 1 #" " -0 0 20 3 6 #"cannot" -0 0 20 3 1 #" " -0 0 20 3 2 #"be" -0 0 20 3 1 #" " -0 0 20 3 4 #"used" -0 0 20 3 5 #" in a" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"type-safe" -0 0 20 3 1 #" " -0 0 20 3 3 #"way" -0 0 20 3 1 #" " -0 0 20 3 3 #"for" -0 0 20 3 1 #" " -0 0 20 3 3 #"now" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 2 #"we" -0 0 20 3 1 #" " -0 0 20 3 7 #"refrain" -0 0 20 3 1 #" " -0 0 20 3 4 #"from" -0 0 20 3 1 #" " -0 0 20 3 5 #"using" -0 0 20 3 1 #" " -0 0 20 3 5 #"these" -0 0 20 3 1 #" " -0 0 20 3 8 #"features" -0 0 20 3 1 #"," -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 4 #"only" -0 0 20 3 9 #" use them" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 9 #"implement" -0 0 20 3 1 #" " -0 0 20 3 4 #"some" -0 0 20 3 1 #" " -0 0 20 3 4 #"very" -0 0 20 3 18 #" common properties" -0 0 24 3 1 #"@" -0 0 14 3 4 #"note" -0 0 24 3 1 #"{" -0 0 20 3 2 #"We" -0 0 20 3 1 #" " -0 0 20 3 5 #"built" -0 0 20 3 1 #" " -0 0 20 3 1 #"a" -0 0 20 3 1 #" " -0 0 20 3 4 #"thin" -0 0 20 3 14 #" macro wrapper" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 13 #"which allows " -0 0 29 3 12 #"typechecking" -0 0 20 3 1 #" " -0 0 20 3 3 #"the" -0 0 20 3 1 #" " -0 0 20 3 14 #"implementation" -0 0 20 3 1 #" " -0 0 20 3 3 #"and" -0 0 20 3 1 #" " -0 0 20 3 9 #"signature" -0 0 20 3 1 #" " -0 0 20 3 2 #"of" -0 0 20 3 14 #" the functions" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 20 3 5 #"bound" -0 0 20 3 1 #" " -0 0 20 3 2 #"to" -0 0 20 3 1 #" " -0 0 20 3 5 #"these" -0 0 20 3 16 #" two properties." -0 0 24 3 1 #"}" -0 0 20 3 2 #": " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 17 #"prop:custom-write" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 5 #"which" -0 0 20 3 7 #" is the" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 14 #"equivalent of " -0 0 24 3 2 #"@|" -0 0 14 3 4 #"java" -0 0 24 3 1 #"|" -0 0 20 3 3 #"'s " -0 0 24 3 1 #"@" -0 0 14 3 2 #"tt" -0 0 24 3 1 #"[" -0 0 19 3 1 #"\"" -0 0 19 3 4 #"void" -0 0 19 3 1 #" " -0 0 19 3 10 #"toString()" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 6 #", and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 15 #"prop:equal+hash" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"which" -0 0 20 3 1 #" " -0 0 20 3 2 #"is" -0 0 20 3 1 #" " -0 0 20 3 14 #"equivalent to " -0 0 24 3 2 #"@|" -0 0 14 3 4 #"java" -0 0 24 3 1 #"|" -0 0 20 3 3 #"'s " -0 0 24 3 1 #"@" -0 0 14 3 2 #"tt" -0 0 24 3 1 #"[" -0 0 19 3 1 #"\"" -0 0 19 3 7 #"boolean" -0 0 19 3 1 #" " -0 0 19 3 6 #"equals" -0 0 19 3 1 #"(" -0 0 19 3 6 #"Object" -0 0 19 3 1 #" " -0 0 19 3 2 #"o)" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 4 #" and" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 2 #"tt" -0 0 24 3 1 #"[" -0 0 19 3 1 #"\"" -0 0 19 3 3 #"int" -0 0 19 3 1 #" " -0 0 19 3 10 #"hashCode()" -0 0 19 3 1 #"\"" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" }" -0 0 24 29 1 #"\n" -0 0 24 3 1 #" " -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"[" -0 0 23 3 5 #"#:tag" -0 0 24 3 1 #" " -0 0 19 3 26 #"\"tr-presentation-functions" -0 0 19 3 1 #"\"" -0 0 24 3 2 #"]{" -0 0 20 3 9 #"Functions" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 9 #"supports " -0 0 20 3 5 #"rich " -0 0 20 3 9 #"function " -0 0 20 3 10 #"types, to " -0 0 20 3 28 #"support some of the flexible" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"use " -0 0 20 3 27 #"patterns allowed by Racket." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"The " -0 0 20 3 7 #"simple " -0 0 20 3 9 #"function " -0 0 20 3 11 #"type below " -0 0 20 3 10 #"indicates " -0 0 20 3 5 #"that " -0 0 20 3 24 #"the function expects two" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 14 #"arguments (an " -0 0 20 3 45 #"integer and a string), and returns a boolean:" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #")]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 20 #"We note that unlike " -0 0 24 3 2 #"@|" -0 0 14 3 7 #"haskell" -0 0 24 3 1 #"|" -0 0 20 3 5 #" and " -0 0 24 3 2 #"@|" -0 0 14 3 4 #"CAML" -0 0 24 3 1 #"|" -0 0 20 3 12 #" functions, " -0 0 20 3 20 #"Racket functions are" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"not " -0 0 20 3 11 #"implicitly " -0 0 20 3 12 #"curried. To " -0 0 20 3 8 #"express " -0 0 20 3 4 #"the " -0 0 20 3 14 #"corresponding " -0 0 20 3 22 #"curried function type," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 16 #"one would write:" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 3 #"))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 2 #"A " -0 0 20 3 13 #"function may " -0 0 20 3 13 #"additionally " -0 0 20 3 7 #"accept " -0 0 20 3 9 #"optional " -0 0 20 3 33 #"positional arguments, and keyword" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 6 #"(i.e. " -0 0 20 3 7 #"named) " -0 0 20 3 11 #"arguments, " -0 0 20 3 28 #"both mandatory and optional:" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 1 #"[" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 9 #"Mandatory" -0 0 19 3 1 #" " -0 0 19 3 6 #"string" -0 0 19 3 1 #"," -0 0 19 3 1 #" " -0 0 19 3 8 #"optional" -0 0 19 3 1 #" " -0 0 19 3 7 #"integer" -0 0 19 3 1 #" " -0 0 19 3 3 #"and" -0 0 19 3 1 #" " -0 0 19 3 7 #"boolean" -0 0 19 3 11 #" arguments:" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 3 #"->*" -0 0 24 3 2 #" (" -0 0 14 3 6 #"String" -0 0 24 3 3 #") (" -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #") " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 9 #"Mandatory" -0 0 19 3 1 #" " -0 0 19 3 7 #"keyword" -0 0 19 3 11 #" arguments:" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:size" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 23 3 5 #"#:str" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 9 #"Mandatory" -0 0 19 3 1 #" " -0 0 19 3 5 #"#:str" -0 0 19 3 1 #"," -0 0 19 3 1 #" " -0 0 19 3 8 #"optional" -0 0 19 3 1 #" " -0 0 19 3 6 #"#:size" -0 0 19 3 1 #" " -0 0 19 3 3 #"and" -0 0 19 3 7 #" #:opt:" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 3 #"->*" -0 0 24 3 2 #" (" -0 0 23 3 5 #"#:str" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 3 #") (" -0 0 23 3 6 #"#:size" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 23 3 5 #"#:opt" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #") " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #")]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 13 #"Furthermore, " -0 0 20 3 1 #"f" -0 0 20 3 8 #"unctions" -0 0 20 3 1 #" " -0 0 20 3 2 #"in" -0 0 20 3 1 #" " -0 0 20 3 1 #"R" -0 0 20 3 5 #"acket" -0 0 20 3 1 #" " -0 0 20 3 6 #"accept" -0 0 20 3 37 #" a catch-all ``rest'' argument, which" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"allows " -0 0 20 3 22 #"for the definition of " -0 0 29 3 8 #"variadic" -0 0 20 3 12 #" functions. " -0 0 20 3 6 #"Typed " -0 0 20 3 18 #"racket also allows" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 11 #"expressing " -0 0 20 3 8 #"this at " -0 0 20 3 4 #"the " -0 0 20 3 5 #"type " -0 0 20 3 10 #"level, as " -0 0 20 3 8 #"long as " -0 0 20 3 28 #"the arguments covered by the" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"``rest'' " -0 0 20 3 11 #"clause all " -0 0 20 3 5 #"have " -0 0 20 3 14 #"the same type:" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 1 #"[" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 3 #"The" -0 0 19 3 1 #" " -0 0 19 3 8 #"function" -0 0 19 3 1 #" " -0 0 19 3 7 #"accepts" -0 0 19 3 1 #" " -0 0 19 3 3 #"one" -0 0 19 3 1 #" " -0 0 19 3 7 #"integer" -0 0 19 3 1 #" " -0 0 19 3 3 #"and" -0 0 19 3 1 #" " -0 0 19 3 3 #"any" -0 0 19 3 1 #" " -0 0 19 3 6 #"number" -0 0 19 3 1 #" " -0 0 19 3 2 #"of" -0 0 19 3 9 #" strings:" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 2 #"->" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 1 #"*" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 4 #"Same" -0 0 19 3 1 #" " -0 0 19 3 5 #"thing" -0 0 19 3 1 #" " -0 0 19 3 4 #"with" -0 0 19 3 1 #" " -0 0 19 3 2 #"an" -0 0 19 3 1 #" " -0 0 19 3 8 #"optional" -0 0 19 3 1 #" " -0 0 19 3 6 #"symbol" -0 0 19 3 1 #" " -0 0 19 3 11 #"inbetween: " -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 3 #"->*" -0 0 24 3 2 #" (" -0 0 14 3 7 #"Integer" -0 0 24 3 3 #") (" -0 0 14 3 6 #"Symbol" -0 0 24 3 2 #") " -0 0 23 3 6 #"#:rest" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #")]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"One of " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 31 #"'s main goals is to be able to " -0 0 29 3 9 #"typecheck" -0 0 20 3 10 #" idiomatic" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"Racket " -0 0 20 3 10 #"programs. " -0 0 20 3 5 #"Such " -0 0 20 3 13 #"programs may " -0 0 20 3 8 #"include " -0 0 20 3 10 #"functions " -0 0 20 3 6 #"whose " -0 0 20 3 19 #"return type depends" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"on " -0 0 20 3 4 #"the " -0 0 20 3 10 #"values of " -0 0 20 3 32 #"the input arguments. Similarly, " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 15 3 11 #"case-lambda" -0 0 24 3 1 #"]" -0 0 20 3 7 #" can be" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 32 #"used to create lambda functions " -0 0 20 3 6 #"which " -0 0 20 3 12 #"dispatch to " -0 0 20 3 28 #"multiple behaviours based on" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 14 #"the number of " -0 0 20 3 33 #"arguments passed to the function." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 1 #"|" -0 0 20 3 14 #" provides the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"case\342\206\222" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 35 #"type operator, which can be used to" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"describe " -0 0 20 3 4 #"the " -0 0 20 3 24 #"type of these functions:" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 1 #"[" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 6 #"Allows" -0 0 19 3 1 #" " -0 0 19 3 1 #"1" -0 0 19 3 1 #" " -0 0 19 3 2 #"or" -0 0 19 3 1 #" " -0 0 19 3 1 #"3" -0 0 19 3 1 #" " -0 0 19 3 9 #"arguments" -0 0 19 3 1 #"," -0 0 19 3 1 #" " -0 0 19 3 4 #"with" -0 0 19 3 1 #" " -0 0 19 3 3 #"the" -0 0 19 3 1 #" " -0 0 19 3 4 #"same" -0 0 19 3 1 #" " -0 0 19 3 6 #"return" -0 0 19 3 6 #" type." -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 7 #"case\342\206\222" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 9 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 1 #"A" -0 0 19 3 1 #" " -0 0 19 3 7 #"similar" -0 0 19 3 1 #" " -0 0 19 3 4 #"type" -0 0 19 3 1 #" " -0 0 19 3 5 #"based" -0 0 19 3 1 #" " -0 0 19 3 2 #"on" -0 0 19 3 1 #" " -0 0 19 3 8 #"optional" -0 0 19 3 1 #" " -0 0 19 3 9 #"arguments" -0 0 19 3 1 #" " -0 0 19 3 6 #"allows" -0 0 19 3 1 #" " -0 0 19 3 1 #"1" -0 0 19 3 1 #"," -0 0 19 3 1 #" " -0 0 19 3 1 #"2" -0 0 19 3 1 #" " -0 0 19 3 2 #"or" -0 0 19 3 2 #" 3" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 1 #" " -0 0 19 3 9 #"arguments" -0 0 19 3 1 #" " -0 0 19 3 2 #"in" -0 0 19 3 10 #" contrast:" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 3 #"->*" -0 0 24 3 2 #" (" -0 0 14 3 7 #"Integer" -0 0 24 3 3 #") (" -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 2 #") " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 3 #"The" -0 0 19 3 1 #" " -0 0 19 3 6 #"output" -0 0 19 3 1 #" " -0 0 19 3 4 #"type" -0 0 19 3 1 #" " -0 0 19 3 3 #"can" -0 0 19 3 1 #" " -0 0 19 3 6 #"depend" -0 0 19 3 1 #" " -0 0 19 3 2 #"on" -0 0 19 3 1 #" " -0 0 19 3 3 #"the" -0 0 19 3 1 #" " -0 0 19 3 5 #"input" -0 0 19 3 6 #" type:" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 7 #"case\342\206\222" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 9 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 4 #"Both" -0 0 19 3 1 #" " -0 0 19 3 8 #"features" -0 0 19 3 2 #" (" -0 0 19 3 5 #"arity" -0 0 19 3 1 #" " -0 0 19 3 3 #"and" -0 0 19 3 1 #" " -0 0 19 3 9 #"dependent" -0 0 19 3 1 #" " -0 0 19 3 6 #"output" -0 0 19 3 1 #" " -0 0 19 3 4 #"type" -0 0 19 3 2 #") " -0 0 19 3 3 #"can" -0 0 19 3 1 #" " -0 0 19 3 2 #"be" -0 0 19 3 6 #" mixed" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 7 #"case\342\206\222" -0 0 24 3 2 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 9 #" (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Listof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 4 #")))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"Another " -0 0 20 3 19 #"important feature, " -0 0 20 3 13 #"which can be " -0 0 20 3 9 #"found in " -0 0 20 3 23 #"the type system of most" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 11 #"functional " -0 0 20 3 12 #"programming " -0 0 20 3 49 #"languages, and most object-oriented languages, is" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 25 #"parametric polymorphism. " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 1 #"|" -0 0 20 3 1 #" " -0 0 20 3 7 #"allows " -0 0 20 3 29 #"the definition of polymorphic" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 29 3 7 #"structs" -0 0 20 3 5 #", as " -0 0 20 3 19 #"detailed above, as " -0 0 20 3 8 #"well as " -0 0 20 3 12 #"polymorphic " -0 0 20 3 27 #"functions. For example, the" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"function " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 4 #"cons" -0 0 24 3 1 #"]" -0 0 20 3 35 #" can be considered as a polymorphic" -0 0 20 3 10 #" function " -0 0 20 3 4 #"with" -0 0 20 3 4 #" two" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 11 #"polymorphic" -0 0 20 3 1 #" " -0 0 20 3 15 #"type arguments " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"A" -0 0 24 3 1 #"]" -0 0 20 3 5 #" and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"B" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 20 3 24 #" which takes an argument" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"of type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"A" -0 0 24 3 1 #"]" -0 0 20 3 22 #", an argument of type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"B" -0 0 24 3 1 #"]" -0 0 20 3 23 #", and returns a pair of" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"A" -0 0 24 3 1 #"]" -0 0 20 3 5 #" and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"B" -0 0 24 3 1 #"]" -0 0 20 3 1 #"." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\210\200" -0 0 24 3 2 #" (" -0 0 14 3 1 #"A" -0 0 24 3 1 #" " -0 0 14 3 1 #"B" -0 0 24 3 3 #") (" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 1 #"A" -0 0 24 3 1 #" " -0 0 14 3 1 #"B" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 1 #"A" -0 0 24 3 1 #" " -0 0 14 3 1 #"B" -0 0 24 3 4 #")))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 5 #"htodo" -0 0 24 3 1 #"{" -0 0 20 3 13 #"Something on " -0 0 20 3 54 #"which types can be inferred and which can't (for now)." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 9 #"Finally, " -0 0 20 3 12 #"predicates (" -0 0 20 3 10 #"functions " -0 0 20 3 36 #"whose results can be interpreted as " -0 0 29 3 8 #"booleans" -0 0 20 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 15 #"can be used to " -0 0 20 3 5 #"gain " -0 0 20 3 12 #"information " -0 0 20 3 6 #"about " -0 0 20 3 4 #"the " -0 0 20 3 8 #"type of " -0 0 20 3 28 #"their argument, depending on" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"the " -0 0 20 3 12 #"result. The " -0 0 20 3 10 #"type of a " -0 0 20 3 52 #"predicate can include positive and negative filters," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 15 #"indicated with " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 23 3 3 #"#:+" -0 0 24 3 1 #"]" -0 0 20 3 5 #" and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 23 3 3 #"#:-" -0 0 24 3 1 #"]" -0 0 20 3 31 #", respectively. The type of the" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"string?" -0 0 24 3 1 #"]" -0 0 20 3 14 #" predicate is:" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"\342\206\222" -0 0 24 3 1 #" " -0 0 14 3 3 #"Any" -0 0 24 3 1 #" " -0 0 14 3 7 #"Boolean" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 1 #" " -0 0 23 3 3 #"#:+" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 23 3 3 #"#:-" -0 0 24 3 2 #" (" -0 0 14 3 1 #"!" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 3 #"))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"In " -0 0 20 3 5 #"this " -0 0 20 3 10 #"notation, " -0 0 20 3 20 #"the positive filter " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 23 3 3 #"#:+" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #"]" -0 0 20 3 20 #" indicates that when" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 22 #"the predicate returns " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 5 #"#true" -0 0 24 3 1 #"]" -0 0 20 3 2 #", " -0 0 20 3 29 #"the argument is known to be a" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"String" -0 0 24 3 1 #"]" -0 0 20 3 19 #". Conversely, when " -0 0 20 3 4 #"the " -0 0 20 3 21 #"predicate exits with " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 21 3 6 #"#false" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 20 #"the negative filter " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 23 3 3 #"#:-" -0 0 24 3 2 #" (" -0 0 14 3 1 #"!" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 2 #")]" -0 0 20 3 11 #" indicates " -0 0 20 3 5 #"that " -0 0 20 3 19 #"the input could not" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 1 #"(" -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"!" -0 0 24 3 1 #"]" -0 0 20 3 2 #") " -0 0 20 3 9 #"possibly " -0 0 20 3 12 #"have been a " -0 0 20 3 12 #"string. The " -0 0 20 3 12 #"information " -0 0 20 3 15 #"gained this way" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 7 #"allows " -0 0 20 3 20 #"regular conditionals" -0 0 20 3 1 #" " -0 0 20 3 9 #"based on " -0 0 20 3 33 #"arbitrary predicates to work like" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 17 #"pattern-matching:" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 8 #"examples" -0 0 24 3 1 #"[" -0 0 23 3 7 #"#:label" -0 0 24 3 1 #" " -0 0 21 3 2 #"#f" -0 0 24 3 1 #" " -0 0 23 3 6 #"#:eval" -0 0 24 3 2 #" (" -0 0 14 3 7 #"tr-eval" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 13 #" (" -0 0 15 3 6 #"define" -0 0 24 3 2 #" (" -0 0 14 3 1 #"f" -0 0 24 3 2 #" [" -0 0 14 3 1 #"x" -0 0 24 3 1 #" " -0 0 14 3 1 #":" -0 0 24 3 2 #" (" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 3 #")])" -0 0 24 29 1 #"\n" -0 0 24 3 15 #" (" -0 0 14 3 2 #"if" -0 0 24 3 2 #" (" -0 0 14 3 7 #"string?" -0 0 24 3 1 #" " -0 0 14 3 1 #"x" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 19 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 1 #"x" -0 0 19 3 1 #" " -0 0 19 3 2 #"is" -0 0 19 3 1 #" " -0 0 19 3 5 #"known" -0 0 19 3 1 #" " -0 0 19 3 2 #"to" -0 0 19 3 1 #" " -0 0 19 3 2 #"be" -0 0 19 3 1 #" " -0 0 19 3 1 #"a" -0 0 19 3 1 #" " -0 0 19 3 6 #"String" -0 0 19 3 6 #" here:" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 19 #" (" -0 0 14 3 3 #"ann" -0 0 24 3 1 #" " -0 0 14 3 1 #"x" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 19 #" (" -0 0 14 3 12 #"code:comment" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 1 #"x" -0 0 19 3 1 #" " -0 0 19 3 2 #"is" -0 0 19 3 1 #" " -0 0 19 3 5 #"known" -0 0 19 3 1 #" " -0 0 19 3 2 #"to" -0 0 19 3 1 #" " -0 0 19 3 2 #"be" -0 0 19 3 1 #" " -0 0 19 3 1 #"a" -0 0 19 3 1 #" " -0 0 19 3 6 #"Number" -0 0 19 3 1 #" " -0 0 19 3 2 #"or" -0 0 19 3 1 #" " -0 0 19 3 1 #"a" -0 0 19 3 1 #" " -0 0 19 3 6 #"Symbol" -0 0 19 3 6 #" here:" -0 0 19 3 1 #"\"" -0 0 24 3 1 #")" -0 0 24 29 1 #"\n" -0 0 24 3 19 #" (" -0 0 14 3 3 #"ann" -0 0 24 3 1 #" " -0 0 14 3 1 #"x" -0 0 24 3 2 #" (" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 14 3 6 #"Number" -0 0 24 3 1 #" " -0 0 14 3 6 #"Symbol" -0 0 24 3 5 #"))))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 4 #"The " -0 0 20 3 20 #"propositions do not " -0 0 20 3 12 #"necessarily " -0 0 20 3 8 #"need to " -0 0 20 3 9 #"refer to " -0 0 20 3 21 #"the value as a whole," -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 8 #"and can " -0 0 20 3 8 #"instead " -0 0 20 3 5 #"give " -0 0 20 3 12 #"information " -0 0 20 3 8 #"about a " -0 0 20 3 8 #"sub-part" -0 0 20 3 4 #" of " -0 0 20 3 25 #"the value. Right now, the" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"user " -0 0 20 3 14 #"interface for " -0 0 20 3 21 #"specifying paths can " -0 0 20 3 5 #"only " -0 0 20 3 7 #"target " -0 0 20 3 4 #"the " -0 0 20 3 22 #"left and right members" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 4 #"cons" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 32 #"pairs, recursively. Internally, " -0 0 24 3 2 #"@|" -0 0 14 3 11 #"typedracket" -0 0 24 3 1 #"|" -0 0 20 3 9 #" supports" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 14 #"richer paths, " -0 0 20 3 4 #"and " -0 0 20 3 1 #"t" -0 0 20 3 3 #"he " -0 0 20 3 4 #"type" -0 0 20 3 15 #" inference can " -0 0 20 3 8 #"produce " -0 0 20 3 18 #"filters which give" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 11 #"information" -0 0 20 3 1 #" " -0 0 20 3 5 #"about" -0 0 20 3 1 #" " -0 0 20 3 10 #"individual" -0 0 20 3 22 #" structure fields, or " -0 0 20 3 6 #"about " -0 0 20 3 20 #"the result of forced" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 22 #"promises, for example." -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"[" -0 0 23 3 5 #"#:tag" -0 0 24 3 1 #" " -0 0 19 3 1 #"\"" -0 0 19 3 32 #"tr-presentation-recursive-types\"" -0 0 24 3 2 #"]{" -0 0 20 3 15 #"Recursive types" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" " -0 0 24 29 1 #"\n" -0 0 24 3 4 #" @|" -0 0 14 3 11 #"Typedracket" -0 0 24 3 1 #"|" -0 0 20 3 8 #" allows " -0 0 20 3 10 #"recursive " -0 0 20 3 7 #"types, " -0 0 20 3 10 #"both via (" -0 0 20 3 8 #"possibly" -0 0 20 3 1 #" " -0 0 20 3 19 #"mutually-recursive)" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"named" -0 0 20 3 27 #" declarations, and via the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"Rec" -0 0 24 3 1 #"]" -0 0 20 3 15 #" type operator." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"In " -0 0 20 3 14 #"the following " -0 0 20 3 20 #"examples, the types " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"Foo" -0 0 24 3 1 #"]" -0 0 20 3 5 #" and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"Bar" -0 0 24 3 1 #"]" -0 0 20 3 4 #" are" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 29 #"mutually recursive. The type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"Foo" -0 0 24 3 1 #"]" -0 0 20 3 9 #" matches " -0 0 20 3 6 #"lists " -0 0 20 3 22 #"with an even number of" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 12 #"alternating " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Integer" -0 0 24 3 1 #"]" -0 0 20 3 5 #" and " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 6 #"String" -0 0 24 3 1 #"]" -0 0 20 3 27 #" elements, starting with an" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 7 #"Integer" -0 0 24 3 1 #"]" -0 0 20 3 1 #"," -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 1 #"[" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 15 3 11 #"define-type" -0 0 24 3 1 #" " -0 0 14 3 3 #"Foo" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 3 1 #" " -0 0 14 3 3 #"Bar" -0 0 24 3 2 #"))" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 15 3 11 #"define-type" -0 0 24 3 1 #" " -0 0 14 3 3 #"Bar" -0 0 24 3 2 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 3 2 #" (" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 14 3 3 #"Foo" -0 0 24 3 1 #" " -0 0 14 3 4 #"Null" -0 0 24 3 4 #")))]" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 5 #"This " -0 0 20 3 5 #"same " -0 0 20 3 5 #"type " -0 0 20 3 6 #"could " -0 0 20 3 17 #"alternatively be " -0 0 20 3 18 #"defined using the " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 3 #"Rec" -0 0 24 3 1 #"]" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 23 #"operator. The notation " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 2 #"[(" -0 0 14 3 3 #"Rec" -0 0 24 3 1 #" " -0 0 14 3 1 #"R" -0 0 24 3 1 #" " -0 0 14 3 1 #"T" -0 0 24 3 2 #")]" -0 0 20 3 1 #" " -0 0 20 3 16 #"builds the type " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"T" -0 0 24 3 1 #"]" -0 0 20 3 7 #", where" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 15 #"occurrences of " -0 0 24 3 1 #"@" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"R" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 4 #"are " -0 0 20 3 39 #"interpreted as recursive occurrences of" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"racket" -0 0 24 3 1 #"[" -0 0 14 3 1 #"T" -0 0 24 3 1 #"]" -0 0 20 3 8 #" itself." -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 11 #"racketblock" -0 0 24 3 1 #"[" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" (" -0 0 14 3 3 #"Rec" -0 0 24 3 1 #" " -0 0 14 3 1 #"R" -0 0 24 29 1 #"\n" -0 0 24 3 7 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 7 #"Integer" -0 0 24 29 1 #"\n" -0 0 24 3 15 #" (" -0 0 14 3 6 #"Pairof" -0 0 24 3 1 #" " -0 0 14 3 6 #"String" -0 0 24 29 1 #"\n" -0 0 24 3 23 #" (" -0 0 14 3 1 #"U" -0 0 24 3 1 #" " -0 0 14 3 1 #"R" -0 0 24 3 1 #" " -0 0 14 3 4 #"Null" -0 0 24 3 6 #"))))]}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"{" -0 0 20 3 7 #"Classes" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 3 #"The" -0 0 20 3 1 #" " -0 0 24 3 1 #"@" -0 0 14 3 13 #"racketmodname" -0 0 24 3 1 #"[" -0 0 14 3 12 #"racket/class" -0 0 24 3 1 #"]" -0 0 20 3 1 #" " -0 0 20 3 6 #"module" -0 0 20 3 1 #" " -0 0 20 3 8 #"provides" -0 0 20 3 30 #" an object-oriented system for" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 11 #"Racket. It " -0 0 20 3 9 #"supports " -0 0 20 3 4 #"the " -0 0 20 3 14 #"definition of " -0 0 20 3 8 #"classes " -0 0 20 3 5 #"with " -0 0 20 3 12 #"methods and " -0 0 20 3 7 #"fields." -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" " -0 0 20 3 26 #"We will not describe this " -0 0 24 29 1 #"\n" -0 0 24 3 2 #" }" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"{" -0 0 20 3 17 #"Occurrence typing" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" }" -0 0 24 29 1 #"\n" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" @" -0 0 14 3 8 #"asection" -0 0 24 3 1 #"{" -0 0 24 29 1 #"\n" -0 0 24 3 3 #" @" -0 0 14 3 6 #"atitle" -0 0 24 3 1 #"{" -0 0 20 3 21 #"Global type inference" -0 0 24 3 1 #"}" -0 0 24 29 1 #"\n" -0 0 24 3 2 #" }" -0 0 24 29 1 #"\n" -0 0 24 3 1 #"}" -0 0 +@(define tr-eval (make-eval-factory '(typed/racket))) + +@title[#:style (with-html5 manual-doc-style) + #:version (version-text) + #:tag "tr-chap"]{@|Typedracket|} + +We start this section with some history: Lisp, @emph{the} language with lots +of parentheses, shortly following Fortran as one of the first high-level +programming languages, was initially designed between 1956 and 1958, and +subsequently implemented@~cite["McCarthyHistoryLisp"]. Dialects of Lisp +generally support a variety of programming paradigms, including (but not +limited to) functional programming and object-oriented programming (e.g. via +CLOS, the Common Lisp Object System). One of the the most proeminent aspects +of Lisp is homoiconicity, the fact that programs and data structures look the +same. This enables programs to easily manipulate other programs, and led to +the extensive use of macros. Uses of macros usually look like function +applications, but, instead of invoking a target function at run-time, a macro +will perform some computation at compile-time, and expand to some new code, +which is injected as a replacement of the macro's use. + +The two main dialects of Lisp are Common Lisp and Scheme. Scheme follows a +minimalist philosophy, where a small core is +standardised@~cite["r5rs" "r6rs" "r7rs"] and subsequently extended via macros +and additional function definitions. + +Racket, formerly named PLT Scheme, started as a Scheme implementation. Racket +evolved, and the Racket Manifesto@~cite["racketmanifesto"] presents it as a +``programming-language programming language'', a language which helps with the +creation of small linguistic extensions as well as entirely new languages. The +Racket ecosystem features many languages covering many paradigms: + +@itemlist[ + @item{The @racketmodname[racket/base] language is a full-featured programming + language which mostly encourages functional programming.} + @item{@racketmodname[racket/class] implements + @seclink["classes" #:doc '(lib "scribblings/guide/guide.scrbl")]{an + object-oriented system}, implemented atop @racketmodname[racket/base] using + macros, and can be used along with the rest of the @racketmodname[racket/base] + language.} + @item{@racketmodname[racklog] is a logic programming language in the style of + prolog. The Racket ecosystem also includes an implementation of + @racketmodname[datalog].} + @item{@seclink["top" #:doc '(lib "scribblings/scribble/scribble.scrbl")]{ + Scribble} can be seen as an alternative to @|LaTeX|, and is used to create + the @seclink["top" #:doc '(lib "scribblings/main/start.scrbl")]{Racket + documentation}. It also supports literate programming, by embedding chunks of + code in the document which are then aggregated together. This thesis is + in fact written using Scribble.} + @item{@racketmodname[slideshow] is a @deftech{DSL} (domain-specific language) + for the creation of presentations, and can be thought as an alternative to + Beamer and SliTeX.} + @item{@racketmodname[r5rs] and @racketmodname[r6rs] are implementations of + the corresponding scheme standards.} + @item{@seclink["top" #:doc '(lib "redex/redex.scrbl")]{Redex} is a + @usetech{DSL} which allows the specification of reduction + semantics for programming languages. It features tools to explore and test + the defined semantics.} + @item{@|Typedracket|@~cite["tobin-hochstadt_design_2008" + "tobin-hochstadt_typed_2010"] is a typed variant of + the main @racketmodname[racket] language. It is implemented as a macro which + takes over the whole body of the program. That macro fully expands all other + macros in the program, and then typechecks the expanded program.} + @item{@seclink["top" #:doc '(lib "turnstile/scribblings/turnstile.scrbl")]{ + @|Turnstile|} allows the creation of new typed languages. It takes a + different approach when compared to @|typedracket|, and threads the type + information through assignments and special forms, in order to be able to + typecheck the program during expansion, instead of doing so afterwards.}] + +In the remainder of this section, we will present the features of +@|typedracket|'s type system, and then present formal semantics for a subset +of those, namely the part which is relevant to our work. +@other-doc['(lib "typed-racket/scribblings/ts-guide.scrbl")] and +@other-doc['(lib "typed-racket/scribblings/ts-reference.scrbl")] provide good +documentation for programmers who desire to use @|typedracket|; we will +therefore keep our overview succinct and gloss over most details. + +@asection{ + @atitle{Overview of Typed Racket's type system} + + @asection{ + @atitle{Simple primitive types} + + @Typedracket has types matching Racket's baggage of primitive values: + @racket[Number], @racket[Boolean], @racket[Char], @racket[String], + @racket[Void]@note{The @racket[Void] type contains only a single value, + @racket[#,(void)], and is equivalent to the @racketid[void] type in + @|C-language|. It is the equivalent of @racketid[unit] of @CAML and + @|haskell|, and is often used as the return type of functions which perform + side-effects. It should not be confused with @racket[Nothing], the bottom + type which is not inhabited by any value, and is similar to the type of + @|haskell|'s @racketid[undefined]. @racket[Nothing] can be used for example + as the type of functions which never return — in that way it is similar to + @|C-language|'s @tt["__attribute__ ((__noreturn__))"].} and so on. + + @examples[#:label #f #:eval (tr-eval) + (ann #true Boolean) + 243 + "Hello world" + #\c + (code:comment "The void function produces the void value") + (code:comment "Void values on their own are not printed,") + (code:comment "so we place it in a list to make it visible.") + (list (void))] + + For numbers, @|typedracket| offers a ``numeric tower'' of + partially-overlapping types: @racket[Positive-Integer] is a subtype of + @racket[Integer], which is itself a subtype of @racket[Number]. @racket[Zero], + the type containing only the number 0, is a both a subtype of + @racket[Nonnegative-Integer] (numbers ≥ 0) and of @racket[Nonpositive-Integer] + (numbers ≤ 0). + + @|Typedracket| also includes a singleton type for each primitive value of + these types: we already mentioned @racket[Zero], which is an alias of the + @racket[0] type. Every number, character, string and boolean value can be used + as a type, which is only inhabited by the same number, character, string or + boolean value. For example, @racket[243] belongs to the singleton type + @racket[243], which is a subtype of @racket[Positive-Integer]. + + @examples[#:label #f #:eval (tr-eval) + 0 + (ann 243 243) + #t]} + + @asection{ + @atitle{Pairs and lists} + + Pairs are the central data structure of most Lisp dialects. They are used to + build linked lists of pairs, terminated by @racket['()], the null element. The + null element has the type @racket[Null], while the pairs which build the list + have the type @racket[(Pairof _A _B)], where @racketid[_A] and @racketid[_B] + are replaced by the actual types for the first and second elements of the + pair. For example, the pair built using @racket[(cons 729 #true)], which + contains @racket[729] as its first element, and @racket[#true] as its second + element, has the type @racket[(Pairof Number Boolean)], or using the most + precise singleton types, @racket[(Pairof 729 #true)]. + + @examples[#:label #f #:eval (tr-eval) + (cons 729 #true) + '(729 . #true)] + + Heterogeneous linked lists of fixed length can be given a precise type by + nesting the same number of pairs at the type level. For example, the list + built with @racket[(list 81 #true 'hello)] has the type + @racket[(List Number Boolean Symbol)], which is a shorthand for the type + @racket[(Pairof Number (Pairof Boolean (Pairof Symbol Null)))]. Lists in + @|typedracket| can thus be seen as the equivalent of a chain of nested + 2-tuples in languages like @|CAML| or @|haskell|. The analog in + object-oriented languages with support for generics would be a class + @tt["Pair<A, B>"], where the generic type argument @racketid[B] could be + instantiated by another instance of @tt["Pair"], and so on. + + @examples[#:label #f #:eval (tr-eval) + (cons 81 (cons #true (cons 'hello null))) + (ann (list 81 #true 'hello) + (Pairof Number (Pairof Boolean (Pairof Symbol Null))))] + + The type of variable-length homogeneous linked lists can be described using + the @racket[Listof] type operator. The type @racket[(Listof Integer)] is + equivalent to @racket[(Rec R (U (Pairof Integer R) Null))]. The @racket[Rec] + type operator describes @seclink["tr-presentation-recursive-types"]{recursive + types}, and @racket[U] describes @seclink["tr-presentation-unions"]{unions}. + Both of these features are described below, for now we will simply say that + the previously given type is a recursive type @racket[R], which can be a + @racket[(Pairof Integer R)] or @racket[Null] (to terminate the linked list). + + @examples[#:label #f #:eval (tr-eval) + (ann (range 0 5) (Listof Number))]} + + @asection{ + @atitle{Symbols} + + Another of Racket's primitive datatypes is symbols. Symbols are interned + strings: two occurrences of a symbol produce values which are pointer-equal if + the symbols are equal (i.e. they represent the same string)@note{This is true + with the exception of symbols created with @racket[gensym] and the like. + @racket[gensym] produces a fresh symbol which is not interned, and therefore + different from all existing symbols, and different from all symbols created + in the future.}. + + @|Typedracket| includes the @racket[Symbol] type, to which all symbols + belong. Additionally, there is a singleton type for each symbol: the type + @racket['foo] is only inhabited by the symbol @racket['foo]. + + @examples[#:label #f #:eval (tr-eval) + 'foo] + + Singleton types containing symbols can be seen as similar to constructors + without arguments in @|CAML| and @|haskell|, and as globally unique enum + values in object-oriented languages. The main difference resides in the scope + of the declaration: two constructor declarations with identical names in two + separate files will usually give distinct types and values. Similarly, when + using the ``type-safe enum'' design pattern, two otherwise identical + declarations of an enum will yield objects of different types. In contrast, + two uses of an interned symbols in Racket and @|typedracket| will produce + identical values and types. A way of seeing this is that symbols are similar + to constructors (in the functional programming sense) or enums which are + implicitly declared globally. + + @examples[#:label #f #:eval (tr-eval) + (module m1 typed/racket + (define sym1 'foo) + (provide sym1)) + (module m2 typed/racket + (define sym2 'foo) + (provide sym2)) + (require 'm1 'm2) + (code:comment "The tow independent uses of 'foo are identical:") + (eq? sym1 sym2)] + } + + @asection{ + @atitle[#:tag "tr-presentation-unions"]{Unions} + + These singleton types may not seem very useful on their own. They can however + be combined together with union types, which are built using the @racket[U] + type operator. + + The union type @racket[(U 0 1 2)] is inhabited by the values @racket[0], + @racket[1] and @racket[2], and by no other value. The @racket[Boolean] type is + actually defined as @racket[(U #true #false)], i.e. the union of the singleton + types containing the @racket[#true] and @racket[#false] values, respectively. + The @racket[Nothing] type, which is not inhabited by any value, is defined as + the empty union @racket[(U)]. The type @racket[Any] is the top type, i.e. it + is a super-type of all other types, and can be seen as a large union including + all other types, including those which will be declared later or in other + units of code. + + Unions of symbols are similar to variants which contain zero-argument + constructors, in @|CAML| or @|haskell|. + + @examples[#:label #f #:eval (tr-eval) + (define v : (U 'foo 'bar) 'foo) + v + (set! v 'bar) + v + (code:comment "This throws an error at compile-time:") + (eval:error (set! v 'oops))] + + A union such as @racket[(U 'ca (List 'cb Number) (List 'cc String Symbol))] + can be seen as roughly the equivalent of a variant with three constructors, + @racketid[ca], @racket[cb] and @racketid[cc], where the first has no + arguments, the second has one argument (a @racket[Number]), and the third has + two arguments (a @racket[String] and a @racket[Symbol]). + + The main difference is that a symbol can be used as parts of several unions, + e.g. @racket[(U 'a 'b)] and @racket[(U 'b 'c)], while constructors can often + only be part of the variant used to declare them. Unions of symbols are in + this sense closer to @|CAML|'s so-called polymorphic + variants@~cite["minskyRealWorldOCaml"] than to regular variants. + + @examples[#:label #f #:eval (tr-eval) + (define-type my-variant (U 'ca + (List 'cb Number) + (List 'cc String Symbol))) + (define v₁ : my-variant 'ca) + (define v₂ : my-variant (list 'cb 2187)) + (define v3 : my-variant (list 'cc "Hello" 'world))] + + Finally, it is possible to mix different sorts of types within the same + union: the type @racket[(U 0 #true 'other)] is inhabited by the number + @racket[0], the boolean @racket[#true], and the symbol @racket['other]. + Translating such an union to a language like @|CAML| could be done by + explicitly tagging each case of the union with a distinct constructor. + + Implementation-wise, all values in the so-called ``untyped'' version of + Racket are tagged: a few bits within the value's representation are reserved + and used to encode the value's type. When considering the target of a pointer + in memory, Racket is therefore able to determine if the pointed-to value is a + number, boolean, string, symbol and so on. Typed Racket preserves these + run-time tags. They can then be used to detect the concrete type of a value + when its static type is a union. This detection is done simply by using + Racket's predicates: @racket[number?], @racket[string?], @racket[symbol?] + etc.} + + @asection{ + @atitle{Intersections} + + Intersections are the converse of unions: instead of allowing a mixture of + values of different types, an intersection type, described using the + @racket[∩] type operator, only allows values which belong to all types. + + The intersection type @racket[(∩ Nonnegative-Integer Nonpositive-Integer)] is + the singleton type @racket[0]. The intersection of @racket[(U 'a 'b 'c)] and + @racket[(U 'b 'c 'd)] will be @racket[(U 'b 'c)], as @racket['b] and + @racket['c] belong to both unions. + + @examples[ + #:label #f #:eval (tr-eval) + (code:comment ":type shows the given type, or a simplified version of it") + (:type (∩ (U 'a 'b 'c) (U 'b 'c 'd)))] + + @|Typedracket| is able to reduce some intersections such as those given above + at compile-time. However, in some cases, it is forced to keep the intersection + type as-is. For example, structs (@seclink["tr-presentation-structs"]{ + describled below} can, using special properties, impersonate functions. This + mechanism is similar to PHP's @tt["__invoke"], the ability to overload + @tt["operator()"] in @|CPP|. @|Typedracket| does not handle these properties + (yet), and therefore cannot determine whether a given struct type also + impersonates a function or not. This means that the intersection + @racket[(∩ s (→ Number String))], where @racket[s] is a struct type, cannot be + reduced to @racket[Nothing], because @|typedracket| cannot determine whether + the struct @racket[s] can act as a function or not. + + Another situation where @|typedracket| cannot reduce the intersection is when + intersecting two function types (@seclink["tr-presentation-functions"]{ + presented below}). + + @racketblock[ + (∩ (→ Number String) (→ Number Symbol)) + (∩ (→ Number String) (→ Boolean String))] + + The first intersection seems like could be simplified to + @racket[(→ Number String) (→ Number Symbol)], and the second one could be + simplified to @racket[(→ (U Number Boolean) String)], however the equivalence + between these types has not been implemented (yet) in @|typedracket|, so we do + not rely on them. Note that this issue is not a soundness issue: it only + prevents passing values types to which they belong in principle, but it + cannot be exploited to assign a value to a variable with an incompatible type. + + Finally, when some types are intersected with a polymorphic type variable, + the intersection cannot be computed until the polymorphic type is + instantiated. + + When @|typedracket| is able to perform a simplification, occurrences of + @racket[Nothing] (the bottom type) propagate outwards in some cases, pairs and + struct types which contain @racket[Nothing] as one of their elements being + collapsed to @racket[Nothing]. This propagation of @racket[Nothing] starts + from occurrences of @racket[Nothing] in the parts of the resulting type which + are traversed by the intersection operator. It collapses the containing pairs + and struct types to @racket[Nothing], moving outwards until the @racket[∩] + operator itself is reached. In principle, the propagation could go on past + that point, but this is not implemented yet in @|typedracket|@note{See + @hyperlink["https://github.com/racket/typed-racket/issues/552"]{Issue #552} + on @|typedracket|'s GitHub repository for more details on what prevents + implementing a more aggressive propagation of @racket[Nothing].}. + + The type @racket[(∩ 'a 'b)] therefore gets simplified to @racket[Nothing], + and the type @racket[(∩ (Pairof 'a 'x) (Pairof 'b 'x))] also simplifies to + @racket[Nothing] (@|typedracket| initially pushes the intersection down the + pairs, so that the type first becomes @racket[(Pairof (∩ 'a 'b) (∩ 'x 'x))], + which is simplified to @racket[(Pairof Nothing 'x)], and the occurrence of + @racket[Nothing] propagates outwards). However, if the user directly specifies + the type @racket[(Pairof (∩ 'a 'b) Integer)], it is simplified to + @racket[(Pairof Nothing Integer)], but the @racket[Nothing] does not propagate + outwards beyond the initial use of @racket[∩]. + + @examples[#:label #f #:eval (tr-eval) + (:type (∩ 'a 'b)) + (:type (∩ (Pairof 'a 'x) (Pairof 'b 'x))) + (:type (Pairof (∩ 'a 'b) Integer))] + + A simple workaround exists: the outer type, which could be collapsed to + @racket[Nothing], can be intersected again with a type of the same shape. The + outer intersection will traverse both types (the desired one and the + ``shape''), and propagate the leftover @racket[Nothing] further out. + + @examples[#:label #f #:eval (tr-eval) + (:type (Pairof (∩ 'a 'b) Integer)) + (:type (∩ (Pairof (∩ 'a 'b) Integer) + (Pairof Any Any)))] + + These intersections are not very interesting on their own, as in most cases + it is possible to express the resulting simplified type without using the + intersection operator. They become more useful when mixed with polymorphic + types: intersecting a polymorphic type variable with another type can be used + to restrict the actual values that may be used. The type @racket[(∩ A T)], + where @racket[A] is a polymorphic type variable and @racket[T] is a type + defined elsewhere, is equivalent to the use of bounded type parameters in + @|java| or @|csharp|. In @|csharp|, for example, the type @racket[(∩ A T)] + would be written using an @tt["where A : T"] clause.} + + @asection{ + @atitle[#:tag "tr-presentation-structs"]{Structs} + + Racket also supports @racket[struct]s, which are mappings from fields to + values. A struct is further distinguished by its struct type: instances of two + struct types with the same name and fields, declared in separate files, can be + differentiated using the predicates associated with these structs. Structs in + Racket can be seen as the analog of classes containing only fields (but no + methods) in @csharp or @|java|. Such classes are sometimes called ``Plain Old + Data (POD) Objects''. Structs belong to a single-inheritance hierarchy: + instances of the descendents of a struct type are recognised by their + ancestor's predicate. When a struct inherits from another, it includes its + parent's fields, and can add extra fields of its own. + + Each struct declaration within a @|typedracket| program additionally declares + corresponding type. + + @examples[#:label #f #:eval (tr-eval) + (struct parent ([field₁ : (Pairof String Symbol)]) + #:transparent) + (struct s parent ([field₂ : Integer] + [field₃ : Symbol]) + #:transparent) + (s (cons "x" 'y) 123 'z)] + + In @|typedracket|, structs can have polymorphic type arguments, which can be + used inside the types of the struct's fields. + + @examples[#:label #f #:eval (tr-eval) + (struct (A B) poly-s ([field₁ : (Pairof A B)] + [field₂ : Integer] + [field₃ : B]) + #:transparent) + (poly-s (cons "x" 'y) 123 'z)] + + Racket further supports + @tech[#:doc '(lib "scribblings/reference/reference.scrbl")]{struct type + properties}, which can be seen as a limited form of method definitions for a + struct, thereby making them closer to real objects. The same struct type + property can be implemented by many structs, and the declaration of a struct + type property is therefore roughly equivalent to the declaration of an + interface with a single method. + + Struct type properties are often considered a low-level mechanism in Racket. + Among other things, a struct type property can only be used to define a single + property at a time. When multiple ``methods'' have to be defined at once (for + example, when defining the @racket[prop:equal+hash] property, which requires + the definition of an equality comparison function, and two hashing functions), + these can be grouped together in a list of functions, which is then used as + the property's value. + ``@seclink["struct-generics" + #:doc '(lib "scribblings/reference/reference.scrbl")]{ + Generic interfaces}'' are a higher-level feature, which among other things + allow the definition of multiple ``methods'' as part of a single generic + interface, and offers a friendlier API for specifying the ``generic + interface'' itself (i.e. what Object Oriented languages call an interfece), as + and for specifying the implementation of said interface. + + @|Typedracket| unfortunately offers no support for struct type properties and + generic interfaces for now. It is impossible to assert that a struct + implements a given property at the type level, and it is also for example not + possible to describe the type of a function accepting any struct implementing + a given property or generic interface. Finally, no type checks are performed + on the body of functions bound to such properties, and to check verifies that + a function implementation with the right signature is supplied to a given + property. Since struct type properties and generics cannot be used in a + type-safe way for now, we refrain from using these features, and only use them + to implement some very common properties@note{We built a thin macro wrapper + which allows typechecking the implementation and signature of the functions + bound to these two properties.}: @racket[prop:custom-write] which is the + equivalent of @|java|'s @tt["void toString()"], and @racket[prop:equal+hash] + which is equivalent to @|java|'s @tt["boolean equals(Object o)"] and + @tt["int hashCode()"]. + + } + + @asection{ + @atitle[#:tag "tr-presentation-functions"]{Functions} + + @|Typedracket| supports rich function types, to support some of the flexible + use patterns allowed by Racket. + + The simple function type below indicates that the function expects two + arguments (an integer and a string), and returns a boolean: + + @racketblock[(→ Integer String Boolean)] + + We note that unlike @|haskell| and @|CAML| functions, Racket functions are + not implicitly curried. To express the corresponding curried function type, + one would write: + + @racketblock[(→ Integer (→ String Boolean))] + + A function may additionally accept optional positional arguments, and keyword + (i.e. named) arguments, both mandatory and optional: + + @racketblock[ + (code:comment "Mandatory string, optional integer and boolean arguments:") + (->* (String) (Integer Boolean) Boolean) + (code:comment "Mandatory keyword arguments:") + (→ #:size Integer #:str String Boolean) + (code:comment "Mandatory #:str, optional #:size and #:opt:") + (->* (#:str String) (#:size Integer #:opt Boolean) Boolean)] + + Furthermore, functions in Racket accept a catch-all ``rest'' argument, which + allows for the definition of variadic functions. Typed racket also allows + expressing this at the type level, as long as the arguments covered by the + ``rest'' clause all have the same type: + + @racketblock[ + (code:comment "The function accepts one integer and any number of strings:") + (-> Integer String * Boolean) + (code:comment "Same thing with an optional symbol inbetween: ") + (->* (Integer) (Symbol) #:rest String Boolean)] + + One of @|typedracket|'s main goals is to be able to typecheck idiomatic + Racket programs. Such programs may include functions whose return type depends + on the values of the input arguments. Similarly, @racket[case-lambda] can be + used to create lambda functions which dispatch to multiple behaviours based on + the number of arguments passed to the function. + + @|Typedracket| provides the @racket[case→] type operator, which can be used to + describe the type of these functions: + + @racketblock[ + (code:comment "Allows 1 or 3 arguments, with the same return type.") + (case→ (→ Integer Boolean) + (→ Integer String Symbol Boolean)) + (code:comment "A similar type based on optional arguments allows 1, 2 or 3") + (code:comment " arguments in contrast:") + (->* (Integer) (String Symbol) Boolean) + (code:comment "The output type can depend on the input type:") + (case→ (→ Integer Boolean) + (→ String Symbol)) + (code:comment "Both features (arity and dependent output type) can be mixed") + (case→ (→ Integer Boolean) + (→ Integer String (Listof Boolean)))] + + Another important feature, which can be found in the type system of most + functional programming languages, and most object-oriented languages, is + parametric polymorphism. @|Typedracket| allows the definition of polymorphic + structs, as detailed above, as well as polymorphic functions. For example, the + function @racket[cons] can be considered as a polymorphic function with two + polymorphic type arguments @racket[A] and @racket[B], which takes an argument + of type @racket[A], an argument of type @racket[B], and returns a pair of + @racket[A] and @racket[B]. + + @racketblock[(∀ (A B) (→ A B (Pairof A B)))] + + @htodo{Something on which types can be inferred and which can't (for now).} + + Finally, predicates (functions whose results can be interpreted as booleans) + can be used to gain information about the type of their argument, depending on + the result. The type of a predicate can include positive and negative filters, + indicated with @racket[#:+] and @racket[#:-], respectively. The type of the + @racket[string?] predicate is: + + @racketblock[(→ Any Boolean : #:+ String #:- (! String))] + + In this notation, the positive filter @racket[#:+ String] indicates that when + the predicate returns @racket[#true], the argument is known to be a + @racket[String]. Conversely, when the predicate exits with @racket[#false], + the negative filter @racket[#:- (! String)] indicates that the input could not + (@racket[!]) possibly have been a string. The information gained this way + allows regular conditionals based on arbitrary predicates to work like + pattern-matching: + + @examples[#:label #f #:eval (tr-eval) + (define (f [x : (U String Number Symbol)]) + (if (string? x) + (code:comment "x is known to be a String here:") + (ann x String) + (code:comment "x is known to be a Number or a Symbol here:") + (ann x (U Number Symbol))))] + + The propositions do not necessarily need to refer to the value as a whole, + and can instead give information about a sub-part of the value. Right now, the + user interface for specifying paths can only target the left and right members + of @racket[cons] pairs, recursively. Internally, @|typedracket| supports + richer paths, and the type inference can produce filters which give + information about individual structure fields, or about the result of forced + promises, for example.} + + @asection{ + @atitle[#:tag "tr-presentation-recursive-types"]{Recursive types} + + @|Typedracket| allows recursive types, both via (possibly mutually-recursive) + named declarations, and via the @racket[Rec] type operator. + + In the following examples, the types @racket[Foo] and @racket[Bar] are + mutually recursive. The type @racket[Foo] matches lists with an even number of + alternating @racket[Integer] and @racket[String] elements, starting with an + @racket[Integer], + + @racketblock[ + (define-type Foo (Pairof Integer Bar)) + (define-type Bar (Pairof String (U Foo Null)))] + + This same type could alternatively be defined using the @racket[Rec] + operator. The notation @racket[(Rec R T)] builds the type @racket[T], where + occurrences of @racket[R] are interpreted as recursive occurrences of + @racket[T] itself. + + @racketblock[ + (Rec R + (Pairof Integer + (Pairof String + (U R Null))))]} + + @asection{ + @atitle{Classes} + + The @racketmodname[racket/class] module provides an object-oriented system for + Racket. It supports the definition of classes with methods and fields. + + We will not describe this + } + + @asection{ + @atitle{Occurrence typing} + } + + @asection{ + @atitle{Global type inference} + } +} +\ No newline at end of file