Fork me on GitHub

I am faced with a design dilemma. I have data structure consisting of deeply nested records which reflect the domain I am working in. Querying this is very straight fwd using specter. But some of these records contain "behaviour" (ie. anonymous functions as values) in the form of validation functions, transformation functions (for how to transform themselves or other records in the structure), dispatch functions(that decides when to dispatch certain messages), conditions etc. I am debating (with myself) two different approaches: Either use multimethods to walk/query the datastructure/trigger behaviour OR use specter for the same task. My primary (perhaps very unfounded) concern with specter is that my structure contains "behaviour". My concern with the multimethod approach is that it will be messy and hard to maintain. Hope my question is even remotely clear, otherwise happy to clarify and context.


@mac I think using specter is fine for that task


you probably want to use traverse with reduce to trigger the nested functions


Thanks, had not noticed traverse, looks very useful.