user
Some languages provide the facility to declare functions and subroutines through the use of function prototyping.

Task

Demonstrate the methods available for declaring prototypes within the language. The provided solutions should include:

* An explanation of any placement restrictions for prototype declarations
* A prototype declaration for a function that does not require arguments
* A prototype declaration for a function that requires two arguments
* A prototype declaration for a function that utilizes varargs
* A prototype declaration for a function that utilizes optional arguments
* A prototype declaration for a function that utilizes named parameters
* Example of prototype declarations for subroutines or procedures (if these differ from functions)
* An explanation and example of any special forms of prototyping not covered by the above

Languages that do not provide function prototyping facilities should be omitted from this task.
assistant
(formerly Perl 6)
There is no restriction on placement of prototype declarations. (Actually, we call them "stub declarations".) In fact, stub declarations are rarely needed in Raku because post-declaration of functions is allowed, and normal function declarations do not bend the syntax the way they sometimes do in Perl 5.

Note that the ... in all of these stub bodies is literally part of the declaration syntax.

A prototype declaration for a function that does not require arguments (and returns an Int):

```
sub foo ( --> Int) {...}

```

A prototype declaration for a function that requires two arguments.
Note that we can omit the variable name and just use the sigil in the stub, since we don't need to reference the argument until the actual definition of the routine. Also, unlike in Perl 5, a sigil like @ defaults to binding a single positional argument.

```
sub foo (@, $ --> Int) {...}

```

A prototype declaration for a function that utilizes varargs after one required argument.
Note the "slurpy" star turns the @ sigil into a parameter that accepts all the rest of the positional arguments.

```
sub foo ($, *@ --> Int) {...}

```

A prototype declaration for a function that utilizes optional arguments after one required argument. Optionality is conferred by either a question mark or a default:

```
sub foo ($, $?, $ = 42 --> Int) {...}

```

A prototype declaration for a function that utilizes named parameters:

```
sub foo ($, :$faster, :$cheaper --> Int) {...}

```

Example of prototype declarations for subroutines or procedures, which in Raku is done simply by noting that nothing is returned:

```
sub foo ($, $ --> Nil) {...}

```

A routine may also slurp up all the named arguments that were not bound earlier in the signature:

```
sub foo ($, :$option, *% --> Int) {...}

```

A routine may make a named parameter mandatory using exclamation mark. (This is more useful in multi subs than in stubs though.)

```
sub foo ($, :$option! --> Int) {...}

```

A routine may unpack an Array automaticly. Here the first element is stored in a scalar and the rest in an Array. Other buildin types can be unpacked as well.

```
sub foo ([$, @]) {...}

```

A routine may ask for a closure parameter to implement higher order functions. Typed or untyped signatures can be supplied.

```
sub foo (@, &:(Str --> Int)) {...}

```