I think the connection is that you are (always) describing function arguments using regex ops. Maybe that could be made clearer.
On Thursday, May 26, 2016 at 9:23:43 AM UTC-5, Sven Richter wrote: > > Do you refer to this section? > > "When regex ops are combined, they describe a single sequence. If you need > to include a nested sequential collection, you must use an explicit call to > spec to start a new nested regex context. For example to describe a > sequence like [:names ["a" "b"] :nums [1 2 3]], you need nested regular > expressions to describe the inner sequential data:" > > If so, I did read it, but did not connect it inner seqs, but instead > always thought it was about regexes, which in my head is something totally > different than function definitions and their arguments. > > Anyway, I am trying to provide useful feedback here, you all have done a > great job! > > Thanks, > Sven > > Am Donnerstag, 26. Mai 2016 14:53:13 UTC+2 schrieb Alex Miller: >> >> There is an example like this in the Sequence section and a bit on this >> issue in particular. >> >> On Thursday, May 26, 2016 at 7:08:44 AM UTC-5, Sven Richter wrote: >>> >>> Ah thanks, that worked, not quite as I expected. Up until this point it >>> was pretty straightforward for me, thats been my fist bummer. >>> >>> Do you have an example for this in the guide? I did not fully read it, >>> but I think I scrolled through everything that used fdefs. >>> >>> Best Regards, >>> Sven >>> >>> Am Donnerstag, 26. Mai 2016 12:21:15 UTC+2 schrieb Alex Miller: >>>> >>>> It's a little tricky but you want: >>>> >>>> (s/fdef remove-autoinc-columns :args (s/cat :cols (s/spec ::columns))) >>>> >>>> Here the args data is ([{:foo "some_t"}]) and while you have an s/cat >>>> for :args and an s/cat in ::columns, those will be combined into the same >>>> regex so that's basically the same thing as ::columns. You need to force a >>>> new level of regex context and the s/spec will do that. >>>> >>>> On Thursday, May 26, 2016 at 4:32:52 AM UTC-5, Sven Richter wrote: >>>>> >>>>> Hi, >>>>> >>>>> I already asked this in the spec channel on slack, but got no response >>>>> yet. >>>>> >>>>> I have this simple spec definition: >>>>> >>>>> (s/def ::foo string?) >>>>> >>>>> >>>>> >>>>> (s/def ::column (s/keys :req-un [::foo])) >>>>> >>>>> >>>>> >>>>> (s/def ::columns (s/cat :col (s/* (s/spec ::column)))) >>>>> >>>>> ;(s/def ::columns (s/cat :col (s/* ::column))) >>>>> >>>>> >>>>> >>>>> (defn remove-autoinc-columns [cols] >>>>> >>>>> (vec (remove #(= true (:autoinc %)) cols))) >>>>> >>>>> >>>>> >>>>> (s/fdef remove-autoinc-columns :args (s/cat :cols ::columns) >>>>> >>>>> :ret ::columns) >>>>> >>>>> >>>>> >>>>> >>>>> $(remove-autoinc-columns [{:foo "some_t"}]) >>>>> >>>>> ===> ExceptionInfo Call to >>>>> #'de.sveri.clospcrud.s-play/remove-autoinc-columns did not conform to >>>>> spec: >>>>> >>>>> At: [:args] val: ([{:foo "some_t"}]) fails predicate: (cat :cols >>>>> :de.sveri.clospcrud.s-play/columns), Extra input >>>>> >>>>> :clojure.spec/args ([{:foo "some_t"}]) >>>>> >>>>> clojure.core/ex-info (core.clj:4617) >>>>> >>>>> >>>>> On the other hand, running this: >>>>> (s/conform ::columns [{:foo "some_t"}]) >>>>> => {:col [{:foo "some_t"}]} >>>>> works. >>>>> >>>>> So something is broken within the fdefs argument definition. >>>>> >>>>> I dont see my mistake here, can somone else reproduce / fix this? >>>>> >>>>> Thanks, >>>>> Sven >>>>> >>>> -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.