<commit_before>=head1 TITLE

List - Perl 6 List class

=head1 DESCRIPTION

This file implements Lists, which are immutable sequences
of objects.  Lists are also lazy, which means that some
items are not generated until they are needed.

=head2 Methods

=over 4

=cut

.namespace ['List']
.sub 'onload' :anon :init :load
    .local pmc p6meta, listproto, pos_role
    p6meta = get_hll_global ['Mu'], '$!P6META'
    
    # Select generic version of Positional (for untyped) and do it.
    # XXX When List becomes a parametric role too, we'd pass in the
    # given T to select below.
    pos_role = get_hll_global 'Positional'
    pos_role = pos_role.'!select'()

    # Create the class.
    listproto = p6meta.'new_class'('List', 'parent'=>'Any', 'attr'=>'$!values $!gen', 'does_role'=>pos_role)
.end

=item Iterator()

=cut

.sub 'Iterator' :method
    .local pmc list_it, index
    list_it = new ['ListIterator']
    index = box 0
    setattribute list_it, '$!list', self
    setattribute list_it, '$!index', index
    .return (list_it)
.end

=item postcircumfix:<[ ]>(Int)

=cut
<commit_msg>Fix List.new(1, 2, 3);<commit_after>=head1 TITLE

List - Perl 6 List class

=head1 DESCRIPTION

This file implements Lists, which are immutable sequences
of objects.  Lists are also lazy, which means that some
items are not generated until they are needed.

=head2 Methods

=over 4

=cut

.namespace ['List']
.sub 'onload' :anon :init :load
    .local pmc p6meta, listproto, pos_role
    p6meta = get_hll_global ['Mu'], '$!P6META'
    
    # Select generic version of Positional (for untyped) and do it.
    # XXX When List becomes a parametric role too, we'd pass in the
    # given T to select below.
    pos_role = get_hll_global 'Positional'
    pos_role = pos_role.'!select'()

    # Create the class.
    listproto = p6meta.'new_class'('List', 'parent'=>'Any', 'attr'=>'$!values $!gen', 'does_role'=>pos_role)
.end

=item new(*@args)

Setup initializers for built in variables.

=cut

.sub 'new' :method
    .param pmc args :slurpy
    .local pmc candidate, attrinit
    candidate = self.'CREATE'('P6opaque')
    attrinit = new ['Hash']
    attrinit['values'] = args
    $P0 = box 0
    attrinit['gen'] = $P0
    .tailcall self.'bless'(candidate, attrinit :flat :named)
.end

=item Iterator()

=cut

.sub 'Iterator' :method
    .local pmc list_it, index
    list_it = new ['ListIterator']
    index = box 0
    setattribute list_it, '$!list', self
    setattribute list_it, '$!index', index
    .return (list_it)
.end

=item postcircumfix:<[ ]>(Int)

=cut

{'fraction_non_alphanumeric': 0.124853228962818, 'fraction_numerical': 0.010567514677103719, 'mean_word_length': 3.5480427046263343, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1963565', 'n_tokens_mistral': 905, 'n_tokens_neox': 878, 'n_words': 299}