Add Fibonnacci

This commit is contained in:
joachimschmidt557 2019-05-17 20:38:18 +02:00
parent 59cfd6db25
commit cadd0f02fd

View file

@ -0,0 +1,15 @@
;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-advanced-reader.ss" "lang")((modname fibonacci-goldener-schnitt) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #t #t none #f () #f)))
(define (fib n) (cond
[(= n 0) 1]
[(= n 1) 1]
[else (+ (fib (- n 1)) (fib (- n 2)))]
))
(define (make-numbers n) (cond
[(= n 0) (list 0)]
[else (append (make-numbers (- n 1)) (list n))]
))
(define (x n) (map (lambda (x) (/ (fib (+ x 1)) (fib x))) (make-numbers n)))