spec - s/gen validation error

2016-05-29 Thread 'Sven Richter' via Clojure
Hi, So I looked at generating specs for tests and I hit an error I just dont understand / neither can fix it. This is my code: (s/def ::column-types #{:int :varchar :boolean :text :time :date :char :binary :smallint :bigint :decimal :float :double

Re: clojure.spec/keys question

2016-05-29 Thread Alistair Roche
Hi Gordon, I ran into this earlier too. It's because s/def is a macro and needs access to [::foo ::bar] at compile time, whereas 'ks' is only def'd at runtime. At least that's how I understand it! Cheers, On Monday, 30 May 2016 05:14:18 UTC+10, Gordon Stratton wrote: > > Hi all, > > clojure.

Re: Variadic run!

2016-05-29 Thread Claudius Nicolae
Yes, I go by `(dorun (map ...` currently . I was reading [1] and got the impression that run! is to be preferred, but it seems it's not a full replacement. [1] https://stuartsierra.com/2015/08/25/clojure-donts-lazy-effects -- You received this message because you are subscribed to the Google Gr

Re: Variadic run!

2016-05-29 Thread Leon Grapenthin
run is a high performance version of (dorun (map ...)), implemented via reduce which also doesn't support a variadic fn. Probably (dorun (map ...)) is what you are looking for? On Sunday, May 29, 2016 at 10:27:54 PM UTC+2, Claudius Nicolae wrote: > > run! can eagerly map a function over a coll.

Re: Variadic run!

2016-05-29 Thread Leon Grapenthin
Have you considered (concat coll1 coll2)? On Sunday, May 29, 2016 at 10:27:54 PM UTC+2, Claudius Nicolae wrote: > > run! can eagerly map a function over a coll. > I think it would be nice to support multiple collections, making it an > eager version of map. > > My particular use case is running a

Variadic run!

2016-05-29 Thread Claudius Nicolae
run! can eagerly map a function over a coll. I think it would be nice to support multiple collections, making it an eager version of map. My particular use case is running a test over two colls. (defn check [m1 m2] (is (almost= (:x m1) (:x m2))) (is (= (:y m1) (:y m2 (run

Re: ClojureScript and React-native?

2016-05-29 Thread Paulus Esterhazy
Also give boot-react-native a try (https://github.com/mjmeintjes/boot-react-native). It's a admittedly bit rough to get started, but when set up offers a powerful interactive working environment. On Sun, May 29, 2016 at 4:12 PM, Mark Stang wrote: > Well, Re-natal seems to build and run. I am sti

clojure.spec/keys question

2016-05-29 Thread Gordon Stratton
Hi all, clojure.spec/keys is documented to accept vectors for :req, :req-un, etc. Shouldn't that also work if such a vector is previously bound? Clojure 1.9.0-alpha3 user=> (require '[clojure.spec :as s]) nil user=> (def ks [::foo ::bar]) #'user/ks user=> (s/def ::foospec (s/keys :req

defprotocol fails oddly in repl only

2016-05-29 Thread CGAT
Whenever I do a defprotocol in the clojurescript repl, even a trivial one like (defprotocol IFoo (foo [this])) it fails with an error `Can't change/establish root binding of: *unchecked-if* with set at line 1 '. Everything else seems to work as expected. When compiled outside the repl, such

defprotocol fails oddly in repl only

2016-05-29 Thread CGAT
Whenever I do a defprotocol in the clojurescript repl, even a trivial one like (defprotocol IFoo (foo [this])) it fails with an error `Can't change/establish root binding of: *unchecked-if* with set at line 1 '. Everything else seems to work as expected. When compiled outside the repl, such

Re: ClojureScript and React-native?

2016-05-29 Thread Mark Stang
Well, Re-natal seems to build and run. I am still going through the exercises in the README. On Sat, May 28, 2016 at 7:16 PM, Mark Stang wrote: > Has anyone gotten it to work lately by building it from scratch? And by > from scratch, I mean using the instructions on cljsrn.org? > > The natal h

Re: How to update state in a webapp

2016-05-29 Thread babysnakes
Thanks Brian, nice idea :) I also added load/save functionality from the atom when reloading the environment in development. On Sunday, May 29, 2016 at 2:57:56 PM UTC+3, Brian Platz wrote: > > In a web-app you probably want the thread safety an atom provides, so it > would be a good choice. >

Re: How to update state in a webapp

2016-05-29 Thread Brian Platz
In a web-app you probably want the thread safety an atom provides, so it would be a good choice. You can include a reference to your atom in your system config if you want to retain the reloaded-like / dependency injection pattern: (def changing-config (atom {})) ;; system-map (def sys-map {: