#clojure logs

2013-01-08

00:12tomojwhy would you need `lein repeat` to get a clean state?
00:30pppaulhello
00:36bbloomi'm pretty sure haskell's type system just empowers you to write programs that you shouldn't ever write b/c no 1 can ever understand them
00:39tomojby "no 1" do you mean something like "people who haven't spent a lot of time using haskell" ?
00:40bbloomi think the real problem is that the only time i ever read haskell is when i want to implement some algorithm that i probably couldn't understand in clojure either
00:40gtrakanybody ever try to deal with openstreetmap data? what's the best way right now? Just downloaded a dump of a state.
00:43aaelony_at some point, you come to the conclusion that in order to understand a particular library, you're going to have to dive into and understand the source. When faced with a bithub src directory with a bunch of subdirs, what do people typically do to get a sense of things?
00:43aaelony_github
00:43gtrakaaelony_ , I find the best way is to get it compiling, then use emacs for code navigation... it's way faster.
00:43gtrakrepl it
00:44gtrakand I feel this way about every clojure library ever
00:44aaelony_it would be nice to have a tool or something that could give a general idea of function flow, or whether the functions are mostly standalone or not, if not, then how then depend, etc..
00:45gtrakgrep works pretty ok for that, sometimes it just takes time, but clojure source is small enough that you can read all of it usually
00:45aaelony_gtrak: where do you usually begin to grep it or repl it?
00:45gtrakthe tests
00:46aaelony_I guess, the trick is to find the starting point. then the rest makes sense, since you know whence it came
00:46tomojbbloom: I think when you read haskell, you can't just read the code, you have to meditate on the types to understand it. which is pretty different from most languages
00:46aaelony_the tests!!! awesome, thx
00:47aaelony_maybe the tests *are* the docs...
00:48gtrakok, I have a 1GB xml file ;-), what now?
00:48bbloomtomoj: yeah, but then people go and add a bunch of unnecessary type aliases that just confuse me more :-P
00:48bbloomhow is a C different than a P ? oh wait, they are both Qs
00:48bbloomwtf is a Q ?
00:49gtraklike you just don't care?
00:49bbloom*sigh*
00:50tomojyeah they tend to like cute little names for things :(
00:50tomojI guess some of the information we convey in a name is conveyed by the type
00:50aaelony_gtrak: does a schema for the xml file exist?
00:51tomojer, _more_ information than we convey in a name..
00:51tomojusually
00:51gtrakaaelony_ yes, I think so, it's openstreetmap
00:51aaelony_hopefully its helpful...
00:53gtrakI'm trying to compile all the intersections in a city
00:53gtrakjust for shits and giggles
00:54tomojguess you need a lazy xml parser?
00:54aaelony_sounds cool
00:54gtrakyea, looking at clojure.data.xml
00:54aaelony_xml-seq ??
00:54lazybotaaelony_: Uh, no. Why would you even ask?
00:55aaelony_heh
00:55gtrakhah
00:55gtrakis it so ridiculous?
00:56gtrakxml-seq doesn't look bad
00:56aaelony_or maybe zippers
00:56gtrakI'm going to have to filter it a lot, I think
00:56gtrakthen cross-correlate
00:57gtrakit's meant to go in a database, but whatever
01:02alex_baranoskydo you guys use hiccup for generating XML?
01:03gtrakas it turns out, clojure.xml is not lazy :-)
01:03Raynesalex_baranosky: I'd hope not.
01:03Raynesalex_baranosky: Why would you? clojure.xml supports the same syntax.
01:04Raynesalex_baranosky: Also, did you figure out the problem with your irc stuff?
01:04alex_baranoskywhy I ask is that we have a bunch of old 1.2 code that generates hiccup-like vectors and makes XML from them using contrib.prxml… what's the easiest migration path off of contrib for that code ?
01:04Raynesalex_baranosky: clojure.xml has stuff that can take prxml structures.
01:05alex_baranoskyRaynes: I'm pretty tired tonight, so haven't put much thought into it… I'm back to COloquoy for now, and will debug the situation better otmorrow
01:05alex_baranoskyRaynes: ahhhh, I didn't know that, I thought it only worked with the map format
01:05alex_baranoskythanks
01:05aaelony_alex_baranosky: I asked a similar question a while back… the following works for me, maybe it is enough for your needs to? https://www.refheap.com/paste/8200
01:06RaynesUgh
01:06aaelony_ha
01:06RaynesJust use clojure.xml :p
01:06RaynesAlso, I'm being stupid.
01:06alex_baranoskyaaelony_: looks like your `x` is not hiccup-formatted
01:06Raynesdata.xml
01:06aaelony_i'm not using hiccup
01:06Raynesalex_baranosky, aaelony_: I meant data.xml when I was saying that crap above. Please ignore everything I've said before now. data.xml, the contrib lib, has what alex wants.
01:06aaelony_currently
01:07alex_baranoskyyeah, I knew what you meant :)
01:11devnhttp://getclojure.org/
01:12devnstill very beta
01:12tomoj500 :(
01:12devnno pagination yet, so don't blow up your browser by searching for let
01:12tomojhttp://getclojure.org/search?q=%28juxt+identity+inc%29
01:12devntomoj: it's propagating, must have not made it to you yet
01:12devntomoj: oh, oof
01:12tomojI see
01:13tomojsupposed to search for a symbol, not a form?
01:13devnyeah, start with a symbol
01:13devnlike butlast or something
01:14tomojthese coming from codeq or what?
01:14devnoutput is screwed up -- it should be disabled when the result is ""
01:14devntomoj: not *yet*
01:14tomojwell, still cool
01:15devntomoj: ive been toying with extending codeq with amrbose' analyze
01:15holohi
01:15devnambrose*
01:15rlbI have a situation where it looks like case isn't working for strings, but I assume I'm just doing it wrong. Anything obvious I might be missing?
01:15devnrlb: case?
01:15devnrlb: got an example?
01:15rlb(case x "foo" 42 "bar" 99)
01:15tomoj&(case "foo" "foo" 42 "bar" 99)
01:15lazybot⇒ 42
01:15tomojseems to work
01:16rlbright
01:16Raynesdevn: Where is the source code?
01:16Rayneshttps://github.com/devn/getclojure duh
01:16devnRaynes: that's sort of the mess i've left
01:16Raynesdevn: Awww, no laser.
01:16RaynesI thought we were friends, man?
01:16devnlaser?
01:16RaynesI thought we were friends.
01:17Rayneshttps://github.com/Raynes/laser coolest new thing on the market
01:17holowith {:foo nil, :spam nil} has the same practical functionality as {}, but i can't test it as empty? . how can i achieve this kind of testing for the first map without filtering out all the nil values from the map?
01:17devnRaynes: oh, cool
01:18tomojholo: not the same practical functionality, not even for ILookup: ##[(get {:foo nil} :foo 3) (get {} :foo 3)]
01:18lazybot⇒ [nil 3]
01:18tomoj&(contains? {:foo nil} :foo)
01:18lazybot⇒ true
01:19tomoj&(seq {:foo nil})
01:19lazybot⇒ ([:foo nil])
01:19tomojetc
01:20holotomoj, i see. didn't remember that one hehe
01:20amalloydon't forget ##[(get {:foo nil} :foo 10) (get {} :foo 10)]
01:20lazybot⇒ [nil 10]
01:21tomojoh, it works with 10 instead of 3? :P
01:21tomojanyway, ##(empty? (keep identity (vals {:foo nil, :spam nil}))) or something
01:21lazybot⇒ true
01:23holokeep - any reason for such a name?
01:24holo>.> if i knew keep, i would have spared some filters
01:25holotomoj, thanks, that was a great one liner
01:26holoamalloy, thanks
01:34amalloyhah. i can't read, tomoj. i saw a pair get returned and assumed you'd demonstrated ##(find {:foo nil} :foo)
01:34lazybot⇒ [:foo nil]
01:34tomojfind is not in my vocabulary
01:35tomojwhy is it useful?
01:36tomojmaybe for ##(conj {} (find {:foo nil} :foo)) ?
01:36lazybot⇒ {:foo nil}
01:36amalloy(when-let [[_ v] (find m k)] ...)?
01:36tomojah, because it's truthy no matter the value
01:36tomojneat
01:36amalloyit's a handy way to combine contains? with get
01:38holooh, ok i got the meaning of keep..
01:40gtrakgosh, clojure.data.xml sure spends a lot of time in Symbol.intern
01:40amalloykeywords, man. reading them from strings is expensive
01:41gtrakbut I can count over the 1GB xml file in 30 seconds
01:41gtrakso, I guess that's good enough
01:41tomojhow much of that is keywords?
01:41gtraklike all of it
01:41gtrakaccording to jvisualvm sampler, haven't tried the profiler yet
01:42gtrakI'll giver her a go
01:43gtrakah, maybe it's not as bad as I thought
02:14francisI just cloned the clojure.data.xml repoistory and would like to run some tests, however it seems that clojure.data.* projects don't use leiningen - what is the standard way of running tests for these projects?
02:22alex_baranoskyanyone know how to run tests for the Clojure core maven-based projects?
02:27noidialex_baranosky, mvn test? :)
02:34seangroveWill cljs source maps potentially work with code compiled in advanced mode?
02:34seangroveWould make debugging *slighty* easier
02:36bbloomseangrove: i believe that is the goal
02:36bbloomhowever, advanced mode compilation might be like a release mode C compilation
02:36bbloomwhen debugging C code with full optimizations disabled, the debugger doesn't always move linearly or execute every line
02:37bbloometc
02:37bbloomi mean enabled
02:38seangroveYeah, I'm just getting an error, and the stack trace is useless - I don't even know where it might be coming from in the source
02:38bbloomdoes it happen w/o advanced mode?
02:39seangroveNope
02:39bbloomare you using aget anywhere?
02:39seangroveYes, a few places, actually
02:39bbloomsearch for those
02:39bbloomanywhere you aget with a string is potentially your problem
02:39seangroveBuilt everything up with simple, and now I've just been going through with advanced mode and stamping out errors
02:39seangroveok, will grep now..
02:40bbloom(aget obj "abc") compiles to obj["abc"]
02:40bbloomwhich might not be valid if abc has been minified
02:40Ember-oh, lol. What's the shortest implementation in Clojure that will cause a StackOverflowError?
02:40Ember-,(#(%%)#(%%))
02:40clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError>
02:40Ember-&(#(%%)#(%%))
02:40lazybotjava.lang.StackOverflowError
02:40Ember-:)
02:40Ember-got it from here http://codegolf.stackexchange.com/questions/9359/shortest-program-that-throws-stackoverflow-error
02:40bbloom,(fn f[](f))
02:40clojurebot#<sandbox$eval59$f__60 sandbox$eval59$f__60@6076264f>
02:41bbloom,((fn f[](f)))
02:41clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.StackOverflowError>
02:41Ember-bbloom: one character longer ;)
02:41bbloomEmber-: yes, but my IRC client has a variable width font -- i win there
02:41Ember-:D
02:41Ember-cheater!
03:11alex_baranoskyAnyone got a good idea how to parse something of this form without using a read-string? "(= {:A 1} {:a 1, :c 3, :b 2, :d 4, :e 5})" I want to transform it into ["=" "{:A 1}" "{:a 1, :c 3, :b 2, :d 4, :e 5}"] where each of the three pieces can be any code clojure could write, but which I may not be able to read at the moment
03:13noidialex_baranosky, why can't you use the reader?
03:13alex_baranoskybecause the forms aren't readable
03:17alex_baranoskymaybe I just read one char at a time, and keep stack of {'s, ('s, and ['s and use a simple approach like that
03:18alex_baranoskybut it seemed like maybe something already existed for this
03:18alandipertalex_baranosky: a parsing lib? or cobble together a reader with PushbackReader that does whatyou want
03:18zilti`alex_baranosky: Probably regex?
03:19noidialex_baranosky, IIRC, Counterclockwise uses Parsely and a custom grammar to parse Clojure code. Maybe you could lift some code from CCW :)
03:20alex_baranoskythanks, I may check it out
03:20noidihttps://github.com/laurentpetit/paredit.clj
03:36alex_baranoskyI wonder if sjacket may be of some use: https://github.com/cgrand/sjacket
03:44ejacksonRaynes: what are your thoughts on XPATH selectors ?
04:12Raynesejackson: xpath
04:12RaynesI do not know what this is.
04:15ejacksonits a selector thingy that I recently came across
04:16ro_stselect xml using a nested path syntax
04:16ejacksonhttp://www.w3.org/TR/xpath/
04:16Raynesejackson: Oh, I see, looks neat.
04:16ejacksonits pretty old, but its got some really nice functionality
04:16ro_stRaynes is too young to have fussed with xml :-)
04:16RaynesThis is one of those things you could implement on top of laser's existing selectors (probably need to add more selectors though).
04:16ejacksonkids these days, forgetting the old ways (in this case, probably a good thing)
04:17RaynesBut you can't do XML with Laser.
04:17RaynesIt uses a validating HTML parser.
04:17ejacksonsiblings was really interesting
04:17bbloomejackson: with the exception of the attributes vs elements distinction, xpath & xquery were probably among the only good things to come out of XML :-P
04:18RaynesIt could be used with xml in the same capacity as enlive is, but jsoup currently lacks a way to parse xml fragments.
04:18ejacksonbbloom: i still have no idea what the distinction is. Baffled me every time
04:19bbloomejackson: the only really interesting distinction has to do with streaming parsers/writers
04:19ejacksonRaynes: anyway, you might find some nice ideas for laser in there.
04:19Raynesejackson: Indeed. Thanks for the tip.
04:19bbloomejackson: an element start tag can't be written without all it's attributes
04:19bbloomso in that sense, it's like a header
04:19ejacksonok
04:19bbloomif you have a streaming XML reader, you may never see an end tag, but you won't see the head tag unless you also see all of it's attributes
04:20gozalaHi Folks do I need special privileges to comment on http://dev.clojure.org/display/design/Feature+Expressions ?
04:21ejacksonyesterday I wrote an xpath: "//td[text()='foo']//following-sibling::td[2]", which gets the second sibling of all TDs containing the text foo. I thought it was pretty neat.
04:21ejacksonbut I'm nooby at that sort of stuff
04:31tomojbut why strings?
04:32ejacksontomoj: in the xpath ?
04:33ejacksoni think it just predates data-thinking
04:33tomojI mean, why use xpath or css string selectors when we have functions and data?
04:33tomojyeah
04:34bbloomit's useful for the same reason that regexs are useful
04:34bbloomit's short hand for something you might do a lot
04:34bbloomyou could write a state machine out by hand
04:35bbloomand somebody who doesn't know regexes could read that
04:35bbloombut we write so many damn regexes, we might as well come up with a language to maximize our productivity there
04:35tomojyou can have short hand without putting it all into a string
04:35bbloomxpath & css selectors are codifications of a short hand for particular problem domains
04:35bbloomi think css selectors are a nightmare, but that's another issue
04:35bbloom:-P
04:36bbloomtomoj: do you have a reasonable feature-complete edn-encoded xpath schema?
04:36bbloomthat is, can you express all xpaths/queries ad edn in a way that makes sense?
04:37tomojdoubtful, you need some functions
04:37tomojbut I'm not writing laser, anyway :)
04:37bbloom:-P
04:37tomojjust a bit puzzled by "Biggest TODO at the moment is a function for turning a string representing a CSS selector into a selector function you can use (by combining existing selectors)."
04:38tomojwell
04:39tomojyou need some functions, but maybe they're just symbols in the data
04:40tomojdoesn't seem inferior to putting a bunch of special keywords like following-sibling in xpath
04:40tomojseems superior since you can extend it
04:41tomojand it's programmable
04:41xumingmingvI am compiling a project(using lein), but one of the file compiled twice, and then the lein process hangs, anyone knows the reason? stacktrace: https://www.refheap.com/paste/8204
04:41ejacksontomoj: I wasn't suggesting a string be used for the selector. I was hoping there might be some selectors that XPATH makes possible that Raynes would be inspired by.
04:42tomojsure, I was mainly responding to that TODO note in laser's readme, you just triggered me
04:42muhooneeds the word "selector" in there more.
04:43muhooi was looking at bootstrap.js recently, and less looks like an attempt to make a dsl out of css.
04:43tomojisn't css already a dsl?
04:44ejacksonguess so
04:44tomojRaynes: that TODO seems like a case of reversed stupidity to me - don't give up on data selectors just because enlive has some problems, please :)
04:44xumingmingvnever mind, i find the cause
04:44ejacksontomoj: you're suggesting that instead of a query string be a data structure.
04:44ejacksona function composition say
04:45tomojof course, you've probably thought about it much more than I have
04:45muhoothat's what i got from that TODO entry: some way of composing selectors, maybe?
04:45tomojyeah, not strings, clojure data structures
04:46tomojpossibly including symbols referring to selector functions
04:46ejacksonoh, so like a hiccup thing ?
04:46ejacksonbut for building the selector
04:46ejacksonor a korma thing for sql
04:46muhooactually, i'm pretty sure laser parses html into a hiccup-like structure
04:46tomojsort of like hiccup, yeah
04:46tomojlike enlive, really
04:47ejacksonlike enlive :)
04:48muhooit seems to me like the use case is where you have chunks of html, but want to turn it into clojure data structures so as to Do Stuff (tm) to it.
04:48muhoowhich i guess is what enlive does, but maybe simpler?
04:49muhooanyway, neat stuff. will find an excuse to play with it soon.
04:49tomojI suppose it's intentional that you can't use ns aliases in reader literals :(
04:51tomojI just realized datomic took #db/id
04:51tomojso the reader literal namespace-namespace is apparently the wild west as well
04:51tomojunless rich just gets special privileges :)
04:51ro_stcourse he does
04:52abpIn a Compojure app that gets deployed into a servlet container later, should I just use ring.util.request/path-info to build any links etc., so the context-path of the servlet is always present?Also, is it a good idea to develop using jetty locally when deploying into a servlet-container?
04:55N1c0test
04:56muhoothe docs say that unqualified literals are reserved (for rich, presumably).
04:57muhoobut qualified ones need to be unique i guess. so in that sense it's wild west like artifact naming maybe.
04:58muhoo#inst made life very pleasant in json-land recently.
05:09bbloomok wtf is the deal with this [trace missing] business?
05:09bbloomit makes debugging really annoying sometimes
05:12ejacksonyeah, I've had that one recently too
05:13Ember-ccw?
05:13clojurebotccw is http://github.com/laurentpetit/ccw
05:13Ember-it has a bug
05:13Ember-you need to use (pst) for now
05:14bbloomi'm using vim-foreplay
05:14bbloombut i've had it at the normal nrepl before
05:16TobiasRaederthere are probably some people using emacs + nrepl around here arent there?
05:17TobiasRaederi just migrated to the new clojure-mode + nrepl but when trying to hit enter in the nrepl i just get Wrong type argument: integer-or-marker-p
05:17TobiasRaederemacs 24.1.x
05:17ejacksonTobiasRaeder: not seen that, sorry.
05:18dimovichhello ppl
05:19dimovichfor a new type, how would one implement withMeta from clojure.lang.IObj?
05:23bbloomdimovich: simply add a meta field to your type and then call your constructor with the new meta
05:24bbloom(deftype Foo [a b m] clojure.lang.IObj (withMeta [this meta] (Foo. a b meta)))
05:24bbloomor, if you use reify, you get metadata for free
05:24dimovichbbloom, thanks a lot
05:32Raynesejackson: Uh, what was he calling me stupid for?
05:34Raynesejackson: Wait, was he saying it was stupid for me to implement real CSS selectors instead of some ridiculous vector and keyword representation?
05:34RaynesI don't get it.
05:34RaynesI'd rather not implement selectors at all. I think we should just use functions instead.
05:35RaynesI don't know what he means by 'data selectors'.
05:54ro_stwhy would someone use scala instead of clojure? in a nutshell.
05:55vijaykirantypesafety
05:55vijaykiranro_st: and "hybrid" programming
05:56vijaykiranro_st: by "hybrid" I mean - OO & Functional at the sametime.
05:56ro_stthat sounds terrifying
05:56ro_stthe hybrid bit, i mean
05:57vijaykiranro_st: I didn't say it is "good" :)
05:57ro_stok. i guess i was implicitly asking what the good reasons are
05:58vijaykirantypesafety is the one I see being pushed as important/good thing.
05:58ro_stand that's the typical class heirarchy with static type checking story?
05:59hyPiRionno, not afaik
05:59hyPiRionIsn't Scala doing more Haskell-like type derivation? I've not used Scala, so I may be way off.
06:02vijaykiranthe answer here summarizes better (of what I'd in my mind) - http://stackoverflow.com/questions/3112725/advantages-of-scalas-type-system
06:02ro_stthanks vijaykiran
06:03ro_stnow i'm more terrified.
06:05hyPiRionheheh
06:05Raynesro_st: Scala is pretty terrifying.
06:05ro_stit looks it. -closes tabs-
06:05hyPiRionMalbolge is worse though.
06:05bbloomi keep saying it: scala is to java as c++ is to c
06:06bbloomthat's all you need to know
06:06vijaykiranbbloom: +1 :)
06:06ro_stthat's four languages i've never used :-) doesnt' say much to me, personally
06:06ro_stbut i reckon i get the gist of it
06:07ro_stscala now has 'condemned. stay out' on it in my head.
06:08RaynesScala is a kitchen sink language.
06:08RaynesIt's worth looking at, but I wouldn't want to write code in it.
06:08RaynesThey just added macros in the latest version.
06:08RaynesWhile that might sound like a good thing, if you've ever seen a piece of even marginally complex Scala code and tried to read it you'd understand why it really isn't.
06:09ejacksonRaynes: macros in a non-homiconic language is just rusty-nail eyeball scraping.
06:10RaynesI had someone telling me that Nimrod's macros are more powerful than Lisps a few days ago.
06:10ejacksoni keep being tempted by "its like Haskell, but on the JVM"...
06:10bbloomit's all the complexity of haskell with all the verbosity of java
06:10RaynesI was left pretty speechless.
06:10ejacksonthat's quite scary
06:10hyPiRionbbloom: I don't think it's specifically verbose though. It's just that there's so much stuff in Scala that you have to remember
06:11hyPiRionAnd so many special cases etc.
06:11bbloomi'm currently porting this: http://hackage.haskell.org/packages/archive/FPretty/1.0/doc/html/src/Text-PrettyPrint-FPretty.html to clojure
06:12bbloomhere's the scala version: http://code.google.com/p/kiama/source/browse/src/org/kiama/example/imperative/PrettyPrinter.scala
06:12bbloom*cringe*
06:12bbloomooops wait
06:12bbloombad link
06:13ro_stscala looks like java with four times more syntax rules
06:13bbloomdammit google code, why can't you suck less and be more like github?
06:14bbloomhere: http://code.google.com/p/kiama/source/browse/src/org/kiama/output/PrettyPrinter.scala
06:14bbloomhyPiRion: compare that to the haskell version
06:14bbloomwhich, btw, the haskell version also lacks some serious bugs b/c it includes a normalizer that is necessary according to the original paper lol
06:17bbloomif i had to write java, i'd rather write scala, but i suspect i only say that now like i used to say "if i had to write c, i'd rather write c++"
06:17bbloomnow i rather quit and get another job :-P
06:21hyPiRionMan, I am happy I don't have to touch so much C++
06:25Raynesbbloom: I feel like I'd probably rather write C.
06:25bbloomRaynes: that's what i'm saying, i prefer C to C++
06:25RaynesOh.
06:25bbloombut i was saying that i *might* prefer scala to java
06:26bbloombut that might only be because i *used to* prefer C++ to C ... until i used C++
06:26bbloom:-P
06:26bbloomi've written some non trivial toy apps in scala and found it to be a huge step up over java, but i feel like it might have just felt liberating coming from java
06:28jro__bbloom: what is your preferred way to write scala? Following Haskell style, or just as extended Java?
06:29bbloomjro__: i don't really have a preferred way b/c i only used it for a few weeks a few years ago
06:29bbloomjro__: but i suspect it would be like how google uses c++: like C with 2 extra features
06:29bbloom:-P
06:30alex_baranoskyany idea why "[:method [:-cdata "Overnite FedEx"]]" would be getting parsed as a clojure.data.xml.Element and not a clojure.data.xml.CData? ?
06:41asteveI have a line that is `1123.918 [0 1.1.1.1:57979] "do" "something"` and I want to remove from [ to ]
06:43ejacksonstr/replace should do it ?
06:44asteves/replace #"\[\.\+\]" "")?
06:44ejacksonyeah
06:51bbloomis there a function version of doall to force side effects?
06:52bbloomlike i want (mapv print foo) without having a big empty vector of nils
06:52bbloomrather than (doseq [x foo] (print x))
06:53bbloombasically: (defn each [f coll] (doseq [x coll] (f x)))
06:54ro_sti guess there is now :-)
06:54asteveejackson: do you see something wrong with this: (let [clean-tuple (s/replace tuple #"\[\.\+\]" "")]?
06:56noidibbloom, there's dorun
06:56noidi,(doc dorun)
06:56ro_st#"\[[^\]]+\]"
06:56bbloom(doc dorun)
06:56clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."
06:56clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."
06:56bbloomsooo (dorun (map print coll)) ?
06:56noidiyes
06:56bbloomok cool, i figured that existed
06:56noidiit's not your `each`, but it doesn't retain head like doall does
06:57bbloomthe main reason i want the each thing is b/c i frequently find myself creating sequences via ->> and then, for debugging purposes, wanting to slap a (each print) at the end of the chain
06:59ejacksonasteve: (str/replace "1123.918 [0 1.1.1.1:57979] \"do\" \"something\"" #"\[.*\]" "")
07:00ejacksondon't escape the .+
07:00ejackson,(str/replace "1123.918 [0 1.1.1.1:57979] \"do\" \"something\"" #"\[.*\]" "")
07:00clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: str, compiling:(NO_SOURCE_PATH:0)>
07:00ejackson,(replace "1123.918 [0 1.1.1.1:57979] \"do\" \"something\"" #"\[.*\]" "")
07:00clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$replace>
07:00ro_stclojure.string/replace :-)
07:00ejackson,(clojure.string/replace "1123.918 [0 1.1.1.1:57979] \"do\" \"something\"" #"\[.*\]" "")
07:00clojurebot"1123.918 \"do\" \"something\""
07:00ejacksonro_st: hehe, was just checking ;)
07:03ejackson,botsnack
07:03clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: botsnack in this context, compiling:(NO_SOURCE_PATH:0)>
07:03ejacksoni tried
07:03ejacksonI'll give to the other bot... you watch me !
07:03ejackson$botsnack
07:03lazybotejackson: Thanks! Om nom nom!!
07:03ejacksonyeah.... yeah.... how you like that ?
07:07aroemersAny of you Clojurians know of a job opening in Clojure in the Netherlands?
07:10aroemersNot all at once! :P
07:10ejacksonhehe, sorry dude.
07:11aroemersSuspected that it would be difficult, but hey, I can try
07:12ro_stjob for you if you live in Cape Town, South Africa :-)
07:13ejacksonaroemers: you should immigrate.
07:13ejacksonClojure in Cape Town .... what a pleasure.
07:13aroemershmm, the commute is a tad long from here
07:13hyPiRionpsh, 12 hrs?
07:14ejacksonbut no jetlage !
07:14Raynesaroemers: Don't feel too bad, I've got to move 2000 miles in less than one month for a full time Clojure job.
07:14aroemerstrue
07:14ejacksoni had to give up my job to do clojure !
07:14ejackson:)
07:15aroemersejackson: but you found a job in it?
07:15ejacksoni created one :)
07:15ejacksonmetacircular employment
07:15ejacksonvery lispy
07:15aroemersRaynes: oh, I am willing to travel, but Cape Town...
07:15aroemershehe, nice
07:16asteveejackson: thanks for the help
07:16Raynesaroemers: If you're willing to travel, travel to California. So much Clojure there that they've parenthesized all road signs.
07:16ro_sthaha
07:16ejacksonaroemers: however, I am teaching a Clojure course in Amsterdam with samaaron and cgrand in a couple of months !
07:17hyPiRionThere's a place in Finland afaik
07:17ejacksonyeah, there's lots in Finland
07:18aroemersejackson: an introductionary course I guess?
07:18ejacksonLondon too if you want to do banking
07:18ejacksonaroemers: and an intermediate
07:18ejacksonotherwise cgrand gets too bored and starts drawing on the walls...
07:19aroemershehe
07:19aroemersintermediate might be interesting, where can I find more info?
07:20ejacksonwww.lambdanext.com
07:21ejacksonnot much there now, but we're planning quarterly courses, with Amsterdam being the next
07:21ejacksonsign up and you'll get the mailshots
07:22aroemersdone
07:23ejacksongroovy - you can be the official beer guide !
08:17cemericktpope: I finally got around to releasing nREPL 0.2.0-RC2 last night. Sorry for the stupid delay, I just totally forgot about it. :-(
08:17Raynescemerick: When are you going to write nREPL for Haskell?
08:17cemerickha-ha
08:18Raynescemerick: Did you ever find someone to write those examples?
08:18cemerickyup
08:18RaynesI felt bad for not doing it. I totally would have, it just would have taken a while because I'm unfamiliar with most of those languages.
08:18cemerickwell, then it's good that you didn't :-)
08:19RaynesIt would have taken me a while because I would have written *good* examples.
08:19RaynesAsshole.
08:19cemerickI wanted the resulting code to be somewhat idiomatic, since it'll be used for public examples/documentation.
08:19cemerick:-P
08:19RaynesI've got friends proficient in every language under the sun. Somebody would have reviewed my code.
08:19Raynes:p
08:20cemerickRaynes: I welcome your haskell examples, using the JVM lib via whatever they use for C++ calls
08:20RaynesScary.
08:20cemerickdid that in python once
08:55varioustexit
09:36RaynesJust wrote a 3685 word guide to laser.
09:36RaynesI am satisfied with myself, to say the least.
09:39hyPiRionSounds long
09:41RayneshyPiRion: Sounds awesome, you mean.
09:42hyPiRionWell, they're not mutually exclusive.
09:42xeqisounds like its almost one yegge long
09:42hyPiRionOkay, wasn't as long as I feared it would be
09:43RaynesIt is meant to be thorough. :p
09:45hyPiRionAt least it's not like me, I sometimes have longer commit messages than the commits themselves.
09:45ro_stwriting a technical book will beat that right out of you -grin-
09:46ro_stlast time i tried to write a tech book i nearly died.
09:46Raynesro_st: I was writing a book, but I hit pause for now.
09:47RayneshyPiRion: Funfact: this guide is longer than laser itself.
09:52hyPiRionRaynes: I think a lib I made has more lines with docstrings than code.
09:53hyPiRionUrgh. Actually, 3685 is totally fine.
09:54hyPiRionAfter looking at my own docs, 3685 is succinct.
09:59RayneshyPiRion: The fact that you write a lot of documentation isn't necessarily a bad thing.
09:59RayneshyPiRion: https://github.com/hyperion This isn't you, is it?
10:01hyPiRionRaynes: yes.
10:01RaynesReally?
10:01hyPiRionWait, hyPiRion it is
10:01babilen:-D
10:01RaynesI was about to say
10:01hyPiRionI said yes to "This isn't me".
10:02RaynesIf this guy is you, you sure are a majestic and handsome feller.
10:02hyPiRionAnd apparently Greek too.
10:02RaynesYeah, definitely not as majestic as this other guy.
10:02hyPiRionWell, Russian, but both are Greek to me anyway.
10:02RaynesHe is remarkably picturesque.
10:03hyPiRionRaynes: If I photoshop a crown on top of my head, would that make me more majestic?
10:03RayneshyPiRion: Wow, you were boring as hell from June to October.
10:03Rayneshttps://github.com/hypirion
10:04hyPiRionRaynes: On github, yes.
10:04RaynesI'm looking at all your private code too though.
10:05RaynesI traced your IP address with a visual basic program and hacked in.
10:06hyPiRionWell damn it
10:06hyPiRionYou got me there.
10:07hyPiRionRaynes: I was generally boring as hell pre October really
10:08S11001001Raynes: a visual basic gui?
10:09RaynesS11001001: Definitely.
10:09S11001001Well, I traced the physical location of the binary from hyPiRion
10:10hyPiRionI'm apparently a lucrative target for hackers.
10:11juxovecisn't APL more suitable for this kind of job?
10:20RayneshyPiRion: You're a pretty cool guy for a new guy.
10:20RaynesI'm probably exaggerating 'new', but I only noticed you coming out of your shell at least in the past maybe 2 months.
10:21RaynesI like active new guys. <3
10:22hyPiRionRaynes: heh, thanks
10:23hyPiRionI appreciate it :)
10:23RaynesIt's weird how I can still pick new people out of a crowd of over 500.
10:24Raynes"Oh, cool, never seen him send a leiningen patch before."
10:24Raynes"TARGET ACQUIRED. BEGIN SURVEILLANCE."
10:26hyPiRionHmm, that's also a way of finding out, but it has one flaw though
10:27hyPiRion"Huh, who is Rich Hickey? Never seen him send in a Leiningen patch"
10:27Rayneslol
10:27hyPiRion"Must be a new kid"
10:27RaynesI was implying that it was merely one method.
10:27S11001001would be accurate hyPiRion :)
10:27RaynesI also know, for example, that S11001001 is not as active as either of us, but still talks on occasion, while juxovec was pretty much just born here.
10:29uvtcRaynes: could you please send me a copy of hyPiRion's dossier? I seem to have misplaced my copy since the last insider's meeting.
10:29hyPiRionjuxovec sounds like a combination of juxt and vec.
10:29juxovecRaynes I am very new to Clojure and all the functional programming world
10:30juxovecgetting thru SICP days and nights these times :)
10:30hyPiRionI like that.
10:31uvtcOh fiddlestix; that was my best joke all morning.
10:31Raynesjuxovec: Welcome!
10:31Raynesjuxovec: I for one am very happy to have you. :)
10:31RaynesI can already tell that we'll be the best of friends.
10:31juxovecthanks a lot :)
10:32uvtcjuxovec, are you using a Scheme, or using Clojure with SICP?
10:32juxovecmit-scheme
10:32juxovecand trying the same things in Clj too
10:35uvtcSounds fun. I haven't gotten as far as I'd like in that book. The "counting change" example was pretty darn amazing to me. Should probably go back with Clojure in-hand.
10:35juxovecafter 2 weeks playin with clj I finished small affiliate server + I am finishing some helper app for my fiancee's job. And I really like (this (new (approach))) :)
10:35Raynes:D
10:38clgvjuxovec: better (approach (new (this))) in terms of execution order or (-> (this) new approach) ;)
10:40juxovecclgv:correct :)
10:43juxovecafter 14 years of imperative/oop programming, there's only one problem. I don't see places where I can use macros. I am comfortable with functions all the day, but I realize that there absolutely new space in reaching DRY with macros.
10:45foodoojuxovec: The first rule of the macro club is: Don't write macros
10:46foodoojuxovec: If functions help you enough with DRY, then everything is fine
10:47Raynesjuxovec: That's a good thing.
10:51juxovecfoodoo: the thing is that there maybe are places where I can use macro. I just doesn't see it because I am in the prison of "use given syntax and don't complain"
10:52clgvjuxovec: you will notice macro application opportunities when you notice "thats absolutely similar code structure but I cannot implement that structure only with functions and higher order functions"
10:52nDuffjuxovec: ...well, it's better to start by finding a place when you want to do something but can't without them.
10:52nDuffjuxovec: macros are great when you need them, but they're trouble when they're a solution in search of a problem.
10:55RaynesHave solutions, will trade for problems.
10:55juxovecmost of the time, I doesn't feel I need macro
10:56juxovecI used them, when I started making my own HTML form generator (http://pastie.org/5648725)
10:56francisjuxovec: clj-record is a great example of using to many macros
10:56francisjuxovec: you can view the author's apology here: http://elhumidor.blogspot.com/2012/11/why-not-to-use-my-library-clj-record.html
10:57juxovecso I can write (required ... other validation rules ... )
11:01jsabeaudryWhen looking at ring-jetty-async-adapter I see that it is 2 years old, is it stable or unmaintained?
11:14TimMcRaynes: An advantage of Enlive's CSS selectors, unless I misunderstand them, is that you can parameterize them without bothering with CSS encoding functions.
11:15TimMcRaynes: You know what would be fantastic? If I could write ["div.foo input[name=${bar}]" input-name]
11:15TimMcerr, {:bar input-name}
11:15RaynesI guess, but I don't really see how it's any better or worse.
11:16TimMcBecause it means you're not doing string concatenation, wherein lies sorrow, madness, and broken sites.
11:16RaynesI meant the paramertizing enlive selectors.
11:16Raynesparameterizing*
11:16TimMcAbstraction, broseph.
11:17RaynesStill not clicking.
11:17TimMcI'd like to write funcitons that take in parameters such as field names and do HTML transformations that target those fields.
11:18TimMcMaybe I'm wrong about something in Enlive, let me check...
11:18RaynesI don't see why you couldn't do that with laser.
11:18TimMcIf your suggestion involves a call to str I'm going to frown very hard at you.
11:19Raynes*shrug*
11:19TimMcRaynes: o\__/o
11:20TimMc(str "div.foo input[name=\"" (escape-css-attr-value input-name) "\"]") is asking for trouble.
11:21TimMcTHat approach will result in anything from randomly broken code to an exploitable security hole.
11:22RaynesTimMc: I was saying I don't see why you can't do it with regular selector functions.
11:23RaynesLaser doesn't do css selectors at all for the time being. I don't really care about them, so it'll be a thing I do when I get bored or something someone else does because they want them that bad.
11:26TimMcSure, it's just a thing to keep in mind.
11:33wingythere is a fn that returns what is passed to it i think .. what's the name of it?
11:33Raynesidentity
11:33TimMc$findfn 5 5
11:34lazybot[clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/time clojure.core/dosync clojure.core/long clojure.core/short clojure.core/+ clojure.core/* clojure.core/doto clojure.core/unchecked-long clojure.core/+' clojure.core/unchecked-short... https://www.refheap.com/paste/8226
11:34wingyyeah
11:34TimMcmua ha ha
11:34TimMcWAKE UP RAYNES
11:34RaynesNERRRR
11:35TimMc&(* "hello!")
11:35lazybotjava.lang.ClassCastException: Cannot cast java.lang.String to java.lang.Number
11:35yogthosTimMc: hey did that markdown-clj change make any difference? :)
11:36TimMcI dunno, it wasn't my bug.
11:36TimMccjfr<TAB> was the one who discovered it
11:36TimMcI was jsut the one who decided to yell at you for using with-redefs. :-P
11:36RaynesTimMc: Also, cegdown, cause I like competing with yogthos.
11:37yogthoslol
11:37yogthosRaynes: oh yeah should we stick that into lib-noir so we can provide md->html thingie? :)
11:37Raynesyogthos: Sure, we can do that. Even with pegdown as a dependency I think it's pretty lightweight.
11:38yogthosRaynes: I think so :)
11:43TimMcGrah, I still don't understand why (/ 0.0) throws and (/ 1 0.0) doesn't.
11:44TimMcTHe unary / doesn't inline, and just calls the binary version with a first arg of 1.
11:53S11001001TimMc: does the binary one inline?
11:53TimMcYes.
11:53TimMcHmm, do you suppose that the unary's call to the binary *doesn't* inline?
11:53S11001001for the unary case are you inlining (/ 1 0.0), or (/ 1 n)?
11:55TimMc([x] (/ 1 x)) https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L972
11:55S11001001great minds
11:55TimMcIn that instance, it doesn't know that x is a double, so I guess it goes to the general case...
11:56TimMc&(let [x (identity 0.0)] (/ 1 x))
11:56lazybotjava.lang.ArithmeticException: Divide by zero
11:56TimMcOho!
11:57TimMchttps://github.com/clojure/clojure/blob/clojure-1.4.0/src/jvm/clojure/lang/Numbers.java#L153
11:57TimMc^ if (yops.isZero((Number)y))
11:57TimMcSeems a bug to me.
12:09hyPiRion,(/ 0.0 0.0)
12:09clojurebotNaN
12:10peatIf any Clojure/Twitter hackers are intrested, the twitter-api project is working on Twitter API v1.1 support. If anyone is curious, or wants to help test the pre-release branch: https://github.com/adamwynne/twitter-api/tree/resource-naming
12:12TimMc&((juxt (comp) #(%%%)) 5)
12:12lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
12:14TimMc&((juxt (comp) #('%%%)) 5)
12:14lazybot⇒ [5 5]
12:14TimMchyPiRion: ^ a shorter identity
12:14TimMcfor all your golfing needs
12:15jlewisor #(do %)
12:15TimMcHmm, if you don't count spaces, that is the same length.
12:16TimMc&((juxt (comp) #('%%%) time) 5)
12:16lazybotjava.lang.RuntimeException: Can't take value of a macro: #'clojure.core/time
12:16TimMcoh right
12:17jlewisi don't understand what #('%%%) is
12:17TimMc,(min "g")
12:17clojurebot"g"
12:17technomancyin the shower this morning I actually came up with a justifiable use for a juxt inside a juxt.
12:17TimMcjuxtifiable
12:18TimMcOK, min is a clear winner
12:18technomancyaw yeah
12:18uvtcteehehe
12:18tmcivertechnomancy: hey, what a man does in the shower is nobody's business.
12:18TimMctmciver: Except when it's code golfing.
12:18jlewisooh, min.
12:18gfredericksamalloy_: ping?
12:20TimMc&((juxt (comp) comp) 5)
12:20lazybot⇒ [5 5]
12:20TimMc\o/
12:21TimMcjlewis: ##'#('%%%)
12:21lazybot⇒ (fn* [p1__194818#] ((quote p1__194818#) p1__194818# p1__194818#))
12:21jlewisummm...
12:21jlewisi don't think that clears anything up :)
12:22Raynesdrewr: Hey Mr Last Name Sounds Like My Nickname. Why does postal require :from? You can configure this for sendmail outside of postal. Not even sure what to put there.
12:23drewrRaynes: haha.. re: names I had no choice
12:23gfredericksamalloy_: unping
12:24drewrRaynes: the purpose of postal was to quickly generate a well-formed rfc822 message in a clojurey way, and send it via SMTP to a smart host
12:24drewrthat's the case it's optimized for
12:24drewrbut I'm curious -- why would you construct a message without from:?
12:25drewryou can always set the envelope sender to something else
12:25Raynesdrewr: It doesn't seem to do anything after I configured it in main.cf. I can put "random person" and I still get the thing I put in main.cf.
12:26drewrsure, sendmail is going to have the last word if you're using it as the transport
12:26drewrit can do whatever it wants to your headers (and more!)
12:26TimMcjlewis: Simplified: (fn* [arg] ('arg arg arg))
12:27TimMcjlewis: Since 'arg is a symbol, unrelated to the value being passed in, it tries to look itself up in arg.
12:27Raynesdrewr: I just figured that since you supported sendmail, :from could be optional. It doesn't seem to actually matter though.
12:27TimMcSince it inevitably fails, being a gensym, it defaults to the second argument: arg
12:27TimMcjlewis: Blame hyPiRion.
12:27RaynesBut disclaimer: I do not know how mail works at all.
12:29drewrpostal also uses from: to populate the envelope sender so you don't have to explicitly define both
12:30jlewisTimMc: *shudder*
12:30RaynesSo there are reasons for :from that I can't see, which would make it bad for me to give it a bogus value? The problem I'm facing at the moment is that I expect sendmail to be configured however and I don't have access to that information.
12:30clgvwhen I want the same function to handle a route for GET and POST how do I define that in compojure?
12:30jlewisTimMc: but kind of awesome, i admit.
12:32weavejesterclgv: You can have both routes call the same function. Or if this is a common problem and not an exception, you can define some middleware.
12:32iwohey, does anyone know how to do the reverse of clojure.data.xml/sexp-as-element?
12:33clgvweavejester: ah ok so there is no built-in abbreviation to write it only once?
12:33iwoi have some xml and i'd like to create an sexp that represents that xml, the structure of the sexp should be the kind of thing that sexp-as-element accepts
12:33weavejesterclgv: No, because strictly speaking it's not good practise. There are exceptions, especially when integrating with legacy systems, but they tend to be rare.
12:34TimMc&((comp (comp comp) (comp)) 5)
12:34lazybot⇒ 5
12:35iwoclojure.data.xml/parse appears to create a more verbose structure with keys like :content and :attrs
12:36TimMc&((comp (comp ((comp) comp) comp) comp (comp)) 5)
12:36lazybot⇒ 5
12:36TimMcOK, I'm done.
12:37egghead(def dove (comp comp))
12:37technomancyegghead: spoilers!
12:38eggheadtrue
12:38hyPiRionTimMc: My identity fn is swearjure-usable
12:38hyPiRion:(
12:38eggheadI just wrote a blog post on to mock a mockingbird, good stuff
12:39TimMcTrue, that is an... advantage.
12:39technomancyegghead: linky?
12:39technomancyI got stuck right around the dove and have been meaning to circle back to it
12:39hyPiRionindeed. Very practical when you're goofing off trying to do nothing.
12:40eggheadheh, it's a little long winded technomancy and uses js for the example code: http://samesake.com/log/2013/01/03/Three-little-birds/
12:40clojurebothttp://homepages.inf.ed.ac.uk/kwxm/JVM/codeByNo.html
12:40eggheadbasically just explains the y combinator in terms of smullyan birds
12:40hyPiRionTimMc: ##(= 5)
12:40lazybot⇒ true
12:40eggheadculminates in the horrible assignment free factorial at the bottom :p
12:41technomancycool
12:41hyPiRionoh right, damn.
12:41hyPiRion,(or 5) ;then
12:41clojurebot5
12:41eggheadtechnomancy: I was blown away when I saw that BML was the y combinator
12:42technomancyI wonder if I can still find my mockingbird notebook
12:42jlewishyPiRion: or's a macro, not a function, though.
12:44iwoi guess i need to parse xml to hiccup-style data structre
12:47hyPiRionjlewis: so the goal is the shortest form such that (apply form id) = id ?
12:48TimMchyPiRion: Just a replacement for identity.
12:48TimMcas in (filter ___ coll)
12:49hyPiRionkay.
12:50gtrakoh jeez it's abusing the fact that symbols look themselves up and can give a default instead
12:50seangroveIs there a way to pass flags to the closure compiler using cljsbuild? It just seems to be ignoring the :debug setting
12:51gtrakall to save 1 letter
12:51hyPiRiongtrak: But that one letter. Think of the trees!
12:51gtrakwe really should huffman-encode clojure's core.clj
12:52gtrakor just the vars
12:54hyPiRion,(filter _ [1 2 nil true false])
12:54clojurebot(1 2 true)
12:54TimMc!
12:54TimMchax
12:54hyPiRionbzz, wish it came in Clojure.
12:58egghead&(letfn [(starling [a] (fn [b] (fn [c] ((a c) (b c))))) (kestrel [a] (fn [b] a)) (identity [a] (((starling kestrel) kestrel) a))] (identity (rand-int 100)))
12:58lazybot⇒ 47
13:01eggheadI was looking at shens automatic partials, looks so nice, wish clojure supported that
13:02egghead(* 2) for instance is a valid expression which means the same as (partial * 2)
13:02clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.NumberFormatException: For input string: "*">
13:02TimMcegghead: * is binary in shen?
13:02eggheadI believe it's variadic like clojures
13:03hyPiRionCan't be 0 or 1-arg though.
13:03TimMcType inference?
13:03eggheadhttp://www.shenlanguage.org/learn-shen/tutorials/shen_in_15mins.html f3 for 'partial'
13:06Raynesdrewr: I'm trying to send an HTML email, but images aren't loading in anything but gmail's web app and my iPhone.
13:06RaynesI'll get you an example.
13:07Raynesdrewr: https://www.refheap.com/paste/8230 <-- See anything obvious that might be wrong with this.
13:07Raynesdrewr: Note that I can send this with Commons Email and it works fine.
13:07TimMcRaynes: href="
13:08RaynesOh, that was a transfer typo.
13:09Rayneshttps://www.refheap.com/paste/8231
13:09eggheadhow is geni, you guys are right around the corner
13:09eggheadfiguratively
13:09drewrRaynes: could be a bug; do you have the commons code? I want to check the difference in generated javamail Messages
13:09Raynesegghead: Yeah, around the corner and two thousand miles away until next month.
13:10Raynesdrewr: I can send an email with both things and then send you the source that my email client receives. Will that work?
13:10drewrRaynes: it might be sufficient
13:10drewrlet's try that first
13:10RaynesAlright, give me a sec.
13:10Raynesegghead: We're great. We just got acquired.
13:11eggheadnice, congrats :)
13:11technomancyRaynes: no kidding? how's that going?
13:11Raynestechnomancy: Great. We keep our team, I get a full time job, etc.
13:12RaynesAnd Geni doesn't go away. We actually got to make a bunch of stuff free that didn't used to be free.
13:12technomancygood deal
13:13TimMcRaynes: And I assume this isn't just your mail client blocking external images?
13:13RaynesTimMc: It isn't. I've checked in a couple of clients and confirmed that to be off in all of them.
13:14TimMcI used to write HTML emails for a job a few years back. It was a nest of compatibility vipers.
13:14TimMcWe actually managed to crash a few customers' computers in one mailing...
13:16Raynesdrewr: https://www.refheap.com/paste/8232 from postal.
13:17antoineBhello, i followed this http://ujihisa.blogspot.fr/2011/12/read-raw-post-request-body-in-compojure.html to get the :body part of a POST, but the HttpInput give me nothing?
13:21Raynesdrewr: Well, actually, the problem with the above example was href != src, and I'm tired enough to not notice that.
13:21RaynesIt actually works if I change it to src. But my larger HTML example still only works in certain clients. Unfortunately, I can't show that to you. :\
13:22RaynesI guess I'll need to investigate more and see if I can narrow anything down and get a reproduce case I can actually show you.
13:26TimMcRaynes: derp!
13:26TimMcI should have caught the src thing.
13:27RaynesTimMc: Yeah, but it's still all screwy with the real HTML. :(
13:27RaynesAnd only with postal. It's crazy.
13:27TimMcOh! Weird.
13:27RaynesI can send the exact same HTML with commons email and it works fine.
13:28RaynesSo it makes me wonder if it might be some kind of formatting problem in postal, but I can't reproduce without the huge private HTML I've got here.
13:29RaynesTimMc: It's showing alt text in Postal.
13:29RaynesUgh. Postbox
13:29RaynesSorry, guys, I'm on no sleep.
13:29RaynesTimMc: If it is showing alt text, I guess that means it parsed the img tag but merely couldn't resolve the image for some reason?
13:29seangroveAh, damnit
13:31seangroveI need a file from closure.jar that wasn't added until oct. 26th, and was last updated nov. 12th. The cljs closure.jar is pretty far behind
13:33Raynesdrewr: Looks like it only happens when postal sends as quoted printable.
13:34Raynesdrewr: How can I make postal send with quoted printable?
13:34TimMcRaynes: Correct re: alt text
13:38antoineBok, i suspect the HttpParser, being already parsed by "wrap-param" ring middleware
13:39drewrRaynes: momentito
13:39drewrRaynes: can you give me the source of a message that renders correctly for you?
13:40drewr...in the client that was giving you trouble
13:40RaynesSure, one second.
13:41Raynesdrewr: https://www.refheap.com/paste/8233
13:42RaynesSent with https://www.refheap.com/paste/de8ba8549b55df52dcc4053e5
13:42drewrthat one renders correctly or incorrectly?
13:42RaynesCorrectly.
13:42drewrit's 7bit though
13:43RaynesYeah, I can't figure out how to force quoted printable.
13:43RaynesThe failing email gets sent in it, but I don't know what triggers it.
13:44RaynesAlso, I noticed that there is a difference between the encoded text from commons email and the encoded text postal sends.
13:44RaynesNot sure if its significant.
13:44RaynesBut they look quite a bit different.
13:51RaynesOr not.
13:51RaynesI guess I was seeing things, they look the same.
13:56drewrRaynes: what's the source of a commons-generated one look like?
13:57Raynesdrewr: Alright, so the encoded body of both emails looks exactly the same. I don't think they are different at all. I'm tempted to run them through diff, in fact. And that's the part that I can't show you. Give me a sec and I'll paste the headers on both of these.
13:58drewrit would surprise me if they were significantly different since they both rely on javamail to handle attachment encoding
13:59Raynesdrewr: https://www.refheap.com/paste/b6d0b201d76b25c436867b613 this is the version that postbox (and inky, and mail.app) both chew up and spit out that comes from postal.
13:59Raynesdrewr: https://www.refheap.com/paste/3494bb397f375b658fab1fdd2 is the working version from commons email
14:00drewryeah, identical in the places that matter :-/
14:00drewrmaybe something in the attachment body?
14:00lazybotjava.lang.RuntimeException: EOF while reading
14:00RaynesAttachment body?
14:01drewr(the html.. in the mime part)
14:01estebannlein uberjar works well for me when :omit-source is not set to true, but when it is I get: "Could not find or load main class" when I try to run the jar, any thoughts?
14:01drewrgotta get some food
14:01Raynesdrewr: The HTML is the same in both versions, and it works with commons.
14:06DaReaper5How do i increment a value within an agent that is a map
14:07DaReaper5(send-off agentMap assoc key (+ (@agentMap key) val))
14:07DaReaper5above does not work due to asych issues
14:07gtrakDaReaper5: update-in
14:08DaReaper5(update-in agentMap [key] + val) ?
14:08Raynesdrewr: Well, I've got to take off for the night. If you happen to have any magic ideas that I could try, let me know. Otherwise, I'll spend some time later/tomorrow trying to come up with a reproduce case with some different HTML. FWIW, shelling out to sendmail doesn't seem to be working for this either.
14:09gtrakyea, if you wanted to make what you wrote work, you would capture the value in a closure instead of derefing twice
14:09drewrRaynes: I can't think of what you can do; if the source is the same I'm not sure how postal could be causing the problem
14:09drewrlet me know if you notice any differences
14:09drewrvery curious
14:10TimMcRaynes: for the night... did you sleep last night, or move to Europe?
14:10TimMc*not sleep
14:10RaynesI didn't sleep last night, TimMc.
14:10TimMc>_<
14:11gtrakDaReaper5: in other words, send-off acts like apply for convenience, but it only needs a fn of 1-arg
14:12gtrak(send-off agentMap update-in [key] + val)... I don't know if that'll work, that's too much indirection for me..
14:13gtrak(send-off agentMap #(update-in % [key] + val)) is more clear
14:14gtrakmaybe it's meant to be used the flat way, try it :-)
14:19riley526Quick question: Given a Compojure route handler function, how do you get the route's URL?
14:20technomancyriley526: :path IIRC
14:20technomancyor maybe :uri?
14:21riley526technomancy: thank you, I'll look into that.
14:28DaReaper5hi am back sorry. What was the suggested usage of send-off and update-in?
14:28riley526technomancy: Is that documented somewhere?
14:29technomancyriley526: it's part of the Ring spec
14:30pmonks@DaReaper5: "gtrak: (send-off agentMap update-in [key] + val)... I don't know if that'll work, that's too much indirection for me.."
14:30gtrakDaReaper5: well, send-off passes the value of the agent into the function and applies the args from in the second to nth position, and update-in does a similar thing, so perhaps maybe it'll do the right thing if you write it all flat
14:30pmonks@DaReaper5: "gtrak: (send-off agentMap #(update-in % [key] + val)) is more clear"
14:30gtrakif you want to be explicit about it, you can do it the way I mentioned
14:31DaReaper5thanks!
14:32gtrak(update-in x [k] + val) is like (update-in x [k] #(+ % val)), a similar trick
14:35riley526technomancy: Oh I see. I don't think :uri is what I'm looking for. That gets the path for the given request. I'm looking for a way to reverse a Compojure route handler to get its URL. Is there such a thing?
14:36riley526technomancy: Like Django's `reverse()` https://docs.djangoproject.com/en/dev/ref/urlresolvers/#django.core.urlresolvers.reverse
14:36gtrakriley526: there's no general solution for that.. you'd have to invert the computation. maybe core.logic :-)
14:38riley526gtrak: Alright thanks.
14:38sveduboisHow I can convert this java line to clojure?
14:38sveduboisnew long[]{ 20, 30, 40 },
14:38S11001001riley526: what gtrak implies is that the reverse function you posted doesn't do what you say, and in fact the django docs admit to that
14:39bpr&(long-array [20 30 40])
14:39lazybot⇒ #<long[] [J@4c0e1f>
14:40bprsvedubois: ^
14:40S11001001svedubois: unless you didn't mean that absolutely literally
14:40S11001001svedubois: java arrays aren't as common in clojure as in java
14:41nDuffsvedubois: the common/native thing would be to just use a vector: [20 30 40]
14:41bpryeah, that's true. typically you'd just want [20 30 40]
14:45riley526S11001001: I'm not sure what you mean. Can you elaborate?
14:45S11001001riley526: quote: "The reverse() function can reverse a large variety of regular expression patterns for URLs, but not every possible one."
14:46sveduboisThis java line could be translated to this ?
14:46sveduboisfinal Img< FloatType > img1 = imgFactory.create( new long[]{ 20, 30, 40 }, new FloatType() );
14:46svedubois(def ^FloatType img1 (-> (imgFactory) (.create (long-array [20 30 40]) (FloatType.))))
14:47gtrakriley526: you could probably mimic what django does, but there's also no way to access routes globally right now.
14:47S11001001svedubois: don't use def
14:48sveduboislet?
14:48clojurebotlet is creating a local binding in your lexical scope
14:48riley526S11001001: Yes, I'm aware of that, but that doesn't mean it isn't useful. I'm just wondering how other people avoid hard-coding URLs in other places (e.g. template rendering).
14:48bprthis looks more correct (based on the java snippet): (-> imgFactor (.create (long-array [20 30 40]) (FloatType.)))
14:48riley526But maybe that's not what Compojure is meant for anyway.
14:48S11001001riley526: reverse would make a poor solution to that problem, given its non-totality.
14:48S11001001unreliability, rather
14:49sveduboisbpr: java.lang.IllegalArgumentException: No matching method found: create for class clojure.lang.Var$Unbound
14:49bprsvedubois: actually in that case i wouldn't even use the thread-first macro. just: (.create imgFactory (long-array [20 30 40]) (FloatType.))
14:49riley526S11001001: Agreed.
14:49gtrakdjango can say 'here's the django way', compojure can't make religious arguments as much
14:50bprsvedubois: yeah, i mis-typed imgFactory in the first attempt
14:51sveduboisbpr: (.create imgFactory (long-array [20 30 40]) (FloatType.))
14:51sveduboisjava.lang.IllegalArgumentException: No matching method found: create for class clojure.lang.Var$Unbound
14:51bprsvedubois: can you paste your code somewhere?
14:52gtraksvedubois: imgFactory would be the unbound thing
14:52sveduboisbpr: https://github.com/imagej/imglib/blob/master/imglib2/examples/src/main/java/Example1c.java
14:53sveduboisgtrak: Yes, you are right
14:53svedubois(def ^FloatType imgFactory (^FloatType CellImgFactory. 5))
14:53svedubois(.create imgFactory (long-array [20 30 40]) (FloatType.))
14:53sveduboisIt works
14:53svedubois#<CellImg CellImg [20x30x40]>
14:53bprgood
14:58aaelonyhmmm, the following works: ((juxt :c :b :a) {:a 1 :b "blah" :c 3}) but if I put it in a function I get an "clojure.lang.ArraySeq cannot be cast to clojure.lang.IFn" https://www.refheap.com/paste/8247
14:59amalloysvedubois: those ^FloatType hints are just getting ignored by the compiler and making the code harder to read
14:59amalloyaaelony: (apply juxt ks)
14:59aaelonydo'h
14:59amalloyalthough really a better solution to the problem is (map m ks)
14:59aaelonyamalloy: thanks
15:01dnolenthe perf boost for small maps in 1.5.0 is nice
15:03sveduboisamalloy: Can you elaborate the way to work with ^FloatType hints?
15:04S11001001svedubois: get it working without hints first.
15:04amalloydon't put them there. the compiler already knows what (CellImgFactory. 5) returns
15:04ohpauleezthen see where the compiler is hitting the need for deep reflection, and hint at those spots
15:04TimMc...but only if performance demands it!
15:05ohpauleezI'm of the opinion you should always remove points of reflection once you have something working and refactored
15:06technomancythat's just busy work
15:06amalloyi prefer the noncommittal "you may always..."
15:06sveduboisohpauleez: How I can know where the compiler is hitting the need for deep reflection?
15:07cemerickdnolen: I didn't follow the thread(s) carefully; have you benched small map vs. records?
15:07S11001001svedubois: We're saying that you shouldn't think about that at all yet.
15:07technomancyspending time thinking about reflection before it's proven to be a bottleneck is a waste of time
15:09dcbIs there a simple way to have an agent loop on a function? IE fill its queue so a function is always in its queue?
15:09bprdcb: i would say use a future with a loop for that
15:11dcbbpr: My use case is I want the agent to run for a set amount of time (say 5 minutes) and complete as many iterations of the function as it can, but all from the same thread. If I have futures in a loop that could parallelize it to many threads, right?
15:12gtrakdcb: that sounds like not a queue at all, but a loop
15:13gtrakor a seq
15:13bprdcb: i meant something like: (future (loop ...))
15:13dnolencemerick: I haven't done any testing like that
15:13bpryeah, good point: (future (doseq ...)) could work too
15:15dcbgtrak: yes, but id like it to be interruptible, which I think you can do with (shutdown-agents)
15:15dnolencemerick: but they seem 2X faster which is never a bad thing
15:16seangrovednolen: Are source-maps blocked, or just not much time to work on them with all the core.logic stuff?
15:17dnolenseangrove: blocked by 1.5.0 and no tools.reader
15:17dnolenseangrove: as soon as that story changes it will move very quickly.
15:17seangroveIs there a ticket I can subscribe to?
15:17bprdcb: (let [stop? (atom false)] (future (loop [...] (when-not @stop? ...))) (fn [] (swap! stop? true)))
15:17dnolenseangrove: hmm not really, but bump the thread on the dev list
15:17bprmeh... s/swap!/reset!/
15:18seangroveWilldo
15:19arrdemwhat place does testing have in your clojure devel cycle? do you do test-driven or do you test and repl to correctness and test after the fact?
15:19dcbbpr: cool, I definitely didn't think about that, thanks
15:19dcbgtrak: thanks as well
15:19amalloybpr: (swap! stop? not), for style points
15:19bpramalloy: nice. thanks
15:20amalloy(don't actually do that, it's ugly. reset is better, but this is funnier)
15:23seangrovearrdem: generally repl to correctness, then maybe write a test to make sure it doesn't break later
15:23seangroveBut certainly far fewer tests than in other languages
15:25arrdemseangrove: mmkay. that's what I was expecting. just pondering cultivating (or not) an OO style testing "habbit".
15:26aaelonyamalloy: (map m ks) is quite elegant. Is there something like that for the case where keys may contain nested maps? Trying to avoid a massive let statement with get-in calls...
15:27amalloyi don't understand "keys may contain nested maps"
15:28carloccihello, is leiningen named after the ant fighting guy?
15:28hiredmanyes
15:28amalloyit'd be quite a coincidence otherwise, i suspect
15:28aaelonyoh, {:a 1 :b { :bee-1 "blah" :bee-2 {:cee 4} } :c 3 }
15:29carlocciis there some meaning behind?
15:29metellusant is a Java build tool
15:29metellusor something like that
15:29carlocciok, that makes perfect sense
15:30carloccithank you
15:31amalloyaaelony: so? calling (m :b) on that works fine
15:31amalloyif you want the ability to use get-in instead, use get-in: (map #(get-in m %) keyseqs)
15:33arrdem,(let [m {:foo 1}] (assert (= (m :foo) (:foo m))))
15:33clojurebotnil
15:34aaelonyamalloy: thanks. I want to guarantee a certain order and would like to specify the order up front. Then give the ordering to a function that retrieves that order from a map that has arbitrary levels of nestings.
15:34aaelonyit works, just wondering if it can be more elegant
16:29alex_baranoskyhave any of you seen a Compiler error: "Unknown Collection Type"?
16:29no7hingi'am writing a wrapper around the java skype api and kind of wonder how i get clojure reflection and reify on the same boat
16:29alex_baranoskyI'm seeing it moving a macro that worked on 1.2.1 to 1.4
16:30no7hingthis screams to be DRY'ed up: https://www.refheap.com/paste/8250
16:30S11001001no7hing: the return type of create-connection-listener isn't inferred
16:31S11001001no7hing: and this is more a macro case than a reflection case
16:32no7hingsry for the confusion: the reflection is not in yet
16:32no7hingi'am thinking about it, but don't want to start until i have an idea how it could look like
16:33no7hingbasically i want to generate the methods for 'reify' through reflection of the java listener interfaces
16:33S11001001no7hing: write a macro that takes the interface symbol, resolves it (getting the interface), etc
16:34jlewisanyone know the threshold of consecutive conj's after which it's better to make the collection transient first? is making it transient first always worth it, if you're doing more than 1 modification?
16:34no7hinghmm, damn, that would actually work
16:35no7hingi was thinking too complicated - again
16:35no7hingthanks!
16:36S11001001np
16:37amalloyjlewis: just use ##(doc into) and don't worry about it, most of the time
16:37lazybot⇒ "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
16:38amalloyalex_baranosky: i don't think so, but i'd be interested to see such a macro
16:39jlewisnice, i guess the fact that it's implemented to always use transient answers my question
16:39jlewisthanks
16:40amalloyjlewis: creating a transient is a small O(1) cost, as is persistent!-ing a transient
16:40amalloyyou only pay for the changes you actually make
16:40amalloyto me this seems like magic, but allegedly that is how it works
16:42jlewisI suppose it isn't particularly surprising - it could be a flag (and thread machinery, etc) that says to edit in place instead of path copying
16:42jlewisassuming that last bit is implemented, of course
16:49odie5533Would clojure be a good language to use to learn functional programming?
16:50eggheadya
16:50odie5533k
16:50eggheadthere are others that some might argue would be better, scheme or shen, but I learned functional w/ clojure and enjoyed it immensely
16:50hiredmanlisp is a great language for learning anything about the structure and interpretation of computer programs
16:53eggheadI see what you did there.... :p
16:53no7hingsicp
16:53no7hingsneaky
16:55bpri really think SICP should be CS 101 everywhere
16:55Sgeo_I wish I went to a school that offered CS
16:55Sgeo_Rather than some bs "Computer Programming/Information Systems"
16:55arrdembpr: meh... Algo & Datastructures wasn't bad in Java
16:56arrdembut I did read SICP on my own that year.
16:56bprthe concept of composeable abstractions is expressed more clearly in SICP than anywhere else i know of
16:56arrdemalso, why will (contains?) never do a linear search?
16:57hyPiRionWell
16:57hyPiRion,(doc contains?)
16:57clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
16:57technomancycontains? is too cool for your linear data structures
16:58hyPiRionIt looks up a key, not a value.
16:58arrdemI mean I see the evil O(N) case... but I'd think that as an "informed" programmer I can incur that cost if I want to.
16:58arrdemand (contains? (set [:foo :bar :baz]) :baz) is still O(N)...
16:59hyPiRionarrdem: contains? doesn't cause that, though. That's the conversion to the set.
16:59hiredmanyou are also free to use the java collections api
16:59hiredman(.contains ...)
17:00arrdemhyPiRion: well right. I'm just askin' here.
17:00hiredmanarrdem: if you are doing lots of O(n) operations you should pick a different datastructure where that operation is O(1)
17:01hyPiRionNothing like bacon and premature optimization for dinner, eh.
17:01no7hinghmm, (defmacro [interface] (let [members (:members (r/reflect interface))] )) always reflects a clojure var - how can i force evaluation of 'interface' ?
17:02no7hingwhere r/ref… is clojure.reflect/refl...
17:06alex_baranoskyamalloy: we found it. The old code had a macro with a syntax quote like this `(f ~a '~regex-patterms) … we changed it to `(f ~a `(vec regex-patterns)) which now compiles
17:07amalloywell, that should compile but give a totally different result, right?
17:08alex_baranoskyshoot I had a typo, should be: `(f ~a ~(vec regex-patterns))
17:11no7hingsilly me, i was actually working with the clojure symbol not the resolved interface
17:12weavejesterDoes anyone have any suggestions for libraries I've missed on clojure-toolbox.com?
17:12weavejesterI'm giving it some long overdue updates.
17:12bprRaynes' conch
17:13amalloyweavejester: i wouldn't include algo.monads without including the much-superior protocol-monads, whichever fork of that is active these days
17:13technomancyweavejester: why not look through the top-ranked libs on clojuresphere?
17:13amalloyand take sexpbot off the irc-bot list; he's long since dead
17:13technomancymight be a good starting place
17:14weavejesterAll good points
17:14ian_I'm using Noir. Is there a way to destructure a list of HTTP request parameter values into a variable? The Servlet api allow one to get a List<String> of values given an HTTP parameter name, but I can't figure out how to get that in Noir.
17:14technomancy(clojure.set/difference (take 100 clojuresphere/libs) clojure-toolbox/libs)
17:14Bronsaalso http://clojure-libraries.appspot.com/
17:15weavejesterian_: You mean variables with the same name?
17:15callenis there a way to do global state that persists within a request's lifespan without using Kiln in Ring?
17:15weavejesterUm, parameters with the same name
17:15callenKlin is a bit more complicated than I really need.
17:15amalloyi don't see anyplace for "handy datastructures", of which i have written a few. ring buffers, sets and maps that retain insertion order when seq'ing over them. people ask for those moderately often
17:15technomancyKiln is more complicated than most people need from what I can tell
17:15ian_weavejester: Yes, the same param name
17:16weavejesterian_: I don't know whether Noir include wrap-nested-params by default
17:16callentechnomancy: that's correct. I'd like something like Flask's g object.
17:16weavejesterwhich because I couldn't work out a good way of parsing it
17:16gtrakcallen: I find compojure's 'context' macro really useful for pulling request-scoped stuff into a binding
17:16weavejestercurrently means that if you want a multiple params *and* nested params, you need to name them like 'foo[]'
17:16weavejestere.g. foo[]=bar&foo[]=baz
17:17amalloyoh, and a lot of people seem to use org.flatland/protobuf, weavejester (in addition to the other stuff i mentioned above but didn't highlight you on)
17:17ian_weavejester: Thanks for the help. I'll give that a try.
17:17weavejesterBut straight Ring will automatically parse parameters into lists if they have more than one value
17:17callengtrak: if you're talking about what I think you are, that's pretty weak.
17:17gtrakso weak.
17:17gtrakthe weakest
17:18gtrakit can easily be generalized into a function of the request
17:18ian_weavejester: it worked! Thanks.
17:19ian_is wrap-nested-params a ring thing?
17:19callengtrak: I need something the templates can access without manually juggling a context map.
17:19weavejesterian_: I'm amazed you were able to understand my confusing explanation :)
17:19weavejesterian_: yes. Ideally it should allow "foo=a&foo=b" as well as "foo[]=a&foo[]=b"
17:20TimMcweavejester: So if I give a ring app duplicate params, there's a good chance it will throw a type error because it expects a string instead of a list? :-P
17:21gtrakcallen: context-map has nothing to do with it, it just prevents you from having to destructure too repetitively. The value's in a key on the request.
17:21weavejesterTimMc: Well, yes...
17:21gtrakso I'm not sure what you think I'm referring to
17:21callengtrak: that's far removed from the problem I was trying to address and is exceedingly trivial.
17:21callengtrak: I'm trying to do something analogous to auto-cycled global state triggered by serving a request.
17:22gtrakwhat's an auto-cycle?
17:23TimMcLovely.
17:23callengtrak: don't reify something that obviously isn't meant to be.
17:23callengtrak: and then pretend you're confused when you mis-reified a description of something
17:24gtraksure...
17:24ian_Using hiccup, I'm doing a lot of stuff like this: [:ul (map #(vector :li %) (:values thing))]
17:24ian_Is there a more idiomatic way to do this?
17:24TimMcweavejester: Is there a different API for getting single value for a key vs. all of a key's values?
17:24weavejesterTimMc: No, but I'm wondering if there should be.
17:25callenian_: no, and there's not lot of redundancy there that a macro could help with either.
17:25weavejesterOr whether to rely on something like a precondition
17:25yogthosweavejester: re: clojure toolbox clj-pdf? https://github.com/yogthos/clj-pdf :)
17:25callenian_: you could write a function to wrap the iteration part of it.
17:25ian_callen: Thanks! I'm very new to clojure, so I'm still trying to figure out how bad my code is :)
17:25aperiodician_: [:ul (for [value (:values thing)] [:li value])] gets the point across a little more cleanly
17:26hiredman(defprotocol IMultiMap (multi-get [_ k default]) (multi-assoc [_ k v]))
17:26yogthosweavejester: this one also gets some usage and I'm maintaining fairly actively https://github.com/yogthos/markdown-clj
17:26yogthosweavejester: and also have this :) https://github.com/yogthos/clj-rss
17:26callenian_: nah that's not bad, but it's a pretty common pattern so you might as well write a function.
17:26weavejesterian_: A for loop loops better. Also… (unordered-list (:values thing))
17:27ian_Great, thanks, All.
17:31gtrakcallen: looks like an interesting problem anyway
17:31weavejesteryogthos: Added
17:31gfrederickswhy is clojure.java.jdbc/insert-records so crazy slow?
17:31yogthosweavejester: cool stuff :)
17:32hiredmangfredericks: I think because of the datastructure manipulation it does under the hood
17:32weavejesteramalloy: Which libraries of yours are data structure libs?
17:32yogthosweavejester: oh and Raynes has https://github.com/Raynes/cegdown which is a pegdown wrapper
17:32gfrederickshiredman: I don't suppose you know if any of the other functions are faster?
17:32callengtrak: it's really not and it is disconcerting that it's an otherwise unsolved problem save for Kiln.
17:33amalloyweavejester: flatland/ordered and amalloy/ring-buffer
17:33callengtrak: http://flask.pocoo.org/docs/api/#flask.g
17:33hiredmanI happen to have a clj file somewhere where we needed to load gigs of data as fast as possible, we ended up generating csv data and using database native stuff for loading from there
17:34gfredericks:/
17:34weavejesteryogthos: Added that too
17:34gfrederickskorma's even a whole lot faster
17:34gfredericksI was trying to speed _it_ up
17:34hiredmangfredericks: but between insert-records and that we switched to insert-rows
17:35yogthosweavejester: I'm still waiting for clojars to start tracking stats :)
17:35gfrederickshow do I figure out what order to put the values in? do a select on the table and see what order they come back in?
17:36hiredmanwe would break the data up in to chunks of 10,000, and make a single transaction+insert-values call per 10,0000
17:36hiredmangfredericks: I believe it is the order they are specified when creating the table
17:37hiredmanI forget how that works out with autogenerated keys
17:37technomancyyeah a lot less consing going on to insert in order
17:37gtrakcallen: well, it looked interesting when I read about kiln. flask.g just looks like it could be implemented with a var.
17:37weavejesteramalloy: I've added them in a Data Structures category
17:37callengtrak: have you done much Ring?
17:37gtrakyea
17:37yogthoscallen: could add something along those lines to lib-noir
17:37callengtrak: you know, try that, let me know how it goes.
17:38callengtrak: report back when you figure out why that doesn't work in a Ring app
17:38TimMcweavejester: I'd find it useful to have two ways of accessing querystring keys: last value (string), and all values (vec/list)
17:39gfrederickshiredman: yeah that's my current issue :D
17:39weavejesterTimMc: Maybe as a function "param" which just gets the last
17:39weavejestercallen: You want some global state to be changed by a request?
17:39gtrakcallen: then proxy over a var... if you need threadlocal, that's what vars do
17:39weavejestercallen: Sorry, got a little distracted and missed the explanation
17:40hiredmangfredericks: fiddle with it, maybe you can just leave it out, or pass a nil
17:40gtrakyou'd have to be explicit about copying a value out of the thread-local scope
17:41gfrederickshiredman: got a workaround
17:42hiredmanif you really want speed I think the "dump to csv and have the database load there" approach was orders of magnitude faster
17:42gfredericksyeah I don't doubt it
17:44gtrakif the problem is there's no association between request map and a thread, that can be solved
17:45callengtrak: the problem is that you can't tie state to the request lifecycle, threads are besides the point
17:46callenoutside of middleware, Ring doesn't make a lot of provisions for statelessness.
17:46ibdknoxwhat are you looking for?
17:46gtrakyea, I can see that
17:47ibdknoxcross-request state? intra-request state?
17:47callenibdknox: http://flask.pocoo.org/docs/api/#flask.g
17:47callenibdknox: intra
17:47weavejestercallen: I don't understand what you mean by "tie state to the request lifecycle"
17:47eggheadcross state requests are subject to federal law
17:47ibdknoxcallen: just use a piece of middleware that threat binds an atom - done.
17:48ibdknoxcallen: for an example look at how sessions work in libnoir
17:48weavejestercallen: Ring handles a request in one thread
17:48weavejesterBecause a handler is a function
17:48callenweavejester: ibdknox understands my question, leave it be. Thanks anyway.
17:48callenibdknox: thank you.
17:48weavejesterUnless you explicitly kick off a new thread or use a future or something
17:49callenweavejester: not what I was talking about, I only used the word thread because others did
17:49callenand only to say that wasn't what I was talking about
17:49weavejesterOkay...
17:49ibdknoxweavejester: Is that a hard guarantee outside of the jetty adapter?
17:49weavejesterBecause flask.g's functionality looks to me like a var
17:50ibdknoxweavejester: yeah it's a var with an atom as the value
17:50gtrakcallen: it's not obvious from ibdknox's trivial solution why no one else knows anything about what you're talking about
17:50weavejesteribdknox: It is within Ring itself
17:50weavejesteribdknox: Aleph it might not be, but then you're stepping outside of Ring
17:51ibdknoxweavejester: got it
17:51weavejesteribdknox: Remember, a Ring handler is a function, so unless you explicitly start a new thread, it'll all happen in one thread
17:51ibdknoxweavejester: oh absolutely, I was just wondering whether it was guaranteed they'd be on different threads :)
17:52ibdknoxmultiple requests that is
17:52weavejesteribdknox: Yes, because that's the only way Clojure has of running functions concurrently.
17:53TimMcHow could they not be?
17:53ibdknoxnio magic?
17:54gtraka loop is not concurrent
17:54weavejesterI guess if you used continuation-passing style you could manually hypervise them
17:54ibdknoxnever said the requests necessarily were handled concurrently
17:54TimMcI guess non-concurrent requests could reuse a thread.
17:54weavejestergtrak: Oh, yeah, threads will be reused
17:54weavejesterJetty uses a threadpool
17:54weavejesterSo you're almost guaranteed to reuse threads.
17:55amalloyhuh. if file A contains (defmacro foo [] `(do ~'(blah))) at line 5, and file B contains (foo) as line 20, and (blah) fails to compile, the compiler seems to report it as an error at line 5 of file B
17:55callensee, people are misunderstanding each other, don't even need me to be involved.
17:55weavejesterhaha :)
17:56gtraka thread has meaning in hardware, and clojure functions map to C-stacks just like java functions do, so continuation-passing moves up the abstraction, but doesn't take you away from that
17:56ibdknoxThere are lots of strategies for request handling, I was just curious if ring explicitly took an approach, and it does :)
17:56ibdknoxI hadn't really thought about it
17:57callensoftware has a way of letting you not think about things.
17:57callenwhich I think is the point.
17:57weavejestergtrak: Oh, I meant with continuation passing style you could maybe stripe the execution of two functions
17:57weavejestergtrak: A green-threads implementation
17:57gtrakweavejester: sure, but then you're just taking control from the OS scheduler and writing your own
17:58arohnerI don't suppose anyone has 'pdoseq in a library anywhere?
17:58weavejestergtrak: Right. I'm not saying it would be useful ;)
17:58arohneror any clues on how to write pdoseq in a way that doesn't involve copy&paste of 'doseq?
17:58dog_cat11what I like about clojure is that it is closest to what I actually think
17:58weavejesterarohner: Interestingly I've needed to do that recently.
17:58gtrakweavejester: so by using a higher abstraction, you've inadvertently forced yourself to think on a lower one :-)
17:59weavejestergtrak: It was just an answer to a hyporthetical need to execute two functions concurrently without threads
17:59Apage43arrdem: pcalls/for?
17:59weavejestergtrak: Not sure "concurrently" is the right word for it
17:59weavejesterarohner: I used a ThreadPoolExecutor and a LinkedBlockingQueue
18:00Apage43(apply pcalls (for [foo bar] (fn [] (* foo 2))))
18:01Apage43not the best
18:01gtrakweavejester: sure, we were just talking about abstraction here :-). Clojure runs on a von Neumann machine, and it benefits from matching it closely (shared memory). All these scheduling issues come up in hardware too.
18:01arohnerweavejester: interesting. I was thinking of somehow generating a lazy seq and reusing pmap
18:03ibdknoxwhat's the disadvantage of (dorun (pmap ...))?
18:03hiredmanpmap is pretty lame
18:03ibdknoxah
18:03arohneribdknox: I wanted for/doseq sugar
18:03ibdknoxhiredman: slow?
18:03hiredmanit has bugs and is not very flexible
18:03arohnerhiredman: what bugs?
18:03technomancypmap only goes ahead of the first un-calculated value by N
18:03hiredmanit can leak threads or something
18:03hiredmanamalloy usually chimes in about it
18:04technomancyN being somewhere in the ballpark of the size of the agent thread pool
18:04hiredmanpmap also has interaction issues with chunking
18:04technomancyso it's a terrible choice unless each element is going to take roughly the same amount of time
18:05weavejesterarohner: https://gist.github.com/4488786
18:05hiredmansomething like pmap would be way cooler if you could pass in the executor to use, and then tune it via the executor
18:05weavejesterarohner: That's roughly what I did
18:05weavejesterhiredman: Wasn't there something in Clojure 1.5 or 1.6 that would allow you to specify the executor for futures etc?
18:06hiredmanI think for agents, dunno if it works for futures
18:06weavejesterhiredman: Oh yep, it's agents
18:07yogthosweavejester: green threads can be used effectively, erlang is a good exmaple :)
18:08hiredman:(
18:08ibdknoxhaha
18:08yogthosweavejester: the overhead per green process is only a few bytes I think, and each function gets spawned as its own process
18:08nDuffI asked about it earlier, and was told that setting the pool for send-off agents would impact futures.
18:08hyPiRionweavejester: Are there any information about Clojure 1.6 already?
18:09dog_cat11are there any good example of parallel algo's implemented in clojure?
18:10dog_cat11not just embarasingly parallel stuff
18:10nDuff*shrug*.
18:10nDuffDoes the ants demo count?
18:10yogthosdog_cat11: http://rosettacode.org/wiki/Dining_philosophers#Clojure
18:10weavejesterhyPiRion: Probably not :)
18:10hiredmanoh, I misremembered it is seque that leaks threads or agents or whatever
18:11weavejesternDuff: I believe futures do use the agent pool
18:11dog_cat11idk, I can to clojure for parallel algo's and I really haven't found any really insightful ones
18:12gtrakdog_cat11: what kind of algorithm? immutable datastructures surely count.
18:13dog_cat11but i still think clojure is one of the few languages that 'gets' concurrency
18:13nDuffweavejester: it's the send-off agent pool, not the send one.
18:13nDuffweavejester: ...annoyingly.
18:14weavejesternDuff: Ahh
18:14yogthosdog_cat11: making stuff immutable by default certainly goes a long way towards that end
18:14nDuff(well, I do understand why -- you could get deadlocks otherwise)
18:14technomancyconcurrency is typically trivial in clojure algorithms, so you're unlikely to find anything particularly insightful
18:14technomancythe whole point is you don't need to be particularly clever
18:15dog_cat11but there are problems that require particularly clever strategies to make concurrent
18:15dog_cat11like branch and bound
18:16amalloyif you're looking for something clever you could look at reducers/fold in 1.5
18:16dog_cat11yeah, i saw those, great stuff
18:16amalloyhiredman: i got a patch into 1.5 so that seque at least no longer leaks agents
18:17gtrakdog_cat11: perhaps the parallel core.logic http://www.clojure.net/2012/03/26/Messin-with-core.logic/
18:17yogthosavout is neat too https://github.com/liebke/avout
18:18yogthosand then there's storm https://github.com/nathanmarz/storm
18:18hiredmanhttps://gist.github.com/4488907
18:23Apage43storm has some pretty neat magic in
18:36jlewisit looks like the convention for clojars is to have groupId == artifactId, right? so project 'foo' can be imported in lein with [foo "0.0.1"]
18:37hyPiRionjlewis: right
18:37jlewisis the a similar convention for the namespaces of such projects? there's this 'core' namespace convention, but what if the project will end up with just one file in it? is it 'acceptable' to have 'foo' as the one and only namespace? so you can (use 'foo)
18:38jlewisis there a*
18:38bbloomjlewis: yeah, that's fine
18:38hiredman~namespaces
18:38clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
18:38hiredmanbbloom: it is not
18:38bbloomwhy not?
18:39bbloombesides conflicts
18:39bbloomif your namespace is a trademark or something, that's totally fine
18:39hiredmanexactly because of conflicts
18:39jlewisi suppose that's the origin of 'core', then. i guess the best alternative is 'foo.core?
18:39bbloomhe's asking about core tho
18:39bbloommycompany.myapp vs mycompany.myapp.core
18:39technomancyjlewis: the best alternative is for you to come up with something that accurately describes your project in two words
18:39hiredmanand because of the way that clojure maps namespaces to java classes (which is just another set of conflicts)
18:40technomancysince Leiningen doesn't know anything about your project, it called it core.clj, which is nondescript and unhelpful, but it can't do any better.
18:40hiredmanclojure.core used to be just clojure and was moved to clojure.core for these reasons
18:41jlewisso maybe i could have a concrete suggestion. i wrote a library that has an implementation of union-find in it, and that's it. it would be nice to call it data.union-find, but the clojure data.foo packages have 'clojure.' in front of them, so it feels wrong to just do data.union-find
18:41jlewison the other hand, jordanlewis.data.union-find isn't so appealing either.
18:41jlewisi don't want my name all up in there!
18:42hyPiRionjlewis: Why not? You'll be famous in no time.
18:42technomancyso you need to pick a name that is unlikely to conflict. you can either do that by coming up with something clever or by using a name you control, like your surname or a domain name.
18:42technomancy(not that you really control your surname, but whatever)
18:43technomancyin some sense you "own" it
18:43hiredmanhttp://www.taguri.org/
18:43hiredmansimilar work
18:43jlewisconsidering that my domain name is jordanlewis.org, i suppose jordanlewis isn't such a bad pick. i just thought that there might be a more standard alternative, since i've been seeing all of these single-namespace projects around.
18:44technomancyjlewis: the artifact/group you put in project.clj doesn't have to have anything to do with your namespace name
18:44hiredmana taguri is also most a valid clojure symbol, I think
18:44technomancythere are very few single-segment namespaces in real clojure projects, but lots of one-word artifact identifiers
18:46jlewismm, i see. ok. now the converse: assuming i'd like to leave the namespace of my project jordanlewis.data.union-find, is there something wrong or deprecated about using a maven-style org.jordanlewis group id?
18:46hiredmannope
18:47hyPiRionmost people use the maven-style I think?
18:47hyPiRionAt least a good portion of libs I use are on that form.
18:52technomancymost people use names that aren't everyday nouns, but if you are going to have a name like that it's best to namespace it
19:09seangroveI'm trying to take a seq of strings and return a map looking like {"s1" {:sn "s1"} "s2" {:sn "s2"}} (if given e.g. ["s1" "s2"] as input)
19:10seangroveHaving a hard time thinking of a way to do it concisely
19:11hiredman(apply merge (map (fn [s] {s {:sn s}}) ["s1" "s2"]))
19:11hiredman,(apply merge (map (fn [s] {s {:sn s}}) ["s1" "s2"]))
19:11clojurebot{"s2" {:sn "s2"}, "s1" {:sn "s1"}}
19:11hiredman,(reduce (fn [m s] (assoc-in m [s :sn] s)) {} ["s1" "s2"])
19:11clojurebot{"s2" {:sn "s2"}, "s1" {:sn "s1"}}
19:11hiredmanetc
19:12seangroveAh, so create a seq of key-value pairs, and then merge them?
19:12seangroveSounds good, thanks
19:22gtrak,(into {} (for [k ["s1" "s2"]] [k {:sn k}]))
19:22clojurebot{"s1" {:sn "s1"}, "s2" {:sn "s2"}}
19:22egghead:3
19:23eggheadtoday I used map juxt and comp in the same line, felt good
19:23gtraknice!
19:23technomancy~o/
19:23clojurebot\o ... High five!
19:23egghead\o
19:23gtrak-_-
19:25yedihow often do new versions of the JVM come out (if at all)
19:25yediare there active groups still working to make the core jvm better?
19:26gtrakyedi: yes
19:27gtrakhttp://en.wikipedia.org/wiki/Java_version_history#JDK_Alpha_and_Beta_.281995.29
19:27technomancyyedi: invokedynamic is relatively new, and there's work to add lambdas and a not-horrible date class.
19:27danostrowskiAnyone here used IntelliJ's Clojure plugin?
19:27mcohenanyone know to how to pass system properties on the command line with lein (not in project.clj)?
19:28ivandanostrowski: I use it to read code
19:28technomancyhuh; according to wikipedia jsr310 is going to be in 8. I wonder how accurate that is.
19:28danostrowskiivan, I guess that's something. :) Was it horrible?
19:29yedii wonder how important new features to the JVM are for clojure...
19:29gtrakyedi: tail-recursion would be nice
19:29yedi one of the changes in java 7 was jvm support for dynamic langauges... whatever that entailed. i don't see how that was useful
19:29technomancyyedi: clojure doesn't explicitly take advantage of anything newer than 5 IIRC
19:29ivandanostrowski: it thinks a lot of things are invalid syntax and it takes quite a while to highlight the functions in lists
19:29dnolenyedi: invokeDynamic could be very useful once it's fast
19:29ivandanostrowski: also no paredit, if you want that
19:29danostrowskiah. good to know.
19:30dnolenyedi: it's possible Nashorn could influence direction of JVM if Oracle takes that project seriously which it looks like they are.
19:30ivantechnomancy: ForkJoin!
19:30danostrowskiMaybe I'll just vim-clojure for now.
19:30danostrowskiI generally like the JetBrains products (I use PyCharm a _ton_) but it doesn't seem like the most active plugin.
19:30gtrakyedi: the master of this is Cliff Click, his blog explodes brains
19:31technomancyivan: well, not in actually released clojure versions =)
19:31ivanyedi: I heard of invokedynamic being broken in 7 and fixed in 8
19:31arrdemdanostrowski: I've been vimclojuring for several months now successuflly...
19:32technomancyclojurebot: inst is http://themosthorriblething.com/horribleimgs/F7UCSS.gif
19:32clojurebot'Sea, mhuise.
19:32mcohendanostrowski: the idea plugin will let you set breakpoints and step through debug, but other than serious folks seem to prefer emacs. sublime text is not bad if you're an emacs newb
19:32danostrowskiit works on the server I edit Riemann files on, but I'm now embarking on, like, really learning Clojure.
19:33danostrowskiI do love the debugger in PyCharm. Hmm.
19:33mcohensame debugger basically
19:33yediwhy would nashorn be useful? embedding clojurescript code inside clojure?
19:33danostrowskifigures. thanks mcohen and all.
19:33yedigtrak: thanks for the blog suggestion
19:35mcohenhi technomancy, do you have a sec?
19:35technomancymcohen: maybe?
19:36mcohenthanks. is there any way i can do something like lein repl -Da=b ?
19:36danostrowskiIf you wanted to expose an API to clients and allow them to add scripts to a program around events firing... what would be the best choice in Clojure? Whitelisting would be important. If I was doing it Erlang or Python I'd use Lua, because there's libraries ready to go for that. Not sure for Clojure...
19:36technomancymcohen: if you want to do it on the CLI you'd do JAVA_OPTS="-Da=b" lein repl
19:36technomancymcohen: you can put it in project.clj as :jvm-opts too
19:36gtrakdanostrowski: clojail might be useful for you
19:36mcohenawesome. in project.clj wasn't an options for me
19:36mcohenthanks a bunch phil
19:36technomancyno problem
19:37dnolenyedi: nothing to do w/ CLJS. Nashorn needs to follow JS spec, JS spec is moving toward proper tails calls.
19:38dnolen(or may already arrived there for ES6)
19:39danostrowskigtrak, hmm! I'll google that, thanks.
19:40gtrakdnolen: maybe we can make a spec for clojure, and give it tail calls :-)
19:41danostrowskialthough... Clojure for plugins may not be the most wise choice, haha.
19:41danostrowskinot sure plugin developers are going to overlap with lisp people, but we'll see. ;)
19:43gtrakdanostrowski: my next suggestion would be rhino or something
19:43gtrakit is embedded in J2SE 6
19:44danostrowskithat probably would be more accessible, I'll look at that after I've read clojail. Thanks for the suggestions, gtrak :)
19:44gtrakyea, no problem!
19:47yedifor languages that have tail recursion: is it automatic? does the parser/compiler recognize functions that can be tco'd and just does it?
19:47gtrakyes
19:48gtrakthough I've only used one that does it (scheme)
19:49technomancyTCO is more than just recursive calls though
19:58augustlwhat's a good way to get a counter/index in a doseq?
19:59technomancyaugustl: (doseq [[x i] (map vector myseq (range))] ...)
19:59augustlonly thing I can think of is to build a map with map-indexed or something
19:59augustltechnomancy: won't that create a lot of temporary objects?
19:59technomancyyeah
20:00augustlsome kind of lazy awesomeness would have been nice :)
20:00technomancyoh, I guess map-indexed is in core now
20:00augustlperhaps a recur is better
20:00technomancybut not doseq-indexed
20:00technomancydon't use recur
20:01augustlhm
20:01technomancyunless you've already measured that object allocation is a bottleneck
20:01augustltrue
20:01amalloyaugustl: everything clojure does creates a lot of temporary objects
20:02hiredmanlots of things
20:02technomancyrule of thumb: the GC is better than you think it is
20:04gtrakjdk7 can even throw em on the stack
20:08yogthosdoes anybody know if there's a pretty printer for outputting nicely formatted code?
20:08gtrakyogthos: more pretty than clojure.pprint?
20:09yogthosgtrak: differently pretty :)
20:09yogthosgtrak: I'd like something that follows formatting similar to paredit
20:09gtrakhmm, yea, no idea
20:09gtrakmaybe there's something interesting in counterclockwise
20:10yogthosgtrak: likely, it has logic for indentation, although it still won't reformat selected code automatically :)
20:10yogthosgtrak: so I suspect it's more of a state thing with it
20:11amalloygtrak: i doubt if jdk7 can put many of clojure's temp objects on the stack, because just about all of them escape from the function they were created in
20:11amalloyyogthos: pprint has a code-dispatch setting
20:11gtrakamalloy: it can also inline those functions they're created in
20:13yogthosamalloy: ah cool
20:20yogthosamalloy: yeah it's exactly what I was looking for thanks :)
21:24gfrederickstechnomancy: I am curious if you're still a fan of the defproject syntax, or if in retrospect you might have preferred a bare map or something else
21:25ed_gDoes the clojure.contrib.math library exist any more or should I be using Java's Math classes?
21:25pppaulcontrib got split up into infinite repos
21:25gfredericks~contrib
21:25clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
21:26gfredericksapparently there is a clojure.math.numeric-tower
21:27ed_goops, OK I had tried to :use it and didn't realize it wasn't bundled with the main distribution of clojure
21:30ed_gthanks @pppaul, @gfredricks!
21:30krli'm confused on this, why does (type (doall (lazy-seq [1 2 3]))) not return PersistentVector?
21:30gfrederickswhy would you expect it to?
21:31gfredericks,(type (lazy-seq [1 2 3]))
21:31clojurebotclojure.lang.LazySeq
21:31gfredericksdoall doesn't change the type of its argument
21:31gfredericksit just forces it
21:31krlok. i guess i want a function to force and return the datastructure
21:31gfredericksI don't think there's a consistent general way to do that
21:31gfrederickswhy would you need that?
21:31krlfor debug printing
21:32gfredericksoh you probably want prn
21:32gfredericks,(prn (lazy-seq [1 2 3]))
21:32clojurebot(1 2 3)
21:32krlhmm. any way to get the result of prn as a string?
21:32ToxicFrogYeah, if you're doing debug printing it'll get realized when it's printed, if not before
21:33gfrederickskrl: yep. prn-str :)
21:33gfredericksalso pr-str if you don't want the newline
21:33krlok cool
21:33pppauli love newlines
21:33pppaulprn prints out stuff that can be evaled, right?
21:33gfrederickswell read at least
21:34gfredericksit tries anyhow
21:34gfredericks,(pr-str (Object.))
21:34clojurebot"#<Object java.lang.Object@701451eb>"
21:35krlok thx, that should solve my problem!
21:37devn,(binding [*print-dup* true] (prn {:a 1 :b 2}))
21:37clojurebot#=(clojure.lang.PersistentArrayMap/create {:a 1, :b 2})
21:38gfrederickswoah man that's serious
21:38gfredericks,(binding [*print-dup* true] (prn (into (sorted-map) {:a 1 :b 999}))
21:38clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
21:38gfredericks,(binding [*print-dup* true] (prn (into (sorted-map) {:a 1 :b 999})))
21:38clojurebot#=(clojure.lang.PersistentTreeMap/create {:a 1, :b 999})
21:39devnsharp-equals club. be careful. :)
21:39gfrederickso_O
21:39gfredericks,(type (sorted-map))
21:39clojurebotclojure.lang.PersistentTreeMap
21:39gfredericksahsee
21:39devn,(read-string "#=(clojure.lang.PersistentTreeMap/create {:a 1, :b 2})")
21:39clojurebot#<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.>
21:39devn^-that would work in your REPL
21:39devnbut not with the bot
22:05technomancygfredericks: you can use a bare map if you want
22:05gfredericksWAT
22:05technomancy(def project {:name "whatever" :group "stuff" :version "1.0.0-COLLECTORS-EDITION"})
22:05technomancyFSVO "bare"
22:05gfredericksoh I meant at the top level :)
22:05technomancyit's just super annoying because every symbol needs to be quoted
22:05technomancyoh you mean like read-string instead of load?
22:06technomancyeh
22:06gfredericksright
22:06xumingmingvIs there a style guide for how to document the parameter of function? like the @param tag in Java?
22:06gfredericksmakes it feel more like data?
22:06gfredericksxumingmingv: I think folk normally just put that in the docstring; I don't know of anything more specific.
22:07gfredericksif you're using marginalia you can use markdown to some effect
22:07technomancygfredericks: I don't think it makes much of a difference. some people take advantage of the fact that you can (def shared-value ...) before defproject, and that would be difficult with read-string
22:07gfrederickstechnomancy: oh man; that's a use case that never would have occured to me
22:07technomancyOTOH you can do a lot with read-eval
22:07technomancy(but not that)
22:08gfredericksooh a new data reader: #eval (def stuff ...)
22:09gfredericksokay am going to bed
22:09technomancyhaha
22:09hyPiRiongfredericks: good luck
22:09technomancyan early version actually used strings for artifact ids
22:09technomancywhich was really annoying
22:09gfrederickstechnomancy: aaah!!!
22:09gfredericksI'm annoyed just hearing about it
22:09technomancyI think defproject is the only macro in leiningen
22:09technomancyheh
22:09gfrederickshyPiRion: thanks
22:10gfrederickstechnomancy: "The Only Macro in Leiningen" would be a good title for something
22:10technomancygfredericks: yeah, it also adds some defaults in, but you could do that with a map merge too
22:10gfredericksthe first great work of clojure literature
22:10amalloytechnomancy: checks out. just one macro. very surprised, personally
22:10technomancywith the lein-pprint plugin it makes it pretty easy to see the effective map value of various profiles etc
22:11hyPiRionYeah, defmacro's the only macro in Leiningen.
22:11hyPiRiondefproject I mean
22:11jweisswhat's the syntax to get the bot to test core functions to match input and output you give it?
22:11xeqihaving not explored readers at all, can you add a new one at runtime?
22:12gfredericks$findfn 42 42
22:12gfredericksxeqi: yeah there's a var for it
22:12lazybot[clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/time clojure.core/dosync clojure.core/long clojure.core/short clojure.core/+ clojure.core/* clojure.core/doto clojure.core/unchecked-long clojure.core/+' clojure.core/unchecked-short... https://www.refheap.com/paste/8259
22:12xumingmingvthanks gfredericks
22:12jweiss$findfn [inc [1 2 3]] {1 2 2 3 3 4}
22:13lazybot[]
22:13jweiss$findfn [[1 2 3] inc] {1 2 2 3 3 4}
22:13gfredericksjweiss: no list around the args
22:13lazybot[]
22:13gfredericksjweiss: also I know that function doesn't exist; I've wanted it a lot
22:13jweissdarn
22:13gfredericksI bet flatland/useful has it
22:14hyPiRion,(zipmap [1 2 3] (map inc [1 2 3]))
22:14clojurebot{3 4, 2 3, 1 2}
22:14jweissso what do you use? let/zipmap?
22:14gfredericksthere's also (into {} (for ...))
22:14jweissright, i wrote both and they looked ugly
22:14jweissoh well
22:14gfredericksit probably wasn't included because the use cases are slightly iffy
22:15jweissgfredericks: if you want to display information to a human? seems like a good use case.
22:16gfredericksyeah humans are the best
22:16xeqiother than robots
22:16hyPiRion~botsnack
22:16clojurebotthanks; that was delicious. (nom nom nom)
22:16gfredericks~botdance
22:16clojurebotI don't understand.
22:16amalloythe problem with that function is that it can't work unless the input values are unique
22:17gfredericksit could work as well as zipmap
22:17gfredericksif your input values aren't unique that's your own problem
22:17gfredericksI can't even see how that's even remotely a problem actually
22:17gfrederickseven even
22:17hyPiRionyeah, no difference between that and zipmap
22:46ravsterhello everyone
22:47arohnerafter binding clojure.core/*data-readers* to {}, I'm still seeing #uuids being loaded. any ideas on what to look at?
22:48arohnerwith-redefs [default-data-readers {}] "solves" the issue, but I'd like something that I can bind
22:49bprarohner: i'm pretty sure *data-readers* is bound to {} in the first place
22:49arohnerbpr: *data-readers* contains {}, but #uuid is still being handled
22:49bprright
22:49bprso, re-binding to {} wouldn't change things
22:53arohnerah, default_data_readers is hard coded in LispReader.java. that's unfortunate :-(
23:02yedicore.matrix would be sexy
23:03bbloomyedi: yes it would!
23:08arohneris there a built in fn that works like repeatedly, but stops when f returns falsey?
23:08arohnerI guess (take-while identity (repeatedly f))
23:08bbloomarohner: that'd do the trick
23:12xeqiis there something to pass to spit to make it create any missing parent directories?
23:13technomancyI don't think so
23:20bprxeqi: ##(doc clojure.java.io/make-parents)
23:20lazybot⇒ "([f & more]); Given the same arg(s) as for file, creates all parent directories of the file they represent."
23:21xeqibpr: thanks, that was my next step
23:21bprk