Search

PythonReactSEOPDF
GitHub Skill

patternsiterator

Iterator Pattern pattern for C development

mgreenly☆ 1 Repository stars0 Repository forks

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

View source ↗Guides

Skill instructions

Iterator Pattern

Provide sequential access to collection elements without exposing underlying structure. In C, typically a struct with next() function or index-based traversal.

ikigai Application

Scrollback traversal: Iterate visible lines for rendering without exposing ring buffer internals.

Message iteration: Walk session messages for LLM context building.

Implementation options:

// Index-based (simple)
for (size_t i = 0; i < scrollback->count; i++) { ... }

// Iterator struct (encapsulated)
ik_iter_t *iter = ik_scrollback_iter(scrollback);
while (ik_iter_next(iter, &line)) { ... }

Current approach: Index-based iteration is sufficient. Iterator struct adds value when traversal logic is complex or needs to hide internals.

Examples

Read the usage examples in the source repository.

View source ↗

Source history

Indexed on
2026-01-20
Index updated
2026-01-26
Branch
main

Index and sync dates describe this directory. View the source repository for code history.

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!