Computing factorials using Raku
In this post, I am demonstrating different ways of computing factorials using the Raku programming language.
Science, Programming, Electronics, Languages
In this post, I am demonstrating different ways of computing factorials using the Raku programming language.
Factorial, being a classical task for practising algorithms, is a great example to demonstrate the features of Raku. Let us update the code so that it caches the already calculated values.
Print the factorial of a given number. By definition, the factorial of a positive integer number N is a product of all the integers numbering from 1 to N, including N. In Perl 6, this can be easily expressed with the use of a reduction operator: my $n = 5;my $f = [*] 1 .. $n;say $f; The … Continue reading “📘 Computing factorial! using Perl 6”
I published my new book: A Language a Day, which is a collection of brief overviews to 21 programming languages.
Andrew ShitovA Language A DayA brief introduction to 21 programming languagesDeepText, 2024 Electronic editionsLeanPub (PDF, EPUB)Amazon (Kindle): US, UK, DE, FR, ES, IT, NL, JP, BR, CA, MX, AU, IN Paper editionsAmazon — hardcover: US, UK, DE, FR, ES, IT, NL, JP, BR, CA, MX, AU, INAmazon — paperback: US, UK, DE, FR, ES, IT, NL, JP, … Continue reading “A Language A Day”
Welcome to the next issue of the series about the cool practical stuff in the Raku programming language. Today, we will discuss the usage of the so-called triangular reduction metaoperator on the following examples: [\*] and [\,].
Raku challenge, week 72. Task 1: count trailing zeroes in a factorial of an integer. Task 2: Get lines A to B from a text file.
How to compute the value of the mathematical constant e using recursion in the Raku programming language.
Welcome to Day 24 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the Factor programming language.
Welcome to Day 23 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the Io programming language.
Welcome to Day 22 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the Zig programming language.
About this ‘A Language a Day’ Advent Calendar This article became a part of my book ‘A Language a Day’, which you can get in both electronic and paper format. Languages covered in the book: C++, Clojure, Crystal, D, Dart, Elixir, Factor, Go, Hack, Hy, Io, Julia, Kotlin, Lua, Mercury, Nim, OCaml, Raku, Rust, Scala, and … Continue reading “D at a Glance — A Language a Day, Advent Calendar Day 21/24”
About this ‘A Language a Day’ Advent Calendar This article became a part of my book ‘A Language a Day’, which you can get in both electronic and paper format. Languages covered in the book: C++, Clojure, Crystal, D, Dart, Elixir, Factor, Go, Hack, Hy, Io, Julia, Kotlin, Lua, Mercury, Nim, OCaml, Raku, Rust, Scala, and … Continue reading “Mercury at a Glance — A Language a Day, Advent Calendar Day 20/24”
About this ‘A Language a Day’ Advent Calendar This series of publications transformed into my book ‘A Language a Day’, which you can get in both electronic and paper format. Languages covered in the book: C++, Clojure, Crystal, D, Dart, Elixir, Factor, Go, Hack, Hy, Io, Julia, Kotlin, Lua, Mercury, Nim, OCaml, Raku, Rust, Scala, and … Continue reading “Red at a Glance — A Language a Day, Advent Calendar Day 19/24”
About this ‘A Language a Day’ Advent Calendar This article became a part of my book ‘A Language a Day’, which you can get in both electronic and paper format. Languages covered in the book: C++, Clojure, Crystal, D, Dart, Elixir, Factor, Go, Hack, Hy, Io, Julia, Kotlin, Lua, Mercury, Nim, OCaml, Raku, Rust, Scala, and … Continue reading “Hy at a Glance — A Language a Day, Advent Calendar Day 18/24”
About this ‘A Language a Day’ Advent Calendar This article became a part of my book ‘A Language a Day’, which you can get in both electronic and paper format. Languages covered in the book: C++, Clojure, Crystal, D, Dart, Elixir, Factor, Go, Hack, Hy, Io, Julia, Kotlin, Lua, Mercury, Nim, OCaml, Raku, Rust, Scala, and … Continue reading “Go at a Glance — A Language a Day, Advent Calendar Day 17/24”
About this ‘A Language a Day’ Advent Calendar This series of publications transformed into my book ‘A Language a Day’, which you can get in both electronic and paper format. Languages covered in the book: C++, Clojure, Crystal, D, Dart, Elixir, Factor, Go, Hack, Hy, Io, Julia, Kotlin, Lua, Mercury, Nim, OCaml, Raku, Rust, Scala, and … Continue reading “V at a Glance — A Language a Day, Advent Calendar Day 16/24”
About this ‘A Language a Day’ Advent Calendar This article became a part of my book ‘A Language a Day’, which you can get in both electronic and paper format. Languages covered in the book: C++, Clojure, Crystal, D, Dart, Elixir, Factor, Go, Hack, Hy, Io, Julia, Kotlin, Lua, Mercury, Nim, OCaml, Raku, Rust, Scala, and … Continue reading “Nim at a Glance — A Language a Day, Advent Calendar Day 15/24”
About this ‘A Language a Day’ Advent Calendar This article became a part of my book ‘A Language a Day’, which you can get in both electronic and paper format. Languages covered in the book: C++, Clojure, Crystal, D, Dart, Elixir, Factor, Go, Hack, Hy, Io, Julia, Kotlin, Lua, Mercury, Nim, OCaml, Raku, Rust, Scala, and … Continue reading “Clojure at a Glance — A Language a Day, Advent Calendar Day 14/24”
About this ‘A Language a Day’ Advent Calendar Welcome to Day 13 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the OCaml programming language. Facts about the language Some facts about OCaml: Based on Caml (which is based on ML) Static type checking Supports functional, imperative, and object-oriented programming Appeared … Continue reading “OCaml at a Glance — A Language a Day, Advent Calendar Day 13/24”