How to spec a vector of custom spec'ed mapsTraversing a list of mapsClojure - extract values from a vector of hashmapsParsing with clojure.specMetaprogramming with clojure.spec values?Exercising macros with named arguments through Clojure SpecClojure Spec for a map with non-keyword keysWhy is Clojure Spec going into an infinite loop here?Clojure: Transform nested maps into custom map keeping only specific attributesClojure Domain Modeling: Spec vs. ProtocolsSyntax error macroexpanding clojure.core/let

Inadvertently nuked my disk permission structure - why?

Does academia have a lazy work culture?

Why was Sauron preparing for war instead of trying to find the ring?

Giant space birds hatching out of planets; short story

Area of parallelogram = Area of square. Shear transform

At what rate does the volume (velocity) of a note decay?

Convert every file from JPEG to GIF in terminal

A planet illuminated by a black hole?

Why isn't there a ";" after "do" in sh loops?

How to judge a Ph.D. applicant that arrives "out of thin air"

Anybody know what this small Nintendo stand is for?

Why are off grid solar setups only 12, 24, 48 VDC?

Spoken encryption

Why did Germany launch its spy satellites from Russia?

AC contactor 1 pole or 2?

TSA asking to see cell phone

What is the difference between 1/3, 1/2, and full casters?

Why not use a diode instead of a resistor for current sense circuits?

How do I generate distribution of positive numbers only with min, max and mean?

Assuring luggage isn't lost with short layover

Examples of simultaneous independent breakthroughs

Why is drive/partition number still used?

How do I stop my characters falling in love?

Is it legal for private citizens to "impound" e-scooters?



How to spec a vector of custom spec'ed maps


Traversing a list of mapsClojure - extract values from a vector of hashmapsParsing with clojure.specMetaprogramming with clojure.spec values?Exercising macros with named arguments through Clojure SpecClojure Spec for a map with non-keyword keysWhy is Clojure Spec going into an infinite loop here?Clojure: Transform nested maps into custom map keeping only specific attributesClojure Domain Modeling: Spec vs. ProtocolsSyntax error macroexpanding clojure.core/let






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a spec for a custom map named ::cell, let's say



(s/def ::attr-1 int?)
(s/def ::attr-2 int?)
(s/def ::cell :req-un [::attr-1 ::attr-2])


Now I want another spec ::grid for a custom vector that consists of only these ::cell maps. As an example, a grid might look like this:



(let grid [:attr-1 11, :attr-2 12 :attr-1 21 :attr-2 22])


Is it possible to create a spec for this requirement using the specification of ::cell?



(s/def ::grid ???)









share|improve this question




























    0















    I have a spec for a custom map named ::cell, let's say



    (s/def ::attr-1 int?)
    (s/def ::attr-2 int?)
    (s/def ::cell :req-un [::attr-1 ::attr-2])


    Now I want another spec ::grid for a custom vector that consists of only these ::cell maps. As an example, a grid might look like this:



    (let grid [:attr-1 11, :attr-2 12 :attr-1 21 :attr-2 22])


    Is it possible to create a spec for this requirement using the specification of ::cell?



    (s/def ::grid ???)









    share|improve this question
























      0












      0








      0








      I have a spec for a custom map named ::cell, let's say



      (s/def ::attr-1 int?)
      (s/def ::attr-2 int?)
      (s/def ::cell :req-un [::attr-1 ::attr-2])


      Now I want another spec ::grid for a custom vector that consists of only these ::cell maps. As an example, a grid might look like this:



      (let grid [:attr-1 11, :attr-2 12 :attr-1 21 :attr-2 22])


      Is it possible to create a spec for this requirement using the specification of ::cell?



      (s/def ::grid ???)









      share|improve this question














      I have a spec for a custom map named ::cell, let's say



      (s/def ::attr-1 int?)
      (s/def ::attr-2 int?)
      (s/def ::cell :req-un [::attr-1 ::attr-2])


      Now I want another spec ::grid for a custom vector that consists of only these ::cell maps. As an example, a grid might look like this:



      (let grid [:attr-1 11, :attr-2 12 :attr-1 21 :attr-2 22])


      Is it possible to create a spec for this requirement using the specification of ::cell?



      (s/def ::grid ???)






      clojure clojure.spec






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 17:30









      idleherbidleherb

      9358 silver badges19 bronze badges




      9358 silver badges19 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          2














          You can use tuple:



          (s/def ::grid (s/tuple ::cell ::cell ::cell))


          or coll-of specifying the kind and count:



          (s/coll-of ::cell :kind vector? :count 3)





          share|improve this answer























          • Thank you! I wasn't aware of the fact that a spec like ::grid could be used as the first argument to s/coll-of!

            – idleherb
            Mar 26 at 17:41










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363047%2fhow-to-spec-a-vector-of-custom-speced-maps%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          You can use tuple:



          (s/def ::grid (s/tuple ::cell ::cell ::cell))


          or coll-of specifying the kind and count:



          (s/coll-of ::cell :kind vector? :count 3)





          share|improve this answer























          • Thank you! I wasn't aware of the fact that a spec like ::grid could be used as the first argument to s/coll-of!

            – idleherb
            Mar 26 at 17:41















          2














          You can use tuple:



          (s/def ::grid (s/tuple ::cell ::cell ::cell))


          or coll-of specifying the kind and count:



          (s/coll-of ::cell :kind vector? :count 3)





          share|improve this answer























          • Thank you! I wasn't aware of the fact that a spec like ::grid could be used as the first argument to s/coll-of!

            – idleherb
            Mar 26 at 17:41













          2












          2








          2







          You can use tuple:



          (s/def ::grid (s/tuple ::cell ::cell ::cell))


          or coll-of specifying the kind and count:



          (s/coll-of ::cell :kind vector? :count 3)





          share|improve this answer













          You can use tuple:



          (s/def ::grid (s/tuple ::cell ::cell ::cell))


          or coll-of specifying the kind and count:



          (s/coll-of ::cell :kind vector? :count 3)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 17:39









          LeeLee

          123k15 gold badges181 silver badges251 bronze badges




          123k15 gold badges181 silver badges251 bronze badges












          • Thank you! I wasn't aware of the fact that a spec like ::grid could be used as the first argument to s/coll-of!

            – idleherb
            Mar 26 at 17:41

















          • Thank you! I wasn't aware of the fact that a spec like ::grid could be used as the first argument to s/coll-of!

            – idleherb
            Mar 26 at 17:41
















          Thank you! I wasn't aware of the fact that a spec like ::grid could be used as the first argument to s/coll-of!

          – idleherb
          Mar 26 at 17:41





          Thank you! I wasn't aware of the fact that a spec like ::grid could be used as the first argument to s/coll-of!

          – idleherb
          Mar 26 at 17:41








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363047%2fhow-to-spec-a-vector-of-custom-speced-maps%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript