<commit_before>use v6;

use Test;
plan *;

#?rakudo todo "Z temporarily disabled"
ok eval('<a b> Z <c d>'), 'cross non-meta operator parses';

#?rakudo skip "Z temporarily disabled"
ok <a b> Z <1 2>, <a 1 b 2>, 'non-meta zip produces expected result';

is (1, 2, 3 Z** 2, 4), (1, 16), 'Z** works';

ok eval('<a b> Z, <c d>'), 'zip metaoperator parses';

is (<a b> Z~ <1 2>), <a1 b2>, 'zip-concat produces expected result';

is (1,2 Z* 3,4), (3,8), 'zip-product works';

is (1,2 Zcmp 3,2,0), (-1, 0), 'Xcmp works';

# tests for laziness
is (1..* Z** 1..*).batch(5), (1**1, 2**2, 3**3, 4**4, 5**5), 'zip-power with lazy lists';
is (1..* Z+ 3, 2 ... *).batch(5), (1+3, 2+2, 3+1, 4+0, 5-1), 'zip-plus with lazy lists';

done_testing;

# vim: ft=perl6<commit_msg>[zip-metaop.t] Z+ and ... are non-associative, so use parens to avoid parsefail<commit_after>use v6;

use Test;
plan *;

#?rakudo todo "Z temporarily disabled"
ok eval('<a b> Z <c d>'), 'cross non-meta operator parses';

#?rakudo skip "Z temporarily disabled"
ok <a b> Z <1 2>, <a 1 b 2>, 'non-meta zip produces expected result';

is (1, 2, 3 Z** 2, 4), (1, 16), 'Z** works';

ok eval('<a b> Z, <c d>'), 'zip metaoperator parses';

is (<a b> Z~ <1 2>), <a1 b2>, 'zip-concat produces expected result';

is (1,2 Z* 3,4), (3,8), 'zip-product works';

is (1,2 Zcmp 3,2,0), (-1, 0), 'Xcmp works';

# tests for laziness
is (1..* Z** 1..*).batch(5), (1**1, 2**2, 3**3, 4**4, 5**5), 'zip-power with lazy lists';
is (1..* Z+ (3, 2 ... *)).batch(5), (1+3, 2+2, 3+1, 4+0, 5-1), 'zip-plus with lazy lists';

done_testing;

# vim: ft=perl6
{'fraction_non_alphanumeric': 0.2398989898989899, 'fraction_numerical': 0.07323232323232323, 'mean_word_length': 3.861963190184049, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7027098', 'n_tokens_mistral': 746, 'n_tokens_neox': 689, 'n_words': 251}