## dist_zef-Kaiepi-Gauge.md
![Build Status](https://github.com/Kaiepi/ra-Gauge/actions/workflows/test.yml/badge.svg)

# NAME

Gauge - Iterative polling

# SYNOPSIS

```
use v6.d;
use Gauge;

#|[ Jury-rigged benchmark that keys it/s counts of an evaluated code block. ]
sub MAIN(
    **@code,
    #|[ The number of threads to dedicate to benchmarking. ]
    UInt:D :j(:$jobs) = $*KERNEL.cpu-cores.pred,
    #|[ The duration in seconds over which timestamps will be aggregated. ]
    Real:D :p(:$period) = 1,
    #|[ The cooldown in seconds performed between each individual benchmark. ]
    Real:D :c(:$cooldown) = (try 2 / 3 * $jobs * $period) // (2 / 3 * $*KERNEL.cpu-cores.pred),
    #|[ Whether or not ANSI 24-bit SGR escape sequences should be suppressed.
        These highlight blocks of it/s counts opening with any new maximum. ]
    Bool:D :m(:$mono) = False,
--> Nil) {
    use MONKEY-SEE-NO-EVAL;
    map $mono ?? &mono !! &poly,
        Gauge(EVAL Qa[-> { @code.join(' ') }])
            .poll($period)
            .pledge($jobs)
            .throttle($cooldown);
}
#=[ Benchmark threads are run once an iteration of any existing threads has
    been exhausted. This is staggered by the cooldown, and by default, allows
    for multiple benchmarks to be taken with a brief overlap of threaded work,
    reducing the time needed to collect results while keeping low overhead. ]

sub poly(Int:D $next --> Empty) {
    my constant @mark = «\e[48;5;198m \e[48;5;202m \e[48;5;178m \e[48;5;41m \e[48;5;25m \e[48;5;129m»;
    state $mark is default(-1);
    state $peak is default(-1);

    my $jump := $peak < $next;
    $mark += $jump;
    $mark %= @mark;
    $peak max= $next;

    my $note = @mark[$mark];
    $note ~= $jump ?? '⊛' !! '∗';
    $note ~= " \e[m";
    $note ~= $next;

    put $note
}

sub mono(Int:D $next --> Empty) {
    state $peak is default(-1);

    my $jump := $peak < $next;
    $peak max= $next;

    my $note = $jump ?? '⊛' !! '∗';
    $note ~= ' ';
    $note ~= $next;

    put $note
}

```

# DESCRIPTION

```
class Gauge is Seq { ... }

```

`Gauge`, in general, provides an interface for a collection of temporal, lazy, non-deterministic iterators. At its base, it attempts to measure durations of calls to a block with as little overhead as possible in order to avoid unnecessary influence over results. This can stack operations mapping its iterator until it decays to a `Seq` via `Iterable` or the `iterator` itself.

# METHODS

## CALL-ME

```
method CALL-ME(::?CLASS:_: Block:D $block --> ::?CLASS:D)

```

Produces a new `Gauge` sequence of native `uint64` durations of a call to the given block. Measurements of each duration are **not** monotonic, thus leap seconds and hardware errors will skew results.

## poll

```
method poll(::?CLASS:D: Real:D $seconds --> ::?CLASS:D)

```

Returns a new `Gauge` sequence that produces an `Int:D` count of iterations of the former totalling a duration of `$seconds`. This will take longer than the given argument to complete due to the overhead of iteration, which may be measured by `Gauge` itself in combination with `head`.

## throttle

```
method throttle(::?CLASS:D: Real:D $seconds --> ::?CLASS:D)

```

Returns a new `Gauge` sequence that will sleep `$seconds` between iterations of its former. If a `poll` is applied later, this will incorporate the time waited into the time it takes to complete an iteration, but not any steps in between required to caculated. The total time throttled is allowed to exceed any poll applied to a `Gauge`, but never by any more than one iteration.

## pledge

```
method pledge(::?CLASS:D: UInt:D $length --> ::?CLASS:D)

```

Returns a new `Gauge` sequence that, across an array of threads of breadth `$length`, pledges that a form of iteration will be continuously invoked across a threaded repetition of this iterator's component iterators in the process. When an empty length is given, this will not change the iteration.

When a length of `1` is given, this will produce a *covenant* wrapping the iterator. This is a thread that upon receiving a query to perform an iteration, will produce its result, then go ahead and perform another iteration while waiting for the next query. This means switching from `skip` to `head` may perform an extra `skip` whose result is discarded while waiting for `head`. Such a thread will finish in a sink context, but is allowed to wait until the end of a program after decaying to another `Seq` when it doesn't play nice.

When a length of `2` or more is given, a *contract* wrapping this number of covenants will be formed. This carries a particular cycle followed to accomodate any throttling performed beforehand. A thread must be spawned in order to work, but any prior threads may complete an iteration during this timespan, and will be waited on in reverse as each covenant is run in its original ordering.

# AUTHOR

Ben Davies (Kaiepi)

# COPYRIGHT AND LICENSE

Copyright 2023 Ben Davies

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_github-supernovus-Flower.md
# Flower: XML Application Languages

## Introduction

Flower is a library for building and using XML Application Languages.
An XML Application Language can be anything that takes an XML document,
and parses it using a set of data. It's perfect for creating template engines,
custom XML syntax, and much more, all using pure XML as its input and output
formats.

Flower was originally written to create an implementation of the TAL and METAL
template engines from Zope. Flower's name was originally a play on the Perl 5
Petal library. Since then, Flower has outgrown its original scope, bringing
in further ideas from Template::TAL, PHPTAL, and some of my own custom XML
concepts. The original TAL/METAL/TALES parsers are still included, and can
be easily used by using Flower::TAL, which is included (see below.)

## Flower::TAL

This is an easily loadable library that extends Flower and automatically
loads the Flower::TAL::TAL, Flower::TAL::METAL application languages
by default, and offers the ability to easily load plugins for the
Flower::TAL::TALES attribute parser (used by Flower::TAL::TAL)

### Differences from Petal (and Template::TAL, PHPTAL and Zope)

* The default local namespace is 'tal', and to override it, you must
  declare <http://xml.zope.org/namespaces/tal> instead of the Petal namespace.
* Flower can use template strings instead of requiring files.
* In addition to strings, it can use a custom provider class.
  Currently a File provider is included.
* Flower does not support the multiple template files based on language.
  But that can be added easily by defining a custom Provider class.
* Adding custom modifiers is completely different in Flower.
* There is NO support for anything but well-formed XML.
  There is no equivelant to the Petal::Parser::HTB, and no plans for one.
* Flower supports tal:block elements, as per the PHPTAL project.
* While you can use the 'structure' keyword, it's not really needed.
  If you want an unescaped XML structure for a replacement, send an
  Exemel object (any class other than Document) and it will be added to
  the XML tree. Send an array of Exemel objects, and they will additionally
  be parsed for TAL statements.
* Nested repeats cannot use the same attribute name, it will get clobbered.
* The built-in repeat object is implemented as per Zope and PHPTAL, not
  the Petal version. Note: it does not support the 'letter' or 'Letter'
  attributes, but instead has some new methods that take paramters:
  'every xx' the number (not the index) is divisible by xx.
  'skip xx' the number is not divisible by xx.
  'gt xx' the number is greater than xx.
  'lt xx' the number is less than xx.
  'eq xx' the number is equal to xx.
  'ne xx' the number is not equal to xx.
* I'm not sure how Petal, PHPTAL or Zope deal with TAL attributes in the
  root element (the top-most element of the document), but to avoid death,
  destruction and mayhem, Flower only processes 'define', 'attributes'
  and 'content' tags on the root element. The rest of the tags are only
  processed on children of the root.

The above list will be updated as this project is developed, as I'm sure
other changes will be introduced that will be a gotchya for users of Petal,
Zope or PHPTAL.

### Flower::TAL::TALES Plugins

Inspired by Petal::Utils, Flower includes a bunch of libraries in the
Flower::TAL::TALES:: namespace. These are available using Flower::TAL's
add-tales() method.

* Text, same as the :text set from Petal::Utils

  * lc: make the string lowercase.
  * uc: make the string uppercase.
  * ucfirst: make the first letter of the string uppercase.
  * substr: extract a portion of the string.
  * printf: format a string or object in a specified way.
* List, similar to the :list set from Petal::Utils.

  * group: turns a flat Array into a nested Array, where each inner
    Array has a set number of elements in it.
  * sort: sort the array using the default sort algorithm.
  * limit: only return the first number of items from the list.
  * shuffle: shuffle the list into a random order.
  * pick: pick a set number of items randomly from the list.
  * reverse: reverse the contents of the list.
* Date, similar to the :date set from Petal::Utils, using on DateTime::Utils

  * date: Builds a DateTime object using specified paramters.
  * time: Builds a DateTime object from a Unix epoch.
  * strftime: Displays a date/time string in a specified format.
  * rfc: A modifier specifically for use with strftime, as the format.
  * now: A modifier specifically for use with strftime, as the object.
* Debug, similar to :debug set from Petal::Utils.

  * dump: modifier spits out the .perl representation of the object.
  * what: modifier spits out the class name of the object.

In addition, the following sets are planned for inclusion at some point:

* Logic, similar to the :logic set from Petal::Utils
* Hash, same as the :hash set from Petal::Utils

The syntax for the Flower::TAL plugins is based on the modifiers from
Petal::Utils, but extended to use the Flower-specific extensions (the
same method that is used to parse method call parameters in queries.)
As is obvious, the syntax is not always the same, and not all of the
modifiers are the same.

Full documentation for the usage of Flower and the Flower::Utils modifiers
will be included in the doc/ folder in an upcoming release, until then
there are comments in the libraries, and test files in t/ that show the
proper usage.

The URI set from Petal::Utils is not planned for inclusion,
feel free to write it if you need it.
I'm sure new exciting libraries will be made adding onto these.

## TODO

* Add Logic and Hash TALES plugins.
* Implement optional query caching.
* Implement multiple paths (/test/path1 | /test/path2) support.
* Implement on-error.
* Add Flower::Provider::Multiple for querying providers by prefix.

## Requirements

* [XML](http://github.com/supernovus/exemel/)
* [DateTime::Utils](http://github.com/supernovus/temporal-utils/)

## Author

Timothy Totten, supernovus on #perl6, <https://github.com/supernovus/>

## License

[Artistic License 2.0](http://www.perlfoundation.org/artistic_license_2_0)


## valueobjat.md
class ValueObjAt

Unique identification for value types

```raku
class ValueObjAt is ObjAt { }
```

A subclass of [`ObjAt`](/type/ObjAt) that should be used to indicate that a class produces objects that are value types - in other words, that are immutable after they have been initialized.

```raku
my %h = a => 42;        # mutable Hash
say %h.WHICH;           # OUTPUT: «ObjAt.new("Hash|1402...888")␤»

my %m is Map = a => 42; # immutable Map
say %m.WHICH;           # OUTPUT: «ValueObjAt.new("Map|AAF...09F61F")␤»
```

If you create a class that should be considered a value type, you should add a `WHICH` method to that class that returns a `ValueObjAt` object, for instance:

```raku
class YourClass {
    has $.foo;  # note these are not mutable
    has $.bar;

    method WHICH() {
        ValueObjAt.new("YourClass|$!foo|$!bar");
    }
}
```

Note that it is customary to always start the identifying string with the name of the object, followed by a "|". This to prevent confusion with other classes that may generate similar string values: the name of the class should then be enough of a differentiator to prevent collisions.

# [Typegraph](# "go to top of document")[§](#typegraphrelations "direct link")

Type relations for `ValueObjAt`

raku-type-graph

ValueObjAt
ValueObjAt

ObjAt
ObjAt

ValueObjAt->ObjAt

Mu
Mu

Any
Any

Any->Mu

ObjAt->Any

[Expand chart above](/assets/typegraphs/ValueObjAt.svg)


## dist_cpan-TITSUKI-Algorithm-LBFGS.md
[![Build Status](https://travis-ci.com/titsuki/raku-Algorithm-LBFGS.svg?branch=master)](https://travis-ci.com/titsuki/raku-Algorithm-LBFGS)

# NAME

Algorithm::LBFGS - A Raku bindings for libLBFGS

# SYNOPSIS

```
use Algorithm::LBFGS;
use Algorithm::LBFGS::Parameter;

my Algorithm::LBFGS $lbfgs .= new;
my &evaluate = sub ($instance, $x, $g, $n, $step --> Num) {
   my Num $fx = ($x[0] - 2.0) ** 2 + ($x[1] - 5.0) ** 2;
   $g[0] = 2.0 * $x[0] - 4.0;
   $g[1] = 2.0 * $x[1] - 10.0;
   return $fx;
};
my Algorithm::LBFGS::Parameter $parameter .= new;
my Num @x0 = [0e0, 0e0];
my @x = $lbfgs.minimize(:@x0, :&evaluate, :$parameter);
@x.say; # [2e0, 5e0]

```

# DESCRIPTION

Algorithm::LBFGS is a Raku bindings for libLBFGS. libLBFGS is a C port of the implementation of Limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) method written by Jorge Nocedal.

The L-BFGS method solves the unconstrainted minimization problem,

```
minimize F(x), x = (x1, x2, ..., xN),

```

only if the objective function F(x) and its gradient G(x) are computable.

## CONSTRUCTOR

```
my $lbfgs = Algorithm::LBFGS.new;
my Algorithm::LBFGS $lbfgs .= new; # with type restrictions

```

## METHODS

### minimize(:@x0!, :&evaluate!, :&progress, Algorithm::LBFGS::Parameter :$parameter!) returns Array

```
my @x = $lbfgs.minimize(:@x0!, :&evaluate, :&progress, :$parameter); # use &progress callback
my @x = $lbfgs.minimize(:@x0!, :&evaluate, :$parameter);

```

Runs the optimization and returns the resulting variables.

`:@x0` is the initial value of the variables.

`:&evaluate` is the callback function. This requires the definition of the objective function F(x) and its gradient G(x).

`:&progress` is the callback function. This gets called on every iteration and can output the internal state of the current iteration.

`:$parameter` is the instance of the `Algorithm::LBFGS::Parameter` class.

#### :&evaluate

The one of the simplest `&evaluate` callback function would be like the following:

```
my &evaluate = sub ($instance, $x, $g, $n, $step --> Num) {
   my Num $fx = ($x[0] - 2.0) ** 2 + ($x[1] - 5.0) ** 2; # F(x) = (x0 - 2.0)^2 + (x1 - 5.0)^2

   # G(x) = [∂F(x)/∂x0, ∂F(x)/∂x1]
   $g[0] = 2.0 * $x[0] - 4.0; # ∂F(x)/∂x0 = 2.0 * x0 - 4.0
   $g[1] = 2.0 * $x[1] - 10.0; # ∂F(x)/∂x1 = 2.0 * x1 - 10.0
   return $fx;
};

```

* `$instance` is the user data. (NOTE: NYI in this binder. You must set it as a first argument, but you can't use it in the callback.)
* `$x` is the current values of variables.
* `$g` is the current gradient values of variables.
* `$n` is the number of variables.
* `$step` is the line-search step used for this iteration.

`&evaluate` requires all of these five arguments in this order.

After writing the definition of the objective function F(x) and its gradient G(x), it requires returning the value of the F(x).

#### :&progress

The one of the simplest `&progress` callback function would be like the following:

```
my &progress = sub ($instance, $x, $g, $fx, $xnorm, $gnorm, $step, $n, $k, $ls --> Int) {
    "Iteration $k".say;
    "fx = $fx, x[0] = $x[0], x[1] = $x[1]".say;
    return 0;
}

```

* `$instance` is the user data. (NOTE: NYI in this binder. You must set it as a first argument, but you can't use it in the callback.)
* `$x` is the current values of variables.
* `$g` is the current gradient values of variables.
* `$fx` is the current value of the objective function.
* `$xnorm` is the Euclidean norm of the variables.
* `$gnorm` is the Euclidean norm of the gradients.
* `$step` is the line-search step used for this iteration.
* `$n` is the number of variables.
* `$k` is the iteration count.
* `$ls` the number of evaluations called for this iteration.

`&progress` requires all of these ten arguments in this order.

#### Algorithm::LBFGS::Parameter :$parameter

Below is the examples of creating a Algorithm::LBFGS::Parameter instance:

```
my Algorithm::LBFGS::Parameter $parameter .= new; # sets default parameter
my Algorithm::LBFGS::Parameter $parameter .= new(max_iterations => 100); # sets max_iterations => 100

```

##### OPTIONS

* Int `m` is the number of corrections to approximate the inverse hessian matrix.
* Num `epsilon` is epsilon for convergence test.
* Int `past` is the distance for delta-based convergence test.
* Num `delta` is delta for convergence test.
* Int `max_iterations` is the maximum number of iterations.
* Int `linesearch` is the line search algorithm. This requires one of `LBFGS_LINESEARCH_DEFAULT`, `LBFGS_LINESEARCH_MORETHUENTE`, `LBFGS_LINESEARCH_BACKTRACKING_ARMIJO`, `LBFGS_LINESEARCH_BACKTRACKING`, `LBFGS_LINESEARCH_BACKTRACKING_WOLFE` and `LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE`. The default value is `LBFGS_LINESEARCH_MORETHUENTE`.
* Int `max_linesearch` is the maximum number of trials for the line search.
* Num `min_step` is the minimum step of the line search routine.
* Num `max_step` is the maximum step of the line search.
* Num `ftol` is a parameter to control the accuracy of the line search routine.
* Num `wolfe` is a coefficient for the Wolfe condition.
* Num `gtol` is a parameter to control the accuracy of the line search routine.
* Num `xtol` is the machine precision for floating-point values.
* Num `orthantwise_c` is a coeefficient for the L1 norm of variables.
* Int `orthantwise_start` is the start index for computing L1 norm of the variables.
* Int `orthantwise_end` is the end index for computing L1 norm of the variables.

## STATUS CODES

TBD

# AUTHOR

titsuki [titsuki@cpan.org](mailto:titsuki@cpan.org)

# COPYRIGHT AND LICENSE

Copyright 2016 titsuki

Copyright 1990 Jorge Nocedal

Copyright 2007-2010 Naoki Okazaki

libLBFGS by Naoki Okazaki is licensed under the MIT License.

This library is free software; you can redistribute it and/or modify it under the terms of the MIT License.

# SEE ALSO

* libLBFGS <http://www.chokkan.org/software/liblbfgs/index.html>


## dist_zef-dwarring-Pod-To-PDF-Lite.md
# TITLE

Pod::To::PDF::Lite

# SUBTITLE

Pod to PDF draft renderer

## Description

Renders Pod to PDF draft documents via PDF::Lite.

## Usage

From command line:

```
$ raku --doc=PDF::Lite lib/To/Class.rakumod --save-as=To-Class.pdf

```

From Raku:

```
use Pod::To::PDF::Lite;

=NAME
foobar.pl

=SYNOPSIS
    foobar.pl <options> files ...

pod2pdf($=pod).save-as: "foobar.pdf";

```

## Exports

```
class Pod::To::PDF::Lite;
sub pod2pdf; # See below

```

From command line:

```
$ raku --doc=PDF::Lite lib/to/class.rakumod --save-as=class.pdf

```

From Raku code, the `pod2pdf` function returns a PDF::Lite object which can be further manipulated, or saved to a PDF file.

```
use Pod::To::PDF::Lite;
use PDF::Lite;

=NAME
foobar.raku

=SYNOPSIS
    foobarraku <options> files ...

my PDF::Lite $pdf = pod2pdf($=pod);
$pdf.save-as: "foobar.pdf"

```

### Command Line Options:

**--save-as=pdf-filename**

File-name for the PDF output file. If not given, the output will be saved to a temporary file. The file-name is echoed to `stdout`.

**--width=n**

Page width in points (default: 592)

**--height=n**

Page height in points (default: 792)

**--margin=n --margin-left=n --margin-right=n --margin-top=n --margin-bottom=n**

Page margins in points (default: 20)

**--page-numbers**

Output page numbers (format `Page n of m`, bottom right)

**--page-style**

```
-raku --doc=PDF::Lite lib/to/class.rakumod --page-style='margin:10px 20px; width:200pt; height:500pt" --save-as=class.pdf

```

Perform CSS `@page` like styling of pages. At the moment, only margins (`margin`, `margin-left`, `margin-top`, `margin-bottom`, `margin-right`) and the page `width` and `height` can be set. The optional [CSS::Properties](https://css-raku.github.io/CSS-Properties-raku/) module needs to be installed to use this option.

## Subroutines

### sub pod2pdf()

`raku sub pod2pdf( Pod::Block $pod, ) returns PDF::Lite;`

Renders the specified Pod to a PDF::Lite object, which can then be further manipulated or saved.

**`PDF::Lite :$pdf`**

An existing PDF::Lite object to add pages to.

**`UInt:D :$width, UInt:D :$height`**

The page size in points (default 612 x 792).

**`UInt:D :$margin`**

The page margin in points (default 20).

**`Hash :@fonts`**

By default, Pod::To::PDF::Lite uses core fonts. This option can be used to preload selected fonts.

Note: PDF::Font::Loader must be installed, to use this option.

```
use PDF::Lite;
use Pod::To::PDF::Lite;
need PDF::Font::Loader; # needed to enable this option

my @fonts = (
    %(:file<fonts/Raku.ttf>),
    %(:file<fonts/Raku-Bold.ttf>, :bold),
    %(:file<fonts/Raku-Italic.ttf>, :italic),
    %(:file<fonts/Raku-BoldItalic.ttf>, :bold, :italic),
    %(:file<fonts/Raku-Mono.ttf>, :mono),
);

PDF::Lite $pdf = pod2pdf($=pod, :@fonts);
$pdf.save-as: "pod.pdf";

```

## Asynchronous Rendering (Experimental)

```
$ raku --doc=PDF::Lite::Async lib/to/class.rakumod | xargs evince

```

Also included in this module is class `Pod::To::PDF::Lite::Async`. This extends the `Pod::To::PDF::Lite` Pod renderer, adding the ability to render larger documents concurrently.

For this mode to be useful, the document is likely to be of the order of dozens of pages and include multiple level-1 headers (for batching purposes).

## Restrictions

PDF::Lite minimalism, including:

* no Table of Contents or Index
* no Links
* no Marked Content/Accessibility

## See Also

* Pod::To::PDF::Lite::Async - Multi-threaded rendering mode (experimental)
* Pod::To::PDF - PDF rendering via <Cairo>


## dist_zef-raku-community-modules-Statistics-LinearRegression.md
[![Actions Status](https://github.com/raku-community-modules/Statistics-LinearRegression/actions/workflows/linux.yml/badge.svg)](https://github.com/raku-community-modules/Statistics-LinearRegression/actions) [![Actions Status](https://github.com/raku-community-modules/Statistics-LinearRegression/actions/workflows/macos.yml/badge.svg)](https://github.com/raku-community-modules/Statistics-LinearRegression/actions) [![Actions Status](https://github.com/raku-community-modules/Statistics-LinearRegression/actions/workflows/windows.yml/badge.svg)](https://github.com/raku-community-modules/Statistics-LinearRegression/actions)

# NAME

Statistics::LinearRegression - simple linear regression

# SYNOPSIS

Gather some data

```
my @arguments = 1,2,3;
my @values = 3,2,1;

```

Build model and predict value for some x using object

```
use Statistics::LinearRegression;
my $x = 15;
my $y = my LR.new(@arguments, @values).at($x);

```

If you prefer bare functions, use :ALL

```
use Statistics::LinearRegression :ALL;
my ($slope, $intercept) = get-parameters(@arguments, @values);
my $x = 15;
my $y = value-at($x, $slope, $intercept);

```

# DESCRIPTION

LinearRegression finds slope and intercept parameters of linear function by minimizing mean square error.

Value at y is calculated using `y = slope × x + intercept`.

# TODO

* R^2 and p-value calculation
* support for other objective functions

# CHANGES

* 1.1.0 LR class exported by default, bare subroutines need :ALL

# AUTHOR

Paweł Szulc

# COPYRIGHT AND LICENSE

Copyright 2016 -2017 Paweł Szulc

Copyright 2024 Raku Community

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_cpan-TYIL-IRC-Client-Plugin-NickServ.md
## class IRC::Client::Plugin::NickServ

The IRC::Client::Plugin to deal with NickServ interaction.

### has Config $.config

A Config instance to hold all configuration.

### method irc-n376

```
method irc-n376(
    $event
) returns Mu

```

Identify with NickServ. This is done on IRC code 376 (end of MOTD), since this is what most servers accept as the earliest time to start interacting with the server.


## dist_zef-raku-community-modules-Email-SendGrid.md
[![Actions Status](https://github.com/raku-community-modules/Email-SendGrid/actions/workflows/linux.yml/badge.svg)](https://github.com/raku-community-modules/Email-SendGrid/actions) [![Actions Status](https://github.com/raku-community-modules/Email-SendGrid/actions/workflows/macos.yml/badge.svg)](https://github.com/raku-community-modules/Email-SendGrid/actions) [![Actions Status](https://github.com/raku-community-modules/Email-SendGrid/actions/workflows/windows.yml/badge.svg)](https://github.com/raku-community-modules/Email-SendGrid/actions)

# NAME

Email::SendGrid - Basic email sending via the SendGrid API

# DESCRIPTION

A basic Raku module for sending email using the [SendGrid Web API (v3)](https://www.twilio.com/docs/sendgrid/for-developers/sending-email/api-getting-started).

At the time of writing, SendGrid allows sending up to 100 emails a day free of charge. This module most certainly does not provide full coverage of the SendGrid API; if you need more, pull requests are welcome.

# Usage

Construct an `Eamil::SendGrid` object using your SendGrid API key:

```
my $sendgrid = Email::SendGrid.new(api-key => 'your_key_here');

```

Then call `send-mail` to send email:

```
$sendgrid.send-mail:
  from => address('some@address.com', 'Sender name'),
  to => address('target@address.com', 'Recipient name'),
  subject => 'Yay, SendGrid works!',
  content => {
    'text/plain' => 'This is the plain text message',
    'text/html' => '<strong>HTML mail!</strong>'
  };

```

It is not required to including a HTML version of the body. Optionally, pass `cc`, `bcc`, and `reply-to` to send these addresses. It is also possible to pass a list of up to 1000 addresses to `to`, `cc`, and `bcc`.

If sending the mail fails, an exception will be thrown. Since `Cro::HTTP::Client` is used internally, it will be an exception from that.

```
CATCH {
    default {
        note await .response.body;
    }
}

```

Pass `:async` to `send-mail` to get a `Promise` back instead. Otherwise, it will be ed for you by `send-mail`.

# Class / Methods reference

## class Email::SendGrid

A partial implementation of the SendGrid v3 API, sufficient for using it to do basic email sending. Construct it with your API key (passed as the api-key parameter), and optionally a from address to be used for all of the emails sent. Construct with :persistent to use a persistent Cro HTTP client (can give better throughput if sending many emails).

Minimal validation of an email address - simply that it has an @ sign.

## class Email::SendGrid::Address

Pairs together a name and email address, which are often needed together in the SendGrid API. A name is optional.

Recipient lists may be an address or a list of addresses 1 to 1000 addresses.

### multi sub address

```
multi sub address(
    $email
) returns Mu

```

Construct an Email::SendGrid::Address object from just an email address.

### multi sub address

```
multi sub address(
    $email,
    $name
) returns Mu

```

Construct an Email::SendGrid::Address object from an email address and a name.

### has Str $.api-key

The SendGrid API key.

### has Email::SendGrid::Address $.from

The default from address to use.

### has Cro::HTTP::Client $.client

The Cro HTTP client used for communication.

### method send-mail

```
method send-mail(
    :$to! where { ... },
    :$cc where { ... },
    :$bcc where { ... },
    Email::SendGrid::Address :$from = Code.new,
    Email::SendGrid::Address :$reply-to,
    Str :$subject!,
    :%content!,
    :$async,
    :$sandbox
) returns Mu

```

Send an email. The C, C, and C options may be a single Address object or a list of 1 to 1000 C objects. Only C is required; C is required if there is no object-level from address. Optionally, a C C may be provided. A C is required, as is a C<%content> hash that maps mime types into the matching bodies. If `async` is passed, the call to the API will take place asynchronously, and a C returned.

# AUTHOR

Jonathan Worthington

# COPYRIGHT AND LICENSE

Copyright 2020 Jonathan Worthington

Copyright 2024 Raku Community

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_cpan-SAMGWISE-Math-Curves.md
[![Build Status](https://travis-ci.org/samgwise/p6-Math-Curves.svg?branch=master)](https://travis-ci.org/samgwise/p6-Math-Curves)

# NAME

Math::Curves - Simple functions for simple curves.

# SYNOPSIS

```
use Math::Curves;

# find the point 1/3 along a linear bézier function.
#   Transition, p0   p1
bézier 1/3,     0,  40;

# find the point 1/3 along a quadratic bézier function.
#   Transition, p0  p1   p2
bézier 1/3,     0,  40,  30;

# find the point 1/3 along a cubic bézier function.
#   Transition, p0  p1  p2   p4
bézier 1/3,     0,  40, 30, -10.5;

# find the point 1/3 along a bézier curve of any size > 1.
#   Transition,  p0  p1  p2   ...
bézier 1/3,     (0,  40, 30, -10.5,  18.28);

# Calculate the length of a line with a given gradient
#    position(x)  gradient
line 2,           1/1;

```

# DESCRIPTION

Math::Curves provides some simple functions for plotting points on a curve. The methods above are the only functions currently implemented but I hope to see this list grow over time.

# Contributing

This module is still quite incomplete so please contribute your favourite functions! To do so submit a pull request to the repo on github: <https://github.com/samgwise/p6-Math-Curves>

Contributors will be credited and appreciated :)

# AUTHOR

```
Sam Gillespie

```

# COPYRIGHT AND LICENSE

Copyright 2016 Sam Gillespie

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## uniprop.md
uniprop

Combined from primary sources listed below.

# [In Cool](#___top "go to top of document")[§](#(Cool)_routine_uniprop "direct link")

See primary documentation
[in context](/type/Cool#routine_uniprop)
for **routine uniprop**.

```raku
multi        uniprop(Str:D, |c)
multi        uniprop(Int:D $code)
multi        uniprop(Int:D $code, Stringy:D $propname)
multi method uniprop(|c)
```

Returns the [unicode property](https://en.wikipedia.org/wiki/Unicode_character_property) of the first character. If no property is specified returns the [General Category](https://en.wikipedia.org/wiki/Unicode_character_property#General_Category). Returns a Bool for Boolean properties. A [uniprops](/routine/uniprops) routine can be used to get the property for every character in a string.

```raku
say 'a'.uniprop;               # OUTPUT: «Ll␤»
say '1'.uniprop;               # OUTPUT: «Nd␤»
say 'a'.uniprop('Alphabetic'); # OUTPUT: «True␤»
say '1'.uniprop('Alphabetic'); # OUTPUT: «False␤»
```


## dist_zef-lizmat-ObjectCache.md
[![Actions Status](https://github.com/lizmat/ObjectCache/workflows/test/badge.svg)](https://github.com/lizmat/ObjectCache/actions)

# NAME

ObjectCache - A role to cache objects

# SYNOPSIS

```
use ObjectCache;

sub id(%h --> Int:D) {
    %h<id> or die "must have an id";
}

class Article does ObjectCache[&id] {
    has $.id;
    # has many more attributes
}

say Article.new(id => 42666789).WHICH;  # Article|42666789

```

# DESCRIPTION

The ObjectCache role mixes the logic of creating a proper ObjectType class **and** making sure that each unique ObjectType only exists once in memory, into a class.

The role takes a `Callable` parameterization to indicate how a unique ID should be created from the parameters given (as a hash) with the call to the `new` method. You can also adapt the given hash making sure any default values are properly applied. If there's already an object created with the returned ID, then no new object will be created but the one from the cache will be returned.

A class is considered to be an object type if the `.WHICH` method returns an object of the `ObjAt` class.

This is specifically important when using set operators (such as `(elem)`, or `Set`s, `Bag`s or `Mix`es, or any other functionality that is based on the `===` operator functionality, such as `unique` and `squish`.

The format of the value that is being returned by `WHICH` is only valid during a run of a process. So it should **not** be stored in any permanent medium.

## Removing objects from cache

The `ObjectCache` role contains a private method `!EVICT`. If you'd like to have the ability to remove an object from the cache, you should create a method in your class that will call this method:

```
class Article does ObjectCache[&id] {
    method remove-from-cache() { self!EVICT }
    # more stuff
}

```

The `!EVICT` method returns the object that is removed from the cache, or `Nil` if the object was not in the cache.

## Clearing the cache completely

The `ObjectCache` role contains a private method `!CLEAR`. If you'd like to have the ability to cleare the cache completely, you should create a method in your class that will call this method:

```
class Article does ObjectCache[&id] {
    method clear-cache() { self!CLEAR }
    # more stuff
}

```

The `!CLEAR` method returns the number of objects that have been removed from the cache.

# AUTHOR

Elizabeth Mattijsen [liz@raku.rocks](mailto:liz@raku.rocks)

Source can be located at: <https://github.com/lizmat/ObjectCache> . Comments and Pull Requests are welcome.

If you like this module, or what I’m doing more generally, committing to a [small sponsorship](https://github.com/sponsors/lizmat/) would mean a great deal to me!

# COPYRIGHT AND LICENSE

Copyright 2020, 2021, 2024 Elizabeth Mattijsen

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_zef-bradclawsie-Subsets-Common.md
[![](https://img.shields.io/badge/License-BSD-yellow.svg)](https://opensource.org/licenses/BSD-2-Clause)
[![ci](https://github.com/bradclawsie/Subsets-Common/workflows/test/badge.svg)](https://github.com/bradclawsie/Subsets-Common/actions)

This module is intended to provide a resource for common subsets.

Please submit patches for any new subsets you find interesting.

The goal is to prevent needless duplication and redefinition of obvious subsets.

Thanks to everyone who has contributed issues and patches.

## Notice

This repository was uploaded via `fez` under the username `b7j0c`,
and later `bradclawsie`. This change was made so the username would match
Github. Sorry for any confusion.

## Installation

```
zef install Subsets::Common

```


## dist_zef-tbrowder-CSV-Table.md
[![Actions Status](https://github.com/tbrowder/CSV-Table/actions/workflows/linux.yml/badge.svg)](https://github.com/tbrowder/CSV-Table/actions) [![Actions Status](https://github.com/tbrowder/CSV-Table/actions/workflows/macos.yml/badge.svg)](https://github.com/tbrowder/CSV-Table/actions) [![Actions Status](https://github.com/tbrowder/CSV-Table/actions/workflows/windows.yml/badge.svg)](https://github.com/tbrowder/CSV-Table/actions)

# NAME

**CSV::Table** - Provides routines for querying and modifying a CSV file with or without a header row.

# SYNOPSIS

For example, using an MxN row/column matrix for data plus a header row in a file with the first three lines being:

```
name, age, ...
John, 40,  ...
Sally, 38, ...
...

```

Handle the file with `CSV::Table` in a Raku program:

```
use CSV::Table;
# with indexing from zero
my $t = CSV::Table.new: :csv($my-csv-file);
say $t.fields;       # OUTPUT: «M␤»     # zero if no header row
say $t.rows;         # OUTPUT: «N-1␤»   # N if no header row
say $t.cols;         # OUTPUT: «M␤»
say $t.field[0];     # OUTPUT: «name␤»  # (Any) if no header row
say $t.cell[0][0];   # OUTPUT: «John␤»

```

There are multiple ways to query a data cell:

* by row and column

```
say $t.cell[1][0]    # OUTPUT: «Sally␤»
say $t.rowcol(1, 0); # OUTPUT: «Sally␤»
say $t.rc(1, 0);     # OUTPUT: «Sally␤»
say $t.ij(1, 0);     # OUTPUT: «Sally␤»

```

* by column and row

```
say $t.colrow(0, 1); # OUTPUT: «Sally␤»
say $t.cr(0, 1);     # OUTPUT: «Sally␤»
say $t.ji(0, 1);     # OUTPUT: «Sally␤»

```

You can change the value of any cell:

```
$t.cell[0][1] = 48;
$t.rowcol(0, 1, 50);

```

You can also change the names of fields, but, unless you also change the corresponding field names in the data hashes, you will most likely have problems. It would be much easier to modify the original CSV file.

You can choose to have the changed data (`$t.save`) any time, but you will be asked to confirm the save.

You can also save the data in a new file: `$t.save: $stem`. Where `$stem` is the desired basename without a suffix. The new files will have the '.csv' and '-raw.csv' names (or your desired 'raw' file string).

You can define a CSV table with row names using the '$has-row-names' option to the constructor and query the table by row name and column name.

```
say $t.rowcol("water", "Feb"); # OUTPUT: «10.80␤»

```

# DESCRIPTION

**CSV::Table** is a class enabling access to a CSV table's contents. Tables with a header row must have unique field names. Input files are read immediately, so very large files may overwhelm system resources.

By default, text in a cell is 'normalized', that is, it is trimmed of leading and trailing whitespace and multiple contiguous interior whitespaces are collapsed into single space characters (' '). In this context, 'whitespace' is one or more characters in the set (" ", "\t", "\n"). Exceptions to that rule occur when the user wishes to use a newline in a cell or a tab is used as a cell separator. In those cases, some other character must be chosen as a line-ending or cell separator, and the newline is **not** considered to be a whitespace character for the normalization algorithm while any tab not used as a cell separator is treated as whitespace. (See more details and examples below.)

It can handle the following which other CSV handlers may not:

* With a header line

  * normalizing field names
  * data lines with fewer fields than a header (missing values assumed to be "" or the user can choose the default value in the constructor)
  * data lines with more fields than its header (fatal, but reported)

Note header lines with any empty fields causes an exception. This is a valid header line:

```
field0, field1, field2

```

This header line is **not** valid (notice the ending comma has no text following it):

```
field0, field1, field2,

```

* Without a header line

  * data lines are padded with empty fields to the maximum number of fields found in the file (or the user's chosen value)
* Either case

  * May use newlines in a cell if a different line ending is specified

As simple as it is, it also has some uncommon features that are very useful:

* Its `slice` method enables extraction of an M'xN' sub-array of the data cells

  The `slice` arguments are two range values defining the rows and columns zero-indexed cell indices of the desired sub-array.
* Comment lines are allowed

  This feature, which is not usual in CSV parsers, is to ignore comment lines interspersed between data lines (such lines may have leading whitespace). Data lines may also have inline comments following a comment character. The comment character is user-definable and its presence invalidates its use as a field separator. The default comment character is '#'. Its use demonstrated:

  ```
    # a comment preceding a data line
  1, 2, 3 # an inline comment following the data
   # ending
  # comments

  ```

  Note comments are preserved and restored when the CSV file is saved.
* Save

  There is a `save` method which saves the current state of the CSV file (including comments) as well as saving a "raw" CSV file without the comments so the file can be used with conventional CSV handlers such as LibreOffice or Excel. The method can also be used to change the names of the output files.
* Text normalization

  Its results are to normalize text in a field or cell, that is: leading and trailing whitespace is trimmed and interior whitespace is collapsed to one space character (' ') between words. This is the default behavior, but it can be turned off if desired (`normalize=False`). In that event, data in all fields are still trimmed of leading and trailing whitespace unless you also set `trim=False`). Some examples:

  Cell contents (line ending **not** a newline): " Sally \n Jean "; normalized: "Sally\nJean".

  Cell contents (tab **not** a cell separator): " Sally \t Jean "; normalized: "Sally Jean".
* Automatic determination of separator character

  Unless the field separator is selected otherwise, the default is 'auto' and the first data line is searched for the most-used separator character from this list: `|`, `;`, `,` and `\t`. Other non-space characters may be used but are probably not tested. File an issue if you want to add a separator not currently specified.
* Row names

  Row names can be used if the "$has-row-names" option is entered with the constructor. Then you can get cell values by row and column name as shown in this example repeated from above:

  ```
  say $t.rowcol("water", "Feb"); # OUTPUT: «10.80␤»

  ```

  Note the names are case sensitive. A non-case-sensitive option may be provided in a future release.

## Limitations

It cannot currently handle:

* special characters
* backslashes
* binary data
* duplicate field names in a header line
* duplicate row names

Also, quoted words are not specially treated nor are unbalanced quote characters detected.

## Constructor with default options

```
my $t = CSV::Table.new: :$csv,
                        :has-header=True,
                        :separator='auto',
                        :normalize=True,
                        :trim=True,
                        :comment-char='#',
                        :line-ending="\n",
                        :empty-cell-value="",
                        :has-row-names=False,
                        :raw-ending="-raw",
                        :config
                        ;

```

Following are the allowable values for the named arguments. The user is cautioned that unspecified values are probably not tested. File an issue if your value of choice is not specified and it can be added and tested for.

There are a lot of options, one or all of which can be defined in a YAML (or JSON) configuration file whose path is provided by the `config` option. The user may get a prefilled YAML config file by executing:

```
$ raku -e'use CSV::Table; CSV::Table.write-config'
See CSV::Table JSON configuration file 'config-csv-table.yml'

```

or

```
$ raku -e'use CSV::Table; CSV::Table.write-config(:type<json>)'
See CSV::Table JSON configuration file 'config-csv-table.json'

```

Alternatively, you can call the method on a CSV::Table object in the REPL:

```
$ raku
> use CSV::Table;
> CSV::Table.write-config
See CSV::Table YAML configuration file 'config-csv-table.yml'

```

* `:$separator`

  * auto [default]
  * comma (`,`)
  * pipe (`|`)
  * semicolon (`;`)
  * tab (`\t`)
* `:$normalize`

  * `True` [default]
  * `False`
* `:$trim`

  * `True` [default]
  * `False`
* `:$comment-char`

  * `#` [default]
  * others, including multiple characters, are possible
* `:$has-header`

  * `True` [default]
  * `False`
* `:$line-ending`

  * `"\n"` [default]
  * `String`
* `:$empty-cell-value`

  * `''` [default]
  * `String`
* `:$has-row-names`

  * `False` [default]
  * `True`

## Accessing the table

The following table shows how to access each cell in a table `$t` with a header row plus `R` rows and `C` columns of data. (In matrix terminology it is an `M x N` rectangular matrix with `M` rows and `N` columns.)

|  |  |  |
| --- | --- | --- |
| $t.field[0] | ... | $t.field[C-1] |
| $t.cell[0][0] | ... | $t.cell[0][C-1] |
| ... | ... | ... |
| $t.cell[R-1][0] | ... | $t.cell[R-1][C-1] |

The table's data cells can also be accessed by field name and row number:

```
$t.col{$field-name}{$row-number}

```

If row names are provided, data cells can be accessed by row and column names:

```
$t.rowcol: $row-name, $field-name

```

# Possible new features

The following features can be implemented fairly easily if users want it and file an issue.

* non-case-sensitive row and column names
* add new rows or columns
* delete rows or columns
* row sum and average
* column sum and average
* normalize comments

Other matrix-related features could be implemented, but most are available in the published modules `Math::Libgsl::Matrix` and `Math::Matrix`.

# CREDITS

Thanks to @lizmat and @[Coke] for pushing for a more robust CSV handling module including quotes and newlines.

Thanks to @librasteve for the idea of the `slice` method and his suggestion of aliases `slice2d` and `view` for `slice`.

# AUTHOR

Tom Browder [tbrowder@acm.org](mailto:tbrowder@acm.org)

# COPYRIGHT AND LICENSE

© 2024-2025 Tom Browder

This library is free software; you may redistribute it or modify it under the Artistic License 2.0.


## dist_zef-vrurg-Concurrent-PChannel.md
# NAME

Concurrent::PChannel - prioritized channel

# SYNOPSIS

```
use Concurrent::PChannel;

my Concurrent::PChannel:D $pchannel .= new( :priorities(10) );
$pchannel.send("low prio", 0);
$pchannel.send("high prio", 1);
say $pchannel.receive; # ‘high prio’
say $pchannel.receive; # ‘low prio’

```

# DESCRIPTION

`Concurrent::PChannel` implements concurrent channel where each item sent over the channel has a priority attached allowing items with higher priority to be pulled first from the channel even if they were sent later in time.

For example, imagine there is a factory of devices supplying our input with different kind of events. Some event types are considered critical and must be processed ASAP. And some are, say, informative and can be taken care of when we're idling. In code this could be implemented the following way:

```
my $pchannel = Concurrent::PChannel.new( :priorities(3) );
for $dev-factory.devices -> $dev {
    start {
        react {
            whenever $dev.event-supply -> $event {
                given $event.type {
                    when EvCritical {
                        $pchannel.send: $event, 2;
                    }
                    when EvInformative {
                        $pchannel.send: $event, 0;
                    }
                    default {
                        $pchannel.send: $event, 1;
                    }
                }
            }
        }
    }
}

for ^WORKER-COUNT {
    start {
        while $pchannel.receive -> $event {
            ...
        }
    }
}

```

## Performance

The performance was the primary target of this module development. It is implemented using highly-concurrent almost lock-less approach. Benchmarking of different numbers of sending/receiving threads (measured over `receive()` method) results in send operations been 1.3-8 times slower than sending over the core `Channel`; receiving is 1.1-6 times slower. The difference in numbers is only determined by the ratio of sending/receving threads.

What's more important, the speed is almost independent of the number of priorities used! I.e. it doesn't matter if code is using 10 or 1000 priorities – the time needed to process the two channels would only be dependent on the number of items sent over them.

## Terms

### Closed And Drained

A channel could be in three different states: normal, closed, and drained. The difference between the last two is that when the channel is closed it might still have some data available for receiving. Only when all items were consumed by the user code then the channel transitions into the *closed* and the *drained* state.

### Priority

Priority is a positive integer value with 0 being the lowest possible priority. The higher the value the sooner an item with this priority will reach the consumer.

# ATTRIBUTES

## `closed`

`True` if channel has been closed.

## `closed-promise`

A `Promise` which is kept with `True` when the channel is closed and broken with a cause object if channel is marked as failed.

## `drained`

`True` if channel is closed and no items left to fetch.

## `drained-promise`

A `Promise` which is kept with `True` when the channel is drained.

## `elems`

Likely number of elements ready for fetch. It is *"likely"* because in a concurrent environment this value might be changing too often.

## `prio-count`

Number of priority queues pre-allocated.

# METHODS

## `new`

`new` can be used with any parameters. But usually it is recommended to specifiy `:priorities(n)` named parameter to specify the expected number of priorities to be used. This allows the class to pre-allocate all required priority queues beforehand. Without this parameter a class instance starts with only one queue. If method `send` is used with a priority which doesn't have a queue assigned yet then the class starts allocating new ones by multiplying the number of existing ones by 2 until get enough of them to cover the requested priority. For example:

```
my $pchannel.new;
$pchannel.send(42, 5);

```

In this case before sending `42` the class allocates 2 -> 4 -> 8 queues.

Queue allocation code is the only place where locking is used.

Use of `priorities` parameter is recommended if some really big number of priorities is expected. This might help in reducing the memory footprint of the code by preventing over-allocation of queues.

## `send(Mu \item, Int:D $priority = 0)`

Send a `item` using `$priority`. If `$priority` is omitted then default 0 is used.

## `receive`

Receive an item from channel. If no data available and the channel is not *drained* then the method `await` for the next item. In other words, it soft-blocks allowing the scheduler to reassing the thread onto another task if necessary until some data is ready for pick up.

If the method is called on a *drained* channel then it returns a `Failure` wrapped around `X::PChannel::OpOnClosed` exception with its `op` attribute set to string *"receive"*.

## `poll`

Non-blocking fetch of an item. Contrary to `receive` doesn't wait for a missing item. Instead the method returns `Nil but NoData` typeobject. `Concurrent::PChannel::NoData` is a dummy role which sole purpose is to indicate that there is no item ready in a queue.

## `close`

Close a channel.

## `fail($cause)`

Marks a channel as *failed* and sets failure cause to `$cause`.

## `failed`

Returns `True` if channel is marked as failed.

## `Supply`

Wraps `receive` into a supplier.

# EXCEPTIONS

Names is the documentation are given as the exception classes are exported.

## `X::PChannel::Priorities`

Thrown if wrong `priorities` parameter passed to the method `new`. Attribute `priorities` contains the value passed.

## `X::PChannel::NegativePriority`

Thrown if a negative priority value has passed in from user code. Attribute `prio` contains the value passed.

## `X::PChannel::OpOnClosed`

Thrown or passed in a `Failure` when an operation is performed on a closed channel. Attribute `op` contains the operation name.

*Note* that semantics of this exception is a bit different depending on the kind of operation attempted. For `receive` this exception is used when channel is *drained*. For `send`, `close`, and `fail` it is thrown right away if channel is in *closed* state.

# AUTHOR

Vadim Belman [vrurg@cpan.org](mailto:vrurg@cpan.org)

# COPYRIGHT AND LICENSE

Copyright 2020 Vadim Belman

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_cpan-TOKUHIROM-HTTP-Server-Tiny.md
[![Build Status](https://travis-ci.org/tokuhirom/p6-HTTP-Server-Tiny.svg?branch=master)](https://travis-ci.org/tokuhirom/p6-HTTP-Server-Tiny)

# NAME

HTTP::Server::Tiny - a simple HTTP server for Perl6

# SYNOPSIS

```
use HTTP::Server::Tiny;

my $port = 8080;

# Only listen for connections from the local host
# if you want this to be accessible from another
# host then change this to '0.0.0.0'
my $host = '127.0.0.1';

HTTP::Server::Tiny.new(:$host , :$port).run(sub ($env) {
    my $channel = Channel.new;
    start {
        for 1..100 {
            $channel.send(($_ ~ "\n").Str.encode('utf-8'));
        }
        $channel.close;
    };
    return 200, ['Content-Type' => 'text/plain'], $channel
});

```

# DESCRIPTION

HTTP::Server::Tiny is a standalone HTTP/1.1 web server for perl6.

# METHODS

* `HTTP::Server::Tiny.new($host, $port)`

Create new instance.

* `$server.run(Callable $app, Promise :$control-promise)`

Run http server with P6W app. The named parameter `control-promise` if provided, can be *kept* to quit the server loop, which may be useful if the server is run asynchronously to the main thread of execution in an application.

If the optional named parameter `control-promise` is provided with a `Promise` then the server loop will be quit when the promise is kept.

# VERSIONING RULE

This module respects [Semantic versioning](http://semver.org/)

# TODO

* Support timeout

# COPYRIGHT AND LICENSE

Copyright 2015, 2016 Tokuhiro Matsuno [tokuhirom@gmail.com](mailto:tokuhirom@gmail.com)

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_github-teodozjan-Mortgage.md
# mortgage6

Mortgage6 is little but usable library that allows to calculate all costs of mortage. Since banks give a lot of discounts if buying their products it is harder see the costs

## install

```
zef install Mortgage

```

## doc

```
p6doc Mortgage

```

or [POD](https://github.com/teodozjan/mortage6/blob/master/lib/Mortgage.pm6)

## QuickStart

```
my $bank = Mortgage.new(bank=>"BANK2",interest_rate => rate-monthly(3.30), mortage=> 1300.73, mortages => 360, loan-left=> 297000.FatRat);

# Arrangement fee
$bank.add(Mortgage::AnnualCostConst.new(from=>1, to=>1, value=>$bank.loan-left * percent 1));

# Should give the same amount you have from bank
my $mortgage =  $bank.calc_mortage;

# Do the sim
$bank.calc;

my $loanleft = $bank.loan-left.round(0.01);
my $total_cost = $bank.total_cost.round(0.01);
my $total_interest= $bank.total_interest.round(0.01);

```


## formatter.md
formatter

Combined from primary sources listed below.

# [In role Dateish](#___top "go to top of document")[§](#(role_Dateish)_method_formatter "direct link")

See primary documentation
[in context](/type/Dateish#method_formatter)
for **method formatter**.

```raku
method formatter(Dateish:D:)
```

Returns the formatting function which is used for conversion to [`Str`](/type/Str). If none was provided at object construction, a default formatter is used. In that case the method will return a Callable type object.

The formatting function is called by [DateTime method Str](/type/DateTime#method_Str) with the invocant as its only argument.

```raku
my $dt = Date.new('2015-12-31');  # (no formatter specified)
say $dt.formatter.^name;          # OUTPUT: «Callable␤»
my $us-format = sub ($self) { sprintf "%02d/%02d/%04d", .month, .day, .year given $self; };
$dt = Date.new('2015-12-31', formatter => $us-format);
say $dt.formatter.^name;           # OUTPUT: «Sub␤»
say $dt;                          # OUTPUT: «12/31/2015␤»
```


## dist_zef-knarkhov-Node-Ethereum-RLP.md
# Recursive Length Prefix for Raku

The purpose of RLP (Recursive Length Prefix) is to encode arbitrarily nested arrays of binary data, and RLP is the main encoding method used to serialize objects in Ethereum. `Node::Ethereum::RLP` delivers RLP encode and decode routines to Raku lang ecosystem.

## License

Module `Node::Ethereum::RLP` is free and opensource software, so you can redistribute it and/or modify it under the terms of the [The Artistic License 2.0](https://opensource.org/licenses/Artistic-2.0).

## Credits

1. <https://eth.wiki/fundamentals/rlp>
2. <https://github.com/ethereumjs/rlp/blob/master/src/index.ts>

## Author

Please contact me via [LinkedIn](https://www.linkedin.com/in/knarkhov/) or [Twitter](https://twitter.com/CondemnedCell). Your feedback is welcome at [narkhov.pro](https://narkhov.pro/contact-information.html).


## dist_zef-samy-File-Tudo.md
# NAME

File::Tudo - Tudo TODO file interface

# SYNOPSIS

```
use File::Tudo;

# Simple convenience wrapper, useful for quick scripts
tudo "Fix that one issue";

# OO interface
my $tudo = File::Tudo.new('/path/to/TODO');
$tudo.todo.append: "Fix that one issue";
$tudo.write;

```

# DESCRIPTION

**File::Tudo** is a Raku module for reading/writing simple TODO files.

## Exported Subroutines

### tudo

```
sub tudo(
  $str,
  :$path = default_todo
)

```

`tudo()` is a simple convenience wrapper for File::Tudo that will quickly add an additional entry to the end of your TODO file. This can make it useful for reporting TODOs in your Raku scripts.

```
my @updates = gather for @packages -> $pkg {
  ...
}

tudo "There are updates that need taken care of!" if @updates;

```

`$str` is the string you would like to add as an entry to your TODO file.

`$path` is the path to the TODO file. Defaults to the return value of `default_todo`, view its documentation for more information.

### default\_todo

```
sub default_todo()

```

`default_todo()` returns an `IO` object for the default TODO path. It will either be the path specified by the `TODO_FILE` environment variable if set, or `~/TODO` otherwise.

## Object-Oriented Interface

### Methods

#### method new

```
method new(
  $path = default_todo,
  Bool :$read = True,
)

```

Returns a newly constructed **File::Tudo**.

`$path` is the path to the TODO file. Defaults to the return value of `default_todo`.

`:$read` determines whether `new()` will read TODO entries from the given file if they are present. If `False`, `new()` will ignore them and initialize an empty array for `todo`.

#### method read

```
method read($file)

```

Reads a list of TODO entries from `$file`, overwriting the previous `todo` array. Returns the list of TODOs read.

#### method write

```
method write($file = $!path)

```

Writes the current `todo` array to `$file`. If `$file` is not supplied, defaults to the value of the object's `path` attribute.

### Attributes

#### path

```
has IO $.path is rw

```

`IO` object of the object's TODO file. Able to be modified.

#### todo

```
has Str @.todo is rw

```

Array of strings holding the list of TODO entries. Able to modified.

## `tudo`

**File::Tudo** also comes with the `tudo` script, which provides a nice command-line interface for manipulating **File::Tudo** TODO files.

# ENVIRONMENT

* `TODO_FILE`

  Default path to TODO file.
* `EDITOR`

  Default text editor to use for `edit` command.
* `VISUAL`

  Default text editor to use for `edit` command, if `EDITOR` is not set.

# BUGS

Don't be ridiculous...

Report bugs on my Codeberg, <https://codeberg.org/1-1sam>.

# AUTHOR

Written by Samuel Young, [samyoung12788@gmail.com](mailto:samyoung12788@gmail.com).

# COPYRIGHT

Copyright 2025, Samuel Young

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.

# SEE ALSO

tudo


## raku.md
raku

Combined from primary sources listed below.

# [In IterationBuffer](#___top "go to top of document")[§](#(IterationBuffer)_method_raku "direct link")

See primary documentation
[in context](/type/IterationBuffer#method_raku)
for **method raku**.

```raku
method raku(IterationBuffer:D: --> Str)
```

Produces a representation of the `IterationBuffer` as a [`List`](/type/List) postfixed with ".IterationBuffer" to make it different from an ordinary list. Does **not** roundtrip. Intended for debugging uses only, specifically for use with [dd](/programs/01-debugging#Dumper_function_(dd)).

# [In FatRat](#___top "go to top of document")[§](#(FatRat)_method_raku "direct link")

See primary documentation
[in context](/type/FatRat#method_raku)
for **method raku**.

```raku
multi method raku(FatRat:D: --> Str:D)
```

Returns an implementation-specific string that produces an [equivalent](/routine/eqv) object when given to [EVAL](/routine/EVAL).

```raku
say FatRat.new(1, 2).raku; # OUTPUT: «FatRat.new(1, 2)␤»

```

# [In RakuAST::Doc::Paragraph](#___top "go to top of document")[§](#(RakuAST::Doc::Paragraph)_method_raku "direct link")

See primary documentation
[in context](/type/RakuAST/Doc/Paragraph#method_raku)
for **method raku**.

```raku
# method .gist falls back to .raku
say $block;  # RakuAST::Doc::Paragraph.new(...

```

Returns the string that is needed for the creation of the paragraph using [`RakuAST`](/type/RakuAST) calls.

# [In Complex](#___top "go to top of document")[§](#(Complex)_method_raku "direct link")

See primary documentation
[in context](/type/Complex#method_raku)
for **method raku**.

```raku
method raku(Complex:D: --> Str:D)
```

Returns an implementation-specific string that produces an [equivalent](/routine/eqv) object when given to [EVAL](/routine/EVAL).

```raku
say (1-3i).raku;                # OUTPUT: «<1-3i>␤»
```

# [In RakuAST::Doc::Markup](#___top "go to top of document")[§](#(RakuAST::Doc::Markup)_method_raku "direct link")

See primary documentation
[in context](/type/RakuAST/Doc/Markup#method_raku)
for **method raku**.

```raku
# method .gist falls back to .raku
say $markup;  # RakuAST::Doc::Markup.new(...

```

Returns the string that is needed for the creation of the markup using [`RakuAST`](/type/RakuAST) calls.

# [In Range](#___top "go to top of document")[§](#(Range)_method_raku "direct link")

See primary documentation
[in context](/type/Range#method_raku)
for **method raku**.

```raku
multi method raku(Range:D:)
```

Returns an implementation-specific string that produces an [equivalent](/routine/eqv) object when given to [EVAL](/routine/EVAL).

```raku
say (1..2).raku # OUTPUT: «1..2␤»

```

# [In IO::Path::Cygwin](#___top "go to top of document")[§](#(IO::Path::Cygwin)_method_raku "direct link")

See primary documentation
[in context](/type/IO/Path/Cygwin#method_raku)
for **method raku**.

```raku
method raku(IO::Path::Cygwin:D: --> Str:D)
```

Returns a string that, when given passed through [`EVAL`](/routine/EVAL) gives the original invocant back.

```raku
IO::Path::Cygwin.new("foo/bar").raku.say;
# OUTPUT: IO::Path::Cygwin.new("foo/bar", :CWD("/home/camelia"))

```

Note that this string includes the value of the `.CWD` attribute that is set to [`$*CWD`](/language/variables#Dynamic_variables) when the path object was created, by default.

# [In Rat](#___top "go to top of document")[§](#(Rat)_method_raku "direct link")

See primary documentation
[in context](/type/Rat#method_raku)
for **method raku**.

```raku
multi method raku(Rat:D: --> Str:D)
```

Returns an implementation-specific string that produces an [equivalent](/routine/eqv) object when given to [EVAL](/routine/EVAL).

```raku
say (1/3).raku;                # OUTPUT: «<1/3>␤»
say (2/4).raku;                # OUTPUT: «0.5␤»

```

# [In RakuAST::Doc::Block](#___top "go to top of document")[§](#(RakuAST::Doc::Block)_method_raku "direct link")

See primary documentation
[in context](/type/RakuAST/Doc/Block#method_raku)
for **method raku**.

```raku
# method .gist falls back to .raku
say $block;  # RakuAST::Doc::Block.new(...

```

Returns the string that is needed for the creation of the block using [`RakuAST`](/type/RakuAST) calls.

# [In Mu](#___top "go to top of document")[§](#(Mu)_method_raku "direct link")

See primary documentation
[in context](/type/Mu#method_raku)
for **method raku**.

```raku
multi method raku(Mu:U:)
multi method raku(Mu:D:)
```

For type objects, returns its name if `.raku` has not been redefined from `Mu`, or calls `.raku` on the name of the type object otherwise.

```raku
say Str.raku;          # OUTPUT: «Str␤»
```

For plain objects, it will conventionally return a representation of the object that can be used via [`EVAL`](/routine/EVAL) to reconstruct the value of the object.

```raku
say (1..3).Set.raku;  # OUTPUT: «Set.new(1,2,3)␤»
```

# [In IO::Path](#___top "go to top of document")[§](#(IO::Path)_method_raku "direct link")

See primary documentation
[in context](/type/IO/Path#method_raku)
for **method raku**.

```raku
method raku(IO::Path:D: --> Str:D)
```

Returns a string that, when given passed through [`EVAL`](/routine/EVAL) gives the original invocant back.

```raku
"foo/bar".IO.raku.say;
# OUTPUT: IO::Path.new("foo/bar", :SPEC(IO::Spec::Unix), :CWD("/home/camelia"))

```

Note that this string includes the value of the `.CWD` attribute that is set to [`$*CWD`](/language/variables#Dynamic_variables) when the path object was created, by default.

# [In IO::Path::Unix](#___top "go to top of document")[§](#(IO::Path::Unix)_method_raku "direct link")

See primary documentation
[in context](/type/IO/Path/Unix#method_raku)
for **method raku**.

```raku
method raku(IO::Path::Unix:D: --> Str:D)
```

Returns a string that, when given passed through [`EVAL`](/routine/EVAL) gives the original invocant back.

```raku
IO::Path::Unix.new("foo/bar").raku.say;
# OUTPUT: IO::Path::Unix.new("foo/bar", :CWD("/home/camelia"))

```

Note that this string includes the value of the `.CWD` attribute that is set to [`$*CWD`](/language/variables#Dynamic_variables) when the path object was created, by default.

# [In Junction](#___top "go to top of document")[§](#(Junction)_method_raku "direct link")

See primary documentation
[in context](/type/Junction#method_raku)
for **method raku**.

```raku
multi method raku(Junction:D:)
```

Collapses the `Junction` and returns a [`Str`](/type/Str) composed of [raku](/routine/raku) of its components that [evaluates](/routine/EVAL) to the equivalent `Junction` with equivalent components:

```raku
<a 42 c>.all.raku.put; # OUTPUT: «all("a", IntStr.new(42, "42"), "c")␤»
```

# [In IO::Path::Win32](#___top "go to top of document")[§](#(IO::Path::Win32)_method_raku "direct link")

See primary documentation
[in context](/type/IO/Path/Win32#method_raku)
for **method raku**.

```raku
method raku(IO::Path::Win32:D: --> Str:D)
```

Returns a string that, when given passed through [`EVAL`](/routine/EVAL) gives the original invocant back.

```raku
IO::Path::Win32.new("foo/bar").raku.say;
# OUTPUT: IO::Path::Win32.new("foo/bar", :CWD("C:\\Users\\camelia"))

```

Note that this string includes the value of the `.CWD` attribute that is set to [`$*CWD`](/language/variables#Dynamic_variables) when the path object was created, by default.

# [In IO::Path::QNX](#___top "go to top of document")[§](#(IO::Path::QNX)_method_raku "direct link")

See primary documentation
[in context](/type/IO/Path/QNX#method_raku)
for **method raku**.

```raku
method raku(IO::Path::QNX:D: --> Str:D)
```

Returns a string that, when given passed through [`EVAL`](/routine/EVAL) gives the original invocant back.

```raku
IO::Path::QNX.new("foo/bar").raku.say;
# OUTPUT: IO::Path::QNX.new("foo/bar", :CWD("/home/camelia"))

```

Note that this string includes the value of the `.CWD` attribute that is set to [`$*CWD`](/language/variables#Dynamic_variables) when the path object was created, by default.

# [In RakuAST::Doc::Declarator](#___top "go to top of document")[§](#(RakuAST::Doc::Declarator)_method_raku "direct link")

See primary documentation
[in context](/type/RakuAST/Doc/Declarator#method_raku)
for **method raku**.

```raku
# method .gist falls back to .raku
say $declarator;  # RakuAST::Doc::Declarator.new(...

```

Returns the string that is needed for the creation of the block using [`RakuAST`](/type/RakuAST) calls.

# [In Allomorph](#___top "go to top of document")[§](#(Allomorph)_method_raku "direct link")

See primary documentation
[in context](/type/Allomorph#method_raku)
for **method raku**.

```raku
multi method raku(Allomorph:D:)
```

Return a representation of the object that can be used via [`EVAL`](/routine/EVAL) to reconstruct the value of the object.


## dist_zef-japhb-MUGS-Games.md
[![Actions Status](https://github.com/Raku-MUGS/MUGS-Games/workflows/test/badge.svg)](https://github.com/Raku-MUGS/MUGS-Games/actions)

# NAME

MUGS-Games - Free-as-in-speech game implementations for MUGS (Multi-User Gaming Services)

# SYNOPSIS

```
# Setting up a simple MUGS-Games development environment
mkdir MUGS
cd MUGS
git clone git@github.com:Raku-MUGS/MUGS-Core.git
git clone git@github.com:Raku-MUGS/MUGS-Games.git
cd MUGS-Core
zef install --exclude="pq:ver<5>:from<native>" .
mugs-admin create-universe
cd ../MUGS-Games
zef install --deps-only .

```

# DESCRIPTION

**NOTE: See the [top-level MUGS repo](https://github.com/Raku-MUGS/MUGS) for more info.**

MUGS-Games is a collection of free-as-in-speech client and server game and genre implementations for MUGS (Multi-User Gaming Services). Note that these implementations do NOT have user interfaces; they only implement abstract game logic, request/response protocols, and so forth. This is sufficient for automated testing and implementation of game bots, but if you want to play them as an end user, you'll need to install the appropriate MUGS-UI-\* for the user interface you prefer.

This Proof-of-Concept release only includes simple turn-based guessing and interactive fiction games. The underlying framework in [MUGS-Core](https://github.com/Raku-MUGS/MUGS-Core) has been tested with 2D arcade games as well, but these are not yet ready for public release. Future releases will include many more games and genres.

# ROADMAP

MUGS is still in its infancy, at the beginning of a long and hopefully very enjoyable journey. There is a [draft roadmap for the first few major releases](https://github.com/Raku-MUGS/MUGS/tree/main/docs/todo/release-roadmap.md) but I don't plan to do it all myself -- I'm looking for contributions of all sorts to help make it a reality.

# CONTRIBUTING

Please do! :-)

In all seriousness, check out [the CONTRIBUTING doc](docs/CONTRIBUTING.md) (identical in each repo) for details on how to contribute, as well as [the Coding Standards doc](https://github.com/Raku-MUGS/MUGS/tree/main/docs/design/coding-standards.md) for guidelines/standards/rules that apply to code contributions in particular.

The MUGS project has a matching GitHub org, [Raku-MUGS](https://github.com/Raku-MUGS), where you will find all related repositories and issue trackers, as well as formal meta-discussion.

More informal discussion can be found on IRC in Libera.Chat #mugs.

# AUTHOR

Geoffrey Broadwell [gjb@sonic.net](mailto:gjb@sonic.net) (japhb on GitHub and Libera.Chat)

# COPYRIGHT AND LICENSE

Copyright 2021-2024 Geoffrey Broadwell

MUGS is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## iterable.md
role Iterable

Interface for container objects that can be iterated over

```raku
role Iterable { }
```

`Iterable` serves as an API for objects that can be iterated with `for` and related iteration constructs, like assignment to a [`Positional`](/type/Positional) variable.

`Iterable` objects nested in other `Iterable` objects (but not within scalar containers) flatten in certain contexts, for example when passed to a slurpy parameter (`*@a`), or on explicit calls to `flat`.

Its most important aspect is a method stub for `iterator`.

```raku
class DNA does Iterable {
    has $.chain;
    method new ($chain where { $chain ~~ /^^ <[ACGT]>+ $$ / } ) {
        self.bless( :$chain );
    }

    method iterator(DNA:D:) {
        $!chain.comb.rotor(3).iterator;
    }
}

my $a := DNA.new('GAATCC');
.say for $a; # OUTPUT: «(G A A)␤(T C C)␤»

```

This example mixes in the Iterable role to offer a new way of iterating over what is essentially a string (constrained by [`where`](/language/signatures#index-entry-where_clause) to just the four DNA letters). In the last statement, `for` actually hooks to the `iterator` role printing the letters in groups of 3.

# [Methods](#role_Iterable "go to top of document")[§](#Methods "direct link")

## [method iterator](#role_Iterable "go to top of document")[§](#method_iterator "direct link")

```raku
method iterator(--> Iterator:D)
```

Method stub that ensures all classes doing the `Iterable` role have a method `iterator`.

It is supposed to return an [`Iterator`](/type/Iterator).

```raku
say (1..10).iterator;
```

## [method flat](#role_Iterable "go to top of document")[§](#method_flat "direct link")

```raku
method flat(Iterable:D: --> Iterable)
```

Returns another `Iterable` that flattens out all iterables that the first one returns.

For example

```raku
say (<a b>, 'c').elems;         # OUTPUT: «2␤»
say (<a b>, 'c').flat.elems;    # OUTPUT: «3␤»
```

because `<a b>` is a [`List`](/type/List) and thus iterable, so `(<a b>, 'c').flat` returns `('a', 'b', 'c')`, which has three elems.

Note that the flattening is recursive, so `((("a", "b"), "c"), "d").flat` returns `("a", "b", "c", "d")`, but it does not flatten itemized sublists:

```raku
say ($('a', 'b'), 'c').flat;    # OUTPUT: «($("a", "b"), "c")␤»
```

You can use the [hyper method call](/language/operators#index-entry-methodop_>>.) to call the [`.List`](/routine/List) method on all the inner itemized sublists and so de-containerize them, so that `flat` can flatten them:

```raku
say ($('a', 'b'), 'c')>>.List.flat.elems;    # OUTPUT: «3␤»
```

## [method lazy](#role_Iterable "go to top of document")[§](#method_lazy "direct link")

```raku
method lazy(--> Iterable)
```

Returns a lazy iterable wrapping the invocant.

```raku
say (1 ... 1000).is-lazy;      # OUTPUT: «False␤»
say (1 ... 1000).lazy.is-lazy; # OUTPUT: «True␤»
```

## [method hyper](#role_Iterable "go to top of document")[§](#method_hyper "direct link")

```raku
method hyper(Int(Cool) :$batch = 64, Int(Cool) :$degree = Kernel.cpu-cores - 1)
```

Returns another Iterable that is potentially iterated in parallel, with a given batch size and degree of parallelism.

The order of elements is preserved.

```raku
say ([1..100].hyper.map({ $_ +1 }).list);
```

Use `hyper` in situations where it is OK to do the processing of items in parallel, and the output order should be kept relative to the input order. See [`race`](/routine/race) for situations where items are processed in parallel and the output order does not matter.

### [Options degree and batch](#role_Iterable "go to top of document")[§](#Options_degree_and_batch "direct link")

The `degree` option (short for "degree of parallelism") configures how many parallel workers should be started. To start 4 workers (e.g. to use at most 4 cores), pass `:degree(4)` to the `hyper` or `race` method. Note that in some cases, choosing a degree higher than the available CPU cores can make sense, for example I/O bound work or latency-heavy tasks like web crawling. For CPU-bound work, however, it makes no sense to pick a number higher than the CPU core count.

The `batch` size option configures the number of items sent to a given parallel worker at once. It allows for making a throughput/latency trade-off. If, for example, an operation is long-running per item, and you need the first results as soon as possible, set it to 1. That means every parallel worker gets 1 item to process at a time, and reports the result as soon as possible. In consequence, the overhead for inter-thread communication is maximized. In the other extreme, if you have 1000 items to process and 10 workers, and you give every worker a batch of 100 items, you will incur minimal overhead for dispatching the items, but you will only get the first results when 100 items are processed by the fastest worker (or, for `hyper`, when the worker getting the first batch returns.) Also, if not all items take the same amount of time to process, you might run into the situation where some workers are already done and sit around without being able to help with the remaining work. In situations where not all items take the same time to process, and you don't want too much inter-thread communication overhead, picking a number somewhere in the middle makes sense. Your aim might be to keep all workers about evenly busy to make best use of the resources available.

You can also check out this **[blog post on the semantics of hyper and race](https://6guts.wordpress.com/2017/03/16/considering-hyperrace-semantics/)**

The default for `:degree` is the number of available CPU cores minus 1 as of the 2020.02 release of the Rakudo compiler.

As of release 2022.07 of the Rakudo compiler, it is also possible to specify an undefined value to indicate to use the default.

## [method race](#role_Iterable "go to top of document")[§](#method_race "direct link")

```raku
method race(Int(Cool) :$batch = 64, Int(Cool) :$degree = 4 --> Iterable)
```

Returns another Iterable that is potentially iterated in parallel, with a given batch size and degree of parallelism (number of parallel workers).

Unlike [`hyper`](/routine/hyper), `race` does not preserve the order of elements (mnemonic: in a race, you never know who will arrive first).

```raku
say ([1..100].race.map({ $_ +1 }).list);
```

Use race in situations where it is OK to do the processing of items in parallel, and the output order does not matter. See [`hyper`](/routine/hyper) for situations where you want items processed in parallel and the output order should be kept relative to the input order.

**[Blog post on the semantics of hyper and race](https://6guts.wordpress.com/2017/03/16/considering-hyperrace-semantics/)**

See [`hyper`](/routine/hyper) for an explanation of `:$batch` and `:$degree`.

# [Typegraph](# "go to top of document")[§](#typegraphrelations "direct link")

Type relations for `Iterable`

raku-type-graph

Iterable
Iterable

Mu
Mu

Any
Any

Any->Mu

Cool
Cool

Cool->Any

Associative
Associative

Map
Map

Map->Iterable

Map->Cool

Map->Associative

PositionalBindFailover
PositionalBindFailover

Sequence
Sequence

Sequence->PositionalBindFailover

RaceSeq
RaceSeq

RaceSeq->Iterable

RaceSeq->Any

RaceSeq->Sequence

Positional
Positional

Range
Range

Range->Iterable

Range->Cool

Range->Positional

List
List

List->Iterable

List->Cool

List->Positional

IO::Path::Parts
IO::Path::Parts

IO::Path::Parts->Iterable

IO::Path::Parts->Any

IO::Path::Parts->Associative

IO::Path::Parts->Positional

Seq
Seq

Seq->Iterable

Seq->Cool

Seq->Sequence

HyperSeq
HyperSeq

HyperSeq->Iterable

HyperSeq->Any

HyperSeq->Sequence

PseudoStash
PseudoStash

PseudoStash->Map

Hash
Hash

Hash->Map

Array
Array

Array->List

Slip
Slip

Slip->List

Stash
Stash

Stash->Hash

[Expand chart above](/assets/typegraphs/Iterable.svg)


## dist_cpan-TYIL-Pod-To-HTML-Section.md
# NAME

Pod::To::HTML

# AUTHOR

Patrick Spek [p.spek@tyil.work](mailto:p.spek@tyil.work)

# VERSION

0.0.0

# Synopsis

```
raku --doc=HTML::Section <document>

```

# Description

Convert a Pod6 document to HTMLWell, just a *section* of it, really.

# Installation

## Through `zef`

[zef](https://github.com/ugexe/zef) is the standard distribution manager for [Raku](https://raku.org). If you're using an end-user distribution like [Rakudo Star](https://rakudo.org/files/star), it will be installed for you by default.

`zef` will install the latest available version from [CPAN](http://www.cpan.org/modules/index.html).

```
zef install Pod::To::HTML::Section

```

## From a downloaded distribution

All official releases are also made available on my [personal distribution server](https://dist.tyil.nl/raku/modules/). These can be installed from the URL directly.

```
zef install https://dist.tyil.nl/raku/modules/Pod-To-HTML-Section-0.1.0.tar.gz

```

Alternatively, you can download the distribution first, and then install that copy with `zef`.

```
wget https://dist.tyil.nl/raku/modules/Pod-To-HTML-Section-0.1.0.tar.gz
zef install ./Pod-To-HTML-Section-0.1.0.tar.gz

```

# Contributing

## Reporting bugs or other feedback

Any bugs or other feedback can be sent to my email address. I generally try to respond to all mail within 24 hours.

## Proposing code patches

Code patches can also be sent in through email. If you need help to send git patches through email, you may want to read up on [git-send-email.io](https://git-send-email.io/).

### Testing

If you're working on a code patch, you will more than likely want to test your own changes to see if they're solving your issue. The easiest way to get the HTML out on your terminal is to specify your development copy with `-I` to give it priority, and using `raku --doc` as usual.

```
raku -Ilib --doc=HTML::Section <document>

```

However, this may be hard to read for most purposes. If you have `xmllint` and `tidy` available on your system, you can use these tools in conjuction with the `raku --doc` command to format the HTML.

```
raku -Ilib --doc=HTML::Section <document> \
   | xmllint --html - 2>/dev/null \
   | tidy --indent yes 2>/dev/null

```

# License

This module is distributed under the terms of the GNUGNU's Not Unix AGPLAferro General Public License, version 3.0.


## dist_cpan-BDUGGAN-OAuth2-Client-Google.md
# NAME

OAuth2::Client::Google -- Authenticate with Google using OAuth2.

# Quick how-to

1. Go to <http://console.developers.google.com> and create a project.
2. Set up credentials for a web server and set your redirect URIs.
3. Download the JSON file (client\_id.json).
4. In your application, create an oauth2 object like this:

   ```
        my $oauth = OAuth2::Client::Google.new(
            config => from-json('./client_id.json'.IO.slurp),
            redirect-uri => 'http://localhost:3334/oauth',
            scope => 'email'
        );

   ```

where redirect-uri is one of your redirect URIs and scope is a space or comma-separated list of scopes from <https://developers.google.com/identity/protocols/googlescopes>.

To authenticate, redirect the user to

```
$oauth.auth-uri

```

Then when they come back and send a request to '/oauth', grab the "code" parameter from the query string. Use it to call

```
my $token = $oauth.code-to-token(code => $code)

```

This will give you `$token<access_token>`, which you can then use with google APIs.

If you also included "email" in the scope, you will get id-token, which you can use like this:

```
my $identity = $oauth.verify-id(id-token => $token<id_token>)

```

which has, e.g. `$identity<email>` and `$identity<given_name>`.

For a working example, see <eg/get-calendar-data.p6>.

# STATUS

[![Build Status](https://travis-ci.org/bduggan/p6-oauth2-client-google.svg?branch=master)](https://travis-ci.org/bduggan/p6-oauth2-client-google)

# SEE ALSO

<https://developers.google.com/identity/protocols/OAuth2WebServer>

# TODO

* Better documentation
* Refresh tokens


## dist_zef-l10n-L10N.md
[![Actions Status](https://github.com/Raku/L10N/actions/workflows/test.yml/badge.svg)](https://github.com/Raku/L10N/actions)

# NAME

L10N - All official localizations of Raku

# SYNOPSIS

```
use L10N;

```

# DESCRIPTION

L10N is a distribution that, when installed, will install all official localizations of the Raku Programming Language as its dependencies.

It will not install anything else.

# AUTHOR

Elizabeth Mattijsen [liz@raku.rocks](mailto:liz@raku.rocks)

# COPYRIGHT AND LICENSE

Copyright 2023 Raku Localization Team

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.


## dist_zef-grondilu-FiniteFields.md
[![SparrowCI](https://ci.sparrowhub.io/project/gh-grondilu-finite-fields-raku/badge)](https://ci.sparrowhub.io)

# Finite Fields Aritmetics in raku

```
use FiniteField;
my $*modulus = 13;

say 10+5;  # 2
say 10/3;  # 12  (3*12 = 36 = 13*2 + 10)

```

## Notes

* The dynamic variable `$*modulus` must be defined before calling any overloaded operator,
  otherwise the program will crash (no exception is handled so far).
* Modular division will not check for primality of modulus or any other requirements.
* Define a modulus for each lexical scopes you import the module in.
* Althouh the name of this repo is using a plural, the name of the module
  itself is singular, because you only use one finite field at a time.
* The main purpose of this module is to make writing cryptographic code easier.