1Attean::API::Iterator(3U)ser Contributed Perl DocumentatiAotntean::API::Iterator(3)
2
3
4

NAME

6       Attean::API::Iterator - Typed iterator
7

VERSION

9       This document describes Attean::API::Iterator version 0.030
10

DESCRIPTION

12       The Attean::API::Iterator role defines a common API for typed
13       iterators.  This package also defines several type-specific iterator
14       roles:
15
16       ·   Attean::API::TripleIterator
17
18       ·   Attean::API::QuadIterator
19
20       ·   Attean::API::MixedStatementIterator
21
22       ·   Attean::API::ResultIterator
23
24       These roles will automatically be applied to iterators during
25       construction when appropriate.
26

ATTRIBUTES

28       The following attributes exist:
29
30       "item_type"
31           A string indicating the type of elements returned by the iterator.
32

REQUIRED METHODS

34       The following methods are required by the Attean::API::Iterator role:
35
36       "next"
37           Returns the next element from the iterator, or "undef" upon
38           exhaustion.
39

METHODS

41       The Attean::API::Iterator role provides default implementations of the
42       following methods:
43
44       "elements"
45           Returns a list of all remaining elements in the iterator.
46
47       "map( \&mapper [, $result_type] )"
48           Returns a new Attean::API::Iterator object with each element mapped
49           using the supplied &mapper function. If the iterator elements are
50           of the same type as those in the referent iterator, only a mapping
51           function is required.  Otherwise, the supplied Type::Tiny
52           $result_type object must indicate the new iterator's type
53           information.
54
55       "grep( \&filter )"
56           Returns a new Attean::API::Iterator object that filters elements
57           from the referent iterator based on whether calling "&filter(
58           $element )" for each $element results in a true value.
59
60       "offset( $offset )"
61           Returns the Attean::API::Iterator referent after skipping the first
62           $offset elements.
63
64       "limit( $limit )"
65           Returns a new Attean::API::Iterator object which returns the first
66           $limit elements of the referent.
67
68       "materialize"
69           Returns a new Attean::API::RepeatableIterator object containing all
70           the elements from the referent.
71
72       "debug( [$name] )"
73           Print each item as it is consumed (with the string generated by
74           "as_string"), prepended by $name.
75
76   Methods on Roles Supporting Stringification
77       For iterators over roles that provide an "as_string" method, extra
78       methods are provided. These iterators are:
79
80       Attean::API::ResultOrTermIterator Attean::API::StatementIterator
81       Attean::API::MixedStatementIterator Attean::API::ResultIterator
82       Attean::API::TermIterator
83
84       They provide the following methods:
85
86       "uniq"
87           Returns a new iterator providing unique results (based on the
88           stringified value of the underlying elements).
89

BUGS

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

SEE ALSO

95       Attean::API::RepeatableIterator
96

AUTHOR

98       Gregory Todd Williams  "<gwilliams@cpan.org>"
99
101       Copyright (c) 2014--2020 Gregory Todd Williams.  This program is free
102       software; you can redistribute it and/or modify it under the same terms
103       as Perl itself.
104
105
106
107perl v5.32.1                      2021-02-08          Attean::API::Iterator(3)
Impressum