Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test composition of multi-arg functions
  • Loading branch information
TimToady committed Oct 2, 2015
1 parent 951b577 commit 2d49591
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion S03-operators/composition.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 8;
plan 10;

sub double ($x) { $x * 2 };
sub invert ($x) { 1 / $x };
Expand All @@ -20,3 +20,6 @@ is ((* + 1) o (* * 2))(3), 7, "can use WhateverCodes on both sides";
is (* o (* * 2))(* + 1)(3), 7, "can autocurry with Whatever on left side";
is ((* + 1) o *)(* * 2)(3), 7, "can autocurry with Whatever on right side";
is (* o *)(* + 1, * * 2)(3), 7, "can autocurry with Whatever on both sides";

is ((* + *) o { $_ + 7, $_ * 6 })(5), 42, "can compose functions that pass two arguments";
is ({ [+] @_ } o *.map(* * 2))(1..10), 110, "can compose functions that pass multiple arguments";

0 comments on commit 2d49591

Please sign in to comment.