#clojure logs

2014-03-06

00:00mischovdissipate: Pedestal is also undergoing a bit of a redesign.
00:00ddellaco_dissipate: I remember it being pretty good actually. My only objection to Pedestal for a beginner is that it is super magical.
00:00ddellaco_mischov, dissipate: yeah, and it was in flux too, I recall...better to wait for v3 (0.3? forget)
00:00dissipateddellaco_, well, magic is awesome. :P
00:01mischovdissipate: It's not only magical- it's complicated (to me, at least).
00:01ddellaco_dissipate: I'm not dissing Pedestal--I think it is pretty incredible and smart, but it is hard to wrap your head around if you are just coming into Clojure and want to make a web app.
00:01dissipateddellaco_, gotcha.
00:02ddellaco_mischov: yeah, I'm on the fence. I think it is complicated for some good reasons, but I haven't used it enough to develop a well-formed opinion.
00:02ddellaco_or at least, was...we'll see how the new version looks.
00:03dissipateddellaco_, do you think it would be worth it to write a clojure based wrapper utility that implemented a better 'shuffle' and perhaps other random functions? it would allow you to choose different sources of entropy such as random.org.
00:04mischovddellaco_: Agreed. A lot of great ideas in it. I keep googling for how to do something I think might be a good idea only to find pedestal already did it.
00:04mischovddellaco_: But it's so far beyond where most people are that it's not funny. And that makes it really hard to get started with.
00:05dissipatemischov, where most clojure developers are or developers in general?
00:05ddellaco_dissipate: isn't there anything out there already? Honestly haven't had much of a need for it myself, I may be the wrong person to ask.
00:06dissipateddellaco_, not that i have found yet
00:06ddellaco_mischov: yeah, that's exactly my feeling. That's why I try to suggest people start with very basic Ring/Compojure apps. I even think Luminus or Caribou are too much, but I recognize opinions vary...
00:06mischovdissipate: Clojure developers in particular. But ahead of the curve in general.
00:06segmondwhat about noir?
00:07ddellaco_segmond: Noir is discontinued. And Noir has (had) a lot of patterns in it which I really don't like, it is very stateful.
00:07dissipatemischov, how powerful is pedestal compared to other non-clojure frameworks like ruby on rails?
00:07segmondoh okay, thanks. i was just searching for clojure web frameworks, so just in time.
00:08MattAbbottthis is going to sound silly, but how hard is it to pick up something like ring/compojure if I basically no web experience?
00:08ddellaco_segmond: yeah, again, I would really suggest starting with the examples in the Compojure wiki, reading through the Ring docs to see how requests, response handlers, responses and middleware works, and then expanding out from there. That will give you the best grasp of the basics.
00:09dissipateddellaco_, sounds like MVC stuff
00:09ddellaco_MattAbbott: I think it's not too hard, but I don't have a great sense of how hard it may be for a beginner. I would just check out the wikis and see how you feel about it (https://github.com/ring-clojure/ring/wiki https://github.com/weavejester/compojure/wiki)
00:09Denommusddellaco_: what about this "app-handler" function from noir? What does it do?
00:10nopromptsegmond: fwiw, i would avoid frameworks. just try to build your app from the ground up. you'll get more out of that.
00:10segmondnoprompt, why is that?
00:10Denommusddellaco_: ah, only saw your opinion now
00:11DenommusI'm going to sleep now
00:11ddellaco_Denommus: dunno honestly, but based on the Luminus docs, seems like it is wrapping up some of Compojure's app helpers: http://www.luminusweb.net/docs/routes.md#organizing_application_routes
00:11nopromptsegmond: typically, applications in clojure are built from *libraries*.
00:11MattAbbottthanks. I'm way more comfortable thinking in terms of pure data transformation in general, and come at most problems from a dat flow angle; Pedestal looks very tempting for me in that regard, but their docs seem nonexistent.
00:11ddellaco_Denommus: 'night.
00:11dissipatenoprompt, from the ground up? for real?
00:12ddellaco_MattAbbott: You can apply that thinking to Ring somewhat actually--it models the HTTP request as a hash-map getting data appended to it as it "flows in."
00:12segmondnoprompt, elaborate please
00:12MattAbbottooh, very cool
00:12nopromptdissipate: why not? i bailed out of rails and did that when i first started clojure, what's the problem?
00:12ddellaco_dissipate: I assume he's talking about the same thing as I am, Ring + Compojure to start (are you noprompt?)
00:12mischovMattAbbott: https://github.com/pedestal/pedestal/tree/master/guides/documentation
00:12nopromptddellaco_: yes.
00:12dissipateddellaco_, how does pedestal model an HTTP request?
00:12mischovMattAbbott: They had better docs but site is down because they're redesigning framework.
00:12nopromptsegmond: how can i elaborate more on that?
00:12ddellaco_dissipate: no freaking idea. ;-)
00:13ddellaco_dissipate: but I actually think Pedestal uses Ring under the covers.
00:13ddellaco_dissipate: it just maps a lot of FRP stuff on top of it, which I couldn't pretend I knew how to explain at this point.
00:13segmondnoprompt, because your answer is terse
00:13mischovddellaco_: As far as I understand.. kinda uses ring.
00:13nopromptsegmond: compojure/ring + a database library + whatever else your application needs?
00:13dissipatenoprompt, i'm not sure why, but web stuff kind of bores me. to me the web is a delivery mechanism. i'm more interested in back-end stuff.
00:14nopromptdissipate: it is boring.
00:14MattAbbottmischov: yeah I'd seen those; it didn't really hit home enough. I'm okay waiting for the redesign, I suppose. Is that development happening on a visible branch?
00:14dissipateddellaco_, functional relational programming?
00:14ddellaco_dissipate: functional reactive programming. I
00:14mischovMattAbbott: No idea, I'm afraid. Sorry.
00:14dissipatenoprompt, how does someone get excited about an MVC framework? i do not know
00:14ddellaco_dissipate: ...I'm not sure if they actually use that term though, but I think it's been described as such.
00:14nopromptsegmond: also, imho, frameworks tend to pigeon hole you into solving a problem the "framework way" instead of encouraging you to "just solve your problem"
00:15dissipateddellaco_, oh, that's gnarly. i was looking into a 'reactive' programming language recently called Dyna. seems pretty cool, but also seems very difficult to reason about outside of small programs.
00:15segmondnoprompt, mmm ok, i don't know much, i guess i'll find out in due time.
00:15nopromptand by that i mean, just look for libraries that solve your problem and if one doesn't exist just write the code yourself.
00:15technomancy"Solve your problem: the Bruce Campbell way!" https://visualcrack.files.wordpress.com/2008/06/make-love-the-bruce-campbell-way.jpg
00:16ddellaco_(inc technomancy)
00:16lazybot⇒ 99
00:16nopromptsegmond: yeah, just do some homework, try and figure things out. ask questions here or google if you get stuck.
00:16ddellaco_technomancy: does that involve chainsaws?
00:16technomancyddellaco_: don't see how it could be any other way
00:17MattAbbottddellaco_ dissipate I think they stick with "dataflow", but FRP is a subset of that and you can reason about it all in the same way if you squint right
00:17nopromptsegmond: i've learned a ton building applications from the ground up.
00:17dissipatenoprompt, i doubt you are suggesting to write a web framework truly from scratch. who wants to write another library to parse HTTP requests? not me.
00:17nopromptdissipate: nah, i'm not saying that.
00:17nopromptdissipate, segmond: compojure is a good start.
00:18MattAbbottso if i wanted to build a client-server system for a tabletop game engine, would web frameworks be the best way to go in clojure, at least for speed of development?
00:18noprompthell, you can even do what i usually do and start off w/ a clojure atom as a "database" and some clojure.set action.
00:19technomancyMattAbbott: if you don't care about the UI, then no. it would be much faster to just write a socket server you can telnet into.
00:19nopromptyou can get *very* far with just those two things.
00:20MattAbbottwell, ideally the model would be clear-cut enough to put a view on top of at some point
00:20xusernoprompt: did you wrote to a file to make it persistent?
00:20nopromptxuser: no
00:21nopromptxuser: i usually make dummy data generators for populating stuff.
00:21xuserddellaco_: you have to tell us now
00:21ddellaco_xuser: no
00:21xusernoprompt: ok
00:21MattAbbottddellaco_: where do you work?
00:21nopromptxuser: i do that often on the client-side too avoid having to hit a real api.
00:22ddellaco_MattAbbott: diligenceengine.com
00:22MattAbbottah cool
00:22technomancywait this isn't steampunk
00:23nopromptfwiw, these are just notes from my experience developing applications.
00:23technomancyoh, *diligence*
00:23nopromptyou can make decisions as you go, you don't have to settle on a database, an api, etc. when your just beginning to explore your problem domain.
00:24ddellaco_technomancy: that would be sweet right? "Finally harnessing the promise of steam and manifesting Babbage's vision."
00:25Nyyxwhy should I require :refer :all instead of :use?
00:25MattAbbottnoprompt: that's a big lesson I'm learning with clojure. It feels like i'm reimplementing datomic sometimes, but it doesn't look like that's such a bad thing compared to other languages; dropping in the actual database when i'm actually ready to start working on schema design doesn't seem too bad
00:26Nyyxwhat sitgma is there vs the two
00:26ddellaco_Nyyx: you should do neither, ideally. :refer to specific names or use a namespace alias
00:26xusernoprompt: yeah, I'm just working with a set of maps right now :)
00:26Nyyxddellaco_: but when you want to use one or the other?
00:26nopromptthe wonderful thing about developing with clojure is that with judicious use of the repl you can sketch out your problem until you have a nice picture of what you're doing.
00:26ddellaco_Nyyx: my rule of thumb is that I don't really use use except in the repl here and there. I'll let others chime in with their opinion though, that's just me...
00:27nopromptxuser: that's how i do it. :)
00:28nopromptholy cow... i've almost done it... the entire sass parse tree as pure data.
00:28nopromptnow for the crazy part...
00:31ambrosebswell apparently it's impossible to unsubscribe from test.check PR #1
00:31ambrosebsgreat
00:31ambrosebswhy does it still come up in my feed with notifications off?
00:31noprompttechnomancy: can lein do a local search for artifacts?
00:32noprompterr jars i mean
00:32technomancynoprompt: not really; lein search just works with lucene indices
00:32technomancyit doesn't have an indexer
00:33noprompttechnomancy: hmm... i guess i could reuse some code from lein-describe and crawl ~/.m2
00:33noprompttechnomancy: sometimes i forget what i have installed, what versions, etc.
00:33technomancynoprompt: you can't grep?
00:33noprompttechnomancy: boring. :-P
00:34noprompttechnomancy: j/k, no, you're right i could.
00:34technomancy'http://p.hagelb.org/unix.jpg
00:45seancorfieldambrosebs: I was able to unsubscribe directly from the page for that PR
00:46ambrosebsseancorfield: I tried toggling it again, perhaps it'll work this time.
00:46ambrosebsseancorfield: It's probably my fault for commenting on it.
00:47ambrosebsgithub is punishing my stupidity
00:47firefauxhow would you make a lazy sequence of [key value] pairs from a map, sorted by value?
00:48seancorfieldAh, if you commented, you may not be able to unsubscribe. I resisted... barely... :)
00:48firefauxI want to make some functions like top-n and bottom-n
00:48seancorfield,(sort-by key {:a 1 :c 2 :d 3 :b 4})
00:48clojurebot([:a 1] [:b 4] [:c 2] [:d 3])
00:48firefauxohhhh
00:49firefauxnow I feel dumb
00:49firefauxI was trying to do something with (into (sorted-map-by))
00:49seancorfieldnot sure how lazy that is tho' since sorting kinda requires processing all of the elements...
00:50firefaux,(sort-by val {:a 1 :c 2 :d 3 :b 4})
00:50clojurebot([:a 1] [:c 2] [:d 3] [:b 4])
00:50firefauxthat's a good point
00:50firefauxdoesn't really matter then
01:02fowlslegsI started writing a program to evolve a solution for a string rearrangement puzzle...
01:02fowlslegsthen I found out it was unsolvable ;'(
01:02fowlslegsWell, that was my Clojure story of the day.
01:06dsrxdoesn't mean there's not a heuristic for it or something
01:06dsrxer, what do you mean by unsolvable
01:11logic_progsuppose I own "mydomain.com" and "mydomain.com" has its dns pointed at digitalocean
01:11logic_proghmm, wrong channel
01:26sm0kehey is there something like lein-autoexpect for plain clojure.test?
01:36seancorfieldsm0ke: that question seems to come up a lot... both Expectations and Midje have auto-runners
01:36sm0keseancorfield: what about clojure.test?
01:37sm0kei found this https://github.com/jakepearson/quickie
01:37sm0kehave to try
01:41seancorfieldsm0ke: I don't know of an auto-runner for clojure.test that is currently maintained - that's what I meant: that question comes up a lot because there's no obvious solution for clojure.test...
01:41seancorfieldI wish there was something we could point people at :)
01:42sm0keok, quickie seems to be working for me
01:42seancorfieldI only use clojure.test for contrib libraries - I use Expectations for all my testing stuff...
01:43ddellaco_seancorfield, sm0ke: not sure what the state of it is, but: https://github.com/aphyr/prism
01:43ddellaco_I guess quickie is more recently maintained though.
01:44seancorfieldquickie looks like a reasonable solution... hadn't heard of it before...
01:44ddellaco_seancorfield: yah, me neither, will have to check it out.
01:45ddellaco_I do like that about Midje (as well as its filter ability, which I haven't figured out how to emulate in clojure.test), even though there's other stuff I don't like so much about Midje.
01:46sm0kehmm it is good, thinking of sending a pr for printing a bell char on failure though
01:52ddellaco_sm0ke: yeah, when I was in Ruby-land there was a nice growl notification lib for automated testing. I do miss some of the slickness of testing in the Ruby eco-system sometimes.
01:52sm0keyep, let contibute to quickie then :)
02:10sm0keweird i just installed plugin locally using 'lein install' but still 'lein quickie' fetched an old version from clojar?
02:11sm0kedo i have to add ~/.m2 to prfiles.clj in :repositories?
02:19muhoobest stacktrace ever https://www.refheap.com/52871
02:20muhooum... ok... this when trying to run https://www.refheap.com/52872
02:20akhudekwhat stack trace?
02:21muhoothis one https://www.refheap.com/52874
02:22muhoosome death deep in the bowels of nrepl or lein, where stacktraces can't reach them.
02:23muhoospecifically, deep in weasel, since it's the second form in there that dies (when evaled on its own)
02:26akhudekmuhoo: oh man, those are the worst
02:27akhudekmuhoo: I recently had a stack overflow in java's regex library, but the stacktrace just gave me a few frames from within the regex library itself and nothing more
02:27akhudekso annoying
02:27muhooyep, it's time for stepping through the code the old fashoined way: by hand, no stacktrace
02:28akhudekprintln debugging :-(
02:34muhoosrc path... methinks
02:35nopromptis it possible to implement clojure.lang.Named for some type?
02:36muhoonope
02:36nopromptbummer
02:37muhoonoprompt: actually i meant nope, not src path (thing i was thraghing on), but it depends if Named is an interface or a protocol, i think
02:37nopromptmuhoo: it's an interface
02:38muhooin general extending stuff is a lot easier in cljs because it uses protocols a lot (exclusively?). jvm clojure uses java interfaces.
02:38muhoofor most things
02:38muhoobut my java-fu is weak; others may know hacks to do what you're trying to do
02:40muhoohmm, is (env/default-compiler-env) supposed to show an empty {} atom?
02:42muhoowell i gots a more thorough stacktrace: https://www.refheap.com/52881
02:45muhooaaand the broken thing appears to be (cljsc/cljs-dependencies {} ["weasel.repl"])
02:53muhooBANG! it's cljs 2173! breaks weasel in some inexplicable way.
03:01muhoooh wow, this breaks on 2173 too: (cljsc/cljs-dependencies {} ["goog.string" "cljs.core"])
03:29Nyyxjoy of clojure shows a function that they say is impure because it uses a (def {some map data...})
03:29Nyyxis it impure because the var can change reference?
03:29Nyyxand if so how do you define top level constant references?
03:35opqdonutNyyx: if you do a def inside a function body then yes, that is impure, the function has a side effect
03:35opqdonutNyyx: top-level constants are simply defined by having a def at the top level
03:36Nyyxopqdonut: there's no def in the function body
03:36opqdonutthen it doesn't sound unpure impure to me
03:36Nyyxyet joy of clojure books says it's impure and suffixed the function with '!'
03:37opqdonutis the code in question online?
03:37opqdonuthttps://github.com/joyofclojure/book-source/tree/master/src/joy which file?
03:38Nyyxopqdonut: https://www.refheap.com/52899
03:39opqdonuthmm, okay
03:39opqdonutit's not impure due to the code itself
03:39opqdonutit's impure due to the design that alters the definition of plays
03:39Nyyxbut there is no design
03:39Nyyxit just says there's a possibility
03:40opqdonutit's a weird argument
03:40Nyyxshould I suffix '!' for my code that just refers to def's?
03:40opqdonutbecause by that reasoning every function ever would be impure
03:40opqdonut(because e.g. the functions it refers to might get redeffed)
03:40opqdonutno, you should not
03:40Nyyxthat's what I was thinking
03:40Nyyxokay, seems like a poor example to use in this book then
03:41opqdonutnow if plays were an atom, it would make more sense
03:46clgvopqdonut: "pure" means always same output on same input no matter how the environment surrounding the function changes
03:46clgvNyyx: ^^
03:47opqdonutclgv: if you define the "surrounding environment" to include other top-level def(n)s, no function is pure
03:48opqdonutthe book seems to be arguing that a function was impure because it accesses a def, and somebody might redef the def
03:49clgvyeah surely, although I'd limit it to "defs" that contain global values which are expected to be changed.
03:49opqdonutalso, you can't define purity by just looking at output. you have to look at side-effects in general. e.g.: (defn pure [x] (reset! an-atom x) nil) would be pure by your definition
03:50Nyyxunless maybe you argue chaing the world is an output?
03:51clgvhumm right, I limited the description to the function itself which wouldnt be affected from the atom change if it does not read it
03:52opqdonutIMO clojure code that redefs stuff as part of normal operation is ugly
03:52opqdonutwrap the data in an atom and it'll at least be clear that it's mutated
03:55clgv"few points of mutation" as design goal so to say
04:26schauehogeek
05:18sm0kewhat da..?
05:18charewhat is File. mean in (import '(java.io File)) (.listFiles (File. "."))
05:19sm0keno docstrings allowed in defrecord?!
05:19clgvsm0ke: no. you are supposed to put those in defprotocol
05:22fredyrchare: File. is the same as `new File()`
05:22chare100% the same
05:22chareZERO exceptions?
05:22sm0keclgv: protocol allows doc string?
05:23clgvsm0ke: yes
05:24sm0kemakes sense then, but if clojure doesnt allow codesharing amongst defrecords for same protocol, it makes sense to have specifice doc strings for each record
05:24charefredyr: you not responding...
05:24clgvsm0ke: not really, since the contract should be clear with the protocol
05:25fredyrchare: not sure what you're after, but (File. ".") just expands to (new File ".")
05:25chareFile. is a macro?
05:25clgvsm0ke: you could not query those docstrings anyway
05:25clgvchare: no. a sepcial form
05:25clgv*special
05:26fredyr,(macroexpand-1 '(File. "."))
05:26chareso then (new File ".") is also a special form?
05:26clojurebot(new File ".")
05:26fredyrhttp://clojure.org/java_interop#Java%20Interop
05:26clgvchare: ok "File." is a reader macro so to say and "new" is the special form
05:27fredyr`Clojure supports special macroexpansion of symbols containing '.'`
05:27Cr8,(read-string "(java.io.File. \"foo\")")
05:27clojurebot(java.io.File. "foo")
05:27Cr8,(macroexpand-1 '(java.io.File. "foo")
05:28clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
05:28Cr8,(macroexpand-1 '(java.io.File. "foo"))
05:28clojurebot(new java.io.File "foo")
05:28sm0kewell at least a top level doc string for record is not debatable
05:28fredyrAnyway, its the dot that's special, it can be any symbol
05:28Cr8,(macroexpand-1 '(wibbity. "foo"))
05:28clojurebot(new wibbity "foo")
05:29fredyr,(macroexpand-1 '(:wicked. "."))
05:29clojurebot(:wicked. ".")
05:29Cr8,(macroexpand-1 (list (symbol ":unholy.") "foo"))
05:29clojurebot(new :unholy "foo")
05:30fredyrya, symbols ending w/ dot
05:30clgvsm0ke: yeah. maybe there is a feature ticket for that in jira you can vote on. otherwise you should create one
05:31clgvit's strange that read-string does not expand the dot form. so maybe it is no reader macro but it clearly is not a usual macro^^
05:31Cr8it's more like any symbol ending in . is implicitly handled like a macro
05:34Cr8https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6587-L6598
05:34sm0keanyone tried clojure on mlvm?
05:35sm0kei wonder if -XX:Tailcalls can get clojure riddance from (recur)
05:42sm0keclgv: guess what you cant have docstrings for method definitions in protocols too
06:01clgvsm0ke: you misread. see ##(doc defprotocol)
06:01lazybot⇒ "Macro ([name & opts+sigs]); A protocol is a named set of named methods and their signatures: (defprotocol AProtocolName ;optional doc string \"A doc string for AProtocol abstraction\" ;method signatures (bar [this a b] \"bar docs\") (baz [this a] [this a b] [this a ... https://www.refheap.com/52925
06:20clgvI specified :profiles {:uberjar {:aot [#"my\.lib.*"] }} in my project.clj but there is no class file for some of the namespaces starting with "my.lib" in the resulting uberjar
06:20clgvwhat might be wrong?
06:21bob2`are you sure you told lein to use the :uberjar profile?
06:22clgvI thought that profile is used for the uberjar task automatically?
06:23bob2`I did not think so
06:24bob2`https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#activating-profiles
06:24clgvI thought it's used automatically like the :user profile for example
06:25clgvsee https://github.com/technomancy/leiningen/blob/6853a511f9f68264a9fefd9c706b51faae13fc94/resources/leiningen/new/app/project.clj#L9
06:26bob2`https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#debugging seems relevant also
06:27bob2`all I can think is you're using ring ubjerjar or something
06:27clgvnope. "lein uberjar"
06:27bob2`or that the docs are unclear and you're meant to use with-profile
06:29clgvok it's definitely in there: https://github.com/technomancy/leiningen/blob/master/src/leiningen/uberjar.clj#L131
06:30clgvmust be some error with the regexp, although that one looks correct
06:32clgvhumm maybe it's matching directories instead of namespaces then dashes would be the problem^^
08:21hhenkel_Hi all, I'm currently facing this error: Exception in thread "async-dispatch-24" java.lang.AssertionError: Assert failed: No more than 1024 pending puts are allowed on a single channel. Consider using a windowed buffer.
08:22hhenkel_I'm aware that this must be an bug in my code but currently I'm not able reproduce it.
08:22hhenkel_That's the code in question: https://www.refheap.com/52956
08:23Anderkenthhenkel_: how many times were you calling request-and-process without reading from channel?
08:24hhenkel_Anderkent: The issue occurs at night when the servers are restared I guess...
08:24hhenkel_Anderkent: ...ah or maybe there is an issue with the server that should get the data...
08:25hhenkel_Anderkent: ...and therefore the data is not read?
08:25Anderkenthhenkel_: well, basically the issue is in whatever code is calling the request-and-process method, or with whatever is reading from channel
08:25Anderkentas the error says, you can't have more than 1024 pending puts on a single channel
08:25hhenkel_Problem at the moment is, that I have no timestamps, therefore it's hard to tell.
08:26Anderkent,(use 'clojure.core.async)
08:26clojurebot#<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/async__init.class or clojure/core/async.clj on classpath: >
08:26Anderkentbah
08:26hhenkel_okay, so the data is not fetched from the channel then, right?
08:26Anderkenteither that, or something is calling request-and-process very quickly and the reads are not fast enough
08:27hhenkel_okay, don't think that this is the case as it works all day till some restarts occur at night.
08:28hhenkel_Tested it through the day with shutting down systems and starting them up after some time...
08:28hhenkel_...and that went well, so maybe I need to remove the sender connection for some time...
08:28Anderkenthard to say without more context; you could for example have many open connections that all close at the same time because of the restart, thus overflowing the channel
08:28hhenkel_...that may result in the same issue then.
08:29Kototamahi, why does (spit "/tmp/a.zip" (:body (http/get "url-with-zip"))) creates a corrupted zip ?
08:30AnderkentKototama: I'd expect spit to open the file in text mode; you want binary mode for binary content
08:33AnderkentKototama: https://github.com/clojure-cookbook/clojure-cookbook/blob/master/04_local-io/4-19_handle-binary-files.asciidoc
08:37clgvI am still struggeling with aot compilation. although my regexp mathces those namespaces some of them are not aot compiled
08:37clgvthose are namespaces of a dependency. but a lot of the namespaces of that dependency are compiled
08:38Anderkentclgv: aot will only compile namespaces of a dependency that are loaded by namespaces that match your regex, afaik
08:39clgvAnderkent: oh damn. that means I need to aot them in the dependency? I only want them aot compiled for the uberjar....
08:39Anderkenthm, why do you need them aot compiled if your code doesnt use them?
08:40clgvmy program is loosely coupled via a configuration with the functions of the dependency, so they are used but not statically required
08:40Anderkenthm, I see. Have you tried with :aot :all?
08:41AnderkentAlso, as a workaround, you can add a layer of indirection - have namespaces of your own that statically require the external ns
08:41Anderkentbut then dynamically require your own namespace according to config
08:42Kototamathere is an example http://myotherpants.com/tag/clojure/ the copy-file function pass the {:as :byte-array} argument to the http/get function
08:43clgvAnderkent: there are many namespaces...
08:43Anderkentand you absolutely need all of them to be aot compiled?
08:43AnderkentI find it hard to imagine why
08:44clgvAnderkent: originally because I want to assure unchecked-math. but I guess I can set that a central poinrt
08:49hhenkel_Anderkent: I updated https://www.refheap.com/52956 with the function that should read from the channel.
08:50hhenkel_My setup / idea is like that: Read data from jolokia (jmx as json) from weblogic servers and send it to zabbix
08:50hhenkel_I see that the first server is restarted at 01.00 and after the restart the script is able to provide more data.
08:51Anderkenthhenkel_: hm, so if your service on port 10051 dies first, then you stop reading?
08:51hhenkel_Once the second server is restarted my script seems to be in error state.
08:51hhenkel_Anderkent: The service on port 10051 (zabbix) is running the whole time.
08:52hhenkel_I guess data should be dropped in that case though.
08:53Anderkentright; I guess this is one of these things that might be pretty hard to debug
08:55hhenkel_I'll try to see if I can simulate this by restarting first one server and that after some time restart the other
09:06Kototamahow can i offer a binary resource with liberator? It seems defroute + available-media-types ["application/zip"] also corrupts the zip content
09:09Kototamamaybe the problem is again my usage of slurp with binary data hummm
09:13Kototamaso i guess my question is how to use byte-array with :handle-ok in liberator
09:18Kototamaclojure.java.io/input-stream does the trick
09:20hhenkel_Anderkent: I think I found the problem...the error handling is not good enough. I must also test if the status is != 200 I guess otherwise the JSON Parser throws an error and no more data is processed.
09:38gfrederickshttps://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.clj#L158
09:38gfredericks^ this presumed typo makes me think an extra arity on `first` would be kind of cool
09:54gmorphemecan someone explain why I can't get more than 8 elements into a transient map? (let [m (transient {})] (doseq [i (range 20)] (assoc! m i i)) (persistent! m)) just gives {0 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7}. must be missing something obvious...
09:55llasramgmorpheme: Either you or someone with the same question just a sec ago got the answer on the clojure-users mailing list
09:56chouserYou can't bash transients in place!
09:56gmorphemeah. got it. thanks llasram
09:57llasramWell, you can. It just doesn't do what you probably want :-)
09:57chouserhm
09:57chouserI guess that's fair.
09:59gfredericksafaik that's the ONE instance in which bashing in place doesn't do what you want
09:59hyPiRionwhen the tree grows its height?
10:00gfredericksyou're suggesting an alternative scenario?
10:01hyPiRionwhen it shrinks
10:01gfredericks,(let [m (transient (hash-map))] (dotimes [n 10000] (assoc! m n (inc n))) (let [m' (persistent! m)] [(count m) (get m 4567)]))
10:01clojurebot#<IllegalAccessError java.lang.IllegalAccessError: Transient used after persistent! call>
10:02gfredericks,(let [m (transient (hash-map))] (dotimes [n 10000] (assoc! m n (inc n))) (let [m' (persistent! m)] [(count m') (get m' 4567)]))
10:02clojurebot[8 nil]
10:02hyPiRionoh right, an actual error message
10:02gfrederickshey that's curious
10:02gfredericks,(type (hash-map))
10:02clojurebotclojure.lang.PersistentArrayMap
10:02gfrederickslol
10:02gfredericks,(let [m (transient (apply hash-map (range 20)))] (dotimes [n 10000] (assoc! m n (inc n))) (let [m' (persistent! m)] [(count m') (get m' 4567)]))
10:02clojurebot[10000 4568]
10:02gfredericks^ seems to work there, and surely the tree grew a bit?
10:04hyPiRioncount may not actually return the right value thoughj
10:04gfredericksI'm calling it on a persistent structure
10:05gfredericksdo hash-maps shrink into array maps?
10:05hyPiRionHrm
10:06gfredericks,(->> (range 300) (map (juxt identity (constantly :val))) (into {}) (apply dissoc (range 298)) (type))
10:06clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentMap>
10:06gfredericksI need plumbing.core/<-
10:06gfredericks,(-> (->> (range 300) (map (juxt identity (constantly :val))) (into {})) (apply dissoc (range 298)) (type))
10:06clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (21) passed to: PersistentHashMap>
10:06gfredericks,(-> (range 300) (->> (map (juxt identity (constantly :val))) (into {})) (apply dissoc (range 298)) (type))
10:06clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (21) passed to: PersistentHashMap>
10:06lvhHi
10:07gfredericksI give up on computers
10:07clgvgfredericks: or clojure.core/as-> ;)
10:07lvhI have a binary multiplication function *; is there an easy way to define pow using it?
10:07gfredericksdo you want easy or fast?
10:07lvhit'd be cool if it was smart enough to break it up into powers of two; but i'm okay if it isn't
10:07lvhgfredericks: I actually think that for answers > 4 computers can't really solve it
10:07lvhgfredericks: so let's go with "easy"
10:08lvhor "elegant" maybe
10:08gfredericks(fn pow [x n] (reduce * (repeat n x)))
10:08lvhwow, that is very pretty
10:08gfredericksthe squaring version isn't too difficult either
10:09lvhgfredericks: the only reason I'd care is because I'm producing inputs to loco/choco, a constraint solver
10:09clgvlvh: you will need recursion for and efficient version ;)
10:11clgvlvh: powers of 2? you mean like multiply-and-square?
10:11gfrederickslvh: btw I have a lib somewhere to turn binary operations into variadic
10:12gmorpheme,(for [x [0 1 10 100 1000 10000]] (let [m (transient (apply hash-map (range (* 2 x ))))] (dotimes [i 20000] (assoc! m i (inc i))) (count (persistent! m))))
10:12clojurebot(8 20000 20000 20000 20000 ...)
10:12gfrederickslvh: https://github.com/fredericksgary/lib-4395/
10:17clgvgfredericks: nice. pretty handy for crypto stuff. strange name though. do you like the factors of 4395?
10:17gfredericks,(format "lib-%04d" (rand-int 10000))
10:17clojurebot"lib-6098"
10:17gfredericks$google lib-4395
10:17lazybot[LIB 4395 Analyses of Crystal Violet & Brilliant Green] http://www.fda.gov/Food/FoodScienceResearch/LaboratoryMethods/ucm071574.htm
10:18gfredericksI was going to say it's handy for googleability but clearly it isn't
10:18clgvinteresting lib name generation scheme :P
10:18clgvwell, you need a better prefix^^
10:18gfredericks:)
10:19clgvnot many intersting properties: http://www.wolframalpha.com/input/?i=4395
10:19gfredericks,(->> (repeatedly 4 #(rand-int 26)) (map #(+ (int \a))) (map char) (apply str))
10:19clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval89/fn--90>
10:19gfredericks,(->> (repeatedly 4 #(rand-int 26)) (map #(+ % (int \a))) (map char) (apply str))
10:19clojurebot"lvnn"
10:20gfrederickslvnn-4395 then?
10:20bbloomdnolen_: http://www.scala-js-fiddle.com/gist/9362801 <- scala.js with some rx framework thinggy
10:20bbloomdnolen_: kinda interesting
10:20clgvgfredericks: but well you need primitive support top be really useful in crpyto ;)
10:23gfredericksclgv: yeah would probably need to switch to a macro approach for that
10:23gfredericksclgv: I wrote this because I got tired of doing it every time I had some algebraic thing I wanted to define
10:24clgvgfredericks: I just added a modul param to the basic operations and initialized the functions via partial for some crypto implementation
10:25gfredericksawhut??
10:25lazybotgfredericks: Definitely not.
10:26dnolen_bbloom: yeah I saw that
10:28dnolen_bbloom: 19mb of JS and source maps
10:29clgvgfredericks: (defn add [m, a, b] (mod (+ a b) m)) but it was just for quick and dirty code for exercises
10:29dnolen_bbloom: still sounds like Scala.js is improving very quickly, they now do a dead code elimination pass before Closure, big perf bump from that.
10:29dnolen_bbloom: would be nice if CLJS did that - would likely get a big speed bump as well
10:30dnolen_er I mean compile time bump - not perf
10:36bbloomdnolen_: definitely
10:37bbloomdnolen_: the work would ultimately help AOT compilation for JVM CLJ as Bronsa continues his work
10:38tbaldridgednolen_: how hard would it be to have CLJS use tools.analyzer?
10:52seangroveHrm, any clear way to do drag/drop with javascript, but have the thing being dragged different from what was initially clicked?
10:53seangroveI'd like to be able to click and drag anywhere in a div that has some text and an icon in it. When dragging, it should follow the mouse of course, but with an expanded version of the image and the full text description.
10:54gfredericksclgv: ah right
10:59shep-werkseangrove: http://jqueryui.com/draggable/#visual-feedback
10:59shep-werkcertainly possible to do
11:00shep-werksee the "custom helper"
11:00seangroveshep-werk: Ah, perfect, thank you
11:02bbloomi really like trello's drag drop effects
11:02bbloomhttp://jsfiddle.net/RVta5/
11:04dnolen_tbaldridge: hmm dunno, probably mostly tedious work to make the CLJS AST conform
11:04dnolen_tbaldridge: we're already pretty close I think the main missing bit is :children
11:04tbaldridgeyeah that's what I figured.
11:05dnolen_would be awesome
11:06bbloomdnolen_: can we just fix the children thing once and for all? if we just got a decision on it, we could bang out whatever solution is required in like 20 minutes
11:07edwHas anyone seen Emacs locking up while completing using the latest MELPA CIDER?
11:09seangrovetbaldridge: What're you looking to do with CLJS + tools.analyzer?
11:10tbaldridgeseangrove: I want to unify all the analyzers laying around in the Clojure world. I've integrated tools.analyzer into core.async CLJ,
11:10seangrovetbaldridge: Ah, sounds like a good idea
11:10tbaldridgeSomeday I'd like to see the same analyzer be used by core.async, core.typed, CLJS, and tools.emit.jvm
11:11bbloomtbaldridge: huh, didn't realize you switched core.async over
11:11bbloomtbaldridge: how'd it go?
11:11dnolen_tbaldridge: might be worth asking Bronsa to take a look at analyzer.clj and see how much work he think it would be.
11:11tbaldridgenot too bad, just a about a day's worth of work
11:11erdosdamn, i am also working on a brand new analyzer.
11:12bbloomtbaldridge: mostly cosmetic differences?
11:16tbaldridgebbloom: well the old code had to parse from sexprs, the new one just does gets on the hashmaps from the analyzer.
11:17bbloomtbaldridge: that's nice
11:17tbaldridgebbloom: so a lot of code was removed. There's like 5 versions of the dot form, Now I don't have to worry about how to parse all of those.
11:17bbloomgrumble grumble dopey dot form
11:20mabestbaldridge: is your latest work in the analyzer branch? https://github.com/clojure/core.async/commits/analyzer
11:20tbaldridgemabes: yep
11:21tbaldridgeI just need to figure out how to port that to CLJS and then I'll merge it into master
11:24tbaldridgealso, I'll be doing a talk on all the analyzer stuff at Clojure/West
11:25tbaldridgeNot that I wrote any of it, but Bronsa couldn't make it to the conference
11:25mabestbaldridge: cool, looking forward to it!
12:34mikerodis here any lib out there already, that can hook onto a clj project at build-time and write some edn files out (perhaps this is too general of a question :)?
12:46justin_smithfor build time, I assume you would want to hook onto the build tool (AKA probably leiningen)
12:46effyi'm trying to use core.matrix for matrix multiplication, and on my local laptop, the multiplication of a [400,400] matrix by a [400,1] matrix take about 400ms compared to numpy which take ~0.5ms, am i doing something very wrong here, or is there another performant matrix library for clojure ?
12:46justin_smithmikerod: you could use an injection that calls the function that creates the edn
12:46justin_smiththere are example injections in the sample project.clj on github
12:47justin_smitheffy: what numeric data type are you using?
12:48effyi declared it as (matrix (repeat 400 [1]))
12:48effyfor the 400,1 and same kind of thing for the 400,400
12:49justin_smiththere are matrix libs that use more efficient structures / numeric types than the default clojure immutible vectors and auto-promoting longs
12:49justin_smithwith the convenience tradeoffs that come with that of course
12:50justin_smithhttp://blog.getprismatic.com/blog/2013/7/10/introducing-hiphip-array-fast-and-flexible-numerical-computation-in-clojure
12:50effybut we are talking of a x100 time here
12:50justin_smithyes
12:50effyi dont think immutability would cause 100 fold performace, would it ?
12:50justin_smithboxed longs are crazy slow
12:50llasrameffy: The core.matrix Clojure vector backend is only for convenience
12:51llasramyep -- boxing is the primary culprit
12:51llasrameffy: You'll want to default to a different backend, and coerce your data to that type
12:52hiredmanyou know, clojure does have vectors that can hold unboxed primitives, just no one ever uses them
12:52effyany idea of what kind of performance i can expect compared to numpy ?
12:52effyonce i did everything right
12:53llasrameffy: Similar ballpark for most individual operations, but you'll find rough edges
12:54llasramhiredman: That would probably be a nice addition to core.matrix
12:55effyllasram: can you give me a head starts and tell me what rough edges i'll find in advance ? :p
12:55hiredmanllasram: https://github.com/clojure/clojure/blob/master/src/clj/clojure/gvec.clj
12:55llasramhiredman: Yah, I've seen the implementation when perusing the source... Would just need someone to do the wiring :-)
12:55justin_smithoh yeah, vector-of
12:56llasrameffy: Nope :-). Sorry, my main experience w/ core.matrix so far has been via a Mahout-backend implementation I haven't released yet
12:57justin_smith,(vector-of :long 0 1 2 3)
12:57llasrameffy: But core.matrix has default (probably slow) implementations for a lot of operations. If a given backend doesn't support those operations explicitly, things still work, but maybe not as performantly as you you'd expect
12:57clojurebot[0 1 2 3]
12:57justin_smithhiphip is seriously worth checking out if you need fast number collection ops
12:57llasrameffy: The good news is that AFAIK the implementations core.matrix considers core do implement everything directly, so you should probably be ok
12:58effyllasram: i'm going to repeat the experiment with AFAIK then and see how it does ! :)
12:58llasramhahaha
12:59llasramYeah, core.matrix REDAME lists what are considered "mature" backend implementations: https://github.com/mikera/core.matrix#status
13:00justin_smithClatrix uses blas, which is likely what numpy is using as well
13:00justin_smithfor what that's worth
13:00hiredmancomparing to python is so complicated, the language has all the halmarks of being slow, but they easily and without shame call c libraries all the time, which has worked out very well for them
13:00effyjustin_smith: can you make 2d vectors with this method, reading the doc it seems to only work for primitive type :(
13:00AdmiralBumbleBeehallmarks of being slow?
13:00AdmiralBumbleBeesuch as... being slow?
13:01hiredmanAdmiralBumbleBee: being one of these super dynamic interpreted langs
13:01justin_smitheffy: if you need a proper matrix lib I guess you probably need core.matrix with a good backend lib - but hiphip has great performance within its featureset
13:01AdmiralBumbleBeehiredman: I see what you're saying now
13:02hiredmanthere is some momentum behind building a new ffi interface for the jvm, which would be super for clojure
13:02effyjustin_smith: i want matrix support for machine learning so i only need matrix multiplication, element wise multiplication, and a tiny bit of broadcast, (and never goes with more than 2d matrix) i'm not greedy
13:02AdmiralBumbleBeeI fear an ffi for the jvm
13:03AdmiralBumbleBeethe abuse of it to the extent of nearly ruining general cross-platform use of the jvm would be imminent I suspect
13:04hiredmanthe jvm has an ffi, jni, it just sucks
13:05justin_smitheffy: some kind of hand rolled 2d with 1d storage may be an option (ie. interleaved in one continuous array like C does it), but it looks like hiphip is strictly 1d
13:05patchworkCan't beat hand optimized fortran for matrix computation
13:06justin_smithtrue, and they use interleaved 1d for 2d as well (just in the opposite unrolling C uses, which happens to work better for most algos)
13:06hiredmanthe amount of ceremony required to transfer bytes over spi from my beaglebone is crazy
13:06effyjustin_smith: i don't trust myself to implement matrix multiplication optimizations myself, i'll pass for this time. but i still keep the name somewhere in a todo list
13:16effywow, you were right, that's a 100x speed improvement for a one line change ... (set-current-implementation :vectorz)
13:16arrdemand that, ladies and gentlemen, is a native java imp'l at work
13:16effypretty awesome !
13:19bbloomhurray boxing and total lack of user defined primitives!?
13:19arrdemI'll get the champaign...
13:42gfredericks,(def devnull (reify clojure.lang.IPersistentCollection (count [_] 0) (cons [this o] this) (empty [this] this) (equiv [this o] (= o #{})) (seq [this] ())))
13:42clojurebot#'sandbox/devnull
13:42gfredericks,(= devnull (into devnull (range 1000000)))
13:42clojurebottrue
13:44danneucan anyone recommend a simple service/tool for tunneling all of a computer's internet traffic through my own server or a VPN?
13:45jchaunceyisnt that what iptables are for
13:45hyPiRiongfredericks: hold on there man, seq returning () ?
13:46gfrederickshyPiRion: what's wrong with that?
13:46danneujchauncey: i'm no wizard, and when i tried to do this sort of thing once before, i couldn't rest assured that i was actually catching all traffic from all of my services.
13:46gfrederickshyPiRion: oh hm
13:46gfredericks,(seq devnull)
13:46clojurebot()
13:46gfrederickshyPiRion: damn you're right
13:46hyPiRionsew should be idempotent
13:46jchaunceydanneu: my guess is the lower level you go (os wise) the better
13:46hyPiRionseq*
13:46gfredericksI was just focused on something that implements ISeq
13:47hyPiRion,(= (seq (seq devnull)) (seq devnull))
13:47clojurebotfalse
13:47gfredericks,(def devnull (reify clojure.lang.IPersistentCollection (count [_] 0) (cons [this o] this) (empty [this] this) (equiv [this o] (= o #{})) (seq [this] nil)))
13:47clojurebot#'sandbox/devnull
13:47gfredericks,(seq devnull)
13:47clojurebotnil
13:47gfredericksPHEW
13:48danneujchauncey: thanks, i found some osx-equivalent solutions in that direction.
13:49hyPiRion,(= devnull (into devnull devnull))
13:49clojurebottrue
13:49hyPiRionwell, I guess.
13:51gfredericks,(reduce into (repeat 900000 devnull))
13:51clojurebot#<sandbox$reify__121 sandbox$reify__121@4fbb0d>
13:52hyPiRion,(def devnull' (let [id (memoize identity)] (id #{}) (id devnull)))
13:52clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: devnull in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:52hyPiRionoh man, the timing
13:53hyPiRion,(def devnull' (let [id (memoize identity)] (id #{}) (id devnull)))
13:53clojurebot#'sandbox/devnull'
13:53hyPiRion,(into devnull' [1 2 3])
13:53clojurebot#{1 2 3}
13:54gfredericksHUH.
13:54llasramCute
13:54hyPiRiongfredericks: just referential transparency issues
13:55gfredericks,(= (hash devnull) (hash #{}))
13:55clojurebotfalse
13:56hyPiRionlol, that one's worse I guess
13:56gfredericksah because it's an arraymap inside the memoize
13:56gfredericksso no hashing needed
13:56gfredericks,(hash devnull)
13:56clojurebot5439281
13:56gfredericks,(hash #{})
13:56clojurebot0
13:57hyPiRion,(let [id (memoize identity) a (id (java.util.ArrayList.)) v (id [])] (.add a 10) v)
13:57clojurebot[10]
13:57hyPiRionThe moral of this story is: Don't use mutable structures, ever.
13:57gfredericksexcept for premature optimization
13:57hyPiRionor for implementing persistent structures
13:59gfrederickslet's use persistent structures and agents to implement mutable structures
14:00llasramAnd then use those mutable structures to implement persistent structures?
14:01gfredericks,(defn mlist [] (let [contents (agent ())] (reify java.util.List (add [_ x] (send contents conj x)) Object (toString [_] (str @contents))))
14:01clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:01gfredericks,(defn mlist [] (let [contents (agent ())] (reify java.util.List (add [_ x] (send contents conj x)) Object (toString [_] (str @contents)))))
14:01clojurebot#'sandbox/mlist
14:01gfredericks,(mlist)
14:01clojurebot#<AbstractMethodError java.lang.AbstractMethodError: sandbox$mlist$reify__238.iterator()Ljava/util/Iterator;>
14:02gfredericks,(defn mlist [] (let [contents (agent ())] (reify java.util.List (add [_ x] (send contents conj x)) (iterator [_] (clojure.lang.SeqIterator. @contents)) Object (toString [_] (str @contents)))))
14:02clojurebot#'sandbox/mlist
14:02gfredericks,(mlist)
14:02clojurebot(nil)
14:02gfrederickswaaat
14:03llasramagents updates are non-synchronous, yes?
14:03technomancyllasram: yeap
14:04hyPiRiongfredericks: it'll iterate over the seq
14:04llasramPut it on a queue and call it George
14:04llasram(that's a new idiom I just made up)
14:04gfrederickshyPiRion: ...but it should still be empty
14:04hyPiRiongfredericks: do (clojure.lang.SeqIterator. (seq @contents))
14:04hyPiRionseq != list
14:04technomancyllasram: teach it to clojurebot or it doesn't count
14:04gfrederickshyPiRion: lists are seqs
14:05llasramclojure: agents |put| it on a queue and call it George
14:05llasramHeeeey
14:05llasramclojurebot: agents |put| it on a queue and call it George
14:05clojurebotYou don't have to tell me twice.
14:05nopromptwhat's the right way to mock a read port in cljs?
14:05hyPiRiongfredericks: not for seqiterator
14:05nopromptreifying readport doesn't totally work
14:05nopromptReadPort
14:06llasramThis channel currently has the very spirit of Clojure itself as a member!
14:06gfrederickshyPiRion: what? why not?
14:06hyPiRiongfredericks: because https://github.com/clojure/clojure/blob/34258286c5bc3cc72ca212fceb34e6d61359cb1b/src/jvm/clojure/lang/SeqIterator.java#L26-L28
14:06gfrederickshyPiRion: oh this is the empty seq edge case?
14:06hyPiRionit checks whether the seq is null, not ()
14:06hyPiRionempty, rather.
14:06hyPiRionyeah
14:07gfredericks,(defn mlist [] (let [contents (agent ())] (reify java.util.List (add [_ x] (send contents conj x)) (iterator [_] (clojure.lang.SeqIterator. (seq @contents))) Object (toString [_] (str @contents)))))
14:07clojurebot#'sandbox/mlist
14:07gfredericks,(mlist)
14:07clojurebot()
14:07gfredericksphew
14:07nopromptany help on this would be nice.
14:07hyPiRion,(doto (mlist) (.add 10) (.add 5))
14:07clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Agent cannot be cast to java.lang.Boolean>
14:07whodidthishow can i get the name of keyword from namespaced name, like :a/b -> :b
14:08gfredericksoh return type
14:08whodidthisif possible without stringifying
14:08gfredericks,(defn mlist [] (let [contents (agent ())] (reify java.util.List (add [_ x] (send contents conj x) true) (iterator [_] (clojure.lang.SeqIterator. (seq @contents))) Object (toString [_] (str @contents)))))
14:08clojurebot#'sandbox/mlist
14:08llasramwhodidthis: the values are internally strings, but you can get at those, then re-keyword
14:08gfredericks,(doto (mlist) (.add 10) (.add 5))
14:08clojurebot()
14:08llasramwhodidthis: ##(-> :a/b name keyword)
14:08lazybot⇒ :b
14:08hyPiRion(inc llasram)
14:08lazybot⇒ 18
14:09gfredericks,(let [l (mlist)] (dotimes [n 50] (.add l n)) l)
14:09clojurebot()
14:09whodidthisllasram: thanks
14:09gfredericks,(let [l (mlist)] (.add l 42) (Thread/sleep 50) l)
14:09clojurebot()
14:10hyPiRiongfredericks: you could do an await inside the add?
14:10gfredericksno, but sleeping should do it
14:10gfredericks,(defn mlist [] (let [contents (agent ())] (reify java.util.List (add [_ x] (send contents conj x) (await contents) true) (iterator [_] (clojure.lang.SeqIterator. (seq @contents))) Object (toString [_] (str @contents)))))
14:10clojurebot#'sandbox/mlist
14:10gfredericks,(doto (mlist) (.add 42))
14:10hyPiRionoh riight
14:10gfredericksclojurebot must have its agents messed up
14:10hyPiRionthere are no threads
14:10clojurebotExecution Timed Out
14:11gfrederickstime to switch to atoms
14:11gfredericks,(defn mlist [] (let [contents (atom ())] (reify java.util.List (add [_ x] (swap! contents conj x) true) (iterator [_] (clojure.lang.SeqIterator. (seq @contents))) Object (toString [_] (str @contents)))))
14:11clojurebot#'sandbox/mlist
14:11gfredericks,(doto (mlist) (.add 42))
14:11clojurebot(42)
14:11TimMcllasram: I think I remember some paradox about channels that contain themselves as a member.
14:11gfredericksw000h we've made java
14:11gfredericks,(let [a (atom)] (reset! a a) a)
14:11clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/atom>
14:13rbattulathis is interesting, is clojurebot executing code from all users in the same ns?
14:13hyPiRiongfredericks: use persistent vectors as mutable arrays
14:13hyPiRion,(let [a [1]] (aset (. a tail) 0 a) a)
14:13clojurebot[[[[[[[[[[#]]]]]]]]]]
14:14hyPiRionStill surprised that got in.
14:14chouserhyPiRion: What did you do!?
14:14llasramI think tore a hole in space-time
14:14hyPiRionchouser: they made the mutable contents of PersistentVector public in 1.6
14:15hyPiRionthat persistent vector contains itself
14:15chouserWhat is the justification for that!?
14:15technomancywhaaaat
14:15hyPiRion"hyPiRion| Still surprised that got in."
14:15chouser
14:16TimMc< rhickey> ¯\(°_o)/¯
14:16Rayneschouser: Who you live
14:16Rayneswhoa*
14:16chouserLO
14:16chouserLOL
14:16technomancyclojurebot: witchcraft is http://thisotplife.tumblr.com/post/63360807823/mutable-data-structures
14:16Rayneschouser: How's life, man? :D
14:16clojurebotc'est bon!
14:16Raynes<3
14:16chouserRaynes: excellent. How are you?
14:16hyPiRionI believe it has to do with RRB-trees utilising subtrees of original vectors
14:16pjstadigmutability is just another version of immutability
14:16Raynes(:status raynes) => :chill
14:16technomancypjstadig: the mirror-universe version that wears a beard?
14:17llasrampjstadig: is that a functional programming koan?
14:17Rayneschouser: Still lonoclouding?
14:17chouserRaynes: yessir. Now at ViaSat.
14:20Bronsadoes anybody know/remember why Rich reverted the lazy fn loading commit? https://github.com/clojure/clojure/commit/c5681382da775e898915b17f3ab18b49c65359ec
14:23hyPiRionBronsa: it's only temporarily, it says :p
14:23llasramheh
14:40gfredericksI like how the slashes on line 3638 got leftened
14:41TimMcLEF-ten-ed
14:46lvhHi; what's the elegant way to spell [a*x, b*y, c*z...] given [a b c] and [x y z]?
14:46lvhIs it (reduce * (map vector as xs))?
14:46lvh(I realize my literal is a vector; I don't necessarily really want a vector)
14:47chouser,(map * [1 2 3] [4 5 6])
14:47clojurebot(4 10 18)
14:49lvhchouser: oh, right!
14:49amalloyhey chouser, haven't seen you in here for a while
15:07gfrederickschouser only comes by when somebody needs to know how to do pairwise multiplication
15:08pdkyou just have to know how to summon him
15:24nopromptbbloom, dnolen_, anyone can someone explain how to go about implementing cljs.core.async.impl/ReadPort such that it works with take!
15:25bbloomnoprompt: tbaldridge is probably best to ask
15:25dnolen_bbloom: noprompt: was about to suggest the same thing
15:26noprompttbaldridge: if you have a moment to share some insights there that'd be helpful.
15:26tbaldridgenoprompt: is this on the JVM or JS?
15:26noprompttbaldridge: cljs
15:27noprompttbaldridge: effectively what we want is a stubbed read-port.
15:28jcromartieis there anything that's like the opposite of partial? i.e. I want to replace #(mod % x)
15:28jcromartiewith (something mod x)
15:28noprompttbaldridge: such that take! just returns a piece of fake data.
15:29pdkpartial can only take empty arguments at the end
15:29pdkyou'd have to roll your own
15:31jcromartieoh I got it :)
15:31jcromartie(comp (partial apply mod) reverse (partial list x))
15:31jcromartie:) this an exercise in point-free style obviously
15:32antonvhi
15:32antonvwhat IDE you use for Clojure? SLIME or some other?
15:33antonvto be able to evaluate Clojure code interactively
15:33llasramantonv: https://github.com/clojure-emacs/cider
15:33bob2`emacs is popular, with cider
15:33nopromptantonv: emacs, vim, intellij w/ cursive, light table, sublime
15:34nopromptantonv: several editors have support for that functionality.
15:34AdmiralBumbleBeeman, I can't keep up with all these clojure ides
15:34AdmiralBumbleBeeI wasn't even aware nrepl changed names
15:35antonvthanks for the responses. I am interested in a simples possible setup
15:35llasramAdmiralBumbleBee: nREPL didn't change names. nrepl.el did, to avoid confusion with nREPL :-)
15:35antonvwhat I can setup as fast as possible; I can tolerate some limitations in functionality
15:36jcromartieantonv: if you are comfortable with Emacs, the cider setup is pretty easy
15:36llasramantonv: If you already know emacs, you can just install cider package (and Leiningen) and be done
15:36jcromartieif not, then I would recommend LightTable
15:37jcromartieit's pretty much instant gratification :)
16:08antonvjcromartie: thanks
17:01ystaelCIDER is hanging my Emacs when it tries to display a docstring. Is this a known problem with a known fix?
17:04ystael... looks like the ac-cider package I had was conflicting with something else.
17:06technomancyauto-complete is probably the biggest source of weird cider problems
17:06technomancyauto-complete.el that is
17:08ystaeltechnomancy: so should i have ac-cider and not auto-complete, rather than the other way around?
17:09technomancyI don't know; I just know getting rid of auto-complete.el often makes problems go away
17:10`cbpprelude doesn't include autocomplete which made me sad but i guess theres zarro boogs
17:11ystaelsounds good, if I had a burning need for magical autocompletion I would use a language that rewarded you more for using it, like C# :)
17:21dacc_what i'd miss is inline documentation
17:21dacccompletion is nice for exploring too i guess
17:22daccclojure is actually really nice for completion
17:22daccnot so many pesky dynamic typed objects with unknowable methods around
17:22daccjust functions in namespaces =)
17:56johnjelinekhihi all :)
17:57matthavenerjohnjelinek: hey :D
17:57johnjelinekso, I guess loop/recur around a take! is not quite a smart idea
17:57johnjelinekmatthavener: what up
17:58jodaroso like
17:58jodarogen-class
17:58jodaroextending and abstract class
17:58jodarowith an abstract method
17:59jodaroblammo with a Duplicate name&signature exception
17:59jodarofixable?
18:24tavoeLearing lighttable/clojure side by side. Getting "TypeError: Cannot call method 'call' of undefined" Does that mean anything to anyone? Because it doesnt' mean anything to me or google
18:25`cbptavoe: that's a javascript error
18:26`cbptavoe: it basically means you're doing something like calling nil
18:27amalloyand as everyone knows...##(nil 1)
18:27lazybotjava.lang.IllegalArgumentException: Can't call nil
18:28tavoeAnd it has fixed itself. After 20 minutes searching, I delete and re-add a line and the whole thing works. Thank you
18:30jodarothe old "wait 20 minutes and it will be fixed" solution
18:30sdegutisclojure: hey how's it goin
18:31amalloythat actually works sometimes in cljs, because 20 minutes after you report a bug dnolen_ has merged a fix
18:32johnjelinek+!
18:32johnjelinek+1*
18:32sdegutisYeah, somehow dnolen_ is on top of cljs like a hawk on top of whatever hawks are often on (probably tree branches).
18:32jodarolight posts
18:32sdegutisReally?
18:32`cbprabbits
18:33tvachonthe thick leather glove of a well monocled hunter
18:37sdegutisIs there some tool that lets me know which requires are unused in my source files?
18:37amalloysdegutis: slamhound?
18:37sdegutisHmm.
18:37sdegutisI thought that only rearranged them. Let me check.
18:38Bronsasdegutis: eastwood should have a linter for that
18:39sdegutisHow does Slamhound know what you're referencing when you use functions such as 'pprint'? It could be in a third party lib?
18:39sdegutisBronsa: Thanks I'll look.
18:39dsrxsdegutis: it looks for namespaces on the classpath iirc
18:40technomancysdegutis: if you're adding a new call it just guesses
18:40sdegutisAh neat.
18:40technomancyfrom the classpath, right
18:40sdegutisThanks you two.
18:40technomancyif you're rewriting an existing ns, it prefers existing declarations
18:40technomancybut yeah, it can guess wrong; I think it chooses whichever is shorter if it doesn't have anything else to go on
18:56sdegutistechnomancy: ha
19:00sdegutis,(let [{foo :foo :or {foo (prn "this should not print")}} {:foo "bar"}] foo)
19:00clojurebot"this should not print"\n"bar"
19:00sdegutisWeird?
19:02technomancyweird.
19:02sdegutistechnomancy: btw the 'ha' comment was about picking the shorter length symbol :)
19:03technomancysdegutis: oh... shorter namespace name, not var name symbol
19:03sdegutistechnomancy: I've more often heard of defaulting to alphanumeric string comparison
19:03sdegutistechnomancy: right
19:03technomancythe logic there being that longer stuff is more likely to be internal
19:04sdegutisAh, that makes sense.
19:04amalloysdegutis: well, the (let [{x y :or {x z}} m]) syntax expands to (let [x (get m y z)])
19:04sdegutisamalloy: Ah, didn't realize that. Thanks
19:05technomancyusing :or makes me think it would expand to an actual clojure.core/or call
19:05sdegutisI assumed so too.
19:05amalloytechnomancy: that's a reasonable intuition to have, of course
19:06amalloybut then what if m is {y nil}?
19:06sdegutisAlthough in this case, doesn't (get) have some special semantics when the key is actually absent and not just nil?
19:06sdegutisYeah, that.
19:06technomancyamalloy: just makes me think :or isn't the right word for that
19:06sdegutistechnomancy: yeah I'd think :default would be a better word here
19:07sdegutis\cc amalloy
19:07technomancysdegutis: you should submit a pull request
19:09amalloy~rimshot
19:09clojurebotBadum, *tish*
19:10sdegutisCould not find sufficiently humourous 'oh you' gif in time. Defaulting to using textual representation.
19:10sdegutistechnomancy: 'oh you'
19:12sdegutis(Somehow it's not the same.)
19:14technomancyhttp://p.hagelb.org/oh-you.jpg
19:14`cbpi knew it
19:15sdegutisPerfect.
19:16isaacbwis this library the most common for mocking ring requests? https://github.com/weavejester/ring-mock
19:16sdegutisI use it to good effect.
19:17bob2`ditto
19:19isaacbwcool beans, thanks
20:07TravisDanyone here from Pittsburgh?
20:17tavoeQuick question. If Lists and Vectors are both immuable, what's the difference? I see them used in different places, but to my untrained eye, it looks arbitrary
20:18bob2`they are implemented completely differently
20:18bob2`one is a linked list, so very cheap to prepend but everything else is expensive, one is an array, so cheap to look up and "mutate" but expensive to prepend to
20:19bob2`vectors are conventially used for things like let bindings and function arg lists, too
20:20ddellacostatavoe: http://stackoverflow.com/questions/1147975/in-clojure-when-should-i-use-a-vector-over-a-list-and-the-other-way-around
20:20tavoebob2', don't tell bob1', but I like you better
20:20bob2`haha
20:23TravisDrh
20:32jodarohttps://github.com/joshrotenberg/gen-class-issues
20:33jodaroif anyone happens to know why this is
20:33jodaroi'd love to figure it out
20:36amalloywhat is the ^{Override {}} thing about, jodaro?
20:36amalloyi don't see that mentioned in genclass docs
20:37amalloyare you just setting an annotation? if so, why?
20:37jodaroyeah
20:37jodaroi saw it somewhere on the internets
20:38jodarodoesn't seem to make a difference either way, though
20:38amalloythe @Override annotation is source-only - it doesn't get put into the generated classfile
20:38amalloyyeah, i wouldn't expect it to
20:40amalloyjodaro: what happens if you change getFoo from protected to public?
20:42jodarohmm
20:44jodarowell doStuff is the problem
20:44jodaroso
20:44jodaronothing that i can tell
20:45amalloyoh, i misread
20:46jodarohttp://dev.clojure.org/jira/browse/CLJ-956
20:46jodaroi found that
20:46jodarobut the sample repo is gone, so i'm not sure if its the same issue or not
20:47amalloyjodaro: i think he's saying just remove the :methods declaration
20:47amalloyie, don't declare your own doStuff, since there's already one
20:48jodarohmmm
20:57jodaromf
20:57jodarothat was it
20:57jodarothanks for letting me borrow your reading comprehension skills
21:00jodarothought i might have to write some java for a little while there
21:04ddellacostais there a more...straightforward way to do this?
21:04ddellacosta,(update-in {:foo {:bar "bar" :baz "baz" :quz "quz"}} [:foo] (fn [foo] (into {} (remove #(some #{:bar} [(key %)]) foo))))
21:04clojurebot{:foo {:quz "quz", :baz "baz"}}
21:05ddellacostaa.k.a. removing a specific MapEntry, identified by key, from a nested map structure
21:06amalloy(update-in m [:foo] dissoc :bar)?
21:10amalloyddellacosta: ^
21:10ddellacostaamalloy: a, *much* nicer...thanks!
22:11RaynesOh dear, I've lost an amalloy.
23:03Mandy27 You can find funny videos here. http://bit.do/my_videos69
23:29charewhat is going on here when apply takes partial twice ????? (defn faux-curry [& args] (apply partial partial args))