GTP pict
1 GTP pict functions
make-racket-logo
tau-icon
icon-material?
make-program-pict/  sta
make-program-pict/  dyn
make-program-pict/  mixed
make-component-pict/  sta
make-component-pict/  dyn
make-component-pict/  blank
make-component-pict/  tu
make-component-pict
make-boundary-pict
bool*->bitstring
bool*->tag
bitstring->tag
make-node
make-lattice
make-fraction
make-check-x-fraction
make-icon
small-check-icon
small-x-icon
small-tau-icon
small-lambda-icon
make-2table
2 Deep, Shallow, Erasure
DEEP-TAG
SHALLOW-TAG
ERASURE-TAG
DSE-TAG*
dse-tag?
dse->string
dse->letter
dse->apples-name
dse->kafka-name
dse->color%
3 GTP pict parameters
*component-color*
*component-border-color*
*dyn-color*
*dyn-text-color*
*stat-color*
*lambda-color*
*tau-color*
*deep-color*
*shallow-color*
*erasure-color*
*lattice-node-color*
*boundary-color*
*type-boundary-color*
*line-margin*
*lattice-component-margin*
*lattice-node-x-margin*
*lattice-node-y-margin*
*component-x-margin*
*component-arrow-size*
*component-arrow-width*
*type-boundary-arrow-size*
*type-boundary-arrow-width*
*migration-arrow-size*
*migration-arrow-width*
*tau-font*
4 GTP pict constants
TYPE-BOUNDARY-TAG
SLIDE-TOP
SLIDE-LEFT
SLIDE-BOTTOM
SLIDE-RIGHT
HEADING-COORD
-HEADING-COORD
CENTER-COORD
8.12

GTP pict🔗ℹ

 (require gtp-pict) package: gtp-pict
Miscellaneous gradual typing picts.

1 GTP pict functions🔗ℹ

procedure

(make-racket-logo)  pict?

Make a pict with the Racket logo.

procedure

