#clojure logs

2012-09-10

00:02michaelr`good morning
00:30muhooi'm totally getting off on how fun it is to do data transformations in a huge (->> ) chain in clojure
00:33michaelr`muhoo: yeah me too :)
00:35michaelr`muhoo: do you ever have cases where you need to insert a func that needs the argument to be the first into a chain started as ->> or vice versa?
00:36muhooyes! and the hack is to do (->> blah #(foo % bar)), or use swiss-arrows
00:36clojurebot'Sea, mhuise.
00:36michaelr`muhoo: swiss-arrows?
00:36muhoohttps://github.com/rplevy/swiss-arrows
00:37michaelr`btw, i usually try to avoid using #(), somehow it makes the code less readable for me
00:37muhooyeah, it's not ideal, but i prefer #(..) to (fn [n] ...). less verbose.
00:39Sgeomuhoo, I think your hack should be (#(foo % bar))
00:39muhooSgeo: indeed, thanks.
00:42michaelr`now it looks really ugly
00:42michaelr`while swiss arrows looks really cool... :)
00:47muhooyeah, (-<> (foo <> bar) (baz quux blah <>)) ... a lot cleaner
00:47callenokay, I want to use noir, but the plugin task was removed.
00:48callenwhy is nothing in sync with the new lein, even the most popular web framework?
00:48callenhow do I add noir as a dependency to my project.clj myself without relying on the plugin?
00:48muhoocallen: [noir "1.3.0-beta8"]
00:49muhooor whatever beta is current, i think 9
00:49michaelr`muhoo: once you start speaking swiss it all becomes clear :) haha
00:49callenmuhoo: I just got done getting my face kicked in because I was using a beta version of lein, why would I use the current beta of noir? what changed?
00:51muhoocallen: https://github.com/noir-clojure/noir/commits/master well, that's what changed
00:51callencheshire appears to be one reason.
00:51callenutf-8 fixes too.
00:51callengood enough reasons for me.
01:05friocallen: what do you mean re the noir task? can't you just lein new noir mysite (in lein2)?
01:55muhoohappy happy joy joy (reduce #(update-in % [:city (:city %2)] conj (dissoc %2 :city)) {})
03:42augustlI have a list of maps, how do I get the index/position of the first map in the list that matches a given predicate?
03:44augustlthis seems to work (.indexOf (map :the-key my-list) "foo")
03:46michaelr`,(doc positions)
03:46clojurebotPardon?
03:46michaelr`hmm
03:46michaelr`'(doc positions)
03:47michaelr`err
03:47michaelr`augustl: ^^^ :)
03:47augustlthanks :)
03:48tomojwhere is that?
03:48Raynes&(doc positions)
03:48lazybotjava.lang.RuntimeException: Unable to resolve var: positions in this context
03:48Raynestomoj: In his head, I think.
03:49tomojcontrib.seq, but
03:49tomoj(->> coll (keep-indexed #(when (#{1} (:foo %2)) %))) ? :/
03:49tomojer, ignore the arrow, it had more parts originally :)
03:51RaynesI don't think that does what he wants.
03:51RaynesHe wants the index, not the map.
03:51RaynesOh
03:51RaynesBlah
03:51RaynesNever mind me.
03:52michaelr`sorry for senting you to contrib ;)
03:52michaelr`sending
04:05mpanyay "any language of your choice"
04:12hyPiRionmpan: "Any language of your choice" is in two of my four courses (three, but I don't consider Clj a language for parallel programming)
04:12hyPiRionI love it - finally no need to set my hair on fire.
04:31mpanwell, the other course is adamant about wanting java, standard library, no jars or other external dependencies
04:31mpanmostly for the sake of the well-being of the graders, I imagine
04:40hyPiRionWell, yeah.
04:40hyPiRionShould be easy to validate the program.
04:43clgvmpan: what topic is the course about?
04:45mpanthat particular one is one I don't think I'll be taking any more, just because I have more stuff than I need and the combined homework is going to get messy mid-semester
04:45mpanso 1/2 my remaining classes that expect programming have no language preferences
04:47clgvmpan: I have had a course where one language was fixed, but I did it in another language anyway, since there was no checked homework. only solutions in the given language were presented.
04:49mpananyway, going to start another class assignment in clojure, I guess
04:49mpanlast time, some weird thing with seqs and laziness came up, but overall it felt nice
04:49piskettiIs there a way to explicitly fail a test in clojure.test?
04:50clgvmpan: sometimes it's better to avoid lazy if you have no benefit of it ^^
04:50piskettiprint-tap-fail just prints stuff but doesn't fail the test
04:50clgvpisketti: returning false? or do you want to fail from within another function?
04:50piskettiI'm looking for something like fail in JUnitr
04:51piskettiyes
04:51piskettiI have a test util function
04:51piskettior several actually
04:52clgvpisketti: would throwing any specific exception work for you?
04:52piskettiWith certain condition I want the whole test to fail
04:52pisketticlgv: I guess that would do it but I'm surprised if that's the way to go
04:52piskettiI would assume there is a way to explictily fail a test
04:53clgvpisketti: I dont know if there is something built-in like that. but It would have to use an exception as well
04:54piskettiokay, thanks
04:56clgvpisketti: I checked the source. there seems to be no such function to fail on purpose
04:58clgvpisketti: but you yould write your function in a short-circuiting way: with `or` or `and`
06:12naegWhy can't I :use clojure.core.logic? There is no installation needed, is it? (Clojure 1.4)
06:12naeghttp://bpaste.net/show/s8UWDqWrCyjvPY71e9GW/
06:15Cheiron_Hi, how to handle MessagePack in Clojure? any library?
06:17clgvnaeg: afaik it is still an external lib that you have to add to your project.clj
06:20naegclgv: thanks, it's working now
06:32kralnamaste
06:32algernonnaeg: you need a dependency in your project.clj
06:34naegalgernon: thanks, yeah, figured that out already ;)
07:15naegcan I do a simple equality test inside a run* in core.logic using just plain =?
07:22llasramnaeg: I've only played around with core.logic a little, but my understanding is that you need to `project` to do any non-relational operations
07:24naegllasram: I'm trying to check columns of a connect four game: http://bpaste.net/show/bFmSVQnwiRpuOP1Fgf5B/
07:24naegbut with l/== it results into () and with = it doesn't result in anything
07:27naega simple test suggests that l/== is the right one though: http://bpaste.net/show/iuXYzyfiXXHkApolsuL6/
07:28clgvnaeg: correct me if I am wrong but l/== should be unification right?
07:28llasramThis really is the blind leading the blind, but I don't think expressions constructed the way you have them work.
07:29llasramRight, what clgv is saying, if I understand properly
07:29naegI think so too, but I can't use =
07:29clgvnaeg: did you read any intro on core.logic?
07:30llasramI think what need to do is map each entry in the board to a fresh logic variable, then perform unification across those
07:30naegclgv: yeah, magical island of kanren
07:30xeqi(inc llasram)
07:30lazybot⇒ 2
07:31naegI'm not getting that one llasram? I'm only checking columns now and since I know the x already, there are only 6 different y's
07:31xeqisee https://gist.github.com/3217582#L23 where vars represents the sudoku board
07:33llasramnaeg: Ok, so not the whole board, but the entries of interest. You need to have a function-local representation where you first unify a set of logic variable w/ the current board state, then unify the potential solution with that logic variable state
07:34llasramBut yeah, like the Sudoku solver xeqi linked to. I'm really just going off of the examples I've seen, and it may be possible to express in a different way
07:35naegllasram: putting together a vector of all the elements in the column and check whether the sublist ["X" "X" "X" "X"] appears in it?
07:36naegthat would be exactly what i'm doing with the rows already
07:37llasramI'm having trouble expressing this apparently. Let me repl up an example
07:38naegllasram: I might have trouble understanding it, an example would be highly appreciated
08:01llasramnaeg: Whew. I have been meaning to get some more core.logic practice :-) https://www.refheap.com/paste/4980
08:02llasramI don't believe this is the best way of expressing it, but does at least appear to work
08:14naegllasram: now I understand what you meant before :P
08:17llasramnaeg: Oh, good, because I realize now it wasn't quite how I described it :-) The cKanren finite domain stuff takes care of the intermediate representation for you. It's quite nice
08:20naegllasram: I'm just wondering whether all those l/+fd could be replaced with a map-indexed
08:21naegbut I guess not
08:25ro_sttechnomancy: ping
09:52cshellIf conj is polymorphic on the type, why isn't it a protocol?
09:54S11001001cshell: conj came first
09:54chousercshell: in ClojureScript it is.
09:54cshellAre they planning on changing it in 1.5?
09:56S11001001cshell: if so, it would be in jira
09:57chouserClojure was built with Java interfaces at the core, Java implementations on top of that, and finally clojure functions and macro on top of that. So in Clojure, conj is an interface method, IPersistentCollection.cons
09:57cshellSo, if we made a new datastructure via deftype, we'd have to mixin something from the IPersistentCollection interface?
09:58chouserIn Clojure, protocols and deftypes were built on top of that whole stack.
09:58chouserIn ClojureScript, Protocols and deftype are at the bottom, and everything is built up from there.
09:58cshellS11001001, chouser: thanks, all this is very helpful!
10:01chousercshell: so yes, in Clojure implement IPersistentCollection. I don't think that'll change in the foreseeable future.
10:01cshellthat makes sense
10:02chouserNow, if cljs gets a JVM bytecode back end, and someone ports the cljs compiler from Java+Clojure to pure cljs...
10:04casionis there a way to change how sets check for equality between elements?
10:05cshellcreate a new function?
10:05S11001001casion: only for your own types
10:08casionhmm. Well I guess I need to rethink this whole thing then
10:09casionI wanted to throw some byte-arrays into a set to get a collection of unique items
10:25S11001001casion: put a type around byte array
10:27S11001001casion: (incidentally, this is also how you'd solve the "add your own implicit whatever" problem in haskell)
10:43naeghow could I write a predicate that declares that the first given coordinate is ascending (both x and y +1) to the second coordinate? (core.logic)
10:43naegI guess I still have a wrong understanding of l/==
10:53mindbender1piggieback lists [org.clojure/clojurescript "0.0-1450"] as a dependency but lein reports it's inability to locate it.
11:06casionS11001001: I was hoping to avoid converting/casting to another type, and then back when I want to use it
11:06casionas I do need to pass that byte-array to a java method in the future
11:09carkthat's not really conversion or casting, only wrapping, a O(1) operation
11:10carkS11001001: konrad hinsen corrected the fetch-val function
11:10carkS11001001: and i've beeen working on implementing lenses
11:11carkS11001001: not a library yet, but i've gone as far as the state-m lenses
11:12casioncark: you mean doing something like (seq (byte-array [stuff])) is O(1) ?
11:13carkyou asked how to change the way sets are checked for equalitye
11:13cark-e
11:14casionI'm confused now :|
11:17clgvcasion: calling `seq` is O(1). it's just wrapping the given argument into a seq-implementation if it can
11:17carkthe thing is that i don't know which interface (or protocol?) you need to implement in order to change equality
11:17S11001001clgv: seq won't work, but a newtype wrapper with cheap unbox will
11:18S11001001cark: unknown falls back on Object equals/hashCode
11:18carkso you would use a deftype
11:18clgvS11001001: what? what should it work for except what its docstring says?
11:19clgvS11001001: I just commented the O(1) question...
11:19S11001001clgv: (identical? some-byte-array (??? (seq some-byte-array))) => true
11:20casionI wanted to do something like ##(into #{} [(byte-array [(byte 1) (byte 2)]) (byte-array [(byte 1) (byte 2)])])
11:20lazybot⇒ #{#<byte[] [B@4cf181> #<byte[] [B@183713c>}
11:20casionexcept the = that set seems to use doesn't work obviously
11:20clgvS11001001: I have no idea what you want to tell me with that.
11:21S11001001clgv: you can't reverse that seq call in constant time
11:21carkwell then seqing the byte arrays should do the trick
11:21casioncark: it does, but it's slow, and then I have to convert back to byte-arrays later
11:21clgvS11001001: no. but he didnt ask for that. just for the seq call
11:22S11001001clgv: casion: as I do need to pass that byte-array to a java method in the future
11:22S11001001casion: using a deftype will give you O(1) wrapping and O(1) unwrapping
11:22carkclgv: then your other option is to wrap the byte arrays in a type, and override the equality thing, i don't know which interface has it. Trouble is that you still will need to loops across your arrays
11:22clgvS11001001: thats probably somewhere before the question ^^
11:23carkcasion: not clgv !
11:23S11001001cark: Object
11:23carkalright
11:23chousernaeg: I don't know if you can "do numbers" in core.logic
11:24S11001001IIRC you can even do it with defrecord
11:24carkchouser: numbers over a domain, the *fd functions i think
11:24casionI guess I could just make a new type and call java.utils.Arrays/equals for =
11:24S11001001casion: don't forget hashCode
11:25carkchouser: dnolen talks about that toward the end of his incomplete talk
11:25casionS11001001: didin't even know about it in the first place
11:26casionI'm as new to java as I am to clojure
11:26casion(or oop or functional programming for that matter)
11:27S11001001casion: http://findbugs.sourceforge.net/bugDescriptions.html#HE_EQUALS_NO_HASHCODE
11:28casionI see, so I need to make sure hashCode returns the same value for this type then, correct?
11:28S11001001s,the same,a consistent,
11:29casionok, thank you
11:29casionand thank you cark
11:29carkonly repeating S11001001's views =P
11:29casionall help is appreciated :)
11:30chousercark: oh interesting. Didn't notice logic.arithmetic
11:32casionchouser: I'm starting to use clojure-jna, do you know if there's a good way to distribute cross-platform apps when using it?
11:33casionI have distributable libraries for the target platforms
11:35chousercasion: no. We built a thing to help with that for LonoCloud, but it requires almost constant tinkering, and every new native dep adds unexpected requirements. This is one area where the JVM ecosystem is a complete mess
11:38casionchouser: ok
11:38casionat least clojure-jna has helped figure out dealing with jna from clojure
11:39chousergood, I'm glad. That's an old lib. I suppose I should release a version to clojars or something.
11:43casionI'm currently using it for generating tests against the de facto C library that I'm more or less replicating in clojure, and I thought maybe I should just wrap that lib instead...
11:43casionbut I think that's obviously a silly idea
11:48arrdemis it legal to write a let form where the definition of some symbol is recursive?
11:48chouserarrdem: nope. But you may be able to use letfn instead
11:49arrdemthanks chouser, I thought not.
11:49samratso, is Clojurescript One the place to get started with Clojurescript? any other recommended resources for cljs?
11:53technomancysamrat: a lot of people seem to have trouble with it since it's a bit outdated
11:53technomancycljsbuild seems to be the way to go
11:54technomancychouser: are you using lein to build jars that contain native components?
11:55chousertechnomancy: yes, I suppose we are.
11:55samrattechnomancy: thanks, I've already installed lein-cljsbuild.
11:55technomancychouser: so are you using the native/ convention that extracts the contents at runtime or do you roll your own thing for getting them on the filesystem?
11:56samratbut I was kinda looking for a tutorial, on cljs basics
12:03chousertechnomancy: I haven't looked at it myself in a while, so I'm having trouble remembering. Looks like we've got a chunk of code commented "derived from leiningen"
12:03chouserbut we are using the native/ convention
12:03arrdemokay that's it. Screw fnparse. What are your favorite non-abandonware clojure parser libs?
12:03technomancychouser: just wondering because that's completely undocumented =\
12:04chouseroh, I think the deal may be that we're deploying uberjars to places where we don't have lein, so we had to do our own unpacking? Would that make sense?
12:05technomancyyeah, makes sense
12:05technomancythat's actually fairly common; I think overtone and lwjgl now do that
12:06chouserso we're relying on the native/ convention for getting dev envs set up right, and letting lein do that for us, but we extract the native libs ourselves when we have to
12:06technomancyyeah
12:06technomancyI should probably formally extract that
12:06chouserBut then each native lib comes with a java lib that may or may not try to do the object loading itself
12:07chouserAnd that loading needs to be done exactly once per JVM, which gets tricky when containers give you different copies of the same namespace in a single JVM, etc etc
12:08technomancyor yeah, I could leave that problem alone and let someone tackle it who has actually used native dependencies and knows what they're talking about =)
12:13mindbender1how can I possibly work with extjs from clojurescript
12:37nz-mindbender1: i think it should be possible, if e
12:37nz-if extjs isn't doing anything too tricky
12:37nz-mindbender1: for example clojurescript works just fine with query
12:38nz-with jquery that is
12:38mindbender1nz-: their codebase really looks clean. where do I throw a thrid party library
12:39mindbender1*third
12:40mindbender1nz-: I suppose the advice here still holds: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
12:45dgrnbrghey, what is the recommended way for making UIs with clojurescript?
12:46dgrnbrgshould I just use goog.ui through the FFI, or are there other libraries I should look into?
12:53nz-mindbender1: I used the same guide. there may be some problems with extern files if you want to use <script src="javascript.file.somewhere.js"> style for referencing external libs
12:54nz-mindbender1: there are some tools that can generate externs file for you, but they many times fail if library is using some weird techniques.
12:54mindbender1nz-: please share
12:54nz-i am using this library: http://leaflet.cloudmade.com/
12:55nz-problems occur if you use google closure compiler with advanced compilation that does name munging
12:56mindbender1nz-: how did you get around all this
12:59nz-i made externs file like this https://github.com/jsyrjala/ruuvi-ui/blob/master/closure-js/externs/leaflet-externs.js, first it is generated by a tool, but then I noticed that many of the methods are missing, so I added them manually
13:00nz-leaflet is using some kind of inheritance thing that the tool didn't understand
13:03SegFaultAX|work2postgresql continues to amaze me every single day.
13:03nz-and this is only problem if you use advanced optimization. if you use simple or no optimization, everything works out of the box
13:05edwAnyone having problems with nrepl spontaneously throwing an exception when typing into the repl?
13:06edw"Unable to resolve symbol if-let"...
13:06mindbender1nz-: thanks a lot for sharing. This would make work a lot easier
13:06edwIn Emacs.
13:07nz-dgrnbrg: i don't know about recommended but I am using enfocus for templating and probably jquery for the rest (via jayq clojure wrapper)
13:08technomancyedw: yeah, I think that's fixed in master
13:09edwFor nrepl?
13:10dgrnbrgnz-: i'll check out jayq
13:13mindbender1edw: I get that error attimes what I do is to quickly put the cursor into the emacs repl buffer and delete the line very quickly
13:14Frozenlockseancorfield: In your clj-time library, is it possible to try multiple built-in-formatters simultaneously? I would like to parse some strings of the form "2012-09-10T00:00:00.000-04:00" and others "2012-09-10" and "2012/09/10".
13:18edwmindbender1, technomancy: Do you know what the problem or issue was? I'm looking through nrepl.el's change history and I don't see anything on point. (Or is the change in nrepl proper?)
13:19mindbender1edw: I'm not really sure but it must be related to not properly handling some input but take technomancy's advice on faith
13:20mindbender1I've upgraded too and I've not seen the error since then
13:21technomancyI haven't been following the development closely so I don't know what was behind the error
13:21edwAre we talking, again, about nrepl or nrepl.el?
13:21mindbender1edw: it's nrepl.el
13:21edwAh. OK. Thank you.
13:22technomancysomething about having to keep an emacs var in sync with the clojure-side namespace
13:23technomancynot a big fan of that approach =\
13:24edwThe problem seems to appear wheneverI use symbols with funky names, specifically "-main", those that's completely anecdotal.
13:24edws/those/though/
13:35dgrnbrgnz-: when you use jayq with clojurescript, do you use jqueryui as well?
13:35pjb32 things in Clojure that I got bit by today because they didn't do what I thought they would
13:35pjb3(= false) # => true
13:35pjb3(:foo :bar) # => nil
13:36pjb3both of those feel like they should result in an error to me
13:36pjb3I mean, I guess I get that = means "are all of these things equal"
13:36nz-dgrnbrg: no, not yet atleast. i am using twitter bootstrap though for css/layout
13:36pjb3pair those together and you get
13:36edwpjb, I strongly disagree with the = thing, but I'm sort of "WTF?!" about the (:a :b) => true thing.
13:36pjb3(if = (:foo :bar) ...
13:36pjb3oops :)
13:37chouserAlso: (when = :foo :bar (prn "the same!"))
13:41Sgeoedw, what (:a :b) => true thing?
13:42noidipjb3, `get` returns `nil` if it can't look up the given key in the given map (or if the "map" is not an associative data structure). keywords are functions that look themselves up in the map provided as an argument.
13:43noidigiven that `:bar` is not an associative data structure, looking up `:foo` in `:bar` returns `nil`
13:43edw,(:a :b)
13:43clojurebotnil
13:43noidihence, (:foo :bar) ;= nil
13:43edwErr, I meant that.
13:43pjb3noidi: it's the (or is the "map" is not an associative data structure) part that I disagree with there
13:44noidipjb3, I agree that it should throw an exception intead
13:44pjb3throwing an exception in that case makes more sense than returning nil
13:44pjb3,(:foo nil)
13:44clojurebotnil
13:44pjb3I guess that makes sense though
13:45noidiand in general I disagree with Clojure's policy of only dealing with happy paths and having undefined behavior (tm) for invalid inputs
13:47noidiI've read somewhere that the current Clojure runtime forgoes error checking in order not to slow down the happy paths
13:47noidis/error checking/input validation/
13:47noidiand, IIRC, at least at some point Rich has had plans for a separate debug runtime that does more validation
13:48konr_trabIs there a "split-when"-like function, that would behave like (split-when #(> % 2) [1 2 3 2 3 2 1]) -> [[1 2] [3 2] [3 2 1]]?
13:50joegallo_,(partition-by #(> % 2) [1 2 3 2 3 2 1])
13:50clojurebot((1 2) (3) (2) (3) (2 1))
13:50joegallo_and then combine the results in twos
13:51joegallo_(is one approach, there's probably a better one, though)
13:54xeqi,(partition-by #(= % 3) [1 2 3 2 3 2 1])
13:54clojurebot((1 2) (3) (2) (3) (2 1))
13:54xeqiah, right
14:05seancorfieldnote to cark S11001001 - I raised ALGOM-4 on clojure-dev and Konrad responded pretty quickly - happy now your issue is addressed? :)
14:07djanatynI don't understand how swap! works with atoms
14:07S11001001seancorfield: not really, since I liked the old behavior, and would rather TMACRO-1 be fixed :/
14:08bjacloudsearch
14:08carkseancorfield: yes, thank you !
14:08hyPiRion,(split-with #(= % 3) [1 2 3 2 3 2 1])
14:08clojurebot[() (1 2 3 2 3 ...)]
14:08hyPiRion,(split-with #(not= % 3) [1 2 3 2 3 2 1])
14:08clojurebot[(1 2) (3 2 3 2 1)]
14:08carkand sorry to S11001001 =)
14:09joegallo_djanatyn: how so?
14:09joegallo_you don't know how the implementation makes it do what it does, or you don't understand why swap! might be a useful thing to do?
14:09joegallo_that is, please elaborate.
14:10joegallo_also, if there was a question you wanted to ask, then just ask it. ;)
14:13djanatynjoegallo_: sorry, had to take a break
14:14djanatynjoegallo_: so when you use the swap! function, it take the atom's value and does (apply f atom-value)
14:15djanatynand then it assigns that to the atom, right?
14:15joegallo_kindof
14:15djanatynwell, say I did (def foo (atom [1 2 3]))
14:15djanatyn(swap! foo +)
14:15joegallo_(apply f atom-value ANY ARGS YOU PROVIDED)
14:15djanatyn(apply + [1 2 3]) is 6
14:15joegallo_think of it this way:
14:16joegallo_(def f (atom []))
14:16xeqi,(let [x (atom [1 2 3])] (swap! x +) @x)
14:16clojurebot#<ClassCastException java.lang.ClassCastException: Cannot cast clojure.lang.PersistentVector to java.lang.Number>
14:16seancorfieldS11001001: sign a CA, submit a patch :) at least if you have a signed CA you can join clojure-dev and at least raise the issue there to get feedback...
14:17xeqi,(let [x (atom [1 2 3])] (swap! x (partial apply +)) @x)
14:17clojurebot6
14:17joegallo_(swap! f conj 1)
14:17joegallo_it will (conj [] 1) -> [1] and makes that the new value of the atom.
14:17cark,(let [x (atom [1 2 3])] (swap! x (partial apply +)) @x)
14:17clojurebot6
14:17djanatynoh, cool
14:18djanatynoooooh! so I can do (swap! some-map-atom-thing assoc :foo nil)
14:19joegallo_bingo
14:19djanatynthat's useful!
14:19joegallo_that's why you want swap!
14:19djanatynthanks for explaining it
14:19joegallo_np
14:25pjb3What's the easiest way to subtract one vec/seq from another?
14:26gfredericks,(map - [1 2 3] [50 0 -6])
14:26clojurebot(-49 2 9)
14:27Frozenlockclojure.set/difference ?
14:27casionsubtract in what way?
14:27gfredericksindeed
14:27Hodappset difference and vector difference are very different things
14:27gfrederickswhat is vector difference? multiset difference?
14:28pjb3I mean get all the elements of a seq/vec that aren't in another
14:28Hodappgfredericks: what you did is vector subtraction
14:28pjb3gfredericks: that looks good
14:28gfredericksHodapp: oh you mean vector like math-vector
14:28pjb3er, not subtract though, I guess include?
14:29Hodapppjb3: you need set difference, which I think is what Frozenlock gave
14:29emezeskepjb3: That sounds like a set union
14:29casionyou want the union of 2 vectors?
14:29Hodappunion is something else
14:29gfredericksyeah but you have to convert them to sets first
14:29pjb3no, the difference
14:29gfredericksto use the set functions
14:29gfredericks,(clojure.set/difference #{7 38 3 5 4 2} #{4 38})
14:29pjb3you don't *have* to convert them to sets
14:29clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.set>
14:30gfredericks&(clojure.set/difference #{7 38 3 5 4 2} #{4 38})
14:30lazybot⇒ #{2 3 5 7}
14:30pjb3but I guess that is the easiest way
14:30gfredericks&(clojure.set/difference [7 38 3 5 4 2] [4 38])
14:30lazybotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.IPersistentSet
14:30gfrederickspjb3: to use clojure.set I meant
14:30emezeske,(keep #{1 2 3} [42 5 1 8 2 89 3])
14:30clojurebot(1 2 3)
14:30casionHodapp: isn't set difference the complement of the union of sets?
14:30emezeske,(keep #{1 2 3} [42 5 1 8 2 89])
14:30clojurebot(1 2)
14:31emezeskepjb3: ^
14:31emezeskeIf you really don't want to convert to a set
14:32aperiodiccasion: that's the symmetric difference
14:34aperiodiccasion: assuming you meant intersection, not union
14:34casionaperiodic: I meant union
14:35casionI'm researching it atm, I was pretty sure how I understood it was correct… but I wouldn't be surprised it it wasn't
14:37XPheriorCan Noir's defpage take a docstring?
14:37XPheriorHaving trouble making it parse.
14:37muhoosomething bizarre has happened to my brain. stuff like (apply map vector (partition 3 (range 10))) is just rolling off my fingers without my thinking about it too much
14:37Hodappcasion: perhaps, but it's certainly not the same as union except maybe when the null set is involved
14:38aperiodiccasion: oh. well, the complement of the union is just everything in the universe that's not in any of your sets. that doesn't have much to do with the difference between your sets.
14:39muhooXPherior: i don't think so
14:40XPheriormuhoo: Boooo :(
14:40muhooXPherior: if you look at the code, it has a defn ~fn-name. there's a map there for metadata (::url, ::action, etc) , but docstring doesn't seem among them.
14:40uvtcmuhoo: `(map vec (partition 3 (range 10)))`
14:40muhoouvtc: even better, thanks :-)
14:40XPheriormuhoo: Hum, okay. Thanks for the info. :)
14:41muhooXPherior: my personal experience is, if you start banging into walls in noir, blow it off and just use straight compojure
14:41casionaperiodic: I think maybe I phrased myself wrong, I thought set difference was the union of A and the complement of B
14:42XPheriormuhoo: Yeeeah, I want to. This was started in Noir by someone else.. Maybe I should just go ahead and do it anyway
14:44muhoouvtc: though, what i was doing, was swapping rows and columns in the array, which (apply map vector) does
14:45aperiodiccasion: are you sure you're not confusing union with intersection? it can be defined as the *intersection* of A and B's complement
14:46casionaperiodic: ah. I was mixing them up
14:53nbeloglazovWhat editor (not IDE, vim or emacs) for windows has clojure syntax higlighting?
14:54nbeloglazovAnd free
14:54casionsublimetext does
14:54casionbut it is not free
14:54emezeskemaybe notepad++?
14:55casionand those are some weird requirements?
14:55casionwhy can't you use anything else?
14:56S11001001nbeloglazov: install cygwin, x, gnome, gedit, maybe gedit has clojure
14:56S11001001nbeloglazov: or maybe relax some of those constraints
14:56FrozenlockNot Vim or Emacs is a tight constraints.
14:56nbeloglazovI want it to be easy. Emacs and vim aren't easy. And IDE has too much stuff in them. I want just leiningen + editor.
14:57casionnetbeans and intellij are pretty easy
14:57casionand so is eclipse
14:57casion(and emacs and vim OM)
14:57casionimo*
14:57nbeloglazovcasion: and what is not easy?
14:57Hodappnbeloglazov: that's all I want too, but lein-tarsier was kind of a rough route.
14:57uvtcmuhoo: Ah! Thanks for pointing that out! Passing `map` multiple coll's has it pass one from each into the func you gave it.
14:57casionyou can just close all the side-bars in eclipse and treat it like a 'text editor' if you want
14:58Hodappthe Clojure support in IntelliJ IDEA still seems a bit buggy when Leiningen is added
14:58casionnbeloglazov: in this context, no idea.
14:58muhoouvtc: yes, that's the magic that was delighting me. map takes several collections and threads them together. awesome.
15:00casionnbeloglazov: appears that jedit has clojure syntax highlighting
15:00casionnbeloglazov: http://plugins.jedit.org/plugins/?Clojure
15:00uvtccasion, nbeloglazov : I tried jedit a while ago, but indentation didn't work as I'd hoped.
15:01casionyou can treat emacsw32 like a 'normal text editor' if you so wished
15:01nbeloglazovI want to teach some clojure at my university. And thinking what environment will be best for windows users. I thought leiningen + editor. Easy to install and use, good for start. Every IDE comes with it's own plugins for clojure and I fear to get lost trying to handle all of them.
15:01nbeloglazovThanks I'll check jedit
15:02casionnbeloglazov: why not just suggest eclipse? it works on the 3 major platforms nearly identically
15:02chousernbeloglazov: you might consider lighttable
15:03pandeirohow do i get project-specific profiles to load when i am using nrepl in emacs?
15:03muhoonbeloglazov: indeed, lighttable sounds ideal for that application
15:03nbeloglazovcasion: I can't say why eclipse is better than intellij or netbeans :) Personally I'm intellij guy.
15:04nbeloglazovchouser: is it free? I remember some stuff about licensing on kickstarter
15:05chousernbeloglazov: you can use it for free. I'm not sure if there are any constraints but I imagine the authors would be happy to support educational use if any extra permission were required.
15:05uvtcnbeloglazov: recent lightnable news http://www.chris-granger.com/2012/08/17/light-table-reaches-010/
15:07nbeloglazovI haven't played a lot with lighttable. Does it have integration with lein?
15:08chousernbeloglazov: indeed lein is now built in
15:08nbeloglazovchouser: hm. Nice. I'll take a look right now. Thanks a lot
15:08xeqipandeiro: you're going to need to use `lein with-profiles ... nrepl :headless` and M-x nrepl
15:09pandeiroxeqi: hm ok
15:09pandeirois the idiomatic way to do it providing a {:user {:injections ... }} in the project.clj for each different project? easier than creating special keys in ~/.lein/profiles.clj and somehow loading them when firing up nrepl?
15:09uvtcnbeloglazov: If installing Emacs 24 on MSWindows isn't too bad, you might try Emacs. Here's a little Clojure + Emacs article I wrote which you might find useful: http://www.unexpected-vortices.com/clojure/10-minute-emacs-for-clojure.html (it's aimed at GNU/Linux users though).
15:12ivanLa Clojure needs nREPL
15:12nbeloglazovuvtc: Thanks, I'll include it to list of available options. But going to make plain editor or lighttable as main option.
15:14uvtcnbeloglazov: You can use Emacs as a plain editor.
15:14xeqipandeiro: what are you using in :injections? I wouldn't see much point in the :user profile in a project.clj vs just using the keys normally
15:16pandeiroxeqi: i just would like to cd to a project dir, open emacs, and nrepl-jack-in with it custom loading some ns's depending on the project
15:26meliponehello! how do I represent a complex number in clojure?
15:27chousermelipone: get a java lib that supports complex numbers, or if you want to roll your own use a vector of two numbers or a deftype
15:31ordnungswidrigslightly off topic: is anybody using emacs with multiple frames in a tiling wm?
15:31muhooordnungswidrig: i am. ion3
15:32casionordnungswidrig: I do in dwm
15:32xeqiI do in xmonad
15:33ordnungswidrigmuhoo: do you have special configuration like oneoneone?
15:33ordnungswidrigto avoid new emacs windows and force new frames, global minibuffer or like that?
15:34muhooordnungswidrig: my .emacs has evolved over the past 8 years, i don't even remmeber what everythign in it does anymore :-) but i have (setq pop-up-windows nil) for sure
15:34ordnungswidrig*g*
15:35ordnungswidrigmuhoo: I wonder how you'd perform with emacs -q
15:36muhooi would be completely helpless
15:36muhoomany of my keybindings are non-standard
15:36casionI've taken special care to be -q compatible
15:36muhooactually, if i'm on a machine where i don't have my .emacs around, i just use vim instead.
15:37casionthough I'd probably trip up on my constant abuse of hippie-exand
15:37Sgeohippie-expand?
15:37ordnungswidrigmuhoo: haha
15:37casionSgeo: http://emacswiki.org/emacs/HippieExpand
15:37uvtcmuhoo: Just curious, do you have a binding for scrolling the window up/down by one line? I use M-n/p for that. Surprised Emacs doesn't come ootb with keybindings for those.
15:37ordnungswidrigemacs users adopt to there random choice of emacs features and extensions
15:38ordnungswidriguvtc: you can bind the scroll-lock key to a minor mode that remaps C-n C-p :-)
15:38muhoouvtc: i have scroll-up-command bount to <next> it seems, which is downarrow
15:38ordnungswidriguvtc: finally a use for that key
15:39uvtcNot sure my keyboard has a "next" key ... hm...
15:39muhooi dunno. my .emacs, .ion config, and .Xmodmap are so tangled and intertwingled, i'd be lost without all of them.
15:39casionnot even the space cadet keyboard has a next key
15:39uvtcordnungswidrig: I think I need my C-n/p. :)
15:39ordnungswidriguvtc: no, only remap when scrolllock is activated :)
15:40muhoosorry, not <next>, <down>
15:40uvtcordnungswidrig: Hm. Sounds like you're going modal on us. :)
15:40casionuvtc: why would you want to scroll a line at a time?
15:40ordnungswidriguvtc: minor-model, to be exact
15:40muhooand, control+<down> appears to be <next>
15:40casionI can't say that I've ever had that desire, so I'm curious
15:40uvtccasion: I guess it's the artist in me; I like to frame what I'm working on just so. :)
15:41ordnungswidrighmm, C-down is forward-paragraph, I did not know
15:41muhooi think you could spend 30 years in emacs and still come across stuff you didn't know.e
15:42uvtcmuhoo: Oh, I see. But then I'd have to move my hands off the home row to scroll the window around. :) Wouldn't want to have to resort to *that*... :)
15:42muhooit's not an editor, it's a lifetime-long easter-egg-hunt
15:42ordnungswidrigisn't there a "did you know?" mode?
15:42casionuvtc: why don't you use C-l then?
15:42casionrecenters the buffer on the point
15:42uvtccasion: Oh, certainly. That too.
15:43pandeirohow can i make a ns (say foo.core) expose a few other ns' fns when it is used?
15:43ordnungswidrigpandeiro: you'd have to alias them into foo.core
15:43muhoopandeiro: (ns foo.core (:use [something else :only [bar baz]])) ?
15:44casionoh neat, I didn't know C-l could take an argument
15:44ordnungswidrigthe other day I tried to build a minor mode to pin buffers based on major mode or regex on name to a (emacs) window. is the anything like that, but that actually works?
15:44pandeiromuhoo: no i think aliasing is what i'm after
15:44casionthat's useful
15:44ordnungswidrigcasion: like center as 5th line from top?
15:44casionordnungswidrig: yes
15:45naeghow can I apply a vector of functions (let's say [print println print]) on a vector of data in squence (e.g. ["hi" "richard" "regards"])?
15:45pandeiroi want to have a ns that i can 'use' just to load an assortment of different stuff into the current repl ns
15:45ordnungswidrignaeg: ,(doc for)
15:45casionnaeg: juxt?
15:45ordnungswidrig&(doc doseq)
15:45lazybot⇒ "Macro ([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
15:46muhoocasion: https://www.refheap.com/paste/4991
15:47naegordnungswidrig: it's not possible with mapv, is it?
15:47naeg(or with map) - in fact want to return a vector at the end
15:48casion,((apply juxt [:a :b]) {:a 1 :b 2 :c 3 :d 4})
15:48clojurebot[1 2]
15:52muhoo,(select-keys {:a 1 :b 2 :c 3 :d 4} [:a :b])
15:52clojurebot{:b 2, :a 1}
15:53muhoo,(-> {:a 1 :b 2 :c 3 :d 4} (select-keys [:a :b]) vals)
15:53clojurebot(2 1)
15:53abaloneis there a clojurescript channel? or might i ask an easy question here?
15:53gfredericksask!
15:54abalonei'd like to return two pieces of data from my cljs fn. like ["a" "b"]. how does js code refer to the first part and the second part?
15:55gfredericksyou're dealing with the return value from raw javascript?
15:55abaloneyeah.
15:55abaloneraw js is the codemirror part
15:55ivanabalone: it'd be an Array in JavaScript with a [0] and [1]
15:55abalonemyFn(args)[0] ?
15:55gfrederickseasiest thing is to figure out how to return an array instead of a vector
15:55gfredericksI would not expect ivan's suggestion to work
15:55abaloneit doesn't for me
15:56ivanright, I assumed you did the conversion already ;)
15:56abaloneoh, how?
15:56naegcasion: juxt seems not to be what I want. I want: take first func of func-vector, apply to first data in dataset, take second ...
15:56ivanthere's a cljs->js somewhere
15:56muhoonaeg: reduce?
15:56jrajavIs 4clojure.com an old site or is it just down right now?
15:56broquaintJust down right now, jrajav.
15:57naegmuhoo: nope, the function should change in sequence like the dataset - not always same func
15:57naegI guess I have to do this with doseq
15:57metellus,(map #(%1 %2) [inc dec] [1 1])
15:57clojurebot(2 0)
15:57ivan4clojure Registrar: GODADDY.COM, LLC
15:57jrajavJust came back up :)
15:57metellussomething like that?
15:57naegmetellus: seems right :o
15:58metellusI think there's something nicer than #(%1 %2) that you can use, though
15:58naegtried around with map, but didn't get it to work, let's see
15:59muhoonaeg: ##(map #(%1 %2) [identity (partial str "foo-")] [2 "baz"])
15:59lazybot⇒ (2 "foo-baz")
15:59naegmetellus: how do you mean nicer? I could use (fn [func data] (func data)) instead
15:59naegmuhoo: yeah, that's what he came up with now too, thanks
15:59muhooclearer maybe ##(map #(%1 %2) [inc dec] [2 4])
15:59lazybot⇒ (3 3)
15:59metellusnaeg: I think there's an actual built-in function that does it, but I could be wrong
15:59muhoometellus: doh, i was just a minute too late :-)
16:02hyPiRion,(map reduce [inc dec] [0 1] (repeat nil))
16:02clojurebot(0 1)
16:02muhooi think there's a function in useful that does it
16:02hyPiRionoops
16:03abaloneivan: you mean cljs-37 in jira?
16:04hyPiRion,(map apply [inc dec] [1 2] (repeat nil))
16:04clojurebot(2 1)
16:04hyPiRioneventually, if you're not scared of it
16:04hyPiRion(map (comp eval list) [inc dec] [1 2])
16:04ivanabalone: yeah. I think someone also might have an implementation in some CLJS library. I forgot which.
16:05ivangithub search might find it
16:05hyPiRion,(map trampoline [inc dec] [1 2])
16:05clojurebot(2 1)
16:05hyPiRionWell, maybe not idiomatic, but hey.
16:06ivanabalone: hmm, maybe just (array)
16:07gfredericksarray looks like it works on himera
16:08gtrakhyPiRion: lol...
16:09gtrakwhat the heck is going on there?
16:09hyPiRiongoing on where?
16:09gfredericks,(map trampoline [constantly dec] [1 2])
16:09clojurebot(1 1)
16:09gtrakthe last two examples look like some serious obfuscation
16:09hyPiRion,(map trampoline [comp apply] [+ -])
16:09clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (1) passed to: core$apply>
16:10llasram&(map deliver [inc dec] [0 1])
16:10lazybot⇒ (1 0)
16:10hyPiRion,(map trampoline [comp complement] [+ #([%]0)])
16:10clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval426$fn>
16:11hyPiRionahh.
16:11gtrakdeliver is kind of an apply
16:12llasramOnly as an implementation detail. Depending on that behavior is probably a way to end up crying later :-)
16:12hyPiRion,(map trampoline [comp some-fn every-pred] [+ * -])
16:12clojurebot(0 nil true)
16:12gtrakexcept it will never change b/c it will break existing code ;-)
16:12gtraki guess it does say 'alpha'
16:13hyPiRiongtrak: Code will never break if you don't upgrade. :)
16:13gtrakany clojure 1.2 stalwarts in existence?
16:15hyPiRionI left 1.2 when I found out that ##(#{2} (denominator 1/2)) returned nil in 1.2 and lower.
16:15lazybot⇒ 2
16:16gtrakoh, that's a little weird, I would've that that would work
16:16gtraksince 1.2 had rationals and stuff
16:17gtrak/s/that/thought/
16:18hyPiRionwell, the issue was that the denominator was a bigint, while the element in the set was a Long
16:18gtrakah, .hashCode
16:24naeghow can I make core.logic available in my repl? when there is no project.clj?
16:25gtraknaeg: lein2 supports some kind of default profile, but in lein1 I would just make a project for stuff like that, it's no big deal
16:27naegglad I'm on arch ;)
16:30gtrakI'm not really a fan of package maintainers decisions on anything to do with java :-)
16:31gtrakthough recently I noticed ubuntu faking out a maven repo in its installation of dependency libs for java applications
16:31naeggtrak: that's why I'm using openjdk 1.6 from the AUR and not jre 1.7 from official
16:31gtrakwhy not 1.7? it's quite a bit faster
16:32technomancygtrak: is it a transparent caching proxy?
16:32naegI have no idea why - but lighttable doesn't work with java 1.7 (for me)
16:32gtraktechnomancy: I didn't dig into it really
16:32technomancygtrak: that's what fedora is doing, and it sounds like an OK idea though the effort/payoff is really really low
16:32naegreported it, but nobody seems to care about the issue
16:32gtraktechnomancy: I googled and this came up: http://wiki.debian.org/Java/MavenRepoSpec
16:33technomancyugh; yeah, mvn and apt are fundamentally incompatible; they have conflicting design goals
16:33technomancygetting JVM libraries through apt is stupid unless it's just to support an application.
16:34gtraktechnomancy: about 4 years ago I tried to use eclipse that way and never looked back.
16:34ordnungswidrigtechnomancy: i wasted many days some years ago, trying to even make maven itself go into debian.
16:34gtraknow anything java related except the jdk itself is a script in ~/bin
16:34technomancyordnungswidrig: well that's different; it's an application.
16:35ordnungswidrigtechnomancy: indead, but it showed the deep madnes of maven. you could not compile it from sources. :-)
16:35ordnungswidrigFTBFS
16:36technomancyouch
16:36ordnungswidrigtechnomancy: leiningen would be easy, it's a shellscript :)
16:37technomancynot really; leiningen needs itself to build
16:37technomancyhttps://github.com/technomancy/leiningen/issues/745 =(
16:37llasramSelf-hosting is a feature!
16:37ordnungswidrighmm, I'm not familiar with the currenct debian packaging requirements, I must confess.
16:37gtrakit's nice for it to be in the repo for people to try, but any serious user is going to do it manually probably
16:38technomancygtrak: the existing deb for lein1 works wonderfully
16:38ordnungswidriggtrak: there might be applications that need leiningen to be built from source.
16:38gtrakordnungswidrig: :-) one can only hope
16:38ordnungswidrigthat was my motivation for trying to package maven.
16:38technomancyI've heard horror stories about people trying to use the one in arch and macports though.
16:38technomancybrew's a bit of a mess too
16:39technomancybut the .deb is rock-solid
16:40ordnungswidrigtechnomancy: talk about maven or lein?
16:40technomancyordnungswidrig: lein specifically, though I never had trouble with maven back in the day
16:41ordnungswidrigI used the curl method :)
16:43technomancyyeah, it's just one more hurdle for potential newcomers though
16:44ordnungswidrigespecially on windows.
16:44technomancyof course if they're really interested they won't care, but for someone who's on the edge, the fact that they can't just use apt-get may just turn into, "Oh, but it does have Haskell; maybe I should try that instead..." =)
16:45ordnungswidrigsounds like a well tought decision.
16:45gtrakha, maybe I'll just drop clojure and learn Haskell....
16:46technomancywell if it was just up to me I don't think I'd have the stamina to untangle the requirements for debian packaging, but luckily I have a helpful DD
16:46ordnungswidrigwell, they opt for node.js, I suppose.
16:46technomancygtrak: I know you've thought of it; don't lie =D
16:46gtraktoo bad I actually have a job doing clojure!
16:47technomancyhaskell programs boot in like zero milliseconds
16:47gtrakoh well... debian supports haskell way better
16:47ordnungswidrighaskell will be the first language ported onto a quantum computer.
16:48Hodappbahahahaha quantum computer
16:48ordnungswidriglisp will be second, as soon as somebody figures out how to entangle to cons cells
16:48emezeskegtrak: Why do you need debian to support clojure? Doesn't lein take care of that?
16:49gtrakemezeske: total sarcasm, sorry :-). I'm fine installing lein manually.
16:49ordnungswidrigemezeske: lein needs clojure as a dependency.
16:49technomancyemezeske: installing by hand is kind of crappy when you're used to a good package manager
16:49technomancyeven if it's not much work, it's the principle of the thing
16:49gtrakbut that's because I've learned to expect anything java-related to be borked on a package-manager
16:50technomancyemezeske: "Same reason we don't wear animal skins or hunt the wooly mammoth! Because we're not savages." http://www.penny-arcade.com/comic/2005/06/06
16:50thorbjornDXhah, I just typed :wq into a repl
16:50ordnungswidriggtrak: that is a good summary :)
16:50emezeskegtrak: Oh, heh
16:50emezesketechnomancy: lol
16:50hyPiRionthorbjornDX: Oh, just wait until you do C-x C-c to get out of chrome.
16:50emezesketechnomancy: I did not notice gtrak's sarcasm -- I thought he wanted to manage like clojars jars via debian's packaging
16:50metellusthorbjornDX: it's valid clojure!
16:51thorbjornDXmetellus: which is why I laughed :D
16:51technomancyoh heavens no
16:51technomancybut applications, absolutely
16:51gtrakemezeske: I don't care either way, I'm not on JVM because it's desktop app story
16:52gtrakit lost that fight a long time ago
16:54SegFaultAX|work2Is there a good way to start a stand-alone nailgun server outside of a clojure project?
16:55muhooi vaguely remember hearing of a lein2 or nrepl/reply/something plugin that'll pprint all the output from every form in the nrepl?
16:55denlab4clojure down ?
16:58muhoowhere's the right place for that? i suppose i could hack up some elisp that throws (pprint ...) around every form it sends to the nrepl server, but not sure if that'd be the right thing
17:00ordnungswidrigmuhoo: i think nrepl has something like middleware that could wrap the expr and pprint the result
17:01technomancythere's an example in `lein help sample` of such a middleware
17:09TimMcdenlab: Their registrar is under DDoS right now, so I wouldn't be *too* surprised.
17:12SegFaultAX|work2Is it just me or has Hickey given the same basic talk about Datomic under like 3 or 4 different titles?
17:15muhootechnomancy: thanks
17:18naegcore.logic: am I getting insane or how can this be true: http://bpaste.net/show/JRAEZ5WKPcozJ3NNouAj/
17:18gtrakhey guys, when's ballpark date for clojure 1.5?
17:18Raynes2050
17:18gtrakhmm....
17:19gtrakRaynes: standard deviation?
17:20gtrakhow about, is there a way I can work around this issue in 1.4?: http://dev.clojure.org/jira/browse/CLJ-1034
17:20muhooah, :nrepl-middleware [my.nrepl.thing/wrap-amazingness ...
17:20ordnungswidrignaeg: nice
17:21naegordnungswidrig: Am I not insane? This should not be right at all, right?
17:22ordnungswidrignaeg: (l/+fd d 1 c) should not match on 3 / 1
17:22naegordnungswidrig: yeah, that's really strange. smells like I have to report an issue
17:22ordnungswidrignaeg: I'm no expert in core.logic, though. mabybe in the fd [1 3 4 5] is (= 3 ( 1 + 1))
17:25naegordnungswidrig: but that wouldn't make much sense imo
17:26samueljHey, i'm trying to get started with compojure and I get this error on lein compile:
17:26samueljException in thread "main" java.io.FileNotFoundException: Could not locate ring/middleware/head__init.class or ring/middleware/head.clj on classpath: , compiling:(route.clj:1)
17:26samueljI'll post my source in a pastie, i'd be so grateful for any help! Really very confused :s
17:27ordnungswidrignaeg: for a fd [:foo :bar :baz :qux] (= :baz (+ 1 :bar)) makes sense.
17:27ordnungswidrignaeg: in a way
17:27weavejestersamuelj: It's likely one of your dependencies is requiring an older version of Ring, and is overriding Compojure's
17:28djanatynhttps://gist.github.com/3693973 -- I was having a lot of fun slacking off in class earlier today
17:28naegordnungswidrig: but +fd is for addition/subtraction, not "chosing the next/previous element of the fd"
17:28samueljweavejester, thanks! How can I resolve it? My project.clj is here: http://pastebin.com/NKmpKDSm
17:28djanatynI played around with records and made a little grid/entity thingy
17:28weavejestersamuelj: Normal "soft" dependencies are resolved depth first - the closer the dependency to your project, the more priority it has.
17:28djanatynit was nice to play with records
17:28weavejestersamuelj: But occassionally there will be "hard" dependencies that specify an exact version - these can cause problems.
17:29djanatynis there anything that I could change that you notice immediately, to make it more idiomatic clojure?
17:29djanatynI didn't use protocols because I didn't really see the need to
17:29samueljweavejester can I not specify versions and let lein resolve them?
17:29djanatynI think that was possibly a bad idea
17:29weavejestersamuelj: Oh, but in this case you've explicitly put the wrong version in your project file
17:30weavejestersamuelj: Compojure 1.1.3 depends on Ring 1.1.0 or above.
17:30samueljah ok! thanks :)
17:30djanatynI already see some things I can change, like (empty? (filter #() .. )) to (some #() .. )
17:30samueljso I'll check required versions in future :)
17:30weavejestersamuelj: The latest version is 1.1.5. Your Ring dep in your project file overrides the one Compojure adds.
17:31weavejestersamuelj: lein deps :tree is a good way of checking deps
17:31samueljsweet, thanks weavejester
17:34Raynesuvtc: Dejected. lol
17:34RaynesMade me smile.
17:34Raynes<3
17:34uvtcNo sad docstrings.
17:34uvtc:)
17:35RaynesI'll let technomancy be the mediator on that one. :p
17:35RaynesIt looks like he took most of my cute out anyways, so probably want to merge this too.
17:36technomancyI dunno, the no-jure thing was more like deranged yelling =)
17:37technomancyderanged in a good way though
17:37technomancybut I like the notion of being able to do `rgrep FIXME .` after generating a project
17:37RaynesFIXME: I don't do a whole lot
17:37Raynes:P
17:37RaynesSeriously though, I don't mind.
17:37uvtc:( docstring doesn't feel good about self.
17:37RaynesWhatever you think is best.
17:38muhooi'd suggest prohibiting projectin names with "*-clj" or "clj-*"
17:38uvtcFIXME: you're going to love the docstring that gets written here!
17:38technomancymuhoo: strongly tempted =)
17:38technomancymaybe at least emit a warning
17:39Raynesmuhoo, technomancy: I'd support that.
17:39Raynesclj-stopwiththefuckingnames
17:39muhooa more useful, but perhaps too complected, warning would be if it checked clojars and github to see if the name was already taken.
17:39technomancyclj-namesarehard
17:40uvtcMy understanding was that (A) Clojure libraries that wrap or otherwise provide access to an underlying Java library are often named "clj-foo", and (B) Clojure libraries that provide their own implementation of a known library are often named "foo-clj".
17:40technomancyI suspect that's more coincidence than intention
17:40muhoomore lik, there's no rationale, and clj- and -clj are just lacks of creativity
17:41RaynesIf I can't think of a name I just ask technomancy.
17:41ordnungswidrignaeg: the examples specify the domain as (domain 1 2 3 4 5 6 7 8 9)
17:41RaynesHe always gives me a name!
17:41RaynesSpeaking of...
17:41scriptorlein should come with a random name generator
17:41uvtcGood idea. I propose we name it clj-random-name-generator.
17:41muhooscriptor: that was the next thing, point them to a list of literary characters. now we're getting *real* complected.
17:42hyPiRionuvtc: What java-library does it wrap?
17:42uvtcOr random-name-gen-clj
17:42hyPiRionI'd just call it adskdashe
17:42hyPiRionthat's random.
17:42muhooi knew wa guy who was a sysadmin at disney, where they'd run around raiding new film development teams for character names whenver they got a new batch of servers in.
17:42uvtchyPiRion: My joke seems to have flopped. :)
17:43muhoouvtc: name-generatejure
17:43naegordnungswidrig: ...so? not getting it
17:43hyPiRionmuhoo: turn of lein ironic first.
17:44hyPiRionon*
17:44naegordnungswidrig: (apply l/domain [1 3 4 5]) = (l/domain 1 3 4 5)
17:44ordnungswidrignaeg: you defined it as (domain [1 3 4 56)
17:44MosesHi, looking for help with this problem : http://pastebin.com/W2r1J38g
17:44ordnungswidrigI see.
17:45muhooi have an intensly stupid question: how can i pull the raw ring request out from inside a compojure handler?
17:45uvtcmuhoo: I've got the best Clojure-name-pun saved for just the right rainy day.
17:45weavejestermuhoo: (GET "/" request …)
17:45naegordnungswidrig: (just doing this because there is actually a variable refering to a vec of numbers instead of [1 3 4 5])
17:45hyPiRionMoses: You're using ratios, while I guess Perl is using floats
17:45weavejestermuhoo: Or (GET "/" {:as request} …)
17:46weavejestermuhoo: Or (GET "/" [:as request] ...)
17:46ordnungswidrigMoses: why using mapv where map will do? and add some type hints to force primitive types, not objects for numerics
17:46muhooweavejester: thanks!
17:46MosesThank you hyPiRion and ordnungswidrig
17:47naegordnungswidrig: but I'm really unsure too whether I misunderstood +fd or infd
17:47naegclosing the issue won't be that much of an effort though
17:48hyPiRion,(time (double (reduce + (map / (range 5000) (range 1 5001)))))
17:48clojurebot"Elapsed time: 5271.078789 msecs"
17:48clojurebot4990.905491147016
17:48hyPiRion,(time (double (reduce + (map / (map double (range 5000)) (map double (range 1 5001))))))
17:48clojurebot"Elapsed time: 169.688312 msecs"
17:48clojurebot4990.905491147009
17:49gfredericksoff by 5e-12 or so
17:50MosesThank you hyPiRion, got it handling 500k now
17:51MosesMapping the values to doubles makes it very fast.
17:51naegllasram: ping
17:51hyPiRionMoses: you're welcome :)
17:56llasramnaeg: Hey, what's up?
17:57naegllasram: hey, remember that code you wrote up for me today in core.logic? that's not the expected behaviour, is it? http://bpaste.net/show/4XK2kmdJGDq1iyV5OOXv/
17:57naegllasram: I already reported an issue, but I'm unsure: http://dev.clojure.org/jira/browse/LOGIC-52
17:58llasramnaeg: No, it really isn't. Huh, interesting. I'd actually played a little further, and found the same problem, but thought it only manifested when I was trying to be fancy and construct the sequence of +fd calls as goals in an `everyg`
17:58llasramI was going to wait until dnolen was around to ask about it
17:58llasrambut it really does look like a bug
17:59llasramIf you have the domain contain one valid sequence, it choose that. Two valid sequences, it choose those. If you have certain particular constructions of domains w/ no valid sequences, then it emits that invalid one
17:59llasramSo yeah, I'm going with bug
18:00naegllasram: ok, great
18:00naegwell, actually bad
18:01llasramBut you could try to track down the bug and fix it, improving the software ecosystem for everyone!
18:01llasramEvery bug is an opportunity
18:01gfredericksOSS is a gift economy
18:01llasramThat's why I leave the bugs in code I write
18:01naegllasram: I'm looking at the sourcecode of +fd, but I don't feel like I'm good enough in clojure already
18:01naegstill trying
18:02carktho tracking a bug in such thing as logic requires quite a bit of expertise
18:02carki already struggle just using it =P
18:06naegllasram: about that everyg - did you put all those calls to +fd into that?
18:08RoxxiFor unit testing is there a lot of traction around Midje, or do most people just use clojure.test ?
18:09samueljHey, can anyone point me in the right direction with this? Just trying to get my head around clojure web dev using compojure. I wanted to be able to define several functions like 'test', and add them into my-routes, then pass that to the defroutes function. I get * a lot * of errors when I try :) http://pastebin.com/efrYdUKw
18:09samueljAny help is again greatly appreciated
18:09samueljjust a nudge in the right direction!
18:09weavejestersamuelj: Why did you quote the route?
18:10samueljBecause i didn't want it to evaluate?
18:10llasramnaeg: Yeah. Unfortunately on other computer I lost my ssh tunnel to ATM
18:10weavejestersamuelj: You do want it to evaluate :)
18:10samueljAh
18:10weavejestersamuelj: GET returns a function
18:10weavejestersamuelj: It's basically equivalent to:
18:11llasramnaeg: Gist is you can use `partition` to build pair-wise sets of the goal logic variables, then apply the step condition to each pair
18:11weavejestersamuelj: (GET "/" [] …) ==> (fn [req] (if (matches-route? req [:get "/"]) …))
18:11samueljah ok!! awesome!
18:12samueljSo if i unquote it, I'm getting clojure.lang.PersistentList cannot be cast to clojure.lang.IFn
18:12weavejestersamuelj: You also don't need a ref, unless you want to dynamically change the routes at runtime.
18:12samueljok, so I can just def the list and then still call alter on it?
18:13samueljwhat i typed doesn't make sense
18:13samueljI mean, I can take out the ref, then still conj into it?
18:13weavejestersamuelj: That's because (defroutes app my-routes) is equivalent to (def app (routes my-routes))
18:13weavejestersamuelj: The routes function takes many handler functions and combines them into one.
18:13weavejestersamuelj: So if there's only one route, then (routes x) == x
18:14weavejestersamuelj: If you want to update the routes dynamically, you'd need an atom or ref, but I don't know why you would
18:14naegllasram: I just did it like that: (l/everyg (fn [[y x]] (l/+fd y 1 x)) [[b a] [c b] [d c]])
18:15weavejestersamuelj: If you just want to put multiple routes into one, then you can use the 'routes' function
18:15weavejestersamuelj: So say x = (GET "/" [] …) and y is another route, then (routes x y) will return a new route that tries x first, then y, then nil if neither match.
18:16llasramnaeg: A bit more manual, but yeah -- I'd think that would have the same effect
18:16samueljah ok, and this is a compojure function? not ring?
18:17weavejestersamuelj: It's basically the same thing. The only difference is that in Compojure the routing functions can return nil. Otherwise they're the same as Ring handlers.
18:17weavejestersamuelj: Compojure treats a route returning nil as meaning "do not match"
18:18samueljawesome, thanks for the help
18:19weavejestersamuelj: So (routes (GET "/" [] "Hi") (ANY "*" [] "Not found")) will check the GET first, and then the ANY, which will always match/
18:19samueljso in general, you define a series of routes with something like (def x (GET ?) and then maybe (def app (routes x y))
18:19samuelj*defroutes
18:19weavejestersamuelj: You don't need the x part, you could do it all inline
18:20samueljYeah, but i'm porting over an existing application and its quite larg
18:20weavejestersamuelj: Like (def app (routes (GET "/" [] …) (POST "/" [] …) (GET "/:id" [id])))
18:20weavejestersamuelj: Okay, so you might want to split things up. Let's say you have some routes for dealing with products
18:21weavejestersamuelj: Give me a sec to make a gist :)
18:21samueljsweet, thanks
18:24naegbtw llasram this is what I'm having so far: http://bpaste.net/show/Y8sNAXSPNGHS0EgOHPjq/
18:25naegyeah, switched to partition and I'm still missing the whole check for diagonals to complete the check for the whole connect four field
18:25naegstuck with diagonals here: http://stackoverflow.com/questions/12355352/predicate-to-declare-descending-ascending-coordinates-using-finite-domains
18:27gtrakdakrone: mind if I ask, what would you call this license used for Cheshire? It looks a bit like MIT. is something like 'Modified MIT license' ok for our documentation?
18:28weavejestersamuelj: Nearly done...
18:28gtraknever mind, I see the README says MIT license
18:35weavejestersamuelj: There: https://gist.github.com/3694454
18:38samueljweavejester thank you so much dude! that's awesome help :)
18:38weavejestersamuelj: Does that make more sense now?
18:41samueljyeah it sure does
18:41samueljthanks a million!
18:41xeqi(inc weavejester)
18:41lazybot⇒ 5
18:44weavejesterCool. Now, sleep for me :)
18:45hyPiRion,(Thread/sleep 1000)
18:45clojurebotnil
18:46samueljweavejester: but what If i want to create a function, say, add-route, that takes something like a GET function, and adds it to a list that is referenced in defroutes
18:46samueljCan I show you what I'm thinking?
18:47samueljweavejester: http://pastebin.com/GE7HZ7TW
18:47samueljoh right, just saw your sleep comment
18:47samueljno worries dude!
18:52gtraksamuelj: just glancing at the compojure code, you might have to hot-replace some of the code to make that happen, like adding around metadata
18:52gtrakthe functions get captured in a closure eventually, you'd want to expose that somehow
18:54gtraklike add an atom to the metadata of the routes, and create functions that alter that
18:55gtrakthat's kinda what noir does with defpage: https://github.com/ibdknox/noir/blob/master/src/noir/core.clj
18:56technomancycan't say I'm a fan
18:56technomancydeclarative routes are the way to go
18:57technomancybut yeah, if you wanted to do that, noir shows you how
18:58gtrakis noir doing 'imperative' routes?
18:58samueljtechnomancy, what's so good about declarative routes?
19:01ivancan I get clojure-dev in my inbox without mailing a piece of paper?
19:05gtrakivan, feeds? https://groups.google.com/group/clojure-dev/feeds?hl=en
19:05ivanah, nice, thanks
19:10thorbjornDXokay, `lein vimclojure` is blowing my mind right now. And I've heard that slime will blow this out of the water
19:11RaynesWe're trying to get people off of SLIME for Clojure in favor of nrepl.el.
19:11RaynesIt might, however, still blow it out of the water.
19:12gtrakRaynes: any hope for lein 1.7?
19:13Raynesgtrak: Don't think so, no.
19:14gtrakI would like some, I don't know when we'll get on 2. I just got off of 1.6.1.1 a month ago.
19:14thorbjornDXRaynes: actually, I think that's what I was using in emacs, is that the "m-x clojure-jack-in" command?
19:14RaynesNope, nrepl-jack-in
19:14thorbjornDXRaynes: ah, okay. I'll have to give it a shot
19:18carkwhat's a good way to do continuous testing with clojure 1.4 ?
19:18gtrakwe do hudson with cmdline lein invocations
19:19thorbjornDXgtrak: you can just use 'lein test' or somesuch, right?
19:19gtrakfor some values of 'good'
19:19gtrakyea
19:19frioi'd also like an answer to cark's q if possible, but locally rather than with a build server
19:19frioi really liked that scala's sbt had ~test
19:19friowhich detected changes, recompiled and re-ran the test suite locally
19:19carki'm also looking at something local and fast
19:19friodoes anyone know if there's anything similar :)?
19:19thorbjornDXgtrak: does it just give you a bunch of stacktraces? Or is there a way to get pretty output?
19:19gtrakthere's a lein-autotest?
19:20gtrakthorbjornDX: yup, stacktraces
19:20gtrakI'm guessing the build result is keyed off the process exit errorlevel
19:20thorbjornDXgtrak: gotcha. cark: jenkins is pretty quick in my experience
19:20gtrakof course if I were starting from scratch I'd prefer jenkins to hudson
19:21frioso there is gtrak
19:21friothanks for that :D
19:21thorbjornDXgtrak: I'm pretty late to the game, what new features does jenkins buy you?
19:21thorbjornDX(personally that is)
19:21friojenkins is just hudson thorbjornDX :)
19:21gtrakthorbjornDX: the whole dev team of hudson...
19:22carklooks like a whole beast, i was thinking lazy-test or lein-auto-expect, but maybe with clojure.test
19:22gtrakhudson is a dead project now
19:22friobut there was a Thing with oracle owning the trademarks and whatnot (which isn't a Thing anymore)
19:22thorbjornDXgtrak: gotcha.
19:23gtrak"Compare core commits: as of 9-March, Jenkins core has 307 commits from 30 contributors; Oracle Hudson has 136 commits by 4 contributors."
19:23thorbjornDXgtrak: not to mention plugin developers... ok :)
19:31gtraklancepantz: umm, what would you say is the license for clj-yaml?
19:39technomancygtrak: anything in particular keeping you on lein1?
19:40gtraktechnomancy: yea, we have some custom plugins
19:41technomancyanything interesting? =)
19:41gtrakthere's one that recursively AOT compiles dependencies and creates -compiled classifier jars in the local maven repo, and another that manages distribution packages, generating license docs, etc..
19:41gtrakthey do a bunch of stuff
19:42technomancywhy do you need a plugin to compile dependencies?
19:42technomancythe common complaint in Clojure is that you can't avoid that =)
19:42technomancyoh, specifically to put them in separate jars?
19:42gtrakyea
19:43gtrakhold on a sec, I have Nate's presentation that explains most of that stuff
19:43technomancy"distribution packages" meaning system-level stuff? are you running lein as root?
19:44gtraknope, I mean as zip files to customers: https://github.com/youngnh/presentations/blob/master/clojure.mn/2012_sep/at_revelytix.md
19:44gtrakspecifically compiledeps
19:45gtrakI'm not sure of the details because I didn't write it, but suffice it to say, it's complicated :-)
19:45technomancyso nothing too specific; these are only distributed with the project because you haven't gotten around to spinning them off into a separate plugin project?
19:47gtrakthey are separate plugins, but they tend to not play well with version changes, I'm not sure exactly what's missing/conflicting in lein2, but I remember there was an issue I think with maven jars keeping us at 1.6.1.1, and we just recently were able to go to 1.7.
19:47technomancyouch
19:47technomancyyou have some plexus conflict or something?
19:47gtrakyea
19:47gtraklet me give it a go I guess :-)
19:47technomancythe worst =(
19:47gtrakI have lein2 installed
19:48technomancyok, just curious since so far most people have reported the transition to be fairly painless
19:48gtrakyea, we're doing something weird, it's not your fault
19:48technomancyare you using this? https://github.com/technomancy/lein-licenses
19:48xeqianyone know a way to limit the number of thread the jvm can spawn?
19:49gtraktechnomancy: nah, I think it's custom, we also pull from a map if the license isn't present, so we can add them for all the dependencies, then I use hiccup to generate some html, I wrote that part ;-)
19:49technomancycool
19:51technomancyI can't help but think what you're doing would be much simpler if you just distributed an uberjar
19:51technomancythen you can have all the class files in one place and don't have to mess with repackaging deps
19:52gtrakyea possibly, I don't quite understand all the rationale
19:52technomancyis there some weird business requirement preventing that?
19:52gtrakassuredly, I don't think we'd go through all that trouble to avoid it otherwise
19:52technomancyheh; from the presentation "No other project in the world seems to need this"
19:52technomancypretty much =)
19:53technomancyhave you seen lein-pedantic?
19:53gtraknope
19:53technomancyit's pretty great for larger projects: https://github.com/xeqi/lein-pedantic
19:53gtrakoh neat
19:53gtrakyes I could totally use that
19:53xeqiits lein2 only
19:53xeqibtw
19:54gtrakgodammit XD
19:54technomancyincentive to upgrade =)
19:54xeqiheh, it uses pomegranate underneath, which has some sorta plexus class conflict with lein1
19:54xeqiif I remember right
19:54gtrakok, first problem, it's not AOT-compiling my main class
19:55gtrakah wait, that's the source layout
19:55devnxeqi: so we need some sort of meta pedantic for lein?
19:55devn;)
19:55gtrakwell it doesn't show our plugins at all in 'lein help', so that's an issue
19:56samfloresguys, what's the "right" way to deploy an ring application?
19:56gtrakthose were dev dependencies
19:56samfloresa*
19:56xeqisamflores: clojars uses jetty behind an nginx frontend
19:57samfloresthat's what I was thinking to do :)
19:57hiredmanI like to use the lein ring plugin to build a war, and jetty-runner
19:57hiredmanuberwar
19:57gtraktechnomancy: it looks like it'll be pretty involved, how about I give it a go some other time and let you know?
19:57xeqitechnomancy: was there something in the .md that lead to mentioning lein-pedantic?
19:58xeqidevn: heh, I think it was used in maven-ant-tasks, which does the dependency resolution for lein1. I don't think its fixable
19:58technomancygtrak: of course; no worries. I was just curious.
19:58unlinkIs there something like when-let for maps?
19:58gtraknaha, me too, I haven't shaved the yak fully yet, I just suspect it will break
19:59technomancygtrak: there's an upgrade guide on the wiki when you do
19:59gtrakcool man
19:59gtrakyea, I'd love to use lein2 personally
19:59unlink(when-let [rec (select-keys m [:a :b :c])] ...)
20:00unlinkOf course the condition always succeeds because empty maps are truthy.
20:00technomancyxeqi: I guess under "Lots and lots will hork your build"
20:00aperiodicunlink: you can just use destructuring: (when-let [{:keys [a b c]} m] ...)
20:00xeqi&(when-let [{:keys [a b c]} {:a 2}] a)
20:00lazybot⇒ 2
20:00xeqi&(when-let [{:keys [a b c]} {:a 2}] [a b c])
20:00lazybot⇒ [2 nil nil]
20:00xeqi&(when-let [{:keys [a b c]} {}] [a b c])
20:00lazybot⇒ [nil nil nil]
20:01gtraktechnomancy: I discovered the hard way that our 'lein printdeps' wouldn't necessarily attribute the declared version of the dependency to the declaring parent, but choose by phase of the moon what to put there :-)
20:02gtrakcrazy stuff like that
20:02xeqiversion ranges can make that hard
20:02technomancygtrak: yeah; that's built-in to lein2 now
20:02unlinkaperiodic: I don't want to destructure, though. I just want to execute something that is side-effective when the select-keys yields a non-empty map.
20:02technomancylein-pedantic adds a lot more visibility there
20:02gtrakI want it
20:07gtraktechnomancy: the motivation for compiledeps looked to be like this: http://dev.clojure.org/jira/browse/CLJ-322
20:09technomancygtrak: huh. that issue has been open for ages; I don't have a lot of hope that it'll ever be fixed at this point
20:09gtrakso in the end we get AOT-compiled JARS for every dep, instead of just a bunch of class files
20:09aperiodicunlink: i don't think there's a builtin. you'd probably want to define something like (fn has-any-key? [& keys] (fn [m] ((apply some-fn keys) m))) and use that as your test (assuming all your keys are keywords)
20:13unlinkWhat I want is isomorphic to (let [m (select-keys m ks)] (when (seq m) ...))
20:13aperiodicunlink: write a macro?
20:13unlinkThat's never the answer.
20:14unlinkI think the better question is, why doesn't clojure.java.jdbc/update-values not accept an empty parameter list? (and do nothing)
20:14metellus,(when-let [m (select-keys {:a 1} [:b])] true)
20:14clojurebottrue
20:15metellusdarn.
20:19aperiodicunlink: what's unsatisfying about defining (fn has-any-key? [m & ks] (seq (select-keys m ks)) and then writing (when (has-any-key? m :a :b :c) ...) ?
20:22muhoois there somewhere a clearinghouse/wiki/directory/something with all the various ring middlewares available?
20:24xeqimuhoo: the "built-in" ones are listed at http://ring-clojure.github.com/ring/
20:40unlinkaperiodic: I actually want the map resulting from the select-keys.
20:41zenolichouser: Thanks, finally had a chance to look at your updates to https://gist.github.com/3687532 using the LinkedBlockingQueue. That's super slick.
20:45gfredericksemezeske: ping
20:46zenolichouser: I'm going to give it a try with my code, looks like it's just what I'm looking for. If I'm understanding correctly, advance-most-recent continues running in its own thread, due to the future, every time the rest unblocks, and that keeps the queue from growing...that was the other piece that I was missing.
20:47emezeskegfredericks: pong
20:56gfredericksemezeske: I was poking for a hacky workaround to the *assert* issue; I tried setting it to false in user.clj, thinking that couldn't possibly not work, and yet it did not work; any ideas?
20:56gfredericks(i.e., with alter-var-root)
20:58emezeskegfredericks: I don't think there's even a hacky workaround
20:59emezeskegfredericks: Since the compiler is run in a separate java process from leiningen itself
20:59gfredericksbut clojure always loads the user.clj, I assumed
20:59gfredericksas long as it's on the classpath
20:59gfredericksI figured the issue must be I'm misguessing the classpath (I put it in src/user.clj)
21:00emezeskeHmm, I guess I don't know much about user.clj
21:00gfredericksbut /src is definitely on the classpath for the compiler's process?
21:01emezeskeYes, unless you changed :source-path or something
21:01gfredericksah ha
21:01gfredericksso the :source-paths option in lein2 is exhaustive?
21:01emezeskeWell, it defaults to ["src"] I think
21:04gfrederickssweet that did it
21:04gfredericksemezeske: thanks!
21:04jcromartie(eval (maths.core/compile-math '(2 * 6)))
21:05jcromartiegetting somewhere
21:05emezeskegfredericks: Glad you got it working!
21:05jcromartieoh wait, Incanter does this
21:10KhaozThe clojure-mode to use with emacs is the one from here: https://github.com/technomancy/clojure-mode right ?
21:24mpanwhat does it mean to get: CompilerException java.lang.RuntimeException: Unable to resolve symbol: defn in this context, compiling:(NO_SOURCE_PATH:2) ?
21:25mpanit seems to happen occasionally at the repl
21:25mpanlike I was previously using stuff from core and it was OK
21:26mpanI can't reproduce it deterministically, but once it happens it sticks around until I get a new repl
21:27xeqimpan: did you recently change namespaces?
21:27muhooxeqi: thanks, i'd seen those. i was thinking mostly of third-party ones. found a few, but have no idea how many there are out in the wild.
21:28mpanuh, I recently evaluated some stuff from the IDE which indirectly changed namespaces
21:28mpanbut I lost core in the process?
21:28xeqimuhoo: I don't know of a listing, and some are built in other libs. friend has some, lib-noir has some, but no global listing :/
21:29gfredericksmpan: (clojure.core/use 'clojure.core)?
21:29tomojmpan: do you call in-ns?
21:29xeqimpan: if it somehow moved to a namespace w/ in-ns(or somethign) and therefore didn't import clojure.core
21:29mpangfredericks: thanks, I'll use that next time
21:29gfredericksmpan: also there is (clojure.core/refer-clojure)
21:29mpantomoj, xeqi: I don't think I did that
21:29gfrederickswhich I think is equivalent...
21:29mpannot intentionally at least
21:30tomojns does (refer-clojure) so that shouldn't happen unless you create a new namespace without using ns
21:30tomojunless you have (:refer-clojure :only [+]) or something...
21:30mpanI suppose I'll wait until it reoccurs to test
21:30mpanthanks guys
21:30xeqiI've had it happen on nrepl 0.1.3, but usually it manifests as an autocomplete error
21:31xeqi* nrepl.el
22:09arrdemI've got a working program which generates Clojure code, is there some library settings for pprinting code, or do I just have to mess with it?
22:10gfredericksarrdem: http://bjeanes.com/2012/09/pure-evil
22:11xeqiarrdem: you mean to change clojure.pprint/pprint ?
22:12arrdemxeqi: I know that clojure.pprint/code-dispatch will print a compiled Clojure fn
22:13arrdemwhat I want to do is achieve a similar pprint for the un-eval'd list representation of a legal fn
22:13arrdemmeh... I guess I can just (map pprint)
22:13xeqi(pprint (quote ...)) ?
22:15arrdemnvm the standard pprint invocation is good enough. I was just looking at ways to tweak the formatting rules, not prevent evaluation of my gen'd code
22:30nsxtanyone successfully using cemerick's friend lib?
22:30brehaut~anyone
22:30clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
22:30brehauthttp://nelsonmorris.net/2012/09/01/using-friend-in-clojars.html
22:32nsxti'm getting this stack trace when loading it as a dependency: https://www.refheap.com/paste/5e7034ed66be1bbeedf466b91
22:36xeqinsxt: whats your project.clj look like?
22:37xeqior.. try https://github.com/xeqi/lein-pedantic to see if the wrong version of a lib is being used
22:38nsxtxeqi: sorry, should have posted that as well. https://www.refheap.com/paste/60fb868fbd1f0bb01ca3de56d
22:38nsxtchecking, thanks
22:39xeqinsxt: let me know if it helps, always interested to hear usage
22:41mpanI'm trying to do something that in java would use abstract classes
22:41mpanshould I use a type or a record?
22:41nsxtxeqi: thanks, lots returned by lein-pedantic, will report back when i've worked through them all
22:42mpanlike I want multiple ways of performing a task according to the same signature
22:42mpanand I have a protocol for it
22:42brehautmpan: neither let you inherit anything other than an interface
22:42mpanuh, I can put in the impl manually
22:43brehauti hope you mean 'i can call a function'
22:43mpaner yea
22:43mpanmaybe that was phrased a bit weird
22:44mpanlike, I want to write a few functions which produce different instances of something that follows this protocol
22:44brehauthttp://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
22:45mpanawesome thanks
22:45mpanand when it says, "use a regular map", does that mean the contract should be written in natural language and human-enforced by the programmer?
22:46brehautit means dont define a new type, just use a map instance
22:46mpanand uh, define multimethods?
22:47brehaut"will the type participate in clojure protocols or be associated with performance-sensitive code" -> No -> Use a regular map
22:47brehautthat no is important
22:47mpanthat leaves me with the other part of my goal, though
22:48mpanlike the code that works with these don't know if f or g produced the one they are using
22:48mpanbecause f and g should follow the same contract
22:48mpanso how would I make it transparent to such use?
22:49nsxtxeqi: thanks for lein-pedantic... helped me sort out the dependency issue. from what i can tell, there's no way to specify a 'minimum' version of a dependency... i'm sure this has been brought up numerous times, is there any reason why it's not supported?
22:49brehautmpan: sorry, sleep deprivation is making me it hard for me to follow.
22:49mpanuh, so like, I've got something that's a solver for certain sorts of problems
22:49mpanso f and g are, well java would call them "factories"
22:50brehautso, functions
22:50xeqinsxt: you can with version ranges, but they have other problems
22:50mpanand either one gives you solver, which should follow the same contract
22:50mpanyes, f and g are functions which return a function, and the returned function follows a certain contract
22:50brehautok
22:50mpanand I need it to be transparent to the code that uses the result whether it got its function from f or g
22:50xeqinsxt: in general, the java ecosystem clojure reuses decided to do "soft"/recommended dependencies by default, so its just something to live with
22:51nsxtxeqi: is the recommended course of action, then, to explicitly state the exclusions, and then load the "dependency dependencies" yourself in the project.clj file?
22:51brehautmpan: i dont understand what the difficulty is?
22:52mpanso, in java I would want a solver "object" of one of a number of concrete classes with the same interface that has several "methods"
22:52mpanas in, it should be bundled together
22:52xeqipretty much, I hope thats what I'm hoping the lein-pedantic suggestions told you to do
22:52mpanshould I use a map of fns?
22:52brehautok.
22:52brehautyou can do
22:53brehautor you can define a record for each type of solver and implement a protocol
22:53mpanis there one that's recommended usually?
22:53brehautif the groups of functions are static, probably protocols
22:54mpanuh well, they take a game state and some extra args, and return a new game state, approximately
22:54brehautso make the records take gamestate, and each of the protocol methods return a new gamestate
22:55mpanis there a general recommendation whether to do this with a map or a record? I'm not sure whether it would help me to make a separate protocol
22:55mpanoriginally, I made one but I'm not sure if it is necessary
22:55brehautif you only have one record type, its probably not necessary
22:56mpanall right, thank you very much!!
22:56owenjones(defpage "/todos/" []
22:56owenjones (todos-page))
22:56owenjones(defpage "/todos.json" []
22:57owenjones (resp/json (todo/all)))
22:57owenjoneshello all, Im trying to learn noir I assume there's a better way to do this?
22:57brehautmpan: you can use operations like assoc and update-in on records to get new records back, so its pretty trivial to make protocol implementations that return new records
22:57nsxtxeqi: yeah, sort of... https://www.refheap.com/paste/5f1dada786fc717c0d9794562 this offers an either/or recommendation, which is great. my question was aimed at the :exclusions keyword in particular, and whether it's considered "good practice" to disregard the versions specified by a dependency and override them with one of your own
22:57brehautowenjones: for future reference, use a paste service like gist.github.com or refheap.com
22:58mpanalso, there is a mention of "performance-sensitive"
22:58mpanhow/to what extent would using a record change performance?
22:59brehautmpan: calls to protocol functions have inline caches at the callsite to make them faster than a pure dynamic call
22:59nsxtxeqi: for example, if i wanted to use cheshire 4.0.2 as a dependency in my project.clj - would i just comb through each of the other dependencies and :exclude cheshire from them?
22:59xeqinsxt: in general, the top level dependencies should win, so you shouldn't have to
22:59brehautmpan: it makes protocols comparable to normal function calls, rather than a lot slower like you might get by indirecting through a map
22:59brehautor in comparison to multimethods
23:00xeqihowever, there are a few times that doesn't happen, and then its useful
23:00nsxtxeqi: alright, thanks. will keep lein-pedantic around then :)
23:00mpanso if this is my inner loop of my game state evaluator, I should use a protocol?
23:00brehautif its polymorphic yes probably
23:00mpanless so a game and more so a simulation, but I suppose the two are similar in the abstract
23:01mpanuh, yes, my main goal is to implement multiple concrete "solution concepts"
23:01mpanall right, thank you!
23:03brehautmpan: i hope i havent said too much craziness
23:03mpanadditionally, should I be type-hinting my inner loop?
23:03mpanit needs to run ~10-100k iterations
23:03brehautonly once you know you need to
23:03mpanwhen would I find out?
23:03brehaut(enable *warn-on-reflection*)
23:03mpanand do that after I have initial correctness?
23:04brehautdo it when you have determiend its running to slowly and its correct
23:04mpanthank you
23:04mpanyes, correctness is my first goal