SICP Exercises in F#, Section 1.1.2

> let size = 2;;

val size : int

> size;;
val it : int = 2
> 5 * size;;
val it : int = 10
> let pi = 3.14159
let radius = (float)10;;

val pi : float
val radius : float

> pi * (radius * radius);;
val it : float = 314.159
> let circumference = 2 * pi * radius;;

  let circumference = 2 * pi * radius;;
  ------------------------^^^

stdin(34,25): error FS0001: The type 'float' does not match the type 'int'.
> let circumference = 2.0 * pi * radius;;

val circumference : float

> circumference;;
val it : float = 62.8318
Advertisements

0 Responses to “SICP Exercises in F#, Section 1.1.2”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: