Share your repls and programming experiences

← Back to all posts
π in Scala
AmazingMech2418 (1045)

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

The issue with NASM has been fixed, but I still need to figure out float addition, subtraction, multiplication, and division before the NASM approximation will be ready.

Here are the other approximations so far:
Reason - https://repl.it/talk/share/p-in-Reason/42012
Tcl - https://repl.it/talk/share/p-in-Tcl/41996
C++ - https://repl.it/talk/share/p-in-C/41882
TypeScript - https://repl.it/talk/share/p-in-TypeScript/41874
CoffeeScript - https://repl.it/talk/share/p-in-CoffeeScript/41867
Elisp - https://repl.it/talk/share/p-in-Emacs-Lisp-Elisp/41846
Clojure - https://repl.it/talk/share/p-in-Clojure/41845
Scheme - https://repl.it/talk/share/p-in-Scheme/41844
Erlang - https://repl.it/talk/share/p-in-Erlang/41652
Elixir - https://repl.it/talk/share/p-in-Elixir/41530
Julia - https://repl.it/talk/share/p-in-Julia/41395
Nim - https://repl.it/talk/share/p-in-Nim/41372
PHP - https://repl.it/talk/share/p-in-PHP/41348
Crystal - https://repl.it/talk/share/p-in-Crystal/41276
F# - https://repl.it/talk/share/p-in-F/41261
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 (personal request for the ping), and LizFoster (the @ is removed so they don't get annoying pings every time I post) 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).

I don't know currently which one is next. If you have any suggestions, please let me know! I would prefer to save esolangs for last. Some examples for ideas for the next ones are like Quil, etc. (I'm running out of ideas)

By the way, I'm starting to run out of languages, so please suggest any you would like to see me do. There are now no (or at least very few) official languages left other than esolangs, but there are some other languages (like OCaml, Quil, etc.) that can be found using the method in my tutorial at https://repl.it/talk/learn/How-to-Get-a-List-of-All-Replit-Langauges/34411. Though, I am saving esolangs for last (or close to last). After I finish the approximations using the Nilakantha Series, I will go through all of the languages again and do another algorithm (I'm thinking either trapezoidal sums or Monte Carlo). I will also then make a tutorial on transpiling programming languages.

List of all other languages on Repl.it that I have not done that I plan to at least eventually do:

BrainF - Esolang
Emoticon - Esolang
Bloop - Esolang
Unlambda - Esolang
NASM - Assembly; still working on it

List of languages that I will not do:

BASIC - Already did QBasic and there is not a large enough difference to make me decide to do BASIC as well.
Roy - There is not enough documentation online to do Roy. (I can find pretty much nothing)
Static - Static does nothing... It is just a makefile and it does nothing when you run it.
Flow - JS type checker which seems to not actually work
Deno - Alternative to Node, but runs exactly as TypeScript repls do
WASM - WebAssembly; Doesn't seem to work on Repl.it and isn't even meant to be programmed in, just compiled into.
OCaml - Doesn't work on Repl.it
TestJ - I thought it was the J programming language, but it is just Java which I have already done...
Quil - Quantum Instruction Language - requires sufficient knowledge of quantum computing (in other words, it is too confusing)

Late Additions To The Series:
D - https://repl.it/talk/share/p-in-D/42887

Comments
hotnewtop
HahaYes (1861)

now that you have done π, you should do e next

AmazingMech2418 (1045)

@HahaYes I was actually thinking about that. Though, I would like the next approximation series to use if statements and other control structures in addition to loops.

AmazingMech2418 (1045)

@HahaYes Any suggestions for the next language?

AmazingMech2418 (1045)

@HahaYes Do you know of any at least semi-normal languages I have not done that work on Repl.it?

AmazingMech2418 (1045)

@HahaYes Well, I've already done Python, so I was thinking more of like if you knew any languages not normally in Repl.it that can be done in Repl.it.

HahaYes (1861)

@AmazingMech2418 I think you may have done all of them .....

HahaYes (1861)

@AmazingMech2418 I dunno, should you do Typescript?

HahaYes (1861)

@AmazingMech2418 I think you did all of them then.... what about D++?

AmazingMech2418 (1045)

@HahaYes If you mean D, then no. I haven't heard of D++ though. Though, is there a GNU compiler?

AmazingMech2418 (1045)

@HahaYes Well, just really a compiler that can run on Repl.it. Like a GCC or Clang, but for D.

HahaYes (1861)

@AmazingMech2418 also nano is amazing I tried it out

AmazingMech2418 (1045)

@Highwayman Any suggestions for the next one?

Highwayman (1444)

@AmazingMech2418 Sadly no. I’m a horrible ideas person lol

AmazingMech2418 (1045)

@Highwayman LOL! I'm not even really sure if there are any other languages I can do on Repl.it though...

AmazingMech2418 (1045)

@Highwayman Maybe some time later. (I have to actually finish Adapt first. LOL!)