## dist_zef-librasteve-Air.md
[![](https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg)](https://opensource.org/licenses/Artistic-2.0)
[![Actions Status](https://github.com/librasteve/Air/actions/workflows/test.yml/badge.svg)](https://github.com/librasteve/Air/actions)

Please raise an Issue if you would like to feedback or contribute.

Air docs are at <https://librasteve.github.io/Air/>

# Air

Breathing life into the raku **hArc stack** (HTMX, Air, Red, Cro).

**Air** aims to be the purest possible expression of [HTMX](https://htmx.org).

**hArc** websites are written in functional code. This puts the emphasis firmly onto the content and layout of the site, rather than boilerplate markup that can often obscure the intention.

**Air** is basically a set of libraries that produce HTML code and serve it with Cro.

The result is a concise, legible and easy-to-maintain website codebase.

# GETTING STARTED

***IMPORTANT - GET BEST RESULTS BY FOLLOWING THIS 3 STEP PROCESS***

Install raku - eg. from [rakubrew](https://rakubrew.org), then:

```
Install Air, Cro & Red
- zef install --/test cro [117 sec]
- zef install Red --exclude="pq:ver<5>" --/test [98 sec]
- zef install Air [15 sec]

Run and view some examples
- git clone https://github.com/librasteve/Air-Play.git && cd Air-Play
- export WEBSITE_HOST="0.0.0.0" && export WEBSITE_PORT="3000"
- raku -Ilib service.raku
- browse to http://localhost:3000

```

Cro has many other options as documented at [Cro](https://cro.raku.org) for deployment to a production server.
Install times are from an M1 macOS, ymmv.

# SYNOPSIS

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

use Air::Functional :BASE;
use Air::Base;

my &index = &page.assuming( #:REFRESH(1),
    title       => 'hÅrc',
    description => 'HTMX, Air, Red, Cro',
    footer      => footer p ['Aloft on ', b safe 'Åir'],
);

my &planets = &table.assuming(
    :thead[["Planet", "Diameter (km)",
            "Distance to Sun (AU)", "Orbit (days)"],],
    :tbody[["Mercury",  "4,880", "0.39",  "88"],
           ["Venus"  , "12,104", "0.72", "225"],
           ["Earth"  , "12,742", "1.00", "365"],
           ["Mars"   ,  "6,779", "1.52", "687"],],
    :tfoot[["Average",  "9,126", "0.91", "341"],],
);

sub SITE is export {
    site #:bold-color<blue>,
        index
            main
                div [
                    h3 'Planetary Table';
                    planets;
                ]
}

```

# DESCRIPTION

Air is not a framework, but a set of libraries. Full control over the application loop is retained by the coder.

Air does not provide an HTML templating language, instead each HTML tag is written as a subroutine call where the argument is a list of `@inners` and attributes are passed via the raku Pair syntax `:name<value>`. [Cro templates](https://cro.raku.org/docs/reference/cro-webapp-template-syntax) are great if you would rather take the template approach.

Reusability is promoted by the structure of the libraries - individuals and teams can create and install your own libraries to encapsulate design themes, re-usable web components and best practice.

Air is comprised of three core libraries:

* Air::Functional - wraps HTML tags as functions
* Air::Base - a set of handy prebuilt components
* Air::Component - make your own components
* Air::Form - declarative forms

**[Air::Play](https://raku.land/zef:librasteve/Air::Play)** is a companion raku module with various **Air** website examples.

The Air documentation is at <https://librasteve.github.io/Air>

# TIPS & TRICKS

* When debugging, use the raku `note` sub to out put debugging info to stderr (ie in the Cro Log stream), `note $thing.raku` instead of `dd` (`dd` is an HTML datalist description tag function)
* When passing a 2D Array to a tag function, make sure that there is a trailing comma `:tbody[["Mercury", "4,880", "0.39", "88"],]`
* An error message like *insufficient arguments* is often caused by separating two tag functions with a comma `,` instead of a semicolon `;`
* In development set CRO\_DEV=1 in the [environment](https://cro.services/docs/reference/cro-webapp-template#Template_auto-reload)

# AUTHOR

Steve Roe [librasteve@furnival.net](mailto:librasteve@furnival.net)

The `Air::Component` module provided is based on an early version of the raku `Cromponent` module, author Fernando Corrêa de Oliveira [fco@cpan.com](mailto:fco@cpan.com), however unlike Cromponent this module does not use Cro Templates.

# COPYRIGHT AND LICENSE

Copyright(c) 2025 Henley Cloud Consulting Ltd.

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


## dist_github-zengargoyle-Search-Dict.md
[![Build Status](https://travis-ci.org/zengargoyle/p6-Search-Dict.svg?branch=master)](https://travis-ci.org/zengargoyle/p6-Search-Dict)

# NAME

Search::Dict - a fast binary search of dictionary like files

# SYNOPSIS

```
use Search::Dict;

my &lookup = search-dict('/usr/share/dict/words');

given lookup('existing-word') -> $w {
  +$w;  # seek offset in dict
  ?$w;  # True
  ~$w;  # 'existing-word'
}
given lookup('non-existing-word') -> $w {
  +$w;  # seek offset after where non-existing-word would be
  ?$w;  # False
  ~$w;  # word after where non-existing-word would be
  # or
  $w.match.defined # False  - after last word in dict
}

```

# DESCRIPTION

Search::Dict is a fast binary search of dictionary like files (e.g. /usr/share/dict/words). A dictionary file is one where:

one entry per line

lines are sorted

# AUTHOR

zengargoyle [zengargoyle@gmail.com](mailto:zengargoyle@gmail.com)

# COPYRIGHT AND LICENSE

Copyright 2015 zengargoyle

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


## dist_cpan-KAIEPI-Kind-Subset-Parametric.md
[![Build Status](https://github.com/Kaiepi/ra-Kind-Subset-Parametric/actions/workflows/test.yml/badge.svg)](https://github.com/Kaiepi/ra-Kind-Subset-Parametric/actions/workflows/test.yml)

# NAME

Kind::Subset::Parametric - Support for generic subsets

# SYNOPSIS

```
use Kind::Subset::Parametric;

# Arrays don't type their elements by default:
my @untyped = 1, 2, 3;
say @untyped.^name; # OUTPUT: Array

# You can make it so they do by parameterizing Array:
my Int:D @typed = 1, 2, 3;
say @typed.^name; # OUTPUT: Array[Int:D]

# But you can't typecheck untyped arrays using these parameterizations:
say @typed   ~~ Array[Int:D]; # OUTPUT: True
say @untyped ~~ Array[Int:D]; # OUTPUT: False

# So let's make our own array type that handles this using a parametric subset:
subset TypedArray of Array will parameterize -> Mu ::T { Array:_ \array {
    array ~~ Array[T] || (array ~~ Array:D && so array.all ~~ T)
} } where { ... };

# Now they can both be typechecked:
given TypedArray[Int:D] -> \IntArray {
    say @typed        ~~ IntArray; # OUTPUT: True
    say @untyped      ~~ IntArray; # OUTPUT: True
    say <foo bar baz> ~~ IntArray; # OUTPUT: False
}

```

# DESCRIPTION

Kind::Subset::Parametric is a library that enhances subsets with support for parameterization. This allows you to easily implement your own generic subsets.

Note: while you can make generic subsets using this library, subsets cannot be parameterized with generics yet. Parameterizations using type captures, such as this, may not work as expected:

```
subset TypeIdentity will parameterize -> Mu ::T { T };

proto sub is-type-id(Mu --> Bool:D)                           {*}
multi sub is-type-id(Mu ::T $ where TypeIdentity[T] --> True) { }
multi sub is-type-id(Mu --> False)                            { }

```

Kind::Subset::Parametric is documented. You can refer to the documentation for its trait and `MetamodelX::ParametricSubset` at any time using `WHY`.

# TRAITS

## will parameterize

```
multi sub trait_mod:<will>(Mu \T where Subset, &body_block, :$parameterize!)

```

This trait mixes the `MetamodelX::ParametricSubset` metarole into the metaobject of the type this trait is used with (which may only be a subset of some sort) after parameterizing it with `&body_block`. This makes it possible to use the subset as a parametric type.

The main metamethod of interest this metarole provides is `parameterize`, which handles creating a new subset type upon parameterization given an arbitrary list of parameters. This is created using a name (generated similarly to how the name of a parametric role is generated), the refinee of the parametric subset, and the return value of the body block when invoked with the list of parameters as its refinement.

`MetamodelX::ParametricSubset` also provides a `body_block` metamethod, which returns the body block it was parameterized with given a subset type.

What all this means that the `TypedArray[Int:D]` parameterization from the synopsis generates a subset functionally equivalent to the one this type declaration creates:

```
subset :: of Array where {
    $_ ~~ Array[Int:D] || ($_ ~~ Array:D && so $_.all ~~ Int:D)
};

```

Parametric subsets can still be given a refinement (the value given to `where` in a subset declaration) when this trait is used. This gets used to handle typechecking against the subset when it has not been parameterized. If it's not desirable for a parametric subset to be possible to use without being parameterized, one way you can prevent this from happening is to give it a stubbed refinement:

```
subset Identity will parameterize -> Mu \T {
    T
} where { ... };

```

Refer to `t/02-will.t` for more examples of how to use this trait.

# AUTHOR

Ben Davies (Kaiepi)

# COPYRIGHT AND LICENSE

Copyright 2019 Ben Davies

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


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

# NAME

Lingua::Conjunction - Convert lists into linguistic conjunctions and fill them into a template

# SYNOPSIS

```
use Lingua::Conjunction;

say conjunction <chair>; # chair
say conjunction <chair spoon>; # chair and spoon
say conjunction <chair spoon window>; # chair, spoon, and window

# "Tom, a man; Tiffany, a woman; and GumbyBRAIN, a bot"
say conjunction 'Tom, a man', 'Tiffany, a woman', 'GumbyBRAIN, a bot';

# These are reports for May, June, and August
say conjunction <May June August>, :str('These [is|are] report[|s] for |list|');

# "Jacques, un garcon; Jeanne, une fille et Spot, un chien"
say conjunction 'Jacques, un garcon', 'Jeanne, une fille', 'Spot, un chien',
    :lang<fr>;

```

# DESCRIPTION

Provides a way to make it easy to prepare a string containing a list of items, where that string is meant to be read by a human.

# EXPORTED SUBROUTINES

## conjunction

```
say conjunction <chair spoon>;
say conjunction <May June August>, :str('Report[|s] for |list|'),
    :lang<fr>, :!last, :sep<·>, :alt<°>, :con<aaand>, :dis<ooor>, :type<or>;

```

Returns a string with the given list of items joined based on the configuration specified by the named arguments, which are as follows:

### alt

Specifies an alternative separator to use when at least one of the items contains `sep` separator. **Defaults to** `;` (a semicolon).

head3 con

Short for **con**junction. The term to use when joining the last item to the previous one, when `type` argument is set to value `and`. **By default** is set based on value of `lang` argument.

### dis

Short for **dis**junction. The term to use when joining the last item to the previous one, when `type` argument is set to value `or`. **By default** is set based on value of `lang` argument.

### lang

Takes a string representing the code of the language to use. This will pre-set `con`, `dis`, and `last` arguments. **Defaults to** `en`. Currently supported languages and the defaults they pre-set are as follows (language is the first two-letter key on the left; that's what you'd specify as `lang` argument):

| lang | last | con | dis |  |
| --- | --- | --- | --- | --- |
| af | True | en | of |  |
| da | True | og | eller |  |
| de | True | und | oder |  |
| en | True | and | or |  |
| es | True | y | o |  |
| fi | True | ja | tai |  |
| fr | False | et | ou |  |
| it | True | e | o |  |
| la | True | et | vel |  |
| nl | True | en | of |  |
| no | False | og | eller |  |
| pt | True | e | ou |  |
| sw | True | na | au |  |

### last

Specifies whether to use `sep` when joining the penultimate and last elements of the list, when the number of elements is more than 2. In English, this is what's known as [Oxford Comma](https://en.wikipedia.org/wiki/Serial_comma). **By default** is set based on value of `lang` argument.

### sep

The primary item separator to use. **Defaults to** `,` (a comma).

### str

```
say conjunction <May June August>, :str('Report[|s] for |list|');
say conjunction <Squishy Slushi Sushi>,
    :str('Octop[us|i] [is|are] named |list|');

```

Specifies a template to use when generating the string. You can use special sequence `[|]` (e.g. `octop[us|i]`) where string to the left of the `|` will be used when the list contains just one item and the string to the right will be used otherwise. The other special sequence is `|list|` that will be replaced with the "conjuncted" items of the list. **Defaults to** `|list|`.

### type

Takes either value `and` or value `or`. Specifies whether words specified by `con` or by `dis` arguments should be used when joining the last two elements of the list.

# AUTHOR

This module was inspired by Perl's [Lingua::Conjunction](https://metacpan.org/pod/Lingua::Conjunction) and and [List::ToHumanString](https://metacpan.org/pod/List::ToHumanString). Some of the internal data was shamelessly ~~stolen~~ borrowed from [Lingua::Conjunction](https://metacpan.org/pod/Lingua::Conjunction)'s guts.

The rest is by Zoffix Znet (<http://zoffix.com/>)

# COPYRIGHT AND LICENSE

Copyright 2015 - 2017 Zoffix Znet

Copyright 2020 - 2024 Raku Community

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


## dist_zef-vrurg-LibXML-Class.md
# NAME

`LibXML::Class` – general purpose XML de-/serialization for Raku

# SYNOPSIS

## Simple Case

```
use LibXML::Class;

class Record1 is xml-element {
    has Int:D $.id is required;
    has Str $.description;
    has %.meta;
}

my $rec = Record1.new(:id(1000), :description("test me"), :meta{ key1 => π, key2 => "some info" });

say $rec.to-xml.Str(:format);

```

This would result in:

```
<?xml version="1.0" encoding="UTF-8"?>
<Record1 id="1000" description="test me">
  <meta>
    <key1>3.141592653589793e+00</key1>
    <key2>some info</key2>
  </meta>
</Record1>

```

## More Complex Case

```
use LibXML::Class;
use Test::Async;

class Record2 is xml-element( :ns<http://my.namespace> ) {
    has Int:D $.id is required is xml-attribute;
    has Str:D $.description is required is xml-attribute;
    has Str $.comment is xml-element(:value-attr<text>, :ns( :extra ) );
    has Real:D $.amount is required is xml-element;
    has DateTime $.when; # Not part of XML
}

class METAEntry is xml-element {
    has Str:D $.key is required;
    has Str:D $.value is required;
}

role META is xml-element {
    has METAEntry @.meta-entry is xml-element('entry', :container<meta>);
}

class Registry is xml-element('registry', :ns( :extra<http://additional.namespace> )) does META {
    has Record2 @.record is xml-element;
}

my $root = Registry.new;
$root.record.append:
    Record2.new( :id(1001),
                 :description("item1"),
                 :comment("here comes a comment"),
                 :amount(42.12) ),
    Record2.new( :id(1002),
                 :description("item2"),
                 :amount(0) );

$root.meta-entry.append:
    METAEntry.new(:key<version>, :value<1.1a>),
    METAEntry.new(:key<encoding>, :value<utf-8>);

my $xml = $root.to-xml;

diag $xml.Str(:format);

my $root-copy = Registry.from-xml: $xml.Str;

cmp-deeply $root-copy, $root, "both are the same";

```

The output of this would be like:

```
# <?xml version="1.0" encoding="UTF-8"?>
# <registry xmlns:extra="http://additional.namespace">
#   <record xmlns="http://my.namespace" id="1001" description="item1">
#     <extra:comment text="here comes a comment"/>
#     <amount>42.12</amount>
#   </record>
#   <record xmlns="http://my.namespace" id="1002" description="item2">
#     <amount>0</amount>
#   </record>
#   <meta>
#     <entry key="version" value="1.1a"/>
#     <entry key="encoding" value="utf-8"/>
#   </meta>
# </registry>
#
ok 1 - both are the same
1..1

```

# DESCRIPTION

`LibXML::Class` implements serialization and deserialization of Raku object into/from XML and, as the name suggests, is based upon fast `LibXML` framework. The module tries to be as simple in use as possible and, yet, provide wide range of features to cover as many use cases as possible. The notable features are:

* Namespaces support
* Out of the box hashes and arrays support
* Implicit or explicit declarations
* Support for roles and inheritance
* Lazy deserialization
* User provided de-/serialization
* Search for deserialization of a paricular XML node, including XML attributes and `#text` nodes
* Sequential XML elements (like arrays but lazily deserialized and allowing for different item types)
* Variative attribute types
* Preservation of unused XML nodes upon deserialization in order to save the original XML as much as possible

Some of the features were inspired by `XML::Class` module, but they were heavily reconsidered. Others are totally unique to `LibXML::Class`. Of these special attention is to be paid to the search feature. Let's take the [SYNOPSIS](#SYNOPSIS) complex example and add a few more lines right after the '`my $root-copy = Registry.from-xml: $xml.Str;`' line:

```
my $root-doc = $root-copy.xml-document;
my $xml-root = $root-doc.libxml-document.documentElement;
my $amount-elem = $xml-root[0][1]; # Pick the <amount>42.12</amount> element
is $root-doc.find-deserializations($amount-elem), (42.12,), "first <amount> element value is 42.12";
cmp-ok $root-doc.find-deserializations($xml-root[1]).head, '===', $root-copy.record[1],
       "second <record> element deserialization found";

```

These would add two more test outcomes indicating that the first call to `find-deserializations` finds the value stored in `$.amount` attribute of the first item in `@.record` on the `Registry` class. And the second `find-deserializations` call produces the second record on the array.

# DISCLAIMER

[`LibXML::Class`](docs/md/LibXML/Class.md) is not capable of handling all possible variations of XML files. Despite all the efforts taken to cover as many possible cases as possible, mapping of Raku objects into XML is and likely will remain its primary purpose.

# SEE ALSO

* To get better accustomed with the kind of lazines used by `LibXML::Class` it is recommended to refer to [`AttrX::Mooish`](https://modules.raku.org/dist/AttrX::Mooish) modules since it is used to back lazy deserialization of attributes.
* More detailed code from synopsis can be found in *./examples/synopsis.raku* of this distribution.
* [The Manual](docs/md/LibXML/Class/Manual.md)
* [`LibXML::Class`](docs/md/LibXML/Class.md)

# AUTHOR

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

# LICENSE

Artistic License 2.0

See the LICENSE file in this distribution.


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

# NAME

App::AizuOnlineJudge - A Raku implementation of the unofficial code submitter for Aizu Online Judge( <http://judge.u-aizu.ac.jp/onlinejudge/index.jsp> ).

# SYNOPSIS

```
$ aoj --code=../AOJ/ITP1/ITP1_1_A.scala --problem-number=A --lesson-id=ITP1_1 --user=perl6isfun --language=Scala submit
$ aoj --code=../AOJ/Volume_00/0000_QQ.cpp --problem-number=0000 --user=perl6isfun --language=C++ submit

```

# DESCRIPTION

App::AizuOnlineJudge is a Raku implementation of the unofficial code submitter for Aizu Online Judge( <http://judge.u-aizu.ac.jp/onlinejudge/index.jsp> ).

# AUTHOR

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

# COPYRIGHT AND LICENSE

Copyright 2016 titsuki

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


## sink.md
sink

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/List#method_sink)
for **method sink**.

```raku
method sink(--> Nil) { }
```

It does nothing, and returns [`Nil`](/type/Nil), as the definition clearly shows.

```raku
sink [1,2,Failure.new("boo!"),"still here"]; # OUTPUT: «»
```

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

See primary documentation
[in context](/type/Proc#method_sink)
for **method sink**.

```raku
method sink(--> Nil)
```

When sunk, the `Proc` object will throw [`X::Proc::Unsuccessful`](/type/X/Proc/Unsuccessful) if the process it ran exited unsuccessfully.

```raku
shell 'ls /qqq';
# OUTPUT:
# (exit code 1) ls: cannot access '/qqq': No such file or directory
# The spawned command 'ls /qqq' exited unsuccessfully (exit code: 2)
#   in block <unit> at /tmp/3169qXElwq line 1
#

```

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

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

```raku
method sink(--> Nil)
```

Calls [`sink-all`](/routine/sink-all) if it is an [`Iterator`](/type/Iterator), `sink` if the Sequence is a list.

```raku
say (1 ... 1000).sink; # OUTPUT: «Nil␤»
```

This is something you might want to do for the side effects of producing those values.

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

See primary documentation
[in context](/type/HyperSeq#method_sink)
for **method sink**.

```raku
method sink(--> Nil)
```

Sinks the underlying data structure, producing any side effects.

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

See primary documentation
[in context](/type/RaceSeq#method_sink)
for **method sink**.

```raku
method sink(--> Nil)
```

Sinks the underlying data structure, producing any side effects.


## dist_zef-kjkuan-Shell-DSL.md
# NAME

`Shell::DSL` - Run and pipe commands from one to another like you would in Bash.

# DESCRIPTION

`Shell::DSL` is a module that provides a shell-like experience for running
external commands (without shell's interpretation) and redirecting their I/O's.
A command's standard output can be captured, and commands can be connected to
form a pipeline easily.

**NOTE:** This module is not thread-safe.

**Caveat:** I've only tested it on Ubuntu, but it should work on any Unix-like
system with the right native library dependencies. Moreover, although an
implementation detail, this module currently depends on Bash to connect the
pipes and to set up user specified I/O redirections for sub processes.

# SYNOPSIS

```
use Shell::DSL;
my @words;
shell :!pipefail, {
    .curl<-fsSL https://en.wikipedia.org/wiki/Special:Random>
      |> .xmllint(«--html --xpath '//*[name()!="script"]/text()' -», (:w2</dev/null>))
      |> .tr<-cs A-Za-z  \n>
      |> .tr<A-Z a-z>
      |> .sort
      |> .uniq<-c>
      |> .sort<-rn>
      |> .head<-30>
      |> pb({
          for .lines {
              my $match = $_ ~~ /\s* \d+ ' ' (\w+)$/;
              next if !$match;
              @words.push: $match[0];
              .put;
          }
      })
      |> .nl;
}
put();
my $i = (^@words).pick;
say "The word, '@words[$i]', is No. {$i+1} in the list.";

```

See [examples/](https://github.com/kjkuan/Shell-DSL/tree/master/examples/) for more usage examples.


## dist_zef-stuart-little-Data-Tree.md
# Data::Tree

A **Raku** (rooted) tree data structure modelled on **Haskell**'s [Data.Tree](https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Tree.html).

## class Tree::RTree

RTree: rooted tree containing data and children (other rooted trees)

## class Tree::Forest

Forest: container class for an array of trees

## Installation

Using [zef](https://github.com/ugexe/zef): clone this repo and

* run `zef install <path-to-repo>`;
* or `cd` into it and run `zef install .`.

## Usage

The examples below are run in a `Raku` REPL with access to this module. So assume you've run `use Data::Tree` successfully in your REPL session.

Construct a tree from a nested list structure (list-of-lists, or lol) and then draw it:

```
> [1,[2,4,[5,6,7,8]],3].&lol2tree.&drawTree
1
|
+-2
| |
| +-4
| |
| `-5
|   |
|   +-6
|   |
|   +-7
|   |
|   `-8
|
`-3

```

"Unfold" a tree using a function `&f` that produces leaves from a seed, and then draw it:

```
> sub f($x) {
* 2*$x+1 > 7 && return ($x, []);
* return ($x, [2*$x, 2*$x+1]);
* }
&f

> unfoldTree(&f,1).&drawTree
1
|
+-2
| |
| +-4
| |
| `-5
|
`-3
  |
  +-6
  |
  `-7

```

Show the levels of that same last tree, as a list of lists:

```
> unfoldTree(&f,1).&levels
[[1] [2 3] [4 5 6 7]]

```

Or flatten it into a pre-order-traversal list:

```
> unfoldTree(&f,1).&flatten
[1 2 4 5 3 6 7]

```

Or compute the sum of its vertex values, by folding it with a summation "folder" function:

```
> sub folder($head, @rest) { $head + @rest.sum }
&folder

> foldTree(&folder, unfoldTree(&f,1))
28

```

(sanity check: yes, 1+2+3+4+5+6+7 equals 7 \* 8 / 2 = 28).

There's also a `map` method that both the classes overload, which does what (I think) you think it should. Using that same `&f` I have been in this running example:

```
> unfoldTree(&f,1).map(* ** 2).&drawTree
1
|
+-4
| |
| +-16
| |
| `-25
|
`-9
  |
  +-36
  |
  `-49

```

Ditto for `grep`:

```
> unfoldTree(&f,1).grep({ $_.data != 2|3 }).&drawForest
1
|
+-4
|
+-5
|
+-6
|
`-7

```

`grep` always returns a `Forest`, hence the need to call `&drawForest` on the result.

What happened there is that

* The predicate I passed identified via a [junction](https://docs.raku.org/type/Junction) which nodes have their `data` attrebute equal to either 2 or 3;
* Those nodes were eliminated;
* The remaining nodes got stitched together into a forest (consisting of a single tree in this case) via the closest-ancestor relationship.

Whether this is what `grep` *should* be doing to a tree is debatable: it could, for instance, simply throw out the relevant nodes and leave it at that, without re-attaching (hence producing a bunch of isolated nodes in this case).

In any case, this is the built-in behavior at present.

Finally, here is a list of exported (or exportable) functions, with links to their cousins' documentation from **Haskell** or **Perl**.

## Creation

### sub lol2tree

```
sub lol2tree(
    @a
) returns Tree::RTree

```

lol2tree

[original inspiration](https://metacpan.org/pod/Tree::DAG_Node#lol_to_tree($lol))

### sub unfoldTree

```
sub unfoldTree(
    &unFolder,
    $root
) returns Tree::RTree

```

unfoldTree

[original inspiration](https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Tree.html#v:unfoldTree)

### sub unfoldForest

```
sub unfoldForest(
    &unFolder,
    @roots
) returns Tree::Forest

```

unfoldForest

[original inspiration](https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Tree.html#v:unfoldForest)

## Reduction

### sub foldTree

```
sub foldTree(
    &folder,
    Tree::RTree $t
) returns Mu

```

foldTree

[original inspiration](https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Tree.html#v:foldTree)

### sub flatten

```
sub flatten(
    Tree::RTree $t
) returns Array

```

flatten

[original inspiration](https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Tree.html#v:flatten)

### sub levels

```
sub levels(
    Tree::RTree $t
) returns Array

```

levels

[original inspiration](https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Tree.html#v:levels)

## Display

### sub drawTree

```
sub drawTree(
    Tree::RTree $t
) returns Str

```

drawTree

[original inspiration](https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Tree.html#v:drawTree)

### sub drawTreeLines

```
sub drawTreeLines(
    Tree::RTree $t
) returns Array

```

drawTreeLines

[original inspiration](https://hackage.haskell.org/package/containers-0.6.4.1/docs/src/Data.Tree.html#draw)

### multi sub drawSubTrees

```
multi sub drawSubTrees(
    @ ()
) returns Mu

```

drawSubTrees

[original inspiration](https://hackage.haskell.org/package/containers-0.6.4.1/docs/src/Data.Tree.html#local-6989586621679098624)

### sub drawForest

```
sub drawForest(
    Tree::Forest $f
) returns Str

```

drawForest

[original inspiration](https://hackage.haskell.org/package/containers-0.6.4.1/docs/Data-Tree.html#v:drawForest)


## defn.md
class Pod::Defn

Pod definition list

```raku
class Pod::Defn is Pod::Block { }
```

Class for definition lists in a Pod document.

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

## [method term](#class_Pod::Defn "go to top of document")[§](#method_term "direct link")

```raku
method term(--> Mu)
```


## dist_cpan-JFORGET-Date-Calendar-Strftime.md
# NAME

Date::Calendar::Strftime - formatting any Date object or any Date::Calendar::whatever object with 'strftime'

# SYNOPSIS

Using the core class Date:

```
use Date::Calendar::Strftime;
my Date $last-day .= new(2019, 12, 31);
$last-day does Date::Calendar::Strftime;
say $last-day.strftime("%Y-%m-%d ('ISO' date %G-W%V-%u)");
# --> 2019-12-31 ('ISO' date 2020-W01-2)

```

Using a Date::Calendar::xxx class (here, the French Revolutionary one):

```
use Date::Calendar::FrenchRevolutionary;
my Date::Calendar::FrenchRevolutionary $Bonaparte's-coup-fr;
$Bonaparte's-coup-fr .= new(year => 8, month => 2, day => 18);

say $Bonaparte's-coup-fr.strftime("%Y-%m-%d");
# ---> "0008-02-18" for 18 Brumaire VIII

say $Bonaparte's-coup-fr.strftime("%A %e %B %EY");
# ---> "octidi 18 Brumaire VIII"

```

# INSTALLATION

```
zef install Date::Calendar::Strftime

```

or

```
git clone https://github.com/jforget/raku-Date-Calendar-Strftime.git
cd raku-Date-Calendar-Strftime
zef install .

```

# DESCRIPTION

Date::Calendar::Strftime is a role providing a strftime method to
format a string representing the date. This method is similar to the
strftime function in C.

The synopsis above shows examples with the standard class Date and
with the class Date::Calendar::FrenchRevolutionary, but
Date::Calendar::Strftime can be used with any Date::Calendar::xxxx
class which implements the attributes "year", "month" and "day". It
can be used with a little more effort with more esoteric
Date::Calendar::xxxx classes.

# AUTHOR

Jean Forget [JFORGET@cpan.org](mailto:JFORGET@cpan.org)

# COPYRIGHT AND LICENSE

Copyright © 2019, 2020 Jean Forget, all rights reserved

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


## permission.md
class X::Method::Private::Permission

Compilation error due to calling a private method without permission

```raku
class X::Method::Private::Permission does X::Comp { }
```

Compile time error thrown when the code contains a call to a private method that isn't defined in the current class, and when no appropriate trusts relation is defined that permits the private method call.

For example

```raku
1!Int::foo

```

dies with

｢text｣ without highlighting

```

```

===SORRY!===
Cannot call private method 'foo' on package Int because it does not trust GLOBAL

```

```

# [Methods](#class_X::Method::Private::Permission "go to top of document")[§](#Methods "direct link")

## [method method](#class_X::Method::Private::Permission "go to top of document")[§](#method_method "direct link")

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

The name of the private method

## [method source-package](#class_X::Method::Private::Permission "go to top of document")[§](#method_source-package "direct link")

```raku
method source-package(--> Mu:D)
```

Returns the type object that (supposedly) contains the private method.

## [method calling-package](#class_X::Method::Private::Permission "go to top of document")[§](#method_calling-package "direct link")

```raku
method calling-package(--> Mu:D)
```

Returns the package in which the calling code is, and which the source package does not trust.


## dist_github-ugexe-Foo.md
## Foo

Used for testing the Perl6 toolchain for installation of same named dists. Specifically this distribution shares its
name with another distribution that uses a different auth.

See also:

<https://github.com/FROGGS/p6-Foo-v1.0.0>

<https://github.com/FROGGS/p6-Foo-v1.2.0>


## dist_zef-samy-Pod-To-Man.md
[![Actions Status](https://github.com/1-1sam-org/Pod-To-Man/actions/workflows/linux.yml/badge.svg)](https://github.com/1-1sam-org/Pod-To-Man/actions) [![Actions Status](https://github.com/1-1sam-org/Pod-To-Man/actions/workflows/macos.yml/badge.svg)](https://github.com/1-1sam-org/Pod-To-Man/actions) [![Actions Status](https://github.com/1-1sam-org/Pod-To-Man/actions/workflows/windows.yml/badge.svg)](https://github.com/1-1sam-org/Pod-To-Man/actions)

# NAME

Pod::To::Man - Render Rakudoc as Roff for man

# SYNOPSIS

From the command line:

```
raku --doc=Man your.rakudoc > your.1

```

From your scripts:

```
use Pod::To::Man;

say Pod::To::Man.pod2man($=pod);

```

# DESCRIPTION

Pod::To::Man is a Raku module that converts a given Rakudoc (pod6) structure to formatted \*roff input, suitable for displaying via the `man(1)` program.

This module also comes with the `rakudoc2man` program, which is a front-end to Pod::To::Man that is a more robust alternative to using Pod::To::Man with Raku's builtin `--doc` renderer.

## Methods

### pod2man

```
method pod2man(
    $pod,
    Str  :$program,
    Str  :$section,
    Date :$date,
    Str  :$version,
    Str  :$center,
    Bool :$urls,
)

```

`pod2man` converts a given pod structure to \*roff, returning the string of formatted \*roff.

`:$program` will be the name `pod2man` will use as the name of the manpage. By default, `pod2man` will try to determine the manpage name by looking for the program name specified by any `=head1 NAME` or `=NAME` blocks/text. If it cannot determine the name to use from those, it will default to the value of `$*PROGRAM.basename`.

`:$section` will be the manual section `pod2man` will use. See `man-pages(7)` for more information on the conventions for manpage sections. If `$*PROGRAM.basename` ends in the `'.pm6'` or `'.rakumod'` suffix, the section will be `'3rakumod'`. Otherwise, defaults to `'1'`.

`:$date` is the date to use for the manpage. Defaults to the value of `now.Date`.

`:$version` is the version to use for the manpage heading. Defaults to `$*RAKU.compiler.gist`, which will look something like `'rakudo (20XX.XX)'`.

`:$center` is the text to display in the center of the manpage heading. Defaults to `"User Contributed Raku Documentation"`.

`:$urls` is a boolean determining whether to generate URLs for `'L<>'` links. Defaults to `True`.

### render

```
method render($pod)

```

`render` is basically the same thing as `pod2man`, but customization is done through environment variables instead of method parameters. This is because it allows the render to be customized when using the `--doc` option in Raku. If you're using Pod::To::Man in your code directly, you should just use `pod2man`.

The following environment variables are supported, each corresponding to their respective `pod2man` parameter.

* `RAKUDOC2MAN_PROGRAM`
* `RAKUDOC2MAN_SECTION`
* `RAKUDOC2MAN_DATE`
* `RAKUDOC2MAN_VERSION`
* `RAKUDOC2MAN_CENTER`
* `RAKUDOC2MAN_URLS`

Most of them accept the same values as their `pod2man` counterparts. `RAKUDOC2MAN_DATE` must be given a date string following the `YYYY-MM-DD` format. `RAKUDOC2MAN_URLS` must be given a number, with `0` equating to `False` and any non-zero value being `True`.

### pod2roff

```
method pod2roff($pod)

```

This method exists only for compatibility reasons. You should use `pod2man` instead.

# BUGS

Don't be ridiculous...

Report bugs on this project's GitHub page, <https://github.com/1-1sam-org/Pod-To-Man>.

# AUTHORS

* Mike Clarke [clarkema@clarkema.org](mailto:clarkema@clarkema.org)
* Vadim Belman [vrurg@lflat.org](mailto:vrurg@lflat.org)
* Samuel Young [samyoung12788@gmail.com](mailto:samyoung12788@gmail.com)

# COPYRIGHT AND LICENSE

* Copyright © 2019-2022 Mike Clarke
* Copyright © 2022, 2025 Raku Community
* Copyright © 2025 Samuel Young

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

# SEE ALSO

man(1), roff(1), man(7), man-pages(7)


## modified.md
modified

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/IO/Special#method_modified)
for **method modified**.

```raku
method modified(IO::Special:D: --> Instant)
```

The last modified time for the filehandle. It always returns an [`Instant`](/type/Instant) type object.

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

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

Returns an [`Instant`](/type/Instant) object indicating when the content of the file was last modified. Compare with [changed](/routine/changed).

```raku
say "path/to/file".IO.modified;          # Instant:1424089165
say "path/to/file".IO.modified.DateTime; # 2015-02-16T12:18:50Z

```


## typecheck.md
class X::TypeCheck

Error due to a failed type check

```raku
class X::TypeCheck is Exception { }
```

Error class thrown when a type check fails.

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

## [method operation](#class_X::TypeCheck "go to top of document")[§](#method_operation "direct link")

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

Returns a string description of the operation that failed, for example `"assignment"`, `"binding"`, `"return"`.

## [method got](#class_X::TypeCheck "go to top of document")[§](#method_got "direct link")

```raku
method got()
```

Returns the object that failed to type check

## [method expected](#class_X::TypeCheck "go to top of document")[§](#method_expected "direct link")

```raku
method expected()
```

Returns the type object against which the check failed.


## dist_github-ppentchev-Serialize-Naive.md
# NAME

Serialize::Naive - recursive serialization and deserialization interface

# SYNOPSIS

```
    use Serialize::Naive;

    class Point does Serialize::Naive
    {
        has Rat $.x;
        has Rat $.y;
    }

    class Circle does Serialize::Naive
    {
        has Point $.center;
        has Int $.radius;
    }

    class Polygon does Serialize::Naive
    {
        has Str $.label;
        has Point @.vertices;
    }

    my %data = radius => 5, center => { x => 0.5, y => 1.5 };
    my Circle $c .= deserialize(%data);

    my %coords = $c.center.serialize;
    say "X %coords<x> Y %coords<y>";

    my Polygon $sq .= new(:label("A. Square"),
        :vertices(Array[Point].new(
            Point.new(:x(0.0), :y(0.0)),
            Point.new(:x(1.0), :y(0.0)),
            Point.new(:x(1.0), :y(1.0)),
            Point.new(:x(0.0), :y(1.0)),
    )));
    %data = $sq.serialize;
    say %data;

    %data<weird> = 'ness';
    %data<vertices>[1]<unhand> = 'me';

    say 'Warnings silently ignored';
    $sq .= deserialize(%data);

    say 'Warnings displayed';
    $sq .= deserialize(%data, :warn(&note));

```

# DESCRIPTION

This role provides two methods to recursively serialize Perl 6 objects to Perl 6 data structures and, later, deserialize them back. No attempt is made to preserve type information in the serialized data; the caller of the `deserialize()` method should take care to pass the proper data structure for the top-level class, and the inner objects and classes will be discovered and recursed into automatically.

# METHODS

* method serialize

  ```
  method serialize()

  ```

  Return a hash containing key/value pairs for all the public attributes of the object's class. Attributes are classified in several categories:

  ```
  * Basic types

    The value of the attribute is stored directly as the hash pair value.

  * Typed arrays or hashes

    The value of the attribute is stored as respectively an array or a hash containing the recursively serialized values of the elements.

  * Other classes

    The value of the attribute is recursively serialized to a hash using the same algorithm.

  ```

  Current API available since version 0.1.0.
* method deserialize

  ```
  method deserialize(%data, Sub :$warn);

  ```

  Instantiate a new object of the invocant's type, initializing its attributes with the values from the provided hash. Any attributes of composite or complex types are handled recursively in the reverse manner as the serialization described above.

  The optional `$warn` parameter is a handler for warnings about any inconsistencies detected in the data. For the present, the only problem detected is hash keys that do not correspond to class attributes.

  Current API available since version 0.1.0.

# FUNCTIONS

The `Serialize::Naive` module also exports two functions:

* sub serialize

  ```
  sub serialize($obj)

  ```

  Serialize the specified object just as `$obj.serialize()` would.

  Current API available since version 0.1.0.
* sub deserialize

  ```
  sub deserialize($type, %data, Sub :$warn)

  ```

  Deserialize an object of the specified type just as `$type.deserialize(%data, :warn($warn))` would.

  Current API available since version 0.1.0.

# SEE ALSO

[Serialize::Tiny](https://modules.perl6.org/dist/Serialize::Tiny)

# AUTHOR

Peter Pentchev <[roam@ringlet.net](mailto:roam@ringlet.net)>

# COPYRIGHT

Copyright (C) 2016, 2017 Peter Pentchev

# LICENSE

The Serialize::Naive module is distributed under the terms of the Artistic License 2.0. For more details, see the full text of the license in the file LICENSE in the source distribution.


## dist_cpan-GARLANDG-Constants-Netinet-In.md
# NAME

Constants::Netinet::In - Constants from netinet/in.h

# SYNOPSIS

```
use Constants::Netinet::In :IP, :IPPROTO;

say IPPROTO::IP;

say IP::ADD_MEMBERSHIP;

say IPPROTO.enums.keys;

say IP.enums.keys;

```

# DESCRIPTION

Constants::Netinet::In contains many enumerated values that are implemented as #define directives in <netinet/in.h>.

This module should be compatible with windows, macos, linux, netbsd, freebsd, openbsd, and dragonflybsd.

Each platform will receive slightly different enumerations.

Based on C headers found on official sites and unofficial mirrors of source trees.

# AUTHOR

Travis Gibson [TGib.Travis@protonmail.com](mailto:TGib.Travis@protonmail.com)

# COPYRIGHT AND LICENSE

Copyright 2019 Travis Gibson

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


## dist_zef-FCO-Injector.md
[![Build Status](https://travis-ci.org/FCO/Injector.svg?branch=master)](https://travis-ci.org/FCO/Injector)

# Injector

A perl6 dependency injector

## Synopsys

```
use lib "lib";

use Injector;

class Rand {
    has $.r = ("a" .. "z").roll(rand * 10).join;
}

class C2 {
    has Int $.a is injected
}

class C1 {
    has C2      $.c2    is injected;
    has Int     $.b     is injected<test>;
    has Rand    $.r     is injected{:lifecycle<instance>};
}

BEGIN {
    bind 42;
    bind 13, :name<test>;
}

my C1 $c is injected;
say $c;                     # C1.new(c2 => C2.new(a => 42), b => 13, r => Rand.new(r => "qo"))

for ^3 {
    given C1.new: :123b {
        .c2.a.say;          # 42                            42                          42
        .b.say;             # 123                           123                         123
        .r.say;             # Rand.new(r => "ztjbpvqka")    Rand.new(r => "zsmqnrr")    Rand.new(r => "wmsq")
    }
}

```


## mixin.md
mixin

Combined from primary sources listed below.

# [In role Metamodel::Mixins](#___top "go to top of document")[§](#(role_Metamodel::Mixins)_method_mixin "direct link")

See primary documentation
[in context](/type/Metamodel/Mixins#method_mixin)
for **method mixin**.

```raku
method mixin($obj, *@roles, :$needs-mixin-attribute)
```

Generates a new mixin type by calling `generate_mixin` with `$obj` and `@roles`. If `$obj` is composed, the mixin cache of `$obj` will be checked for any existing mixin for these beforehand. If `$obj` is an instance of a type, this will return `$obj` reblessed with the mixin generated, otherwise this will return the mixin itself.

If `$needs-mixin-attribute` is `True`, this will throw an exception if no mixin attribute exists on the mixin generated before returning.


## str.md
Str

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/List#method_Str)
for **method Str**.

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

Stringifies the elements of the list and joins them with spaces (same as `.join(' ')`).

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

# [In role Sequence](#___top "go to top of document")[§](#(role_Sequence)_method_Str "direct link")

See primary documentation
[in context](/type/Sequence#method_Str)
for **method Str**.

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

[Stringifies](/type/List#method_Str) the [cached](/type/PositionalBindFailover#method_cache) sequence.

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

See primary documentation
[in context](/type/Num#method_Str)
for **method Str**.

```raku
method Str(Int:D)
```

Returns a string representation of the number.

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

[`Cool`](/type/Cool) being a parent class of `Num`, an explicit call to the `Num.Str` method is seldom needed.

```raku
say π.Str.comb == π.comb; # OUTPUT: «True␤»
```

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

See primary documentation
[in context](/type/ForeignCode#method_Str)
for **method Str**.

```raku
method Str( ForeignCode:D: )
```

Returns the name of the code by calling `name`.

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

See primary documentation
[in context](/type/IO/Special#method_Str)
for **method Str**.

```raku
method Str(IO::Special:D:)
```

This returns `'<STDIN>'`, `'<STDOUT>'`, or `'<STDERR>'` as appropriate.

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

See primary documentation
[in context](/type/Version#method_Str)
for **method Str**.

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

Returns a string representation of the invocant.

```raku
my $v1 = v1.0.1;
my $v2 = Version.new('1.0.1');
say $v1.Str;                                      # OUTPUT: «1.0.1␤»
say $v2.Str;                                      # OUTPUT: «1.0.1␤»
```

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

See primary documentation
[in context](/type/IO/Handle#method_Str)
for **method Str**.

Returns the value of [`.path`](/type/IO/Handle#method_path), coerced to [`Str`](/type/Str).

```raku
say "foo".IO.open.Str; # OUTPUT: «foo␤»

```

# [In role Systemic](#___top "go to top of document")[§](#(role_Systemic)_method_Str "direct link")

See primary documentation
[in context](/type/Systemic#method_Str)
for **method Str**.

```raku
method Str
```

Instance method returning the name of the object.

```raku
say $*RAKU.Str; # OUTPUT: «Raku␤»
```

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

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

```raku
put $paragraph;  # Text before B<and> after markup␤␤

```

Returns the string for the paragraph, with any markup stringified.

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

See primary documentation
[in context](/type/Match#method_Str)
for **method Str**.

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

Returns the matched text.

```raku
"abc123def" ~~ /\d+/;
say $/.Str;               # OUTPUT: «123␤»
```

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

See primary documentation
[in context](/type/StrDistance#method_Str)
for **method Str**.

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

Returns an `after` string value.

```raku
my $str-dist = ($str ~~ tr/old/new/);
say $str-dist.Str; # OUTPUT: «fnew␤»
say ~$str-dist;    # OUTPUT: «fnew␤»

```

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

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

```raku
put $markup;  # B<and>␤

```

Returns the string for the markup object, with any embedded markup also stringified.

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

See primary documentation
[in context](/type/Pair#method_Str)
for **method Str**.

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

Returns a string representation of the invocant formatted as *key ~ \t ~ value*.

```raku
my $b = eggs => 3;
say $b.Str;                                       # OUTPUT: «eggs  3␤»
```

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

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

```raku
put $block;  # bar␤

```

Returns the string for the paragraphs of the block, with any markup also stringified.

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

See primary documentation
[in context](/type/Label#method_Str)
for **method Str**.

Converts to a string including the name, file and line it's been defined in.

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

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

```raku
multi method Str(--> Str)
```

Returns a string representation of the invocant, intended to be machine readable. Method [`Str`](/type/Str) warns on type objects, and produces the empty string.

```raku
say Mu.Str;   # Use of uninitialized value of type Mu in string context.
my @foo = [2,3,1];
say @foo.Str  # OUTPUT: «2 3 1␤»
```

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

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

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

Throws [`X::Buf::AsStr`](/type/X/Buf/AsStr) with [`Str`](/type/Str) as payload. In order to convert to a [`Str`](/type/Str) you need to use [`.decode`](/routine/decode).

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

See primary documentation
[in context](/type/IO/CatHandle#method_Str)
for **method Str**.

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

Calls [`.Str`](/type/IO/Handle#method_Str) on the currently active source handle and returns the result. If the [source handle queue has been exhausted](/type/IO/CatHandle#method_next-handle), returns an implementation-defined string (`'<closed IO::CatHandle>'` in Rakudo).

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

See primary documentation
[in context](/type/Nil#method_Str)
for **method Str**.

```raku
method Str()
```

Warns the user that they tried to stringify a `Nil`.

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

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

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

Alias for [`IO::Path.path`](/routine/path). In particular, note that default stringification of an `IO::Path` does **NOT** use the value of [`$.CWD` attribute](/type/IO/Path#attribute_CWD). To stringify while retaining full path information use [`.absolute`](/routine/absolute) or [`.relative`](/routine/relative) methods.

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

See primary documentation
[in context](/type/Code#method_Str)
for **method Str**.

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

Will output the method name, but also produce a warning. Use `.raku` or `.gist` instead.

```raku
sub marine() { }
say ~&marine;
# OUTPUT: «Sub object coerced to string (please use .gist or .raku to do that)␤marine␤»
say &marine.Str;
# OUTPUT: «Sub object coerced to string (please use .gist or .raku to do that)␤marine␤»
say &marine.raku; # OUTPUT: «sub marine { #`(Sub|94280758332168) ... }␤»
```

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

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

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

Autothreads the `.Str` method over its elements and returns results as a `Junction`. Output methods that use `.Str` method ([print](/routine/print) and [put](/routine/put)) are special-cased to autothread junctions, despite being able to accept a [`Mu`](/type/Mu) type.

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

See primary documentation
[in context](/type/Thread#method_Str)
for **method Str**.

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

Returns a string which contains the invocants [thread id](#method_id) and [name](#method_name).

```raku
my $t = Thread.new(code => { for 1..5 -> $v { say $v }}, name => 'calc thread');
say $t.Str;                           # OUTPUT: «Thread<3>(calc thread)␤»
```

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

See primary documentation
[in context](/type/Int#method_Str)
for **method Str**.

```raku
multi method Str(Int:D)
multi method Str(Int:D, :$superscript)
multi method Str(Int:D, :$subscript)
```

Returns a string representation of the number.

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

[`Cool`](/type/Cool) being a parent class of `Int`, an explicit call to the `Int.Str` method is seldom needed, unless you want the string to be returned in superscript or subscript.

```raku
say 42.Str(:superscript); # OUTPUT: «⁴²␤»
say 42.Str(:subscript);   # OUTPUT: «₄₂␤»
```

The `:superscript` and `:subscript` named arguments are available as of the 2023.05 Rakudo compiler release.

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

See primary documentation
[in context](/type/DateTime#method_Str)
for **method Str**.

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

Returns a string representation of the invocant, as done by [the formatter](/type/Dateish#method_formatter). If no formatter was specified, an ISO 8601 timestamp will be returned.

```raku
say DateTime.new('2015-12-24T12:23:00+0200').Str;
# OUTPUT: «2015-12-24T12:23:00+02:00␤»

```

# [In role Real](#___top "go to top of document")[§](#(role_Real)_method_Str "direct link")

See primary documentation
[in context](/type/Real#method_Str)
for **method Str**.

```raku
multi method Str(Real:D:)
```

Calls the [`Bridge` method](/routine/Bridge) on the invocant and then the [`Str` method](/routine/Str) on its return value.

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

See primary documentation
[in context](/type/Backtrace#method_Str)
for **method Str**.

```raku
multi method Str(Backtrace:D:)
```

Returns a concise string representation of the backtrace, omitting routines marked as `is hidden-from-backtrace`, and at the discretion of the implementation, also some routines from the setting.

```raku
my $backtrace = Backtrace.new;
say $backtrace.Str;
```

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

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

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

Returns the [`Str`](/type/Str) value of the invocant.

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

See primary documentation
[in context](/type/Date#method_Str)
for **method Str**.

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

Returns a string representation of the invocant, as specified by [the formatter](/type/Dateish#method_formatter). If no formatter was specified, an ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)) date will be returned.

```raku
say Date.new('2015-12-24').Str;                     # OUTPUT: «2015-12-24␤»

my $fmt = { sprintf "%02d/%02d/%04d", .month, .day, .year };
say Date.new('2015-12-24', formatter => $fmt).Str;  # OUTPUT: «12/24/2015␤»
```


## setty.md
role Setty

Collection of distinct objects

```raku
role Setty does QuantHash { }
```

A role for collections which make sure that each element can only appear once. See [`Set`](/type/Set) and [`SetHash`](/type/SetHash).

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

## [method new-from-pairs](#role_Setty "go to top of document")[§](#method_new-from-pairs "direct link")

```raku
method new-from-pairs(*@pairs --> Setty:D)
```

Constructs a Setty object from a list of [`Pair` objects](/type/Pair) given as positional arguments:

```raku
say Set.new-from-pairs: 'butter' => 0.22, 'salt' => 0, 'sugar' => 0.02;
# OUTPUT: «Set(butter sugar)␤»
```

**Note:** be sure you aren't accidentally passing the Pairs as positional arguments; the quotes around the keys in the above example are significant.

## [method grab](#role_Setty "go to top of document")[§](#method_grab "direct link")

```raku
method grab($count = 1)
```

Removes and returns `$count` elements chosen at random (without repetition) from the set.

If `*` is passed as `$count`, or `$count` is greater than or equal to the size of the set, then all its elements are removed and returned in random order.

Only works on mutable sets; When used on an immutable set, it results in an exception.

## [method grabpairs](#role_Setty "go to top of document")[§](#method_grabpairs "direct link")

```raku
method grabpairs($count = 1)
```

Removes `$count` elements chosen at random (without repetition) from the set, and returns a list of [`Pair`](/type/Pair) objects whose keys are the grabbed elements and whose values are `True`.

If `*` is passed as `$count`, or `$count` is greater than or equal to the size of the set, then all its elements are removed and returned as [`Pair`](/type/Pair)s in the aforementioned way in random order.

Only works on mutable sets; When used on an immutable set, it results in an exception.

## [method pick](#role_Setty "go to top of document")[§](#method_pick "direct link")

```raku
multi method pick($count = 1)
```

Returns `$count` elements chosen at random (without repetition) from the set.

If `*` is passed as `$count`, or `$count` is greater than or equal to the size of the set, then all its elements are returned in random order (shuffled).

## [method pickpairs](#role_Setty "go to top of document")[§](#method_pickpairs "direct link")

```raku
multi method pickpairs(Setty:D: --> Pair:D)
multi method pickpairs(Setty:D: $count --> Seq:D)
```

Returns a [`Pair`](/type/Pair) or a [`Seq`](/type/Seq) of [`Pair`](/type/Pair)s depending on the candidate of the method being invoked. Each [`Pair`](/type/Pair) returned has an element of the invocant as its key and `True` as its value. In contrast to [grabpairs](#method_grabpairs), the elements are 'picked' without replacement.

If `*` is passed as `$count`, or `$count` is greater than or equal to the number of [elements](#method_elems) of the invocant, then all element/`True` [`Pair`](/type/Pair)s from the invocant are returned in a random sequence; i.e. they are returned shuffled;

Note that each `pickpairs` invocation maintains its own private state and has no effect on subsequent `pickpairs` invocations.

```raku
my $numbers = set (4, 2, 3);
say $numbers.pickpairs;                           # OUTPUT: «4 => True␤»
say $numbers.pickpairs(1);                        # OUTPUT: «(3 => True)␤»
say $numbers.pickpairs(*);                        # OUTPUT: «(2 => True 4 => True 3 => True)␤»
```

## [method roll](#role_Setty "go to top of document")[§](#method_roll "direct link")

```raku
multi method roll($count = 1)
```

Returns a lazy list of `$count` elements, each randomly selected from the set. Each random choice is made independently, like a separate die roll where each die face is a set element.

If `*` is passed as `$count`, the list is infinite.

## [method antipairs](#role_Setty "go to top of document")[§](#method_antipairs "direct link")

```raku
multi method antipairs(Setty:D: --> Seq:D)
```

Returns all elements in the set and `True` as a [`Seq`](/type/Seq) of [`Pair`](/type/Pair)s, where the element itself is the value, i.e. the opposite of method `pairs`.

```raku
my $s = Set.new(1, 2, 3, 1);
say $s.antipairs.sort;                            # OUTPUT: «(True => 1 True => 2 True => 3)␤»
```

## [method keys](#role_Setty "go to top of document")[§](#method_keys "direct link")

```raku
multi method keys(Setty:D: --> Seq:D)
```

Returns a [`Seq`](/type/Seq) of all elements of the set.

```raku
my $s = Set.new(1, 2, 3);
say $s.keys;                                      # OUTPUT: «(3 1 2)␤»
```

## [method values](#role_Setty "go to top of document")[§](#method_values "direct link")

```raku
multi method values(Setty:D: --> Seq:D)
```

Returns a [`Seq`](/type/Seq) containing as many `True` values as the set has elements.

```raku
my $s = Set.new(1, 2, 3);
say $s.values;                                    # OUTPUT: «(True True True)␤»
```

## [method kv](#role_Setty "go to top of document")[§](#method_kv "direct link")

```raku
multi method kv(Setty:D: --> Seq:D)
```

Returns a [`Seq`](/type/Seq) of the set's elements and `True` values interleaved.

```raku
my $s = Set.new(1, 2, 3);
say $s.kv;                                        # OUTPUT: «(3 True 1 True 2 True)␤»
```

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

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

The number of elements of the set.

## [method total](#role_Setty "go to top of document")[§](#method_total "direct link")

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

The total of all the values of the [`QuantHash`](/type/QuantHash) object. For a `Setty` object, this is just the number of elements.

## [method minpairs](#role_Setty "go to top of document")[§](#method_minpairs "direct link")

```raku
multi method minpairs(Setty:D: --> Seq:D)
```

Returns the value of [`self.pairs`](/routine/pairs) (as all Pairs have minimum values). See also [`Any.minpairs`](/routine/minpairs)

## [method maxpairs](#role_Setty "go to top of document")[§](#method_maxpairs "direct link")

```raku
multi method maxpairs(Setty:D: --> Seq:D)
```

Returns the value of [`self.pairs`](/routine/pairs) (as all Pairs have maximum values). See also [`Any.maxpairs`](/routine/maxpairs)

## [method default](#role_Setty "go to top of document")[§](#method_default "direct link")

```raku
method default(--> False)
```

Returns the default value of the invocant, i.e. the value which is returned when trying to access an element in the `Setty` object which has not been previously initialized or when accessing an element which has explicitly been set to [`Nil`](/type/Nil) or `False`.

```raku
my $s1 = SetHash.new(1, 2, 3);
say $s1{2};                                           # OUTPUT: «True␤»
$s1{2} = Nil;
say $s1{2};                                           # OUTPUT: «False␤»
# access non initialized element
say $s1{4};                                           # OUTPUT: «False␤»
```

## [method ACCEPTS](#role_Setty "go to top of document")[§](#method_ACCEPTS "direct link")

```raku
method ACCEPTS($other)
```

Returns `True` if `$other` and `self` contain all the same elements, and no others.

## [method Bag](#role_Setty "go to top of document")[§](#method_Bag "direct link")

```raku
method Bag(Setty:D: --> Bag:D)
```

Returns a [`Bag`](/type/Bag) containing the elements of the invocant.

```raku
my Bag $b = Set.new(1, 2, 3).Bag;
say $b;                                           # OUTPUT: «Bag(3 1 2)␤»
```

The quantity of the elements in this created bag will be set to one:

```raku
say (1,2,3).Bag{1};                              # OUTPUT: «1␤»
```

## [method BagHash](#role_Setty "go to top of document")[§](#method_BagHash "direct link")

```raku
method BagHash(Setty:D: --> BagHash:D)
```

Returns a [`BagHash`](/type/BagHash) containing the elements of the invocant.

```raku
my BagHash $b = Set.new(1, 2, 3).BagHash;
say $b;                                           # OUTPUT: «BagHash(1 2 3)␤»
```

## [method Bool](#role_Setty "go to top of document")[§](#method_Bool "direct link")

```raku
multi method Bool(Setty:D: --> Bool:D)
```

Returns `True` if the invocant contains at least one element.

```raku
my $s1 = Set.new(1, 2, 3);
say $s1.Bool;                                     # OUTPUT: «True␤»

my $s2 = $s1 ∩ Set.new(4, 5);                     # set intersection operator
say $s2.Bool;                                     # OUTPUT: «False␤»
```

## [method Mix](#role_Setty "go to top of document")[§](#method_Mix "direct link")

```raku
method Mix(Setty:D: --> Mix:D)
```

Returns a [`Mix`](/type/Mix) containing the elements of the invocant.

```raku
my Mix $b = Set.new(1, 2, 3).Mix;
say $b;                                           # OUTPUT: «Mix(3 1 2)␤»
```

The elements of the returned [`Mix`](/type/Mix) will have weights equal to 1:

```raku
say (1,2,3).Mix{3};                               # OUTPUT: «1␤»
```

## [method MixHash](#role_Setty "go to top of document")[§](#method_MixHash "direct link")

```raku
method MixHash(Setty:D: --> MixHash:D)
```

Returns a [`MixHash`](/type/MixHash) containing the elements of the invocant.

```raku
my MixHash $b = Set.new(1, 2, 3).MixHash;
say $b;                                           # OUTPUT: «MixHash(1 2 3)␤»
```

# [See Also](#role_Setty "go to top of document")[§](#See_Also "direct link")

[Sets, Bags, and Mixes](/language/setbagmix)

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

Type relations for `Setty`

raku-type-graph

Setty
Setty

QuantHash
QuantHash

Setty->QuantHash

Associative
Associative

QuantHash->Associative

Mu
Mu

Any
Any

Any->Mu

Set
Set

Set->Setty

Set->Any

SetHash
SetHash

SetHash->Setty

SetHash->Any

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


## catdir.md
catdir

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/IO/Spec/Cygwin#method_catdir)
for **method catdir**.

```raku
method catdir (*@parts --> Str:D)
```

Concatenates multiple path fragments and returns the canonical representation of the resultant path as a string. The `@parts` are [`Str`](/type/Str) objects and are allowed to contain path separators.

```raku
IO::Spec::Cygwin.catdir(<foo/bar ber raku>).say;
# OUTPUT: «foo/bar/ber/raku␤»
```

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

See primary documentation
[in context](/type/IO/Spec/Unix#method_catdir)
for **method catdir**.

```raku
method catdir (*@parts --> Str:D)
```

Concatenates multiple path fragments and returns the canonical representation of the resultant path as a string. The `@parts` are [`Str`](/type/Str) objects and are allowed to contain path separators.

```raku
IO::Spec::Unix.catdir(<foo/bar ber raku>).say; # OUTPUT: «foo/bar/ber/raku␤»
```

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

See primary documentation
[in context](/type/IO/Spec/Win32#method_catdir)
for **method catdir**.

```raku
method catdir (*@parts --> Str:D)
```

Concatenates multiple path fragments and returns the canonical representation of the resultant path as a string. The `@parts` are [`Str`](/type/Str) objects and are allowed to contain path separators.

```raku
IO::Spec::Win32.catdir(<foo/bar ber raku>).say;
# OUTPUT: «foo\bar\ber\raku␤»
```


## dist_zef-masukomi-Function-Validation.md
[![Actions Status](https://github.com/masukomi/Function-Validation/actions/workflows/test.yml/badge.svg)](https://github.com/masukomi/Function-Validation/actions)

# NAME

Function::Validation - Functions to help you validate the signature of functions

Think of it as a quasi-type system for functional programming.

# SYNOPSIS

```
use Function::Validation;

#validate a specific function
my sub func(Int $x, Int $y, Bool :$translate, :$rotate) {};
validate-function(&func, (Int, Int, Bool, Any), Mu); # => True
#                        ^--inputs              ^--return

# generate a reusable validator
my $validator = generate-func-validator((Int, Int, Bool, Any), Mu);
$validator(&func); # => True

my $lambda = sub (){"noparams"};
validate-function($lambda, [], Str);  # => True
validate-function($lambda, [], Mu);   # => True
validate-function($lambda, [], Any);  # => False (Any isn't a catch-all like Mu)

my $lamda_validator = generate-func-validator([], Mu);
$lambda_validator($lambda);           # => True

my $function_with_where = sub (Int $x where $x < 10) {$x}
validate-function($function_with_where, [Int], Mu); # => True

# extract the argument types from a function
my @types = function-arg-types(&func); #=> [(Int) (Int) (Bool) (Any)]

```

## DESCRIPTION

Function::Validation validates a function you've been passed to ensure it takes the inputs you expect and provides the output you expect.

Useful in functional programming when you don't have any Classes and thus can't use a `role` or class type to enforce valid input types.

## BUT...

How does

```
validate-function(&func, (Int, Int, Bool, Any), Mu)

```

differ from

```
&func.signature ~~ :(Int,Int,Bool :$translate,Any :$rotate --> Mu)

```

?

* The former is more self evident to readers.
* The former doesn't require developers to have knowledge of the `.signature` function which new devs are unlikely to have.

How does

```
function-arg-types(&func)

```

differ from

```
&func.signature.params».type

```

?

* The former makes what's happening more self-evident to readers.
* The former doesn't require developers to have knowledge of the `.signature` and `.params` functions, or why you can't call `.params` on the function directly.

How does is distinguish between

```
sub foo(Str :$thing)

```

and

```
sub bar(Str :$other)

```

? They can't be called the same way.

**It doesn't!** If you know how to teach it to do this, please [make a Pull Request](https://github.com/masukomi/Function-Validation/pulls), with unit tests.

### AUTHOR

[masukomi](https://masukomi.org)

# COPYRIGHT AND LICENSE

Copyright 2022

This library is free software; you can redistribute it and/or modify it under the MIT license

### sub validate-function

```
sub validate-function(
    Sub $function,
    Positional $arg_types,
    Mu $return_type = Mu
) returns Bool

```

a function to validate the signature of other functions

## class Mu $

a reference to the function you want to test

## class Mu $

A list of the types. If unspecified use Mu

## class Mu $

The expected return type of the function.

### sub generate-func-validator

```
sub generate-func-validator(
    Positional $arg_types,
    Mu $return_type = Mu
) returns Sub

```

A function to generate a validator to validate the signature of functions

## class Mu $

A list of the types. If unspecified use Mu

## class Mu $

The expected return type of the function.

### sub function-arg-types

```
sub function-arg-types(
    Sub $function
) returns Seq

```

a function to extract the types of the arguments of a function

## class Mu $

the function you want to know the argument types of


## dist_zef-demayl-Terminal-Size.md
# raku-terminal-size

Terminal::Size - raku programming language library to get a tty size
Works on Linux, MacOS\* and BSD\*

## Example using STDOUT

```
#!/usr/bin/raku
use Terminal::Size;

my winsize $size = terminal-size();
my uint16  $rows = $size.rows; # 76
my uint16  $cols = $size.cols; # 310

```

## Example using custom IO::Handle

```
#!/usr/bin/raku
use Terminal::Size;

my $fd = "somefile.tty".IO.open: :r;

my $size = terminal-size($fd);

if !$size { # Failure
    note "Failed " ~ $size.exception.message;
    exit 1;
}

my uint16  $rows = $size.rows; # 76
my uint16  $cols = $size.cols; # 310

```

## Exported symbols

* &terminal-size( IO::Handle:D $fd = $\*OUT )
* struct winsize

## Supported OS

* Linux
* \*BSD ( needs testing )
* MacOS ( needs testing )

## Method used to get the info

### In short it should support all POSIX compatible systems

```
ioctl $FD TIOCGWINSZ *winsize

```


## dist_github-alabamenhu-Intl-LanguageTag-Simple.md
# Intl::LanguageTag::Simple

An extremely simple class implementing the core functions of a language tag.
This is designed to be either extremely lightweight when you don't need the
bulk of other language tag classes (and only need the language and region
functionality). This simple class uses the first two runs of `<alnum>`,
characters but can also be made directly using `language` and `region`
attributes. The simple heuristic works sufficiently well for all known
standard language tag standards.

For more powerful introspection, matching, etc, see one of the other classes.

Note that this class may generate invalid BCP-47 tags, and as such the string
returned from the `.bcp47` method is false-y.


## nl-out.md
nl-out

Combined from primary sources listed below.

# [In IO::Handle](#___top "go to top of document")[§](#(IO::Handle)_method_nl-out "direct link")

See primary documentation
[in context](/type/IO/Handle#method_nl-out)
for **method nl-out**.

```raku
has Str:D $.nl-out is rw = "\n";
```

One of the attributes that can be set via `.new` or [open](/routine/open). Defaults to `"\n"`. Takes a [`Str`](/type/Str) specifying output line ending for this handle, to be used by methods [`.put`](/type/IO/Handle#method_put) and [`.say`](/type/IO/Handle#method_say).

```raku
with 'test'.IO {
    given .open: :w {
        .put: 42;
        .nl-out = 'foo';
        .put: 42;
        .close;
    }
    .slurp.raku.say; # OUTPUT: «"42\n42foo"␤»
}

```

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

See primary documentation
[in context](/type/Any#method_nl-out)
for **method nl-out**.

```raku
method nl-out(--> Str)
```

Returns [`Str`](/type/Str) with the value of "\n". See [`IO::Handle.nl-out`](/type/IO/Handle#method_nl-out) for the details.

```raku
Num.nl-out.print;     # OUTPUT: «␤»
Whatever.nl-out.print;# OUTPUT: «␤»
33.nl-out.print;      # OUTPUT: «␤»
```


## dist_zef-cro-Cro-Core.md
# Cro::Core Build Status

This is part of the Cro libraries for implementing services and distributed
systems in Raku. See the [Cro website](http://cro.services/) for further
information and documentation.


## dist_zef-antononcube-Chemistry-Stoichiometry.md
# Raku Chemistry::Stoichiometry

[![Build Status](https://travis-ci.com/antononcube/Raku-Chemistry-Stoichiometry.svg?branch=main)](https://travis-ci.com/antononcube/Raku-Chemistry-Stoichiometry)
[![](https://img.shields.io/badge/License-Artistic%202.0-0298c3.svg)](https://opensource.org/licenses/Artistic-2.0)

🇧🇬 🇨🇳 🇨🇿 🇬🇧 🇩🇪 🇬🇷 🇯🇵 🇰🇷 🇮🇷 🇵🇱 🇵🇹 🇷🇺 🇪🇸

## Introduction

This repository is with Raku package for Stoichiometry procedures and related data.
The primary functionalities are:

* Calculation of molecular masses for chemical compound formulas
* Chemical equations balancing
* Multi-language support

Here are corresponding examples:

```
use Chemistry::Stoichiometry;

say molecular-mass('SO2');

```

```
# 64.058

```

```
say balance-chemical-equation('C2H5OH + O2 = H2O + CO2');

```

```
# [1*C2H5OH + 3*O2 -> 2*CO2 + 3*H2O]

```

The package has also functions for chemical element data retrieval
and functions that convert between chemical names, symbols/abbreviations, and atomic numbers.

Here are a couple of examples:

```
say atomic-number('actinium');

```

```
# 89

```

```
say chemical-symbol('ガリウム');

```

```
# Ga

```

**Remark:** Multiple languages can be used for the names of the chemical elements.
The corresponding functions automatically detect the language.

**Remark:** At this point the package has standard element names in the following languages:

```
my Chemistry::Stoichiometry::ResourceAccess $resources.instance;
say $resources.get-language-names-data.keys.sort;

```

```
# (Arabic Bulgarian Chinese Czech English German Greek Japanese Korean Persian Polish Portuguese Russian Spanish)

```

Adding new languages can be easily done by adding CSV files into the
[resources](./resources) directory.

### Related work

The package
["Chemistry::Elements"](https://github.com/briandfoy/perl6-chemistry-elements)
developed by Brian D. Foy, [BF1], also has functions that convert
between chemical names, symbols/abbreviations, and atomic numbers.
(Several languages are supported.)

Mathematica / Wolfram Language (WL) has the function
[`ElementData`](https://reference.wolfram.com/language/ref/ElementData.html), [WRI1].

In 2007 I wrote the original versions of the chemical equation balancing and
molecular functionalities in
[WolframAlpha](https://www.wolframalpha.com).
See for example
[this output](https://www.wolframalpha.com/input/?i=C2H5OH+%2B+O2+%3D+H2O+%2B+CO2).

---

## Installation

Package installations from both sources use [zef installer](https://github.com/ugexe/zef)
(which should be bundled with the "standard" [Rakudo](https://rakudo.org) installation file.)

To install the package from [Zef ecosystem](https://raku.land)
use the shell command:

```
zef install Chemistry::Stoichiometry

```

To install the package from the GitHub repository use the shell command:

```
zef install https://github.com/antononcube/Raku-Chemistry-Stoichiometry.git

```

---

## Element data retrieval

### Element data records

Element data of one or several elements can be obtained with the function `chemical-element-data`:

```
say chemical-element-data('Cl');

```

```
# {Abbreviation => Cl, AtomicNumber => 17, AtomicWeight => 35.45, Block => p, Group => 17, Name => chlorine, Period => 3, Series => Halogen, StandardName => Chlorine}

```

```
.say for chemical-element-data(['H', 'Li', 'Na', 'K', 'Rb', 'Cs', 'Fr']);

```

```
# {Abbreviation => H, AtomicNumber => 1, AtomicWeight => 1.008, Block => s, Group => 1, Name => hydrogen, Period => 1, Series => Nonmetal, StandardName => Hydrogen}
# {Abbreviation => Li, AtomicNumber => 3, AtomicWeight => 6.94, Block => s, Group => 1, Name => lithium, Period => 2, Series => AlkaliMetal, StandardName => Lithium}
# {Abbreviation => Na, AtomicNumber => 11, AtomicWeight => 22.98976928, Block => s, Group => 1, Name => sodium, Period => 3, Series => AlkaliMetal, StandardName => Sodium}
# {Abbreviation => K, AtomicNumber => 19, AtomicWeight => 39.0983, Block => s, Group => 1, Name => potassium, Period => 4, Series => AlkaliMetal, StandardName => Potassium}
# {Abbreviation => Rb, AtomicNumber => 37, AtomicWeight => 85.4678, Block => s, Group => 1, Name => rubidium, Period => 5, Series => AlkaliMetal, StandardName => Rubidium}
# {Abbreviation => Cs, AtomicNumber => 55, AtomicWeight => 132.90545196, Block => s, Group => 1, Name => cesium, Period => 6, Series => AlkaliMetal, StandardName => Cesium}
# {Abbreviation => Fr, AtomicNumber => 87, AtomicWeight => 223, Block => s, Group => 1, Name => francium, Period => 7, Series => AlkaliMetal, StandardName => Francium}

```

### Element names

```
say chemical-element('Cl');

```

```
# Chlorine

```

```
say chemical-element('Cl', 'Russian');

```

```
# Хлор

```

Chemical element names can be obtained using the function `chemical-element-data` with the adverbs
`:name` or `:standard-name`:

```
say chemical-element-data('Cl'):name;

```

```
# Chlorine

```

```
say chemical-element-data('Cl'):standard-name;

```

```
# Chlorine

```

### Element symbols / abbreviations

```
say chemical-symbol('oxygen');   # 'O' from English

```

```
# O

```

```
say chemical-symbol('кислород'); # 'O' from Bulgarian

```

```
# O

```

Chemical element abbreviations can be obtained using the function `chemical-element-data` with the adverbs
`:symbol` or `:abbr`:

```
say chemical-element-data('oxygen'):symbol;         # 'O' from English

```

```
# O

```

```
say chemical-element-data('кислород'):abbr;         # 'O' from Bulgarian

```

```
# O

```

Note, that `chemical-element` will automatically detect the language.

### Atomic numbers

```
say atomic-number('Cl');

```

```
# 17

```

```
say atomic-number('actinium');  # from the English name of Ac

```

```
# 89

```

```
say atomic-number('берилий');   # from the Bulgarian name of Be

```

```
# 4

```

Alternatively, `chemical-element-data` can be used with the adverbs `:number` or `:atomic-number`:

```
say chemical-element-data('Cl'):number;

```

```
# 17

```

```
say chemical-element-data('Cl'):atomic-number;

```

```
# 17

```

### Atomic weights

```
say atomic-weight('Se');

```

```
# 78.971

```

```
say atomic-weight('ガリウム');  # from the Japanese name of Ga

```

```
# 69.723

```

Alternatively, `chemical-element-data` can be used with the adverbs `:weight` or `:atomic-weight`:

```
say chemical-element-data('Cl'):weight;

```

```
# 35.45

```

```
say chemical-element-data('Cl'):atomic-weight;

```

```
# 35.45

```

---

## Stoichiometry procedures

The functions `molecular-mass` and `balance-chemical-equation` are based on a parser
for
[Simplified Molecular-Input Line-Entry System (SMILES)](https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system),
[OS1].

### Molecular mass

Molecular mass for a compound:

```
say molecular-mass('SO2');

```

```
# 64.058

```

Molecular masses of the sides of a chemical equation:

```
say molecular-mass('C2H5OH + O2 -> H2O + CO2');

```

```
# 78.06700000000001 => 62.024

```

Note that the masses in the output above are different because the equation is not balanced.

### Equation balancing

For a given chemical equation the function `balance-chemical-equation` returns a list of balanced equations.

```
say balance-chemical-equation('C2H5OH + O2 = H2O + CO2');

```

```
# [1*C2H5OH + 3*O2 -> 2*CO2 + 3*H2O]

```

```
say balance-chemical-equation( 'K4Fe(CN)6 + H2SO4 + H2O = K2SO4 + FeSO4 + (NH4)2SO4 + CO' );

```

```
# [6*H2O + 6*H2SO4 + 1*K4Fe(CN)6 -> 3*(NH4)2SO4 + 6*CO + 1*FeSO4 + 2*K2SO4]

```

**Remark:** The result of the balancing is a list because certain chemical equations
can be balanced in several ways corresponding to different reactions.

---

## Abstract syntax tree

Here is a way to get Abstract Syntax Tree of a (parse-able) molecule formula:

```
my $cf = 'K4Fe(CN)6';
say Chemistry::Stoichiometry::Grammar.parse( $cf );

```

```
# ｢K4Fe(CN)6｣
#  mult-molecule => ｢K4Fe(CN)6｣
#   molecule => ｢K4Fe(CN)6｣
#    sub-molecule => ｢K4｣
#     chemical-element-mult => ｢K4｣
#      chemical-element => ｢K｣
#       K-stoichiometry => ｢K｣
#      number => ｢4｣
#    sub-molecule => ｢Fe｣
#     chemical-element => ｢Fe｣
#      Fe-stoichiometry => ｢Fe｣
#    sub-molecule => ｢(CN)6｣
#     group-mult => ｢(CN)6｣
#      group => ｢(CN)｣
#       molecule => ｢CN｣
#        sub-molecule => ｢C｣
#         chemical-element => ｢C｣
#          C-stoichiometry => ｢C｣
#        sub-molecule => ｢N｣
#         chemical-element => ｢N｣
#          N-stoichiometry => ｢N｣
#      number => ｢6｣

```

---

## TODO

In order of importance, most important are first:

1. TODO Extensive tests:

   * TODO Chemical data retrieval
   * TODO Chemical compound formulae parser
   * TODO Molecular mass calculation
   * TODO Chemical equation balancing
2. DONE Chemical element names translation function.
   (Say, from Bulgarian to Persian.)
3. TODO Inverse look-up from atomic weight to chemical element(s).
4. TODO Extensive documentation.
5. TODO Handling of semicolon separated input.

   * TODO For the data functions. E.g. `atomic-weight('Cl; O; Mn')`.
   * TODO For the parser-interpreter functions. E.g. `molecular-mass('FeSO4; H2O; CO2')`.
6. DONE Parsing of (pre-)balanced chemical equations.
7. TODO Recognition of chemical compound names.

   * This requires the development of a separate chemical entities package.
8. TODO Element data in more languages.

   * DONE Chinese Traditional
   * TODO Chinese Simplified
   * DONE Czech
   * DONE Korean
   * DONE Portuguese (PT)
   * TODO Portuguese (BR)
   * TODO Other

---

## References

[BF1] Brian D. Foy,
[Chemistry::Elements Raku package](https://github.com/briandfoy/perl6-chemistry-elements),
(2016-2018),
[GitHub/briandfoy](https://github.com/briandfoy).

[CJ1] Craig A. James,
[OpenSMILES specification](http://opensmiles.org/opensmiles.html),
(2007-2016),
[OpenSMILES.org](http://opensmiles.org).

[WRI1] Wolfram Research,
[ElementData, Wolfram Language function](https://reference.wolfram.com/language/ref/ElementData.html),
(2007), (updated 2014),
[Wolfram Language System Documentation Center](https://reference.wolfram.com).


## proc.md
class Proc

Running process (filehandle-based interface)

```raku
class Proc {}
```

`Proc` is a representation of an invocation of an external process. It provides access to the input, output and error stream as well as the exit code. It is typically created through the `run` subroutine:

```raku
my $proc = run 'echo', 'Hallo world', :out;
my $captured-output = $proc.out.slurp: :close;
say "Output was $captured-output.raku()";# OUTPUT: «Output was "Hallo world\n"␤»

```

Piping several commands is easy too. To achieve the equivalent of the pipe `echo "Hello, world" | cat -n` in Raku, and capture the output from the second command, you can do

```raku
my $p1 = run 'echo', 'Hello, world', :out;
my $p2 = run 'cat', '-n', :in($p1.out), :out;
say $p2.out.get;

```

You can also feed the `:in` (standard input) pipe directly from your program, by setting it to `True`, which will make the pipe available via `.in` method on the `Proc`:

```raku
my $p = run "cat", "-n", :in, :out;
$p.in.say: "Hello,\nworld!";
$p.in.close;
say $p.out.slurp: :close;
# OUTPUT: «1  Hello,␤
#          2  world!␤»

```

In order to capture the standard error, `:err` can be supplied:

```raku
my $p = run "ls", "-l", ".", "qqrq", :out, :err;
my $captured-output = $p.out.slurp: :close;
my $captured-error  = $p.err.slurp: :close;
my $exit-code       = $p.exitcode;

```

In sink context, a `Proc` will call its `sink` method, throwing an exception if the process has exited with an exit code different from zero:

```raku
shell 'exit 1'
# OUTPUT: «(exit code 1) The spawned command 'exit 1' exited unsuccessfully (exit code: 1)␤»

```

**Note:** Versions of [Rakudo](/language/glossary#Rakudo) older than 2017.04 do not have `.slurp` available on [`IO::Pipe`](/type/IO/Pipe) objects; use [`.slurp-rest`](/routine/slurp-rest) instead.

Use [`Proc::Async`](/type/Proc/Async) for non-blocking operations.

# [Potential Deadlocks](#class_Proc "go to top of document")[§](#Potential_Deadlocks "direct link")

If you run an external program with `:out` and `:err` (so capturing standard output and standard error separately), a deadlock can occur, for example in the following scenario:

* Your Raku script reads from the program's standard output until the End of File (EOF) marker).
* The external program writes to its standard error stream.
* The external program runs into the standard error's buffer limit.
* Your Raku script blocks, waiting for input on the output stream, while the external program blocks until its standard error buffer is being drained.

You can avoid this by using `:merge` to join the external program's standard output and error streams, so that you only need to read from one pipe. This presupposes that you do not need separate access to the two streams. If you do, the only safe approach is to use [`Proc::Async`](/type/Proc/Async).

A similar deadlock can occur when you call an external program with both the `:in` option (to open a pipe to its standard input) and one of the `:out`, `:err` or `:merge` options. In this scenario, it can happen that your Raku script blocks reading from the external program's output while it waits for input, and vice versa.

In this scenario, switching to [`Proc::Async`](/type/Proc/Async) is the most robust solution.

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

## [routine new](#class_Proc "go to top of document")[§](#routine_new "direct link")

```raku
method new(Proc:U:
        :$in = '-',
        :$out = '-',
        :$err = '-',
        Bool :$bin = False,
        Bool :$chomp = True,
        Bool :$merge = False,
        Str:D :$enc = 'UTF-8',
        Str:D :$nl = "\n",
    --> Proc:D)

sub shell(
        $cmd,
        :$in = '-',
        :$out = '-',
        :$err = '-',
        Bool :$bin = False,
        Bool :$chomp = True,
        Bool :$merge = False,
        Str:D :$enc = 'UTF-8',
        Str:D :$nl = "\n",
        :$cwd = $*CWD,
        Hash() :$env = %*ENV
    --> Proc:D)

```

`new` creates a new `Proc` object, whereas `run` or `shell` create one and spawn it with the command and arguments provided in `@args` or `$cmd`, respectively.

`$in`, `$out` and `$err` are the three standard streams of the to-be-launched program, and default to `"-"` meaning they inherit the stream from the parent process. Setting one (or more) of them to `True` makes the stream available as an [`IO::Pipe`](/type/IO/Pipe) object of the same name, like for example `$proc.out`. You can set them to `False` to discard them. Or you can pass an existing [`IO::Handle`](/type/IO/Handle) object (for example [`IO::Pipe`](/type/IO/Pipe)) in, in which case this handle is used for the stream.

Please bear in mind that the process streams reside in process variables, not in the dynamic variables that make them available to our programs. Thus, modifying [the dynamic filehandle variables (such as `$*OUT`)](/language/variables#Special_filehandles:_STDIN,_STDOUT_and_STDERR) inside the host process will have no effect in the spawned process, unlike `$*CWD` and `$*ENV`, whose changes will be actually reflected in it.

```raku
my $p-name = "/tmp/program.raku";
my $program = Q:to/END/;
    #!/usr/bin/env raku

    $*OUT.say( qq/\t$*PROGRAM: This goes to standard output/ );
END

spurt $p-name, $program;

$*OUT.put: "1. standard output before doing anything weird";

{
    temp $*OUT = open '/tmp/out.txt', :w;
    $*OUT.put: "2. temp redefine standard output before this message";
    shell( "raku $p-name" ).so;
}

$*OUT.put: "3. everything should be back to normal";
# OUTPUT
# 1. standard output before doing anything weird
#     /tmp/program.raku: This goes to standard output
# 3. everything should be back to normal

# /tmp/out.txt will contain:
# 2. temp redefine standard output before this message

```

This program shows that the program spawned with `shell` is not using the temporary `$*OUT` value defined in the host process (redirected to `/tmp/out.txt`), but the initial `STDOUT` defined in the process.

`$bin` controls whether the streams are handled as binary (i.e. [`Blob`](/type/Blob) object) or text (i.e. [`Str`](/type/Str) objects). If `$bin` is False, `$enc` holds the character encoding to encode strings sent to the input stream and decode binary data from the output and error streams.

With `$chomp` set to `True`, newlines are stripped from the output and err streams when reading with `lines` or `get`. `$nl` controls what your idea of a newline is.

If `$merge` is set to True, the standard output and error stream end up merged in `$proc.out`.

## [method sink](#class_Proc "go to top of document")[§](#method_sink "direct link")

```raku
method sink(--> Nil)
```

When sunk, the `Proc` object will throw [`X::Proc::Unsuccessful`](/type/X/Proc/Unsuccessful) if the process it ran exited unsuccessfully.

```raku
shell 'ls /qqq';
# OUTPUT:
# (exit code 1) ls: cannot access '/qqq': No such file or directory
# The spawned command 'ls /qqq' exited unsuccessfully (exit code: 2)
#   in block <unit> at /tmp/3169qXElwq line 1
#

```

## [method spawn](#class_Proc "go to top of document")[§](#method_spawn "direct link")

```raku
method spawn(*@args ($, *@), :$cwd = $*CWD, Hash() :$env = %*ENV, :$arg0,
             :$win-verbatim-args = False --> Bool:D)
```

Runs the `Proc` object with the given command, argument list, working directory, and environment.

If `:arg0` is set to a value, that value is passed as arg0 to the process instead of the program name.

On Windows the flag `$win-verbatim-args` disables all automatic quoting of process arguments. See [this blog](https://docs.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way) for more information on windows command quoting. The flag is ignored on all other platforms. The flag was introduced in Rakudo version 2020.06 and is not present in older releases.

## [method shell](#class_Proc "go to top of document")[§](#method_shell "direct link")

```raku
method shell($cmd, :$cwd = $*CWD, :$env --> Bool:D)
```

Runs the `Proc` object with the given command and environment which are passed through to the shell for parsing and execution. See [`shell`](/type/independent-routines#sub_shell) for an explanation of which shells are used by default in the most common operating systems.

## [method command](#class_Proc "go to top of document")[§](#method_command "direct link")

```raku
method command(Proc:D: --> List:D)
```

The command method is an accessor to a list containing the arguments that were passed when the Proc object was executed via `spawn` or `shell` or `run`.

## [method Bool](#class_Proc "go to top of document")[§](#method_Bool "direct link")

```raku
multi method Bool(Proc:D:)
```

Awaits for the process to finish and returns `True` if both exit code and signal of the process were 0, indicating a successful process termination. Returns `False` otherwise.

## [method pid](#class_Proc "go to top of document")[§](#method_pid "direct link")

```raku
method pid()
```

Returns the `PID` value of the process if available, or [`Nil`](/type/Nil).

## [method exitcode](#class_Proc "go to top of document")[§](#method_exitcode "direct link")

```raku
method exitcode(Proc:D: --> Int:D)
```

Returns the exit code of the external process, or -1 if it has not exited yet.

## [method signal](#class_Proc "go to top of document")[§](#method_signal "direct link")

```raku
method signal(Proc:D:)
```

Returns the signal number with which the external process was killed, or `0` or an undefined value otherwise.

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

Type relations for `Proc`

raku-type-graph

Proc
Proc

Any
Any

Proc->Any

Mu
Mu

Any->Mu

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


## dist_cpan-TYIL-Log-Colored.md
## class Log::Colored

An implementation of Log with colors.

### has Positional @!outputs

An array of hashes. Each has must have a handle key, with an IO::Handle to print messages to. A level key with an integer to signify a Log::Level is also required.

### has Supplier $!messages

A supplier to emit messages to.

### multi method emergency

```
multi method emergency(
    Str:D $message
) returns Mu

```

Send an emergency message.

## class Str:D $message

The message to print.

### multi method alert

```
multi method alert(
    Str:D $message
) returns Mu

```

Send an alert message.

## class Str:D $message

The message to print.

### multi method critical

```
multi method critical(
    Str:D $message
) returns Mu

```

Send a critical message.

## class Str:D $message

The message to print.

### multi method error

```
multi method error(
    Str:D $message
) returns Mu

```

Send an error message.

## class Str:D $message

The message to print.

### multi method warning

```
multi method warning(
    Str:D $message
) returns Mu

```

Send a warning message.

## class Str:D $message

The message to print.

### multi method notice

```
multi method notice(
    Str:D $message
) returns Mu

```

Send a notice message. This is the "normal" level to publish log entries on.

## class Str:D $message

The message to print.

### multi method info

```
multi method info(
    Str:D $message
) returns Mu

```

Send an informational message.

## class Str:D $message

The message to print.

### multi method debug

```
multi method debug(
    Str:D $message
) returns Mu

```

Send a debug message.

## class Str:D $message

The message to print.

### multi method add-output

```
multi method add-output(
    IO::Handle:D $handle,
    $level where { ... },
    Callable :$filter
) returns Mu

```

Add an output to the logger.

## class IO::Handle:D $handle

The IO::Handle to write log messages to.

## class $level where { ... }

The log level for this particular stream.

## class Callable :$filter

A filter function to apply to any messages sent to the output.

### method callee

```
method callee(
    Int:D $depth = 4
) returns Str

```

Convenience method to get the callee name. This is the package name if one exists, or the source file name.

## class Int:D $depth = 4

The depth of which to get the callframe.

### method message

```
method message(
    Str:D $message,
    Str:D $color
) returns Str

```

Convenience method for formatting the message as desired.

## class Str:D $message

The original message to be logged.

## class Str:D $color

A human readable identifier for the level.

# NAME

Log::Colored

# VERSION

0.1.1

# AUTHOR

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

# LICENSE

Copyright © 2020

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.