clojure.spec Questions
2
Solved
I've recently been trying out Clojure Spec and ran into an unexpected error message. I've figured out that if you have a spec/or nested in a spec/and then the spec functions, after the spec/or bran...
Headliner asked 24/6, 2018 at 8:0
1
Solved
Let's say we have API to save different type of files' attributes into DB*: text, images, audio and video files. It should be able to get the following fields based on their type:
base properties f...
Alloy asked 25/4, 2020 at 15:28
4
I used the last days to dig deeper into clojure.spec in Clojure and ClojureScript.
Until now I find it most useful, to use specs as guards in :pre and :post in public functions that rely on data i...
Mohican asked 17/6, 2016 at 15:43
2
Solved
Can you explain with examples how does retag parameter impacts multi-spec creation? I find multi-spec documentation hard to digest.
Delora asked 29/7, 2017 at 22:11
3
I wonder how I would spec a function, that has a parameter, that hold a map in an atom.
(defn do-something [a]
(prn (vals @a)))
This those obviously not work:
(s/fdef do-something
:args (s/ca...
Centralia asked 22/6, 2016 at 15:14
1
Other languages have property based testing libraries, like Haskell QuickCheck. How does Clojure spec differ from such libraries? Or is it just a property based testing framework for Clojure?
Ignace asked 18/10, 2017 at 21:36
1
In my Clojure project, I am using Clojure Spec but If I need to use some lib like compojure-api then I need to use Schema.
What is the advantage one over the others?
Why would I consider one ove...
Vietnamese asked 5/10, 2017 at 8:58
1
Solved
(s/def ::users (s/coll-of ::user :distinct true))
The spec above requires each user map to be distinct but How can I specify it to check for distinct :user/ids only
The collection bellow shouldn...
Entirety asked 9/9, 2017 at 21:6
1
Solved
One of the examples in the clojure.spec Guide is a simple option-parsing spec:
(require '[clojure.spec :as s])
(s/def ::config
(s/* (s/cat :prop string?
:val (s/alt :s string? :b boolean?))))
(...
Mantling asked 25/6, 2016 at 3:27
1
Solved
I am using Clojure spec to spec a simple data structure:
{:max 10
:data [[3 8 1]
[9 0 1]]}
The :data value is a vector of equal-size vectors of integers in the interval from zero to the :max v...
Aman asked 11/5, 2017 at 15:42
2
I am trying to learn clojure.spec. While setting up a clojure project along boot build tool I am getting following error while requiring the clojure.spec.alpha.
Compiling ClojureScript...
• js/app...
Comet asked 7/5, 2017 at 9:25
1
Solved
Lets look at the real-world example of Leiningen project maps :global-vars:
;; Sets the values of global vars within Clojure. This example
;; disables all pre- and post-conditions and emits warn...
Antibaryon asked 17/4, 2017 at 14:50
3
Solved
The following clojure spec ::my permits maps having either the key :width or the key :height, however it does not permit having both of them:
(s/def ::width int?)
(s/def ::height int?)
(defn one...
Wearproof asked 27/1, 2017 at 17:16
2
Solved
I came across Generative Testing in Clojure with spec notion and would like to learn about it.
Also providing some examples would be very useful.
Osman asked 11/4, 2017 at 14:14
1
Solved
With clojure.spec, is there a way to define a more “human-readable” spec for nested maps? The following doesn't read very well:
(s/def ::my-domain-entity (s/keys :req-un [:a :b])
(s/def :a (s/keys...
Disc asked 20/2, 2017 at 13:52
3
I haven't found any example of how to do a recursive entity spec like I'm attempting below. I realize that the ::left and ::right are failing because they aren't defined yet, so I'm wondering how I...
Phillida asked 15/2, 2017 at 23:5
1
Solved
Is there a less verbose way of making a spec for a map or a record than the way it is presented in the official spec guide?
(defrecord Person [first-name last-name email phone])
(s/def ::first-nam...
Unreasoning asked 5/2, 2017 at 16:46
1
I have a DSL specification which is a sequence as usual (cat). I want to take advantage of spec's parsing (i.e. conforming) to get the AST of an expression that conforms with my DSL. E.g.
user>...
Gurnard asked 16/1, 2017 at 23:31
1
Solved
I've been trying out clojure.spec, and one idea I have for how to use it is to generate the UI for editing an instance of the map I'm specifying. For example, it might generate a web form with a da...
Hobbledehoy asked 15/1, 2017 at 2:7
3
So, I'm diving deeper and deeper into Clojure.Spec.
One thing I stumbled upon is, where to put my specs. I see three options:
Global Spec File
In most examples, I found online, there is one big ...
Jennajenne asked 21/6, 2016 at 10:54
2
Solved
I just saw one of Rich's talks on clojure.spec, and really want to give it a try on my project. I'm writing a series of tools for parsing C code using the eclipse CDT library, and I would like to s...
Aftermost asked 16/12, 2016 at 3:10
2
Solved
I have recently watched Rich Hickeys talk at Cojure Conj 2016 and although it was very interesting, I didn't really understand the point in clojure.spec or when you'd use it. It seemed like most of...
Knotting asked 11/12, 2016 at 16:33
1
Solved
I am trying to write a higher order function in clojure.spec with version 1.9.0-alpha11 and have not been able to get the validation to execute against the returned function.
Using the example in...
Quenelle asked 8/9, 2016 at 3:42
1
Solved
Say I have the following specs:
(s/def :person/age number?)
(s/def :person/name string?)
(s/def ::person (s/keys :req [:person/name :person/age]))
Then I fetch an entity from Datomic:
(def per...
Latona asked 11/10, 2016 at 6:44
1
Solved
As screencasts and blogs start to appear around the new clojure.spec feature in Clojure 1.9, it's becoming clear that clojure.spec is capable of doing a lot of the risk mitigation that's previously...
Afterdinner asked 23/9, 2016 at 23:28
1 Next >
© 2022 - 2024 — McMap. All rights reserved.