#clojure logs

2016-01-10

04:43arrdemIs it just me or has nobody written a Clojure IRC server?
05:27domgetterSo I don't have to rlwrap when I do lein repl, but I *do* have to rlwrap when I do lein figwheel
05:27domgetterwhat should I look into to change figwheel so that I don't need rlwrap with it? Surely it's possible since lein repl doesn't need it?
05:33ridcully_the lein repl uses some faux readline library from the java universe
05:35ridcully_yet if you prefer the jline over the readline (i don't) iirc there should be bit about starting figwheel from the repl in the wiki over there
05:47blt␐/exit
05:54t0byblt just invented IRC russian roulette, it seems.
07:59m1dnight_Can I uset jvm-opts in developer mode and deply mode? Ive been looking at some project.clj files but I can't find one.
07:59m1dnight_Or even better, put it in an external file so I don't have to ignore my project.clj file when I push.
08:00kwladykam1dnight_ https://github.com/kwladyka/chess-challenge/blob/master/project.clj
08:00m1dnight_The hting is, I have set the path for configuration files as a jvm option. When I run it on my server I had to change my project.clj file.
08:00m1dnight_kwladyka: YEs that is what I have now. But it would be great if I could set it up differently for developing and for deploying.
08:01kwladykam1dnight_ use :profiles
08:11m1dnight_,(inc kwladyka)
08:11m1dnight_that worked, thanks
08:11clojurebot#error {\n :cause "Unable to resolve symbol: kwladyka in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: kwladyka in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: kwladyk...
08:11m1dnight_(inc kwladyka)
08:11kwladykam1dnight_ happy to hear that :)
09:22m1dnight_If somebody is looking for a project to help form time to time, I could use a second opinion on my irc/slack bot. I feel Im making a mess of things :p
09:38jonathanjwhy do you think that?
09:43m1dnight_Well, the thing is getting very big and I think I might be missing some proper design patterns here and there.
09:47jonathanjthose are kind of broad reasons
09:55m1dnight_Well sure. But I think you learn more/faster if you work together. Different people have different views.
10:02jonathanjwell, what's the current implementation look like?
10:05m1dnight_https://github.com/m1dnight/clojbot/tree/slack_connector
10:05m1dnight_This is where Im currently at. I just added a slack connection so the bot can do irc and slack.
10:06m1dnight_(disclaimer: the readme hasnt been updated to reflect this)
10:24jonathanj(doall (map #(f x) xs)) seems like longhand for something
10:24jonathanjmaybe (doseq [x xs] (f x))
10:24MJB47x isnt from xs there
10:24MJB47otherwise it would be %
10:25MJB47but i think the doall is unecessary
10:25MJB47if you dont want the lazyness (which there you dont)
10:25MJB47then mapv might be the function
10:25jonathanjsorry, i meant % not x
10:25MJB47thgouh i think map is the wrong thing
10:25jonathanji find using map for side-effects gives me a weird feeling
10:25MJB47yer
10:25MJB47i think maybe dotimes might be better?
10:26novak`if I have (defn onetwo [& {:keys [one two]}] (print "one: " one ", two: " two)) is it possible to call it with something like (onetwo {:one 1 :two 2})?
10:26MJB47remove the &
10:27MJB47i actually have no idea how [& {:keys [one two]}] works (or if its meant to)
10:27MJB47but yer, anything after & is put into a list
10:27MJB47so you input to that function would look like ({:one 1 :two 2})
10:28MJB47which is not what you want by the looks of things
10:28jonathanjthat's not actually true
10:28MJB47oh?
10:28jonathanj& {...} lets you write stuff like (f :a 1 :b 2)
10:28jonathanjbut apparently that style is frowned upon because it's difficult to compose and it's a little bit funky
10:28MJB47ohrly? thats pretty sick
10:29MJB47it does seem rather implicit
10:29MJB47i would have just assumed it was undefined behaviour
10:29jonathanj,((fn [& {:keys [a b]}] (vector a b)) :a 1 :b 2 :c 'nope)
10:29clojurebot[1 2]
10:30MJB47interesting
10:30MJB47the more you know :)
10:30jonathanj,(let [{a :a} '(:a 2)] a)
10:30clojurebot2
10:31novak`jonathanj: Yup, but ,((fn [& {:keys [a b]}] (vector a b)) {:a 1 :b 2 :c 'nope})
10:31jonathanjso for whatever reason you can destructure a seq of pairs as a map
10:32jonathanjnovak`: then just lose the & like MJB47 said
10:32jonathanj,((fn [{:keys [a b]] (vector a b)) {:a 1 :b 2 :c 'nope})
10:32clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
10:32jonathanj,((fn [{:keys [a b]}] (vector a b)) {:a 1 :b 2 :c 'nope})
10:32clojurebot[1 2]
10:32novak`So, answer to my question is: No?
10:32jonathanjyou can't use & to do both
10:33jonathanjit doesn't really make sense, if you think about it
10:33novak`jonathanj: OK, thanks!
10:44m1dnight_Am I correct in assuming that I can create an uberjar locally and run it om y server?
10:44m1dnight_Compiling on my server really takes 5 minutes or so. Locally only a few seconds.
10:46kwladykam1dnight_ yes, uberjar is standalone ver. with everything compiled in
10:47novak`jonathanj: wait, it might have sense, I saw it in cemerick's nrepl server https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/server.clj#L121
12:56elika1(+ 1 2 3 4)
12:56clojurebot*suffusion of yellow*
12:56elika1(+ 1 2)
12:56clojurebot3
12:56elika1(+ 1 2 4)
12:56clojurebot*suffusion of yellow*
12:56elika1(+ 1 2 1)
12:56clojurebot4
12:56elika1(+ 1 2 0 0 0 )
12:56clojurebot3
12:56elika1(+ 1 1 1 1 0 0 0 )
12:56clojurebot4
12:56elika1(+ 1 1 1 1 0 0 0 1)
12:56clojurebot*suffusion of yellow*
12:56elika1(+ 1 1 1 1 0 0 0 190)
12:56clojurebot*suffusion of yellow*
13:02ridcully_everyday with this bot... everyday something new, that makes me crack up
13:52favetelinguis,(* 60 60 60 3)
13:52clojurebot648000
14:00jonathanjis there a public web repl?
14:00jonathanj`lein repl` takes forever, especially when i just want to play with a function or check something
14:00MJB47i use http://clojurescript.net/ for clojurescript
14:00gfredericksI have a long-running emacs with a long-running repl that I can switch to easily
14:01devsdajonathanj: you could try http://www.tryclj.com/
14:03ridcully_also `java -cp ~/.m2/repository/org/clojure/clojure/1.7.0/clojure-1.7.0.jar clojure.main` starts quite fast
14:04jonathanjgfredericks: that *usually* works for me, but sometimes i'm not actually at my own computer when i want to do this
14:04jonathanj(also ridcully_)
14:04clojurebotGabh mo leithscéal?
14:04jonathanjdevsda: thanks, that seems sufficient
14:05jonathanjit would be nice if had modern editor features (like just paren matching) but i guess i'll be happy with what i can get :)
14:08ridcully_ssh home? no?
14:08ArkerHi everyone. I am new to the clojure community and wish to contribute to the project. I was wondering where to start and will be grateful for your opinions.
14:16justin_smithArker: clojure is very conservative about the code it accepts, and submissions are accepted on the clojure jira
14:17justin_smithhttp://dev.clojure.org/jira/browse/CLJ
14:22Arkerjustin_smith: Hi. I wish to start by contributing to the project by choosing a bug or enhancement request from the issue tracker list.
14:24ArkerLater on I also wish to work on some projects bigger projects like the ones listed under GSoC
15:12justin_smithit's very nice that Arker wants to contribute, but I warned them.
15:18favetelinguisim not sure what the difference is between put! >! and >!! in core.async, i do understand where >! >!! is different but put! was new to me
15:19favetelinguisthe only usecase i have seens is using put! instaed of (go (>! ch c))
15:21justin_smithfavetelinguis: put! takes an optional callback, and is async without being inside a go block. >!! is blocking. >! is async, but only inside a go block.
15:23favetelinguisso put! is sort of an implicit go block wrapper?
15:24justin_smithkind of, except for the whole callback thing, and it optionally runs the callback on the caller's thread instead of its own
15:31visofhi guys
15:31MJB47sup
15:33visofi have csv files, file1 has 3 fields and file2 has 4 fields, from file1 i want to get first and second fields and from file2 want to get second and third fields, how can write a generic method which do this transparentely?
15:33visof,(clojure.string/split "a,b,c" #",")
15:34clojurebot["a" "b" "c"]
15:34gfredericks,(subvec ["a" "b" "c"] 0 2)
15:34clojurebot["a" "b"]
15:34MJB47i would use https://github.com/davidsantiago/clojure-csv
15:34justin_smithvisof: there are csv libraries that handle the quoting and such
15:34justin_smithyeah
15:34MJB47and then use normal vector functions
15:35visof,(let [[a b c] (clojure.string/split "a,b,c" #",")] [a b])
15:35clojurebot["a" "b"]
15:35visof,(let [[a b c] (clojure.string/split "d,a,b,c" #",")] [a b])
15:35clojurebot["d" "a"]
15:35visofi want to get ["a" "b"]
15:35visoffor both cases
15:35ErhardtMundthey there
15:35visof,(let [[_ a b c] (clojure.string/split "d,a,b,c" #",")] [a b])
15:35clojurebot["a" "b"]
15:36visofi want the code which take "d,a,b,c" or "a,b,c" and get only ["a" "b"]
15:36visoffor both cases
15:36MJB47are ab the same value in both cases?
15:37ErhardtMundtI'm new to clojure, I was playing around with compojure and stuff and I wondered if there's any best practice about stylesheet other than having DSL sources (the hiccup way)
15:37ErhardtMundtI'd like to go the enlive way
15:37visofMJB47: not necessary, i mean i need a method which take csv line with 3 or 4 fields and return ]
15:37visofreturn
15:37ErhardtMundt(having html and css stuff being independent from the code)
15:37justin_smith,(map (comp (partial take 2) (partial take-last 3)) '[[a b c] [wrong a b c]])
15:37clojurebot((a b) (a b))
15:38MJB47then i dont think you can do it with a single arity function (without doing something like (if (= 4 (count ...)
15:38MJB47or justin smith just proves me wrong
15:38justin_smithMJB47: the above does it ^
15:38MJB47again
15:38MJB47either way
15:40visofjustin_smith: thanks
17:57visofhi guys
17:58visofif i have list of hashes [{:x 10 :y "a"} {:x 1 :y "b"} {:x 8 :y "a"}], how can i take one of hashes of unique y with higher :x
17:59visofso i take {:x 10 :y "a"} {:x 1 :y "b"}
18:01gfredericks(defn unique-y-with-higher-x [hashes] (->> hashes (group-by :y) (vals) (map (fn [more-hashes] (apply max-key :x more-hashes)))))
18:01gfredericks,(defn unique-y-with-higher-x [hashes] (->> hashes (group-by :y) (vals) (map (fn [more-hashes] (apply max-key :x more-hashes)))))
18:01clojurebot#'sandbox/unique-y-with-higher-x
18:01gfredericks,(unique-y-with-higher-x [{:x 10 :y "a"} {:x 1 :y "b"} {:x 8 :y "a"}])
18:01clojurebot({:x 10, :y "a"} {:x 1, :y "b"})
18:01MJB47that was fast o.0
18:01visofthanks gfredericks
18:03domgettermmmm, those top-shelf functions
18:03MJB47it literally took you longer to write that /me than the function
19:07neoncontrailsWhat sort of network issues could be symptomatic of lein not finding a "luminus-nrepl" artifact when trying to boot a fresh cljs template?
19:08neoncontrailsI know it's not a typo in dependencies. I just ran lein new luminus with +cljs +http-kit and +site flags
19:12neoncontrailsEh. I'll see if rebooting helps
21:05elvis4526Hi - is there a way to see all channels subscribed to a pub ?
21:57muraikiis anyone using bouncer for validation? if so, do you have a recommendation for handling the use case of an html form with numeric inputs failing to validate as number because they are java strings?
22:15neoncontrailsIs it safe to delete "luminus-nrepl" from maven's local cache? I suspect it might have saved some bindings to project that doesn't exist anymore
22:16justin_smithneoncontrails: it should be safe to delete anything from the cache that you did not install by hand
22:25neoncontrailsHmm. That wasn't it. Is it possible a luminus project I deleted earlier had some of its settings cached to maven?
22:25neoncontrailsParticularly nrepl-related settings?
22:25justin_smithmaven doesn't hold settings
22:25justin_smithit holds jars
22:25justin_smithI mean I guess you can use a jar to hold some settings files but I don't know of anyone that does that.
22:26justin_smithalso, the jars are immutable - every time you get a specific version, you will get the same jar
22:26neoncontrailsGotcha. I was able to run luminus projects earlier, but now lein is having dependency issues
22:26justin_smithneoncontrails: what's the specific error you are getting?
22:27justin_smithneoncontrails: have you changed your .lein/profiles.clj since then?
22:27neoncontrails"Could not find artifact luminus-nrepl:luminus-nrepl:jar:0.1.2 in central (https://repo1.maven.org/maven2/) ... This could be due to a typo in :dependencies or network issues."
22:27justin_smithdid you make a new "lein new" that might have looked at a new template version?
22:28neoncontrailsjustin_smith: uh I'm not sure I understand your question, did I create two instances of the same luminus template you mean?
22:29justin_smithneoncontrails: was it a previously working project that stopped working, or a new luminus project that doesn't work?
22:29neoncontrailsnew luminus project that doesn't work.
22:30justin_smiththe most recent version of luminus-nrepl is 0.1.1, so yeah it won't find 0.1.2 anywhere
22:30justin_smiththat's not because of lein - the jar isn't up there
22:30justin_smithhttps://clojars.org/luminus-nrepl
22:30neoncontrailsjustin_smith: good catch. Let me fix the template
22:31justin_smithneoncontrails: if you clone this and run lein install, that will make the not-yet-available 0.1.2 available on your local system https://github.com/luminus-framework/luminus-nrepl
22:31justin_smithand maybe someone should tell them they broke their template by relying on an artifact they did not deploy
22:32justin_smithwhich is funny, because 0.1.1 was just deployed today for the first time
22:33neoncontrailsjustin_smith: you are a savior. Thank you, I was stuck on this for hours
22:34justin_smithneoncontrails: do you see how the nature of the problem was right there in the error?
22:34justin_smithneoncontrails: and np, any time
22:35neoncontrailsIt makes sense, yeah. What threw me is, I didn't get this error last night
22:36neoncontrailsSo I was working under the assumption I must have augmented my local environment in some way. Bad assumption, of course
22:37justin_smithand the fact that "lein new" templates are not immutable or versioned, so every time you use lein new you get random crap!
22:37justin_smith(this breaks a lot of tutorials too)
22:38justin_smithand this sucks because it's people who are newest to the language that are likely to be following a tutorial, and they are likely to judge the whole language by the fact that the tutorial no longer works because the template has mutated
22:39justin_smithversioned templates is my feature vote for lein 3
22:39neoncontrailsHear, hear. I'll create a new issue right now
22:42BRODUSis @ only used for derefing?
22:43BRODUSi'm looking for a char that clojure doesn't have any special meaning
22:43BRODUSfor
22:47gfredericks! $ & *
22:47gfredericks?
22:47gfredericks- _
22:48gfredericks<>
22:48gfredericks|
22:48gfredericksmost of those mostly don't have a special meaning
22:48gfrederickseven % is usually usable
22:48justin_smith☃ is the best char, and it has no meaning in clojure
22:48BRODUShahaha
22:49gfredericksI didn't even mention + or =
22:49justin_smith,(defn ☃ [f & args] (apply f (shuffle args)))
22:49BRODUSid like to use dollar but thats used to access nested classes
22:49clojurebot#'sandbox/☃
22:49justin_smithBRODUS: no, it's just part of the name
22:49gfredericksBRODUS: use it for what?
22:49justin_smithit's not an operator
22:50justin_smith,(☃ / 1 2 3 4)
22:50clojurebot1/24
22:50justin_smith,(☃ / 1 2 3 4)
22:50clojurebot3/8
22:50justin_smith,(☃ / 1 2 3 4)
22:50clojurebot1/24
22:50gfredericks,(☃ / 0 1 2 3 4)
22:50clojurebot#error {\n :cause "Divide by zero"\n :via\n [{:type java.lang.ArithmeticException\n :message "Divide by zero"\n :at [clojure.lang.Numbers divide "Numbers.java" 158]}]\n :trace\n [[clojure.lang.Numbers divide "Numbers.java" 158]\n [clojure.core$_SLASH_ invokeStatic "core.clj" 1007]\n [clojure.core$_SLASH_ invoke "core.clj" 1000]\n [clojure.lang.ArrayChunk reduce "ArrayChunk.java" 63]\n [clo...
22:50BRODUSim building a helm extension thats lets you apply transformations to data
22:51BRODUSfor a clojure evaluation context i want to find a symbol that users can use to acess arguments of the data
22:51BRODUS$ for the whole argument, $0 $1 .. $N for elements within if applicable
22:53justin_smithBRODUS: that's very much like *1 *2 *3 etc. in the repl
22:54BRODUSi haven't seen that before
22:54gfredericksjustin_smith: that "etc" was pretty misleading
22:54justin_smithBRODUS: in the repl, *1 is the last result, *2 is the one before that
22:54justin_smithgfredericks: :)
22:56TimMc(def *4 *3)
22:56gfredericksha
22:56TimMc(that might be the shortest joke I've told)
22:57gfrederickswould be fun if clojure added a new *N with every release
22:57TimMc:-D
22:57BRODUSah cool. I would want the symbol to be used against the current item being transformed, so if you're transforming [1 2 3] then (list %0 %1 %2 %) would return (1 2 3 [1 2 3])
22:58justin_smithso this is for a dsl that has to be compatible with clojure, and used inside helm?
23:00BRODUSa very small dsl but yeah, i think I just need a symbols for element access
23:01TEttingerwell you can't redefine '@', '#', or any other reader macro
23:01justin_smith,(apply #(list %1 %2 %3 %&] [1 2 3]) ; BRODUS - not far from what you are doing...
23:01clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
23:01justin_smith,(apply #(list %1 %2 %3 %&) [1 2 3])
23:01clojurebot(1 2 3 nil)
23:02justin_smithoh, right
23:02justin_smith%& won't work there
23:03BRODUSusing snowman or something is a good idea since that can be bound to a shortcut in emacs