leftiness / hex_math

MIT License
4 stars 1 forks source link

Issue #78: Implemented Predicate to extract logic #82

Closed leftiness closed 7 years ago

leftiness commented 7 years ago

There. Now the generic line function doesn't handle details like range or walls.

He can accept an arbitrary amount of conditions by creating a nested tuple Predicate: (pred, (pred, (pred, pred))). Maybe I'd implement more tuple-to-predicate conversions if I was using that, but we don't have variadics in Rust, so nested tuples might be the lesser of two evils.

The point is that he could even be used with more predicates in the future (like wall strength) without adding any more code, and I've done this while shrinking the function body.

That's a refactor success imo.