Conditional Independence Net

This website uses Javascript to render markdown documents in your browser, apply syntax highlighting to code fragments and render $\LaTeX$ formulas. Below is the markdown source code of this page. You can either read that or enable Javascript to have it rendered to HTML.

# NAME

CInet::Seq::List - Reified list representation of a Seq

# SYNOPSIS

    my $list = CInet::Seq::List->new(@elts);
    say $list->count, " elements left:";
    while (defined(my $elt = $list->next)) {
        say "got $elt";
    }

# DESCRIPTION

A `CInet::Seq:::List` object represents a Seq with a reified list
of all its values. Whenever an operation cannot be performed lazily
and there is no other efficient overload, the lazy Seq decays into
a Seq::List object, which provides the Seq interface on a complete
in-memory array.

You usually want to avoid creating an instance of this type when
dealing with large amounts of lazily produced data. Methods which
have to reify will indicate this in their documentation.

This class implements the [CInet::Seq](/doc/CInet%3A%3ASeq) role.

## Methods

### new

    my $list = CInet::Seq::List->new(@elts);

Constructs a new CInet::Seq::List object from the given array.

### description

    my $str = $seq->description;

## Implementation of CInet::Seq

### next

    my $elt = $seq->next;
    last if not defined $elt;

Return the next unconsumed element from the backing array or
`undef` if no elements are left.

### count

    my $count = $seq->count;

Return how many elements are left unconsumed in this Seq.
Unlike the default `count` implementation of [CInet::Seq](/doc/CInet%3A%3ASeq),
this method can quickly return the answer without exhausting
all the elements. You can continue iterating where you left
off after calling this method.

# AUTHOR

Tobias Boege <tobs@taboege.de>

# COPYRIGHT AND LICENSE

This software is copyright (C) 2020 by Tobias Boege.

This is free software; you can redistribute it and/or
modify it under the terms of the Artistic License 2.0.