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.
This package has utilities like
collectresidues
andcollectatoms
. Because this allocates storage, it might be of interest to implement an alternative. I see two main options:EachResidue(struc)
orEachAtom(struc)
.collectresidues
could then be implemented ascollectresidues(struc) = collect(EachResidue(struc))
but one could also perform other forms of processing (for r in EachResidue(struc) ... end
).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 offoldxl
so generalizing them would be perfectly viable too.