Fork me on GitHub
#code-reviews
<
2018-11-17
>
john20:11:26

I'm not as conversant in macros, so it's probably pretty buggy

jaihindhreddy-duplicate21:11:27

@john it seems because you're using a {} to store the impls, when a value satisfies multiple predicates, which one gets dispatched is random, isn't it? How about (def poly-atom (atom (array-map)))? That way we can implement prefer-method? This is first time I've seen predicate dispatch so I have no idea what I'm talking about.

john21:11:27

@jaihindh.reddy I updated the example a bit, to read a bit clearer. Particular polys, like myincs or take-turns are stored as keys in the map. Their predicate implementations are conjed to a vector of vectors which contain pairs of predicates and functions, which apply to the params when the predicate returns true with the params.

john21:11:28

prefer-method enhancement would need to replace the filtering functionality that runs over those pairs

jaihindhreddy-duplicate21:11:35

Oops. The comment cleared it up. Got it.