Share your repls and programming experiences

← Back to all posts
π in F#
h
AmazingMech2418 (891)

I think I'm pretty much doing pi approximations in every language now, so, here it is in F#!

The interesting thing about F# is that, while a functional language, it is actually quite like R which is not functional.

I still have the same issue with NASM and am working on that one side-by-side with the other languages. If you can help fix the issue, please let me know at https://repl.it/talk/ask/NASM-Print-Floating-Point/41105.

Here are the other approximations so far:
Lua - https://repl.it/talk/share/p-in-Lua/41251
Dart - https://repl.it/talk/share/p-in-Dart/41240
R - https://repl.it/talk/share/p-in-R/41205
Haskell - https://repl.it/talk/share/p-in-Haskell/41199
Raku - https://repl.it/talk/share/p-in-Raku/41111
Rust - https://repl.it/talk/share/p-in-Rust/41056
Go - https://repl.it/talk/share/p-in-Go/40950
Swift - https://repl.it/talk/share/p-in-Swift/36150
C# - https://repl.it/talk/share/p-in-C/36141
Bash - https://repl.it/talk/share/p-in-Bash/36133
Kotlin - https://repl.it/talk/share/p-in-Kotlin/36125
Ruby - https://repl.it/talk/share/p-in-Ruby/34982
Java - https://repl.it/talk/share/p-in-Java/34978
QBasic - https://repl.it/talk/share/p-in-QBasic/34973
Fortran - https://repl.it/talk/share/p-in-Fortran/34890
APL - https://repl.it/talk/share/p-in-APL/34888
Forth - https://repl.it/talk/share/p-in-Forth/34652
LOLCODE - https://repl.it/talk/share/p-in-LOLCODE/34421
Python and Node.js (Node is linked in post) - https://repl.it/talk/share/2-Approximations-of-p-In-Only-Four-Lines-of-Code/32773
C - https://repl.it/talk/share/p-Approximations-in-C/33461

Credit to @NoelBryan, @TheForArkLD , @Warhawk947 , and @LizFoster for inspiring these approximations. Most of these use the Nilakantha Series, although I also use the arctangent method (multiplying the radian arctangent of 1 by 4 to get pi and getting the arctangent with an infinite series) in three of them (Python, Node, and C).

Also, credit to @Jakman for suggesting F#!

Next up is Crystal and then L ( @theangryepicbanana 's language). (I'm still working on NASM, but can't really tell when I'll be able to get that one done.) If you have any suggestions for after those, please let me know!

Commentshotnewtop
AmazingMech2418 (891)

@DynamicSquid Maybe soon. (I'm starting to run out of non-Lisp languages, but guess I can do like Nim, Julia, etc. still...)

AmazingMech2418 (891)

@DynamicSquid Yeah. Lisp seems kind of weird and would probably be best to save for later (of course still before the esolangs though).

Warhawk947 (518)

Tip: If the run command is a bit slow, just skip the build and do mono main.exe

AmazingMech2418 (891)

@Warhawk947 Yeah. I thought about doing that, but it's not too slow the way it is right now...