#clojure logs

2013-12-04

00:04xeqithe austin example does it for its dev tooling https://github.com/cemerick/austin/blob/master/browser-connected-repl-sample/src/clj/cemerick/austin/bcrepl_sample.clj#L22
00:05technomancy~guards
00:05clojurebotSEIZE HIM!
00:05dnolenargh
00:06jonasenxeqi: isn't that a lie thou? If the namespace is compiled, the server var is defined.
00:07jonasenso (run) doesn't actually do anything
00:08hiredmanclojurescript is not clojure though
00:08xeqijonasen: nope, (run) definitly starts and defines server ; https://www.refheap.com/21481
00:09hiredmanvars make a difference in the semantics of defs inside of defs
00:09jonasenxeqi: ok
00:09hiredmanoh, I assumed if it was in austin it was clojurescript
00:09hiredmanugh
00:10hiredman~gourds
00:10clojurebotSQUEEZE HIM!
00:10niceguy21in the context of a framework, is an implicit dependency inside a macro okay?
00:10niceguy21i.e. (add-something arg)
00:10hiredmanno
00:11niceguy21but pulling "this" out of the environment
00:11niceguy21(in effect, not passing in this explicitly ala (add-something this arg)
00:12hiredmanxeqi: if only there had been a linter to warn chas not to do something so horrid
00:16jonasenhiredman: don't know if that was sarcasm. (It's sometimes hard to recognize sarcasm/irony on IRC)
00:17hiredmanjonasen: I am often sarcastic and serious at the same time
00:17technomancyit is a useful skill
00:18jonasenhiredman: ok
00:28technomancyfollow along at home with my insane nrepl hacking https://groups.google.com/forum/#!topic/cider-emacs/7p7yyv-Ocwc
00:28dnolensans the OO stuff React really look like WebFUI, seems flexible to create our own abstraction over it - https://gist.github.com/swannodette/7782780
00:29dnolenflexible enough
00:29alandipertdnolen: re: core.logic, is there a conjo or similar? in particular i'd like conso with a map
00:30jarodzzaaaa. i 'm sick of java. translating Character to char, Integer to int
00:30alandiperti enjoy k/v unification and featurec but i wish to also eat my cake :-)
00:30jarodzzArray to List
00:30dnolenalandipert: no such thing yet - kinda tricky if the key value pair isn't ground, but maybe that isn't a use case that matters?
00:31alandipertdnolen: nope, kv is ground
00:31dnolenalandipert: you could represent it as a delayed constraint a la featurec
00:31dnolenso that unground case will work
00:31jarodzzhow many of you guys have successfully transfer a java project to clojure?
00:33dnolenalandipert: a polymorphic constraint conjo would be welcome ...
00:33dnolenwhen it's arguments become ground it could dispatch to -conjo protocol implementation of the first argument
00:34dnolenwould pave the way for core.logic being less list-centric
00:35amalloyandyf_: i wouldn't put a def inside a def in a library, but a couple of my apps have included (defn -main [] (def server (run-server config))), so that i can look around at the server's state from nrepl or swank if something goes wrong
00:36amalloyif that's wrong i'm not sure i want to be right
00:36dnolenalandipert: actually now that I think about it, not necessary for -conjo, http://dev.clojure.org/jira/browse/LOGIC-147
00:38bitemyapparrdem: I didn't
00:38bitemyapparrdem: somebody else might've or it might be bugged.
00:38bitemyapparrdem: reset it.
00:40alandipertdnolen: i'll noodle around, thanks
00:45dnolenalandipert: you caught me at the right time - https://github.com/clojure/core.logic/commit/c0f69ab5f43567c5a9f8932b187c51a42ed2a5da
00:45dnolenalandipert: half baked version in master
00:45dnolenfor a fully baked version - if the first argument isn't ground but the last one is - should call -jonc on the output argument
00:45dnolenthen it's reversible
00:46alandipertdnolen: nice, thx!
00:48jarodzzwxqy: hi
01:00hiredmanamalloy: alter-var-root
01:00amalloyyeah, i know that works too, but in such a limited scope i don't see that it makes a difference
01:12gunsHello, I'm ready to push 0.3.0-SNAPSHOT of tools.cli and mail clojure-dev an RFC, but I don't know if I am supposed to change the version in project.clj/pom.xml, or do this in Hudson.
01:12gunsI also don't have a Hudson account. Could someone advise me?
01:15andyf_guns: I don't have an answer for you, and if no one else here does, I'd recommend asking in clojure-dev
01:15gunsandyf_: Okay, thank you. I'll push to a branch and ask in the email
01:16technomancyguns: I'm pretty sure the contrib policy is that project.clj is non-canonical
01:16gunstechnomancy: I see; it sure convenient though
01:16guns*is
01:16andyf_guns: Yes, technomancy is definitely right about that. No rule against having one, but Hudson does not use it for anything.
01:17technomancyyeah, a lot of those policies are really out dated from back before lein worked with http deploys or supported jenkins
01:17dnolenvoila! core.logic can do reversible computation on vectors, maps, and list - more cases welcome - https://github.com/clojure/core.logic/commit/9f86dbab5c8edc41c22a7ecafcce3b5dfa58571f
01:18sm0kei have started a server using 'lein repl :headless' and i can see the port in ~/.lein/repl-port
01:18andyf_I want reversible computation on futures
01:18sm0kebut when i do a 'grenchman lein' is says invalid task ''
01:19sm0kedoc mentions otherwise, am i doing it wrong
01:19andyf_I have no idea what that would mean -- just a flailing attempt at humor.
01:22dnolennice to get a chance to use reduced
01:22Raynesguns: Do you have a brother named knives, by chance?
01:22sm0kei can obviously alias 'grench repl :connect `cat ~/.lein/repl-port`' but that must be obvious in grenchman
01:23Raynesguns: http://trigun.wikia.com/wiki/Knives_Millions
01:23gunsRaynes: lol. it is possible; the immigration office really butchers east asian names
01:27{[^-^]}how do I define some test data like with a def
01:27{[^-^]}but solely for the purpose of testing
01:30{[^-^]}also in joy of clojure, I see a :test key for the metadata of defn
01:30{[^-^]}but don't see that in the docs of clojure.test
01:40SeanCorfield{[^-^]}: technically the docs for the deftest macro do explain :test but it's probably not as clear as it could be
01:41glosoliHmm I have some ring middleware which I only want to take place in production, I am trying to alter-var-root its function so it would return the same handler that it was passed to it without doing any action (the file that contains alter-var-root is only loaded in development), any ideas why this won't take any effect ?
01:45SeanCorfieldglosoli: maybe post your code on refheap.com so we can take a look?
01:46RaynesSupporting local business. Good man. <3
01:47jarodzzhi, guys. any one tried to use clojure generate a java class at run time?
01:47glosoliSeanCorfield: https://www.refheap.com/0fd9efb7c8c34f8c21c0859cb
01:47nightflyjarodzz: Kind of a cheeky answer, but isn't that how fns work?
01:50jarodzznightfy: right, i'll search stackoverflow first. :)
01:50jarodzzsorry about that,man
01:50glosoliSeanCorfield: they are all in different namespaces though
01:53{[^-^]}SeanCorfield: Should I be using the :test metadata like they do in joy of clojure? For ex: https://www.refheap.com/21483
01:53{[^-^]}I'm trying to be as idiomatic as possible
01:53bitemyappRaynes: make money from refheap? That explains all the coke.
01:53Rayneslolol
01:53Raynesbitemyapp: Nah, I don't make a penny from refheap.
01:53bitemyappobv.
01:54RaynesI'd have to jump out a window if I had to put ads in there.
01:54RaynesIt'd literally be worthless at that point.
01:56bitemyappyeah I hate pastebin for a reason.
01:58SeanCorfieldglosoli: hard to tell based on that paste - I suspect it may be due to order of loading: the wrap-optimus function may have been deref'd before the alter-var-root takes effect?
01:59SeanCorfield{[^-^]}: it depends whether you want to keep your tests and your functions together, or not
01:59glosoliHmm that would make sense, not sure how to check though
02:00SeanCorfield{[^-^]}: I think most people have their test code in a separate directory tree, per the skeleton that lein new creates
02:03SeanCorfieldglosoli: old school: add println calls :)
02:03glosoliSeanCorfield: ah obvious, thanks
02:04{[^-^]}SeanCorfield: I think it would be better for my project to test every function where it is defined
02:04{[^-^]}the (fn [] (assert .. )) thing seems tedious though
02:04{[^-^]}why do I have to have (fn [] )
02:04SeanCorfield{[^-^]}: try both ways and see what works best for you...
02:05SeanCorfield{[^-^]}: because the :test metadata needs to be a function - it could be a named function defined separately (for less clutter on the function being tested)
02:05glosoliSeanCorfield: Hmm I don't even get println from alrer-var-root weird, must be doing smth wrong, thanks
02:06{[^-^]}SeanCorfield: I'll just use (with-test ) then, but how do I define some test data without it being compiled into production code?
02:09SeanCorfield{[^-^]}: define it inside a test function? or do you need it across multiple functions?
02:09{[^-^]}across multiple functions
02:10SeanCorfieldone possibility is to put it in a function instead of plain def, then only call it from the test functions
02:10SeanCorfieldthat way it won't be evaluated in production
02:11glosoliSeanCorfield: Hmm just curious, not depending on order alter-var-root should still execute the println ?
02:11{[^-^]}so (defn [] {:test-data "whatever"})?
02:11SeanCorfield{[^-^]}: no, just a regular function
02:11SeanCorfield(defn test-data [] {:returns :some :test :data}) and then call that from the tests as needed
02:12{[^-^]}that's what I was saying
02:12{[^-^]}okay thanks
02:12SeanCorfieldglosoli: how are you trying to get alter-var-root to "print" something?
02:13SeanCorfieldi was just suggesting println before/after the alter-var-root call... and in wrap-optimus as well to see if it's called before alter-var-root takes effect
02:16glosoliSeanCorfield: yeah alter-var-root is being executed later ;/
02:16SeanCorfieldding! :)
02:17glosoliSeanCorfield: thanks! :)
02:18sm0kea survey says that programmers who are fascinated by new languages have 90% likelyhood of cheating on their partners. :|
02:19SeanCorfieldheh, i'm always fascinated by new languages - always have been - but my wife of 14+ years won't believe that survey :)
02:20sm0kehmmm
02:20sm0kemay be you are a good liar ;D
02:21SeanCorfieldRule #1 - never lie
02:21noprompthaha. what kinda shit is that?
02:21noprompt(inc SeanCorfield)
02:21lazybot⇒ 8
02:21sm0keRules #2 - that was a lie.
02:21nopromptSeanCorfield: that is the golden rule, my friend.
02:21SeanCorfieldRule #2 - and I quote - "If you make me choose between you and the cats, the cats will win!"
02:22noprompt(dec SeanCorfield)
02:22lazybot⇒ 7
02:22nopromptsorry, i hate cats.
02:22SeanCorfieldThose were the two rules she gave me 14 1/2 years ago on our first date...
02:22nopromptoh, nm
02:22noprompt(inc SeanCorfield)
02:22lazybot⇒ 8
02:22noprompt:P
02:22SeanCorfieldnoprompt: for years we bred and showed Bengal cats... and my wife is a cat show judge :)
02:23sm0ke'Bengal' as in 'Bengal, India'
02:24nopromptSeanCorfield: damn. those loook really cool.
02:24SeanCorfieldhttp://bangles.com is our cattery website (but it hasn't been updated in ages - because we stopped breeding a few years back)
02:24nopromptSeanCorfield: i couldn't tell what with the centered red text and all :P
02:24SeanCorfieldThey're cool pets... very smart, very active... we have child locks on all our cupboards (and we don't have kids)...
02:25nopromptSeanCorfield: are they dangerous?
02:25SeanCorfieldwhy would they be?
02:25SeanCorfieldthey're regular kitties...
02:25noprompti'm not sure. they look... wild?
02:25noprompthow much does a cat like that go for?
02:25SeanCorfieldthey're supposed to look like miniature leopards
02:26SeanCorfieldwe used to sell pet kittens for $700-900
02:26nopromptthat's reasonable.
02:26nopromptyorkie's go for about that much. sometimes more.
02:26sm0kehmm 700 for a cat!
02:27Raynessm0ke: lol did you accuse SeanCorfield of being unfaithful? :P
02:27SeanCorfieldbut cat breeding is a very expensive hobby (as is dog breeding) unless you're not paying much attentions to the animals' health
02:27noprompti'm gonna write a book called "HTML Anti-patterns" lol.
02:28nopromptthis codebase i inherited has mysterious html like <div></div>
02:28sm0kecats have obsession with sleeping on laptops
02:28SeanCorfieldcats want to be wherever your attention is :)
02:29sm0kemay be cats want to write clojure!
02:29SeanCorfieldwe only let one of our cats in the "office" at home - she's very well-behaved and sleeps in a bed on the desk next to my keyboard
02:29nopromptwhat do you feed them?
02:30SeanCorfielda mix of wet food, dry food and raw meat... separately, not mixed together :)
02:30SeanCorfieldbut we have a couple on special diets due to age and/or medical conditions
02:31sm0kewow you are like frkn catman
02:31SeanCorfieldour oldest girl is 17 and she has thyroid issues as well as some g.i. issues so she gets special food (and quite a lot of medication)
02:31bitemyappSeanCorfield: my god, $700 for a cat? Cats are so ambivalent to your existence though :(
02:32sm0kebitemyapp: its a different kind of cat
02:32SeanCorfieldbitemyapp: that's part of their charm - they're independent and if they come to you, it's because they want to, not like dogs which just want to please you all the time :)
02:33bitemyappSeanCorfield: I've only had one cat that seemed to enjoy my company. It was like a really lazy dog and I loved it to death.
02:33bitemyappI don't think I'd get another cat, I'd rather get a dog.
02:33SeanCorfield$700 isn't expensive for a pedigree pet (with a full health guarantee, temperement, and lifetime support from the breeder)
02:33SeanCorfield^known temperament
02:34sm0keif i get rich i would want a golden retirever
02:34SeanCorfieldOur fur kids are crazy active... they jump on people's shoulders, they play in water...
02:34bitemyappI'd agree with that, but I still have a hard time with the idea of worrying about the breed of a cat, it's unclear to me how much the temperament would improve over a typical shorthair.
02:34SeanCorfieldWe have a paddling pool indoors in the summer for them!
02:35bitemyappthat's pretty adorable, but they're still a cat and cats plot your demise constantly.
02:35SeanCorfieldDifferent breeds have different temperaments in general. With a random bred cat, you've no idea what temperament it'll have - some are great, some are not - and it also depends what you want in a pet.
02:35SeanCorfieldbitemyapp: yeah, we say that you come to a mutually agreeable set of behaviors when you have Bengals as pets :)
02:35SeanCorfieldthe cat trains you a bit and you train the cat a bit
02:36SeanCorfieldBengals aren't for everyone - we've turned down quite a few pet buyers because we didn't think they were ready for a Bengal... Hint: we have no breakable things out anywhere the cats can go...
02:37sm0kewhoa! pets are indeed costly!http://www.puppyfind.com/view_listing/?list_id=86l0x802rt&amp;sid=45a7f10b57c7038a3e55c38c0ddb7968&amp;back=%2Ffor_sale%2F%3Fbreed_id%3D57%26country%3D%26state%3D%26page%3D1%26order_by%3Dnew%26back%3D
02:37sm0ke2k for a puppy!
02:37SeanCorfieldAnd like I say, we have child locks _everywhere_ to keep the cats out of places... And bungee cords on one of the faucets because they figured out how to turn it on!
02:37bitemyappSeanCorfield: I know bengals are higher maintenance and more feisty, but what would interest me is a velcro cat with a dog's personality.
02:37bitemyappSeanCorfield: does such a breed exist?
02:38SeanCorfieldMaybe a Selkirk Rex...
02:38SeanCorfieldCurly coated cat. A friend in this area breeds them. In fact she just went off to Argentina to deliver two of them tonight.
02:38bitemyapp"The temperament of the Selkirk Rex reflects that of the breeds used in its development. They have a lot of the laid-back, reserved qualities of the British Shorthair, the cuddly nature of the Persian, and the playfulness of the Exotic Shorthair."
02:39bitemyappI didn't know persians were supposed to be cuddly, I definitely recall a family friend having an intensely anti-social persian.
02:39SeanCorfieldThat's down to poor socialization mostly.
02:39bitemyappmayhaps, they were nice people and responsible pet owners.
02:39SeanCorfieldPersians should be raised to be lap cats.
02:39bitemyappSeanCorfield: do you have to socialize them before they get older?
02:39bitemyappyes, lap cat. That's what I would hypothetically want.
02:40SeanCorfieldYeah, we used to have to work hard with kittens to ensure they weren't scared and they liked people. Bengals are very toy focused so you have to play with kittens all the time they're awake so they associate toys and fun with people :)
02:40SeanCorfieldOtherwise they will find their own "fun"...
02:41bitemyappI knew a himalayan that was really anti-social too.
02:41SeanCorfieldBengals are definitely not lap cats... Shoulder cats, sometimes, top-of-door cats...
02:41bitemyappSeanCorfield: that makes sense. That sounds like it would make adopting an adult cat tricky.
02:41bitemyappmy mother and I got lucky with the aforementioned velcro cat. He was an orange tabby, the most cuddly, lazy cat on the planet.
02:42bitemyappgot him as an adult. was totally chill on arrival.
02:42bitemyappI'd kill to get that cat back, but my mom gave him up for adoption after I left.
02:42SeanCorfieldDepends on the cat and how it's been raised. We're very atatched to most of our adult cats now but there are a couple we'd place in forever homes, if they would be "only cats" and the owner was willing to live within their rules :)
02:43SeanCorfieldWe have a young girl we're showing for friends in Texas but otherwise our house runs from about 2 1/2 up to 17 with most of them in the 7-10 age range...
02:44SeanCorfieldAnyways, my wife went to bed about 15 minutes ago, so I should go and join her... I'll be back online in about 8 hours :)
02:45bitemyappSeanCorfield: cheers, thanks for sharing your CAT FACTS
02:46seangone'nite
03:02glosoliwhat wrong could happen when same ns is required twice ?
03:05gunsglosoli: Nothing, unless there are side-effects at the top-level. Also, defonce might be problematic depending on what you're doing
03:06glosoliguns: well I need to alter-var-root some function from ns that is referenced inside other ns, but if need to do that before that other ns is required
03:06gunsglosoli: that sounds terrible!
03:07glosoliYeah ;/
03:07gunsbeware:
03:07guns"When you stare into the abyss, the abyss stares back into you"
03:12abaranoskyglosoli: how did you determine that you *need* to do this?
03:13glosoliabaranosky: because I need the content altered before it's loaded in that other namespace
03:14abaranoskyif the var's ns isn't loaded, then there's no var to alter-var-root on
03:15abaranoskyglosoli: maybe I'm not getting what you're doing
03:15glosoliabaranosky: by loaded I mean, it's evaluated, and then later wrapped, since it's handler for ring
03:16glosoliand if I alter after it has been wrapper
03:16glosoliwrapped" there is no effect ;)
03:17glosoliIt's like you have, (ns dev) (ns app) (ns handler) (ns route) route serves resources, I want to add some handler which is in handler, but app requires both handler and route, and since when I am in dev mode, I don't want that handler to take effect, but I can't alter that handler, if I wait app is required before alter var root takes place
03:18glosoliabaranosky: maybe more clear ?
03:18gunsglosoli: it just so happens abaranosky and I discussed this with a user a couple of days ago
03:18gunsglosoli: https://github.com/technomancy/slamhound/issues/59
03:18clojurebotI don't understand.
03:18gunsI think you should look into stuart sierra's reloaded workflow and components library
03:19gunsIn OO languages we learn to package state in classes; we can do something similar, but more sophisticated in Clojure
03:20gunsbut binding ring handlers to vars and such is going back to global variables
03:20abaranoskyguns speaks the truth
03:20guns(inc abaranosky)
03:20lazybot⇒ 1
03:21beppuhttp://bodil.org/more-than-functions/m/data-all-the-things.jpg
03:27abaranoskyglosoli: do you have a code sample to show? It's hard to give a concrete solution without something tangible
03:27glosolisec
03:27abaranosky... bu the alter-var-root talk sets off my inner alarm bells
03:30glosolihttps://www.refheap.com/21484
03:32clgvglosoli: you need to use ":require" instead of "require" in an ns-statement
03:32amalloyclgv: you don't, actually
03:32glosoliyeah this is just example
03:32amalloyit's purely convention; either one works
03:33clgvamalloy: are you sure. I remember some weird effects when mixing that up in the past
03:33amalloyglosoli: single-segment namespaces are the devil: you want my-app.dev-only or something
03:33clgvalthough "past" ranges back to 1.2.1 ;)
03:33glosoliamalloy: this is just for presentation purposes of my problem
03:35abaranoskythe routes ns is your issue imo
03:35glosolithe way that app route loads too much
03:35glosolior the way we are handling dev mode
03:35glosoliby altering stuff.. and having it in separate namespace
03:36abaranoskyI can't quite tell: is the routes ns creating a top-level fvar?
03:37abaranoskythat code just looks super weird to me
03:37abaranoskyinstead you can make the routes themselves be generated by a funciton call... and in dev call a different function... one where it doesn't add the optimus middleware
03:38abaranoskyglosoli: ^^^
03:41abaranoskyglosoli: something like this pseudo code: https://www.refheap.com/21485
03:44glosoliabaranosky: ah sorry for late response, thanks for an advice, looks better
03:51magnarsglosoli: You should always add the optimus middleware, even in dev - because you need to link to your assets. Having hard coded links won't link to the right assets in prod. Instead, choose different optimizations and strategies in prod and dev - like optimizations/none and serve-live-assets in dev, and optimizations/all and serve-frozen-assets in prod.
03:52glosolimagnars: yeah but since we are not doing bundles or versioning
03:52glosolithat does not seem like in need at least until then
03:52magnarsyou're just doing minification?
03:53glosolimagnars: yeah for now, later they might get added, waiting for orders from the upper folks :)
03:53glosolimagnars: There isn't really any lein plugin which wouldn't be overkill for what I need, optimus just seemed the most optimal solution )
03:54glosoliand it would help with versioning later
03:54magnarsglad to hear that :)
03:54magnarsbut why not just serve the assets through optimus in dev too?
03:55glosolimagnars: dunno, it will require some additional conf which isn't how this app works now
03:55logic_progis there a way to reload a *.cljs file
03:55logic_progin a running browser?
03:56logic_progI don't want to hit the refresh on the browser. I want it to reload my *.cljs file
03:56glosolimagnars: whole dev is weirdly separated in namepsace...
03:56magnarsah, I see. Yeah, that does sound weird.
03:56glosolimagnars: well that's our first project with clojure, just learning heh
03:58magnarsNot that it's my business, but I would recommend against that split. You're running entirely different code in dev and prod - which is a receipe for bugs that only show up in production environments. That's nasty, and hard to track down.
04:00glosolimagnars: i need quick fix
04:00glosolimagnars: could you add linux i386 archetype ?
04:00clojurebotIt's greek to me.
04:00glosolito v8.clj
04:01glosolimagnars: Exception in thread "main" java.lang.Exception: Unsupported OS/archetype: Linux i386, compiling:(v8.clj:32:1)
04:01magnarsThat's a case for https://github.com/circleci/clj-v8 I'm afraid
04:02glosoliDamn lol, I pushed the changes to repo and tests started screaming ;/
04:02glosolimagnars: last change for clj-v8 was like year ago, isn't it dead ?
04:02magnarsMaybe it will run with the pre-built 32 bit x86 binaries
04:03magnarsLet's try it, give me a sec.
04:06magnarsglosoli: ok, 0.12.4 is on clojars which will try to use clj-v8-native's prebuilt x86 32 bit binaries.
04:07borkdudewhat noise cancellation headphones might be best for programmers?
04:07borkdudenot only bass sounds, but also typing sounds preferably
04:08glosolimagnars: so I should update my project clj to optimus 0.12.4 to try the new changes ?
04:09magnarsglosoli: yes. Might be a shot in the dark, but worth trying. Which version are you on now?
04:09glosolimagnars: 0.12.3
04:09magnarsexcellent
04:11glosolimagnars: ok gonna see in a seconds if test running robot will scream, but why is it a problem at first place? I mean isn't just the way archetypes are defined incorrectly ?
04:13magnarsyeah, the problem is that we have to manually load the native binaries, since JNI and JNA won't load from jars. So the list of archetypes is incomplete.
04:13glosolimagnars: so how come 0.12.4 could help with that, since it will report wrong archetype anyway ?
04:14magnarsglosoli: I set up Linux i386 to use the precompiled x86 32 bit binaries, in the hopes that they will work.
04:15glosolimagnars: yeah, works now just fine
04:16magnarsgreat! :)
04:16glosolimagnars: Thanks! :)
04:16magnarsHah, no worries. Thanks for your patience. :)
04:17glosolimagnars: No problem, it should also work on Linux x64 just fine yeah ? (i am a bit noob when it comes to architectures and how they deal with compiled stuff in linux)
04:18magnarsYeah, Linux x86_64 is what we're using - and why you crashed into a missing archetype on a 32 bit Linux.
04:18jph-so if i'm changing code in core.clj for a library, and i already have lein repl fired up - can i simple run (use `my-library.core) again to reload it?
04:18jph-or do i have to quit repl and lein repl again?
04:19gunsjph-: (require 'my-library.core :reload)
04:19glosolimagnars: ok thanks again
04:20jph-guns - perfect
04:20jph-guns: the shutdown/startup was getting on my nerves
04:20jph-i figured there was a better way :)
04:21gunsjph-: If you're using an nREPL plugin, that's probably already bound to a key sequence
04:21jph-im just doing from cmd line atm
04:21gunsoh ok. gl
04:21jph-but i have sublime repl as well which i havent played with yet
04:22gunsjph-: If you ever want to wipe all your namespaces and reload from scratch, look at https://github.com/clojure/tools.namespace
04:23jph-cheers
04:24jph-im still new to all this
04:24jph-i've dived in before fully reading through the two books i have
04:25jph-guns: so reload should work fine if im just modifying a function
04:26gunsjph-: yes, it will work fine. also, you should avoid doing anything beside defining things in a namespace
04:26jph-k
04:45clgvjph-: (require 'my-library.core :reload-all) will reload the namespaces required in my-library.core as well. but seems that might not be enough, hence there is tools.namespaces
04:45jph-k
04:45jph-another stupid question
04:45jph-in my core.clj
04:45jph-i have at the top [clojure.tools.namespace.repl :only (refresh)]
04:45jph-yet in repl it doesn't know about (refresh)
04:47clgvjph-: you mean (use '[clojure.tools.namespace.repl :only (refresh)])?
04:47clgvor (:use [clojure.tools.namespace.repl :only (refresh)]) in the ns
04:47jph-in the ns
04:47clgvjph-: the ":only" part applies only within the namespace
04:47jph-oh
04:47jph-so i have to my-library/refresh ?
04:48clgvno. if you want to use it in another namespace you have to do the same there.
04:48jph-is that how it works? *winces*
04:48jph-in repl... what is the right was to use it so (refresh) would work?
04:49jph-or rather... the way im using repl is i fire it up with lein repl, then (use `my-library.core)
04:49jph-and im probably wrongly assuming all the stuff i have in my-library.core ns is getting setup
04:49jph-so if i have that use in my ns in core.clj, it's accessible in repl... but it isnt
04:50jph-im just not grokking the interactions yet
04:53clgvit is set up. but you are in a different namespace, which is "user"
04:53clgvyou can check via "*ns*"
04:53jph-in repl?
04:53clgvyes
04:53jph-ohhhhhh
04:53jph-so how do i get to (refresh) then
04:54jph-so (refresh) would work within core.clj, but that doesnt translate to repl autoagically due to diff namespaces
04:54clgvwhen you want to develop within my-lib.core you should require it and then (in-ns 'my-lib.core)
04:54jph-so i presume instead of putting tools.namespace in my core.clj, i can put it in some repl startup config?
04:54jph-in-ns?
04:55jph-is that to switch namespaces?
04:55clgvyes
04:55jph-ooh
04:55jph-ok
04:55clgvusually the IDEs have shortcuts therefore
04:55jph-but ... when i (use `my-lib.core)
04:55jph-i can call the functions in my-lib.core
04:55jph-how does that work
04:56jph-oh wait
04:56clgvthen it is different. you import (refer) all public vars
04:56jph-penny drops
04:56jph-im explicitly useing from repl
04:56jph-got it
04:56jph-thank you clgv for explaining that
04:57clgvjph_: do you have one of the clojure books?
04:57clgvjph-: ^^
04:58jph-i have several
04:58jph-but i've dived into coding ahead of properly sitting down and reading through them
04:58jph-heh
04:58jph-impatient
05:00pyrhhocore.async question. I'm trying to implement (defn promise->chan [prom
05:00pyrhhoerm.
05:01pyrhho(defn promise->chan [prom] …)
05:01pyrhhothat takes a promise and returns a chan that receives the value when the promise is realized...
05:01pyrhhobut I'm not sure how to put a callback on when a promise is realised, or how to deref a promise without blocking the core.async thread pool..
05:01pyrhhoany advice?
05:02pyrhhoOr any particular direction I should look in?
05:02amalloydoes cljs have promises? i don't immediately see them
05:04pyrhhoit's in java, not cljs
05:04amalloyon clj-jvm, if promises implemented IRef (which includes add-watch), you could use add-watch
05:04amalloybut they don't, so...it doesn't look like you can really do that
05:04pyrhhoah! forgot about add-watch. will check
05:05pyrhhothey do implement IDeref. is that close enough?
05:06pyrhhoor since IRef extends IDeref, could I extend the promise to implement IRef?
05:06amalloynot at all
05:07pyrhhodamn
05:07amalloythe best you can do is use a timeout channel to periodically poll it and see if it's been realized, i suspect
05:07amalloyor do something blocking that eats up a thread
05:07pyrhhooof
05:08pyrhhoalright, well thanks
05:17sm0keholy shit! logging is a mess already and clojure has timbre with its own format, really?!
05:18sm0kehmm someone needs to kill Ceki Gülcü
05:41glosoliany ideas for some nice way some elements near the end of </body> tag
05:41glosolis/way some/way to move
05:53ucbis it possible that the aleph docs are stale? If I specify no :frame for the tcp-server I don't get ByteBuffers but rather a BigEndianHeapChannelBuffer
06:05amalloyucb: ByteBuffer is an interface
06:05ucbamalloy: very good point; I just realised that :)
06:05ucbas in, I actually read the docs
06:15rstandyhello clojure community
06:15rstandyweb dev question
06:16rstandywhat people use to make websites?
06:16rstandyis caribou a good framework?
06:18rstandydoes someone uses caribou?
06:21rstandywhat people use for web development?
06:22john2xluminusweb.net
06:22jph-is there a shortcut way to uppercase a keyword from :abc to :ABC
06:22jph-rstandy: i was looking at caribou, it looks very good, but perhaps a little too "magic" for firsttimer
06:23jph-ie, when you wander off the beaten track you might be stuck if you're new to clojure webdev
06:23jph-that's just my guess
06:27clgvjph-: no. but it is not too long
06:27clgv&(require ['clojure.string :as str])
06:27lazybotjava.lang.ClassCastException: clojure.core$str cannot be cast to clojure.lang.Symbol
06:27clgv&(require '[clojure.string :as str])
06:27lazybot⇒ nil
06:28jph-thx
06:28clgv&(-> :abc name str/upper-case keyword)
06:28lazybot⇒ :ABC
06:28clgvor maybe clojure.string counts as shortcut ;)
06:28jph-hehe
06:29jph-oh yeh
06:29rstandyjph-: thanks for your opinion :-)
06:29jph-what does &(-> mean?
06:29jph-i've seen that in a few places
06:29clgvthe "&" is for lazybot to tell it to execute the form
06:30jph-rstandy: there's a full book on webdev with clojure that seems fairly framework agnostic, have you seen that?
06:30jph-also on my kindle to read list
06:30clgv"->" is threading. the code above is equal to (keyword (str/upper-case (name :abc)))
06:30jph-ahh
06:31clgvsee: ##(macroexpand-1 '(-> :abc name str/upper-case keyword))
06:31lazybot⇒ (clojure.core/-> (clojure.core/-> :abc name) str/upper-case keyword)
06:31clgvoh right only one step^^
06:32clgv&(macroexpand-1 '(-> :abc name))
06:32lazybot⇒ (name :abc)
07:05sm0kein a gen-clas :method key how do i define a funtion with signature (String msg, Object... objects);
07:12clgvsm0ke: that might be a limitation of gen-class
07:12sm0keshit man!
07:12sm0kei am stuck
07:12clgvsm0ke: http://stackoverflow.com/questions/8951449/clojure-gen-class-varargs-constructor
07:12sm0kealso i have one more problem
07:12clgvbut I am not sure that this does the trick completely
07:13sm0kewhat if i want to define two function with same name and different types?
07:13clgvafaik varargs are in fact syntactic sugar
07:13sm0kei get java.lang.RuntimeException: Can't have 2 overloads with same arity
07:13sm0kealthough i have typehints
07:13clgvsm0ke: well in clojure you can only dispatch on arity in methods
07:13sm0ke:(
07:14clgvI am not sure whether deftypes can implement same arg count different type method implementations
07:15clgvit would only be an option if you do not necessarily need gen-class...
07:15sm0kehmm it just clicked me!
07:15sm0kewhat if i just define one method and check if its instance of a particular type?
07:15sm0kewould that work?
07:15clgvsure
07:16sm0ke:D
07:16clgvyou could also pass to a multimethod which dispatches on all arg types
07:16sm0kei hope that trick you mentioned for varargs works out too
07:16sm0keclgv: thanks
07:17clgvsm0ke: you'd have to try the varargs trick from the java side to see whether it works
07:17clgvsm0ke: https://groups.google.com/forum/#!msg/clojure/HMpMavh0WxA/fenl_hSxNkAJ
07:17sm0keclgv: hmm actually it should work ...varargs indeed are just array right
07:18sm0keonly if clojure had a better syntax for array-types
07:19sm0keclgv: does using typed clojure let me define two functions?
07:19sm0kewith same name and arity?
07:19clgvnope. it is only for type checking
07:19clgvit does not change clojure itself
07:20sm0kehmm what a bummer
07:20clgvbut there is a difference on the java side for varargs since the compiler needs to distinguish between methods that have varargs and those which take an array as param
07:21clgvsm0ke: can you write a java facade and just write the actual implemenation in clojure?
07:21sm0keclgv: isnt calling clojure from java even more hairy?
07:22clgvsm0ke: I thought you needed that interop scenario! otherwise, why would want vararg support and multiple same arity implementations?
07:22clgvclojure functions provide varargs the clojure way...
07:23sm0keok so i want to rewrtie an old project in clojure, but because a lot of existing java code base uses it i need to make sure that doesnt breaks
07:24sm0keso the only problem is i am using clojure libraries in the rewrite
07:24sm0keultimately java needs to call clojure functions is my point
07:30sm0kehmm i am not sure
07:30sm0keis having java classes calling clojure the easier route?
07:31TEttingersm0ke, I did it once, but you need to be careful about type hints everywhere
07:32TEttingerit was a while ago
07:32sm0kedoes a clojure function (defn foo [msg & objects]) would translate to (String msg, Object... objects);
07:32TEttingersome stuff may have changed
07:32TEttingerno.
07:32sm0keNO?
07:32sm0kehmm ok
07:32TEttinger(defn foo [msg & objects]) would translate to (Object msg, Object... objects);
07:33sm0kefunny
07:33sm0keyes you just scared the hell out of me
07:33TEttinger(defn foo [^String msg & objects]) would translate to (String msg, Object... objects);
07:33sm0kenaaice, i would take that deal than
07:33TEttingerbut in a single-method class
07:33TEttingerin a class that is the ns name
07:33TEttingerit is hairy
07:34sm0keTEttinger: you mean it would be a static method right?
07:34TEttingerno.
07:34TEttingerI believe clojre fns compile to classes
07:34sm0keer
07:34TEttingerwith one static method
07:34glosolihow could one combine usage of move and after in enlive, I have an element that i can move just fine, but I want to move it after some other element
07:35sm0keyess yess but for two function in namespace named foo.bar , can i not call them like foo.bar.f1() foo.bar.f2()?
07:35sm0kefrom java
07:35TEttingerthey do get included, but basically don't return fns if you want java to use tghem, is what I gathered
07:35TEttingeryes
07:35TEttingeryou can probably do that
07:35sm0keso whats hairy about that
07:35sm0kethats probably very clean
07:35TEttinger(doc partial)
07:35clojurebot"([f] [f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & ...]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."
07:35TEttingerif you return anything like that
07:36TEttingeryou can't easily use it
07:36TEttingeryou can use it, but it is hairy because java expects methods to be a certain way
07:36TEttingernot clojuresque
07:36TEttingerI'm pretty sleepy, maybe I shouldn
07:37TEttinger't be talking
07:37sm0keok thanks for scaring the shit out of me
07:37sm0keso much for interop
07:38TEttingerit's totally possible, but clojure calls java easier than java calls clojure
07:39sm0kehmm ok
07:40sm0kelet me try that ugly "[Ljava.lang.Object;" trick first
07:40TEttingerdon't forget! ^"[[Z" for a 2D array of bools!
08:10clgvsm0ke: (defn foo [^String msg & objects]) does NOT translate to (String msg, Object... objects) but (Object msg, Object... objects) with some String Cast in the implementation
08:17sm0keclgv: thanks will keep in mind
08:17sm0keg2g
08:20clgvsm0ke: you can always do (alter-var-root #'*compile-files* (constantly true)) in REPL and then evaluate the function definition and have a look at the class file with a decompiler like luyten or jd-gui
08:20clgvthen you know for sure
08:39teslanickAre there any guides for using non-closure libraries with clojurescript?
08:52glosolihttps://www.refheap.com/9924de3987469c1a0ca47ac04 why would such Enlive code fail saying that it does not know how to create ISeq, it works fine if I remove (attr-has check
09:33marianoguerrahi! I want to run a function in another thread to return the response of an http request right away, if I wrap it in a future and don't deref it even if the future goes out of scope will it run?
09:33marianoguerrais there another way to do that?
09:33dnolenteslanick: I've learned a ton from this article, still do - http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
09:35teslanickdnolen: Thanks! My google-fu is weak this morning
09:37devnteslanick: Luke and Stuart Sierra wrote a Clojurescript book
09:38devnteslanick: They cover that topic in there. Although I expect most of what you're looking for is in that article: http://shop.oreilly.com/product/0636920025139.do
09:48stuartsierraThere's a chapter in the book based on that article. :)
09:51stuartsierramarianoguerra: Futures start running in another thread as soon as you call `future`
09:51stuartsierraIf you don't deref it, the only down side is that you won't know if it threw an exception.
09:52dsrxis there a rule that clojure librarys can't be puns anymore?
09:52dsrxlibraries*
09:53dsrxlol Sorry, names such as clojure or *jure are not allowed.
09:54stuartsierradsrx: That's mostly a joke.
09:55llasramExcept in Norway, where it is in fact illegal
09:56teslanickScandinavian nanny governments, man, whatchagunnado?
10:00marianoguerrastuartsierra: thanks!
10:00stuartsierramarianoguerra: You're welcome.
10:08itrusloveteslanick: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html gives a decent overview and is cited all over the place
10:16whilois pedestal planned to become compatible with core.async?
10:16TimMcdsrx: Not disallowed so much as... annoying. :-P
10:16justin_smithwhilo: is it somehow incompatible? that seems odd
10:17whilojustin_smith: last time i tried, i couldn't build with both dependencies
10:17justin_smithoh, I see
10:17stuartsierrawhilo: The next version of pedestal will use core.async for both server- and client-side.
10:17whiloawesome
10:17justin_smithdid you try using :exclusions to make their dependencies work together?
10:17whiloi hoped that :-D
10:17whilostuartsierra: 0.3?
10:17stuartsierraI think so, yes.
10:19justin_smithIf all threads in my app are created inside a binding form that binds a dynamic var, and none call set!, can I expect reasonable and unsurprising behavior from the binding? The only reason I want it declared dynamic is in order to have a different binding, via a binding form, in some contexts (but in those contexts not expecting to change what other threads or frames see)
10:20justin_smithalternatively I could add an extra argument to just about every function in the codebase, or go back to using globals
10:22nDuffjustin_smith: what *is* your idea of reasonable and unsurprising behavior? There are some cases where using bound-fn or such might be appropriate, but I'm not quite sure I understand the use case well enough to say.
10:23justin_smithI have a database config, and some config for app behavior
10:23justin_smithI also have a multi-threaded web server
10:24justin_smithI want to start the server inside the context of a "default" binding, but have the option of switching the config to interact with another db (ie. to help generate migrations from a repl)
10:24justin_smithbut I wouldn't want that special case to interfere with the parent binding, and I wouldn't want any of the server threads to see the config unbound
10:24nDuff...so, it sounds to me like making the root binding be what you use when starting the server is a closest fit for the use case
10:25justin_smithright
10:25justin_smithbut the var is declared in a librarie's namespace, and the end user has to set the value
10:25justin_smithso I would alter-var-root on the object in the library?
10:26nDuffit's not the prettiest thing, but without knowing more details, it's probably the safest.
10:26justin_smithand then use binding to make rebindings on a thread-local basis
10:26nDuffright.
10:26justin_smithOK, thanks
10:26justin_smithit acts like it works, I have just heard so many warnings about dynamic bindings I want to be extra sure
10:26justin_smithso I will throw alter-var-root into the mix
10:45gfredericksin core.async what's the idiomatic way to "doseq on a channel"? i.e., do something side-effecty for each message received until the channel closes. Looks like async/reduce would do it; anything simpler?
10:48gfrederickswould also be easy given a (defn ch->seq [ch] (->> (repeatedly #(async/<!! ch)) (take-while (complement nil?)))
10:48justin_smithgfredericks: (go (while (when-let [input (<! channel)] ...))) ?
10:49justin_smithmakes me think there should be a while-let
10:49gfredericksthat's a weird way to do it
10:49justin_smithyeah it is weird
10:49justin_smithbut it has the right semantics
10:49gfredericksrelies on the when-let returning truthy, which is sketchy for side effects
10:49justin_smithwell you can put a true at the end of the when-let block
10:49gfredericksyep
10:50justin_smithit is guaranteed to return falsy if the first cond is falsy
10:50gfredericksso anyhow yes this is doable a variety of ways, I'm just wondering if there's some idiomatic way to do it
10:50gfredericksusing reduce for side effects feels weird, and it's hard to believe this use case isn't common enough to have something for
10:50justin_smithiterate?
10:52gfredericksI don't think that makes sense?
10:52gfredericksiterate is a pure-functional thing
10:52gfrederickseach item based on the previous one
10:53justin_smith(go (take-while identity (iterate (fn [input] ... (<! channel)) (<! channel))))
10:53justin_smithstill clumsy I guess
10:53justin_smithat that point I guess you may as well be using loop
10:58stuartsierra,(= (byte-array (map byte [1 2 3])) (byte-array (map byte [1 2 3])))
10:58clojurebotfalse
10:58stuartsierraThat's odd.
10:58justin_smithbecause they are mutable maybe?
10:58stuartsierraI suppose so.
10:59justin_smith,(map = (byte-array (map byte [1 2 3])) (byte-array (map byte [1 2 3])))
10:59clojurebot(true true true)
10:59justin_smithof course
10:59stuartsierraAlso, if you get a seq over both arrays, those seqs compare =
10:59hyPiRionuse Arrays/equals for shallow array comparison
11:00justin_smithwhich reminds me, I found this incredibly ignorant comment disparaging clojure on progorammers.stack-exchange.com but I don't have enough karma there to rebut it
11:00justin_smithhttp://programmers.stackexchange.com/questions/220146/why-the-scala-fascination-with-flatmap-this-doesnt-seem-to-be-the-same-for-ma/220150#220150
11:00TimMcSomeone is wrong on the internet!
11:00justin_smithheh
11:00hyPiRion,(do (import 'java.util.Arrays) (Arrays/equals (byte-array (map byte [1 2 3])) (byte-array (map byte [1 2 3]))))
11:00clojurebottrue
11:00justin_smithTimMc: wrong about something I love!
11:02TimMcjustin_smith: I actually don't see the problem.
11:02justin_smith"mapcat isn't part of a protocol, so can't be made to work on other types"
11:02justin_smithmapcat calls map and concat, both call seq, seq operates on a protocol
11:02justin_smithimplement ISeq and mapcat works on your thing
11:03hyPiRionyeah, but then you've just made the object a collection though
11:03stuartsierraIt's true that Clojure's core abstractions are not typically "monadic" in the same way that Scala's are.
11:03TimMcOK, but I don't see the disparaging part.
11:06justin_smithmaybe I was misreading something...
11:07justin_smithprobably better I didn't have permission to comment
11:08hyPiRionwell, it is possible to make own collections and use them though
11:08hyPiRionso in a way "It isn't part of a protocol, so can't be made to work on other types" isn't right in a sense.
11:09justin_smithlook at how, for example, you can get a seq from a string or a hashmap or a record made with defrecord
11:09justin_smiththe clojure idiom is to turn everything into a collection
11:09justin_smithso the dude kind of misses a point there I think
11:09bbloomnow i'm far from a haskell expert, but i just get the impression that it doesn't turn out to be all that useful to write generalized code that works on arbitrary monads
11:10bbloomsure, the do synax in haskell & the for syntax in scala are based on that type class interface
11:10justin_smithwe use monads too, it's just that we prefer the sequence monad and stick to that one
11:10justin_smith(mostly)
11:10bbloombut all the higher level monadic stuff that most people in clojure actually use like lift, etc are an artifact of the type system
11:10justin_smithright
11:11brainproxyall the various monads can be used, it's just that one has to take care "manually" that the return values from the monadic functions are values in whatever monad you're using
11:11justin_smithor you could say that dynamic typing is a catch-all monad that can often replace the others (with the added cost of losing static checking)
11:11bbloomhttp://lambda-the-ultimate.org/node/4786
11:11brainproxyyou actually get some flexibility there, because "in the monad" basically boils down to implementing an interface/protocol
11:11bbloomi'll keep pitching that idea :-)
11:12brainproxyand do syntax is not necessarily an artifact of a type system
11:12brainproxyit's just more sugar for monadic plumbing
11:12bbloomno, the do syntax is the primary consumer of the monadic interface
11:12brainproxyso you don't have to write bind..bind...bind... manually
11:13bbloomit's THE use case that justifies bothering to reify the protocol
11:13brainproxyanything you can do with monadic do you can do with monadic bind and functions
11:13brainproxyit's just more verbose
11:13bbloomof course
11:13brainproxyi mean doing it by hand with bind is verbose
11:13bbloomwe also have the do syntax already, it's just not built in terms of a protocol
11:14bbloomwe call it clojure.core/for
11:14bbloom:-P
11:14brainproxyi don't think that really holds true for all monads
11:14justin_smithapropos, my earlier question about dynamic binding - I could also use a monad, and convert all my code to operate inside that monad which provides the config - and then using an alternate sub-config would just be a question of launching a sub-monad
11:14brainproxye.g. I don't think "for" directly corresponds to "do" with the state monad
11:14justin_smithbut a dynamic var is easier to work with, if I can get it to be correct
11:14bbloombrainproxy: sure it does. it's just like scala's map & flatMap
11:15bbloombrainproxy: it has some *extra* list-monad stuff, like :when and :let
11:15bbloombrainproxy: which is one of the reasons it's preferable to generalized do notation: we use the list monad far more often than most other monads, so if we want to bother adding syntax to ease that usage, we might as well capitalize on the lack of generality to have a more specialized syntax
11:16brainproxybbloom: if you can write out using clojure.core/for something that works the same as using m/state and m/do from protocol-monads I would like to see it
11:16brainproxyand I mean that sincerely, not being a doubter or insincere
11:17brainproxycoffee needs to kick in
11:17bbloombrainproxy: i don't know the interface, so i'm just looking at jim duey's blog post and i see this:
11:17bbloom(def state-mv (m/do [x (m/state 9) y (m/state 2)] (+ x y)))
11:17bbloomclearly that m/do form has the same underlying structure as c.c/for
11:19brainproxywell there is a superficial similarity, but I'm not sure that the plumbing for State can be realized with for
11:20brainproxymaybe it can, that would be pretty cool
11:20bbloomnot the build in for it can't
11:21bbloomhttp://www.scala-lang.org/api/current/#scala.collection.generic.FilterMonadic
11:21bbloomhttp://www.scala-lang.org/old/node/111
11:21bbloomnotice the "if" part of the comprehension
11:21bbloomthat's like clojure's :when
11:22brainproxysure, but those are comprehensions and pertain to the List (aka Sequence) monad
11:22brainproxywhich has entirely different plumbing from, say, State
11:22brainproxyor Writer
11:22Borkdudehmm, something very stranged happened to my nick earlier today, because of a typo... sorry for that
11:23bbloombrainproxy: in scala, if you implement the FilterMonadic trait, then you can participate in for comprehensions
11:23bbloombrainproxy: you can trivially create a stateful object, add that trait, and then create a state monad with "do" syntax using the magic "for" keyword
11:23bbloombrainproxy: there is no reason clojure couldn't do that
11:23bbloomother than it being generally not that useful
11:24brainproxyI don't get it, I still see apples and oranges, but you may be correct
11:25brainproxybut, if you do a macroexpand-1 of a monadic/do using protocol monads and example from jim's page
11:25brainproxymaybe you will see what I mean about plumbing being different, when you look at impl for bind and invoke
11:42brainproxybbloom: btw what I find useful about state monad used with monadic do is that it lets you compose computations to arbitrary depth and branching, w/o having to yourself coordinate the context passing (i.e. the state) between the steps
11:42brainproxyit's a similar thing with -> and ->> of course, but more robust
11:43bbloombrainproxy: i prefer to implement interpreter-like machines
11:43brainproxythat's what I'm using it for in a big project at the moment
11:43bbloombrainproxy: rather than bringing the state to your functions, bring your functions to your state
11:43brainproxyI've worked up a varient of the monadic/do macro that lets me use go-block symbols as well
11:44brainproxyand the steps will get appropriately wrapped in go
11:44brainproxyso you get the "magic" effect of parking the computation somewhere deep in some branched/nested step
11:45seangrovebrainproxy: Sounds very cool indeed.
11:45brainproxypass in one or more external queues via "the world" (i.e. the state) and suddenly you're building a custom event loop
11:45brainproxyof course you could do that with go-loop as well
11:46brainproxybut then you're having to figure out all the context passing between steps in the loop ... and then you're back to looking for a better mousetrap
11:47brainproxyjim's monadic/do doesn't provide a mechanism for recursion to be expressed cleanly within a do block
11:47brainproxyI worked one out though
11:48brainproxyand it's backed by a trampoline, so doesn't blow the stack
11:48edolouglinDoes anyone have sensible bindings for smartparens? The package doesn't seem to provide any and I'm not feeling creative enough to come up with something good.
11:49brainproxyedolouglin: check the prelude package perhaps?
11:49edolouglinbrainproxy: ok. Will do. Thanks
11:49brainproxyhttps://github.com/bbatsov/prelude
11:49brainproxyedolouglin: ^
11:49brainproxyanyway, whatever bindings come standard prelude are working well for me
11:49brainproxyI haven't done any personalizing of the smartparens config
11:51upwardindexAnyone knows if there is a way to get some kind of list of all my compojure handlers?
11:52edolouglinbrainproxy: I got told off in #emacs for using a bundle and was sternly sent to https://github.com/technomancy/better-defaults, which doesn't provide much in the way of bindings.
11:52brainproxyedolouglin: dpm
11:52brainproxywhoops
11:53brainproxyedolouglin: ignore the naysayers, prelude is awesome
11:53edolouglinI'll give it a look...
11:53seangroveedolouglin: I think the creator of that repo's own words summarize the 'better defaults' best: http://p.hagelb.org/lies.gif
11:53brainproxygive it a whirl; save off your .emacs.d to some other place and start fresh by killing what you have and doing a prelude install
11:53upwardindexprelude is pretty nice indeed, the only thing I miss is the M-1 ( from paredit
11:54brainproxybetter yet, fork prelude, then you can keep up with the bug fixes, new features, etc.
11:54brainproxywhile at the same time having a git-backed store of your stuff in .emacs.d/personal
11:56foolanowhat's the idiomatic way of doing the following: i have a function foo that takes too arguments and returns true or false, i want to execute that function over a list for consecutive pairs. Something like for [a b c d], foo(a b) foo(b c) foo(c d)
11:56ordnungswidrig1foolano: use partition and map
11:56foolanoordnungswidrig1: thx
11:57brainproxyupwardindex: been awhile since paredit, remind me what that keysequence accomplished?
11:58upwardindexbrainproxy: Wrap the next "1" sexp in parens, M-3 ( to wrap the next 3 sexps
11:58upwardindexetc
11:58brainproxyah right
11:58Bronsauuuh that's handy
11:59Bronsa(inc upwardindex)
11:59lazybot⇒ 1
11:59brainproxyupwardindex: there's probably a smartparens command for that, but not sure
12:00upwardindexbrainproxy: indeed, I'll try #emacs
12:01brainproxyupwardindex: M-( acts like M-1 ( in my setup
12:02gfredericksI think my life has been forever changed
12:02upwardindexbrainproxy: oh nice, M-5 M-( does it!
12:02brainproxyupwardindex: for me its C-# M-(
12:03brainproxywhere # is 1,2,3...
12:03upwardindexbrainproxy: both work here
12:03brainproxymy favorite is C-M-@
12:04upwardindexhuh?
12:04brainproxyput on an opening paren of some large s-expr to highlight the whole thing at once
12:04brainproxyi mean move to an opening paren of some large s-expr
12:04brainproxyand then C-M-shift-2
12:05upwardindexbrainproxy: is that for visual reference?
12:05brainproxynice for following up with C-w, or M-w or M-;
12:05upwardindexI usually just C-M-k
12:05brainproxysure
12:06upwardindexbrainproxy: ah for commenting it is nice indeed
12:06brainproxy:)
12:06upwardindexwhat is uncomment?
12:07m0gI'm trying to follow http://weka.wikispaces.com/Use+WEKA+in+your+Java+code#Classification-Train/test%20set but in Clojure. I'm getting a method not found exception. In java it works as showcased in https://gist.github.com/m09/7791210
12:07m0gany idea why ?
12:08m0gthe problematic method is evaluateModel in the evaluate function. But the problem might be broader of course since I'm only starting Clojure and might have missed obvious things
12:12gfredericksm0g: is it possible that test is nil?
12:12gfredericksjava interop calls like .evaluateModel get compiled to reflection in the absence of type hints, and I'm not sure what the reflective code does if some of the args are nil
12:12m0ggfredericks: it should not be at least. In Java it isn't and I am using the same file
12:13hiredmanm0g: if you look at the javadocs for evaluateModel, the only signature that takes a classifier and an instance, also takes other objects as java varargs
12:13gfredericksyeah I guess load-instances would have thrown an NPE
12:13gfrederickshiredman's observation sounds correct
12:13gfredericksyou'd need to give an empty array
12:13hiredmanwhich in clojure, for no args, means you need to pass an empty array or nil depending
12:13m0goh
12:15sm0keis it possible to set the logger name in tools.logging
12:15sm0kecan i cahange it some other than the current namespace?
12:17gfrederickssm0ke: I think one of the arities lets you pass an ns
12:17brainproxyupwardindex: re-highlight and M-; usually works for me
12:18sm0kegfredericks: i dont see any such thing in the debug info etc conterparts
12:18upwardindexbrainproxy: hahahha I was trying all kinds of stuff C-u M-; C-M-; etc but had not tried the simplest :)
12:19sm0keits just fmt & fmt-args
12:19sm0keor throwable fmt & args
12:20m0ghiredman: Adding (into-array Object []) as last argument indeed fixed it. Thanks a ton, this was driving me nuts <3
12:22sm0kewow tools.logging looks pretty ancient
12:22dnolenhrm, I wonder how hard it would be to make a cljs.core/defmacro in CLJS so we get sensible symbol resolution?
12:22sm0keeven before lein was born i guess
12:23gfrederickssm0ke: I guess the best you can do is the log* function which takes a logger as the first arg
12:25sm0kegfredericks: :( hard work!! i would have to rewrite/copy all the macros!!
12:25sm0kegfredericks: can i overrite the settings which picks default ns?
12:26gfredericksyou could monkey-patch impl/get-logger I suppose?
12:26sm0kei couldnt figure out how tool.logging get the current namesapce
12:26gfredericksI was just examining (source clojure.tools.logging/logp)
12:26dabdcould anyone please recommend a debugger for clojure with the ability to step through forms?
12:26dabdusing emacs+nrepl atm
12:27ToBeReplacedsm0ke: what is your issue? the macros all accept a logger ns i thought?
12:28devnAnyone here do clojure on Android?
12:28devnFor fun or for profit?
12:28devnWhat's the current state of that whole thing?
12:28nDuffdevn: Slow.
12:28devnHow slow?
12:28nDuffdevn: 3-5 seconds at startup.
12:28sm0keToBeReplaced: no they do not, at least according to my limited knowledge of reading clojure source
12:28devnnDuff: responsive once it's running, oui ou non?
12:28nDuffdevn: AIUI, reasonably so.
12:29coventrydabd: Ritz is the incumbent, but I never got it work effectively. I heard that you can use schemetterling as stepping debugger, but haven't tried it. Troncle is not a stepping debugger, but does print out the result of evaluating each form.
12:29nDuffdevn: ...for what it's worth, I have a plan to try to make things better, but it's probably a few months away from a working 0.1 release.
12:30sm0kenot very flexible api design
12:30ToBeReplacedsm0ke: https://github.com/clojure/tools.logging/blob/5c7f87f023288afe074d26bb3a26fe5e88b10429/src/main/clojure/clojure/tools/logging.clj#L70
12:30devnnDuff: we're considering doing a datalog impl on sqlite for a client-side data store
12:31sm0keToBeReplaced: Yes, thats the log macro, but info debug do much more that just passing :info :debug keywords, so i can not use then
12:32sm0ke,*ns*
12:32clojurebot#<Namespace sandbox>
12:32nDuffdevn: ...also, long-term, the platform is going to be moving away from Dalvik to something that can handle lots of GC of tiny objects better, which is where the non-startup parts of the performance penalty comes from.
12:32sm0keevery other macro is using *ns*
12:32technomancyI always read that as "Dalek"
12:33devnnDuff: i know little about droid -- what's the new thing going to be?
12:33devndoes it have a name?
12:33dabdcoventry: ty
12:33ToBeReplacedsm0ke: i don't understand what you are looking for... is it that you need logp/logf functionality with the ns functionality?
12:34nDuffdevn: I don't remember the name offhand offhand. An early version is shipping with Android 4.4 today -- if you have developer options unlocked, you can flip it on (and wait for all your apps' bytecode to be rewritten).
12:34sm0keToBeReplaced: ok if i do a (info "something") i get a log like org.mystupidnamespace: INFO: somthing, right?
12:34devnnDuff: interesting
12:34ToBeReplacedsm0ke: i've found tools.logging to meet all of my needs... info/warn/etc. are just ease-of-use functions... log is the real meat and is maximally customizable, or at least, i've never had to do something it couldn't
12:34devnnDuff: thanks for the info.
12:35sm0keToBeReplaced: what if i want to change org.mystupidnamespace to org.sanenamspace?
12:35sm0keok i agree thats a bizzare use case
12:35sm0kebut i need it
12:35justin_smithcoventry: no stepping in schmetterling, just local eval, AFAIK and I am on daily speaking terms with the schmetterling authoer (his desk is 6 feet from mine)
12:35ToBeReplaced(log "org.sanenamespace" :info nil "something")
12:36sm0keToBeReplaced: man! there are sanity checks in the info debug etc macros, which your example doesnt cover
12:37sm0keactually just the logf logp macros to be precise
12:38sm0keso ideally i should be able to do (info "org.saneamespace" "my log")
12:38coventryjustin_smith: I believe you. I heard it's "a browser UI for step debugging." I may have misinterpreted that.
12:39ToBeReplacedsm0ke: straight up, i don't grok the implementation of logp, so i can't be of help here
12:39justin_smithcoventry: s/step/stack
12:39coventryOh! Thanks.
12:39justin_smiththough you get a repl where you can do arbitrary stuff, that can look like stepping
12:40justin_smith(one repl per stack frame)
12:40sm0keugh! another bummer
12:41ToBeReplacedsm0ke: the reason you can't do what you want is the ~more expansion... (info "hi" "there") prints "hi there"... maybe that's bad idk i've never used that feature
12:42sm0keToBeReplaced: no thats for string formatting
12:42justin_smithcoventry: on further thought, since you can back up to an arbitrary frame, set the args to the next call, and invoke continue - it isn't super far from stepping - but still not quite stepping
12:42sm0kelike (info "{0} hates {1}" "clojure" "logging")
12:42coventryjustin_smith: How to do get it to stop on the next instruction?
12:43coventrys/to do/do you/
12:43ToBeReplacedsm0ke: okay just looked at logp... what sanity checking are you looking for? it's the same as log macro
12:43ToBeReplacedlogp and logf both just do log exactly... there's no sanity checking
12:44sm0keToBeReplaced: they check wether msg is String ?
12:44justin_smithcoventry: you would have to set the breakpoint after that instruction, then call continue. Likely this would be something to automate and not do by hand.
12:44sm0kecheck wether t is actually Throwable
12:44justin_smithcoventry: at this point I am thinking outloud about how we could implement stepping in schmetterling.
12:45ToBeReplacedsm0ke: sure, but you are passing the throwable to log, and passing a message .... logf/logp is just convenience
12:46sm0keToBeReplaced: well you are working on the premise that one will actually pass an throwable
12:46sm0kewhat if i pass a string instead of throwable
12:47ToBeReplacedsm0ke: it only has to do the throwable check because of the varargs... it's not intended to do sanitization... the string check is just an optimization
12:54alandipertdnolen: https://github.com/tailrecursion/stasis/blob/master/src/tailrecursion/stasis/nanorel.clj re: core.logic awesome power
12:54alandipertdnolen: i'm sure my core.logic is absolutely atrocious, so thanks in advance for tips
12:58sm0keToBeReplaced: you are right
12:58sm0keToBeReplaced: thanks
12:59sm0kei am little slow with understanding macros
12:59sm0ke:P
13:02sm0kecan i force tools.logging to use log4j first?
13:05jonasenBronsa: Any input on this: https://www.refheap.com/21499
13:06ToBeReplacedsm0ke: there's a couple of different ways... the complexity varies depending on if you are polyglot or not -- check out https://github.com/malcolmsparks/clj-logging-config if you are in the commonly treaded path
13:09BobSchackdevn ping
13:09joegallosm0ke: https://groups.google.com/d/msg/clojure/xhdK4M67ji4/9mZWD0b4V0gJ
13:09sm0kehmm configuring logging in the code
13:09joegalloand there's that
13:09sm0kenot so attractive
13:10ToBeReplacedalter-var-root on logger-factory seems like the way to go
13:10sm0keok well it makes sense for the logging library to do that
13:12ToBeReplacedwe just use logback.xml files and everything works out of the box, but if i understand correctly when there are multiple logger implementations in the classpath things get hairy
13:13sm0keToBeReplaced: interesting
13:13sm0keyou mean you use slf4j-api
13:14sm0kelogback by default is not listed in tools.logging wiki
13:14sm0kei guess it can be used via slf4j oly
13:14sm0keonly*
13:14ToBeReplacedch.qos.logback/logback-classic
13:17ToBeReplacedsm0ke: an example app we have in prod uses [org.clojure/tools.logging "0.2.6"] [ch.qos.logback/logback-classic "1.0.13"] [net.logstash.logback/logstash-logback-encoder "1.3"] [org.slf4j/log4j-over-slf4j "1.7.5"]
13:19sm0keyou have both log4j and logback
13:20sm0keit would come down to who is in the classpath first
13:21sm0kei am not sure if slf4j also has a preference
13:22ToBeReplacedit looks like that's a dep that doesn't need to be there anymore
13:24sm0keyes i think one of them is unecessary
13:24sm0keyou can chose over log4j or logback
13:24sm0keits the same nonsense over years
13:25sm0kecan i define a compilation order in lein?
13:26sm0kei have a namespace some-thing.core and some classes in src/java folder which are trying to import some_thing.core; but i get symbol not found constantly
13:27technomancysm0ke: lein defaults to java first, then clojure
13:27technomancybut you can change it with prep-tasks
13:27technomancy:prep-tasks ["compile" "javac"] ; iirc
13:28eric_normanddnolen: do you know of a way of suppressing the JSDoc warnings when using React.js?
13:28aconbereztellman: got a sec?
13:28ztellmanaconbere: sure
13:28aconberehttps://gist.github.com/ztellman/03fae5146befe9c24868#file-gistfile1-clj-L14
13:29aconberedoesn't that line block the netty thread?
13:29sm0ketechnomancy: thanks, but still no luck
13:29aconbere(since it's using the blocking take operation?)
13:29aconbereblocking put
13:29aconberebleh
13:29ztellmanaconbere: it's in a (future ...)
13:29aconbereah!
13:29ztellmanwhich puts it on a separate thread
13:30sm0kethis is rather intriguing example https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L202
13:30aconbereztellman: doesn't that suffer the same ordering problems as my initial attempt?
13:30ztellmanaconbere: no, because only once message is in flight at any given time
13:31ztellmanby spinning off a goroutine for each new message, depending on how the underlying thread pool works you might get reordering
13:31aconbereooooo
13:31aconberei think I see
13:31technomancysm0ke: do you have a circular dependency between java and clojure?
13:31aconbereyou're putting the digestion of the lazy sequence in a future
13:31aconberebut the actual eating of that seek is not ordered
13:31ztellmanyes, which is strictly ordered
13:31aconberebecause of the blocking put
13:32aconberegotcha!
13:32ztellmanwait, no, it *is* ordered
13:32sm0ketechnomancy: no just java calling clojure
13:32aconberebleh
13:32aconbereit's still earlier her
13:32aconbereyes
13:32aconbere"eating of the seek *IS* ordered"
13:32aconbereand obviously I mean sequence
13:32aconbereand I should just stop and drink more coffee now
13:33aconbereztellman: thanks
13:33ztellmannp
13:33sm0ketechnomancy: i just have a single import in my java class and a single function in my clojure ns
13:33sm0ketrying to call that function from java class
13:34technomancysm0ke: simplest thing is to do it reflectively; then compilation order doesn't matter
13:34sm0ke:D
13:35sm0kedo you think the _ is the culprit
13:36technomancyI'm probably not the right person to ask since I don't know Java
13:36sm0keso i have import my_namesapce.core; then core.func()
13:36sm0kehmm somehow i dont believe you
13:36technomancywhat
13:37technomancyno, seriously
13:37mdrogalisI have never seen technomancy kid.
13:37sm0kecome on
13:37mdrogalisWell, maybe once.
13:37technomancyI have written one class in java, and that was a test case for a jruby patch in 2007.
13:37mdrogalisIt was the worst year of his life.
13:37sm0kethats bullshit
13:37Bronsajonasen: looks like a tools.analyzer bug to me, I have to go now, will look into this in a couple of hours
13:37technomancyhttp://jira.codehaus.org/browse/JRUBY-3189 2008, sorry
13:38aconbereztellman: aleph has been pretty awesome to work with, i was really banging my head agains the way trying to get basic network protocols running :-/
13:38jonasenBronsa: Thanks.
13:38technomancyeven that took me like five tries to compile
13:38sm0keauthor of lein doesnt know java
13:38sm0kefucking hilarious
13:38sm0keoh man you are awesome!
13:42TimMcThat's nothing, I use Java and don't know x86 assembler.
13:42mdrogalisI always wondered what it would be like using Clojure and not knowing Java. Obviously I can't undo that to experience it.
13:42technomancyI'm pretty handy with transistors though.
13:43gfrederickstechnomancy: do you wear flip flops?
13:43gfredericksand eat nand bread?
13:43technomancynot in the winter
13:44technomancygarlic nand
13:44TimMcgfredericks: Not to be confused with NaaN
13:44aconberemdrogalis: I learned scala before learning java which I imagine is somewhat similar
13:45aconberemdrogalis: mostly I found that the hardest part was learning how to interface with the JVM environment (debuggers / frameworks / libraries / vocabulary)
13:46mdrogalisaconbere: Right, the vocabularly would seem like the most daunting thing to me.
13:46technomancyyeah, mostly it's just a matter of learning the jdk classes
13:46mdrogalisBut it wasn't so bad?
13:46aconberenah
13:47mdrogalisThat's pretty excellent. Good for you. :)
13:47aconbereheh
13:47technomancythe only tricky part was java.io.*, (readers, writers, inputstreams, etc) but I had to learn it before clojure.java.io
13:47technomancykids these days have it easy
13:48sm0keyes, there is no fun learning clojure if you havent seen assembly
13:50sm0keugh, i remember making a disk reader in assembly during college
13:50sm0kecruel
13:52TimMcsm0ke: On the other hand, I wrote a 5-stage pipeline MIPS processor in Clojure during college.
13:52mdrogalisI did MIPS in college. Ugh.
13:52TimMcIt felt a little silly.
13:52sm0keTimMc: what college is that?
13:53TimMcCollege of Computer and Information Science (at Northeastern University in Boston, MA, USA)
13:53sm0keMasters?
13:54TimMcNo, BS in CS.
13:54TimMcI had to ask for an exception to use Clojure -- the default option were C(++) and Java.
13:56sm0keTimMc: must be having your own OS written in clojure?
13:57mdrogalisYeah, I actually had a similar situation asking to use clojure, TimMc.
13:57mdrogalisIt went well. :)
13:57TimMcI mostly learned Clojure via school projects. It's important to have a project of some sort.
13:58TimMcsm0ke: Nah, for that I think I'd want to use Erlang, OCaml, or Rust.
13:58mdrogalisYeah, agreed with that sentiment. I think it's important to put in a lot of time alone too.
13:58TimMc(none of which I actually know, mind you)
13:58mdrogalisPeople start to lean pretty heavily on others in teams and end up not learning as a habit.
13:58sm0keso MIPS is basically RISC instruction set right
14:00TimMcIIRC, yes.
14:01sm0keTimMc: i dont understand how did you program in Clojure?
14:02sm0keour cpu design lab was on small microprocessors
14:03TimMcsm0ke: Oh, sorry, it was just a simulator.
14:03ToxicFrogsm0ke: he implemented a MIPS processor emulator in clojure.
14:03ToxicFrogHe didn't write clojure targeting a MIPS processor.
14:03sm0keah!
14:04TimMcNothing so exciting.
14:04TimMcNo wonder you were asking if it was a Master's program.
14:05sm0keyea simulator lab are challenging to brain, hardware lab are challenging to spine
14:05sm0kefking cpu lab
14:06nDuffHeh.
14:06sm0keok guys, later
14:11dsrxi have a bunch of tests that are just repetitions of: is (= desired-output (my-fun some-val)) with different desired-outputs and some-vals
14:12dsrxhm
14:13dsrxoh nice, the are macro
14:15gfredericks(inc are)
14:15lazybot⇒ 1
14:15gfrederickshey we can track karma for specific vars
14:15gfredericks(inc clojure.test/are)
14:15lazybot⇒ 1
14:16gfrederickseven hypothetical vars
14:16gfredericks(inc clojure.core/update)
14:16lazybot⇒ 1
14:16TimMc(inc clojure.core/dissoc-in)
14:16lazybot⇒ 1
14:16gfredericks^ register your support
14:16technomancy(inc map-keys)
14:16lazybot⇒ 1
14:16technomancy(inc map-vals)
14:16lazybot⇒ 1
14:17ToxicFrog(doc are)
14:17clojurebotTitim gan éirí ort.
14:17ToxicFrogUnhelpful, clojurebot.
14:17TimMcI have faith that Rich will come in here one day and check $karma for each of these to see what to implement next.
14:17technomancyneeds jira integration
14:22dsrxit's like println
14:22stuartsierraI don't get map-vals/map-keys. reduce-kv is just as easy.
14:23gfredericksyou don't get using them at all or just don't think they meet the clojure.core threshold?
14:23stuartsierraI don't get why people so often seem to want them. Their lack has never bothered me.
14:23technomancystuartsierra: can you do reduce-kv without a #()?
14:24gfredericksI feel messy using reduce for something where each step is independent of the others
14:24gfrederickse.g., why do we have map at all when reduce works?
14:24stuartsierra`map` is lazy
14:24stuartsierra:)
14:25gfredericksso if you use reduce-kv to do a map-keys, I as the reader of the code have to put a bit more effort into figuring out that that's what you're doing (as opposed to a more proper reduction)
14:25gfredericksthe same reason that it's nice to have map even though (laziness aside) you can do map with reduce
14:26gfredericksit makes it obvious that the things are being mapped independently
14:26technomancyyeah, reduce is too general/heavy
14:27gfredericksyou could be doing just about anything in reduce and it takes a bit of concentration to rule out those other possibilities
14:27technomancywe wrote a map:for::reduce:reducate macro at seajure once; that was kind of fun
14:27technomancyto avoid needing an anon fn the way that for does
14:30gfrederickstechnomancy: is it possible for eval-in-project to ignore compilation failures and eval in a previous build of the project?
14:30ToBeReplacedthe map-keys/map-vals candy is nice for nested structures, which seem to come up often enough
14:30technomancyToBeReplaced: yeah, works much better than reduce for update-in
14:30technomancygfredericks: no. you might be able to write a higher-order task for that though.
14:31technomancysomething that monkeys with :compile-path
14:31gfrederickstechnomancy: a buddy is seeing that behavior with `lein ring server :headless` and I'm trying to figure out why
14:35gfrederickstechnomancy: oh nm I misunderstood the problem
14:41gfredericksthis was about auto reloading
14:42gfrederickson a compile error it serves the stacktrace once and then reverts to the old code
14:43mklappstuhlhey there. is it possible to persist a clojure function in postgres and then deserialize it? (I guess it is but I'm not sure how to approach it)
14:43mdrogalis,(pr-str {:a 1})
14:43clojurebot"{:a 1}"
14:44mdrogalis,(read-string "{:a 1}")
14:44clojurebot{:a 1}
14:44coventryI'm curious, could you pull out a fn's byte code and persist that?
14:44mdrogalisOh, you wrote function.
14:45mdrogalisI'll just sit here and pretend I know what's going on.
14:45TimMcserializable-fn
14:45TimMcsort of
14:45mdrogalisWhat's your problem, mklappstuhl?
14:46mklappstuhlmdrogalis: that looks pretty helpful already, thanks
14:47mdrogalisSure :)
14:55teslanickOk. So here's a weird one. I'm messing with lein-resource to copy some static assets from one directory to another. It's creating the file, but with only the file name as the contents.
15:01seangrove bitemyapp: First sf cljs meetup will be in January, second or third week, at Etsy. Food, drink, location, check. Just need to nail down a workable date and round up some interesting people.
15:05sritchiemagnars: boom, got cloudfront working :)
15:05sritchiefor some reason, though, chrome doesn't seem to be respecting the Cache-Control and Expires headers
15:05sritchiemagnars: (though cloudfront does). Chrome still hits cloudfront on every request
15:06dnolenalandipert: cool stuff will have to look more closely at it later
15:07magnarssritchie: Cool, glad you got it working. :) Is Cloudfront serving the right headers? And, how are you checking? Chrome will behave differently for a regular navigation, and a refresh.
15:07dnoleneric_normand: use master
15:07sritchiemagnars: ah, interesting. I was doing a refresh, perhaps that's it
15:07sritchiemagnars: the right headers are coming through
15:08sritchiemagnars: boom! btw, I ended up using Enlive to go rewrite all of the static resources paths inline
15:08sritchieso, with a one line addition to my main page template, optimus works everywhere, no big changes required
15:08sritchiepretty cool :)
15:08eric_normanddnolen: thanks
15:09magnarssritchie: oh, that is sweet! Care to share the code?
15:09sritchiesure, one sec
15:09clojurebotHuh?
15:10gfredericks~botsmack
15:10clojurebotOwww!
15:10dnoleneric_normand: included required project settings to the gist
15:12sritchiemagnars: https://gist.github.com/sritchie/7794646
15:12sritchiethat's the idea
15:13sritchienot sure if you've used enlive
15:14sritchiemagnars: but the entries are pairs of selector and transformation (that gets applied to every match)
15:14sritchieso :img just matches every image tag on the page (after the user's code gets subbed into the :main div
15:14sritchieand rewrites the url, if it starts with /img, in this case
15:14magnarssritchie: No, just read about it. That is a really neat way of fixing all your image urls. :) Mind if I use it as an example in the README?
15:14sritchiemagnars: please do
15:15magnarsExcellent, thanks
15:15clojurebotPardon?
15:15sritchiemagnars: of course the same idea applies for hiccup
15:16sritchiemagnars: a tree-walking function that replaces all img tags right before serving
15:16zanesseangrove: That's exciting!
15:18bitemyappseangrove: I look forward to the cljs meetup.
15:18seangrovezanes: You going to come?
15:18zanesseangrove: I'd love to! I assume you mean Etsy's offices in NYC?
15:18magnarssritchie: very nice! It's going in the readme :)
15:18seangrovezanes: Of course not, in SF ;)
15:19zanesseangrove: :(
15:19seangroveWith dnolen, cljs is actually *over-represented* in NYC
15:19zanesI was going to say — but we have dnolen!
15:19seangroveWe have to do more with it out here to catch up
15:19zanesI see, I see.
15:19eric_normanddnolen: with the project settings, I shouldn't need to use master?
15:19dnoleneric_normand: no you need master for those project settings to do anything
15:19bitemyappzanes: SF brings all the boys to the yard, damn right, better than yours.
15:19eric_normanddnolen: I see
15:20eric_normanddnolen: thanks!
15:25gfredericksclojure.core.async/map< will "send a nil through the channel" if your map function returns nil
15:25gfredericksis that intentional?
15:27bitemyappgfredericks: it probably is, it should be understood by now that nil has special meaning in any core.async context.
15:27bitemyappgfredericks: the onus is on the user to remember that.
15:27gfrederickssure
15:27bitemyappI feel like core.async needs a flashing neon sign that says, "nil has special meaning!"
15:28bitemyappI feel like an empty defrecord instance baked into the library would've been cleaner, but you know, whatever.
15:28gfrederickswe can put it in the pom.xml
15:29TimMcWhat *does* it mean?
15:29TimMcI haven't worked with core.async at all.
15:29gfrederickschannel is closed
15:29bitemyappTimMc: pool's closed.
15:29gfredericksclosed channels return nil when you read from them
15:29TimMcYuck.
15:30gfredericksI think the horse is already dead on this one
15:30bitemyappgfredericks: the horse is in miscible pieces.
15:30gfredericksI just didn't expect map<'s behavior
15:30bitemyappit's a fine red mist.
15:31coventryWhat's the advantage of that?
15:31bitemyappcoventry: advantage of what?
15:31gfrederickseasy to say (when-let [x (a/<!! ch)] ...)
15:31bitemyappoh yes, that.
15:31gfrederickswhile trying not to think about false of course
15:32coventryOf nil closing the channel. Happy for a transcript/video of the horse's beating up to this point.
15:32bitemyappgfredericks: pattern matching would be more generally useful. oh well.
15:32gfrederickscoventry: I expect you could find a long ML thread
15:32bitemyappcoventry: if you use core.async it becomes obvious quickly.
15:32gfredericksclojure; it's the worst language out there except for all the other ones
15:33hiredmangfredericks: that seems like a bug, I thought you weren't allowed to pass nils over channels
15:34gfrederickshiredman: it technically doesn't go through a channel, which is obvious when you look at the source of map<
15:34gfredericksit's more of an API question
15:34gfredericksi.e., it blows up if you put nil on a channel; should we therefore assume it's physically impossible to receive nil from a "channel"?
15:35gfredericksthe docs for map< claim that it returns a channel
15:36gfredericksbitemyapp: discounts for unpopularity of course
15:37bitemyappgfredericks: not even what I was thinking of.
15:38gfrederickswell then your mouth-zipping was effective
15:45seangroveHrm, just finished the Pete Hunt Reactjs talk dnolen linked to, very interesting.
15:45dnolenseangrove: it's good stuff just had lunch with him, I think React is likely to be a very good fit for ClojureScript
15:46dnolenseangrove: they are using persistent structures + React at Instagram & Facebook, they "get it"
15:46seangrovednolen: The high-level ideas seem very sound, pretty much what I've been thinking of, similar to how pedestal approaches things, etc.
15:46dnolenseangrove: exactly
15:46hiredmangfredericks: sounds like a bug waiting to waste someones time to me
15:46dnolenseangrove: React is nice in that the part we care about is properly modular - event handling & UI representation
15:46seangrovednolen: Wow, did he say if they had a cultural struggle getting engineers to use persistent data structures?
15:47dnolenseangrove: no, because its ... wait for it ... wait .. FASTER
15:47gfrederickshiredman: well fixing it requires an extra check; who knows if that's worth the perf effort
15:47seangrovednolen: but.. but... what about banging on it in place! How dare you *demand* I not mutate!
15:47dnolenseangrove: currently React uses bad default because JS programmers mutate everything, so they have to rewalk everything
15:47dnolenseangrove: if you're data is pure, React can be up to 10X faster (and it's not slow)
15:47bitemyapp~reactjs
15:47clojurebotreactjs is a poorly implemented comonad
15:48stompyjshots fired!
15:48seangrovednolen: I'm with you, but also very interested in the cultural changes/fixing misconceptions, etc.
15:48seangrove~gentlemen
15:48clojurebotYou can't fight in here. This is the war room.
15:48bitemyappit's kitschy, but I'm going to bump for that one.
15:48bitemyapp(inc stompyj)
15:48lazybot⇒ 1
15:49dnolenseangrove: it's super small team from what I understand and they hated the MVC stuff they had before
15:49dnolenseangrove: I think converting was not hard
15:49seangrovednolen: I see, so it's not like the entire org was willing to try it then
15:49seangroveWell, that makes sense. Start small and prove it out first, then maybe it'll spread.
15:50tos91
15:52seangroveOh jesus, I just realized that talk was at JSConf EU
15:52seangroveI was *there*. I can't believe I didn't go to that talk. Damnit.
15:59Raynesseangrove: http://wpmedia.o.canada.com/2013/05/kittensleep.gif
15:59RaynesSlept through it, clearly.
16:00seangroveRaynes: True, the conference didn't have a ton of material that caught my eye.
16:00seangroveBut the people were nice
16:00owengalenjonesquestion, if core.async/<! returns nil when the channel is closed, what is the preferred way to see if a channel is drained? a coworker suggested putting ::sentinel onto the channel and waiting till that value gets taken off
16:01bitemyappowengalenjones: timeout or sentinel.
16:01owengalenjonesbut still just sending a keyword is acceptable?
16:02hiredmanowengalenjones: my guess is the producer that is putting values on the channel should close it to signal to the consumer(s) that nothing more will be forthcoming
16:02bitemyappowengalenjones: if you want, but it's usually a sign you're not using core.async correctly.
16:02mdrogalisWasn't Tim trying to get a closed? function into the API?
16:02sritchieanyone here using amazonica?
16:02bitemyappowengalenjones: you're better off closing the channel.
16:02bitemyappsritchie: a lot of Pallet people use it.
16:02bitemyappsritchie: but beware, Pallet people are a bit warped.
16:03bitemyappsmart, but warped.
16:03sritchie:) I used it for a while
16:03sritchiepallet, that is
16:03bitemyapptoo loopy 4 me
16:03bitemyappnot at all how I think about deployment or provisioning.
16:03sritchiewhat do you use?
16:03bitemyappmassive mental model / library model mismatch.
16:03bitemyappsritchie: idempotent fabric+cuisine (python) or haskell.
16:04sritchiewhat's the recommended haskell deploy lib?
16:05owengalenjonesbitemyapp: basically I want to use a buffered channel to control the amount of concurrent requests and then do something with the results as finished requests get taken off the channel
16:06owengalenjonesis this using async incorrectly?
16:06owengalenjonesrhickey basically cites this as a use case in the async introduction video
16:08mdrogalisbitemyapp: Basically owengalenjones is seeing that values in the channel that were put in before closing the channel come out as nil.
16:11gfredericksowengalenjones: (alts!! [ch] :default :drained) or something like that?
16:14owengalenjonesgfredericks: thanks that might be what I need
16:22hiredmanowengalenjones: if you are using a buffered channel as a batching mechanism it seems like you would be better off using an unbuffered channel and having the consumer take off n things before it does any work
16:41bitemyappsritchie: there's not one, I've been tinkering with my own.
16:48gfredericksI want to write http APIs by defn's that have metadata to help the ring server translate the request into args
16:50brehautliberator ?
16:50brehautits not defns but its more like what you are asking about
16:50brehauthttp://clojure-liberator.github.io/liberator/
16:51gfredericksI'm not sure if I'm a fan of the rest thing
16:51brehaut~guards
16:51clojurebotSEIZE HIM!
16:51gfredericksconditioned on me being a fan then liberator is probably what I want, yeah
16:52brehautim not a fan of rest where it means 'lets make rails apps look kinda like rest'
16:52gfredericksright now I'm in the mud because there's a bug in some app logic that exists inline in my compojure route
16:52gfrederickswhich means testing it involves going through http which is rather awkwarder than testing a regular function
16:53gfredericksso I could pull the logic out into a .server.data namespace perhaps
16:53justin_smithyou can't just call your handler?
16:53gfredericksI think I can
16:53justin_smithI usually call my handler with a request map
16:53gfredericksI've been using this peridot thing for no good reason
16:53justin_smithI made a lib that records requests for replay and serializes them
16:53gfredericksoh I made a vcr lib too :P
16:54justin_smithin mine the map is fully ring compatible, ie. the body is a stream
16:54brehautgfredericks: i think the best practise with compojure is to make your inline handler code as small as possible and pass it on to a plain function as quickly as you can
16:54gfredericksthat's not an issue at the moment too
16:54justin_smithwith the same contents as the initial request
16:54gfredericksjustin_smith: yeah this test wouldn't benefit from vcr
16:54justin_smithif you have that, why do you need to use http?
16:55justin_smithjust call your handler as a function on the request if it is properly serialized
16:56gfredericksit's still clunkier than calling a function with normal args
16:56gfredericksif the translation from http to clojure was declarative then I wouldn't have as much of a burden to test that part
16:57brehautgfredericks: xml-rpc!
16:57justin_smithwhat does your compojure route do that doesn't translate out of http to serialized request?
16:57bitemyappin liberator, is there a way to use a custom rendering function with Content Negotiation
16:58bitemyappI just want to call "identity" on what my handler returns (I do this all the time in non-liberator Ring applications) but I get a multimethod error.
16:58gfredericksjustin_smith: e.g., parsing a UUID from the route
16:58justin_smiththe route is in the request map
16:58justin_smithwell, the uri is
16:59gfrederickssure
16:59gfredericksgotta pull the component out and parse it to a UUID
16:59gfredericksand to call the handler in a test I have to shove the uuid back into the uri
16:59justin_smithif it is recorded, then you just reuse it
17:00justin_smithif it is serialized, you can paste it into a deftest form
17:00justin_smithor a file that gets read by the deftest
17:00bitemyappn/m, found the multimethod, just need to smash it.
17:00bitemyappmonkeypatching ftw.
17:01gfredericksjustin_smith: yep. what I would like is to be able to just test idiomatic clojure functions and assume the http details are taken care of
17:02justin_smithfair enough, then you probably want a more functional and less macro oriented router than compojure I guess
17:03gfredericksI don't know how the collecting of functions into a single handler would work best
17:04gfrederickse.g., would the route be defined in the route listing or on the function metadata? both seem important
17:04justin_smithno, you make the routes combine to make a handler function, but each is also just a standalone function
17:04justin_smithwell in my ideal design they do
17:04riley526fwiw, you might check out https://github.com/mwmitchell/wire for another routing approach
17:05justin_smithhttps://github.com/caribou/polaris a buddy / coworker of mine made this
17:05justin_smithmore function / edn oriented routing
17:05justin_smithalso has reverse routing
17:06justin_smithie. you can test your route by feeding it the map that should come out, and seeing if the URL that it spits out looks right
17:09gfredericksa map comes out?
17:10gfredericksoh with params and such?
17:11alandipertgfredericks: https://github.com/tailrecursion/castra might interest you, RPC + csrf
17:12gfrederickshmm
17:12jrubinoWill performance ever be a development priority or is Clojure devs consider it "fast enough "
17:13gfredericksI'm not doing web apps
17:13bitemyappokay, I've had enough, Liberator is getting defenestrated.
17:13jrubino"fast enough" is a reference to the python BDFL remarks on python performance
17:13stompyjbitemyapp: how come? I ask because I just started a project with it
17:13gfredericksjrubino: in what respect do you see performance as not a development priority?
17:14arrdemgfredericks: cinc and c2host aren't exacly rush rush core projects :P
17:14justin_smithgfredericks: yes, see the demo at the bottom of that github page
17:14justin_smithgfredericks: though you may need more fancy parsing of request into params than it provides
17:15jrubinogfredericks: I have read third hand comments that say the focus on clojure was usability while the focus on scala was on performance
17:15gfredericksarrdem: c2host?
17:15arrdemgfredericks: my nickname for a cinc backed to host binary compiler. sorry.
17:15dnolenjrubino: Clojure can be competitive with Java if you care enough to bother
17:16bitemyappstompyj: changing content negotiation/representation behavior is Vietnam.
17:16arrdemdnolen: if you use a subset of clojurescript that can run atop asm.js you could do better than java. maybe.
17:16gfredericksarrdem: how would one recognize a rush rush core project?
17:16dnolenarrdem: asm.js w/o GC story is useless
17:16TimMcdnolen: Meh, RAM is cheap these days. ;-)
17:18stompyjbitemyapp: Ahh. LOL
17:18dnolenarrdem: well useless is probably a strong word, but the value proposition is too small unless you're doing something very specialized (which I think most people aren't)
17:18arrdemgfredericks: given that this is a F/OSS project there really can't be such a thing. my entire comment was sarcasm in so much as achieving performance competitive with "performance" languages like FORTRAN and C is not a serious development goal to my perception.
17:19arrdemdnolen: right. you could probably pull off fast math through CLJS+asm.js but that'd be it.
17:20gfredericksarrdem: I suppose "performance" is relative. I think clojure has a good performance reputation conditioned on being a jvm language
17:21gfredericksor more specifically that it has been a "development priority"
17:22arrdemjrubino: have I snarked on your question enough to answer it?
17:23gfredericksevery single time I call cheshire.core/parse-{string,stream} it takes me 5 minutes to figure out I need to add the extra `true` arg
17:24jrubinoarrdem: I think it rates with the generic "fast enough".
17:24arrdemjrubino: correct. attempting to qualify it with anything else would be silly.
17:25jrubinoarrdem: Clojure; fast enough for android apps?
17:25arrdemjrubino: dalvik, fast enough to be a really shitty JVM?
17:25arrdemjrubino: more seriously I don't know
17:25gfredericksin context we're comparing with scala
17:26jrubinoarrdem: LMAO
17:26scottjjrubino: last I heard startup time for Clojure on android is much worse than Scala.
17:26technomancytreating "performance" like a single-dimensional property is silly
17:26gfredericksI suppose the one thing clojure hasn't optimized for is a slim runtime
17:27technomancycriticizing it as "not performant enough" because it takes a long time to boot makes no sense
17:27gfrederickstechnomancy: I tried out clojure as a DSL for starting JVMs and it sucked
17:27arrdemagreed. the HPC apps I work with have insane boot sequences and then run like a bat out of hell.
17:28technomancyscottj: scala doesn't have a compiler in the runtime, so tree-shaking is a lot easier
17:29eric_normandreact.js's virtual dom is great
17:29arrdemtechnomancy: for most apps can't the compiler tree shake itself out tho?
17:30technomancyarrdem: yeah, but there's enough dynamic/reflective stuff common in clojure to discourage anyone from spending a lot of time on that
17:30dnolenjrubino: reports make it sound like the biggest offender on Android is not running app performance, but the fact that Clojure ships a lot of unnecessary crap - metadata, no tree shaking etc.
17:31dnolenjrubino: unlike most dynamic languages, Clojure was designed from day one with performance in mind - and thank goodness for that
17:32dnolenjrubino: making ClojureScript fast has more or less been copying what's been done in the Java code base, except we get to write it in ClojureScript
17:33justin_smithdropping definitions or data that won't be needed at runtime
17:35nDuff...surprisingly enough [to me], using Soot's basic optimization on a compiled Clojure binary for Android cuts the size down pretty immensely, and that's making very, very conservative inferences about what is/isn't reachable (ie. if we can't track what something returns, assuming that it could be *anything* of the appropriate type).
17:35nDuffHaven't validated that that isn't due to a bug in Soot / behavior not matching intent, though.
17:36nDuff...my hope is to have it taught to follow Var indirections soon, at which point things will get considerably more exact.
17:37arrdemnDuff: a framework like soot should be insanely conservative... any refinements should only make it more agressive
17:37arrdemnDuff: thanks for mentioning that tho. I'll definitely play with it some.
17:37nDuffarrdem: *nod*, just so. That said, given how awful Soot's implementation is, I have trust issues as to its correctness. :)
17:38nDuffarrdem: ...it's mutable singletons everywhere. Abandon all hope, &c.
17:38arrdemnDuff: ::sadface::
17:38nDuff...anyhow, off to catch a train.
17:51aconbereI'm going to feel a little dumb here
17:51aconberebut what's the current state of contrib libraries?
17:51aconbere(in particular math)
17:51arrdemaconbere: questionable
17:51arrdemaconbere: some have been ported forwards, others abandoned
17:51aconbere:-/
17:51aconbereis the best bet just to call java?
17:52ztellmanaconbere: missed the first part of your question
17:52ztellmanwhat are you trying to do?
17:52aconbereztellman: I want to take the log2 of a number
17:53aconbereztellman: but I can't quite figure out the state of contrib libraries
17:53ztellman(/ (Math/log n) (Math/log 2))
17:53aconbereyay!
17:53aconberemy googling all gave examples like (math/log ...)
17:53aconbereor brought up contrib libraries
17:53aconberethat didn't exist
17:58zanesYikes. That's a pretty horrible experience for newbies.
17:59PupenoWhat book would you recommend for people to learn Clojure when they never played with any Lisp before and they know only a little of functional programming?
18:00dnolenPupeno: Clojure Programming is pretty good if you know Python/Ruby/Java
18:04PupenoThanks dnolen
18:04sritchieanyone using http-kit for async responses in clj?
18:04sritchienot long polling, but setting up an async response, then moving on
18:08bitemyappsritchie: I'm not sure what that means.
18:08sritchiewell, say I get a request,
18:08bitemyappsritchie: generally you're reading/writing a websocket or long-poll.
18:09sritchieand I want to do some async work (like uploading an image), then return it to the user once it's done
18:09sritchiethen close the connection
18:20amalloysritchie: how is that different from long polling?
18:21sritchieamalloy: would it be a mistake to do that for every single request?
18:21technomancyPupeno: hey, do I know you from another channel?
18:21sritchieamalloy: a la finagle thrift services in scala,, where every network method returns a future
18:21amalloyi don't see why. that's how aleph works
18:21Pupenotechnomancy: it's possible.
18:22technomancyPupeno: maybe #ruby-lang from way back in the day
18:22Pupenotechnomancy: yes. I've been hanging out in #ruby-lang for a few years already. :)
18:24technomancywell nice to see you again after so many years
18:24PupenoSo, you are clojuring instead of rubying now?
18:24aconbere:-/
18:25aconbereI want to take the bitwise and of a hashed string value
18:25aconberebleh
18:25aconberemaybe I should just use java here
18:25aconberethe problem I'm having is bit-and doesn't support BigInteger (nor BigInt)
18:25aconbereand doesn't list what it /does/ support
18:25aconbere:-/
18:26technomancyPupeno: since about this time of year in 2008
18:26PupenoOh! long time.
18:26SegFaultAXaconbere: (.and my-bigint my-other-bigint)
18:27aconberetechnomancy: see... this is where if I knew java I'm sure I would be happier :-/
18:27justin_smithaconbere: you can read the javadocs for the object that is giving you trouble, and try any methods that look useful
18:27SegFaultAXaconbere: I assume that was to me... also: Google is a thing.
18:28justin_smithas is (javadoc)
18:28aconbereSegFaultAX: clearly google is a thing, otherwise I wouldn't know a lot of what I just asked
18:28aconbere:P
18:28SegFaultAXaconbere: :)
18:28justin_smith(javadoc BigInteger) should open your web browser to the docs for that class
18:29justin_smithif your jvm is properly configured with your OS
18:31PupenoI'm thinking of using Clojure for my next startup.
18:32PupenoSegFaultAX: that's all... I have to sit down, do some experiments, and see whether we can be as productive with Clojure as we can with Ruby and Rails.
18:32mklappstuhlhow can I use korma's predicates like >= when only a single attribute is relevant? http://sqlkorma.com/docs
18:33bitemyappPupeno: a lot of the benefit in web apps with Clojure is that you can grow your own idioms and build with composable libraries/functions instead of having to snipe framework behavior.
18:33bitemyappmklappstuhl: (where {:myattr [> 5]}) ?
18:33Pupenobitemyapp: yes... I have a vague idea of that, but I never built a web app in a Lisp, so it's very vague and unfunded.
18:33SegFaultAXPupeno: In the beginning, there is not a doubt in my mind that you will be several orders of magnitude faster in RoR, espeically if you're targeting a basic CRUD app.
18:34SegFaultAXBut don't despair about that, RoR is literally optimized for that kind of thing.
18:34SegFaultAXYou might even say it's RoR bread 'n butter, if you like that sort of thing.
18:34bitemyappPupeno: it depends on how far outside RoR's sweet spot your app will be, and how quickly you learn Clojure idioms.
18:35PupenoSegFaultAX: I know... I have several years of experience with RoR so I know when it's fast and when it's slow. And I think when the project got really complex we would have benefited from a more flexible system.
18:35SegFaultAXPupeno: Clojure web stack tends to be optimized more towards services. RoR is obviously heavily oriented towards monolithic architectures.
18:35SegFaultAXThe latter tends to make the very early stages of a project much faster.
18:36SegFaultAXAt least that has been my experience.
18:36PupenoWhich framework are people using these days? Pedestal seems to be the most active.
18:37SegFaultAXPupeno: Caribou just dropped and it has been getting a lot of love in here and on the mailing list.
18:37SegFaultAXI haven't actually used it yet.
18:37mklappstuhlbitemyapp: tried that. always resulted in sth like: "SELECT \"days\".* FROM \"days\" WHERE (\"days\".\"date\" >= ?) LIMIT 3"
18:46ToBeReplacedfor the clojurescript + emacs crowd -- how do you organize your folders for clojurescript-test?
18:59augustlmade Yet Another Ring Router :) It's good for Rails-like nested resources, it has a cool system for 404-ing and getting data for things like /user/:user-id, and it makes it easy handlers with different sets of middlewares (middlewares run after method/path matching). Also, it can be extended beyond Ring usage. Check it out :)
19:00augustlhttps://github.com/augustl/traffic-police
19:00augustlwhoops, I some words.
19:01ossarehI some thoughts, thus I am.
19:01augustlossareh: indeed, that was what I.
19:14nkozoThere is a way to destructure the seq in the left to the locals in the right using a single expression for all cases? Here are the three cases: https://www.refheap.com/21509
19:18`cbpnkozo: no, use a map
19:20nkozo`cbp: I can't, I want to destructure function arguments to call a function in the following ways: (f 1) => a=1,b=nil / (f(:b 3) => b=3,a=nil / (f
19:21nkozo sorry, I mean: (f 1) => a=1,b=nil / (f :b 3) => a=nil, b=3 / (f 1 :b 3) => a=1, b=3
19:21RaynesWill the keyword arguments always be the last arguments passed?
19:22nkozoRaynes: yes
19:22nkozobut the non-keyword argument can be present or not
19:22nkozoI want a single destructuring expression to handle all three cases
19:22RaynesAre these the only cases that are ever going to happen?
19:23RaynesIt feels like there are a lot of variables here.
19:23nkozoRaynes: yes, you can handle that in python by simply using def f(a=nil,b=nil)
19:24`cbpwell don't try to write python in clojure :P
19:24amalloynkozo: that's not really a popular style in clojure
19:24`cbpinclude the :a in your arguments
19:25nkozoI don't want to use :a :)
19:25amalloyi mean, what does it mean to call (f 1 :a 2)?
19:26nkozoI don't want to handle that case
19:26nkozothe :b argument is really exceptional
19:26amalloywell heck, i don't want to handle the (f 1 :b 2) case either
19:26amalloyso this should be easy; just write it to accept (f 1) or (f 1 2)
19:27nkozogreat, but I only want to know if a single destructuring expression can handle all these three cases or is impossible :)
19:27amalloyno
19:27`cbpnkozo: that was my first answer to you
19:27amalloyyou can write one yourself, if you want it to be easy for python coders to read your code, and hard for clojure coders
19:41danenaniaanyone know where i can find contrib.seq-utils nowadays?
19:41TimMc~contrib
19:41clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
19:41danenanialooked there, isn't listed
19:42TimMcHmm, what did you want from it?
19:42danenaniaindexed
19:42TimMcThis would be like (partial map-indexed identity)?
19:43danenaniayep, i could use map-indexed
19:43danenaniabut indexed would be cleaner for my use case
19:43TimMcErr, not quite that, but you know what I mean.
19:44danenaniai want to do: (for [[x i] (indexed l)...)
19:44TimMc&(map vector '[a b c] (range))
19:44lazybot⇒ ([a 0] [b 1] [c 2])
19:44TimMcI'd say just define it yourself.
19:45danenaniaso some of the old contrib packages aren't around anymore?
19:48amalloyarrdem: i'm pretty sure http://stackoverflow.com/a/20389154/625403 is wrong
20:00pmaphey, I'm getting some unexpected behavior out of java arrays in clojure
20:00pmapI thought that (aclone arr) would return a new array, and that changes to one array wouldn't affect the other
20:01pmapbut look at this
20:01pmap,(let [a (make-array Integer 2 2) b (aclone a)] (aset a 0 0 (int 2)) (aget b 0 0))
20:01clojurebot2
20:01pmapsetting a[0][0] = 2 causes b[0][0] == 2
20:02amalloypmap: it's not some kind of magic deep-clone: a and b are distinct pointers, but a[0] is still pointing at the same array as b[0]
20:02pmapok
20:02pmapso does that mean I have to clone the array myself?
20:03pmapoh, I see what you mean
20:03pmapit's cloning the rows
20:03pmapbut the colums still point to the same thing
20:04amalloyif you're really excited about using 2d arrays, and you want to clone them deeply, then i guess you have to, yeah. but the main reason to use arrays is for performance, and if you're cloning them you might as well just use vectors?
20:04pmapI'm only cloning it once
20:04pmapbut using the two arrays many times
20:04pmapat least thousands of times
20:05pmapso the performance loss of cloning should be outweighed by the performance gain of using arrays
20:05pmapbasically everything in my program works except for the fact that the arrays are interdependent
20:06pmapso I'm not changing that at this point
20:06arrdemamalloy: you're correct
20:06pmapand I'm not excited about using arrays :P
20:06arrdemamalloy: I forgot that the only valid operator has to be monad -> monad
20:06pmaparrays are awful
20:06amalloyarrdem: well, not monad->monad
20:06amalloya -> m b
20:06arrdemright.
20:07amalloyoh god, he's accepted your answer now
20:08arrdemamalloy: I got this
20:08amalloyhaha
20:09arrdemamalloy: dunno if he'll ever see the change tho
20:09amalloylooks like he has
20:09amalloyhigh five!
20:09arrdemyaaaay I fail at SO karma farming...
20:09amalloyarrdem: but you win at learning about monads
20:10arrdemamalloy: don't let bitemyduche hear about that
20:10arrdem~monads
20:10clojurebotmonads are the new gotos
20:10arrdemLIEZ
20:11pmaphmm
20:11pmapmaybe instead of creating an array and trying to clone that
20:12pmapI make a lazy sequence
20:12pmapand use to-array-2d
20:12pmaptwice
20:14hiredmanmaybe we gaze too long in to the abyss
20:20TimMcpmap: Perhaps amap could be useful?
20:20TimMcamap and System/arraycopy or whatever
20:20clojurebotI don't understand.
20:22gfredericks,(doc aclone)
20:22clojurebot"([array]); Returns a clone of the Java array. Works on arrays of known types."
20:22gfrederickswhat are arrays of unknown types?
20:24amalloygfredericks: that's quite poorly worded, isn't it
20:25gfredericksamalloy: I don't know what it's trying to mean.
20:25amalloy&(aclone (into-array ["a" "b"]))
20:25lazybot⇒ #<String[] [Ljava.lang.String;@1b82cb6>
20:25bitemyappclojurebot: forget monads are the new gotos
20:25clojurebotCool story bro.
20:25bitemyapp~monads
20:25clojurebotmonads are #<RuntimeException java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "=" at line 1, column 38.>
20:25amalloybitemyapp: you're just making it worse
20:25amalloythat is not the forget syntax
20:25gfredericksclojurebot: that is not the forget syntax
20:25clojurebotOk.
20:26bitemyapp~that
20:26clojurebotthat is not the forget syntax
20:26bitemyapp~forget monads
20:26clojurebotexcusez-moi
20:26amalloyis String[] a subtype of Object[] in java? i think it is, which is kinda awful
20:26gfredericks~this
20:26clojurebotthis is a better one i think: https://github.com/michaelklishin/neocons
20:26bitemyappamalloy: of course it is.
20:26bitemyapp~which
20:26clojurebotIt's greek to me.
20:26bitemyapp~greek
20:26amalloyof course?
20:26clojurebotGabh mo leithscéal?
20:26bitemyappamalloy: I am well acquainted with the awfulness of Java's type system.
20:26bitemyappso, "of course".
20:27gfredericksideally it's a subtype for reading and a supertype for writing?
20:27bitemyappthat's just policy-wonking an unforgivable horror. Don't even bother.
20:27amalloygfredericks: i think it's trying to mean "if the array you want to clone is type-hinted, we don't have to do reflection on it"?
20:28gfredericksbitemyapp: no idea what you're referring to
20:28amalloy"but only if it's hinted as primitive[] or Object[], not some other fancy nonsense?"
20:28amalloythat last bit doesn't really make sense, though
20:28amalloyespecially since afaict from reading the source it's not actually true
20:30gfredericksbitemyapp: I think core.typed treats references this way?
20:30gfredericksthey're parameterized twice even I think
20:33pmapwhat's a better way of doing (let [x (foo bar) y (foo bar)] ...) ?
20:33pmapin this case (foo bar) is making that array
20:34pmapI thought about doing something like (let [[x y] (repeat 2 (foo bar))] ...)
20:34pmapmaybe that's not best, though
20:34brehautodd
20:34brehautwrong window
20:34hyPiRionno "better way" really, although it's possible to do (let [[x y] (repeatedly #(foo bar))] ...
20:35pmapooh, I like that actually
20:35hyPiRionperhaps punch in a 2 there for good measure
20:37kristofIn core.async, does a go body have a return value?
20:37kristofno, it doesn't, because it's a macro...
20:37pmapusing repeatedly is about twice as slow
20:38pmapcompared to repeat
20:38kristofthese ported goroutines are magic, geez
20:38pmapwait
20:38pmapI'm doing it wrong
20:38pmaprepeat is making duplicates which point to the same thing
20:38pmapderp
20:39pmapguess repeatedly is the only way
20:40amalloykristof: doesn't (go ...) return some kind of channel?
20:42amalloyyeah. from the docstring of go: "Returns a channel which will receive the result of the body when completed"
20:43kristofamalloy: I don't think so, considering you can make lots of channels within a single go body
20:43kristof.....................wait, no you can't
20:43amalloyi mean...of course you can
20:44kristofthat would be an improper use of go
20:44kristofamalloy: But still, even if it returned a channel, the {c,g}oroutines you just created are certainly the primary "effect" of the go body
20:45amalloyso? you asked if it returned something, and then said it doesn't because it's a macro. the conclusion is false, and the reasoning makes no sense
20:45kristofI'm not making any sense, you're right
20:46amalloyabsolutely the routines you made are usually the primary purpose of a go block
20:46kristofLet's see what the macroexpand is of 'go'
20:46amalloyoh boy
20:47amalloyi mean, i encourage you to look, but don't expect you to understand any of it. i know i wouldn't
20:47kristofOh, that's right, it expands into a state machine
20:47kristofamalloy: it's only 12 lines :P
20:48kristofI'm sure the REAL beefy stuff is in 'ioc/state-machine' and in 'ioc/run-state-machine-wrapped'
20:50dabdi love emacs but this seems to be a nice project: https://github.com/cursiveclojure/cursive
20:50dabdif they can provide Paredit-style structural editing
20:51kristofwhat's wrong with lighttable?
20:52dabdkristof: you asking me»?
20:53Bronsaparedit should be easy to support thanks to https://github.com/laurentpetit/paredit.clj
20:53kristofdabd: Yeah.
20:53dabdkristof: i am not familiar with it
20:53kristofdabd: I mean it was more of a rhetorical question, because only the Cursive people can answer it.
20:53dabdare you using it for clojure?
20:54amalloyBronsa: it says right at the top of that page that he's moved it to https://github.com/laurentpetit/ccw/tree/master/paredit.clj
20:54kristofdabd: It was one of those super-hyped editors that was supposed to revolutionize the way we write code (and custom made for clojure, although it's entirely written in clojurescript now)
20:54Bronsaamalloy: yeah, I read that just after linking it
20:55kristofdabd: I actually use emacs for clojure but lighttable had some neat stuff, like being able to immediately display what functions were being called in what expression
20:55kristofdabd: Could use some work. But it's nice.
20:56dabdI like emacs but i wanted to have a nice debugger. Someone pointed me to ritz but it seems to be a bit hard to learn
20:56dabdand configure
20:58kristofpfft, debuggers
21:03kristofwooooooah baby that's cool
21:03kristofdabd: Not a debugger, but check this out: https://www.youtube.com/watch?v=d8-b6QEN-rk
21:03kristofdabd: Relevant blog post: http://www.chris-granger.com/2013/08/22/light-table-050/
21:04dabdthat's cool. the power of clojurescript
21:06kristofApparently they had a problem with threading and stuff that was blocking
21:06kristofI wonder how much of core.async they used? :P
21:29jarodzz:jarodzz haha
22:18arohneris there a core.async fn similar to clojure.core/take?
22:18arohneri.e. take upto N items off the chan, without blocking?
22:18arohner(or with blocking is fine too)
22:18arohnerI just want more than one
22:18arohnerI can reduce, but that seems like overkill
22:22blur3dI am trying to insert multiple records using [clojure.java.jdbc :as sql] into postgres, and am having trouble using a list of records/row with the insert function.
22:22blur3d(sql/insert! db-url :series {:low 1 :high 20} ;; works
22:22blur3d(sql/insert! db-url :series [:low :high] [1 10] [2 8] [3 9]) ;; works
22:22blur3dbut I am trying to insert using [[1 10] [2 8] [3 9]]
22:23blur3dthe docs have (defn insert! [db table & options])
22:24blur3dis there a way to explode the data into args... or somehow just use a list of rows to insert
22:25gunsarohner: (repeatedly n (<! chan))
22:25blur3dIn ruby you could do it with splat *list_of_args... but just not sure in clojure
22:26gunsblur3d: the corollary of arg splat is apply
22:27blur3dok, but apply takes two args, and splat just one
22:27ToBeReplaced(apply sql/insert! db-url :series [:low :high] coll)
22:28blur3dyeah, but isn't that going to perform an insert for each one... instead of batching
22:29ToBeReplacedblur3d: no - apply is equivalent to your second example above... apply is not map
22:30ToBeReplacedgl gotta run
22:30gunsblur3d: apply executes f with your args, spreading the last one
22:30blur3dok, ill give it a go. thanks
22:33blur3dawesome, works. cheers
22:59bitemyapparohner: what you want is something I called "draining" a channel. Let me know if the repeatedly thing works for your use-case.
23:30murtaza52Need help in deploying to clojars. I get the ReasonPhrase: Forbidden. error
23:30murtaza52I had deployed to clojars previously another lib and it was working. However I recently had to change my machine, and now I m not able to get it work.
23:30murtaza52Any help will be appreciated ...
23:35jph-is there any clojuresque way to cache results for a period of time
23:36jph-im using an API and i dont want to go over the limit, plus the results wont chance much in a few seconds
23:36jph-so i kind of want to cache results and only fetch again after x seconds
23:36jph-i was thinking of setting an atomic timestamp and checking that... wasn't sure if there was something more elegant available
23:37arrdemjph-: there's clojure.core.cache which provides a ttlcache :D
23:37jph-arrdem: lovely
23:37jph-i'll investigate
23:37jph-so helpful here
23:37jph-:D
23:38SegFaultAXcore.cache doesn't get enough love.
23:38SegFaultAXIt's an incredibly handy library
23:39SegFaultAXIt also happens to be pretty simple.
23:39jph-perfect
23:39arrdemw00t!
23:40jph-im wrote a (get-api-data <arg>) function, then did (+ (get-api-data <arg1>) (get-api-data <arg2>) and started worrying about hitting api limits
23:41jph-hence going down some sort of caching path
23:42murtaza52Need help in deploying to clojars. I get the ReasonPhrase: Forbidden. error
23:42blur3dhas anyone had this before when running leon reps :tree
23:42blur3dPossibly confusing dependencies found:
23:42blur3d[clj-time "0.6.0"]
23:42blur3d overrides
23:42blur3d[clj-time "0.6.0"]
23:43murtaza52I had deployed to clojars previously another lib and it was working. However I recently had to change my machine, and now I m not able to get it work.
23:43murtaza52Any way I can debug what is going wrong ..
23:43jph-(pst)
23:43SegFaultAXmurtaza52: Probably an auth problem.
23:43arrdemjph-: no need to whisper in here
23:44jph-it happened with me when my new machine didnt have config setup for the lib
23:44jph-arrdem: i mean (pst) stack trace
23:44SegFaultAXTHERE'S NO NEED TO YELL EITHER, ARRDEM!
23:44jph-in repl
23:44arrdem~gentlemen
23:44clojurebotYou can't fight in here. This is the war room.
23:44jph-heheh
23:44danenaniais there a better way to buildup nested hiccup elements than for and into? - [:thead (into [:tr] (for [i (range 7)] [:th (helper/days i)]))]
23:44arrdemSegFaultAX: ~paddlin
23:44arrdemdamnit clojurebot, you're supposed to back me up here
23:46murtaza52SegFaultAX: jph: http://pastebin.com/FGE9gftb
23:46arrdem~paste
23:47clojurebotpaste is not gist.github.com
23:47blur3dworked it out... was duplicated in my profiles.clj
23:47arrdem~pastebin
23:47clojurebotexcusez-moi
23:47arrdem(dec clojurebot)
23:47lazybot⇒ 32
23:48SegFaultAXmurtaza52: Probably you don't have the right pubkey registered.
23:48arrdemmurtaza52: if you changed computers that's extremely likely.
23:48murtaza52I had a different pubkey before, I generated a new one this time, and updated it in clojars
23:48SegFaultAXOrly?
23:49murtaza52orly?
23:49arrdem(or yarly barely)
23:49SegFaultAXmurtaza52: http://4.bp.blogspot.com/-9B5oDjm1wgM/T3gFww7jqlI/AAAAAAAABoY/c79rs-PrfPM/s1600/ORLY+Wallpapers.png
23:50murtaza52:)
23:50murtaza52I updated both the ssh and the pgp pub keys
23:50murtaza52sorry gpg
23:51SegFaultAXmurtaza52: Well damnit now I'm all confused. Get your g's and p's straight.
23:52arrdemHOOOOM. I see that we have avout for distributed atoms & refs, but is there a library for doing a multi-host (pmap)?
23:52murtaza52SegFaultAX: its the gpg pub key that I also updated …
23:53SegFaultAXmurtaza52: I was kidding. :)
23:53murtaza52:) I am frustrated …
23:53SegFaultAXmurtaza52: Anyway, I'm assuming the issue has to do with your key configuration being wrong. I don't know how it's wrong, but that's my guess.
23:53SegFaultAXMaybe you registered the wrong pubkey?
23:54murtaza52let me a generate a new one and try again
23:56technomancymurtaza52: if you are using `lein deploy` and getting Forbidden then its your password that's wrong, not your key
23:56murtaza52lein deploy clojars is what I am using
23:57murtaza52does that also indicate my password is wrong ?
23:59sm0keguys, can i not call a foo(Object... objs) method in java class , like this in clojure (foo ClassName. "aa" "bb") ?