#clojure logs

2015-06-19

00:32justin_smithyedi: try searching for "debouncing"
00:33yedithanks
00:42yedijustin_smith: cool, this looks like itll do the job: https://gist.github.com/swannodette/5888989
00:42yedinow i just gotta think of what a good debounce time would be, prolly like 250ms
00:43justin_smithyedi: likely looking a the allowed delay between clicks in a double-click would be a good starting point
01:39Jake_can someone who knows datomic give me feedback https://groups.google.com/forum/#!topic/datomic/auHSz3evCuA
02:49tmtwddoes clojure have a new operator?
03:00noiditmtwd, there's some special syntax for calling the constructor of a Java class: (TheClass. arg1 arg2)
03:04noidihttp://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form-(Classname.%20args*)
03:05noidiah, I had forgotten that there's the special form "new", to which the dotted form is expanded
03:05noidiin practice all you see is (TheClass.)
03:32tmtwdhello
03:42tm89hello
03:43hellofunktm89: greetings
05:00H4nswhat is a good way to configure clojure systems? i'd hope for a library that supports configuration files in edn.
05:19tmtwdlein?
05:23egliH4ns: https://github.com/weavejester/environ
05:27H4nsegli: thanks!
05:42H4nshm. environ seems to be leiningen centric and not offer a mechanism that allows edn files for configurations (unless it is named .lein-env and resides in the current wd)
05:43bluesky44in writing a ClojureScript macro (in Clojure), how does one go about using a custom function that is defined in ClojureScript? (I'm trying to write the <? macro mentioned here: http://swannodette.github.io/2013/08/31/asynchronous-error-handling/)
05:43bluesky44I've written a throw-err function but don't know where to put it.
05:44bluesky44If it's in my macros.clj file, I get a 'no such namespace: js' error.
05:44bluesky44https://gist.github.com/mhuebert/2221c18e9df11f2fd766
05:48kungiI am trying to send messages via postal and keep getting this error: "nodename nor servname provided, or not known"
05:48kungiThis seems to hint on dns resolution
05:48kungiHow can I debug this?
05:52kungiNevermind I had an error in my hostfile
05:52kungi:-(
06:37kaffeeboehnchenHas anyone an idea why I always get an 404 whenn the code runs into "false" or "error"? "true" is working fine. http://paste42.de/8231/ (httpkit -> compojure)
06:50wasamasano error callback?
06:53kaffeeboehnchenwasamasa: What do you mean?
06:53wasamasakaffeeboehnchen: yesterday someone mentioned your library is using futures or something
06:54wasamasakaffeeboehnchen: usually you have one for the success and another one for the error case
06:54kaffeeboehnchenwasamasa: http-kit is using promises
06:54kaffeeboehnchenbut compojure is used for routing and that should just return the result of that function
06:56kaffeeboehnchenah, I guess I have to write ring handler https://github.com/ring-clojure/ring/wiki/Concepts#handlers
07:53justin_smithH4ns: I have used environ to select a file name to load for config
07:54H4nsjustin_smith: i kind of like the flexibity of environ and am now using it together with edn files at well-known locations.
07:54justin_smithyeah, sounds pretty much like what I was talking about
07:55H4nswell, i'm merging environ/env with whatever i'm reading from the selected configuration files.
07:55H4nsbut everyone to their liking
07:55kaffeeboehnchenBy the way, writing the ring handlers helped for my problem earlier.
08:20elbenWhat other languages support symbols (e.g. :name) other than Ruby, Clojure and Scala?
08:21wasamasaevery other lisp dialect?
08:22justin_smithelben: to be clear, :name is not a symbol, it is a keyword (I think Ruby calls keywords symbols though)
08:22elbenyes, I meant that.
08:23wasamasajust like the lisp implementation its author studied :P
08:23wasamasa(type-of :foo) ;=> symbol
08:23justin_smithwasamasa: what weirdo lisp implementation was that?
08:23wasamasajustin_smith: the one living inside emacs
08:24justin_smithWEIRD and how did I not know that...
08:24wasamasasee http://www.slideshare.net/yukihiro_matz/how-emacs-changed-my-life for details
08:24H4nsin common lisp, keywords are symbols in the special "KEYWORDS" package
08:24wasamasaI've stumbled on a few of these while reading ruby C sources
08:24H4nsit is just clojure making them be totally separate
08:24wasamasalike, them reusing the convention of Qtrue, Qfalse and Qnil although none of these are quoted things :P
08:25justin_smithwasamasa: haha, cargo cult
08:26TEttingerI think LiveScript supports a sort of keyword equivalent. you can do \something , and it will compile to "something"
08:26TEttingerbut it is still a string
08:27justin_smithmy coworkers are constantly getting keyword / symbol wrong (because it was an ex ruby shop), and the big a-ha for me was of course that ruby is not homoiconic, so "symbol" as we know it is not a meaningful thing there
08:32elbenI use those words interchangably at work (Ruby)—I think my co-workers understand…
08:33justin_smithelben: but we do clojure, so when they say symbol and mean keyword I often get confused
08:33elbenYes, an important distinction there :)
09:46zathrasHi. I have a config file written in clojure and would like to extract some info out of it (things like a hostname definition etc). Does clojure provide a beautyfier to list/dump code or can I even use it to read/et this information into a bash script somehow?
09:46zathras*get
09:47wasamasapprint?
09:49zathraswasamasa, ty. I am new to clojure. Can I use pprint from the commandline somehow?
09:49zathraslooking at the docs it seems at first sight something to be used from within a clojure program.
09:49wasamasait is
09:50wasamasagenerally clojure isn't really something you'd use for commandline utilities
09:50wasamasait's more of a fit for long-running servers you talk to with something else
09:51zathrasI have Riemann (http://riemann.io) installed. It's configurationfile is in clojure. I want to parse that configfile and I am looking for the best way to do that. Currently I look at regexes however I do not mind making the task easier if possible
09:51zathrashence my asking here
09:57ordnungswidrigWhat are my options for mocking fns in clojure.test tests? I know of with-redefs-fn but thats pretty low level
09:58Duke-zathras: I guess you could use an EDN parser for python or ruby, if you don't want to use Clojure itself (and start a JVM) in the script
09:59Duke-doesn't sound much easier than regexes though I guess
09:59zathrasDuke-, what is an EDN parser?
10:00zathrasI am fine with python, but not familiar with "EDN"
10:01Duke-EDN is the format of Clojure code (or rather a subset)
10:03zathrasty Duke- , I will look into it
10:17kwladykaafter months of learnig clojure i am ready to back to the topic http://stackoverflow.com/questions/29867671/clojure-architecture-like-uncle-bob-did/29985761#29985761 - do you recommend watch/read someting more then http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html and http://blog.find-method.de/index.php?/archives/209-Dependency-inversion-in-Clojure.html
10:25kwladykatopic: clean architecture in Clojure
10:25j-pbjust looking at that makes my brain melt
10:26j-pbam I the only one to consider the architectural patterns an antipattern?
10:27puredangerI haven't read it yet, but I suspect http://www.rkn.io/application-architecture/ would be of interest
10:37kwladykaj-pb, it depend witch one ;)
10:37kwladykain my opinion architecture is one of the most important thing durgin development
10:37j-pbwell, I kinda like the microservice stuff that has come up in the clojure world recently
10:38kwladykait is easy to write something but develop this 5 years not
10:38j-pbyeah but trying to press your application into a pedetermined shape is pretty harmfull imho
10:39j-pball of these articles mention multimethods and protocols as a great design tool
10:39j-pbwhile they are absolutely horrible and should only be used if functions and data fail
10:39kwladykayes, but this one is really close to how i am thingking about that
10:39kwladykai want have business model in core layer separater with "not important code"
10:41kwladykawhen i am talking about business i say "user register, fill email and password and have to confirm by link in email" not "after user fill forms save data in postgresql and then...."
10:41j-pbI still woudldn't use a lot of the technologies mentioned before
10:41kwladykabut ofcourse nobody know the best soltuion for everything :)
10:42j-pbthe stack overflow answer is especially ugly
10:42kwladykawhat do you mean when say "technologies"?
10:42j-pbprotocols and reify for example
10:42kwladykawhy?
10:42clojurebotwhy is startup slow is busy compiling the `for` macroexpansion
10:43j-pbif you want to design a new datastructure or need some performance tuning, records are great, for everything else they offer mostly disadvantages over data
10:43maxpnplace advice me how to do next (sample in javascript): if( a = f1() ) { return g1(a);} if(a = f2()) { return g2(a);} ...
10:44maxpnlike (cond ... ) but with returned value
10:44j-pbthey are not really persistent (kinda with automatic reader literals), they are polymorphic so there are potential ambiquities which method is actually called by just looking at code
10:44snowellmaxpn: (cond) does return the value
10:45j-pbthe load/save-data protocol is typical OO crap, persistent datastructures are already persistent
10:45maxpnsnowell: no, I mean "get value from function and return f(value) if value is true"
10:45kwladykaj-pb, so in your opinion how would you do architecture?
10:46maxpnsnowell: and there are many such functions like in (cond ... )
10:46justin_smithj-pb: in what way are records as defined by defrecord not persistent?
10:47j-pbkwladyka: keep it small, keep it simple, use higher order functions, the "keep your depencies as a DAG and avoid cycles" from the article is actually pretty good
10:47j-pbkwladyka: it epends on the thing I build really
10:47j-pbjustin_smith: you can't serialize their behaviour with them
10:48snowellmaxpn: I would probably do nested `if-let`s
10:48justin_smithj-pb: their behavior is in their definition, if you can load their reader literal, you have loaded their behavior
10:48snowell,(if-let [a false] :a (if-let [b true] :b (if-let [c true] :c)))
10:48clojurebot:b
10:48j-pbjustin_smith: you always assume that there is an application with your code on the other end, or at least some conforming code that has the right reader literal
10:49maxpnsnowell: nesten if-let's? no more elegant way? ... :(
10:49justin_smithj-pb: oh yeah, don't put your records on the wire
10:49snowellBut instead of the true/false, do the function call. If it returns anything truthy it'll set the value and you can pass it to the g function
10:49justin_smiththat's not about persistence, that's about communicating between processes
10:49j-pbjustin_smith: yeah, that's the nice thing about persistence for me, that it's independent of the context of execution
10:49justin_smithOK
10:49snowellmaxpn: Sure, there might be a more elegant way. I'm still kind of learning myself :)
10:50j-pbjustin_smith: yeah kinda, but then serialized java objects would also be persistent datastructures, which they're not really
10:51justin_smithj-pb: well serialization of anything stateful is going to be a mess, yeah
10:52j-pbsnowell maxpn: there is, the maybe monad, afaik we have that now as a threading macro let me check
10:52justin_smithj-pb: some-> / some->> is almost like maybe I guess
10:52j-pbjustin_smith: yeah exactly that one
10:53maxpnreally I need some kind of form validation - "if filed1_err return err1; if field2_err return err2; ... all ok ..."
10:53j-pb,(macroexpand '(-> x f g))
10:53clojurebot(g (f x))
10:53j-pb,(macroexpand '(some-> x f g))
10:53clojurebot(let* [G__78 x G__78 (if (clojure.core/nil? G__78) nil (clojure.core/-> G__78 f)) G__78 ...] G__78)
10:53justin_smithmaxpn: something like cond-> then?
10:53justin_smith(doc cond->)
10:53clojurebot"([expr & clauses]); Takes an expression and a set of test/form pairs. Threads expr (via ->) through each form for which the corresponding test expression is true. Note that, unlike cond branching, cond-> threading does not short circuit after the first true test expression."
10:54justin_smithmaxpn: since you have multiple error states that you want to destinguish
10:54maxpno, sorry, I was not correct - "if( err_msg = valid_field1()) { return err_msg;} ... )"
10:55maxpnI have to save tha value of comapsion like if-let
10:55maxpnbut chained if-let is my last chance :)
10:56j-pbhrmmm
10:56j-pbif( a = f1() ) { return g1(a);} if(a = f2()) { return g2(a);}
10:56j-pbthats basicallya cond right?
10:56kwladykajustin_smith, and what is your opinion about architecture? how it should look?
10:56j-pbbecause the return will short circuit
10:57snowellj-pb: I think the problem is it's not checking "a == f1()," it's setting the return value to a and using it
10:57maxpnno. (cond ..) is like "if (f1()) { ... }" result of function is lost
10:57j-pbmaxpn: could you restate your problem?, I feel like we have 3 semantically different things here
10:57snowellAnd evaluating whether or not said return value is truthy
10:57justin_smithkwladyka: that is a very broad question! - what I have found to work well is plain data structures, stuartsierra's component (or something like it) to manage data deps between namespaces, and prismatic/schema to describe exactly those properties of nested data you are relying on
10:57j-pbmaxpn: so you do a = (cond
10:58j-pbah I see what you mean
10:58maxpn"if (a = f() ) ... " is not just a condition - it is an assignment to var a
10:58j-pbyeah
10:58j-pbso you want both a as well as the result of its application to something right?
10:58justin_smithmaxpn: cond allows the then clause to get the result of the condition as an arg
10:59justin_smithmaxpn: oops, not cond, condp
10:59justin_smith(doc condp)
10:59clojurebot"([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which must be a unary fu
10:59maxpnmoment...
11:00j-pb(inc justin_smith)
11:00lazybot⇒ 265
11:02kwladykajustin_smith, what with separatig business model/logic from other code?
11:02justin_smithkwladyka: namespaces organize things, if you use immutable data you don't really need information hiding or any of that
11:02justin_smith(mostly)
11:04kwladykabut dont you feel it will be good to close circle with business logic and on this circle put code like database queries etc. and on this circle put interface?
11:04kwladykadiscussion began with http://stackoverflow.com/questions/29867671/clojure-architecture-like-uncle-bob-did/29985761#29985761
11:10kwladykajust i fell i have to close some things in smaller "independent" parts
11:12justin_smithkwladyka: I actually think protocols make sense for inserting one's own functionality into a more general library (ring is a perfect example of how well this works), but without mutable state you don't really need hiding, and local mutable state is worse than global mutable state
11:15kwladykaso how to do architecture which i can make system as small parts of something bigger. I don't want mess with core and GUI - it has to be separate. Also i preffer to separate database functions. And later.... if i will find some part of system like payments is reapatable and always the same maybe i want made from this module/microservice
11:15binjuredis there a string buffer sorta thing that works with (with-open)?
11:16kwladykaIs there any other option like uncle bob clear architecture?
11:20justin_smithbinjured: I don't know, does with-out-str count?
11:22maxpnthank you all, now I use (condp ... :>> ...)
11:22binjuredjustin_smith: heh, not really. i guess i could pass *out* as a writer, but it feels dirty.
11:22hellofunksometimes when i write i pass out all the time
11:23justin_smithkwladyka: as I mentioned before there is the component lib, and that makes it easy to provide data or functionality between self-contained pockets of functionality
12:07mmeixok, beginner's question again: how much do I really need to know about POM files (xml, properties)?
12:08justin_smithmmeix: usually nothing at all, if you are interacting with the maven system it should be via lein which just makes these pom files for you
12:08mmeixok
12:08mmeixor boot
12:08mmeixthanks
12:08justin_smithsure, boot uses the maven system too
12:09mmeixset and forget :-)
12:11mmeixthe POMs are used to build the final jars, right?
12:12justin_smiththey are built to go with the jars, and then the maven system uses the pom in the jar to see its deps and version etc.
12:12mmeixah, ok
12:12mmeixthnx afgain
12:12mmeix-f
12:14mmeixor an Afghan, sheared ("afgain")
12:17mmeix(just trying out boot ...)
12:30binjuredanybody know how to find out where a (require) library was loaded from on the filesystem?
12:34TimMcbinjured: Yeah, but it's ugly.
12:36binjuredTimMc: i managed to confirm a suspicion without it ... if something doesn't show up in `lein deps :tree` i guess i have to assume it's coming from my lein profile?
12:38TimMcI'll write something up anyhow.
12:43TimMc...this works in one of my projects but not another. :-(
12:44binjuredman, this is weird. for some reason lein and maven both pull down like 5 versions of cheshire, despite only one appearing in `lein deps :tree`, `mvn dependency:tree`, and `mvn help:effective-pom`
12:45TimMcMight be pulling down all the versions it encounters in the dependency graph, even though only one actually wins out to be used for the classpath.
12:45TimMcor someone has specified a version range
12:46binjuredTimMc: yeah, the annoying part is that the wrong one is winning so the app breaks.
12:47TimMcDoes lein deps :tree give you some conflict info at the top of the output?
12:47binjurednope
12:49TimMcWhat version of lein?
12:50binjured2.5.1
12:53bittsReading an Oracle column of type NUMBER(2) returns a BigDecimal in clojure.core.jdbc version 0.3.6. But http://dev.clojure.org/jira/browse/JDBC-57 says it was fixed a few years ago. Any info on this?
12:54bitts[org.clojure/java.jdbc "0.3.6"] rather..
12:55hiredmandid you read the comments on the ticket? it reads like the decision was to add extension points so users can change the behavior, not actually changing it
12:57bittshiredman: Thanks, I missed that.
12:57bittshiredman: now to figure out the decision points. :rowfn perhaps.
12:59TimMcInteresting: When I run (.getResource (class #()) "clojure/core__init.class") in lein repl, it yields a URL in some projects and nil in others.
12:59TimMcI think the latter happens in AOT'd projects, but why?
13:01binjuredheh, so weird. even after removing everything from my ~/.lein/profiles, all dependencies from the :dev profile of my project, and every lein plugin... still, it downloads old versions of cheshire.
13:01justin_smithbinjured: lein deps :tree will tell you why this is happening
13:01hiredmanbinjured: what evidence do you have that it downloads old versions of cheshire?
13:02binjuredjustin_smith: no, it will not... only 5.4.0 is mentioned anywhere.
13:02binjuredhiredman: when i run `lein run` it says so ;)
13:02hiredmanbinjured: what do you mean it says so?
13:03binjuredhiredman: (1) remove from local maven repo (2) `lein run` (3) "Retrieving cheshire/cheshire/4.0.3/cheshire-4.0.3.pom from clojars"
13:04binjuredplus a few other versions
13:04binjurednone of which appear in any lein tree, maven tree, or effective pom
13:04hiredmanbinjured: lein may download transitive dependencies that end up being overriden
13:05hiredmanlein classpath will show you the classpath lein uses
13:12TimMcbinjured: You probably have like 5 dependencies that ask for different versions of cheshire, so maven gets curious about them and downloads all of them.
13:13binjuredTimMc: well, maven's curiosity is killing me!
13:13TimMcThen one wins according to a complicated set of precedence rules, thunderdome-style death matches, and coin flips.
13:13TimMc(I have been assured it is actually deterministic and fairly straight-forward, but have not looked into it myself.)
13:14TimMclein deps only shows the winner.
13:14binjuredi finally managed to get it to stop downloading most of them, but the super crazy part now is that i don't even know where `cheshire.core` is coming from because in the repl the contents of the NS are wrong for either version found in ~/.m2
13:14TimMcLessee, I think I wrote a tool to find these.
13:16TimMcbinjured: Here, it's not released as an artifact yet, but download this, run `lein install`, add it to your :plugins, and run `lein arbuscule :print` in your project: https://github.com/timmc/arbuscule
13:16TimMcThat will show you the full dependency graph.
13:16binjuredit's a "the phone call is coming from... inside the house!" situation now. damn you, maven dependency nonsense! you followed me from java and keep haunting me!
13:17binjuredi will check it out, thank you
13:17TimMcI think it's technically... aether? that backs both maven and lein.
13:18TimMcarbuscule basically gives you an adjacency list right now, not a fully played-out tree.
13:20TimMcIt's basically just a frontend onto pomegranate.
13:51noncomis anyone familiar with overtone here?
13:51noncomi wonder if it is possible to apply effects to sampled instruments...
13:53CoaxialLatencyi'd hope so
13:56justin_smithnoncom: yeah, overtone is network bindings to the supercollider UDP server api
13:56noncomyeah, it is :)
13:57noncomi did not find an api or docs on applying effects to sampled instruments though...
13:57justin_smithnoncom: so yeah, just like in supercollider, any audio output can be run through any effect that takes audio input (look into "synth groups" for one approach to this in sc at least)
13:57noncomah, so i re-route the sampler output through an effect...
13:57justin_smithnoncom: in the sc engine, anything that can produce audio can be plugged into anything that takes audio input
13:58noncomdoes supercollider have this notion of "wires" ?
13:58justin_smithnoncom: exactly, it's like a mixing board
13:58noncomcool, that makes it rather clear
13:58justin_smithif you look into synth groups it covers all this stuff
13:58noncomvery nice, i'll head right there!
13:59justin_smithnow how nicely overtone provides access to any of this is of course another question, but I would expect it to be usable
13:59justin_smithnoncom: http://www.dewdrop-world.net/sc3/tutorials/index.php?id=1
14:00noncomi am at a crossroads actually
14:00noncomi have to chose between minim and overtone/sc
14:01justin_smithnoncom: be sure to check out pink too if you want to try anything experimental - pink is implemented in pure clojure
14:01justin_smith(well mostly pure clojure, I think it might have a java class file or two)
14:01justin_smithbut pink is going to mostly only be useful if you want to try experimental dsp algos
14:01hellofunknoncom: https://www.youtube.com/watch?v=wDcN7yoZ6tQ
14:02justin_smithhellofunk: yup, that's the project. Steven Yi is one of the lead devs of csound, so he knows his shit.
14:02noncomwow
14:02hellofunkjustin_smith: yes he's huge. i don't mean he's fat. i mean a lot of people who hardly have heard of clojure follow his work
14:03noncomyeah, csound is a big thing
14:03noncomalso, he has a very nice emacs setup
14:04hellofunknoncom: looks like aquamacs or something. tabbed buffers?
14:04noncommaybe maybe.. idk, i do not use emacs often, but sometimes i use it.. still looking for a perfect setup
14:05noncomafaik most people are still looking... :)
14:05CoaxialLatencywhat do you use mostly?
14:07noncomCoaxialLatency: currently i am mostly on prelude + the bliss theme + paredit + autocomplete + smex and some other things i do not remember exactly
14:08noncombut i am not using it for clojure, i program dotlisp in it
14:09CoaxialLatencyi see
14:15seangroveHey all, trying to use immutant 2.0.1, doesn't seem to be able to find immutant.web.websocket ns
14:16seangroveI'm using [org.immutant/immutant "2.0.1"] in my project.clj, which I *think* should pull in all the deps
14:18seangroveLooks like it might have been unified under immutant.web.async ns and the docs aren't updated...
14:19tcrawleyseangrove: which docs are you looking at?
14:20seangrovetcrawley: http://immutant.org/tutorials/web/#Development_Mode
14:21tcrawleyseangrove: ah, those are the 2.x alpha docs - you should look at http://immutant.org/documentation/current/apidoc/guide-web.html (transitively linked from the top of that tutorial)
14:23seangrovetcrawley: And the 2.x alpha is older than 2.0.1, right?
14:23tcrawleycorrect
14:23seangroveJust making sure...
14:23seangroveGreat, thanks
14:23tcrawleyit's really 2.0.0.alpha1. and my pleasure!
14:33TimMcbinjured: If you're curious, this is how I check where a namespace was loaded from: https://gist.github.com/timmc/1dc26376e3cc475e125e
14:36seangrovetcrawley: Is there a way to access the session from a websocket on-open event?
14:36seangroveLooks like the only thing passed in is the channel
14:38tcrawley(immutant.web.async/originating-request ch) will give you the request map which will give you the session as it was when the channel opened
14:41binjuredTimMc: thanks. really losing my mind here... (.getResource (class #()) "cheshire/core.clj")
14:41binjured#object[java.net.URL 0x6f06d24e "jar:file:/home/tom/.m2/repository/cheshire/cheshire/5.4.0/cheshire-5.4.0.jar!/cheshire/core.clj"] <-- this is correct. if i open that file, i see `(def decode-strict parse-string-strict)` ... despite this, neither of those names exist in the require'd namespace.
14:42creeseRan into a strange case verifying a fressian encoding. Are fressian encodings unique?
14:45TimMcbinjured: What about cheshire/core__init.class ?
14:45binjurednil
14:49binjuredTimMc: but then, (.getResource (class #()) "clojure/core__init.class") is nil too so i'm not sure how interesting that is.
14:52TimMcDoes your project have any AOT namespaces?
14:53TimMcI still don't understand why that snippet doesn't always work, but I think it has to do with AOT.
14:53binjuredlike, pure java namespaces?
14:54binjurednot familiar with what all gets AOT'd in clojure vs. not
14:55TimMcDo you have a :main or an :aot key in your project.clj?
14:56binjureda :main, yeah
14:57TimMcTry lein clean and set :main [^:skip-aot your.main.ns] just for the time being, then lein repl
14:58TimMcLeiningen automatically adds your :main ns to the aot list (though that will change in a future version.)
15:00binjuredTimMc: "Option -m requires a valid namespace argument, not [my.main.ns]"
15:00TimMcIf that doesn't make the test for clojure/core__init.class non-nil, then it's probably a bad idea to keep using the getResource approach (since I would have no more ideas about why it works/does not work.)
15:00TimMcOh whoops, drop the brackets. :-)
15:02binjuredit's not nil anymore
15:03binjuredTimMc: the cheshire core__init.class is coming from leiningen itself, not the m2 repo
15:05binjuredone of my user profile dependencies is [leiningen #=(leiningen.core.main/leiningen-version) :exclusions [cheshire]] but that exclusion is not doing what i thought it would.
15:08TimMcHmm... now, that might be a REPL thing.
15:08TimMcThe REPL has extra dependencies added to it that your code wouldn't have.
15:09seangrovetcrawley: Trying to access some session data in my websocket handlers https://www.refheap.com/b64aa3b5a40720b155c8d688b but the session is always empty - am I wrapping things in the wrong order?
15:13binjuredTimMc: well, this particular repl is embedded in the app so it's definitely applying there too. removing that dep from my list and everything that used it resulting in getting the correct library back.
15:14tcrawleyseangrove: yes, you should move the wrap-websocket call above wrap-session - if wrap-websocket is below it in the chain (above it in the middleware stack), wrap-session will never be called
15:14whodidthisi would imagine wrap-session middleware goes before ?assign-id
15:14tcrawleyseangrove: that middleware had to be last in the thread in alpha1, but that is no longer the case
15:15seangrovetcrawley: Ah, My bad for reading the old docs, thought it had to be the terminating handler
15:15tcrawleyyeah, no longer. sorry for the confusion
15:17seangroveNo worries - that works well now, thanks!
15:17tcrawleygood deal!
15:17seangroveOverall immutant seems pretty nicely put together
15:18tcrawleythanks! feel free to hang out in #immutant if you like
15:19seangrovetcrawley: Sounds good, it's in the init.el now
15:33noncomtcrawley: hi!
15:34tcrawleynoncom: ahoyhoy!
15:35noncomtcrawley: someone adviced me to ask you
15:35noncomtcrawley: i have a couple of jars on clojars that are missing now!
15:35noncomlike, they've been there and they disappeared
15:35tcrawleywhat jars?
15:35noncomwhat do you think?
15:35noncomwait a sec
15:36noncom[org.noncom/tuio4j "1.1"]
15:36noncom [com.illposed.osc/javaosc-core "0.3"]
15:36noncomthese two
15:37noncomhttps://clojars.org/users/noncom the groups are not listed too
15:39tcrawleyany idea when you deployed them? neither show up in the deploy event log that goes back 2+ years
15:40tcrawleyand neither appear in the backup dir where we store a copy of deleted artifacts
15:43tcrawleynoncom: javaosc-core is in maven central: https://search.maven.org/#artifactdetails|com.illposed.osc|javaosc-core|0.3|bundle
15:43noncomtcrawley: ah, i am sorry about javaosc-core, i deployed my osc on clojars and it disappeared, so i must have swithced to this one... that was some time ago, you see..
15:44noncomtcrawley: but i am 100% sure of [org.noncom/tuio4j "1.1"]
15:44noncomit is not there, right?
15:44tcrawleynot that I can see, no
15:44tcrawleyany idea when you deployed it?
15:44noncomi deployed it a while ago, maybe somewhere around the new year...
15:45noncomtcrawley: i am starting to think that i have fabricated the memory...
15:45tcrawleythat's before my time with clojars, but I don't see a record of it anywhere
15:45tcrawleyhey, I'm not saying you're crazy :)
15:45gfredericks~tcrawley is not saying you're crazy
15:45clojurebotOk.
15:46tcrawleygfredericks: thanks!
15:46noncomhehe :) idk but the whole story is a little strange. just suddenly, moved on another machine and i find that lein fails to pull the dep...
15:46tcrawleygfredericks: speaking of crazy, will you buddy with me at STL?
15:47tcrawleynoncom: is it possible you had it installed in your local ~/.m2/ so you never noticed it wasn't in an external repo?
15:47noncommaybe... looks like that was the case, i just thought i did deploy it to clojars
15:48noncombut apparently i did not for some reason...
15:48gfrederickstcrawley: you're coming???
15:48lazybotgfredericks: Oh, absolutely.
15:48tcrawleytotes
15:48gfredericksbirthday party!
15:48tcrawley_exactly_
15:49gfredericksand bhauman will be there too
15:49tcrawleyindeed. we just need cfleming, et al to get the band back together
15:50gfrederickshe's probably not speaking and so probably not coming I bet :/
15:50tcrawleyyeah
15:51gfredericksand jim not coming?
15:52tcrawleyhe's a "maybe". he has a ticket, but isn't sure he can make it
15:54gfredericksmaybe blackmail him
15:54tcrawleyI'll see what I can do
15:54tcrawleyjcrossley3: ^
15:58binjureddoes this make sense to anybody? https://gist.github.com/tdavis/e11c9c882f4eb27bd447 -- i've been trying to debig this for over an hour now, i am not returning a bufferedinputstream from anywhere and cannot figure out where it might be coming from.
15:59justin_smithbinjured: is something trying to json-encode the request body object?
16:01binjuredjustin_smith: not that i'm aware of, no. though it doesn't seem to matter what i do in my actual request handler, so i guess it's somewhere in the middleware? i dunno.
16:03justin_smithyeah, likely middleware nonsense I guess
16:04cflemingtcrawley: Sniff sniff
16:05tcrawleywe'll miss you my friend
16:07jcrossley3gfredericks: tcrawley has nothing on me
16:07tcrawleythat sounds like a challenge
16:07sdegutisWhat's the best way to get from [[:a 1] [:b 1] [:b 3]] to {:a 1 :b 4} ?
16:09amalloysdegutis: apply merge-with +
16:09sdegutishmm thought it had something to do with merge-with, thanks
16:09amalloywell more specifically ##(apply merge-with + (for [[k v] '((a 1) (b 1) (b 3))] {k v}))
16:09lazybot⇒ {b 4, a 1}
16:13H4ns,(apply merge-with + (map (partial apply hash-map) [[:a 1] [:b 1] [:b 3]]))
16:13clojurebot{:b 4, :a 1}
16:29cflemingtcrawley: I must make it to STL one of these days
16:30cflemingtcrawley: It's a longish trip though!
16:32gfrederickscfleming: considering relocating to STL
16:32mikerodis it not the case that = and == are different for numerics in Clj?
16:33gfredericks[(= 3 3.0) (== 3 3.0)]
16:33gfredericks,[(= 3 3.0) (== 3 3.0)]
16:33clojurebot[false true]
16:33gfredericks,((juxt = ==) 3 3.0)
16:33clojurebot[false true]
16:37tcrawleycfleming: I'll be there, so it will totally be worth it
16:38justin_smith,(map (juxt identical? = ==) [3 3000 3000 3000] [3 (+ 1000 2000) 3000 3000.0])
16:38clojurebot([true true true] [false true true] [false true true] [false false true])
16:40H4nswhat would be a good way to retrieve every other element from a seq? (1 2 3 4) => (1 3)
16:41justin_smithone way: (comp (partial map first) (partial partition 2))
16:42oddcullyi see no points
16:42H4nsjustin_smith: thanks!
16:47amalloyjustin_smith: is that your final answer?
16:47justin_smithamalloy: I am sure there is something better, but that was the first thing I thought of
16:48amalloywell there is a builtin: ##(take-nth 2 '(1 2 3 4))
16:48lazybot⇒ (1 3)
16:48justin_smithman, I always forget that one
16:48amalloyH4ns: ^
16:48H4nsamalloy: much nicer, thanks!
17:02pbxPSA: i don't know that it will lure anyone away from the excellent refheap, but i added some clojure syntax detection to my pastebin at http://dpaste.com/ -- meaning if you paste clojure code it can automatically set the syntax
17:41vhquanghi everyone,
17:42vhquangI am very new to clojure, and am having a problem with pedestal library
17:42vhquangif anyone has experience with that library, can you spend few minutes help me out?
17:44wasamasawasn't that this whole webframework thing?
17:44vhquangyes it it
17:44vhquangit is
17:44wasamasawell, the mindshare tends to go towards the opposite here
17:45wasamasacomposing your web application by using ring and libraries complementing it
17:45seangrove,(into {} (map vec (partition 2 (interleave (keys {:a 10 :b 20 :c 30}) (repeat {})))))
17:45wasamasaso you'll probably find less support for it
17:45clojurebot{:a {}, :b {}, :c {}}
17:46seangrove,(into {} (partition 2 (interleave (keys {:a 10 :b 20 :c 30}) (repeat {}))))
17:46clojurebot#error {\n :cause "clojure.lang.Keyword cannot be cast to java.util.Map$Entry"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.Keyword cannot be cast to java.util.Map$Entry"\n :at [clojure.lang.ATransientMap conj "ATransientMap.java" 44]}]\n :trace\n [[clojure.lang.ATransientMap conj "ATransientMap.java" 44]\n [clojure.lang.ATransientMap conj "ATransientMap.java" 17]\n ...
17:46justin_smithseangrove: only vectors can be entries
17:46vhquangwe are near a demo day, so switching library isn't the prefer path for me
17:46seangrovejustin_smith: Ah, headed off my first question
17:46justin_smithalso, the error message has a bug in it
17:46vhquangI just hope to find some temporary fix if possible
17:47seangroveSeconds question though, is there a cleaner way of resetting the values to {}
17:47seangrove(without bringing in mapvals)
17:47justin_smith,(zipmap (keys {:a 10 :b 20 :c 30}) (repeat {}))
17:47clojurebot{:a {}, :b {}, :c {}}
17:47seangrovebah! zipmap! Should have remembered
17:48seangroveThanks as usual, justin_smith
17:48seangrove(inc justin_smith)
17:48lazybot⇒ 266
17:48amalloyseangrove: if you need to do something similar but more complicated, just about every "build a collection based on another one" problem can be written in terms of (into y (for [x xs] ...))
17:49amalloy,(into {} (for [[k v] {:a 10 :b 20 :c 30}] {k {}}))
17:49clojurebot{:a {}, :b {}, :c {}}
17:49wasamasavhquang: well, you'll hardly get someone here to help you if you don't go into any further detail as nobody is bold enough to proclaim themselves gurus
17:50justin_smithwasamasa: speak for yourself
17:50seangrovejustin_smith: I believe he was
17:51vhquangwasamasa, thanks for explaining that to me, I am very new to the community here
17:51justin_smithvhquang: in general, the thing that works best on IRC is to just ask your question and stay logged in
17:51justin_smithmaybe repeat it if it's been a while and nobody responded
17:52vhquangthe problem I have is with the io.pedestal.interceptor.helpers, when compiling the uberjar
17:52justin_smithand then like - maybe hours later - the perfect answer will show up out of the blue
17:52vhquangah OK
17:55vhquangI have no problem running the pedestal project with lein, but running the compiled jar file giving me error: java.lang.IllegalArgumentException: No matching ctor found for class io.pedestal.interceptor.helpers$before
17:56vhquangand I use the AOT compilation as well
18:21sdegutisWhat's a dazzling way to transform the number 12345 into the string "12,345"?
18:22amalloysdegutis: ask java to do it
18:22sdegutisamalloy: thanks I'll ask #java
18:22amalloysdegutis: i mean the answer is java.util.text.NumberFormat, or something like that
18:22amalloyi forget what package it's in
18:23sdegutis,(.format (NumberFormat/getNumberInstance Locale/US) 35634646)
18:23clojurebot#error {\n :cause "No such namespace: NumberFormat"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: No such namespace: NumberFormat, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6543]}\n {:type java.lang.RuntimeException\n :message "No such namespace: NumberFormat"\n :at [clojure.lang.Util runtimeExce...
18:24sdegutisclojurebot: shut up nobody asked you
18:24clojurebotPardon?
18:24sdegutisclojurebot: nothin just bsayin hi
18:24clojurebotexcusez-moi
18:24sdegutisclojurebot: dont worry bout it bruh
18:24clojurebotCool story bro.
18:27sdegutis,(.format (java.text.NumberFormat/getNumberInstance java.util.Locale/US) 1234567)
18:27clojurebot"1,234,567"
18:27sdegutisamalloy: I was kind of assuming you would say to use the mysterious cl-format function
18:27amalloygross
18:27sdegutisIndeed.
18:28sdegutisBut most of Clojure is gross.
18:31irctchi
18:31sdegutisamalloy: you won the prize btw.
18:32sdegutisamalloy: cuz that worked.
18:34sdegutisamalloy: unfortunately you have to redeem the prize in person over irc
18:38whodidthissingletons4lyfe
18:40whodidthisimagine someone actually having multiple instances of numberformatters of a selected locale around, what an idiot
18:45elvis4526how does if check the boolean value of an expression ?
18:45elvis4526is it with true? ?
18:46vermaI have a seq of vecs, I want to find the item I am interested in and change it, I could do a map over it and check if an item is the one I am looking for and return the updated item, but I would imagine that this approach would cause iteration beyond my item of interest, what's a good way of doing something like this?
18:46vermabasically take the vec I am interested in and return a new one, maintaining its spot in the seq
18:47andyfelvis4526: At the Java byte code level, every value except false and nil is considered true
18:47vermaI could do some drop-while take-while stuff, but I was wondering if there's a better way of doing this
18:47amalloywhodidthis: huh? getNumberInstance isn't a singleton, i'm fairly sure
18:47vermamay be split-with
18:48andyfelvis4526: That is definitely not what checking with true? would do. That only returns true for the value true.
18:48amalloymaybe i am getting it mixed up with the getInstance of something else, like parsers instead of formatters, but i know something in there *requires* multiple instances, because it's not threadsafe
18:48elvis4526oh okay - thanks
18:48amalloyandyf: uhhhhh, i don't think that's the java bytecode level, that is a clojureism
18:48amalloyat the java bytecode level, one thing is true, which is the boolean true, and one thing is false, which is the boolean false
18:49andyfMaybe I didn't say it clearly enough. My meaning is that the Clojure compiler generates Java byte code that does the checks I describe.
18:49amalloyyes, that is certainly what the bytecode generated by clojure's 'if special form does
18:49whodidthisoh, didnt think getInstance type of things were used for that kind of stuff too, bad joke heh
18:52whodidthisthen again i dont know whats going on with the logging stuff at all either so mebbe shouldn't comment about java
19:06hiredmanamalloy: simpledateformat
19:06amalloy$javadoc java.util.SimpleDateFormat
19:06amalloyoh well
19:06amalloy$javadoc java.text.SimpleDateFormat
19:06lazybothttp://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
19:06amalloyyeah, that's the vile thing indeed
19:57hyPiRionOmg, there's an actual ComplexDateFormat: http://www-01.ibm.com/support/knowledgecenter/SSEPH2_11.1.0/com.ibm.ims11.doc.classicjdoc/topics/com/ibm/ims/base/ComplexDateFormat.html
19:57hyPiRion"extends java.text.SimpleDateFormat"
20:42vhquanghi, can someone help me to understand the difference between (require ....) and (:require ....) ? I cannot get a good answer from google
21:06creeseCan you deploy pedestal as an uberjar?
21:08mearnshvhquang: require is a function, normally you'd only use it at a REPL, favouring the use of :require inside an ns macro otherwise
21:08mearnshthey both do the same job, but :require only works inside an ns form
21:09vhquangthanks mearnsh!
21:10vhquang@creese, I can compile the uberjar, but cannot deploy(or run) it
22:52jjttjjas a rule, should a clojure library that just wraps an api deal with java dates or are joda time dates acceptible? The dates are coming from strings the api returns
23:03bbloomat this point, i consider joda to be "the api the jvm should have had"
23:03bbloomit's so widely deployed that you might as well depend on it until the unlikely event that somebody complains
23:09jjttjjbbloom: Java dates are a little more conviente to deal with sometimes in clojure like with the built in reader literals, etc, is this not enough of a big deal to make a difference?
23:09jjttjjconvenient*