Fork me on GitHub
#clojure-spec
<
2019-08-28
>
johanatan04:08:05

huh? brain fart apparently. this works:

cljs.user=> (clojure.string/replace "/////blah/blah/blaz///" #"\/+" "/")
"/blah/blah/blaz/"
cljs.user=> 

johanatan18:08:22

hmm, ^^ that was in lumo.

johanatan18:08:47

when it's in my source file and compiled by figwheel-main I get the following js error:

Uncaught SyntaxError: missing ) after argument list

johanatan18:08:59

so, yea, a compilation error apparently

johanatan18:08:22

and i just realized this is the very wrong channel for this topic lol

johanatan18:08:31

[sorry about that]

chancerussell19:08:53

I noticed that alpha2 supports s/def ing symbols instead of keywords and got really curious about it…then realized that the first version supports the same thing

chancerussell19:08:07

Really curious about the use case for that though

Alex Miller (Clojure team)19:08:14

that's how function specs are registered (s/fdef)

ag22:08:22

can someone throw at me with an example of a spec for a string that has to be of specic length (within range) and should only allow letters. The catch though: it should not fail generation with Couldn't satisfy such-that predicate message. I swear, I used to have those, somehow I’m feeling stupid and can’t make them anymore.

Alex Miller (Clojure team)22:08:49

you could use test.chuck's support for making generators from a regex

ag22:08:16

ah test.chuck. Yeah it has a few nice gems there. But I feel I’m missing something fairly small

ag22:08:13

my best effort for now is to use with-gen with gen/such-that with max-tries jacked-up to a huge number. But it seems to be slow and still not guaranteed to not to fail to satisfy

seancorfield23:08:30

@ag Another "vote" for test.chuck here since you can use a (string) regex such as #"[a-zA-Z]{1,32}" for example, for pure alpha strings up to 32 chars in length and test.chuck provides a generator that works out of the box. We use it to generate email addresses and a bunch of other stuff.

👍 4
ag23:08:01

On related note: Gary is awesome! He was at defn podcast (that I started listening but couldn’t finish this morning)

4