Skip to content

Check your F# skills

December 16, 2011

Below is a naive definition of natural power function:

let power n (``base``: bigint) =
    [1..n] |> List.fold (fun product _ -> ``base`` * product) 1I

It multiplies base by itself n times.

Without FSI/FS find out what would be returned if power is called with n = 0?

Advertisements

From → F#

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: