SICP Exercises in F#, Section 1.1.4

> let square x = x * x;;

val square : int -> int

> square 21;;
val it : int = 441
> square (2 + 5);;
val it : int = 49
> square (square 3);;
val it : int = 81
> let sum_of_squares x y = (square x) + (square y);;

val sum_of_squares : int -> int -> int

> sum_of_squares 3 4;;
val it : int = 25
> let f a = sum_of_squares (a + 1) (a * 2);;

val f : int -> int

> f 5;;
val it : int = 136
Advertisements

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



  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: