#clojure logs

2014-06-04

00:33ddellaco_amalloy, right1, alandipert: I don't understand why folks think SQL is such a problem honestly
01:13PhallicQsputnikus
01:13PhallicQWhat is your opinion on state sanctioned executions?
01:15hellofunkPhallicQ are you talking about federal laws for capital punishment? I think you are confusing this room with #closure
01:17PhallicQI don'tknow of any room called #closure
01:17PhallicQhellofunk, but yes, I am talking about capital punishment
01:17PhallicQwhat is your opinion on the pracitce?
01:18hellofunkPhallicQ http://ejusa.org/learn/victims
01:20xy86hi, im toying with using clojure as a compilation target. its bascially an ast and is expression based so very easy to do it to
01:20xy86is anyone familiar with any projects that do something similar and is that approach not completely foolish?
01:21PhallicQhellofunk, let me see.
01:22PhallicQhellofunk, ah yeah
01:22PhallicQretributive justice.
01:23PhallicQA very American concept
01:23PhallicQIn my little scandinavian socialist state, we believe prisons should serve as a means to stop crime from happening, not as a vehicle for vengeance, and it's working fine because hey, there's less crime here.
01:23hellofunkPhallicQ the closure you're looking for is not the clojure we're offering
01:24PhallicQLike I said, I'm not looking of that
01:24PhallicQI know what this channel is about
01:24PhallicQNew scheme without TCO, some-what better type system, worse macroes etc.
01:25PhallicQWell, the type system is weaker.
01:25PhallicQPersistent vectors are cool though
01:25PhallicQFunky data structure.
01:33hellofunkIf I'm running a localhost webserver and I have a println in a function that is running on that server, shouldn't I see the output of that println in the REPL?
01:59amalloyhellofunk: in the thread processing your web requests, *out* is typically not bound to whatever your repl is reading from
01:59hellofunkamalloy ah that probably explains it
02:00amalloyit usually defaults to java's stdout, which will go to a terminal somewhere, or to nowhere at all if some other process started java and then you connected to the repl via another port
02:00hellofunkhow do i get the *out* redirected to the repl, if possible?
02:28hellofunkddellacosta it took a bit of naive hacking but i've got your oauth2 for friend returning the user's email address now, and it works nicely with other friend workflows that also return email address. thanks for all the pointers last couple of days.
03:57hellofunkI'm trying to make a ring route of /login serve a static html file. This doesn't seem to be doing it: (route/files "/login." {:root "./login.html"})
03:58hellofunkpasted a typo. it is: (route/files "/login" {:root "./login.html"})
06:36yotsovcame across this quite neat performance comparison of atoms, refs and similar: http://clojure.roboloco.net/?p=894
06:38yotsovI am surprised that futures are roughly as expensive as refs. For me that makes them suitable only for very specific situations
06:39Glenjaminfutures are 1:1 with threads iirc
06:39Glenjaminso if you create loads, co-ordination overhead will dominate
06:40yotsovI see. but no transactional memory involved with futures, right?
06:40Glenjaminnot as far as i know
06:40yotsovthanks
06:51clgvyotsov: might be due to the configuration of the threadpool for futures
06:52clgvyotsov: actually comparing performance of refs and futures is apples vs oranges
06:53yotsovclgv: I see what you mean. My first reaction was to think futures involve transactional memory in some strange way I wasn't aware of. But of course jvm thread management can lead to such performance if not done correctly too
06:53clgvyotsov: what's the actual comparison over there you are refering to?
06:55clgvyotsov: single futures for very short calculations do have more scheduling effort than benefit. when parallelizing you always need to select the right size of the "work packages"
06:55yotsovPromise/deliver + future creation + destruction 7949 is of the order of what refs do and like 100 times slower than what atoms do
06:55yotsovyes I see
06:56yotsovso it is the jvm threads overhead we see there
06:56yotsovthat's indeed irrelevant
06:56clgvalthough using criterium these benchmarks seem not well planned
06:59clgvthe promise/deliver roundtrip does not make sense without some decent workload.
06:59whodidthisn
07:00clgvyotsov: and why is "3 futures" only done with atoms and not with refs as comparisons - that would actually make sense ;)
07:08yotsovclgv: right... well "general" benchmarking not corresponding to a particular scenario, tends to give not so much insight... this article just got me worried that futures might involve transactional memory in a way I am not aware of
07:09clgvyotsov: no they dont. they are implemented on top of javas threadpoolexecutors
07:09yotsovclgv: yep makes sense now, thanks
07:09clgv$source future-call
07:09lazybotfuture-call is http://is.gd/BkUPBd
07:10visofhi
07:11visofis there a good technique to conver "HelloWorld" to "hello_world" , and the same pattern which the word Start with capital letter so "ClojureIsNice" converted to "clojure_is_nic"
07:11visof"clojure_is_nice"
07:12clgvvisof: split on upper caser letter a join with the wanted delimiter
07:12visof,(clojure.string/split "HelloWorld" #"[A-Z]")
07:13clojureboteval service is offline
07:13visofclgv: that's will drop H and W
07:14clgvvisof: yeah just noticed that
07:16clgv,(require '[clojure.string :as str])
07:16clgv,(str/join "-" (re-seq #"\p{Upper}\p{Lower}*" "ClojureIsNice"))
07:16clojureboteval service is offline
07:16clgvclojurebot: why?
07:16clojureboteval service is offline
07:16clgv:/
07:16clgv&(require '[clojure.string :as str])
07:16lazybot⇒ nil
07:17clgv&(str/join "-" (re-seq #"\p{Upper}\p{Lower}*" "ClojureIsNice"))
07:17lazybot⇒ "Clojure-Is-Nice"
07:18clgvvisof: like that ^^ you just need to lowercase the words to fullfil your full spe
07:18clgv&(str/join "-" (map str/lower-case (re-seq #"\p{Upper}\p{Lower}*" "ClojureIsNice")))
07:18lazybot⇒ "clojure-is-nice"
07:19visof&(str/join "-" (map str/lower-case (re-seq #"\p{Upper}\p{Lower}*" "ClojureIsNiceClgvIsGreat")))
07:19lazybot⇒ "clojure-is-nice-clgv-is-great"
07:19clgvthx :P
08:02ambrosebscan I connect my REPL to a lazybot?
08:05ambrosebsnvm just learnt about reloading.
08:07visofclgv: ping
08:07visof&(str/join "-" (map str/lower-case (re-seq #"\p{Upper}\p{Lower}*" "clojureIsNice")))
08:07lazybot⇒ "is-nice"
08:08clgvvisof: is that an error with repsect to your requirements?
08:08visofi need to get clojure too
08:10clgv&(str/join "-" (map str/lower-case (re-seq #"\p{Alpha}\p{Lower}*" "clojureIsNice")))
08:10lazybot⇒ "clojure-is-nice"
08:10clgvvisof: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
08:16ambrosebs,*clojure-version*
08:17ambrosebs&*clojure-version*
08:17lazybot⇒ {:major 1, :minor 4, :incremental 0, :qualifier nil}
08:17clojureboteval service is offline
08:17ambrosebshmm I'll assume lazybot is stuck at 1.4.0 :(
08:24clgvambrosebs: hit raynes ;)
08:24clgvuntil he changes it ^^
08:25ambrosebsRaynes: trying to get core.typed on lazybot again. Is it feasible to upgrade to clojure 1.5.1?
08:31ambrosebsoh cool, wasn't as hard as I thought.
08:31ambrosebsthere was a tools.reader conflict with core.typed that I misinterpreted as a clojure.core version thing
08:32clgvambrosebs: on to 1.6.0 then? ;)
08:32ambrosebsdoesn't exist for me yet ;)
08:32ambrosebswaiting for CLJS
08:32clgvwhat has that to do with cljs?
08:33ambrosebsmy clojure world is core.typed which depends on cljs
08:33ambrosebsI'm also the only person who tried to AOT compile cljs
08:33ambrosebs*tries
08:33ambrosebsand that doesn't work with 1.6.0
08:34clgvambrosebs: because of the tools.analyzer your world depends on cljs
08:34clgv?
08:34ambrosebsno core.typed checks cljs code too
08:35ambrosebsnot very well yet, but the dependency is there.
08:42rurumate,(into #{} nil)
08:43clojureboteval service is offline
08:43rurumateoh noes
08:43rurumateI wanted to point out that, at least in clojure 1.5.1, (into #{} nil) = #{}
08:43rurumateand (into #{} nil nil) = exception
08:44rurumatewhereas #{nil} != #{}
08:44llasram&(into #{} [] [])
08:44lazybotclojure.lang.ArityException: Wrong number of args (3) passed to: core$into
08:44llasramrurumate: Thus isn't that expected?
08:44llasramboth of `into`s arguments are collections
08:44llasramand it takes only two
08:45rurumateoh,
08:45rurumateright, into takes collection
08:46rurumateI meant (into #{} [nil])
08:46rurumateanyway
08:47rurumateit's a hot day, brainrot sets in
08:47Glenjamin&(into #{} [nil])
08:47lazybot⇒ #{nil}
08:47Glenjamin&(into #{} nil)
08:48lazybot⇒ #{}
08:48Glenjaminseems right
08:48rurumateso lazybot took clojurebots job away?
08:48Glenjaminoh, someone already did that
08:48Glenjaminthey're usually both up
08:48clgv,(println "back again")
08:48clgvhm no, seems not like it
08:48clojureboteval service is offline
08:48rurumatestuck in a loop, clojurebot?
08:49clgvrurumate: he got timeouts for that ;)
08:50rurumate&(into {} [nil [1 2] nil]
08:50lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
08:50rurumate(into {} [nil [1 2] nil])
08:50rurumate&(into {} [nil [1 2] nil])
08:50lazybot⇒ {1 2}
08:51rurumatemaps are special
08:51clgvrurumate: well what should be done with nil?
08:51clgv&(into {} [[nil nil] [1 2]])
08:51lazybot⇒ {nil nil, 1 2}
08:51rurumateit's understood, map conj takes 2-vec or nil
08:52clgvyou need at least key value pairs
08:52rurumateit just takes a bit of getting used to
08:52rurumate&(conj {} nil)
08:52lazybot⇒ {}
08:52clgv&(into {} [{:a 1 :b 2} {:a 42 :c 3}])
08:52lazybot⇒ {:a 42, :b 2, :c 3}
08:53rurumate&(into {} (remove nil? [nil [1 2] nil [3 4]]))
08:53lazybot⇒ {1 2, 3 4}
08:54rurumatethe remove is not needed, is what I used to do
08:56Glenjamin&(conj {} nil)
08:56lazybot⇒ {}
08:56Glenjaminthat's what into does under the hood
09:35martin_I'm looking for something similar to https://github.com/Leonidas-from-XIV/node-xml2js, but for Clojure. I want a more "natural" (for lack of a better word) data structure than the one clojure.xml/parse provides
09:35clgvrurumate: concerning that "remove" you mentioned - it is likely that the sequence resulted from a "map" and you could just switch to "keep" to throw away all nil values
09:40rurumateoh, thanks clgv I had not known about keep
09:41martinklepschmartin_, looked into enlive?
09:41martinklepschmartin_, what do you want to achieve?
09:44martin_martinklepsch: to transform a xml datastructure (e.g. merge attributes) into something that can be rendered as json
09:45martinklepschmanually selecting the elements from the XML or in general for various different xml snippets?
09:54martin_martinklepsch: I'm thinking there's a general solution for it, but maybe there isn't. Example: https://gist.github.com/martinp/8a3bfc85d6f98bd55551
09:55martinklepschmartin_ I've been working with XML a lot recently and that zipper structure is pretty clever actualyl
09:56martinklepschmartin_, in your example, where does the potential content of a tag go?
10:00martin_martinklepsch: ideally, they would be merged with :attrs as values of the associated tag name (:bar in the example), but then need to figure what do with duplicate keys and multiple values (when :content has more than one child)
10:01martin_so maybe the only solution is to do something more explicit with the zipper structure
10:02martinklepschmartin_ Whats your end goal here? do you want to obtain specifc data or rather convert a complete structure?
10:03martinklepschmerged with attrs means: {:more-test "abc" :test "xyz" :content "ovw"} ?
10:03martinklepschI tried doing something similar and most of the time I just noticed that I was missing a case in how XML can be structured that then broke my attempt
10:03martin_martinklepsch: yes
10:05arrdemoh good clojure.core/when-let is a thing
10:13lvhhow do I add things to a leiningen project that don't have formally released versions?
10:13clgv&(:since (meta #'when-let))
10:13lazybot⇒ nil
10:13clgv&(meta #'when-let)
10:13lazybot⇒ {:macro true, :ns #<Namespace clojure.core>, :name when-let, :arglists ([bindings & body]), :added "1.0", :doc "bindings => binding-form test\n\n When test is true, evaluates body with binding-form bound to the value of test", :line 1687, :file "clojure/core.clj"}
10:13clgvarrdem: since 1.0 ;)
10:13arrdemclgv: all these nice little pseudo-pattern matching constructs :P
10:13clgvlvh: you dont - since no one once to shoot himself in the foot
10:14clgvs/once/wants/
10:14lvhwell, I'd like to do some network simulation
10:14lvhhttps://github.com/aphyr/timelike seems like it's a pretty decent start
10:14clgvlvh: usually I upload them under a version into a repository
10:14lvhso I run a repository of my own?
10:15clgvlvh: if the artifact is allowed to be public you upload it to clojars.org with a private group name
10:15clgv+can
10:16lvhclgv: I have no idea how that works but I guess I'm about to find out :)
10:17cemerickgfredericks: you pinged?
10:18clgvlvh: easiest way in this case. checkout the git repo change the project name to org.clojars.lvh/timelike maybe choose a different number. use "lein install" and then scp the pomx.xml and the jar to clojars@clojars.org
10:19clgv"version number"
10:19lvhclgv: awesome, thanks!
10:19clgvlvh: you need an account on clojars though and register you public ssh key overthere
10:20clgvlvh: alternatively use "lein deploy" instead of the scp approach but make sure you read its documentation
10:20lvhoh hay, there's actually a timeline clojar already
10:20lvhhttps://clojars.org/timelike
10:20clgvlvh: even better :D
10:20lvhunfortunately it's [timelike "0.1.0-SNAPSHOT"]
10:21lvhso I have no idea what version that actually is
10:21clgvlvh: that's the version that is on github
10:21lvhclgv: yeah, but isn't that also the default that you get when you lein new?
10:21lvhclgv: I'm suggesting there's lots of commits that have that version in project.clj
10:22lvhso I don't actually know that the thing on clojars is the thing that's currently git master, right?
10:22lvh(I'm really sure they've diverged because there's more recent commits on github, but only by a few days)
10:22clgvlvh: yes thats correct. usually you should make a 0.1.0 release when you think you covered most basic functionality...
10:22lvhI probably don't care too much though :)
10:22lvhclgv: Thanks a lot, that was super helpful!
10:23clgvlvh: if you need the most recent you'll have to build and upload it yourself or contact aphyr to do that ;)
10:38dabbelingCLjany LT users here?
10:38arrdemthere are a few here, and more in #lighttable :P
10:39stompyjI used to, but I’ve gone away from it recently
10:39dabbelingCLjstompyj: what do you use instead?
10:39stompyjsublime text 3
10:40dabbelingCLjthats mac only right?
10:40stompyjalthough, my goal is to give IDEA + Cursive a good run
10:40scriporit's for windows, too
10:40stompyjno, it’s for all three platforms, win, mac & linux
10:40scriporhow is clojure support on ST3?
10:40dabbelingCLjhow do you setup developement?
10:41stompyjmmmmm. the nrepl stuff isn’t great, tbh
10:41rurumatewhat's a good string templating library for clojure? something ala stringtemplate, but easy?
10:41stompyjdabbelingCLj: but I have a weird dev setup atm. I do most of my coding in ST3 and just refresh the page to see whats happening
10:41stompyjI also have tests setup to run after every save
10:42stompyjand I do just keep a REPL open for prototyping functions
10:42rurumateAre there any reasons to not just use emacs?
10:42cbpUh I can't tell what stringtemplate is like from its page but I always use selmer for templating
10:42stompyjrurumate: I think if you haven’t invested 18 years in VI like I have, then no
10:42stompyjbut for me, its probably nto worth the cost
10:43stompyjI run ST3 in VIM mode
10:43rurumatestompyj: it's definitel worth a try
10:43stompyjand all my external boxes have vi on them
10:43rurumateemacs and lisp go pretty well together
10:43stompyjrurumate: I’ve used emacs quite a bit in college
10:43cflemingrurumate: Yeah, but the learning curve is steep
10:44cflemingrurumate: And I think other options are good now too
10:44stompyjrurumate: our infrastructure is clojure, java, javascript, and ruby, it wouldn’t be prudent to optimize for clojure, when it’s 3% of my codebase
10:44rurumatethere's another catch about emacs: it's even steeper when you have a non american keyboard layout
10:44cfleming(full disclosure: I develop Cursive, so I'm biased)
10:44stompyjand as I said, I’ve been using vi for close to two decades
10:45stompyjcfleming: awesome. Thats where I want to be in hte next year or so, I love what you’ve done so far
10:45rurumateok, I see the editor subject is a bit loaded
10:45cflemingstompyj: Yeah, those keyboard shortcuts really get down into the reptilian hindbrain after that long
10:45cflemingstompyj: Thanks! Lots of cool things coming too.
10:46cflemingstompyj: IntelliJ is probably a good fit for that language mix, too.
10:46stompyjThats my goal
10:46stompyjGetting back to a “Real IDE"
10:46stompyjand IntelliJ seems pretty great
10:47cflemingUnfortunately IdeaVim has some rough edges with Cursive (and other language consoles)
10:47cflemingYeah, IntelliJ is amazing.
10:47cflemingIt's one of my favourite pieces of software ever.
10:47stompyjrurumate: I appreciate the sales pitch, didn’t mean to come off as harsh, just that this decision has been carefully considered :)
10:47stompyjWhat IdeaVim?
10:48cflemingThe Vim bindings for IntelliJ
10:48stompyjAhhh ok
10:48stompyjthats actually not so bad, For years I split my brain between “Hardcore IDE” for either .NET or Java developement and VI for everythign else
10:48stompyjso when I see a blank editor my mind goes vi
10:48cflemingI'm working with the developer to try to improve the Vim support in consoles.
10:48stompyjand if I see GUI, I think IDE
10:49mercwithamouthi change every 3-4 months
10:49cflemingHehe
10:49stompyjdabbelingCLj: LT is pretty great tho, you should check it out
10:49stompyjmercwithamouth: lol
10:49arrdemmercwithamouth: someone doesn't use editor level keybindings :P
10:50cflemingYeah, for getting started easily LT is really nice, especially for cljs
10:50tsmarshI’ve been writing more and more clojure recently, but I’m a Java developer, so I fear I might be using protocols as a crutch. Is there a good resources on when to use protocols vs how?
10:50stompyjmercwithamouth: you’re killing me. Deadpool is one of my favorite comic book chars
10:50stompyjand now I wonder what he’s been up to :/
10:51cflemingtsmarsh: Check out the Clojure Programming book - the chapter on protocols/records etc is nice.
10:51pandapoolaw crap someone already registered this :P
10:51cflemingTalks in particular about when to choose records over maps etc.
10:51dabbelingCLjstompyj: I just tried and got weird issues :/ thats not helping when learning a new language
10:51stompyjdabbelingCLj: ahhh. got it :/ sorry to hear that
10:52irctcWhich concurrency primitive should I use if I want to limit a function concurrent execution of pmap? I want to use pmap on a function say downloadfile but I only want a max of 4 concurrent execution at any one time. Any suggestions? Thank you!
10:52stompyjI’ve yet to use protocols/records. I think my clojure code is probably remedial
10:52arrdemirctc: use a real ratelimiter rather than complecting your parallel function call operation with rate limiting
10:52stompyjheh
10:53irctcWhat is a real ratelimiter? Are there any implementations?
10:53arrdem$google clojure rate limiting github
10:53lazybot[jkk/rate-gate · GitHub] https://github.com/jkk/rate-gate
10:53irctcThanks!
10:54hhenkelHi all, I'm trying to read multiple yaml files and the want them to merge in a "single tree". Anyone aware how to do that?
10:54tsmarshthanks.
10:55hhenkelI'm using clj-yaml
10:55arrdemhhenkel: custom recursive tree merge?
10:55tsmarshProtocols just don’t feel very functional, they’re awesome, but somehow it feels like cheating. I think I’m using them correctly according to the examples. Thanks again
10:56hhenkelarrdem: Pardon? :)
10:56arrdemtsmarsh: how are they cheating... as long as your protocol is pure, the protocol methods themselves are first class and life's good.
10:56arrdemtsmarsh: if your protocol isn't pure, then you're just being silly
10:56arrdem(doc merge)
10:56clojurebot"([& maps]); Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result."
10:57tsmarshbecause the look up isn’t the same as everything else. You look up the function on the first argument, rather than in the namespace.
10:58arrdemhhenkel: (-> (text ← yaml) (λ yaml → map) (λ map → map) (λ map → yaml) (λ yaml → string))
10:58llasramtsmarsh: The protocol function still exists in the namespace. It just performs implementation dispatch based on that first argument...
10:58tsmarshahhhhhh, thats the bit I was missing. That makes so much sense. Thank you
10:58hhenkelarrdem: okay, that sounds reasonable. Only problem I see is that I use hooks in yaml so I guess I need to load all files first, then parse them with clj-yaml (snakeyaml).
10:58arrdemtsmarsh: that's not inherently imperative at all, you're just dispatching differently than a normal function.
10:59llasramarrdem: That said, if you're writing lots of protocols then `deftype`s which implement those protocols, then there probably is a better way :-)
11:00tsmarsharrdem, it wasn’t imperative that worried about so much as OO.
11:00martin_given [{:a {:c 2, :b 1}} {:a {:c 3, :b 4}}], what would be good way to transform it into {:a [{:c 2 :b 1} {:c 3 :b 4}]}?
11:00arrdemllasram: yeah. my first compiler abused the crap out of deftype and protocols T_T
11:00arrdemtsmarsh: oo isn't somehow not functional so long as it's pure and the methods can be taken as values...
11:01arrdemtsmarsh: then it's just record oriented programming :P
11:02tsmarsharrdem, agreed, more that I’m trying to learn to be a better functional programmer, but I fall back in to what I’d concider to be OO. My OO strives to be as pure and immutable as possible, so I guess I shouldn’t be too suprised at the similarities between my Java and my Clojure
11:03llasramtsmarsh: Do you have any code you can share for specific patterns you're concern about?
11:05tsmarshllasram, not yet. I was about to go in and extend a small project I was working on, and protocols seemed like a good fit. I just wanted to get a sense of “am I writing Java in Clojure”. I’ll share when I’ve checked it in
11:05justin_smith,(apply merge-with vector [{:a {:c 2, :b 1}} {:a {:c 3, :b 4}}]) martin:
11:05clojurebot{:a [{:c 2, :b 1} {:c 3, :b 4}]}
11:06justin_smithmartin_: that is ^
11:07martin_justin_smith: beautiful, thank you
12:03rurumatequick, what are '[#_foo] and '#_foo
12:04rurumateor (quote #_foo)
12:05philandstuffwell #_ is a reader macro that discards the next form
12:05philandstuffso (quote #_foo) reads as (quote)
12:05bbloom... why does it need to be so quick?
12:05rurumateyes, that's correct!
12:05rurumateso you don't cheat and try it in the repl
12:06philandstuffthat's not cheating?
12:08llasramI didn't realize we were being quizzed on how well our collective mental model of Clojure matched the implementation(s)
12:08llasramAre there prizes and/or punishments?
12:12martin_justin_smith: any way to do it for a vector with more than two elements?
12:13stompyj(inc llasram)
12:13lazybot⇒ 25
12:13arrdemllasram: why would we need rewards when we have internet points!
12:13arrdem(inc llasram)
12:13lazybot⇒ 26
12:13arrdem(dec so)
12:13lazybot⇒ -26
12:17PigDudealiasing something from antoher namespace .. now i have (def ^{:doc "Docs.."} foo some-ns/kazoo), is that right?
12:17PigDudeit works of course
12:17llasramPigDude: Why do you need to do that?
12:17PigDudellasram: i want all API in core
12:18PigDudellasram: it's a python idiom i think but i think it applies here? dunno
12:18llasramztellman wrote https://github.com/ztellman/potemkin to help with that, but
12:19llasramI think the general consensus is that it's better to just keep the implementation and interface namespace divisions the same
12:19justin_smithmartin_: merge-with is varargs, so any number of maps in the vec will work
12:20kschraderanybody know an easy way to print out all of the compojure routes defined in an app?
12:21justin_smith,(apply merge-with vector [{:a {:c 2, :b 1}} {:a {:c 3, :b 4}} {:a {:c 4}}]) martin_
12:21clojurebot{:a [[{:c 2, :b 1} {:c 3, :b 4}] {:c 4}]}
12:22justin_smithoh wait, that is structured oddly isn't it
12:24cbpPigDude: nitpick, you can do (def foo "Docs.." ..)
12:28justin_smith,,(apply merge-with (fn [a b] (if (vector? a) (conj a b) (vector a b))) [{:a {:c 2, :b 1}} {:a {:c 3, :b 4}} {:a {:c 4}}]) martin_: there may be a cleaner way to do this, but this works
12:28clojurebot{:a [{:c 2, :b 1} {:c 3, :b 4} {:c 4}]}
12:29justin_smithbut that does end up failing if any of your initial vals are vectors...
12:30PigDudecbp: oh cool, didn't know that
12:31dbasch,(apply merge-with (fn [& args] (into [] args)) [{:a {:c 2, :b 1}} {:a {:c 3, :b 4}} {:a {:c 4}}])
12:31clojurebot{:a [[{:c 2, :b 1} {:c 3, :b 4}] {:c 4}]}
12:31dbaschsame problem
12:35justin_smithdbasch: I think the right way is to wrap all vals of the first arg in vectors, and then merge-with conj, wrapping any new keys in vectors - which makes me think merge-with is not the right way to do this
12:35justin_smith*any vals of new keys
12:38llasram,(->> [{:a {:c 2, :b 1}} {:a {:c 3, :b 4}} {:a {:c 4}}] (apply concat) (reduce (fn [m [k v]] (update-in m [k] (fnil conj []) v)) {}))
12:38clojurebot{:a [{:c 2, :b 1} {:c 3, :b 4} {:c 4}]}
12:39ambrosebsBronsa: can you attach the evaluated result to the AST in analyze+eval ?
12:39arrdemjustin_smith: no that's still fine, it just becomes (fn [[x & more]] (reduce (partial merge-with conj) (map-vals vec x) more))
12:40dbasch,(apply merge (vals (group-by keys [{:a {:c 2, :b 1}} {:a {:c 3, :b 4}} {:a {:c 4}}])))
12:40clojurebot[{:a {:c 2, :b 1}} {:a {:c 3, :b 4}} {:a {:c 4}}]
12:40dbaschI don’t know what the original request was
12:40arrdemambrosebs: I don't think t.e.jvm has that out of the box, but I may be wrong.
12:40ambrosebsarrdem: that's a feature request :)
12:41arrdemambrosebs: :P
12:41arrdem(doseq [maintainer lurking-maintainers] (inc maintainer))
12:41ambrosebsoh I forgot to say please!
12:42Bronsaambrosebs: sure, any idea for the field name? :eval-ret?
12:42arrdemBronsa: :result
12:42Bronsaarrdem: that's better, yeah
12:43dbaschit looks like the bot that logs this channel is not running http://clojure-log.n01se.net/
12:45arrdemas long as we're bugging Bronsa...
12:45Bronsaambrosebs: https://github.com/clojure/tools.analyzer.jvm/commit/37679c74039507042050f88bb25eac362d595d00
12:46Bronsaarrdem: :)
12:46arrdemBronsa: I don't know if preserving the raw input from macroexpand through eval is something you'd consider a feature, but I hacked it in for Oxcart. https://github.com/arrdem/oxcart/commit/ad55c112547712367890456e578d671636d5447e
12:46arrdems/eval/analyze/g
12:47Bronsaambrosebs: I'm probably gonna cut a 0.2.0 later today with the new env stuff
12:47ambrosebslooks good
12:47ambrosebsyou mean with t.a.js?
12:48ambrosebsunaware of env stuff in t.a.jvm
12:48Bronsaambrosebs: no, t.a.js is not ready for a release yet
12:49Bronsaambrosebs: the next releases of t.a and t.a.j will include a breaking change, I moved :namespaces from :env to a global env/*env*
12:49ambrosebsoh very nice
12:49martin_,(apply merge-with (comp flatten vector) [{:a {:c 2, :b 1}} {:a {:c 3, :b 4}} {:a {:c 4}}])
12:49clojurebot{:a ({:c 2, :b 1} {:c 3, :b 4} {:c 4})}
12:49Bronsaambrosebs: that's for the sake of unifying behaviour between t.a.jvm and t.a.js
12:49martin_justin_smith: ended up with that one ^
12:50justin_smithoh, cool - except flatten sucks
12:50justin_smith~flatten
12:50clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
12:50Bronsaambrosebs: also it makes more sense to have the namespaces map in an env that can be shared between different analyze calls
12:51martin_justin_smith: I see :)
12:51ambrosebsah true.
12:51justin_smithmartin_: same problem as the (if (vector? a) ...) version - it loses structure
12:51Bronsaarrdem: re: :raw-form, sure, I'd take a patch for that
12:52arrdemBronsa: the issue is that it sits weirdly in the macroexpand/analyze pipeline because it needs to jump over macroexpand and I don't think you expose a macorexpand+analyze fn.
12:53arrdemBronsa: you're welcome to it, I just don't think of where it would fit offhand.
12:57PigDude(RT.java:505)
12:57PigDudeof course!
12:59PigDudehangs the tests too
13:00PigDudemy test suite has stopped reportnig errors
13:00PigDudeit reports the line location but not the sort of error, and hangs
13:03justin_smithhttps://www.refheap.com/86275 martin_: finally a version that preserves all incoming structure, just couldn't figure out how to do it as a one liner
13:04Bronsaarrdem: http://sprunge.us/BWIE what do you think?
13:04justin_smithit's probably more verbose and simultaneously more obtuse than it needs to be, but it is the first version that is actually correct if any v in the incoming maps is already a vector
13:04justin_smithalso it is bad because it walks all the keys of all the maps twice
13:09arrdemBronsa: works for me
13:09arrdemBronsa: thanks!
13:09UrukQ: lein seems to ignore my $http_proxy and $https_proxy. Running netstat/wireshark while running lein deps shows it's trying to direct connect. Anything else to check? How do you get lein to respect $http_proxy?
13:09arrdemUruk: ask in #leiningen probably...
13:10Urukarrdem: will do, thanks
13:10arrdemdunno if tech is lurking yet but he's more likely to give support over ther.e
13:10PigDudeso, this is a problem i could use some help with
13:10PigDudewhy my test suite is not showing errors, and hangs instead?
13:11Bronsaarrdem: np https://github.com/clojure/tools.analyzer/commit/6042cd3b25ad7e6a597e7fcf3bd0ddb8c6159a54
13:11technomancyUruk: all the proxy stuff has been contributed; I don't think anyone on the maintainer team is familiar with it
13:11arrdemBronsa: wait, what on earth is your :raw-forms doing? O
13:11PigDudei am invoking tests with `lein test` and cleaned my project to make sure there was nothing untoward
13:11arrdemBronsa: oh it's a seq of every step of macroexpand-1.
13:11Bronsayeah
13:11arrdemBronsa: solid!
13:11MagBo[MURT]hi. I can't figure out if *symbol* has any special meanong
13:12MagBo[MURT]meaning*. I mean those asterisks
13:12PigDudethis is making it extremely difficult to fix bugs found by these tests, because i only get a file and line number
13:12PigDudein certain cases i get a RT.java line number instead
13:15justin_smithmartin_: updated to only walk the input once https://www.refheap.com/86275
13:16PigDudei have a hunch there is an infinite loop in a test here, and that clojure test runner does not report (see?) the exceptions until some later point in the test execution
13:16PigDudewhat do you do about this?
13:18MagBo[MURT]the more docs I read the more I thknk that a symbol in asterisks denotes something semantically but isnt enforced by reader.
13:18justin_smithPigDude: maybe spawn a thread alongside the test that throws an exception after some timeout, and manually stop that thread when the individual test completes
13:19justin_smithPigDude: that way the exception can tell you which test spawned the thread that timed out and threw an exception
13:19justin_smithPigDude: I bet core.async would make this very easy to do
13:19PigDudebut this is a bug right?
13:20justin_smithPigDude: sounds like a bug in your test
13:20justin_smithhow should the test runner no a-priori how long a test has to run?
13:20justin_smith*know
13:20PigDudeoh because i feel like a test runner that emits ERROR in (test-events-out-of-order) (MultiFn.java:160) Uncaught exception, not in assertion. expected: nil
13:20PigDudeand then hangs while not showing a known exception
13:20PigDudeis buggy
13:21justin_smith,(def *x* 'should-be-special) MagBo[MURT]
13:21clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
13:21justin_smithMagBo[MURT]: anyway, if you run that above in your local repl, you will see the warning: "Warning: *x* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *x* or change the name. (NO_SOURCE_PATH:1)"
13:22MagBo[MURT]justin_smith: got it, had a hunch that it denotes some warning-level semantics.
13:23justin_smithMagBo[MURT]: right, and you would see that warning if any lib you used made a *foo* that was not ^:dynamic
13:23MagBo[MURT]got it, thanks.
13:24MagBo[MURT]i wonder if it's reflected in the docs.
13:25justin_smith,(meta #'*1)
13:25clojurebot{:ns #<Namespace clojure.core>, :name *1, :added "1.0", :file "clojure/core.clj", :column 1, ...}
13:25justin_smith,(:dynamic (meta #'*1))
13:25clojurebottrue
13:25MagBo[MURT]really difficult to search for all these arcane modifyers and while #, ^ and so on are really well documented, i didnt see anything about **.
13:26justin_smithMagBo[MURT]: we call them earmuffs http://dev.clojure.org/display/community/Library+Coding+Standards
13:27ambrosebsBronsa: just happened to have some calls to update-ns-map! in core.typed.
13:27MagBo[MURT]justin_smith: <3 thanks for the link
13:28Bronsaambrosebs: remove the env argument and it will work as before
13:29ambrosebsok
13:30BronsaI could have left the argument as a no-op to avoid breaking compatibility now that I think about it
13:32BronsaMagBo[MURT]: note that ** are not modifiers, *foo* is just a regular symbol
13:33ambrosebsI guess.
13:43Glenjaminhttp://yobriefca.se/blog/2014/05/19/the-weird-and-wonderful-characters-of-clojure/
13:44jcromartie1I have a lot of issues with the terminology of that article
13:45Glenjaminthe bit at the top about not having a good reference point for hard-to-google symbols is valid though
13:45jcromartie1yes
13:45jcromartie1except http://clojure.org/reader
13:46Glenjaminmm, but not everything ungooglable is part of the reader
13:49ambrosebsBronsa: could t.a.jvm make this a little easier to write? Just a macroexpand-1 that provides a map of macro overrides https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/analyze_clj.clj#L82
13:49justin_smithis there a version of pcalls which reorders the results based on which one returns first?
13:49ambrosebsunsure if it's common enough to support.
13:50justin_smithie. so that (first (race-pcalls ...)) would always give the result of the fastest calculation
13:52Glenjamini'm not sure how you'd implement that
13:52Glenjaminwould need another thread checking results of the worker threads?
13:53Glenjaminor some sort of channel
13:53justin_smithGlenjamin: I am working on a version with a promise and futures racing to fill the promise right now
13:53justin_smithjust figured it might already exist
13:53Glenjaminhow do you know which promise is ready?
13:53justin_smithboth futures want to deliver the same promise
13:53justin_smithfirst one wins
13:53Glenjaminoh, i see
13:53justin_smiththe other gets cancelled
13:54Glenjaminif the future completes and the promise is already taken, it tries the next one?
13:54pjstadighave the pcalls conj into an atom containing a vector
13:54justin_smithahh, not directly using the result
13:54justin_smithbut I like the idea of cancelling the calls that are not done yet
13:55cbpjustin_smith: that sounds like alts!! with the cancelling
13:55justin_smithcbp: yeah, but I was hoping I could do something simple that did not require pulling in all of core.async
13:55justin_smithwhich may be folly, finding out now
13:56faustrollI'm fiddling with logging
13:57faustrollI like the thinking behind clj-logging-config
13:57faustrollbut it seems not to have caught on and not been introduced into clojure.tools.logging
13:58Bronsaambrosebs: I guess you could do something like http://sprunge.us/WjjJ
13:58faustrollIt looks as if when folks are using logback they are fiddling with xml?
14:00faustrollany thoughts on logging in a clojure way?
14:00justin_smithfaustroll: I had really bad luck trying to make any of the clojure wrappers for java logging stuff behave in a nice clojurey way (ie. runtime config that did not depend on global settings and did not require mucking with xml)
14:00justin_smithfaustroll: this could have just been a sign of my impatience or ignorance though
14:02faustrolljustin_smith: I hear you. I'm feeling the pain right now
14:02faustrolljustin_smith: clj-logging-config looks like a noble attempt
14:03justin_smithif you can stomach a single global config, timbre is the least yucky https://github.com/ptaoussanis/timbre
14:03faustrolljustin_smith: but it seems not to have been updated for slf4j
14:04justin_smithor maybe I mean most-clojurey, which to me is least-yucky
14:04llasramIf all you want out of logging is to get lines tagged with the log level to go out via STDERR, clojure.tools.logging is fine
14:04llasram(and since IMHO that's what you usually really want from logging...)
14:04arrdemtools logging is fine, but timbre is a little nicer for leightweight use.
14:05arrdemdefinitely not a lightweight lib tho.
14:05llasram"Hey, there sure are a lot of JVM logging libraries. I know how to solve this -- I'll write another one!"
14:05arrdem(inc llasram) ;; the lisper's curse strikes again.
14:05lazybot⇒ 27
14:05faustrollthanks so much for all the responses
14:05llasramtools.logging at least is just a facade which works over whatever Java library logging facility you are probably already using
14:05arrdemllasram: but xml is nasty and evil...
14:06arrdemambrosebs: lol @ swift static types
14:06llasramI use it with slf4j+log4j and a ~5 line property file
14:06llasramNo XML in site
14:06llasramer, sight
14:06faustrollarrdem: i'd love to avoid xml
14:06llasramWe do have *some* XML at our site :-)
14:07faustrollllasram: as long as no human has to read it
14:07llasramOf course
14:07llasramlog4j's property file configuration is pretty human-friendly IMHO
14:08faustrollllasram: the libraries I am using are already using logback
14:08llasramAre they directly using logback, or are they using that as the default via slf4j?
14:08cbpjava config files are pretty tame compared to RPC things
14:09faustrollllasram: I'd like a clojurey way of programmatically setting log levels in different contexts
14:09llasramEr. Why?
14:10faustrollllasram: very noob here. but I want to quiet logs during testing
14:10llasramThen you don't want programmatic setting of the log level -- you want test configuration which sets the log level :-)
14:11faustrollllasram: lol! yes. I want to quiet the logs while testing in Storm
14:12arrdemso just load a different log config as part of testing...
14:12llasramfaustroll: Do you mean you want to change the log level of a Storm cluster while doing some sort of integration testing, or just change the log level while running local tests?
14:12faustrollllasram: local tests
14:13faustrollllasram: I modified a with-quiet-logs function
14:13llasramI see
14:13faustrollllasram: and it worked with log4j
14:14eraserhdOK, so if I 'lein install' and it puts a jar in ~/.m2/repository, I'm supposed to be able to use it from another project, right?
14:14llasramWhat I'd do instead is add a `test-resources` directory and Leiningen :test profile :resource-paths entry, then include a separate logging config
14:14justin_smitheraserhd: if you require the right group / artifact
14:14llasramIt will only apply when running `lein test` (vs running tests in your REPL), but that's usually what I personally want anyway
14:14faustrollllasram: thanks for the suggestion
14:15eraserhdjustin_smith: Well, I'm definitely doing that, I just bumped the version in the requiring project.
14:15jcromartie1I'm really liking Cursive.
14:15justin_smitheraserhd: that is to say, if you add the right group / artifact in your deps (sorry for the sloppiness)
14:15eraserhdOh, doh. No I don't. Weird internal version messiness.
14:15faustrollllasram: Storm moved on from log4j to slf4j and my previous function is no longer useful
14:16justin_smitheraserhd: yeah, lein install is pretty simple, so any problems are usually just not getting the group / artifact right
14:16faustrollI looked at the way pallet implemented logging and I liked it
14:17dgleesonI have a question about ring middleware. So I'm still pretty new to clojure, so this might sound like a dumb question. In all the examples of middleware I see that the first thing that happens is an anonymous function that takes a request. I'm not sure I understand where the request is coming from.
14:18gtrakdgleeson: check out the jetty servlet adapter.
14:19gtrakhttps://github.com/rmarianski/ring-jetty-servlet-adapter/blob/master/src/ring/adapter/jetty_servlet.clj#L14
14:19eraserhddgleeson: middleware returns an anonymous function which accepts a request.
14:20dgleesoneraserhd: Ah, ok, that makes sense!! thanks
14:20gtrakdgleeson: and that calls this to build the request map: https://github.com/mmcgrana/ring/blob/master/ring-servlet/src/ring/util/servlet.clj#L149
14:20eraserhdSo it's like (defn wrap-x [x] (fn [req] (x req)))
14:20dgleesongtrak: also, thanks for the backgroudn!
14:20gtraknp!
14:21eraserhdSo what happens when project x requires version A of z, project y requires version B of z, and project x requires project y (in leiningen)?
14:22gtrakyou get to learn about lein exclusions
14:23eraserhdIs it an error? Or is the result "undefined"?
14:23doritostainsI'm loading a schema in a datomic mem db, ~900 lines, and I get a "Method code too large" error. Is there a limit to how large a transaction can be or would there be something I should look in to?
14:24technomancyeraserhd: depth in the dependency tree determines it; if there's a tie then the first one wins
14:26faustrollllasram: I'm looking a logback docs now
14:26faustrollllasram: I see that logback first looks for a logback-text.xml
14:27llasramfaustroll: If they're using slf4j, you *can* use log4j instead of logback if you prefer it. You just need to add exclusions for the logback and slf4j logback bindings and include the log4j ones
14:27jcromartie1how many people here use Emacs in OS X from the terminal vs Emacs.app
14:28eraserhdtechnomancy: Oh, cool.
14:28eraserhdtechnomancy: Thanks.
14:29PigDudeis there a shorthand for (fn [& [first-arg]] (f first-arg))? i.e. (single-arg-fn first-arg) ..
14:29faustrollllasram: thanks. I'm okay with logback. I'm building this with forward compatibility in mind
14:29PigDudei find i define functions like that for multimethods
14:30llasram,((partial count) [1] :whatever :else)
14:30clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/count>
14:30justin_smithPigDude: why not (fn [arg & _] (frob arg))
14:30llasramHa, what was I thinking
14:30faustrollllasram: If Storm is moving on to logback, then logback it is for this project
14:31justin_smithPigDude: or is the intention that with no args first-arg would be passed on as nil?
14:31PigDudejustin_smith: well, it's for instance if i had a multimethod that dispatched by identity in some cases, identity only accepts one arg
14:32PigDudejustin_smith: but method implementations should be able to work with however many args
14:32justin_smithI think (fn [arg & _]) is more explicit about taking multiple args and only using the first
14:32justin_smithto me the fact that zero args becomes an error is a bonus
14:33PigDudehm that's a good point
14:33PigDudebeing same length, i used theone without the dummy binding _, but they do behave differently
14:34justin_smithPigDude: https://www.refheap.com/86280 a simple error-if-it-took-too-long function
14:35justin_smith(timed 10 #(reduce *' (range 1 10000N))) => AssertionError Assert failed: completed in a timely manner: 10ms G__1837 user/timed (NO_SOURCE_FILE:7)
14:36justin_smithcould be trivially updated to pass in a string to include in the assert message
14:40devnThere has to be a better way to do this: https://gist.github.com/devn/09f17059c55c01f85922
14:41amalloydevn: java.lang.String is just String
14:41devnamalloy: sure, just qualifying it along with java.io.File
14:42dbaschmy name is String. java.lang.String.
14:42llasramdevn: If you really want to use some `*client*` dynamic, make the multimethod e.g. `as-page!*` and dispatch only on the non-WebClient argument. Then you can have `as-page!` be a function which accepts either arity and delegates to `as-page!*`
14:43devnllasram: yeah, i was heading that direction, but i wondered if there was a simpler option i was missing. that seems like the right thing to do though
14:44devnllasram: much obliged for the input
14:44llasramWell, ditching the default dynamic var argument would make it even simpler :-)
14:46devnllasram: yeah, but i don't wannnnnaaa :D
14:48tickingI really wonder what would be possible if all clojure code was just EDN instead of a superset.
14:49tickingYou could manage the code in a database and send it of to different compilers that run as services on different platforms
14:49dbaschticking: the same but less concise
14:50tickingdbasch: well you could tell your IDE to manage syntactic sugar for you
14:51amalloyi'd be sad to lose #(% x)
14:51amalloyugh, and having to write (quote x) instead of 'x
14:52amalloyand syntax-quote
14:52tickingamalloy: why not have a rule in your editor that automatically displays short fn s as #(, same goes for '
14:53arrdemticking: because nesting #() isn't legal and therefore rewriting fns to #() isn't generally sane,.
14:53tickingamalloy: syntax quote is the only thing that would really suck because it is all done by the reader and there is no symbolic equivalent
14:53tickingarrdem: yeah, but I have never seen a #( contain a fn
14:54amalloyticking: what
14:54amalloythat happens all the time
14:54amalloyi mean, not all the time, but certainly not never
14:54arrdemticking: sure, but I have, and I've also written fns containing fns. that said I did just write a lambda lifting engine so... moot point any way you want to get the AST into the compiler.
14:55arrdemit'll all express the same control flow once compiled and that's all that matters
14:56tickingarrdem: yeah fn conainting fn or #( seems sensible to me but having short hand notation contain enough code to include a fn seems weird to me
14:57arrdemticking: is it stylistically weird? sure... point is that the parser permits it.
14:57arrdems/parser/reader & macroexpander/g
14:58patrickodI'm working on a small clojure project with ring and the ring server-headless command has suddenly stopped working due to an SSL issue with the clj_http dependency https://gist.github.com/patrickod/25671c703311eb8157a3
14:58patrickodspecifically java.lang.ClassNotFoundException: org.apache.http.conn.ssl.SSLContexts
14:59tickingarrdem: it just feels to me that clojure has the largest "data all the things" movement of all lisps, yet the language itself is the least homoiconic of them all
14:59patrickodI'm unsure what could have changed no my machine to cause this. has anyone experienced this before?
14:59arrdemticking: how so?
14:59arrdemticking: reader macros are still just as first class as lists and much nicer to use.
15:00tickingarrdem: the code has the most syntactic sugar
15:00tickingarrdem: yeah and I'd argue that reader macros break homoiconicy
15:00arrdemticking: lolk
15:00tickingarrdem: at least when there is not a simple transformation between them as in ' and quote
15:00hiredmanpatrickod: do a 'lein deps :tree' it is likely that you have conflicting dependencies on different versions of the apache http client stuff
15:01arrdemticking: okay, and why does this matter in terms of homoiconicy?
15:02patrickodhiredman: yah that seems to be the case. there's dependencies using both 4.3.x and 4.2.x
15:02hiredmanpatrickod: well pick one
15:03patrickodthese are subdependencies. I'll see if their parent packages have updates that I've not used
15:03arrdemticking: code's still data, data's still code, macroexpand happens to make some things easier to write.
15:03amalloyticking: homoiconicity doesn't care at all about the textual representation of your code, only that the forms produced by the reader and manipulated by the compiler are the same data structures as you use to store "normal data"
15:04arrdem(inc amalloy)
15:04lazybot⇒ 116
15:04tickingarrdem amalloy: according to that definition any self hosting language is homoiconic
15:04amalloyuh, no?
15:05amalloylike, try python. how do you manipulate python code from within python? do you use arrays, lists, tuples, and dictionaries? no, you have to use strings or some byzantine AST object
15:05tickingamalloy: let's assume I take python, rewrite all the code blocks into python lists, maps and strings, during parsing, then pass it on to the compiler
15:05dbaschticking: that’s no longer python
15:05amalloyif you did that, it would be homoiconic
15:06amalloybut that's not at all what python is now
15:06amalloyand that's a gargantuan project
15:06tickingamalloy: the tl;dr of wikipedias definition of homoiconicity is " the AST and the syntax are isomorphic"
15:06hiredmanamalloy: wikipedia's homoiconicity entry would seem to disagree with ou
15:07tickinghow is the ast of a sytax quote isomorphic to what it expands to?
15:07dbasch“In a homoiconic language the primary representation of programs is also a data structure in a primitive type of the language itself”
15:08tickingdbasch: yes, but as clojure has no quasiquote type, I don't see how this holds
15:10justin_smithhomoiconicity is not identity of source code as ascii and program structure, that the internal form is a native clojure structure suffices
15:10justin_smithreader macros are a convenience, but they don't affect the meaning of the thing stored
15:11tickingjustin_smith: but how is that any different from any self hosting system
15:11tickingarrdem: no seriously, show me the difference
15:11dbascha python program is not a primitive python data structure, unless you call strings data structures
15:11tickingcurrently the best way to work with clojure seems to be tools.analyzer
15:11amalloyheh. C is homoiconic because its code is represented as pointers to bytes, which are a native type
15:11arrdembecause the read of "for(int i = 0; i < 3; i++){println(i);}" has no syntactic meaning in another language.
15:11arrdemhere java
15:12justin_smithticking: you can walk the internal representation, and it looks like normal data structures, and you can use normal data structure manipulating code on it
15:12tickingwhich produces the exact byzantine ast "objects" amalloy feared
15:12dbaschmachine language is homoiconic :P
15:12arrdem(inc dbasch)
15:12lazybot⇒ 4
15:12amalloyticking: no, the easiest way to work with clojure is to write clojure, and use macros to manipulate the source
15:13amalloyyou use tools.analyzer if you need a deep knowledge of what small vm-level instructions your code will turn into
15:14tickingamalloy: but that is exactly the point, you can't manipulate the source, only an intermediary, because of reader macros
15:14tickingotherwise writing a structural editor would be a bazillion times easier
15:15justin_smithbut the intermediary has the same structure as the source, it is just more explicit / verbose - and when you are doing programmatic transformation this is a big win
15:15Glenjaminbut you *can* manipuate the AST
15:15justin_smithbecause that is simpler to work with in macros etc.
15:15dbaschticking: you can manipulate the source to a large extent, depending on what you want to do, without expanding reader macros
15:15tickingjustin_smith: I agree for most reader macros, but not for example for quasiquote
15:16justin_smithticking: you would rather manually do what quasiquote does yourself, rather than use the expanded and resolved version of the form?
15:16PigDudejustin_smith: thanks, i was working on a macro but couldn't quite get it to work, i'll have to paste it when i do later :)
15:17justin_smithPigDude: np, I was considering a macro a last resort, what I have there could easily be wrapped in a convenience macro to avoid creating a thunk manually though
15:17tickingjustin_smith: no, I rather had ` turn to (quasiquote
15:18llasramticking: Maybe orthogonal to what you're saying, but have you seen https://github.com/brandonbloom/backtick ?
15:18tickingllasram: not yet thanks, this seems very interesting
15:19tickingjustin_smith: I'm not against all the syntactic niceties and shorthands, I just think they should be a more direct representation of the read intermiary
15:20tickings/intermiary/intermediary
15:21tickingThere are things like indentation, I would rather leave to the editor completely
15:21justin_smithticking: so you want more granularity in where one can intervene?
15:21l3dxhttps://gist.github.com/tskardal/e189daf48e971e2a3197 - how can I solve this in a better way? the result of this is a seq of JPanels
15:22l3dxor should I perhaps just ignore the return value. it's mutated after all
15:22dbaschl3dx: you shouldn’t be using for, you should have a loop
15:22tickingjustin_smith: basically, I want a more straightforward and simpler intermediary representation that retains more properties of the written code
15:22dbaschl3dx: for is for creating sequences, you want side effects
15:23tickingjustin_smith: the worst in this regard is the meta reader I think ^, it outputs datastructures with metadata directly
15:25amalloydbasch: well, doseq
15:26amalloyticking: so you want sjacket or something? wanting something that understands clojure's textual layout is nice, but if that's all you want i don't understand the railing against homoiconicity
15:26dbaschamalloy: or dotimes, in this case
15:26amalloydbasch: he'll probably want to use x and y in the real code
15:27l3dxdbasch: ok, so how would I achieve the same x-y-loop?
15:28dbaschl3dx: (doseq [x (range (:witdh game) ….
15:28justin_smithl3dx: do what amalloy suggests and switch out for for dotimes, dotimes has the same syntax but it is done for side effects and returns nil and isn't lazy
15:28clojurebotIn Ordnung
15:28l3dxaah, so not the actual loop function
15:28justin_smitherr, I meant doseq, unless you need the numbers
15:28l3dxas in loop/recur
15:29llasramclojurebot: dotimes has the same syntax but it?
15:29clojurebotGabh mo leithscéal?
15:29llasramOk, so the whole thing then
15:29l3dxthanks
15:29dbaschl3dx: yes, I meant a loop in the generic sense
15:30tickingamalloy: what I'm saying is that the smarter the reader macros get, the more removed the source code will be from the read datastructure will be. And this means less homoiconicity as wikipedia defines it "is a property ... in which the program structure is similar to its syntax, and ... internal representation can be inferred by reading the text..."
15:30tickings/will be/
15:30arrdemticking: so really this is a long argument against context sensitive macros, which are a bad idea anyway.
15:31AWizzArdAnyone here who was using naive bayes on mnist?
15:32amalloyaw man. it turns out that you can use emacs to browse a jar inside of a tgz, but if you try to read any files inside the jar, unzip breaks
15:32justin_smithsounds like an emacs bug
15:35tickingarrdem: theres nothing wrong with context sensitivity as long as it is expressed in the read datastructure to be executed by regular macros and not as a reader macro to be executed before it is data
15:36tickingarrdem: you should be able to read a code file, serialize it again and not go "WTF", that is my metric here
15:40Glenjaminwhat actually happens if you read-string with a syntax quote?
15:40amalloy~tias
15:40clojurebotTry it and see! You'll get results faster than asking someone in #clojure to evaluate it for you, and you'll get that warm, fuzzy feeling of self-reliance.
15:41Glenjamin,(read-string "`(~@a)")
15:41clojurebot(clojure.core/seq (clojure.core/concat a))
15:41amalloy&`(foo ~@bar ~baz) ;; a shortcut
15:41lazybotjava.lang.RuntimeException: Unable to resolve symbol: bar in this context
15:41amalloy&'`(foo ~@bar ~baz)
15:41lazybot⇒ (clojure.core/seq (clojure.core/concat (clojure.core/list (quote clojure.core/foo)) bar (clojure.core/list baz)))
15:41justin_smith,,(read-string "`+")
15:41clojurebot(quote clojure.core/+)
15:41amalloyguys why are you using read-string
15:41amalloyjust use quote. that's what it's for
15:41Glenjaminbecause of the homoiconicity discussion
15:41justin_smithhe asked a question about read-string
15:42amalloy(read-string "foo") is the same as 'foo, for all foo
15:42cbp(inc amalloy)
15:42lazybot⇒ 117
15:43tickingeven worse
15:43ticking'(defn ^Integer len [^String x] (.length x))
15:43Glenjamin,'(defn ^Integer len [^String x] (.length x))
15:43clojurebot(defn len [x] (.length x))
15:44tickingah sorry I'm a bit distracted yeah thanks ^^
15:44tickingso where did the meta go?
15:44Glenjamin,(binding [*with-meta* true] '(defn ^Integer len [^String x] (.length x)))
15:44clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: *with-meta* in this context, compiling:(NO_SOURCE_PATH:0:0)>
15:44ticking,(meta (second '(defn ^Integer len [^String x] (.length x))))
15:44clojurebot{:tag Integer}
15:44tickingah there it is
15:44Bronsa,(binding [*print-meta* true] (pr '(defn ^Integer len [^String x] (.length x))))
15:44clojurebot(defn ^Integer len [^String x] (.length x))
15:44Glenjamin^^ thats the one
15:45tickingyeah but that means that no database that we currently use in clojure can hold our code
15:46Bronsa:|
15:46tickingwe either have metas in syntax, which it won't be able to read, or we have metas attached to the symbols, which it will probably disgard, because they are not part of the value
15:47arrdemor we could just have a more honest print that displays metas so that round tripping code is honest...
15:47arrdems/honest/an identity operation/g
15:47amalloyarrdem: you won't like all the :line metadata that gets printed
15:47arrdemamalloy: I'm well aware of all the metadata that'd get spewed.
15:48Bronsaand if you use tools.reader you get :line, :column, :end-line, :end-column, :file and maybe even :source !
15:48arrdemBronsa: yeah... source containing source.... this'll end well
15:49Bronsaarrdem: https://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader/reader_types.clj#L294
15:50arrdemBronsa: what are you doing to that poor var...
15:50Bronsaarrdem: to my defense I didn't write that code
15:51devntechnomancy: do you know how many hits clojars.org gets/day?
15:51Bronsaarrdem: it's a way to get an anonymous Var
15:51technomancydevn: I have numbers that are a year and a half old; want 'em?
15:52devnyeah that'd be cool
15:52arrdemBronsa: hum....
15:52technomancyhttps://www.refheap.com/6193
15:52amalloyBronsa: what about with-local-vars? ##(with-local-vars [x 1] x)
15:52lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Var is bad!
15:53technomancydevn: wait, do you mean the web app or the repository?
15:53amalloy,(with-local-vars [x 1] x)
15:53clojurebot#<Var: --unnamed-->
15:54Bronsaamalloy: uh it didn't occur to me that vars created with with-local-vars could escape the with-local-vars scope
15:54technomancyhm; that might not be all that useful
15:54amalloyi don't actually know if it works, but it probably does
15:54Bronsayeah looking at the source now, it's just Var/create + bindings around the body
15:54amalloy,(let [v (with-local-vars [x 1] x)] (with-bindings [v 2] @v))
15:54clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.IMapEntry>
15:55amalloy,(let [v (with-local-vars [x 1] x)] (with-bindings {v 2} @v))
15:55clojurebot2
15:55amalloymagic!
15:55tickingarrdem Bronsa: so yeah, I'm not saying all is lost, a more honest print might be a good idea, but I think being able to put code into databases and query it would be really awesome, and putting nodes a la {:type :vector :contents foo} really seems like too much
15:55Bronsayeah well, I still prefer (Var/create 1) to (with-local-vars [x 1] x) :)
15:55amalloywimp
15:55amalloyinterop is the easy way out
15:55Glenjaminisn't that what codex does?
15:56Glenjaminmaybe not codex
15:56arrdemamalloy: does it matter? it reaches in to the same var class anyway, just through a clojure core fn instead...
15:56Glenjaminwhat was that git history clojure datomic thing called?
15:56llasramcodeq
15:56tickingyeah
15:57Bronsa I wish (var x) was (the-var x) so var could be Var/create
15:57amalloyarrdem: it doesn't matter
15:57bbloomBronsa: isn't Var/create == intenr ?
15:57amalloyi would use Var/create instead of with-local-vars
15:57bbloomintern*
15:57amalloybbloom: no, that needs a name
15:57amalloyputs it into a namespace, etc etc
15:57bbloom(doc intern)
15:57Bronsabbloom: no, Var/create returns an anonymous Var instance
15:57clojurebot"([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var."
15:58bbloom(doc the-var)
15:58clojurebotHuh?
15:58bbloomyeah, ok, "or creates"
15:59tickingGlenjamin: but I think they are only code aware and don't dump it all in the database, the orgmode readme contains a lot of questionmarks on ast vs strings
15:59gfrederickscemerick: I pung; I was pondering NREPL-53 and was wondering if it's valid to say that nrepl middleware ordering boils down to a basic topological sort; once the op-vs-var thing is normalized
15:59bbloomBronsa: Var/create doesn't need to be primitive or anything, does it? i don't understand your wish :-P
15:59Bronsabbloom: what I meant is, I wish the `var` special form was called `the-var` so that we could have a `var` function that created an anonymous Var, just like we have `atom`, `ref` etc
15:59Bronsabbloom: I'd rather write (var 1) than (clojure.lang.Var/create 1) :P
15:59gtrakgfredericks: I think I'm running into issues there
15:59bbloomBronsa: ah, i see. you mean for un-named thread locals
15:59bbloomgotcha
16:00Bronsayep
16:00gtrakapparently nrepl middleware and gary don't mix
16:00bbloomsorry, came to the conversation a step late :-)
16:01gtrakgfredericks: https://groups.google.com/d/msg/clojure/nUBBbYZHuTE/ScLBH-A2HkoJ
16:01bbloomyeah, vars are a bit... dare i say... complected
16:02bbloomnamespace + state management combined
16:06amalloyi propose that instead of using reflection to resolve unhinted interop, clojure just assumes you meant String
16:06amalloythat seems like the #1 cause of reflection warnings
16:08dbaschamalloy: it would be interesting to run a test on all the artifacts on clojars and see if that’s indeed the case
16:09amalloydbasch: i think String would constitute about 50% of all interop
16:09amalloybut you can't really test it in an automated way
16:10bbloomamalloy: you probably could with eclj
16:10bbloomamalloy: but not realistically yet, b/c all clojure.core usage is considered interop lol
16:15arrdemBronsa: thinking about the AOT stuff, my gut is that class compilation should just emit a seq of [classname bytecode] pairs and that subsequent classloading or lack thereof should be its own thing as opposed to the implicit classloading that t.e.jvm does now. thoughts?
16:17Bronsaarrdem: that's not going to work as tej works right now, control doesn't return to t.e.j/eval for all fns unfortunately.
16:19gfredericksgtrak: hooray it's not just me
16:19gtrakwas planning to spend a couple days on it sometime in the next few weeks
16:19gtrakit's really holding back cider.
16:19gtrakor at least, my lack of understanding it is holding back cider.
16:19Bronsaarrdem: an option could be to make the class-loading mechanism configurable using an option on the emit frame, so maybe (e/emit (a/analyze ..) {:loader-fn (fn [loader class-name bytecode] (.defineClass loader class-name bytecode))} ..)
16:20gfredericksgtrak: it weirds me out that this doesn't blow up for normal people
16:20gtrakI think that normal people don't futz with middlewares yet.
16:20Bronsaarrdem: that way you could roll your own loader-fn and put the [class-name bytecode] tuples in an atom maybe
16:20gtrakexcept to you know, like just add one.
16:20arrdemBronsa: that'd probably work. I'm gonna break for food and I'll play with it once I'm back.
16:21Bronsaarrdem: ok
16:21gfredericksgtrak: right, but why doesn't this issue apply to existing sets of middlewares?
16:21gtrakgfredericks: my workaround was to collect all the expects and requires from a bunch of middlewares and generate a single middleware.
16:21gfredericksgtrak: i.e., reimplement the ordering yourself? :D
16:21gtrakheh yes.
16:21gtrakbut that's a big change for me not understanding the implications.
16:22Bronsaarrdem: are you a clojure contrib member? if so you can go ahead and make the changes you need to t.e.j in a branch if you want
16:24arrdemBronsa: I've had my CA in for a while, don't think I have contrib access tho. I asked tb++ about it a while back and it sounded like something that wasn't gonna happen for whatever reason.
16:24arrdemso... shrug
16:25arrdemprobably something I should bug Alex M. about.
16:25gfredericksgtrak: we should flip a coin to see who has to fix it
16:26gtrakgfredericks: I'll end up fixing it in a few weeks unless you beat me to it. been really busy.
16:26gtrakbut first I have to make some test-cases.
16:26gfredericksgtrak: you saw my code on the ticket?
16:26gtrakyea
16:27gtraki did something similar.
16:27gtraki don't even remember.
16:27gtrak:-) it's a mess.
16:27gfredericksdid you observe nondeterminism or just incorrectness?
16:27Bronsaarrdem: yeah, I don't really know how any of this stuff should work but try asking Alex, I wouldn't have a problem letting you push your changes in a separate branch
16:27gtrakincorrectness.
16:27gtrakI didn't try multiple JVMs
16:28gtrakgfredericks: I would expect a behavior that throws an error if constraints can't be met, at least a warning.
16:28gtrakwith the conflicting constraints.
16:28gfredericksgtrak: I didn't think my constraints were even conflicting
16:28gtrakmine either.
16:28gtrakit made no sense.
16:29gtrakbut the result was totally wrong.
16:29gtrakor at least it didn't match my understanding
16:29gtrak_something_ was wrong.
16:30gfredericksfo sho
16:30gfredericksI wasn't able to wrap my head around the code so far
16:30gfredericksI was hoping that given two middlewares the info would boil down to a partial order
16:31gfrederickscan't tell looking at the code if that's the case
16:31gtrakme neither, I might try reimplementing it.
16:31gtraklike I said, on the order of a couple days' work.
16:31gtrakhopefully before we have to push a cider release.
16:33gtrakit seems like these tooling projects have lots of good ideas that are half-finished :-)
16:33gtrakfor instance the elisp bencode impl couldn't handle nesting before I got to it.
16:33gfredericksthat must be less dire than it sounds
16:34gtrakwell, nesting's a nice thing to want to have.
16:34gtrakwhich is why I had to realize that pain for myself.
16:34gtrakand this is why we can't have nice things.
16:36{blake}Hey, all: I have a question about some code I've written. (ref: https://www.refheap.com/86286) In particular, I feel like it's cheap to have to call "flatten" and especially "remove nil?". Any thoughts?
16:37joegallo{blake}: i believe you could collapse your let and if up into the for itself (as :let and :when)
16:37{blake}I know I could get the "remove nil?" out if I tested the return but I can't see a non-clunky way to do that.
16:37gtrakgfredericks: I've even started thinking about what it would take to implement these things in CLJS or possibly CLR :-)
16:37gtrakwhich is a whole can of worms.
16:37{blake}joegallo, thanks, lemme try that out...
16:37joegallothen you wouldn't have to remove the nils from the result, because they wouldn't have been generated by the for
16:38{blake}Well, but...hmmm.
16:39llasram{blake}: It looks to me like this may be one of the circumstances where you want a manual `lazy-seq`
16:40{blake}llasram: A manual lazy-seq...like calling "lazy-seq" directly?
16:40llasramYes
16:41llasramOh, except... the recursion is essentially depth-first?
16:41{blake}llasram: OK, I'll check that out, too.
16:41zoldar{blake}: you could also make use of destructuring in let bindings
16:41{blake}zoldar, ok *makes list*
16:42gfredericksgtrak: so many cans
16:43zoldar{blake}: that's partly a matter of personal preference but I would rather use full names rather than abberviations, even when the scope is small
16:43{blake}zoldar, not sure I follow...you mean full names instead of "t", "c" and "tt"?
16:44zoldar{blake}: yes
16:45{blake}zoldar, I get that. I'm not sure where I come down on it yet. If I use full names, I find myself wondering if I'm thinking too concretely.
16:46amalloy{blake}: the flatten is particularly outrageous, as you suspected. i'd write something like https://www.refheap.com/61d3a3c7f691c1f26c8084770, although i agree about the names t, c, tt; i added x only because i don't know what the right name is in your context
16:47zoldar{blake}: overall, you could move the code working with a single element of collection (the one in for form) to a separate function - and instead of using flatten and for you could use a form like (into {} (map ... pz-xml))
16:47{blake}amalloy: You agree with zoldar about using full names?
16:48{blake}Ah, yes, I see that you've fleshed them out. =P
16:51cemerickgfredericks: generally and IIRC. There's a set of reasonably complex nREPL issues that were started a week or two ago I haven't looked at in detail, that's one of them.
16:52{blake}amalloy, I don't think I get "for [{:keys [tag content]} pz-xml..." You're iterating over pz-xml and pulling out the keys, is that right? Then destructuring tag and content from them?
16:52zoldar{blake}: erm, of course the second part of my last advice is wrong, ignore it
16:53{blake}zoldar, OK. It usually takes me a while to go through the advice queue and quasi-understand it. Heh.
16:53amalloyare you asking about :keys destructuring in general, or about what it's doing inside a for, or...?
16:56amalloyactually, i'm off to lunch. but the basic point is: anytime you give something a name, you can destructure it instead. [{:keys [x y z]} foo] is a destructuring form that says "look up (:x foo), (:y foo), and (:z foo), and create locals named x, y, and z for them"
16:56{blake}amalloy: thanks...I think that answers it
17:05zoldar{blake}: in case you haven't heard about it yet, 4clojure.com is pretty fun way to learn idioms of the language. It's pretty useful to follow a couple of top participants to see what they have come up with after solving a given problem yourself. I remember that amalloy's solutions in particular were pretty damn nice.
17:07mdeboardThe map destructuring bind syntax is particularly hard to remember IMO
17:08mordocaizoldar: Thanks for that! I'm just lurking in this channel and going through The Joy of Clojure. Looks like 4clojure.com will be very helpful to "master" clojure.
17:08mdeboard[{:keys [x y z]} foo] ... lots of syntax
17:08arrdem mdeboard: :keys, :as and :or aren't too bad, IMO
17:09arrdemit's just a mapping datastructure from keys to local symbols
17:09zoldarmordocai: my pleasure
17:09mdeboardWell, it's just remembering whether to use parens, braces, brackets, "Is 'keys' a keyword? I forgot"
17:09zoldarmordocai: however thanks should go to the authors
17:09mordocaizoldar: Of course, but thanks for letting me know about it :P
17:10mdeboardThe function parameter syntax in general is tough forme to remember
17:10mdeboardWhen you get into optional arguments, destructuring, etc.
17:11noonian[{:keys [x y z]} foo] could also be written [{x :x, y :y, z :z} foo] btw, :keys :as and :or is nice sugar to keep it concise(ish)
17:13zoldarmordocai: another option is clojure track on exercism.io however I'm not sure how active it is now
17:14mordocaizoldar: You said you liked amalloy's solutions on 4clojure, do you remember what username they are under? Don't see amalloy or related username that I can tell. (I would ask amalloy but looks like they are AFK)
17:14{blake}zoldar, I've done about 60-70 of the 4Clojure exercises. I didn't find it all that useful. I might now, though, knowing more about Clojure.
17:15zoldar{blake}: heh, I've just logged in and don't see him either...
17:16{blake}mordocai, I think he's under amalloy, at least as far as submitting problems.
17:16dbasch{blake}: there’s a point at which 4clojure becomes more about programming puzzles than the language, probably 60-70 is about right before you’re better off with a real project
17:17zoldar{blake}: ah, you have to switch to show all
17:17dbasch{blake}: imo, the most useful ones are the ones that make you reimplement features of the language (e.g. comp, juxt)
17:17{blake}dbasch, Exactly. There's also a point =before= where you're just throwing stuff together to see if you can make something come out, which has limited use. (At least, that's what =I= ended up doing. =P)
17:17{blake}dbasch, true, and those are the hardest, IMO.
17:18zoldardbasch: yeah, there's even an (optional) code golf contest
17:20zoldaroops just realized that I've mixed up names when messaging, sorry
17:21llasram~guards
17:21clojurebotSEIZE HIM!
17:21arrdem~gourds
17:21zoldar:)
17:21arrdemaaaaand bot ignored
17:21llasramHuh
17:21arrdemthis is getting old.
17:21llasramOh, are you on clojurebot's naughty list some how, arrdem ?
17:22arrdemllasram: apparently.
17:22llasramhiredman: ?
17:22gtrak~gourds
17:22clojurebotSQUEEZE HIM!
17:22hiredmanllasram: ?
17:23llasramJust wondering arrdem's status on clojurebot's secret naughty list
17:23llasramSeeeeecrets
17:24hiredmanhttps://github.com/hiredman/clojurebot/blob/master/clojurebot-facts/src/clojurebot/facts.clj#L74
17:24llasrams,secret,well-publicized,
17:24arrdemwell damn.
17:25gtrakup there with bitemyapp, that's harsh.
17:25arrdemyeah... I'm actually offended somewhat.
17:26gtrakwhat did you do?
17:26arrdemno idea... best guess is that I wrote too many factoids. *shrug*
17:28dbascharrdem: you should write your own bot, with blackjack and hookers
17:28dbascharrdem: call it bender
17:28arrdemdbasch: meh... priorities.
17:28llasramOr just submit a polite and apologetic PR to hiredman :-)
17:29dbascheverybody should write an irc bot once, it’s fun
17:29arrdemdbasch: I already did mine. in perl and irssi. never again.
17:29dbaschI did mine in Ruby
17:29arrdemdbasch: the good news is that the pentesters in the channel it lurked never did manage to exploit it :D
17:30{blake}I did one in Delphi.
17:36knur:)
17:40pcnDoes anyone know the record uptime for a windows box?
17:44amalloyit can't be an official record unless a beer company verifies it
17:48arrdemwell you can write a Θ bound for it, based on the first sale of MS-DOS...
17:57dbascharrdem: you can do better than that, the development of Windows started in 1982
18:08justin_smithI'm picturing that Owl from the tootsie roll commercial, starting up a windows box, getting a blue screen after two minutes: "two. two minutes"
18:09dbaschasking about the machine with the most windows uptime is a bit like wondering who’s the tallest midget to ever live
18:10amalloydbasch: http://en.wikipedia.org/wiki/Adam_Rainer
18:10justin_smithhttp://raamdev.com/2007/another-best-personal-windows-uptime/ here is a guy bragging about 131 days
18:11TimMchahaha
18:11gtrakmine runs fine except it freaking reboots itself.
18:11gtrakwhen updates are pushed.
18:11dbaschamalloy: actually I remember that guy from the first edition of the Guinness book of records I got when I was a kid
18:11dbaschalong with Robert Wadlow
18:11mordocaiMeh, my linux uptime isn't that great because I am an update-aholoic so I reboot for kernel/libc updates regularly. Better than being forced to reboot though.
18:14TimMcYeah, critical patches ruin uptime whether you're forced to reboot or do it voluntarily. :-/
18:15dbasch“The earliest application of the Game Oriented Assembly Lisp (GOAL) programming tool, was the original Jak and Daxter game.” <— Guinness record
18:16kenrestivobtw, it's not just windows. a friend with a macbook air, had problems with network connectivity, and was told by the "genius" at the apple store to reboot his macbook every few days to solve that
18:17teslanickWhat does #' indicate? e.g. #'app ?
18:18amalloy,'#'app
18:18clojurebot(var app)
18:18amalloyif there's some reader syntax that confuses you, you can just put a quote in front of it and see what it expands to
18:19teslanickI didn't know that, thans!
18:20dbaschteslanick: #’ is a reader macro called var-quote
18:21dbaschteslanick: those are hard to google, you can find them here: http://clojure.org/reader#The%20Reader--Macro%20characters
18:21teslanickThat's precisely why I asked -- it would be impossible to google for it. ;)
18:23kenrestivo,'#inst "2014-05-01"
18:23clojurebot#<SecurityException java.lang.SecurityException: denied>
18:23cbphmm why is that denied
18:24whodidthismysteries of the universe, why is (compojure.core/defroutes them-routes ...) given to ring-handler as #'them-routes
18:25cbpwhodidthis: so you can modify them at runtime
18:26amalloycbp: maybe clojurebot knows that j.u.Date is garbage, and he's trying to protect you
18:29cbpyou might take my j.u.Date from me clojurebot but you will never take my freedom
18:29sdegutisTIL that (future (doall (repeatedly some-fn-that-throws-exception))) silently stops unless you put in a try/catch.
18:35cbpsdegutis: it might be that its just not done yet
18:35cbpsdegutis: can only make sure its done by dereferencing it
18:35sdegutiscbp: It doesn't take this many hours for an EC2 server to download a 1.5 GB file.
18:36amalloywell, it can never be done, since he asked for an infinite amount of work
18:36sdegutisamalloy: semantics
18:36cbpamalloy: but it throws so it will be done at the first step
18:36PigDudeis this normal multimethod usage when other namespaces are defining methods? the :require [tex-mex] feels weird: https://www.refheap.com/83d9d77c079836d461c129c84
18:38amalloythat's basically what you have to do, PigDude. you can include a comment explaining that it's for loading method definitions
18:38cbpsdegutis: i guess i mean *started* rather than done
18:39cbpso it's not failing silently just not doing much at all
18:39amalloyalso, namespaces with no . in them are bad juju. so like, you'd want awesome.cookbook and recipes.tex-mex or something
18:39PigDudeamalloy: and it's that way for protocols as well?
18:39dbaschsdegutis: that’s a very strange way to keep calling a function until it fails btw
18:39sdegutisdbasch: it should never fail.
18:39PigDudeamalloy: yea i was justhammering out this example for you all
18:39amalloydbasch: but it's nice because it guarantees that it will fail!
18:39dbaschsdegutis: then how does it end?
18:39amalloybecause he's saving its results in a doall, and he'll eventually run out of ram for them
18:40cbp:-P
18:40sdegutisdbasch: it's how we run infinite background-processes in the website until I can get this infrastructure tool working for EC2 and spin up a new server for that
18:40sdegutisamalloy: the results are nil afaik, but yeah, good point, I shouldn't use a doall
18:40dbaschinfinite background processes? Wow, you must have a high aws bill :P
18:41amalloysdegutis: infinitely many nils still take up infinite space
18:41dbaschmy iinstances are limited to 10^100 processes
18:41sdegutisHmm.
18:41sdegutisNo no no, not a unix process, just a task.
18:41sdegutisTo run in a new Java thread.
18:42dbaschsdegutis: that’s better, I can do 10^300 threads
18:42amalloy10^100 processes, huh? that's the kind of number only like google could handle
18:42cbp10^100 processes? that's not even enough to compile haskell!
18:42dbaschI need them, I’m trying to list all bitcoin keys
18:42arrdemdbasch: y u build rainbow tbls n brk blockchain. y u do dis.
18:43amalloyc'mon guys, play along. 10^100? google? googol? i'm dying here
18:43dbaschamalloy: that’s the kind of joke they’d love at the 10^(10^100)
18:43amalloy*rimshot*
18:44arrdemamalloy: no it's ~rimshot
18:44amalloyi don't let clojurebot steal my glory
18:44cbptoo bad arrdem can't do it
18:44arrdemcbp: I'll build my own bot with blackjack and hookers...
18:45PigDudeanyhow thanks amalloy :)
18:48PigDudei researched this other quesiton i had a lot and couldn't find an answer either: how do you bind something in a macro that is private to the macro?
18:49PigDudei can output values with ~() but i can't share them with other ~() expansions
18:50amalloyPigDude: i don't really understand the question. are you looking for something more sophisticated than auto-gensyms?
18:50PigDudemore specifically, to define a function (as a curiosity) that accepted some gensym-named arguments and then uses them somewhere in its body
18:50PigDudeamalloy: well v# works fine when you know ahead of time how many you have
18:51PigDudeamalloy: but if i generate this list of symbols, then i want to do (map gensym (somthing))
18:51PigDudeand use it around the function
18:52PigDudei thought it was a stupid question but i couldn't figure out how to define some data in the macro and use it twice, basically: (defmacro m [x] (let [x* (inc x)] ...)) <- no trace of x/x* should be in the macro-expanded form
18:52amalloyyou can certainly do that. just (let [names (repeatedly n gensym)] `(fn [~@names] (+ ~@names))) or whatever
18:52amalloyPigDude: what you've just written is the answer to your question
18:52PigDude(defmacro m [] (let [names (repeatedly n gensym)] `(fn [~@names] (+ ~@names)))
18:52PigDude, (defmacro m [] (let [names (repeatedly n gensym)] `(fn [~@names] (+ ~@names)))) (m [1 2 3])
18:52clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: n in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:52amalloyx and x* only live in the macro's scope, they don't get emitted
18:52PigDude, (defmacro m [n] (let [names (repeatedly n gensym)] `(fn [~@names] (+ ~@names)))) (m [1 2 3])
18:52clojurebot#'sandbox/m
18:53PigDudeah right only one at a time
18:53PigDude,(macroexpand-1 '(m [1 2 3]))
18:53clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
18:53amalloy,((m 5) 1 2 3 4 5)
18:53clojurebot15
18:53PigDudeamalloy: oh ok so i was only seeing them because i was using macroexpand-1?
18:53PigDudeamalloy: of course!
18:54amalloyPigDude: no, if you saw them in macroexpand, they were in the emitted source
18:54amalloypresumably because you let them inside of the syntax-quote, instead of outside it
18:54amalloy,(macroexpand-1 '(m 5))
18:54clojurebot(clojure.core/fn [G__131 G__132 G__133 G__134 G__135] (clojure.core/+ G__131 G__132 G__133 G__134 ...))
18:55amalloynote that `names` doesn't exist in there anywhere
18:57PigDuderight
18:59PigDudeamalloy: i was writing this macro earlier and having a tough time for some reason, i think it's because i was expanding with the wrong function
19:00PigDude,(defmacro fnn [f n] (let [syms (repeatedly n gensym)] `(fn [~@syms] (~f ~@syms))))
19:00clojurebot#'sandbox/fnn
19:01PigDude,(defmacro fnn [f n] (let [syms (repeatedly n gensym)] `(fn [~@syms & _#] (~f ~@syms))))
19:01clojurebot#'sandbox/fnn
19:01PigDude,((fnn identity 1) 1 2 3)
19:01clojurebot1
19:17amalloygross. (merge) and (merge-with f) return nil instead of {}
19:20technomancyamalloy: same thing
19:20gfredericksyeah name six circumstances where nil doesn't act like {}
19:20gfredericksyou can't do it.
19:20gfrederickscase closed.
19:20amalloygfredericks: well, i took over a codebase where someone loved to write (m k) instead of (k m)
19:20gfredericksdelete the codebase
19:21amalloyworking on it
19:21gfredericksw00t clojure legacy code
19:22amalloyalso, using map! (map some-map [:x :y :z])
19:22technomancy~gourds
19:22clojurebotSQUEEZE HIM!
19:22gfredericksamalloy: I think that's the same root cause
19:22gfredericksso you're still short five
19:23amalloygfredericks: well, obviously. the main root cause is "calling it as a function"
19:23gfredericksyes
19:23amalloybut while (m k) is more or less indefensible, passing it as a function to something else is reasonable
19:23gfredericksah ha okay
19:23amalloybut, okay, challenge accepted: (instance? Map nil)
19:23gfredericksI think (m k) is defensible actually
19:23amalloygfredericks: not when k is a literal keyword
19:24gfrederickstrue dat
19:24gfredericksI think there are two primary map usages -- record-like and map-like
19:24gfredericksfor record-like, use the keyword as a function; for map-like, use the map as a function, at least if you know it's a PHM; otherwise use get
19:24gfredericksanyhow you're up to 2
19:25amalloyi usually use get anyway. you never know when some madman like technomancy or gfredericks will say "psh nil is just like a map"
19:25gfredericksyou can't just find more superclasses of PHM either
19:25gfredericksnil is just like an empty string
19:25amalloyokay. passing it to java code
19:25gfredericksnil; it's just like <html></html>
19:26gfredericksclojurebot: nil is just like an empty picnic basket
19:26clojurebotc'est bon!
19:26amalloyand uh, (when opts (use-opts)), where opts is a map or nil
19:26technomancyamalloy: in general I hate sloppiness around nil semantics, but you can usually get away with it when it's a conflation between nil and a collection
19:26technomancynillable scalar values are a bucket of hurt though
19:27gfrederickstechnomancy: that is an interesting distinction
19:27amalloygfredericks: comparing for equality, hashing, using as a key in a map: those three just count as one, but they count
19:27technomancygfredericks: well most collection stuff just calls get or seq on the arg anyway
19:27amalloyso i think i'm at 5
19:27technomancy*the moral equivalent of get
19:27gfredericksguys I use C-t all the time
19:27amalloyoh, and calling conj/into
19:28amalloygfredericks: i rebound C-t to transpose-sexps, because i'm a typing wizard who never transposes characters
19:28gfredericksonly whole sexps
19:28amalloywell, i change my mind a lot
19:28gfredericksclojurebot: amalloy is a typing who wizard only sexps transposes
19:28clojurebotIk begrijp
19:29amalloyclojurebot: gfredericks is a sexp wizard who only types transpositions
19:29clojurebotIk begrijp
19:29technomancyI used to have C-t as my screen prefix
19:30technomancyso I was blind to the usefulness of character transpositions
19:30technomancy(dec so)
19:30lazybot⇒ -27
19:32amalloyi'm surprised there's anything with a score of -27 in lazybot's karma db
19:32technomancydecing so is a time-honored #clojure tradition
19:33cbp$karma bitemyapp
19:33lazybotbitemyapp has karma 16.
19:33cbp$karma callen
19:33lazybotcallen has karma 15.
19:35amalloyso has the lowest karma score of anything
19:35amalloyjava is in 4th with -4
19:36amalloyactually, let's limit this to #clojure. java is *second* with a score of -4. javascript hot on its heels with -3
19:36technomancy(dec javascript)
19:36lazybot⇒ -4
19:37nullptr$karma IE
19:37lazybotIE has karma 0.
19:37amalloyafter that they start getting silly, with things like "n", "%2", and "also"
19:37technomancylazybot: that's how you know this isn't a web-centric channel
19:37amalloybut i see clojuredocs has -1
19:37technomancyerr
19:37technomancy^ nullptr
19:38amalloylazybot: look at technomancy when he's speaking to you
19:38nullptrtechnomancy: true enough ... in our company's general dev chat IE has -162 ... still falls short of outlook's -430 (notice a theme?)
19:38technomancyabject despair?
19:38amalloyyou guys like negative numbers?
19:38nullptr(inc technomancy)
19:38lazybot⇒ 110
19:39xy86has anyone here used instaparse?
19:39nullptras in all channels, negative karma is for technologies, positive karma is for people
19:39cbpalso was a nick on this channel
19:39cbplike so
19:39technomancymaybe so is short for "also"
19:40amalloy~anyone
19:40clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
19:40gfredericksxy86: we're using it at work
19:41xy86gfredericks: i dont see anyhwere in the docs how to get line the line number from a node as the result of a parse
19:42gfredericksxy86: I actually don't know anything about it I just wanted everybody to know I was a hipster
19:42gfredericksthe other guy on my team wrote the code :)
19:48kwertiiI have a project where “lein uberjar” fails with “Compilation failed: Subprocess failed”. (“lein compile” seems to work fine.) Is there any way to make “lein uberjar” print more information on what exactly is failing?
19:52technomancykwertii: try `lein with-profile uberjar compile`
19:53kwertiitechnomancy: “Warning: profile :uberjar not found.”
19:54kwertiiother than that, no errors
19:56technomancyhuh... try applying profile isolation; see the end of the faq
20:04kwertiiOK, trying
20:19AWizzArdI am experiencing a strange error message. Perhaps someone saw it before. I have a (defrecord MNIST [label digit]). When I have a (def x (MNIST. 10 20)) I can do (.label ^MNIST x). Works fine.
20:20AWizzArdHowever, I have a vector data, and when I (doseq [element data] (.label ^MNIST element)) I get an error: test.MNIST cannot be cast to test.MNIST
20:21BronsaAWizzArd: that probably means that you evaluated twice the defrecord
20:21Bronsaand you created the vector with those instances before re-evaluating the defrecord
20:22AWizzArdBronsa: okay, that sounds good. I will restart my jvm, perhaps I indeed played with it.
20:26AWizzArdBronsa: Yes, works. Thx!
20:27AWizzArdBronsa: cause when I reloaded the file (in emacs, C-c C-k) it found again my defrecord.
20:28AWizzArdIs there some “defoncerecord”?
20:28AWizzArdI constantly reload my test file but did a defonce on my data file, as the import takes nearly 30 seconds.
20:31AWizzArd(when-not (ns-resolve *ns* 'MNIST) (defrecord MNIST [label digit]))
20:33AWizzArdMaybe the Clojure compiler could check when it sees a defrecord if such a record already exists. In such a case it won’t have to be replaced.
20:33AWizzArdIf the fields didn’t change there would be no need to over-define the existing one.
20:34AWizzArdMy when-not doesn’t work, it replaces the defrecord anyway.
20:35johncashrecords are object oriented poison
20:36AWizzArdWell, I was the guy who originally suggested them, in early 2009.
20:36AWizzArdThey are a very nice addition and allow for good efficiency.
20:37AWizzArdI used defstruct but found that it was much slower compared to plain Java classes.
20:37AWizzArdBack then Rich hung out here every day and I asked if we could get a defclass.
20:38AWizzArdAt first he didn’t like that, but a few months later he came up with a very cool idea: adding defrecord to Clojure. I thought that I heard about this idea before ;)
20:39technomancyimma join johncash in the corner
20:40cbp`u guys just dont like SPEEED
20:40johncashshooting yourself in the foot happens very fast
20:40p_l(optimize (debug 0) (speed 3) (safety 0) (size 0)) ; eh?
20:40AWizzArdp_l: did that too ;)
20:41gfredericks,(defstruct foo bar)
20:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: bar in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:41gfredericks,(defstruct foo [bar])
20:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: bar in this context, compiling:(NO_SOURCE_PATH:0:0)>
20:41gfredericksman it's been so long since I did a defstruct
20:41AWizzArdIndeed.
20:42AWizzArdThough I don’t see how defrecords have anything to do with oop.
20:42amalloyi happen to know that it's (defstruct foo :bar)
20:42kwertiitechnomancy: I tried profile isolation as described in the FAQ; “lein compile” now gives the same “Compilation failed: Subprocess failed” error as “lein uberjar”. Other than that, no change
20:42AWizzArdHah, the long forgotten syntax :)
20:43amalloybecause the code i'm working on, written in the distant past of 2013, has a defstruct
20:43technomancykwertii: cool, you fixed your build =)
20:43gfredericksdepends on what you think OOP is about
20:43gfredericksI was explaining defrecord to a teammate just two days ago and his reaction was "just like OOP!"
20:44cbpevery currently recommended clojure book was written for 1.3 anyway
20:44cbpeveryone knows defstruct when they first start
20:44johncash#<INSTANCEOFPERSON name: "foo" age: 42> vs {name: "foo", :age 42}
20:44amalloycbp: huh? records were added, and structs deprecated, in 1.2
20:44cbpoh
20:45johncashi think people closely associate polymorphism with OOP
20:45cbpI guess written for 1.2 with the 2nd edition in 1.3 and defstruct not removed :-P
20:45gfredericksI think the worst thing about OOP culture is encapsulated state, and defrecords don't have that
20:47AWizzArdYes, they are just a data structure like you and me.
20:47AWizzArdComputer science is about using the right data structures and algorithms.
20:47gfredericksum
20:47gfredericksI don't think that's what records are obut
20:47gfredericksaboeutho
20:47gfredericksabout
20:47AWizzArdThey are a very lightweight data structure.
20:47gfrederickssince datastructurewise they are effectively maps
20:48AWizzArdWith very much less memory requirements and different lookup times.
20:48gfredericksyeah I guess there's a perf vs api distinction
20:48jcromartieI wish I could hit C-c C-k without an nREPL connection and automatically jack in
20:49AWizzArdWhat is again the syntax for the #: reader macro?
20:49gfredericksthe what
20:49kwertiitechnomancy: er. I did?
20:49amalloyyou just type #: and then the reader explodes
20:49AWizzArdOr what is the reader macro that allows to run code at read time?
20:49gfredericks,#:kaboom!
20:49clojurebot#<RuntimeException java.lang.RuntimeException: Reader tag must be a symbol>
20:49kwertiijcromartie: C-c M-j does that
20:50gfrederickshaha funny error
20:50gfredericks,#&kaboom!
20:50clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
20:50technomancykwertii: it was leaking state and giving you a false positive when it should have failed
20:50gfrederickswow that reader literal thing takes up a big swath of the # dispatch space
20:50gfredericks,#&kaboom! :val
20:50clojurebot#<RuntimeException java.lang.RuntimeException: No reader function for tag &kaboom!>
20:50cbpjcromartie: im sure you can write an elisp function to do that? :-P
20:50AWizzArdWas it #& maybe?
20:51gfredericks#=
20:51amalloyAWizzArd: you're thinking of #=, which is a tool of the devil
20:51AWizzArdAh yes, that was it.
20:51AWizzArdamalloy: guess who I am?
20:51kwertiitechnomancy: You mean “lein compile” should have always failed?
20:51johncashI have learned from Om that global application state is the only sane way to do state, however counter intuitive that may sound
20:51jcromartiekwertii: C-c M-j, then C-c C-k
20:51kwertiijcromartie: ah, I see
20:52jcromartiebut I think C-c C-k should imply a cider-jack-in when there's no nREPL yet
20:52johncashcoming from an era of "global variables the sky is falling"
20:52kwertiijcromartie: yes, that could be. seems straightforward enough to add
20:53johncashAWizzArd: A wizard?
20:54cbpjohncash: as long as you're dealing with a single thread
20:56johncashah good point
20:56AWizzArdjohncash: btw, I am aware that wizard has only one ‘z’.
20:56johncashclojurescript is inheritly single threaded
20:57johncashAWizzArd: i was joking, you asked amalloy to guess who you were, and i respond "a wizard"
20:58johncashcbp: whats the best way to manage global app state with multiple threads?
20:59cbpWell
20:59cbpI don't know
21:00AWizzArdjohncash: in Clojure one might be using refs for that.
21:01cbpMy rethinkdb driver uses an agent as a frontend for a connection and it seems to work pretty well
21:01amalloydelete all the global app state. mischief managed
21:02johncashamalloy: so global app state is only a good idea in a single threaded environment?
21:03johncashAWizzArd: if you only have one ref as your global state, it seems to me there is no advantage of using STM since there is nothing to coordinate
21:03AWizzArdcbp: yes, and internally rethinkdb probably uses its own stm and fully persistant data structures.
21:03AWizzArdjohncash: yes
21:03amalloyit's not a great idea then either. but i'm being overzealous on purpose: having some mutable state is acceptable, but if you have so much that you're having trouble managing it, the solution is usually to have less, not to get better management tools
21:04AWizzArdjohncash: nope I meant :)
21:04AWizzArdjohncash: if you want to read two times from your global ref that is fine. You can’t do this with an atom, as it might have changed between the two reads.
21:04cbpAWizzArd: sure, but as far as I've tested there are no race conditions with the sockets
21:05johncashamalloy: wouldn't it depend on the domain? Some application domains could be inherently very stateful
21:06AWizzArdjohncash: let’s say you want to send money from one bank account to another. You first read from an account to see if it has a good balance. Then you withdraw a certain amount. But after reading the current balance and before doing this withdrawel someone else might have withdrawn all money in that account.
21:07johncashAWizzArd: doesn't that example assume two refs? one for each account balance?
21:07amalloyjohncash: there's no such thing as inherently stateful
21:08cbpthat example assumes a relational database
21:08cbpcus i don't want my money getting garbage collected no sir
21:08AWizzArdjohncash: just one ref {:accounts {"amalloy" {:balance 17000000}}}
21:08AWizzArdjohncash: but you access it possibly several times within one transaction.
21:08johncashAWizzArd: ah i get you now
21:09johncashamalloy_: is the _ suffix a convention for idleness?
21:10dbaschamalloy: well, real-time aircraft control is ridiculously stateful
21:11p_lmore like it's not "functional" in the way people associate with the word these days
21:11johncash(inc dbasch)
21:11lazybot⇒ 5
21:14amalloydbasch: sure, airplanes move around a lot in real life. but that doesn't mean that your program's model of airplanes has to be a big set of mutable Plane objects
21:14amalloyyou model reality in a way that makes programming to achieve your goals easiest; statefulness isn't thrust upon you by a problem domain
21:15dbaschamalloy: true, but until now it has been impossible to model certain systems with mostly immutable state because of hardware constraints
21:15AWizzArdI for example work with big mutable arrays.
21:15kwertiitechnomancy: Is there anything else I can try to make “Compilation failed: Subprocess failed” tell me something useful?
21:16AWizzArdEverything else would be by far too slow.
21:16dbaschamalloy: for example, I used to be part of a team that crawled the web constantly and we could not afford to keep every old state of the web, not even the internet archive can
21:17dbaschwe had to reuse storage space, delete old states
21:17dbaschthe idea of databases with version control has been around forever but mostly impractical, and at some point people would laugh at anyone who’d consider it for a real-life project
21:18dbaschof course it’s awesome that now we can model things with less state because of better hardware and software
21:20johncashand non-naive immutable datastructures
21:22kenrestivo"databases with version control".... um, datomic?
21:23kenrestivo1http://docs.datomic.com/clojure/#datomic.api/as-of
21:23kenrestivoehrm, i meant http://docs.datomic.com/clojure/#datomic.api/as-of
21:28arrubinkenrestivo: Datamoic is not the first temporal database.
21:28arrubinAnd the technique is not new.
21:28arrubinDatomic rather.
21:30arrubinA common technique is to use a trigger to move the existing data to an archive table.
21:59AWizzArdIs there
21:59AWizzArdIs there (dotimes [i n]
21:59AWizzArdoops
21:59AWizzArdIs there an await for futures?
22:03JachyAWizzArd: Just dereference the future.
22:04AWizzArdJachy: ah okay, it still has the blocking behaviour.
22:04AWizzArdI thought this was removed at some point, but good then, thx.
22:42sdegutisApparently (.delete tmp-file) does not delete the temp file. I found this out the hard way.
22:49mgaareanyone have a favored method of passing stateful dependencies like database connections to ring handlers?
22:52dbaschsdegutis: did it return true?
22:52dbaschmgaare: the easiest way is to use an atom
22:56sdegutisdbasch: never checked :)
22:58dbasch,(.delete (java.io.File. "blah"))
22:58clojurebot#<SecurityException java.lang.SecurityException: denied>
22:58dbaschmeh
23:03mgaaredbasch: yeah, I've tried that before, and some middlewares before
23:04kwertiitechnomancy: Found it. If a top-level form in clj being compiled throws an exception, ‘lein compile’ eats the exception and fails silently.
23:09kwertiitechnomancy: at least, that’s what happens in my real project. While trying to make a minimal example test case project, it *does* print the compile error. :/
23:26j0nianyone seen this error trying to require clojure.core.async? CompilerException java.lang.Exception: namespace 'clojure.core.async.impl.channels' not found, compiling:(clojure/core/async.clj:9:1)
23:26j0nieverything works fine in a toy project...
23:34TimMcI thought there was a lein task you could run that would give you a sort of lein task repl where you could enter things like "test foo.core" instead of running lein test foo.core
23:35dbaschj0ni: what do your deps look like?
23:38j0nidbasch: clojure.set, com.stuartsierra.component, taoensso.timbre and 2 of my own namespaces
23:38j0nieval-ing the ns form in cider gets me that error
23:39dbaschj0ni: I mean, is this a lein project and if so what does the :dependencies mapping look like
23:40j0nioh
23:40j0nihttps://gist.github.com/j0ni/b173f407fc30e41f05d3
23:40j0nidbasch: ^^
23:42j0nisorry, was private, just made it public
23:56j0nihmm, it appears to be due to capacitor
23:58dbaschj0ni: yes, it has its own core.async