#clojure logs

2014-01-14

00:02logic_progis there a way to run clojure on go ?
00:06eggheadclojure on the go
00:15TEttingerlogic_prog, there might be some project that could, but it seems like it wouldn't really be optimal if Clojure on C isn't close to mature yet, and that's a way bigger use case
00:31arrdembitemyapp: well it coulda gone worse... there was interest in a follow up.
00:31arrdemlogic_prog: the real constraint with something like a clojure in C is that you loose so much of Clojure and unless you allow access to C primitives (scary shit!) you don't really win...
00:32arrdemlogic_prog: such a compiled Clojure is very much something I'm intrigued by, but I'm convinced that it'd just be a better Lisp, not really Clojure.
00:32arrdemthat said I don't really think CLJS is Clojure for the same reasons...
00:32arrdem</rant>
00:39logic_progarrdem: Understood. Thanks.
00:48arrdemlogic_prog: that's what Rust is for :D
00:48logic_progarrdem: rust is a lisp
00:49logic_prog?
00:49arrdemlogic_prog: nah it's another C like with more safety gurantees
00:49arrdemlogic_prog: I wish it was a lisp :P
00:49noonian__http://www.rust-lang.org/
00:59quizdryes
01:53danielcomptonI'm trying to do nested destructuring but am not sure how to do use :keys on anything but the innermost form
01:53danielcomptonI want to turn https://www.refheap.com/23624
01:53danielcomptoninto an expression where I don't need to specify name :name on the outer form
01:54danielcomptonCan anyone help?
01:59maravillasdanielcompton: do you mean like https://www.refheap.com/23625 ?
02:00danielcomptonmaravillas thats it. Thanks!
02:00maravillaswelcome!
02:01danielcomptonHow would you do a third level?
02:01TEttingermaravillas, change m to book, btw
02:02TEttingerjust ran it, it does work with that change. fast work
02:02TEttinger(inc maravillas)
02:02lazybot⇒ 1
02:02maravillasoh yeah, caught that. thanks :)
02:03maravillasdanielcompton: if you wanted to destructure further into :details, you'd just add whatever's appropriate to the {:keys [pages isbn-10]} form
02:05danielcomptonHow would I do https://www.refheap.com/23626 ?
02:06danielcomptonI think I've almost got it
02:06maravillascover should be in a vector
02:07TEttingeryeah, cover in [cover]
02:07danielcomptonGreat!
02:07danielcomptonI think it clicks now
02:07maravillas:)
02:07danielcomptonThanks TEttinger and maravillas
02:07TEttingerargument destructuring is great, no prob
02:07maravillasnp
02:08danielcompton(inc maravillas) (inc TEttinger)
02:08lazybot⇒ 1
02:08TEttingerhaha
02:08TEttingerI think that may have...
02:08TEttinger$karma maravillas) (inc TEttinger
02:08lazybotmaravillas) has karma 0.
02:08TEttingerhm
02:08danielcompton(inc TEttinger )
02:08lazybot⇒ 1
02:08danielcomptonThats better
02:08TEttingerwhat happened to my karma???
02:08lazybotTEttinger: How could that be wrong?
02:09TEttingeroh haha
02:09nones$karma maravillas
02:09lazybotmaravillas has karma 1.
02:09maravillasmaybe it doesn't trim spaces?
02:09TEttinger$karma TEttinger
02:09lazybotTEttinger has karma 11.
02:09TEttinger$karma TEttinger
02:09lazybotTEttinger has karma 11.
02:09TEttingerhm
02:09nones$karma alhimik45
02:09lazybotalhimik45 has karma 0.
02:09TEttinger$karma TEttinger )
02:09lazybotTEttinger has karma 11.
02:09TEttingerno idea
02:09arrdemTEttinger: .... what are you doing.
02:09TEttingerwhat did it add the karma to?
02:10TEttingersorry for spam
02:10arrdemTEttinger: I was just surprised is all..
02:11TEttingerI tried it with trailing spaces, apparently the bot has a weird parse thing
02:11TEttingerI know it allows multi-word incs
02:12TEttingerI also am fairly sure that it needs to be done in-channel because at least one of the bots keeps some data specific to a channel
02:12yuri_niyazovWhat is the canonical location for the current documentation of clojure?
02:12TEttingerlike how clojurebot now only allows def'd forms in the same channel
02:13TEttingerprobably the API on the site. clojuredocs is out of date
02:14yuri_niyazovis this what everyone uses: http://clojure.github.io/clojure/index.html
02:14yuri_niyazov?
02:14TEttingerhttp://clojure.github.io/clojure/clojure.core-api.html I think
02:14TEttingeroh yeah you're right
02:15TEttingerbut it doesn't have the examples for unchanged or earlier-made parts of clojure that clojuredocs has
02:15TEttingerlike the github.io page has reduced , clojuredocs doesn't
02:15charehi guys
02:15chareremember me?
02:16TEttingerhi chare
02:16arrdemtechnomancy: so normally I wouldn't bother you, but chord is back for more.
02:16TEttingerI believe you were making a starcraft-like game?
02:16chareI gave up on that
02:16arrdemtechnomancy: see char
02:16chareI started learning Erlang
02:16TEttingeroh boy
02:17charewhats wrong with Erlang?
02:17chareits functional just lik eclojure
02:17TEttingeryes, I just have never seen it used
02:17arrdemhttp://i.imgur.com/p8gOKbv.jpg
02:17TEttingercan't be of much help
02:18TEttingers/^/I /
02:18chareso does that mean you guys are jealous that I spend the effort to learn new languages and you guys don't
02:20TEttingerI wouldn't describe myself as jealous of you, no
02:21charewhat have you guys been up to in my absense
02:21andyfgen-interface forms throw exceptions if you expand them twice (part of a defprotocol expansion). Are there any other known Clojure forms that have similar ill effects when exanded twice?
02:22andyfexpanded*
02:22TEttingerI wonder if macroexpand can expand itself
02:23arrdemTEttinger: yep... shouldn't do anything tho.
02:23andyfIt can, but macroexpansions of function calls are just the function calls
02:24charelets talk about Datomic are you guys familiar with it?
02:31chareso thats a no?
02:54bitemyapparrdem: back
02:54bitemyappcrazy fun type theory meetup :)
02:55chareshit I just got banned from #python for claiming that clojure > python
02:56bitemyappchare: are you that starcraft dude?
02:56charewhat does that mean
02:56bitemyappthere was some troll coming to this channel asking people to write a starcraft clone for him
02:56bitemyappchare: are you him?
02:56chareI gave up on that
02:57bitemyappah, you are him
02:57bitemyappnew nick to ignore, cool.
02:57chareI got bored of starcraft
02:57charei didn't change my nick
02:57arrdembitemyapp: dude
02:57bitemyapparrdem: what?
02:57arrdembitemyapp: my drow streak is getting silly
02:57bitemyapparrdem: mumbur.
02:57arrdembitemyapp: bedtime.
02:58bitemyapparrdem: dammit. Wanted to do a game before going to bed, type theory meetup was awesome!
02:59charewhat do you guys think of linear typing
02:59arrdembitemyapp: sweet! yeah this 1am 2am shit is getting old already... I'm considering some sort of electronic vaccation until I've gotten in a sane school swing...
02:59arrdembitemyapp: much as I enjoy fivemanning with you and quiggles et all.
03:00bitemyapparrdem: fair nuff.
03:00charearrdem tell bitemyapp to unignore me please
03:14AeroNotixis there any integration with `lein check' and emacs already? Or is it something I should write?
03:18andyfI don't know of anything, but haven't looked. Seems like M-x next-error would be easily customizable for that.
03:24AeroNotixok
03:26ivanthese names don't make a whole lot of sense https://github.com/dakrone/cheshire#decoding
03:26ivan(first (cheshire/parsed-seq rdr)) to read JSON from a file with a reader
03:28_ericI have a (def) that just calls (System/getenv "VAR") and I'd like to override what it is in a test
03:28_ericis that reasonable and is there a simple way to do it?
03:39clgveric: if it were wynamic you could rebind it with `binding`
03:39clgv*dynamic
03:41Glenjaworkthis is an odd question, but if i were trying to model a normalised data-model in memory (similar structure to an RDBMS) - would refs be a reasonable option?
03:41clgvGlenjawork: sure.
03:42Glenjaworkcan you do circular structures?
03:43Glenjaworkie, user1 is a ref containing a map, where one key is score1, and score1 is a ref containing a map where one key is user1
03:43clgvnot with the immutable/persistent values within the refs
03:44Glenjaworkah ok, so because refs are mutable you can't put them inside refs?
03:44clgvfor building a circular structure you'll always need the indirection through a ref (when transactions are required, otherwise atoms work as well)
03:44Glenjaworkright, so i could model each "table" as a map in a ref
03:44clgvGlenjawork: no. you can put refs into other refs
03:45clgvthat would be an option.
03:45Glenjaworkthis is probably a bad idea, but we have a specific calculation our mysql DB is terrible at
03:45clgvfirst options that come to my mind: (1) whole database in ref, (2) each table in a ref, (3) each row in a ref
03:46clgvwith different implications on scalability
03:46Glenjaworkso we're considering writing something that can efficiently do this bit, without having to change the entire app onto a new db
03:46clgvGlenjawork: other DBs like PostgreSQL are no option?
03:46AeroNotixwhat's the best way to abort compilation in macros? I see some of the standard library uses assert-args.
03:46Glenjaworkmaybe
03:47Glenjaworkbut any DB is a black box
03:47clgvif you use jdbc anyway that would not be a complex change
03:47Glenjaworkand potentially we want a white box
03:47clgvok
03:47Glenjaworkwe don't even use clojure at the moment
03:48Glenjaworkbut if i want to calculate something atomically with high concurrency, it seems like a good fit
03:48clgvAeroNotix: assert-args just throws an exception
03:48AeroNotixclgv: so I'll just throw IllegalArgumentException or something?
03:49clgvAeroNotix: yeah. for a useful exception you should include line and file information to help the user
03:49AeroNotixclgv: cheers
03:49Glenjaworkor it might be a dumb idea
03:49Glenjaworki'm not sure yet
03:49Glenjaworkif there's an optimised FRP toolkit somewhere that might be a good fit as well
03:49Glenjaworkas i only want to update dependant data
03:50clgvGlenjawork: you can search the ML for FRP - there were several discussions about it. but I don't remember whether there is a mature library yet
03:50Glenjaworkits annoying, this dataset/calculation really shouldn't be that hard
03:51Glenjaworkit's just a 1million person league table
03:51AeroNotixGlenjawork: and you're sure you've written the most optimized query available?
03:51clgvthe bottlenekc is mysql right now?
03:51Glenjaworkthe bottleneck is a combination of current schema and mysql
03:52Glenjaworkthe bottleneck used to be data transfer between DB and app
03:52Glenjaworkso we do all the work in the app
03:52Glenjaworkand it maxes out one core
03:52Glenjaworkbut if i make it use more than one core, i need multiple connections and lose atomicity
03:52Glenjaworkall the work in the DB even
03:53clgvyou'd have transactions in the db as you'd have with clojure's ref
03:53Glenjaworki assume i can use reducers within a ref transaction
03:53AeroNotixMySQL has transactions Glenjawork, that's kind of the point.
03:53Glenjaworkso i'd expect better parallelisation
03:53Glenjaworkat the moment i can't make it use more than 1 core without losing atomicity
03:54Glenjaworkunless maybe i do a table rename
03:54Glenjaworkthe query is (pseudo-sql) UPDATE score (select sum(score) from guess group by user)
03:57Glenjaworkhrm, all the FRP things i find are about UI
04:01clgvGlenjawork: simple building blocks for FRP are the watch functions you can have for refs and atoms
04:02Glenjaworkmodelling rows as refs and using watch functions might work nicely
04:02Glenjaworkalthough i guess thats equivalent to normalising my schema more, so perhaps it should do that first
04:02Glenjaworks/perhaps it/perhaps i/
04:03clgvGlenjawork: I'd go for optimal schema and query first. if that is not sufficient you can use a real db like postgresql ;)
04:04Glenjaworkyeah, that'll be a fun chat with ops
04:04Glenjaworkwe technically have a bunch of oracle licenses too
04:04clgvwell then maybe oracle since you probably have experts for it as well then
04:04Glenjaworkon the face of it that query looks like it should parellise perfectly
04:06Glenjaworkanyway, cheers for the input
04:06Glenjaworklots more thinking to do :)
04:17sm0keis there a better way to do, ##(get-in {:a {:b {:c 1}}} [:a :b :c]); than this
04:17lazybot⇒ 1
04:18bitemyappAeroNotix: InnoDB has transactions
04:18bitemyappAeroNotix: MySQL/MyISAM do not.
04:21AeroNotixbitemyapp: ;)
04:21fredyrsm0ke: i think thats it, what else do you have in mind?
04:22AeroNotixsm0ke: -> ?
04:22AeroNotix->> ?
04:22sm0keyea but not if keys are non keywords
04:23sm0kei think map should take more than one argument
04:23sm0ke,({:a {:b {:c 1}}} :a :b :c)
04:23clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: PersistentArrayMap>
04:23sm0kelike that
04:23sm0ke,({:a {:b {:c 1}}} :a)
04:23clojurebot{:b {:c 1}}
04:24AeroNotixsm0ke: make a macro
04:25sm0kealso how do i find max in [[1 2 4] [3 5 1] [3 4 6]]
04:25AeroNotixsm0ke: flatten+max?
04:25sm0kewhat?
04:25clojurebotwhat is cells
04:26sm0keheh
04:26sm0ke[1 2 4] sensibly is lesser than [1 2 1]
04:26sm0kei am talking about tuple comparison
04:26AeroNotixwhy?
04:26clojurebotwhy is Why
04:26AeroNotixclojurebot: because
04:26clojurebotExcuse me?
04:27AeroNotixyou heard me!
04:27sm0kesorry
04:27sm0ke[1 2 1] < [1 2 4] i meant
04:27AeroNotixSure
04:27sm0ke,(< [1 2 1] [1 2 4])
04:27clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
04:27pyrtsa,(< (compare [1 2 1] [1 2 4]) 0)
04:27clojurebottrue
04:28Glenjaworkwhat does 0 mean?
04:28jonathanj,(compare [1 2 1] [1 2 4])
04:28clojurebot-1
04:28pyrtsa(compare a b) returns -1 if a<b, 0 if a=b, otherwise 1.
04:28Glenjaworkoh right
04:28sm0keok so ##(max-key #(< (compare %1 %2)) [[1 2 4] [3 5 1] [3 4 6]])
04:28lazybot⇒ [[1 2 4] [3 5 1] [3 4 6]]
04:28jonathanjhow does compare actually compare two vectors?
04:29sm0kewhat the..
04:29squidzdoes anybody know if there is a way to get lein to recompile the project when other source files change within the 'src' folder? I have a clojurescript project and have javascript files and want to get leiningen to recompile the clojurescript on change. Anybody know how to do this?
04:29pyrtsaBut... Word of warning: Clojure does not define sequence comparisons as lexicographical. Instead, the shorter is considered smaller. :(
04:29sm0kesquidz: lein-reload
04:29jonathanjisn't that the same as Python?
04:29pyrtsajonathanj: Lexicographical ordering would be the best definition.
04:30pyrtsa(compare [1 3] [1 2 4])
04:30pyrtsa,(compare [1 3] [1 2 4])
04:30clojurebot-1
04:30pyrtsa,(compare [1 2] [1 2 4])
04:30clojurebot-1
04:30pyrtsa,(compare [1 1 1 1] [1 2 4])
04:30clojurebot1
04:31sm0keok this is weird
04:31pyrtsajonathanj: Python does it lexicographically.
04:31jonathanjso you probably need to have a better definition of what it means to compare two vectors, given your software's domain
04:31pyrtsaI'm just saying what might probably be a sensible default.
04:31amalloypyrtsa: well, clojure compares vectors the way that python compares tuples
04:32pyrtsaOf course, by-count comparison is faster if the count is known.
04:32amalloywhich is different from the way it compares lists
04:32pyrtsaamalloy: No it doesn't!
04:32amalloyit does
04:32amalloy>>> (5) < (1,2) ## => True
04:32sm0keok so ##(max-key (partial compare [0 0 0]) [[1 2 4] [3 5 1] [3 4 6]])
04:32lazybot⇒ [[1 2 4] [3 5 1] [3 4 6]]
04:32amalloyoh wait, that's not a tuple
04:32amalloyokay, i take it back
04:32pyrtsaamalloy: Python: (1,3) < (1,2,4) == False, (1,2) < (1,2,4) == True.
04:33pyrtsa(1,) would be a Python tuple.
04:34sm0keit doesnt make sense
04:34sm0kewhy isnt there a sort-by-cmp or max-by-cmp
04:35pyrtsasort-by does take a cmp argument, optionally.
04:35sm0kepyrtsa: its a key func not comparison
04:35pyrtsa(sort-by identity cmp xs)
04:35pyrtsasm0ke: In addition to the key.
04:35amalloywhat would sort-by-cmp do? it would just be sort?
04:35clgv,(apply max-key (partial compare [0 0 0]) [[1 2 4] [3 5 1] [3 4 6]])
04:35clojurebot[3 4 6]
04:35pyrtsaamalloy: Sort with your custom comparator. Like it does.
04:36amalloybut that's what sort does
04:36amalloy&(doc sort)
04:36lazybot⇒ "([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
04:36pyrtsaHeh, true.
04:36sm0kepyrtsa: what about max?
04:37pyrtsasm0ke: max is unfortunately defined for sequences of java.lang.Number instances only.
04:37pyrtsaThus, asking for a comparator would be asking for a different function.
04:37sm0kenow thats fucking stupid api to have
04:37pyrtsaI agree.
04:38pyrtsaFun fact: I actually have my variations of min, max, <, <=, >, >= etc. defined for Comparables. Should probably open-source those.
04:38Glenjaworkor add to core :p
04:38pyrtsaYeah.
04:39arcatanpyrtsa: our codebase has those versions of <, <=, >, >=, too. cleverly i called them <<, <<=, >>, >>=.
04:39pyrtsaGlenjawork: Well, somebody *might* be right in arguing that the default impls are defined for Numbers only because of inlining.
04:39arcatanwasn't the best naming decision - now i'm like "wtf we are binding here?"
04:39pyrtsaarcatan: >>= -- I see what you did there! :D
04:40pyrtsaarcatan: I went for >' <' <=' >=' min' max'.
04:40Glenjaworkpyrtsa: isn't there something in core that presents inlinable versions of functions for some types
04:40Glenjaworki seem to recall + is overloaded that way
04:40pyrtsaGlenjawork: I'm not sure. FWIW, there's a separate +' with different semantics.
04:41pyrtsa(Potentially returning BigInt etc.)
04:41Glenjaworkhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L939
04:42Glenjaworknot that i know what :inline actually does
04:47pyrtsaGlenjawork: If I'm not missing something, the only way to redefine max etc so that inlining is available for Numbers, would be to guard them with an (if (instance? Number x) ... ...) check, and then make the "else" branch use the Comparable interface.
04:47piranhadnolen: are you by any chance still here?
04:47pyrtsa...Which might not be that bad, since they cast to Numbers anyway.
05:50AeroNotixwhat do people use for linting/code analysis?
05:58sm0kekibit is good
05:58sm0keactually its awesome, just that it doesnt walk recursively
06:02arcatanthen there's Eastwood, which has had some attention recently
06:09sm0kealso dynalint
06:39AeroNotixlots of cider/kibit stuff doesn't work but gives me an error in the bar: "Variable binding depth exceeds max-specdpl size"
06:39AeroNotixany ideas?
06:48sm0keyes i got an idea, how about use vim and do :!lein kibit %
06:55AeroNotixsm0ke: how about no
06:55sm0kewell its up to you man
06:55sm0keno pressure
06:55sm0ketake your time
06:55AeroNotixsm0ke: not sure what you're trying to insinuate there.
06:59bitemyapplol.
06:59AeroNotixJust childish
07:01sm0keid like to be serious sometimes
07:02lockssm0ke: until the first "y so serious"
07:04CookedGryphonAeroNotix: what do you get if you do M-h v max-specpdl-size
07:04AeroNotix1500
07:04AeroNotixI'm looking at: https://github.com/clojure-emacs/cider/issues/443
07:05AeroNotixseems like the issue was fixed in tip, just seeing if marmalade is picking up the changes...
07:05AeroNotix..secondary annoyance... why don't most marmalade packages just build from git/git tags
07:05CookedGryphonmelpa does that doesn't it~?
07:05CookedGryphonthink you'll find most stuff from marmalade in there
07:06AeroNotixlemme see
07:06AeroNotixoh wait, I'm using melpa
07:20rurumate_Hi, is there an easy way to read only first line from a file, a la head -n 1 ?
07:21rurumate_maybe useful has something?
07:22CookedGryphon(first (line-seq (reader file)))
07:22rurumate_coo;
07:22rurumate_*l
07:22CookedGryphonmore correctly, (with-open [rdr (reader file)] (first (line-seq rdr)))
07:23CookedGryphonwhich will handle closing the file properly after you've read your one line
07:23rurumate_I was just about to say you should close the reader
07:23rurumate_but that's a bit too clunky
07:24CookedGryphondepending how critical this is...
07:24CookedGryphonyou might want to just to (.readLine rdr)
07:24CookedGryphonwhat with lazy seqs chunking off the first 32, plus all the overhead of setting up the seq, even if it is idiomatic
07:25rurumate_no it's not critical, just playing in the repl
07:26rurumate_I'm trying to write it as short as possible.. looking for something like a bash implementation in clojure
07:29CookedGryphonstevedore might be interesting to you
07:33rurumate_yes, that's interesting, thanks
08:08oracle123aI have stored a string like "> 2 1" in db, then how to evaluate in clojure like (> 2 1)
08:11AeroNotixoracle123: read-string
08:11AeroNotixhttp://clojurecassandra.info/ <- is this as good as it looks?
08:18oracle123I need to read a string from db, and then evaluate it as a filter, but looks like it doens't work as expected, both of the following return all the data in the vector., shouldn't the second one return empty since (< 3 2) is alway false?
08:18oracle123 (filter (fn [x] eval (read-string "(> 3 2)")) [0 1 2 3])
08:18oracle123 (filter (fn [x] eval (read-string "(< 3 2)")) [0 1 2 3])
08:18oracle123
08:21hyPiRionoracle123: There's a difference between `(eval (read-string "(> 3 2)"))` and `eval (read-string "(> 3 2)")`
08:23oracle123got it, thx hyPiRion
08:50samfooHey there clojurists! I have a bit of an open ended design/performance question that I was hoping some more experienced clojure developers might share some thoughts on...
08:51samfooI've started implementing an NES emulator in clojure, and gotten to a point where immutability is causing pretty substantial performance trouble.
08:52samfooThe design is effectively that I have to "step" from one clock tick to the next. Each step produced a new system state...
08:54Glenjaworkwhich part is the hotspot?
08:54samfooObject churn
08:54Glenjaworkare you changing lots of stuff each "tick" ?
08:54samfooYes
08:54mdrogalisYeah unless you're using persistent data structures, that's going to hurt.
08:54Glenjaworkmaybe take a look at http://clojure.org/transients
08:55samfooIt's using defrecord or persistent maps for practically all the state
08:55samfooSo it's already persistent
08:55mdrogalisDid you use an actual profiler and observe that GC is the problem?
08:56samfooI used VisualVM and observed that about 1/2 of the program time is spent in the constructors of some of my defrecords
08:56Glenjaworkoh, you're making new records instead of assoc-ing ?
08:56mdrogalissamfoo: Interesting. I don't use defrecord all that much, so I can't comment on performance there.
08:56samfooWhich I interpretted as immutability being "slow" in this particular case
08:57Glenjaworkclojure records are immutable in that when you change them you get a new cheap copy
08:57Glenjaworknot in the sense that you have to make new ones
08:57mdrogalisWhat Glenjawork said :)
08:57samfooGlenjawork: I'm assoc'ing and merging, but I assumed that assoc and merge internally have to call the record (java class) constructor
08:57Glenjaworkhrm, interesting
08:58samfooI could have misinterpretted the profiler output, of course
08:58samfooI've never profile clojure before
08:58mdrogalisNot all too different from profiling Java IMO
09:02oracle123(defrecord Alert [id amount unit])
09:02oracle123(def alerts (map (fn[x] (Alert. x (* 2 x) (* 3 x))) (range 10)))
09:02oracle123(def rules ["(> .amount 3)" "(> .unit 4)"])
09:02oracle123I want to keep the alerts which meet every rules, how to do that? the rules definition are got from db, so the definition is type of string.
09:02oracle123
09:05daGrevisis if a macro?
09:06sandbagsdaGrevis: trick I learned y'day to answer this question: 1) evaluate it
09:06sandbagsmacro's do not evaluate to themselves
09:07sandbags2) was looking at the metadata IIRC but looking at it now maybe i got that wrong
09:07jballanc,(macroexpand '(if true (println "Yes") (println "No")))
09:07clojurebot(if true (println "Yes") (println "No"))
09:07jballanceven easier :-)
09:07jballanc,(macroexpand '(-> crazy (nesting) (fun functions)))
09:07clojurebot(fun (nesting crazy) functions)
09:08sandbagsjballanc: i'm not following what that tells you... how does that tell you that if is a macro?
09:08daGrevis,if
09:08clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: if in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:09jballancsandbags: "macroexpand" will expand out macros
09:09daGrevisye sorry
09:09teslanickIf is a special form -- I took that to mean that it was neither function nor macro, and loosely thought it's some sort of IFn implementor in the java land.
09:09teslanickI don't know if that's accurate or not
09:10jballancteslanick: yup...but definitely not a macro
09:10daGrevisbut why isn't it a macro?
09:10jballancoptimization
09:10sandbagsjballanc: right, but the macro expansion of the 'if' is the same as the expression so what does that tell you?
09:10jballancsandbags: that it's not a macro
09:10jballancsee my example with "->"
09:10jballancwhich *is* a macro
09:10sandbagsjballanc: right but it doesn't tell you that it isn't a function either
09:11jballancwell, you asked if "if" was a macro ;-)
09:11sandbagsactually i didn't ;-)
09:11jballancoh, whoops... daGrevis did
09:11sandbagsbut i take your point
09:11jballanc:P
09:11Glenjawork,(var if)
09:11clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: if in this context, compiling:(NO_SOURCE_PATH:0:0)>
09:12sandbagsusing macroexpand proves it isn't a macro
09:12Glenjawork,(var and)
09:12clojurebot#'clojure.core/and
09:12Glenjaworkit's a special form
09:12Glenjaworkafaict
09:13hyPiRion$source and
09:13lazybotand is http://is.gd/go7OcG
09:13jballanc,(letfn [(if [c t f] (println "Fooled you"))] (if true (println "If's not a function") (println "umm...")))
09:13clojurebotIf's not a function\n
09:18jballancheh...fun 'n games:
09:18jballanc,(letfn [(and [& clauses] (println "Macros can be replaced by functions"))] (and true (println "Macros can't be replaced by functions")))
09:18clojurebotMacros can't be replaced by functions\nMacros can be replaced by functions\n
09:18jballanc:P
09:22Glenjaworkhttp://clojure.org/special_forms#Special%20Forms--%28if%20test%20then%20else?%29
09:32TimMcjballanc: Wow, `and` is surprisingly annoying to write.
09:33TimMc(defn and2 ([] true) ([test] (test)) ([test & more] (let [r (test)] (if r (apply and2 more) r))))
09:33TimMccalled like (and2 (fn [] true) (fn [] 5))
09:35degMoving my clojure env from Linux to my brand-new MacBook, but I'm a Mac newbie. So, wondering if better to use macports or homebrew, at least with respect to typical clojure/clojurescript usages?
09:36AeroNotixhow do I parameterize builds? I want to have global variables (e.g. database hosts, other nodes in my network) as compile time constants. Does Lein support this?
09:37jcromartieAeroNotix: You can include a .properties file in your build and generate it with a template?
09:37jcromartieAeroNotix: but it's really better to specify those things at startup time
09:37hyPiRionAeroNotix: sort of. You can read resource files, and Lein supports specifying which resources to include
09:37sandbagsdeg: i've used both and found homebrew works better
09:37jcromartiei.e. from outside the .jar
09:37hyPiRionbut yeah, jcromartie's suggestion is the best
09:37AeroNotixhyPiRion: jcromartie: I've got a resource file which I use. But I want to e.g. have a `make dev' and a `make production' target. Which will fill out that file.
09:38sandbagsdeg: in so far as I've never managed to get hb "wedged" and had to start from scratch
09:38degsandbags: thanks. Any particular advantages, or just general sense?
09:38degoops, msgs crossed. thx
09:39AeroNotixhyPiRion: jcromartie in Erlang there's a release generator (think uberjar, bit different though) and Erlang uses a sys.config file which you can write in a template language and then specify a file to fill out those templates at release generation time.
09:40AeroNotixusing relx
09:41hyPiRionAeroNotix: yeah no, that's not possible in vanilla lein. But possible in plugins, I guess
09:41AeroNotixhmm ok
09:42GlenjaworkAeroNotix: could you have the makefile spit out a shell script wrapper that sets env vars?
09:42Glenjaworkwhich isn't really what you asked, but keeps the app free of config and gives you an easier build
09:43AeroNotixhmm, not perfect but...
09:43Glenjaworkeg, if you need to add/move a DB host, you don't really want to recompile
09:43Glenjaworkhttp://12factor.net/config and all that jazz
09:43AeroNotixsure. I'm just using what my ops dude likes to use
10:08rurumate_I need a fast hash function, maybe murmur. Is there a ready-to-eat implementation somewhere?
10:08hyPiRionrurumate_: generally you'd like to use a java lib for that
10:09rurumate_hyPiRion: yes, that's ok since it would probably be only one static call. but which one?
10:10rurumate_or is is the wrong channel to ask ;_;
10:12ddellacostarurumate_: re: wrong channel, personally think that kind of question is fine. Unfortunately don't have a great answer for you...maybe Zach Tellman's byte-transforms? https://github.com/ztellman/byte-transforms
10:13hyPiRionrurumate_: http://search.maven.org/#artifactdetails%7Ccom.google.guava%7Cguava%7C15.0%7Cbundle
10:13hyPiRionrurumate_: then http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/hash/Hashing.html
10:15hyPiRionI would generally just copypaste it and keep the license stuff available if the lib is too big
10:18mrhankyannybody here used servant with dommy? i keep getting an error something like "svgelement" is not defined. i dont know how to avoid this
10:19mrhankysadly there's really not much information on servant in the web
10:27AeroNotixwhat are people using for cassandra?
10:28stuartsierraDataStax' Java client.
10:30AeroNotixstuartsierra: what about http://clojurecassandra.info/
10:30AeroNotixit uses the datastax client underneath
10:30AeroNotixDoes this take care of pooling?
10:34matt444Whenever I define a function inside of a defn and use one of the defn's parameters, ClojureScript compiles that variable as being part of the namespace. Showing you what I mean: http://pastebin.com/Dv62ED2w
10:34matt444Is this a bug or am I doing something wrong?
10:34stuartsierraAeroNotix: I don't know anything about that.
10:34AeroNotixstuartsierra: hmm, cheers anyway
10:35CookedGryphonmatt444: one of those is aitimes, one is atimes
10:35CookedGryphonaitems, atimes*
10:35matt444well that's embarrassing
10:35CookedGryphon:P
10:36matt444lesson is to proofread my code, thanks
10:43matt444Is there a function for turning clojure sequences into javascript arrays, for interop?
10:44stuartsierramatt444: clj->js should do it
10:45AimHereI was going to suggest into-array, but that might be a java-array thing
10:45matt444@stuartsierra: when i google that I get a link to a gist, is this not in the cljs namespace
10:46stuartsierramatt444: I think it is. Look at the cljs.core source.
10:52xificurCis there a way to fetch all the code I wrote in my repl session?
10:52CookedGryphonno, but that would be an awesome plugin/middleware
10:52xificurC:(
10:52llasramxificurC: Are you using Emacs w/ cider/nrepl ?
10:53xificurCllasram: yes
10:53clgvhmm the repl has to keep its history somewhere...
10:53llasramxificurC: Do you have the Emacs variable `cider-history-file` set?
10:53clgvsince you can step and search through it
10:53xificurCllasram: if you have to set it manually then no
10:53CookedGryphonmy emacs repl resets every time, is there a way to stop it doing that?
10:53llasramxificurC, CookedGryphon: `customize` that variable. Then your history will be saved theer
10:54llasramAnd persist across emacs sessions
10:54xificurCllasram: will it save everything?
10:54CookedGryphon!!!
10:54llasramYes
10:54xificurCeven if I type (+ 2 3)?
10:54llasramYes
10:54CookedGryphonthat'll save me some time...
10:54CookedGryphondoes it only do it globally though? Not per project?
10:54llasramIt just saves the input
10:54CookedGryphonstill better than nothing
10:55xificurCI'm playing around with seesaw and wanted to see if I could keep the stuff that worked
10:55llasramCookedGryphon: By default it's global, but I believe you could use e.g. dir locals to make it per-project
10:55xificurCso I am asking for stuff, redefining defs and defns etc
10:55llasramxificurC: Now you want magic :-)
10:55llasramClojure doesn't save source attached to things it compiles
10:55xificurCI thought I could fetch the last used code :)
10:55llasramSo there isn't a way to do that without doing something like custom middleware, as suggested earlier
10:56xificurCthats a shame
10:56xificurCthere could be :source meta
10:56llasramxificurC: It's been discussed
10:57clgvxificurC: there is a serializable-fn macro
10:57clgvxificurC: I forgot the name of the lib but google should find it
10:58xificurCclgv: I wanted to save the session I'm running right now and am shutting down the pc in ~10-20 minutes, I don't think I'll be able to solve it till then :)
10:58llasramclgv, xificurC: https://github.com/technomancy/serializable-fn
11:01xificurCthis works for fn only?
11:02xificurCvery nice though
11:02clgvhm well, defn is missing. it's not difficult to add it though.
11:02llasramThe source code is tiny -- reading it should answer all of your questions :-)
11:04clgvwhen you have a serializable defn, you could replace regular defn via leiningen project.clj to have all function with attached source ;)
11:20xificurCseesaw seems pretty nice
11:21corecodehi
11:21corecodeis there a way to convert bigint to byte[]?
11:21corecode(byte-array 10N) returns an array with 10 elements :)
11:22corecodei mean something like BigInteger. .toByteArray
11:22clgvxificurC: it is. helped me to build a code comparison tool pretty fast :)
11:22clgv,(.toByteArray 10N)
11:22clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: toByteArray for class clojure.lang.BigInt>
11:23clgv,(.. 10N toBigInteger toByteArray)
11:23clojurebot#<byte[] [B@19512c2>
11:23clgvcorecode: there you go ^^
11:32jcromartiemapcat is lazy… this is huge
11:32jcromartiewhy did I think that was impossible?
11:33clgvconcat is lazy ;)
11:42gfredericksjcromartie: it's mostly lazy
11:43gfredericks$google CLJ-1218
11:43lazybot[clojure/src/clj/clojure/core.clj at master · clojure/clojure · GitHub] https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj
11:43gfredericksbaah
11:43matt444Pretty sure I found a bug in clj->js
11:43matt444http://cljsfiddle.net/fiddle/matthewp.myfiddle
11:43gfrederickshttp://dev.clojure.org/jira/browse/CLJ-1218
11:44clgvsee CLJ-1218
11:44clgv$see CLJ-1218
11:44clgvthere was a shortcut for this^^
11:52jcromartieso I'm torn on a design decision
11:52AeroNotixSo it looks like this cassandra client (datastax) doesn't do connection pooling, can anyone recommend a generic connection pool? Java or otherwise.
11:52jcromartieI am using protocols and records to define events
11:52jcromartiebut I want all events to have a :time attached to them
11:53jcromartierecords obviously have no inheritance for things like this
11:53clgvjust assoc time anyway?
11:54clgvdefrecord has an almost regular map implementation
11:54jcromartieit seems kind of dirty because it's interfering with the record's own field
11:54jcromartieI could use multimethods for handling and maps for events
11:54jcromartieI don't have any real clear reason why I'd use protocols here anyway, I guess :|
11:55clgvyou can use regular maps with type metadata
11:55jcromartieand then technomancy would be happy
11:55clgv,(type (with-meta {:a 1 :time 42} {:type :awesome-event}))
11:55clojurebot:awesome-event
11:56jcromartieif it were maps it would just be {:time … :name :project-created :data {:attributes etc…}}
11:56WWWestDi
11:56WWWest*Hi
11:56sverihi, i am trying to combine a luminus starter project with enlive, i am able to return a template, but this seems to be parsed by some middleware from luminus, does someone have an example project where he uses enlive and luminus together so i might have a look?
11:56jcromartieand then (defn make-event [name data] {:time … :data data :name name}) etc.
11:56clgvjcromartie: `type` as dispatch function for your different event types ^^
11:56WWWestif I want to read a value from a channel it two different go blocks, what's the pretty way to do that?
11:56jcromartietype or :name
11:56jcromartieyeah
11:57WWWest*in two different
11:57jcromartieclgv: I don't think metadata is the answer there, because the name of the event is pretty integral to the whole thing, I want to see it
11:57jcromartieand make it obvious
11:57jcromartieI know it's there
11:57jcromartiebut I don't like metadata
11:57clgvjcromartie: ok...
11:57jcromartieplus I have to store them
11:57clgvmetadata is easily stored ;)
11:58clgvI use maps and type metadata in one of my important dataset formats
11:59mikeroddoes the latest stable counter clockwise version only work with Java 7? Getting this hinted from http://doc.ccw-ide.org/documentation.html#install-as-plugin . Seeing "Java Virtual Machine (JVM) 7 installed and setup in the Operating System’s PATH" under pre-reqs.
12:00clgvmikerod: humm good question. maybe if uses some java.nio2 features...
12:00mikerodclgv: hmm perhaps
12:00clgvmikerod: do you really want to continue to use unsupported java 6?
12:00mikerodI have some people using counter clockwise that I wouldnt' expect to have Java 7 as of yet
12:01mikerodClojure only requires 1.5+ :)
12:01clgvisnt clojure 1.6 switching to java 7?
12:01mikerodclgv: I haven't seen this stated somewhere. You could be right.
12:02clgvah no 1.6
12:02clgvaka 6
12:02mikerodyeah
12:02koreth__I thought there was an issue with Android not moving to Java 7 yet.
12:02clgv"Clojure now builds with Java SE 1.6 and emits bytecode requiring Java SE 1.6 instead of Java SE 1.5. [CLJ-1268]"
12:02mikerodthoguht I read a debate on that somewhere
12:02koreth__So moving Clojure to 7 would break Android development.
12:02mikerodpoor Android
12:03koreth__(But that's just what I've read; I'm just an interested bystander.)
12:03aaelonyis there a concept in clj-time for computing business days between dates?
12:05mikerodWhen Clojure chooses to embrace invokedynamic, then we'll see Java 7 minimum :)
12:06jcromartiethen again, multimethods avoid the AOT hell of protocols and records
12:06clgvmikerod: maybe 1.7? ;)
12:06jcromartiedammit
12:07mikerodjcromartie: AOT hell with protocols and records? hmm
12:08hiredmanmikerod: once 1.6 is released the minimum jvm version will be 1.6 as well
12:13mikerodhiredman: yeah, I think that is pretty common that people have moved on to 1.6
12:13mikerodI think 1.7 is a little less common still
12:13mikerod1.7 jvm
12:13jcromartiemikerod: interactive development with AOT and protocols = pain
12:14jcromartiemikerod: not to mention without AOT, recompiling a namespace that defines a protocol = pain
12:14jcromartiebecause every instance of a record that implemented that protocol is now broken and needs to be recreated
12:15jcromartiemikerod: I even had a case where (not= some-record (read-string (pr-str some-record))) due to AOT
12:15mikerodjcromartie: that is true. I've seen the not= sort of scenario several times
12:18koreth__Wait, how can that be true unless some-record is implementing non-value-based equality semantics?
12:18mikerodkoreth__: I believe the Class is checked as well there
12:19koreth__Ah, ok, TIL
12:20mikerodkoreth__: With record (defrecord R [x]) ; (not= (->R 1) {:x 1})
12:20mikerodso the type is part of the "value" for these
12:21koreth__I guess I can see the reasoning, but intuitively it feels like it sort of breaks the "records should just be used as a performance optimization for maps" idea. But that idea is probably too simplistic to begin with.
12:24mikerodkoreth__: Yeah, that is an interesting point. Testing the full equality of two maps probably isn't often what you want to do anyways I'd suppose though.
12:24mikerod(not= (into {} (->R 1)) {:x 1}) ; problem solved :P
12:25WWWestsorry if impolite, retrying: if I want to read a value from a channel it two different go blocks, what's the pretty way to do that?
12:25ToBeReplacedWWWest: do you mean, you have a channel with a value x on it, and you want two different go blocks to both get x?
12:26WWWestToBeReplaced: yes
12:26justin_smithWWWest: maybe what you want is broadcast
12:26justin_smithone input, N outputs, each sees all inputs
12:27WWWestyes, looks good, thanks
12:27justin_smith"Usage: (broadcast & ports) Returns a broadcasting write port which, when written to, writes the value to each of ports."
12:28justin_smithI like how core.async is basically a recording studio, it means I can leverage my existing audio engineering skills
12:29ToBeReplacedWWWest: if you don't want the consumers to go out of sync (like, won't allow one consumer to eat more values than the other), then mult/tap will do it properly
12:29justin_smithToBeReplaced: cool, I was not familiar with that one
12:30ToBeReplacedjustin_smith: nothing wrong with broadcast afaict -- i've just been staying out of lab
12:30justin_smithlab?
12:31ToBeReplacedbroadcast is a lab feature, i thought?
12:32CaptainLexDoes anybody here know much about korma?
12:32justin_smithToBeReplaced: I am sorry, I don't know what "lab" is
12:33justin_smithoh, now I see, yeah
12:33justin_smithsorry, my bad
12:35gfredericksshould I be disturbed that clj-http README documents the :socket-timeout option but that keyword doesn't appear in its /src directory?
12:36Glenjaworkit uses destructring a log
12:36Glenjaworka lot
12:37gfredericksyeah I forgot about that possibility
12:37gfredericksthe world is as it should be
12:37Glenjaworki only know because i dug through for a similar reason
12:38dakronegfredericks: https://github.com/dakrone/clj-http/blob/master/src/clj_http/core.clj#L206
12:39gfredericksdakrone: yep; thanks
12:40clgvgfredericks: socket timeouts are for quitters. :P
12:41Glenjaworkwe had an issue this week where the client and server both thought they had an active TCP connection, but some hardware in between had killed it
12:41Glenjaworknot fun
12:42noonianthats called a man in the middle attack :P
12:45justin_smithnoonian: the passive-agressive version
12:45noonianlol
13:03dnolenanyone tried to enable more of paredit in Light Table?
13:05jcromartiekoreth__: ,(do (defrecord R [a b]) (let [r (->R :x :y)] (= r (read-string (pr-str r)))))
13:06jcromartieor rather
13:06jcromartie,(do (defrecord R [a b]) (let [r (->R :x :y)] (= r (read-string (pr-str r)))))
13:06clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
13:06jcromartieoh right
13:07jcromartiekoreth__: it's even to the point where the record's and the record->string->record's class appear to be the same
13:08nooniani just started using paredit so idk what LT is missing
13:08nooniani think this is the paredit pugin for LT though: https://github.com/LightTable/Paredit
13:09CookedGryphondnolen: I had a go at composing the existing primitives into something more like emacs' paredit, but it lacks select forward s-exp and wrap/unwrap type operations
13:10CookedGryphondoesn't look like it would be too much work, but I didn't have the time to play any more than that
13:11dnolenCookedGryphon: ok just making sure I wasn't missing something
13:11dnolennoonian: that's actually helpful, I think add parens + the shrink left/right might keep me from losing my mind
13:11gfredericksjust wrote a haxy protocol to get the count of the messages in an async buffer; am I missing some existing functionality?
13:13clgvgfredericks: someone on the ML claimed you could just use count on the buffer
13:13gfredericksclgv: it's a (chan 40) actually
13:13CookedGryphondnolen: have you seen this on the use of that plugin too? https://groups.google.com/forum/#!topic/light-table-discussion/BIyWHnRcoWc
13:13clgvthe pattern was too build the buffer manually and then use it to construct a channel
13:14gfredericksclgv: that does appear to work; thanks
13:25Pupnikwhat does putting in the :seq tag here https://github.com/clojure/core.match/wiki/Overview#seq-matching actually do? is it just a performance optimisation or is there some syntax change I missed?
13:26technomancyPupnik: it used to be that you couldn't use lists in patterns to match against lists
13:27technomancyI think that was recognized as a design error and fixed, but it could be some of the docs have leftover mentions of the workarounds or something?
13:29dnolenCookedGryphon: nice, so do I need to install the paredit plugin first or is that builtin?
13:30Pupnikhmm seems to have no problem at all working with vectors, but lists might be a bit funny, ill need to experiment more
13:40aconbereanyone here have any experience using amazonica?
13:43abakeris there a lein plugin or available API for creating release zips that are the jar + other goodies in your folder structure (like conf files and the like)?
13:44arrdemis there a particular favorite among the Clojure logging libraries? I'm looking for something with namespace level debugging control and minimal overhead beyond that.
13:44ToBeReplacedabaker: not the answer to your question, but could the conf files and related be "resources" instead that are packed up with the jar?
13:44ToBeReplacedarrdem: i like clojure.tools.logging
13:44llasramarrdem: I use tools.logging w/ slf4j + log4j
13:45abakerToBeReplaced: no, they're too big and conceptually not typical resources you'd pack into the jar
13:45technomancyabaker: there is lein-tar for that
13:45llasramarrdem: You can configure it with a short Java properties file
13:45abakertechnomancy: cool, that's what I was looking for
13:46ne-ondnolen: paredit is built in, but none of the commands are bound to keys. control-space and type 'paredit' to see commands, or 'keymap' to see keymapping stuff
13:46dnolenne-on: thx
13:53shiranaihitowhat kind of problems can conflicting dependencies be expected to cause if one of them is ignored (to get past the build error)? .. in this case, i've included Datomic, which depends on AWS SDK, which depends on Codec 1.3 .. but other stuff depends on Codec 1.6 .. is there a sensible, non-dirty solution to this, or should i just wait for whatever trouble is coming my way? :P
14:02stuartsierrashiranaihito: As long as the more-recent version is 100% API-compatible with the older version, you can safely use the more-recent version.
14:03shiranaihito.. and only as pertains to what's actually being used by the dependencies?
14:03justin_smithshiranaihito: I usually use an :exclusions key, and go with whatever combination of :exclusions on various deps reliably gets me an app that works
14:03shiranaihito:P
14:03stuartsierrashiranaihito: yes, if you can determine what's used
14:04shiranaihitoand what happens when there's a "compatibility conflict" with the calls being used?
14:04stuartsierrashiranaihito: stuff breaks ;)
14:04shiranaihitoof course, but how mysteriously? :P
14:05hyPiRionvery, usually :p
14:05stuartsierraIt really depends on the library and the nature of the conflict.
14:05shiranaihito.. examples? :P
14:05SlackwiseWhere's the best place to ask newbie questions? I've got a snippet of code that's clearly not working, and it'd help to have someone explain what I'm doing wrong.
14:05stuartsierraA common symptom is a ClassNotFoundException or a method-not-found.
14:05nDuffSlackwise: Here isn't awful.
14:05Slackwisehttps://gist.github.com/Slackwise/c8f2af25bcc2598096e4
14:05rasmustoSlackwise: here, drop a link to a gist/refheap paste
14:06shiranaihitostuartsierra: hmm.. well, a method-not-found would lead you in the right direction, at least
14:06SlackwiseI'm trying to re-implement the comp function, but I'm getting an a crazy arity error.
14:06Slackwise^a crazy
14:06shiranaihitohow often do you guys run into trouble with dependencies?
14:06stuartsierrashiranaihito: Running `lein deps :tree` will print out warnings for possible dependency conflicts.
14:07hyPiRionSlackwise: (apply (first fs) results) should be ((first fs) results)
14:07llasramshiranaihito: Not very often in my experience
14:07nDuffSlackwise: right -- it's passing each character through as an argument.
14:07shiranaihitostuartsierra: well, i'm already getting an error - that's why i'm asking about this stuff :)
14:07abakerllasram: clearly you need more commons-logging in your life
14:07shiranaihito"Possibly confusing dependencies found"
14:08hyPiRionSlackwise: also, this happens in opposite order of comp, so if you want the exact same functionality, you need to reverse the list first
14:08shiranaihitobut alright.. the most efficient way to sweep this madness under the rug is some kind of "general exclusions" key somewhere?
14:08mikerodso stuartsierra has officially embranced leiningen over maven for building Clojure projects?
14:09nDuffSlackwise: ...apply can/will do that.
14:09pjstadigwell there was the hand off of power ceremony
14:09hyPiRionmikerod: hah. I just thinks he knows all the ways debug unexpected lein results.
14:09mikerodhttp://stuartsierra.com/2013/11/04/command-line-intransigence
14:10nDuffSlackwise: if you take out the apply, it works.
14:10mikerodhyPiRion: maybe true, I was just putting the blog post together with this hah.
14:10hyPiRion:p
14:10nDuffSlackwise: ...so, that line should be just ((first fs) results)
14:10stuartsierrashiranaihito: Yes, you can use `:exclusions […]` at the top level of project.clj
14:11shiranaihitostuartsierra: alright, thanks! .. i guess i'll.. be alright.. :p
14:11SlackwisenDuff, hyPiRion: I guess my problem is assuming args would be a seq?
14:11SlackwiseI was using apply to "explode" a list.
14:11nDuffSlackwise: pardon? args *is* a seq.
14:11mikerodI have been on the fence on the topic at times. Maven is probably smoother in my current work environment, but leiningen is a possibility. Looking for that final inspiration to push more for lein here.
14:11stuartsierramikerod: There are still things missing from Leiningen that Maven does (e.g. multi-module builds with automatic dependency ordering) but I default to Leiningen for most Clojure work.
14:11nDuffSlackwise: you might consider playing around with Light Table if you want to see what values are used in practice.
14:11hyPiRionSlackwise: ooh, sorry. You're right. Well, just for the first comp.
14:12hyPiRionthen, when you've done (apply (first fs) result) once, the results will not be a list.
14:13SlackwisenDuff: Will Light Table do any form of debugging, or just evaluate expressions? (I've seen a bit of the screencast, so I know it will do inline eval.)
14:13mikerodstuartsierra: Yes, I have had a few times now where I'd prefer to be using Leiningen for our Clojure projects due to its greater (perhaps just simpler) build flexibility.
14:14rasmustois there a good way to shell out in a lighttable plugin? I'm looking at the python plugin example and its doing a lot of (unnecessary?) stuff. I want to run git
14:14SlackwisehyPiRion: Ahh, good point. It was a seq coming in, but not out, and apply expects a seq, doesn't it...
14:14hyPiRionSlackwise: yes, exactly
14:14SlackwiseSo... use "into"?
14:15SlackwiseHmm.
14:15djjolicoeurSlackwise: You can set up kebindings to do things like macroexpand, benchmarking, or tracing in light table
14:16nDuffSlackwise: if there's stepwise debugging as such, I'm not aware of it. If that's what you want, you end up with something like Ritz, and that's... rather heavyweight.
14:16sobeloh hai, nDuff :)
14:16nDuffsobel: heh, small world.
14:18Slackwisedjjolicoeur, nDuff: I meant to give Light Table a try anyway, so I'll definitely check it out. (Downloading.)
14:22jcromartiesigh… at some point you just have to set aside the pure functions and make API calls to six different systems :P
14:22jcromartiethere's always going to be a point of no return
14:44fredyri'm having trouble with lookups on om's cursors
14:44fredyrthis is a manual cursor creation of the same state i have in my component
14:44fredyrhttps://gist.github.com/fredyr/8424220
14:44fredyrwhich gives an error i'm not really able to follow
14:48fredyrit does work if i do (:author (om/value cursor)), but the cursor is implementing the lookup interface straight up, isn't that the idea?
14:51noonianfredyr: hmm, are you sure you need to build a cursor by hand?
14:56fredyrno, im not doing that in my original code, but i tried to narrow the behaviour down
14:57fredyrthe manual cursor is a recreation of the same state i had in my component, which gave the same error
15:01justin_smithtechnomancy: I need to add a jar to the path that will be on a user's machine (comes with java) but is no longer included in the default classpath. Resolving it with an environment expansion under :source-paths works (and :java-source-paths would too) but I would like a key that more clearly species "this is a jar that is part of java but not in the default classpath" or something close to it
15:01llasramjustin_smith: :resource-paths ?
15:01justin_smithhmm, yeah, that kind of makes sense
15:02fredyrnoonian: updated the gist to contain the original code
15:07aaelony12:02 *** tomobrien QUIT Ping timeout: 248 seconds
15:08noonianfredyr: try passing nil as the first arg to dom/div before your (dom/h2 nil ...)
15:11fredyrnoonian: right, that was me messing up the gist, had a #js object there in the original. doesn't make any difference unfortunately
15:11justin_smithllasram: good enough, running with that one
15:11justin_smith(inc llasram)
15:11lazybot⇒ 14
15:15noonianfredyr: hmm, weird. and you're calling build on book? or om/root?
15:16fredyrnoonian: yes, root on the initial state and build-all for the list of books
15:17fredyrnoonian: as you see, the print-out of the state coming into the component is okay
15:17fredyrnoonian: and it works if i call om/value
15:20noonianfredyr: i'm not sure whats' causing the error
15:21gfredericksis async/thread supposed to be a version of async/go without the crazy state machine?
15:21nooniani'd update to om 0.1.6 and try to figure out whats going on from the source
15:21gfredericksif not, what distinguishes it from go?
15:21nooniani think the error is from line 97 of the current source in core.cljs: (if (satisfies? IShouldUpdate c)
15:22sverihi, when i use enlive with ring, is there a way to enable hot reloading of html templates?
15:23davis there a document/blogpost somewhere that explains the performance/implementation of hash-maps ?
15:24jcromartiesveri: yes, there is https://github.com/cgrand/enlive#auto-reloading-112
15:24sverijcromartie: hm, i have seen that
15:24sveribut where do i have to put that?
15:24sveriin the handler?
15:26jcromartiesveri: I think you call it directly in the ns with templates
15:26sverijcromartie: you mean where i define the templates?
15:27sveriin the clojure file?
15:27nooniandav: i think rich hickey has a few videos talking about them. they are a persistent version of an array mapped hash trie described by some dude name Bagwell but i can't find the paper with a quick google
15:32fredyrnoonian: i'm on 0.1.6 btw, thanks for the help
15:33noonianfredyr: np, i might try to reproduce your error when i have time
15:33fredyrnoonian: cool, let me know if you find anything
15:33noonianwill do
15:34davnoonian: thanks
15:34nooniannp
15:34davnoonian: http://en.wikipedia.org/wiki/Hash_tree_(persistent_data_structure) <= there are references there
15:35noonianthanks
15:36edbondusing (go ... (om/read ... (<! ....))) tells me <! used not in go block. Why is that?
15:45bitemyapphttp://news.sciencemag.org/people-events/2013/06/u.s.-supreme-court-strikes-down-human-gene-patents
15:46technomancyoops
15:46aaelonyshouldn't this return true?? (re-matches #"\-" "hello-there")
15:46bitemyappaaelony: are you asking us to change Clojure's regex library?
15:47bitemyappaaelony: or Java's for that matter?
15:47aaelonyno I foolishly have forgotten how to match a hyphen in a string...
15:47technomancy,(some #{\?} (name 're-matches))
15:47edbond,(re-matches #"\-" "hello-there")
15:47clojurebotnil
15:47clojurebotnil
15:47bitemyapp,(re-find #"-" "hello-there")
15:47clojurebot"-"
15:47bitemyapp,(re-find #"BLAH" "hello-there")
15:47clojurebotnil
15:48aaelonythanks, I just need it to report true if there is a hyphen
15:48bitemyappaaelony: you got two unhelpful answers and one helpful one. That's a better than average hit-rate.
15:48bitemyappaaelony: "-" is true.
15:48aaelonythat works :)
15:48bitemyapp,(not "-")
15:48clojurebotfalse
15:48technomancywait true or truthy?
15:48bitemyapptruthy
15:48bitemyappI was trying to avoid using that word.
15:49bitemyappsaying "true" makes the ridiculous nature of it more obvious.
15:49technomancytruthiness is perfectly cromulent
15:49aaelonyhelpful answers to me, heheh
15:50bitemyappaaelony: typing re-<TAB> would've given you some functions to fiddle with
15:50bitemyappaaelony: could've easily figured it out yourself in the repl :P
15:50aaelonylong story... but true
16:05gfredericks~truthiness
16:06clojurebotPardon?
16:06gfredericksclojurebot: truthiness is perfectly cromulent
16:06clojurebotRoger.
16:14gfredericksoh man async/alt! is a nasty macro
16:23amalloyisn't every async macro a nasty one?
16:26gfredericksprollably
16:32milanjwhat's usual way to get minimal useful stacktrace ?
16:32technomancyuse a language that isn't clojure
16:32TimMcmilanj: (pst)
16:32trptcolinBOOM technomancy'd
16:33TimMcmilanj: clojure.repl/pst prints the most recent exception in a cleaner way.
16:33milanjTimMc, thanks, I'll look at it
16:34milanjtechnomancy, I wish
16:39eric_normandI would like to do something when a lazy seq has been exhausted
16:39eric_normandis there a common way to do that?
16:40gfredericks(concat some-seq (lazy-seq (side-effects) ())) ;; would work I think
16:40gfredericksI've never seen anybody do that
16:40eric_normandwould like to close an input stream and delete a file
16:40bitemyapperic_normand: wouldn't rest be nil?
16:40eric_normandgfredericks: ah! thanks!
16:41gfrederickseric_normand: probably there are better ways to handle resources like that
16:41bitemyappman.
16:41eric_normandbitemyapp: wrong scope
16:41gfrederickspjstadig has this fascinating lib that I don't know anything about
16:41bitemyappPeople complain about laziness in Haskell and then do stuff like that?
16:41Bronsaeric_normand: there is also realized?
16:41eric_normandagain, wrong scope
16:41bitemyapperic_normand: your face is a wrong scope :|
16:41eric_normandthe file is too big to fit in memory
16:41bitemyapperic_normand: jkjk :)
16:42bitemyapperic_normand: liked the H-M post.
16:42eric_normandbitemyapp: thanks!
16:42bitemyapperic_normand: didn't like the war it sparked off in HN. I wasn't responsible for that bonfire, for once.
16:43eric_normandbitemyapp: i try not to read comments there
16:43eric_normandbitemyapp: anything worthwhile?
16:46bitemyapperic_normand: Wiser man than I. Good comments include: https://news.ycombinator.com/item?id=7053188 https://news.ycombinator.com/item?id=7052206 https://news.ycombinator.com/item?id=7052344 https://news.ycombinator.com/item?id=7051944
16:46bitemyapperic_normand: ignore the rest as much as possible, including responses.
16:46eric_normandbitemyapp: thanks
16:47eric_normandbitemyapp: i think I'll avoid the lazy seq solution
16:47eric_normandbitemyapp: cleaner just to return a cleanup closure
16:47bitemyapperic_normand: thank you :)
16:49abaranoskyis there a consensus on which JSON library has the best performance?
16:49bitemyappabaranosky: Jackson?
16:49bitemyappabaranosky: you won't like the output.
16:50bitemyappabaranosky: use criterium and benchmark it against inputs and outputs you care about.
16:51bitemyappabaranosky: throw jackson, clj-json, cheshire, and http://code.google.com/p/json-smart/wiki/Benchmark into the running.
16:53technomancywhat
16:53technomancyclj-json is not a thing
16:53bitemyapph/o
16:53technomancyit's just what cheshire used to be called
16:54bitemyappoh
16:54bitemyappwell nevermind then.
16:54technomancyand jackson is just the lib underneath cheshire
16:54bitemyappdidn't know if there'd be a performance difference between it and cheshire.
16:54bitemyapptechnomancy: yeah but is there overhead from mapification?
16:55technomancybitemyapp: sure, but that's overhead nearly every clojure application is going to introduce anyway
16:55dakronebitemyapp: there's always overhead, you could just loop over Jackson's JsonToken/START_OBJECT, but that would be a pain ;)
16:55technomancywhether in the lib or outside it
16:55bitemyapptechnomancy: given what I know about abaranosky, I was taking non-mapification to be a serious option.
16:55bitemyappReally.
16:56dakronecheshire includes benchmarks, you could always run those
16:56bitemyappdakrone: what agains what?
16:56sverihm, i added (net.cgrand.reload/auto-reload *ns*) to my template definition .clj file, but the hot reloading is still not working with http-kit, any ideas what is wrong there?
16:56bitemyappdakrone: it's safe to assume he's been using Cheshire all along and has run into a rough patch.
16:56bitemyapp(probably)
16:57dakronebitemyapp: data.json, clj-json, and a lot of different parts in cheshire (keyword-izing, custom keyword coerce fns, etc)
16:57`cbpif i had a dime for every setup.py i've had to edit
16:57bitemyapp`cbp: if I had a dime for every setup.py I've had to edit, I'd have half a dollar. I'm pretty good at avoiding Python busywork.
16:57bitemyapp`cbp: mostly by writing Makefiles instead.
16:58arrdembitemyapp: we should architect a Makefile replacement that's easier to write and harder to fuck up
16:58bitemyapparrdem: doable with a Haskell EDSL.
16:58`cbpI mean setup.py that pip gives me
16:58bitemyapparrdem: model it as a dependency tree.
16:58arrdembitemyapp: exactly.
16:59bitemyapp`cbp: pip is for communists.
16:59arrdemnow we just have 30 years of legacy makefiles to migrate..
16:59bitemyapparrdem: "Now there are 102 Makefile clones"
16:59rasmustojust replace tab characters with "[" and you're good
16:59arrdemrasmusto: oh gods why
17:00bitemyapparrdem: GHC is enabling typeholes by default. This is amazing.
17:00rasmusto(for the makefile replacement)
17:00bitemyapparrdem: http://www.haskell.org/haskellwiki/GHC/TypeHoles
17:00arrdembitemyapp: the last make system I worked with used $(make $TARGET $OPTS) to allow for reconfiguring of "shared" components, thus making a parallel build impossible..
17:00bitemyapparrdem: noice.
17:01`cbpc based too hard too many unices too many differences
17:01`cbpjvm or bust imo
17:01arrdemRUST OR BUST
17:02bitemyapparrdem: I'm considering using Rust in an AI competition tomorrow.
17:02arrdembitemyapp: if you do lemme know how it goes.. I have yet to truly try out rust.
17:02arrdemhello world doesn't count at all.
17:04bitemyapparrdem: most of what I know about it concerns the type system, ownership model, and concurrency model. For fairly obvious reasons (those are the interesting bits)
17:04bitemyapparrdem: the secret here is keeping the rust devs honest WRT FP, which failed in the development of other languages. Rust is hybrid procedural / FP at the moment, no OO.
17:04bitemyapparrdem: but make no mistake, it's no Haskell. It's pretty typical to mutate structs (which are memory-identical to C structs) and kick 'em around.
17:05bitemyapparrdem: but the compiler keeps you honest, so that's good.
17:05bitemyapparrdem: true const correctness!
17:05bitemyapp<3
17:05arrdembitemyapp: yeak. that the compiler is keeping you honest about pointers and memory locations I think is pretty cool.
17:06arrdembitemyapp: I haven't read in to the channels system yet
17:06jjidoif you're into C style syntax there is http://ceylon-lang.org too
17:06bitemyapparrdem: well it's not pointers and memory locations so much as tree-based propagation of "properties"
17:07arrdemjjido: some things were not meant to be...
17:07bitemyapparrdem: if container is mut, the sub-elements it "owns" are mut. Ditto immutability. Ditto ownership strategy.
17:07bitemyapparrdem: well sorry, not quite ditto ownership strategy.
17:08seangroveIs there an index-of in clojurescript?
17:08bitemyapparrdem: it's more subtle than that, you can have value and reference based sub elements mixed into a container.
17:08seangroveOr rather, what's a good way to find the index of an element in a collection that matches a predicate?
17:09bitemyappseangrove: filter + map-indexed
17:10dnolenseangrove: I'm thinking about adding indexOf lastIndexOf to all sequential CLJS collections, I think there's a ticket for it even
17:10bitemyapp,(ffirst (filter #(= (second %) "blah") (map-indexed vector ["woot" "blah" "blargh"])))
17:10clojurebot1
17:10bitemyappseangrove: ^^
17:11seangrovebitemyapp: Ah, makes sense, thanks
17:11seangrovednolen: Would certainly be nice, but I assume that would be looking for a specific item?
17:11seangrovednolen: Or would you use the #{} syntax for it?
17:11dnolenseangrove: no predicate
17:11dnolenseangrove: same as Clojure
17:11amalloybitemyapp: (first (keep-indexed ...))?
17:12bitemyappamalloy: not my fault the language doesn't have loop fusion :(
17:12bitemyappamalloy: good call.
17:14piranhadnolen: I'm not sure if that's a bug or not, but if I do two om.core/update! calls in a row, I get "Cannot manipulate cursor outside of render phase, only om.core/transact!, om.core/update!, and om.core/read operations allowed"
17:14bitemyapparrdem: Reid read: http://www.haskell.org/haskellwiki/GHC/TypeHoles
17:14piranhaafk right now, but if you want, I can provide more details
17:14arrdembitemyapp: never do tha again.
17:14arrdembitemyapp: already queued
17:15dnolenpiranha: would need to see a minimal example, thanks
17:15bitemyapparrdem: sweet
17:16Cr8bitemyapp is a typehole
17:16arrdem(inc Cr8)
17:16lazybot⇒ 3
17:17`cbpLOL
17:17bitemyappbitemyapp |is| a typehole
17:17bitemyappclojurebot: bitemyapp |is| a typehole
17:17clojurebotIk begrijp
17:17arrdembitemyapp: you're already bitemyapp |is|
17:17arrdemit entertains me to mock other peoples gods
17:18bitemyapp~bitemyapp
17:18clojurebotbitemyapp is a typehole
17:18bitemyapparrdem: evidently not!
17:18arrdembitemyapp: hum... clojurebot is supposed to gripe when you change your own ~ but w/e
17:19Cr8huh
17:19Cr8that's actually pretty neat
17:19arrdemone of these days I'm gonna figure out how to get clojurebot to bitch on my behalf whenever pastebin.com is mentioned in channel...
17:19bitemyapp~bitemyapp
17:19clojurebotbitemyapp is it amuses me to mock other peoples' gods
17:19Cr8then again I've been in C++ land all day so anything having to do with making error messages *reasonable* probably seems pretty neat to me right now
17:19arrdem~botsnack
17:20clojurebotthanks; that was delicious. (nom nom nom)
17:20arrdembitemyapp: ooh! I know what I can use grimoire for...
17:20arrdembitemyapp: clojurewiki lookup!
17:20bitemyapparrdem: I already have a grimoire repo, YOU'RE TOO LATE
17:21arrdemQ_Q
17:21bitemyapparrdem: jk jk. I do have a repo but it's a starting place for notes I wouldn't put in ClojureWiki.
17:21arrdemthat's something else I want to add to the wiki... a naming convention article
17:22arrdemwith extra bitching about $LEIN_IRONIC_JURE
17:22technomancyhow about clo*
17:22piranhadnolen: not really minimal (I can provide smaller one tomorrow, time to sleep here already :), but here my actual code - http://paste.in.ua/9265/#11 - line 11 is failing
17:23arrdemtechnomancy: I only know three clo* projects.. clojurebot, clojail and cloutjure.
17:23dnolenpiranha: that might be becauase that's in a go loop
17:23piranhadnolen: can I do anything because of that?
17:23`cbpwhat about cloact
17:26dnolenpiranha: actually that should just work
17:26piranha:(
17:26dnolenpiranha: oh I see
17:26dnolenpiranha: the second one is problematic
17:26dnolenpiranha: you are reading from a cursor that's a no no
17:26bitemyappsadfaces on IRC sometimes actually make me sad.
17:26bitemyapppiranha's was one of them
17:26dnolenpiranha: outside of the render phase
17:27dnolen:orig-locations
17:27piranhadnolen: ah! I see
17:27arrdemI wonder if there's an emacs minor-mode to do smilies->glyphs
17:27piranhahm, well I can read from global state atom here of course...
17:27dnolenpiranha: no need
17:27dnolenpiranha: just do it "inside"
17:28dnolenpiranha: (update! data (fn [data] ...))
17:28bitemyapparrdem: you can definitely do it, given what Haskellers do with lambdas.
17:29piranhadnolen: hah, sure! thanks :)
17:29arrdembitemyapp: looks like it's an emacs/erc builtin already.
17:29bitemyapplolmacs.
17:29arrdemHAHA piranha's last got glyph'd :D
17:29dnolenpiranha: yeah it's too easy to see inconsistent stuff, if Om doesn't enforce because of 16ms delay between renders
17:29arrdembitemyapp: br0 I'm already a nyanmacs user... what did you expect of me?
17:30dnolenpiranha: so it actually caught a potential bug for you :)
17:30piranhayeah I understand that :)
17:30piranhathat's quite cool, the only problem that it's not documented/I couldn't understand from an error message what to do
17:30piranhabut I can live with that :P
17:31dnolenpiranha: yes we're getting close to the point where I'll starting documenting, I'm starting to see that what we have is pretty good with the exception of the outstanding issues
17:31piranhabitemyapp: and I'm sorry for a sadface, was confused :-)
17:32piranhadnolen: yeah it's quite usable right now, I don't think I miss anything... but you'll hear from me if I will :-)
17:32dnolenpiranha: excellent :)
17:32bitemyapparrdem: I use to use nyanmacs, until it started causing memory leaks.
17:34wwellsorry for the stupid question, but i'm just starting clojure and i was wondering about something regarding variables wrapped inside of lambdas: when i write something like (defn f [] y), i would think that it wouldn't give me unbound variable error, but rather just wait until f is applied (which is what happens with common lisp and scheme)
17:34wwelli guess this wouldn't be useful too often, but it seemed curious to me
17:35shep-werkwwell: i think that is dynamic binding
17:35wwellohh
17:35wwelli'm not used to that
17:35technomancyit's not dynamic binding
17:35shep-werkand as i understand it, clojure has lexical binding
17:35wwelloh
17:35bitemyappit has dynamic scope too.
17:35bitemyappbut that's not really the point in this case.
17:35technomancywwell: clojure functions don't carry around their full environment
17:35shep-werktrue, but you have to opt into that, correct?
17:35technomancyjust the specific locals they depend upon
17:36technomancyso you can know during compile time whether a function refers to something non-existent
17:36wwellokay
17:36technomancy(also because there's no way to pass an environment to eval)
17:36noonianbut this is a compile time error right? isn't it about the compiler trying to make guarantees for the jvm?
17:36technomancynoonian: nothing to do with the jvm
17:37technomancythere's just literally no way that function could ever work
17:38noonianif y was defined later it would work in other languages though, so the original question seems valid to me: why throw the error at compile time?
17:38noonianit sounds like you are saying it was a design choice
17:38technomancyas a top-level var or as a local?
17:38nooniana top level var
17:39technomancyas a local there's no way it could work; as a top-level var it was an explicit design choice to simplify the compiler and allow it to catch many kinds of errors
17:39technomancys/local/closure/
17:39nooniancool
17:40technomancycomes up every so often on the mailing list
17:40technomancywell, it used to
17:40wwellalright, thanks for the informative (and very quick/kind) answers. i gotta go now~
17:41scgilardiit's why declare is useful/used
17:43bitemyapptechnomancy: I just thought of a workaround.
17:43bitemyappAgda is cooler anyway >:)
17:53arrdembitemyapp: smiley mode totally mangled that last one... I got a > and then the glyph. evidently I need to do some hacking on this...
17:54Cr8ew smilies
18:03mikerodis `(vec <some-coll>)` better than `(apply vector <some-coll>)`
18:03amalloyi mean, maybe it depends on your definition of "better" but it's better in any way i can think of
18:04mikerodvague I know, I mean if you had to choose
18:04technomancymikerod: I'd guess it's less wasteful since apply has to create a seq for the args to vector
18:04amalloyi would never write (apply vector x)
18:04technomancybut no idea if that actually matters
18:04amalloytechnomancy: huh? it creates exactly as many seqs as vec does
18:04mikerodok, so a subtle difference; `vec` definitely seems more straight-forward, so then I'd pick it as "better"
18:05technomancyhm; true since you still have to step over it
18:05technomancyuse whichever uses transients, if any
18:08justin_smiththat would be (into [] coll)
18:08bitemyappokay people
18:08bitemyappwe're going to stop guessing
18:08technomancybut I don't actually care
18:08technomancyyou can't make me care
18:08bitemyappI want empiricism damn you
18:14bitemyappExecution time mean : 11.088373 ms for (apply vector (range 100000)) --- Execution time mean : 10.990399 ms for vec.
18:14bitemyappstd-dev of both was in the hundreds of microseconds.
18:14bitemyappmikerod: now you know.
18:15technomancyhttp://sararyan.com/wp-content/uploads/covers/3183556620_14b37b97d0_m-150x150.jpg
18:15bitemyapp<3
18:16technomancywas wearing that shirt yesterday
18:16technomancyalso, now I really really want to find myself in a situation where I can drop the ape dung link and have it be apropos
18:16technomancythe one from yesterday
18:17bitemyappYeah, I remember. That won't be easy.
18:17technomancywe'll see
18:17amalloybitemyapp: that didn't measure anything interesting
18:17bitemyappamalloy: my repl is at your disposal.
18:17technomancybitemyapp: I could be invited to contribute to a Go codebase or something
18:17amalloyyou just measured how long it takes to fully evaluate (range 100000)
18:18bitemyappah, well, good point. h/o
18:18bitemyapptechnomancy: that would do it.
18:18amalloyyou want instead to (def l (doall (range 100000))), and then time (vec l) (apply vector l)
18:18bitemyappamalloy: yeah, about to do that.
18:18bitemyapptechnomancy: I've been wanting to repurpose some go-based dev-ops stuff in Haskell.
18:20kristofbitemyapp: I thought about something
18:20bitemyapp4.374956 ms (vec l), 4.399963 ms (apply vector l)
18:20bitemyappwelp.
18:20kristofbitemyapp: I decided that type systems are not just for correctness or mini-proofing but most importantly are a rich way to describe the world
18:21bitemyappkristof: a rich way to describe code and what it should look like, but from a higher order.
18:21bitemyappkristof: (ala Theorems For Free!)
18:21kristofbitemyapp: I'm thinking more in terms of data-structures
18:22bitemyappkristof: that too. We could discuss the categorical nature of product and sum types.
18:22bitemyappkristof: they're categorical duals of each other :)
18:22kristofI've only ever understood product types, not sum types
18:22bitemyappkristof: are you familiar with Lenses?
18:22kristofnein
18:22bitemyappokay, we'll put that off until you're comfy with product and sum types.
18:24bitemyappkristof: I'm about to go into a meeting, but I want to leave you with something before I go: http://ncatlab.org/nlab/show/product http://ncatlab.org/nlab/show/sum+type when you draw a category graph
18:24bitemyappkristof: categorical duals are, put in a facile way, inversions of each other by flipping the arrows around.
18:24bitemyappkristof: so a product type has a C with arrows from C to A and B, where a sum type has an A and a B with arrows pointing from each to C
18:25bitemyappkristof: http://en.wikipedia.org/wiki/Coproduct
18:25bitemyappkristof: sum types are basically just algebraic data types. "this or this or that"
18:26bitemyappkristof: product types contain multiple things that can be obtained via a function. Sum types can be obtained *FROM* multiple things via a function.
18:26justin_smithhttps://www.refheap.com/23800 <- into is more than twice as fast as the others, which are about equivalent (reposting in proper channel)
18:26kristofbitemyapp: I didn't realize that tagged unions and sum types were the same thing, sorry
18:26bitemyappkristof: yep!
18:26kristofneat
18:27bitemyappkristof: oh very.
18:27bitemyappkristof: when kmett was working on lenses (like jquery but for typed data), he realized there was a categorical dual, and thus prisms were born! And they're very useful!
18:27kristofbitemyapp: I'm confused. What would the C represent in the sum type?
18:27bitemyappkristof: the best of both worlds when using those libraries, as far as typed/untyped goes :D
18:27kristofThe "entire" tagged union?
18:27bitemyappkristof: yes.
18:27kristofOh, everything makes sense now :P
18:27technomancyjustin_smith: wow; geez
18:28technomancypatch to get vec to use into, I guess?
18:28bitemyappkristof: the member constructors of the tagged union are the functions/arrows/morphisms pointing to C.
18:28kristofgotcha
18:28kristofI know basic category theory from my abstract algebra class
18:28bitemyappkristof: if you're in the bay area, you should come to the type theory meetups!
18:29kristofI'm a couple of hours away
18:29bitemyappanyway, I have to go, but I'll be around. leave me messages on my query if you like.
18:29kristofAlright, nice talking to you :)
18:29mikerodbitemyapp: thank you for that empirical input
18:29bitemyappmikerod: justin's was better.
18:29mikerodbitemyapp: was gone a minute, didn't see there was more examples out there
18:30mikerodah, good analysis
18:31bitemyappmikerod: and amalloy
18:31bitemyappalthough that change didn't change the outcome.
18:32mikerodwell, then thank you justin_smith for the example :) and amalloy and technomancy for that matter
18:49justin_smithmikerod: np
18:49justin_smithtechnomancy: yeah, really anything in core building an associative collection should be using transients at this point - or dispatching to into which uses them
18:50justin_smithunless transients are still somehow unproven
18:53technomancynah, with into using them I can't see that being the case
18:53technomancythere were a bunch of bugs early on, but that was like 1.2 days
18:53mikerodtransients all the way down
18:55adhollanderls
18:55lazybotboot media proc src srv sys
19:03arrdembitemyapp: well, I decided to get lazy on multi-PC sync. Lets see what Dropbox does with all of ~/doc...
19:51bitemyapparrdem: just spent 30 minutes explaining Haskell to a coworker I kidnapped.
19:52bitemyapparrdem: I don't use dropbox.
19:53bitemyapparrdem: I'm always surprised when people use dropbox, then I remember normal people have things like "paperwork" and "documents"
19:56Raynesgfredericks: <3
19:57bitemyappRaynes: zomg hare
19:57Cr8bitemyapp's corner of the office is the Haskell Dungeon
19:59bitemyappCr8: it's an open space office.
19:59bitemyappCr8: I'm not in the corner, I'm in a main thoroughfare. I'm the troll taking his toll.
19:59Cr8I'm imagining a sort of blanket fort
20:00Cr8a Haskell Troll Bridge works too
20:01bitemyappCr8: IT guy has tried really hard to get me to make it into a blanket fort.
20:01bitemyappCr8: he wanted me to use camo netting
20:01Cr8should add you to the office-themed text adventure I made a long time ago
20:01bitemyappCr8: throwing against Sphinx-like category theory questions?
20:01bitemyappCr8: WHAT IS THE CATEGORICAL DUAL OF PRODUCT?
20:01bitemyappthrowing saves*
20:02Cr8> The third floor is an open-plan office. This is unfortunate, as the Haskell Troll is able to spot you as you leave the staircase.
20:02Raynesbitemyapp: I use dropbox mostly for pictures.
20:02Raynesbitemyapp: My screenshots, for example, automatically go there.
20:02bitemyappRaynes: I'm buddhist about my data.
20:02bitemyappmuch easier.
20:03Cr8my photos go to dropbox
20:03Cr8because the i like the convenience of them just being on my computer by the time i'm arsed to care
20:04justin_smithI like to imagine there is a cobitemyapp on #haskell who brings up clojure at every juncture
20:04Cr8other than that it's all tax forms
20:04technomancyhehe
20:05bitemyappjustin_smith: I have some converts there, but they're already on the side of justice and morality.
20:06justin_smithso you are suggesting you are your own categorical dual?
20:06bitemyappNo.
20:06bitemyappjustin_smith: I don't advocate Clojure there, just not writing terrible code.
20:06bitemyappsame as here.
20:06bitemyappI liked this quote from that channel, "<paper_ziggurat> clojure has a job market?"
20:08bitemyappjustin_smith: I'm searching the rather thorough Haskell IRC logs, the only nice things said about Clojure so far have been, "well. It's not Scala or Java."
20:08justin_smithheh
20:08technomancy"We have decided... that you are not orcs."
20:09bitemyappjustin_smith: I've got a couple of candidates for the title, but they're pretty weak sauce really :)
20:09bitemyapptechnomancy: haha, love that moment.
20:10bitemyappjustin_smith: no wait, found him. monochrom.
20:10bitemyappjustin_smith: that's my dual.
20:10bitemyappjustin_smith: oddly, he's in there but not here. ?_?
20:11locksno point in preaching to the choir, right
20:12bitemyapplocks: well. I'm in #haskell to learn.
20:12bitemyapplocks: he must know everything about Clojure already.
20:12Cr8<monochrom> I don't know clojure. I cannot compare.
20:13bitemyappCr8: nuts. older quote had him saying Clojure is better than Haskell.
20:13bitemyappjustin_smith: n/m the
20:13bitemyappthen*
20:13Cr8that was 2013-12-26
20:13bitemyappCr8: well.
20:13bitemyappI dunno.
20:15locksmaybe they were just being humble
20:15locksthe whole the more you know, the more you know you don’t know
20:15JaniczekHi, is there some kind of "map" or "doseq" for core.logic goals? I'm puzzled on how to do this: https://gist.github.com/Janiczek/8429048
20:17rseniorbitemyapp: have you given much though to database migrations on a single datomic instance for brambling?
20:17JaniczekI see how that probably could be solved by some recursive goal, slicing the head of the map, converting it into the permuteo goal and then calling itself on the rest ... but maybe there's a better way?
20:18rseniorbitemyapp: or maybe that's what you mean with differential support?
20:18bitemyapprsenior: single datomic instance?
20:18bitemyapprsenior: that is almost certainly not what I mean by differential migrations.
20:19bitemyapprsenior: differential migrations could also be called incremental or "catch-up" migrations.
20:19bitemyapprsenior: they catch-up the 'difference' between the origin and the target incrementally.
20:19bitemyapprsenior: origin and target can be on the same Datomic instance.
20:20rseniorbitemyapp: ah, maybe that's what I was missing
20:20bitemyapprsenior: I cannot change the way Datomic works and I do not feel comfortable reaching into the internals when the jars are obfuscated.
20:21bitemyapprsenior: as much as I'd like things to be some "other way", I really think the worrying over migrations is unmerited. Very few people have enough data that having a temporary copy of the database on disk is going to hurt anything.
20:21rseniorbitemyapp: so last week's version of my schema had a :foo/bar attribute, this week I want to add :foo/baz
20:21bitemyapprsenior: if you're adding things you don't need brambling.
20:22rseniorbitemyapp: ok changing :-), I imagine I will do a fair bit of that, sounds like I just use origin and target as the same with brambling?
20:22bitemyapprsenior: perhaps you mean something like renaming the attribute from bar to baz?
20:22rseniorbitemyapp: exactly
20:22bitemyapprsenior: you write a migration that renames datoms with the attribute ident to the new one.
20:22bitemyapprsenior: it copies all the data over, filtered through your migration, bada bing.
20:23bitemyapprsenior: archive a backup of the origin, then delete from your database if you like.
20:23bitemyappmaybe brambling finally gets a user?
20:24rseniorbitemyapp: heh, last datomic app I worked on, we rolled our own (closed source, no longer working for them), now working on another app and it would be nice to build on something
20:24bitemyapprsenior: plz do.
20:24bitemyapprsenior: and if you reverse engineer the godforsaken jars so we can add in-place
20:24bitemyappmigrations, let me know.
20:24bitemyapp;)
20:25rseniorbitemyapp: so the model is, create a new db, migrate datoms, drop old db, move back?
20:25bitemyapprsenior: yeah and differential migrations are a way of narrowing the maintenance to something possibly programmatic.
20:26bitemyappthat's a discussion I'm a whiskey bottle away from having though.
20:26bitemyapprsenior: look at it this way, the namespace is "brambling.moves.ya.bits.*"...pretty indicative.
20:27rseniorseems like it would be a big deal for bigger dbs, mine won't be
20:27bitemyapprsenior: Right. I think it could be made manageable for larger dbs.
20:27bitemyappcatch-up migrations can make the 'shutdown and flip over' window very small with no lost data or race conditions.
20:28bitemyappbut that option only really exists because the data is an immutable log
20:28bitemyappso, Hail Hickey for that one.
20:29rseniorbitemyapp: what would be the difficulty for user defined differential?
20:29bitemyapprsenior: it wouldn't have to be user defined, purely automagic.
20:29bitemyapprsenior: uhhh...partial migrations that understand when they're just catching up the history of the tx log with the same migration that got the ball rolling to begin with.
20:30bitemyapprsenior: figured out the set point in the tx log that the last migration stopped at and picked things up from there.
20:30bitemyappideal being to continually/incrementally reduce origin/target delta until a "lockdown" of the origin would take a second or two.
20:30bitemyappor at least a minute or something. you'd propagate the new dburi to the peers.
20:30bitemyappcache warming could be an issue.
20:31bitemyappyadda yadda.
20:31rseniorbitemyapp: but that still requires manual intervention of creating a new db, switching over etc
20:31rseniorI'm thinking about how I use relational db migrations
20:31rseniorI have a list of "revisions" of the db
20:31bitemyappwell that part does
20:31rseniorstore that version info in the db
20:31bitemyappimplementing the differential migrations doesn't
20:32bitemyappand it could still be automated modulo peer configuration.
20:32bitemyapprsenior: people do that sort of thing "in the small" with Datomic in production, I think it's complete and utter gobshite.
20:32rsenioron startup, hey, I'm on v2, I need to be on v5, so I execute the v3, then v4, then v5 migrations
20:32bitemyapprsenior: I do not want my time-dimension queries to get fucked by fields getting shuffled around
20:32bitemyappmeaning my queries cannot cross migration barriers.
20:32bitemyappnuts to that. I'd rather use brambling.
20:33bitemyappit's a simple fold. Really.
20:33rseniorbitemyapp: not following, how is creating a new db change that?
20:33rseniorthat is drops the old data?
20:34bitemyappI'm talking about when people want to change a data type
20:34bitemyappinstead of actually migrating the data
20:34rseniorok, walk me through that
20:34bitemyappthey add a "new" attribute
20:34bitemyapp:myCar = "blah" gets changed to an enum or something
20:34rseniorgot it
20:34bitemyappthe problem is when you add that new attribute to the schema and flip the application code over
20:34bitemyappyou have a breakpoint in your history that your queries cannot traverse
20:34bitemyappso you have to maintain two versions of your queries.
20:35bitemyappBleh.
20:35rseniorright, unless you write a migration
20:35bitemyappYou write a migration and handling mapping your stringly values to an enum, and everything's kosher. All the history is intact and consistent.
20:35bitemyapphandle*
20:35rseniorok, so a list of schema migrations, with a possible fn that does data migrations?
20:36rseniorthen I don't need another db?
20:36bitemyapprsenior: have you looked at the code in Brambling's readme?
20:36rseniorI did
20:36bitemyappokay. That
20:36bitemyappThat's all I would ever advise doing.
20:36bitemyapp(origin -> target) - translate the data.
20:36bitemyappwhether you agree or not is your maintenance burden.
20:37bitemyappBrambling is basically all I have to say for the time being about Datomic migrations. I literally haven't heard a single other thing (from Cognitect or otherwise) that I'd advise anybody to do.
20:38rseniorok, I understand, your opinion is it's best to always migrate to a new db, that's fair
20:38rseniorI don't have an opinion to the contrary, just thinking about what would be involved in a new "deploy" of my app
20:39bitemyapprsenior: easiest thing is shut the app down, migrate the database, archive, delete, repoint, start.
20:39bitemyappor just leave the old one in place if the storage is trivial.
20:39bitemyappthen you can run differential functional tests to reproduce possible problems arising from migrations.
20:39bitemyappwhich is another reason I'm not that keen on mutative migrations
20:40bitemyappif you don't want to ever shut your app down, then start queuing your transactions and queries or never change your data.
20:41rseniorbitemyapp: I'll give it a try, I'm still in the early stages, so it'll be more test-like, but I'll try out one of those cycles
20:41bitemyappI would kill for some youtube vitess/vitocc-esque middleware for Datomic.
20:42bitemyapprsenior: let me know if it eats your data and eggs your mother's house.
20:42thedarksideBeginner. How do you guys go about remembering the 591 functions in clojure.core?
20:42bitemyappthedarkside: writing code
20:42bitemyappthedarkside: using clojuredocs.org
20:43thedarksideThat's worse than PHP. Well, almost.
20:43bitemyappthedarkside: too bad there's no hoogle for Clojure :(
20:43bitemyapp"worse than PHP" hahahahahaha
20:43thedarksideI mean memorising them, not looking them up.
20:44thedarksideYou can't use a function you don't know exists or what it does.
20:44bitemyappthedarkside: http://pic.dhe.ibm.com/infocenter/wsmashin/v1r1m1/index.jsp?topic=/zero.infocenter.singlebook.doc/using/zero.php/CoreFunctions.html
20:44bitemyapparrdem: what's the find command?
20:45thedarksidebitemyapp: I was only joking.
20:45bitemyapp$findfn 1 2
20:45thedarksideNo, I'm not trolling. What memorisation techniques do you use?
20:45lazybot[clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']
20:45bitemyappthedarkside: ding ding ^^
20:46bitemyapp$findfn [[1] [2]] [1 2]
20:46lazybot[clojure.core/flatten]
20:46bitemyappthedarkside: again ^^
20:46bitemyappthedarkside: I don't memorize things. If I'm using Hoogle I search by type. If I'm using Clojure I use findfn or I simply remember because I've been using Clojure a lot for some time now.
20:46bitemyappI do have memorization techniques, I don't apply them to any of this.
20:47hyPiRionthedarkside: Using a decent repl with autocompletion in conjunction with the clojure cheatsheet is nice
20:47thedarksideTo get the full benefit of Clojure surely they have to be internalised at some point?
20:48hyPiRionIt's generally about applying them which makes me remember them. That, or the fact that some of them makes no sense
20:48bitemyappthedarkside: sorta not really? hyPiRion's suggestion is solid.
20:48bitemyappthedarkside: the benefits of FP don't have a lot to do with core libraries, although some are better designed than others. Haskell > Clojure > Scala
21:08hiredmanmap/mapcat/reduce/assoc/dissoc/update-in/inc do you really use anything else?
21:09xuserpartial, comp, repeteadly
21:13hyPiRionfor, into
21:19gfredericksRaynes: <3?
21:19gfredericksI don't mind a <3 or two but it seemed a bit unprovoked
21:20seangrove,(doc seq?)
21:20clojurebot"([x]); Return true if x implements ISeq"
21:21gfredericks,(seq? nil)
21:21clojurebotfalse
21:22arrdembitemyapp: oh. lol. I thought you were talking about POSIX find
21:23arrdem $findfn is part of the clojurebot black magic...
21:24arrdemalso $findfn doesn't come with the function warnings... such as how (flatten) is rarely actually what you want...
21:35logic_progclojure is awesome
21:35logic_proganyone disagree?
21:35hyPiRionthe best channel to ask that question, I guess.
21:35logic_progcompletely unbiasaed
21:35arrdemhyPiRion: least biased to be sure...
21:36logic_proghighest IQ people too
21:36logic_progthe only possible thing that could convince me that #clojure has gotten smarter
21:36logic_progwould be if it granted me ops
21:37arrdemlogic_prog: .... you realize that in the five year history of this chan there have only ever been two ops, right?
21:37arrdemthree if you count chanserv
21:37logic_progarrdem: only two?
21:37hyPiRionarrdem: four then? rhickey, chouser and technomancy?
21:37arrdemhyPiRion: oh I didn't know chouser had op
21:37logic_progrhickey (clojure_ and technomancy (lein) I know about
21:37logic_progwhat has chouser done?
21:38arrdemyeah this isn't #atx2600 where everyone gets op every few months since our op management system is that anyone misbehaving gets smacked at the next meetup.
21:46bitemyapparrdem: findfn is lazybot.
21:46bitemyapplogic_prog: I can find a smarter channel
21:47bitemyappno the answer isn't #haskell
21:47bitemyappthat said, there are still a lot of smart and very awesome people.
21:47bitemyappit's my favorite channel still.
21:48bitemyappalthough Cale is turning the tide for #haskell on that front.
21:48bitemyapparrdem: still on electronic leave?
21:49arrdembitemyapp: up to date on my homework, I can do a game of two but I'm calling it by 11 Central
21:50bitemyapparrdem: deal.
21:53bitemyapparrdem: I'm in your mumble, not the minetexas one.
22:04Bronsa,
22:04Bronsa(loop [x (Integer. 1)] (if (number? x) (recur "foo") (.hashCode x))
22:04clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
22:04Bronsa,(loop [x (Integer. 1)] (if (number? x) (recur "foo") (.hashCode x))
22:04clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
22:05Bronsa,(loop [x (Integer. 1)] (if (number? x) (recur "foo") (.hashCode x)))
22:05clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer>
22:05Bronsa,(loop [x 1] (if (number? x) (recur "foo") (.hashCode x)))
22:05clojurebot101574
22:05Bronsa:(
22:07logic_progdoes cljs support find-ns, create-ns, ns-resolve, var-get, and intern ? if so, what namesapce is it in?
22:10maravillaslogic_prog: searching the repo suggests none of those are implemented yet
22:12seancorfieldmaravillas: presumably because cljs does not use the Var indirection that clj uses...
22:13logic_progthus, what are the cljs equivalent for namespaces?
22:15seancorfieldnamespaces compile down into js objects i think
22:19quizdrif I enter (find-doc #"\?$") at the REPL, what exactly is the argument there, starting with the #? Because I can just use a string for (find-doc "reduce"), for example, with no # character
22:20seancorfield#"..." is a regex in clojure
22:20seancorfield"..." is a string
22:20seancorfield,(source find-doc)
22:20clojurebotSource not found\n
22:20seancorfieldbah!
22:21quizdrah, i get it
22:34seancorfield,(doc find-doc)
22:34clojurebot"([re-string-or-pattern]); Prints documentation for any var whose documentation or name contains a match for re-string-or-pattern"
22:36bendb,(keys (ns-publics *ns*))
22:36clojurebotnil
22:37seancorfieldaccording to the source for find-doc, it always treats the argument as a regex pattern, by calling re-pattern on it
22:37seancorfield,(doc re-pattern)
22:37clojurebot"([s]); Returns an instance of java.util.regex.Pattern, for use, e.g. in re-matcher."
23:08ddellacostais there a way to specify a set of defaults for all builds in lein-cljsbuild?
23:10alewtechnomancy: are the instructions for new relic clojure support up to date? I'm not getting any results on the new relic dashboard but it is registering the app was deployed
23:11quizdrsince all vars are immutable, it is possible to return a closure over a local var that increments it each time the closure fn is called? similar to this CL: (defparameter *lfn*
23:11quizdr (let ((count 0))
23:11quizdr #'(lambda ()
23:11quizdr (incf count))))
23:12quizdrevery time (funcall *lfn*) is called a new incremented number is returned
23:12quizdrwhen I try this in Clojure, I get the error that the local var is immutable
23:14bja(let [counter (atom 0)] #(swap! counter inc))
23:14quizdrah, so i'd use an atom as a local
23:15bjayou could also define the var as dynamic I guess
23:15bjabut I don't think anyone would recommend that you do that
23:15S11001001hope not
23:17quizdrsince clojure.string/split returns a non-lazy vector, if I was calling this in a very large amount of text and wanted a lazy result, would I simply wrap it in lazy-seq?
23:19bjaquizdr, probably something like (re-seq #"\w+" ...)
23:21quizdrlooks like re-seq uses lazy-seq in its implementatino
23:24dnolena guide to the ClojureScript analyzer/compiler http://swannodette.github.io/2014/01/14/clojurescript-analysis--compilation/
23:26ddellacostagetting java.lang.OutOfMemoryError: Java heap space with source maps, but compiles fine without source maps. Not sure how to resolve this--anyone have any suggestions?
23:27ddellacostadnolen: very cool, look forward to digging into it!
23:27dnolenddellacosta: increase memory to the JVM with :jvm-opts
23:27dnolen^{:replace true} is important
23:28ddellacostadnolen: okay, I've already bumped it to 1GB and it still didn't work, will bump it up some more. Will look into ^{:replace true}, thanks for the tips!
23:28dnolenddellacosta: :replace is important otherwise won't work
23:28ddellacostadnolen: ah, okay
23:43rubber-duckanyone knows why I'm getting "clojure.lang.ExceptionInfo: No implementation of method: :emit-instruction of protocol: #'cljs.core.async.impl.ioc-macros/IEmittableInstruction found for class: cljs.core.async.impl.ioc_macros.Jmp" in core.async go block ?
23:43rubber-duckhere is a gist :https://gist.github.com/anonymous/8430856
23:43rubber-duckit's clojurescript btw
23:45dnolenrubber-duck: might be a legit core.async bug I would make a minimal case
23:46rubber-duckdnolen, does the code at least look legit ?
23:46rubber-duckI'm still new to clojure I could be missing something obvious :)
23:50eggheadis it related to <!remote on line 17?
23:51rubber-duck<!remote is just a macro that expands to (result (<! (rpc ...)))