Fork me on GitHub
#clojure
<
2015-10-26
>
noonian00:10:40

you could use core.async and read the values from a channel in a loop and write to the file

potetm00:10:52

Not certain, but I would assume logging libraries make all kinds of optimizations to the logging process. If a flat file log is what you need, I would seriously consider just using log4j or logback.

potetm00:10:45

That being said, I believe either an agent or a core.async chan+process would do what you want.

potetm00:10:27

The main difference being that backpressure can be configured with core.async.

potetm00:10:38

(TBH using an agent for controlled side-effects always seemed like a bit of a hack, but I think it fits the bill for some scenarios. So take that as you will simple_smile )

Alex Miller (Clojure team)01:10:55

The main benefit of agents for side effects is that they are stm aware.so you can safely send from inside a ref txn

Alex Miller (Clojure team)01:10:35

Because agent sends are held till when the txn completes

blissdev02:10:05

@meikemertsch: ah thanks, great idea!

noprompt03:10:51

user> (var identity why is this totally ignored?)
#'clojure.core/identity

noprompt03:10:01

user> (throw (ex-info "lol" {}) ... or this?)
ExceptionInfo lol  clojure.core/ex-info (core.clj:4593)

noprompt03:10:11

any takers?

noprompt03:10:12

i mean understand why this happens, but i don't understand why this is allowed to happen.

noprompt03:10:49

both of those should throw argument errors imo.

ghadi03:10:40

var and throw are special forms

ghadi03:10:52

the compiler probably doesn't check enough

noprompt03:10:39

yes, i understand that.

noprompt03:10:23

but def is a special form and

(def fe "fi" :fo :fum)
CompilerException java.lang.RuntimeException: Too many arguments to def, compiling:(/private/var/folders/sv/xytbwbxn6pg835_hkmyf8lxc0000gn/T/form-init786571130783712406.clj:1:1) 

noprompt03:10:04

hmm... seems like it should.

ghadi03:10:22

yeah def happens to handle it

ghadi03:10:32

in the def special form parser

noprompt03:10:41

var definitely doesn't check however.

ghadi03:10:04

That's right, it doesn't.

noprompt03:10:11

@ghadi: i have the source open on my machine right now.

noprompt03:10:31

i suppose that deserves a patch.

noprompt03:10:10

i'm not sure why throw is allowing that to slide. it could be a repl thing but it doesn't seem likely.

ghadi03:10:41

¯\(ツ)

tjb04:10:27

hey everyone, i am new to clojure and using http://braveclojure.com as a starting point. i hope to gain lots of knowledge from everyone here and share my experience as i embark on this journey. cheers!

nowprovision08:10:33

Anyone have any thoughts about how Im structuring this simple component based webapp server side (i guess system.clj is a good place to start) https://github.com/nowprovision/webhookproxyweb/blob/master/src/webhookproxyweb/system.clj

danlebrero09:10:33

to anybody using Midje autotest, is it supposed to support deleting namespaces?

danlebrero09:10:11

After deleting/renaming some file I get a “LOAD FAILURE” and need to restart the jvm

danlebrero09:10:27

using Midje 1.7.0

mishok1310:10:52

quickly glanced at midje, it doesn't seem to use tools.namespace and instead does some ad-hoc namespace handling

mishok1310:10:11

@danlebrero:I didn't really help you here, did I? simple_smile

mishok1310:10:32

I just hope that maybe someone re-writes autotesting to do a proper thing

danlebrero10:10:46

@mishok13: you confirmed my suspicion

danlebrero10:10:55

which is quite helpful

ljosa14:10:05

I suspect that *assert* is not being set to false` when building my uberjar. When I start my app from the uberjar, then connect to its nrepl and evaluate *assert*, I get true. I can't afford to run my pre and post conditions in production. How do I ensure that they're off?

ljosa14:10:36

I have :profiles {:uberjar {:global-vars {*assert* false}}} in my project.clj

jeremyraines14:10:22

anyone know how to get comments in the interior of a function to get pulled into the documenation section with Marginalia? I’ve tried ; and ;; and they always stay in the code section

ragge15:10:47

@ghadi: any idea of what the future of squee looks like? I really liked the approach and impl.

ghadi15:10:57

@ragge thanks. I have my attention turned towards a different library right now (stay tuned) but I'd be glad to merge in some tests

ghadi15:10:07

"Everything works for me" but there is no test coverage

ghadi15:10:57

The one feature I haven't pushed up yet, is "data readers" for SQL. Rather than receiving a java.util.Date from the underlying resultset, you can receive java.time or Joda -- customizable by datatype

ghadi15:10:31

I'm just happy about the connection & transaction implementation. It's just simpler than clojure.java.jdbc

ragge15:10:55

When you say "data readers" for SQL, do you mean something similar to IResultSetReadColumn in java.jdbc?

ghadi15:10:13

ragge: essentially, but not globally scoped

ragge15:10:26

@ghadi: ok, makes sense

ragge15:10:45

@ghadi: which scope? per statement?

ghadi15:10:48

passed in as an argument a la (clojure.edn/read {:readers})

mishok1315:10:09

@ljosa: I observe the same behavior with global-vars on a sample project

mishok1315:10:22

seems that lein just ignores assert

ragge15:10:56

@ghadi: would you accept contributions for tests/minor things (found a few docstring errors)?

mbertheau15:10:08

Is there a contains-in? I.e. (contains-in? {:a {:b 1}} [:a :b]) should be true.

mishok1315:10:28

(defn contains-in? [m ks] (not= :not-found (get-in m ks :not-found))) simple_smile

mishok1315:10:05

seriously though, no, I don't think there's anything like that but it should be fairly easy to write one

danlebrero17:10:30

@mbertheau: (comp some? get-in)

bostonaholic17:10:43

^^ doesn't work for (contains-in? {:a {:b nil}} [:a :b])

mbertheau17:10:26

I have

(fn [m [k & ks]]
  (if (contains? m k)
    (if (nil? ks)
      true
      (recur (k m) ks))
    false))
now. Improvements are very welcome!

bostonaholic17:10:06

I like from @mishok13

(defn contains-in? [coll key]
  (not= :not-found (get-in coll key :not-found)))

bostonaholic17:10:03

hmm, just realized that (contains? {:a {:b nil}} [:a :b]) => false

bostonaholic17:10:32

they key [:a :b] exists, just happens that the value is nil

danboykis18:10:38

@mbertheau: I would modify it slightly for the case when keys aren't keywords

(fn [m [k & ks]]
  (if (contains? m k)
    (if (nil? ks)
      true
      (recur (get m k) ks))
    false))

arrdem19:10:39

bostonaholic: you have a collision on (contains-in? {:a {:b :not-found}} [:a :b]), easily fixed by using a new Object that won't be equal to anything else.

bensu21:10:01

Hi everybody! I'm testing a small service to make dependency graphs for clojure projects. You feed it a github url and it gives you back a dep graph. Anybody wants to try it out? http://asterion-dev.elasticbeanstalk.com/index.html

dominicm21:10:54

@bensu: Try #C06MAR553! that channel needs more love

bensu21:10:45

hahaha @dominicm it's not an announcement, I haven't even configured the routes yet

dominicm21:10:01

@bensu: In other news, I need to simplify my library: https://i.imgur.com/qb3uA4C.png

gjnoonan21:10:57

@bensu: Nice simple_smile would be nice to be able to either hover over or click on a node and have the path highlighted

dominicm21:10:25

And to make it linkable! 😛

bensu21:10:04

@gjnoonan: which paths? all paths to the node?

bensu21:10:40

@dominicm: we might start with download the svg

xeqi23:10:19

@bensu I've wanted something like this before. Nice project

xeqi23:10:44

to add to your feature requests, I'd enjoy being able to see the graph at the var level

bensu23:10:32

@xeqi: how do vars depend on each other?

xeqi23:10:13

a def/defn creates a var that depends on the var of any referenced symbol in it's source. Almost like a call graph

bensu23:10:21

@xeqi: it's definitely doable, I'll put it on the queue

xeqi23:10:53

@bensu: and I'll add another feature request for branches.. ala https://github.com/xeqi/clojars-web/tree/lucene-index-component