Fork me on GitHub
#clojure-uk
<
2017-04-05
>
thomas07:04:57

mogge 😼

peterwestmacott08:04:44

clojure.core function of the day: inst-ms "Return the number of milliseconds since January 1, 1970, 00:00:00 GMT”

thomas08:04:46

isn't that the same as System/currentimemilliseconds (or something like that) ?

peterwestmacott08:04:56

it takes an inst as an arg

yogidevbear08:04:27

Is there a bot in this slack group for executing Clojure code snippets?

thomas08:04:00

so not the current time... but the number of mseconds since epoch of the inst you give it?

agile_geek08:04:11

@yogidevbear yep - clojurebot which you send messages too using /clj

thomas08:04:25

ok silly question... I have a key in one file: ::db how do I use that from a different file (that I have required ?)

bronsa08:04:25

@thomas ::foo is a reader macro that simply expands to the value of (keyword (ns-name (the-ns *ns*)) "foo")

bronsa08:04:59

after reading, supposing your current ns is foo, clojure sees ::foo as :foo/foo

bronsa08:04:26

so from another namespace just write :foo/foo directly or if you have (:require [foo :as f]) you can ::f/foo

thomas08:04:59

aah ok.. .I had missed it on one line 😇

thomas08:04:10

thank you @bronsa

thomas09:04:25

ok.. I watched Eric Normands Clojure/West talk last night and now I am trying to do something similar with my project...

thomas09:04:55

what is the best way to generate a maps with a set number of keys... but varying values?

peterwestmacott09:04:13

I haven’t seen the talk but that sounds like a job for Spec’s generators?

thomas09:04:31

yes it is... but not sure how to do it though.

peterwestmacott09:04:11

or just manually: (apply hash-map (interleave [:a :b :c] (repeatedly rand)))?

thomas09:04:01

ok got it...

thomas09:04:20

(gen/sample (s/gen ::spec/db) 3)

thomas09:04:35

where ::spec/db is my spec

peterwestmacott09:04:44

do you mean :spec/db (with a single :)?

thomas12:04:17

hmm I have a defspec but when I run it only seem to run one invocation of my test... despite having this: (defspec tester 5 ...