Responses for exercises in Exercism.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Julio Biason 93084c4cc6 Exercism: Short Fibonacci 3 years ago
..
.exercism Exercism: Short Fibonacci 3 years ago
src Exercism: Short Fibonacci 3 years ago
tests Exercism: Short Fibonacci 3 years ago
Cargo.lock Exercism: Short Fibonacci 3 years ago
Cargo.toml Exercism: Short Fibonacci 3 years ago
HELP.md Exercism: Short Fibonacci 3 years ago
HINTS.md Exercism: Short Fibonacci 3 years ago
README.md Exercism: Short Fibonacci 3 years ago

README.md

A Short Fibonacci Sequence

Welcome to A Short Fibonacci Sequence on Exercism's Rust Track. If you need help running the tests or submitting your code, check out HELP.md. If you get stuck on the exercise, check out HINTS.md, but try and solve it without using those first :)

Introduction

Rust provides a macro vec![] to help you create Vectors. This comes in quite handy when you need to initialize lists.

Instructions

You are going to initialize empty buffers and list the first five numbers, or elements, of the Fibonacci sequence.

The Fibonacci sequence is a set of numbers where the next element is the sum of the prior two. We start the sequence at one. So the first two elements are 1 and 1.

1. Create a buffer of count zeroes.

Create a function that creates a buffer of count zeroes.

let my_buffer = create_buffer(5);
// [0, 0, 0, 0, 0]

2. List the first five elements of the Fibonacci sequence

Create a function that returns the first five numbers of the Fibonacci sequence. Its first five elements are 1, 1, 2, 3, 5

let first_five = fibonacci();
// [1, 1, 2, 3, 5]

Source

Created by