1Attean::CodeIterator(3)User Contributed Perl DocumentatioAnttean::CodeIterator(3)
2
3
4

NAME

6       Attean::CodeIterator - Iterator implementation backed by a generator
7       function
8

VERSION

10       This document describes Attean::CodeIterator version 0.030
11

SYNOPSIS

13         use v5.14;
14         use Attean;
15         my $iter = Attean::CodeIterator->new(
16           generator => sub {
17             state $value = 0;
18             Attean::Literal->new(++$value)
19           },
20           item_type => 'Attean::API::Term',
21         );
22
23         say $iter->next->value; # 1
24         say $iter->next->value; # 2
25         say $iter->next->value; # 3
26

DESCRIPTION

28       The Attean::CodeIterator class represents a typed iterator.  It
29       conforms to the Attean::API::Iterator role.
30
31       The Attean::CodeIterator constructor requires two named arguments:
32
33       generator
34           A code reference that when called will return either the iterator's
35           next item, or undef upon reaching the end of iteration.
36
37       item_type
38           A Type::Tiny object representing the type of the items that will be
39           returned from the iterator.
40

METHODS

42       "next"
43           Returns the iterator's next item, or undef upon reaching the end of
44           iteration.
45

BUGS

47       Please report any bugs or feature requests to through the GitHub web
48       interface at <https://github.com/kasei/attean/issues>.
49

SEE ALSO

AUTHOR

52       Gregory Todd Williams  "<gwilliams@cpan.org>"
53
55       Copyright (c) 2014--2020 Gregory Todd Williams.  This program is free
56       software; you can redistribute it and/or modify it under the same terms
57       as Perl itself.
58
59
60
61perl v5.34.0                      2021-07-22           Attean::CodeIterator(3)
Impressum