Hacker News new | past | comments | ask | show | jobs | submit login

Does the spec logic typically live inside the modify-inventory function, or elsewhere? If elsewhere, what triggers it before the function is called?



There is very little spec logic. It looks a lot like type declarations in typed languages.

It's usually outside the scope of functions, since you are likely going to want to reuse those declarations. For example, you can use spec to generate test cases for something like quick-check.

You can add pre and post conditions to clojure function's metadata that test wether the spec complies with the function's input/output.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: