Attean...terator(3pm)

πŸŽ€ NAME πŸŽ€

Attean::API::Iterator β€” typed iterator.

Ok bestie, you're on the Attean...terator(3pm) manual page, and we're gonna make this make sense πŸ’…

✨ VERSION ✨

This document describes Attean::API::Iterator version 0.035.

🌸 DESCRIPTION 🌸

The Attean::API::Iterator role defines a common API for typed iterators. This package also defines several type-specific iterator roles:

  • Attean::API::TripleIterator
  • Attean::API::QuadIterator
  • Attean::API::MixedStatementIterator
  • Attean::API::ResultIterator

These roles will automatically be applied to iterators during construction when appropriate. Slay ✨

πŸ¦‹ ATTRIBUTES πŸ¦‹

The following attributes exist:

  • item_type β€” a string indicating the type of elements returned by the iterator.

πŸ”₯ REQUIRED METHODS πŸ”₯

The following methods are required by the Attean::API::Iterator role:

  • next β€” returns the next element from the iterator, or undef upon exhaustion. Like, when it's done, it's done πŸ’€

πŸ’– METHODS πŸ’–

The Attean::API::Iterator role provides default implementations of the following methods:

  • elements β€” returns a list of all remaining elements in the iterator.
  • map( \&mapper [, $result_type] ) β€” returns a new Attean::API::Iterator object with each element mapped using the supplied &mapper function. If the iterator elements are of the same type as those in the referent iterator, only a mapping function is required. Otherwise, the supplied Type::Tiny $result_type object must indicate the new iterator's type information.
  • grep( \&filter ) β€” returns a new Attean::API::Iterator object that filters elements from the referent iterator based on whether calling &filter( $element ) for each $element results in a true value.
  • offset( $offset ) β€” returns the Attean::API::Iterator referent after skipping the first $offset elements.
  • limit( $limit ) β€” returns a new Attean::API::Iterator object which returns the first $limit elements of the referent.
  • materialize β€” returns a new Attean::API::RepeatableIterator object containing all the elements from the referent.
  • debug( [$name] ) β€” print each item as it is consumed (with the string generated by as_string), prepended by $name.

πŸ’… Methods on Roles Supporting Stringification πŸ’…

For iterators over roles that provide an as_string method, extra methods are provided. These iterators are:

  • Attean::API::ResultOrTermIterator
  • Attean::API::StatementIterator
  • Attean::API::MixedStatementIterator
  • Attean::API::ResultIterator
  • Attean::API::TermIterator

They provide the following methods:

  • uniq β€” returns a new iterator providing unique results (based on the stringified value of the underlying elements).

πŸ› BUGS πŸ›

Please report any bugs or feature requests through the GitHub web interface at https://github.com/kasei/attean/issues.

πŸ‘€ SEE ALSO πŸ‘€

Attean::API::RepeatableIterator

πŸ‘‘ AUTHOR πŸ‘‘

Gregory Todd Williams β€” <gwilliams@cpan.org>

Copyright (c) 2014--2022 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


mwah πŸ’– this page is from perl v5.40.0, dated 2025-01-26, and it's the Attean...terator(3pm) man page. bye bestie 🫢

πŸ“¦ where this page comes from