#clojure logs

2014-07-07

00:46FarLightWhat is the name of the bracing style that the clojure source code employs?
00:53_atoFarLight: EDN? https://github.com/edn-format/edn
00:56_atoor "S-expressions"? (although that term usually refers to the more traditional simpler lisp syntax that only has lists)
00:56FarLightI meant the java code for clojure _ato
00:57bbloomFarLight: "something weird, then something weirder caused by an intellij fuck up"
00:57bbloomFarLight: but i believe the that weird thing is (was): https://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style
00:57FarLightYeah I am looking at it now but it appears to be changed
00:58bbloomFarLight: as i said, there was an intellij mishap
00:59bbloomwhy it hasn't been auto-reformatted, i don't know... i assume b/c people have patches they depend on & it would be a pain to rebase them all
00:59FarLightSo Hickey didnt actually write it that way to begin with
00:59FarLightIs that his name?
00:59FarLightHicky?
00:59bbloomwith the e
00:59bbloomhe wrote it in whitehead style, as far as i know
01:00FarLightInteresting
01:00bbloomer whitesmith rather
01:15ybit3any idea what's going on here?
01:15ybit3https://gist.githubusercontent.com/heath/b336e361a0550f05fb91/raw/92e7f30246f6382db260c556a267117b9257a066/gistfile1.txt
01:17ybit3~"""javascript file found on classpath for library cljs.nodejs but does not contain a corresponding goo.provide"""
01:17clojurebotPardon?
01:19ybit3a company is willing to let me writie clojurescript for node.js :) so i'm learning in my spare time
01:34ivanybit3: maybe this works better with lein-cljsbuild and :target :nodejs?
01:38ybit3ivan: hm, i guess, i was was using what's on the clojurescript wiki
01:38ybit3i'll try that tomorrow
01:38ybit3thanks
05:25gfixleris there a way in clojure to do straight search/replace, sans regexes?
05:26gfixler(replace "string" #"find" "replace") is great if you have a regex, but I have complex finds with ?s and things in them
05:26gfixlerI just literally want to replace whatever my find term is
05:27gfixlerOh, looks like I can just use the string, and not wrap it in #"this"
05:27gfixlerhooray
05:27Viesti:)
05:28gfixlertoo simple; so boring :)
06:12brackiDoes anybody know how to calm down Jetty when enabling logging via clojure.tools.logging, slf4j and logback?
06:21brackiOr how do I even log? What's a sane configuration?
07:14runnerciau xD
07:14runnerciao
07:14runner!list
07:42neena.
08:11perplexahm (nthnext seq 1) vs (rest seq)
08:11perplexawhich is prefered to drop the 1st element of seq? ;p
08:13mnngfltgperplexa, if in doubt, take the shorter one? :)
08:13perplexai did ;p
08:13perplexajust wondering :)
08:13mnngfltgperplexa, also compare (next) and (rest)
08:14perplexadamnit. another one :|
08:14pyrtsaUse (next xs) if you want nil to indicate an empty tail, otherwise (rest xs).
08:15perplexatail is never empty :)
08:16perplexai'm ust returning the result of a re-find, but don't want the whole string to be at #0
08:16perplexai think i'm gonna stick with rest
08:18pyrtsaperplexa: Heh, then you should know there's also (subvec xs 1) that you can use for vectors (to keep the result as a vector).
08:38perplexapyrtsa: thx
09:26rurumatehow to do http request in clojurescript? what's the most awesome way? just goog XhrIo or is there something more convenient / standard yet?
09:27teslanickI use the raw DOM api with (doto)
09:27rurumatebecause I don't like CamelCase
09:28rurumateand XhrIo doesn't return a channel. bummer
09:29broquaintrurumate: cljs-http or cljs-ajax perhaps?
09:29rurumatethanks, I wasn't aware of cljs-ajax
09:30Glenjaminthe general advice is to not treat the network like a channel
09:30Glenjaminbut instead to have the network code feed messages to/from a channel
09:38rurumateGlenjamin: huh?
09:38rurumateare you telling me not to use cljs-ajax?
09:38Glenjamini know nothing about cljs-ajax
09:39rurumateyou telling me to use a callback and put it in XhrIo directly, no channels attached?
09:40Glenjamini'm saying a core.async channel and a network socket should be treated differently
09:40Glenjaminit looks like cljs-ajax does that
09:41rurumatehum hum
09:41rurumateI just want to avoid callbacks that's all
09:41benzap`question for you guys, I want to implement something that resembles (defn, but I want to automatically be passing in the parameter. This means I can't gensym, but I still need some form of local scope for the paramter
09:41benzap`i can't seem to figure out how to do that
09:41rurumatecallbacks in the toplevel code that is, of course they are still there somewhere below
09:42rurumatebenzap`: something like #() ?
09:42Glenjaminthe general advice i've seen is when apis expose callbacks, your callback should just put! a value onto a channel
09:42marpstarGlenjamin is right, rurumate, your XhrIo should put! a message onto a channel
09:42rurumateyes that's what I want to do,
09:42benzap`rurumate: that generates a symbol, how would I reference it inside of the macro?
09:42rurumate just I don't want to write that code all over again in each project, I want it in a library
09:42benzap`I mean, outside of the macro
09:43gfredericksbenzap`: this is called anaphoric macros
09:43gfredericksusually discouraged
09:43rurumateput!, not >! ?
09:43gfredericks,(defmacro while-x-is-42 [expr] `(let [~'x 42] ~expr))
09:43clojurebot#'sandbox/while-x-is-42
09:43benzap`gfredericks: I see, maybe I need to rethink this then
09:44gfredericks,(while-x-is-42 (inc x))
09:44clojurebot43
09:44marpstaractually, I used >!
09:44gfredericksbenzap`: yeah maybe try describing what you're doing at a higher level?
09:44marpstarrurumate: http://pastebin.com/5HuUBRX3
09:44marpstarassumes xhr is XhrIo
09:45benzap`gfredericks: well, what i'm trying to do is make a macro called defservice, which takes the form (defservice name-of-service {parameters, like polling interval, etc} ~@body (which takes a msg object, containing service data)
09:45marpstarthat's how I call up to my server, get a JSON response, convert it into a cljs hash map with keywords for keys
09:45benzap`so it would be like (defservice poll-test {} (println msg))
09:46marpstarand publish it to a channel
09:46benzap`honestly, i'm just trying to introduce some more syntactic sugar
09:47benzap`I want to smooth over some things for newcomers
09:47benzap`I could just forget about using ~@body, and just pass in a function
09:49gfredericksbenzap`: you might look at how compojure's routing macros provide sugar without using anaphora
09:50benzap`gfredericks: alrighty
09:51gfredericksbenzap`: it does seem easier when there's just one instance of anaphora and you're actively thinking about how it works, but in general it makes it a lot harder to look at code and see what things are referring to
09:52brackiHow do I force a form into a string?
09:52brackiI want to convert a map to a JSON string.
09:52benzap`gfredericks: agreed, to be honest, I could probably do most of what I want without macros
09:58benzap`looks like compojure is passing down the routing information to handlers to construct whatever routing requests it needs
09:58benzap`I don't understand why some things are made into macros
10:00teslanickbracki: In clojure or clojurescript?
10:07rurumatemarpstar: brilliant, thanks
10:41brackiteslanick: Got it working
10:41brackiin Clojure
10:41brackiOnce more, does anybody know what I have to do to Jetty to shut it up? I'm using ring and slf4j.
10:41teslanickI was going to say -- in Clojure you'll need a JSON serializer, but in JS you can usually just use js/JSON.stringify
11:01ddellacostabracki: did you figure out your logging issue? This may help: https://github.com/malcolmsparks/clj-logging-config
11:01ddellacostabracki: alternatively, just configure it via XML
11:19rurumatewhat's the difference between alt! and alts! ?
11:22tbaldrid_rurumate: alt! is like alts! + case
11:23tbaldridgearrdem: have you seen this one yet? (let [[& {:as opts] [1 2 3 4 5 6]] opts)
11:23tbaldridge, (let [[& {:as opts] [1 2 3 4 5 6]] opts)
11:23clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>
11:23tbaldridge, (let [[& {:as opts} [1 2 3 4 5 6]] opts)
11:23clojurebot#<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )>
11:23Bronsa,(let [[& {:as opts}] [1 2 3 4]] opts)
11:23clojurebot{1 2, 3 4}
11:23tbaldridgebleh this is easier as a defn
11:23tbaldridgethere we go! :-)
11:26arrdemtbaldridge: hum.... no I don't think I've seen that one before either
11:27tbaldridgeit's basically the same as something like (fn [& opts] (apply hash-map opts))
11:27tbaldridgebut I hadn't seen it either until Rich used it in part of core.async
11:28arrdemyeah I may have seen that once or twice for exactly that reason but AFAIK I've never used that trick.
11:28Bronsawell that's the same as doing (defn x [& {:keys [..]}]) ..
11:28arrdemsure
11:30rurumatetbaldridge: thanks, I see there are not clauses in alts!. alt! is a lot easier on the eye in many cases
11:32benzap`was wondering, is there a way to easily generate a symbol when (defn a function? i'm currently doing something like this http://stackoverflow.com/questions/2486752/in-clojure-how-to-define-a-variable-named-by-a-string
11:32benzap`but I can't seem to store (symbol x) in a (let cloause
11:34benzap`ugh, I feel like i'm breaking the law, the way i'm doing this
11:34benzap`it's almost like an object-oriented approach, that doesn't quite cut it
11:35benzap`I just want a service, that I can stop, start, setup scheduling
11:35cbpbenzap`: what exactly are you doing and why?
11:36benzap`I want to add services to a list, and I was going to add in optional arguments to setup scheduling
11:36benzap`using overtone.at-at
11:36benzap`so I need to generate functions that will handle the scheduling as well, which consists of a schedule pool, and 'stop-functions'
11:37benzap`it requires me to store state on these services based on what types of scheduling I introduce on the service
11:37teslanickbenzap`: Have you seen http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded
11:39benzap`the problem isn't my workflow, i'm writing something which I can use to extend my service-pool
11:40benzap`ugh
11:42benzap`i feel like my brain is going to explode, I just think about everything in terms of OOP
11:43JaoodFP is fud
11:44yogsotothHi! Could someone help me. I have a lazy-seq of strings and I want to produce an array of string out of it.
11:44arrdemJaood: naw man it's blub
11:44yogsotothI tried (into [] myseq) without success.
11:45jonasenyogsototh: do you need a Java array?
11:45cbpyogsototh: that makes a clojure vector. Is that the problem?
11:45yogsotothI don't know, in the end I want to make a JSON out of it.
11:46cbpyogsototh: can you show your code + stacktrace?
11:46teslanickIf it needs to be a Java array, you can do (into-array lazy-seq)
11:46cbp~refheap
11:46clojurebothttps://www.refheap.com/
11:46Jaoodarrdem: what's blub?
11:47arrdemJaood: http://en.wikipedia.org/wiki/Paul_Graham_%28computer_programmer%29#Blub
11:47jonasenyogsototh: You won't need a java array for outputting JSON. I don't think you need to convert the lazy seq at all
11:47yogsotothI use storm, the stacktrace is not very relevant.
11:48yogsotothI showed the type and I got: clojure.lang.LazySeq
11:48yogsotothbut if I try to print it, it simply fail
11:49yogsotothhere is my error log http://pastebin.com/piZbtd0S
11:49yogsotothand the code http://pastebin.com/YKkDuU88
11:56cbpsorry yogsototh I am unfamiliar with storm
11:57yogsotothcbp: in this case I don't think this is a storm related problem. I have a LazySeq but I don't even know how to print it!
11:58cbpyou just print it
11:58cbp,(print (range 10))
11:58clojurebot(0 1 2 3 4 ...)
12:01yogsotothI tried print and it didn't worked
12:01yogsotothIt tried (realized? tokens) and it returned false
12:01cbpwhat did print do?
12:02yogsotothapparently nothing happened
12:02AeroNotixyogsototh: doall
12:03yogsototh(doall print tokens) fail dramatically...
12:03AeroNotixjesus
12:03AeroNotix(print (doall tokens))
12:03yogsotothI even tried (take 1 tokens)
12:03AeroNotixobv
12:04yogsototh(print (doall tokens)) failed the same way...
12:04AeroNotixIn what way?
12:04yogsotothI get a NullPointerException
12:05AeroNotixis tokens nil?
12:05yogsotothno tokens isn't nil
12:05dbaschyogsototh: it's possible that your lazy sequence has things that cause NPE upon realization
12:06AeroNotixindeed
12:06yogsotothMaybe I use a quite old lirbary
12:06yogsotothhttps://github.com/eandrejko/clj-tokenizer
12:06dbasche.g.
12:06dbasch,(def a (map #(/ 1 %) (repeat 0)))
12:06clojurebot#'sandbox/a
12:07dbasch(first a)
12:07dbasch,(first a)
12:07clojurebot#<ArithmeticException java.lang.ArithmeticException: Divide by zero>
12:07dbaschit's a different exception but you get the idea
12:07yogsotothYou are completely right!
12:07yogsotothThanks!
12:27anykeyis there a chief web framework for Clojure like Grails for Groovy?
12:29TimMcCompojure, I guess?
12:30TimMcMight not be as framework-y as you want. :-P
12:39arrdemBronsa: https://www.refheap.com/87936
12:40arrdemBronsa: pedantic, but big for someone trying to understand what the class structure is
12:40vermain repl, how do I reload a file if I initially loaded it with (load "test/file")
12:41arrdemverma: load doesn't do any caching AFAIK, it's imperative. just call load again.
12:41vermaarrdem, if I do a (in-ns) after the load it cannot find the file anymore
12:42vermaarrdem, but you're right just doing (load "") again doesn't report any problems, only that when I do (in-ns) it blows
12:42vermaarrdem, nice, I can do (in-ns 'user) and it throws be out and then I can reload
12:43vermaarrdem, thanks
12:43arrdemverma: (doc load) shows that load is classpath/namespace relative. If you in-ns into some ns, loads are assumed to be relative to the location of whatever ns you are in.
12:45vermaarrdem, ah, thanks :)
12:46Bronsaarrdem: pushed
12:46arrdemBronsa: <3
12:50anykeyTimMc: I'll take a look nevertheless.
12:52arrdemcbp: bug: you don't use your cactus on twitter
12:53arrdemcbp: bug: your twitter and github handles aren't eq
12:54cbparrdem: lol
12:55aperiodic[us hsov
12:55aperiodicha, wrong keyboard layout
13:00cbparrdem: Fixed #1
13:01arrdemyay
13:18Planet_ENIts quite a noob question but I'm trying to use spit in a clojure file and it gives me the symbol isn't defined, it works fine when I use it in REPL. Any ideas?
13:24zanesPlanet_EN: Things that are defined when you evaluate them in the REPL stay defined, even if you remove them in the file.
13:24zanesPlanet_EN: So what probably happened is that you required it, then removed that requirement from the file.
13:24zanesPlanet_EN: Do you mean ‘split’?
13:27Planet_EN zanes, no I mean spit, the one in clojure.core
13:27cbpPlanet_EN: can you paste your code + stacktrace?
13:28Planet_ENzanes, http://pastebin.com/xDDvAMyd
13:28atyzanykey: I don't think there is a framework as encompasing as grails
13:29amalloyPlanet_EN: you need some kind of ns declaration; a clojure file with no namespace is weird and who knows whether spit will work or even println
13:29amalloyi mean, i would expect it to work, but who knows
13:29Planet_ENzanes, stack trace: http://pastebin.com/raw.php?i=fmL56cuq
13:30amalloyah. Planet_EN: uninstall this "clojure" executable, and install leiningen
13:30Planet_ENamalloy, println works, spit doesn't.
13:30Planet_ENamalloy, I've lein too
13:30arrdemamalloy: if there is no ns/in-ns form, *ns* is still 'user
13:31amalloyarrdem: like i said i'd *expect* it to work but eliminating weirdness is a reasonable first guess at debugging
13:31arrdemamalloy: sure
13:31amalloyPlanet_EN: you're running a binary from like three years ago, which was never sanctioned by clojure/core anyway
13:31amalloyback then, spit lived in clojure.contrib.io, or something like that
13:31arrdemlul contrib
13:32Planet_ENamalloy, how do I run a file via lein?
13:34amalloyso, anyway, the solution is to do everything with lein. https://github.com/technomancy/leiningen/blob/master/README.md#basic-usage is useful since you've already got it installed. so you'll want to use `lein run -m your.namespace`, once you've got a project set up (as via `lein new`)
13:34amalloy"loose" clojure files which are not part of a project are not really very useful; everything lives in a project
13:35arrdemPlanet_EN: you did install lein via the boostrap script not via $PKGMANAGER, right?
13:35anykeyatyz: I figured that; I come from Django and express (on node.js) and I am new to clojure altogether, so something... skinny might be a choice
13:36Planet_ENarrdem, yea from the official script
13:36Planet_ENarrdem, its v2.4.2
13:36arrdemgud
13:38vermawhat is the #{} for?
13:38arrdemverma: https://clojure.org/reader it's the set reader literal
13:38vermaarrdem, oh nice, thanks
13:48Planet_ENIs there something similar to curl in clojure or a port of python requests?
13:48Planet_ENrequests lib
13:48Glenjaminclj-http is my preferred choice
13:48tuftPlanet_EN: yes, clj-http
13:53atyzhiredman, TimMc are you guys around today?
13:54TimMcatyz: Here, yep.
13:55TimMcafk in 7 minutes
13:55atyzIt appears you were right yesterday re the GC issue
13:55atyzErm, on thursday
13:56TimMcOh, that wasn't my diagnosis. What did you learn?
13:58atyzOh sorry it must have been amalloy
13:58atyzUmmm
13:58TimMcProbably.
13:58TimMc(inc amalloy)
13:58lazybot⇒ 140
13:58arrdemBronsa: I can't quite tell, do you manage the numbering of fields/constants manually or do you get that for free from objectweb/asm
13:58atyzI attached nr to those boxes
13:58atyzLet me show you something
13:59atyzhttp://imgur.com/w70zatW
14:00TimMcatyz: ...interesting. What happened at 10:40?
14:00Bronsaarrdem: you mean "0" in const__0?
14:00atyzTimMc: Nothign!
14:01atyzLogs say nothing
14:01Bronsaarrdem: or are you talking about local variables?
14:01atyzhttp://imgur.com/oywuUUK
14:01atyzWe are also using all of our Eden heap
14:01atyzbasically all the memory on the box
14:01aperiodicatyz: was this after taking the node out of the LB group?
14:01amalloyatyz: adding giant piles of extra RAM to a process managed by a GC is a great way to slow it down
14:01arrdemBronsa: class fields not local variables.
14:02atyzamalloy: the box has 3.7gb of ram i believe, we have allocated 3g to the jvm
14:02atyzIt seems to be using all it can
14:02Bronsaarrdem: so that's constants/callsites, the index is assigned to each constant/callsite by the collect pass
14:02amalloysure, you're probably leaking memory somewhere
14:02atyzaperiodic: the GC cpu usage dropped after I pulled it out of the lb
14:02amalloybut if you can manage with less memory at one time, incremental cleanup on a small heap will make your program run faster than occasional huge cleanups on a huge heap
14:03atyzHowever teh machine is still running at 100% after being pulled out of the lb
14:03Bronsaarrdem: https://github.com/clojure/tools.analyzer/blob/master/src/main/clojure/clojure/tools/analyzer/passes/collect.clj#L38
14:03atyzamalloy: please excuse me, but would you expand on your last statement?
14:04amalloyatyz: suppose you had a machine with 1TB of RAM, and decided to give it all to a clojure webserver
14:04aperiodicyou want a smaller heap that you garbage collect more frequently rather than a big one with rare, expensive collections
14:04amalloywhat would happen is you'd have no gc for hours, lots of garbage piling up, and then a GC pause that's minutes long
14:04tuftcan you actually prevent stop-the-world that way, or does the world just stop for less time?
14:04atyzamalloy: but that wouldn't explain why the machine is still running at 100%
14:05arrdemBronsa: herm.... okay.
14:05TimMcThere's no way to get it to do more frequent collections?
14:05amalloywell, like i said, you're probably leaking memory somewhere; once you run out of memory once, any program can get into really bad states because the OutOfMemoryError crops up somewhere you weren't expecting it
14:05aperiodictuft: the latter. hopefully your world only stops for a millisecond or two at a time
14:05TimMcOr is the problem that any collection on a heavily-used heap will make a long pause?
14:05amalloytuft: modern garbage collectors can do with very short STW pauses, or none at all if you can proactively avoid major collections
14:06tuftcool, makes sense
14:07atyzhow would I go about finding a memory leak?
14:07atyzand would it possibly help for me to change my java-opts?
14:07atyzI guess logging teh gc would be the only way
14:07amalloyatyz: you can use jmap or a profiler to get a histogram of the heap space used by objects of various sorts
14:08atyzamalloy: i've run the new relic profiler on teh box when it was under strain
14:08atyzI'll go look through that again quick
14:08amalloyand if you see that the dominator is something like my.app.core$helper$fn__123$fn__456, you'll know that you're leaking closures from inside of my.app.core/helper
14:09amalloybut of course you won't always get such a helpful answer
14:09Bronsa`arrdem: https://github.com/clojure/tools.emitter.jvm/blob/master/src/main/clojure/clojure/tools/emitter/jvm/emit.clj#L1111 for the code that emits constants
14:09amalloyusually it's clojure.lang.LazySeq objects or something, and than you have to figure out where they're coming frmo
14:14arrdemBronsa`: thanks. just trying to meld my mental model of (essentially unordered) method/field/class generation with name resolution and with your transform structure(s).
14:14atyzamalloy: forgive my ignorance, but why would a machine taking no requests, which is no longer really garbage collecting anymore but has a memory leak be using all of its cpu?
14:15amalloyatyz: because OOMEs are like armageddon. anything can happen. maybe some scheduler thread was the one who got the first error, and it was unable to unschedule some timer
14:15arrdematyz: because the machine is continually garbage collecting trying to prove that some subset of the heap is unreachable so that it can get some memory to breath in.
14:18tuftthrashing, basically =)
14:21atyzSo from what I see here (http://imgur.com/tN6MeZa) basically it looks like the culprit is the ThreadPoolExecutor. Could this just be from my threadpool in clj-http or my (probably) not the best use of futures?
14:23amalloyatyz: those threads should be blocking, not spinning cpu
14:23amalloysun.misc.Unsafe/park is the primitive used for blocking until some event happens
14:26atyzamalloy: Unless I"m reading this correctly, why are they taking up 66% of the cpu?
14:26atyz*increctly
14:26atyz*incorrectly
14:27amalloydunno. maybe newrelic doesn't realize it's blocking. maybe some weird black magic happened when you got your OOME. maybe i'm wrong and that's supposed to take up CPU time after all
14:27halogenandtoastI’m trying to understand how I should model this functionally. I have a game object and I want the game to keep playing until someone wins. I was considering having a :running true value in my Map, but I’m not sure how I’d use that to keep executed a branch until :running false because immutability. I thought about a while loop. Should I be using an atom for this instead?
14:27halogenandtoasts/executed/executing/
14:27halogenandtoastI’ve been avoiding atoms as a whole.
14:28halogenandtoastIt seems like I want an infinite lazy inject.
14:29halogenandtoastBut I might be in left field.
14:30arrdem(loop [state] (let [state
14:30arrdemderp
14:31arrdem(loop [state] (let [stat' (tick state)] (when (:running state') (recur state'))))
14:31arrdems/stat'/state'/g
14:31arrdemno need for atoms here
14:32halogenandtoastarrdem: thanks, makes some sense, I’ll start working on understanding how this works.
14:33halogenandtoastSo recur executes the loop again passing in a new value, interesting.
14:33atyzamalloy: I don't think so, because on happy boxes it doesn't take up a majority of the cpu
14:35arrdemhalogenandtoast: yep.
14:56pandeiroanyone ever experienced a ring app using compojure working fine (200s) with embedded jetty in dev, but returning 302s when deployed as a war? (referring to the same exact route, eg localhost:8080/foo)
14:58anykeyatyz: I am impressed. Compojure is exactly the balance of simplicity and complexity I searched for. Will be learning clojure the next weeks with that.
15:06halogenandtoastarrdem: Thanks so much for the example, I think that was a huge clojure breakthrough for me.
15:07arrdemhalogenandtoast: no worries
15:19atyzanykey: I think you (like I did) will start to enjoy the simplicity of it. I have felt bogged down by many of the larger all inclusive frameworks
15:20anykeyatyz: it's my main gripe with grails. Grails is SLOW.
15:20anykeyit takes above 45 seconds to just reload changes
15:21anykeyin comparison to that, compojure feels quick, but comes, of course, as no-frills.
15:21anykeyI will have problems when I want to properly secure applications
15:22atyzYep, thats not fun. If you are looking for more all inclusive stuff Scala has some frameworks that are a little more all inclusive
15:22anykeyatyz: actually I like lisp, it's been a long time
15:22anykeyI did Lisp in... I think 2008
15:22anykeycommon lisp, back then
15:23anykeybut I have known it for quite some time before that
15:23atyzThen you shuldn't have too much trouble adopting clojure :)
15:24anykeytomorrow it may be decided that I am doomed to do Java for the rest of my work life
15:25anykeyif that doesn't come to pass, I will happily take a very good look at clojure
15:38Fareis there a better way to insert something at the second position of a vector than (fn [[a & b]] (apply vector a 2 b)) ?
15:39turbofailprobably not. vectors aren't really made for random insertion
15:40bbloomwell, should use into
15:40Fare(into [] (list* a 2 b)) ?
15:40bbloom,((fn [[a & b]] (into [a 2] b)) [1 2 3 4])
15:40clojurebot[1 2 2 3 4]
15:40Fareok
15:41bbloomapply-vector will make a pass through lazy seqs on the way to being a vector
15:41bbloomusing into will internally use reduce, skipping the intermediate data structures
15:41Fare(inc bbloom)
15:41lazybot⇒ 36
15:43bbloomFare: still, unless you know you have a small (30ish or fewer) item vector (or are doing this rarely enough) then you've probably good the wrong data structure
15:43bbloomFare: seqs have fast head access
15:48Farethis is to represent source code. All these vecs are fewer than 10 elements.
15:48Faremaybe even only all fewer than 5 or 6
15:48bbloomyup, won't matter at all then
15:49Fare7 actually
15:54bbloomFare: enjoying clojure so far? would be interesting to get a CL-ers view
15:56Fareyes, enjoying it very much.
15:56halogenandtoastIs there any service for paying other clojure developers to review my code and give me tips to improve it (I know I can use exercism.io, but that’s solving very specific examples and not the code I wrote).
15:56halogenandtoast(pay or free)
15:57Farethere are things I'm missing, but the core language is much neater.
15:57FareI still am not done with "The Joy of Clojure". It just happily surprised me with {:pre ... :post ...}
15:58anykeyI bought that book too
15:58anykeythen I noticed I couldn't handle it, so I also got a more introductory one
15:59FareI bought 1st ed shortly before 2nd ed was out :-/
15:59Fareit is slightly too slow for me, but good nonetheless. 1st ed has many small mistakes here and there. I suppose they've been fixed in 2nd ed, but that's annoying.
15:59amalloyhalogenandtoast: you could try #clojure on freenode. i hear some clojure devs hang out there
15:59Farehallski, wait, where am I?
16:00Fares/hallski/amalloy/
16:00halogenandtoastamalloy: so you mean here?
16:00vermalol
16:00vermaI checked to make sure I was on freenode
16:00verma:P
16:01halogenandtoastAt the moment I just have this small program I’m writing to emulate a card game: https://gist.github.com/halogenandtoast/58cf169f271d49f69005
16:01halogenandtoastI’m concerned that my lack of clojure knowledge might have led me down bad paths
16:01amalloyhalogenandtoast: sure. you just have to structure your question so that it's interesting. nobody will want to "offer general suggestions" on your 3000-line app, but smaller targeted questions are often answered helpfully. plus, working on asking a better question will itself teach you
16:02vermaI just need a good set of problems/projects to work on to learn more clojure, I find myself struggling with ideas
16:02halogenandtoastamalloy: Heh luckily it’s less than 100 lines, and it’s at least a card game. Maybe that’s interesting?
16:04amalloyhalogenandtoast: seems like a basically reasonable way of doing things. it's unfortunate that there are side effects buried in make-player, but i see you're doing a pretty good job of keeping pure code pure
16:04amalloy#(shuffle-deck %1 %2) is just shuffle-deck
16:05amalloynothing in there stands out as outrageously bad. i'd say you're on a good path
16:06halogenandtoastamalloy: Thanks, good to know. I agree I didn’t like the side-effects (due to map not working, switched to doall, and then finally mapv).
16:06halogenandtoastThe doall, forced me to use into later
16:09brackiDoes anybody know how to calm down Jetty when enabling logging via clojure.tools.logging, slf4j and logback?
16:10Farewhat's the easiest way to conditionally destructure a seq?
16:11razum2umjust a small survey: how many of participants here are writing clojure at work as primary language?
16:12nopromptrazum2um: is everyone supposed to raise their hand?
16:14pandeiroanyone know what config is necessary for standalone jetty and lein ring warfiles to work together?
16:14amalloyFare: destructuring is unconditional; we don't have pattern-matching like haskell or erlang (unless you use a library like core.match)
16:14nopromptdoes anyone what the proper channels are for removing something accidentally push to clojars, work related, not intended for public consumption? /cc technomany
16:14noprompt:| ^ technomancy
16:14i-blis*raises hand*
16:14razum2umnoprompt: room encounters 757 users now, just will know how many are just curious
16:15amalloynoprompt: it's to talk to technomancy
16:15Fareis there a reason not to use core.match?
16:15nopromptit'd be nice to have a "panic-button" with clojars when you accidentally push something.
16:15Farealso, is there a good way to use a library only at compile-time?
16:15arrdemFare: TL;DR no
16:15amalloyi mean, the same reason not to use anything. the default, for all x, is to not use x; you only use x if there's a reason :P
16:16nopromptlike i'm pretty sure 1000s of people aren't going to be depending on something i haven't even made known to the public. as if people are sitting on pins and needles waiting for me to push my next clojure smash hit.
16:16nopromptamalloy: so do i email our techno friend?
16:16amalloyFare: use it only at compile time? that might be viable if it were 100% macros, but i don't think there are very many such libraries
16:17noprompthang out in IRC and wait for him to show up?
16:17johnwalkeris there an eof literal in clojure?
16:17amalloynoprompt: *shrug* i just see people hang out in irc
16:17amalloybut of course more people may be emailing him; i don't read all of those
16:17nopromptthe clojure community has a weird "addiction" to IRC.
16:17nopromptit's a bubble.
16:17arrdem(nsa-logs-authed? 'amalloy)
16:17Fareamalloy: well, for instance core.match. Also, I'm interested in using instaparser at compile-time only to generate some data.
16:17amalloynoprompt: you could sell irc short
16:17nopromptshit goes down in here that people don't get a chance to talk about on the ML. it's lame.
16:18technomancynoprompt: I'm on the phone, but I can get this deleted as soon as this call ends.
16:18amalloyif you think the market is in a bubble
16:18technomancythere is also contact@clojars.org
16:19noprompttechnomancy: i think that was more of what i was looking for. i didn't want to think of you as some kind of hotline that i could just walk in here and make demands. :)
16:19amalloyi would be surprised, Fare, to discover that core.match is 100% macros. it probably also defines some functions that it causes you to call at runtime
16:19technomancynoprompt: there have been suggestions to allow deletions of zero-download jars
16:19technomancybut suggestions are not patches
16:20nopromptamalloy: i like irc. i miss it in fact. my job doesn't give me the time to be here though during the day. which is why i get frustrated by the exclusive IRC attitude i've seen since i started programming in clojure a year and a half ago.
16:20noprompttechnomancy: that's fair.
16:22noprompttechnomancy: i'll fork/clone the repo now and spike on something as soon as i have a chance. i didn't realize it was a pain point until about 15mins ago.
16:22amalloyfor example, Fare, clojure.core.match/val-at* is a function dnolen_ apparently includes to be slightly different from get in some way, which he uses when matching against maps
16:22Fareok
16:23Fareso, that would be: using instaparser in a macro
16:24FareI suppose that's ok to include instaparser in the jar even if not used at runtime
16:25noprompttechnomancy: do i need to add a special email subject?
16:26technomancynoprompt: just make it clear that it's about sensitive data vs a typo or something
16:30brackiHow can I turn on NSCA formatted request logging when using the ring-jetty-adapter?
16:32noprompttechnomancy: this is code that belongs to the company.
16:35johnwalkerin clj-http, is there a way to do --data-binary like in curl?
16:36dakronejohnwalker: you can send a byte array in {:body my-byte-array}
16:37johnwalkerahh, nice dakrone
16:48bacon1989I'm finding it really hard to find an example of reading an input stream using a buffer
16:48bacon1989there's an example here http://stackoverflow.com/questions/7756909/in-clojure-1-3-how-to-read-and-write-a-file
16:48bacon1989but it's using line-seq, my string doesn't have any 'lines'
16:48bacon1989it's a giant base64 dump
16:49bacon1989so I think the slurp function is failing to grab the entire contents of my output, because it's truncating after a certain amount of time
16:49bacon1989(assuming it's using line-seq)
16:58Fareis anyone here going to ILC'2014, Aug 15-17 in Montreal?
16:58FareI'd like to organize a panel there, and someone who knows more clojure than I would be welcome to participate.
17:04gfredericks$google ILC 2014
17:04lazybot[International Liver Congress 2014: ILC 2014] http://www.ilc-congress.eu/
17:06Farehttp://international-lisp-conference.org/
17:06TEttingerthat makes more sesne
17:06TEttingersense
17:07gfrederickswould love to be invited to the liver congress as a clojure expert
17:12technomancyas the owner and operator of a liver you should be uniquely qualified
17:13arrdemheh
17:13gfrederickstechnomancy: so insensitive of you to assume that everybody you talk to on the internet has a liver
17:14TEttinger,"yeah!"
17:14clojurebot"yeah!"
17:14technomancyfine, *former* owner of a liver
17:15gfredericksexperienced with livers
17:21thecatwasfati'm getting an "OutOfMemoryError Java heap space" message when trying to generate prime numbers: http://pastebin.com/yahkLxai
17:21rurumatelangohr seems complex enough to use stuartsierra-style component pattern, has anyone done that yet?
17:21thecatwasfatis it because i'm creating too many "nums" sequences that don't get discarded?
17:25johnwalkerwhat is an alternative to clojure data xml?
17:26johnwalkeractually, i bet there's something more like hiccup
17:27halogenandtoastIs there any benefit to (nth (:decks game) index) over ((:decks game) index)? given (:decks game) returns a Vector
17:28amalloyjohnwalker: there's a function in c.d.xml that converts hiccupy sexprs into c.d.xml values
17:28johnwalkeramalloy: is there one that converts c.d.xml values into hiccupy sexprs?
17:29johnwalker(does the opposite)
17:30amalloyjohnwalker: i don't see one. really, working with hiccup values is awfully unpleasant: hiccup's notation exists because it's easy for humans to type in
17:30amalloyif you already have something in a nice computer-friendly format, why convert it to this hiccup soup?
17:30johnwalkerhiccup soup looks nicer
17:31johnwalkerand the pretty printed values use ( instead of [
17:31johnwalkerwhich kills the reader whenever you want to just store them as vars
17:32amalloyi don't understand your objections at all; but it's trivially easy to write a transformer to hiccup style yourself if you want
17:34johnwalkerto be clearer, hiccup's vectors are convenient because [:h2 "aoeu"] doesn't try to call :h2 on "aoeu"
17:34johnwalkeri am slightly annoyed that i can't use cider pprint directly on parsed xml
17:35amalloyunless you're eval'ing these things for some crazy reasno, neither does (:h2 "aoeu")
17:35johnwalkerthen there is an easy way to do (def foo (:h2 "aoeu")) unevaluated?
17:35TimMcjohnwalker: Just throw a ' in front
17:36TimMc,'(:h2 "aoeu")
17:36clojurebot(:h2 "aoeu")
17:36amalloyjohnwalker: your use case is that you're printing things to stdout, and then copy/pasting them into vars?
17:36johnwalkerbut these are nested structures
17:36johnwalkeryeah basically
17:36TimMc,'(:h2 "aoeu" (:h2 "more")) ;; so?
17:36clojurebot(:h2 "aoeu" (:h2 "more"))
17:37amalloywell, at last we've gotten to the real problem, which is nothing to do with hiccup or xml
17:37johnwalker,'(:h2 "aoeu (:h2 (for [i (range ...)] ..)))
17:37clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
17:37TimMcjohnwalker: Ah, so you'll be wanting ` and ~
17:38TimMc&'(:h2 "aoeu" ~(str "a" "b") ~@(range 4))
17:38lazybot⇒ (:h2 "aoeu" (clojure.core/unquote (str "a" "b")) (clojure.core/unquote-splicing (range 4)))
17:38TimMc&`(:h2 "aoeu" ~(str "a" "b") ~@(range 4)) ;; whoops
17:38lazybot⇒ (:h2 "aoeu" "ab" 0 1 2 3)
17:38johnwalkeri am not a big fan of this solution
17:38TimMcjohnwalker: Just so you know, though -- hiccup is prone to XSS.
17:38ybit3if anyone has a bit of time to spare, i could use some help in getting this to compile: https://gist.githubusercontent.com/heath/406917c7d57c5fcf46fe/raw/54b6b30102e5706775dadd6b3d6e46c5e69d8295/gistfile1.txt
17:39amalloycopy/pasting printed forms back into source is never going to have a pretty answer
17:39ybit3it compiles to incorrect js
17:40amalloyybit3: you didn't even include the clojurescript you want help with!
17:40johnwalkercough homoiconicity
17:41ybit3amalloy: it's from the clojurescript wiki entry "getting started"
17:41ybit3i'll paste anyway
17:41ybit3https://gist.githubusercontent.com/heath/7a242e1e9cbe643ebdf1/raw/fa9d69ea353ee0cf5bd3a15444e1806a7bc6c1f6/gistfile1.txt
17:41johnwalkeri didn't know that hiccup had xss issues
17:42johnwalkerthanks TimMc, amalloy
17:42halogenandtoastAww I used lein-kibit hoping it would output a bunch of things I was doing wrong… got nothing :(
17:42ybit3hm, let me remove the (ns.. at the bottom
17:43ybit3(hsenv) is me copying/pasting incorrectly
17:43sdegutisAnyone using noprompt's garden lib?
17:43sdegutisI'm trying to figure out how to generate "tr:nth-child(2n)" without resorting to just using a string literal.
17:43nopromptyo
17:43sdegutisohai
17:43TimMcjohnwalker: Most HTTP templating libs do (and not just in Clojure-land.)
17:44sdegutisnoprompt: is this possible?
17:44TimMcI think ato has a patch that fixes it by introducing RawString.
17:44nopromptsdegutis: yeah, i mean a string literal is fine, what else would you use?
17:45johnwalkerahh, i'll keep an eye out for that
17:45sdegutisnoprompt: there's just so many utility functions to generate stuff, I thought maybe I was overlooking something
17:45nopromptsdegutis: i have some work on a branch for *way* better selectors but i haven't merged it yet.
17:45sdegutisok
17:46nopromptsdegutis: for that one (defn nth-child [n] (format "&:nth-child(%i)" n))
17:47nopromptsdegutis: i realize there's a lot of missing stuff in the library and i've been encouraging people to send me patches.
17:47TimMcjohnwalker: https://github.com/ato/clojars-web/blob/master/src/clojars/web/safe_hiccup.clj although you still have to watch out for ring accepting multiple args as a coll of strings, I think...
17:47noprompti only have so much time in the day and i appreciate that sort of thing.
17:47ybit3here's a better paste showing directory and file contents as well as compiler output
17:47ybit3https://gist.githubusercontent.com/heath/7ce8a379c5840bf734ac/raw/ea45b6ddb21c990074a3d2ea51a326bafda41b56/gistfile1.txt
17:50sdegutisnoprompt: it suffers from the problem of "good enough"
17:50sdegutisnoprompt: also a project ive been working on just got suddenly popular and i cant step away from the computer for 5 minutes without getting 10 feature requests
17:51nopromptsdegutis: unfotunately, it isn't, imho. i've been pretty unhappy with it for a while. i just haven't been able to merge in some of the work i've been doing in silence.
17:51nopromptsdegutis: which project?
17:51sdegutisnoprompt: my osx window manager
17:51nopromptsdegutis: oh neat, which is it?
17:51sdegutissomeone caught sight of it this weekend https://github.com/sdegutis/hydra/
17:52sdegutisits not the one that can be scripted in clojure.. that ones deprecated ;)
17:52nopromptsdegutis: this looks good! i've been using spectacle for a while, i should give this a shot.
17:53johnwalkerTimMc: i'm really glad that i don't have to worry about ring lol
17:53sdegutisnoprompt: :)
17:53sdegutisnoprompt: if you run into anything, #hydrawm is a good place to get quick help
17:53Jaoodsdegutis: you like atom?
17:53sdegutisJaood: no sir, why?
17:53Jaoodthat green ball on dock looks looks like atom :P
17:53sdegutisheh
17:54sdegutisprolly limechat
17:54nopromptatom lol
17:54sdegutisyoull also notice emacs there
17:54technomancyTom Swift and his Atomic Text Editor
17:54sdegutisohai technomancy
17:54arrdemtechnomancy: good grief it's been a long time since I heard that name...
17:54technomancyhihi
17:55johnwalker(inc dakrone)
17:55lazybot⇒ 2
17:55Jaoodsdegutis: looks cool, always wonder why OS X never had the key strokes for resizing windows like on windows7
17:55johnwalker(inc amalloy)
17:55lazybot⇒ 141
17:56johnwalker(inc TimMc)
17:56lazybot⇒ 62
17:56sdegutisJaood: thx
17:56FrozenlockJaood: because Mac users can't handle more than 1 window at the time. /troll
17:57noprompthahahaha
17:58nopromptOS X also has keyboard navigation disabled *by default* which is kinda lame.
17:58sdegutiswait there's keyboard navigation?
17:58sdegutiswhat kind do you mean?
17:58noprompteven my mom knows how to use the tab key to get to the cancel button.
17:58technomancyFrozenlock: if you can't even handle two mouse buttons then keyboards must look bewildering
17:58sdegutisoh yeah that
17:58Frozenlockloool
17:58FrozenlockForgot about the mouse thing
17:59bbloomhonestly, that keyboard navigation thing really screws up a lot of people
17:59noprompti imagine it'll take a generation before people forget the whole mouse thing.
17:59bbloomthey use the arrows or tab or whatever, then try to type, assuming the focus is in a textbox, and wind up submitting or canceling
17:59sdegutistechnomancy: well users can use my window manager to pretend they have two mouse buttons, maybe
17:59bbloomi've watched it happen quite a few times with people who even know how to type, but aren't great at computers
17:59sdegutisok bye
17:59bbloomi think textbox-only for keyboard nav is a perfectly reasonable default for a mass market machine
18:00nopromptbbloom: geez man. take me to court already. ;)
18:01bbloomit really sucks that our choices are polished lowest common denominator, unpolished lowest common denominator, and downright raw crap for experts
18:01noprompti've been bitten by it though too so i guess your point is fair.
18:10FrozenlockI blame mobile for everything.
18:11{blake}Hey, all: I'm having trouble applying a function recursively. (It's here: https://www.refheap.com/87749). Basically, I've got a list of maps where each map has a single entry, but the key to that entry might be duped elsewhere in the list. So I draw out the key and put all the values of common keys together under one entry. Great--but now I want to do it with the resultant child lists.
18:13bbloomtechnomancy: i googled for engelbart's violin
18:14bbloomtechnomancy: at first, i was hesitant, since loper-os usually means insane incoherent ramblings of an old crank
18:14bbloomtechnomancy: but http://www.loper-os.org/?p=861 is actually pretty good
18:14technomancyhaha, I know, right
18:14technomancyimmediate "uh oh, not this guy again" reaction, but in this case it's unfounded
18:15bbloomi don't think you're crazy for making your own keyboard, although i wouldn't do it myself...
18:15bbloombut still, people give me shit over my kensis
18:15TimMcI also found this on loper-os: http://www.loper-os.org/wp-content/editors.png
18:15mtd=861 is actually pretty good
18:15bbloomninesis, rather
18:15mtdugh, sry
18:15bbloomi can't type
18:15bbloomkinesis
18:15mtdbbloom: ...rocks :)
18:15bbloomanyway, they are like "i wanted to try one of those, but they were so expensive".... dude, it's 300 bucks. your boss shouldn't bat an eye if you wanted to order one just to try it out
18:16bbloomyou're gonna lose more than $300 in productivity the very first day you re-learn to type on it!
18:16bbloompeople dont' want to invest in their tools
18:16bbloomit's nuts
18:17FrozenlockPeople or bosses?
18:17bbloomboth
18:17Frozenlockeveryone! :-p
18:17technomancybbloom: the problem is once you realize everything is crap, you're stuck with it
18:17arrdemtechnomancy: ignorance truly is bliss :P
18:17technomancybbloom: same with coffee, wine, PLs, etc
18:17bbloomlol
18:18bbloomi don't buy the idea that learnability isn't important tho
18:18bbloomsoftware is unique in its adaptability
18:18bbloomyou can create software that scales with its users
18:18Frozenlockbbloom: Sounds like Emacs
18:18bbloomw/o resorting to a ton of "preferences" and settings
18:21technomancyit's a ton easier if your users are programmers though
18:21bbloomtechnomancy: hey, i did my part in ensuring that *all* users are programmers ;-)
18:21bbloomgotta run tho, cya
18:22technomancyhaha, yeah exactly
18:22technomancythe fact that there's a difference between "being a user of a computer" and "being a programmer" is really just a shortcoming of existing software
18:23FrozenlockIndeed. I think the title divide is an obstacle in itself. "I won't try this, I'm not a programmer..."
18:23noprompti tend to agree
18:23AimHeretechnomancy, if that's the case, isn't software getting worse?
18:23technomancyAimHere: I don't know; I don't pay attention to software that isn't for programmers
18:23arrdemhahaha
18:23technomancyprobably
18:24nopromptlol
18:24AimHereWell at one time there wasn't software that wasn't for programmers. Now there is.
18:25FrozenlockEverything's getting worse. Software, laws, TV...
18:26FrozenlockExcept bacon. Bacon is always good.
18:26turbofailcars that no longer kill you. what's the world coming to?
18:26sdegutisnoprompt: umm, just how much is the garden api going to change?
18:26sdegutisnoprompt: because I'm currently putting in a lot of effort to convert our plain CSS to garden
18:26sdegutisnoprompt: and I'd love to avoid doing this a second time
18:27technomancyincreased resources result in greater breathing room, meaning more space in which things can flourish which would otherwise crash and burn from the weight of their own imperfection
18:27technomancy(independent of any value judgement)
18:28Frozenlockturbofail: I'm still waiting to see how this turns out... the biggest challenge might not be technical, but legal.
18:30TimMcFrozenlock: Yes, the question of liability becomes rather more front-and-center than it is with (say) mistakenly bounced email.
18:31TimMcturbofail: More like... cars that can kill you instead of drivers that can kill you. :-P
18:32turbofaili was actually more referring to how older cars would send the engine block through your torso instead of crumpling nicely
18:32TimMcOh! Yeah, that's a nice thing.
18:32TimMcAlthough the '85 Volvo I learned to driv eon would apparently shunt the engine out the bottom instead...
18:32clojurebotI don't understand.
18:33TimMcThis is not from first-hand experience, however -- just what I heard.
18:33amalloyhey, i learned on an 86 volvo. we're like twins!
18:33TimMcDid you also once run a lawn tractor into it?
18:34amalloylawn...tractor? some sort of suburban farming implement?
18:34TimMcRiding lawn mower, but witha towing hitch on it IIRC.
18:34TimMcBasically.
18:35TimMcMy dad ran a seed company on our 2 acre property. That machine got a lot of use, and not just for mowing.
18:37tufttesla's have a nice crumple zone =)
18:38TimMctuft: Your luggage?
18:38amalloythe ' in tesla's is serving as a crumple zone too
18:40tufti'd rather have luggage in my lap than an engine block =)
18:47tuftwow, garden+clojurescript+hiccup would be some kind of nirvana =)
19:08TEttinger$google tesla stolen chase crash
19:08lazybot[Stolen Tesla involved in high speed chase, crashes, splits in two in ...] http://wgntv.com/2014/07/06/stolen-tesla-involved-in-high-speed-chase-crashes-splits-in-two-in-california/
19:08TEttingertuft:
19:11tuftwoah
19:12amalloyhey, i lived just three or four blocks from that intersection a year ago
19:13amalloyhow come i never got to see any exciting tesla crashes?
19:13TEttingeryou wouldn't want to be near that guy...
19:13TEttingerso much collateral damage
19:13p_ldidn't they recently claim you can't steal a tesla because of remote killswitch?
19:14amalloyyou can't steal a tesla because it's illegal, silly
19:14amalloy(aside: tesla and steal use the same letters. coincidence? you decide)
19:14p_lamalloy: the line goes "coincidence? I think not" :P
19:14amalloyi think they both work
19:14tuftyeah you'd think they could kill it
19:14tuftprobably off hours?
19:15tuftanyway, wonder how a gas car would have faired
19:15p_ltuft: lost reception :P
19:15tufthaha yeah
19:15tufthe was switching towers too fast
19:15tuftdoing the ol' 4g shuffle
19:15p_ln.b. if you can get a tesla owner to install your certificate into trusted store on his iphone or android, you can then steal his credentials for the car
19:15amalloy'A coincidence is actually a conspiracy without the "???? You decide!" at the end of it. Simply by adding "??? You decide!" any coincidence becomes a government conspiracy carried out by the Jews.'
19:17tuftglen beck "just asks questions"
19:19sritchiednolen_: hey david, is there some way to apply the om.dom functions?
19:19sritchie(d/div {} "hi") vs (apply d/div {} [“hi”])
19:20sritchieI see in dom.clj, gen-react-dom-fns makes it look like the generated funcs should do the trick
19:20amalloysritchie: iirc there are foo* variants. i remember someone applying div*
19:21sritchieah, looks like it works - I was calling om-tools.dom by accident
19:21sritchiewhich provides macro-only wrappers, I guess
19:22cespareHow can I catch an exception in a macro?
19:22amalloynot div* then, just div. okay. maybe next time i'll remember
19:22amalloycespare: same as anything. generate the code that works to catch exceptions outside of macros
19:24amalloy(defmacro with-dangerous-errors [& body] `(try (do ~@body) (catch Throwable t# (format-hard-drive)))
19:25cesparefair enough. I'm testing a macro and asserting that it rejects certain bad inputs
19:25cespareis this the right way to go about it?
19:26amalloyif you want to catch the exceptions at compile time, then you want to call macroexpand by hand, instead of letting the compiler do it
19:26cespares/compile /run/ ?
19:26amalloysince you can wrap a try around that, but any try around an actual use of the macro will come "too late": when the code is run, rather than when it's compiled
19:27amalloyno
19:27amalloyyou're saying your macro throws exceptions at compile time, if you give it an input it doesn't like
19:28cespareright. Wouldn't my new exception-catching macro wrapped around that work?
19:28amalloyno
19:28amalloyyou throw the exception at compile time, but any try exprs wrapped around it are only in effect at runtime
19:28amalloy(try (fasfasgsdfs) (catch Exception e nil)) is still going to fail
19:29amalloybecause it fails while compiling this nonsense symbol, long before the try block is actually entered, which is at runtime
19:30cespareok, so i need the exception-catching macro and macroexpand?
19:30amalloyyou don't need an exception-catching macro
19:31amalloyjust (try (macroexpand '(...)) "no exception" (catch Exception e "exception"))
19:31cesparedoesn't that macroexpand happen at runtime?
19:32amalloyyes, which is exactly when the try block is in effect
19:32amalloyand is when your tests are run
19:32cesparegot it. so my s/compile /run from earlier was correct
19:32cespareyou said compile time
19:32cesparewhich confused me
19:33amalloyit was too vague to be correct in any interesting way. the macro is throwing exceptions at compile time; you're catching them at runtime by actually calling it via macroexpand instead of via the compiler
19:43{blake}OK, so I'm creating a map of lists from a list of maps by drawing the common keys of the lists up and compiling all the values of those keys. At the top level, this works, but now I have to go to the created lists and do it again. Recurse, but going down instead of up.
19:44{blake}Here's what I have: https://www.refheap.com/87749 .I'm stumped on how to proceed.
19:45amalloy{blake}: you should at least include what output you wish you could get. "needing to do this with XYZ also" isn't very specific
19:47{blake}amalloy, Fair enough. Having collected the values for :L1 under one key, I want to collect all the value for :L2 under one key. And so on in that fashion until all humans have been eaten.
19:48amalloy{blake}: try writing out, as an actual clojure value that would be accepted by the reader, the result you want to get. i don't think it's as clear as you think
19:48{blake}OK, I updated https://www.refheap.com/87749 to show the next level.
19:49{blake}Well, wait, I could just output what I get when I do the call manually.
19:50amalloywhat i'm getting at is, what are you going to do when the hierarchies diverge? you need some values "at" L2, and some to live "under" it in L3 somehow
19:50amalloyand how do you distinguish "stuff" from "L3" in the transformation, if the only arg you pass is sxml and not a list of keys you're interested in
19:51{blake}amalloy, If I do this: (draw-forward (val (first (draw-forward sxml))))
19:51{blake}I get the desired result: {:L2 ({:stuff :data1} {:L3 ({:stuff :otherdata1})} {:stuff :data2} {:L3 ({:stuff :otherdata2})})}
19:52{blake}Except, of course, disassociated from the original structure.
19:52tuftugh, i hate how args can be either named or position in python per invocation. really confuses matters when trying to make nice polymorphisms.
19:52tufts/position/positional/
19:53amalloyso, you say "I need to do this with :L2, :L3, etc", but then when i asked for the result you actually wish you got, you seem to have only done something with :L2. what do you wish happened with :L3?
19:54{blake}Well, I thought I would get the same thing for :L3 (and :stuff, for that matter).
19:54{blake}In other words: Give a list of single-entry maps, create a new map of the common keys' values aggregated together.
19:55{blake}Er, given.
19:55amalloyso you don't in fact want to distinguish between :Ln and :stuff at all; you intend them to be treated similarly
19:56{blake}amalloy, Right. I agree that's confusing, but I either want that stuff aggregated or dropped, so I'm not too worried about it.
19:57amalloy{blake}: the point i'm making is that having a clear, well-defined problem is important in asking for help, and one really good way to do that is to state what output you expect. we've spent ten minutes now going back and forth over your original question because you haven't put your actual goal into it
19:58amalloyin that time, a well-defined problem could already be solved
20:00{blake}amalloy, I apologize. I thought my goal of aggregating the common keys was clear. But then, if I weren't confused in some fashion, I probably wouldn't need help.
20:01{blake}(Like, I tried resolving that last layer manually and am getting an error, and I can't see why.)
20:01amalloy{blake}: right. things can seem clear to you, and it's hard to know what will actually be clear or not. that's why i suggest writing down something concrete, like a clojure value, because that's harder to misinterpret
20:02{blake}amalloy, Yeah, I had that earlier on, but took it out because it seemed more confusing to me than "do this again". Go figure.
20:05{blake}So that "draw-forward" code fails when there's multiple keys.
20:05amalloy{blake}: https://www.refheap.com/df790a776292225c5e0a374ab
20:07amalloyi hereby declare it undefined behavior if you give my function input like '({:L1 x}, {:L1 ({:L2 x})}), though - it wants a consistent hierearchy
20:08amalloyseq->deep-map is your draw-forward function, in case that's not clear
20:09{blake}amalloy, I got that. Just looking at and trying to figure it out.
20:10amalloythe idea is to traverse that seq of seqs of maps, producing a seq like [[:L1 :L2 :stuff :data1] [:L1 :L2 :stuff :data2]], and then reduce over that seq to build a map
20:11{blake}amalloy, Thanks...right, and I toyed with doing a test for a sequence vs. map.
20:11amalloyyeah, i wasn't sure how structured your input data is, so glossing that distinction over was easiest
20:12{blake}I =think= it's more structured than my actual samples, but since it's not my data, I was erring on the cautious side.
20:13cespareWhy does this test pass in my repl but fail under 'lein test'? http://pastie.org/9365787
20:13cespareamalloy: ^^ related to prior discussion
20:13{blake}(inc amalloy)
20:13lazybot⇒ 142
20:13seangrove(dec amalloy) ;; keep egos in check
20:13lazybot⇒ 141
20:13seangrove(inc amalloy) ;; but just can't do it, really
20:13lazybot⇒ 142
20:13seangrove(inc amalloy) ;; and a bit more
20:13lazybot⇒ 143
20:13amalloy,(symbol "(inc amalloy)")
20:13clojurebot(inc amalloy)
20:14amalloyaw. i forgot we fixed that
20:14seangroveYeah, looooong time a go
20:14{blake}What would it do?
20:14amalloyi dunno, cespare. seems it should pass in any conceivable universe
20:15cespareamalloy: my coworker can repro as well.
20:15amalloy{blake}: it was a trick to get clojurebot to inc your karma by proxy, since lazybot won't let you do it
20:15cespareexpected: (thrown? Exception (macroexpand-1 (quote (foobar)))) actual: nil
20:15{blake}So, sort of like manipulating your divorced parents.
20:16amalloycespare: is foobar actually in scope? if you're not referring it into your test namespace, then (foobar) just expands to (foobar)
20:16cespareamalloy: in my toy example it's defined literally right above the test
20:17amalloyhmmmm. i'm not sure what namespace tests are run "in". probably clojure.core. try replacing the ' with a `
20:17cespareamalloy: ok. I'm also just gonna print what it expands to; that'll probably show the issue you're talking about.
20:22cespareamalloy: you were correct, thanks
20:27amalloycespare: it's easy to forget how macroexpand works, since it's usually only called from the repl. i certainly had
20:29PigDudeso i came in asking about this a couple days ago ... using core.async, why don't i see stacktracess?
20:29PigDudeany error in a go block i only see the error message, no line number or stack trace. my program does not handle any exceptions
20:29PigDudei usually can infer the error site but it is still a pain, line numbers are nice and i know the information is there
20:30amalloyPigDude: there's an old commit to core.async that added this "feature"; stuartsierra was in here last week vowing to fix it
20:31PigDudeso is there any way to get at this info?
20:31PigDudejust curious
20:34PigDudeor maybe if you know the commit sha i could look at what changed and figure it out from there
20:35amalloyhttps://github.com/clojure/core.async/commit/9fcae99576c0735a804bbd4cbec81307e2d34d90#diff-2193dd8597437d6454bb74edd2f15e00L26
20:36PigDudenoooooo haha
20:36PigDudethank you amalloy
20:38arrdemso given core's propensity for making things that could be public private... why is this gem public and is it patch worth.. http://www.arrdem.com/grimoire/1.6.0/clojure.data/diff_DASH_similar/ https://github.com/clojure/clojure/blob/master/src/clj/clojure/data.clj#L75
20:41amalloywhat would you want to patch about it?
20:42arrdemmeh... the "real" fix is that you change extend so that it doesn't kick out defs here, but that doesn't make sense. not enshrining diff in core would be my "real" fix :P
20:59startlingAny idea why the functions in tools.logging print things prefixed with clojure.tools.logging$eval4837$fn__4843 invoke ?
21:14halogenandtoastIs there any difference between (nth coll 1) and (coll 1)?
21:14halogenandtoastfunctionality wise, not syntax wise of course.
21:15sritchienth works with all seqs,
21:15sritchieI think (coll 1) only works with vectors
21:16sritchiehalogenandtoast: also, (coll 1) will still “work” with a map, it’ll just return the value associated with 1, or nil
21:17halogenandtoastOkay, makes sense.
21:18dbasch(coll 1) works with colls that implement IFn
21:19dbaschand it means different things depending on coll's type
21:45devnoh whoa, cool
21:45devnsome interesting commits by rich on core.async
21:45devnhttps://github.com/clojure/core.async/commit/99d2ffbb22f57b29a41220cfb292e4c286037e46
21:45devnI missed those
22:22ShayanjmSo in my application, I have to do _a lot_ of scraping + parsing (grabbing about 40 pages at a time & performing NLP sentiment analysis on the contents), which obviously takes quite a few resources and time
22:22ShayanjmIs there a good framework where I can run computationally expensive functions on small external boxes?
22:29TEttingermechanical turk
22:33ttasteriscoShayanjm: I probably don't know the answer to your question, but would like to know what exactly are you looking for?
22:33ttasteriscoi.e. a good framework?
22:34Shayanjmttasterisco: essentially, I'm grabbing a bunch of data and applying a number of functions to it to transform it in a few ways before it's actually consumed
22:35Shayanjmthe total overhead to grab the data from a limited number of sources is getting a bit out of control on a single box (some 2.5GB memory usage + function takes >2 mins to run)
22:35ttasteriscoyes, but what do you mean by a framework to run computationally expensive functions on small external boxes? talking without knowing, but wasn't that the whole point of google's map reduce? :p
22:35Shayanjmehh, yes. I mean I could use hadoop but I don't really need the distributed storage half of it
22:35TEttingerah, you just need the processors and RAM
22:36ShayanjmYeah precisely
22:36Shayanjmand the IPs at that, since it's scraping as well
22:36TEttingerthere's gotta be an AWS thing from amazon
22:36ShayanjmYeah maybe
22:37ttasteriscois your sentiment analysis self contained or are you hitting some service of yours in some other box?
22:37Shayanjmself contained
22:37TEttingerhttps://aws.amazon.com/documentation/ec2/ ?
22:37Shayanjmit runs on a trained neural net, so if I do end up building a distributed solution I'd need to figure out a way to persist that NN to all nodes
22:38ShayanjmTEttinger: EC2 is all well and good, but I'd need an interface between the servers. They're not clustered by default
22:38TEttingerah...
22:38TEttingerbotnet?
22:38ShayanjmYeah something like that lol
22:38ShayanjmI'd need some sort of master-slave set up
22:38Shayanjmmaybe I'll just bake my own with RabbitMQ then...
22:38TEttingerI'm sure some russians would be happy to give you one, in exchange for an unspecified future favor
22:39ttasteriscoShayanjm: I would probably try and reorganize the architecture of the system. queueing things and all
22:39Shayanjmttasterisco: the organization isn't the problem because the NLP functions are long-running by default
22:39Shayanjma lot of things -have- to exist in memory at a time because each piece of information builds on the other
22:40TEttingerhow much memory does each box need?
22:40ttasteriscois the scraping/parsing shouldn't be that demanding
22:40ttasterisco*no is
22:40Shayanjmttasterisco: neither of them are. It's the sentiment analysis part of it
22:40ttasteriscois it logic dependent on the SA
22:40ttasterisco?
22:40ShayanjmNah. SA is dependent on the results of a few transforms
22:40Shayanjmwell, the stuff that feeds into the SA function
22:41ShayanjmTEttinger: good q. Right now I'm running it off my MBP with 2GB alloc
22:41ttasteriscowhat are you scraping, if I might ask
22:41ttasteriscoNYT?
22:41Shayanjmttasterisco: a bunch of news sources, not just NYT
22:41TEttingercomments on youtube?
22:41ttasteriscook
22:42Shayanjmcurrently on the list: BBC, NPR, Reuters, CNN, AP, NYT, The Guardian
22:42Shayanjmplanning on adding much more, but already hitting a little bit of a roadblock
22:43Shayanjmarguably, I could reduce total memory allocation to the 'slave' nodes by persisting the trained NN state to something centrally visible
22:43ttasteriscoI mean, if you would reorganize the system and assuming there's no big requirements, you could just get a few boxes scraping/parsing and dumping things into a queue and have some other boxes consume it and do the SA
22:43ttasteriscobut that's just me thinking loud
22:44TEttingerI'm curious if you could distribute it across some really cheap linux devices.
22:44ShayanjmThat would be interesting TEttinger
22:44ShayanjmI imagine spinning up an environment would be fairly expensive for the device though
22:44TEttingerclojure runs on ARM linux, right?
22:57FrozenlockAre there timeouts with ring? Say I upload something via a post request, will ring cut me out after a given time?
23:05dbaschFrozenlock: if you're uploading something via a post request, ring will not know until you're finished with the post. The web server may cut you out before that.
23:06dbaschFrozenlock: ring receives the request from the web server
23:07cespareSuppose I have records R1 and R2, and R1 is defined as (defrecord R1 [^R2 f]). Suppose I have a macro that operates on record instances, and I pass in r (an R1). How can I discover that (.f r) is an R2?
23:07seancorfieldI'm starting to look at ZeroMQ (it's been on my list for a while!) and see there's a "standard" Clojure library, cljzmq, which seems to be "just" a wrapper around the Java API, and there's zmq-async from Kevin Lynagh, which wires ZeroMQ up to core.async which looks very interesting
23:08Frozenlockdbasch: o_O I always believed ring WAS the webserver (and compojure just some sugar on top).
23:08akhudekseancorfield: why not higher level message queues such as hornet or rabbit?
23:08seancorfieldakhudek: because I don't want to deal with the whole server/broker/clustering crap shoot mostly :)
23:09dbaschFrozenlock: the default web server is jetty
23:10wildnuxHi, how can i check what packages are loaded in repl in current namespace
23:10FrozenlockThe tower of abstraction is collapsing all over my me
23:11FrozenlockSo if I get this right, *if* I eventually get a timeout, it will be from jetty. Correct?
23:11seancorfieldI like the idea of just using core.async in my code and having it "magically" spin off to ZeroMQ, but it's not entirely clear what state Kevin's library is in...
23:11ttasteriscoFrozenlock: jetty or any other webserver you use. e.g. you can use http-kit
23:11dbasch,(all-ns) ;; wildnux
23:11clojurebot(#<Namespace clojure.uuid> #<Namespace user> #<Namespace clojure.core> #<Namespace sandbox> #<Namespace clojure.repl> ...)
23:12puredanger(loaded-libs)
23:12akhudekseancorfield: as far as I know zeromq is pretty low level and so you lose a lot of stuff such as durability etc. Guess it depends on your needs though.
23:12wildnuxdbasch: thank you
23:13dbaschwildnux: that's namespaces, if you want libraries it's what puredanger said
23:13ttasterisco,(loaded-libs) ; does this work here?
23:13clojurebot#{clojure.core.protocols clojure.instant clojure.java.io clojure.repl clojure.string ...}
23:13wildnuxpuredanger: thank you,
23:13puredangereither may be useful :)
23:13ttasterisco;nice
23:13seancorfieldakhudek: but you haven't actually used ZeroMQ I gather?
23:13seancorfieldit would be nice to get input from someone who has
23:14akhudekseancorfield: nope, we use rabbitmq which we are more or less happy with. There are some annoyances regarding administering the server though.
23:14seancorfieldpreferably someone who's used both the "official" cljzmq wrapper and zmq-async - and who has previously used more traditional MQ style solutions
23:15hellofunkanyone have any advice on using several tiny, focused atoms vs one large deeply nested atom? which would be better performant or better in practice? i'm using clojurescript if that matters.
23:15ztellmanseancorfield: what are you trying to accomplish?
23:15ztellmantypically ZeroMQ is a nicer TCP
23:15seancorfieldakhudek: I've worked with FioranoMQ and ActiveMQ quite a bit in the past - which is why I'm trying to avoid that sort of thing now :)
23:15ztellmancomparing it to any other "queue" is basic apple to overengineered orange
23:16seancorfieldztellman: yeah, mostly I want a flexible way to communicate between processes (possibly locally, possibly distributed)
23:16Frozenlockhellofunk: I usually prefer using many atoms. It helps my small brain and I can more easily print/save it if needed.
23:16ztellmanseancorfield: how mission-critical are the messages?
23:17puredangerhellofunk: you can't coordinate changes across multiple atoms (all or nothing). not necessarily a problem for many use cases though.
23:17seancorfieldztellman: some are fairly mission-critical (nothing financial tho'), some are really just aggregate log data
23:17Frozenlockhellofunk: If you want to use tools like this one, you should use smaller atoms. https://github.com/alandipert/storage-atom
23:17ztellmanseancorfield: if you care about guaranteed delivery, don't use ZeroMQ
23:17hellofunkFrozenlock thanks, that's what I'm doing now (many smaller atoms)
23:17ztellmanand if you use something other than ZeroMQ for those messages, better to piggyback on that for less important messages unless you everwhelm it
23:17ztellmanoverwhelm*
23:19seancorfieldztellman: my processes are pretty much 100% up so i'm not worried about durability in that respect but delivery guarantees would be rather useful :)
23:19ztellmanprocesses being alive != durability
23:19hellofunkFrozenlock that web storage stuff seems pretty interesting, had not heard of that before
23:20ztellmanor rather, without guaranteed delivery the processes being alive doesn't give you much
23:20ztellmanI'd look at Rabbit et al, honestly
23:20ztellmaneven though they're kinda ungainly and typically pretty overengineered
23:21Frozenlockhellofunk: It's pretty sweet for cross-windows propagation. Here, try this small demo https://peaceful-caverns-2604.herokuapp.com/
23:21seancorfieldztellman: any good clojure library to make jms less painful to work with?
23:21Frozenlock(in many windows)
23:21ztellmanseancorfield: dunno, not something I've had to tangle with
23:22seancorfieldztellman: I thought you'd done stuff with distributed messaging...?
23:22ztellmannot using JMS
23:23seancorfieldah, aleph, is "just" async messaging over a variety of protocols...?
23:23ztellmanaleph is TCP, UDP, HTTP
23:23ztellmanplus a few others that are small layers atop those
23:24dbaschseancorfield: Kafka comes with a java client
23:24seancorfieldztellman: so no guaranteed delivery there either... fair enough...
23:25wildnuxpuredanger: if there are multiple namespaces loaded in repl, does (loaded-libs) show from all of them or just the current one?
23:25seancorfielddbasch: hadn't heard of Kafka... will take a look thanx!
23:25puredangerwildnux:
23:26puredangerwildnux: it shows all namespaces ever loaded
23:27puredangerwildnux: I'm guessing when you say "multiple namespaces loaded in repl" maybe you mean "namespaces that have been 'use'd such that their vars can be used without qualifying"?
23:29wildnuxpuredanger: I am very new :D forgive me if my questions dont make any sense. lets say i loaded a repl, i tried a few expressions in user namespace
23:30puredangerwildnux: no worries. :)
23:30wildnuxpatrickod: and then i loaded another namespace from the app.clj i am working on (in emacs cider using C-c M-n)
23:30wildnuxpuredanger: ^^
23:31wildnuxpuredanger: and if i do (loaded-libs) will it show libraries that is loaded by repl by itself or only the libraries loaded because of my app.clj ?
23:31puredangerwildnux: (you might find this video to be useful http://www.infoq.com/presentations/Clojure-Namespaces-Vars-Symbols )
23:32puredangerwhen you want to dig deeper
23:32wildnuxpuredanger: thank you i will certainly watch it. I have been watching youtube videos to learn clojure
23:32puredangerClojure keeps track of all the namespaces that have been loaded - that's (loaded-libs)
23:33puredangeryou also have a "current" ns - typically that's what your repl says or just look at special var *ns*
23:33puredangera namespace has vars defined in it (things you created with def or defn mostly) - the fully qualified names of those vars is the current-ns/the-var
23:34seancorfielddbasch: Kafka looks interesting - thanx - and not too horrible to manage a cluster of :)
23:34puredangerso if you (def a 1) in user namespace, you created a var referred to by user/a
23:35puredangeryou can refer to vars in namespaces outside your current namespace by using the fully-qualifeid named (things like clojure.string/join)
23:36puredangerfor that to work, the namespace has to be loaded (either already compiled or as source and compiled) - that's what "require" does
23:36puredangeryou can also ask to bring all of another namespaces vars into your own namespace so they don't need to be qualified. that's what "refer" does
23:37puredangeryou may also have seen "use" (generally considered deprecated in the ns macro, but still useful at the repl) - use will require (load the library) and also refer all of the other namespaces symbols into the current ns
23:39puredangerwildnux: hopefully any of that helped expose a little of the underlying model. when you switch to the the app ns, you are just changing *ns* and everything now is in terms of the app ns. vars declared in app available without qualification. if the app ns referred in other namespaces, their vars might also be available without qualification. Any loaded library var is available fully-qualified.
23:41hellofunkanyone know what namespace dissoc-in resides in now? used to be contrib.core but i believe the contrib libraries are deprecated?
23:43puredangerhellofunk: it's not in core. you could get it from medley: https://github.com/weavejester/medley
23:44hellofunkpuredanger: ok. i thought the "old" contrib libraries were migrated to other clojure org libraries, but maybe not all were
23:44puredangerhellofunk: not everything
23:46wildnuxpuredanger: wow, that made it all clear
23:46wildnuxpuredanger: your explanation.
23:50hellofunkpuredanger: i added the medley dependency, restarted cider, then tried this: (refer 'medley.core) but it indicated there was no such namespace
23:51hellofunkpuredanger: nevermind, forgot to load it. got is all now.
23:52hellofunk*it
23:53puredangerwildnux: there are a bunch of functions to explore various aspects of a particular namespace's state - they all start with "ns-" so use (find-doc $"ns-") to see them. most take a namespace so use *ns* for that. happy exploring.
23:54Frozenlock,(find-doc $"ns-")
23:54clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: $ in this context, compiling:(NO_SOURCE_PATH:0:0)>