2015-06-19
| 00:32 | justin_smith | yedi: try searching for "debouncing" |
| 00:33 | yedi | thanks |
| 00:42 | yedi | justin_smith: cool, this looks like itll do the job: https://gist.github.com/swannodette/5888989 |
| 00:42 | yedi | now i just gotta think of what a good debounce time would be, prolly like 250ms |
| 00:43 | justin_smith | yedi: likely looking a the allowed delay between clicks in a double-click would be a good starting point |
| 01:39 | Jake_ | can someone who knows datomic give me feedback https://groups.google.com/forum/#!topic/datomic/auHSz3evCuA |
| 02:49 | tmtwd | does clojure have a new operator? |
| 03:00 | noidi | tmtwd, there's some special syntax for calling the constructor of a Java class: (TheClass. arg1 arg2) |
| 03:04 | noidi | http://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form-(Classname.%20args*) |
| 03:05 | noidi | ah, I had forgotten that there's the special form "new", to which the dotted form is expanded |
| 03:05 | noidi | in practice all you see is (TheClass.) |
| 03:32 | tmtwd | hello |
| 03:42 | tm89 | hello |
| 03:43 | hellofunk | tm89: greetings |
| 05:00 | H4ns | what is a good way to configure clojure systems? i'd hope for a library that supports configuration files in edn. |
| 05:19 | tmtwd | lein? |
| 05:23 | egli | H4ns: https://github.com/weavejester/environ |
| 05:27 | H4ns | egli: thanks! |
| 05:42 | H4ns | hm. 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:43 | bluesky44 | in 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:43 | bluesky44 | I've written a throw-err function but don't know where to put it. |
| 05:44 | bluesky44 | If it's in my macros.clj file, I get a 'no such namespace: js' error. |
| 05:44 | bluesky44 | https://gist.github.com/mhuebert/2221c18e9df11f2fd766 |
| 05:48 | kungi | I am trying to send messages via postal and keep getting this error: "nodename nor servname provided, or not known" |
| 05:48 | kungi | This seems to hint on dns resolution |
| 05:48 | kungi | How can I debug this? |
| 05:52 | kungi | Nevermind I had an error in my hostfile |
| 05:52 | kungi | :-( |
| 06:37 | kaffeeboehnchen | Has 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:50 | wasamasa | no error callback? |
| 06:53 | kaffeeboehnchen | wasamasa: What do you mean? |
| 06:53 | wasamasa | kaffeeboehnchen: yesterday someone mentioned your library is using futures or something |
| 06:54 | wasamasa | kaffeeboehnchen: usually you have one for the success and another one for the error case |
| 06:54 | kaffeeboehnchen | wasamasa: http-kit is using promises |
| 06:54 | kaffeeboehnchen | but compojure is used for routing and that should just return the result of that function |
| 06:56 | kaffeeboehnchen | ah, I guess I have to write ring handler https://github.com/ring-clojure/ring/wiki/Concepts#handlers |
| 07:53 | justin_smith | H4ns: I have used environ to select a file name to load for config |
| 07:54 | H4ns | justin_smith: i kind of like the flexibity of environ and am now using it together with edn files at well-known locations. |
| 07:54 | justin_smith | yeah, sounds pretty much like what I was talking about |
| 07:55 | H4ns | well, i'm merging environ/env with whatever i'm reading from the selected configuration files. |
| 07:55 | H4ns | but everyone to their liking |
| 07:55 | kaffeeboehnchen | By the way, writing the ring handlers helped for my problem earlier. |
| 08:20 | elben | What other languages support symbols (e.g. :name) other than Ruby, Clojure and Scala? |
| 08:21 | wasamasa | every other lisp dialect? |
| 08:22 | justin_smith | elben: to be clear, :name is not a symbol, it is a keyword (I think Ruby calls keywords symbols though) |
| 08:22 | elben | yes, I meant that. |
| 08:23 | wasamasa | just like the lisp implementation its author studied :P |
| 08:23 | wasamasa | (type-of :foo) ;=> symbol |
| 08:23 | justin_smith | wasamasa: what weirdo lisp implementation was that? |
| 08:23 | wasamasa | justin_smith: the one living inside emacs |
| 08:24 | justin_smith | WEIRD and how did I not know that... |
| 08:24 | wasamasa | see http://www.slideshare.net/yukihiro_matz/how-emacs-changed-my-life for details |
| 08:24 | H4ns | in common lisp, keywords are symbols in the special "KEYWORDS" package |
| 08:24 | wasamasa | I've stumbled on a few of these while reading ruby C sources |
| 08:24 | H4ns | it is just clojure making them be totally separate |
| 08:24 | wasamasa | like, them reusing the convention of Qtrue, Qfalse and Qnil although none of these are quoted things :P |
| 08:25 | justin_smith | wasamasa: haha, cargo cult |
| 08:26 | TEttinger | I think LiveScript supports a sort of keyword equivalent. you can do \something , and it will compile to "something" |
| 08:26 | TEttinger | but it is still a string |
| 08:27 | justin_smith | my 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:32 | elben | I use those words interchangably at work (Ruby)—I think my co-workers understand… |
| 08:33 | justin_smith | elben: but we do clojure, so when they say symbol and mean keyword I often get confused |
| 08:33 | elben | Yes, an important distinction there :) |
| 09:46 | zathras | Hi. 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:46 | zathras | *get |
| 09:47 | wasamasa | pprint? |
| 09:49 | zathras | wasamasa, ty. I am new to clojure. Can I use pprint from the commandline somehow? |
| 09:49 | zathras | looking at the docs it seems at first sight something to be used from within a clojure program. |
| 09:49 | wasamasa | it is |
| 09:50 | wasamasa | generally clojure isn't really something you'd use for commandline utilities |
| 09:50 | wasamasa | it's more of a fit for long-running servers you talk to with something else |
| 09:51 | zathras | I 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:51 | zathras | hence my asking here |
| 09:57 | ordnungswidrig | What are my options for mocking fns in clojure.test tests? I know of with-redefs-fn but thats pretty low level |
| 09:58 | Duke- | 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:59 | Duke- | doesn't sound much easier than regexes though I guess |
| 09:59 | zathras | Duke-, what is an EDN parser? |
| 10:00 | zathras | I am fine with python, but not familiar with "EDN" |
| 10:01 | Duke- | EDN is the format of Clojure code (or rather a subset) |
| 10:03 | zathras | ty Duke- , I will look into it |
| 10:17 | kwladyka | after 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:25 | kwladyka | topic: clean architecture in Clojure |
| 10:25 | j-pb | just looking at that makes my brain melt |
| 10:26 | j-pb | am I the only one to consider the architectural patterns an antipattern? |
| 10:27 | puredanger | I haven't read it yet, but I suspect http://www.rkn.io/application-architecture/ would be of interest |
| 10:37 | kwladyka | j-pb, it depend witch one ;) |
| 10:37 | kwladyka | in my opinion architecture is one of the most important thing durgin development |
| 10:37 | j-pb | well, I kinda like the microservice stuff that has come up in the clojure world recently |
| 10:38 | kwladyka | it is easy to write something but develop this 5 years not |
| 10:38 | j-pb | yeah but trying to press your application into a pedetermined shape is pretty harmfull imho |
| 10:39 | j-pb | all of these articles mention multimethods and protocols as a great design tool |
| 10:39 | j-pb | while they are absolutely horrible and should only be used if functions and data fail |
| 10:39 | kwladyka | yes, but this one is really close to how i am thingking about that |
| 10:39 | kwladyka | i want have business model in core layer separater with "not important code" |
| 10:41 | kwladyka | when 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:41 | j-pb | I still woudldn't use a lot of the technologies mentioned before |
| 10:41 | kwladyka | but ofcourse nobody know the best soltuion for everything :) |
| 10:42 | j-pb | the stack overflow answer is especially ugly |
| 10:42 | kwladyka | what do you mean when say "technologies"? |
| 10:42 | j-pb | protocols and reify for example |
| 10:42 | kwladyka | why? |
| 10:42 | clojurebot | why is startup slow is busy compiling the `for` macroexpansion |
| 10:43 | j-pb | if 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:43 | maxpn | place advice me how to do next (sample in javascript): if( a = f1() ) { return g1(a);} if(a = f2()) { return g2(a);} ... |
| 10:44 | maxpn | like (cond ... ) but with returned value |
| 10:44 | j-pb | they 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:44 | snowell | maxpn: (cond) does return the value |
| 10:45 | j-pb | the load/save-data protocol is typical OO crap, persistent datastructures are already persistent |
| 10:45 | maxpn | snowell: no, I mean "get value from function and return f(value) if value is true" |
| 10:45 | kwladyka | j-pb, so in your opinion how would you do architecture? |
| 10:46 | maxpn | snowell: and there are many such functions like in (cond ... ) |
| 10:46 | justin_smith | j-pb: in what way are records as defined by defrecord not persistent? |
| 10:47 | j-pb | kwladyka: 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:47 | j-pb | kwladyka: it epends on the thing I build really |
| 10:47 | j-pb | justin_smith: you can't serialize their behaviour with them |
| 10:48 | snowell | maxpn: I would probably do nested `if-let`s |
| 10:48 | justin_smith | j-pb: their behavior is in their definition, if you can load their reader literal, you have loaded their behavior |
| 10:48 | snowell | ,(if-let [a false] :a (if-let [b true] :b (if-let [c true] :c))) |
| 10:48 | clojurebot | :b |
| 10:48 | j-pb | justin_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:49 | maxpn | snowell: nesten if-let's? no more elegant way? ... :( |
| 10:49 | justin_smith | j-pb: oh yeah, don't put your records on the wire |
| 10:49 | snowell | But 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:49 | justin_smith | that's not about persistence, that's about communicating between processes |
| 10:49 | j-pb | justin_smith: yeah, that's the nice thing about persistence for me, that it's independent of the context of execution |
| 10:49 | justin_smith | OK |
| 10:49 | snowell | maxpn: Sure, there might be a more elegant way. I'm still kind of learning myself :) |
| 10:50 | j-pb | justin_smith: yeah kinda, but then serialized java objects would also be persistent datastructures, which they're not really |
| 10:51 | justin_smith | j-pb: well serialization of anything stateful is going to be a mess, yeah |
| 10:52 | j-pb | snowell maxpn: there is, the maybe monad, afaik we have that now as a threading macro let me check |
| 10:52 | justin_smith | j-pb: some-> / some->> is almost like maybe I guess |
| 10:52 | j-pb | justin_smith: yeah exactly that one |
| 10:53 | maxpn | really I need some kind of form validation - "if filed1_err return err1; if field2_err return err2; ... all ok ..." |
| 10:53 | j-pb | ,(macroexpand '(-> x f g)) |
| 10:53 | clojurebot | (g (f x)) |
| 10:53 | j-pb | ,(macroexpand '(some-> x f g)) |
| 10:53 | clojurebot | (let* [G__78 x G__78 (if (clojure.core/nil? G__78) nil (clojure.core/-> G__78 f)) G__78 ...] G__78) |
| 10:53 | justin_smith | maxpn: something like cond-> then? |
| 10:53 | justin_smith | (doc cond->) |
| 10:53 | clojurebot | "([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:54 | justin_smith | maxpn: since you have multiple error states that you want to destinguish |
| 10:54 | maxpn | o, sorry, I was not correct - "if( err_msg = valid_field1()) { return err_msg;} ... )" |
| 10:55 | maxpn | I have to save tha value of comapsion like if-let |
| 10:55 | maxpn | but chained if-let is my last chance :) |
| 10:56 | j-pb | hrmmm |
| 10:56 | j-pb | if( a = f1() ) { return g1(a);} if(a = f2()) { return g2(a);} |
| 10:56 | j-pb | thats basicallya cond right? |
| 10:56 | kwladyka | justin_smith, and what is your opinion about architecture? how it should look? |
| 10:56 | j-pb | because the return will short circuit |
| 10:57 | snowell | j-pb: I think the problem is it's not checking "a == f1()," it's setting the return value to a and using it |
| 10:57 | maxpn | no. (cond ..) is like "if (f1()) { ... }" result of function is lost |
| 10:57 | j-pb | maxpn: could you restate your problem?, I feel like we have 3 semantically different things here |
| 10:57 | snowell | And evaluating whether or not said return value is truthy |
| 10:57 | justin_smith | kwladyka: 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:57 | j-pb | maxpn: so you do a = (cond |
| 10:58 | j-pb | ah I see what you mean |
| 10:58 | maxpn | "if (a = f() ) ... " is not just a condition - it is an assignment to var a |
| 10:58 | j-pb | yeah |
| 10:58 | j-pb | so you want both a as well as the result of its application to something right? |
| 10:58 | justin_smith | maxpn: cond allows the then clause to get the result of the condition as an arg |
| 10:59 | justin_smith | maxpn: oops, not cond, condp |
| 10:59 | justin_smith | (doc condp) |
| 10:59 | clojurebot | "([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:59 | maxpn | moment... |
| 11:00 | j-pb | (inc justin_smith) |
| 11:00 | lazybot | ⇒ 265 |
| 11:02 | kwladyka | justin_smith, what with separatig business model/logic from other code? |
| 11:02 | justin_smith | kwladyka: namespaces organize things, if you use immutable data you don't really need information hiding or any of that |
| 11:02 | justin_smith | (mostly) |
| 11:04 | kwladyka | but 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:04 | kwladyka | discussion began with http://stackoverflow.com/questions/29867671/clojure-architecture-like-uncle-bob-did/29985761#29985761 |
| 11:10 | kwladyka | just i fell i have to close some things in smaller "independent" parts |
| 11:12 | justin_smith | kwladyka: 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:15 | kwladyka | so 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:15 | binjured | is there a string buffer sorta thing that works with (with-open)? |
| 11:16 | kwladyka | Is there any other option like uncle bob clear architecture? |
| 11:20 | justin_smith | binjured: I don't know, does with-out-str count? |
| 11:22 | maxpn | thank you all, now I use (condp ... :>> ...) |
| 11:22 | binjured | justin_smith: heh, not really. i guess i could pass *out* as a writer, but it feels dirty. |
| 11:22 | hellofunk | sometimes when i write i pass out all the time |
| 11:23 | justin_smith | kwladyka: 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:07 | mmeix | ok, beginner's question again: how much do I really need to know about POM files (xml, properties)? |
| 12:08 | justin_smith | mmeix: 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:08 | mmeix | ok |
| 12:08 | mmeix | or boot |
| 12:08 | mmeix | thanks |
| 12:08 | justin_smith | sure, boot uses the maven system too |
| 12:09 | mmeix | set and forget :-) |
| 12:11 | mmeix | the POMs are used to build the final jars, right? |
| 12:12 | justin_smith | they 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:12 | mmeix | ah, ok |
| 12:12 | mmeix | thnx afgain |
| 12:12 | mmeix | -f |
| 12:14 | mmeix | or an Afghan, sheared ("afgain") |
| 12:17 | mmeix | (just trying out boot ...) |
| 12:30 | binjured | anybody know how to find out where a (require) library was loaded from on the filesystem? |
| 12:34 | TimMc | binjured: Yeah, but it's ugly. |
| 12:36 | binjured | TimMc: 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:38 | TimMc | I'll write something up anyhow. |
| 12:43 | TimMc | ...this works in one of my projects but not another. :-( |
| 12:44 | binjured | man, 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:45 | TimMc | Might 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:45 | TimMc | or someone has specified a version range |
| 12:46 | binjured | TimMc: yeah, the annoying part is that the wrong one is winning so the app breaks. |
| 12:47 | TimMc | Does lein deps :tree give you some conflict info at the top of the output? |
| 12:47 | binjured | nope |
| 12:49 | TimMc | What version of lein? |
| 12:50 | binjured | 2.5.1 |
| 12:53 | bitts | Reading 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:54 | bitts | [org.clojure/java.jdbc "0.3.6"] rather.. |
| 12:55 | hiredman | did 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:57 | bitts | hiredman: Thanks, I missed that. |
| 12:57 | bitts | hiredman: now to figure out the decision points. :rowfn perhaps. |
| 12:59 | TimMc | Interesting: When I run (.getResource (class #()) "clojure/core__init.class") in lein repl, it yields a URL in some projects and nil in others. |
| 12:59 | TimMc | I think the latter happens in AOT'd projects, but why? |
| 13:01 | binjured | heh, 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:01 | justin_smith | binjured: lein deps :tree will tell you why this is happening |
| 13:01 | hiredman | binjured: what evidence do you have that it downloads old versions of cheshire? |
| 13:02 | binjured | justin_smith: no, it will not... only 5.4.0 is mentioned anywhere. |
| 13:02 | binjured | hiredman: when i run `lein run` it says so ;) |
| 13:02 | hiredman | binjured: what do you mean it says so? |
| 13:03 | binjured | hiredman: (1) remove from local maven repo (2) `lein run` (3) "Retrieving cheshire/cheshire/4.0.3/cheshire-4.0.3.pom from clojars" |
| 13:04 | binjured | plus a few other versions |
| 13:04 | binjured | none of which appear in any lein tree, maven tree, or effective pom |
| 13:04 | hiredman | binjured: lein may download transitive dependencies that end up being overriden |
| 13:05 | hiredman | lein classpath will show you the classpath lein uses |
| 13:12 | TimMc | binjured: 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:13 | binjured | TimMc: well, maven's curiosity is killing me! |
| 13:13 | TimMc | Then one wins according to a complicated set of precedence rules, thunderdome-style death matches, and coin flips. |
| 13:13 | TimMc | (I have been assured it is actually deterministic and fairly straight-forward, but have not looked into it myself.) |
| 13:14 | TimMc | lein deps only shows the winner. |
| 13:14 | binjured | i 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:14 | TimMc | Lessee, I think I wrote a tool to find these. |
| 13:16 | TimMc | binjured: 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:16 | TimMc | That will show you the full dependency graph. |
| 13:16 | binjured | it'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:17 | binjured | i will check it out, thank you |
| 13:17 | TimMc | I think it's technically... aether? that backs both maven and lein. |
| 13:18 | TimMc | arbuscule basically gives you an adjacency list right now, not a fully played-out tree. |
| 13:20 | TimMc | It's basically just a frontend onto pomegranate. |
| 13:51 | noncom | is anyone familiar with overtone here? |
| 13:51 | noncom | i wonder if it is possible to apply effects to sampled instruments... |
| 13:53 | CoaxialLatency | i'd hope so |
| 13:56 | justin_smith | noncom: yeah, overtone is network bindings to the supercollider UDP server api |
| 13:56 | noncom | yeah, it is :) |
| 13:57 | noncom | i did not find an api or docs on applying effects to sampled instruments though... |
| 13:57 | justin_smith | noncom: 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:57 | noncom | ah, so i re-route the sampler output through an effect... |
| 13:57 | justin_smith | noncom: in the sc engine, anything that can produce audio can be plugged into anything that takes audio input |
| 13:58 | noncom | does supercollider have this notion of "wires" ? |
| 13:58 | justin_smith | noncom: exactly, it's like a mixing board |
| 13:58 | noncom | cool, that makes it rather clear |
| 13:58 | justin_smith | if you look into synth groups it covers all this stuff |
| 13:58 | noncom | very nice, i'll head right there! |
| 13:59 | justin_smith | now how nicely overtone provides access to any of this is of course another question, but I would expect it to be usable |
| 13:59 | justin_smith | noncom: http://www.dewdrop-world.net/sc3/tutorials/index.php?id=1 |
| 14:00 | noncom | i am at a crossroads actually |
| 14:00 | noncom | i have to chose between minim and overtone/sc |
| 14:01 | justin_smith | noncom: be sure to check out pink too if you want to try anything experimental - pink is implemented in pure clojure |
| 14:01 | justin_smith | (well mostly pure clojure, I think it might have a java class file or two) |
| 14:01 | justin_smith | but pink is going to mostly only be useful if you want to try experimental dsp algos |
| 14:01 | hellofunk | noncom: https://www.youtube.com/watch?v=wDcN7yoZ6tQ |
| 14:02 | justin_smith | hellofunk: yup, that's the project. Steven Yi is one of the lead devs of csound, so he knows his shit. |
| 14:02 | noncom | wow |
| 14:02 | hellofunk | justin_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:03 | noncom | yeah, csound is a big thing |
| 14:03 | noncom | also, he has a very nice emacs setup |
| 14:04 | hellofunk | noncom: looks like aquamacs or something. tabbed buffers? |
| 14:04 | noncom | maybe maybe.. idk, i do not use emacs often, but sometimes i use it.. still looking for a perfect setup |
| 14:05 | noncom | afaik most people are still looking... :) |
| 14:05 | CoaxialLatency | what do you use mostly? |
| 14:07 | noncom | CoaxialLatency: currently i am mostly on prelude + the bliss theme + paredit + autocomplete + smex and some other things i do not remember exactly |
| 14:08 | noncom | but i am not using it for clojure, i program dotlisp in it |
| 14:09 | CoaxialLatency | i see |
| 14:15 | seangrove | Hey all, trying to use immutant 2.0.1, doesn't seem to be able to find immutant.web.websocket ns |
| 14:16 | seangrove | I'm using [org.immutant/immutant "2.0.1"] in my project.clj, which I *think* should pull in all the deps |
| 14:18 | seangrove | Looks like it might have been unified under immutant.web.async ns and the docs aren't updated... |
| 14:19 | tcrawley | seangrove: which docs are you looking at? |
| 14:20 | seangrove | tcrawley: http://immutant.org/tutorials/web/#Development_Mode |
| 14:21 | tcrawley | seangrove: 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:23 | seangrove | tcrawley: And the 2.x alpha is older than 2.0.1, right? |
| 14:23 | tcrawley | correct |
| 14:23 | seangrove | Just making sure... |
| 14:23 | seangrove | Great, thanks |
| 14:23 | tcrawley | it's really 2.0.0.alpha1. and my pleasure! |
| 14:33 | TimMc | binjured: If you're curious, this is how I check where a namespace was loaded from: https://gist.github.com/timmc/1dc26376e3cc475e125e |
| 14:36 | seangrove | tcrawley: Is there a way to access the session from a websocket on-open event? |
| 14:36 | seangrove | Looks like the only thing passed in is the channel |
| 14:38 | tcrawley | (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:41 | binjured | TimMc: thanks. really losing my mind here... (.getResource (class #()) "cheshire/core.clj") |
| 14:41 | binjured | #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:42 | creese | Ran into a strange case verifying a fressian encoding. Are fressian encodings unique? |
| 14:45 | TimMc | binjured: What about cheshire/core__init.class ? |
| 14:45 | binjured | nil |
| 14:49 | binjured | TimMc: but then, (.getResource (class #()) "clojure/core__init.class") is nil too so i'm not sure how interesting that is. |
| 14:52 | TimMc | Does your project have any AOT namespaces? |
| 14:53 | TimMc | I still don't understand why that snippet doesn't always work, but I think it has to do with AOT. |
| 14:53 | binjured | like, pure java namespaces? |
| 14:54 | binjured | not familiar with what all gets AOT'd in clojure vs. not |
| 14:55 | TimMc | Do you have a :main or an :aot key in your project.clj? |
| 14:56 | binjured | a :main, yeah |
| 14:57 | TimMc | Try lein clean and set :main [^:skip-aot your.main.ns] just for the time being, then lein repl |
| 14:58 | TimMc | Leiningen automatically adds your :main ns to the aot list (though that will change in a future version.) |
| 15:00 | binjured | TimMc: "Option -m requires a valid namespace argument, not [my.main.ns]" |
| 15:00 | TimMc | If 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:00 | TimMc | Oh whoops, drop the brackets. :-) |
| 15:02 | binjured | it's not nil anymore |
| 15:03 | binjured | TimMc: the cheshire core__init.class is coming from leiningen itself, not the m2 repo |
| 15:05 | binjured | one 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:08 | TimMc | Hmm... now, that might be a REPL thing. |
| 15:08 | TimMc | The REPL has extra dependencies added to it that your code wouldn't have. |
| 15:09 | seangrove | tcrawley: 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:13 | binjured | TimMc: 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:14 | tcrawley | seangrove: 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:14 | whodidthis | i would imagine wrap-session middleware goes before ?assign-id |
| 15:14 | tcrawley | seangrove: that middleware had to be last in the thread in alpha1, but that is no longer the case |
| 15:15 | seangrove | tcrawley: Ah, My bad for reading the old docs, thought it had to be the terminating handler |
| 15:15 | tcrawley | yeah, no longer. sorry for the confusion |
| 15:17 | seangrove | No worries - that works well now, thanks! |
| 15:17 | tcrawley | good deal! |
| 15:17 | seangrove | Overall immutant seems pretty nicely put together |
| 15:18 | tcrawley | thanks! feel free to hang out in #immutant if you like |
| 15:19 | seangrove | tcrawley: Sounds good, it's in the init.el now |
| 15:33 | noncom | tcrawley: hi! |
| 15:34 | tcrawley | noncom: ahoyhoy! |
| 15:35 | noncom | tcrawley: someone adviced me to ask you |
| 15:35 | noncom | tcrawley: i have a couple of jars on clojars that are missing now! |
| 15:35 | noncom | like, they've been there and they disappeared |
| 15:35 | tcrawley | what jars? |
| 15:35 | noncom | what do you think? |
| 15:35 | noncom | wait a sec |
| 15:36 | noncom | [org.noncom/tuio4j "1.1"] |
| 15:36 | noncom | [com.illposed.osc/javaosc-core "0.3"] |
| 15:36 | noncom | these two |
| 15:37 | noncom | https://clojars.org/users/noncom the groups are not listed too |
| 15:39 | tcrawley | any idea when you deployed them? neither show up in the deploy event log that goes back 2+ years |
| 15:40 | tcrawley | and neither appear in the backup dir where we store a copy of deleted artifacts |
| 15:43 | tcrawley | noncom: javaosc-core is in maven central: https://search.maven.org/#artifactdetails|com.illposed.osc|javaosc-core|0.3|bundle |
| 15:43 | noncom | tcrawley: 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:44 | noncom | tcrawley: but i am 100% sure of [org.noncom/tuio4j "1.1"] |
| 15:44 | noncom | it is not there, right? |
| 15:44 | tcrawley | not that I can see, no |
| 15:44 | tcrawley | any idea when you deployed it? |
| 15:44 | noncom | i deployed it a while ago, maybe somewhere around the new year... |
| 15:45 | noncom | tcrawley: i am starting to think that i have fabricated the memory... |
| 15:45 | tcrawley | that's before my time with clojars, but I don't see a record of it anywhere |
| 15:45 | tcrawley | hey, I'm not saying you're crazy :) |
| 15:45 | gfredericks | ~tcrawley is not saying you're crazy |
| 15:45 | clojurebot | Ok. |
| 15:46 | tcrawley | gfredericks: thanks! |
| 15:46 | noncom | hehe :) 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:46 | tcrawley | gfredericks: speaking of crazy, will you buddy with me at STL? |
| 15:47 | tcrawley | noncom: is it possible you had it installed in your local ~/.m2/ so you never noticed it wasn't in an external repo? |
| 15:47 | noncom | maybe... looks like that was the case, i just thought i did deploy it to clojars |
| 15:48 | noncom | but apparently i did not for some reason... |
| 15:48 | gfredericks | tcrawley: you're coming??? |
| 15:48 | lazybot | gfredericks: Oh, absolutely. |
| 15:48 | tcrawley | totes |
| 15:48 | gfredericks | birthday party! |
| 15:48 | tcrawley | _exactly_ |
| 15:49 | gfredericks | and bhauman will be there too |
| 15:49 | tcrawley | indeed. we just need cfleming, et al to get the band back together |
| 15:50 | gfredericks | he's probably not speaking and so probably not coming I bet :/ |
| 15:50 | tcrawley | yeah |
| 15:51 | gfredericks | and jim not coming? |
| 15:52 | tcrawley | he's a "maybe". he has a ticket, but isn't sure he can make it |
| 15:54 | gfredericks | maybe blackmail him |
| 15:54 | tcrawley | I'll see what I can do |
| 15:54 | tcrawley | jcrossley3: ^ |
| 15:58 | binjured | does 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:59 | justin_smith | binjured: is something trying to json-encode the request body object? |
| 16:01 | binjured | justin_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:03 | justin_smith | yeah, likely middleware nonsense I guess |
| 16:04 | cfleming | tcrawley: Sniff sniff |
| 16:05 | tcrawley | we'll miss you my friend |
| 16:07 | jcrossley3 | gfredericks: tcrawley has nothing on me |
| 16:07 | tcrawley | that sounds like a challenge |
| 16:07 | sdegutis | What's the best way to get from [[:a 1] [:b 1] [:b 3]] to {:a 1 :b 4} ? |
| 16:09 | amalloy | sdegutis: apply merge-with + |
| 16:09 | sdegutis | hmm thought it had something to do with merge-with, thanks |
| 16:09 | amalloy | well more specifically ##(apply merge-with + (for [[k v] '((a 1) (b 1) (b 3))] {k v})) |
| 16:09 | lazybot | ⇒ {b 4, a 1} |
| 16:13 | H4ns | ,(apply merge-with + (map (partial apply hash-map) [[:a 1] [:b 1] [:b 3]])) |
| 16:13 | clojurebot | {:b 4, :a 1} |
| 16:29 | cfleming | tcrawley: I must make it to STL one of these days |
| 16:30 | cfleming | tcrawley: It's a longish trip though! |
| 16:32 | gfredericks | cfleming: considering relocating to STL |
| 16:32 | mikerod | is it not the case that = and == are different for numerics in Clj? |
| 16:33 | gfredericks | [(= 3 3.0) (== 3 3.0)] |
| 16:33 | gfredericks | ,[(= 3 3.0) (== 3 3.0)] |
| 16:33 | clojurebot | [false true] |
| 16:33 | gfredericks | ,((juxt = ==) 3 3.0) |
| 16:33 | clojurebot | [false true] |
| 16:37 | tcrawley | cfleming: I'll be there, so it will totally be worth it |
| 16:38 | justin_smith | ,(map (juxt identical? = ==) [3 3000 3000 3000] [3 (+ 1000 2000) 3000 3000.0]) |
| 16:38 | clojurebot | ([true true true] [false true true] [false true true] [false false true]) |
| 16:40 | H4ns | what would be a good way to retrieve every other element from a seq? (1 2 3 4) => (1 3) |
| 16:41 | justin_smith | one way: (comp (partial map first) (partial partition 2)) |
| 16:42 | oddcully | i see no points |
| 16:42 | H4ns | justin_smith: thanks! |
| 16:47 | amalloy | justin_smith: is that your final answer? |
| 16:47 | justin_smith | amalloy: I am sure there is something better, but that was the first thing I thought of |
| 16:48 | amalloy | well there is a builtin: ##(take-nth 2 '(1 2 3 4)) |
| 16:48 | lazybot | ⇒ (1 3) |
| 16:48 | justin_smith | man, I always forget that one |
| 16:48 | amalloy | H4ns: ^ |
| 16:48 | H4ns | amalloy: much nicer, thanks! |
| 17:02 | pbx | PSA: 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:41 | vhquang | hi everyone, |
| 17:42 | vhquang | I am very new to clojure, and am having a problem with pedestal library |
| 17:42 | vhquang | if anyone has experience with that library, can you spend few minutes help me out? |
| 17:44 | wasamasa | wasn't that this whole webframework thing? |
| 17:44 | vhquang | yes it it |
| 17:44 | vhquang | it is |
| 17:44 | wasamasa | well, the mindshare tends to go towards the opposite here |
| 17:45 | wasamasa | composing your web application by using ring and libraries complementing it |
| 17:45 | seangrove | ,(into {} (map vec (partition 2 (interleave (keys {:a 10 :b 20 :c 30}) (repeat {}))))) |
| 17:45 | wasamasa | so you'll probably find less support for it |
| 17:45 | clojurebot | {:a {}, :b {}, :c {}} |
| 17:46 | seangrove | ,(into {} (partition 2 (interleave (keys {:a 10 :b 20 :c 30}) (repeat {})))) |
| 17:46 | clojurebot | #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:46 | justin_smith | seangrove: only vectors can be entries |
| 17:46 | vhquang | we are near a demo day, so switching library isn't the prefer path for me |
| 17:46 | seangrove | justin_smith: Ah, headed off my first question |
| 17:46 | justin_smith | also, the error message has a bug in it |
| 17:46 | vhquang | I just hope to find some temporary fix if possible |
| 17:47 | seangrove | Seconds question though, is there a cleaner way of resetting the values to {} |
| 17:47 | seangrove | (without bringing in mapvals) |
| 17:47 | justin_smith | ,(zipmap (keys {:a 10 :b 20 :c 30}) (repeat {})) |
| 17:47 | clojurebot | {:a {}, :b {}, :c {}} |
| 17:47 | seangrove | bah! zipmap! Should have remembered |
| 17:48 | seangrove | Thanks as usual, justin_smith |
| 17:48 | seangrove | (inc justin_smith) |
| 17:48 | lazybot | ⇒ 266 |
| 17:48 | amalloy | seangrove: 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:49 | amalloy | ,(into {} (for [[k v] {:a 10 :b 20 :c 30}] {k {}})) |
| 17:49 | clojurebot | {:a {}, :b {}, :c {}} |
| 17:49 | wasamasa | vhquang: 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:50 | justin_smith | wasamasa: speak for yourself |
| 17:50 | seangrove | justin_smith: I believe he was |
| 17:51 | vhquang | wasamasa, thanks for explaining that to me, I am very new to the community here |
| 17:51 | justin_smith | vhquang: in general, the thing that works best on IRC is to just ask your question and stay logged in |
| 17:51 | justin_smith | maybe repeat it if it's been a while and nobody responded |
| 17:52 | vhquang | the problem I have is with the io.pedestal.interceptor.helpers, when compiling the uberjar |
| 17:52 | justin_smith | and then like - maybe hours later - the perfect answer will show up out of the blue |
| 17:52 | vhquang | ah OK |
| 17:55 | vhquang | I 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:56 | vhquang | and I use the AOT compilation as well |
| 18:21 | sdegutis | What's a dazzling way to transform the number 12345 into the string "12,345"? |
| 18:22 | amalloy | sdegutis: ask java to do it |
| 18:22 | sdegutis | amalloy: thanks I'll ask #java |
| 18:22 | amalloy | sdegutis: i mean the answer is java.util.text.NumberFormat, or something like that |
| 18:22 | amalloy | i forget what package it's in |
| 18:23 | sdegutis | ,(.format (NumberFormat/getNumberInstance Locale/US) 35634646) |
| 18:23 | clojurebot | #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:24 | sdegutis | clojurebot: shut up nobody asked you |
| 18:24 | clojurebot | Pardon? |
| 18:24 | sdegutis | clojurebot: nothin just bsayin hi |
| 18:24 | clojurebot | excusez-moi |
| 18:24 | sdegutis | clojurebot: dont worry bout it bruh |
| 18:24 | clojurebot | Cool story bro. |
| 18:27 | sdegutis | ,(.format (java.text.NumberFormat/getNumberInstance java.util.Locale/US) 1234567) |
| 18:27 | clojurebot | "1,234,567" |
| 18:27 | sdegutis | amalloy: I was kind of assuming you would say to use the mysterious cl-format function |
| 18:27 | amalloy | gross |
| 18:27 | sdegutis | Indeed. |
| 18:28 | sdegutis | But most of Clojure is gross. |
| 18:31 | irctc | hi |
| 18:31 | sdegutis | amalloy: you won the prize btw. |
| 18:32 | sdegutis | amalloy: cuz that worked. |
| 18:34 | sdegutis | amalloy: unfortunately you have to redeem the prize in person over irc |
| 18:38 | whodidthis | singletons4lyfe |
| 18:40 | whodidthis | imagine someone actually having multiple instances of numberformatters of a selected locale around, what an idiot |
| 18:45 | elvis4526 | how does if check the boolean value of an expression ? |
| 18:45 | elvis4526 | is it with true? ? |
| 18:46 | verma | I 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:46 | verma | basically take the vec I am interested in and return a new one, maintaining its spot in the seq |
| 18:47 | andyf | elvis4526: At the Java byte code level, every value except false and nil is considered true |
| 18:47 | verma | I could do some drop-while take-while stuff, but I was wondering if there's a better way of doing this |
| 18:47 | amalloy | whodidthis: huh? getNumberInstance isn't a singleton, i'm fairly sure |
| 18:47 | verma | may be split-with |
| 18:48 | andyf | elvis4526: That is definitely not what checking with true? would do. That only returns true for the value true. |
| 18:48 | amalloy | maybe 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:48 | elvis4526 | oh okay - thanks |
| 18:48 | amalloy | andyf: uhhhhh, i don't think that's the java bytecode level, that is a clojureism |
| 18:48 | amalloy | at the java bytecode level, one thing is true, which is the boolean true, and one thing is false, which is the boolean false |
| 18:49 | andyf | Maybe 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:49 | amalloy | yes, that is certainly what the bytecode generated by clojure's 'if special form does |
| 18:49 | whodidthis | oh, didnt think getInstance type of things were used for that kind of stuff too, bad joke heh |
| 18:52 | whodidthis | then again i dont know whats going on with the logging stuff at all either so mebbe shouldn't comment about java |
| 19:06 | hiredman | amalloy: simpledateformat |
| 19:06 | amalloy | $javadoc java.util.SimpleDateFormat |
| 19:06 | amalloy | oh well |
| 19:06 | amalloy | $javadoc java.text.SimpleDateFormat |
| 19:06 | lazybot | http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html |
| 19:06 | amalloy | yeah, that's the vile thing indeed |
| 19:57 | hyPiRion | Omg, 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:57 | hyPiRion | "extends java.text.SimpleDateFormat" |
| 20:42 | vhquang | hi, can someone help me to understand the difference between (require ....) and (:require ....) ? I cannot get a good answer from google |
| 21:06 | creese | Can you deploy pedestal as an uberjar? |
| 21:08 | mearnsh | vhquang: require is a function, normally you'd only use it at a REPL, favouring the use of :require inside an ns macro otherwise |
| 21:08 | mearnsh | they both do the same job, but :require only works inside an ns form |
| 21:09 | vhquang | thanks mearnsh! |
| 21:10 | vhquang | @creese, I can compile the uberjar, but cannot deploy(or run) it |
| 22:52 | jjttjj | as 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:03 | bbloom | at this point, i consider joda to be "the api the jvm should have had" |
| 23:03 | bbloom | it's so widely deployed that you might as well depend on it until the unlikely event that somebody complains |
| 23:09 | jjttjj | bbloom: 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:09 | jjttjj | convenient* |