2015-03-17
| 00:03 | TEttinger | raspasov: command line to the program curl, which fetches from a url |
| 00:04 | TEttinger | bcm, I've never really dealt with complex url gathering, slurp has always sufficed for me |
| 00:31 | akuttruf` | hey guys, can someone explain to me the difference between @ and '#? |
| 00:32 | akuttruf` | I am having a difficult time researching threads and docs due to the special characters, and hope someone might be able to clarify. |
| 00:33 | scottj | '# is nothing, #' is var, @ is deref |
| 00:33 | akuttruf` | ah, thank you! |
| 01:33 | ewemoa | akuttruff: i was introduced to the following and found it helpful for this sort of situation: http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ |
| 02:27 | TEttinger | (inc ewemoa) |
| 02:27 | lazybot | ⇒ 1 |
| 02:27 | TEttinger | I am always linking to that site, it's great |
| 02:27 | TEttinger | it's how I found out about #_ , which I love |
| 02:34 | optout | (which site?) |
| 02:35 | scottj | optout: http://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/ |
| 02:41 | optout | what i like about that site |
| 02:42 | optout | is that it has some js to say 'this post might be outdated' |
| 02:42 | optout | i think that needs to come by default with technical/programming blogs |
| 03:04 | chenglou | does clojure do some optimization concerning (get-in coll [1 2 3]) and pull that vector out if it's used many times? |
| 03:04 | chenglou | pulls* |
| 03:05 | Empperi | I'd have to guess the answer is no |
| 03:05 | arrdem | Clojure does not, to my knowledge, do constant lifting. That said, the cost of repeating that expression is zero. |
| 03:05 | arrdem | effectively. |
| 03:05 | chenglou | arrdem: how so |
| 03:05 | chenglou | arrdem: just because it's so cheap? Or something else |
| 03:05 | arrdem | chenglou: bingo. just about anything else will dominate that cost. |
| 03:05 | arrdem | because it's a constant, it'll get lifted into the function constant pool |
| 03:06 | arrdem | so N identical vectors will be computed once |
| 03:06 | arrdem | and then reused forever |
| 03:06 | chenglou | function constant pool? |
| 03:06 | chenglou | is there any article that explains how this works |
| 03:06 | arrdem | not really. |
| 03:06 | arrdem | sorry. |
| 03:06 | arrdem | If you're feeling brave, checkout how tools.emitter.jvm works |
| 03:07 | chenglou | oh well. But how does the constant pool work for the vector? |
| 03:07 | arrdem | Functions are really classes implementing clojure.lang.IFn |
| 03:08 | arrdem | functions can have fields just like any other object |
| 03:08 | arrdem | it just so happens that Clojure uses const function fields to cache values (like constant expressions) which will be reused. |
| 03:09 | arrdem | so keywords like :foo will be computed once when the class is first instantiated, that keyword instance will be written to a generated const field of the function and then that field will be referenced whenever the key :foo is needed for the stack. |
| 03:09 | arrdem | does that make sense? |
| 03:09 | arrdem | same thing happens for more complex structures like vectors and maps. |
| 03:09 | arrdem | if they are actually constant. |
| 03:10 | chenglou | they always are, aren't they? |
| 03:11 | arrdem | no, you can reference locals in a literal expression. |
| 03:11 | chenglou | oh, right. Was thinking about immutability |
| 03:12 | chenglou | arrdem: that's interesting. Do you know if the same constant optimization applies to clojurescript as well? |
| 03:13 | arrdem | chenglou: I know about tools.emitter voodoo because I worked on it last summer. I have nothing to do with clojurescript. |
| 03:13 | arrdem | besides the Google Closure compiler is deep magic beyond the ken of mortals |
| 03:14 | chenglou | hah, alright thanks |
| 03:17 | ewemoa | TEttinger: lol...i probably learned about the link from you ;) |
| 05:18 | nicola_ | hi all |
| 05:18 | kungi | Hi nicola_ |
| 05:19 | kungi | can someone help me make this code snippet more readable: https://gist.github.com/Kungi/b7c55fae2be594ce3452 |
| 05:19 | clojurebot | Huh? |
| 05:20 | nicola_ | I am a first year computer science student wanting to do google summer of code. but I have to propose a project and I have no idea where to start. I have never worked on an open source project before but I really want to! help? |
| 05:21 | kungi | nicola_: What are you interested in? |
| 05:21 | nicola_ | well im big into functional programming, thats why im here :P |
| 05:24 | kungi | nicola_: ;-P |
| 05:25 | nicola_ | I just really want to get involved but most projects are big and scary |
| 05:26 | hyPiRion | nicola_: anything more specific? Like, do you want to work on anything listed on http://dev.clojure.org/display/community/Project+Ideas ? |
| 05:26 | nicola_ | to be honest i havent even taken a look |
| 05:28 | hyPiRion | I guess that's somewhere you can get ideas at least :) |
| 05:28 | nicola_ | im taking a look right now :) |
| 05:31 | kungi | hyPiRion: Can you help me with some code for a second? |
| 05:33 | hyPiRion | kungi: I can try at least |
| 05:33 | hyPiRion | just post the url and I'll see |
| 05:34 | kungi | hyPiRion: https://gist.github.com/Kungi/e3d43696983d70e72fd8 |
| 05:34 | kungi | hyPiRion: can I write this in some prettier way? |
| 05:34 | hyPiRion | ah |
| 05:34 | hyPiRion | yeah, give me a second |
| 05:39 | hyPiRion | kungi: https://www.refheap.com/8bea851de16b40e0bd74e1da0 |
| 05:39 | hyPiRion | the indentation went a bit off there, but you should grok the idea |
| 05:41 | nicola_ | okay, i took a look and all those ideas seem pretty scary |
| 05:41 | kungi | hyPiRion: I did not know of cond-> :-) |
| 05:41 | kungi | hyPiRion: Thank you |
| 05:42 | shem | nicola_: maybe work on some project you already use? |
| 05:42 | hyPiRion | kungi: np |
| 05:42 | dysfun | cond-> is pretty shiny |
| 05:48 | dysfun | stuartsierra: around? |
| 05:48 | stuartsierra | yes |
| 05:50 | dysfun | i built a thing on top of component. i'd be interested to hear what you think https://github.com/jjl/oolong |
| 05:54 | stuartsierra | Lots of people have built stuff on top of component. I'm always happy when people find it useful. Can't comment beyond that. |
| 05:55 | dysfun | well in particular, you asserted that you don't think libraries should be distributed in component form. the platform this will power is planning to do exactly that. |
| 05:57 | stuartsierra | That's fine. https://github.com/danielsz/system and https://github.com/juxt/modular do that too. |
| 05:57 | dysfun | ah okay. cool. |
| 06:26 | danielcompton | Does anyone know of a python version of Clojure's iterate? |
| 06:31 | dysfun | it should be fairly easy to do in a list comprehension |
| 06:32 | dysfun | well, the whole thing |
| 06:32 | dysfun | just the iterate part sounds like generators |
| 06:37 | dysfun | try this https://www.refheap.com/98536 |
| 07:00 | noncom | is it possible that *ns* and Compiler.currentNS() differ during performing (eval) on a piece of code ? |
| 07:06 | agarman | can you eval in-ns? |
| 07:07 | noncom | yes... |
| 07:08 | noncom | you mean that compiler-ns will be different? |
| 07:18 | agarman | Var is thread local |
| 07:18 | agarman | only the thread it belongs to should have access to it. |
| 07:19 | zot | is there any way to refer to ILookup (from clojure.lang) without the full prefix? |
| 07:19 | agarman | so a Var can change, but it has to be done by the thread |
| 07:21 | agarman | *ns* is a Var, so unless I am just plain wrong, it shouldn't change in an eval unless what you eval changes it |
| 07:23 | agarman | zot: you mean something like associative? |
| 07:25 | agarman | ,(map associative? [{} [] () #{}]) |
| 07:25 | clojurebot | (true true false false) |
| 07:28 | noncom | agarman: i was just evaling some forms read by clojure.tools.analyzer and it got stuck, misassociating a symbol with a worng ns |
| 07:31 | agarman | noncom: ask later when there's more folks here |
| 07:32 | noncom | yeah, this question is very specific.. there were people like Bronsa who know the internals... |
| 07:32 | Bronsa | noncom: Compiler.currentNS() literally just dereferences *ns* so there's no way they can return different values |
| 07:32 | agarman | yep, usually don't see Bronsa or tbaldrid answering questions this early |
| 07:33 | noncom | oh, hi! |
| 07:33 | noncom | strange... i got into a situation where the evaled symbols are wrongly attributed to a different namespace... |
| 07:34 | noncom | so, you're saying that *ns* and compiler ns is the same.. that adds more strangeness |
| 07:35 | Bronsa | noncom: t.a.jvm uses the :ns value in the env to bind *ns* to |
| 07:36 | Bronsa | noncom: if you use analyze-ns it will handle *ns* for you, if you manually loop with analyze+eval, you'll need something like (binding [*ns* *ns*] (loop [..] (analyze+eval form env) ..)) to make sure *ns* keeps bound to the right value |
| 07:37 | noncom | i did not use t.a.jvm yet.. i only read forms with tools.reader and then eval with the regular (eval)... |
| 07:37 | Bronsa | agarman: that's because I'm a late sleeper :P it's 12.30 for me now |
| 07:37 | noncom | i do the *ns* *ns* binding, but i did not pass env as you pointed now |
| 07:37 | Bronsa | noncom: ah, you talked about t.analyzer earlier |
| 07:37 | agarman | Bronsa: much earlier for me :-) |
| 07:38 | noncom | you see, all is read ok with tools.reader |
| 07:38 | noncom | but during eval it fails to attribute some symbols to a correct ns |
| 07:38 | kitallis | people with compojure-api experience:- how do I do middlewares post-schema validations for a bunch of routes (I can write a restructure-params macro but I'd have to repeat that in every route)? |
| 07:39 | Bronsa | noncom: if you nopaste the code you're using and a snippet that's using it that causes the error, I can try and help you |
| 07:39 | agarman | kitallis: try liberator or roll your own |
| 07:40 | noncom | Bronsa: i will try to factor out a smaller code example now |
| 07:41 | ikitommi_ | kitallis: does this help? https://github.com/metosin/compojure-api/blob/master/test/compojure/api/core_integration_test.clj#L132 |
| 07:42 | agarman | ikitommi_ kitallis are you trying to remove description of validation and validation descriptions from your routes |
| 07:42 | kitallis | agarman, I want a more high-level middleware that isn't on the request, but instead post-params validations |
| 07:42 | pandeiro | is (in-ns 'foo.bar) not supposed to load the foo.bar namespace? |
| 07:43 | pandeiro | (if not, what command am i looking for?) |
| 07:43 | kitallis | agarman, so req --> (run middlewares) --> extract params --> (validate) --> (run middleware) --> send response |
| 07:45 | ikitommi_ | kitallis: was just experimenting context* -macro, which could setup shared metadata for all routes beneath + make the endpoints (GET* etc.) read the accumulated metada at runtime instead of statically generating codes. Would solve that too. |
| 07:45 | Bronsa | noncom: I have to go for a while now, you can send me a mail if you need it or I'll be back in a couple of hours |
| 07:46 | agarman | kitallis: we wrote something that works like that , but it needs some fixes |
| 07:46 | agarman | including actual updated documentation: https://github.com/CareLogistics/somni |
| 07:47 | agarman | and like I said liberator does that as well |
| 07:47 | kitallis | moving to liberator now isn't an option anymore |
| 07:47 | kitallis | one solution is I move all the schema validations as a part of this middleware and remove them from the routes |
| 07:48 | kitallis | ikitommi_, I only vaguely understood that, would you have an example? |
| 07:49 | ikitommi_ | kitallis: something ~https://github.com/metosin/compojure-api/blob/context-star/examples/src/examples/thingie.clj#L123 |
| 07:49 | noncom | Bronsa: sure! making a smaller example wont be easy, so itll take time |
| 07:53 | ikitommi_ | kitallis: so one could either run the rules on the path/context (like pedestal interceptors) or one could add metadata on the route and they would accumulate on the endpoint. |
| 08:05 | ikitommi_ | kitallis: but for now, can't figure an easy way to inject common code to multiple routes AFTER the validations. :middlewaress wrap the whole handler body so kicks in before the input validations. Open to suggestions. |
| 08:11 | timvisher | is anyone using s3 to manage their service artifacts for their deployments? |
| 08:23 | ThomasDeutsch | how can i partition a set by missing values? #{1 2 5 6} => ((1 2) (4 5)) |
| 08:24 | ThomasDeutsch | no, i mean ... like this #{1 2 5 6} => ((1 2) (5 6)) |
| 08:24 | mpenet | ,(doc partition-all) |
| 08:25 | clojurebot | "([n] [n coll] [n step coll]); Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end. Returns a stateful transducer when no collection is provided." |
| 08:25 | mpenet | (partition-all 2 [1 2 3 4 5]) |
| 08:25 | mpenet | ,(partition-all 2 [1 2 3 4 5]) |
| 08:25 | clojurebot | ((1 2) (3 4) (5)) |
| 08:25 | mpenet | nevermind, I should read stuff before replying |
| 08:27 | ThomasDeutsch | maybe partitioning is not the best way to do it in this case? |
| 08:28 | mpenet | indeed |
| 08:28 | noncom | ThomasDeutsch: i think that what you're trying to do is more mathematical than programming |
| 08:29 | noncom | ThomasDeutsch: i would think of a math approach to this. for example, i would walk over the original set and coin the subsets that do not have breaks |
| 08:30 | noncom | ThomasDeutsch: what is your real application? do you have a big set og ints and you must find gas in it? |
| 08:31 | noncom | *of |
| 08:34 | ThomasDeutsch | in my application i can also calculate split points. in this case #{3}. so i think the best way will be to sort the set, and split it apart on every split-point |
| 08:36 | mpenet | you could abuse clojure.set or just loop |
| 08:37 | mpenet | ,(let [s #{1 2 3 4 7 9}] (clojure.set/difference (set (range (apply max s))) s)) |
| 08:37 | clojurebot | #error{:cause "clojure.set", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.ClassNotFoundException: clojure.set, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6732]} {:type java.lang.ClassNotFoundException, :message "clojure.set", :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}], :trace [[java.net.URLClassLoader$1 r... |
| 08:37 | mpenet | hmm |
| 08:37 | mpenet | ,(use 'clojure.set) |
| 08:37 | clojurebot | nil |
| 08:37 | mpenet | ,(let [s #{1 2 3 4 7 9}] (difference (set (range (apply max s))) s)) |
| 08:37 | clojurebot | #{0 6 5 8} |
| 08:37 | mpenet | but no ordering/grouping here |
| 08:39 | noncom | ThomasDeutsch: also, if you do something math-related, take a look at http://data-sorcery.org/ |
| 08:45 | hellofunk | is there any reason to prefer one of these idioms over the other: (into [] (for [x (range 10)] x)) vs. (vec (for [x (range 10)] x)) |
| 08:46 | mpenet | into is a tiny bit faster currently i believe (depends maybe on the size of the seq) |
| 08:46 | mpenet | it uses transient under the hood, set I dont think so |
| 08:46 | mpenet | could have changed recently tho |
| 08:47 | hellofunk | since the end result is the same, it's a curious notion |
| 08:47 | hellofunk | into is just conj i think. |
| 08:48 | hellofunk | vec does a to-array |
| 08:48 | mpenet | ah! http://dev.clojure.org/jira/browse/CLJ-1384 |
| 08:49 | mpenet | well vec != set |
| 08:49 | mpenet | so not sure |
| 08:50 | mpenet | maybe it's the same after all |
| 09:20 | jack0 | Hi! |
| 09:20 | gfredericks | ~hello |
| 09:21 | clojurebot | BUENOS DING DONG DIDDLY DIOS, fRaUline gfredericks |
| 09:21 | jack0 | Would someone help me out with unit testing? |
| 09:21 | gfredericks | ~anyone |
| 09:21 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 09:22 | jack0 | :) |
| 09:27 | hellofunk | and ~hello to you too |
| 09:39 | kungi | Anyone uses kerodon for web testing? |
| 09:41 | jack0 | Unit testing? Anyone??!! |
| 09:41 | kungi | jack0: yes |
| 09:42 | Glenjamin | kungi: i do, why? |
| 09:43 | jack0 | kungi: Could you explain in detail how I must do it? |
| 09:43 | kungi | Glenjamin: Im am trying to get (follow) to work. |
| 09:43 | kungi | jack0: sorry but this is just too broad a question. |
| 09:44 | jack0 | Ok, I'll simplify |
| 09:44 | Glenjamin | kungi: what isn't working? if you use it after receiving a redirect it should just work |
| 09:45 | kungi | Glenjamin: I get this error: |
| 09:45 | kungi | java.lang.ClassCastException: clojure.lang.PersistentStructMap cannot be cast to java.lang.CharSequence |
| 09:45 | kungi | Somewhere in the trim function |
| 09:47 | Glenjamin | oh wow, that sounds quite broken |
| 09:47 | kungi | Glenjamin: yes it does |
| 09:47 | Glenjamin | if you add (doto prn) into the flow before the (follow), can you pastebin the output? |
| 09:47 | kungi | Glenjamin: It breaks is css-or-content |
| 09:47 | kungi | Glenjamin: sure |
| 09:47 | Glenjamin | sounds like you might have a dodgily formed response/header |
| 09:50 | kungi | Glenjamin: http://pastebin.com/NqsHkbDe |
| 09:51 | kungi | Glenjamin: Hmm the link is not present ... but it still should not break in this way |
| 09:54 | kungi | Glenjamin: Maybe it is because the link text looks like this in enlive? |
| 09:54 | kungi | {:tag :a, :attrs {:id "menu-item-alternate", :href "/configuration/alternate"}, :content ("Vertreter")} |
| 09:54 | kungi | Maybe not ... |
| 09:55 | justin_smith | hellofunk: definitely into would be faster, unless the argument is an array |
| 09:56 | hellofunk | justin_smith: while it is an interesting clojure question, i'm actually using it in cljs, and dnolen suggested that in the JS world there was little difference between the two, fyi |
| 09:56 | justin_smith | hellofunk: aha! I did a window switch while composing my reply before, somehow |
| 09:56 | justin_smith | ah, interesting |
| 09:56 | dnolen | hellofunk: the difference also doesn't matter enough to care in Clojure or ClojureScript |
| 09:57 | dnolen | hellofunk: the only time I would really spend any time to think about it would be performance situations where vec can adopt an array directly |
| 09:57 | hellofunk | i'm using the line to process 16 million credit cards, so was curious which would go faster. just kidding. |
| 09:58 | dnolen | choosing one or the other in idiomatic code isn't really worthy of discussion IMO |
| 09:58 | dnolen | hellofunk: not criticising your query, just pointing having a strong opinion about it doesn't make sense to me |
| 09:59 | hellofunk | dnolen: it's one of those odd syntantical questions that some like to discuss. i know amalloy has often found good reason to prefer one little convention over another, so i like to get the feedback |
| 09:59 | Glenjamin | kungi: can you include the kerodon code too? |
| 09:59 | kungi | Glenjamin: sure |
| 10:00 | kungi | Glenjamin: http://pastebin.com/fV7VdGkt |
| 10:01 | Glenjamin | hrm, so the :id doesn't exist |
| 10:01 | Glenjamin | that should definitely give a better error |
| 10:01 | Glenjamin | would you mind reporting as an issue on github? |
| 10:06 | kungi | Glenjamin: I can do that. Can you please explain to me what the error is exactly? |
| 10:07 | Glenjamin | it would appear that you get a bad error when trying to reach an element with a selector that doesn't match |
| 10:08 | Glenjamin | but if you include the contents of those pastebins that'd be ace |
| 10:14 | kungi | Glenjamin: Yep I can do that. But that's not at the heart of the problem. I realized that I tried to access a link which does not exist and fixed this. Now the link exists on the page, but I get the same error. I created another pastebin including the state, the stacktrace and the actual kerodon code. |
| 10:14 | kungi | http://pastebin.com/dzQQu5ts |
| 10:15 | kungi | Glenjamin: When I use the id of the Link it works fine. |
| 10:25 | cnb_ | when using gen-class is it possible to define a method with a function/class as parameter |
| 10:33 | justin_smith | cnb_: like a method that has a clojure.lang.IFn arg? |
| 10:33 | Glenjamin | kungi: you should be able to work around by using a keyword as a css selector for the link |
| 10:33 | Glenjamin | i'm not sure why this is broken though |
| 10:36 | kungi | Glenjamin: Ok thank you. I will file a bug report this evening |
| 10:36 | kungi | Glenjamin: thanks for looking into it |
| 10:45 | cnb_ | what does # means I have this : foo [ this ^String #^{WebParam{:name "some"}}] |
| 10:53 | andyf | cnb_: #^ is older style syntax for what is now usually written as only ^. That is a prefix for metadata |
| 10:54 | Bronsa | cnb_: the snippet you pasted doesn't make sense, though. |
| 10:54 | andyf | I don't recognize the way it is used in your example |
| 10:58 | freddd | andyf: I just pulled up the ant demo and swapped ^ in for #^ and it still works. Is there any reason to use #^ now instead of ^? Symbols are hard to Google. |
| 10:59 | andyf | No reason to keep using #^ |
| 10:59 | justin_smith | freddd: http://clojure.org/reader and http://symbolhound.com/ is helpful sometimes too |
| 11:01 | freddd | andyf: Nice. Thanks. |
| 11:01 | freddd | justin_smith: Thanks. symbolhound doesn't seem to be working right now, but I'll try again later. |
| 11:03 | fortruce | When using speclj, how can I bind symbols for several 'it' specifications? |
| 11:03 | fortruce | wrapping the 'it's in a let causes only the last one to actually be tested |
| 11:04 | fortruce | I could just wrap the underlying 'should's, but I want to be able to label my tests with descriptive strings |
| 11:08 | fortruce | Ahh, if I wrap them in a context it works, duh |
| 11:15 | Glenjamin | fortruce: generally you'd use (with) inside a context |
| 12:18 | lxsameer | guys, I'm looking for a cool podcast about clojure , any suggestion ? |
| 12:19 | justin_smith | lxsameer: tbaldridge has some videos |
| 12:21 | fortruce | \u |
| 12:22 | lxsameer | justin_smith: let me check them out |
| 12:25 | lxsameer | justin_smith: do you have any url ? |
| 12:25 | justin_smith | https://tbaldridge.pivotshare.com/ |
| 12:27 | lxsameer | thanks |
| 12:34 | andyf | lxsameer: Cignitect's Cognicast podcast has many interesting Clojure-related discussions, but they explore other topics, too |
| 12:35 | lxsameer | andyf: cool thanks |
| 13:28 | gfredericks | what on earth is BigDecimal#plus() useful for |
| 13:28 | gfredericks | ,(.plus 3.0M) |
| 13:28 | clojurebot | 3.0M |
| 13:29 | justin_smith | ,(.plus 3.0M 1.0M) |
| 13:29 | clojurebot | #error{:cause "java.math.BigDecimal cannot be cast to java.math.MathContext", :via [{:type java.lang.ClassCastException, :message "java.math.BigDecimal cannot be cast to java.math.MathContext", :at [sandbox$eval49 invoke "NO_SOURCE_FILE" -1]}], :trace [[sandbox$eval49 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compiler.java" 6784] [clojure.lang.Compiler eval "Compiler.java" 6747] [cl... |
| 13:29 | justin_smith | ahh! |
| 13:29 | gfredericks | the docs just say "well we had .negate() so it seemed like we ought to have .plus()" |
| 13:29 | justin_smith | ,(.plus -3.0M) |
| 13:29 | clojurebot | -3.0M |
| 13:29 | justin_smith | wat |
| 13:29 | fortruce | haha |
| 13:29 | gfredericks | it's the identity, by definition |
| 13:30 | Bronsa | "This method, which simply returns this BigDecimal is included for symmetry with the unary minus method negate()." |
| 13:30 | Bronsa | :| |
| 13:30 | justin_smith | ;D |
| 13:30 | TimMc | superb reasoning |
| 13:30 | gfredericks | it maks me cry a little bit on the inside |
| 13:30 | justin_smith | we could totally do a loljvmapi blog |
| 13:31 | TimMc | jvmsadness |
| 13:31 | gfredericks | ,(-> 42M .plus .plus .plus .plus .plus .plus) |
| 13:31 | clojurebot | 42M |
| 13:32 | gfredericks | also does anybody know if there's any functional difference between ##[42.0M 42.00M] |
| 13:32 | lazybot | ⇒ [42.0M 42.00M] |
| 13:32 | justin_smith | ,(.plus 0.99999999999999999999999999999999999999999999M java.math.MathContext/DECIMAL32) |
| 13:32 | clojurebot | 1.000000M |
| 13:33 | justin_smith | ,(.plus 0.99999999999999999999999999999999999999999999M java.math.MathContext/DECIMAL128) |
| 13:33 | clojurebot | 1.000000000000000000000000000000000M |
| 13:33 | justin_smith | ,(.plus 0.99999999999999999999999999999999999999999999M java.math.MathContext/UNLIMITED) |
| 13:33 | clojurebot | 0.99999999999999999999999999999999999999999999M |
| 13:34 | justin_smith | so there's that |
| 13:34 | gfredericks | is there another method for doing that? |
| 13:34 | justin_smith | checking... |
| 13:35 | gfredericks | I don't see one |
| 13:35 | justin_smith | well, you could use .add 0.0 context |
| 13:35 | justin_smith | which may make more or less sense than .plus, dunno |
| 13:35 | gfredericks | ,(.stripTrailingZeros 42.100000000) |
| 13:35 | clojurebot | #error{:cause "No matching field found: stripTrailingZeros for class java.lang.Double", :via [{:type java.lang.IllegalArgumentException, :message "No matching field found: stripTrailingZeros for class java.lang.Double", :at [clojure.lang.Reflector getInstanceField "Reflector.java" 271]}], :trace [[clojure.lang.Reflector getInstanceField "Reflector.java" 271] [clojure.lang.Reflector invokeNoArgInst... |
| 13:35 | gfredericks | ,(.stripTrailingZeros 42.100000000M) |
| 13:35 | clojurebot | 42.1M |
| 13:36 | gfredericks | oh wait |
| 13:36 | pandeiro | is it possible to create a postgresql database from clojure code, outside of shelling out to `createdb` or something? |
| 13:36 | gfredericks | ,(.round 0.99999999999999999999999999999999999999999999M java.math.MathContext/DECIMAL128) |
| 13:36 | clojurebot | 1.000000000000000000000000000000000M |
| 13:36 | gfredericks | justin_smith: ^ there it is with a much better name |
| 13:37 | justin_smith | ,(.round 0.99999999999999999999999999999999999999999999M java.math.MathContext/UNLIMITED) |
| 13:37 | clojurebot | 0.99999999999999999999999999999999999999999999M |
| 13:37 | justin_smith | oh yeah, that is a much better name |
| 13:38 | justin_smith | it's surrealist logic: round -> fat -> plus-size -> plus |
| 13:39 | gfredericks | one weird trick to make sense of the JVM std lib |
| 13:39 | justin_smith | haha |
| 13:39 | gfredericks | 1990's developers hate him |
| 13:40 | verma | pretty sure I've asked this before, but can I get some clojure stickers printed and give them out on the day of my clojure workshop? |
| 13:40 | verma | I mean has anyone tried to do it and knows about any legal implications? |
| 13:43 | gabrbedd | Hi guys, I'm working on a recursive function (using recur) and for some reason I keep smashing the stack. |
| 13:43 | gabrbedd | How do you trace/debug/understand what's failing to do loop optimization? |
| 13:43 | justin_smith | gabrbedd: are you building up a lazy seq with many calls to concat? |
| 13:44 | justin_smith | gabrbedd: the recur itself won't consume stack, but you could be doing something that leads to stack usage (like nested concat calls, which are a classic case of that) |
| 13:44 | gabrbedd | justin_smith: No, it's a fixed-length sequence where I iteratively transform the sequence. |
| 13:44 | justin_smith | can you share a paste? |
| 13:44 | hiredman | https://groups.google.com/forum/#!searchin/clojure/logo/clojure/_o-sHr_YIwo/7R1fOaVQVOMJ |
| 13:45 | djames_ | I was hoping to find a (fail) function in clojure.test. I didn't see it. |
| 13:45 | justin_smith | djames_: (is nil "I am failing on purpose here because ...") |
| 13:45 | djames_ | justin_smith thanks |
| 13:45 | gabrbedd | justin_smith: yeah, give me a sec to see if I can make a smaller example |
| 13:47 | djames_ | ,(it nil "FAIL") |
| 13:48 | clojurebot | #error{:cause "Unable to resolve symbol: it in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: it in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: it in this context", :at [clojure.lang... |
| 13:48 | djames_ | ,(is nil "FAIL") |
| 13:48 | clojurebot | #error{:cause "Unable to resolve symbol: is in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: is in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: is in this context", :at [clojure.lang... |
| 13:48 | justin_smith | djames_: try referring clojure.test first, and is doesn't do much outside a deftest form |
| 13:48 | djames_ | ,(clojure.test/is nil "FAIL") |
| 13:48 | clojurebot | #error{:cause "clojure.test", :via [{:type java.lang.ClassNotFoundException, :message "clojure.test", :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}], :trace [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366] [java.net.URLClassLoader$1 run "URLClassLoader.java" 355] [java.security.AccessController doPrivileged "AccessController.java" -2] [java.net.URLClassLoader findClass "... |
| 13:48 | justin_smith | ,(require '[clojure.test :refer [deftest is]]) |
| 13:48 | clojurebot | #error{:cause "denied", :via [{:type java.lang.ExceptionInInitializerError, :message nil, :at [java.lang.Class forName0 "Class.java" -2]} {:type java.lang.SecurityException, :message "denied", :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}], :trace [[clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69] [clojurebot.sandbox.proxy$java.lang.Se... |
| 13:48 | djames_ | no worries, just playing around |
| 13:49 | justin_smith | clojurebot seems not to like clojure.test |
| 14:01 | gabrbedd | justin_smith: ok, here's a simpler test case http://pastebin.com/gbju6Mwi |
| 14:01 | gabrbedd | Trivial example (convert a sequence to all zeros)... but still. |
| 14:02 | gabrbedd | (count (recur-xform 1000)) => 1000 |
| 14:02 | gabrbedd | (count (recur-xform 10000)) => smashed stack |
| 14:04 | justin_smith | gabrbedd: yeah, this is the same issue - it's unrealized lazy seqs stacked on top of unrealized lazy-seqs |
| 14:05 | justin_smith | try forcing some of the lazy stuff with (doall (map ...)) instead of just (map ...) and your stack issues should disappear |
| 14:05 | justin_smith | the stack is getting smashed after the looping, when in the process of realizing the result |
| 14:06 | justin_smith | gabrbedd: I had referred to nested concat in a loop because that is a common pattern for this to happen, but any lazy operation nested in a loop has the danger of doing this |
| 14:07 | gabrbedd | justin_smith: thanks... yeah in the trivial example it was the map... in the /real/ example it appears to be a concat. |
| 14:07 | justin_smith | haha :) |
| 14:08 | gabrbedd | justin_smith: still... how do you debug this stuff? Is there a way to single-step through code or tracers or anythin? |
| 14:08 | gabrbedd | (e.g. in Haskell, they have a really nice built-in profiler) |
| 14:08 | gabrbedd | (...not that I expect Clojure to be Haskell... :-)) |
| 14:08 | justin_smith | gabrbedd: the oracle jdk comes with jvisualvm, which is a decent profiler |
| 14:08 | justin_smith | though it expresses everything in jvm terms, not clojure terms, which can be a bit confusing |
| 14:09 | justin_smith | there is also yourkit, which is free for open source work |
| 14:09 | justin_smith | gabrbedd: also, the best debugging integration I know if is cursive, which is a clojure plugin for intellij idea ide |
| 14:09 | gabrbedd | justin_smith: thanks (i'm new to the JVM world, too...) |
| 14:11 | gabrbedd | justin_smith: thank you! |
| 14:12 | justin_smith | also the stack traces you can get from thrown exceptions can be useful (even if you don't get it, someone who knows clojure's implementation better can probably decipher it) |
| 14:12 | justin_smith | depending on your setup the stack trace may not print, but you can use (.printStackTrace *e) to see the trace for the last exception thrown in the repl |
| 14:13 | gabrbedd | OK, cool. |
| 14:13 | justin_smith | and the better you get to know clojure, the more useful the traces are. |
| 14:25 | gfredericks | oh another cool thing about the new #error printing is that stacktrace customization is probably, like, even easier, or something |
| 14:27 | justin_smith | gfredericks: you could probably like redefine the print method for that type or something? |
| 14:28 | gfredericks | I mean that's already possible |
| 14:29 | gfredericks | but now it's trivial to reparse and rearrange |
| 14:29 | justin_smith | gfredericks: I thought the typical stack trace printing scenario wasn't a print method thing, it was an exception handler that happens to print |
| 14:31 | gfredericks | uuuhm |
| 14:31 | gfredericks | well if you call .printStackTrace on something then you can't be helped |
| 14:31 | gfredericks | but I'm thinking of repls and other tools and whatnot that now have a standard way to represent an exception as data |
| 14:33 | justin_smith | gfredericks: yeah. My available 1.6 repl doesn't return a value for an exception, it prints a message, *1 is not touched, but *e is set. |
| 14:34 | gfredericks | justin_smith: I don't think that will change |
| 14:34 | justin_smith | and .printStackTrace prints to the stdout on the remote server rather than my local nrepl client |
| 14:34 | justin_smith | yeah, makes sense |
| 14:34 | gfredericks | nrepl probably returns it as a distinguished thing? |
| 14:35 | justin_smith | not this nrepl |
| 14:35 | gfredericks | rather than just generic stderr prints? Not sure |
| 14:35 | gfredericks | well you can't necessarily tell from the other side of the client |
| 15:01 | thesaskwatch | Hi, I have a question regarding ring. I understand what are handlers and middlewares, but I don't understand why in the case of static resources ( https://github.com/ring-clojure/ring/wiki/Static-Resources ) a handler is needed. Any help? |
| 15:06 | gfredericks | thesaskwatch: it's not strictly needed, the library author just decided to structure static resources as a middleware instead of as a handler |
| 15:06 | gfredericks | you can use a trivial handler, I think there's a not-found handler somewhere |
| 15:07 | gfredericks | or just (constantly {:status 404}) would probably work |
| 15:07 | thesaskwatch | gfredericks: Thanks, that makes sense. |
| 15:07 | gfredericks | I'm assuming you're trying to setup a static-only server of some sort |
| 15:07 | seangrove | I came across this in some code I'm working on, wondering if there's a way to add a reader for it (looks doubtful from https://github.com/clojure/tools.reader/blob/1908c673fc60873a5da688e6fc87f6b07b222963/src/main/clojure/clojure/tools/reader.clj#L616) |
| 15:07 | seangrove | ,(read-string "[{:time #<DateTime 2015-03-06T00:00:51.888Z>}]") |
| 15:07 | clojurebot | #error{:cause "Unreadable form", :via [{:type java.lang.RuntimeException, :message "Unreadable form", :at [clojure.lang.Util runtimeException "Util.java" 221]}], :trace [[clojure.lang.Util runtimeException "Util.java" 221] [clojure.lang.LispReader$UnreadableReader invoke "LispReader.java" 1106] [clojure.lang.LispReader$DispatchReader invoke "LispReader.java" 616] [clojure.lang.LispReader readDelim... |
| 15:08 | thesaskwatch | gfredericks: Yes, I want to include clojurescript js file that way |
| 15:08 | gfredericks | seangrove: you'd want to change how it prints in the first place |
| 15:20 | seangrove | gfredericks: Yeah, I don't control the serialization side |
| 15:20 | seangrove | Owell, not a big deal |
| 15:21 | gfredericks | seangrove: who on earth is subjecting you to this |
| 15:22 | Bronsa | seangrove: in a hackish way, just alter-var-root `macros` and replace the dispatch for the unreadable reader |
| 15:23 | gfredericks | #protip |
| 15:24 | gfredericks | seangrove: the thing to be careful of is parsing #<> "correctly" |
| 15:24 | gfredericks | things that aren't timestamps can also print as #<> and might throw off the parser |
| 15:24 | gfredericks | ,(atom \>) |
| 15:24 | clojurebot | #<Atom@5bd7757a: \>> |
| 15:24 | gfredericks | like so |
| 15:24 | Bronsa | wait |
| 15:24 | Bronsa | shouldn't that print with the new #object syntax |
| 15:25 | gfredericks | yeah what's the deal clojurebot |
| 15:25 | Bronsa | oh it does, it's just clojurebot |
| 15:25 | gfredericks | wat |
| 15:25 | gfredericks | does it special case reference types? why on earth? |
| 15:25 | gfredericks | ,(prn (atom \>)) |
| 15:25 | clojurebot | #<Atom@69983f60: \>>\n |
| 15:25 | gfredericks | ,(Object.) |
| 15:25 | clojurebot | #object[java.lang.Object "java.lang.Object@4e737800"] |
| 15:25 | Bronsa | ,(promise) |
| 15:25 | clojurebot | #<core$promise$reify__6695@28ed12da: :pending> |
| 15:26 | Bronsa | gfredericks: ^ |
| 15:26 | Bronsa | IDerefs are handled specially so that they can print :pending/:done & the value they hold |
| 15:26 | amalloy | derefables have print-methods, yeah |
| 15:26 | gfredericks | Bronsa: but rhickey updated that |
| 15:26 | gfredericks | Bronsa: amalloy: https://github.com/clojure/clojure/commit/e03d787720a16fae37a2ec9afb3859a15e67b976 |
| 15:27 | Bronsa | gfredericks: ah yeah but it looks like clojurebot is still to the previous commit |
| 15:27 | gfredericks | clojurebot: I thought you were always bleeding |
| 15:27 | clojurebot | Cool story bro. |
| 15:27 | gfredericks | anyhow my original point to seangrove still applies |
| 15:27 | gfredericks | hey seangrove just convince whoever is emitting these to upgrade to clojure/master :P |
| 15:29 | gfredericks | ,(java.util.Date.) |
| 15:29 | clojurebot | #inst "2015-03-17T19:29:02.024-00:00" |
| 15:29 | gfredericks | urhm |
| 15:29 | gfredericks | ,(java.sql.Date.) |
| 15:29 | clojurebot | #error{:cause "No matching ctor found for class java.sql.Date", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.IllegalArgumentException: No matching ctor found for class java.sql.Date, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6732]} {:type java.lang.IllegalArgumentException, :message "No matching ctor found for class java.sql... |
| 15:29 | gfredericks | ,(java.sql.Date. 383) |
| 15:29 | clojurebot | #inst "1970-01-01T00:00:00.383-00:00" |
| 15:29 | arrdem | ,*ns* |
| 15:29 | clojurebot | eval service is offline |
| 15:29 | gfredericks | whatever nevermind ugh |
| 15:30 | Bronsa | &(java.util.Date.) |
| 15:30 | lazybot | ⇒ #inst "2015-03-17T19:29:56.393-00:00" |
| 15:30 | gfredericks | ,clj-time.core/now |
| 15:30 | clojurebot | #error{:cause "clj-time.core", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.ClassNotFoundException: clj-time.core, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.ClassNotFoundException, :message "clj-time.core", :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}], :trace [[java.net.URLClassLoader$... |
| 15:30 | gfredericks | &clj-time.core/now |
| 15:30 | lazybot | ⇒ #<core$now clj_time.core$now@2d6eed3f> |
| 15:30 | gfredericks | &(clj-time.core/now) |
| 15:30 | lazybot | ⇒ #<DateTime 2015-03-17T19:30:26.158Z> |
| 15:31 | gfredericks | well that doesn't matter though cause I wanted to see that with the new code |
| 15:47 | lvh | I have a function that wraps a Java API. One of the args is annotated #^Group, Group being a Java class. For testing, I want to create a fake Group that won't confuse Clojure. |
| 15:52 | lvh | What do I use for that? I've used reify before, but there's no Interface or Protocol to adhere to. From what I understand how it works, #^Group means that things you pass to it should be instances of Group, right? |
| 15:52 | lvh | So, do I do deftype and override all the methods? |
| 15:55 | gfredericks | lvh: you can try proxy |
| 15:55 | gfredericks | lvh: is the #^Group annotation yours? |
| 15:55 | gfredericks | is there not an interface you could put there instead? |
| 15:58 | borkdude | is there a way to get an over view of 'dead' code in your clojure project? |
| 16:01 | gfredericks | borkdude: expressions or functions? |
| 16:01 | borkdude | gfredericks functions would be good enough |
| 16:01 | gfredericks | borkdude: you could try running clj-usage-graph and scrutinizing the output |
| 16:01 | gfredericks | or adapting that code for the purpose |
| 16:02 | gfredericks | I wouldn't be surprised if there were something else that already existed though |
| 16:04 | borkdude | gfredericks thanks |
| 16:07 | kungi | Glenjamin: I created a bug report for kerodon: https://github.com/xeqi/kerodon/issues/32 |
| 16:11 | gfredericks | oh man clojure.math.numeric-tower/sqrt |
| 16:11 | gfredericks | with bigdecimal |
| 16:12 | gfredericks | stays in bigdecimal if there's an exact answer and drops down to double otherwise |
| 16:12 | paulswilliamsesq | dnolen hi, what's the best channel for a query / feedback on the cljs quick start? Don't want to disturb ;-) |
| 16:12 | dnolen | paulswilliamsesq: #clojurescript |
| 16:22 | freddd | Can an atom not be changed if its associated watch has not completed? |
| 16:23 | Waynes | which is the most appropriate channel for ring.middleware.flash questions? |
| 16:23 | paulswilliamsesq | dnolen cheers |
| 16:27 | patrickgombert | freddd: atoms notify watches after running a CAS |
| 16:27 | Waynes | I'm trying to use ring.middleware.flash/wrap-flash, but (get request :flash) is always nil http://pastebin.com/raw.php?i=axDw6dvd |
| 16:27 | patrickgombert | or just a set in the case of rest! |
| 16:28 | patrickgombert | reset!* |
| 16:28 | lvh | gfredericks: Yes, the #^Group annotation is mine, but there's no Group interface defined yet. Unless I misremember how Java works, I don't think I can define it myself and then define Group and MyFakeTestingGroup to be IGroups, right? |
| 16:29 | lvh | gfredericks: Proxy looks like what I want; thanks! |
| 16:31 | gfredericks | lvh: correct, if the lib isn't designed around interfaces then you end up pretty constrained |
| 16:33 | ordnungswidrig | waynes: what do you expect? |
| 16:34 | Waynes | ordnungswidrig: (= (get request :flash) "WORK, GODDAMNIT") |
| 16:34 | ordnungswidrig | waynes: I think you need wrap-session for flash to work... |
| 16:35 | ordnungswidrig | should work better than shouting curses. |
| 16:35 | Waynes | still does not work |
| 16:36 | Waynes | sorry, for the curses, I have tried for quite a while and I'm running weechat-curses which totally screwed itself up after I accidentally pressed the wrong key and it took a while to fix it |
| 16:36 | ordnungswidrig | In the repl, when you invoke (handler {:uri "/" :request-method :get}) what does it return? |
| 16:39 | Waynes | ordnungswidrig: repl freezes while starting atm, I'll see what's up with that, brb |
| 16:48 | Waynes | ordnungswidrig: apparently I shouldn't write ":main foo.core/-main" in project.clj or "lein repl" will freeze, anyway, it gives "{:session {:_flash "WORK, GODDAMNIT!"}, :flash "WORK, GODDAMNIT!", :status 200, :headers {}, :body "{:params {}, :route-params {}, :session/key nil, :cookies {}, :flash nil, :session {}, :uri \"/\", :request-method :get}"}" |
| 16:50 | ordnungswidrig | That's without wrap-session, right? |
| 16:50 | lxsameer | guys, I want to read some easy to understand clojure code as a practice , any suggestion what to read? |
| 16:50 | justin_smith | lxsameer: one possibility is doing 4clojure and looking at other people's answers |
| 16:50 | arrdem | what are you interested in? what are you trying to do? |
| 16:51 | lxsameer | arrdem: I'm trying to learn clojure as way it meant to be learned |
| 16:51 | Waynes | ordnungswidrig: that's with wrap-session, but the only difference is :session/key nil |
| 16:51 | lxsameer | justin_smith: 4clojure ? |
| 16:52 | arrdem | http://4clojure.org |
| 16:52 | justin_smith | http://www.4clojure.com/ |
| 16:52 | arrdem | https://github.com/arrdem/batbridge |
| 16:52 | arrdem | it's a collection of small(ish) programs with blog posts.. could be something useful to you. |
| 16:52 | arrdem | aphyr has some good "intro to Clojure with code" posts too.. |
| 16:53 | Waynes | ordnungswidrig: I could just put all the stuff in :session, that seems to work |
| 16:53 | lxsameer | cool thanks |
| 16:54 | arrdem | top post to go with the batbridge project, http://arrdem.com/2014/01/10/Batbridge/ |
| 16:55 | arrdem | e talking about the mechanics of the simulator to be worthwhile for you |
| 16:55 | arrdem | sorry. |
| 16:55 | arrdem | blarg C-u lxsameer ignore my posts, not enough clojure density. |
| 16:56 | lxsameer | arrdem: I confused man |
| 16:56 | justin_smith | arrdem: you should write more blog posts about Clojure |
| 16:56 | arrdem | justin_smith: I should pass my classes |
| 16:56 | arrdem | lxsameer: ignore my posts they aren't beginner level enough sorry. |
| 16:56 | lxsameer | arrdem: thanks anyway |
| 16:56 | arrdem | lxsameer: they assume you know clojure and teach computer architecture rather than teaching clojure worth a darn. |
| 17:01 | gabrbedd | I sometimes get runtime errors when variables bind to unexpected types. What strategies do you guys use to manage that? |
| 17:02 | arrdem | gabrbedd: core.typed, prismatic/schema, aggressive use of assertions and preconditions are all strategies I've seen. |
| 17:03 | arrdem | gabrbedd: of late I've been doing pre/post conditions and type predicate assertions. It works reasonably well. |
| 17:03 | justin_smith | gabrbedd: it is also possible to attach validators to vars |
| 17:03 | justin_smith | unless by variables you mean arguments to functions |
| 17:03 | justin_smith | then yeah, pre is good for that |
| 17:04 | justin_smith | or prismatic/schema |
| 17:04 | arrdem | justin_smith: I think he's talking about let-bound symbols. |
| 17:04 | arrdem | or other locals. |
| 17:04 | justin_smith | right, right |
| 17:04 | justin_smith | ,(def foo 1) |
| 17:04 | gabrbedd | Actually, I mean all of them... but I think the ones I hit today were arguments to functions. |
| 17:04 | clojurebot | #'sandbox/foo |
| 17:05 | justin_smith | ,(set-validator #'foo number?) |
| 17:05 | clojurebot | #error{:cause "Unable to resolve symbol: set-validator in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: set-validator in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: set-validator in... |
| 17:05 | justin_smith | ,(set-validator! #'foo number?) |
| 17:05 | clojurebot | nil |
| 17:05 | justin_smith | ,(def foo nil) |
| 17:05 | clojurebot | #error{:cause "Invalid reference state", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.IllegalStateException: Invalid reference state, compiling:(NO_SOURCE_FILE:0:0)", :at [clojure.lang.Compiler$DefExpr eval "Compiler.java" 452]} {:type java.lang.IllegalStateException, :message "Invalid reference state", :at [clojure.lang.ARef validate "ARef.java" 33]}], :trace [[clojur... |
| 17:05 | justin_smith | ,foo |
| 17:05 | clojurebot | 1 |
| 17:05 | gabrbedd | justin_smith: arrdem: Thanks. |
| 17:05 | arrdem | http://conj.io/store/v0/org.clojure/clojure/1.7.0-alpha4/clj/clojure.core/set-validator!/ |
| 17:05 | justin_smith | ,(def foo 5) |
| 17:05 | clojurebot | #'sandbox/foo |
| 17:05 | arrdem | ##clojure.core/even? |
| 17:06 | gabrbedd | I usually used statically typed languages... so I'm trying to find my way. :-) |
| 17:06 | justin_smith | arrdem: ## only works with () bounded things |
| 17:06 | Waynes | ,(prn "neat") |
| 17:06 | clojurebot | "neat"\n |
| 17:06 | arrdem | ##(print clojure.core/even?) |
| 17:06 | lazybot | ⇒ #<core$even_QMARK_ clojure.core$even_QMARK_@2e89de1c>nil |
| 17:07 | gfredericks | I used it with ##[] earlier |
| 17:07 | lazybot | ⇒ [] |
| 17:07 | gfredericks | I bet also ##{} |
| 17:07 | lazybot | ⇒ {} |
| 17:07 | gfredericks | what about ###{} |
| 17:07 | lazybot | ⇒ #{} |
| 17:07 | gfredericks | or ###'first |
| 17:07 | lazybot | ⇒ #'clojure.core/first |
| 17:07 | amalloy | gfredericks: anything that reads as a collection |
| 17:08 | justin_smith | gfredericks: oh, weird |
| 17:08 | gfredericks | okay so not ##"this" |
| 17:08 | gfredericks | nor ###"this" |
| 17:08 | Waynes | ["test"] |
| 17:08 | amalloy | to prevent incidents when people talk about irc channels like ##java |
| 17:08 | gfredericks | that would be a disaster |
| 17:08 | Waynes | ##(print "test") |
| 17:08 | lazybot | ⇒ testnil |
| 17:08 | justin_smith | but ###'future-cancel works |
| 17:08 | lazybot | ⇒ #'clojure.core/future-cancel |
| 17:08 | amalloy | justin_smith: that reads as (var future-cancel), of course |
| 17:08 | ordnungswidrig | waynes: wrap-session should add a session cookie to the response when working correctly |
| 17:08 | justin_smith | amalloy: of course |
| 17:09 | justin_smith | (doc future-cancel) |
| 17:09 | clojurebot | "([f]); Cancels the future, if possible." |
| 17:09 | justin_smith | my favorite doc string |
| 17:09 | justin_smith | poetry |
| 17:09 | Waynes | ordnungswidrig: yeah, wrap-session works, but :flash stays nil |
| 17:10 | whodidthis | whats a fun way to combine a pair of keywords like :page/one :load into :page.one/load |
| 17:11 | justin_smith | what's with the adjectives all the time anyway |
| 17:12 | amalloy | whodidthis: it sounds like a bad thing to do |
| 17:13 | whodidthis | alrite, ill do without hehe |
| 17:13 | ordnungswidrig | waynes: there was no session cookie in the above example you pasted |
| 17:13 | justin_smith | whodidthis: this works ##(assoc {} [:page :one :load] 42) |
| 17:13 | lazybot | ⇒ {[:page :one :load] 42} |
| 17:14 | Waynes | ordnungswidrig: ok, I got it working by wrapping it in a compojure.handler/site instead of ring.middleware.flash/wrap-flash :) |
| 17:14 | amalloy | also, you probably really want 1, not :one |
| 17:14 | justin_smith | amalloy: perhaps it's a site themed on various U2 albums |
| 17:14 | amalloy | but then strings, not keywords |
| 17:14 | justin_smith | heh |
| 17:15 | ordnungswidrig | waynes: I think you might had the order of wrap-flash and wrap-session wrong, site contains both in a sensible order |
| 17:15 | ordnungswidrig | wanyes: additionall side note: compojure.handler is deprecated |
| 17:17 | Waynes | ordnungswidrig: ah yes, that did it, wrap-flash has to come before wrap-session |
| 17:17 | ordnungswidrig | Waynes: using ring-defaults might be a good idea anyways |
| 17:18 | Waynes | ordnungswidrig: I tried that, but then firefox would only want to download the website instead of displaying it |
| 17:18 | justin_smith | Waynes: that's a sign that {:headers {:content-type ...}} was not set up properly |
| 17:19 | whodidthis | o yea why did i think of matching against just keywords, vectors be fine |
| 17:19 | Waynes | justin_smith: I guessed so, too, but I didn't guess the correct setup |
| 17:25 | pandeiro | ordnungswidrig: should liberator + ring-defaults' site-defaults have sessions working out of the box? i'm trying to attach :session inside a defresource and i can't get it to stick |
| 17:33 | pandeiro | ok i just needed (liberator.representation/ring-response (update-in resp [:body] pr-str)) to do what i meant |
| 18:33 | Travisty | Does technomancy still hang out here? |
| 18:35 | amalloy | Travisty: i haven't seen him for a while. he might be on vacation or something? he hasn't been active in #leiningen either |
| 18:36 | Travisty | Shucks. I wanted to tell him that he’s on the front page of hacker news right now! https://news.ycombinator.com/ |
| 18:38 | ambrosebs | I thought he was taking a break from computers |
| 18:38 | AeroNotix | Travisty: I doubt it's the first time for him |
| 18:38 | ambrosebs | or he was moving or something |
| 18:38 | arrdem | amalloy: he moved to singapore |
| 18:38 | ambrosebs | ah |
| 18:38 | Travisty | ah, well, I was excited :P |
| 18:39 | arrdem | as part of this he seems to have stepped back from all the f/oss stuff besides lurking #emacs |
| 18:39 | raek | I lives in Thailand now |
| 18:39 | raek | *he |
| 18:39 | arrdem | I was close :P |
| 18:39 | ambrosebs | I'm not sure if being on HN is cause for celebration ;) |
| 18:39 | raek | http://technomancy.us/177 |
| 18:39 | Travisty | heh, how come? |
| 18:39 | amalloy | i don't get how living in thailand or singapore or whatever is relevant. it's the internet |
| 18:39 | ambrosebs | if anyone sees him, warn him about the trolls coming his way :) |
| 18:40 | arrdem | ^ |
| 18:40 | arrdem | the last article of mine to make HN frontpage just got trolled. |
| 18:40 | ambrosebs | yea sorry to hear |
| 18:40 | arrdem | the traffic was nice when Grimoire made it, but none of them stuck around as users. |
| 18:41 | arrdem | ambrosebs: you gonna make it to clj/west? |
| 18:41 | ambrosebs | arrdem: nope. conferenced out |
| 18:41 | ambrosebs | after going to india for POPL |
| 18:41 | Travisty | arrdem: Have you had mulitple first page articles? :O |
| 18:41 | arrdem | laem. fair enough. |
| 18:41 | Travisty | I think I saw one a few months back, when I spent more time here |
| 18:42 | arrdem | Travisty: I think other people have made front page with my work three times now |
| 18:42 | Travisty | heh |
| 18:45 | hiredman | ambrosebs: timezones are a thing still, they effect irc a lot |
| 18:45 | hiredman | er |
| 18:45 | hiredman | amalloy: |
| 19:27 | mdeboard | arrdem: Why the (apparent?) evasiveness about Grimoire in http://arrdem.com/2015/01/27/ox:_some_motivation/ |
| 19:28 | mdeboard | Also conj.io is a dead link now I guess |
| 19:28 | arrdem | mdeboard: site's still up... |
| 19:28 | arrdem | mdeboard: which link? |
| 19:28 | mdeboard | Oh |
| 19:29 | arrdem | "htttp" |
| 19:29 | arrdem | lol I did that |
| 19:29 | mdeboard | The 3rd bullet point in that-- |
| 19:29 | mdeboard | yeah |
| 19:30 | arrdem | fixed thanks |
| 19:30 | mdeboard | Sorry, combined with the "I will say no more on the matter" and the "dead" link I thought you got sued or something :P |
| 19:31 | arrdem | I mean... it's like arguing the contribution process. I have a philisophical difference with Core and it's not useful to anyone to beat on it. |
| 19:31 | mdeboard | Ah I see |
| 19:31 | arrdem | it just creates unproductive drama |
| 19:31 | mdeboard | A political ballyhoo |
| 19:31 | arrdem | right. |
| 19:32 | arrdem | I'd be happy to write about that stuff if you're interested, I just didn't think it's worth my time. |
| 19:33 | mdeboard | I'm sure it's as boring to an outsider like me as it is irritating to insiders on both sides |
| 19:33 | arrdem | "insider" lol |
| 19:34 | mdeboard | :) |
| 19:36 | hyPiRion | Just to be sure: When you compile a namespace, its dependencies also have to be compiled, yes? |
| 19:36 | arrdem | hyPiRion: yes AFAIK |
| 19:37 | amalloy | hyPiRion: yes |
| 19:38 | hyPiRion | amalloy, arrdem: Thanks for confirming |
| 19:44 | danlentz | good afternoon, clojurians. I just promoted clj-uuid 0.1.5 which is documentation and feature complete now. It is a library for efficient UUID generation and a fairly comprehensive implementation of RFC4122. |
| 19:45 | danlentz | Please have a look, if it is of interest: http://danlentz.github.io/clj-uuid |
| 19:46 | mdeboard | is tree-shaking a recently coined phrase ? or recently re-discovered from computing antiquity? |
| 19:46 | mdeboard | I have trouble finding any references to it that don't involve JS, Dart or Clojure |
| 19:46 | danlentz | common lisp uses the term frequently |
| 19:47 | mdeboard | I see |
| 19:47 | danlentz | well, some implementations. the ones that have the capability to compile reduced-functionality binaries like lispworks i believe |
| 19:48 | danlentz | I saw an experimental one for an old version of SBCL but i dont remember where. |
| 19:49 | eprogramming | hi all |
| 19:49 | eprogramming | can't import BufferedImage... |
| 19:49 | eprogramming | don't know why any help would be really good |
| 19:49 | eprogramming | thanks |
| 19:50 | eprogramming | ...Unable to resolve classname: BufferedImage.. |
| 19:50 | danlentz | mdeboard: https://gist.github.com/danlentz/4778188019707b21aa16 |
| 19:50 | danlentz | there is a tree shaker from 1989 |
| 19:51 | hyPiRion | eprogramming: (import 'java.awt.image.BufferedImage) or (:import java.awt.image.BufferedImage) in the ns declaration |
| 19:51 | mdeboard | danlentz: nice |
| 19:51 | eprogramming | hyPiRion: thanks i will do this now to try ! |
| 19:52 | hyPiRion | np |
| 19:55 | danlentz | mdeboard: of course more modern tree-shakers are generally implemented with a Taylor Swift backing track. |
| 19:55 | eprogramming | hyPiRion: now getting: 'No matching ctor found for class java.awt.image.BufferedImage' |
| 19:56 | amalloy | eprogramming: that means your import worked but you're using it wrong |
| 19:57 | eprogramming | amalloy: got it ! doing this: (let [space (BufferedImage.)]) |
| 19:57 | eprogramming | ctor 'constructor' right ? |
| 19:57 | amalloy | $javadoc java.awt.image.BufferedImage |
| 19:57 | lazybot | http://docs.oracle.com/javase/6/docs/api/java/awt/image/BufferedImage.html |
| 19:57 | amalloy | yes |
| 19:57 | eprogramming | thx |
| 19:57 | amalloy | note that there is no 0-arg constructor |
| 19:58 | eprogramming | yup ! sorry i'm just really noob on clojure |
| 19:58 | eprogramming | trying to migrate a small game to clojure |
| 19:58 | eprogramming | thnks a lot amalloy hyPiRion |
| 19:59 | mdeboard | danlentz: I wasn't aware Apple had forked Swift into different versions |
| 19:59 | mdeboard | regular Swift and Taylor Swift? Or are there more variants |
| 19:59 | mdeboard | -.- |
| 20:00 | danlentz | heh :) |
| 20:03 | hyPiRion | mdeboard: the Swift on Security variant |
| 20:05 | Seylerius | What's with the - prefix before some functions in Clojure? Like (-main)? |
| 20:06 | eprogramming | hyPiRion: amalloy i have another one ;) |
| 20:06 | eprogramming | my project is called dinga_invaders |
| 20:07 | eprogramming | underline on namespace |
| 20:07 | ambrosebs | Seylerius: I believe -init and -main are special if you use gen-class |
| 20:07 | eprogramming | i saw unit tests doing test_clojure for directory and test-clojure |
| 20:07 | eprogramming | for ns |
| 20:07 | Seylerius | ambrosebs: gen-class? |
| 20:07 | eprogramming | weird because here works only if i declare ns with underline |
| 20:07 | ambrosebs | Seylerius: almost guaranteed you don't need to know |
| 20:07 | gratimax | eprogramming: that's a feature |
| 20:08 | gratimax | the jvm can't handle - in package names afaik |
| 20:08 | eprogramming | gratimax: really ? |
| 20:08 | eprogramming | gratimax: ok np but is good to have some of this on main docs agree ? |
| 20:08 | gratimax | http://stackoverflow.com/questions/4420944/why-does-clojure-convert-dashes-in-names-to-underscores-in-the-filesystem |
| 20:09 | gratimax | well honestly it's hidden behind a 5-keyword google search... |
| 20:09 | eprogramming | gratimax: tks will look |
| 20:09 | eprogramming | gratimax: i part of a group to try not use google by the way |
| 20:09 | eprogramming | to do feedback about main docs |
| 20:09 | eprogramming | but thanks i will take a look |
| 20:09 | gratimax | ok. it's hidden behind a 5-keyword duckduckgo search |
| 20:10 | gratimax | oh I see :P |
| 20:10 | eprogramming | haha gratimax not like dr. stallman |
| 20:10 | eprogramming | no he is great person reply my emails 2013 a lot but |
| 20:10 | eprogramming | this not the point |
| 20:10 | eprogramming | the point is get the doc and vim and try to do something |
| 20:11 | eprogramming | i'm on 5 days only in clojure and learning a lot using this technique ( sorry my english ) |
| 20:12 | eprogramming | btw gratimax thanks for this |
| 20:14 | Seylerius | ambrosebs: Short version is that it uses the "-" prefix to identify things that the JVM will care about in the resulting class? Like main, init, and so on? |
| 20:14 | amalloy | Seylerius: yes |
| 20:14 | amalloy | specifically methods |
| 20:14 | Seylerius | Shiny. Useful to know about. |
| 20:14 | Seylerius | But not particularly necessary _right_now_. |
| 20:15 | Seylerius | Glad I looked it up in more detail, though. |
| 20:15 | Seylerius | I'll probably want to know about this later. |
| 20:15 | gratimax | eprogramming: I looked around a bit and turns out an explanation is in the docs http://dev.clojure.org/display/doc/FAQ |
| 20:16 | gratimax | well it's an FAQ... idk if you consider that "main docs" |
| 20:16 | eprogramming | gratimax: this is great ! |
| 20:16 | gfredericks | anybody know what the weird doublebooked slots are in the clojurewest schedule? |
| 20:16 | amalloy | gfredericks: link? |
| 20:17 | eprogramming | gratimax: yes going to take a look on this |
| 20:17 | gfredericks | amalloy: clojurewest.org |
| 20:17 | gratimax | actually it's even mentioned twice in the main documentation, here http://clojure.org/libs |
| 20:17 | gfredericks | amalloy: in three different slots it has two talks inexplicably in one room opposite nothing |
| 20:17 | gratimax | under example lib, "note the translations from period to slash and hyphen to underscore" |
| 20:18 | amalloy | i only see two, but okay |
| 20:18 | gfredericks | as if six different talks all ended up being crammable into a halfslot |
| 20:18 | amalloy | oh, three |
| 20:20 | eprogramming | gratimax: thanks a lot |
| 20:20 | eprogramming | 'So a "_" in a namespace "folder name/file name" has to correspond to a "-" in the namespace name.' |
| 20:20 | eprogramming | http://dev.clojure.org/display/doc/FAQ as you shared |