scad-clj icon indicating copy to clipboard operation
scad-clj copied to clipboard

Use with spec

Open veikman opened this issue 6 years ago • 0 comments

Over in scad-app I’ve run into the problem of how to recognize the intermediate products of scad-clj by their type. I’m currently using seq?. I would like to expand on this. For example, I would like to create Clojure functions that work interchangeably with shapes like (cube 1 2 3) and raw Cartesian coordinates like [0 0], adding translations/transformations to the former while directly replacing the latter using this stuff behind a (spec/conform ...). In general, I would like to be able to use spec/valid? for sanity checks and annotations in all sorts of places as I build upon scad-clj.

Should I be using something other than seq? as a predicate to test for intermediates? Would it be possible to guarantee a more specific spec-able format for all intermediates, or is this considered an unstable implementation detail pending #37?

veikman avatar Feb 23 '19 14:02 veikman