Raku is a very nice language. Discover it with the one-liner examples of andrew Shitov

The book: Andrew Shitov: Raku one-liners

In chapter 3 Working with Numbers, page 33, of the book, the author demonstrates a (slow) computation of Pi decimals. But using BBP formula, a better, and more amazing solution may be build, at the price of slightly a longer single line.

BBP formula in one line (map version)

With the following code, only 12 sums are sufficient to arrive at the limit of the standard value of pi in Raku, as standard Rat use standard int.

raku -e 'say pi - [+] (^12).map( {(1/(16**$_))*(4/(8*$_ +1) - 2/(8*$_+4)\
    - 1/(8*$_+5) - 1/(8*$_+6))} )'

Arbitrary number of decimals

But with FatRat, you can achieve fast arbitrary accuracy !

raku -e 'say [+] (^100).map( {FatRat.new(1,16**$_)*( FatRat.new(4,8*$_ +1)\
    - FatRat.new(2,8*$_+4) - FatRat.new(1,8*$_+5) - FatRat.new(1,8*$_+6))} )'