Fork me on GitHub
#clojurescript
<
2016-06-18
>
wildermuthn03:06:08

Can I emote about how awesome Spec is? Using comformer to coerce incoming JSON is really straightforward.

wildermuthn03:06:35

I’m sure there’s problems with the above, but I haven’t been able to do this effectively before, so I’m pretty stoked!! Just wanted to share my excitement. 🙂

rnandan27303:06:40

Can we use specter in clojurescript? I keep getting select not found. It works fine in clojure, am on clojurescript 1.8.x

rnandan27303:06:25

I have used the includes for macros also

nathanmarz05:06:14

@rnandan273: yes, specter works in clojurescript

nathanmarz05:06:23

are you using something like this in your ns definition?

(:require-macros [com.rpl.specter.macros :refer [select transform]])

dnolen13:06:10

@curlyfry: that’s the only one I’m aware of for Chrome, and yes people use that

dnolen13:06:30

that + Figwheel seems like a productive combo

mfikes15:06:29

Planck 1.15 has been released

richiardiandrea16:06:22

@curlyfry also Dirac is kind of popular if you want a Repl inside Chrome

richiardiandrea16:06:37

I also forgot to mention my choice, which is boot Repl with boot-reload. Figwheel has very nice error messages now and it is the best choice for starters imho but the others will catch up soon I guess :)

rnandan27318:06:00

@nathanmarz: Thanks a ton for your help, i was making the mistake of using it as (:require [com.rpl.specter.macros :refer [select transform]]).

rnandan27318:06:46

@nathanmarz: I was contemplating using datascript but specter should suffice my requirements. I am writing an app to supprt offline / online mode using browser localstorage and specter will help me to query and update the localstorage via the app-db

darwin18:06:56

@curlyfry: in case of cljs-devtools and Dirac they are not mutually exclusive, Dirac assumes cljs-devtools usage and should be more advanced step in your tooling setup. My recommendation: start with Figwheel , then add cljs-devtools, and possibly add Dirac after you get familiar with your basic setup.

nathanmarz18:06:03

@rnandan273: cool, feel free to come to the #C0FVDQLQ5 channel if you need any help

zpinter23:06:57

hello everyone! quick question about spec if anybody is up for it

zpinter23:06:34

looking to define a spec for the keys of the react native style map. there's a bunch of them, so I'd like to define them in a var and then pass that as the :opt param for the map. However, that seems to be failing with

IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
(i'm guessing because s/def is a macro?)

zpinter23:06:55

here's a simple example:

(def style-keys
   [
    (s/def ::padding ::dimen-spec)
    (s/def ::padding-left ::dimen-spec)
    (s/def ::padding-right ::dimen-spec)
    (s/def ::padding-top ::dimen-spec)
    (s/def ::padding-bottom ::dimen-spec)])

(s/def ::style (s/keys :opt style-keys))

darwin23:06:37

@zpinter: that looks bad, you should call “def*” methods only at top level, this is a general rule, not something specific to spec

darwin23:06:36

I haven’t played with specs yet, but my understanding is that s/def’ing fully qualified keyword, means you can use it anywhere else and it will just work

zpinter23:06:02

@darwin thanks! happy for alternative ideas... just trying to avoid having a large number of s/def's and then having to repeat the keyword list all over again to construct the map spec

darwin23:06:50

if you want to make this more succinct I’m afraid you will have write a macro, assuming s/def is a macro

zpinter23:06:05

the above seems to error out in the same way (my guess is that s/keys doesn't like :opt being passed as a symbol)

darwin23:06:17

try to ask in #C1B1BB2Q3

zpinter23:06:51

will do! thanks again

darwin23:06:18

if this works, it would explain it, s/def is a macro which needs to see the :opt vector during compile time

zpinter23:06:20

yep, that works (though has the issue of repeating the keys that i'm trying to avoid)

darwin23:06:39

I’m afraid, you need your own macro for automating that

darwin23:06:04

which should not be an issue, just build your own macro-tools on top of spec macros

zpinter23:06:40

makes sense