Fork me on GitHub
#clojure
<
2016-10-27
>
josh.freckleton02:10:43

TIL : in emacs,`cider-mode` preface any sexp with #light, and track all the variable's values as they flow throug that form. or turn on enlighten-mode permanently

josh.freckleton02:10:07

(when evaluating directly, with, eg, C-c)

sivakumargsk06:10:30

I was trying to integrate my cljs-project with quickbooks api. should any one done please give me a suggestions?

wwajerowicz08:10:19

@sasha you won’t see the name of the thread in ps or htop, in those you’ll always see the command you used to run the app, if you wan’t to know the name of your current thread you’ll need to call Thread.currentThread().getName() or (.getName (Thread/currentThread)) in your code (no sure about the Clojure version, as I’m still a Clojure beginner)

wwajerowicz08:10:06

and anyway, htop and ps will show you the system process which is running multiple threads (so if you see only one process, it doesn’t mean that you’re running only one thread)

mpenet08:10:07

is there a nice way to get to the map-> constructor of a record from a class value -> ex: (foo some.ns.Foo) -> some.ns.map->Foo, ideally going from symbol to ns then resolving the (str "map->" symbol-repr) for that ns for instance

mpenet08:10:52

I could get dirty and parse the symbol repr, but I was wondering if there's some other way

Pablo Fernandez11:10:22

How can I get the raw request in a compojure-api?

sveri11:10:46

@pupeno (GET "/foo" req (handle-req req))

sveri11:10:53

where req is the request

Pablo Fernandez11:10:11

@sveri I’m already getting the session, how do I merge that with the session:

Pablo Fernandez11:10:31

(compojure.api.sweet/POST "/register" {session :session} :body [registration-form s/Any]

sveri11:10:36

@pupeno it looks like you are using the sweet library, which I never used myself, so I cannot help here, sorry.

sveri11:10:25

Ah, you said that in the beginning, I mistakenly took compojure-api for compojure

Pablo Fernandez11:10:40

With ring.mock.request, when doing a post request, how do I specify body params instead of form ones?

ikitommi11:10:15

@pupeno, {session :session :as request} should work.

Pablo Fernandez11:10:42

ikitommi thanks 🙂

shooodooken14:10:35

Can one trust = to return false if there are any differences between 2 very large(&deeply nested) structures? Are there gotchas one should be aware of? (I had looked at clojure.data/diff but that is overkill for my needs)

tbaldridge14:10:32

@shooodooken yes you can trust it

tbaldridge14:10:06

Gotchas are around around java objects and reference types (atoms, refs, agents).

tbaldridge14:10:31

But you should avoid putting reference objects in clojure data structures anyway.

baptiste-from-paris15:10:56

hello guys, newbie question pending ^^: I have a map where each element holds informations in order to make http requests. Right now, I use map function to retrieve these info and make the request by forcing it with a dorun I bet I am doing things wrong, any feedbacks please ?

robert-stuttaford15:10:56

(doall (map f coll)) 🙂

baptiste-from-paris15:10:53

@robert-stuttaford I though doallwas less performant than dorun by keepingelements in memory ?

baptiste-from-paris15:10:18

@mpenet doseq VS dorun/`doall` ?

mpenet15:10:28

(doall (map ...)) is a smell when you just want to do side effects

robert-stuttaford15:10:34

do you want the results of the http requests? doall. not? dorun

robert-stuttaford15:10:54

neither? do-a-little-dance!

baptiste-from-paris15:10:04

@robert-stuttaford I don’t care about the result but it has to be run sync

mpenet15:10:38

doall will cause the seq to reside in memory entirely over time (retains the head etc)

mpenet15:10:55

doseq will basically iterate over the seq contents, it can be over a huge seq, no problem

baptiste-from-paris15:10:21

and doseq VS dorun ?

mpenet15:10:47

I'd say doseq, or run! depending on what you prefer, the former is more common

baptiste-from-paris15:10:43

thx guys ! I was pretty close from the better way

mpenet15:10:51

run! is not good on large seqs, it's eager, but might be a tiny bit faster

mpenet15:10:13

I always use doseq personally

baptiste-from-paris15:10:42

on the contrary, if I don’t care about the order and I want to make requests async, would you use future or a go block ?

mpenet15:10:54

the fancy way: a go block, using async/thread with a loop with alts! that listens to incoming responses, or the naive way: (->> (mapv #(future ...) coll) (mapv deref))

jstokes15:10:22

or even just switching to pmap

dominicm15:10:58

https://stuartsierra.com/2015/08/25/clojure-donts-lazy-effects seems relevant to the discussion, at some point transducers were mentioned.

josh_tackett19:10:55

Anybody on here work at heroku who can help me? https://help.heroku.com/tickets/416968

josh_tackett19:10:09

I am trying to deploy our app and the deployments just aren’t working

josh_tackett19:10:17

they don’t even start the logs. They just load and load

tom20:10:05

With compojure-api is there a way to disable the swagger page being available? Say based on environment

tom21:10:40

Is any reason one shouldn't use ring-mock outside testing environments?

hiredman22:10:50

(defmacro foo []
  (let [v (with-meta (gensym) {:tag 'java.lang.String})]
    `(fn [~v] (.charAt ~v 2))))

moxaj22:10:54

@hiredman works, thanks!

Pablo Fernandez22:10:16

Is it possible for hugsql to convert from snake case to kebab case automatically?

mikeb23:10:43

And if you're using postgres and a little adventurous, this lib does it by default. https://github.com/mikeball/foundation

lambeta23:10:41

Hi hivemind, where to find a definition of Generative Testing or related topics like property-based testing?

hiredman23:10:14

I don't know that there are formal definitions

hiredman23:10:09

too me, generative testing is testing with (randomly usually) generated data instead of testing using particular examples pieces of data

hiredman23:10:30

and too me, property based testing is looking for universal invariants(or properties) I can assert about the relationship between inputs and outputs of a test, instead of asserting particular things that are true under some conditions.

hiredman23:10:19

generative testing by its nature drives you to property based testing

hiredman23:10:12

https://www.youtube.com/watch?v=H18vxq-VsCk (John Hughes - The Mysteries of Dropbox) is a great quickcheck video

creese23:10:18

I have a map defined like this

(def metadata
  {:type :record
   :fields [foo
            bar
            baz]})

creese23:10:31

Is it possible get metadata on foo?

creese23:10:59

Correction, it's defined like this:

(def metadata
  `{:type :record
    :fields [foo
             bar
             baz]})

creese23:10:52

I've attempted (meta #'(first (:fields metadata))) but that results in:

CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(*cider-repl foo-bar-baz*:158:6) ` but that results int