#clojure logs

2014-03-30

00:07coventrycddr``: Maybe something like (s/either (merge {:key1 (s/pred (partial = rval)), :key2 s/Any} other-requirements) (merge {:key1 (s/pred (partial not= rval))} other-requirements))
00:07bjeanesamalloy: is there a way to implement a protocol for java types such that they can be printed in a readable form?
00:08bjeaneslike (URI. "the-url") ?
00:09amalloybjeanes: i mean, you can add a print-method, but that's not actually readable: you have to run code to get '(URI. "x") to produce anything useful, whereas '[(x 1) (y 2)] is a value that the reader can produce
00:09bjeanesah good point
00:09bjeaneswell then... that is copy paste friendly :P
00:12amalloylike i said, print-method
00:19gkoCan I do something like this: (def my-java-class String) then (new my-java-class "string") ?
00:19gkoUnable to resolve classname
00:20amalloyno
00:21gkook thanks
01:36mskoudAnyone coming from Haskell? Any thoughts on the tradeoffs?
01:49anildigi_hi guys..
01:50anildigi_Joy of Clojure or Joy of Clojure second edition?
01:50anildigi_Which book should I read?
01:55bob2second
03:03devnbob2: both
03:03devnanildigital: both
03:09bob2devn, why so?
03:16chareWhen is the clojure startup time going to get fixed?
03:18Rosnecchare: I was thinking about this today
03:18Rosnecthe reason it takes so long is because of the bootstrap process
03:18chareoh good Rosnec you understand the details of the problem, so now we can unload and hound you until you fix it
03:18Rosnecif the compiler could somehow reduce the bootstrap rpocess to only what's necessary
03:19Rosnecit might be faster
03:19Rosnecidk if that's even possible though
03:19Rosnecit takes so long because it has to load clojure.core
03:19chareRosnec does scheme and racket have slow startup time, if not WHY?
03:20Rosnecall of it, from what I understand
03:20Rosneci dont know
03:20RosnecI've only really used Common Lisp and Emacs Lisp outside of clojure
03:20Rosnecemacs lisp isn't really comparable
03:22chareits so messed up that clojure has the slowest startup time of the lisp dialects
03:22charethat is just WRONG
03:22FrozenlockWith, or without the jvm started?
03:22charejvm isn't the problem
03:23Rosnecthe reason clojure takes so long is because the language has to be built from a small number of functions, written in java
03:23Rosnecand that happens every time you start clojure
03:23Rosnecalthough, if you have a repl running already, I bet you could make it faster somehow
03:23RosnecI have no idea how
03:26anildigitaldevn: why both books?
03:56scottjchare: https://github.com/galdolber/clojurefast people are working on it
04:58mercwithamouthhas anyone here used liftweb and thought about/experimented with a view first pattern with compojure?
05:16ptcekI am following omtut-starter and got stuck on om/build-all. I don't get the following snippet and it's output: http://pastebin.com/ZQZnij31 What I am overlooking?
05:58charewhat do you guys think of the book "Web Development with Clojure" and the library choices it makes?
06:00scottjchare: be more specific. it has been well received.
06:02charescottj ok so I'm not going to find out that ring,compojure,hiccup,noir,liberator is like the old obsolete way of doing things
06:04scottjchare: ring, compojure and hiccup are timeless. the others, who knows.
06:05charewhat does that mean
06:05dark_elementchare, noir has been discontinued but other than that rest of the things are not obsolete.
06:05charewtf do you mean noir has been discontinued?
06:05charethe book uses noir and the book isn't that old!!!
06:05dark_elementchare, read the first line. https://github.com/noir-clojure/noir
06:07chareoh I was calling lib-noir the name noir
06:07charedidn't realize there was two separate existing things
06:07dark_elementchare, all good things from noir moved to lib-noir which can be used with compojure.
06:11bob2let's freak out without reading any details!
06:12dark_elementheh. when in doubt rtfm.
08:05martinklepschhey, I'm trying to parse something patents from the USPTO which look something like this: https://gist.github.com/mklappstuhl/df82f4846c4d97639be3
08:07martinklepschparsing that w/ clojure.xml errs because clojure.xml apparently looks for the referenced dtd file — is there any way to not parse that dtd file?
09:30paulswilliamsesqhi all, has anyone any experience in stubbing webservice calls?
09:35gfrederickshaha don't ##(update-in nil "some string" conj 2)
09:35lazybot⇒ {\s {\o {\m {\e {\space {\s {\t {\r {\i {\n {\g (2)}}}}}}}}}}}
09:46luxbockwhen benchmarking between Java and Clojure programs, should I be compiling my Clojure source into a jar to get a fair comparison, or can I simply use the REPL?
09:51ptcekluxbock: compile, nREPL is optimized for fast startup and may be slower when running...
09:53luxbockalright
10:08paulswilliamsesqHiya, any Midje users here?
10:13gfredericksb
10:13gfredericksun-b
10:14gfredericksI just got a POC debug repl working as nrepl-middleware
10:15gfredericksyou can call (break!) anywhere in your code, and it stops there and hijacks the repl so that all future entries get eval'd in that lexical context
10:15gfredericksyou can call (unbreak!) to continue
10:15gfredericksand they nest perfectly well
10:15modulusHi there. I've been wondering hat the recommended way to write web applications is in clojure, since I think noir is sort of not really developed anymore.
10:15modulusis luminus the best way forward?
10:21btbngrwhy is def- ommitted in clojure.core? it seems rather unsymmetrical to have to use metadata there.
10:24AeroNotixyeah.... I always think this
10:24AeroNotixperhaps it'll come one day
10:24Bronsadont count on it
10:25btbngrI don't need to count on it, but. it's still silly.
10:25gfredericksa lot of folk deal with it by avoiding defn-
10:26btbngrbut i like defn-. it's terse.
10:27AeroNotixgfredericks: why do you say that?
10:27AeroNotixThere's plenty of reason for private vars
10:28gfredericksno I mean using ^:private
10:28btbngr(def ^{:private true} foo 6)
10:28btbngr(def- foo 6)
10:28AeroNotixgfredericks: oh you mean just use ^:private instead of defn-?
10:28btbngrwhy.. why would i want to type that? :)
10:28gfredericks(def ^:private foo 6)
10:28AeroNotixbtbngr: fwiw you're making it sound worse
10:29btbngr:)
10:29gfredericksAeroNotix: yeah
10:29btbngryes i am being a bit bit facetious. still.
10:30AeroNotixI
10:30AeroNotixI'm +1 on def- and defn-
10:30luxbockhmm, so I used `lein uberjar` and then ran the resulting file with java -jar ./target/<file>, but for some reason the performance is much worse than when I run it from nREPL
10:31luxbockI thought it would be faster
10:31BronsaAeroNotix: adding def-/defmacro- & friends has been discussed a lot before, Rich and Stu's position is that it will never be added to core
10:31AeroNotixBronsa: do you have a link to those discussions?
10:32luxbockin my -main I call (time (do-work n))
10:32Bronsait's in the ml somewhere, let me search for it
10:32AeroNotixaight
10:32btbngrBronsa: thanks. I'd be interested in the justification
10:32luxbockI know criterium would be better for more accurate benchmarking but the uberjar is running 10x slower than when I ran the function in nREPL
10:33Bronsabtbngr: if I remember correctly it was something among the lines of "we don't like private vars, so the more difficult we can make you make one, the better"
10:35AeroNotixBronsa: but what's the justification for that?
10:35btbngr... that sounds like a justification based on a rather shakey premis.
10:35btbngrpremise*
10:36btbngrwell, rather than have poor Bronsa play devils advocate, let's read the discussion :)
10:36Bronsafound it
10:36gfredericksluxbock: does the function return a lazy seq?
10:36Bronsabtbngr: AeroNotix https://groups.google.com/d/msg/clojure/gNhz72JSIaw/41KAjI6fXQ4J
10:36gfredericksor anything that contains one?
10:37btbngrBronsa: thanks
10:37AeroNotixBronsa: thanks, /me reads
10:37BronsaAeroNotix: there's not much to read
10:37BronsaI don't know if there are more threads where this has been discussed in more detail but that's the only one I could find
10:38AeroNotixBronsa: quite the circular logic in there
10:39btbngryeah, that's really quite crap logic. I'm quite happy deprecating defn- in core and reshuffling the library about a bit to move it OUT of core. *sigh*
10:40AeroNotixOh well
10:40AeroNotixit's not a huge pita
10:40AeroNotixBut yeah, this is one of the few rough edges of Clojure
10:41Bronsahttps://groups.google.com/forum/#!msg/clojure/r_ym-h53f1E/y1S31QXNhcAJ this conversation looks more interesting and offers a few points
10:42btbngr"generally there is not as much reason to use a constant, for example". Unless, y'know. you're using a map as a function, etc... :/
10:43BronsaAeroNotix: btbngr tldr: a reasonable reason (sorry :)) for having no def-, is that in core there are a number of def* macros, def- would only cover one of those
10:43btbngryeah, the namespace explosion part is reasonable. deprecate defn-! :)
10:44btbngrnamespace? macro*
10:45gfredericksthis is a good link to have on hand: http://dev.clojure.org/display/design/Why+Feature+X+Was+Declined
10:46btbngrMore interesting is the "Compiler in Clojure" idea hammock. Is there a place I can find out more about how that is going?
10:47Bronsabtbngr: *ahem* I'm working on it
10:47btbngrI was just looking at 8700 lines of uncommented tree walking java dubbed the "Compiler" and became sad.
10:48btbngrBronsa: hi! I would like to contribute when I have a bit more time!
10:49Bronsabtbngr: every contribution is welcome, right now the "CinC" project is split between a number of libraries: tools.reader, tools.analyzer, tools.analyzer.jvm and tools.emitter.jvm
10:50paulswilliamsesqHiya, I've been trying to combine test a function that uses clj-http to query a restful service with Midje. I've managed to successfully stub a service call using sonian/cartridge in :use-fixtures, but not as a background in Midje. No exception is generated, the function under test is executed but no cartridge is created. Any pointers in where to look?
10:50Bronsayou can find them in the clojure organization page on github
10:50AeroNotixbtbngr: just remember the draconian agreement you need to sign before you commit to Clojure.
10:50zachmassiaIs there an easy way to produce [[1 2] [3 4] [5 6]] from [[1 2] [3 4]] and [[5 6]]?
10:50btbngrBronsa: excellent, thanks very much. Yes, I shall mail off a signature to rhicky personally :)
10:51Bronsagfredericks: I don't think it's that good :/ all I read there is "We might add a feature if it proves good enough. We decide when it's good enough." but doesn't tell you what "good enough" means
10:52gfredericksBronsa: well I can't imagine any sort of explicit rule
10:52BronsaI'd argue that update-in or seqable? would be more useful than say, same? but yet same? has been added to core and update-in/seqable? still live in the mostly forgotten core.incubator
10:53gfredericksupdate-in?
10:53Bronsadurr
10:53Bronsadissoc-in
10:54gfredericksAnd I assume s/same?/some?/
10:54Bronsa.. yeah
10:54BronsaI haven't slept much. It shows
10:57ptcekzachmassia: try this ##(concat [[1 2] [3 4]] [[5 6]])
10:57lazybot⇒ ([1 2] [3 4] [5 6])
10:57zachmassiaptcek: Awesome, thanks :)
10:59gfredericksBronsa: I think I've come to the conclusion that any language design will be upsetting to at least 80% of its users
10:59gfredericksso I mostly just appreciate how powerful libs are and don't worry about what's in core as much except when it really can't be in a lib
11:00luxbockgfredericks:
11:00luxbocknope
11:00btbngrgfredericks: hey. it's lisp. smoothing over the bumps is what it does.
11:00Bronsagfredericks: we agree, I was just nit-picking. Overall clojure.core does a pretty good job
11:00AeroNotixgfredericks: that doesn't really apply to Lisps
11:01gfrederickswe need some mechanism for measuring upsetness over IRC
11:01gfredericksAeroNotix: what doesn't apply?
11:01AeroNotixgfredericks: languages features upsetting people
11:01technomancyBronsa: the rule is if it's needed for datomic it goes in
11:01technomancy(how else do you explain uuid literals?)
11:01gfrederickstechnomancy: clojure.core is rhickey's utility library
11:01AeroNotixWhich kind of is understandable, even if not quite perfect.
11:01gfrederickstechnomancy: I love the uuid literals
11:01AeroNotixgfredericks: lol
11:02technomancygfredericks: I find them hilarious
11:02btbngrheh, yes, but he should really tidy up a bit. "where is it?" "it is all in the desk draw. ALL OF IT."
11:02gfrederickstechnomancy: I use them all the time at work
11:03technomancygfredericks: you use them to name your libraries?
11:03gfrederickslein new #uuid "dce6bfa3-fa9b-4cfb-9579-05f2fa1a0026"
11:03Bronsalol
11:04technomancyusing your gherkin-based shell
11:04gfredericksmost of these arguments boil down to "X is useful" "no it isn't" "I hate you"
11:06btbngryes but CL throw everything in a single namespace... now look.
11:06btbngrthrew*
11:06technomancywell, uuid literals are pretty awesome compared to the only other reader literal that ships with clojure
11:06btbngrdeprecate symbols!
11:07technomancyas reader literals go, they're better than average.
11:09technomancygfredericks: are uuids as strings prevalent enough in your system that you see significant memory savings by switching to uuid objects?
11:09gfrederickstechnomancy: the literal itself is fine, it's the default reader you're offended by
11:09gfrederickstechnomancy: do you like using dates as strings too?
11:09technomancygfredericks: I'd take it over j.u.Date any day
11:09gfrederickscompared to e.g. Joda
11:10gfredericksit's not just memory savings; I like the semantics of it
11:14gfrederickspresumably also time savings when comparing
11:16technomancybut yeah, it's not that I find them silly on their own; just the way they are bundled with clojure and were used to introduce the concept of reader literals themselves is weird.
11:16technomancyplus the fact that reader literals make the reader unsafe even with *read-eval* off makes me sad
11:26gfredericksunsafe in that reading edn can cause any code that you explicitly set up to run?
11:28technomancyno, I mean the actual reader is unsafe to run on user-provided code due to reader literals
11:29hyPiRiontechnomancy: well, only the reader literals you've provided, right?
11:29technomancyhyPiRion: no, an attacker could run arbitrary constructors
11:29upwardindex,(ProcessBuilder. “ls”) ;; No matching ctor?
11:29clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ?ls? in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:30hyPiRiontechnomancy: with edn or the clojure reader?
11:30technomancyhyPiRion: with clojure.core/read
11:30Bronsatechnomancy: that's because of the record literals, not because of tagged literals
11:30hyPiRionright, that's always funny
11:30technomancyBronsa: oh right; sure. in my mind they're closely intertwined.
11:32Bronsawell record/deftype literals are at all effects read-time constructor invocators..
11:32BronsaI wonder why they weren't limited to IRecord/IType constructors
11:32technomancyfiled under "weird stuff I don't see the point of"
11:32Bronsathat would solve most issues
11:32andyf_G'day, folks. Good to see the channel topic version number updated.
11:34andyf_Bronsa: Thanks for the heads up on tools.analyzer changes. By any chance, do you keep a list of Clojure compiler vs. t.a(.jvm) behavior differences somewhere (besides in your head)?
11:35Bronsatechnomancy: yeah, I don't think I have ever used a record literal in code, but it's definitely nice that they print that way
11:35yedidoes console.pprint or something exist for cljs
11:35Bronsaandyf_: no and I should really write one
11:36andyf_I guess TANAL tickets and email you sent to Mr. Baldridge would be a start.
11:36Bronsathat and some actual documentation :/
11:36yediinspecting complex maps in cljs is a pain
11:36andyf_After Tim's talk, we should ask whether he is willing to write the docs :-)
11:37andyf_I'll file a ticket adding a link to his talk to the README
11:37Bronsagood idea
11:39technomancyBronsa: yeah, I just wish it used *read-eval* behind the scenes so there could be a way to keep it safe
11:39gfrederickstechnomancy: does this apply to clojure.edn?
11:39Bronsatechnomancy: doesn't some *read-eval* value affects the record literal too?
11:40BronsaI don't remember, I thought there was something for that
11:40gfredericks,(defrecord Phil [])
11:40clojurebotsandbox.Phil
11:40gfredericks,(Phil.)
11:40clojurebot#sandbox.Phil{}
11:40gfredericks,(clojure.edn/read-string "#sandbox.Phil{}")
11:40clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.edn>
11:40Bronsa,#sandbox.Phil{}
11:40clojurebot#<RuntimeException java.lang.RuntimeException: Record construction syntax can only be used when *read-eval* == true>
11:40gfredericks,(require 'clojure.edn)
11:40clojurebotnil
11:40Bronsathere
11:40gfredericks,(clojure.edn/read-string "#sandbox.Phil{}")
11:40clojurebot#<RuntimeException java.lang.RuntimeException: No reader function for tag sandbox.Phil>
11:41Bronsahttps://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader.clj#L617
11:41Bronsagfredericks: I don't think edn has record syntax
11:42gfredericksso this really only applies to things like eval services that are probably already conscious of *read-eval*
11:54gfredericksoh speaking of inconsistencies with def macros -- apparently defonce doesn't even take a docstring
11:56bodie_anyone have a recommendation for a /really great/ clojure book?
11:56bodie_I have probably 15 years of experience programming, just never used a functional language
11:56gfredericksI've never heard a single bad thing said about the oreilly book
11:58modulusjoy of clojure seems ok to me
11:59btbngryeah it's not bad
12:01gfredericksI think this debug repl thing is going to actually work
12:01winkjoy of clojure is good, but not sure it's a good first clojure book
12:01ambrosebsgfredericks: what's that?
12:02gfredericksambrosebs: an nrepl-middleware I'm building; you call (break!) and it essentiall transfers your repl to the breakpoint
12:02gfredericksessentially
12:02ambrosebssweet
12:03gfredericksit's turning out only moderately haxy, which is a lot less than I was expecting
12:03gfredericksalready supports nesting
12:09gfredericksmost of the haxiness is around having multiple nrepl sessions but letting the client pretend there's just one
12:10gfrederickssince I don't think clients tend to support the idea of the server opening new repls for them
12:12yediis there something like a print-let, that pretty prints all the binded vars when theyre made
12:14gfredericksdon't think so
12:26plaeremansHello there I would like to fork clojure.java.jdbc, do some modifications and produce a pull request, what is the best way to this wit a leiningen project ? I would like to test my modified version first ?
12:27plaeremansbut can i modify that project and test it in another one, without recompilation
12:28andyf_plaeremans: If it is important to modify your local java.jdbc without recompiling it, and test it using a different Leiningen project, Leiningen has a 'checkouts' directory you can put your modified java.jdbc into
12:29plaeremanscool
12:29andyf_But modifying your local copy of java.jdbc and doing 'lein install' into your local Maven repo is pretty quick and easy, too, and then the other project you use to test it just needs to use the same version number as your locally-installed copy.
12:30plaeremansandyf, ok but I would love to remove the roundtrip time of that
12:30plaeremansthan i don't have to restart my repo to test the modifications
12:30ambrosebsplaeremans: java.jdbc patches much go through Jira http://dev.clojure.org/jira/browse/JDBC
12:30plaeremansdatabase connections to test it with is configured in anther project
12:31ambrosebsplaeremans: also you need a Clojure CA http://clojure.org/contributing
12:31andyf_http://stackoverflow.com/questions/7411326/clojure-lein-how-do-i-include-source-from-another-directory-in-my-project has some Q&A, and a link to the Leiningen docs on checkouts
12:31gfrederickshttps://github.com/fredericksgary/debug-repl
12:31plaeremans@andyf_ thanks, the ticket is already there : JDBC-64
12:31plaeremansBut I fought I could implement it myself and submit a pull request
12:32plaeremansIt will probably be rejected if I get to it
12:32plaeremansbut when I do and there is feedback I'll learn something
12:32andyf_You can submit a patch with tests without having sent in a Clojure CA first, but the patch cannot be incorporated into java.jdbc without Clojure core folks having that on hand.
12:32plaeremansoh yes I forgot about that
12:32andyf_Pull requests will definitely be rejected.
12:33andyf_Sean Corfield might be willing to give you feedback either way, depending upon his interest level and time available.
12:33andyf_But it becomes more interesting for him if you have the CA submitted, and there is a chance your changes might make it in.
12:34plaeremansWhy will pull requests be rejected isn't that the way to contribute code ?
12:34plaeremansI see on the clojure website that patches should be submitted via jira
12:35andyf_For Clojure itself, Rich Hickey prefers to review patches rather than pull requests. He says it is an easier workflow for him.
12:35andyf_For other Clojure libraries, I think there is the desire to make the process consistent across them.
12:39Rosnecso I have a question about conventions
12:39Rosnecsay there's a variable, foo, within the scope I'm working in
12:40Rosnecand I have some map that I want to destructure
12:40Rosnecand that map has a value :foo
12:40RosnecI want to preserve both foo's
12:40Rosnecwhat's the conventional way of doing so?
12:40RosnecI know I could do (let [old-foo foo, {:keys [foo]} m] ...)
12:41Rosnecis there a better way?
12:41Bronsano other way if you want to use :keys
12:41stcredzeroSo, am I right in assuming that atoms that never experience thread contention are very low overhead?
12:42BronsaRosnec: what you could do however is (let [{foo' :foo :keys [..]} map] ..)
12:44stcredzeroAlso, is there any overhead that comes from having too many atoms in memory at once? (In order to assure no threads are contending for that atom)
12:45RosnecBronsa: so you're saying just use :keys for everything but :foo, and specify what to call :foo?
12:45RosnecI guess that makes sense
12:45Bronsayeah
12:46Rosnecis there a way I could use :keys and have a prefix added to everything?
12:46Bronsano
12:46Rosnecok
12:51bbloomstcredzero: atoms use simple compare and swap
12:52bbloomstcredzero: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Atom.java
12:53bbloomstcredzero: the overhead is essentially that of an AtomicReference, which has JIT support for producing machine primitives for atomic CAS
12:58stcredzerobbloom: cool. So that means there's little overhead, even in the face of thread contention.
12:58bbloomstcredzero: essentially, yes
13:01Anderkentstcredzero: the overhead when thread contention is high will probably come from repeatedly rerunning the update function, rather than the compare-and-set
13:12shiranaihitoanyone know what this is about: "IllegalAccessError: Key does not exist" when i try to require "Key" like this: "[c2d.localization :refer [Key]]" ?
13:13shiranaihito("Key" is a record in "localization.clj")
13:13bbloomshiranaihito: records aren't vars
13:13bbloomshiranaihito: for example:
13:14bbloom,(defrecord Point [x y])
13:14shiranaihitohm
13:14clojurebotsandbox.Point
13:14bbloom,#'Point
13:14clojurebot#<CompilerException java.lang.RuntimeException: Expecting var, but Point is mapped to class sandbox.Point, compiling:(NO_SOURCE_PATH:0:0)>
13:14bbloomsee?
13:14shiranaihitoso how do i "import" it then? :P
13:14bbloomyou can refer with the ->Foo factory method
13:14bbloom,(->Point 5 10)
13:14clojurebot#sandbox.Point{:x 5, :y 10}
13:15bbloomif you need the class object for instance? or something like that, you can use a fully qualified name (after requiring the namespace) or you can (i think) use :import like any other java class
13:15shiranaihitohmm
13:16shiranaihitowhat does it mean to "refer with factory method"?
13:16ambrosebsBronsa: do you do anything fancy working with 2 tools.analyzer repos simultaneously?
13:16ambrosebsworth the pain?
13:16bbloomshiranaihito: (:require your.code :refer [->Foo])
13:16bbloom(doc ->Point)
13:16clojurebot"([x y]); Positional factory function for class sandbox.Point."
13:16shiranaihitooh.. and then i can do (Foo. x) ?
13:17bbloomshiranaihito: #'->Foo is a var that simply calls new Foo with the same arguments
13:17bbloomso just do (->Foo x)
13:17shiranaihitook.. well, somehow i find (Foo. x) neater :P
13:18shiranaihitoso i guess i'll try importing it
13:18bbloomshiranaihito: they are different
13:18bbloomconsider:
13:18bbloom,(apply ->Point [5 10])
13:18clojurebot#sandbox.Point{:x 5, :y 10}
13:18bbloom,(apply Point. [5 10]) # no good!
13:18clojurebot#<CompilerException java.lang.ClassNotFoundException: Point., compiling:(NO_SOURCE_PATH:0:0)>
13:18shiranaihitohmm
13:18bbloom,(apply #(Point. %1 %2) [5 10]) # gotta do this
13:18clojurebot#sandbox.Point{:x 5, :y 10}
13:19shiranaihitoaww.. i can't seem to import it
13:20bbloom(doc import)
13:20clojurebot"([& import-symbols-or-lists]); import-list => (package-symbol class-name-symbols*) For each name in class-name-symbols, adds a mapping from name to the class named by package.name to the current namespace. Use :import in the ns macro in preference to calling this directly."
13:20bbloom,(import 'sandbox.Point)
13:20clojurebotsandbox.Point
13:20bbloomseems to work
13:21Bronsaambrosebs: I'm sorry I was having dinner
13:22ambrosebs:)
13:22Bronsaambrosebs: do you mean for dev or when releasing?
13:23ambrosebsBronsa: releasing mainly
13:23ambrosebsBronsa: with dev I assume you can connect them up in a repl somehow
13:24Bronsaambrosebs: the only thing I need to do special is to bump the tools.analyzer dep from SNAPSHOT to whatever I just released before releasing tools.analyzer.jvm
13:24Bronsaand then moving it back to SNAPSHOT after the release
13:24ambrosebsok
13:24shiranaihitobbloom: "ClassNotFoundException: c2d.localization.Key" .. :o
13:24shiranaihitoohh.. that quote there
13:24ambrosebsI'm splitting up core.typed and I'm up to 6 repos. Need to figure out something easier than that.
13:24bbloomshiranaihito: did you (:require [c2d.localization]) first?
13:25Bronsaambrosebs: eh 6 repos might be a pain
13:25shiranaihitobbloom: ah, nope.. damn, this is too complicated
13:26bbloomshiranaihito: the ns form is complicated/silly for sure, but the underlying mechanisms are quite simple. you're missing the key thing: when you define a type, a java class is prodcued and so is a factory function
13:26bbloomshiranaihito: classes work just like any other class, the factory function works just like any other clojure var
13:26shiranaihitommm
13:26Bronsaambrosebs: also when dev I need to remember to mvn install locally tools.analyzer before e.g. reloading a repl so that it pulls the last snapshot
13:26shiranaihitonow it's working but Cursive still shouts about importing "Key" :P
13:27bbloomshiranaihito: the one complication is that classes defined by clojure code are created at runtime, so they don't exist until the namespace they are in is loaded
13:27shiranaihito:/
13:27bbloomshiranaihito: remember, clojure's compiler is actually going to run your namespace file. so you can't possibly import a known java class until you load that file
13:27bbloomshiranaihito: does that clear it up?
13:27shiranaihitoyeah, that makes sense
13:28shiranaihitothanks for the help! :)
13:28bbloomshiranaihito: also, you probably shouldn't have this problem :-P
13:28ambrosebsBronsa: right. there's no way you could do that manually with 6 repos.
13:28bbloomshiranaihito: you should create a real public api
13:28shiranaihitohow so? :P
13:28bodie_any preferred setups? I guess slime/emacs is out of style?
13:28bbloomshiranaihito: don't treat the class itself as part of your interface promise. instead provide a type predicate function and a smart factory function
13:28bbloomshiranaihito: for example, going with the Point record example:
13:28shiranaihitobbloom: well, i'm just using "Key" as a marker for an error returned from a validation function etc
13:28ambrosebsBronsa: I'm finding the separation very valuable, so I'll see how I go on my machine for a while
13:29bodie_i was looking at lein + lighttable but it looks like it uses an outdated version of Clojure.
13:29shiranaihito(and then checking instance? etc)
13:29bbloom,(defn point? [x] (instance? Point x))
13:29clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: Point in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:29bbloomdoh, timed out :-P
13:29bbloom,(defrecord Point [x y])
13:29clojurebotsandbox.Point
13:29bbloom,(defn point? [x] (instance? Point x))
13:29clojurebot#'sandbox/point?
13:29bbloom,(defn point [x y] (Point. x y)) ;TODO: add preconditions to ensure x and y are numbers
13:29clojurebot#'sandbox/point
13:30shiranaihitohmm
13:30bbloomshiranaihito: now later you can just do: (:require whatever :refer [point point?])
13:30amalloybodie_: there's a good clojure plugin for most editors. emacs has a great one, if you already like emacs; i hear vim's is quite good as well; and eclipse, etc etc
13:30shiranaihitowell, that makes sense but seems like extra typing
13:30scottjbodie_: what editor/IDE do you use for most other programming? use that
13:31bbloomshiranaihito: you should be defining so few new types that this extra typing is a marginally small cost in the general case
13:31Bronsaambrosebs: maybe there's some plugin for lein to manage multiple repos
13:31shiranaihitobbloom: mmm.. luckily i haven't gone crazy with Records yet :p
13:32amalloyshiranaihito: bbloom's suggestion gives you more flexibility, too - you don't have to stick with the Point record if you decide you need some other data associated with them
13:32shiranaihitohm
13:32amalloylike, maybe a point holds, as well as its x/y coordinates, a cache of distances to other points. that's easy to add onto the point function without changing its args
13:32amalloybut you'd have to add a new arg to the Point constructor to hold it
13:32shiranaihitoyou mean the "factory method" allows for flexibility if/when needed?
13:33ambrosebsBronsa: true. unsure if I want to maintain 6x pom.xml and 6x project.clj's.
13:33shiranaihitoyep
13:34shiranaihitowell, fiddling with the imports and stuff is so annoying that maybe i'll just write those "extra" functions.. although it doesn't feel very "feng shui" for now :P
13:34ambrosebsI'll play it by ear
13:42elfenlaidehm, kind of silly question :) who knows where source of "`" function can be found or how it called properly? under properly I mean, for example, ' is called quote :)
13:43ambrosebselfenlaid: it's called syntax-quote
13:43ambrosebselfenlaid: grep for that in the Java sources
13:44elfenlaidwow, thanks
13:44ambrosebselfenlaid: good luck :)
13:49dokyhello is here anybody how understands http-kit ?
13:50dokyi want to know to to redirect a request ? it said that follows Ring spec but it can not redirect ... ? does anybody know how to do that?
13:53rberthelthere is a redirect in ring.util.response/redirect
13:56dokyyes i added it to project, but it didn't redirects
14:02Bronsaelfenlaid: you can read https://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader.clj#L521 for an implementation from scratch that mimicks the one used by clojure itself or https://github.com/brandonbloom/backtick/blob/master/src/backtick.clj for an alternative implementation
14:03bodie_amalloy, scottj -- i'm a vimmer but interested in getting into emacs live programming, kinda the lighttable setup via emacs if possible :)
14:03bodie_I saw some cool stuff with emacs tree manipulation that took me by surprise
14:05elfenlaidBronsa, that's interesting, thanks :)
14:08bbloomelfenlaid: the backtick readme also links to my blog which might have some insight in to why/how
14:09elfenlaidbbloom, heh, clojure community is awesome!
14:11whodidthisdoky: return {:status 302 :headers {"Location" "/coolplace"}} in handler
14:13dokythanks it worked also with ring redirect, i did silly mistake but thanks for response :)
14:39stcredzeroAnderkent: are you saying that function call overhead is much larger than atom cmp-set overhead?
14:41bbloomstcredzero: he's saying that the function you give to swap! should do as little work as possible, but no less than necessary
14:42stcredzerobbloom: In other words: "optimize" -- or to be more specific, the duration of the swap function should be short as possible if there may be thread contention
14:44bodie_emacs/clojure newb here, any pointers? I'm looking at CIDER
14:44bodie_cool articles the community loves that I'm unaware of... etc
14:44bbloomstcredzero: based on past discussions and your current line of questioning, i'll be very explicit: do NOT optimize here. you'd be wasting your time in a big way
14:45bbloomstcredzero: if you have a very expensive operation, don't use swap! on a shared atom, since cheap operations may beat you and force you to restart the operation
14:46stcredzerobbloom: so expensive operations are ok on a non-shared atom (or while an atom is only being molested by a single thread)
14:47bbloomstcredzero: i'd probably have chosen a nicer way to say that, but yes.
14:47bbloomstcredzero: the principle is simple: get-value, perform function, compare-and-set. if value changed during those steps, compare fails, retry
14:49bbloomobviously if "perform function" takes too long, other operations can consistently prevent your comparison from passing, forcing you to retry indefinitely
14:49stcredzerobbloom: so changing around one's architecture to ensure that predominantly only single threads are going after one atom tends to be good
14:49bbloomstcredzero: absolutely not.
14:50stcredzerobbloom: you seem to be contradicting yourself
14:50bbloomstcredzero: no, no i am not
14:50bbloomstcredzero: i've been very clear in my guidance each time we've spoke
14:50bbloomyou are prematurely optimizing without measuring in a big way
14:50bbloomi'm explaining the principles to you so that you know what to look for
14:50bbloom... when you measure
14:51stcredzerodid you talk to me previously under a different name?
14:51bbloomatoms are designed to be used by many threads simultaneously
14:51bbloomstcredzero: most recently we discussed pmap
14:52bbloomyou can have dozens of threads hammering on an atom and it will outperform any lock-based solution with ease
14:52bbloombut, as the name "atom" suggests, it's designed for atomic operations
14:52bbloomand atomic is a carefully chosen word, meaning both "small" and "indivisible"
14:52stcredzerobbloom: you have no idea what I am and what I'm not measuring
14:53bbloomstcredzero: if you get defensive again, i'll stop offering my help
14:53stcredzerobbloom: keep in mind that I'm trying to devise a new kind of architecture and I'm not necessarily trying to use these devices for their usual purpose
14:54bbloomstcredzero: if you're trying to abuse the constructs, then you're probably better off using the java.util.concurrent bits that underly them
14:54stcredzeroHow about this: your help is very valuable when you talk about the performance of the components. But beyond that, you tend to jump to conclusions and get preachy.
14:54bbloomok, i'll shut up then
14:55stcredzerobbloom: in other words: please continue to provide insight about the components, but stop >speculating< about what it is I'm doing.
14:56stcredzerobbloom: you have been wrong almost every time
14:58bbloomstcredzero: i'm not saying that this is true about you in person, but you should be aware that the way you write here in irc gives off a very hostile tone. at the conference, somebody said "so how about that pmap thing in irc" and there were several respected folks who expressed disbelief in the way you conducted yourself. if that was unintentional, you should be aware of it and adjust accordingly
14:59bodie_freenode #clojure is a great place to have personal arguments
14:59bbloombodie_: my apologies. stcredzero: happy to discuss privately if you wish to understand/correct. i'll refrain from discussing publicly further
15:00stcredzeroabout the pmap thing: we were taling past each other because you kept saying things that were untrue about what I am designing, because you are speculating about what I am doing. I find that people contradicting me like that comes off as condescending
15:01bodie_not trying to be an ass, just saying. hehe. :)
15:01bbloombodie_: no no, you're right
15:02bbloombodie_: thank you
15:02bodie_I applaud your mature response... I probably would've said something like "NO U!"
15:02konrHow can I find out which Protocols an object implements?
15:03bbloombodie_: mature+blunt is a fine line :-P
15:03amalloykonr: not possible in general
15:03amalloythe information about protocol implementation is stored on the protocol itself, so you'd have to iterate over all existing protocols
15:08tomjackI was going to ask "how do I write clojure.core.async/map" in more complicated terms, then I found it :)
15:09`szxhas anyone had a chance to play around with https://github.com/galdolber/clojure-objc and/or can tell me how viable it is?
15:09`szxjust thought i would ask before diving in
15:24munderwoHi all. Im playing around with Aleph, and am running into some issues. This is what I have so far https://www.refheap.com/69070 . Now when I curl at the server after running "lein ring server-headless" I get 'clojure.lang.ArityException: Wrong number of args (0) passed to: core$handler' .
15:25munderwoIf I run (start-http-server handler {:port 8080}) from the repl it works. But obviously something im doing is not passing the right parameters into the handler. Any ideas?
15:30amalloymunderwo: line 14 is calling (handler) with zero arguments
15:30amalloyyou just want handler, not (handler)
15:31munderwoamalloy: ahhh!
15:31munderwofacepalm!
15:39munderwohmmm. I'd like to use lein-ring . But it seems there is a mismatch between what aleph provides with its start-http-server and what lein-ring wants.
15:40munderwoHas anybody uses these two together?
15:40munderwothis is what I have in my project.clj. https://www.refheap.com/69075
15:41munderwowhen I try use 'lein ring server-headless' and do a request I get 'clojure.lang.ArityException: Wrong number of args (1) passed to: server$start-server$fn'
16:15TravisDDoes anyone know if incanter has a multiple-argument version of $join? Or do I need to write one myself using reduce?
17:27kuppuHi #clojure
17:55Rosnechow is it possible that I can run my program without errors using "lein run", but if I try to compile it to a jar, I get a NullPointerException when trying to compile one of my files?
17:56Rosnecit's happening at the very first line of one of my files, and it's a file that was working well when I just did "lein run"
18:06yotsovRosnec: adding gen-class to the ns declaration maybe?
18:07Rosnecthe ns doesn't have :gen-class
18:07RosnecI should have mentioned that, yotsov
18:07Rosnecmy core.clj has :gen-class, but this is a different file
18:08Rosnecohhh
18:08RosnecI think I might have found it
18:08Rosnecor maybe not...
18:08Rosnecno, that wasn't it
18:09RosnecI found an import to something I removed
18:09Rosnecbut that was in a different file anyway
18:11yotsovRosnec: something to do with a BOM on windows maybe? first-line issue brings this association...
18:12Rosnecnope, running linux
18:23hiredmanRosnec: check all your calls to io/resource, one of them is returning nil
18:23hiredman(or paste bin the whole stacktrace for the npe)
18:26Rosnechere's my stacktrace
18:26Rosnechttp://pastebin.com/8knb7y0L
18:26Rosneci dont know how to show past the "and 49 more"
18:27RosnecI mean "... 49 more"
18:27jeremyheilerRosnec: stack traces are backwards, the 49 more are the lines above
18:27Rosnecoh
18:28Rosnecso that actually is the whole stack trace?
18:28RosnecI always thought it just got clipped of at a point
18:29hiredmanRosnec: put (:refer-clojure :exclude [send]) in your ns form
18:29Rosnecoh
18:29Rosnecis that really it?
18:29RosnecI thought it was just a warning
18:30RosnecI knew there was something like that I needed to get rid of the warning
18:30Rosnecaand it compiles now
18:30Rosneclol
18:30Rosnecwell I won't make that mistake again
18:30hiredmanI am not sure, there are some bugs ragarding overriding the vars from clojure.core and aot compiling
18:31jeremyheileryeah
18:31jeremyheileroops
18:31jeremyheiler(wrong room)
18:32kuppuWould anyone be able to help me understand the difference between a vector and a list?
18:32kuppu"lists are used for code and vectors for data". What's that supposed to mean?
18:32brehaut$seen dnolen
18:32lazybotdnolen was last seen quitting 6 weeks and 6 days ago.
18:32Rosnecyou write your source code with lists
18:33Rosnec(+ 2 2) is a list with the elements + 2 and 2
18:33Rosnecif you want a list of data instead, use vectors
18:33kuppuHmmm
18:33Rosnecsay you want to store a bunch of (x, y) pairs
18:33kuppuYeah
18:34Rosnecyou should have them in vectors [x y]
18:34Rosnecor some other kind of seq
18:34hiredmanhttp://dev.clojure.org/jira/browse/CLJ-1392
18:34Rosnecbut if you're going to literally write out the elements
18:34Rosnecyou should do it with a vector
18:34kuppuAlright, let me digest this for a bit haha
18:34Rosnecso don't do this: '(x y)
18:34Rosnecdo this: [x y]
18:35BronsaRosnec: more specifically http://dev.clojure.org/jira/browse/CLJ-1241
18:35Rosnechiredman, Bronsa: thanks
18:36Rosnecgood to know it's a bug and not me being stupid
18:36hiredmanwell, aot compilation is full of that kind of stuff, best to not do it
18:36kuppuRosnec: thanks for the help :)
18:37Bronsa.. or we could juxt fix it
18:37Rosnecyeah, lol
18:37Rosnecunless you're saying aot is just not ready for use yet
18:38hiredmanBronsa: go a head, given that aot is rarely (if ever) required I've got another things to do :)
18:39Rosnecit makes launching your program faster, once it's compiled
18:39hiredmaneven if that issue is fixed, aot compilation still generates classes files for transitive namespaces, which can break things, and once you fix that, the aot'ed class files still won't be abi compat with different version of clojure
18:40hiredmanetc etc
18:40RosnecI'm mainly just doing it because I'm writing a client/server program, and if I don't AOT compile on one machine, I have to compile on both machines every time I run it
18:41hiredmanI am not sure the current aot should be "fixed" maybe it should be redesigned and replaced
18:41hiredmanRosnec: no you don't
18:41Rosnecit's quicker to make a jar and scp it than to push to git, pull on the server, and use "lein run" on both sides
18:41hiredmanugh
18:41Rosnecis there an easier way?
18:41hiredmandon't use git for deployments
18:41hiredmandon't stick jars in git
18:41RosnecI'm not sticking jars in git
18:41hiredmandon't use lein run to run your servers
18:42Rosnecthen what do I use?
18:42jeremyheilerRosnec: package your clojure code in a jar (it doesn't need to be aot compiled) and run it with java -jar
18:42hiredmanon your build machine use lein uberjar (which doesn't require aot compilation) then use java -jar the-uber-jar.jar clojure.main -m your.main.namespace to run it
18:42RosnecI'm using lein uberjar
18:43Rosnecactually, I think i set the :aot option in my package.clj without really thinking about it
18:43hiredman-m will look for a -main method, like gen-class uses, but -m doesn't require aot compilation
18:43Rosnecno wait, I didn't set the :aot option at all
18:44Rosnecthen why is lein uberjar doing aot?
18:44hiredmanRosnec: :main (in some versions of lein) implies :aot
18:44Rosnecoh
18:44RosnecI think I read that before
18:44hiredmanbecause :main sets the main class in the jars manifest, and for their to be a class there needs to be aot
18:45Rosnecah
18:46hiredmanthere
18:46danielszmulewiczseancorfield: ping
18:47Bronsahiredman: meh. if there's a bug we should fix it regardless.
18:48technomancyor just fix your code so you don't get that warning
18:48Bronsaalso that bug is not really specific to AOT, try to eval (let [] (def inc #(+ 1 %))) in your repl
18:49technomancyAOT causes all kinds of problems in development, but it's perfectly appropriate to do during deployment as long as you don't shadow core vars like it tells you not to do
18:49technomancyand as long as you start afresh every time
18:49Bronsathe only real bugs that I encountered that are AOT specific are ClassLoader related
18:50hiredmanBronsa: there are bugs and there are hazzards
18:52hiredmanBronsa: the transitive compilation is a real problem if you have an aot'ed app that you then want to use as a library in another app, but that other app needs to specify a different version of some library the first depends on
18:53hiredmanwhich if the library is backwards compatible should be fine, but because of transitive aot compilation, you'll have two versions of the library on the classpath
18:54hiredmanthese are all problems I've run into at work in the past two weeks
19:12bodie_i noticed the lein plugin for lighttable is using an outdated version of clojure
19:12bodie_I was going to try and set up everything around lighttable but now I'm not so sure
19:16brehauti may well be wrong, but i dont think the version of clojure lein uses impacts the version you use in your own program
19:16michaniskinbodie_: https://groups.google.com/forum/#!topic/light-table-discussion/FnM4lwYA2eI
19:17michaniskinsorry disregard :/
19:20bob2lein by default invokes a new jvm for your app
19:38munderwoHi all. So I want to turn this vector [0 1 2 3 4] into {:0 0 :1 0 :2 0 :3 0 :4 0}
19:38munderwoso far I have (map #(assoc (keyword %1) 0 temp) [0 1 2 3 4])
19:38munderwowhich gives me ({0 {}} {0 {}} {0 {}} {0 {}} {0 {}})
19:40bjeanesmunderwo: you might want to use (reduce) with an initial empty {}
19:41bbloom,(into {} (map (juxt keyword identity) [0 1 2 3 4]))
19:41clojurebot{nil 4}
19:42bjeanes,(reduce #(assoc (keyword %2) 0 %1) {} [0 1 2 3 4])
19:42clojurebot{0 {0 {0 {0 {0 {}}}}}}
19:42bbloomhm
19:42bjeaneser.. lol nope
19:43bbloom,(into {} (map (juxt (comp keyword str) identity) [0 1 2 3 4]))
19:43clojurebot{:0 0, :1 1, :2 2, :3 3, :4 4}
19:43bjeanesexcept munderwo wants the value to always be 0
19:43bjeanesso not identity
19:43bbloombjeanes: oh, i misread. *shrug* juxt constantly is getting ugly :-P
19:44bbloom,(into {} (map (juxt (comp keyword str) (constantly 0)) [0 1 2 3 4]))
19:44clojurebot{:0 0, :1 0, :2 0, :3 0, :4 0}
19:44bbloombut better:
19:44amalloymunderwo: why do you want (keyword "0") as your key? just 0, the number, would be the usual thing
19:44bbloom,(into {} (for [x [0 1 2 3 4]] [(-> % str keyword) 0]))
19:44clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: % in this context, compiling:(NO_SOURCE_PATH:0:0)>
19:44bbloom,(into {} (for [x [0 1 2 3 4]] [#(-> % str keyword) 0]))
19:44clojurebot{#<sandbox$eval259$iter__260__264$fn__265$fn__266$fn__267 sandbox$eval259$iter__260__264$fn__265$fn__266$fn__267@8ed62> 0, #<sandbox$eval259$iter__260__264$fn__265$fn__266$fn__267 sandbox$eval259$iter__260__264$fn__265$fn__266$fn__267@18f143> 0, #<sandbox$eval259$iter__260__264$fn__265$fn__266$fn__267 sandbox$eval259$iter__260__264$fn__265$fn__266$fn__267@18790d7> 0, #<sandbox$eval259$iter__260__2...
19:45bjeanesyikes
19:45bbloomok i'll stop coding in irc, i'm bad at it :-P
19:45munderwoumm.. It might be through ignorance? I want it to be a counting mechanism for a list of things that I have. So I can inc :0 when the zeroth element gets used etc.
19:45bjeaneshahah clojurebot accepts PMs I just realized
19:45bbloom,(into {} (for [x [0 1 2 3 4]] [(-> x str keyword) 0]))
19:45clojurebot{:0 0, :1 0, :2 0, :3 0, :4 0}
19:45bbloomthere we go :-P i suck.
19:45bjeanesI'm too lazy to use a repo so apparently clojurebot just became my private repl
19:45bjeaness/repo/repl
19:45bbloommunderwo: you can simply use numbers as keys... this isn't javascript! :-)
19:46munderwoahh ok. didnt realise that :)
19:46bbloommunderwo: also, if your keys are a dense indexes, you can just use a vector as a map directly
19:46bjeanesbut at that point why are you using maps?
19:46bbloom,(update-in [0 0 0 0 0] [2] inc)
19:46clojurebot[0 0 1 0 0]
19:46bjeanesyes that
19:46munderwoYeah. I just like maps I guess :)
19:46munderwocool. well i've learnt two things today :)
20:20chareDo you guys use lib-noir for validation even though using the following functions result in code based on side effects not pure functions [noir.validation :refer [rule errors? has-value? on-error]]
21:30DomKM,(str (char 0))
21:30clojurebot"
21:30DomKM,(= "" (str (char 0)))
21:30clojurebotfalse
21:30DomKMwhy?
21:30clojurebothttp://clojure.org/rationale
21:31DomKMheh, I didn't realize clojurebot responded to "why?"
21:31jeremyheiler,(count (str (char 0)))
21:31clojurebot1
21:31nightflywhy not?
21:32DomKMWhy is "" not email to (str (char 0))?
21:32DomKMgah, I'm tired. Not *equal* to
21:32jeremyheilerbecause empty is different than something that isn't
21:32jeremyheilerthe char 0 is not a displayable character
21:32jeremyheilerso it appears empty in a repl
21:33DomKMjeremyheiler: ah, got it. Thanks
21:34AmandaCJava Strings can contain embedded nulls, so I assume that Clojure ones can too. so (str (char 0)) is presumably making a string of length 1 with a null as the sole char
21:36DomKMHow can I filter invalid chars ( (char 0), (char 1), etc. ) from valid chars ( (char 42) )?
21:38kuppu_Whoa, there's a clojure bot that runs clojure code?
21:38jeremyheilerDomKM: You can filter based on char ranges, whcih you can identify by looking at an ascii chart. Though, perhaps you could explain why you want to do that in the first place?
21:40DomKMjeremyheiler: Thanks, that's what I'm doing now. I'm using LevelDB and need to be able to pick a larger char to set an end point for an iterator.
21:41jeremyheilerwhat do you mean by larger? higher integer value? also, compared to what?
21:42DomKMjeremyheiler: Yes, higher integer value, I believe. LevelDB sorts keys in lexigraphical order
21:45amalloyDomKM: in that context i don't see why you would care about the difference between (char 1) and (char 42). both work fine as a byte value that you can use as the endpoint for an iterator
21:46DomKMamalloy: I suppose that's true. Hadn't considered that, thanks.
21:55startlingcan I use a type from defrecord in Java?
21:58brehautstartling: i think yes but maybe requires some AOT shenanigans?
22:29amalloystartling: yes, but as brehaut says you have to AOT your stuff. plus, records aren't a ton of fun to work with from java anyway. consider whether you can instead produce an interface containing the methods that java folks would care about, and then provide a way to get instances of that interface
22:30startlingamalloy, that's possible.
22:30gfredericksamalloy: you are gooder at answering this question than I am
22:30startlingWhat I'm trying to do is
22:30gfredericks,(doc definterface)
22:30clojurebot"([name & sigs]); Creates a new Java interface with the given name and method sigs. The method return types and parameter types may be specified with type hints, defaulting to Object if omitted. (definterface MyInterface (^int method1 [x]) (^Bar method2 [^Baz b ^Quux q]))"
22:30amalloygfredericks: nahhhhhh, just include a Foo.java file in src/java and let lein build it
22:30amalloydefinterface is a compromise that just makes the clojure guys *and* the java guys sad
22:30startlinghave some Java code return a clojure-native data-structure rather than a Java one, since that's a little bit nicer.
22:31startling(I'm writing some Java to interact with a Java library).
22:31amalloystartling: they can just use clojure.lang.RT/map to build a map. it doesn't have to be a record
22:34amalloyor you can provide a clojure function that builds whatever datatype you want, from args that are convenient in java, if building a map from scratch is too hard
22:34startlingamalloy, that's not a great solution; I'm using a defrecord since I'd like do dispatch on types.
22:34startlingamalloy: hm, that's possible.
22:35amalloyreally, using a record's constructor as part of a public API is tacky, even in clojure (see: bbloom's discussions earlier today)
22:35amalloyput a function in between and you're more flexible and more convenient
22:37startlingthat's a good point. thanks!
22:45gfrederickstools.nrepl has a good readme
22:45gfredericks(inc cemerick)
22:45lazybot⇒ 16
23:20luxbockany help appreciated: http://codereview.stackexchange.com/questions/45796/translating-cfrm-algorithm-from-java-to-clojure-improving-performance
23:25amalloyluxbock: use a profiler, figure out where the time is being spent, and then focus on that area
23:26luxbockwhat's a good profiler to use?
23:27milindaI am using a priority-map inside a atom
23:28milindabut it type got changed in after couple of swap! calls
23:28milindaanyone has any idea what can go wrong here
23:32bbloommilinda: have you tried modifying your swap! calls to print out their inputs/outputs or the classes of their inputs/outputs?
23:35milindabbloom: looks like the content of atom becomes nil in the middle
23:36milindabbloom: I'll check whether this is a big from my side
23:39milindabbloom: it was a bug in my code. Missing else. Thanks!
23:41charewhat does {::file (file (str (io/resource-path) "/home.html"))} do in https://gist.github.com/anonymous/9884811
23:59amalloywell, ::file is a keyword, namespaced in the current namespace. so it returns a one-element map, whose key is :liberator.whatever/file, and whose value is a File object returned by file