<commit_before>use v6;

use Test;
plan 11;

# L<S03/List infix precedence/the cross operator>
ok eval('<a b> X <c d>'), 'cross non-meta operator parses';

{
    my @result = <a b> X <1 2>;
    is @result, <a 1 a 2 b 1 b 2>,
    'non-meta cross produces expected result';
}

# L<S03/List infix precedence/This becomes a flat list in>
#?rakudo skip 'infix:<X> on ranges'
{
    my @result = gather {
        for @(1..3 X 'a'..'b') -> $n, $a {
            take "$n:$a"
        }
    }
    is @result, <1:a 1:b 2:a 2:b 3:a 3:b>, 'smooth cross operator works';
}

# L<S03/List infix precedence/and a list of arrays in>
#?rakudo skip 'parsefail: @@( ... )'
{
    my @result = gather for @@(1..3 X 'A'..'B') -> $na {
        take $na.join(':');
    }
    is @result, <1:A 1:B 2:A 2:B 3:A 3:B>, 'chunky cross operator works';
}

# L<S03/Cross operators/formed syntactically by placing>
ok eval('<a b> X,X <c d>'), 'cross metaoperator parses';

# L<S03/Cross operators/"string concatenating form is">
{
    my @result = <a b> X~X <1 2>;
    is @result, <a1 a2 b1 b2>,
        'cross-concat produces expected result', :todo<feature>;
}

# L<S03/Cross operators/desugars to something like>
#?rakudo skip 'parsefail: prefix hypers not implemented'
{
    my @result = [~]«( <a b> X,X <1 2> );
    is @result, <a1 a2 b1 b2>,
        'X,X works with hyperconcat', :todo<feature>;
}

# L<S03/Cross operators/list concatenating form when used like this>
{
    my @result = <a b> X,X 1,2 X,X <x y>;
    is @result.elems, 8, 'chained cross-comma produces correct number of elements';

    my @expected = (
        ['a', 1, 'x'],<commit_msg>[rakudo]:  Correct .elems count on list-of-lists in cross-metaop.t<commit_after>use v6;

use Test;
plan 11;

# L<S03/List infix precedence/the cross operator>
ok eval('<a b> X <c d>'), 'cross non-meta operator parses';

{
    my @result = <a b> X <1 2>;
    is @result, <a 1 a 2 b 1 b 2>,
    'non-meta cross produces expected result';
}

# L<S03/List infix precedence/This becomes a flat list in>
#?rakudo skip 'infix:<X> on ranges'
{
    my @result = gather {
        for @(1..3 X 'a'..'b') -> $n, $a {
            take "$n:$a"
        }
    }
    is @result, <1:a 1:b 2:a 2:b 3:a 3:b>, 'smooth cross operator works';
}

# L<S03/List infix precedence/and a list of arrays in>
#?rakudo skip 'parsefail: @@( ... )'
{
    my @result = gather for @@(1..3 X 'A'..'B') -> $na {
        take $na.join(':');
    }
    is @result, <1:A 1:B 2:A 2:B 3:A 3:B>, 'chunky cross operator works';
}

# L<S03/Cross operators/formed syntactically by placing>
ok eval('<a b> X,X <c d>'), 'cross metaoperator parses';

# L<S03/Cross operators/"string concatenating form is">
{
    my @result = <a b> X~X <1 2>;
    is @result, <a1 a2 b1 b2>,
        'cross-concat produces expected result', :todo<feature>;
}

# L<S03/Cross operators/desugars to something like>
#?rakudo skip 'parsefail: prefix hypers not implemented'
{
    my @result = [~]«( <a b> X,X <1 2> );
    is @result, <a1 a2 b1 b2>,
        'X,X works with hyperconcat', :todo<feature>;
}

# L<S03/Cross operators/list concatenating form when used like this>
{
    my @result = <a b> X,X 1,2 X,X <x y>;
    is @result.elems, 24, 'chained cross-comma produces correct number of elements';

    my @expected = (
        ['a', 1, 'x'],
{'fraction_non_alphanumeric': 0.172434729811779, 'fraction_numerical': 0.033697632058287796, 'mean_word_length': 2.8947990543735225, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 61, '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': '7362996', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1267, 'n_words': 430}