Share your repls and programming experiences

← Back to all posts
π in Crystal
h
AmazingMech2418 (693)

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

Crystal is pretty much just a faster version of Ruby for anyone who wants to learn either language.

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:
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 , 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 Crystal!

Next up is 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! I would prefer to save Lisp dialects for a little later. Some examples for ideas for the next ones are like Nim, Julia, Erlang, etc.

Commentshotnewtop
CodeLongAndPros (963)

You should do one in raspberry, so your repl name will be:
raspberry pi

AmazingMech2418 (693)

@CodeLongAndPros If only that was actually a programming language...

DynamicSquid (2673)

@CodeLongAndPros someone get this guy an award, that is actually genius!

Jakman (377)

nice. It looks like your profile will invade hot.

Jakman (377)

@DynamicSquid if a post gets upvotes within the first few minutes of its posting it gets into hot quick. It helps to get comments as well.

DynamicSquid (2673)

@Jakman I thought they changed it though, it was like that before, but now it's harder. I guess all the previous posts were old, so it's easier for a newer post to take over

Jakman (377)

@DynamicSquid yeah. that is the case. My tutorial got into hot because someone upvoted it instantly and commented many times.

AmazingMech2418 (693)

@CodeLongAndPros I already tried that a while ago. It didn't work. LOL!

CodeLongAndPros (963)

@AmazingMech2418 Some more:

  • Pi in PowerPoint
  • Pi in GOL
  • Pi in rule 110
AmazingMech2418 (693)

@CodeLongAndPros
PowerPoint: You know Repl.it uses Linux, right?
GOL: Can't find what that is. Do you mean GOAL?
rule 110: All I can find is something with a Sierpinski Triangle on Wolfram Mathworld.

AmazingMech2418 (693)

@CodeLongAndPros Still, I kind of meant an actual programming language. I guess it says rule 110 is Turing-complete, but I don't think it can be used to program on Repl.it.

AmazingMech2418 (693)

@DynamicSquid LOL! I don't want to have to do 150,000 iterations though like my programs are doing...

DynamicSquid (2673)

@AmazingMech2418 lol :) but keep it up though! these are always interesting to watch!

AmazingMech2418 (693)

@DynamicSquid Thank you! I'm trying to do L (theangryepicbanana's language) for the next one, but there isn't currently a way to read the program from a file, so that one might have to be pushed back one or two posts. Do you have any suggestions for the next few languages (in order preferably)?

DynamicSquid (2673)

@AmazingMech2418 umm... no not really... your list already covered basically all the languages I know

AmazingMech2418 (693)

@DynamicSquid Looking at the list, there's only Julia, Elixir, Nim, Erlang, PHP, Roy, the Lisp dialects, and the esolangs. Would you like to see any of those on the list (excluding the Lisp dialects and esolangs which I'm planning on saving for later) more than the others?

AmazingMech2418 (693)

@DynamicSquid Unofficially, there is also OCaml, Quil, Tcl, WASM, and Scala.

TheForArkLD (660)
Mono
   ^
Use me for powerpoint