What is a Clojure spec?

I could not understand the intentions of clojure . spec

What problems does he solve?

Why should we use it?

+3
source share
2 answers

spec allows you to create specifications for data and functions. Specifications are in their main predicate (based on existing Clojure predicates) and structural, rather than type-based, as you can see in a statically typed language. Based on predicates, you can write specifications that are much more expressive than most type systems and use the same language as your code.

args, args return. (), .

, , :

  • ,
  • "Conform" ,
  • , ( , stdout ).
  • docs
  • ,
  • .
  • spec'ed
  • , .

( , ), ( , , 'ed functions) ( ).

, Clojure .

+24

, " ". ?

+7

Source: https://habr.com/ru/post/1663456/


All Articles