(tau-icon [#:color color    
  #:height height    
  #:material material])  (is-a?/c bitmap%)
  color : pict-color/c = (*tau-color*)
  height : real? = (default-icon-height)
  material : icon-material? = (default-icon-material)

Example:

procedure

(icon-material? x)  boolean?

  x : any/c

procedure

(make-program-pict/sta)  pict?

procedure

(make-program-pict/dyn)  pict?

procedure

(make-program-pict/mixed #:show-boundary? show-boundary?)

  pict?
  show-boundary? : #false

procedure

(make-component-pict/sta [#:body body    
  #:width width    
  #:height height])  pict?
  body : (or/c #f pict?) = #f
  width : (or/c #f real?) = #f
  height : (or/c #f real?) = #f

procedure

(make-component-pict/dyn [#:body body    
  #:width width    
  #:height height])  pict?
  body : (or/c #f pict?) = #f
  width : (or/c #f real?) = #f
  height : (or/c #f real?) = #f

procedure

(make-component-pict/blank [#:body body    
  #:width width    
  #:height height])  pict?
  body : (or/c #f pict?) = #f
  width : (or/c #f real?) = #f
  height : (or/c #f real?) = #f

procedure

(make-component-pict/tu #:body body    
  #:width width    
  #:height height    
  #:color color)  pict?
  body : pict?
  width : real?
  height : real?
  color : pict-color/c

procedure

(make-component-pict [#:body body    
  #:width width    
  #:height height    
  #:color color    
  #:border-width border-width    
  #:border-color border-color    
  #:radius radius    
  #:x-margin x-margin    
  #:y-margin y-margin])  pict?
  body : pict? = (blank)
  width : (or/c #f real?) = #f
  height : (or/c #f real?) = #f
  color : (or/c #f real?) = #f
  border-width : real? = 4
  border-color : pict-color/c = #f
  radius : real? = -0.08
  x-margin : real? = 10
  y-margin : real? = 10

Examples:

procedure

(make-boundary-pict #:l l-pict    
  #:c c-pict    
  #:r r-pict    
  #:x-margin x-margin)  pict?
  l-pict : (or/c pict? #f)
  c-pict : (or/c pict? #f)
  r-pict : (or/c pict? #f)
  x-margin : real?
Illustrate a value crossing a type boundary.

Example:
> (make-boundary-pict #:l (text "\"hello\"" (cons (*stat-color*) '()) 20)
                      #:c (text "v" '() 20)
                      #:r (text "Int" '() 20))

image

procedure

(bool*->bitstring b*)  string?

  b* : (listof boolean?)

Examples:
> (bool*->bitstring '(#t #t))

"11"

> (bool*->bitstring '(#f #t #f #f))

"0100"

procedure

(bool*->tag b*)  symbol?

  b* : (listof boolean?)

Example:
> (bool*->tag '(#t #f #t #t))

'cfg-1011

procedure

(bitstring->tag s)  symbol?

  s : string?

Example:
> (bitstring->tag "101")

'cfg-101

procedure

(make-node b*)  pict?

  b* : (listof boolean?)

Example:
> (scale (make-node '(#t #t #t #f #t)) 1/2)

image

procedure

(make-lattice total-bits    
  make-node    
  #:x-margin x-margin    
  #:y-margin y-margin)  pict?
  total-bits : natural?
  make-node : (-> (listof boolean?) pict?)
  x-margin : (*lattice-node-x-margin*)
  y-margin : (*lattice-node-y-margin*)

Example:
> (scale-to-fit (make-lattice 3 make-node) 200 600)

image

procedure

(make-fraction top bot)  pict?

  top : pict?
  bot : pict?

Example:

procedure

(make-check-x-fraction)  pict?

procedure

(make-icon i #:height h)  pict?

  i : (-> #:material icon-material? #:height real? (is-a?/c bitmap%))
  h : real?

procedure

(small-check-icon)  pict?

procedure

(small-x-icon)  pict?

procedure

(small-tau-icon)  pict?

procedure

(small-lambda-icon)  pict?

procedure

(make-2table picts    
  [#:col-sep col-sep    
  #:row-sep row-sep]    
  #:col-align col-align    
  #:row-align row-align)  pict?
  picts : (listof (cons/c pict? pict?))
  col-sep : (or/c real? #f) = 328/5
  row-sep : (or/c real? #f) = 364/5
  col-align : lc-superimpose
  row-align : cc-superimpose
Create a table with 2 columns.

Example:
> (make-2table (list (cons (standard-fish 40 40) (small-check-icon))
                     (cons (jack-o-lantern 40) (small-x-icon)))
               #:row-sep 30)

image

2 Deep, Shallow, Erasure🔗ℹ

“Deep” “Shallow” and “Erasure” are three possible names for three common approaches to enforcing types at runtime in a mixed-typed (or, gradually typed) language.

value

DEEP-TAG : symbol? = 'deep

value

SHALLOW-TAG : symbol? = 'shallow

value

ERASURE-TAG : symbol? = 'erasure

value

DSE-TAG* : (listof symbol?)

 = (list DEEP-TAG SHALLOW-TAG ERASURE-TAG)

procedure

(dse-tag? x)  boolean?

  x : any/c

procedure

(dse->string x)  string?

  x : dse-tag?

procedure

(dse->letter x)  string?

  x : dse-tag?

procedure

(dse->apples-name x)  string?

  x : dse-tag?

procedure

(dse->kafka-name x)  string?

  x : dse-tag?

procedure

(dse->color% x)  (is-a?/c color%)

  x : dse-tag?

3 GTP pict parameters🔗ℹ

parameter

(*component-color*)  (is-a?/c color%)

(*component-color* cc)  void?
  cc : (is-a?/c color%)
 = (string->color% "LightGoldenrodYellow")

parameter

(*component-border-color*)  (is-a?/c color%)

(*component-border-color* cbc)  void?
  cbc : (is-a?/c color%)
 = (string->color% "black")

parameter

(*dyn-color*)  (is-a?/c color%)

(*dyn-color* dc)  void?
  dc : (is-a?/c color%)
 = (string->color% "Firebrick")

parameter

(*dyn-text-color*)  (is-a?/c color%)

(*dyn-text-color* dtc)  void?
  dtc : (is-a?/c color%)
 = (string->color% light-metal-icon-color)

parameter

(*stat-color*)  (is-a?/c color%)

(*stat-color* sc)  void?
  sc : (is-a?/c color%)
 = (string->color% "PaleTurquoise")

parameter

(*lambda-color*)  (is-a?/c color%)

(*lambda-color* lc)  void?
  lc : (is-a?/c color%)
 = light-metal-icon-color

parameter

(*tau-color*)  (is-a?/c color%)

(*tau-color* tc)  void?
  tc : (is-a?/c color%)
 = (string->color% "DarkGoldenrod")

parameter

(*deep-color*)  (is-a?/c color%)

(*deep-color* dc)  void?
  dc : (is-a?/c color%)
 = (string->color% "Tomato")

parameter

(*shallow-color*)  (is-a?/c color%)

(*shallow-color* sc)  void?
  sc : (is-a?/c color%)
 = (string->color% "cornflowerblue")

parameter

(*erasure-color*)  (is-a?/c color%)

(*erasure-color* ec)  void?
  ec : (is-a?/c color%)
 = (string->color% "mediumseagreen")

parameter

(*lattice-node-color*)  (is-a?/c color%)

(*lattice-node-color* lnc)  void?
  lnc : (is-a?/c color%)
 = (string->color% "Gainsboro")

parameter

(*boundary-color*)  (is-a?/c color%)

(*boundary-color* bc)  void?
  bc : (is-a?/c color%)
 = (string->color% "black")

parameter

(*type-boundary-color*)  (is-a?/c color%)

(*type-boundary-color* tbc)  void?
  tbc : (is-a?/c color%)
 = (string->color% "Fuchsia")

parameter

(*line-margin*)  real?

(*line-margin* lm)  void?
  lm : real?
 = 4

parameter

(*lattice-component-margin*)  real?

(*lattice-component-margin* lcm)  void?
  lcm : real?
 = 6

parameter

(*lattice-node-x-margin*)  real?

(*lattice-node-x-margin* lnxm)  void?
  lnxm : real?
 = 20

parameter

(*lattice-node-y-margin*)  real?

(*lattice-node-y-margin* lnym)  void?
  lnym : real?
 = 40

parameter

(*component-x-margin*)  real?

(*component-x-margin* cxm)  void?
  cxm : real?
 = 40

parameter

(*component-arrow-size*)  real?

(*component-arrow-size* cas)  void?
  cas : real?
 = 11

parameter

(*component-arrow-width*)  real?

(*component-arrow-width* caw)  void?
  caw : real?
 = 3

parameter

(*type-boundary-arrow-size*)  real?

(*type-boundary-arrow-size* tbas)  void?
  tbas : real?
 = 13

parameter

(*type-boundary-arrow-width*)  real?

(*type-boundary-arrow-width* tbaw)  void?
  tbaw : real?
 = 4

parameter

(*migration-arrow-size*)  real?

(*migration-arrow-size* mas)  void?
  mas : real?
 = 25

parameter

(*migration-arrow-width*)  real?

(*migration-arrow-width* maw)  void?
  maw : real?
 = 8

parameter

(*tau-font*)  (is-a?/c font%)

(*tau-font* tf)  void?
  tf : (is-a?/c font%)

4 GTP pict constants🔗ℹ

value

TYPE-BOUNDARY-TAG : symbol? = 'type-boundary

value

SLIDE-TOP : real% = 1/10

value

SLIDE-LEFT : real% = 1/50

value

SLIDE-BOTTOM : real% = 4/5

value

SLIDE-RIGHT : real% = 49/50

value

HEADING-COORD : refpoint-placer?

value

-HEADING-COORD : refpoint-placer?

value

CENTER-COORD : refpoint-placer?