Raku Books

Raku One-Liners cover

Raku One-Liners

Short, powerful Raku programs — command-line one-liners for files, numbers, strings, and dates, a tour of the language’s most expressive syntax, a round of Raku golf, and a look behind floating-point arithmetic.

Author
Andrew Shitov
Published
18 October 2019 · DeepText, Amsterdam
ISBN
978-90-821568-9-8
Pages
93

Get the book →

Preface

Command-Line Options

  • Using command-line options
  • Examples of short one-lines
  • Reading files with $*ARGFILES

Working with Files

  • Renaming files
  • Merging files horizontally
  • Reversing a file

Working with Numbers

  • Grepping multiples of 3 and 5
  • Generating random integers
  • Working with big numbers
  • Testing palindromic numbers
  • Adding up even Fibonacci numbers
  • Playing with Fibonacci numbers
  • Distance between two points
  • Playing with prime numbers
  • Using map and Seq to compute the value of π
  • Computing totals
  • Sum of the numbers equal to the sum of factorials of digits
  • 42 via the cubes

Working with Strings

  • Generating random passwords
  • The joy of Unicode

Working with Dates

  • What’s the date today?
  • How many days in the century match the condition?
  • Another solution of the same prob- lem

Raku Syntax

  • More on X, .., and …
  • Reduction operator
  • All the stars of Raku
  • The EVAL routine

Raku Golf

  • The first test
  • The second test
  • Tips and ideas for the Raku Golf code

Appendix on Compiler Internals

  • What’s behind 0.1 + 0.2

Afterword

Course navigation

← The Raku Course   |   Preface →

Andrew Shitov’s Raku Books

Tested programs · Raku Course · Raku.org · Raku Playground · GitHub

Books written by Andrew Shitov · Interactive edition © 2017–2026