2015-04-15
| 00:00 | justin_smith | ,(= (fn []) (fn [])) |
| 00:00 | clojurebot | false |
| 00:00 | brainproxy_ | right, the latter case makes sense to me |
| 00:00 | justin_smith | brainproxy_: metadata is not part of equality |
| 00:02 | brainproxy | ,(let [x (fn [])] (= x x)) |
| 00:02 | clojurebot | true |
| 00:02 | justin_smith | that' |
| 00:02 | brainproxy | :) |
| 00:02 | justin_smith | s object idenity |
| 00:02 | justin_smith | which as I mentioned is the only kind of identity fn has |
| 00:02 | justin_smith | *equality |
| 00:02 | brainproxy | ,(+ 1 1) (+ 1 1) |
| 00:02 | clojurebot | 2 |
| 00:03 | brainproxy | was testing something, have an idea |
| 00:10 | brainproxy | ,(do (defrecord Myfun [f] clojure.lang.IFn (invoke [_] (f))) (let [x (->Myfun (fn []))] (= x (vary-meta x assoc :a 'bc)))) |
| 00:10 | clojurebot | true |
| 00:11 | brainproxy | well, obviously not a general purpose solution, but could do in a pinch |
| 00:11 | justin_smith | brainproxy: you could also put the function in a var or atom or ref or agent |
| 00:11 | justin_smith | and put the metadata on that container |
| 00:11 | TEttinger | meta doesn't affect equality does it? |
| 00:12 | justin_smith | TEttinger: no, but varying meta on a function makes a new function |
| 00:12 | TEttinger | oh you covered that already |
| 00:12 | TEttinger | ahhh |
| 00:12 | justin_smith | so it changes function equality as a side effect of that |
| 00:16 | brainproxy | justin_smith: ah good point re: var/atom |
| 00:18 | justin_smith | brainproxy: or even with your defrecord trick, that record could have been a vector, where you function is the only element |
| 00:28 | noidi | justin_smith, great explanation, thanks |
| 00:29 | justin_smith | np |
| 04:29 | zot | morning! is there a func like assoc that errors if the key already exists? i can clearly create this with merge-with, but wondered if something already exists. |
| 04:34 | zot | to be super clear, this is what I meant to simplify: |
| 04:35 | zot | (merge-with (fn [& _] (throw (Exception. (str "Duplicate :db/ident found: " :a)))) {:a :foo} {:a [0]}) |
| 04:59 | m1dnight_ | Guys, I'm looking for the term that describes how data structures (like maps) are represented in Clojure. IF you were to pass am ap and assoc to it, you would get a "new" map which shares old data with the previous data structure, but the old reference still has the old view of that data structure. |
| 05:00 | m1dnight_ | CAn anyone help me? |
| 05:00 | sm0ke | zot: i dont think so, but you can combine assoc with `contains?` |
| 05:01 | Bronsa | m1dnight_: persistent data structures with structural sharing |
| 05:01 | m1dnight_ | aha! thank you bronsa |
| 05:01 | zot | sm0ke: definitely, although since I want an error, i feel like the merge-with failing fn is more elegant. i didn't write the other version to actually see it though :) |
| 05:01 | sm0ke | like ##(if (contains? {:a 1} :b) (throw (Exception. "foo")) (prn "ok"))) |
| 05:01 | lazybot | ⇒ "ok" nil |
| 05:01 | m1dnight_ | (inc Bronsa) |
| 05:01 | lazybot | ⇒ 104 |
| 05:04 | sm0ke | ,(bean org.apache.commons.lang.SerializationUtils) |
| 05:04 | clojurebot | #error{:cause "org.apache.commons.lang.SerializationUtils", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.ClassNotFoundException: org.apache.commons.lang.SerializationUtils, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6535]} {:type java.lang.ClassNotFoundException, :message "org.apache.commons.lang.SerializationUtils", :at [java.n... |
| 05:05 | zot | sm0ke: looks nice and tight there. will try the same now just for comparison. thanks :) |
| 05:05 | sm0ke | how awsome it would be if clojurebot allow adding a dependency here |
| 05:33 | darthdeus | hey guys, anyone here using core.typed? I'm having trouble finding a good way to import its namespace ... since if I just :refer :all, it will collide with the core clojure functions |
| 05:35 | oddcully | darthdeus: :as t seems quite popular |
| 05:58 | aspra | hey there! Does anyone know if https://github.com/razum2um/clj-debugger is the main debugger for Clojure atm? |
| 06:00 | razum2um | aspra: seems like it is :) I also linked to other options here: https://github.com/razum2um/awesome-clojure#debugging |
| 06:03 | aspra | razum2um: cool thx! Is there anything more than the README I can look at? |
| 06:03 | razum2um | aspra: what are you looking for? |
| 06:04 | aspra | I want to start using it - just a guide to get me started |
| 06:05 | aspra | razum2um: I want to start using it - just a guide to get me started |
| 06:06 | razum2um | aspra: basically it has only 2 functions just on top of readme. currently won't work in multithreading and no stack up/down walking :\ |
| 06:06 | razum2um | aspra: I've got less time for it recently, but we could improve it all together :) |
| 06:08 | razum2um | aspra: the main puprose I initially did this is importing a huge dataset, where some datarows were invalid and I needed break-catch, logging was not enough |
| 06:08 | aspra | razum2um: I see :) Ok great - I will try it and come back to you! |
| 06:09 | aspra | razum2um: thx for the work |
| 07:24 | aspra | I am trying the clj-debugger. I keep getting the https://github.com/razum2um/clj-debugger/issues/11 error even though my defn is not defined in the repl. Then I cannot exit using (q). Any idea what I might be doing wrong? |
| 08:02 | clojer | Is this syntactically wrong: (let [gen (new SecureRandom) key (byte-array length)] ... ? |
| 08:03 | clojer | From https://github.com/Arcanum-XIII/buddy-liberator/blob/master/src/buddy_liberator/core/handler.clj |
| 08:07 | mavbozo | clojer, at a glance, it's alright. why? is there any compilation error? |
| 08:08 | clojer | mavbozo: Doesn't look like a proper binding. |
| 08:09 | clojer | mavbozo: Shouldn't it be: (let [gen ((new SecureRandom) key (byte-array length))] |
| 08:13 | mavbozo | clojer, i tried it with repl and your version returns an error. What do you want to achieve with your version? |
| 08:14 | sm0ke | one weird question so i have a var which contains a function how do find the namesapce of the fcuntion? |
| 08:14 | mavbozo | (new SecureRandom) returns an object, and you put the object in function position inside a list |
| 08:14 | sm0ke | ,(do (def a inc) (namespace a)) |
| 08:14 | clojurebot | #error{:cause "clojure.core$inc cannot be cast to clojure.lang.Named", :via [{:type java.lang.ClassCastException, :message "clojure.core$inc cannot be cast to clojure.lang.Named", :at [clojure.core$namespace invoke "core.clj" 1530]}], :trace [[clojure.core$namespace invoke "core.clj" 1530] [sandbox$eval25 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compiler.java" 6784] [clojure.lang.C... |
| 08:16 | sm0ke | ,(do (def a inc) (namespace `a)) |
| 08:16 | clojurebot | "sandbox" |
| 08:17 | sm0ke | which is obvious, but can i get ##(namespace `inc) |
| 08:17 | lazybot | ⇒ "clojure.core" |
| 08:35 | aspra | razum2um: I am trying the clj-debugger. I keep getting the https://github.com/razum2um/clj-debugger/issues/11 error even though my defn is not defined in the repl. Then I cannot exit using (q). Any idea what I might be doing wrong? |
| 08:53 | geirby | oh my |
| 08:54 | geirby | have just noticed that cider updated (ns (:require with [clojure.string :as str] when I typed (str/ |
| 08:54 | geirby | magic |
| 08:56 | bensu | thanks Bronsa, puredanger, lukev for reader conditionals |
| 08:56 | mavbozo | geirby, cider 0.9.0-SNAPSHOT? |
| 08:56 | geirby | yes |
| 08:57 | mavbozo | wow |
| 08:57 | bensu | and all the contributors for 1.7 |
| 08:57 | mavbozo | (inc Bronsa) |
| 08:57 | lazybot | ⇒ 105 |
| 08:57 | mavbozo | (inc puredanger) |
| 08:57 | lazybot | ⇒ 43 |
| 08:57 | mavbozo | (inc lukev) |
| 08:57 | lazybot | ⇒ 1 |
| 08:57 | bensu | I just finished the migration and it worked great |
| 08:57 | bensu | mavbozo: exactly :) |
| 08:57 | geirby | mavbozo: not sure if it was done by cider. I'm using spacemacs, may be it was some plugin |
| 08:58 | puredanger | Noooo now I lost my 42 :) |
| 08:58 | mavbozo | (dec puredanger) |
| 08:58 | lazybot | ⇒ 42 |
| 08:58 | puredanger | Whew |
| 08:59 | bensu | puredanger: the only thing that broke was instaparse, and the error was already solved and documented |
| 09:09 | sobel | is there anything like afl fuzzer for clojure code? |
| 09:19 | oddcully | sobel: considered test.check? |
| 09:31 | timvisher | what is `#'var`? |
| 09:31 | timvisher | and can i use it with a macro? |
| 09:31 | justin_smith | timvisher: it's a reader macro |
| 09:31 | justin_smith | ,#'+ |
| 09:31 | clojurebot | #'clojure.core/+ |
| 09:31 | justin_smith | ,(var +) |
| 09:31 | clojurebot | #'clojure.core/+ |
| 09:31 | timvisher | ah |
| 09:31 | clojurebot | Gabh mo leithscéal? |
| 09:31 | timvisher | so (= #' (var ...)) |
| 09:32 | justin_smith | well, (= #'foo (var foo)) yeah |
| 09:32 | timvisher | what's the word for that? qualified var? |
| 09:33 | justin_smith | timvisher: var quote |
| 09:33 | timvisher | so generally i refer to `foo` as a var |
| 09:33 | justin_smith | it's a symbol, which resolves to the value of the var |
| 09:33 | timvisher | but when i pass it to something using #'foo, what i'm passing to the thing is a ...? |
| 09:33 | justin_smith | while #'foo refers to the var itself |
| 09:33 | timvisher | ok |
| 09:33 | justin_smith | a var is a mutable container |
| 09:34 | justin_smith | it's the difference between passing a pointer vs. the thing itself |
| 09:34 | timvisher | ah yes, which is why when i wrap jetty around the var instead of the value, i can change the value of the var and jetty picks it up |
| 09:34 | timvisher | i thought it had something to do with pass by referenc rather than by value :) |
| 09:34 | timvisher | reference* |
| 09:34 | justin_smith | right - a var in function call position is implicitly dereferenced |
| 09:34 | justin_smith | timvisher: and yes, it is sort of a value vs. reference sort of thing |
| 09:34 | justin_smith | ,((var +) 1 2) |
| 09:34 | clojurebot | 3 |
| 09:34 | justin_smith | implicit deref |
| 09:35 | timvisher | so, i'm trying to write a macro that will pass the war down eventually to a run-jetty call |
| 09:35 | timvisher | var* |
| 09:35 | justin_smith | but note that that implicit deref is only in the calling position |
| 09:35 | justin_smith | timvisher: the cool thing is with a macro, you could add the (var ...) part inside the macro |
| 09:35 | timvisher | and -main is now complaining that i can't refer to an undefined var |
| 09:35 | timvisher | i suppose i could give that a try :) |
| 09:36 | justin_smith | timvisher: note that this won't work with a first class function |
| 09:36 | justin_smith | it needs to be a def at the top level of the ns |
| 09:36 | timvisher | justin_smith: in this case it is |
| 09:39 | timvisher | well, i can't get the code highlighting to work but this is what i've got so far https://gist.github.com/timvisher/1000a363e5dca3e2a01e |
| 09:39 | timvisher | justin_smith: congrats! |
| 09:40 | timvisher | there that's better |
| 09:40 | timvisher | https://gist.github.com/timvisher/1000a363e5dca3e2a01e |
| 09:42 | justin_smith | so yeah, that looks about right, wouldn't be surprised if it worked |
| 09:42 | timvisher | it doesn't seem to :( i attached the stack i'm getting to the gist |
| 09:42 | justin_smith | maybe "handler-var" would be better named "handler-symbol" |
| 09:42 | timvisher | justin_smith: that's a good note :) |
| 09:43 | justin_smith | timvisher: ~'service-name |
| 09:43 | justin_smith | assuming service-name is a symbol |
| 09:43 | timvisher | service-name is a string |
| 09:43 | justin_smith | oh it's a string |
| 09:43 | justin_smith | never mind |
| 09:43 | timvisher | probably doesn't need to be but it is right now |
| 09:43 | justin_smith | port-arg# nrepl-port-arg# etc. |
| 09:44 | justin_smith | ` wants to namespace qualify your binding symbols |
| 09:44 | justin_smith | you need to change them by adding # |
| 09:44 | justin_smith | (at definition and at usage) this tells ` to generate a gensym rather than namespace qualifying the symbols |
| 09:44 | timvisher | ah |
| 09:45 | justin_smith | compare: |
| 09:45 | justin_smith | ,`(let [a 0] a) |
| 09:45 | clojurebot | (clojure.core/let [sandbox/a 0] sandbox/a) |
| 09:45 | justin_smith | ,`(let [a# 0] a#) |
| 09:45 | clojurebot | (clojure.core/let [a__49__auto__ 0] a__49__auto__) |
| 09:45 | justin_smith | for obvious reasons, that first version won't actually run |
| 09:45 | timvisher | indeed |
| 09:45 | justin_smith | you can't let bind a ns qualfied symbol (as that stack trace is saying) |
| 09:45 | mavbozo | justin_smith, congratulations on your new job |
| 09:45 | justin_smith | mavbozo: thanks! |
| 09:46 | justin_smith | it'll be more clojure, but in a field I haven't done before |
| 09:46 | justin_smith | so I have a lot of learning to do... |
| 09:46 | justin_smith | well, it's also a web server process, but there's some other fun stuff going on too that will be new to me... |
| 09:46 | timvisher | so now we're here https://gist.github.com/timvisher/1000a363e5dca3e2a01e#file-service-main-clj |
| 09:46 | timvisher | still the same error |
| 09:47 | Shayanjm | justin_smith: what industry will you be working in? |
| 09:47 | timvisher | is this because i'm attempting to use destructuring? |
| 09:47 | justin_smith | Shayanjm: big data |
| 09:47 | Shayanjm | any specific vertical? 'big data' is a big place |
| 09:47 | justin_smith | timvisher: I wonder... |
| 09:47 | justin_smith | Shayanjm: graph analysis of social data, with a web UI for clients |
| 09:48 | timvisher | ,`(defn [& {ohai ":ohai" charnock ":charnock" :as args}] (ohai charnock args)) |
| 09:48 | Shayanjm | oh nice |
| 09:48 | clojurebot | (clojure.core/defn [& {sandbox/charnock ":charnock", :as sandbox/args, sandbox/ohai ":ohai"}] (sandbox/ohai sandbox/charnock sandbox/args)) |
| 09:48 | Shayanjm | a bit like my last project then |
| 09:48 | Shayanjm | but, graph-y |
| 09:48 | timvisher | ,`(defn [& {ohai# ":ohai" charnock# ":charnock" :as args#}] (ohai# charnock# args#)) |
| 09:48 | clojurebot | (clojure.core/defn [& {:as args__100__auto__, ohai__98__auto__ ":ohai", charnock__99__auto__ ":charnock"}] (ohai__98__auto__ charnock__99__auto__ args__100__auto__)) |
| 09:48 | timvisher | no that looks reasonable... |
| 09:49 | timvisher | assuming that :as can go first in the destructuring bind? |
| 09:49 | justin_smith | timvisher: OH |
| 09:49 | Shayanjm | justin_smith: do you have a few minutes to review some wordvomit? I'm trying to skeleton-out my blog post for that data project I was working on |
| 09:49 | justin_smith | timvisher: pass app-routes rather than app |
| 09:50 | justin_smith | timvisher: it's already a var, var quoting is nonsensical there |
| 09:50 | Shayanjm | would appreciate some criticism/comments on direction. It's fairly light reading because I tried to make everything as simple/accessible as possible |
| 09:50 | justin_smith | ,(var `#'+) |
| 09:50 | clojurebot | #error{:cause "clojure.lang.Cons cannot be cast to clojure.lang.Symbol", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6732]} {:type java.lang.ClassCastException, :message "clojure.lang.Cons cannot be cast to... |
| 09:50 | justin_smith | oops |
| 09:50 | justin_smith | ,`(var #'+) |
| 09:50 | clojurebot | (var (var clojure.core/+)) |
| 09:50 | justin_smith | that's what you were doing, and it won't work ^ |
| 09:51 | timvisher | ,(let [{:as charnock ohai ":ohai" whitefield ":whitefield"} {":ohai" :a ":whitefield" :b}] [charnock ohai whitefield]) |
| 09:51 | clojurebot | [{":ohai" :a, ":whitefield" :b} :a :b] |
| 09:51 | timvisher | it does seem to work |
| 09:51 | justin_smith | timvisher: no, it's because app is already a var |
| 09:51 | justin_smith | you can't call var on a var |
| 09:51 | timvisher | ok |
| 09:51 | justin_smith | ,(var #'+) |
| 09:51 | clojurebot | #error{:cause "clojure.lang.Cons cannot be cast to clojure.lang.Symbol", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6732]} {:type java.lang.ClassCastException, :message "clojure.lang.Cons cannot be cast to... |
| 09:51 | timvisher | so this was working though prior to trying to macroize it |
| 09:52 | timvisher | in the application the app-routes var is being further wrapped by some middleware |
| 09:52 | justin_smith | timvisher: right, before you needed to pre-var-quote |
| 09:52 | justin_smith | now the macro var-quotes |
| 09:52 | justin_smith | hmm... |
| 09:52 | timvisher | which i'm assuming doesn't return the var itself? |
| 09:52 | timvisher | middleware returns a function right? |
| 09:52 | justin_smith | right |
| 09:53 | justin_smith | I was wrong, app should work there |
| 09:53 | timvisher | i updated the gist to be more accurate https://gist.github.com/timvisher/1000a363e5dca3e2a01e |
| 09:53 | justin_smith | ,(def f +) |
| 09:53 | clojurebot | #'sandbox/f |
| 09:53 | timvisher | (sorry, trying to obfuscate sensitive stuff :) ) |
| 09:53 | justin_smith | ,(defmacro g [h] (var h)) |
| 09:53 | clojurebot | #error{:cause "Unable to resolve var: h in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve var: h in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6732]} {:type java.lang.RuntimeException, :message "Unable to resolve var: h in this context", :at [clojure.lang.Util run... |
| 09:54 | justin_smith | ,(defmacro g [h] `(var ~h)) |
| 09:54 | clojurebot | #'sandbox/g |
| 09:54 | justin_smith | ,(g f) |
| 09:54 | clojurebot | #'sandbox/f |
| 09:54 | timvisher | that looks like about what i was seeing |
| 09:54 | justin_smith | so that works |
| 09:54 | timvisher | ah nice |
| 09:54 | timvisher | so a further syntax quote |
| 09:55 | justin_smith | timvisher: you may need ~(var handler-var) |
| 09:55 | justin_smith | to make the defn form work |
| 09:56 | timvisher | i'm reminded of something fogus or chouser said about writing macros, which is that most people writing macros just treat the various quote and unquote functions like a salt shaker, sprinkling them at random throughout the macro until it works :) |
| 09:56 | justin_smith | ,(defmacro g [h] `(defn ~'generated [] (var ~h))) |
| 09:56 | clojurebot | #'sandbox/g |
| 09:56 | timvisher | justin_smith: net referring to you of course, but to me :) |
| 09:56 | justin_smith | ,(defmacro g [h] `(defn generated [] (var ~h))) |
| 09:56 | clojurebot | #'sandbox/g |
| 09:56 | justin_smith | timvisher: haha, indeed |
| 09:57 | justin_smith | I get suspicious of any nesting of quotes and unquotes |
| 09:57 | justin_smith | ,(g f) |
| 09:57 | clojurebot | #error{:cause "Unable to resolve var: f in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve var: f in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6732]} {:type java.lang.RuntimeException, :message "Unable to resolve var: f in this context", :at [clojure.lang.Util run... |
| 09:57 | justin_smith | ,(def f +) |
| 09:57 | clojurebot | #'sandbox/f |
| 09:57 | justin_smith | ,(g f) |
| 09:57 | clojurebot | #'sandbox/generated |
| 09:57 | justin_smith | ,(generated) |
| 09:57 | clojurebot | #'sandbox/f |
| 09:57 | justin_smith | ok, so this worked |
| 10:00 | timvisher | justin_smith: i'm not sure it did. isn't there something about macros resolving vars in their namespace rather than in the var's namespace? |
| 10:00 | justin_smith | timvisher: when I take the call to control/start-service! out, it works |
| 10:00 | justin_smith | timvisher: just returning the hash-map |
| 10:00 | timvisher | oh well nevermind then :) |
| 10:00 | justin_smith | timvisher: I think the problem is control/start-service! |
| 10:00 | timvisher | as in that's the qualified var it can't find? |
| 10:00 | justin_smith | because that's the only change I made from your code as of the last paste |
| 10:00 | justin_smith | timvisher: has to be |
| 10:01 | timvisher | that's possible |
| 10:01 | timvisher | in this instance, the macro is in the same ns as the function i'm calling |
| 10:01 | justin_smith | because it works in my repl if I take that reference out and return the hash-map |
| 10:01 | justin_smith | than don't qualify it! |
| 10:01 | justin_smith | ` ns-qualifies things for you |
| 10:01 | timvisher | i just realized that :) |
| 10:02 | timvisher | how many fake internet points would you like? ;) |
| 10:02 | justin_smith | haha |
| 10:02 | mavbozo | more than raynes? |
| 10:03 | timvisher | (identify raynes) |
| 10:03 | timvisher | (identity raynes) |
| 10:03 | lazybot | raynes has karma 55. |
| 10:03 | timvisher | who was it last night that had triple digits? |
| 10:03 | timvisher | oh yeah |
| 10:03 | timvisher | amalloy |
| 10:03 | justin_smith | amalloy, technomancy, and myself all are in the 3 digits |
| 10:04 | justin_smith | oh, and gfredericks |
| 10:04 | justin_smith | $karma gfredericks |
| 10:04 | lazybot | gfredericks has karma 135. |
| 10:04 | justin_smith | $karma amalloy |
| 10:04 | lazybot | amalloy has karma 257. |
| 10:04 | justin_smith | $karma technomancy |
| 10:04 | lazybot | technomancy has karma 163. |
| 10:04 | justin_smith | $karma justin_smith |
| 10:04 | lazybot | justin_smith has karma 239. |
| 10:04 | zerokarmaleft | ooh, catching up |
| 10:05 | mavbozo | $karma Raynes |
| 10:05 | lazybot | Raynes has karma 55. |
| 10:05 | mavbozo | case-insensitive i see |
| 10:13 | timvisher | justin_smith: huh. i can't get this to work even removing the call to `start-service!`... |
| 10:13 | timvisher | can you pastebin the version you said worked? |
| 10:13 | timvisher | because you already do enough of my job for me :) |
| 10:18 | justin_smith | timvisher: this version works https://www.refheap.com/99635 |
| 10:19 | justin_smith | next is for you to figure out how to refer to start-service! |
| 10:20 | justin_smith | always so excited about side effects around here |
| 10:22 | timvisher | bizarre... |
| 10:22 | timvisher | this is why i never write macros... |
| 10:24 | timvisher | "make it a little easier on your fellow devs... have some sweet syntax... have a few laughs..." http://imoviequotes.com/wp-content/uploads/2014/11/3-Die-Hard-quotes.gif |
| 10:25 | timvisher | oh jeez. -main is being ns qualified... |
| 10:25 | timvisher | so how i do i get that specific name to be in the resulting expansion? |
| 10:26 | justin_smith | timvisher: haha ~'-main |
| 10:26 | justin_smith | for some reason I did not have that problem, weird |
| 10:27 | timvisher | interesting... the macroexpansion 'inlines' (?) the (var ...) call to #'app |
| 10:27 | noncom | does anybody know some solution to reduce startup time of aleph? |
| 10:27 | justin_smith | timvisher: #'app is how (var app) prints |
| 10:28 | timvisher | oh interesting |
| 10:28 | timvisher | i know so litle about the reader/printer |
| 10:29 | justin_smith | ,(var +) |
| 10:29 | clojurebot | #'clojure.core/+ |
| 10:29 | timvisher | ok! feeling good about this restart :) |
| 10:34 | timvisher | the war is over ender... we won... |
| 10:34 | timvisher | at what cost? |
| 10:34 | timvisher | ... |
| 10:34 | zerokarmaleft | eh, he gets over it over the next three books :P |
| 10:43 | timvisher | (inc justin_smith) |
| 10:43 | lazybot | ⇒ 240 |
| 10:43 | timvisher | (inc justin_smith) |
| 10:43 | lazybot | ⇒ 241 |
| 10:43 | timvisher | (inc justin_smith) |
| 10:43 | lazybot | ⇒ 242 |
| 10:43 | timvisher | gotta be worth at least three |
| 10:43 | timvisher | justin_smith: want to come work in philly? :) |
| 10:44 | justin_smith | timvisher: I appreciate the offer, but Portland is pretty awesome, and I just got this job |
| 10:44 | timvisher | justin_smith: heh. understood :) |
| 10:44 | timvisher | gotta love that concrete |
| 10:46 | TEttinger | what happened, haha |
| 10:46 | virmundi | are there any good tutorials for advanced compojure techniques? I just realized that I can have /resource/:id, and the :id be missing. as such a 404 should occur. Easy enough if I have just a few routes, but it would be a pattern. |
| 10:50 | noncom | if smb is interested on the q about aleph i asked a few minutes ago, here's what: http://dev.clojure.org/jira/browse/CLJ-1529 |
| 10:54 | timvisher | virmundi: maybe the luminus docs? |
| 10:54 | timvisher | compojure is great while things are small by imo it breaks down _hard_ when you get more complex |
| 10:58 | virmundi | timvisher: I’ll take a look |
| 10:58 | noncom | does anyone use clojure 1.7.0-beta1 already? |
| 11:11 | CookedGryphon | hey, can anyone explain to me why Transit takes a ByteArrayInputStream argument to its reader? |
| 11:11 | CookedGryphon | how am I supposed to get the benefits of keyword caching etc. over a stream of data if I need to recreate the reader every time? |
| 11:13 | CookedGryphon | on the writer side, I can at least call reset() on the bytearrayoutputstream and write new data to it if needs be, but I have no way of putting new data into the reader without creating a new reader, or going to all the faff of making a new type of input stream (which is hell in clojure, with it being an abstract class rather than an interface) |
| 11:14 | dnolen | CookedGryphon: that's just how caching is supposed to work, you can't safely share caches across reads anyway |
| 11:15 | TEttinger | https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayOutputStream.html it appears there is a .reset |
| 11:17 | CookedGryphon | TEttinger: yeah, I can do that on the write side, but it's not thread safe |
| 11:17 | CookedGryphon | but on the read side, I can't do anything |
| 11:17 | TEttinger | ah. |
| 11:17 | TEttinger | yeah you shouldn't be able to send something that causes the reader to forget everything it read... |
| 11:18 | CookedGryphon | dnolen: is there a reason for that? I would have thought if you're creating a reader, you can manage a session to the extent that you know what the other end has seen from you already, in which case why not share cache values? |
| 11:19 | TEttinger | there's also a reset for input https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayInputStream.html#reset-- |
| 11:19 | CookedGryphon | TEttinger: yeah, but all that allows you to do is read the same data again |
| 11:20 | TEttinger | not if you mark when you reset the writer |
| 11:20 | CookedGryphon | dnolen: my particular use case, I am opening a websocket and want a reader/writer for the lifetime of that socket, why wouldn't it be safe to use cached keywords during that session? |
| 11:21 | TEttinger | https://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayInputStream.html#mark-int- this should let you reset to a later point in the stream |
| 11:23 | TEttinger | ah, but you want different data to be read in, I guess? I think that it will keep reading and adding in input at the end |
| 11:23 | TEttinger | since it can't be closed |
| 11:32 | CookedGryphon | Yeah, I really want streams to be core.async channels |
| 11:32 | CookedGryphon | and they just aren't |
| 11:36 | timvisher | ugh... round-trip on uberjar testing is _slooooooow_ |
| 11:37 | timvisher | CookedGryphon: i have some memory of aleph support attaching a core.async channel to a websocket? |
| 11:37 | timvisher | does that sound like anything to anybody? :) |
| 11:37 | mpenet | timvisher: via manifold probably |
| 11:37 | mpenet | jet has websocket support using core.async as well (both client/server) |
| 11:38 | CookedGryphon | so I'm using chord |
| 11:38 | CookedGryphon | and that has core.async websocket support, clj and cljs, and it's great |
| 11:38 | CookedGryphon | it even has a transit mode, |
| 11:39 | CookedGryphon | but the formatter creates a new writer for every outbound message and a new reader for every inbound message |
| 11:39 | CookedGryphon | when I really want for the lifetime of the websocket to use keyword caching and a single reader/writer. |
| 11:39 | muraiki | I've used websockets in httpkit with core.async, but I don't know what it does in terms of writers/readers |
| 11:40 | CookedGryphon | so I tried to make the change to the formatter, and in cljs it's not a problem, but the clj version has these ByteArray<in/out>putStreams |
| 11:42 | kolov | cemerick, thanks for the help with friend & google oauth2 yesterday. https://github.com/ddellacosta/friend-oauth2 workflow works fine, I migrated my app to oauth2. |
| 11:43 | cemerick | kolov: great, glad it worked out :-) |
| 11:44 | cemerick | kolov: it would probably be useful to others if you could document the migration process/changes, would be happy to have a friend wiki page on this if you're willing |
| 11:44 | timvisher | so my understanding of transitive deps is clearly broken |
| 11:45 | timvisher | when i `lein run` a thing, all transitive deps seem to be present. but when i go to `lein uberjar` the thing, it seems like anything i didn't specify explicitly in my deps dissapears |
| 11:45 | timvisher | which can't be right, can it? |
| 11:45 | kolov | cemerick: I'll leave a comment at https://github.com/cemerick/friend/issues/117 |
| 11:46 | mpenet | timvisher: sounds odd... you're using checkouts? |
| 11:46 | timvisher | mpenet: i do, but not in this instance |
| 11:47 | mpenet | timvisher: I never had this issue |
| 11:47 | timvisher | mpenet: i haven't either... |
| 11:47 | timvisher | not to my knowledge at least |
| 11:48 | timvisher | so i've got a shared lib which depends _explicitly_ on cider-nrepl, and _transitively_ on tools.nrepl |
| 11:48 | timvisher | i've got my service which depends explicitly on the shared-lib |
| 11:48 | timvisher | lein deps :tree reports all the deps |
| 11:49 | timvisher | but lein uberjar can't find `clojure/tools/nrepl/server...` on the classpath |
| 11:51 | timvisher | i mean, i'm fine with adding the dep, but i don't understand why it's necessary |
| 11:52 | mpenet | the dep is in a dev/test profile? |
| 11:52 | timvisher | mpenet: nope. top level `:dependencies` |
| 11:53 | timvisher | there doesn't appear to be anything weird about the dep in cider-nrepl either https://github.com/clojure-emacs/cider-nrepl/blob/0f189d6881352f584dbbbdcb47272ccfaf1ed25a/project.clj#L15 |
| 11:55 | ghadishayban | is there any known trouble with calling (require 'somens) inside futures to get an application started up faster? |
| 12:03 | Bronsa | ghadishayban: might interact badly with defmethod/extend |
| 12:03 | timvisher | hah. `lein classpath` even reports that the dep is there... |
| 12:05 | timvisher | puredanger's tip about jar contents is also a swing and a miss, the jar contains the stuff i think it does |
| 12:18 | timvisher | i'm completely baffled by this behavior. is there a difference between the compiletime dependencies and the dependencies included in the uberjar? |
| 12:19 | timvisher | i'm wondering now if this is a lein version problem? it has to be simpler than that though |
| 12:21 | lemonodor | maybe `lein with-profile uberjar deps :tree` might show something different? |
| 12:38 | sdegutis | Do any've y'all who've a Clojure web app 'nd deploy it to EC2 use Docker or Vagrant or anything else to manage it? |
| 12:39 | lemonodor | I used elastic beanstalk, and just created WARs with lein-awsuberwar |
| 12:42 | bensu | sdegutis: I use Docker |
| 13:01 | noncom | dowa anyone use clojure 1.7.0-beta 1 lready? |
| 13:02 | TEttinger | ,*clojure-version* |
| 13:02 | clojurebot | {:major 1, :minor 7, :incremental 0, :qualifier "master", :interim true} |
| 13:02 | TEttinger | it's pretty likely that clojurebot uses it |
| 13:02 | TEttinger | or something newer |
| 13:02 | TEttinger | are you having issues with it, noncom? |
| 13:03 | noncom | i'd say just a question: https://www.refheap.com/99638 |
| 13:03 | noncom | see the differences on starting my project in the two versions? |
| 13:03 | noncom | 1) namespace object is strange in 1.7.0 |
| 13:04 | noncom | 2) warnings are not suppressed? |
| 13:04 | noncom | can you maybe comment on that? (just to know what's going on) |
| 13:08 | TEttinger | right, noncom: update is new in 1.7.0 as a clojure.core fn |
| 13:09 | mavbozo | ,(doc update) |
| 13:09 | clojurebot | "([m k f] [m k f x] [m k f x y] [m k f x y ...] [m k f x y ...]); 'Updates' a value in an associative structure, where k is a key and f is a function that will take the old value and any supplied args and return the new value, and returns a new structure. If the key does not exist, nil is passed as the old value." |
| 13:09 | TEttinger | and there's a different printer for objects |
| 13:09 | TEttinger | ,(print (java.util.HashMap.)) |
| 13:09 | clojurebot | #object[java.util.HashMap {}] |
| 13:09 | TEttinger | &(print (java.util.HashMap.)) |
| 13:09 | lazybot | ⇒ #<HashMap {}>nil |
| 13:10 | TEttinger | ,#object[java.util.HashMap {}] |
| 13:10 | clojurebot | #<RuntimeException java.lang.RuntimeException: No reader function for tag object> |
| 13:10 | TEttinger | hm |
| 13:10 | TEttinger | why do we have this object reader syntax again? |
| 13:11 | bacon1989 | TEttinger: think it's for the EDN format, so you can write custom readers to produce the desired Record from external data |
| 13:12 | noncom | ok, i got it about (update), really, ew only had (update-in) before... |
| 13:12 | TEttinger | yep, we really did |
| 13:12 | TEttinger | kinda nuts |
| 13:12 | noncom | but as for the object... |
| 13:12 | noncom | maybe it's what bacon1989 says... |
| 13:12 | puredanger | TEttinger: the new syntax can be read by the reader, the old could not |
| 13:13 | TEttinger | puredanger, but... it didn't get read |
| 13:13 | puredanger | it *can* be read, but no default reader is defined for it |
| 13:13 | TEttinger | tag object doesn't have a reader function, should it? |
| 13:14 | puredanger | what would you do with it if you had it? |
| 13:17 | TEttinger | puredanger: probably try to deserialize the stuff that comes with the object (the {} there), and/or call the zero arg constructor if present |
| 13:18 | TEttinger | is there an edn serializer for POJOs yet? |
| 13:18 | puredanger | the {} is the toString - this seems like an older version btw, as it now also includes the hash explicitly |
| 13:20 | Shayanjm | ping arrdem |
| 13:21 | puredanger | ,(prn (java.util.HashMap.)) |
| 13:21 | clojurebot | {}\n |
| 13:21 | Shayanjm | ,(doc prn) |
| 13:21 | clojurebot | "([& more]); Same as pr followed by (newline). Observes *flush-on-newline*" |
| 13:21 | Shayanjm | oic |
| 13:21 | TEttinger | ,(doc pr) |
| 13:21 | clojurebot | "([] [x] [x & more]); Prints the object(s) to the output stream that is the current value of *out*. Prints the object(s), separated by spaces if there is more than one. By default, pr and prn print in a way that objects can be read by the reader" |
| 13:22 | TEttinger | hm |
| 13:22 | puredanger | pr/prn are for printing as readable data |
| 13:22 | puredanger | print/println are for humans |
| 13:22 | Shayanjm | noted |
| 13:22 | TEttinger | then what's this new less readable sometimes #object syntax? |
| 13:22 | mavbozo | ,(println (java.util.HashMap.)) |
| 13:22 | clojurebot | #object[java.util.HashMap {}]\n |
| 13:23 | noncom | so now we now that's an object :) |
| 13:23 | puredanger | that's for printing as data when it has no defined printer as data - interestingly it looks like print-dup and print-method differ here in how they handle Java collections, so this is kind of a weird corner |
| 13:23 | TEttinger | ah |
| 13:24 | Bronsa | all the differences between pr/str/print + *print-dup* always confused me |
| 13:24 | Shayanjm | TIL |
| 13:24 | mavbozo | ,(prn 'a-symbol) |
| 13:24 | puredanger | ,(pr (java.awt.Color/BLACK)) |
| 13:24 | clojurebot | a-symbol\n |
| 13:24 | clojurebot | #error{:cause "Could not initialize class java.awt.Toolkit", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6732]} {:type java.lang.NoClassDefFoundError, :message "Could not initialize class java.awt.Toolkit", :at [java... |
| 13:24 | puredanger | ha |
| 13:25 | mavbozo | ,(println 'a-symbol) |
| 13:25 | clojurebot | a-symbol\n |
| 13:26 | mavbozo | ,(prn (get get get get)) |
| 13:26 | clojurebot | #object[clojure.core$get "clojure.core$get@38c44e0e"]\n |
| 13:26 | mavbozo | ,(println (get get get get)) |
| 13:26 | clojurebot | #object[clojure.core$get clojure.core$get@38c44e0e]\n |
| 13:26 | puredanger | yeah, functions are a good example |
| 13:27 | noncom | but adventures continue! https://www.refheap.com/99639 |
| 13:27 | noncom | look at lines 10 and 11 |
| 13:27 | puredanger | but on beta1 you should see something like this for (pr get): #object[clojure.core$get 0x58915a1a "clojure.core$get@58915a1a"] |
| 13:27 | puredanger | class hash toString |
| 13:28 | puredanger | ,*clojure-version* |
| 13:28 | clojurebot | {:major 1, :minor 7, :incremental 0, :qualifier "master", :interim true} |
| 13:28 | puredanger | must be an old version of master - that's weird |
| 13:29 | puredanger | I guess maybe clojurebot was started with master before beta1 or something? |
| 13:29 | puredanger | ,(class (range 5)) |
| 13:29 | clojurebot | clojure.lang.LazySeq |
| 13:29 | puredanger | yeah, definitely pre-beta1 |
| 13:30 | noncom | mine shows |
| 13:30 | noncom | => *clojure-version* |
| 13:30 | noncom | {:major 1, :minor 7, :incremental 0, :qualifier "beta1"} |
| 13:30 | noncom | => (class (range 5)) |
| 13:30 | noncom | clojure.lang.LongRange |
| 13:30 | puredanger | yeah, what clojurebot is showing is a master-SNAPSHOT, but it not current |
| 13:30 | noncom | well, ok.. |
| 13:31 | noncom | what about lines 10 and 11 here? ttps://www.refheap.com/99639 |
| 13:31 | puredanger | the :interim true up there means it's a snapshot |
| 13:31 | puredanger | noncom: those are long-standing reflection warnings in those libs - I think some of them have newer versions where they've been fixed |
| 13:33 | hiredman | ,(class (range 5)) |
| 13:33 | clojurebot | clojure.lang.LongRange |
| 13:34 | puredanger | hey look :) |
| 13:34 | noncom | wow |
| 13:34 | noncom | ,(class (range 5)) |
| 13:34 | clojurebot | clojure.lang.LongRange |
| 13:34 | puredanger | ,(pr get) |
| 13:34 | clojurebot | #object[clojure.core$get 0x35bcc9ae "clojure.core$get@35bcc9ae"] |
| 13:34 | noncom | *clojure-version* |
| 13:34 | noncom | ,*clojure-version* |
| 13:34 | clojurebot | {:major 1, :minor 7, :incremental 0, :qualifier "master", :interim true} |
| 13:34 | noncom | wtf |
| 13:35 | puredanger | I assume hiredman did a bounce :) |
| 13:35 | hiredman | I did, I restarted the eval service with a newer version |
| 13:35 | puredanger | master currently matches beta1 |
| 13:35 | mavbozo | cool |
| 13:36 | mavbozo | ,(prn (get get get get)) |
| 13:36 | clojurebot | #object[clojure.core$get 0x35bcc9ae "clojure.core$get@35bcc9ae"]\n |
| 13:36 | noncom | cool! |
| 13:36 | mavbozo | ,(print (get get get get)) |
| 13:36 | clojurebot | #object[clojure.core$get 0x35bcc9ae clojure.core$get@35bcc9ae] |
| 13:38 | TEttinger | ,(def get ([] get) ([& get] get get)) |
| 13:38 | clojurebot | #error{:cause "Too many arguments to def", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Too many arguments to def, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6740]} {:type java.lang.RuntimeException, :message "Too many arguments to def", :at [clojure.lang.Util runtimeException "Util.java" 221]}], :trace [[cl... |
| 13:39 | TEttinger | ,(defn get ([] get) ([& get] get get)) |
| 13:39 | clojurebot | #error{:cause "denied", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6740]} {:type java.lang.SecurityException, :message "denied", :at [clojurebot.sandbox$enable_security_manager$fn__835 invoke "sandbox.clj" 69]}], :trace [[clojurebot.sandbox$enable_securit... |
| 13:39 | TEttinger | ha |
| 13:53 | sdegutis | Sorry, I disconnected. D'anyone say anythin' 'n regards t' my question about deploying t' EC2? |
| 13:54 | sdegutis | I only saw the first two responses, respectively from lemonodor and bensu. |
| 13:54 | sdegutis | lemonodor: so you don't use nginx or anything besides a single UBER-WAR? |
| 13:55 | xemdetia | sdegutis, I spent at least half a minute trying to parse 3 messages back |
| 13:55 | sobel | anyone here use clojure-nginx? |
| 13:58 | ircxy | concurrency Q: I'd like to manage a max number of a db column for more than 1 db env. I'd like to call a func or lazy-seq to get the next value passing a map containing the db-env. {:db-env :test} initially the map is empty. When the env key is not found, Q db, init the atom. Any tips? |
| 13:58 | ircxy | Looking at dosync with if-let |
| 14:00 | small-chimp | burn all jews in oven |
| 14:00 | small-chimp | sieg heil |
| 14:00 | sdegutis | xemdetia: sorry 'bout that, I s'pose contractions 'n' abbreviations don't work quite so well here as the'do in real life. |
| 14:00 | small-chimp | death to infidels |
| 14:00 | small-chimp | allahu akhbar |
| 14:00 | small-chimp | burn all jews in oven |
| 14:00 | sobel | yes. use a sequence in your database. |
| 14:01 | sdegutis | sobel: nope, why d'y' ask? |
| 14:01 | Bronsa | amalloy: |
| 14:01 | sobel | sdegutis: hoping to find a success story with the latest version. i can't get it to twitch under the microscope. |
| 14:01 | Bronsa | sdegutis: please stop. it's pointless and makes your phrases hard to read |
| 14:02 | sdegutis | Bronsa: you're the boss. |
| 14:02 | small-chimp | DEATH TO JEWS |
| 14:02 | small-chimp | CLOJURE IS AN INFIDEL PROGRAMMING LANGUAGE |
| 14:02 | small-chimp | ALLAHU AKHBAR |
| 14:02 | Bronsa | puredanger: you here? |
| 14:02 | puredanger | yeah, hang on |
| 14:02 | sobel | ircxy: don't try to keep track of things in the database that are already kept track of in the database. |
| 14:03 | mavbozo | ircxy, you only query the max-number of column once during your app startup? |
| 14:03 | sobel | ircxy: if you need a serial value, use it in your sql expressions. that is regular/appropriate use. |
| 14:03 | oddcully | small-chimp: your last nick was more funny |
| 14:03 | ircxy | mavbozo: yes, actually the first time someone calls the next function. |
| 14:04 | Bronsa | sdegutis: not trying to be bossy but it's seriously irritating and I'm sure you're aware of it. no idea why you sometimes try to be willfully annoying |
| 14:04 | sobel | ircxy: why do you need that value? |
| 14:04 | sobel | Bronsa: the burden of communication is on the speaker. let the problems he creates rest on his shoulders. |
| 14:04 | small-chimp | HELP I WOULD LIKE TO LEARN CLOJURE BUT I AM TOO STUPID |
| 14:04 | small-chimp | HELP PLEASE |
| 14:04 | sobel | Bronsa: rather than asking us to carry them, as well ;) |
| 14:04 | ircxy | sobel: like DB sequence number, but for a group of inserts |
| 14:04 | pbx | no ops here eh? |
| 14:05 | small-chimp | HELP HOW CAN I BECOME A DATABASE |
| 14:05 | sobel | /ig small-chimp |
| 14:05 | sobel | and be done |
| 14:05 | mavbozo | done |
| 14:05 | sdegutis | Bronsa: to be honest I was just trying to have a little harmless fun; but I keep forgetting that every single time I try to add a little harmless fun into my communications on IRC in #clojure, you get very very very annoyed at it; my apologies for forgetting to be sensitive to your needs |
| 14:05 | oddcully | none of the bots have some vote kill feature? |
| 14:05 | sobel | ircxy: right, it's a concurrency problem right there if you are sending seq numbers from your app. it's safer to use a "next seq" expression in the sql code. |
| 14:06 | sobel | ircxy: s/safer/safe. |
| 14:06 | sdegutis | small-chimp: touché |
| 14:06 | sobel | ircxy: in other words, when you copy a seq value from your database, you have created the concurrency problem. |
| 14:06 | small-chimp | HELP HOW CAN I LEARN FUNCTIONAL PROGRAMMING HELP PLEASE |
| 14:06 | ircxy | sobel: can't. I'm inserting a group of X rows that are related. They all need the same number. think batch id. |
| 14:07 | small-chimp | EVERYTHING IS A FUNCTION THAT IS SOMETHING I THINK UH THAT I COULD THINK ON ACID |
| 14:07 | oddcully | aaaand good bye |
| 14:08 | ircxy | sobel: understood. Theoretically this is true, no Q. But this server as the only access for inserting. |
| 14:08 | mavbozo | ircxy, have you considered using stored-procedure? |
| 14:08 | sdegutis | small-chimp: you make a very compelling and reasonable point in that we shouldn't try to amuse ourselves without regard or consideration for others around us; thank you for your subtle but effective nudge |
| 14:08 | sobel | ircxy: so inserting then updating all new rows to the (same) next_seq value wouldn't be allowed |
| 14:09 | ircxy | sobel: so each thread would get the next value and insert it's batch with the next number. |
| 14:09 | sobel | that sounds like a shite db arrangement. sorry to hear it. :) |
| 14:09 | sdegutis | Bronsa: after reading small-chimp's message between the lines, I now understand that I was the one wrong this whole time; I'm sorry for annoying you with my so-called "harmless" fun. |
| 14:10 | Bronsa | sdegutis: I don't remember all those times I complained about you that you seem to imply. Also please stop this passive-aggressive trolling. |
| 14:10 | mgaare | sdegutis: how's the view from up there on hte cross? |
| 14:10 | small-chimp | what!? but i never meant any offense or disrespect |
| 14:10 | ircxy | sobel: simply the inserted batch rows are logically related, this single number ties them together. |
| 14:11 | dmead | hi channel. can i still use slime with swank-clojure? or do i have to use nrepl |
| 14:11 | dmead | i'm having a problem getting slime to talk to clojure |
| 14:11 | Bronsa | puredanger: surely #clojure!*@* +b!*@* small-chimp!*@* |
| 14:11 | sdegutis | Bronsa: based on your response you must have completely misunderstood what I was saying |
| 14:11 | sobel | ircxy: ok, so you need a value nailed down that is transactional. a sequence will not be, for obvious reasons. |
| 14:11 | @puredanger | Bronsa: eh? |
| 14:11 | Bronsa | puredanger: surely #clojure!*@* +b!*@* small-chimp!*@* have done nothing wrong :) |
| 14:11 | sdegutis | mgaare: I'm sure that's meant to be an insult of some kind, but I really don't get it |
| 14:11 | Bronsa | puredanger: you messed up the ban command :P |
| 14:12 | TimMc | That bans everyone, right? |
| 14:12 | sdegutis | Anyway, anyone else use Docker, Vagrant, or other, and have reason to prefer it over the others? |
| 14:12 | @puredanger | yeah, I probably did |
| 14:12 | @puredanger | help? |
| 14:12 | clojurebot | Nobody can help with "X doesn't work". Please provide context: what you did, what you hoped would happen, and what happened instead. A stack trace is especially helpful, if applicable. |
| 14:12 | sobel | ircxy: could you use a temp table to stage your import? would a UUID be just as good or does someone else depend on having continuously increasing integers for import ids? |
| 14:12 | Bronsa | puredanger: /mode #clojure -bb #clojure!*@* +b!*@* |
| 14:12 | TimMc | not that I understand IRC ban syntax, because I don't |
| 14:12 | sdegutis | I don't know anyone who does, it's completely confusing. |
| 14:13 | TimMc | I've never seen documentation for it, though I've looked. |
| 14:13 | @puredanger | Bronsa: what does all that mean? |
| 14:13 | Bronsa | puredanger: hang on, you're not opped so that won't work |
| 14:13 | ircxy | sobel: no requirement for inc numbers. Was thinking UUID as well. |
| 14:13 | @puredanger | I think I am opped? |
| 14:13 | sdegutis | puredanger: you are |
| 14:13 | sobel | ircxy: i would go with that, and not try to sync a data structure with db sequences |
| 14:13 | oddcully | hes channel op |
| 14:14 | @puredanger | this is like giving your keys to a 5 year old :) |
| 14:14 | sobel | ircxy: that way your import process starts with reading a fresh uuid then inserting with that value for the batch |
| 14:14 | Bronsa | puredanger: oh you are, erc is dumb then |
| 14:14 | Bronsa | puredanger: that removes the two wrong bans you added to the banlist |
| 14:14 | sobel | ircxy: it's probably the simplest concurrent way to do this |
| 14:14 | Bronsa | +b |
| 14:15 | Bronsa | (inc puredanger) |
| 14:15 | lazybot | ⇒ 43 |
| 14:15 | sobel | (inc sobel) |
| 14:15 | lazybot | You can't adjust your own karma. |
| 14:15 | sobel | !!!!!! |
| 14:15 | mavbozo | (dec puredanger) |
| 14:15 | lazybot | ⇒ 42 |
| 14:15 | ircxy | sobel: surely a lot simpler, to create a uuid |
| 14:15 | mavbozo | keep it 42 |
| 14:15 | TimMc | local maximum |
| 14:15 | sobel | (inc Bronsa ) |
| 14:15 | lazybot | ⇒ 3 |
| 14:15 | sobel | i only inc the with-spaces version. |
| 14:16 | sobel | (div 2 Bronsa) |
| 14:16 | TimMc | $karma Bronsa |
| 14:16 | lazybot | Bronsa has karma 105. |
| 14:16 | sobel | $karma Bronsa |
| 14:16 | lazybot | Bronsa has karma 105. |
| 14:16 | sobel | $karma Bronsa |
| 14:16 | lazybot | Bronsa has karma 105. |
| 14:16 | TimMc | with-spaces, is that like the evin-twin version? |
| 14:16 | sobel | apparently it trims whitespace. however will i query the with-space version. |
| 14:16 | sobel | TimMc: right down to the goatee |
| 14:17 | sobel | $karma "Bronsa " |
| 14:17 | lazybot | "Bronsa " has karma 0. |
| 14:17 | sobel | $karma 'Bronsa ' |
| 14:17 | lazybot | 'Bronsa ' has karma 0. |
| 14:17 | sobel | $karma Bronsa\ |
| 14:17 | lazybot | Bronsa\ has karma 0. |
| 14:17 | Bronsa | sobel: please stop highlighting me |
| 14:17 | sdegutis | Bronsa: sorry |
| 14:17 | sobel | Bronsa: will try |
| 14:18 | sobel | do the karma inquiries highlight you? |
| 14:18 | noprompt_ | is there anything i need to enable to get #? working in the repl? |
| 14:18 | timvisher | i do understand lein uberjar right in that it should package transient dependencies up with the jar? |
| 14:18 | noprompt_ | i get a rt exception saying the conditional read isn't allowed. :/ |
| 14:19 | timvisher | ah https://github.com/technomancy/leiningen/issues/1762#event-194323170 |
| 14:20 | sobel | transitive <> transient ;) |
| 14:21 | timvisher | sobel: not sure i follow |
| 14:21 | sdegutis | I'm looking to upgrade from 1.5.1 to 1.7. Are transients pretty much the only new interesting feature in this version jump? |
| 14:21 | puredanger | noprompt_: in beta1, reader conditionals won't work in the repl. with next release (beta2?) CLJ-1700 will enable that |
| 14:22 | timvisher | https://github.com/technomancy/leiningen/issues/1771 |
| 14:22 | timvisher | that's pretty much my situation exactly |
| 14:22 | puredanger | noprompt_: you can invoke the reader directly with read or read-string though |
| 14:22 | puredanger | ,(read-string {:read-cond :allow} "#?(:clj "hi" :default "there")") |
| 14:22 | clojurebot | #error{:cause "Unable to resolve symbol: hi in this context", :via [{:type clojure.lang.Compiler$CompilerException, :message "java.lang.RuntimeException: Unable to resolve symbol: hi in this context, compiling:(NO_SOURCE_PATH:0:0)", :at [clojure.lang.Compiler analyze "Compiler.java" 6543]} {:type java.lang.RuntimeException, :message "Unable to resolve symbol: hi in this context", :at [clojure.lang... |
| 14:23 | noprompt_ | puredanger: right. i was simply looking forward to interacting with it. :) |
| 14:23 | puredanger | ah, quoting bad |
| 14:23 | puredanger | ,(read-string {:read-cond :allow} "#?(:clj :hi :default :there)") |
| 14:23 | clojurebot | :hi |
| 14:24 | puredanger | sdegutis: are you talking about Clojure versions? |
| 14:24 | puredanger | if so, see: https://github.com/clojure/clojure/blob/master/changes.md |
| 14:25 | Bronsa | sdegutis: transducers not transients. also another big 1.7 feature is reader conditionals |
| 14:26 | Bronsa | ,(read-string {:read-cond :allow} "#?@(:clj [1 2])") |
| 14:26 | clojurebot | 1 |
| 14:26 | Bronsa | puredanger: ^ I have a patch for t.reader that makes that an error -- is it be reasonable? |
| 14:26 | Bronsa | puredanger: would mimick ##`~@() |
| 14:27 | Bronsa | ,`~@() |
| 14:27 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: splice not in list> |
| 14:27 | TEttinger | what on earth... |
| 14:27 | TEttinger | #?@ does what exactly? |
| 14:28 | TEttinger | trigraphs are getting a bit... much IMO |
| 14:28 | sdegutis | Bronsa: oh nice! |
| 14:28 | TEttinger | I was pretty happy when my macro macro got working with ~'~ in there |
| 14:28 | sdegutis | puredanger: yes sorry |
| 14:29 | sdegutis | Are reader conditionals the new alternative to Cljx? |
| 14:34 | sdegutis | Off topic, but the Reader Conditionals feature made me wonder if it would be worthwhile to write a Clojure compiler in Haskell using parsec that has different back-ends for emitting different bytecode (JVM, JS, CLR, YARV, etc). |
| 14:35 | sdegutis | The main downside I suppose would be that the macro-expansion runtime would need to be entirely written in Haskell. |
| 14:47 | puredanger | Bronsa: sorry, was otp |
| 14:48 | puredanger | sdegutis: see http://dev.clojure.org/display/design/Reader+Conditionals |
| 14:49 | sdegutis | Oops got disconnected again. |
| 14:50 | puredanger | Bronsa: on your question, I'm not sure that's generally correct. shouldn't 2 be available to be read next? I'm not sure we've talked about this case. |
| 14:50 | Bronsa | puredanger: with how it's currently implemented, it's impossible |
| 14:50 | sdegutis | TEttinger: #?@ is splicing, kind of like in macros. |
| 14:50 | TEttinger | ah |
| 14:50 | puredanger | sdegutis: see http://dev.clojure.org/display/design/Reader+Conditionals |
| 14:50 | sdegutis | ,#?(:clj :foo :cljs :bar) |
| 14:50 | clojurebot | #<RuntimeException java.lang.RuntimeException: Conditional read not allowed> |
| 14:51 | puredanger | it won't work in here "at the repl" until next release |
| 14:51 | puredanger | you have to invoke the reader via read-string: |
| 14:51 | puredanger | ,(read-string {:read-cond :allow} "#?(:clj :foo :cljs :bar)") |
| 14:51 | clojurebot | :foo |
| 14:52 | puredanger | in next release, what you did will work though |
| 14:52 | puredanger | reader conditionals are only allowed in .cljc files, not in .clj or .cljs |
| 14:52 | Bronsa | puredanger: to make that work we'd have to save pending-forms in the reader |
| 14:52 | puredanger | yeah |
| 14:53 | puredanger | we actually talked about an alternate implementation that would wrap the pbr and buffer forms instead of passing them around as we do now |
| 14:53 | puredanger | that's prob a cleaner impl and could probably be used to allow this |
| 14:53 | Bronsa | puredanger: which might not be possible -- read just requires a j.io.pbr |
| 14:54 | puredanger | anyhow, I can read your case above as a valid result as it currently stands |
| 14:54 | puredanger | it's probably best to file it as a CLJ ticket so we can discuss and decide there? |
| 14:55 | sdegutis | ,(read-string {:read-cond :allow} "(+ #?@(:clj [1 2 3] :cljs [4 5 6]))") |
| 14:55 | clojurebot | (+ 1 2 3) |
| 14:56 | sdegutis | /cc TEttinger |
| 14:56 | TEttinger | aaaah |
| 14:56 | TEttinger | nice |
| 14:58 | sdegutis | I'm not sure I see a point to that tbh. |
| 14:58 | puredanger | the splicing one comes in handy in ns macros to splice in different libs for clj vs cljs |
| 14:59 | sdegutis | Ooh. |
| 15:01 | sdegutis | I'm approaching Clojure web apps in a new way now, where the Clojure part is just a microservice that offers an EDN-based API, and ClojureScript handles most of the heavy lifting. |
| 15:03 | sdegutis | In this approach, Nginx serves a static HTML file for all routes that don't start with "/api/", and this static HTML file references the ClojureScript file (served via CDN), which then handles all the routing via Reagent, and pings the backend via /api/* routes. |
| 15:03 | sdegutis | But this relies heavily on features of Nginx for the sake of speed, e.g. minimal delay between client's request and server's response, and thus it's not really an isolated application. |
| 15:03 | Bronsa | ,(def a (java.io.PushbackReader. (java.io.StringReader. "#?(:clj [1 2])"))) |
| 15:04 | clojurebot | #'sandbox/a |
| 15:04 | Bronsa | ,(read a) |
| 15:04 | clojurebot | #error{:cause "Conditional read not allowed", :via [{:type java.lang.RuntimeException, :message "Conditional read not allowed", :at [clojure.lang.Util runtimeException "Util.java" 221]}], :trace [[clojure.lang.Util runtimeException "Util.java" 221] [clojure.lang.LispReader$ConditionalReader checkConditionalAllowed "LispReader.java" 1412] [clojure.lang.LispReader$ConditionalReader invoke "LispReade... |
| 15:04 | Bronsa | ,(read a) |
| 15:04 | clojurebot | (:clj [1 2]) |
| 15:04 | sdegutis | That's why I'm looking into Docker/Vagrant/etc... but I'm wondering, maybe this isn't the best way to handle this? |
| 15:04 | Bronsa | :P |
| 15:04 | pmonks | sdegutis: have you considered OSv? |
| 15:04 | pmonks | There are some Clojure examples out there (e.g. Reimmann) |
| 15:05 | pmonks | http://osv.io/ |
| 15:05 | pmonks | https://github.com/cloudius-systems/osv/wiki/Porting-Clojure-applications-to-OSv |
| 15:05 | pmonks | Note: assumes you have a hypervisor to run on (AWS or whatever). |
| 15:06 | pmonks | I also did a little Clojure webapp on Heroku a while back. That was a reasonably nice experience. |
| 15:08 | sdegutis | pmonks: thanks I'll look at that |
| 15:08 | sdegutis | Bronsa: why did that work the second time?? |
| 15:08 | lazybot | sdegutis: Uh, no. Why would you even ask? |
| 15:09 | pmonks | sdegutis: np note that OSv is still a beta, so ymmv... |
| 15:09 | pmonks | I'll admit to being a bit of a gushy fanboi about it though. ;-) |
| 15:10 | Bronsa | sdegutis: it didn't really |
| 15:11 | Bronsa | sdegutis: it returned an exception the first time and a wrong result the second time b/c only part of the input had been consumed |
| 15:12 | lemonodor | sdegutis: correct, no nginx, just an uberwar running in tomcat |
| 15:12 | sdegutis | pmonks: that is valuable information and gives me perspective on your comments, thanks |
| 15:12 | Bronsa | puredanger: maybe it should be better to consume the coll before throwing an exception in that case? |
| 15:12 | sdegutis | Bronsa: ahhhh |
| 15:12 | sdegutis | Bronsa: mutation! |
| 15:12 | sdegutis | lemonodor: sounds kind of convenient but also slow to serve static assets |
| 15:13 | lemonodor | yes, this is for an API with no real static resources |
| 15:13 | sdegutis | lemonodor: great, thanks |
| 15:39 | sveri | Hi, using clojures multimethod can I do a dispatch on either or something? maybe something like: (defmethod foo (or :varchar :char) [arg]....? |
| 15:40 | amalloy | sveri: no, but the body of a defmethod can just call some other function. or you can use namespaced keywords and derive them |
| 15:40 | tbaldrid_ | sveri: look at heirarchies: http://clojure.org/multimethods |
| 15:40 | tbaldrid_ | can possibly do what you want |
| 15:41 | sdegutis | Is a Jetty/ring app actually really slow to serve assets? |
| 15:42 | sveri | tbaldrid_: thanks, I play around with that approach |
| 16:03 | bacon1989 | sveri: what're suggesting seems like a problem I ran into |
| 16:03 | bacon1989 | I ended up using core.match with a seq |
| 16:05 | bacon1989 | Here's an example. It's a bit messy, but you can pattern match to specific sequences. In your case, you would treat the arguments as a sequence. |
| 16:05 | bacon1989 | https://github.com/benzap/baconbot/blob/master/src/baconbot/games/rpg/core.clj#L26 |
| 16:05 | bacon1989 | come to think of it, I wouldn't consider it for what you're doing |
| 16:27 | szatz | is it possible to use an instance of a record as a key in a map? when i'm trying, it's using the keys of the record as the keys for the map. |
| 16:30 | lawandand | Is there any plan to implement clojure in some lisp dialect? |
| 16:30 | puredanger | szatz: yes |
| 16:31 | puredanger | lawandand: one of Rich's early precursors of Clojure was written in CL |
| 16:31 | puredanger | http://jfli.sourceforge.net/ I think |
| 16:32 | puredanger | but there are no plans to implement Clojure as it currently stands in a Lisp platform |
| 16:32 | szatz | puredanger: aha, just figured it out. thanks for the confirmation! |
| 16:32 | lawandand | Perhaps immutability is a barrier, but racket also use a little of it |
| 16:34 | lawandand | just out of curiosity, do people use java libraries with clojure or that is not very typical |
| 16:35 | bacon1989 | lawandand: all the time |
| 16:35 | szatz | lawandand: i know that i do quite a bit. |
| 16:35 | bensu | lawandand: many useful libraries are wrappers around java |
| 16:35 | bensu | https://github.com/dakrone/clj-http |
| 16:36 | lawandand | people in common-lisp are developing their own libraries for example there are many for http, I wonder if using java is a confortable zone to stagnate |
| 16:38 | lawandand | if you have many libraries at your disposal then is seducing to create your own, except if you have the NIH syndromme |
| 16:38 | mengu | lawandand: that is the main reason of building clojure on top of jvm |
| 16:39 | mengu | seamless java integration, access to thousands of ready-made libraries |
| 16:39 | lawandand | I can understand that java integration is a good selling point, but many programmers love to do thing from scratch |
| 16:40 | lawandand | lisp heart was begin with a list and conquer the universe (poetical license taken) |
| 16:40 | amalloy | am i doing something stupid here with compojure? https://www.refheap.com/e9cf75c476b3044efa9210a8d - if i include the handler (GET "/hello" [text] nil), or indeed any GET, then all requests to my server print this error message. if i just put in (constantly (response "ok")) it works fine, so it kinda has to be something wrong with how GET is working |
| 16:41 | amalloy | and i could swear it worked yesterday. i'm thinking it looks some dependency version mismatch or something, but i haven't changed those |
| 16:42 | lawandand | I don't know about compojure, can't help, I find ruby sinatra easy for playing. |
| 16:44 | lawandand | I learned a little clojure with Mark Wolkman article, I think it was a very good way of learning the basic of clojure |
| 16:44 | patchwork | amalloy: https://github.com/caribou/polaris (routes as data, not macros) |
| 16:45 | amalloy | i am not asking what other crazy framework to switch to, i am seeing if anyone knows why this simple example is broken even though i've written a dozen compojure servers just like it |
| 16:45 | lawandand | the code for 4clojure was somewhere around to play with |
| 16:45 | amalloy | lawandand: i know, i wrote it :P |
| 16:45 | mavbozo | amalloy, route path should be "/hello/:text" ? |
| 16:46 | lawandand | Some years ago I spent a lot of time playing with 4clojure, noughty boys |
| 16:46 | Jekferro | ciao |
| 16:46 | amalloy | mavbozo: no, the way it is now it's a query-param instead of a route-param |
| 16:47 | lawandand | it is supposed that compjure is so easy to use that you don't need a lot of documentation, but I prefer to h ave a lot of docs around, just in case something doesn't work |
| 16:47 | amalloy | but it doesn't matter, i can make it (GET "/foo" [] nil) and get the same behavior |
| 16:47 | ircxy | amalloy: with a nil handler I get 404 |
| 16:48 | amalloy | yeah, i'd love to get a 404, because then stuff would be working |
| 16:48 | lawandand | amalloy: test the port is not broken |
| 16:49 | lawandand | perhaps the server is using a different port and so yoiu don't get traffic |
| 16:49 | amalloy | what would a broken port even mean? curl causes my app to print stacktraces, the server is obviously on that port |
| 16:50 | amalloy | sorry, i guess i am being kinda grumpy. you are trying to help, and i should appreciate it |
| 16:50 | lawandand | ok, so the problem is somewhere else, perhaps the stacktraces can tell something |
| 16:51 | amalloy | yes, i pasted the stacktrace awhile ago |
| 16:51 | amalloy | https://www.refheap.com/e9cf75c476b3044efa9210a8d |
| 16:52 | scottj | amalloy: sorry to pile on random suggestions, but maybe you can write a minimal request map and pass that the router or handler (sorry I haven't used compojure in a long time) |
| 16:52 | TimMc | lein clean, rm -rf ~/.m2/repository, and say three Hail Marys. :-P |
| 16:52 | amalloy | i did try lein clean, and turning off aot |
| 16:52 | amalloy | because i have run into stupid stuff like this from stale classfiles before |
| 16:53 | scottj | right now we don't see the request map that's causing that clout error |
| 16:53 | amalloy | scottj: the req map is https://www.refheap.com/877c5be44427cd2865916b384 |
| 16:53 | amalloy | which seemed pretty reasonable to me |
| 16:55 | lawandand | I can't help, don't know about compojure, the stacktraces mention someting about clojure.core/-cache-protocol-fn |
| 17:08 | TimMc | amalloy: When you figure this out you'd better tell us 'cause the suspense is killing me. |
| 17:08 | patchwork | I bet it is something dumb |
| 17:09 | amalloy | TimMc: i have bad news in that regard. it mysteriously started working and i can't figure out what i changed |
| 17:09 | TimMc | noooooo |
| 17:09 | TimMc | Something *really* dumb, like being in the wrong directory then. :-P |
| 17:09 | amalloy | no, this is all in the same swank session |
| 17:09 | TimMc | oy |
| 17:12 | mavbozo | there'a github issue with the same error https://github.com/weavejester/compojure/issues/135 |
| 17:12 | mavbozo | No implementation of method: :route-matches of protocol: #'clout.core/Route found for class: clojure.lang.PersistentArrayMap |
| 17:14 | amalloy | i wonder if it is related to aot after all |
| 17:18 | amalloy | aha. TimMc: figured it out. it is another dang issue with clojure.tools.macro/macrolet. i guess that thing is more trouble than it's worth to keep trying to use |
| 17:18 | mavbozo | what does it do? |
| 17:19 | amalloy | my route was inside of a (macrolet ... (routes (GET ...))), and the macroexpander in macrolet breaks the expansion of GET (probably replacing a record with a plain map, even though really you shouldn't be embedding record literals in code IMO) |
| 17:21 | TimMc | oof |
| 17:21 | mavbozo | but sometimes it works, sometimes it breaks. why? |
| 17:21 | TimMc | Not dumb, but not satisfying. |
| 17:21 | TimMc | I demand better bugs! |
| 17:22 | TimMc | such as this one: http://calicat.tripod.com/gif/giant.jpg |
| 17:22 | amalloy | mavbozo: because i had gotten rid of the macrolet at some point, once i commented out the actual handler that was using it, and replaced it with the dummy handler that just returns nil |
| 17:22 | wink | TIL tripod is alive |
| 17:27 | xemdetia | it's getting all that sweet geocities traffic |
| 17:27 | mavbozo | 1 more bug squashed today |
| 17:29 | pmonks | (inc wink) |
| 17:29 | lazybot | ⇒ 3 |
| 17:29 | pmonks | (inc rhymes) |
| 17:29 | lazybot | ⇒ 1 |
| 17:40 | sveri | Why does (into (sorted-map) (partition 2 [:1 2 :3 4])) not work, but (into (sorted-map) [[:1 2] [:3 4]]) works? |
| 17:41 | amalloy | because [1 2] is a vector, and (1 2) is not a vector, and maps only want to conj vectors |
| 17:41 | amalloy | but like, don't use into/partition to put stuff into a map. if you already have an interleaved vector, just (apply assoc (sorted-map) ...) |
| 17:43 | sveri | amalloy: thanks, that works :-) |
| 17:43 | amalloy | sveri: also, the keyword :1 is super duper suspicious |
| 17:43 | amalloy | you probably just want 1 as your map key, not :1 |
| 17:43 | sveri | amalloy: this was just an example to try things out in the repl |
| 17:43 | sveri | I never had a :1 in real code ;-) |
| 17:52 | calvinfroedge | I want to call an API until I hit a rate limit. My approach to this is mapping a function to an infinite range and then doseq until a condition exists. My problem with this is that there doesn't seem to be a way to break out of a doseq. Is there a better alternative? |
| 17:53 | calvinfroedge | I want to use a lazy sequence so that I only need to keep 1 item in memory at a time. My understanding of doing this recursively would be that the entire call stack would stay in memory (is that incorrect)? |
| 17:56 | amalloy | (doseq [x xs :while (keep-going x)] ...) |
| 17:56 | calvinfroedge | amalloy: Thanks! |
| 17:59 | thearthur | anyone know if you can tell leiningen to use some directory other than ~/.lein/profiles to get it's profiles (or another location for all of ~/.lein)? |
| 18:00 | amalloy | thearthur: ~/.lein is hardcoded in a number of places in lein source, it seems to me from a quick grep. so probably not |
| 18:00 | lemonodor | calvinfroedge: you could also use reduce for that, i think. use (reduced …) to break out, or just pass along information about the last attempt to the next attempt. e.g. you could do exponential backoff for a few tries, and break out after some limit is hit |
| 18:01 | amalloy | oh, no, i take it back |
| 18:01 | amalloy | thearthur: you can set the environment var LEIN_HOME |
| 18:01 | amalloy | and that's used instead of .lein |
| 18:02 | calvinfroedge | lemonodor: Definitely seems like doseq :while is much simpler, but thanks for another option = ) |
| 18:03 | thearthur | amalloy: LEIN_HOME works :) yay |
| 18:13 | kaiyin | anyone care to have a look at this? http://stackoverflow.com/questions/29661828/classcastexception-when-filtering-a-set-by-another-set |
| 18:16 | amalloy | kaiyin: you mistyped the definition of character |
| 18:16 | amalloy | should read :items, not :itmes |
| 18:16 | spieden | ya |
| 18:16 | sritchie | typo |
| 18:17 | mavbozo | kaiyin, first argument for filter must be predicate-function |
| 18:17 | amalloy | mavbozo: sets are functions, and the code is intending to pass a set there |
| 18:17 | amalloy | but because of the typo i mentioned, it's a list instead |
| 18:18 | sritchie | ,(conj nil 0) |
| 18:18 | clojurebot | (0) |
| 18:18 | mavbozo | amalloy, ah, my mistake |
| 18:18 | mavbozo | kaiyin, sorry |
| 18:19 | kaiyin | got it, thanks! |
| 18:19 | kaiyin | mavbozo: no problems at all. |
| 19:05 | zanes | Did someone integrate Herbert schemas with core.match? |
| 19:06 | zanes | Am I imagining things? |
| 19:10 | zanes | (Not quite sure what such an integration would look like.) |
| 19:23 | irctc | hello, I need help with regex + permutation |
| 19:24 | irctc | can anyone tell me how would you implement such function: (magic-func "+---++---+" "KEY") -> ["+KEY++---+" "+---++KEY+"] |
| 19:24 | irctc | clojure.string/replace-first only gets me the first item |
| 19:29 | oddcully | ,(re-seq #"\+---\+" "+---++---+") |
| 19:29 | clojurebot | ("+---+" "+---+") |
| 19:57 | timvishe_ | ,(clojure.string/replace "---" "KEY") |
| 19:58 | clojurebot | #error{:cause "Wrong number of args (2) passed to: string/replace", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (2) passed to: string/replace", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 36] [sandbox$eval25 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler eval "Compiler.j... |
| 19:58 | timvishe_ | ,(clojure.string/replace "+---++---+" "---" "KEY") |
| 19:58 | clojurebot | "+KEY++KEY+" |
| 19:58 | timvishe_ | irctc: ↑ |
| 19:58 | timvishe_ | oh. Bai Bai! ^_^ :) |
| 19:58 | timvishe_ | hmm... redundant emoji... |
| 21:34 | stephens_ | hi i was wondering if i could get some help |
| 21:34 | stephens_ | i want to hit an API from within my clojure code |
| 21:35 | stephens_ | im very new to clojure, and have come from python, and i was wondering if there was anything like the requests library in python for clojure? |
| 21:45 | mgaare_ | stephens_: look at http-kit |
| 21:49 | stephens_ | great, thanks mgaare |
| 22:12 | justin_smith | cfleming: did you see this SO question? it might be something you could help with http://stackoverflow.com/questions/29661440/intellij-double-click-to-not-treat-hyphen-as-word-separator |
| 22:12 | TEttinger | uh oh, does intelliJ use \w for word separation? |
| 22:13 | justin_smith | One would think you could override the word rules |
| 22:13 | cfleming | justin_smith: Thanks. I don't know the answer but I'll see if I can find it |
| 22:13 | TEttinger | ,(re-find #"\w+" "ÁÁÁÁaaa") |
| 22:13 | justin_smith | who know, you may need to implement the answer :) |
| 22:14 | clojurebot | "aaa" |
| 22:14 | justin_smith | *knows |
| 22:16 | cfleming | justin_smith: Yep, looks like I will. There's actually already an issue open for this I think |
| 22:17 | justin_smith | also, maybe see you at clojure/west? |
| 22:17 | cfleming | I'm counting on it! |
| 22:17 | cfleming | I'll be too jetlagged to be going to the concert you were suggesting though. |
| 22:18 | justin_smith | fair enough |
| 22:21 | cfleming | I should probably watch some set of SO tags I guess, I never check it much |
| 22:21 | justin_smith | yeah, it's an era when people are more likely to mention their software problems on twitter or stack overflow than they are to bring them up with the developers of the app |
| 22:22 | cfleming | Kids these days |
| 22:23 | cfleming | I've got to say, I hate twitter for most forms of support. I mean, it's generally pretty immediate, but for anything other than really simple queries it's a PITA |
| 22:23 | justin_smith | yeah |
| 22:25 | amalloy | @cfleming tweet longer than 140 chars :(((( |
| 22:25 | cfleming | amalloy: 1. I end up writing |
| 22:25 | cfleming | amalloy: 2. lots of answers like |
| 22:26 | cfleming | amalloy: 3. this. It drives me |
| 22:26 | cfleming | amalloy: 4. nuts. |
| 23:05 | xphillyx | Is earmuff notation accepted or generally frowned upon in Clojure? |
| 23:05 | justin_smith | xphillyx: it's expected for dynamic vars |
| 23:06 | justin_smith | ,*clojure-version* |
| 23:06 | clojurebot | {:major 1, :minor 7, :incremental 0, :qualifier "master", :interim true} |
| 23:06 | justin_smith | ,*out* |
| 23:06 | clojurebot | #object[java.io.StringWriter 0x3fcdb5a1 ""] |
| 23:06 | justin_smith | funny enough, *clojure-version* isn't even dynamic (I mean why would it be...) |
| 23:07 | xphillyx | Awesome thanks. |
| 23:07 | justin_smith | ,(apropos "^\*.*\*$") |
| 23:07 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unsupported escape character: \*> |
| 23:07 | justin_smith | ergh |
| 23:07 | justin_smith | ,(apropos #"^\*.*\*$") |
| 23:07 | clojurebot | (clojure.core/*agent* clojure.core/*allow-unresolved-vars* clojure.core/*assert* clojure.core/*clojure-version* clojure.core/*command-line-args* ...) |
| 23:07 | justin_smith | ^ fun clojure trick |
| 23:07 | xphillyx | oh thats nifty. |
| 23:08 | xphillyx | Yay regex. |
| 23:08 | justin_smith | now I'm trying to remember if there's something like apropos that also looks at doc strings |
| 23:08 | Bruce_Wayne | has anyone used [cemerick.url :refer [url-encode |
| 23:08 | Bruce_Wayne | url-decode] |
| 23:08 | justin_smith | ,(apropos "doc") |
| 23:08 | clojurebot | (clojure.core/my-doc clojure.repl/doc clojure.repl/find-doc) |
| 23:09 | justin_smith | ooooo |
| 23:09 | justin_smith | ,(find-doc "number") |
| 23:09 | clojurebot | -------------------------\nclojure.core/*print-length*\n *print-length* controls how many items of each collection the\n printer will print. If it is bound to logical false, there is no\n limit. Otherwise, it must be bound to an integer indicating the maximum\n number of items of each collection to print. If a collection contains\n more items, the printer will print items up to the limit foll... |
| 23:09 | justin_smith | that's hella useful |
| 23:09 | Bruce_Wayne | anyone able to help with url encoding? |
| 23:09 | justin_smith | Bruce_Wayne: you can go ahead and ask your specific question |
| 23:10 | Bruce_Wayne | I am trying to encode params in a url useable way |
| 23:10 | Bruce_Wayne | aka not including special symbols |
| 23:10 | Bruce_Wayne | thought I could use the [cemerick.url :refer [url-encode url-decode] library |
| 23:11 | Bruce_Wayne | but when i pass it a string it seems to not work |
| 23:11 | justin_smith | Bruce_Wayne: what does it do? I'm looking at the source and it should work |
| 23:12 | Bruce_Wayne | not sure, I’m working in a complex system and I can’t see it’s output |
| 23:12 | xphillyx | Bruce_Wayne: Have you tried the built in Java encoder? http://docs.oracle.com/javase/7/docs/api/java/net/URLEncoder.html |
| 23:12 | justin_smith | xphillyx: that's what cemerick's lib is using |
| 23:12 | justin_smith | it's a very thin wrapper |
| 23:12 | justin_smith | https://github.com/cemerick/url/blob/master/src/cemerick/url.cljx#L9 |
| 23:12 | Bruce_Wayne | interesting |
| 23:12 | xphillyx | Ah, I didn't peek into the source. |
| 23:13 | Bruce_Wayne | I’m just not sure why it won’t pass the params |
| 23:13 | justin_smith | the function is just a single interop call (well two, one for clj, one for cljs) |
| 23:13 | Bruce_Wayne | looks like it’s encoding right |
| 23:13 | Bruce_Wayne | just a problem with reading the url on the other side |
| 23:13 | justin_smith | Bruce_Wayne: url-encode is for taking a single param, and making a form that is safe to use inside a query parameter |
| 23:14 | Bruce_Wayne | will work a bit an check in with futhure questions |
| 23:14 | Bruce_Wayne | just wanted to make sure I wasn’ crazy |
| 23:14 | justin_smith | url-encode is not for building your entire query-string with - you can piece that together with & and = and your various keys |
| 23:15 | justin_smith | Bruce_Wayne: you might want to use map->query if you want it to build the whole query string though |
| 23:15 | Bruce_Wayne | thank you! |
| 23:17 | Bruce_Wayne | I am also using the reagent framework |
| 23:17 | Bruce_Wayne | but when the url is formated like this: |
| 23:17 | Bruce_Wayne | http://localhost:8020/#/users/create-vendor-rep/003i000001OKpSrAAL/Dave_0Bodet/Sysco_0TBD/enter_password |
| 23:17 | Bruce_Wayne | it works |
| 23:17 | Bruce_Wayne | but like this: |
| 23:18 | Bruce_Wayne | http://localhost:8020/#/users/create-vendor-rep/003i000001N8JsaAAF/Dennis%20Dougherty/US%20Foods/enter_password |
| 23:18 | Bruce_Wayne | it doesn’t work |
| 23:18 | Bruce_Wayne | ideas? |
| 23:18 | Bruce_Wayne | the latter url gives a not found error |
| 23:19 | justin_smith | Bruce_Wayne: that's not a query string, that is a really weird anchor |
| 23:19 | Bruce_Wayne | i am passing the params attached to the end of the url |
| 23:20 | Bruce_Wayne | and destructuring the url based on the “/" |
| 23:20 | Bruce_Wayne | I’m not building a query string |
| 23:20 | justin_smith | why not use real query syntax? |
| 23:21 | justin_smith | ,(java.net.URLEncoder/encode "/users/create-vendor-rep/003i000001N8JsaAAF/Dennis%20Dougherty/US%20Foods/enter_password") |
| 23:21 | clojurebot | "%2Fusers%2Fcreate-vendor-rep%2F003i000001N8JsaAAF%2FDennis%2520Dougherty%2FUS%2520Foods%2Fenter_password" |
| 23:22 | Bruce_Wayne | ? |
| 23:22 | Bruce_Wayne | what i sent is already the encoded url…. |
| 23:22 | justin_smith | that's what a proper encoding of that monstrosity looks like, but I still thing using real query parameters is a better idea |
| 23:22 | justin_smith | Bruce_Wayne: that's not encoded |
| 23:22 | Bruce_Wayne | the params are encoded |
| 23:22 | Bruce_Wayne | each individual param |
| 23:22 | Bruce_Wayne | the struggle isn’t with the url |
| 23:22 | justin_smith | by what encoding? it's not URLEncoding |
| 23:22 | Bruce_Wayne | it’s with the params |
| 23:22 | Bruce_Wayne | yes it is haha |
| 23:22 | Bruce_Wayne | given each param to the url encoder |
| 23:23 | Bruce_Wayne | (java.net.URLEncoder/encode “Dennis Dougherty”) |
| 23:23 | justin_smith | OK, but the fact that you are putting them together with / is what breaks it |
| 23:23 | Bruce_Wayne | why does that break it |
| 23:23 | Bruce_Wayne | and why does the first url work then? |
| 23:23 | justin_smith | because URLs have rules |
| 23:23 | Bruce_Wayne | so why does the first one work and the second one doesn’t? |
| 23:23 | xphillyx | "this isnt nam smokey, there are rules!" |
| 23:24 | justin_smith | why invent your own idiosyncratic way of specifying parameters when there is already a system defined for specifying parameters with a request? |
| 23:24 | justin_smith | Bruce_Wayne: because they are both broken and one accidentally worked |
| 23:24 | Bruce_Wayne | justin_smith: then all of them accidently work that way |
| 23:25 | xphillyx | Do you have any working URLs with spaces in the names? |
| 23:25 | Bruce_Wayne | yes |
| 23:25 | justin_smith | Bruce_Wayne: most of the time if you walk into a random street without looking both ways you won't die. Just because something didn't fail once doesn't mean you were doing it properly. |
| 23:26 | Bruce_Wayne | basically the problem was special characters in the params |
| 23:26 | Bruce_Wayne | which are being passed as extensions to the url |
| 23:26 | Bruce_Wayne | whether right or wrong |
| 23:26 | Bruce_Wayne | cars on the street or no cars on the street |
| 23:26 | justin_smith | Bruce_Wayne: why not use real query parameters and not your weird invented version? |
| 23:27 | Bruce_Wayne | because the way I did it fits in nicely with reagent framework |
| 23:27 | Bruce_Wayne | when i use these methods: |
| 23:27 | Bruce_Wayne | https://gist.github.com/jtackett/962cddfb89e0b4fe9327 |
| 23:28 | Bruce_Wayne | to take the special characters out of the params that I am passing |
| 23:28 | justin_smith | OK, you know what my opinion is. Good luck. |
| 23:29 | xphillyx | Is Joy of Clojure considered a good resource for learning idiomatic Clojure? |
| 23:29 | justin_smith | xphillyx: definitely, if you can follow it. It isn't a slow moving text. |
| 23:29 | Bruce_Wayne | oh that’s interesting, i think we have reached the limit to justin smith’s knowledge |
| 23:30 | Bruce_Wayne | if someone would be so kind as to actually explain why one url works and the other doesn’t that would be awesome |
| 23:30 | justin_smith | Bruce_Wayne: if preferring real query parameters, as defined in the http spec, to bizarre nonstandard hacks makes me ignorant, I'm proud to be stupid. |
| 23:31 | Bruce_Wayne | maybe they could actually cite some of the rules the second url breaks rather than making car references |
| 23:31 | justin_smith | Bruce_Wayne: for one, it isn't a query parameter |
| 23:31 | justin_smith | like I said, it's an http anchor |
| 23:31 | Bruce_Wayne | could you just answer my specific question which you asked me to ask |
| 23:32 | justin_smith | no, I'll just accept being stupid instead |
| 23:32 | Bruce_Wayne | so you don’t know the answer? |
| 23:34 | Bruce_Wayne | also just because I am doing something different than the http spec protocol doesn’t make it wrong |
| 23:34 | Bruce_Wayne | Job’s built a personal computer that was completely against the protocol…didn’t make him wrong either |
| 23:35 | xphillyx | … what? |
| 23:35 | justin_smith | you are using the string as part of a http request string - as an achor tag in the URI. This means that you need to follow the rules for URIs. If you use query parameters properly, this problem can easily be avoided. |
| 23:35 | justin_smith | and I'm being grumpy and unhelpful, which means I need a break. See you all later, sorry. |
| 23:46 | justin_smith | Bruce_Wayne: OK, everything following # in a URL is called a "fragment identifier", they are meant to look up named anchors within a page. This SO answer describes the valid characters in a fragment identifier: http://stackoverflow.com/a/2849800/2258453 |
| 23:47 | Bruce_Wayne | awesome |
| 23:47 | Bruce_Wayne | thank you for the straight answer |
| 23:48 | justin_smith | in particular, a "?" is going to introduce the end of a fragment, and everything after it will be treated as query params |
| 23:49 | justin_smith | http://tools.ietf.org/html/rfc3986#section-3.5 "The characters slash ("/") and question mark ("?") are allowed to represent data within the fragment identifier. Beware that some older, erroneous implementations may not handle this data correctly when it is used as the base URI for relative references (Section 5.1)." |
| 23:50 | Bruce_Wayne | so maybe a % sign isn’t allowed either? |
| 23:51 | justin_smith | it's allowed as part of an escape string |
| 23:51 | justin_smith | %dd where d are digits |
| 23:51 | justin_smith | *hex |
| 23:51 | Guest76337 | (+ 1 1) |
| 23:51 | clojurebot | 2 |
| 23:52 | TEttinger | huh, clojurebot normally needs , before it can eval |
| 23:52 | TEttinger | (+ 1 2 3) |
| 23:52 | clojurebot | *suffusion of yellow* |
| 23:52 | justin_smith | TEttinger: it's a special case :) |
| 23:53 | justin_smith | (#'+ Double/NaN Double/NaN) |
| 23:54 | TEttinger | ,(== Double/NaN Double/NaN) |
| 23:54 | clojurebot | false |
| 23:55 | Guest76337 | batman, are you building a REST api? |
| 23:55 | TEttinger | ,(let [nana Double/NaN] (== nana nana)) |
| 23:55 | clojurebot | false |
| 23:55 | TEttinger | ,(let [nana Double/NaN] (= nana nana)) |
| 23:55 | clojurebot | false |
| 23:55 | arrdem | nans are never equal yo |
| 23:55 | TEttinger | ,(let [nana (identity Double/NaN)] (= nana nana)) |
| 23:55 | clojurebot | true |
| 23:55 | arrdem | ##(* -1 Double/NaN) |
| 23:55 | lazybot | ⇒ NaN |
| 23:56 | TEttinger | arrdem, you sure about that? |
| 23:56 | TEttinger | ,(let [nana (identity Double/NaN)] [ (= nana nana) (== nana nana)]) |
| 23:56 | clojurebot | [true false] |
| 23:57 | arrdem | that's awful but I feel like we've been over this before |
| 23:57 | TEttinger | object identity will make two NaNs returned by the same call equal, even if they are numerically non-equal |
| 23:57 | TEttinger | yep |
| 23:57 | TEttinger | I hadn't checked for == before |
| 23:58 | TEttinger | NaN is like the worst corner case possible wherever it shows up |