## mu.md
class Mu

The root of the Raku type hierarchy.

```raku
class Mu { }
```

The root of the Raku type hierarchy. For the origin of the name, see [Mu (negative)](https://en.wikipedia.org/wiki/Mu_%28negative%29) on Wikipedia. One can also say that there are many undefined values in Raku, and `Mu` is the *most undefined* value.

Note that most classes do not derive from `Mu` directly, but rather from [`Any`](/type/Any).

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

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

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

Coerces the invocant to a `list` by applying its [`.list`](/routine/list) method and uses [`iterator`](/type/Iterable#method_iterator) on it.

```raku
my $it = Mu.iterator;
say $it.pull-one; # OUTPUT: «(Mu)␤»
say $it.pull-one; # OUTPUT: «IterationEnd␤»
```

## [method defined](#class_Mu "go to top of document")[§](#method_defined "direct link")

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

Returns `False` on a type object, and `True` otherwise.

```raku
say Int.defined;                # OUTPUT: «False␤»
say 42.defined;                 # OUTPUT: «True␤»
```

A few types (like [`Failure`](/type/Failure)) override `defined` to return `False` even for instances:

```raku
sub fails() { fail 'oh noe' };
say fails().defined;            # OUTPUT: «False␤»
```

## [routine defined](#class_Mu "go to top of document")[§](#routine_defined "direct link")

```raku
multi defined(Mu --> Bool:D)
```

invokes the `.defined` method on the object and returns its result.

## [routine isa](#class_Mu "go to top of document")[§](#routine_isa "direct link")

```raku
multi method isa(Mu $type     --> Bool:D)
multi method isa(Str:D $type  --> Bool:D)
```

Returns `True` if the invocant is an instance of class `$type`, a subset type or a derived class (through inheritance) of `$type`. [`does`](/routine/does#(Mu)_routine_does) is similar, but includes roles.

```raku
my $i = 17;
say $i.isa("Int");   # OUTPUT: «True␤»
say $i.isa(Any);     # OUTPUT: «True␤»
role Truish {};
my $but-true = 0 but Truish;
say $but-true.^name;        # OUTPUT: «Int+{Truish}␤»
say $but-true.does(Truish); # OUTPUT: «True␤»
say $but-true.isa(Truish);  # OUTPUT: «False␤»
```

## [routine does](#class_Mu "go to top of document")[§](#routine_does "direct link")

```raku
method does(Mu $type --> Bool:D)
```

Returns `True` if and only if the invocant conforms to type `$type`.

```raku
my $d = Date.new('2016-06-03');
say $d.does(Dateish);             # OUTPUT: «True␤»    (Date does role Dateish)
say $d.does(Any);                 # OUTPUT: «True␤»    (Date is a subclass of Any)
say $d.does(DateTime);            # OUTPUT: «False␤»   (Date is not a subclass of DateTime)

```

Unlike [`isa`](/routine/isa#(Mu)_routine_isa), which returns `True` only for superclasses, `does` includes both superclasses and roles.

```raku
say $d.isa(Dateish); # OUTPUT: «False␤»

```

Using the smartmatch operator [~~](/routine/~~) is a more idiomatic alternative.

```raku
my $d = Date.new('2016-06-03');
say $d ~~ Dateish;                # OUTPUT: «True␤»
say $d ~~ Any;                    # OUTPUT: «True␤»
say $d ~~ DateTime;               # OUTPUT: «False␤»
```

## [routine Bool](#class_Mu "go to top of document")[§](#routine_Bool "direct link")

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

Returns `False` on the type object, and `True` otherwise.

Many built-in types override this to be `False` for empty collections, the empty [string](/type/Str) or numerical zeros

```raku
say Mu.Bool;                    # OUTPUT: «False␤»
say Mu.new.Bool;                # OUTPUT: «True␤»
say [1, 2, 3].Bool;             # OUTPUT: «True␤»
say [].Bool;                    # OUTPUT: «False␤»
say %( hash => 'full' ).Bool;   # OUTPUT: «True␤»
say {}.Bool;                    # OUTPUT: «False␤»
say "".Bool;                    # OUTPUT: «False␤»
say 0.Bool;                     # OUTPUT: «False␤»
say 1.Bool;                     # OUTPUT: «True␤»
say "0".Bool;                   # OUTPUT: «True␤»
```

## [method Capture](#class_Mu "go to top of document")[§](#method_Capture "direct link")

```raku
method Capture(Mu:D: --> Capture:D)
```

Returns a [`Capture`](/type/Capture) with named arguments corresponding to invocant's public attributes:

```raku
class Foo {
    has $.foo = 42;
    has $.bar = 70;
    method bar { 'something else' }
}.new.Capture.say; # OUTPUT: «\(:bar("something else"), :foo(42))␤»
```

## [method Str](#class_Mu "go to top of document")[§](#method_Str "direct link")

```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␤»
```

## [routine gist](#class_Mu "go to top of document")[§](#routine_gist "direct link")

```raku
multi        gist(+args --> Str)
multi method gist(   --> Str)
```

Returns a string representation of the invocant, optimized for fast recognition by humans. As such lists will be truncated at 100 elements. Use `.raku` to get all elements.

The default `gist` method in `Mu` re-dispatches to the [raku](/routine/raku) method for defined invocants, and returns the type name in parenthesis for type object invocants. Many built-in classes override the case of instances to something more specific that may truncate output.

`gist` is the method that [say](/routine/say) calls implicitly, so `say $something` and `say $something.gist` generally produce the same output.

```raku
say Mu.gist;        # OUTPUT: «(Mu)␤»
say Mu.new.gist;    # OUTPUT: «Mu.new␤»
```

## [method perl](#class_Mu "go to top of document")[§](#method_perl "direct link")

```raku
multi method perl(Mu:)
```

Calls [`.raku`](/routine/raku) on the invocant. Since the change of the language name to Raku, this method is deprecated and might disappear in the near future. Use `.raku` instead.

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

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

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

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

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

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

## [method item](#class_Mu "go to top of document")[§](#method_item "direct link")

```raku
method item(Mu \item:) is raw
```

Forces the invocant to be evaluated in item context and returns the value of it.

```raku
say [1,2,3].item.raku;          # OUTPUT: «$[1, 2, 3]␤»
say %( apple => 10 ).item.raku; # OUTPUT: «${:apple(10)}␤»
say "abc".item.raku;            # OUTPUT: «"abc"␤»
```

## [method self](#class_Mu "go to top of document")[§](#method_self "direct link")

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

Returns the object it is called on.

## [method clone](#class_Mu "go to top of document")[§](#method_clone "direct link")

```raku
multi method clone(Mu:U: *%twiddles)
multi method clone(Mu:D: *%twiddles)
```

This method will clone type objects, or die if it's invoked with any argument.

```raku
say Num.clone( :yes )
# OUTPUT: «(exit code 1) Cannot set attribute values when cloning a type object␤  in block <unit>␤␤»

```

If invoked with value objects, it creates a shallow clone of the invocant, including shallow cloning of private attributes. Alternative values for *public* attributes can be provided via named arguments with names matching the attributes' names.

```raku
class Point2D {
    has ($.x, $.y);
    multi method gist(Point2D:D:) {
        "Point($.x, $.y)";
    }
}

my $p = Point2D.new(x => 2, y => 3);

say $p;                     # OUTPUT: «Point(2, 3)␤»
say $p.clone(y => -5);      # OUTPUT: «Point(2, -5)␤»

```

Note that `.clone` does not go the extra mile to shallow-copy `@.` and `%.` sigiled attributes and, if modified, the modifications will still be available in the original object:

```raku
class Foo {
    has $.foo is rw = 42;
    has &.boo is rw = { say "Hi" };
    has @.bar       = <a b>;
    has %.baz       = <a b c d>;
}

my $o1 = Foo.new;
with my $o2 = $o1.clone {
    .foo = 70;
    .bar = <Z Y>;
    .baz = <Z Y X W>;
    .boo = { say "Bye" };
}

# Hash and Array attribute modifications in clone appear in original as well:
say $o1;
# OUTPUT: «Foo.new(foo => 42, bar => ["Z", "Y"], baz => {:X("W"), :Z("Y")}, …␤»
say $o2;
# OUTPUT: «Foo.new(foo => 70, bar => ["Z", "Y"], baz => {:X("W"), :Z("Y")}, …␤»
$o1.boo.(); # OUTPUT: «Hi␤»
$o2.boo.(); # OUTPUT: «Bye␤»

```

To clone those, you could implement your own `.clone` that clones the appropriate attributes and passes the new values to `Mu.clone`, for example, via [`nextwith`](/language/functions#sub_nextwith).

```raku
class Bar {
    has $.quux;
    has @.foo = <a b>;
    has %.bar = <a b c d>;
    method clone { nextwith :foo(@!foo.clone), :bar(%!bar.clone), |%_  }
}

my $o1 = Bar.new( :42quux );
with my $o2 = $o1.clone {
    .foo = <Z Y>;
    .bar = <Z Y X W>;
}

# Hash and Array attribute modifications in clone do not affect original:
say $o1;
# OUTPUT: «Bar.new(quux => 42, foo => ["a", "b"], bar => {:a("b"), :c("d")})␤»
say $o2;
# OUTPUT: «Bar.new(quux => 42, foo => ["Z", "Y"], bar => {:X("W"), :Z("Y")})␤»

```

The `|%_` is needed to slurp the rest of the attributes that would have been copied via shallow copy.

## [method new](#class_Mu "go to top of document")[§](#method_new "direct link")

```raku
multi method new(*%attrinit)
```

Default method for constructing (create + initialize) new objects of a class. This method expects only named arguments which are then used to initialize attributes with accessors of the same name.

Classes may provide their own `new` method to override this default.

`new` triggers an object construction mechanism that calls submethods named `BUILD` in each class of an inheritance hierarchy, if they exist. See [the documentation on object construction](/language/objects#Object_construction) for more information.

## [method bless](#class_Mu "go to top of document")[§](#method_bless "direct link")

```raku
method bless(*%attrinit --> Mu:D)
```

Low-level object construction method, usually called from within `new`, implicitly from the default constructor, or explicitly if you create your own constructor. `bless` creates a new object of the same type as the invocant, using the named arguments to initialize attributes and returns the created object.

It is usually invoked within custom `new` method implementations:

```raku
class Point {
    has $.x;
    has $.y;
    multi method new($x, $y) {
        self.bless(:$x, :$y);
    }
}
my $p = Point.new(-1, 1);

```

In this example we are declaring this `new` method to avoid the extra syntax of using pairs when creating the object. `self.bless` returns the object, which is in turn returned by `new`. `new` is declared as a `multi method` so that we can still use the default constructor like this: `Point.new( x => 3, y => 8 )`.

For more details see [the documentation on object construction](/language/objects#Object_construction).

## [method CREATE](#class_Mu "go to top of document")[§](#method_CREATE "direct link")

```raku
method CREATE(--> Mu:D)
```

Allocates a new object of the same type as the invocant, without initializing any attributes.

```raku
say Mu.CREATE.defined;  # OUTPUT: «True␤»
```

## [method print](#class_Mu "go to top of document")[§](#method_print "direct link")

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

Prints value to `$*OUT` after stringification using `.Str` method without adding a newline at end.

```raku
"abc\n".print;          # OUTPUT: «abc␤»
```

## [method put](#class_Mu "go to top of document")[§](#method_put "direct link")

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

Prints value to `$*OUT`, adding a newline at end, and if necessary, stringifying non-[`Str`](/type/Str) object using the `.Str` method.

```raku
"abc".put;              # OUTPUT: «abc␤»
```

## [method say](#class_Mu "go to top of document")[§](#method_say "direct link")

```raku
multi method say()
```

Will [`say`](/type/IO/Handle#method_say) to [standard output](/language/variables#index-entry-$*OUT).

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

What `say` actually does is, thus, deferred to the actual subclass. In [most cases](/routine/say) it calls [`.gist`](/routine/gist) on the object, returning a compact string representation.

In non-sink context, `say` will always return `True`.

```raku
say (1,[1,2],"foo",Mu).map: so *.say ;
# OUTPUT: «1␤[1 2]␤foo␤(Mu)␤(True True True True)␤»
```

However, this behavior is just conventional and you shouldn't trust it for your code. It's useful, however, to explain certain behaviors.

`say` is first printing out in `*.say`, but the outermost `say` is printing the `True` values returned by the `so` operation.

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

```raku
multi method ACCEPTS(Mu:U: $other)
```

`ACCEPTS` is the method that smartmatching with the [infix ~~](/routine/~~) operator and given/when invokes on the right-hand side (the matcher).

The `Mu:U` multi performs a type check. Returns `True` if `$other` conforms to the invocant (which is always a type object or failure).

```raku
say 42 ~~ Mu;           # OUTPUT: «True␤»
say 42 ~~ Int;          # OUTPUT: «True␤»
say 42 ~~ Str;          # OUTPUT: «False␤»
```

Note that there is no multi for defined invocants; this is to allow autothreading of [junctions](/type/Junction), which happens as a fallback mechanism when no direct candidate is available to dispatch to.

## [method WHICH](#class_Mu "go to top of document")[§](#method_WHICH "direct link")

```raku
multi method WHICH(--> ObjAt:D)
```

Returns an object of type [`ObjAt`](/type/ObjAt) which uniquely identifies the object. Value types override this method which makes sure that two equivalent objects return the same return value from `WHICH`.

```raku
say 42.WHICH eq 42.WHICH;       # OUTPUT: «True␤»
```

## [method WHERE](#class_Mu "go to top of document")[§](#method_WHERE "direct link")

```raku
method WHERE(Mu:)
```

Returns an [`Int`](/type/Int) representing the memory address of the object. Please note that in the Rakudo implementation of Raku, and possibly other implementations, the memory location of an object is **NOT** fixed for the lifetime of the object. So it has limited use for applications, and is intended as a debugging tool only.

## [method WHY](#class_Mu "go to top of document")[§](#method_WHY "direct link")

```raku
multi method WHY(Mu: --> Pod::Block::Declarator)
```

Returns the attached Pod::Block::Declarator.

For instance:

```raku
#| Initiate a specified spell normally
sub cast(Spell $s) {
  do-raw-magic($s);
}
#= (do not use for class 7 spells)
say &cast.WHY;
# OUTPUT: «Initiate a specified spell normally␤(do not use for class 7 spells)␤»

```

See [Pod declarator blocks](/language/pod#Declarator_blocks) for details about attaching Pod to variables, classes, functions, methods, etc.

## [trait is export](#class_Mu "go to top of document")[§](#trait_is_export "direct link")

```raku
multi trait_mod:<is>(Mu:U \type, :$export!)
```

Marks a type as being exported, that is, available to external users.

```raku
my class SomeClass is export { }
```

A user of a module or class automatically gets all the symbols imported that are marked as `is export`.

See [Exporting and Selective Importing Modules](/language/modules#Exporting_and_selective_importing) for more details.

## [method return](#class_Mu "go to top of document")[§](#method_return "direct link")

```raku
method return()
```

The method `return` will stop execution of a subroutine or method, run all relevant [phasers](/language/phasers#Block_phasers) and provide invocant as a return value to the caller. If a return [type constraint](/language/signatures#Constraining_return_types) is provided it will be checked unless the return value is [`Nil`](/type/Nil). A control exception is raised and can be caught with [CONTROL](/language/phasers#CONTROL).

```raku
sub f { (1|2|3).return };
say f(); # OUTPUT: «any(1, 2, 3)␤»
```

## [method return-rw](#class_Mu "go to top of document")[§](#method_return-rw "direct link")

Same as method [`return`](/type/Mu#method_return) except that `return-rw` returns a writable container to the invocant (see more details here: [`return-rw`](/language/control#return-rw)).

## [method emit](#class_Mu "go to top of document")[§](#method_emit "direct link")

```raku
method emit()
```

Emits the invocant into the enclosing [supply](/language/concurrency#index-entry-supply_(on-demand)) or [react](/language/concurrency#react) block.

```raku
react { whenever supply { .emit for "foo", 42, .5 } {
    say "received {.^name} ($_)";
}}

# OUTPUT:
# received Str (foo)
# received Int (42)
# received Rat (0.5)
```

## [method take](#class_Mu "go to top of document")[§](#method_take "direct link")

```raku
method take()
```

Returns the invocant in the enclosing [gather](/language/control#gather/take) block.

```raku
sub insert($sep, +@list) {
    gather for @list {
        FIRST .take, next;
        take slip $sep, .item
    }
}

say insert ':', <a b c>;
# OUTPUT: «(a : b : c)␤»
```

## [routine take](#class_Mu "go to top of document")[§](#routine_take "direct link")

```raku
sub take(\item)
```

Takes the given item and passes it to the enclosing `gather` block.

```raku
#| randomly select numbers for lotto
my $num-selected-numbers = 6;
my $max-lotto-numbers = 49;
gather for ^$num-selected-numbers {
    take (1 .. $max-lotto-numbers).pick(1);
}.say;    # six random values
```

## [routine take-rw](#class_Mu "go to top of document")[§](#routine_take-rw "direct link")

```raku
sub take-rw(\item)
```

Returns the given item to the enclosing `gather` block, without introducing a new container.

```raku
my @a = 1...3;
sub f(@list){ gather for @list { take-rw $_ } };
for f(@a) { $_++ };
say @a;
# OUTPUT: «[2 3 4]␤»
```

## [method so](#class_Mu "go to top of document")[§](#method_so "direct link")

```raku
method so()
```

Evaluates the item in Boolean context (and thus, for instance, collapses Junctions), and returns the result. It is the opposite of `not`, and equivalent to the [`?` operator](/language/operators#prefix_?).

One can use this method similarly to the English sentence: "If that is **so**, then do this thing". For instance,

```raku
my @args = <-a -e -b -v>;
my $verbose-selected = any(@args) eq '-v' | '-V';
if $verbose-selected.so {
    say "Verbose option detected in arguments";
} # OUTPUT: «Verbose option detected in arguments␤»
```

The `$verbose-selected` variable in this case contains a [`Junction`](/type/Junction), whose value is `any(any(False, False), any(False, False), any(False, False), any(True, False))`. That is actually a *truish* value; thus, negating it will yield `False`. The negation of that result will be `True`. `so` is performing all those operations under the hood.

## [method not](#class_Mu "go to top of document")[§](#method_not "direct link")

```raku
method not()
```

Evaluates the item in Boolean context (leading to final evaluation of Junctions, for instance), and negates the result. It is the opposite of `so` and its behavior is equivalent to the [`!` operator](/language/operators#prefix_!).

```raku
my @args = <-a -e -b>;
my $verbose-selected = any(@args) eq '-v' | '-V';
if $verbose-selected.not {
    say "Verbose option not present in arguments";
} # OUTPUT: «Verbose option not present in arguments␤»
```

Since there is also a [prefix version of `not`](/language/operators#prefix_not), this example reads better as:

```raku
my @args = <-a -e -b>;
my $verbose-selected = any(@args) eq '-v' | '-V';
if not $verbose-selected {
    say "Verbose option not present in arguments";
} # OUTPUT: «Verbose option not present in arguments␤»
```

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

Type relations for `Mu`

raku-type-graph

Mu
Mu

Any
Any

Any->Mu

Junction
Junction

Junction->Mu

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


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

# Digests in raku

This is a pure [raku](https://raku.org/) repository implementing some digest
algorithms.

As of today (march 2023), raku still is fairly slow so if you need a faster way
to compute digest, consider using a
[nativecall](https://docs.raku.org/language/nativecall) binding to the OpenSSL
library instead.

## Synopsis

Nb. Since commit 911c292688ad056a98285f7930297c5e1aea3bfb,
there is no `Digest` module anymore, the submodules, `Digest::MD5`, `Digest::SHA1` and
so on must be used directly.

```
use Digest::MD5;
say md5      "hello";
use HMAC;
say hmac
  key => "key",
  msg => "The quick brown fox jumps over the lazy dog",
  hash => &md5,
  block-size => 64;

use Digest::SHA1;
say sha1     "Hola";

use Digest::SHA2;
say sha256   "Привет";

use Digest::RIPEMD;
say rmd160   "Saluton";

use Digest::SHA3;
say sha3_256 "Bonjour";
say shake256 "Merhaba", 16;

# This will keep printing blocks
.say for shake256 "नमस्ते", *;

```

## Features

Currently implemented:

* HMAC
  * hmac
* Digest
  * md5
* Digest::SHA1
  * sha1
* Digest::SHA2
  * sha224
  * sha256
  * sha384
  * sha512
* Digest::SHA3
  * sha3\_224
  * sha3\_256
  * sha3\_384
  * sha3\_512
  * shake128
  * shake256
* Digest::RIPEMD :
  * rmd160

## License

This work is published under the terms of the artistic license, as rakudo is.
See LICENSE file.


## enumhow.md
class Metamodel::EnumHOW

Metaobject representing a Raku enum.

```raku
    class Metamodel::EnumHOW
        does Metamodel::Naming
        does Metamodel::Documenting
        does Metamodel::Stashing
        does Metamodel::AttributeContainer
        does Metamodel::MethodContainer
        does Metamodel::MultiMethodContainer
        does Metamodel::RoleContainer
        does Metamodel::BaseType
        does Metamodel::MROBasedMethodDispatch
        does Metamodel::MROBasedTypeChecking
        does Metamodel::BUILDPLAN
        does Metamodel::BoolificationProtocol
        does Metamodel::REPRComposeProtocol
        does Metamodel::Mixins
            { }

```

*Warning*: this class is part of the Rakudo implementation, and is not a part of the language specification.

`Metamodel::EnumHOW` is the metaclass behind the `enum` keyword.

```raku
enum Numbers <1 2>;
say Numbers.HOW ~~ Metamodel::EnumHOW; # OUTPUT: «True␤»
```

The following enum declaration:

```raku
our Int enum Error <Warning Failure Exception Sorrow Panic>;
```

Is roughly equivalent to this code using `Metamodel::EnumHOW`'s methods:

```raku
BEGIN {
    my constant Error = Metamodel::EnumHOW.new_type: :name<Error>, :base_type(Int);
    Error.^add_role: Enumeration;
    Error.^add_role: NumericEnumeration;
    Error.^compose;
    for <Warning Failure Exception Sorrow Panic>.kv -> Int $v, Str $k {
        # Note: Enumeration.pred and .succ will not work when adding enum
        # values as pairs. They should be instances of the enum itself, but
        # this isn't possible to do without nqp.
        Error.^add_enum_value: $k => $v;
        OUR::{$k} := Error.^enum_from_value: $v;
    }
    Error.^compose_values;
    OUR::<Error> := Error;
}
```

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

## [method new\_type](#class_Metamodel::EnumHOW "go to top of document")[§](#method_new_type "direct link")

```raku
method new_type(:$name!, :$base_type?, :$repr = 'P6opaque', :$is_mixin)
```

Creates a new type object for an enum. `$name` is the enum name, `$base_type` is the type given when the enum is declared using a scoped declaration (if any), and `$repr` is the type representation passed to the enum using the `repr` trait. `$is_mixin` is unused.

## [method add\_parent](#class_Metamodel::EnumHOW "go to top of document")[§](#method_add_parent "direct link")

```raku
method add_parent($obj, $parent)
```

Sets the base type of an enum. This can only be used if no base type was passed to `.new_type`.

## [method set\_export\_callback](#class_Metamodel::EnumHOW "go to top of document")[§](#method_set_export_callback "direct link")

```raku
method set_export_callback($obj, $callback)
```

Sets the enum's export callback, which is invoked when calling `.compose_values`. This is called when applying the `export` trait to an enum. `$callback` should be a routine of some sort, taking no arguments, that handles exporting the enum's values.

## [method export\_callback](#class_Metamodel::EnumHOW "go to top of document")[§](#method_export_callback "direct link")

```raku
method export_callback($obj)
```

Returns the export callback set by `.set_export_callback`.

## [method compose](#class_Metamodel::EnumHOW "go to top of document")[§](#method_compose "direct link")

```raku
method compose($obj, :$compiler_services)
```

Completes a type object for an enum. This is when any roles done by the enum are mixed in. This needs to be called before any enum values can be added using `.add_enum_value`.

## [method is\_composed](#class_Metamodel::EnumHOW "go to top of document")[§](#method_is_composed "direct link")

```raku
method is_composed($obj)
```

Returns 1 if the enum is composed, otherwise returns 0.

## [method compose\_values](#class_Metamodel::EnumHOW "go to top of document")[§](#method_compose_values "direct link")

```raku
method compose_values($obj)
```

Calls the export callback set by `.set_export_callback` and removes it from state. This should be called after adding the enum's values using `.add_enum_value`.

## [method set\_composalizer](#class_Metamodel::EnumHOW "go to top of document")[§](#method_set_composalizer "direct link")

```raku
method set_composalizer($c)
```

Sets the composalizer for an enum, which produces a type that can be mixed in with another. `$c` should be a routine of some that has the following signature:

```raku
:($type, $name, @enum_values)
```

## [method composalizer](#class_Metamodel::EnumHOW "go to top of document")[§](#method_composalizer "direct link")

```raku
method composalizer($obj)
```

Returns the composalizer set by `.set_composalizer`.

## [method add\_enum\_value](#class_Metamodel::EnumHOW "go to top of document")[§](#method_add_enum_value "direct link")

```raku
method add_enum_value($obj, $value)
```

Adds a value to this enum. `$value` should be an instance of the enum itself, as type [`Enumeration`](/type/Enumeration).

## [method enum\_values](#class_Metamodel::EnumHOW "go to top of document")[§](#method_enum_values "direct link")

```raku
method enum_values($obj)
```

Returns the values for the enum.

```raku
enum Numbers <10 20>;
say Numbers.^enum_values;                   # OUTPUT: {10 => 0, 20 => 1}
```

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

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

Returns the number of values.

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

## [method enum\_from\_value](#class_Metamodel::EnumHOW "go to top of document")[§](#method_enum_from_value "direct link")

```raku
method enum_from_value($obj, $value)
```

Given a value of the enum's base type, return the corresponding enum.

```raku
enum Numbers <10 20>;
say Numbers.^enum_from_value(0);            # OUTPUT: 10
```

## [method enum\_value\_list](#class_Metamodel::EnumHOW "go to top of document")[§](#method_enum_value_list "direct link")

```raku
method enum_value_list($obj)
```

Returns a list of the enum values.

```raku
enum Numbers <10 20>;
say Numbers.^enum_value_list;               # OUTPUT: (10 20)
```


## dist_github-nxadm-StrictNamedArguments.md
# StrictNamedArguments

[![Build Status](https://travis-ci.org/nxadm/StrictNamedArguments.svg?branch=master)](https://travis-ci.org/nxadm/StrictNamedArguments)

While Perl 6 is strict on types when one is specified in the parameter
definition, the default behaviour for values for unknown named parameters
in methods (and constructors) is just to ignore them.
With this module, you can let Perl 6 throw an exception when invalid
named parameters are supplied. Let Perl6 watch yours fingers for these typos.

See <https://perl6advent.wordpress.com/2015/12/13/a-new-trait-for-old-methods/>

Usage:

```
use v6;
use StrictNamedArguments;

# Just use the trait 'strict' for methods
class Foo { 	 # your class
    has $.valid; # attribute, used by .new

	# A regular method that expects a named argument:
	# msg => 'some_value'
	# and returns the value in upper case (in this example)
    method shout(:$msg) is strict { $msg.uc }

	# The Perl6 constructor is a regular method and can also
	# me made strict if you provide the method strictly.
	# The syntax of named parameters is a hash to be blessed.
    method new(:$valid) is strict { self.bless(valid => $valid) }
}

```

Example output for $foo.shout( msg\_ => 'some\_value' ) method call:

```
The method shout of Foo received an invalid named parameter(s): msg_
  in method <anon> at /home/claudio/Code/StrictNamedArguments/lib/StrictNamedArguments.pm line 47
  in any enter at gen/moar/m-Metamodel.nqp line 3927
  in block <unit> at t/strict2.t line 19

```


## preserving.md
class Supplier::Preserving

Cached live Supply factory

```raku
class Supplier::Preserving is Supplier { }
```

This is a factory for live [`Supply`](/type/Supply)-type objects, and it provides the mechanism for emitting new values onto the supplies, whereby values are kept when no consumer has tapped into the [`Supply`](/type/Supply). Any tapping will consume the already stored and future values.

Starting a preserving [`Supply`](/type/Supply) and consuming its values after it is `done`:

```raku
my $p = Supplier::Preserving.new;
start for ^3 {
    $p.emit($_);
    LAST {
        say „done after { now - BEGIN now}s“;
        $p.done;
    }
}
sleep 2;
react {
    whenever $p.Supply { $_.say; }
    whenever Promise.in(2) { done }
}
say „also done after { now - BEGIN now }s“
```

Will output:

｢output｣ without highlighting

```

```

done after 0.0638467s
0
1
2
also done after 4.0534119s

```

```

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

## [method new](#class_Supplier::Preserving "go to top of document")[§](#method_new "direct link")

```raku
method new()
```

The [`Supplier`](/type/Supplier) constructor.


## dist_github-ugexe-Grammar-HTTP.md
## Grammar::HTTP

Grammars for parsing HTTP headers, message bodies, and URIs

## Synopsis

```
use Grammar::HTTP;

my $request = "GET / HTTP/1.1\r\nHost: www.raku.org\r\n\r\n";
my $match   = Grammar::HTTP.parse($request);
say $match;

# ｢GET / HTTP/1.1
# Host: www.raku.org
#
#｣
# HTTP-message => ｢GET / HTTP/1.1
# Host: www.raku.org
#
#｣
#  start-line => ｢GET / HTTP/1.1
#｣
#   request-line => ｢GET / HTTP/1.1
#｣
#    method => ｢GET｣
#    request-target => ｢/｣
#    HTTP-version => ｢HTTP/1.1｣
#     HTTP-name => ｢HTTP｣
#     major => ｢1｣
#     minor => ｢1｣
#  header-field => ｢Host: www.raku.org｣
#   name => ｢Host｣
#   value => ｢www.raku.org｣
#    host => ｢www.raku.org｣
#  message-body => ｢｣

```

### Rules

```
token HTTP-start
token HTTP-headers
token HTTP-header
token HTTP-body
token HTTP-message

```

Parsing individual parts of the HTTP message can also be done by using a different rule. The default
`Grammar::HTTP.parse($str)` is really the same as `Grammar::HTTP.parse($str, :rule('HTTP-message')`.
So to parse just the start line you could do:

```
my $string = "GET /http.html HTTP/1.1\r\n";
say Grammar::HTTP.parse($string, :rule<HTTP-start>)'

# ｢GET /http.html HTTP/1.1
# ｣
#  start-line => ｢GET /http.html HTTP/1.1
# ｣
#   request-line => ｢GET /http.html HTTP/1.1
# ｣
#    method => ｢GET｣
#    request-target => ｢/http.html｣
#    HTTP-version => ｢HTTP/1.1｣
#    HTTP-name => ｢HTTP｣
#    major => ｢1｣
#    minor => ｢1｣

```

### Actions

`Grammar::HTTP::Actions` can be used to generate a structured hash from a HTTP response message

```
use Grammar::HTTP::Actions;
use Grammar::HTTP;

my $response = "HTTP/1.1 200 OK\r\n"
    ~ "Allow: GET, HEAD, PUT\r\n"
    ~ "Content-Type: text/html; charset=utf-8\r\n"
    ~ "Transfer-Encoding: chunked, gzip\r\n\r\n";

my $parsed = Grammar::HTTP.parse($response, :actions(Grammar::HTTP::Actions.new));
my %header = $parsed.<HTTP-message>.<header-field>>>.made;
dd %header;

# Hash %header = {
#    :Allow($("GET", "HEAD", "PUT")),
#    :Content-Type($[
#        :type("text"),
#        :subtype("html"),
#        :parameters([ :charset("utf-8") ])
#    ]),
#    :Transfer-Encoding($("chunked", "gzip"))}

```

#### RFCs

[RFC1035](https://www.rfc-editor.org/rfc/rfc1035) Domain Names - Implementation and Specification

[RFC3066](https://www.rfc-editor.org/rfc/rfc3066) Tags for the Identification of Languages

[RFC4234](https://www.rfc-editor.org/rfc/rfc4234) Augmented BNF for Syntax Specifications: ABNF

[RFC5234](https://www.rfc-editor.org/rfc/rfc5234) Augmented BNF for Syntax Specifications: ABNF (replaces 4234)

[RFC7405](https://www.rfc-editor.org/rfc/rfc7405) Case-Sensitive String Support in ABNF

[RFC4647](https://www.rfc-editor.org/rfc/rfc4647) Matching of Language Tags

[RFC5322](https://www.rfc-editor.org/rfc/rfc5322) Internet Message Format

[RFC5646](https://www.rfc-editor.org/rfc/rfc5646) Tags for Identifying Languages

[RFC7230](https://www.rfc-editor.org/rfc/rfc7230) Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing

[RFC7231](https://www.rfc-editor.org/rfc/rfc7231) Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content

[RFC7232](https://www.rfc-editor.org/rfc/rfc7232) Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests

[RFC7233](https://www.rfc-editor.org/rfc/rfc7233) Hypertext Transfer Protocol (HTTP/1.1): Range Requests

[RFC7234](https://www.rfc-editor.org/rfc/rfc7234) Hypertext Transfer Protocol (HTTP/1.1): Caching

[RFC7235](https://www.rfc-editor.org/rfc/rfc7235) Hypertext Transfer Protocol (HTTP/1.1): Authentication


## dist_zef-raku-community-modules-Terminal-Width.md
# NAME

Terminal::Width - Get the current width of the terminal

# SYNOPSIS

```
    use Terminal::Width;

    # Default to 80 characters if we fail to get actual width:
    my $width = terminal-width;

    # Default to 100 characters if we fail to get actual width:
    $width = terminal-width :default<100>;

    # return a Failure if we fail to get actual width:
    $width = terminal-width :default<0>;

```

# DESCRIPTION

This module tries to figure out the current width of the terminal the
program is running in. The module is known to work on Windows 10 command
prompt and Debian flavours of Linux. Untested on other systems, but should also
work on OSX.

# EXPORTED SUBROUTINES

## `terminal-width`

```
    terminal-width (Int :$default = 80 --> Int|Failure)

```

Returns and `Int` representing the character width of the terminal.
Takes one optional named argument `:default` that specifies the width
to use if we fail to determine the actual width (defaults to `80`). If
`:default` is set to `0` the subroutine will return a `Failure` if it
can't determine the width.

# ⚠ SECURITY NOTE

On Windows, this module attempts to run program `mode` and on all other
systems it attempts to run `tput`. A clever attacker can manipulate what
the actual executed program is, resulting in it being executed
with the privileges of your script's user.

# REPOSITORY

Fork this module on GitHub:
<https://github.com/raku-community-modules/Terminal-Width>

# BUGS

To report bugs or request features, please use
<https://github.com/raku-community-modules/Terminal-Width/issues>

# AUTHOR

Zoffix Znet (<http://zoffix.com/>)

# LICENSE

You can use and distribute this module under the terms of the
The Artistic License 2.0. See the `LICENSE` file included in this
distribution for complete details.


## dist_zef-tony-o-envy.md
# envy

A nice utility for managing your dist environments. With this utility you can enable and disable certain module repositories without affecting the system wide repositories. Each repo is self contained and can easily be reset/updated without affecting the system's modules.

## installation

```
$ zef install Envy

```

## usage

If you want to fill up your terminal with message, all of these commands will also take `--debug`, `--info`, `--silent`, `--loglevel=<Int>` flags. `--silent` is only effective in commands where output is not required, `config` and `version` below both ignore this flag.

### zef install ...

To install modules to your named repo, you should use:

```
$ zef install --to='Envy#<name>' [<modules> ...]

```

The `to=` flag will let `zef` know which repository you'd like the module installed with.

### [-e|--enable = False] init [<names> ...]

Allows you to initialize multiple repos for general use and the `-e` flag provides a shortcut for enabling all of the provided repos.

### ls

Displays the repos that are managed by `envy`. A `+<name>` indicates the repo is enabled and a `-` prefix indicates a disabled repo. Typical output:

```
~ envy ls
==> + a1
==> + a2
==> + a3
==> + b1
==> - dev
==> - my-project
==> - test

```

### enable [<names> ...]

Enables the given repos system wide.

### disable [<names> ...]

Disables the given repos system wide.

### destroy [<names> ...]

Disables and then removes that repository from the file system.

### config

Displays the given config without any other marks so it can be piped to a formatter if desired.

### version

Displays the currently running version of envy.

### help [<command>]

Command is optional, displays help for the given command or for envy in general.

## troubleshooting

By default no named repos are initialized or used. When you use Envy this way, it uses the `$*TMPDIR` as a repository. This is effectively a no-op unless you go through the hassle of initializing and installing modules to that directory.


## dist_cpan-BRAKMIC-Verge-RPC-Client.md
# Perl6 Verge Client

This is a client for accessing the Verge [REST API](https://vergecurrency.com/langs/en/#developers)

More info about available API calls can be found [here](https://chainquery.com/bitcoin-api).

## Installation

`zef install .`

## LICENSE

[Artistic License 2.0](https://github.com/brakmic/Perl6-Verge-Client/blob/master/LICENSE)


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

# NAME

URL::Find - find all the URLs in a set of text

# DESCRIPTION

By default it will match domain names that use unicode characters such as http://правительство.рф. To only match ASCII domains use the :ascii option. It will also find URL's that end in one of the restricted characters, so `https://www.google.com,` will pull out `https://www.google.com`. It will find all the URL's in a text by default, or you can specify a maximum number with the :limit option. By default it will only find http, https, ftp, git and ssh schemes, but you can specify `:any<1>` to match any schemes with legal characters.

### sub find-urls

```
sub find-urls(
    Str $string,
    Num :$limit is copy,
    :$ascii,
    :$any
) returns List

```

Accepts a string and returns a list of URL's. Optionally you can specify a limit to the number of URL's returned, or whether you want to only match URL's with ASCII domain names: :ascii<1> Matches only http https ftp git and ssh schemes by default. To match any scheme, use :any<1>

# AUTHOR

Samantha McVey

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

# COPYRIGHT AND LICENSE

Copyright 2016 - 2018 Samantha McVey

Copyright 2024 The Raku Community

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


## dist_cpan-VRURG-Test-Async.md
# NAME

Test::Async - asynchronous, thread-sage testing

# SYNOPSYS

```
use Test::Async;

plan 2, :parallel;
subtest "Async 1" => {
    plan 1;
    pass "a test";
}
subtest "Async 2" => {
    plan 1;
    pass "another test";
}

```

# DESCRIPTION

`Test::Async` provides a framework and a base set of tests tools compatible with the standard Raku `Test` module. But contrary to the standard, `Test::Async` has been developed with two primary goals in mind: concurrency and extensibility.

Here is the key features provided:

* event-driven, threaded, and OO core
* easy development of 3rd party test bundles
* asynchronous and/or random execution of subtests
* support of threaded user code

The SYNOPSYS section provides an example where two subtests would be started in parallel, each in its own thread. This allows to achieve two goals: speed up big test suits by splitting them in smaller chunks; and testing for possible concurrency problems in tested code.

With

```
plan $count, :random;

```

subtests will be executed in random order. In this mode it is possible to catch another class of errors caused by code being dependent on the order execution.

It is also possible to combine both *parallel* and *random* modes of operation.

# READ MORE

[`Test::Async::Manual`](https://github.com/vrurg/raku-Test-Async/blob/v0.0.16/docs/md/Test/Async/Manual.md), [`Test::Async::CookBook`](https://github.com/vrurg/raku-Test-Async/blob/v0.0.16/docs/md/Test/Async/CookBook.md), [`Test::Async`](https://github.com/vrurg/raku-Test-Async/blob/v0.0.16/docs/md/Test/Async.md), [`Test::Async::Base`](https://github.com/vrurg/raku-Test-Async/blob/v0.0.16/docs/md/Test/Async/Base.md)


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

# NAME

JSON::Unmarshal - turn JSON into an Object (the opposite of JSON::Marshal)

# SYNOPSIS

```
use JSON::Unmarshal;

class SomeClass {
    has Str $.string;
    has Int $.int;
}

my $json = '{ "string" : "string", "int" : 42 }';

my SomeClass $object = unmarshal($json, SomeClass);

say $object.string; # -> "string"
say $object.int;    # -> 42

```

# DESCRIPTION

This provides a single exported subroutine to create an object from a JSON representation of an object.

It only initialises the "public" attributes (that is those with accessors created by declaring them with the '.' twigil. Attributes without acccessors are ignored.

## `unmarshal` Routine

`unmarshal` has the following signatures:

* `unmarshal(Str:D $json, Positional $obj, *%)`
* `unmarshal(Str:D $json, Associative $obj, *%)`
* `unmarshal(Str:D $json, Mu $obj, *%)`
* `unmarshal(%json, $obj, *%)`
* `unmarshal(@json, $obj, *%)`

The signatures with associative and positional JSON objects are to be used for pre-parsed JSON data obtained from a different source. For example, this may happen when a framework deserializes it for you.

The following named arguments are supported:

* **`Bool :$opt-in`**

  When falsy then all attributes of a class are deserialized. When *True* then only those marked with `is json` trait provided by `JSON::OptIn` module are taken into account.
* **`Bool :$warn`**

  If set to *True* then the module will warn about some non-critical problems like unsupported named arguments or keys in JSON structure for which there no match attributes were found.
* **`Bool :$die`** or **`Bool :$throw`**

  This is two aliases of the same attribute with meaning, similar to `:warn`, but where otherwise a waning would be issued the module will throw an exception.

## Manual Unmarshalling

It is also possible to use `is unmarshalled-by` trait to control how the value is unmarshalled:

```
use JSON::Unmarshal

class SomeClass {
    has Version $.version is unmarshalled-by(-> $v { Version.new($v) });
}

my $json = '{ "version" : "0.0.1" }';

my SomeClass $object = unmarshal($json, SomeClass);

say $object.version; # -> "v0.0.1"

```

The trait has two variants, one which takes a `Routine` as above, the other a `Str` representing the name of a method that will be called on the type object of the attribute type (such as "new"), both are expected to take the value from the JSON as a single argument.

# COPYRIGHT AND LICENSE

Copyright 2015 - 2017 Tadeusz Sośnierz

Copyright 2022 - 2025 Raku Community

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


## dist_cpan-HANENKAMP-HTTP-Headers.md
# TITLE

HTTP::Headers

# SUBTITLE

Tools for working with HTTP message headers

# SYNOPSIS

```
use HTTP::Headers :standard-names;
my $headers = HTTP::Headers.new;
$headers.Content-Type = 'text/html';
$headers.Content-Type.charset = "UTF-8";
$headers.Content-Length = $content.encode.bytes;

my $CRLF = "\x0d\x0a";
print "200 OK$CRLF;
print $headers.as-string(:eol($CRLF));
print $CRLF;
print $content;

```

# DESCRIPTION

This module provides convenient tools for working with HTTP headers. An emphasis has been placed on making it easy to use in a way that helps catch errors early. It has also been built for extensibility.

# Methods

## method new

```
method new(HTTP::Headers:U: @headers, Bool:D :$quiet = False --> HTTP::Headers:D)
method new(HTTP::Headers:U: %headers, Bool:D :$quiet = False --> HTTP::Headers:D)
method new(HTTP::Headers:U: Bool:D :$quiet = False, *@headers, *%headers --> HTTP::Headers:D)

```

Constructs a new object for working with headers. The `:$quiet` option can be used to suppress all warnings normally generated by this object.

The various `%headers` and `@headers` methods can be used to initialize the object from a list of pairs:

```
my $headers = HTTP::Headers.new:
    ::(Content-Type)   => 'text/html',
    ::(Content-Length) => 42,
    'X-Requested-With' => 'XMLHTTPRequest',
    ;

```

## method headers

```
multi method headers(HTTP::Headers:D: Pair:D @headers)
multi method headers(HTTP::Headers:D: %headers)
multi method headers(HTTP::Headers:D: *@headers, *%headers)

```

Sets all the headers given as pairs or named parameters.

## method header

```
multi method header(HTTP::Headers:D: HTTP::Header::Standard::Name $name --> HTTP::Header) is rw
multi method header(HTTP::Headers:D: Str $name --> HTTP::Header) is rw

```

This method is writable and allows the use of either the values in the `HTTP::Header::Standard::Name` enumeration or string values. In general, you should not use strings when you can use the enumeration in your code. By using the enumeration, you can discover typos at compile time.

```
use HTTP::Headers :standard-names;
$headers.header(Content-MIME-Type); # I forgot it's just Content-Type
# Undeclared name:
#     Content-MIME-Type used at line 1

```

The library will remind you of this best practice if you use a string when you could use an enumeration:

```
$headers.header("Content-Type");
# Calling .header(Content-Type) is preferred to .header("Content-Type") for standard HTTP headers.

```

If you don't want to see these, you can ask the object or the method to be quiet:

```
$headers.header("Content-Type", :quiet);
# OR during construction
my $headers = HTTP::Headers.new(:$quiet);

```

When setting values on a header, you may set either a single or multiples.

```
$headers.header(Content-Length) = 42;
$headers.header(Accept) = "text/html", "text/*", "*/*";
say $headers.as-string;
# Accept: text/html
# Accept: text/*
# Accept: */*
# Content-Length: 42

```

By setting with a comma, you will generate multiple headers.

You may also set headers with <DateTime>, <Instant>, and <Duration> objects and it should do the right thing. For example,

```
$headers.header(Date)        = DateTime.now;
$headers.header(Retry-After) = Duration.new(120);
say $headers.as-string;
# Date: Thu, 14 May 2015 09:48:00 GMT
# Retry-After: 120

```

When you read a header, the value returns is a [HTTP::Header](http::Header) object.

```
my HTTP::Header $ct = $headers.header(Content-Type);
my HTTP::Header $xf = $headers.header("X-Foo-Custom");

```

This object stringifies to the value of the header (with multiple values being joined together using a comma, safe according to RFC). It also provides a bunch of additional tools for working with and manipulating the header. For example:

```
$headers.header(Accept).push: "text/css", "text/js";
$headers.header(Content-Type).charset = "UTF-8";

```

See [HTTP::Header](http::Header) for details.

## method remove-header

```
multi method remove-header(HTTP::Header:D: $name --> HTTP::Header)
multi method remove-header(HTTP::Header:D: *@names --> List)

```

These method will remove headers from the list. The removed [HTTP::Header](http::Header) object is returned.

## method remove-content-headers

```
method remove-content-headers(HTTP::Headers:D: --> List)

```

This method removes all the entity headers:

```
Allow Content-Encoding Content-Language Content-Length
Content-Location Content-MD5 Content-Range Content-Type
Expires Last-Modified

```

as well as any that start with "Content-".

## method clear

```
method clear(HTTP::Headers:D:)

```

This removes all headers.

## method clone

```
method clone(HTTP::Headers:D: --> HTTP::Headers:D)

```

This performs a deep clone of the object.

## method sorted-headers

```
method sorted-headers(HTTP::Headers:D: --> Seq)

```

Returns all [HTTP::Header](http::Header) objcts in a sequence sorted by header name.

## method list

```
method list(HTTP::Headers:D: --> List)

```

This returns all the headers stored in this object, sorted according to the RFC recommendation (general headers first, then request/response headers, then entity/content headers, and finally custom headers).

## method map

```
method map(HTTP::Headers:D: &code --> Seq)

```

Provides a way to iterate over all the headers in the object.

## method as-string

```
method as-string(HTTP::Headers:D: Str:D :$eol = "\n" --> Str)

```

Returns the headers for output using the given line separator. If no line separator is given, "\n" is used.

## method Str

```
multi method Str(:$eol = "\n") returns Str

```

This calls [/method as-string](/method as-string) with the given arguments.

## method for-WAPI

```
method for-WAPI(HTTP::Headers:D: --> List:D)

```

This returns the headers formatted for output from a RakuWAPI application, as an array of Pairs.

# Hash-like Operations

You can also treat [HTTP::Headers](http::Headers) like a hash in some ways. These are **experimental** and might be removed or changed in the future.

## method postcircumfix:<{ }>

```
multi method postcircumfix:<{ }>(HTTP::Headers:D: Str:D $key --> HTTP::Header)
multi method postcircumfix:<{ }>(HTTP::Headers:D: HTTP::Header::Standard::Name:D $key --> HTTP::Header)

```

This may be used to return or assign a head value.

## adverb :delete

This may be used to delete headers.

## adverb :exists

This may be used to check to see if a head is set.

# Convenience Methods

The following methods are provided as a shortcut for [/method header](/method header) and can be used as an accessor or mutator.

```
# General Headers
method Cache-Control is rw
method Connection is rw
method Date is rw
method Pragma is rw
method Trailer is rw
method Transfer-Encoding is rw
method Upgrade is rw
method Via is rw
method Warning is rw

# Request Headers
method Accept is rw
method Accept-Charset is rw
method Accept-Encoding is rw
method Accept-Language is rw
method Authorization is rw
method Expect is rw
method From is rw
method Host is rw
method If-Match is rw
method If-Modified-Since is rw
method If-None-Match is rw
method If-Range is rw
method If-Unmodified-Since is rw
method Max-Forwards is rw
method Proxy-Authorization is rw
method Range is rw
method Referer is rw
method TE is rw
method User-Agent is rw

# Response Headers
method Accept-Ranges is rw
method Age is rw
method ETag is rw
method Location is rw
method Proxy-Authenticate is rw
method Retry-After is rw
method Server is rw
method Vary is rw
method WWW-Authenticate is rw

# Entity Headers
method Allow is rw
method Content-Encoding is rw
method Content-Language is rw
method Content-Length is rw
method Content-Location is rw
method Content-MD5 is rw
method Content-Range is rw
method Content-Type is rw
method Expires is rw
method Last-Modified is rw

```

# Extending HTTP::Headers

It is possible to create a sub-class of [HTTP::Headers](http::Headers) more suited to your application. As a simplistic example, here's a customization that provides two new custom headers named "X-Foo" and "X-Bar" which have a default column setting of 42 when used.

```
class MyApp::CustomHeaders is HTTP::Headers {
    enum MyAppHeader < X-Foo X-Bar >;

    method build-header($name, *@values) {
        if $name ~~ MyAppHeader {
            HTTP::Header::Custom.new(:name($name.Str), :42values);
        }
        else {
            nextsame;
        }
    }

    multi method header(MyAppHeader $name) is rw {
        self.header-proxy($name);
    }

    method X-Foo is rw { self.header(MyAppHeader::X-Foo) }
    method X-Bar is rw { self.header(MyAppHeader::X-Bar) }
}

```

Here is a description of the methods you'll need to consider in doing this.

## method build-header

```
multi method build-header(HTTP::Headers:D: Str:D $name, *@values --> HTTP::Header:D)
multi method build-header(HTTP::Headers:D: HTTP::Header::Standard::Name:D $name, *@values --> HTTP::Header:D)

```

This is a factory method used to decide how to build the headers being stored. Here is the place where you'll want to add custom roles to your headers, instantiate any custom implementations of [HTTP::Header](http::Header), etc.

It is recommended that you define it to build what you need and then use `nextsame` to handle all the remaining cases.

## method header-proxy

```
multi method header-proxy(HTTP::Headers:D: Str:D $name --> HTTP::Header) is rw
multi method header-proxy(HTTP::Headers:D: HTTP::Header::Standard::Name:D $name --> HTTP::Header) is rw

```

This is a handy helper that allows you to easily build your own custom version of [/method header](/method header). It returns a <Proxy> useful for building `is rw` methods similar to those in [HTTP::Headers](http::Headers).

# CAVEATS

This module provides a mutator style that is not considered ideal, possibly even un-Perlish. It pretty much completely overuses <Proxy> objects and such to make mutators that perform complex operations during seemingly straightforward assignment operations. This is probably not wise, but it seemed like a good idea at the time of first writing.

For a detailed write-up of why this is not preferable, see this blog post by Jonathan Worthington: [https://6guts.wordpress.com/2016/11/25/perl-6-is-biased-towards-mutators-being-really-simple-thats-a-good-thing/](Perl 6 is biased towards mutators being really simple. That’s a good thing.)


## trusting.md
role Metamodel::Trusting

Metaobject that supports trust relations between types

```raku
role Metamodel::Trusting is SuperClass { ... }

```

*Warning*: this role is part of the Rakudo implementation, and is not a part of the language specification.

Normally, code in a class or role can only access its own private methods. If another type declares that it trusts that first class, then access to private methods of that second type is possible. `Metamodel::Trusting` implements that aspect of the Raku object system.

```raku
class A {
    my class B {
        trusts A;   # that's where Metamodel::Trusting comes in
        method !private_method() {
            say "Private method in B";
        }
    }
    method build-and-poke {
        # call a private method from B
        # disallowed if A doesn't trust B
        B.new()!B::private_method();
    }
};

A.build-and-poke;   # Private method in B
```

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

## [method add\_trustee](#role_Metamodel::Trusting "go to top of document")[§](#method_add_trustee "direct link")

```raku
method add_trustee($type, Mu $trustee)
```

Trust `$trustee`.

```raku
class A {
    BEGIN A.^add_trustee(B);
    # same as 'trusts B';
}

```

## [method trusts](#role_Metamodel::Trusting "go to top of document")[§](#method_trusts "direct link")

```raku
method trusts($type --> List)
```

Returns a list of types that the invocant trusts.

```raku
class A { trusts Int; };
say .^name for A.^trusts;       # Int
```

## [method is\_trusted](#role_Metamodel::Trusting "go to top of document")[§](#method_is_trusted "direct link")

```raku
method is_trusted($type, $claimant)
```

Returns 1 if `$type` trusts `$claimant`, and 0 otherwise. Types always trust themselves.


## dist_zef-FRITH-Math-Libgsl-BLAS.md
## Chunk 1 of 2
[![Actions Status](https://github.com/frithnanth/raku-Math-Libgsl-BLAS/workflows/test/badge.svg)](https://github.com/frithnanth/raku-Math-Libgsl-BLAS/actions)

# NAME

Math::Libgsl::BLAS - An interface to libgsl, the Gnu Scientific Library - BLAS (Basic Linear Algebra Subprograms).

# SYNOPSIS

```
use Math::Libgsl::Raw::BLAS :ALL;

use Math::Libgsl::BLAS;
use Math::Libgsl::BLAS::Num32;
use Math::Libgsl::BLAS::Complex32;
use Math::Libgsl::BLAS::Complex64;

```

# DESCRIPTION

Math::Libgsl::BLAS is an interface to the BLAS functions of the libgsl, the Gnu Scientific Library

This package provides both the low-level interface to the C library (Raw) and a more comfortable interface layer for the Raku programmer.

Throughout this package I used a naming convention corresponding to that of the C library, stripping the initial `gsl_blas_`.

The functions are divided in three levels:

* Level 1: vector operations
* Level 2: matrix-vector operations
* Level 3: matrix-matrix operations

The names of the functions specify the kind of operation, the matrix type, and the underlying data type. For more information please read the [C Library Documentation](C Library Documentation).

Since the original C library provided functions for four data types, so does this module. The Math::Libgsl::BLAS module provides functions that work on the default data type: num64. The functions working on num32 vector and matrices are in the Math::Libgsl::BLAS::Num32 module; those working on complex64 and complex32 are respectively in the Math::Libgsl::BLAS::Complex64 and Math::Libgsl::BLAS::Complex32 modules.

So for example this code will be executed using num32 data type variables:

```
use Math::Libgsl::Vector::Num32;
use Math::Libgsl::BLAS::Num32;

my $x = Math::Libgsl::Vector::Num32.new: 10;
$x.setall(.1);
my $y = Math::Libgsl::Vector::Num32.new: 10;
$y.setall(.2);
say sdsdot(.3, $x, $y); # output: 0.5

```

Here I'm following the order the functions are listed in the C Library Manual.

## Level 1

### sdsdot(Num() $α, Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y where { $y.vector.size == $x.vector.size } --> Num)

This function computes the sum α + T(x)y, where T(x) is the transpose of x.

### sdot(Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y where { $y.vector.size == $x.vector.size } --> Num)

### dsdot(Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y where { $y.vector.size == $x.vector.size } --> Num)

### ddot(Math::Libgsl::Vector $x, Math::Libgsl::Vector $y where { $y.vector.size == $x.vector.size } --> Num)

### cdotu(Math::Libgsl::Vector::Complex32 $x, Math::Libgsl::Vector::Complex32 $y where { $y.vector.size == $x.vector.size } --> Complex)

### zdotu(Math::Libgsl::Vector::Complex64 $x, Math::Libgsl::Vector::Complex64 $y where { $y.vector.size == $x.vector.size } --> Complex)

These functions compute the scalar product T(x)y.

### cdotc(Math::Libgsl::Vector::Complex32 $x, Math::Libgsl::Vector::Complex32 $y where { $y.vector.size == $x.vector.size } --> Complex)

### zdotc(Math::Libgsl::Vector::Complex64 $x, Math::Libgsl::Vector::Complex64 $y where { $y.vector.size == $x.vector.size } --> Complex)

These functions compute the complex conjugate scalar product H(x)y.

### snrm2(Math::Libgsl::Vector::Num32 $x --> Num)

### dnrm2(Math::Libgsl::Vector $x --> Num)

### scnrm2(Math::Libgsl::Vector::Complex32 $x --> Num)

### dznrm2(Math::Libgsl::Vector::Complex64 $x --> Num)

These functions compute the Euclidean norm ||x||₂.

### sasum(Math::Libgsl::Vector::Num32 $x --> Num)

### dasum(Math::Libgsl::Vector $x --> Num)

### scasum(Math::Libgsl::Vector::Complex32 $x --> Num)

### dzasum(Math::Libgsl::Vector::Complex64 $x --> Num)

These functions compute the absolute sum Σ|xᵢ| of the elements of the vector x (or the sum of the magnitudes of the real and imaginary parts).

### isamax(Math::Libgsl::Vector::Num32 $x --> Int)

### idamax(Math::Libgsl::Vector $x --> Int)

### icamax(Math::Libgsl::Vector::Complex32 $x --> Int)

### izamax(Math::Libgsl::Vector::Complex64 $x --> Int)

These functions return the index of the largest element of the vector x. The largest element is determined by its absolute magnitude for real vectors and by the sum of the magnitudes of the real and imaginary parts Σ|R(xᵢ)| + |I(xᵢ)| for complex vectors. If the largest value occurs several times then the index of the first occurrence is returned.

### sswap(Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y where { $y.vector.size == $x.vector.size } --> Int)

### dswap(Math::Libgsl::Vector $x, Math::Libgsl::Vector $y where { $y.vector.size == $x.vector.size } --> Int)

### cswap(Math::Libgsl::Vector::Complex32 $x, Math::Libgsl::Vector::Complex32 $y where { $y.vector.size == $x.vector.size } --> Int)

### zswap(Math::Libgsl::Vector::Complex64 $x, Math::Libgsl::Vector::Complex64 $y where { $y.vector.size == $x.vector.size } --> Int)

These functions exchange the elements of the vectors. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### scopy(Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y where { $y.vector.size == $x.vector.size } --> Int)

### dcopy(Math::Libgsl::Vector $x, Math::Libgsl::Vector $y where { $y.vector.size == $x.vector.size } --> Int)

### ccopy(Math::Libgsl::Vector::Complex32 $x, Math::Libgsl::Vector::Complex32 $y where { $y.vector.size == $x.vector.size } --> Int)

### zcopy(Math::Libgsl::Vector::Complex64 $x, Math::Libgsl::Vector::Complex64 $y where { $y.vector.size == $x.vector.size } --> Int)

These functions copy the elements of the vector x into the vector y. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### saxpy(Num() $α, Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y where { $y.vector.size == $x.vector.size } --> Int)

### daxpy(Num() $α, Math::Libgsl::Vector $x, Math::Libgsl::Vector $y where { $y.vector.size == $x.vector.size } --> Int)

### caxpy(Complex $α, Math::Libgsl::Vector::Complex32 $x, Math::Libgsl::Vector::Complex32 $y where { $y.vector.size == $x.vector.size } --> Int)

### zaxpy(Complex $α, Math::Libgsl::Vector::Complex64 $x, Math::Libgsl::Vector::Complex64 $y where { $y.vector.size == $x.vector.size } --> Int)

These functions compute the sum y = αx + y. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### sscal(Num() $α, Math::Libgsl::Vector::Num32 $x)

### dscal(Num() $α, Math::Libgsl::Vector $x)

### cscal(Complex $α, Math::Libgsl::Vector::Complex32 $x)

### zscal(Complex $α, Math::Libgsl::Vector::Complex64 $x)

### csscal(Num() $α, Math::Libgsl::Vector::Complex32 $x)

### zdscal(Num() $α, Math::Libgsl::Vector::Complex64 $x)

These functions rescale the vector x by α.

### srotg(Num() $a, Num() $b --> List)

### drotg(Num() $a, Num() $b --> List)

These functions compute a Givens rotation which zeroes the vector (a, b). They return the magnitude of the resulting vector and the coefficients (c, s) which zero the vector (a, b). In case of error a failure object is returned.

### srot(Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y where { $y.vector.size == $x.vector.size }, Num() $c, Num() $s --> Int)

### drot(Math::Libgsl::Vector $x, Math::Libgsl::Vector $y where { $y.vector.size == $x.vector.size }, Num() $c, Num() $s --> Int)

These functions apply a Givens rotation (x ′ , y ′ ) = (cx + sy, −sx + cy) to the vectors x, y. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### srotmg(Num() $d1, Num() $d2, Num() $b1, Num() $b2 --> List)

### drotmg(Num() $d1, Num() $d2, Num() $b1, Num() $b2 --> List)

These functions compute a modified Givens transformation. They return a list of five elements (see the BLAS manual for an explanation). In case of error a failure object is returned.

### srotm(Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y where { $y.vector.size == $x.vector.size }, @param where \*.elems == 5 --> Int)

### drotm(Math::Libgsl::Vector $x, Math::Libgsl::Vector $y where { $y.vector.size == $x.vector.size }, @param where \*.elems == 5 --> Int)

These functions apply a modified Givens transformation. These functions return GSL\_SUCCESS if successful, or one of the error codes (see the gsl-error enum in Math::Libgsl::Constants).

## Level 2

### sgemv(Int $TransA, Num() $α, Math::Libgsl::Matrix::Num32 $A, Math::Libgsl::Vector::Num32 $x, Num() $β, Math::Libgsl::Vector::Num32 $y --> Int)

### dgemv(Int $TransA, Num() $α, Math::Libgsl::Matrix $A, Math::Libgsl::Vector $x, Num() $β, Math::Libgsl::Vector $y --> Int)

### cgemv(Int $TransA, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Vector::Complex32 $x, Complex $β, Math::Libgsl::Vector::Complex32 $y --> Int)

### zgemv(Int $TransA, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Vector::Complex64 $x, Complex $β, Math::Libgsl::Vector::Complex64 $y --> Int)

These functions compute the matrix-vector product and sum y = αop(A)x + βy. "op" can be a no-op, a transpose, or a hermitian transpose (see the cblas-transpose enum in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### strmv(Int $Uplo, Int $TransA, Int $Diag, Math::Libgsl::Matrix::Num32 $A, Math::Libgsl::Vector::Num32 $x --> Int)

### dtrmv(Int $Uplo, Int $TransA, Int $Diag, Math::Libgsl::Matrix $A, Math::Libgsl::Vector $x --> Int)

### ctrmv(Int $Uplo, Int $TransA, Int $Diag, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Vector::Complex32 $x --> Int)

### ztrmv(Int $Uplo, Int $TransA, Int $Diag, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Vector::Complex64 $x --> Int)

These functions compute the matrix-vector product x = op(A)x for the triangular matrix A. "op" can be a no-op, a transpose, or a hermitian transpose (see the cblas-transpose enum in Math::Libgsl::Constants). When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used. If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced (see the cblas-uplo and cblas-diag enums in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### strsv(Int $Uplo, Int $TransA, Int $Diag, Math::Libgsl::Matrix::Num32 $A, Math::Libgsl::Vector::Num32 $x --> Int)

### dtrsv(Int $Uplo, Int $TransA, Int $Diag, Math::Libgsl::Matrix $A, Math::Libgsl::Vector $x --> Int)

### ctrsv(Int $Uplo, Int $TransA, Int $Diag, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Vector::Complex32 $x --> Int)

### ztrsv(Int $Uplo, Int $TransA, Int $Diag, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Vector::Complex64 $x --> Int)

These functions compute inv(op(A))x for x. "op" can be a no-op, a transpose, or a hermitian transpose (see the cblas-transpose enum in Math::Libgsl::Constants). When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used. If Diag is CblasNonUnit then the diagonal of the matrix is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced (see the cblas-uplo and cblas-diag enums in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### ssymv(Int $Uplo, Num() $α, Math::Libgsl::Matrix::Num32 $A, Math::Libgsl::Vector::Num32 $x, Num() $β, Math::Libgsl::Vector::Num32 $y --> Int)

### dsymv(Int $Uplo, Num() $α, Math::Libgsl::Matrix $A, Math::Libgsl::Vector $x, Num() $β, Math::Libgsl::Vector $y --> Int)

These functions compute the matrix-vector product and sum y = αAx + βy for the symmetric matrix A. Since the matrix A is symmetric only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used (see the cblas-uplo enum in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### chemv(Int $Uplo, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Vector::Complex32 $x, Complex $β, Math::Libgsl::Vector::Complex32 $y --> Int)

### zhemv(Int $Uplo, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Vector::Complex64 $x, Complex $β, Math::Libgsl::Vector::Complex64 $y --> Int)

These functions compute the matrix-vector product and sum y = αAx + βy for the hermitian matrix A. Since the matrix A is hermitian only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used (see the cblas-uplo enum in Math::Libgsl::Constants). The imaginary elements of the diagonal are automatically assumed to be zero and are not referenced. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### sger(Num() $α, Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y, Math::Libgsl::Matrix::Num32 $A --> Int)

### dger(Num() $α, Math::Libgsl::Vector $x, Math::Libgsl::Vector $y, Math::Libgsl::Matrix $A --> Int)

### cgeru(Complex $α, Math::Libgsl::Vector::Complex32 $x, Math::Libgsl::Vector::Complex32 $y, Math::Libgsl::Matrix::Complex32 $A --> Int)

### zgeru(Complex $α, Math::Libgsl::Vector::Complex64 $x, Math::Libgsl::Vector::Complex64 $y, Math::Libgsl::Matrix::Complex64 $A --> Int)

These functions compute the rank-1 update A = αxy T + A of the matrix A. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### cgerc(Complex $α, Math::Libgsl::Vector::Complex32 $x, Math::Libgsl::Vector::Complex32 $y, Math::Libgsl::Matrix::Complex32 $A --> Int)

### zgerc(Complex $α, Math::Libgsl::Vector::Complex64 $x, Math::Libgsl::Vector::Complex64 $y, Math::Libgsl::Matrix::Complex64 $A --> Int)

These functions compute the conjugate rank-1 update A = αxH(y) + A of the matrix A. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### ssyr(Int $Uplo, Num() $α, Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Matrix::Num32 $A --> Int)

### dsyr(Int $Uplo, Num() $α, Math::Libgsl::Vector $x, Math::Libgsl::Matrix $A --> Int)

These functions compute the symmetric rank-1 update A = αxT(x) + A of the symmetric matrix A. Since the matrix A is symmetric only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used (see the cblas-uplo enum in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### cher(Int $Uplo, num32 $α, Math::Libgsl::Vector::Complex32 $x, Math::Libgsl::Matrix::Complex32 $A --> Int)

### zher(Int $Uplo, num64 $α, Math::Libgsl::Vector::Complex64 $x, Math::Libgsl::Matrix::Complex64 $A --> Int)

These functions compute the hermitian rank-1 update A = αxx H + A of the hermitian matrix A. Since the matrix A is hermitian only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used (see the cblas-uplo enum in Math::Libgsl::Constants). The imaginary elements of the diagonal are automatically set to zero. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### ssyr2(Int $Uplo, Num() $α, Math::Libgsl::Vector::Num32 $x, Math::Libgsl::Vector::Num32 $y, Math::Libgsl::Matrix::Num32 $A --> Int)

### dsyr2(Int $Uplo, Num() $α, Math::Libgsl::Vector $x, Math::Libgsl::Vector $y, Math::Libgsl::Matrix $A --> Int)

These functions compute the symmetric rank-2 update A = αxT(y) + αyT(x) + A of the symmetric matrix A. Since the matrix A is symmetric only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used (see the cblas-uplo enum in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### cher2(Int $Uplo, Complex $α, Math::Libgsl::Vector::Complex32 $x, Math::Libgsl::Vector::Complex32 $y, Math::Libgsl::Matrix::Complex32 $A --> Int)

### zher2(Int $Uplo, Complex $α, Math::Libgsl::Vector::Complex64 $x, Math::Libgsl::Vector::Complex64 $y, Math::Libgsl::Matrix::Complex64 $A --> Int)

These functions compute the hermitian rank-2 update A = αxH(y) + α \* yH(x) + A of the hermitian matrix A. Since the matrix A is hermitian only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used (see the cblas-uplo enum in Math::Libgsl::Constants). The imaginary elements of the diagonal are automatically set to zero. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

## Level 3

### sgemm(Int $TransA, Int $TransB, Num() $α, Math::Libgsl::Matrix::Num32 $A, Math::Libgsl::Matrix::Num32 $B, Num() $β, Math::Libgsl::Matrix::Num32 $C --> Int)

### dgemm(Int $TransA, Int $TransB, Num() $α, Math::Libgsl::Matrix $A, Math::Libgsl::Matrix $B, Num() $β, Math::Libgsl::Matrix $C --> Int)

### cgemm(Int $TransA, Int $TransB, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Matrix::Complex32 $B, Complex $β, Math::Libgsl::Matrix::Complex32 $C --> Int)

### zgemm(Int $TransA, Int $TransB, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Matrix::Complex64 $B, Complex $β, Math::Libgsl::Matrix::Complex64 $C --> Int)

These functions compute the matrix-matrix product and sum C = αop(A)op(B) + βC where op(A) = A, T(A), H(A) for TransA = CblasNoTrans, CblasTrans, CblasConjTrans and similarly for the parameter TransB (see the cblas-transpose enum in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### ssymm(Int $Side, Int $Uplo, Num() $α, Math::Libgsl::Matrix::Num32 $A, Math::Libgsl::Matrix::Num32 $B, Num() $β, Math::Libgsl::Matrix::Num32 $C --> Int)

### dsymm(Int $Side, Int $Uplo, Num() $α, Math::Libgsl::Matrix $A, Math::Libgsl::Matrix $B, Num() $β, Math::Libgsl::Matrix $C --> Int)

### csymm(Int $Side, Int $Uplo, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Matrix::Complex32 $B, Complex $β, Math::Libgsl::Matrix::Complex32 $C --> Int)

### zsymm(Int $Side, Int $Uplo, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Matrix::Complex64 $B, Complex $β, Math::Libgsl::Matrix::Complex64 $C --> Int)

These functions compute the matrix-matrix product and sum C = αAB + βC for Side is CblasLeft and C = αBA + βC for Side is CblasRight, where the matrix A is symmetric (see the cblas-side enum in Math::Libgsl::Constants). When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used (see the cblas-uplo enum in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### chemm(Int $Side, Int $Uplo, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Matrix::Complex32 $B, Complex $β, Math::Libgsl::Matrix::Complex32 $C --> Int)

### zhemm(Int $Side, Int $Uplo, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Matrix::Complex64 $B, Complex $β, Math::Libgsl::Matrix::Complex64 $C --> Int)

These functions compute the matrix-matrix product and sum C = αAB + βC for Side is CblasLeft and C = αBA + βC for Side is CblasRight, where the matrix A is hermitian (see the cblas-side enum in Math::Libgsl::Constants). When Uplo is CblasUpper then the upper triangle and diagonal of A are used, and when Uplo is CblasLower then the lower triangle and diagonal of A are used (see the cblas-uplo enum in Math::Libgsl::Constants). The imaginary elements of the diagonal are automatically set to zero. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### strmm(Int $Side, Int $Uplo, Int $TransA, Int $Diag, Num() $α, Math::Libgsl::Matrix::Num32 $A, Math::Libgsl::Matrix::Num32 $B --> Int)

### dtrmm(Int $Side, Int $Uplo, Int $TransA, Int $Diag, Num() $α, Math::Libgsl::Matrix $A, Math::Libgsl::Matrix $B --> Int)

### ctrmm(Int $Side, Int $Uplo, Int $TransA, Int $Diag, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Matrix::Complex32 $B --> Int)

### ztrmm(Int $Side, Int $Uplo, Int $TransA, Int $Diag, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Matrix::Complex64 $B --> Int)

These functions compute the matrix-matrix product B = αop(A)B for Side is CblasLeft and B = αBop(A) for Side is CblasRight (see the cblas-side enum in Math::Libgsl::Constants). The matrix A is triangular and op(A) = A, T(A), H(A) for TransA = CblasNoTrans, CblasTrans, CblasConjTrans (see the cblas-transpose enum in Math::Libgsl::Constants). When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used (see the cblas-uplo enum in Math::Libgsl::Constants). If Diag is CblasNonUnit then the diagonal of A is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced (see cblas-diag enums in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### strsm(Int $Side, Int $Uplo, Int $TransA, Int $Diag, Num() $α, Math::Libgsl::Matrix::Num32 $A, Math::Libgsl::Matrix::Num32 $B --> Int)

### dtrsm(Int $Side, Int $Uplo, Int $TransA, Int $Diag, Num() $α, Math::Libgsl::Matrix $A, Math::Libgsl::Matrix $B --> Int)

### ctrsm(Int $Side, Int $Uplo, Int $TransA, Int $Diag, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Matrix::Complex32 $B --> Int)

### ztrsm(Int $Side, Int $Uplo, Int $TransA, Int $Diag, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Matrix::Complex64 $B --> Int)

These functions compute the inverse-matrix matrix product B = αop(inv(A))B for Side is CblasLeft and B = αBop(inv(A)) for Side is CblasRight (see the cblas-side enum in Math::Libgsl::Constants). The matrix A is triangular and op(A) = A, T(A), H(A) for TransA = CblasNoTrans, CblasTrans, CblasConjTrans (see the cblas-transpose enum in Math::Libgsl::Constants). When Uplo is CblasUpper then the upper triangle of A is used, and when Uplo is CblasLower then the lower triangle of A is used (see the cblas-uplo enum in Math::Libgsl::Constants). If Diag is CblasNonUnit then the diagonal of A is used, but if Diag is CblasUnit then the diagonal elements of the matrix A are taken as unity and are not referenced (see cblas-diag enums in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### ssyrk(Int $Uplo, Int $TransA, Num() $α, Math::Libgsl::Matrix::Num32 $A, Num() $β, Math::Libgsl::Matrix::Num32 $C --> Int)

### dsyrk(Int $Uplo, Int $TransA, Num() $α, Math::Libgsl::Matrix $A, Num() $β, Math::Libgsl::Matrix $C --> Int)

### csyrk(Int $Uplo, Int $TransA, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Complex $β, Math::Libgsl::Matrix::Complex32 $C --> Int)

### zsyrk(Int $Uplo, Int $TransA, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Complex $β, Math::Libgsl::Matrix::Complex64 $C --> Int)

These functions compute a rank-k update of the symmetric matrix C, C = αAT(A) + βC when Trans is CblasNoTrans and C = αT(A)A + βC when Trans is CblasTrans (see the cblas-transpose enum in Math::Libgsl::Constants). Since the matrix C is symmetric only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of C are used, and when Uplo is CblasLower then the lower triangle and diagonal of C are used (see the cblas-uplo enum in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### cherk(Int $Uplo, Int $TransA, num32 $α, Math::Libgsl::Matrix::Complex32 $A, num32 $β, Math::Libgsl::Matrix::Complex32 $C --> Int)

### zherk(Int $Uplo, Int $TransA, num64 $α, Math::Libgsl::Matrix::Complex64 $A, num64 $β, Math::Libgsl::Matrix::Complex64 $C --> Int)

These functions compute a rank-k update of the hermitian matrix C, C = αAH(A) + βC when Trans is CblasNoTrans and C = αH(A)A + βC when Trans is CblasConjTrans (see the cblas-transpose enum in Math::Libgsl::Constants). Since the matrix C is hermitian only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of C are used, and when Uplo is CblasLower then the lower triangle and diagonal of C are used (see the cblas-uplo enum in Math::Libgsl::Constants). The imaginary elements of the diagonal are automatically set to zero. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### ssyr2k(Int $Uplo, Int $TransA, Num() $α, Math::Libgsl::Matrix::Num32 $A, Math::Libgsl::Matrix::Num32 $B, Num() $β,


## dist_zef-FRITH-Math-Libgsl-BLAS.md
## Chunk 2 of 2
 Math::Libgsl::Matrix::Num32 $C --> Int)

### dsyr2k(Int $Uplo, Int $TransA, Num() $α, Math::Libgsl::Matrix $A, Math::Libgsl::Matrix $B, Num() $β, Math::Libgsl::Matrix $C --> Int)

### csyr2k(Int $Uplo, Int $TransA, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Matrix::Complex32 $B, Complex $β, Math::Libgsl::Matrix::Complex32 $C --> Int)

### zsyr2k(Int $Uplo, Int $TransA, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Matrix::Complex64 $B, Complex $β, Math::Libgsl::Matrix::Complex64 $C --> Int)

These functions compute a rank-2k update of the symmetric matrix C, C = αAT(B) + αBT(A) + βC when Trans is CblasNoTrans and C = αT(A)B + αT(B)A + βC when Trans is CblasTrans (see the cblas-transpose enum in Math::Libgsl::Constants). Since the matrix C is symmetric only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of C are used, and when Uplo is CblasLower then the lower triangle and diagonal of C are used (see the cblas-uplo enum in Math::Libgsl::Constants). These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

### cher2k(Int $Uplo, Int $TransA, Complex $α, Math::Libgsl::Matrix::Complex32 $A, Math::Libgsl::Matrix::Complex32 $B, num32 $β, Math::Libgsl::Matrix::Complex32 $C --> Int)

### zher2k(Int $Uplo, Int $TransA, Complex $α, Math::Libgsl::Matrix::Complex64 $A, Math::Libgsl::Matrix::Complex64 $B, num64 $β, Math::Libgsl::Matrix::Complex64 $C --> Int)

These functions compute a rank-2k update of the hermitian matrix C, C = αAH(B) + conj(α)BH(A) + βC when Trans is CblasNoTrans and C = αH(A)B + conj(α)H(B)A + βC when Trans is CblasConjTrans (see the cblas-transpose enum in Math::Libgsl::Constants). Since the matrix C is hermitian only its upper half or lower half need to be stored. When Uplo is CblasUpper then the upper triangle and diagonal of C are used, and when Uplo is CblasLower then the lower triangle and diagonal of C are used (see the cblas-uplo enum in Math::Libgsl::Constants). The imaginary elements of the diagonal are automatically set to zero. These functions return GSL\_SUCCESS if successful, or one of the error codes listed in Math::Libgsl::Constants::gsl-error.

# C Library Documentation

For more details on libgsl see <https://www.gnu.org/software/gsl/>.

The excellent C Library manual is available here <https://www.gnu.org/software/gsl/doc/html/index.html>, or here <https://www.gnu.org/software/gsl/doc/latex/gsl-ref.pdf> in PDF format.

The BLAS C Library manual is available here <https://software.intel.com/en-us/mkl-developer-reference-c-blas-routines> and here <http://netlib.org/blas/#_level_1>.

# Prerequisites

This module requires the libgsl library to be installed. Please follow the instructions below based on your platform:

## Debian Linux

```
sudo apt install libgsl23 libgsl-dev libgslcblas0

```

That command will install libgslcblas0 as well, since it's used by the GSL.

## Ubuntu 18.04 and Ubuntu 20.04+

libgsl23 and libgslcblas0 have a missing symbol on Ubuntu 18.04. I solved the issue installing the Debian Buster version of those three libraries:

* <http://http.us.debian.org/debian/pool/main/g/gsl/libgslcblas0_2.5+dfsg-6_amd64.deb>
* <http://http.us.debian.org/debian/pool/main/g/gsl/libgsl23_2.5+dfsg-6_amd64.deb>
* <http://http.us.debian.org/debian/pool/main/g/gsl/libgsl-dev_2.5+dfsg-6_amd64.deb>

# Installation

To install it using zef (a module management tool):

```
$ zef install Math::Libgsl::BLAS

```

# AUTHOR

Fernando Santagata [nando.santagata@gmail.com](mailto:nando.santagata@gmail.com)

# COPYRIGHT AND LICENSE

Copyright 2020 Fernando Santagata

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


## trim-leading.md
trim-leading

Combined from primary sources listed below.

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

See primary documentation
[in context](/type/Allomorph#method_trim-leading)
for **method trim-leading**.

```raku
method trim-leading(Allomorph:D:)
```

Calls [`Str.trim-leading`](/type/Str#method_trim-leading) on the invocant's [`Str`](/type/Str) value.

# [In Str](#___top "go to top of document")[§](#(Str)_method_trim-leading "direct link")

See primary documentation
[in context](/type/Str#method_trim-leading)
for **method trim-leading**.

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

Removes the whitespace characters from the beginning of a string. See also [trim](/routine/trim).

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

See primary documentation
[in context](/type/Cool#routine_trim-leading)
for **routine trim-leading**.

```raku
sub trim-leading(Str(Cool))
method trim-leading()
```

Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns the string with leading whitespace stripped.

```raku
my $stripped = '  abc '.trim-leading;
say "<$stripped>";          # OUTPUT: «<abc >␤»
```


## dist_cpan-HOLLI-Color-Scheme.md
# NAME

Color::Scheme - Generate color schemes from a base color

# SYNOPSIS

```
use Color::Scheme;

my $color   = Color.new( "#1A3CFA" );

# this is the sugar
my @palette = color-scheme( $color, 'six-tone-ccw' );

# for this
my @palette = color-scheme( $color, color-scheme-angles<six-tone-ccw> );

# debug flag, to visually inspect the colors
# creates "colors.html" in the current directory
my @palette = color-scheme( $color, 'triadic', :debug );

```

# DESCRIPTION

With Color::Scheme you can create schemes/palettes of colors that work well together.

You pick a base color and one of sixteen schemes and the module will generate a list of colors that harmonize. How many colors depends on the scheme.

There are 16 schemes available:

* split-complementary (3 colors)
* split-complementary-cw (3 colors)
* split-complementary-ccw (3 colors)
* triadic (3 colors)
* clash (3 colors)
* tetradic (4 colors)
* four-tone-cw (4 colors)
* four-tone-ccw (4 colors)
* five-tone-a (5 colors)
* five-tone-b (5 colors)
* five-tone-cs (5 colors)
* five-tone-ds (5 colors)
* five-tone-es (5 colors)
* analogous (6 colors)
* neutral (6 colors)
* six-tone-ccw (6 colors)
* six-tone-cw (6 colors)

Those schemes are just lists of angles in a hash ( `Color::Scheme::color-scheme-angles`).

You can use the second form of the color-scheme sub to pass in your own angles if you have to.

# AUTHOR

```
holli.holzer@gmail.com

```

# COPYRIGHT AND LICENSE

BSD-3 License (see LICENSE file)

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.