mdbergmann / cl-gserver

Sento - Actor framework featuring actors and agents for easy access to state and asynchronous operations.

Home Page:https://mdbergmann.github.io/cl-gserver/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide pre-configured agent for alists and plists

Ambrevar opened this issue · comments

As for #34, it would make sense to unify the 2 data structure agents considering how similar they are.

But the CL standard uses different APIs for the two: assoc for alists and getf for plists.

If we are going to follow CL, then we can make serarate agents.
If not, we can unify the interfaces. But then, why not unify the plist/alist interface with that of hash-tables?

The agent for those two could be generic. Both functions assoc and getf could be supported depending on whether the user uses the agent for a plist or alist.
I don't actually know, how are values removed from a/plist. Is there something like remhash or even clrhash?

I think an acceptable interface would be to allow agent-assoc and agent-getf with setf but only do a agent-dolist with a lambda where the user can arbitrarily use remf of remove-if, or delete or however we wants to delete or filter entries.

What I mean is that the removal (mostly delete) of entries in at least the alist seems combersome and I thought it should be done by the user that can choose between delete and deletef, etc.
But maybe it should still be considered and pre-configured for a simpler use.

remf could be abstracted to handle plists and alists the same way.

Yeah. I think that would make sense here.