Skip to content

Commit

Permalink
lingo-birth-evolution-demise
Browse files Browse the repository at this point in the history
  • Loading branch information
jht9629-nyu committed Apr 25, 2024
1 parent 01de87d commit 96812ea
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
15 changes: 9 additions & 6 deletions _jht-site.code-workspace
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"folders": [
{
"path": "."
}
]
}
"folders": [
{
"path": "."
}
],
"settings": {
"liveServer.settings.port": 5501
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8179,7 +8179,14 @@ <h2>
word-wrap: normal;
color: rgb(36, 39, 41);
"
><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;white-space:inherit"><font size="6">fib ^ self &lt;= 2 ifTrue: [ 1 ] ifFalse: [ (self - 2) fib + (self - 1) fib ]</font></code></pre>
>
fib
^ self <= 2
ifTrue: [ 1 ]
ifFalse: [ (self - 2) fib + (self - 1) fib ]

</pre
>
</h2>
<h2>
<a name="TOC-1"></a><font size="6"><br /></font>
Expand Down Expand Up @@ -8221,7 +8228,12 @@ <h2>
color: rgb(57, 51, 24);
word-wrap: normal;
"
><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;white-space:inherit"><font size="6"><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(16,16,148)">defun</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> fibonacci </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">n </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">&amp;</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">optional </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">a </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(125,39,39)">0</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">)</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">b </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(125,39,39)">1</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">)</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">acc </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">)))</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(16,16,148)">if</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">zerop n</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">)</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">nreverse acc</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">)</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">fibonacci </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(125,39,39)">1</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">-</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> n</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">)</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> b </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">+</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> a b</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">)</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(16,16,148)">cons</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> a acc</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">))))</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"></span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">(</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)">fibonacci </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(125,39,39)">5</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline">)</span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(48,51,54)"> </span><span style="margin:0px;padding:0px;border:0px;font-family:inherit;font-style:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;color:rgb(133,140,147)">; ==&gt; (0 1 1 2 3)</span></font></code></pre>
>
(defun fibonacci (n &optional (a 0) (b 1) (acc ()))
(if (zerop n)
(nreverse acc)
(fibonacci (1- n) b (+ a b) (cons a acc))))
</pre>
</h2>
<h2>
<a name="TOC-3"></a><font size="6"><br /></font>
Expand Down

0 comments on commit 96812ea

Please sign in to comment.