Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

biojulep: iterators or fold for structures #57

Open
timholy opened this issue Aug 21, 2024 · 1 comment
Open

biojulep: iterators or fold for structures #57

timholy opened this issue Aug 21, 2024 · 1 comment

Comments

@timholy
Copy link
Contributor

timholy commented Aug 21, 2024

This package has utilities like collectresidues and collectatoms. Because this allocates storage, it might be of interest to implement an alternative. I see two main options:

  • an iterator interface, e.g., EachResidue(struc) or EachAtom(struc). collectresidues could then be implemented as collectresidues(struc) = collect(EachResidue(struc)) but one could also perform other forms of processing (for r in EachResidue(struc) ... end).
  • a transducers interface, where foldxl is the core operation.

I have less personal experience with the latter, so left to my own devices I'd probably be tempted to implement the iterator version. But collectresidues/collectatoms are currently probably special cases of foldxl so generalizing them would be perfectly viable too.

@jgreener64
Copy link
Member

Sounds like a good idea, and I am also more familiar with the iterator interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants