Anonymous recursion: Difference between revisions
Content added Content deleted
m (Updated description and link for Fōrmulæ solution) |
(add BQN) |
||
Line 464: | Line 464: | ||
Answer: |
Answer: |
||
<pre>832040</pre> |
<pre>832040</pre> |
||
=={{header|BQN}}== |
|||
<code>𝕊</code> is a useful symbol in BQN which references the function it is currently in. This can be used to perform anonymous recursion without the need of naming the function block. |
|||
The following code calls an anonymous recursive Fibonacci function on each number of the range 0-9. |
|||
<lang bqn>{ |
|||
(𝕩<2)◶⟨+´𝕊¨,𝕏⟩𝕩-1‿2 |
|||
}¨↕10</lang> |
|||
<lang bqn>⟨ 0 1 1 2 3 5 8 13 21 34 ⟩</lang> |
|||
[https://mlochbaum.github.io/BQN/try.html#code=ewogICjwnZWpPDIp4pe24p+oK8K08J2VisKoLPCdlY/in6nwnZWpLTHigL8yCn3CqOKGlTEw Try It!] |
|||
=={{header|C}}== |
=={{header|C}}== |