π in APL
@TheForArkLD recommended that I make a pi approximation in APL, so here it is! By the way, I don't know if I did it the way you are technically supposed to, but it works! APL has almost no available documentation online...
TheForArkLD (745)
Thanks :D
Really cool!
(Dyalog is our friends)
AmazingMech2418 (994)
@TheForArkLD Thank you!
AmazingMech2418 (994)
@TheForArkLD I don't think Repl.it uses Dyalog. Loops don't work. I had to use tail-end recursion.
TheForArkLD (745)
@AmazingMech2418 Yes but ngn ≒ Dyalog
AmazingMech2418 (994)
@TheForArkLD Well, ngn doesn't support loops with the same syntax as Dyalog...
TheForArkLD (745)
@AmazingMech2418 yes,but we can make loop
AmazingMech2418 (994)
@TheForArkLD You have to use tail-end recursion though...
TheForArkLD (745)
@AmazingMech2418 yes
n←0
max←10
func←{
⍝Do something
n←n+1
{n < max:func 1} 1
}
func 1
TheForArkLD (745)
@AmazingMech2418 I found symbol that recursion for function, lol
You could probably simplify this whole thing:
to:
because I believe the APL evaluates from right to left (rather than left to right). It might even be able to be simplified further.
@theangryepicbanana Yeah. I could simplify it.
@theangryepicbanana I just simplified it as far as I can.