#clojure log - Mar 06 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:00 mischov: dissipate: Pedestal is also undergoing a bit of a redesign.

0:00 ddellaco_: dissipate: I remember it being pretty good actually. My only objection to Pedestal for a beginner is that it is super magical.

0:00 mischov, dissipate: yeah, and it was in flux too, I recall...better to wait for v3 (0.3? forget)

0:00 dissipate: ddellaco_, well, magic is awesome. :P

0:01 mischov: dissipate: It's not only magical- it's complicated (to me, at least).

0:01 ddellaco_: 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.

0:01 dissipate: ddellaco_, gotcha.

0:02 ddellaco_: 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.

0:02 or at least, was...we'll see how the new version looks.

0:03 dissipate: ddellaco_, 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.

0:04 mischov: ddellaco_: 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.

0:04 ddellaco_: 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.

0:05 dissipate: mischov, where most clojure developers are or developers in general?

0:05 ddellaco_: 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.

0:06 dissipate: ddellaco_, not that i have found yet

0:06 ddellaco_: 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...

0:06 mischov: dissipate: Clojure developers in particular. But ahead of the curve in general.

0:06 segmond: what about noir?

0:07 ddellaco_: segmond: Noir is discontinued. And Noir has (had) a lot of patterns in it which I really don't like, it is very stateful.

0:07 dissipate: mischov, how powerful is pedestal compared to other non-clojure frameworks like ruby on rails?

0:07 segmond: oh okay, thanks. i was just searching for clojure web frameworks, so just in time.

0:08 MattAbbott: this is going to sound silly, but how hard is it to pick up something like ring/compojure if I basically no web experience?

0:08 ddellaco_: 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.

0:09 dissipate: ddellaco_, sounds like MVC stuff

0:09 ddellaco_: 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)

0:09 Denommus: ddellaco_: what about this "app-handler" function from noir? What does it do?

0:10 noprompt: segmond: fwiw, i would avoid frameworks. just try to build your app from the ground up. you'll get more out of that.

0:10 segmond: noprompt, why is that?

0:10 Denommus: ddellaco_: ah, only saw your opinion now

0:11 I'm going to sleep now

0:11 ddellaco_: 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

0:11 noprompt: segmond: typically, applications in clojure are built from *libraries*.

0:11 MattAbbott: thanks. 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.

0:11 ddellaco_: Denommus: 'night.

0:11 dissipate: noprompt, from the ground up? for real?

0:12 ddellaco_: 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."

0:12 segmond: noprompt, elaborate please

0:12 MattAbbott: ooh, very cool

0:12 noprompt: dissipate: why not? i bailed out of rails and did that when i first started clojure, what's the problem?

0:12 ddellaco_: dissipate: I assume he's talking about the same thing as I am, Ring + Compojure to start (are you noprompt?)

0:12 mischov: MattAbbott: https://github.com/pedestal/pedestal/tree/master/guides/documentation

0:12 noprompt: ddellaco_: yes.

0:12 dissipate: ddellaco_, how does pedestal model an HTTP request?

0:12 mischov: MattAbbott: They had better docs but site is down because they're redesigning framework.

0:12 noprompt: segmond: how can i elaborate more on that?

0:12 ddellaco_: dissipate: no freaking idea. ;-)

0:13 dissipate: but I actually think Pedestal uses Ring under the covers.

0:13 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.

0:13 segmond: noprompt, because your answer is terse

0:13 mischov: ddellaco_: As far as I understand.. kinda uses ring.

0:13 noprompt: segmond: compojure/ring + a database library + whatever else your application needs?

0:13 dissipate: noprompt, 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.

0:14 noprompt: dissipate: it is boring.

0:14 MattAbbott: mischov: 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?

0:14 dissipate: ddellaco_, functional relational programming?

0:14 ddellaco_: dissipate: functional reactive programming. I

0:14 mischov: MattAbbott: No idea, I'm afraid. Sorry.

0:14 dissipate: noprompt, how does someone get excited about an MVC framework? i do not know

0:14 ddellaco_: dissipate: ...I'm not sure if they actually use that term though, but I think it's been described as such.

0:14 noprompt: segmond: also, imho, frameworks tend to pigeon hole you into solving a problem the "framework way" instead of encouraging you to "just solve your problem"

0:15 dissipate: ddellaco_, 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.

0:15 segmond: noprompt, mmm ok, i don't know much, i guess i'll find out in due time.

0:15 noprompt: and by that i mean, just look for libraries that solve your problem and if one doesn't exist just write the code yourself.

0:15 technomancy: "Solve your problem: the Bruce Campbell way!" https://visualcrack.files.wordpress.com/2008/06/make-love-the-bruce-campbell-way.jpg

0:16 ddellaco_: (inc technomancy)

0:16 lazybot: ⇒ 99

0:16 noprompt: segmond: yeah, just do some homework, try and figure things out. ask questions here or google if you get stuck.

0:16 ddellaco_: technomancy: does that involve chainsaws?

0:16 technomancy: ddellaco_: don't see how it could be any other way

0:17 MattAbbott: ddellaco_ 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

0:17 noprompt: segmond: i've learned a ton building applications from the ground up.

0:17 dissipate: noprompt, 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.

0:17 noprompt: dissipate: nah, i'm not saying that.

0:17 * technomancy contacts bruce campbell's agent to discuss terms for a Leiningen endorsement contract

0:17 noprompt: dissipate, segmond: compojure is a good start.

0:18 * ddellaco_ wholeheartedly supports technomancy's Bruce Campbell sponsorship initiative

0:18 * ddellaco_ but must now get back to work

0:18 MattAbbott: so 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?

0:18 noprompt: hell, you can even do what i usually do and start off w/ a clojure atom as a "database" and some clojure.set action.

0:19 technomancy: MattAbbott: 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.

0:19 noprompt: you can get *very* far with just those two things.

0:20 MattAbbott: well, ideally the model would be clear-cut enough to put a view on top of at some point

0:20 xuser: noprompt: did you wrote to a file to make it persistent?

0:20 noprompt: xuser: no

0:21 * ddellaco_ can't wait to show all you folks what we've been working on w.r.t. data and web apps, but must keep working on it now so he can show you folks, so will now shut up for reals

0:21 noprompt: xuser: i usually make dummy data generators for populating stuff.

0:21 xuser: ddellaco_: you have to tell us now

0:21 ddellaco_: xuser: no

0:21 xuser: noprompt: ok

0:21 MattAbbott: ddellaco_: where do you work?

0:21 noprompt: xuser: i do that often on the client-side too avoid having to hit a real api.

0:22 ddellaco_: MattAbbott: diligenceengine.com

0:22 MattAbbott: ah cool

0:22 technomancy: wait this isn't steampunk

0:23 noprompt: fwiw, these are just notes from my experience developing applications.

0:23 * technomancy re-reads url

0:23 technomancy: oh, *diligence*

0:23 noprompt: you 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.

0:24 ddellaco_: technomancy: that would be sweet right? "Finally harnessing the promise of steam and manifesting Babbage's vision."

0:25 Nyyx: why should I require :refer :all instead of :use?

0:25 MattAbbott: noprompt: 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

0:26 Nyyx: what sitgma is there vs the two

0:26 ddellaco_: Nyyx: you should do neither, ideally. :refer to specific names or use a namespace alias

0:26 xuser: noprompt: yeah, I'm just working with a set of maps right now :)

0:26 Nyyx: ddellaco_: but when you want to use one or the other?

0:26 noprompt: the 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.

0:26 ddellaco_: 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...

0:27 noprompt: xuser: that's how i do it. :)

0:28 holy cow... i've almost done it... the entire sass parse tree as pure data.

0:28 now for the crazy part...

0:31 ambrosebs: well apparently it's impossible to unsubscribe from test.check PR #1

0:31 great

0:31 why does it still come up in my feed with notifications off?

0:31 noprompt: technomancy: can lein do a local search for artifacts?

0:32 err jars i mean

0:32 technomancy: noprompt: not really; lein search just works with lucene indices

0:32 it doesn't have an indexer

0:33 noprompt: technomancy: hmm... i guess i could reuse some code from lein-describe and crawl ~/.m2

0:33 technomancy: sometimes i forget what i have installed, what versions, etc.

0:33 technomancy: noprompt: you can't grep?

0:33 noprompt: technomancy: boring. :-P

0:34 technomancy: j/k, no, you're right i could.

0:34 technomancy: 'http://p.hagelb.org/unix.jpg

0:45 seancorfield: ambrosebs: I was able to unsubscribe directly from the page for that PR

0:46 ambrosebs: seancorfield: I tried toggling it again, perhaps it'll work this time.

0:46 seancorfield: It's probably my fault for commenting on it.

0:47 github is punishing my stupidity

0:47 firefaux: how would you make a lazy sequence of [key value] pairs from a map, sorted by value?

0:48 seancorfield: Ah, if you commented, you may not be able to unsubscribe. I resisted... barely... :)

0:48 firefaux: I want to make some functions like top-n and bottom-n

0:48 seancorfield: ,(sort-by key {:a 1 :c 2 :d 3 :b 4})

0:48 clojurebot: ([:a 1] [:b 4] [:c 2] [:d 3])

0:48 firefaux: ohhhh

0:49 now I feel dumb

0:49 I was trying to do something with (into (sorted-map-by))

0:49 seancorfield: not sure how lazy that is tho' since sorting kinda requires processing all of the elements...

0:50 firefaux: ,(sort-by val {:a 1 :c 2 :d 3 :b 4})

0:50 clojurebot: ([:a 1] [:c 2] [:d 3] [:b 4])

0:50 firefaux: that's a good point

0:50 doesn't really matter then

1:02 fowlslegs: I started writing a program to evolve a solution for a string rearrangement puzzle...

1:02 then I found out it was unsolvable ;'(

1:02 Well, that was my Clojure story of the day.

1:06 dsrx: doesn't mean there's not a heuristic for it or something

1:06 er, what do you mean by unsolvable

1:11 logic_prog: suppose I own "mydomain.com" and "mydomain.com" has its dns pointed at digitalocean

1:11 hmm, wrong channel

1:26 sm0ke: hey is there something like lein-autoexpect for plain clojure.test?

1:36 seancorfield: sm0ke: that question seems to come up a lot... both Expectations and Midje have auto-runners

1:36 sm0ke: seancorfield: what about clojure.test?

1:37 i found this https://github.com/jakepearson/quickie

1:37 have to try

1:41 seancorfield: sm0ke: 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...

1:41 I wish there was something we could point people at :)

1:42 sm0ke: ok, quickie seems to be working for me

1:42 seancorfield: I only use clojure.test for contrib libraries - I use Expectations for all my testing stuff...

1:43 ddellaco_: seancorfield, sm0ke: not sure what the state of it is, but: https://github.com/aphyr/prism

1:43 I guess quickie is more recently maintained though.

1:44 seancorfield: quickie looks like a reasonable solution... hadn't heard of it before...

1:44 ddellaco_: seancorfield: yah, me neither, will have to check it out.

1:45 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.

1:46 sm0ke: hmm it is good, thinking of sending a pr for printing a bell char on failure though

1:52 ddellaco_: 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.

1:52 sm0ke: yep, let contibute to quickie then :)

2:10 weird i just installed plugin locally using 'lein install' but still 'lein quickie' fetched an old version from clojar?

2:11 do i have to add ~/.m2 to prfiles.clj in :repositories?

2:19 muhoo: best stacktrace ever https://www.refheap.com/52871

2:20 um... ok... this when trying to run https://www.refheap.com/52872

2:20 akhudek: what stack trace?

2:21 muhoo: this one https://www.refheap.com/52874

2:22 some death deep in the bowels of nrepl or lein, where stacktraces can't reach them.

2:23 specifically, deep in weasel, since it's the second form in there that dies (when evaled on its own)

2:26 akhudek: muhoo: oh man, those are the worst

2:27 muhoo: 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

2:27 so annoying

2:27 muhoo: yep, it's time for stepping through the code the old fashoined way: by hand, no stacktrace

