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::Map - Lazy map on a Seq object

# SYNOPSIS

    # Can use $_ or @_ in sub
    my $mapped = $seq->map(sub{ … });

# DESCRIPTION

This class adapts a given [CInet::Seq](/doc/CInet%3A%3ASeq) object by mapping its elements.
Each element from the source Seq is passed through a coderef and the
return value is returned instead of the original data.

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

## Methods

### new

    my $map = CInet::Seq::Map->new($source, $code);

Constructs a CInet::Seq::Map object which pulls its elements from the
`$source` Seq and transforms them through the `$code` coderef.

The coderef can refer to its argument as either `$_` or via `@_`.

## Implementation of CInet::Seq

### next

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

Pull one element from the source Seq. If the source is exhausted, return
`undef` immediately. Otherwise transform the pulled element and return it.

# 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.