Examples collection
Welcome to the examples collection of the Raku programming language!
Categories
Best of Rosettacode
The best of the rosettacode.org examples
- 100 Doors 100-doors.raku
- 24 game 24-game.raku
- Accumulator factory accumulator-factory.raku
- Ackermann function ackermann-function.raku
- Arbitrary-precision integers (included) arbitrary-precision-integers.raku
- Balanced brackets balanced-brackets.raku
- Binomial Coefficient binomial-coefficient.raku
- Copy a string copy-a-string.raku
- Create a two-dimensional array at runtime create-a-two-dimensional-array-at-runtime.raku
- Hailstone sequence hailstone-sequence.raku
- Last fridays of the year last-fridays-of-year.raku
- Prime decomposition prime-decomposition.raku
- README.md
99 Problems
Based on lisp 99 problems
- 99-problems.pod
- P01 - Find the last box of a list. P01-scottp.raku
- P01 - Find the last element of a list. P01-topo.raku
- P02 - Find the last but one box of a list. P02-scottp.raku
- P02 - Find the last two elements of a list. P02-topo.raku
- P03 - Find the K'th element of a list. P03-scottp.raku
- P03 - Find the kth element of a list. P03-topo.raku
- P04 - Find the number of elements of a list P04-scottp.raku
- P04 - Find the number of elements in a list. P04-topo.raku
- P05 - Reverse a list P05-scottp.raku
- P05 - Reverse a list. P05-topo.raku
- P06 - Find out whether a list is a palindrome. P06-ajs.raku
- P06 - Find out whether a list is a palindrome. P06-scottp.raku
- P06 - Find out whether a list is a palindrome. P06-sdondley.raku
- P06 - Find out whether a list is a palindrome. P06-topo.raku
- P07 - Flatten a nested array structure. P07-eric256.raku
- P07 - Flatten a nested array structure. P07-topo.raku
- P07 - Flatten a nested array structure. P07-viklund.raku
- P08 - Eliminate consecutive duplicates of list elements. P08-eric256.raku
- P08 - Eliminate consecutive duplicates of list elements. P08-topo.raku
- P08 - Eliminate consecutive duplicates of list elements. P08-viklund.raku
- P09 - Pack consecutive duplicates of list elements into sublists. P09-rje.raku
- P09 - Pack consecutive duplicates of list elements into sublists. P09-scottp.raku
- P09 - Pack consecutive duplicate elements of a list into sublists. P09-topo.raku
- P09 - Pack consecutive duplicates of list elements into sublists. P09-unobe.raku
- P10 - Run-length encoding of a list. P10-scottp.raku
- P10 - Run-length encoding of a list. P10-topo.raku
- P10 - Run-length encoding of a list. P10-unobe.raku
- P11 - Modified run-length encoding. P11-topo.raku
- P11 - Modified run-length encoding. P11-unobe.raku
- P12 - Decode a run-length encoded list. P12-rhebus.raku
- P12 - Decode modified run-length encoding. P12-topo.raku
- P12 - Decode a run-length encoded list. P12-unobe.raku
- P13 - Run-length encoding of a list (direct solution). P13-rhebus.raku
- P13 - Direct run-length encoding. P13-topo.raku
- P13 - Run-length encoding of a list (direct solution). P13-viklund.raku
- P14 - Duplicate the elements of a list. P14-scottp.raku
- P14 - Duplicate the elements in a list. P14-topo.raku
- P14 - Duplicate the elements of a list. P14-viklund.raku
- P15 - Replicate the elements of a list a given number of times. P15-rhebus.raku
- P15 - Replicate the elements of a list a given number of times. P15-topo.raku
- P15 - Replicate the elements of a list a given number of times. P15-unobe.raku
- P16 (**) Drop every N'th element from a list. P16-edpratomo.raku
- P16 - Drop every nth element from a list. P16-topo.raku
- P17 - Split a list into two parts; the length of the first part is given. P17-sdondley.raku
- P17 - Split a list into two parts; the length of the first part is given. P17-topo.raku
- P17 - Split a list into two parts; the length of the first part is given. P17-unobe.raku
- P18 - Extract a slice from a list. Indices start at 1. P18-topo.raku
- P19 - Rotate a list n places to the left. P19-topo.raku
- P20 - Remove the K'th element from a list. P20-rhebus.raku
- P20 - Remove the kth element of a list. P20-topo.raku
- P21 - Insert an element at a given position into an array. P21-scottp.raku
- P21 - Insert an element at a given position into a list. P21-topo.raku
- P22 - Create a list containing all integers within a given range. P22-scottp.raku
- P22 - Create a list containing all integers within a given range. P22-topo.raku
- P23 - Extract a given number of randomly selected elements from a list. P23-topo.raku
- P24 - Draw N different random numbers from the set 1..M. P24-topo.raku
- P25 - Generate a random permutation of the elements of a list. P25-topo.raku
- P26 - Generate the combinations of k distinct objects chosen from the n elements of a list. P26-topo.raku
- P31 - Determine whether a given integer number is prime. P31-rhebus.raku
- P32 - Determine the greatest common divisor of two positive integer P32-rhebus.raku
- P33 - Determine whether two positive integer numbers are coprime. P33-rhebus.raku
- P34 - Calculate Euler's totient function phi(m). P34-rhebus.raku
- P35 - Determine the prime factors of a given positive integer. P35-rhebus.raku
- P36 - Determine the prime factors of a given positive integer (2). P36-ovid.raku
- P36 - Determine the prime factors of a given positive integer (2). P36-rhebus.raku
- P37 - Calculate Euler's totient function phi(m) (improved). P37-rhebus.raku
- P39 - A list of prime numbers. P39-rhebus.raku
- P40 - Goldbach's conjecture. P40-rhebus.raku
- P41 - A list of Goldbach compositions. P41-rhebus.raku
- P91 - Knight's tour. P91-edpratomo.raku
- README.md
Cookbook
Cookbook examples
- Raku Cookbook: Introduction to Strings 01strings
- Substrings 01strings
- Swapping values 01strings
- Converting between characters and numbers. 01strings
- Using Named Unicode Chars 01strings
- Reversing a String by Word or Character 01strings
- Upper/Lower Case 01strings
- Trimming whitespace from both ends of a string 01strings
- Soundex Matching 01strings
- Valid Number 02numbers
- Convert to/from Roman Numerals 02numbers
- Logarithms 02numbers
- Complex Numbers 02numbers
- Convert Bases 02numbers
- Today's Date 03dates-and-times
- DateTime to Epoch Seconds 03dates-and-times
- Epoch Seconds to DateTime 03dates-and-times
- Adding and Subtracting Dates 03dates-and-times
- Subtracting Two Dates From Each other 03dates-and-times
- From date to week of year, month of year, day of year 03dates-and-times
- Hi-Res Timings 03dates-and-times
- Specifying a list in your program 04arrays
- Printing a list with commas 04arrays
- Iterating Over an Array 04arrays
- Traversing a hash 05hashes
- Copy and substitute simultaneously 06pattern-matching
- Matching alphabetic wide characters 06pattern-matching
- Opening a file 07file-access
- Count File Lines 08file-contents
- Process every word in a file 08file-contents
- Read file lines backwards 08file-contents
- Get/Set Filetime 09directories
- Delete File 09directories
- Copy/Move File 09directories
- Process all files in a directory 09directories
- Get list of files matching a pattern 09directories
- Process files recursively 09directories
- Splitting up a filename 09directories
- Process files lazy 09directories
- Accessing subroutine arguments 10subroutines
- Constructing an object 13classes-objects-and-ties
- Managing Instance data 13classes-objects-and-ties
- Managing Instance data 13classes-objects-and-ties
- Overloading operators 13classes-objects-and-ties
- Executing SQL with DBIish 14database-access
- Parsing program arguments 15interactivity
- Test whether program is interactive or not 15interactivity
- Clear the screen 15interactivity
- Change text colour 15interactivity
- Timeout Operation 16processes
- List Signals 16processes
- Send a signal to a process 16processes
- Catch ctrl-c 16processes
- Writing a TCP Client 17sockets
- Writing a TCP Server 17sockets
- Writing a CGI Script 19cgi-programming
- Fetch uri 20web-automation
Project Euler
Answers for Project Euler
- Multiples of 3 and 5 prob001-cspencer.raku
- Multiples of 3 and 5 prob001-eric256.raku
- Multiples of 3 and 5 prob001-grondilu.raku
- Multiples of 3 and 5 prob001-hexmode.raku
- Multiples of 3 and 5 prob001-unobe.raku
- Even Fibonacci numbers prob002-eric256.raku
- Even Fibonacci numbers prob002-gerdr.raku
- Even Fibonacci numbers prob002-hexmode.raku
- Largest prime factor prob003-eric256.raku
- Largest prime factor prob003-gerdr.raku
- Largest prime factor prob003-hexmode.raku
- Largest prime factor prob003-lanny.raku
- Largest palindrome product prob004-unobe.raku
- Largest palindrome product prob004-xfix.raku
- Smallest multiple prob005-unobe.raku
- Smallest multiple prob005-xfix.raku
- Sum square difference prob006-polettix.raku
- 10001st prime prob007-polettix.raku
- Largest product in a series prob008-duff.raku
- Largest product in a series prob008-duff2.raku
- Special Pythagorean triplet prob009-gerdr-feeds.raku
- Special Pythagorean triplet prob009-gerdr.raku
- Special Pythagorean triplet prob009-polettix.raku
- Summation of primes prob010-polettix.raku
- Largest product in a grid prob011-moritz.raku
- Highly divisible triangular number prob012-polettix.raku
- Large sum prob013-grondilu.raku
- Longest Collatz sequence prob014-felher.raku
- Lattice paths prob015-felher.raku
- Power digit sum prob016-grondilu.raku
- Number letter counts prob017-duff.raku
- Maximum path sum I prob018-felher.raku
- Counting Sundays prob019-grondilu.raku
- Factorial digit sum prob020-grondilu.raku
- Amicable numbers prob021-gerdr.raku
- Names scores prob022-grondilu.raku
- Non-abundant sums prob023-shlomif.raku
- Lexicographic permutations prob024-moritz.raku
- 1000-digit Fibonacci number prob025-polettix.raku
- Reciprocal cycles prob026-shlomif.raku
- Quadratic primes prob027-shlomif.raku
- Number spiral diagonals prob028-shlomif.raku
- Distinct powers prob029-gerdr.raku
- Distinct powers prob029-polettix.raku
- Coin sums prob031-shlomif.raku
- Digit cancelling fractions prob033-andreoss.raku
- Digit factorials prob034-quinny.raku
- Double-base palindromes prob036-xenu.raku
- Pandigital multiples prob038-andreoss.raku
- Integer right triangles prob039-quinny.raku
- Pandigital Prime prob041-heyajulia-alternative.raku
- Pandigital Prime prob041-heyajulia.raku
- Coded triangle numbers prob042-shlomif.raku
- Distinct primes factors prob047-gerdr.raku
- Permuted multiples prob052-duff.raku
- Combinatoric selections prob053-duff.raku
- Combinatoric selections prob053-gerdr.raku
- Poker hands prob054-andreoss.raku
- Lychrel numbers prob055-shlomif.raku
- prob056-shlomif.raku
- XOR decryption prob059-andreoss.raku
- Powerful digit counts prob063-moritz.raku
- Powerful digit counts prob063-polettix.raku
- Convergents of e prob065-andreoss.raku
- prob065-grondilu.raku
- Diophantine equation prob066-andreoss.raku
- Maximum path sum II prob067-felher.raku
- Square root digital expansion prob080-andreoss.raku
- Path sum: two ways prob081-moritz.raku
- Roman numerals prob089-andreoss.raku
- Square digit chains prob092-moritz.raku
- Large non-Mersenne prime prob097-andreoss.raku
- Anagramic squares prob098-andreoss.raku
- Largest exponential prob099-andreoss.raku
- README.md
Games
Games written in Perl 6
- Blackjack blackjack.raku
- Connect4 connect4.raku
- Flashcard flashcard.raku
- Hangman hangman.raku
- Tic Tac Toe tictactoe.raku
- Yahtzee yahtzee.raku
Interpreters
Language or DSL interpreters
- Brainfuck Interpreter brainfuck.raku
- Simple Infix Arithmetic Calculator calc.raku
- Simple Lisp Interpreter lisp.raku
- Reverse Polish Notation Calculator RPN.raku
Module Management
Examples of organising modules
Parsers
Example grammars
- CSS2.1 Grammar CSSGrammar.rakumod
- Newick tree format Newick.rakumod
- Simple strings SimpleStrings.rakumod
Perlmonks
Answers to perlmonks.org questions
Category perlmonks not found
$[
"99-problems",
"best-of-rosettacode",
"cookbook",
"euler",
"games",
"interpreters",
"module-management",
"other",
"parsers",
"rosalind",
"shootout",
"tutorial",
"wsg"
]Project Rosalind
Bioinformatics-related programming problems
- Counting Disease Carriers afrq-grondilu.raku
- Introduction to Alternative Splicing aspc-grondilu.raku
- Consensus and Profile cons-grondilu.raku
- Comparing Spectra with the Spectral Convolution conv-grondilu.raku
- Creating a Character Table from Genetic Strings cstr-grondilu.raku
- Creating a Character Table ctbl-grondilu.raku
- Introduction to Protein Databases dbpr-grondilu.raku
- Counting DNA Nucleotides dna-gerdr.raku
- Counting DNA Nucleotides dna-grondilu.raku
- Enumerating Unrooted Binary Trees eubt-grondilu.raku
- Expected Number of Restriction Sites eval-grondilu.raku
- Rabbits and Recurrence Relations fib-grondilu.raku
- Mortal Fibonacci Rabbits fibd-grondilu.raku
- Computing GC Content gc-gerdr.raku
- Overlap Graphs grph-grondilu.raku
- Counting Point Mutations hamm-grondilu.raku
- Calculating Expected Offspring iev-grondilu.raku
- Independent Segregation of Chromosomes indc-grondilu.raku
- Mendel's First Law iprb-grondilu.raku
- Finding Disjoint Motifs in a Gene itwv-grondilu.raku
- Finding a Shared Spliced Motif lcsq-grondilu.raku
- Independent Alleles lia-grondilu.raku
- lrep-grondilu-p5.raku
- Maximum Matchings and RNA Secondary Structures mmch-grondilu.raku
- Finding a Protein Motif mprt-grondilu.raku
- Inferring mRNA from Protein mrna-grondilu.raku
- Distances in Trees nwck-grondilu.raku
- Open Reading Frames orf-grondilu.raku
- Perfect Matchings and RNA Secondary Structures pmch-grondilu.raku
- Partial Permutations pper-grondilu.raku
- Introduction to Random Strings prob-grondilu.raku
- Quartets qrt-grondilu.raku
- README.md
- Complementing a Strand of DNA revc-gerdr.raku
- Transcribing DNA into RNA rna-gerdr.raku
- Matching Random Motifs rstr-grondilu.raku
- Sex-Linked Inheritance sexl-grondilu.raku
- Using the Spectrum Graph to Infer Peptides sgra-grondilu.raku
- Inferring Protein from Spectrum spec-grondilu.raku
- Finding a Spliced Motif sseq-grondilu.raku
- Finding a Motif in DNA subs-grondilu.raku
- Encoding Suffix Trees suff-grondilu.raku
- Transitions and Transversions tran-grondilu.raku
- Introduction to Pattern Matching trie-grondilu.raku
Shootout
Implementations for the Computer Language Benchmark Game
- fasta.p5.raku
- Generate and write random DNA sequences fasta.raku
- k-nucleotide.p5.raku
- Repeatedly update hashtables and k-nucleotide strings k-nucleotide.raku
- Generates the Mandelbrot Set fractal mandelbrot.raku
- Perform an N-body simulation of the Jovian planets n-body-v2.raku
- n-body.p5.raku
- Perform an N-body simulation of the Jovian planets n-body.raku
- regex-dna.p5.raku
- Match DNA 8-mers and substitute nucleotides for IUB code regex-dna.raku
- Read DNA sequences and write their reverse-complement revcomp-v2.raku
- revcomp.p5.raku
- Read DNA sequences and write their reverse-complement revcomp.raku
Perl6 Tutorial Examples
Initial work in collecting Perl 6 tutorial examples
- Reading from a file 01-read-from-file.raku
- Reading from the terminal 01-read-from-terminal.raku
- Word-wrap paragraphs to a given length 01-word-wrap.raku
- Write to a file 01-write-to-file.raku
- Lazily evaluate items in a list lazy-evaluation.raku
Winter Scripting Games
Answers for the Winter Scripting Games
- Could I Get Your Phone Number? advanced-2008
- Skating on Thin Ice advanced-2008
- You Call That a Strong Password? advanced-2008
- Blackjack! advanced-2008
- One of These Things is not Like the Others beginner-2007
- Pairing Off beginner-2008
- Pairing off beginner-2008
- Pairing Off beginner-2008
- Let's Get Together beginner-2008
- Coffee Break beginner-2008
- Coffee Break beginner-2008
- Random Guess beginner-2008
- Random Guess beginner-2008
- Bowling beginner-2008
- README.md
Other examples
Other examples which aren't yet categorized