2:28 akhudek: println debugging :-(

2:34 muhoo: src path... methinks

2:35 noprompt: is it possible to implement clojure.lang.Named for some type?

2:36 muhoo: nope

2:36 noprompt: bummer

2:37 muhoo: noprompt: 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

2:37 noprompt: muhoo: it's an interface

2:38 muhoo: in general extending stuff is a lot easier in cljs because it uses protocols a lot (exclusively?). jvm clojure uses java interfaces.

2:38 for most things

2:38 but my java-fu is weak; others may know hacks to do what you're trying to do

2:40 hmm, is (env/default-compiler-env) supposed to show an empty {} atom?

2:42 well i gots a more thorough stacktrace: https://www.refheap.com/52881

2:45 aaand the broken thing appears to be (cljsc/cljs-dependencies {} ["weasel.repl"])

2:53 BANG! it's cljs 2173! breaks weasel in some inexplicable way.

2:53 * muhoo prepares test case and bug report

3:01 muhoo: oh wow, this breaks on 2173 too: (cljsc/cljs-dependencies {} ["goog.string" "cljs.core"])

3:29 Nyyx: joy of clojure shows a function that they say is impure because it uses a (def {some map data...})

3:29 is it impure because the var can change reference?

3:29 and if so how do you define top level constant references?

3:35 opqdonut: Nyyx: if you do a def inside a function body then yes, that is impure, the function has a side effect

3:35 Nyyx: top-level constants are simply defined by having a def at the top level

3:36 Nyyx: opqdonut: there's no def in the function body

3:36 opqdonut: then it doesn't sound unpure impure to me

3:36 Nyyx: yet joy of clojure books says it's impure and suffixed the function with '!'

3:37 opqdonut: is the code in question online?

3:37 https://github.com/joyofclojure/book-source/tree/master/src/joy which file?

3:38 Nyyx: opqdonut: https://www.refheap.com/52899

3:39 opqdonut: hmm, okay

3:39 it's not impure due to the code itself

3:39 it's impure due to the design that alters the definition of plays

3:39 Nyyx: but there is no design

3:39 it just says there's a possibility

3:40 opqdonut: it's a weird argument

3:40 Nyyx: should I suffix '!' for my code that just refers to def's?

3:40 opqdonut: because by that reasoning every function ever would be impure

3:40 (because e.g. the functions it refers to might get redeffed)

3:40 no, you should not

3:40 Nyyx: that's what I was thinking

3:40 okay, seems like a poor example to use in this book then

3:41 opqdonut: now if plays were an atom, it would make more sense

3:46 clgv: opqdonut: "pure" means always same output on same input no matter how the environment surrounding the function changes

3:46 Nyyx: ^^

3:47 opqdonut: clgv: if you define the "surrounding environment" to include other top-level def(n)s, no function is pure

3:48 the book seems to be arguing that a function was impure because it accesses a def, and somebody might redef the def

3:49 clgv: yeah surely, although I'd limit it to "defs" that contain global values which are expected to be changed.

3:49 opqdonut: also, 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

3:50 Nyyx: unless maybe you argue chaing the world is an output?

3:51 clgv: humm right, I limited the description to the function itself which wouldnt be affected from the atom change if it does not read it

3:52 opqdonut: IMO clojure code that redefs stuff as part of normal operation is ugly

3:52 wrap the data in an atom and it'll at least be clear that it's mutated

3:55 clgv: "few points of mutation" as design goal so to say

4:26 schaueho: geek

5:18 sm0ke: what da..?

5:18 chare: what is File. mean in (import '(java.io File)) (.listFiles (File. "."))

5:19 sm0ke: no docstrings allowed in defrecord?!

5:19 clgv: sm0ke: no. you are supposed to put those in defprotocol

5:22 fredyr: chare: File. is the same as `new File()`

5:22 chare: 100% the same

5:22 ZERO exceptions?

5:22 sm0ke: clgv: protocol allows doc string?

5:23 clgv: sm0ke: yes

5:24 sm0ke: makes sense then, but if clojure doesnt allow codesharing amongst defrecords for same protocol, it makes sense to have specifice doc strings for each record

5:24 chare: fredyr: you not responding...

5:24 clgv: sm0ke: not really, since the contract should be clear with the protocol

5:25 fredyr: chare: not sure what you're after, but (File. ".") just expands to (new File ".")

5:25 chare: File. is a macro?

5:25 clgv: sm0ke: you could not query those docstrings anyway

5:25 chare: no. a sepcial form

5:25 *special

5:26 fredyr: ,(macroexpand-1 '(File. "."))

5:26 chare: so then (new File ".") is also a special form?

5:26 clojurebot: (new File ".")

5:26 fredyr: http://clojure.org/java_interop#Java%20Interop

5:26 clgv: chare: ok "File." is a reader macro so to say and "new" is the special form

5:27 fredyr: `Clojure supports special macroexpansion of symbols containing '.'`

5:27 Cr8: ,(read-string "(java.io.File. \"foo\")")

5:27 clojurebot: (java.io.File. "foo")

5:27 Cr8: ,(macroexpand-1 '(java.io.File. "foo")

5:28 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

5:28 Cr8: ,(macroexpand-1 '(java.io.File. "foo"))

5:28 clojurebot: (new java.io.File "foo")

5:28 sm0ke: well at least a top level doc string for record is not debatable

5:28 fredyr: Anyway, its the dot that's special, it can be any symbol

5:28 Cr8: ,(macroexpand-1 '(wibbity. "foo"))

5:28 clojurebot: (new wibbity "foo")

5:29 fredyr: ,(macroexpand-1 '(:wicked. "."))

5:29 clojurebot: (:wicked. ".")

5:29 Cr8: ,(macroexpand-1 (list (symbol ":unholy.") "foo"))

5:29 clojurebot: (new :unholy "foo")

5:30 fredyr: ya, symbols ending w/ dot

5:30 clgv: sm0ke: yeah. maybe there is a feature ticket for that in jira you can vote on. otherwise you should create one

5:31 it'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^^

5:31 Cr8: it's more like any symbol ending in . is implicitly handled like a macro

5:34 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6587-L6598

5:34 sm0ke: anyone tried clojure on mlvm?

5:35 i wonder if -XX:Tailcalls can get clojure riddance from (recur)

5:42 clgv: guess what you cant have docstrings for method definitions in protocols too

6:01 clgv: sm0ke: you misread. see ##(doc defprotocol)

6:01 lazybot: ⇒ "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

6:20 clgv: I 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

6:20 what might be wrong?

6:21 bob2`: are you sure you told lein to use the :uberjar profile?

6:22 clgv: I thought that profile is used for the uberjar task automatically?

6:23 bob2`: I did not think so

6:24 https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#activating-profiles

6:24 clgv: I thought it's used automatically like the :user profile for example

6:25 see https://github.com/technomancy/leiningen/blob/6853a511f9f68264a9fefd9c706b51faae13fc94/resources/leiningen/new/app/project.clj#L9

6:26 bob2`: https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#debugging seems relevant also

6:27 all I can think is you're using ring ubjerjar or something

6:27 clgv: nope. "lein uberjar"

6:27 bob2`: or that the docs are unclear and you're meant to use with-profile

6:29 clgv: ok it's definitely in there: https://github.com/technomancy/leiningen/blob/master/src/leiningen/uberjar.clj#L131

6:30 must be some error with the regexp, although that one looks correct

6:32 humm maybe it's matching directories instead of namespaces then dashes would be the problem^^

8:21 hhenkel_: 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.

8:22 I'm aware that this must be an bug in my code but currently I'm not able reproduce it.

8:22 That's the code in question: https://www.refheap.com/52956

8:23 Anderkent: hhenkel_: how many times were you calling request-and-process without reading from channel?

8:24 hhenkel_: Anderkent: The issue occurs at night when the servers are restared I guess...

8:24 Anderkent: ...ah or maybe there is an issue with the server that should get the data...

8:25 Anderkent: ...and therefore the data is not read?

8:25 Anderkent: hhenkel_: well, basically the issue is in whatever code is calling the request-and-process method, or with whatever is reading from channel

8:25 as the error says, you can't have more than 1024 pending puts on a single channel

8:25 hhenkel_: Problem at the moment is, that I have no timestamps, therefore it's hard to tell.

8:26 Anderkent: ,(use 'clojure.core.async)

8:26 clojurebot: #<FileNotFoundException java.io.FileNotFoundException: Could not locate clojure/core/async__init.class or clojure/core/async.clj on classpath: >

8:26 Anderkent: bah

8:26 hhenkel_: okay, so the data is not fetched from the channel then, right?

8:26 Anderkent: either that, or something is calling request-and-process very quickly and the reads are not fast enough

8:27 hhenkel_: okay, don't think that this is the case as it works all day till some restarts occur at night.

8:28 Tested it through the day with shutting down systems and starting them up after some time...

8:28 ...and that went well, so maybe I need to remove the sender connection for some time...

8:28 Anderkent: hard 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

8:28 hhenkel_: ...that may result in the same issue then.

8:29 Kototama: hi, why does (spit "/tmp/a.zip" (:body (http/get "url-with-zip"))) creates a corrupted zip ?

8:30 Anderkent: Kototama: I'd expect spit to open the file in text mode; you want binary mode for binary content

8:33 Kototama: https://github.com/clojure-cookbook/clojure-cookbook/blob/master/04_local-io/4-19_handle-binary-files.asciidoc

8:37 clgv: I am still struggeling with aot compilation. although my regexp mathces those namespaces some of them are not aot compiled

8:37 those are namespaces of a dependency. but a lot of the namespaces of that dependency are compiled

8:38 Anderkent: clgv: aot will only compile namespaces of a dependency that are loaded by namespaces that match your regex, afaik

8:39 clgv: Anderkent: oh damn. that means I need to aot them in the dependency? I only want them aot compiled for the uberjar....

8:39 Anderkent: hm, why do you need them aot compiled if your code doesnt use them?

8:40 clgv: my program is loosely coupled via a configuration with the functions of the dependency, so they are used but not statically required

8:40 Anderkent: hm, I see. Have you tried with :aot :all?

8:41 Also, as a workaround, you can add a layer of indirection - have namespaces of your own that statically require the external ns

8:41 but then dynamically require your own namespace according to config

8:42 Kototama: there is an example http://myotherpants.com/tag/clojure/ the copy-file function pass the {:as :byte-array} argument to the http/get function

8:43 clgv: Anderkent: there are many namespaces...

8:43 Anderkent: and you absolutely need all of them to be aot compiled?

8:43 I find it hard to imagine why

8:44 clgv: Anderkent: originally because I want to assure unchecked-math. but I guess I can set that a central poinrt

8:49 hhenkel_: Anderkent: I updated https://www.refheap.com/52956 with the function that should read from the channel.

8:50 My setup / idea is like that: Read data from jolokia (jmx as json) from weblogic servers and send it to zabbix

8:50 I see that the first server is restarted at 01.00 and after the restart the script is able to provide more data.

8:51 Anderkent: hhenkel_: hm, so if your service on port 10051 dies first, then you stop reading?

8:51 hhenkel_: Once the second server is restarted my script seems to be in error state.

8:51 Anderkent: The service on port 10051 (zabbix) is running the whole time.

8:52 I guess data should be dropped in that case though.

8:53 Anderkent: right; I guess this is one of these things that might be pretty hard to debug

8:55 hhenkel_: I'll try to see if I can simulate this by restarting first one server and that after some time restart the other

9:06 Kototama: how can i offer a binary resource with liberator? It seems defroute + available-media-types ["application/zip"] also corrupts the zip content

9:09 maybe the problem is again my usage of slurp with binary data hummm

9:13 so i guess my question is how to use byte-array with :handle-ok in liberator

9:18 clojure.java.io/input-stream does the trick

9:20 hhenkel_: 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.

9:38 gfredericks: https://github.com/Prismatic/plumbing/blob/master/src/plumbing/core.clj#L158

9:38 ^ this presumed typo makes me think an extra arity on `first` would be kind of cool

9:54 gmorpheme: can 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...

9:55 llasram: gmorpheme: Either you or someone with the same question just a sec ago got the answer on the clojure-users mailing list

9:56 chouser: You can't bash transients in place!

9:56 gmorpheme: ah. got it. thanks llasram

9:57 llasram: Well, you can. It just doesn't do what you probably want :-)

9:57 chouser: hm

9:57 I guess that's fair.

9:59 gfredericks: afaik that's the ONE instance in which bashing in place doesn't do what you want

9:59 hyPiRion: when the tree grows its height?

10:00 gfredericks: you're suggesting an alternative scenario?

10:01 hyPiRion: when it shrinks

10:01 gfredericks: ,(let [m (transient (hash-map))] (dotimes [n 10000] (assoc! m n (inc n))) (let [m' (persistent! m)] [(count m) (get m 4567)]))

10:01 clojurebot: #<IllegalAccessError java.lang.IllegalAccessError: Transient used after persistent! call>

10:02 gfredericks: ,(let [m (transient (hash-map))] (dotimes [n 10000] (assoc! m n (inc n))) (let [m' (persistent! m)] [(count m') (get m' 4567)]))

10:02 clojurebot: [8 nil]

10:02 hyPiRion: oh right, an actual error message

10:02 gfredericks: hey that's curious

10:02 ,(type (hash-map))

10:02 clojurebot: clojure.lang.PersistentArrayMap

10:02 gfredericks: lol

10:02 ,(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:02 clojurebot: [10000 4568]

10:02 gfredericks: ^ seems to work there, and surely the tree grew a bit?

10:04 hyPiRion: count may not actually return the right value thoughj

10:04 gfredericks: I'm calling it on a persistent structure

10:05 do hash-maps shrink into array maps?

10:05 hyPiRion: Hrm

10:06 gfredericks: ,(->> (range 300) (map (juxt identity (constantly :val))) (into {}) (apply dissoc (range 298)) (type))

10:06 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentMap>

10:06 gfredericks: I need plumbing.core/<-

10:06 ,(-> (->> (range 300) (map (juxt identity (constantly :val))) (into {})) (apply dissoc (range 298)) (type))

10:06 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (21) passed to: PersistentHashMap>

10:06 gfredericks: ,(-> (range 300) (->> (map (juxt identity (constantly :val))) (into {})) (apply dissoc (range 298)) (type))

10:06 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (21) passed to: PersistentHashMap>

10:06 lvh: Hi

10:07 gfredericks: I give up on computers

10:07 clgv: gfredericks: or clojure.core/as-> ;)

10:07 lvh: I have a binary multiplication function *; is there an easy way to define pow using it?

10:07 gfredericks: do you want easy or fast?

10:07 lvh: it'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:07 gfredericks: I actually think that for answers > 4 computers can't really solve it

10:07 gfredericks: so let's go with "easy"

10:08 or "elegant" maybe

10:08 gfredericks: (fn pow [x n] (reduce * (repeat n x)))

10:08 lvh: wow, that is very pretty

10:08 gfredericks: the squaring version isn't too difficult either

10:09 lvh: gfredericks: the only reason I'd care is because I'm producing inputs to loco/choco, a constraint solver

10:09 clgv: lvh: you will need recursion for and efficient version ;)

10:11 lvh: powers of 2? you mean like multiply-and-square?

10:11 gfredericks: lvh: btw I have a lib somewhere to turn binary operations into variadic

10:12 gmorpheme: ,(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:12 clojurebot: (8 20000 20000 20000 20000 ...)

10:12 gfredericks: lvh: https://github.com/fredericksgary/lib-4395/

10:17 clgv: gfredericks: nice. pretty handy for crypto stuff. strange name though. do you like the factors of 4395?

10:17 gfredericks: ,(format "lib-%04d" (rand-int 10000))

10:17 clojurebot: "lib-6098"

10:17 gfredericks: $google lib-4395

10:17 lazybot: [LIB 4395 Analyses of Crystal Violet & Brilliant Green] http://www.fda.gov/Food/FoodScienceResearch/LaboratoryMethods/ucm071574.htm

10:18 gfredericks: I was going to say it's handy for googleability but clearly it isn't

10:18 clgv: interesting lib name generation scheme :P

10:18 well, you need a better prefix^^

10:18 gfredericks: :)

10:19 clgv: not many intersting properties: http://www.wolframalpha.com/input/?i=4395

10:19 gfredericks: ,(->> (repeatedly 4 #(rand-int 26)) (map #(+ (int \a))) (map char) (apply str))

10:19 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval89/fn--90>

10:19 gfredericks: ,(->> (repeatedly 4 #(rand-int 26)) (map #(+ % (int \a))) (map char) (apply str))

10:19 clojurebot: "lvnn"

10:20 gfredericks: lvnn-4395 then?

10:20 bbloom: dnolen_: http://www.scala-js-fiddle.com/gist/9362801 <- scala.js with some rx framework thinggy

10:20 dnolen_: kinda interesting

10:20 clgv: gfredericks: but well you need primitive support top be really useful in crpyto ;)

10:23 gfredericks: clgv: yeah would probably need to switch to a macro approach for that

10:23 clgv: I wrote this because I got tired of doing it every time I had some algebraic thing I wanted to define

10:24 clgv: gfredericks: I just added a modul param to the basic operations and initialized the functions via partial for some crypto implementation

10:25 gfredericks: awhut??

10:25 lazybot: gfredericks: Definitely not.

10:26 dnolen_: bbloom: yeah I saw that

10:28 bbloom: 19mb of JS and source maps

10:29 clgv: gfredericks: (defn add [m, a, b] (mod (+ a b) m)) but it was just for quick and dirty code for exercises

10:29 dnolen_: 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:29 bbloom: would be nice if CLJS did that - would likely get a big speed bump as well

10:30 er I mean compile time bump - not perf

10:36 bbloom: dnolen_: definitely

10:37 dnolen_: the work would ultimately help AOT compilation for JVM CLJ as Bronsa continues his work

10:38 tbaldridge: dnolen_: how hard would it be to have CLJS use tools.analyzer?

10:52 seangrove: Hrm, any clear way to do drag/drop with javascript, but have the thing being dragged different from what was initially clicked?

10:53 I'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:54 gfredericks: clgv: ah right

10:59 shep-werk: seangrove: http://jqueryui.com/draggable/#visual-feedback

10:59 certainly possible to do

11:00 see the "custom helper"

11:00 seangrove: shep-werk: Ah, perfect, thank you

11:02 bbloom: i really like trello's drag drop effects

11:02 http://jsfiddle.net/RVta5/

11:04 dnolen_: tbaldridge: hmm dunno, probably mostly tedious work to make the CLJS AST conform

11:04 tbaldridge: we're already pretty close I think the main missing bit is :children

11:04 tbaldridge: yeah that's what I figured.

11:05 dnolen_: would be awesome

11:06 bbloom: dnolen_: 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:07 edw: Has anyone seen Emacs locking up while completing using the latest MELPA CIDER?

11:09 seangrove: tbaldridge: What're you looking to do with CLJS + tools.analyzer?

11:10 tbaldridge: seangrove: I want to unify all the analyzers laying around in the Clojure world. I've integrated tools.analyzer into core.async CLJ,

11:10 seangrove: tbaldridge: Ah, sounds like a good idea

11:10 tbaldridge: Someday I'd like to see the same analyzer be used by core.async, core.typed, CLJS, and tools.emit.jvm

11:11 bbloom: tbaldridge: huh, didn't realize you switched core.async over

11:11 tbaldridge: how'd it go?

11:11 dnolen_: tbaldridge: might be worth asking Bronsa to take a look at analyzer.clj and see how much work he think it would be.

11:11 tbaldridge: not too bad, just a about a day's worth of work

11:11 erdos: damn, i am also working on a brand new analyzer.

11:12 bbloom: tbaldridge: mostly cosmetic differences?

11:16 tbaldridge: bbloom: well the old code had to parse from sexprs, the new one just does gets on the hashmaps from the analyzer.

11:17 bbloom: tbaldridge: that's nice

11:17 tbaldridge: bbloom: 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:17 bbloom: grumble grumble dopey dot form

11:20 mabes: tbaldridge: is your latest work in the analyzer branch? https://github.com/clojure/core.async/commits/analyzer

11:20 tbaldridge: mabes: yep

11:21 I just need to figure out how to port that to CLJS and then I'll merge it into master

11:24 also, I'll be doing a talk on all the analyzer stuff at Clojure/West

11:25 Not that I wrote any of it, but Bronsa couldn't make it to the conference

11:25 mabes: tbaldridge: cool, looking forward to it!

12:34 mikerod: is 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:46 justin_smith: for build time, I assume you would want to hook onto the build tool (AKA probably leiningen)

12:46 effy: i'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:46 justin_smith: mikerod: you could use an injection that calls the function that creates the edn

12:46 there are example injections in the sample project.clj on github

12:47 effy: what numeric data type are you using?

12:48 effy: i declared it as (matrix (repeat 400 [1]))

12:48 for the 400,1 and same kind of thing for the 400,400

12:49 justin_smith: there are matrix libs that use more efficient structures / numeric types than the default clojure immutible vectors and auto-promoting longs

12:49 with the convenience tradeoffs that come with that of course

12:50 http://blog.getprismatic.com/blog/2013/7/10/introducing-hiphip-array-fast-and-flexible-numerical-computation-in-clojure

12:50 effy: but we are talking of a x100 time here

12:50 justin_smith: yes

12:50 effy: i dont think immutability would cause 100 fold performace, would it ?

12:50 justin_smith: boxed longs are crazy slow

12:50 llasram: effy: The core.matrix Clojure vector backend is only for convenience

12:51 yep -- boxing is the primary culprit

12:51 effy: You'll want to default to a different backend, and coerce your data to that type

12:52 hiredman: you know, clojure does have vectors that can hold unboxed primitives, just no one ever uses them

12:52 effy: any idea of what kind of performance i can expect compared to numpy ?

12:52 once i did everything right

12:53 llasram: effy: Similar ballpark for most individual operations, but you'll find rough edges

12:54 hiredman: That would probably be a nice addition to core.matrix

12:55 effy: llasram: can you give me a head starts and tell me what rough edges i'll find in advance ? :p

12:55 hiredman: llasram: https://github.com/clojure/clojure/blob/master/src/clj/clojure/gvec.clj

12:55 llasram: hiredman: Yah, I've seen the implementation when perusing the source... Would just need someone to do the wiring :-)

12:55 justin_smith: oh yeah, vector-of

12:56 llasram: effy: Nope :-). Sorry, my main experience w/ core.matrix so far has been via a Mahout-backend implementation I haven't released yet

12:57 justin_smith: ,(vector-of :long 0 1 2 3)

12:57 llasram: effy: 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:57 clojurebot: [0 1 2 3]

12:57 justin_smith: hiphip is seriously worth checking out if you need fast number collection ops

12:57 llasram: effy: The good news is that AFAIK the implementations core.matrix considers core do implement everything directly, so you should probably be ok

12:58 effy: llasram: i'm going to repeat the experiment with AFAIK then and see how it does ! :)

12:58 llasram: hahaha

12:59 Yeah, core.matrix REDAME lists what are considered "mature" backend implementations: https://github.com/mikera/core.matrix#status

13:00 justin_smith: Clatrix uses blas, which is likely what numpy is using as well

13:00 for what that's worth

13:00 hiredman: comparing 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:00 effy: justin_smith: can you make 2d vectors with this method, reading the doc it seems to only work for primitive type :(

13:00 AdmiralBumbleBee: hallmarks of being slow?

13:00 such as... being slow?

13:01 hiredman: AdmiralBumbleBee: being one of these super dynamic interpreted langs

13:01 justin_smith: effy: 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:01 AdmiralBumbleBee: hiredman: I see what you're saying now

13:02 hiredman: there is some momentum behind building a new ffi interface for the jvm, which would be super for clojure

13:02 effy: justin_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:02 AdmiralBumbleBee: I fear an ffi for the jvm

13:03 the abuse of it to the extent of nearly ruining general cross-platform use of the jvm would be imminent I suspect

13:04 hiredman: the jvm has an ffi, jni, it just sucks

13:05 justin_smith: effy: 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:05 patchwork: Can't beat hand optimized fortran for matrix computation

13:06 justin_smith: true, 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:06 hiredman: the amount of ceremony required to transfer bytes over spi from my beaglebone is crazy

13:06 effy: justin_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:16 wow, you were right, that's a 100x speed improvement for a one line change ... (set-current-implementation :vectorz)

13:16 arrdem: and that, ladies and gentlemen, is a native java imp'l at work

13:16 effy: pretty awesome !

13:16 * arrdem sighs

13:19 bbloom: hurray boxing and total lack of user defined primitives!?

13:19 arrdem: I'll get the champaign...

13:42 gfredericks: ,(def devnull (reify clojure.lang.IPersistentCollection (count [_] 0) (cons [this o] this) (empty [this] this) (equiv [this o] (= o #{})) (seq [this] ())))

13:42 clojurebot: #'sandbox/devnull

13:42 gfredericks: ,(= devnull (into devnull (range 1000000)))

13:42 clojurebot: true

13:44 danneu: can anyone recommend a simple service/tool for tunneling all of a computer's internet traffic through my own server or a VPN?

13:45 jchauncey: isnt that what iptables are for

13:45 hyPiRion: gfredericks: hold on there man, seq returning () ?

13:46 gfredericks: hyPiRion: what's wrong with that?

13:46 danneu: jchauncey: 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:46 gfredericks: hyPiRion: oh hm

13:46 ,(seq devnull)

13:46 clojurebot: ()

13:46 gfredericks: hyPiRion: damn you're right

13:46 hyPiRion: sew should be idempotent

13:46 jchauncey: danneu: my guess is the lower level you go (os wise) the better

13:46 hyPiRion: seq*

13:46 gfredericks: I was just focused on something that implements ISeq

13:47 hyPiRion: ,(= (seq (seq devnull)) (seq devnull))

13:47 clojurebot: false

13:47 gfredericks: ,(def devnull (reify clojure.lang.IPersistentCollection (count [_] 0) (cons [this o] this) (empty [this] this) (equiv [this o] (= o #{})) (seq [this] nil)))

13:47 clojurebot: #'sandbox/devnull

13:47 gfredericks: ,(seq devnull)

13:47 clojurebot: nil

13:47 gfredericks: PHEW

13:48 danneu: jchauncey: thanks, i found some osx-equivalent solutions in that direction.

13:49 hyPiRion: ,(= devnull (into devnull devnull))

13:49 clojurebot: true

13:49 hyPiRion: well, I guess.

13:51 gfredericks: ,(reduce into (repeat 900000 devnull))

13:51 clojurebot: #<sandbox$reify__121 sandbox$reify__121@4fbb0d>

13:52 hyPiRion: ,(def devnull' (let [id (memoize identity)] (id #{}) (id devnull)))

13:52 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: devnull in this context, compiling:(NO_SOURCE_PATH:0:0)>

13:52 hyPiRion: oh man, the timing

13:53 ,(def devnull' (let [id (memoize identity)] (id #{}) (id devnull)))

13:53 clojurebot: #'sandbox/devnull'

13:53 hyPiRion: ,(into devnull' [1 2 3])

13:53 clojurebot: #{1 2 3}

13:54 gfredericks: HUH.

13:54 llasram: Cute

13:54 hyPiRion: gfredericks: just referential transparency issues

13:55 gfredericks: ,(= (hash devnull) (hash #{}))

13:55 clojurebot: false

13:56 hyPiRion: lol, that one's worse I guess

13:56 gfredericks: ah because it's an arraymap inside the memoize

13:56 so no hashing needed

13:56 ,(hash devnull)

13:56 clojurebot: 5439281

13:56 gfredericks: ,(hash #{})

13:56 clojurebot: 0

13:57 hyPiRion: ,(let [id (memoize identity) a (id (java.util.ArrayList.)) v (id [])] (.add a 10) v)

13:57 clojurebot: [10]

13:57 hyPiRion: The moral of this story is: Don't use mutable structures, ever.

13:57 gfredericks: except for premature optimization

13:57 hyPiRion: or for implementing persistent structures

13:59 gfredericks: let's use persistent structures and agents to implement mutable structures

14:00 llasram: And then use those mutable structures to implement persistent structures?

14:01 gfredericks: ,(defn mlist [] (let [contents (agent ())] (reify java.util.List (add [_ x] (send contents conj x)) Object (toString [_] (str @contents))))

14:01 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

14:01 gfredericks: ,(defn mlist [] (let [contents (agent ())] (reify java.util.List (add [_ x] (send contents conj x)) Object (toString [_] (str @contents)))))

14:01 clojurebot: #'sandbox/mlist

14:01 gfredericks: ,(mlist)

14:01 clojurebot: #<AbstractMethodError java.lang.AbstractMethodError: sandbox$mlist$reify__238.iterator()Ljava/util/Iterator;>

14:02 gfredericks: ,(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:02 clojurebot: #'sandbox/mlist

14:02 gfredericks: ,(mlist)

14:02 clojurebot: (nil)

14:02 gfredericks: waaat

14:03 llasram: agents updates are non-synchronous, yes?

14:03 technomancy: llasram: yeap

14:04 hyPiRion: gfredericks: it'll iterate over the seq

14:04 llasram: Put it on a queue and call it George

14:04 (that's a new idiom I just made up)

14:04 gfredericks: hyPiRion: ...but it should still be empty

14:04 hyPiRion: gfredericks: do (clojure.lang.SeqIterator. (seq @contents))

14:04 seq != list

14:04 technomancy: llasram: teach it to clojurebot or it doesn't count

14:04 gfredericks: hyPiRion: lists are seqs

14:05 llasram: clojure: agents |put| it on a queue and call it George

14:05 Heeeey

14:05 clojurebot: agents |put| it on a queue and call it George

14:05 clojurebot: You don't have to tell me twice.

14:05 noprompt: what's the right way to mock a read port in cljs?

14:05 hyPiRion: gfredericks: not for seqiterator

14:05 noprompt: reifying readport doesn't totally work

14:05 ReadPort

14:06 llasram: This channel currently has the very spirit of Clojure itself as a member!

14:06 gfredericks: hyPiRion: what? why not?

14:06 hyPiRion: gfredericks: because https://github.com/clojure/clojure/blob/34258286c5bc3cc72ca212fceb34e6d61359cb1b/src/jvm/clojure/lang/SeqIterator.java#L26-L28

14:06 gfredericks: hyPiRion: oh this is the empty seq edge case?

14:06 hyPiRion: it checks whether the seq is null, not ()

14:06 empty, rather.

14:06 yeah

14:07 gfredericks: ,(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:07 clojurebot: #'sandbox/mlist

14:07 gfredericks: ,(mlist)

14:07 clojurebot: ()

14:07 gfredericks: phew

14:07 noprompt: any help on this would be nice.

14:07 hyPiRion: ,(doto (mlist) (.add 10) (.add 5))

14:07 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Agent cannot be cast to java.lang.Boolean>

14:07 whodidthis: how can i get the name of keyword from namespaced name, like :a/b -> :b

14:08 gfredericks: oh return type

14:08 whodidthis: if possible without stringifying

14:08 gfredericks: ,(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:08 clojurebot: #'sandbox/mlist

14:08 llasram: whodidthis: the values are internally strings, but you can get at those, then re-keyword

14:08 gfredericks: ,(doto (mlist) (.add 10) (.add 5))

14:08 clojurebot: ()

14:08 llasram: whodidthis: ##(-> :a/b name keyword)

14:08 lazybot: ⇒ :b

14:08 hyPiRion: (inc llasram)

14:08 lazybot: ⇒ 18

14:09 gfredericks: ,(let [l (mlist)] (dotimes [n 50] (.add l n)) l)

14:09 clojurebot: ()

14:09 whodidthis: llasram: thanks

14:09 gfredericks: ,(let [l (mlist)] (.add l 42) (Thread/sleep 50) l)

14:09 clojurebot: ()

14:10 hyPiRion: gfredericks: you could do an await inside the add?

14:10 gfredericks: no, but sleeping should do it

14:10 ,(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:10 clojurebot: #'sandbox/mlist

14:10 gfredericks: ,(doto (mlist) (.add 42))

14:10 hyPiRion: oh riight

14:10 gfredericks: clojurebot must have its agents messed up

14:10 hyPiRion: there are no threads

14:10 clojurebot: Execution Timed Out

14:10 * gfredericks sigs

14:10 * gfredericks sighs

14:11 gfredericks: time to switch to atoms

14:11 ,(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:11 clojurebot: #'sandbox/mlist

14:11 gfredericks: ,(doto (mlist) (.add 42))

14:11 clojurebot: (42)

14:11 TimMc: llasram: I think I remember some paradox about channels that contain themselves as a member.

14:11 gfredericks: w000h we've made java

14:11 ,(let [a (atom)] (reset! a a) a)

14:11 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core/atom>

14:13 rbattula: this is interesting, is clojurebot executing code from all users in the same ns?

14:13 hyPiRion: gfredericks: use persistent vectors as mutable arrays

14:13 ,(let [a [1]] (aset (. a tail) 0 a) a)

14:13 clojurebot: [[[[[[[[[[#]]]]]]]]]]

14:14 hyPiRion: Still surprised that got in.

14:14 chouser: hyPiRion: What did you do!?

14:14 llasram: I think tore a hole in space-time

14:14 hyPiRion: chouser: they made the mutable contents of PersistentVector public in 1.6

14:15 that persistent vector contains itself

14:15 chouser: What is the justification for that!?

14:15 technomancy: whaaaat

14:15 * chouser is in a full on interrobang, obviously.

14:15 hyPiRion: "hyPiRion| Still surprised that got in."

14:15 chouser:

14:16 TimMc: < rhickey> ¯\(°_o)/¯

14:16 Raynes: chouser: Who you live

14:16 whoa*

14:16 chouser: LO

14:16 LOL

14:16 technomancy: clojurebot: witchcraft is http://thisotplife.tumblr.com/post/63360807823/mutable-data-structures

14:16 Raynes: chouser: How's life, man? :D

14:16 clojurebot: c'est bon!

14:16 Raynes: <3

14:16 chouser: Raynes: excellent. How are you?

14:16 hyPiRion: I believe it has to do with RRB-trees utilising subtrees of original vectors

14:16 pjstadig: mutability is just another version of immutability

14:16 Raynes: (:status raynes) => :chill

14:16 technomancy: pjstadig: the mirror-universe version that wears a beard?

14:17 llasram: pjstadig: is that a functional programming koan?

14:17 Raynes: chouser: Still lonoclouding?

14:17 chouser: Raynes: yessir. Now at ViaSat.

14:20 Bronsa: does anybody know/remember why Rich reverted the lazy fn loading commit? https://github.com/clojure/clojure/commit/c5681382da775e898915b17f3ab18b49c65359ec

14:23 hyPiRion: Bronsa: it's only temporarily, it says :p

14:23 llasram: heh

14:24 * TimMc patiently waits for it to be un-reverted

14:40 gfredericks: I like how the slashes on line 3638 got leftened

14:41 * gfredericks tries to figure out if the \t in "leftened" is silent

14:41 TimMc: LEF-ten-ed

14:46 lvh: Hi; what's the elegant way to spell [a*x, b*y, c*z...] given [a b c] and [x y z]?

14:46 Is it (reduce * (map vector as xs))?

14:46 (I realize my literal is a vector; I don't necessarily really want a vector)

14:47 chouser: ,(map * [1 2 3] [4 5 6])

14:47 clojurebot: (4 10 18)

14:49 lvh: chouser: oh, right!

14:49 amalloy: hey chouser, haven't seen you in here for a while

15:07 gfredericks: chouser only comes by when somebody needs to know how to do pairwise multiplication

15:08 pdk: you just have to know how to summon him

15:24 noprompt: bbloom, dnolen_, anyone can someone explain how to go about implementing cljs.core.async.impl/ReadPort such that it works with take!

15:25 bbloom: noprompt: tbaldridge is probably best to ask

15:25 dnolen_: bbloom: noprompt: was about to suggest the same thing

15:26 noprompt: tbaldridge: if you have a moment to share some insights there that'd be helpful.

15:26 tbaldridge: noprompt: is this on the JVM or JS?

15:26 noprompt: tbaldridge: cljs

15:27 tbaldridge: effectively what we want is a stubbed read-port.

15:28 jcromartie: is there anything that's like the opposite of partial? i.e. I want to replace #(mod % x)

15:28 with (something mod x)

15:28 noprompt: tbaldridge: such that take! just returns a piece of fake data.

15:29 pdk: partial can only take empty arguments at the end

15:29 you'd have to roll your own

15:31 jcromartie: oh I got it :)

15:31 (comp (partial apply mod) reverse (partial list x))

15:31 :) this an exercise in point-free style obviously

15:32 antonv: hi

15:32 what IDE you use for Clojure? SLIME or some other?

15:33 to be able to evaluate Clojure code interactively

15:33 llasram: antonv: https://github.com/clojure-emacs/cider

15:33 bob2`: emacs is popular, with cider

15:33 noprompt: antonv: emacs, vim, intellij w/ cursive, light table, sublime

15:34 antonv: several editors have support for that functionality.

15:34 AdmiralBumbleBee: man, I can't keep up with all these clojure ides

15:34 I wasn't even aware nrepl changed names

15:35 antonv: thanks for the responses. I am interested in a simples possible setup

15:35 llasram: AdmiralBumbleBee: nREPL didn't change names. nrepl.el did, to avoid confusion with nREPL :-)

15:35 antonv: what I can setup as fast as possible; I can tolerate some limitations in functionality

15:36 jcromartie: antonv: if you are comfortable with Emacs, the cider setup is pretty easy

15:36 llasram: antonv: If you already know emacs, you can just install cider package (and Leiningen) and be done

15:36 jcromartie: if not, then I would recommend LightTable

15:37 it's pretty much instant gratification :)

16:08 antonv: jcromartie: thanks

17:01 ystael: CIDER is hanging my Emacs when it tries to display a docstring. Is this a known problem with a known fix?

17:04 ... looks like the ac-cider package I had was conflicting with something else.

17:06 technomancy: auto-complete is probably the biggest source of weird cider problems

17:06 auto-complete.el that is

17:08 ystael: technomancy: so should i have ac-cider and not auto-complete, rather than the other way around?

17:09 technomancy: I don't know; I just know getting rid of auto-complete.el often makes problems go away

17:10 `cbp: prelude doesn't include autocomplete which made me sad but i guess theres zarro boogs

17:11 ystael: sounds 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:21 dacc_: what i'd miss is inline documentation

17:21 dacc: completion is nice for exploring too i guess

17:22 clojure is actually really nice for completion

17:22 not so many pesky dynamic typed objects with unknowable methods around

17:22 just functions in namespaces =)

17:56 johnjelinek: hihi all :)

17:57 matthavener: johnjelinek: hey :D

17:57 johnjelinek: so, I guess loop/recur around a take! is not quite a smart idea

17:57 matthavener: what up

17:58 jodaro: so like

17:58 gen-class

17:58 extending and abstract class

17:58 with an abstract method

17:59 blammo with a Duplicate name&signature exception

17:59 fixable?

18:24 tavoe: Learing 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 `cbp: tavoe: that's a javascript error

18:26 tavoe: it basically means you're doing something like calling nil

18:27 amalloy: and as everyone knows...##(nil 1)

18:27 lazybot: java.lang.IllegalArgumentException: Can't call nil

18:28 tavoe: And it has fixed itself. After 20 minutes searching, I delete and re-add a line and the whole thing works. Thank you

18:30 jodaro: the old "wait 20 minutes and it will be fixed" solution

18:30 sdegutis: clojure: hey how's it goin

18:31 amalloy: that actually works sometimes in cljs, because 20 minutes after you report a bug dnolen_ has merged a fix

18:32 johnjelinek: +!

18:32 +1*

18:32 sdegutis: Yeah, somehow dnolen_ is on top of cljs like a hawk on top of whatever hawks are often on (probably tree branches).

18:32 jodaro: light posts

18:32 sdegutis: Really?

18:32 `cbp: rabbits

18:33 tvachon: the thick leather glove of a well monocled hunter

18:37 sdegutis: Is there some tool that lets me know which requires are unused in my source files?

18:37 amalloy: sdegutis: slamhound?

18:37 sdegutis: Hmm.

18:37 I thought that only rearranged them. Let me check.

18:38 Bronsa: sdegutis: eastwood should have a linter for that

18:39 sdegutis: How does Slamhound know what you're referencing when you use functions such as 'pprint'? It could be in a third party lib?

18:39 Bronsa: Thanks I'll look.

18:39 dsrx: sdegutis: it looks for namespaces on the classpath iirc

18:40 technomancy: sdegutis: if you're adding a new call it just guesses

18:40 sdegutis: Ah neat.

18:40 technomancy: from the classpath, right

18:40 sdegutis: Thanks you two.

18:40 technomancy: if you're rewriting an existing ns, it prefers existing declarations

18:40 but yeah, it can guess wrong; I think it chooses whichever is shorter if it doesn't have anything else to go on

18:56 sdegutis: technomancy: ha

19:00 ,(let [{foo :foo :or {foo (prn "this should not print")}} {:foo "bar"}] foo)

19:00 clojurebot: "this should not print"\n"bar"

19:00 sdegutis: Weird?

19:02 technomancy: weird.

19:02 sdegutis: technomancy: btw the 'ha' comment was about picking the shorter length symbol :)

19:03 technomancy: sdegutis: oh... shorter namespace name, not var name symbol

19:03 sdegutis: technomancy: I've more often heard of defaulting to alphanumeric string comparison

19:03 technomancy: right

19:03 technomancy: the logic there being that longer stuff is more likely to be internal

19:04 sdegutis: Ah, that makes sense.

19:04 amalloy: sdegutis: well, the (let [{x y :or {x z}} m]) syntax expands to (let [x (get m y z)])

19:04 sdegutis: amalloy: Ah, didn't realize that. Thanks

19:05 technomancy: using :or makes me think it would expand to an actual clojure.core/or call

19:05 sdegutis: I assumed so too.

19:05 amalloy: technomancy: that's a reasonable intuition to have, of course

19:06 but then what if m is {y nil}?

19:06 sdegutis: Although in this case, doesn't (get) have some special semantics when the key is actually absent and not just nil?

19:06 Yeah, that.

19:06 technomancy: amalloy: just makes me think :or isn't the right word for that

19:06 sdegutis: technomancy: yeah I'd think :default would be a better word here

19:07 \cc amalloy

19:07 technomancy: sdegutis: you should submit a pull request

19:09 amalloy: ~rimshot

19:09 clojurebot: Badum, *tish*

19:10 sdegutis: Could not find sufficiently humourous 'oh you' gif in time. Defaulting to using textual representation.

19:10 technomancy: 'oh you'

19:12 (Somehow it's not the same.)

19:14 technomancy: http://p.hagelb.org/oh-you.jpg

19:14 `cbp: i knew it

19:15 sdegutis: Perfect.

19:16 isaacbw: is this library the most common for mocking ring requests? https://github.com/weavejester/ring-mock

19:16 sdegutis: I use it to good effect.

19:17 bob2`: ditto

19:19 isaacbw: cool beans, thanks

20:07 TravisD: anyone here from Pittsburgh?

20:17 tavoe: Quick 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:18 bob2`: they are implemented completely differently

20:18 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:19 vectors are conventially used for things like let bindings and function arg lists, too

20:20 ddellacosta: tavoe: http://stackoverflow.com/questions/1147975/in-clojure-when-should-i-use-a-vector-over-a-list-and-the-other-way-around

20:20 tavoe: bob2', don't tell bob1', but I like you better

20:20 bob2`: haha

20:23 TravisD: rh

20:32 jodaro: https://github.com/joshrotenberg/gen-class-issues

20:33 if anyone happens to know why this is

20:33 i'd love to figure it out

20:36 amalloy: what is the ^{Override {}} thing about, jodaro?

20:36 i don't see that mentioned in genclass docs

20:37 are you just setting an annotation? if so, why?

20:37 jodaro: yeah

20:37 i saw it somewhere on the internets

20:38 doesn't seem to make a difference either way, though

20:38 amalloy: the @Override annotation is source-only - it doesn't get put into the generated classfile

20:38 yeah, i wouldn't expect it to

20:39 * gfredericks lein new z

20:40 amalloy: jodaro: what happens if you change getFoo from protected to public?

20:42 jodaro: hmm

20:44 well doStuff is the problem

20:44 so

20:44 nothing that i can tell

20:45 amalloy: oh, i misread

20:46 jodaro: http://dev.clojure.org/jira/browse/CLJ-956

20:46 i found that

20:46 but the sample repo is gone, so i'm not sure if its the same issue or not

20:47 amalloy: jodaro: i think he's saying just remove the :methods declaration

20:47 ie, don't declare your own doStuff, since there's already one

20:48 jodaro: hmmm

20:57 mf

20:57 that was it

20:57 thanks for letting me borrow your reading comprehension skills

21:00 thought i might have to write some java for a little while there

21:04 ddellacosta: is there a more...straightforward way to do this?

21:04 ,(update-in {:foo {:bar "bar" :baz "baz" :quz "quz"}} [:foo] (fn [foo] (into {} (remove #(some #{:bar} [(key %)]) foo))))

21:04 clojurebot: {:foo {:quz "quz", :baz "baz"}}

21:05 ddellacosta: a.k.a. removing a specific MapEntry, identified by key, from a nested map structure

21:06 amalloy: (update-in m [:foo] dissoc :bar)?

21:10 ddellacosta: ^

21:10 ddellacosta: amalloy: a, *much* nicer...thanks!

22:11 Raynes: Oh dear, I've lost an amalloy.

22:12 * Raynes quickly repairs his znc

23:03 Mandy27: You can find funny videos here. http://bit.do/my_videos69

23:29 chare: what is going on here when apply takes partial twice ????? (defn faux-curry [& args] (apply partial partial args))

Logging service provided by n01se.net