From ac2833eb3c3e3a7c75709d992bfd9115254412de Mon Sep 17 00:00:00 2001 From: Katharine Kerr Date: Thu, 27 Oct 2022 10:54:18 -0700 Subject: Katharine's contribution with a simple fib --- entries/kekerr/fib.ts | 16 ++++++++++++++++ people.json | 11 +++++++++++ 2 files changed, 27 insertions(+) create mode 100644 entries/kekerr/fib.ts diff --git a/entries/kekerr/fib.ts b/entries/kekerr/fib.ts new file mode 100644 index 0000000..cc42fcf --- /dev/null +++ b/entries/kekerr/fib.ts @@ -0,0 +1,16 @@ +function fibonacci(n: number): string { + if (n <= 0) { + return "Surely that's a mistake! We can't give you anything interesting!"; + } + + if (n == 1) { + return "This one's easy: [1]"; + } + + const seq = [1, 1]; + for(let i = 2; i < n; i++) { + seq.push(seq[i-1] + seq[i-2]); + } + + return "Fibonacci this: " + seq.toString(); +} diff --git a/people.json b/people.json index 6f6d1d2..d611699 100644 --- a/people.json +++ b/people.json @@ -479,5 +479,16 @@ "link": "./entries/nakilon/fib.rasel" } ] + }, + { + "github": "kekerr", + "name": "Katharine Kerr", + "title": "'Whether you think you can or can't, either way you are right.' - Henry Ford", + "entries": [ + { + "name": "TypeScript", + "link": "./entries/kekerr/fib.ts" + } + ] } ] -- cgit v1.2.3-70-g09d2