user
Partial function application   is the ability to take a function of many
parameters and apply arguments to some of the parameters to create a new
function that needs only the application of the remaining arguments to
produce the equivalent of applying all arguments to the original function.

E.g:

:   Given values `v1, v2`
:   Given `f(param1, param2)`
:   Then `partial(f, param1=v1)` returns `f'(param2)`
:   And `f(param1=v1, param2=v2) == f'(param2=v2)` (for any value v2)

Note that in the partial application of a parameter, (in the above case param1), other parameters are not explicitly mentioned. This is a recurring feature of partial function application.

Task

* Create a function fs( f, s ) that takes a function, f( n ), of one value and a sequence of values s.  
   Function fs should return an ordered sequence of the result of applying function f to every value of s in turn.

* Create function f1 that takes a value and returns it multiplied by 2.
* Create function f2 that takes a value and returns it squared.

* Partially apply f1 to fs to form function fsf1( s )
* Partially apply f2 to fs to form function fsf2( s )

* Test fsf1 and fsf2 by evaluating them with s being the sequence of integers from 0 to 3 inclusive and then the sequence of even integers from 2 to 8 inclusive.

Notes

* In partially applying the functions f1 or f2 to fs, there should be no *explicit* mention of any other parameters to fs, although introspection of fs within the partial applicator to find its parameters *is* allowed.
* This task is more about *how* results are generated rather than just getting results.
assistant
(formerly Perl 6)

**Works with**: rakudo version 2015-09-25

All Code objects have the .assuming method, which partially applies its arguments. For both type safety reasons and parsing sanity reasons we do not believe in implicit partial application by leaving out arguments. Also, people can understand "assuming" without being steeped in FP culture.

```
sub fs ( Code $f, @s ) { @s.map: { .$f } }
 
sub f1 ( $n ) { $n *  2 }
sub f2 ( $n ) { $n ** 2 }
 
my &fsf1 := &fs.assuming(&f1);
my &fsf2 := &fs.assuming(&f2);
 
for [1..3], [2, 4 ... 8] X &fsf1, &fsf2 -> ($s, $f) {
    say $f.($s);
}

```

Output:

```
(2 4 6)
(1 4 9)
(4 8 12 16)
(4 16 36 64)
```

The \*+2 is also a form of partial application in Raku. In this case we partially apply the infix:<+> function with a second argument of 2. That is, the star (known as the "whatever" star) indicates which argument *not* to apply. In contrast to languages that keep some arguments unbound by leaving holes, the explicit star in Raku allows us to avoid syntactic ambiguity in whether to expect a term or an infix operator; such self-clocking code contributes to better error messages when things go wrong.