1 util
cast
exact-round
exact-floor
exact-ceiling
exact-truncate
2 2htdp/ image
Image
Nat
Angle
Color
Image-Color
Mode
X-Place
Y-Place
Pen
Pen-Style
Pen-Cap
Pen-Join
circle
ellipse
triangle
right-triangle
isosceles-triangle
square
rectangle
rhombus
regular-polygon
star
star-polygon
polygon
line
add-line
add-curve
text
text/ font
overlay
overlay/ align
overlay/ xy
underlay
underlay/ align
underlay/ xy
beside
beside/ align
above
above/ align
empty-scene
place-image
place-image/ align
scene+ line
scene+ curve
rotate
scale
scale/ xy
crop
frame
image-width
image-height
image-baseline
mode?
image-color?
make-color
color-red
color-green
color-blue
y-place?
x-place?
angle?
side-count?
make-pen
pen-color
pen-width
pen-style
pen-cap
pen-join
pen-style?
pen-cap?
pen-join?
3 2htdp/ universe
animate

Typed: Libraries and Utilities

David Van Horn <dvanhorn@ccs.neu.edu>

This package contains a set of typed libraries. It is still under development.

Report a bug.

1 util

 (require (planet dvanhorn/typed:1:2/util))

cast : (All (T) ((Any -> Boolean : T) Any -> T))
Cast the given value to the type described by the predicate. Note the predicate must be symmetric. The cast will fail at run-time if the value does not satisfy the predicate.

Casting is useful to embed type refinements the programmer can prove that Typed Scheme is not able to reason about.

Examples:

  > (sin pi)

  - : Complex

  1.2246467991473532e-16

  > (cast real? (sin pi))

  - : Real

  1.2246467991473532e-16

exact-round : (Real -> Integer)
exact-floor : (Real -> Integer)
exact-ceiling : (Real -> Integer)
exact-truncate : (Real -> Integer)
These operations coerce their result to exact integers.

Examples:

  > (round 3/2)

  - : Real

  2

  > (exact-round 3/2)

  - : Integer

  2

  > (round 2.5)

  - : Real

  2.0

  > (exact-round 2.5)

  - : Integer

  2

It is a contract violation to apply these operations to a non-rational real (i.e., +inf.0, -inf.0, or +nan.0), since there is no exact representation of these values.

Examples:

  > (round +inf.0)

  - : Real

  +inf.0

  > (exact-round +inf.0)

  /Users/dvanhorn/Documents/planet/typed/private/util.ss:2.19:

  

    (file

    

  /Users/dvanhorn/Documents/planet/typed/util.ss)

   broke the

  contract (-> rational? any/c) on exact-round; expected

  <rational?>, given: +inf.0

2 2htdp/image

 (require (planet dvanhorn/typed:1:2/2htdp/image))

This module provides a typed 2htdp/image library.

Base types. Angle is a synonym for Real and Nat for Exact-Nonnegative-Integer.

circle : (Real Mode (U Pen Image-Color) -> Image)
ellipse : (Real Real Mode (U Pen Image-Color) -> Image)
triangle : (Real Mode (U Pen Image-Color) -> Image)
right-triangle : (Real Real Mode (U Pen Image-Color) -> Image)
isosceles-triangle : (Real Angle Mode (U Pen Image-Color) -> Image)
square : (Real Mode (U Pen Image-Color) -> Image)
rectangle : (Real Real Mode (U Pen Image-Color) -> Image)
rhombus : (Real Angle Mode (U Pen Image-Color) -> Image)
regular-polygon : (Real Nat Mode (U Pen Image-Color) -> Image)
star : (Real Mode (U Pen Image-Color) -> Image)
star-polygon : (Real Nat Nat Mode (U Pen Image-Color) -> Image)
polygon : ([Listof Posn] Mode (U Pen Image-Color) -> Image)
line : (Real Real Image-Color -> Image)
add-line : (Image Real Real Real Real (U Pen Image-Color) -> Image)
add-curve : 
(Image Real Real Angle Real Real Real Angle Real
       (U Pen Image-Color) -> Image)
text : (String Integer Image-Color -> Image)
text/font : 
(String Exact-Positive-Integer Image-Color (Option String)
        (U 'default 'decorative 'roman 'script
           'swiss 'modern 'symbol 'system)
        (U 'normal 'italic 'slant)
        (U 'normal 'bold 'light)
        Any
        -> Image)
overlay : (Image Image Image * -> Image)
overlay/align : (X-Place Y-Place Image Image Image * -> Image)
overlay/xy : (Image Real Real Image -> Image)
underlay : (Image Image Image * -> Image)
underlay/align : (X-Place Y-Place Image Image Image * -> Image)
underlay/xy : (Image Real Real Image -> Image)
beside : (Image Image Image * -> Image)
beside/align : (Y-Place Image Image Image * -> Image)
above : (Image Image Image * -> Image)
above/align : (X-Place Image Image Image * -> Image)
empty-scene : (Real Real -> Image)
place-image : (Image Real Real Image -> Image)
place-image/align : (Image Real Real X-Place Y-Place Image -> Image)
scene+line : (Image Real Real Real Real (U Pen Image-Color) -> Image)
scene+curve : 
(Image Real Real Angle Real Real Real Angle Real
       (U Pen Image-Color) -> Image)
rotate : (Angle Image -> Image)
scale : (Real Image -> Image)
scale/xy : (Real Real Image -> Image)
crop : (Real Real Real Real Image -> Image)
frame : (Image -> Image)
image-width : (Image -> Nat)
image-height : (Image -> Nat)
image-baseline : (Image -> Nat)
mode? : (Any -> Boolean)
image-color? : (Any -> Boolean)
make-color : (Nat Nat Nat -> Color)
color-red : (Color -> Nat)
color-green : (Color -> Nat)
color-blue : (Color -> Nat)
y-place? : (Any -> Boolean)
x-place? : (Any -> Boolean)
angle? : (Any -> Boolean)
side-count? : (Any -> Boolean)
make-pen : (Image-Color Real Pen-Style Pen-Cap Pen-Join -> Pen)
pen-color : (Pen -> Image-Color)
pen-width : (Pen -> Real)
pen-style : (Pen -> Pen-Style)
pen-cap : (Pen -> Pen-Cap)
pen-join : (Pen -> Pen-Join)
pen-style? : (Any -> Boolean)
pen-cap? : (Any -> Boolean)
pen-join? : (Any -> Boolean)
Typed variants of the image library.

3 2htdp/universe

 (require (planet dvanhorn/typed:1:2/2htdp/universe))

animate : ((Nat -> Image) -> Nat)
Typed animate.