Attean...erator(3pm)

🌸 NAME 🌸

okay so this page (Attean...erator(3pm)) is from the User Contributed Perl Documentation shelf, and it’s all about Attean::CodeIterator, bestie β€” an iterator implementation backed by a generator function. Iconic behavior, no cap. πŸ’…

✨ VERSION ✨

This document describes Attean::CodeIterator version 0.035, periodt. πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

use v5.14;
use Attean;
my $iter = Attean::CodeIterator->new(
  generator => sub {
    state $value = 0;
    Attean::Literal->new(++$value)
  },
  item_type => 'Attean::API::Term',
);

say $iter->next->value; # 1
say $iter->next->value; # 2
say $iter->next->value; # 3

πŸŽ€ DESCRIPTION πŸŽ€

The Attean::CodeIterator class represents a typed iterator. It conforms to the Attean::API::Iterator role. That’s the whole vibe check: typed iterator, correct role, slay. ✨

The Attean::CodeIterator constructor requires two named arguments, and yes, both are required β€” not me being dramatic, that’s literally the deal:

  • generator β€” a code reference that, when called, returns either the iterator’s next item or undef upon reaching the end of iteration. It’s giving β€œmain character energy” but for yielding values. 🫢
  • item_type β€” a Type::Tiny object representing the type of the items that will be returned from the iterator. Very type-safe, very demure. πŸ’œ

πŸ’… METHODS πŸ’…

  • next β€” returns the iterator’s next item, or undef upon reaching the end of iteration. Simple, iconic, ate. πŸ”₯

πŸ’€ BUGS πŸ’€

Please report any bugs or feature requests through the GitHub web interface at <https://github.com/kasei/attean/issues>. Don’t suffer in silence, bestie β€” tell the maintainers. πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€

This section is a whole empty vibe β€” there are no cross-references listed here, bestie. Nothing to click, nothing to chase. πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

Gregory Todd Williams <gwilliams@cpan.org> β€” the person behind this masterpiece. Respect the author, fr fr. 🌈

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. Periodt. πŸŽ€


byeee from perl v5.40.0, dated 2025-01-26, page Attean...erator(3pm) β€” stay typed, stay iconic, and may your iterator always know when to return undef πŸ’–βœ¨

πŸ“¦ where this page comes from