## elems.md
elems

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/Uni#method_elems)
for **method elems**.

```raku
method elems(Uni:D: --> Int:D)
```

Returns the number of codepoints in the invocant.

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

See primary documentation
[in context](/type/List#routine_elems)
for **routine elems**.

```raku
sub    elems($list --> Int:D)
method elems(List:D: --> Int:D)
```

Returns the number of elements in the list.

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

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

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

```raku
method elems(IterationBuffer:D: --> Int:D)
```

Returns the number of elements in the `IterationBuffer`.

# [In role Baggy](#___top "go to top of document")[§](#(role_Baggy)_method_elems "direct link")

See primary documentation
[in context](/type/Baggy#method_elems)
for **method elems**.

```raku
method elems(Baggy:D: --> Int:D)
```

Returns the number of elements in the `Baggy` object without taking the individual elements' weight into account.

```raku
my $breakfast = bag <eggs spam spam spam>;
say $breakfast.elems;                             # OUTPUT: «2␤»

my $n = ("b" => 9.4, "b" => 2).MixHash;
say $n.elems;                                     # OUTPUT: «1␤»
```

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

See primary documentation
[in context](/type/Capture#method_elems)
for **method elems**.

```raku
method elems(Capture:D: --> Int:D)
```

Returns the number of positional elements in the `Capture`.

```raku
my Capture $c = \(2, 3, 5, apples => (red => 2));
say $c.elems; # OUTPUT: «3␤»
```

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

See primary documentation
[in context](/type/Seq#method_elems)
for **method elems**.

```raku
method elems(Seq:D:)
```

Returns the number of values in the sequence. If this number cannot be predicted, the `Seq` is cached and evaluated till the end.

Because an infinite sequence cannot be evaluated till the end, such a sequence *should* be declared lazy. Calling `.elems` on a lazy `Seq` [fail](/routine/fail)s with [`X::Cannot::Lazy`](/type/X/Cannot/Lazy).

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

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

```raku
method elems(Range:D: --> Numeric:D)
```

Returns the number of elements in the range, e.g. when being iterated over, or when used as a [`List`](/type/List). Returns 0 if the start point is larger than the end point, including when the start point was specified as `∞`. Fails when the Range is lazy, including when the end point was specified as `∞` or either end point was specified as `*`.

```raku
say (1..5).elems;                                 # OUTPUT: «5␤»
say (1^..^5).elems;                               # OUTPUT: «3␤»
```

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

See primary documentation
[in context](/type/Map#method_elems)
for **method elems**.

```raku
method elems(Map:D: --> Int:D)
```

Returns the number of pairs stored in the Map.

```raku
my %map = Map.new('a', 1, 'b', 2);
say %map.elems; # OUTPUT: «2␤»
```

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

See primary documentation
[in context](/language/subscripts#method_elems)
for **method elems**.

```raku
multi method elems(::?CLASS:D:)
```

Expected to return a number indicating how many subscriptable elements there are in the object. May be called by users directly, and is also called by [`postcircumfix [ ]`](/language/operators#postcircumfix_[_]) when indexing elements from the end, as in `@foo[*-1]`.

If not implemented, your type will inherit the default implementation from [`Any`](/type/Any) that always returns `1` for defined invocants - which is most likely not what you want. So if the number of elements cannot be known for your positional type, add an implementation that [fail](/routine/fail)s or [die](/routine/die)s, to avoid silently doing the wrong thing.

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

See primary documentation
[in context](/type/Array#method_elems)
for **method elems**.

```raku
method elems(Array:D: --> Int:D)
```

Returns the number of elements in the invocant. Throws [`X::Cannot::Lazy`](/type/X/Cannot/Lazy) exception if the invocant [is lazy](/routine/is-lazy). For shaped arrays, returns the outer dimension; see [shape](/routine/shape) if you need information for all dimensions.

```raku
say [<foo bar ber>] .elems; # OUTPUT: «3␤»
say (my @a[42;3;70]).elems; # OUTPUT: «42␤»

try [-∞...∞].elems;
say $!.^name;               # OUTPUT: «X::Cannot::Lazy␤»
```

# [In role Positional](#___top "go to top of document")[§](#(role_Positional)_method_elems "direct link")

See primary documentation
[in context](/type/Positional#method_elems)
for **method elems**.

```raku
method elems()
```

Should return the number of available elements in the instantiated object.

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

See primary documentation
[in context](/type/Any#method_elems)
for **method elems**.

```raku
multi method elems(Any:U: --> 1)
multi method elems(Any:D:)
```

Interprets the invocant as a list, and returns the number of elements in the list.

```raku
say 42.elems;                   # OUTPUT: «1␤»
say <a b c>.elems;              # OUTPUT: «3␤»
say Whatever.elems ;            # OUTPUT: «1␤»
```

It will also return 1 for classes.

# [In role Blob](#___top "go to top of document")[§](#(role_Blob)_method_elems "direct link")

See primary documentation
[in context](/type/Blob#method_elems)
for **method elems**.

```raku
multi method elems(Blob:D:)
```

Returns the number of elements of the buffer.

```raku
my $blob = Blob.new([1, 2, 3]);
say $blob.elems; # OUTPUT: «3␤»
```

# [In Metamodel::EnumHOW](#___top "go to top of document")[§](#(Metamodel::EnumHOW)_method_elems "direct link")

See primary documentation
[in context](/type/Metamodel/EnumHOW#method_elems)
for **method elems**.

```raku
method elems($obj)
```

Returns the number of values.

```raku
enum Numbers <10 20>;
say Numbers.^elems;                         # OUTPUT: 2
```

# [In role Setty](#___top "go to top of document")[§](#(role_Setty)_method_elems "direct link")

See primary documentation
[in context](/type/Setty#method_elems)
for **method elems**.

```raku
method elems(Setty:D: --> Int)
```

The number of elements of the set.

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

See primary documentation
[in context](/type/Supply#method_elems)
for **method elems**.

```raku
method elems(Supply:D: $seconds? --> Supply:D)
```

Creates a new supply in which changes to the number of values seen are emitted. It optionally also takes an interval (in seconds) if you only want to be updated every so many seconds.


## dist_zef-lucs-File-TreeBuilder_1.md
[![Actions Status](https://github.com/lucs/File-TreeBuilder/actions/workflows/test.yml/badge.svg)](https://github.com/lucs/File-TreeBuilder/actions)

# NAME

```
File::TreeBuilder - Build text-scripted trees of files

```

## SYNOPSIS

```
    use File::TreeBuilder;

        #`{
            Note that this example heredoc string is literal ('Q'), so
            no interpolation occurs at all. The program will replace
            the literal '\n', '\t', '\s' (representing a space), and
            '\\' by the correct characters.

            Also, empty lines and lines starting with '#'
            will be discarded and ignored.

            It is invalid for any real tab characters to appear in
            this string, so indentation must be accomplished with
            spaces only. And the indentation must be coherent (bad
            examples are shown later).

            This is an example of an actual tree of files and
            directories that one might want to build. It has examples
            of pretty much all the features the program supports,
            described in detail later.
        }
    my $tree-desc = Q:to/EoDesc/;
        / D1
            . F1

        . F2 . File\n\twith tab, newlines and 2 trailing space.\n\s\s

        /_ D_2
            .x  Fx3
            /600 D3
                . F4 % f4-key

            .755é Fé5

        . F6 . \sLine continued, \
            and backslash and 't': \\t.
    EoDesc

    my %file-contents = (
        f4-key => "File contents from hash.".uc,
    );

    my $parent-dir = '/home/lucs/File-TreeBuilder.demo';

    build-tree(
        $parent-dir,
        $tree-desc,
        %file-contents,
    );

```

The example code would create the following directories and files under the parent directory, which must already exist:

```
    D1/
        F1
    F2
    D 2/
        F 3
        D3/
            F4
        F 5
    F6

Note that:

    The 'D1' directory will have default permissions.

    The 'F1' file will be empty and have default permissions.

    The 'F2' file will contain :
    "File\n\twith tab, newlines and 2 trailing spaces.\n  ".

    The 'D 2' directory has a space in its name.

    The 'F 3' file has a space in its name.

    The 'D3' directory will have permissions 0o600.

    The 'F4' file will contain "FILE CONTENTS FROM HASH.".

    The 'F 5' file has a space in its name and will have permissions
    0o755.

    The 'F6' file will contain " Line continued, and backslash and 't': \\t."

```

## DESCRIPTION

This module exports the `build-tree` function, used for building and populating simple trees of files and directories. I have found this useful to build test data for programs that need such things. Invoke the function like this:

```
    build-tree(
        Str $parent-dir,
        Str $tree-desc,
        %file-contents?,
    )

```

`$parent-dir` is the directory under which the needed files and directories will be created. It must already exist and have write permission.

`$tree-desc` is a multiline string describing a hierarchy of needed directories and files and their contents.

The optional `%file-contents` argument can be used to specify arbitrary file contents, as will be explained below.

### The tree description

Within the `$tree-desc` string, blank or empty lines are ignored. The string must also not contain any tab characters. The first non-blank character of each remaining line must be one of:

```
    # : Comment line, will be ignored.
    / : The line describes a wanted directory.
    . : The line describes a wanted file.

```

Any other first non-blank is invalid.

#### Directory descriptions

Directory descriptions must mention a directory name. The leading ‹/› can optionally be immmediately followed by a three-digit octal representation of the desired permissions of the directory and/or by a space-representing character to be used if the directory name is to contain spaces, and must then be followed by whitespace and the directory name. For example:

```
    / d       : Directory 'd'.
    /X dXc    : Directory 'd c'; spaces in its name are represented by 'X'.
    /600 e    : Directory 'e', permissions 600 (octal always).
    /755_ a_b : Directory 'a b', permissions 755.

    /         : Error: Missing directory name.
    /644      : Error: Missing directory name.
    / abc de  : Error: unexpected data (here, 'de').

```

#### File descriptions

File descriptions must mention a file name. The leading ‹.› can optionally be immmediately followed by a three-digit octal representation of the desired permissions of the file and/or by a space-representing character to be used if the file name is to contain spaces, and must then be followed by whitespace and the file name, and then optionally be followed by whitespace and by a specification of their wanted contents, as one of either:

```
    . ‹literal contents›
    % ‹key of contents to be retrieved from the %file-contents argument›

```

A ‹.› means to place the trimmed rest of the line into the created file. The program will replace `\t`, `\n`, `\s`, and `\\` with actual tabs, newlines, spaces, and backslashes in the file inserted content. If a line ends with a single ‹\›, the line that follows it will be concatenated to it, having its leading spaces removed.

A ‹%› means to take the trimmed rest of the line as a key into the instance's `%file-contents` and to use the corresponding found value as the file contents.

For example:

```
    . f         : File "f", contents empty (default), default permissions.
    ._ f_a      : File "f a": spaces in its name are represented by '_'.
    .444Z fZb   : File "f b", permission 444.
    . f . me ow : File "f", literal contents: "me ow".
    . f % k9    : File "f", contents retrieved from %file-contents<k9>.
    . f . This line \
        continues.\n
                : File "f", contents are "This line continues.\n".

    .           : Error: missing filename.
    . f x       : Error: unrecognized ‹x›.
    . f % baz   : Error if %file-contents wasn't specified
                  or if key ‹baz› is missing from it.
    . f %       : Error: No key specified.

```

#### Hierarchy

Directories are created hierarchically, according to the indentation. Files are created in the directory hierarchically above them. In the hierarchy then, these are okay:

```
        Directories and files intermixed on the same level.
    / d1
    / d2
    . f1
    . f2
    / d3

        A directory holding a subdirectory or a file.
    / d1
        / d2
            . f1

        Returning to a previously established level, here at ‹. f2›.
    / d1
        / d2
            / d3
                . f1
        . f2

```

But these are not:

```
        A file cannot hold a file.
    . f1
        . f2

        Nor can it hold a directory.
    . f1
        / d1

        ‹/ d3›'s indentation conflicts with those of ‹/ d1› and ‹/ d2›.
    / d1
        / d2
      / d3

        ‹/ d5›'s indentation conflicts with those of ‹/ d2› and ‹/ d3›.
    / d1
        / d2
            / d3
    / d4
          / d5

```

## AUTHOR

Luc St-Louis [lucs@pobox.com](mailto:lucs@pobox.com)

## COPYRIGHT AND LICENSE

Copyright 2023

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


## dist_zef-antononcube-DSL-English-QuantileRegressionWorkflows.md
# Quantile Regression Workflows

## In brief

This Raku Perl 6 package has grammar classes and action classes.
These are used for the parsing and interpretation of spoken commands that specify Quantile Regression (QR) workflows.

It is envisioned that the interpreters (actions) target different
programming languages: R, Mathematica, Python, etc.

The generated pipelines are for the software monads
[`QRMon-R`](https://github.com/antononcube/QRMon-R)
and
[`QRMon-WL`](https://github.com/antononcube/MathematicaForPrediction/blob/master/MonadicProgramming/MonadicQuantileRegression.m),
[AA1, AA2].

## Installation

**1.** Install Raku (Perl 6) : <https://raku.org/downloads> .

**2.** You should make sure you have the Zef Module Installer.

* Type in `zef --version` in the command line.
* Zef Module Installer can be installed from : <https://github.com/ugexe/zef> .

**3.** Open a command line program. (E.g. Terminal on Mac OS X.)

**4.** Run the commands:

```
zef install https://github.com/antononcube/Raku-DSL-Shared.git
zef install https://github.com/antononcube/Raku-DSL-English-QuantileRegressionWorkflows.git

```

## Examples

Open a Raku IDE or type `raku` in the command line program. Try this Raku code:

```
use DSL::English::QuantileRegressionWorkflows;

say ToQuantileRegressionWorkflowCode(
    "compute quantile regression with 16 knots and probabilities 0.25, 0.5 and 0.75",
    "R-QRMon");
# QRMonQuantileRegression(df = 16, probabilities = c(0.25, 0.5, 0.75))

```

Here is a more complicated pipeline specification:

```
say ToQuantileRegressionWorkflowCode(
    "create from dfTemperatureData;
     compute quantile regression with 16 knots and probability 0.5;
     show date list plot with date origin 1900-01-01;
     show absolute errors plot;
     echo text anomalies finding follows;
     find anomalies by the threshold 5;
     take pipeline value;", "R-QRMon")

```

The command above should print out R code for the R package `QRMon-R`, [AA1]:

```
QRMonUnit( data = dfTemperatureData) %>%
QRMonQuantileRegression(df = 16, probabilities = c(0.5)) %>%
QRMonPlot( datePlotQ = TRUE, dateOrigin = '1900-01-01') %>%
QRMonErrorsPlot( relativeErrorsQ = FALSE) %>%
QRMonEcho( "anomalies finding follows" ) %>%
QRMonFindAnomaliesByResiduals( threshold = 5) %>%
QRMonTakeValue

```

## Versions

The original version of this Raku package was developed and hosted at
[ [AA3](https://github.com/antononcube/ConversationalAgents/tree/master/Packages/Perl6/QuantileRegressionWorkflows) ].

A dedicated GitHub repository was made in order to make the installation with Raku's `zef` more direct.
(As shown above.)

## References

### Packages

[AA1] Anton Antonov,
[Quantile Regression Monad in R](https://github.com/antononcube/QRMon-R),
(2019),
[QRMon-R at GitHub](https://github.com/antononcube/QRMon-R).

[AA2] Anton Antonov,
[Monadic Quantile Regression Mathematica package](https://github.com/antononcube/MathematicaForPrediction/blob/master/MonadicProgramming/MonadicQuantileRegression.m),
(2018),
[MathematicaForPrediction at GitHub](https://github.com/antononcube/MathematicaForPrediction).

[AA3] Anton Antonov,
[Quantile Regression Workflows](https://github.com/antononcube/ConversationalAgents/tree/master/Packages/Perl6/QuantileRegressionWorkflows),
(2019),
[ConversationalAgents at GitHub](https://github.com/antononcube/ConversationalAgents).

### Videos

[AAv1] Anton Antonov,
["Simplified Machine Learning Workflows Overview"](https://www.youtube.com/watch?v=Xy7eV8wRLbE), (WTC-2022),
(2022),
[YouTube/Wolfram](https://www.youtube.com/@WolframResearch).

[AAv2] Anton Antonov,
["Natural Language Processing Template Engine"](https://www.youtube.com/watch?v=IrIW9dB5sRM), (WTC-2022),
(2022),
[YouTube/Wolfram](https://www.youtube.com/@WolframResearch).


## dist_github-supernovus-Hinges.md
# Hinges

## Introduction

Hinges is a Genshi-like template engine for Perl 6.
It's a modular system based on XML SAX streams, it allows for combining
(X)HTML and Perl 6 code in the same template.

## Authors

[Carl Mäsak](https://github.com/masak/)


## dist_zef-jjatria-Game-Entities.md
# NAME

Game::Entities

# SYNOPSIS

```
given Game::Entities.new {
    # Create an entity with a possibly empty set of components
    $guid = .create:
        Collidable.new,
        Drawable.new,
        Consumable.new;

    # CRUD operations on an entity's components
    .add:    $guid, Equipable.new;
    .delete: $guid, Consumable;
    $item = .get: $guid, Equipable;

    # A system operates on sets of entities in a number of possible ways
    .view( Drawable, Equipable ).each: {
        draw-equipment $^draw, $^item
    }

    # This is the same as above
    for .view: Drawable, Equipable {
        my ( $draw, $item ) = |.value;
        draw-equipment $draw, $item;
    }

    # The block can also receive the entity if you need it
    .view( Drawable, Equipable ) -> $guid, $draw, $item {
        with .get: $guid, Consumable {
            say 'This is equipment you can eat!';
        }
        ...
    }

    # Delete the entity and all its components
    .delete: $guid;

    .clear; # Delete all entities and components
}

```

# DESCRIPTION

Game::Entities is a minimalistic entity manager designed for applications using an ECS architecture.

If you don't know what this means, Mick West's [Evolve Your Hierarchy](http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy) might be a good place to start.

## On Stability

This distribution is currently **experimental**, and as such, its API might still change without warning. Any change, breaking or not, will be noted in the change log, so if you wish to use it, please pin your dependencies and make sure to check the change log before upgrading.

# CONCEPTS

Throughout this documentation, there are a couple of key concepts that will be used repeatedly:

## GUID

Entities are represented by an opaque global unique identifier: a GUID. GUIDs used by Game::Entities are stored as `Int` objects, and represent a particular version of an entity which will remain valid as long as that entity is not deleted (with `delete` or `clear`).

Each Game::Entities registry supports up to 1,048,575 (2^20 - 1) simultaneous valid entity GUIDs. From version 0.0.4, they are guaranteed to always be truthy values.

## Valid entities

An entity's GUID is valid from the time it is created with `create` until the time it is deleted. An entity's GUID can be stored and used as an identifier anywhere in the program at any point during this time, but must not be used outside it.

## Components

As far as Game::Entities is concerned, any object of any type can be used as a component and added to an entity. This includes built-in types like `Int` and `Str` and those defined by the user with keywords like `class` or `role`.

Entities can have any number of components attached to them, but they will only ever have one component of any one type (as reported by `.WHAT`).

## Views

A group of components defines a view, which is composed of all entities that have all of that view's components. This means that all the entities for the view for components `A`, `B`, and `C` will have *at least* all those components, but could of course have any others as well.

The main purpose of views is to make it possible to iterate as fast as possible over any group of entities that have a set of common components.

# METHODS

## new

```
method new () returns Game::Entities

```

Creates a new entity registry. The constructor takes no arguments.

## create

```
method create (
    *@components,
) returns Int

```

Creates a new entity and returns its GUID. If called with a list of components, these will be added to the entity before returning.

## add

```
multi method add (
    Int() $guid,
          $component,
) returns Nil

multi method add (
    Int() $guid,
          *@components,
) returns Nil

```

Takes an entity's GUID and a component, and adds that component to the specified entity. If the entity already had a component of that type, calling this method will silently overwrite it.

Multiple components can be specified, and they will all be added in the order they were provided.

## get

```
multi method get (
    Int() $guid,
          $component,
)

multi method get (
    Int() $guid,
          *@components,
)

```

Takes an entity's GUID and a component, and retrieves the component of that type from the specified entity, if it exists. If the entity had no component of that type, a type object of the component's type will be returned.

Multiple components can be specified, and they will all be retrieved and returned in the order they were provided.

## delete

```
multi method delete (
    Int() $guid,
) returns Nil

multi method delete (
    Int() $guid,
          $component,
) returns Nil

multi method delete (
    Int() $guid,
          *@components,
)

```

When called with only an entity's GUID, it deletes all components from the entity, and marks that entity's GUID as invalid.

When called with an additional component or more, components of those types will be removed from the specified entity in that order. Deleting a component from an entity is an idempotent process.

## check

```
method check (
    Int() $guid,
          $component,
) returns Bool

```

Takes an entity's GUID and a component and returns `True` if the specified entity has a component of that type, or `False` otherwise.

## valid

```
method valid (
    Int() $guid,
) returns Bool

```

Takes an entity's GUID and returns `True` if the specified entity is valid, or `False` otherwise. An entity is valid if it has been created and not yet deleted.

## created

```
method created () returns Int

```

Returns the number of entities that have been created. Calling `clear` resets this number.

## alive

```
method alive () returns Int

```

Returns the number of created entities that are still valid. That is: entities that have been created and not yet deleted.

## clear

```
method clear () returns Nil

```

Resets the internal storage of the registry. Calling this method leaves no trace from the previous state.

## sort

```
method sort( $component, $parent );
method sort( $component, { ... } );

```

*Since version 0.1.0*.

Under normal circumstances, the order in which a particular set of components is stored is not guaranteed, and will depend entirely on the additions and deletions of that component type.

However, it will sometimes be useful to impose an order on a component set. This will be the case for example when renderable components need to be drawn back to front, etc.

This method accommodates this use case.

Given a single component, and a `Callable` to use as a comparator, the specified component will be sorted accordingly. The comparator behaves just like the one used for the regular [sort](https://docs.raku.org/routine/sort), and can take one or two parameters. The arguments to the comparator will be the components being compared.

Alternatively, if given another component (`B`) to use as a parent instead of a comparator, the order of the first component (`A`) will follow that of `B`. After this, iterating over the entities that have `A` will return

* all of the entities that also have `B`, according to the order in `B`
* all of the entities that *do not* have `B`, in no particular order

Sorting a component pool invalidates any cached views that use that component.

The imposed order for this component is guaranteed to be stable as long as no components of this type are added or removed.

## view

```
multi method view (
    Whatever,
) returns Game::Entities::View

multi method view (
    $component,
) returns Game::Entities::View

multi method view (
    *@components,
) returns Game::Entities::View

```

Takes a set of one or more components, and returns an internal object representing a *view* for that specific set of components. Entities in the view are in no specific order, and this order is not guaranteed to remain the same.

As a special case, calling this method with a `Whatever` will generate a view which is guaranteed to always have all valid entities.

Once a view has been created, it should remain valid as long as none of the components in the view's set are added or deleted from any entity. Once this is done, the data returned by the view object is no longer guaranteed to be accurate. For this reason, it is not recommended to keep hold of view objects for longer than it takes to run an iteration.

The view object implements an `iterator` method which returns a list of `Pair` objects with the GUID of each entity in the view as the key, and a `List` of components as the value. This means that using the view in eg. a `for` loop should behave as expected, as illustrated below:

```
for $registry.view: |@components {
    my $guid       = .key;
    my @components = .value;
    # Do something with the GUID and components
}

```

Apart from this, the interface for this object is documented below:

### each

```
method each ( &cb ) returns Nil

```

Takes a block of code which will be called once per entity in the view.

The block of code will be called with a flat list with the GUID for the current entity as an `Int`, and the components in the requested set in the order they were specified. If the block cannot be called with these parameters, the GUID will be skipped and only the list of components will be used. Using a block that does not accept either of these is an error.

As the block of code is called within a loop, using control flow statements like `last`, `next`, and `redo` is supported and should behave as expected.

If the view was created with a `Whatever`, the view will be considered to have an empty component list, which means the block of code will *always* be called with the GUID of the current entity.

Within the callback, it is safe to add or delete entities, as well as to add or remove components from those entities.

### entities

```
method entities () returns List

```

Returns a list of only the GUIDs of the entities in this view.

### components

```
method components () returns List

```

Returns a list of `List` objects, each of which will hold the list of components for a single entity in the view. The components will be in the order provided when the view was created.

Useful for iterating like

```
for $registry.view( A, B, C ).components -> ( $a, $b, $c ) {
    ...
}

```

# PERFORMANCE

Game::Entities aims to implement a simple entity that is as fast as possible. Specifically, this means tht it needs to be fast enough to be used in game development, which is the natural use case for ECS designs.

To this end, the library caches component iterators which are invalidated every time one of the components relevant to that iterator is either added or removed from any entity. This should make the common case of systems operating over sets of components that tend to be relatively stable (eg. across game frames) as fast as possible.

The distribution includes two tests in its extended suite to test the performance with iterations over large number of entities (`xt/short-loops.t`), and many iterations over small numbers of entities (`xt/long-loops.t`). Please refer to these files for accurate estimations.

# SEE ALSO

* [EnTT](https://skypjack.github.io/entt)

  Much of the design and API of this distribution is based on that of the entity registry in EnTT (famously used in Minecraft). A significant part of the credit for the algorithms and data structures used by Game::Entities falls on the EnTT developers and [the blog posts](https://skypjack.github.io) they've made to explain how they work.

# COPYRIGHT AND LICENSE

Copyright 2021 José Joaquín Atria

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


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

# TITLE

**File::Copy** - Provides the essential functions of the POSIX `cp` command

# SYNOPSIS

```
use File::Copy; # exports routine 'cp'
cp "/usr/share/fonts/", "/home/fonts"; # the trailing slash is not required

```

# DESCRIPTION

Exported function `cp` copies files and directories from one location to another. Its behavior is intended to be very similar to the POSIX `cp` utility program.

If the `$from` location is a directory, it and all its top-level files will copied to the `$to` location. A fatal error will be thrown if `$from` is a directory and `$to` is a file. If the recursive option (`:r`) is used, all below the `from` path will be copied.

Errors will also be thrown if the permissions in either location are not appropriate for the selected operation.

Existing files **will** be overwritten unless the `:createonly` option is selected.

Current named options:

* `:i` (or `:interactive`) - Asks permission to overwrite an existing file.
* `:r` (or `:recursive`) - When the source (`$from`) is a directory, copy recursively.
* `:c` (or `:createonly`) - Existing files will be overwritten, but notice will be given.
* `:v` (or `:verbose`) - Informs the user about copying details.

See an example Raku program using this module in the module package repository at <examples>.

# AUTHOR

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

# COPYRIGHT AND LICENSE

© 2023 Tom Browder

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


## cmp.md
cmp

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/List#infix_cmp)
for **infix cmp**.

```raku
multi infix:<cmp>(List @a, List @b)
```

Evaluates `Lists` by comparing element `@a[$i]` with `@b[$i]` (for some `Int $i`, beginning at 0) and returning `Order::Less`, `Order::Same`, or `Order::More` depending on if and how the values differ. If the operation evaluates to `Order::Same`, `@a[$i + 1]` is compared with `@b[$i + 1]`. This is repeated until one is greater than the other or all elements are exhausted.

If the `List`s are of different lengths, at most only `$n` comparisons will be made (where `$n = @a.elems min @b.elems`). If all of those comparisons evaluate to `Order::Same`, the final value is selected based upon which `List` is longer.

```raku
say (1, 2, 3) cmp (1, 2, 3);   # OUTPUT: «Same␤»
say (4, 5, 6) cmp (4, 5, 7);   # OUTPUT: «Less␤»
say (7, 8, 9) cmp (7, 8, 8);   # OUTPUT: «More␤»

say (1, 2)    cmp (1, 2, 3);   # OUTPUT: «Less␤»
say (1, 2, 3) cmp (1, 2);      # OUTPUT: «More␤»
say (9).List  cmp (^10).List;  # OUTPUT: «More␤»
```

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

See primary documentation
[in context](/type/Pair#infix_cmp)
for **infix cmp**.

```raku
multi infix:<cmp>(Pair:D, Pair:D)
```

The type-agnostic comparator; compares two `Pair`s. Compares first their *key* parts, and then compares the *value* parts if the keys are equal.

```raku
my $a = (Apple => 1);
my $b = (Apple => 2);
say $a cmp $b; # OUTPUT: «Less␤»
```

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

See primary documentation
[in context](/language/operators#infix_cmp)
for **infix cmp**.

```raku
multi infix:<cmp>(Any,       Any)
multi infix:<cmp>(Real:D,    Real:D)
multi infix:<cmp>(Str:D,     Str:D)
multi infix:<cmp>(Version:D, Version:D)
```

Generic, "smart" three-way comparator.

Compares strings with string semantics, numbers with number semantics, [`Pair`](/type/Pair) objects first by key and then by value etc.

if `$a eqv $b`, then `$a cmp $b` always returns `Order::Same`.

```raku
say (a => 3) cmp (a => 4);   # OUTPUT: «Less␤»
say 4        cmp 4.0;        # OUTPUT: «Same␤»
say 'b'      cmp 'a';        # OUTPUT: «More␤»
```

Strings are compared codepoint by codepoint; if leading codepoints are the same, the result of comparing the first differing codepoint is returned or the longer string if their lengths differ.

```raku
"abcd" cmp "abcde";    # OUTPUT: «Less␤»
"abcd " cmp "abcde";   # OUTPUT: «Less␤»
'A' cmp 'Ẳ';           # OUTPUT: «Less␤»
```

# [In enum Order](#___top "go to top of document")[§](#(enum_Order)_infix_cmp "direct link")

See primary documentation
[in context](/type/Order#infix_cmp)
for **infix cmp**.

```raku
multi infix:<cmp>(\a, \b --> Order:D)
```

`cmp` will first try to compare operands as strings (via coercion to [`Stringy`](/type/Stringy)), and, failing that, will try to compare numerically via the `<=>` operator or any other type-appropriate comparison operator. See also [the documentation for the `cmp` operator](/routine/cmp#(Operators)_infix_cmp).

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

See primary documentation
[in context](/type/Allomorph#infix_cmp)
for **infix cmp**.

```raku
multi infix:<cmp>(Allomorph:D $a, Allomorph:D $b)
```

Compare two `Allomorph` objects. The comparison is done on the [`Numeric`](/type/Numeric) value first and then on the [`Str`](/type/Str) value. If you want to compare in a different order then you would coerce to a [`Numeric`](/type/Numeric) or [`Str`](/type/Str) value first:

```raku
my $f = IntStr.new(42, "smaller");
my $g = IntStr.new(43, "larger");
say $f cmp $g;          # OUTPUT: «Less␤»
say $f.Str cmp $g.Str;  # OUTPUT: «More␤»
```


## iterating.md
Iterating

Functionalities available for visiting all items in a complex data structure

# [The](#Iterating "go to top of document") [`Iterator`](/type/Iterator) and [`Iterable`](/type/Iterable) roles[§](#The_Iterator_and_Iterable_roles "direct link")

Raku is a functional language, but functions need something to hold on to when working on complex data structures. In particular, they need a uniform interface that can be applied to all data structures in the same way. One of these kind of interfaces is provided by the [`Iterator`](/type/Iterator) and [`Iterable`](/type/Iterable) roles.

The [`Iterable`](/type/Iterable) role is relatively simple. It provides a stub for the `iterator` method, which is the one actually used by statements such as `for`. `for` will call `.iterator` on the variable it precedes, and then run a block once for every item. Other methods, such as array assignment, will make the [`Iterable`](/type/Iterable) class behave in the same way.

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

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

my @longer-chain =  DNA.new('ACGTACGTT');
say @longer-chain.raku;
# OUTPUT: «[("A", "C", "G"), ("T", "A", "C"), ("G", "T", "T")]␤»

say  @longer-chain».join("").join("|"); # OUTPUT: «ACG|TAC|GTT␤»

```

In this example, which is an extension of the [example in `Iterable` that shows how `for` calls `.iterator`](/type/Iterable), the `iterator` method will be called in the appropriate context only when the created object is assigned to a [`Positional`](/type/Positional) variable, `@longer-chain`; this variable is an [`Array`](/type/Array) and we operate on it as such in the last example.

The (maybe a bit confusingly named) [`Iterator`](/type/Iterator) role is a bit more complex than [`Iterable`](/type/Iterable). First, it provides a constant, `IterationEnd`. Then, it also provides a series of [methods](/type/Iterator#Methods) such as `.pull-one`, which allows for a finer operation of iteration in several contexts: adding or eliminating items, or skipping over them to access other items. In fact, the role provides a default implementation for all the other methods, so the only one that has to be defined is precisely `pull-one`, of which only a stub is provided by the role. While [`Iterable`](/type/Iterable) provides the high-level interface loops will be working with, [`Iterator`](/type/Iterator) provides the lower-level functions that will be called in every iteration of the loop. Let's extend the previous example with this role.

```raku
class DNA does Iterable does Iterator {
    has $.chain;
    has Int $!index = 0;

    method new ($chain where {
                       $chain ~~ /^^ <[ACGT]>+ $$ / and
                       $chain.chars %% 3 } ) {
        self.bless( :$chain );
    }

    method iterator( ){ self }
    method pull-one( --> Mu){
        if $!index < $.chain.chars {
            my $codon = $.chain.comb.rotor(3)[$!index div 3];
            $!index += 3;
            return $codon;
        } else {
            return IterationEnd;
        }
    }
};

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

```

We declare a `DNA` class which does the two roles, [`Iterator`](/type/Iterator) and [`Iterable`](/type/Iterable); the class will include a string that will be constrained to have a length that is a multiple of 3 and composed only of ACGT.

Let us look at the `pull-one` method. This one is going to be called every time a new iteration occurs, so it must keep the state of the last one. An `$.index` attribute will hold that state across invocations; `pull-one` will check if the end of the chain has been reached and will return the `IterationEnd` constant provided by the role. Implementing this low-level interface, in fact, simplifies the implementation of the [`Iterable`](/type/Iterable) interface. Now the iterator will be the object itself, since we can call `pull-one` on it to access every member in turn; `.iterator` will thus return just `self`; this is possible since the object will be, at the same time, [`Iterable`](/type/Iterable) and [`Iterator`](/type/Iterator).

This need not always be the case, and in most cases `.iterator` will have to build an iterator type to be returned (that will, for instance, keep track of the iteration state, which we are doing now in the main class), such as we did in the previous example; however, this example shows the minimal code needed to build a class that fulfills the iterator and iterable roles.

# [How to iterate: contextualizing and topic variables](#Iterating "go to top of document")[§](#How_to_iterate:_contextualizing_and_topic_variables "direct link")

`for` and other loops place the item produced in every iteration into the [topic variable `$_`](/language/variables#index-entry-topic_variable), or capture them into the variables that are declared along with the block. These variables can be directly used inside the loop, without needing to declare them, by using the [`^` twigil](/syntax/$CIRCUMFLEX_ACCENT#(Traps_to_avoid)_twigil_^).

Implicit iteration occurs when using the [sequence operator](/language/operators#infix_...).

```raku
say 1,1,1, { $^a²+2*$^b+$^c } … * > 300; # OUTPUT: «(1 1 1 4 7 16 46 127 475)
```

The generating block is being run once while the condition to finish the sequence, in this case the term being bigger than 300, is not met. This has the side effect of running a loop, but also creating a list that is output.

This can be done more systematically through the use of the [`gather/take` blocks](/syntax/gather take), which are a different kind of iterating construct that instead of running in sink context, returns an item every iteration. This [Advent Calendar tutorial](https://perl6advent.wordpress.com/2009/12/23/day-23-lazy-fruits-from-the-gather-of-eden/) explains use cases for this kind of loops; in fact, gather is not so much a looping construct, but a statement prefix that collects the items produced by `take` and creates a list out of them.

# [`Classic` loops and why we do not like them](#Iterating "go to top of document")[§](#Classic_loops_and_why_we_do_not_like_them "direct link")

Classic `for` loops, with a loop variable being incremented, can be done in Raku through the [`loop` keyword](/language/control#loop). Other [repeat](/language/control#repeat/while,_repeat/until) and [while](/language/control#while,_until) loops are also possible.

However, in general, they are discouraged. Raku is a functional and concurrent language; when coding in Raku, you should look at loops in a functional way: processing, one by one, the items produced by an iterator, that is, feeding an item to a block without any kind of secondary effects. This functional view allows also easy parallelization of the operation via the [`hyper`](/routine/hyper) or [`race`](/routine/race) auto-threading methods.

If you feel more comfortable with your good old loops, the language allows you to use them. However, it is considered better practice in Raku to try and use, whenever possible, functional and concurrent iterating constructs.

*Note:* Since version 6.d loops can produce a list of values from the values of last statements.


## dist_cpan-AZAWAWI-SDL2.md
# SDL2

[![Build Status](https://travis-ci.org/azawawi/perl6-sdl2.svg?branch=master)](https://travis-ci.org/azawawi/perl6-sdl2) [![Build status](https://ci.appveyor.com/api/projects/status/github/azawawi/perl6-sdl2?svg=true)](https://ci.appveyor.com/project/azawawi/perl6-sdl2/branch/master)

This module adds some OO-sugar on top of [`SDL2::Raw`](https://github.com/timo/SDL2_raw-p6/).

**Note: This is currently experimental and API may change. Please DO NOT use in
a production environment.**

## Example

```
use v6;

use SDL2::Raw;
use SDL2;

die "couldn't initialize SDL2: { SDL_GetError }" if SDL_Init(VIDEO) != 0;
LEAVE SDL_Quit;

my $window = SDL2::Window.new(:title("Hello, world!"), :flags(OPENGL));
LEAVE $window.destroy;

my $render = SDL2::Renderer.new($window);
LEAVE $render.destroy;

my $event = SDL_Event.new;

main: loop {
  $render.draw-color(0, 0, 0, 0);
  $render.clear;

  while SDL_PollEvent($event) {
    last main if $event.type == QUIT;
  }

  $render.draw-color(255, 255, 255, 255);
  $render.fill-rect(
    SDL_Rect.new(
      2 * min(now * 300 % 800, -now * 300 % 800),
      2 * min(now * 470 % 600, -now * 470 % 600),
    sin(3 * now) * 50 + 80, cos(4 * now) * 50 + 60));

  $render.present;
}

```

More examples can be found in [`examples`](examples/) folder.

## Installation

Please see [`SDL2::Raw`](https://github.com/timo/SDL2_raw-p6/) for `libsdl2` platform dependencies.

```
$ zef install sdl2

```

## Testing

* To run tests:

```
$ prove -ve "perl6 -Ilib"

```

* To run all tests including author tests (Please make sure
  [Test::Meta](https://github.com/jonathanstowe/Test-META) is installed):

```
$ zef install Test::META
$ AUTHOR_TESTING=1 prove -e "perl6 -Ilib"

```

## Author

Ahmad M. Zawawi, [azawawi](https://github.com/azawawi/) on #perl6

## License

MIT License


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

# NAME

Pod::EOD - Moves declarative POD blocks to the end of the POD

# SYNOPSIS

```
#| Example sub!
my sub example {}

DOC INIT {
    use Pod::EOD;
    move-declarations-to-end($=pod);
}

=head1 OTHER POD
...

# Now the "Example sub" POD appears after
# the "OTHER POD" POD!

```

# DESCRIPTION

Many authors from a Perl background (like myself) write POD in a "all POD at the end" style; this keeps it out of the way when you're looking at the code, but in the same file. However, POD blocks are inserted into `$=pod` in the order they occur in the code, and I would rather not give up the advantages of declarative POD blocks. So this module simply moves declative POD blocks to the end of the POD document, so that the developer can keep their POD at the end, and the user can read the high-level overview of the module before encountering the reference section provided by declarative blocks.

# AUTHORS

* Rob Hoelz
* Raku Community

# COPYRIGHT AND LICENSE

Copyright (c) 2016 - 2017 Rob Hoelz

Copyright (c) 2024 Raku Community

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# REFERENCE

### sub move-declarations-to-end

```
sub move-declarations-to-end(
    $pod
) returns Mu

```

Rearranges the POD blocks in C<$pod> (you will almost always pass your module's C<$=pod> to this sub) so that declarative POD blocks (like this one) are moved to the end of the document. Note that this happens I, so your original array is modified!


## stringy.md
role Stringy

String or object that can act as a string

```raku
role Stringy { ... }
```

Common role for string types (such as Str).

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

Type relations for `Stringy`

raku-type-graph

Stringy
Stringy

Positional
Positional

Blob
Blob

Blob->Stringy

Blob->Positional

Mu
Mu

Any
Any

Any->Mu

Cool
Cool

Cool->Any

Str
Str

Str->Stringy

Str->Cool

Uni
Uni

Uni->Stringy

Uni->Positional

Uni->Any

Allomorph
Allomorph

Allomorph->Str

NFKC
NFKC

NFKC->Uni

NFD
NFD

NFD->Uni

NFC
NFC

NFC->Uni

NFKD
NFKD

NFKD->Uni

Buf
Buf

Buf->Blob

utf8
utf8

utf8->Blob

utf8->Any

Numeric
Numeric

Real
Real

Real->Numeric

Int
Int

Int->Cool

Int->Real

IntStr
IntStr

IntStr->Allomorph

IntStr->Int

Num
Num

Num->Cool

Num->Real

NumStr
NumStr

NumStr->Allomorph

NumStr->Num

Complex
Complex

Complex->Cool

Complex->Numeric

ComplexStr
ComplexStr

ComplexStr->Allomorph

ComplexStr->Complex

Rational
Rational

Rational->Real

Rat
Rat

Rat->Cool

Rat->Rational

RatStr
RatStr

RatStr->Allomorph

RatStr->Rat

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


## dist_zef-jonathanstowe-Chronic.md
# Chronic

Scheduling thingy for Raku

![Build Status](https://github.com/jonathanstowe/Chronic/workflows/CI/badge.svg)

## Synopsis

```

# Static configuration;

use Chronic;

react {
    # Every minute
    whenever Chronic.every() -> $v {
        say "One: $v";
    }
    # Every five minutes
    whenever Chronic.every(minute => '*/5') -> $v {
        say "Five: $v";
    }
    # At 21:31 every day
    whenever Chronic.every(minute => 31, hour => 21) -> $v {
        say "21:31 $v";
    }

}

# Dynamic configuration

use Chronic;

my @events = (
    {
        schedule => {},
        code     => sub ($v) { say "One: $v" },
    },
    {
        schedule => { minute => '*/2' },
        code     => sub ($v) { say "Two: $v" },
    },
    {
        schedule => { minute => '*/5' },
        code     => sub ($v) { say "Five: $v" },
    },
    {
        schedule => { minute => 31, hour => 21 },
        code     => sub ($v) {  say "21:31 $v"; },
    },
);

for @events -> $event {
    Chronic.every(|$event<schedule>).tap($event<code>);
}

# This has the effect of waiting forever
Chronic.supply.wait;

```

## Description

This module provides a low-level scheduling mechanism, that be used to
create cron-like schedules, the specifications can be provided as cron
expression strings, lists of integer values or [Junctions](https://docs.raku.org/type/Junction) of values.

There is a class method `every` that takes a schedule specification
and returns a `Supply` that will emit a value (a `DateTime`) on
the schedule specified. There is also a method `at` (also a class
method) that returns a Promise that will be kept at a specified point
in time (as opposed to `Promise.in` which will return a Promise that
will be kept after a specified number of seconds.)

This can be used to build custom scheduling services like `cron`
with additional code to read the specification from a file and arrange
the execution of the required thing or it could be used in a larger
program that may require to execute some code asynchronously periodically.

There is a single base Supply that emits an event at a 1 second frequency
in order to preserve the accuracy of the timings (in testing it may drift
by up to 59 seconds on a long run due to system latency if it didn't match
the seconds too,) so this may be a problem on a heavily loaded single core
computer. The sub-minute granularity isn't provided for in the interface
as it is easily achieved anyway with a basic supply, it isn't supported by
a standard `cron` and I think most code that would want to be executed
with that frequency would be more highly optimised then this may allow.

## Installation

If you have a working Rakudo you can install directly with *zef*:

```
# From the source directory

zef install .

# Remote installation

zef install Chronic

```

## Support

Suggestions/patches are welcomed via github at <https://github.com/jonathanstowe/Chronic>

## Licence

This is free software.

Please see the <LICENCE> file in the distribution.

© Jonathan Stowe 2015, 2016, 2017, 2019, 2020


## ro.md
class X::Assignment::RO

Exception thrown when trying to assign to something read-only

```raku
class X::Assignment::RO is Exception {}
```

Code like

```raku
sub f() { 42 };
f() = 'new value';  # throws an X::Assignment::RO
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Assignment::RO: Cannot modify an immutable Any␤»
```

throws an exception of type `X::Assignment::RO`.

# [Methods](#class_X::Assignment::RO "go to top of document")[§](#Methods "direct link")

## [method typename](#class_X::Assignment::RO "go to top of document")[§](#method_typename "direct link")

```raku
method typename(X::Assignment::RO:D: --> Str)
```

Returns the type name of the value on the left-hand side


## dist_github-jaffa4-String-Stream.md
# String::Stream

Stream into a string or from a string. Use print, say to direct output into a string.

## Usage

```
my $t = String::Stream.new(); # for both input and output

print $t: "something";

say $t: "something else";

$*IN = Stream.new("puccini");

my $out = say prompt "composer> "; # $out will contain puccini.

print $t.buffer;
somethingsomething else

```

## Similar module

```
https://github.com/sergot/IO-Capture-Simple

```


## dist_cpan-AVUSEROW-Audio-TagLib.md
[![Actions Status](https://github.com/avuserow/raku-audio-taglib/workflows/test/badge.svg)](https://github.com/avuserow/raku-audio-taglib/actions)

# NAME

Audio::TagLib - Read ID3 and other audio metadata with TagLib

# SYNOPSIS

```
use Audio::TagLib;

my $taglib = Audio::TagLib.new($path);

# Abstract API - aliases for simple fields
say $taglib.title ~ " by " ~ $taglib.artist;
say "$path has no album field set" unless $taglib.album.defined;

# Raw access to all tags in the file (as a list of pairs)
.say for $taglib.propertymap.grep(*.key eq 'ALBUMARTIST' | 'ALBUM ARTIST');

```

# DESCRIPTION

Audio::TagLib provides Raku bindings to the TagLib audio metadata library, providing a fast way to read metadata from many audio file formats: mp3, m4a, ogg, flac, opus, and more. See <https://taglib.org> for more details.

# Audio::TagLib vs Audio::Taglib::Simple

This module uses the C++ interface to TagLib rather than the C bindings. This means installation requires a C++ compiler, but provides the full API rather than the "abstract only" API.

This module is newer than Simple and does not yet provide tag writing functions.

This module does not keep a taglib object open and reads everything into memory initially, meaning there is no `free` method needed (unlike Simple).

`Audio::Taglib::Simple` has a lowercase 'l' in its name, where this module uses `TagLib` (as does the official website). I thought adjusting the case was a good idea at the time.

### Abstract API

TagLib provides what is known as the "abstract API", which provides an easy interface to common tags without having to know the format-specific identifier for a given tag. This module provides these as attributes of `Audio::TagLib`. The following fields are available as strings (Str):

* title
* artist
* album
* comment
* genre

The following are provided as integers (Int):

* year
* track
* length - length of the file, in seconds

These attributes will be undefined if they are not present in the file.

### @.propertymap

The raw tag values are available in the propertymap attribute as a List of Pairs. It is possible to have duplicate keys (otherwise this would be a hash).

If you are looking for a tag that is not available in the abstract interface, you can find it here. O

## Album Art

Album art can be extracted from most types of audio files. This module provides access to the first picture data in the file. Most files only have a single picture attached, so this is usually the album art.

* album-art-size - the size of the album art in bytes
* album-art-mime - the mime type of the album art, such as 'image/png'

The data can be retrieved by calling one of the following methods:

* get-album-art - returns the data as a Blob[uint8]
* get-album-art-raw - returns the data as a CArray (call .elems to get the size)

The raw variant is much faster if you are passing the data to another function that uses a CArray. If speed is important, consider using NativeHelpers::Blob to convert the raw variant.

Note that the mime type is stored in the file, and not determined from the image, so it may be inaccurate.

# SEE ALSO

Audio::Taglib::Simple

<https://taglib.org>

# AUTHOR

Adrian Kreher [avuserow@gmail.com](mailto:avuserow@gmail.com)

# COPYRIGHT AND LICENSE

Copyright 2021-2022 Adrian Kreher

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


## frame.md
class Backtrace::Frame

Single frame of a Backtrace

```raku
class Backtrace::Frame { }
```

A single backtrace frame. It identifies a location in the source code.

# [Methods](#class_Backtrace::Frame "go to top of document")[§](#Methods "direct link")

## [method file](#class_Backtrace::Frame "go to top of document")[§](#method_file "direct link")

```raku
method file(Backtrace::Frame:D --> Str)
```

Returns the file name.

```raku
my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.file;
```

## [method line](#class_Backtrace::Frame "go to top of document")[§](#method_line "direct link")

```raku
method line(Backtrace::Frame:D --> Int)
```

Returns the line number (line numbers start counting from 1).

```raku
my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.line;
```

## [method code](#class_Backtrace::Frame "go to top of document")[§](#method_code "direct link")

```raku
method code(Backtrace::Frame:D)
```

Returns the code object into which `.file` and `.line` point, if available.

```raku
my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.code;
```

## [method subname](#class_Backtrace::Frame "go to top of document")[§](#method_subname "direct link")

```raku
method subname(Backtrace::Frame:D --> Str)
```

Returns the name of the enclosing subroutine.

```raku
my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.subname;
```

## [method is-hidden](#class_Backtrace::Frame "go to top of document")[§](#method_is-hidden "direct link")

```raku
method is-hidden(Backtrace::Frame:D: --> Bool:D)
```

Returns `True` if the frame is marked as hidden with the `is hidden-from-backtrace` trait.

```raku
my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.is-hidden;
```

## [method is-routine](#class_Backtrace::Frame "go to top of document")[§](#method_is-routine "direct link")

```raku
method is-routine(Backtrace::Frame:D: --> Bool:D)
```

Return `True` if the frame points into a routine (and not into a mere [`Block`](/type/Block)).

```raku
my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.is-routine;
```

## [method is-setting](#class_Backtrace::Frame "go to top of document")[§](#method_is-setting "direct link")

```raku
method is-setting(Backtrace::Frame:D: --> Bool:D)
```

Returns `True` if the frame is part of a setting.

```raku
my $bt = Backtrace.new;
my $btf = $bt[0];
say $btf.is-setting; # OUTPUT: «True␤»
```


## dist_zef-l10n-L10N-PT.md
# NAME

L10N::PT - Portuguese localization of Raku

# SYNOPSIS

```
use L10N::PT;
diga "Hello World";

```

# DESCRIPTION

L10N::PT contains the logic to provide a Portuguese localization of the Raku Programming Language.

# AUTHORS

Fernando Corrêa de Oliveira

# 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-raku-community-modules-Games-BubbleBreaker.md
## Games::BubbleBreaker – a mouse based logic game

### Installation

This game requires `libSDL`, `libSDL_image` and `libSDL_mixer`. On Debian-based systems
you can install these with:

```
sudo apt install libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev

```

### Running

The script can be ran from the sources by

```
raku bin/bubble-breaker.raku

```

after installation, it can be executed as simply as

```
bubble-breaker.raku

```


## dist_zef-librasteve-Net-Google-Sheets.md
[![](https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg)](https://opensource.org/licenses/Artistic-2.0)

# Net::Google::Sheets

Simple API access to Google Sheets, using [OAuth2::Client::Google](https://github.com/bduggan/p6-oauth2-client-google)

## Install

```
zef install Net::Google::Sheets

```

Follow the [HOW-TO](https://raku.land/cpan:BDUGGAN/OAuth2::Client::Google#quick-how-to) to make a client\_id.json in your script dir (eg. /bin for /bin/synopsis)

## Synopsis

```
#!/usr/bin/env raku
use Net::Google::Sheets;

my $session = Session.new;

my %sheets = $session.sheets;
my $id = %sheets<AWS_EC2_Sizes_test>;

# get values from Sheet1
my $sheet1 = Sheet.new(:$session, :$id, range => 'Sheet1');
my @vals = $sheet1.values;
dd @vals;

# put values into Sheet2
my $sheet2 = Sheet.new(:$session, :$id, range => 'Sheet2');
$sheet2.values: @vals;

# clear Sheet2
$sheet2.clear;

```

### Copyright

copyright(c) 2023-2024 Henley Cloud Consulting Ltd.


## dist_zef-jjmerelo-Math-Constants.md
# Math::Constants [.github/workflows/test.yaml](https://github.com/JJ/p6-math-constants/actions/workflows/test.yaml)

Math::Constants - A few constants defined in Raku

# SYNOPSIS

```
#!/usr/bin/env raku

use Math::Constants;

say "We have ", phi, " ", plancks-h, " ",  plancks-reduced-h, " ",
    c, " ", G, " and ", fine-structure-constant, " plus ",
    elementary-charge, " and ", vacuum-permittivity ;

say "And also  φ ", φ, " α ", α,  " ℎ ",  ℎ, " and ℏ ", ℏ,
    " with e ", e, " and ε0 ", ε0;

say "We are flying at speed ", .1c;

```

# DESCRIPTION

Math::Constants is a collection of Math and Physics constants that will save you the trouble of defining them.

## Constants included

### Physical constants

All the physical constants have the [CODATA 2018](https://www.nist.gov/publications/codata-recommended-values-fundamental-physical-constants-2018) recommended values. These
reflect the new definitions of the kilogram and ampere as of 2019-05-20.

* [Gravitational constant](https://en.wikipedia.org/wiki/Gravitational_constant) as `gravitation-constant` and `G`.
* [Speed of light](https://en.wikipedia.org/wiki/Speed_of_light) as `speed-of-light-vacuum` and `c`. It works also as a suffix for expressing speeds, as in `3c` for 3 times the speed of light.
* [Planck constant and reduced constant](https://en.wikipedia.org/wiki/Planck_constant) in J/s as `plancks-h` or `ℎ` and `plancks-reduced-h` or `ℏ`.
* [Boltzmann constant](https://en.wikipedia.org/wiki/Boltzmann_constant) as `boltzmann-constant` or `k`. Previous versions of Math::Constants had this in eV. The value is now in standard SI units. The eV postfix operator can be used to get the previous value if needed.
* [Coulomb constant](https://en.wikipedia.org/wiki/Coulomb_constant) as `coulomb-constant` or `K0`.
* [Mass of an electron](https://en.wikipedia.org/wiki/Electron) as `electron-mass`.
* [Electron volt](https://en.wikipedia.org/wiki/Electronvolt) as `electron-volt` and `eV` or as an operator.
* [Elementary charge](https://en.wikipedia.org/wiki/Elementary_charge) as `elementary-charge` or `q`.
* [Faraday constant](https://en.wikipedia.org/wiki/Faraday_constant) as `faraday-constant` or `F`.
* [The fine structure constant](https://en.wikipedia.org/wiki/Fine_structure) as `fine-structure-constant` or `α`.
* [Gas constant](https://en.wikipedia.org/wiki/Gas_constant) as `gas-constant` or `R`.
* [Avogadro's constant](https://en.wikipedia.org/wiki/Avogadro_constant) as `avogadro-constant` or `L`.
* [Vacuum magnetic permeability](https://en.wikipedia.org/wiki/Vacuum_permeability) as `magnetic-permeability` or `μ0`.
* [Mass of a neutron](https://en.wikipedia.org/wiki/Neutron) as `neutron-mass`.
* [Planck length](https://en.wikipedia.org/wiki/Planck_length) as `planck-length` or `lp`.
* [Planck mass](https://en.wikipedia.org/wiki/Planck_mass) as `planck-mass` or `mp`.
* [Planck temperature](https://en.wikipedia.org/wiki/Planck_temperature) as `planck-temperature` or `Tp`.
* [Planck time](https://en.wikipedia.org/wiki/Planck_time) as `planck-time` or `tp`.
* [Mass of a proton](https://en.wikipedia.org/wiki/Proton) as `proton-mass`.
* The quantum ratio (elementary charge / Planck constant) as `quantum-ratio`.
* [Standard acceleration due to gravity](https://en.wikipedia.org/wiki/Standard_gravity) as `standard-acceleration-gravity` or `g`.
* [Vacuum electrical permittivity](https://en.wikipedia.org/wiki/Vacuum_permittivity) as `vacuum-permittivity` or `ε0`.

### Mathematical constants

* [Golden ratio](https://en.wikipedia.org/wiki/Golden_ratio) as `phi` or `φ`.
* [Feigenbaum constants](https://en.wikipedia.org/wiki/Feigenbaum_constants) as `alpha-feigenbaum-constant` and `delta-feigenbaum-constant` or `δ`.
* [Apéry's constant](https://en.wikipedia.org/wiki/Ap%C3%A9ry%27s_constant) as `apery-constant`.
* [Conway's constant](https://en.wikipedia.org/wiki/Look-and-say_sequence#Growth_in_length) as `conway-constant` and `λ`.
* [Khinchin's constant](https://en.wikipedia.org/wiki/Khinchin%27s_constant) as `khinchin-constant` and `k0`.
* [Glaisher–Kinkelin constant](https://en.wikipedia.org/wiki/Glaisher%E2%80%93Kinkelin_constant) as `glaisher-kinkelin-constant` and `A`.
* [Golomb–Dickman constant](https://en.wikipedia.org/wiki/Golomb%E2%80%93Dickman_constant) as `golomb-dickman-constant`.
* [Catalan's constant](https://en.wikipedia.org/wiki/Catalan%27s_constant) as `catalan-constant`.
* [Mill's constant](https://en.wikipedia.org/wiki/Mills%27_constant) as `mill-constant`.
* [Gauss's constant](https://en.wikipedia.org/wiki/Gauss%27s_constant) as `gauss-constant`.
* [Euler–Mascheroni constant](https://en.wikipedia.org/wiki/Euler%E2%80%93Mascheroni_constant) as `euler-mascheroni-gamma` and `γ`.
* [Sierpiński's constant](https://en.wikipedia.org/wiki/Sierpi%C5%84ski%27s_constant) as `sierpinski-gamma` and `K`.
* [iⁱ](https://oeis.org/A049006)
* [ζ(2)](https://oeis.org/A013661)

### Units

"Units" can be used as suffix; the number will be multiplied by its value

* `eV`, or electron-volts; `1.3eV` is 1.3 divided by the `eV` constant value.
* `c`, speed of light.
* `g`, gravitational constant.

# Issues and suggestions

Please post them [in GitHub](https://github.com/JJ/p6-math-constants/issues). Pull requests are also welcome.

# AUTHOR

* JJ Merelo [jjmerelo@gmail.com](mailto:jjmerelo@gmail.com)
* Kevin Pye [Kevin.Pye@gmail.com](mailto:Kevin.Pye@gmail.com)
* [`librasteve`](https://github.com/librasteve)

# COPYRIGHT AND LICENSE

Copyright 2016-2023 JJ Merelo

Copyright 2019 Kevin Pye

This library is free software; you can redistribute it and/or modify it under the GPL 3.0.


## iterationbuffer.md
class IterationBuffer

Low level storage of positional values

```raku
my class IterationBuffer { }

```

An `IterationBuffer` is used when the implementation of an [`Iterator`](/type/Iterator) class needs a lightweight way to store/transmit values. It doesn't make [`Scalar`](/type/Scalar) containers, and only supports mutation through the `BIND-POS` method, only supports adding values with the `push` and `unshift` methods, supports merging of two `IterationBuffer` objects with the `append` and `prepend` methods, and supports resetting with the `clear` method.

It can be coerced into a [`List`](/type/List), [`Slip`](/type/Slip), or [`Seq`](/type/Seq).

Values will be stored "as is", which means that [Junctions](/type/Junction) will be stored as such and will **not** [autothread](/language/glossary#Autothreading).

As of release 2021.12 of the Rakudo compiler, the `new` method also accepts an [`Iterable`](/type/Iterable) as an optional argument which will be used to fill the `IterationBuffer`.

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

## [method push](#class_IterationBuffer "go to top of document")[§](#method_push "direct link")

```raku
method push(IterationBuffer:D: Mu \value)
```

Adds the given value at the end of the `IterationBuffer` and returns the given value.

## [method unshift](#class_IterationBuffer "go to top of document")[§](#method_unshift "direct link")

```raku
method unshift(IterationBuffer:D: Mu \value)
```

Adds the given value at the beginning of the `IterationBuffer` and returns the given value. Available as of the 2021.12 release of the Rakudo compiler.

## [method append](#class_IterationBuffer "go to top of document")[§](#method_append "direct link")

```raku
method append(IterationBuffer:D: IterationBuffer:D $other --> IterationBuffer:D)
```

Adds the contents of the other `IterationBuffer` at the end of the `IterationBuffer`, and returns the updated invocant.

## [method prepend](#class_IterationBuffer "go to top of document")[§](#method_prepend "direct link")

```raku
method prepend(IterationBuffer:D: IterationBuffer:D $other --> IterationBuffer:D)
```

Adds the contents of the other `IterationBuffer` at the beginning of the `IterationBuffer`, and returns the updated invocant. Available as of the 2021.12 release of the Rakudo compiler.

## [method clear](#class_IterationBuffer "go to top of document")[§](#method_clear "direct link")

```raku
method clear(IterationBuffer:D: --> Nil)
```

Resets the number of elements in the `IterationBuffer` to zero, effectively removing all data from it, and returns [`Nil`](/type/Nil).

## [method elems](#class_IterationBuffer "go to top of document")[§](#method_elems "direct link")

```raku
method elems(IterationBuffer:D: --> Int:D)
```

Returns the number of elements in the `IterationBuffer`.

## [method AT-POS](#class_IterationBuffer "go to top of document")[§](#method_AT-POS "direct link")

```raku
multi method AT-POS(IterationBuffer:D: int   $pos)
multi method AT-POS(IterationBuffer:D: Int:D $pos)
```

Returns the value at the given element position, or [`Mu`](/type/Mu) if the element position is beyond the length of the `IterationBuffer`, or an error will be thrown indicating the index is out of bounds (for negative position values).

## [method BIND-POS](#class_IterationBuffer "go to top of document")[§](#method_BIND-POS "direct link")

```raku
multi method BIND-POS(IterationBuffer:D: int   $pos, Mu \value)
multi method BIND-POS(IterationBuffer:D: Int:D $pos, Mu \value)
```

Binds the given value at the given element position and returns it. The `IterationBuffer` is automatically lengthened if the given element position is beyond the length of the `IterationBuffer`. An error indicating the index is out of bounds will be thrown for negative position values.

## [method Slip](#class_IterationBuffer "go to top of document")[§](#method_Slip "direct link")

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

Coerces the `IterationBuffer` to a [`Slip`](/type/Slip).

## [method List](#class_IterationBuffer "go to top of document")[§](#method_List "direct link")

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

Coerces the `IterationBuffer` to a [`List`](/type/List).

## [method Seq](#class_IterationBuffer "go to top of document")[§](#method_Seq "direct link")

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

Coerces the `IterationBuffer` to a [`Seq`](/type/Seq).

## [method raku](#class_IterationBuffer "go to top of document")[§](#method_raku "direct link")

```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)).


## dist_cpan-BDUGGAN-Duckie.md
[![Actions Status](https://github.com/bduggan/raku-duckie/actions/workflows/linux.yml/badge.svg)](https://github.com/bduggan/raku-duckie/actions/workflows/linux.yml)
[![Actions Status](https://github.com/bduggan/raku-duckie/actions/workflows/macos.yml/badge.svg)](https://github.com/bduggan/raku-duckie/actions/workflows/macos.yml)

# NAME

Duckie - A wrapper and native bindings for DuckDB

# SYNOPSIS

```
use Duckie;
Duckie.new.query('select name from META6.json').rows[0]
# {name => Duckie}

my $db = Duckie.new;
say $db.query("select 1 as the_loneliest_number").column-data(0);
# [1]

with $db.query("select 1 as the_loneliest_number") -> $result {
  say $result.column-data('the_loneliest_number'); # [1]
} else {
  # Errors are soft failures
  say "Failed to run query: $_";
}

# DuckDB can query or import data from CSV or JSON files, HTTP URLs,
# PostgreSQL, MySQL, SQLite databases and more.
my @cols = $db.query('select * from data.csv').columns;
my @rows = $db.query('select * from data.json').rows;

$db.query: q[ attach 'postgres://secret:pw@localhost/dbname' as pg (type postgres)]
$res = $db.query: "select * from pg.my_table"

$db.query("install httpfs");
$db.query("load httpfs");
$res = $db.query: "select * from 'http://example.com/data.csv'";

# Joins between different types are also possible.
$res = $db.query: q:to/SQL/
select *
from pg.my_table one
inner join 'http://example.com/data.csv' csv_data on one.id = csv_data.id
inner join 'data.json' json_data on one.id = json_data.id
SQL

```

# DESCRIPTION

This module provides Raku bindings for [DuckDB](https://duckdb.org/). DuckDB is a "fast in-process analytical database". It provides an SQL interface for a variety of data sources. Result sets are column-oriented, with a rich set of types that are either inferred, preserved, or explicitly defined. `Duckie` also provides a row-oriented API.

This module provides two sets of classes.

* `Duckie::DuckDB::Native` is a low-level interface that directly maps to the [C API](https://duckdb.org/docs/api/c/api.html). Note that a number of the function calls there are either deprecated or scheduled for deprecation, so the implementation of the Raku interface favors the more recent mechanisms where possible.
* `Duckie` provides a high level interface that handles things like memory management and native typecasting. While the Raku language supports native types, the results from `Duckie` do not currently expose them, preferring, for instance to return Integers instead of uint8s, int64s, etc, and using Rats for decimals, and Nums for floats. A future interface may expose native types.

# METHODS

### method new

```
method new(
  :$file = ':memory:'
) returns Duckie

```

Create a new Duckie object. The optional `:file` parameter specifies the path to a file to use as a database. If not specified, an in-memory database is used. The database is opened and connected to when the object is created.

### method query

```
method query(
    Str $sql
) returns Duckie::Result

```

Run a query and return a result. If the query fails, a soft failure is thrown.

### method DESTROY

```
method DESTROY() returns Mu

```

Close the database connection and free resources.

# SEE ALSO

* [Duckie::Result](https://github.com/bduggan/raku-duckie/blob/main/docs/lib/Duckie/Result.md)
* [Duckie::DuckDB::Native](https://github.com/bduggan/raku-duckie/blob/main/docs/lib/Duckie/DuckDB/Native.md)

# ENVIRONMENT

Set `DUCKIE_DEBUG` to a true value to enable logging to `STDERR`.

# AUTHOR

Brian Duggan


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

# NAME

Raku port of Perl's getnetbyname() and associated built-ins

# SYNOPSIS

```
use P5getnetbyname;
# exports getnetbyname, getnetbyaddr, getnetent, setnetent, endnetent

say getnetbyaddr(Scalar, 127, 2);   # something akin to loopback

my @result_byname = getnetbyname("loopback");

my @result_byaddr = getnetbyaddr(|@result_byname[4,3]);

```

# DESCRIPTION

This module tries to mimic the behaviour of Perl's `getnetbyname` and associated built-ins as closely as possible in the Raku Programming Language.

It exports by default:

```
endnetent getnetbyname getnetbyaddr getnetent setnetent

```

# ORIGINAL PERL 5 DOCUMENTATION

```
getnetbyname NAME
getnetbyaddr ADDR,ADDRTYPE
getnetent
setnetent STAYOPEN
endnetent
        These routines are the same as their counterparts in the system C
        library. In list context, the return values from the various get
        routines are as follows:

         # 0        1          2           3         4
         ( $name,   $aliases,  $addrtype,  $net      ) = getnet*

        In scalar context, you get the name, unless the function was a
        lookup by name, in which case you get the other thing, whatever it
        is. (If the entry doesn't exist you get the undefined value.)

```

# PORTING CAVEATS

This module depends on the availability of POSIX semantics. This is generally not available on Windows, so this module will probably not work on Windows.

# AUTHOR

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

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!

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

# COPYRIGHT AND LICENSE

Copyright 2018, 2019, 2020, 2021, 2022, 2023 Elizabeth Mattijsen

Re-imagined from Perl as part of the CPAN Butterfly Plan.

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


## dist_zef-jjmerelo-kazmath.md
# kazmath

This is an embryo of a NativeCall port of the [kazmath
library](https://github.com/Kazade/kazmath), which is a low-level library for
manipulation of graphics primitives. It's similar to others graphics
libraries such as OpenGL, but it's simpler and, in some cases, faster.

## Installing

You need to install kazmath from source (URL above), compiling it. Follow the
instructions to create a shared library.

Then you xan install this from this source or via

```
zef install kazmath

```

## Running

Since only some functions have been ported, basically you can rotate a vector
, like this:

```
    my mat4 $one-mat .= new;
    my mat4 $turn-pi = kmMat4RotationY($one-mat, pi/2);
    say $turn-pi;
    my vec4 $out .= new;
    my vec4 $in  .= new(1.Num, 0.Num, 0.Num, 1.Num);
    my vec4 $result = kmVec4Transform( $out, $in, $turn-pi);
    say $result;

```

## See also

Tutorial for [NativeCall](https://docs.raku.org/language/nativecall)

Also, this has been built mainly to be used as a recipe in the upcoming Raku
Recipes book by APress. Check out all [Raku titles in Apress such as this one.](https://www.apress.com/gp/book/9781484249550)

If you want to create a Dockerfile with `kazmath`, check out also the [`download -and-compile-kazmath.sh`](download-and-compile-kazmath.sh) included in this
repo, which can be useful to create the image.

## License

(c) JJ Merelo `jj@raku.org`, 2021-2022

This module is licensed under the Artistic 2.0 License (the same as Raku itself
)


## dist_zef-samy-App-Ebread.md
# ebread

**ebread** (**eb**ook **read**er) is a program that dumps the contents of an EPUB ebook to plain text. It accomplishes this via the HTML dump feature found in many text-mode web browsers, like `lynx`. The outputted text should be suitable for reading and piping into other programs for further processing.

## Installing

**ebread** should be able to run on most Unix-like operating systems, as long as they support the dependencies below. There is currently no plan to support Windows.

**ebread** requires the [rakudo](https://rakudoc.org/) compiler.

**ebread** depends on the following Raku modules, which can be installed via the [zef](https://github.com/ugexe/zef)) package manager.

* `File::Temp`
* `File::Which`
* `XML`

**ebread** also depends on the following system binaries to be installed:

* `unzip`

and at least one of the following text browsers:

* `elinks`
* `links`/`links2`
* `lynx`
* `w3m`

Once all of the necessary dependencies are installed, **ebread** can be installed via zef.

```
zef install .

```

## Usage

```
ebread [options] epub

```

By default, **ebread** will dump the text contents of a given EPUB to *stdout*. For more extensive documentation on the usage of **ebread**, you should consult the manual, which can be read either via [rakudoc](https://github.com/Raku/rakudoc) or **ebread**'s `--man` option.

```
rakudoc App::Ebread
ebread --man

```

## Copyright

Copyright 2024-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.


## dist_zef-raku-community-modules-Math-Trig.md
[![Actions Status](https://github.com/raku-community-modules/Math-Trig/workflows/test/badge.svg)](https://github.com/raku-community-modules/Math-Trig/actions)

# NAME

Math::Trig - Trigonometric routines not already built-in

# SYNOPSIS

```
use Math::Trig;

```

# DESCRIPTION

Subroutines for coverting between degrees, radians, and gradians; converting between different coordinate systems (cartesian, spherical, cylindrical); and great circle formulas.

# SUBROUTINES

Available with `use Math::Trig`;

* sub rad2rad($rad)
* sub deg2deg($deg)
* sub grad2grad($grad)
* sub rad2deg($rad)
* sub deg2rad($deg)
* sub grad2deg($grad)
* sub deg2grad($deg)
* sub rad2grad($rad)
* sub grad2rad($grad)
* sub cartesian-to-spherical($x,$y,$z)

Available with `use Math::Trig :radial`;

* sub spherical-to-cartesian($rho, $theta, $phi)
* sub spherical-to-cylindrical($rho, $theta, $phi)
* sub cartesian-to-cylindrical($x,$y,$z)
* sub cylindrical-to-cartesian($rho, $theta, $z)
* sub cylindrical-to-spherical($rho, $theta, $phi)

Available with `use Math::Trig :great-circle`;

* sub great-circle-distance($theta0, $phi0, $theta1, $phi1, $rho = 1)
* sub great-circle-direction($theta0, $phi0, $theta1, $phi1)
* sub great-circle-bearing($theta0, $phi0, $theta1, $phi1)
* sub great-circle-waypoint($theta0, $phi0, $theta1, $phi1, $point = 0.5)
* sub great-circle-midpoint($theta0, $phi0, $theta1, $phi1)
* sub great-circle-destination($theta0, $phi0, $dir0, $dst)

# BUGS

* This is a work in progress. Caveat emptor.
* Perhaps rename this module since it's less about trigonometry and more about angular conversions and great circles?

# AUTHOR

Jonathan Scott Duff

Source can be located at: <https://github.com/raku-community-modules/Math-Trig> . Comments and Pull Requests are welcome.

# ACKNOWLEDGEMENTS

This module is shamelessly based on the [Perl module](https://metacpan.org/pod/Math::Trig) of the same name. Without the authors and maintainers of *that* module, this module wouldn't exist in this form.

# COPYRIGHT AND LICENSE

Copyright 2015 - 2017 Jonathan Scott Duff

Copyright 2018 - 2022 Raku Community

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


## dist_zef-antononcube-Proc-ZMQed.md
# Raku Proc::ZMQed

This package, "Proc::ZMQed", provides external evaluators (Julia, Mathematica, Python, R, etc.) via
[ZeroMQ (ZMQ)](https://zeromq.org).

Functionality-wise, a closely related Raku package is
["Text::CodeProcessing"](https://raku.land/zef:antononcube/Text::CodeProcessing),
[AAp1]. For example, Raku can be used in Mathematica sessions (i.e. notebooks) with [AAp1] and [AAp2]; see [AA1] for more details.
With this package, "Proc::ZMQed", we can use Mathematica in Raku sessions.

---

## Installation

From GitHub:

```
zef install https://github.com/antononcube/Raku-Proc-ZMQed.git

```

From [Zef ecosystem](https://raku.land):

```
zef install Proc::ZMQed

```

---

## Usage example: symbolic computation with Mathematica

*Mathematica is also known as Wolfram Language (WL).*

The following example shows:

* Establishing connection to [Wolfram Engine](https://www.wolfram.com/engine/) (which is free for developers.)
* Sending a formula for symbolic algebraic expansion.
* Getting the symbolic result and evaluating it as a Raku expression.

```
use Proc::ZMQed;

# Make object
my Proc::ZMQed::Mathematica $wlProc .= new(url => 'tcp://127.0.0.1', port => '5550');

# Start the process (i.e. Wolfram Engine)
$wlProc.start-proc;

my $cmd = 'Expand[(x+y)^4]';
my $wlRes = $wlProc.evaluate($cmd);
say "Sent : $cmd";
say "Got  :\n $wlRes";

# Send computation to Wolfram Engine
# and get the result in Fortran form.
say '-' x 120;
$cmd = 'FortranForm[Expand[($x+$y)^4]]';
$wlRes = $wlProc.evaluate($cmd);
say "Sent : $cmd";
say "Got  : $wlRes";

# Replace symbolic variables with concrete values
my $x = 5;
my $y = 3;

use MONKEY-SEE-NO-EVAL;
say 'EVAL($wlRes) : ', EVAL($wlRes);

# Terminate process
$wlProc.terminate;

```

```
# Sent : Expand[(x+y)^4]
# Got  :
#   4      3        2  2        3    4
# x  + 4 x  y + 6 x  y  + 4 x y  + y
# ------------------------------------------------------------------------------------------------------------------------
# Sent : FortranForm[Expand[($x+$y)^4]]
# Got  : $x**4 + 4*$x**3*$y + 6*$x**2*$y**2 + 4*$x*$y**3 + $y**4
# EVAL($wlRes) : 4096

```

**Remark:** Mathematica can have variables that start with `$`, which is handy if we want to
treat WE results as Raku expressions.

Here is a corresponding flowchart:

```
graph TD
  WE{{Wolfram Engine}}
  Raku{{Raku}}
  CO["Create connection object<br>(ZMQ sockets)"]
  SC[Send symbolic computation<br>to Wolfram Engine]
  AV[Assign values to symbols]
  ES[Evaluate WE output string]
  CO --> SC --> AV --> ES
  SC -.- Raku
  SC -.-> |ZMQ.send|WE
  WE -.-> |ZMQ.recv|SC
  CO -.- Raku
  AV -.- Raku
  ES -.- |EVAL|Raku

```

---

## Setup

In this section we outline setup for different programming languages as "servers."

Generally, there are two main elements to figure out:

* What is the concrete Command Line Interface (CLI) name to use?

  * And related code option. E.g. `julia -e` or `wolframscript -code`.
* Is ZMQ installed on the server system?

The CLI names can be specified with the option `cli-name`.
The code options can be specified with `code-option`.

### Julia

In order to setup ZMQ computations with Julia start Julia and execute the commands:

```
using Pkg
Pkg.add("ZMQ")
Pkg.add("JSON")

```

(Also, see the instructions at ["Configure Julia for ExternalEvaluate"](https://reference.wolfram.com/language/workflow/ConfigureJuliaForExternalEvaluate.html).)

By default "Proc::ZMQed::Julia" uses the CLI name `julia`. Here is an alternative setup:

```
my Proc::ZMQed::Julia $juliaProc .= new(url => 'tcp://127.0.0.1',
                                        port => '5560',
                                        cli-name => '/Applications/Julia-1.8.app/Contents/Resources/julia/bin/julia');

```

### Mathematica

Install [Wolfram Engine (WE)](https://www.wolfram.com/engine/). (As it was mentioned above, WE is free for developers. WE has ZMQ functionalities "out of the box.")

Make sure `wolframscript` is installed. (This is the CLI name used with "Proc::ZMQed::Mathematica".)

### Python

Install the ZMQ library ["PyZMQ"](https://pypi.org/project/pyzmq/). For example, with:

```
python -m pip install --user pyzmq

```

By default "Proc::ZMQed::Python" uses the CLI name `python`.
Here we connect to a Python virtual environment (made and used with
[miniforge](https://github.com/conda-forge/miniforge)):

```
my Proc::ZMQed::Python $pythonProc .= new(url => 'tcp://127.0.0.1',
                                          port => '5554',
                                          cli-name => $*HOME ~ '/miniforge3/envs/SciPyCentric/bin/python');

```

---

## Implementation details

The package architecture is Object-Oriented Programming (OOP) based and it is a combination of the OOP design patterns
Builder, Template Method, and Strategy.

The package has a general role "Proc::ZMQed::Abstraction" that plays Abstract class in Template method.
The concrete programming language of the classes provide concrete operations for:

* ZMQ-server side code
* Processing of setup code lines

Here is the corresponding UML diagram:

```
use UML::Translators;
to-uml-spec(<Proc::ZMQed::Abstraction Proc::ZMQed::Julia Proc::ZMQed::Mathematica Proc::ZMQed::Python Proc::ZMQed::R Proc::ZMQed::Raku>, format=>'mermaid');

```

```
classDiagram
class Proc_ZMQed_Julia {
  +$!cli-name
  +$!code-option
  +$!context
  +$!port
  +$!proc
  +$!receiver
  +$!url
  +BUILD()
  +BUILDALL()
  +cli-name()
  +code-option()
  +context()
  +evaluate()
  +make-code()
  +port()
  +proc()
  +process-setup-lines()
  +receiver()
  +start-proc()
  +terminate()
  +url()
}
Proc_ZMQed_Julia --|> Proc_ZMQed_Abstraction

class Proc_ZMQed_Mathematica {
  +$!cli-name
  +$!code-option
  +$!context
  +$!port
  +$!proc
  +$!receiver
  +$!url
  +BUILD()
  +BUILDALL()
  +cli-name()
  +code-option()
  +context()
  +evaluate()
  +make-code()
  +port()
  +proc()
  +process-setup-lines()
  +receiver()
  +start-proc()
  +terminate()
  +url()
}
Proc_ZMQed_Mathematica --|> Proc_ZMQed_Abstraction

class Proc_ZMQed_Python {
  +$!cli-name
  +$!code-option
  +$!context
  +$!port
  +$!proc
  +$!receiver
  +$!url
  +BUILD()
  +BUILDALL()
  +cli-name()
  +code-option()
  +context()
  +evaluate()
  +make-code()
  +port()
  +proc()
  +process-setup-lines()
  +receiver()
  +start-proc()
  +terminate()
  +url()
}
Proc_ZMQed_Python --|> Proc_ZMQed_Abstraction

class Proc_ZMQed_R {
  +$!cli-name
  +$!code-option
  +$!context
  +$!port
  +$!proc
  +$!receiver
  +$!url
  +BUILD()
  +BUILDALL()
  +cli-name()
  +code-option()
  +context()
  +evaluate()
  +make-code()
  +port()
  +proc()
  +process-setup-lines()
  +receiver()
  +start-proc()
  +terminate()
  +url()
}
Proc_ZMQed_R --|> Proc_ZMQed_Abstraction

class Proc_ZMQed_Raku {
  +$!cli-name
  +$!code-option
  +$!context
  +$!port
  +$!proc
  +$!receiver
  +$!url
  +BUILD()
  +BUILDALL()
  +cli-name()
  +code-option()
  +context()
  +evaluate()
  +make-code()
  +port()
  +proc()
  +process-setup-lines()
  +receiver()
  +start-proc()
  +terminate()
  +url()
}
Proc_ZMQed_Raku --|> Proc_ZMQed_Abstraction

```

(Originally, "Proc::ZMQed::Abstraction" was named "Proc::ZMQish", but the former seems a better fit for the role.)

The ZMQ connections are simple REP/REQ. It is envisioned that more complicated ZMQ patterns can be implemented in
subclasses. I have to say though, that my attempts to implement
["Lazy Pirate"](https://zguide.zeromq.org/docs/chapter4/)
were very unsuccessful because of the half-implemented (or missing) polling functionalities in [ASp1].
(See the comments [here](https://github.com/arnsholt/Net-ZMQ/blob/master/lib/Net/ZMQ4/Poll.pm6).)

---

## TODO

1. TODO Robust, comprehensive ZMQ-related failures handling.
2. TODO More robust ZMQ patterns.

   * Like the "Lazy Pirate" mentioned above.
3. TODO Implement "Proc::ZMQed::Java".
4. TODO Better message processing in "Proc::ZMQed::R".
5. TODO Verify that "Proc::ZMQed::JavaScript" is working.

   * Currently, I have problems install ZMQ in JavaScript.

---

## References

### Articles

[AA1] Anton Antonov,
["Connecting Mathematica and Raku"](https://rakuforprediction.wordpress.com/2021/12/30/connecting-mathematica-and-raku/),
(2021),
RakuForPrediction at WordPress.

### Packages

[AAp1] Anton Antonov
[Text::CodeProcessing Raku package](https://github.com/antononcube/Raku-Text-CodeProcessing),
(2021-2022),
[GitHub/antononcube](https://github.com/antononcube).

[AAp2] Anton Antonov,
[RakuMode Mathematica package](https://github.com/antononcube/ConversationalAgents/blob/master/Packages/WL/RakuMode.m),
(2020-2021),
[ConversationalAgents at GitHub/antononcube](https://github.com/antononcube/ConversationalAgents).

[ASp1] Arne Skjærholt,
[Net::ZMQ](https://github.com/arnsholt/Net-ZMQ),
(2017),
[GitHub/arnsholt](https://github.com/arnsholt).


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

# NAME

Raku port of Perl's shift() / unshift() built-ins

# SYNOPSIS

```
use P5shift;

say shift;  # shift from @*ARGS, if any

sub a { dd @_; dd shift; dd @_ }; a 1,2,3;
[1, 2, 3]
1
[2, 3]

my @a = 1,2,3;
say unshift @a, 42;  # 4

```

# DESCRIPTION

This module tries to mimic the behaviour of Perl's `shift` and `unshift` built-ins as closely as possible in the Raku Programming Language.

# ORIGINAL PERL DOCUMENTATION

```
shift ARRAY
shift EXPR
shift   Shifts the first value of the array off and returns it, shortening
        the array by 1 and moving everything down. If there are no
        elements in the array, returns the undefined value. If ARRAY is
        omitted, shifts the @_ array within the lexical scope of
        subroutines and formats, and the @ARGV array outside a subroutine
        and also within the lexical scopes established by the "eval
        STRING", "BEGIN {}", "INIT {}", "CHECK {}", "UNITCHECK {}", and
        "END {}" constructs.

        Starting with Perl 5.14, "shift" can take a scalar EXPR, which
        must hold a reference to an unblessed array. The argument will be
        dereferenced automatically. This aspect of "shift" is considered
        highly experimental. The exact behaviour may change in a future
        version of Perl.

        To avoid confusing would-be users of your code who are running
        earlier versions of Perl with mysterious syntax errors, put this
        sort of thing at the top of your file to signal that your code
        will work [4monly[m on Perls of a recent vintage:

            use 5.014;  # so push/pop/etc work on scalars (experimental)

        See also "unshift", "push", and "pop". "shift" and "unshift" do
        the same thing to the left end of an array that "pop" and "push"
        do to the right end.

unshift ARRAY,LIST
unshift EXPR,LIST
        Does the opposite of a "shift". Or the opposite of a "push",
        depending on how you look at it. Prepends list to the front of the
        array and returns the new number of elements in the array.

            unshift(@ARGV, '-e') unless $ARGV[0] =~ /^-/;

        Note the LIST is prepended whole, not one element at a time, so
        the prepended elements stay in the same order. Use "reverse" to do
        the reverse.

        Starting with Perl 5.14, "unshift" can take a scalar EXPR, which
        must hold a reference to an unblessed array. The argument will be
        dereferenced automatically. This aspect of "unshift" is considered
        highly experimental. The exact behaviour may change in a future
        version of Perl.

        To avoid confusing would-be users of your code who are running
        earlier versions of Perl with mysterious syntax errors, put this
        sort of thing at the top of your file to signal that your code
        will work only on Perls of a recent vintage:

            use 5.014;  # so push/pop/etc work on scalars (experimental)

```

# PORTING CAVEATS

In future language versions of Raku, it will become impossible to access the `@_` variable of the caller's scope, because it will not have been marked as a dynamic variable. So please consider changing:

```
shift;

```

to:

```
shift(@_);

```

or, using the subroutine as a method syntax:

```
@_.&shift;

```

# AUTHOR

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

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!

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

# COPYRIGHT AND LICENSE

Copyright 2018, 2019, 2020, 2021, 2023 Elizabeth Mattijsen

Re-imagined from Perl as part of the CPAN Butterfly Plan.

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


## nfkd.md
class NFKD

Codepoint string in Normal Form KD (compatibility decomposed)

```raku
class NFKD is Uni {}
```

A Codepoint string in Unicode Normalization Form KD. It is created by Compatibility Decomposition. For more information on what this means, see [Unicode TR15](https://www.unicode.org/reports/tr15/).

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

Type relations for `NFKD`

raku-type-graph

NFKD
NFKD

Uni
Uni

NFKD->Uni

Mu
Mu

Any
Any

Any->Mu

Positional
Positional

Stringy
Stringy

Uni->Any

Uni->Positional

Uni->Stringy

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


## dist_zef-hythm-Retry.md
# Name

Retry - Retry action

# Synopsis

```
use Retry;

retry { action }, :4max, :2delay;

retry { say 'trying!'; die }, :max(-1), :delay({ constant @fib = 0, 1, *+* ... *; @fib[$++] });

```

# Description

Retry is a module that exports `retry` sub which takes a `Block` to retry execute until success and return the result. or in case of `Exception`, rethrow after `max` retries.

`max` defaults to `4`. sets the max number of retries. Use `Inf`, `*` or integer smaller 0 to retry forever.

`delay` defaults to `0.2`. sets the delay between retries. The delay doubles with every retry. Use a `Code` object to provide your own stepping. Each call must return a `Real`.

# Acknowledgements

Thanks to gfldex for improving the module by allowing passing `Callable` to `delay`, also allow using `Inf` and `Whatever`. and improving tests as well.

# Author

Haytham Elganiny [elganiny.haytham@gmail.com](mailto:elganiny.haytham@gmail.com)

# Copyright and License

Copyright 2020 Haytham Elganiny

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


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

# NAME

Config::INI - parse standard configuration files (.ini files)

# SYNOPSIS

```
use Config::INI;
my %hash = Config::INI::parse_file('config.ini');
#or
%hash = Config::INI::parse($file_contents);
say %hash<_><root_property_key>;
say %hash<section><in_section_key>;

```

# DESCRIPTION

This module provides 2 functions: parse() and parse\_file(), both taking one `Str` argument, where parse\_file is just parse(slurp $file). Both return a hash which keys are either toplevel keys or a section names. For example, the following config file:

```
foo=bar
[section]
another=thing

```

would result in the following hash:

```
{ '_' => { foo => "bar" }, section => { another => "thing" } }

```

# AUTHORS

Tadeusz Sośnierz

Nobuo Danjou

# COPYRIGHT AND LICENSE

Copyright 2010 - 2017 Tadeusz Sośnierz

Copyright 2024 Raku Community

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