use Test;
# SIMD vectorized (compiler hintend parallel) operations using "»" and "«" operators
# see https://docs.raku.org/syntax/%3C%3C
# direction of » indicates if vector gets cycled
say "no cycling";
ok (1..3) »+« (1..3) ~~ <2 4 6>, "addition";
ok (1..3) »~« ('a'..'c') ~~ <1a 2b 3c>, "concat";
ok ('a'..'c' »=>« 1..3) ~~ ('a' => 1, 'b' => 2, 'c' => 3), "pairs, or any other operation";
dies-ok { (1..3) »+« (1..2) }, "RHS too short";
say "only RHS cycled";
ok (1..5) »~» <a b> ~~ <1a 2b 3a 4b 5a>;
ok (1..5) »%%» 3 ~~ <False False True False False>;
say "LHS and RHS cycled";
ok (1..3,'a'..'d') «~» (<a b>, 7..19) ~~ (<1a 2b 3a>, <a7 b8 c9 d10 a11 b12 c13 d14 a15 b16 c17 d18 a19>);
say "working also on single list-like object";
my @a = 1, 2, 3;
@a»++;
ok @a ~~ <2 3 4>, "same as: @a »+» 1, but in-place";
say "you can apply custom functions";
ok (1..3, -2..5)».&{ .abs + 1 } ~~ (2..4, <3 2 1 2 3 4 5 6>);