This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-17
Channels
- # beginners (10)
- # boot (9)
- # cider (1)
- # cljs-dev (191)
- # clojure (77)
- # clojure-russia (4)
- # clojure-serbia (10)
- # clojure-spec (19)
- # clojure-uk (4)
- # clojurescript (16)
- # core-async (9)
- # cursive (1)
- # data-science (1)
- # datomic (3)
- # emacs (42)
- # graphql (2)
- # hoplon (38)
- # jobs (1)
- # jobs-discuss (18)
- # luminus (3)
- # lumo (20)
- # off-topic (9)
- # om (51)
- # parinfer (3)
- # pedestal (8)
- # re-frame (4)
- # reagent (7)
- # rum (9)
- # sql (9)
- # untangled (81)
If I have some data like this [:a :b :c :b :a]
where the structure is mirrored, but those could be any values, like [:x :y :z :y :x]
, what would I use from spec to write that?
@colinkahn: You could have a predicate like #(= % (reverse %))
(s/and sequential? #(= % (reverse %)))
@weavejester thanks, I realized you could do something similar but my solution wasn't as concise 😄
is there a more declarative way to define it? I was searching around and found recursive regular expressions with this solution: (\w)(?:(?R)|\w?)\1
But that requires you to be able to reference the group, which I don't see a way to do that with clojure.spec. Maybe using tags?
that's from this article: http://www.rexegg.com/regex-recursion.html I know it's for palindromes which wasn't what I originally posted, but curious if you could solve problems in that way using clojure.spec
Hello everyone, I have a clojure macro that is in a .clj
file, I use this macro within .cljs
files however it seems I cannot spec this macro???
@matan Instrumentation is a little like :pre
, except that you can turn it on and off selectively.
So during development you might have error messages that you do without in production.
anybody else working on spec-based transformation? use case is representing html head/meta stuff as a clojure map. the task is to transform such a map into html <link>, <meta>, etc. my xform code mimics spec : register a transform for each specked kw, then crawl the validated structure to xform it. this seems like a natural offshoot of spec. i can't be the only person who wants it. what else is out there?
What's the recommended way to integrate testing the :ret
part of function specs in an automated fashion via clojure.test
?
Here's one answer: https://stackoverflow.com/questions/40697841/howto-include-clojure-specd-functions-in-a-test-suite Is that the current recommended path?