#clojure log - Dec 04 2013

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

0:04 xeqi: the 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

0:05 technomancy: ~guards

0:05 clojurebot: SEIZE HIM!

0:05 dnolen: argh

0:06 jonasen: xeqi: isn't that a lie thou? If the namespace is compiled, the server var is defined.

0:07 so (run) doesn't actually do anything

0:08 hiredman: clojurescript is not clojure though

0:08 xeqi: jonasen: nope, (run) definitly starts and defines server ; https://www.refheap.com/21481

0:09 hiredman: vars make a difference in the semantics of defs inside of defs

0:09 jonasen: xeqi: ok

0:09 hiredman: oh, I assumed if it was in austin it was clojurescript

0:09 ugh

0:10 ~gourds

0:10 clojurebot: SQUEEZE HIM!

0:10 niceguy21: in the context of a framework, is an implicit dependency inside a macro okay?

0:10 i.e. (add-something arg)

0:10 hiredman: no

0:11 niceguy21: but pulling "this" out of the environment

0:11 (in effect, not passing in this explicitly ala (add-something this arg)

0:12 hiredman: xeqi: if only there had been a linter to warn chas not to do something so horrid

0:16 jonasen: hiredman: don't know if that was sarcasm. (It's sometimes hard to recognize sarcasm/irony on IRC)

0:17 hiredman: jonasen: I am often sarcastic and serious at the same time

0:17 technomancy: it is a useful skill

0:18 jonasen: hiredman: ok

0:28 technomancy: follow along at home with my insane nrepl hacking https://groups.google.com/forum/#!topic/cider-emacs/7p7yyv-Ocwc

0:28 dnolen: sans the OO stuff React really look like WebFUI, seems flexible to create our own abstraction over it - https://gist.github.com/swannodette/7782780

0:29 flexible enough

0:29 alandipert: dnolen: re: core.logic, is there a conjo or similar? in particular i'd like conso with a map

0:30 jarodzz: aaaa. i 'm sick of java. translating Character to char, Integer to int

0:30 alandipert: i enjoy k/v unification and featurec but i wish to also eat my cake :-)

0:30 jarodzz: Array to List

0:30 dnolen: alandipert: no such thing yet - kinda tricky if the key value pair isn't ground, but maybe that isn't a use case that matters?

0:31 alandipert: dnolen: nope, kv is ground

0:31 dnolen: alandipert: you could represent it as a delayed constraint a la featurec

0:31 so that unground case will work

0:31 jarodzz: how many of you guys have successfully transfer a java project to clojure?

0:33 dnolen: alandipert: a polymorphic constraint conjo would be welcome ...

0:33 when it's arguments become ground it could dispatch to -conjo protocol implementation of the first argument

0:34 would pave the way for core.logic being less list-centric

0:35 amalloy: andyf_: 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

0:36 if that's wrong i'm not sure i want to be right

0:36 dnolen: alandipert: actually now that I think about it, not necessary for -conjo, http://dev.clojure.org/jira/browse/LOGIC-147

0:38 bitemyapp: arrdem: I didn't

0:38 arrdem: somebody else might've or it might be bugged.

0:38 arrdem: reset it.

0:40 alandipert: dnolen: i'll noodle around, thanks

0:45 dnolen: alandipert: you caught me at the right time - https://github.com/clojure/core.logic/commit/c0f69ab5f43567c5a9f8932b187c51a42ed2a5da

0:45 alandipert: half baked version in master

0:45 for a fully baked version - if the first argument isn't ground but the last one is - should call -jonc on the output argument

0:45 then it's reversible

0:46 alandipert: dnolen: nice, thx!

0:48 jarodzz: wxqy: hi

1:00 hiredman: amalloy: alter-var-root

1:00 amalloy: yeah, i know that works too, but in such a limited scope i don't see that it makes a difference

1:12 guns: Hello, 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.

1:12 I also don't have a Hudson account. Could someone advise me?

1:15 andyf_: guns: I don't have an answer for you, and if no one else here does, I'd recommend asking in clojure-dev

1:15 guns: andyf_: Okay, thank you. I'll push to a branch and ask in the email

1:16 technomancy: guns: I'm pretty sure the contrib policy is that project.clj is non-canonical

1:16 guns: technomancy: I see; it sure convenient though

1:16 *is

1:16 andyf_: guns: Yes, technomancy is definitely right about that. No rule against having one, but Hudson does not use it for anything.

1:17 technomancy: yeah, a lot of those policies are really out dated from back before lein worked with http deploys or supported jenkins

1:17 dnolen: voila! core.logic can do reversible computation on vectors, maps, and list - more cases welcome - https://github.com/clojure/core.logic/commit/9f86dbab5c8edc41c22a7ecafcce3b5dfa58571f

1:18 sm0ke: i have started a server using 'lein repl :headless' and i can see the port in ~/.lein/repl-port

1:18 andyf_: I want reversible computation on futures

1:18 sm0ke: but when i do a 'grenchman lein' is says invalid task ''

1:19 doc mentions otherwise, am i doing it wrong

1:19 andyf_: I have no idea what that would mean -- just a flailing attempt at humor.

1:22 dnolen: nice to get a chance to use reduced

1:22 Raynes: guns: Do you have a brother named knives, by chance?

1:22 sm0ke: i can obviously alias 'grench repl :connect `cat ~/.lein/repl-port`' but that must be obvious in grenchman

1:23 Raynes: guns: http://trigun.wikia.com/wiki/Knives_Millions

1:23 guns: Raynes: lol. it is possible; the immigration office really butchers east asian names

1:27 {[^-^]}: how do I define some test data like with a def

1:27 but solely for the purpose of testing

1:30 also in joy of clojure, I see a :test key for the metadata of defn

1:30 but don't see that in the docs of clojure.test

1:40 SeanCorfield: {[^-^]}: technically the docs for the deftest macro do explain :test but it's probably not as clear as it could be

1:41 glosoli: Hmm 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 ?

1:45 SeanCorfield: glosoli: maybe post your code on refheap.com so we can take a look?

1:46 * Raynes gives SeanCorfield a hug.

1:46 Raynes: Supporting local business. Good man. <3

1:47 jarodzz: hi, guys. any one tried to use clojure generate a java class at run time?

1:47 glosoli: SeanCorfield: https://www.refheap.com/0fd9efb7c8c34f8c21c0859cb

1:47 nightfly: jarodzz: Kind of a cheeky answer, but isn't that how fns work?

1:50 jarodzz: nightfy: right, i'll search stackoverflow first. :)

1:50 sorry about that,man

1:50 glosoli: SeanCorfield: they are all in different namespaces though

1:53 {[^-^]}: SeanCorfield: Should I be using the :test metadata like they do in joy of clojure? For ex: https://www.refheap.com/21483

1:53 I'm trying to be as idiomatic as possible

1:53 bitemyapp: Raynes: make money from refheap? That explains all the coke.

1:53 Raynes: lolol

1:53 bitemyapp: Nah, I don't make a penny from refheap.

1:53 bitemyapp: obv.

1:54 Raynes: I'd have to jump out a window if I had to put ads in there.

1:54 It'd literally be worthless at that point.

1:56 bitemyapp: yeah I hate pastebin for a reason.

1:58 SeanCorfield: glosoli: 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?

1:59 {[^-^]}: it depends whether you want to keep your tests and your functions together, or not

1:59 glosoli: Hmm that would make sense, not sure how to check though

2:00 SeanCorfield: {[^-^]}: I think most people have their test code in a separate directory tree, per the skeleton that lein new creates

2:03 glosoli: old school: add println calls :)

2:03 glosoli: SeanCorfield: ah obvious, thanks

2:04 {[^-^]}: SeanCorfield: I think it would be better for my project to test every function where it is defined

2:04 the (fn [] (assert .. )) thing seems tedious though

2:04 why do I have to have (fn [] )

2:04 SeanCorfield: {[^-^]}: try both ways and see what works best for you...

2:05 {[^-^]}: 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)

2:05 glosoli: SeanCorfield: Hmm I don't even get println from alrer-var-root weird, must be doing smth wrong, thanks

2:06 {[^-^]}: SeanCorfield: I'll just use (with-test ) then, but how do I define some test data without it being compiled into production code?

2:09 SeanCorfield: {[^-^]}: define it inside a test function? or do you need it across multiple functions?

2:09 {[^-^]}: across multiple functions

2:10 SeanCorfield: one possibility is to put it in a function instead of plain def, then only call it from the test functions

2:10 that way it won't be evaluated in production

2:11 glosoli: SeanCorfield: Hmm just curious, not depending on order alter-var-root should still execute the println ?

2:11 {[^-^]}: so (defn [] {:test-data "whatever"})?

2:11 SeanCorfield: {[^-^]}: no, just a regular function

2:11 (defn test-data [] {:returns :some :test :data}) and then call that from the tests as needed

2:12 {[^-^]}: that's what I was saying

2:12 okay thanks

2:12 SeanCorfield: glosoli: how are you trying to get alter-var-root to "print" something?

2:13 i 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

2:16 glosoli: SeanCorfield: yeah alter-var-root is being executed later ;/

2:16 SeanCorfield: ding! :)

2:17 glosoli: SeanCorfield: thanks! :)

2:18 sm0ke: a survey says that programmers who are fascinated by new languages have 90% likelyhood of cheating on their partners. :|

2:19 SeanCorfield: heh, i'm always fascinated by new languages - always have been - but my wife of 14+ years won't believe that survey :)

2:20 sm0ke: hmmm

2:20 may be you are a good liar ;D

2:21 SeanCorfield: Rule #1 - never lie

2:21 noprompt: haha. what kinda shit is that?

2:21 (inc SeanCorfield)

2:21 lazybot: ⇒ 8

2:21 sm0ke: Rules #2 - that was a lie.

2:21 noprompt: SeanCorfield: that is the golden rule, my friend.

2:21 SeanCorfield: Rule #2 - and I quote - "If you make me choose between you and the cats, the cats will win!"

2:22 noprompt: (dec SeanCorfield)

2:22 lazybot: ⇒ 7

2:22 noprompt: sorry, i hate cats.

2:22 SeanCorfield: Those were the two rules she gave me 14 1/2 years ago on our first date...

2:22 noprompt: oh, nm

2:22 (inc SeanCorfield)

2:22 lazybot: ⇒ 8

2:22 noprompt: :P

2:22 SeanCorfield: noprompt: for years we bred and showed Bengal cats... and my wife is a cat show judge :)

2:23 * noprompt googles for "bengal cat"

2:23 sm0ke: 'Bengal' as in 'Bengal, India'

2:24 noprompt: SeanCorfield: damn. those loook really cool.

2:24 SeanCorfield: http://bangles.com is our cattery website (but it hasn't been updated in ages - because we stopped breeding a few years back)

2:24 noprompt: SeanCorfield: i couldn't tell what with the centered red text and all :P

2:24 SeanCorfield: They're cool pets... very smart, very active... we have child locks on all our cupboards (and we don't have kids)...

2:25 noprompt: SeanCorfield: are they dangerous?

2:25 SeanCorfield: why would they be?

2:25 they're regular kitties...

2:25 noprompt: i'm not sure. they look... wild?

2:25 how much does a cat like that go for?

2:25 SeanCorfield: they're supposed to look like miniature leopards

2:26 we used to sell pet kittens for $700-900

2:26 noprompt: that's reasonable.

2:26 yorkie's go for about that much. sometimes more.

2:26 sm0ke: hmm 700 for a cat!

2:27 Raynes: sm0ke: lol did you accuse SeanCorfield of being unfaithful? :P

2:27 SeanCorfield: but cat breeding is a very expensive hobby (as is dog breeding) unless you're not paying much attentions to the animals' health

2:27 noprompt: i'm gonna write a book called "HTML Anti-patterns" lol.

2:28 this codebase i inherited has mysterious html like <div></div>

2:28 sm0ke: cats have obsession with sleeping on laptops

2:28 SeanCorfield: cats want to be wherever your attention is :)

2:29 sm0ke: may be cats want to write clojure!

2:29 SeanCorfield: we 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

2:29 noprompt: what do you feed them?

2:30 SeanCorfield: a mix of wet food, dry food and raw meat... separately, not mixed together :)

2:30 but we have a couple on special diets due to age and/or medical conditions

2:31 sm0ke: wow you are like frkn catman

2:31 SeanCorfield: our 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)

2:31 bitemyapp: SeanCorfield: my god, $700 for a cat? Cats are so ambivalent to your existence though :(

2:32 sm0ke: bitemyapp: its a different kind of cat

2:32 SeanCorfield: bitemyapp: 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 :)

2:33 bitemyapp: SeanCorfield: 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.

2:33 I don't think I'd get another cat, I'd rather get a dog.

2:33 SeanCorfield: $700 isn't expensive for a pedigree pet (with a full health guarantee, temperement, and lifetime support from the breeder)

2:33 ^known temperament

2:34 sm0ke: if i get rich i would want a golden retirever

2:34 SeanCorfield: Our fur kids are crazy active... they jump on people's shoulders, they play in water...

2:34 bitemyapp: I'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.

2:34 SeanCorfield: We have a paddling pool indoors in the summer for them!

2:35 bitemyapp: that's pretty adorable, but they're still a cat and cats plot your demise constantly.

2:35 SeanCorfield: Different 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.

2:35 bitemyapp: yeah, we say that you come to a mutually agreeable set of behaviors when you have Bengals as pets :)

2:35 the cat trains you a bit and you train the cat a bit

2:36 Bengals 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...

2:37 sm0ke: whoa! pets are indeed costly!http://www.puppyfind.com/view_listing/?list_id=86l0x802rt&sid=45a7f10b57c7038a3e55c38c0ddb7968&back=%2Ffor_sale%2F%3Fbreed_id%3D57%26country%3D%26state%3D%26page%3D1%26order_by%3Dnew%26back%3D

2:37 2k for a puppy!

2:37 SeanCorfield: And 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!

2:37 bitemyapp: SeanCorfield: I know bengals are higher maintenance and more feisty, but what would interest me is a velcro cat with a dog's personality.

2:37 SeanCorfield: does such a breed exist?

2:38 SeanCorfield: Maybe a Selkirk Rex...

2:38 Curly coated cat. A friend in this area breeds them. In fact she just went off to Argentina to deliver two of them tonight.

2:38 bitemyapp: "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."

2:39 I didn't know persians were supposed to be cuddly, I definitely recall a family friend having an intensely anti-social persian.

2:39 SeanCorfield: That's down to poor socialization mostly.

2:39 bitemyapp: mayhaps, they were nice people and responsible pet owners.

2:39 SeanCorfield: Persians should be raised to be lap cats.

2:39 bitemyapp: SeanCorfield: do you have to socialize them before they get older?

2:39 yes, lap cat. That's what I would hypothetically want.

2:40 SeanCorfield: Yeah, 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 :)

2:40 Otherwise they will find their own "fun"...

2:41 bitemyapp: I knew a himalayan that was really anti-social too.

2:41 SeanCorfield: Bengals are definitely not lap cats... Shoulder cats, sometimes, top-of-door cats...

2:41 bitemyapp: SeanCorfield: that makes sense. That sounds like it would make adopting an adult cat tricky.

2:41 my mother and I got lucky with the aforementioned velcro cat. He was an orange tabby, the most cuddly, lazy cat on the planet.

2:42 got him as an adult. was totally chill on arrival.

2:42 I'd kill to get that cat back, but my mom gave him up for adoption after I left.

2:42 SeanCorfield: Depends 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 :)

2:43 We 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...

2:44 Anyways, 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 :)

2:45 bitemyapp: SeanCorfield: cheers, thanks for sharing your CAT FACTS

2:46 seangone: 'nite

3:02 glosoli: what wrong could happen when same ns is required twice ?

3:05 guns: glosoli: Nothing, unless there are side-effects at the top-level. Also, defonce might be problematic depending on what you're doing

3:06 glosoli: guns: 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

3:06 guns: glosoli: that sounds terrible!

3:07 glosoli: Yeah ;/

3:07 guns: beware:

3:07 "When you stare into the abyss, the abyss stares back into you"

3:12 abaranosky: glosoli: how did you determine that you *need* to do this?

3:13 glosoli: abaranosky: because I need the content altered before it's loaded in that other namespace

3:14 abaranosky: if the var's ns isn't loaded, then there's no var to alter-var-root on

3:15 glosoli: maybe I'm not getting what you're doing

3:15 glosoli: abaranosky: by loaded I mean, it's evaluated, and then later wrapped, since it's handler for ring

3:16 and if I alter after it has been wrapper

3:16 wrapped" there is no effect ;)

3:17 It'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

3:18 abaranosky: maybe more clear ?

3:18 guns: glosoli: it just so happens abaranosky and I discussed this with a user a couple of days ago

3:18 glosoli: https://github.com/technomancy/slamhound/issues/59

3:18 clojurebot: I don't understand.

3:18 guns: I think you should look into stuart sierra's reloaded workflow and components library

3:19 In OO languages we learn to package state in classes; we can do something similar, but more sophisticated in Clojure

3:20 but binding ring handlers to vars and such is going back to global variables

3:20 abaranosky: guns speaks the truth

3:20 guns: (inc abaranosky)

3:20 lazybot: ⇒ 1

3:21 beppu: http://bodil.org/more-than-functions/m/data-all-the-things.jpg

3:27 abaranosky: glosoli: do you have a code sample to show? It's hard to give a concrete solution without something tangible

3:27 glosoli: sec

3:27 abaranosky: ... bu the alter-var-root talk sets off my inner alarm bells

3:30 glosoli: https://www.refheap.com/21484

3:32 clgv: glosoli: you need to use ":require" instead of "require" in an ns-statement

3:32 amalloy: clgv: you don't, actually

3:32 glosoli: yeah this is just example

3:32 amalloy: it's purely convention; either one works

3:33 clgv: amalloy: are you sure. I remember some weird effects when mixing that up in the past

3:33 amalloy: glosoli: single-segment namespaces are the devil: you want my-app.dev-only or something

3:33 clgv: although "past" ranges back to 1.2.1 ;)

3:33 glosoli: amalloy: this is just for presentation purposes of my problem

3:35 abaranosky: the routes ns is your issue imo

3:35 glosoli: the way that app route loads too much

3:35 or the way we are handling dev mode

3:35 by altering stuff.. and having it in separate namespace

3:36 abaranosky: I can't quite tell: is the routes ns creating a top-level fvar?

3:37 that code just looks super weird to me

3:37 instead 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

3:38 glosoli: ^^^

3:41 glosoli: something like this pseudo code: https://www.refheap.com/21485

3:44 glosoli: abaranosky: ah sorry for late response, thanks for an advice, looks better

3:51 magnars: glosoli: 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.

3:52 glosoli: magnars: yeah but since we are not doing bundles or versioning

3:52 that does not seem like in need at least until then

3:52 magnars: you're just doing minification?

3:53 glosoli: magnars: yeah for now, later they might get added, waiting for orders from the upper folks :)

3:53 magnars: There isn't really any lein plugin which wouldn't be overkill for what I need, optimus just seemed the most optimal solution )

3:54 and it would help with versioning later

3:54 magnars: glad to hear that :)

3:54 but why not just serve the assets through optimus in dev too?

3:55 glosoli: magnars: dunno, it will require some additional conf which isn't how this app works now

3:55 logic_prog: is there a way to reload a *.cljs file

3:55 in a running browser?

3:56 I don't want to hit the refresh on the browser. I want it to reload my *.cljs file

3:56 glosoli: magnars: whole dev is weirdly separated in namepsace...

3:56 magnars: ah, I see. Yeah, that does sound weird.

3:56 glosoli: magnars: well that's our first project with clojure, just learning heh

3:58 magnars: Not 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.

4:00 glosoli: magnars: i need quick fix

4:00 magnars: could you add linux i386 archetype ?

4:00 clojurebot: It's greek to me.

4:00 glosoli: to v8.clj

4:01 magnars: Exception in thread "main" java.lang.Exception: Unsupported OS/archetype: Linux i386, compiling:(v8.clj:32:1)

4:01 magnars: That's a case for https://github.com/circleci/clj-v8 I'm afraid

4:02 glosoli: Damn lol, I pushed the changes to repo and tests started screaming ;/

4:02 magnars: last change for clj-v8 was like year ago, isn't it dead ?

4:02 magnars: Maybe it will run with the pre-built 32 bit x86 binaries

4:03 Let's try it, give me a sec.

4:06 glosoli: ok, 0.12.4 is on clojars which will try to use clj-v8-native's prebuilt x86 32 bit binaries.

4:07 borkdude: what noise cancellation headphones might be best for programmers?

4:07 not only bass sounds, but also typing sounds preferably

4:08 glosoli: magnars: so I should update my project clj to optimus 0.12.4 to try the new changes ?

4:09 magnars: glosoli: yes. Might be a shot in the dark, but worth trying. Which version are you on now?

4:09 glosoli: magnars: 0.12.3

4:09 magnars: excellent

4:11 glosoli: magnars: 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 ?

4:13 magnars: yeah, 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.

4:13 glosoli: magnars: so how come 0.12.4 could help with that, since it will report wrong archetype anyway ?

4:14 magnars: glosoli: I set up Linux i386 to use the precompiled x86 32 bit binaries, in the hopes that they will work.

4:15 glosoli: magnars: yeah, works now just fine

4:16 magnars: great! :)

4:16 glosoli: magnars: Thanks! :)

4:16 magnars: Hah, no worries. Thanks for your patience. :)

4:17 glosoli: magnars: 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)

4:18 magnars: Yeah, Linux x86_64 is what we're using - and why you crashed into a missing archetype on a 32 bit Linux.

4:18 jph-: 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?

4:18 or do i have to quit repl and lein repl again?

4:19 guns: jph-: (require 'my-library.core :reload)

4:19 glosoli: magnars: ok thanks again

4:20 jph-: guns - perfect

4:20 guns: the shutdown/startup was getting on my nerves

4:20 i figured there was a better way :)

4:21 guns: jph-: If you're using an nREPL plugin, that's probably already bound to a key sequence

4:21 jph-: im just doing from cmd line atm

4:21 guns: oh ok. gl

4:21 jph-: but i have sublime repl as well which i havent played with yet

4:22 guns: jph-: If you ever want to wipe all your namespaces and reload from scratch, look at https://github.com/clojure/tools.namespace

4:23 jph-: cheers

4:24 im still new to all this

4:24 i've dived in before fully reading through the two books i have

4:25 guns: so reload should work fine if im just modifying a function

4:26 guns: jph-: yes, it will work fine. also, you should avoid doing anything beside defining things in a namespace

4:26 jph-: k

4:45 clgv: jph-: (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

4:45 jph-: k

4:45 another stupid question

4:45 in my core.clj

4:45 i have at the top [clojure.tools.namespace.repl :only (refresh)]

4:45 yet in repl it doesn't know about (refresh)

4:47 clgv: jph-: you mean (use '[clojure.tools.namespace.repl :only (refresh)])?

4:47 or (:use [clojure.tools.namespace.repl :only (refresh)]) in the ns

4:47 jph-: in the ns

4:47 clgv: jph-: the ":only" part applies only within the namespace

4:47 jph-: oh

4:47 so i have to my-library/refresh ?

4:48 clgv: no. if you want to use it in another namespace you have to do the same there.

4:48 jph-: is that how it works? *winces*

4:48 in repl... what is the right was to use it so (refresh) would work?

4:49 or rather... the way im using repl is i fire it up with lein repl, then (use `my-library.core)

4:49 and im probably wrongly assuming all the stuff i have in my-library.core ns is getting setup

4:49 so if i have that use in my ns in core.clj, it's accessible in repl... but it isnt

4:50 im just not grokking the interactions yet

4:53 clgv: it is set up. but you are in a different namespace, which is "user"

4:53 you can check via "*ns*"

4:53 jph-: in repl?

4:53 clgv: yes

4:53 jph-: ohhhhhh

4:53 so how do i get to (refresh) then

4:54 so (refresh) would work within core.clj, but that doesnt translate to repl autoagically due to diff namespaces

4:54 clgv: when you want to develop within my-lib.core you should require it and then (in-ns 'my-lib.core)

4:54 jph-: so i presume instead of putting tools.namespace in my core.clj, i can put it in some repl startup config?

4:54 in-ns?

4:55 is that to switch namespaces?

4:55 clgv: yes

4:55 jph-: ooh

4:55 ok

4:55 clgv: usually the IDEs have shortcuts therefore

4:55 jph-: but ... when i (use `my-lib.core)

4:55 i can call the functions in my-lib.core

4:55 how does that work

4:56 oh wait

4:56 clgv: then it is different. you import (refer) all public vars

4:56 jph-: penny drops

4:56 im explicitly useing from repl

4:56 got it

4:56 thank you clgv for explaining that

4:57 clgv: jph_: do you have one of the clojure books?

4:57 jph-: ^^

4:58 jph-: i have several

4:58 but i've dived into coding ahead of properly sitting down and reading through them

4:58 heh

4:58 impatient

5:00 pyrhho: core.async question. I'm trying to implement (defn promise->chan [prom

5:00 erm.

5:01 (defn promise->chan [prom] …)

5:01 that takes a promise and returns a chan that receives the value when the promise is realized...

5:01 but 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..

5:01 any advice?

5:02 Or any particular direction I should look in?

5:02 amalloy: does cljs have promises? i don't immediately see them

5:04 pyrhho: it's in java, not cljs

5:04 amalloy: on clj-jvm, if promises implemented IRef (which includes add-watch), you could use add-watch

5:04 but they don't, so...it doesn't look like you can really do that

5:04 pyrhho: ah! forgot about add-watch. will check

5:05 they do implement IDeref. is that close enough?

5:06 or since IRef extends IDeref, could I extend the promise to implement IRef?

5:06 amalloy: not at all

5:07 pyrhho: damn

5:07 amalloy: the best you can do is use a timeout channel to periodically poll it and see if it's been realized, i suspect

5:07 or do something blocking that eats up a thread

5:07 pyrhho: oof

5:08 alright, well thanks

5:17 sm0ke: holy shit! logging is a mess already and clojure has timbre with its own format, really?!

5:18 hmm someone needs to kill Ceki Gülcü

5:41 glosoli: any ideas for some nice way some elements near the end of </body> tag

5:41 s/way some/way to move

5:53 ucb: is 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

6:05 amalloy: ucb: ByteBuffer is an interface

6:05 ucb: amalloy: very good point; I just realised that :)

6:05 as in, I actually read the docs

6:15 rstandy: hello clojure community

6:15 web dev question

6:16 what people use to make websites?

6:16 is caribou a good framework?

6:18 does someone uses caribou?

6:21 what people use for web development?

6:22 john2x: luminusweb.net

6:22 jph-: is there a shortcut way to uppercase a keyword from :abc to :ABC

6:22 rstandy: i was looking at caribou, it looks very good, but perhaps a little too "magic" for firsttimer

6:23 ie, when you wander off the beaten track you might be stuck if you're new to clojure webdev

6:23 that's just my guess

6:27 clgv: jph-: no. but it is not too long

6:27 &(require ['clojure.string :as str])

6:27 lazybot: java.lang.ClassCastException: clojure.core$str cannot be cast to clojure.lang.Symbol

6:27 clgv: &(require '[clojure.string :as str])

6:27 lazybot: ⇒ nil

6:28 jph-: thx

6:28 clgv: &(-> :abc name str/upper-case keyword)

6:28 lazybot: ⇒ :ABC

6:28 clgv: or maybe clojure.string counts as shortcut ;)

6:28 jph-: hehe

6:29 oh yeh

6:29 rstandy: jph-: thanks for your opinion :-)

6:29 jph-: what does &(-> mean?

6:29 i've seen that in a few places

6:29 clgv: the "&" is for lazybot to tell it to execute the form

6:30 jph-: rstandy: there's a full book on webdev with clojure that seems fairly framework agnostic, have you seen that?

6:30 also on my kindle to read list

6:30 clgv: "->" is threading. the code above is equal to (keyword (str/upper-case (name :abc)))

6:30 jph-: ahh

6:31 clgv: see: ##(macroexpand-1 '(-> :abc name str/upper-case keyword))

6:31 lazybot: ⇒ (clojure.core/-> (clojure.core/-> :abc name) str/upper-case keyword)

6:31 clgv: oh right only one step^^

6:32 &(macroexpand-1 '(-> :abc name))

6:32 lazybot: ⇒ (name :abc)

7:05 sm0ke: in a gen-clas :method key how do i define a funtion with signature (String msg, Object... objects);

7:12 clgv: sm0ke: that might be a limitation of gen-class

7:12 sm0ke: shit man!

7:12 i am stuck

7:12 clgv: sm0ke: http://stackoverflow.com/questions/8951449/clojure-gen-class-varargs-constructor

7:12 sm0ke: also i have one more problem

7:12 clgv: but I am not sure that this does the trick completely

7:13 sm0ke: what if i want to define two function with same name and different types?

7:13 clgv: afaik varargs are in fact syntactic sugar

7:13 sm0ke: i get java.lang.RuntimeException: Can't have 2 overloads with same arity

7:13 although i have typehints

7:13 clgv: sm0ke: well in clojure you can only dispatch on arity in methods

7:13 sm0ke: :(

7:14 clgv: I am not sure whether deftypes can implement same arg count different type method implementations

7:15 it would only be an option if you do not necessarily need gen-class...

7:15 sm0ke: hmm it just clicked me!

7:15 what if i just define one method and check if its instance of a particular type?

7:15 would that work?

7:15 clgv: sure

7:16 sm0ke: :D

7:16 clgv: you could also pass to a multimethod which dispatches on all arg types

7:16 sm0ke: i hope that trick you mentioned for varargs works out too

7:16 clgv: thanks

7:17 clgv: sm0ke: you'd have to try the varargs trick from the java side to see whether it works

7:17 sm0ke: https://groups.google.com/forum/#!msg/clojure/HMpMavh0WxA/fenl_hSxNkAJ

7:17 sm0ke: clgv: hmm actually it should work ...varargs indeed are just array right

7:18 only if clojure had a better syntax for array-types

7:19 clgv: does using typed clojure let me define two functions?

7:19 with same name and arity?

7:19 clgv: nope. it is only for type checking

7:19 it does not change clojure itself

7:20 sm0ke: hmm what a bummer

7:20 clgv: but 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

7:21 sm0ke: can you write a java facade and just write the actual implemenation in clojure?

7:21 sm0ke: clgv: isnt calling clojure from java even more hairy?

7:22 clgv: sm0ke: I thought you needed that interop scenario! otherwise, why would want vararg support and multiple same arity implementations?

7:22 clojure functions provide varargs the clojure way...

7:23 sm0ke: ok 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

7:24 so the only problem is i am using clojure libraries in the rewrite

7:24 ultimately java needs to call clojure functions is my point

7:30 hmm i am not sure

7:30 is having java classes calling clojure the easier route?

7:31 TEttinger: sm0ke, I did it once, but you need to be careful about type hints everywhere

7:32 it was a while ago

7:32 sm0ke: does a clojure function (defn foo [msg & objects]) would translate to (String msg, Object... objects);

7:32 TEttinger: some stuff may have changed

7:32 no.

7:32 sm0ke: NO?

7:32 hmm ok

7:32 TEttinger: (defn foo [msg & objects]) would translate to (Object msg, Object... objects);

7:33 sm0ke: funny

7:33 yes you just scared the hell out of me

7:33 TEttinger: (defn foo [^String msg & objects]) would translate to (String msg, Object... objects);

7:33 sm0ke: naaice, i would take that deal than

7:33 TEttinger: but in a single-method class

7:33 in a class that is the ns name

7:33 it is hairy

7:34 sm0ke: TEttinger: you mean it would be a static method right?

7:34 TEttinger: no.

7:34 I believe clojre fns compile to classes

7:34 sm0ke: er

7:34 TEttinger: with one static method

7:34 glosoli: how 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

7:35 sm0ke: yess yess but for two function in namespace named foo.bar , can i not call them like foo.bar.f1() foo.bar.f2()?

7:35 from java

7:35 TEttinger: they do get included, but basically don't return fns if you want java to use tghem, is what I gathered

7:35 yes

7:35 you can probably do that

7:35 sm0ke: so whats hairy about that

7:35 thats probably very clean

7:35 TEttinger: (doc partial)

7:35 clojurebot: "([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."

7:35 TEttinger: if you return anything like that

7:36 you can't easily use it

7:36 you can use it, but it is hairy because java expects methods to be a certain way

7:36 not clojuresque

7:36 I'm pretty sleepy, maybe I shouldn

7:37 't be talking

7:37 sm0ke: ok thanks for scaring the shit out of me

7:37 so much for interop

7:38 TEttinger: it's totally possible, but clojure calls java easier than java calls clojure

7:39 sm0ke: hmm ok

7:40 let me try that ugly "[Ljava.lang.Object;" trick first

7:40 TEttinger: don't forget! ^"[[Z" for a 2D array of bools!

8:10 clgv: sm0ke: (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

8:17 sm0ke: clgv: thanks will keep in mind

8:17 g2g

8:20 clgv: sm0ke: 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

8:20 then you know for sure

8:39 teslanick: Are there any guides for using non-closure libraries with clojurescript?

8:52 glosoli: https://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

9:33 marianoguerra: hi! 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?

9:33 is there another way to do that?

9:33 dnolen: teslanick: I've learned a ton from this article, still do - http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html

9:35 teslanick: dnolen: Thanks! My google-fu is weak this morning

9:37 devn: teslanick: Luke and Stuart Sierra wrote a Clojurescript book

9:38 teslanick: 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

9:48 stuartsierra: There's a chapter in the book based on that article. :)

9:51 marianoguerra: Futures start running in another thread as soon as you call `future`

9:51 If you don't deref it, the only down side is that you won't know if it threw an exception.

9:52 dsrx: is there a rule that clojure librarys can't be puns anymore?

9:52 libraries*

9:53 lol Sorry, names such as clojure or *jure are not allowed.

9:54 stuartsierra: dsrx: That's mostly a joke.

9:55 llasram: Except in Norway, where it is in fact illegal

9:56 teslanick: Scandinavian nanny governments, man, whatchagunnado?

10:00 marianoguerra: stuartsierra: thanks!

10:00 stuartsierra: marianoguerra: You're welcome.

10:08 itruslove: teslanick: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html gives a decent overview and is cited all over the place

10:16 whilo: is pedestal planned to become compatible with core.async?

10:16 TimMc: dsrx: Not disallowed so much as... annoying. :-P

10:16 justin_smith: whilo: is it somehow incompatible? that seems odd

10:17 whilo: justin_smith: last time i tried, i couldn't build with both dependencies

10:17 justin_smith: oh, I see

10:17 stuartsierra: whilo: The next version of pedestal will use core.async for both server- and client-side.

10:17 whilo: awesome

10:17 justin_smith: did you try using :exclusions to make their dependencies work together?

10:17 whilo: i hoped that :-D

10:17 stuartsierra: 0.3?

10:17 stuartsierra: I think so, yes.

10:19 justin_smith: If 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:20 alternatively I could add an extra argument to just about every function in the codebase, or go back to using globals

10:22 nDuff: justin_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:23 justin_smith: I have a database config, and some config for app behavior

10:23 I also have a multi-threaded web server

10:24 I 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:24 but 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:24 nDuff: ...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:25 justin_smith: right

10:25 but the var is declared in a librarie's namespace, and the end user has to set the value

10:25 so I would alter-var-root on the object in the library?

10:26 nDuff: it's not the prettiest thing, but without knowing more details, it's probably the safest.

10:26 justin_smith: and then use binding to make rebindings on a thread-local basis

10:26 nDuff: right.

10:26 justin_smith: OK, thanks

10:26 it acts like it works, I have just heard so many warnings about dynamic bindings I want to be extra sure

10:26 so I will throw alter-var-root into the mix

10:45 gfredericks: in 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:48 would also be easy given a (defn ch->seq [ch] (->> (repeatedly #(async/<!! ch)) (take-while (complement nil?)))

10:48 justin_smith: gfredericks: (go (while (when-let [input (<! channel)] ...))) ?

10:49 makes me think there should be a while-let

10:49 gfredericks: that's a weird way to do it

10:49 justin_smith: yeah it is weird

10:49 but it has the right semantics

10:49 gfredericks: relies on the when-let returning truthy, which is sketchy for side effects

10:49 justin_smith: well you can put a true at the end of the when-let block

10:49 gfredericks: yep

10:50 justin_smith: it is guaranteed to return falsy if the first cond is falsy

10:50 gfredericks: so anyhow yes this is doable a variety of ways, I'm just wondering if there's some idiomatic way to do it

10:50 using reduce for side effects feels weird, and it's hard to believe this use case isn't common enough to have something for

10:50 justin_smith: iterate?

10:52 gfredericks: I don't think that makes sense?

10:52 iterate is a pure-functional thing

10:52 each item based on the previous one

10:53 justin_smith: (go (take-while identity (iterate (fn [input] ... (<! channel)) (<! channel))))

10:53 still clumsy I guess

10:53 at that point I guess you may as well be using loop

10:58 stuartsierra: ,(= (byte-array (map byte [1 2 3])) (byte-array (map byte [1 2 3])))

10:58 clojurebot: false

10:58 stuartsierra: That's odd.

10:58 justin_smith: because they are mutable maybe?

10:58 stuartsierra: I suppose so.

10:59 justin_smith: ,(map = (byte-array (map byte [1 2 3])) (byte-array (map byte [1 2 3])))

10:59 clojurebot: (true true true)

10:59 justin_smith: of course

10:59 stuartsierra: Also, if you get a seq over both arrays, those seqs compare =

10:59 hyPiRion: use Arrays/equals for shallow array comparison

11:00 justin_smith: which 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:00 http://programmers.stackexchange.com/questions/220146/why-the-scala-fascination-with-flatmap-this-doesnt-seem-to-be-the-same-for-ma/220150#220150

11:00 TimMc: Someone is wrong on the internet!

11:00 justin_smith: heh

11:00 hyPiRion: ,(do (import 'java.util.Arrays) (Arrays/equals (byte-array (map byte [1 2 3])) (byte-array (map byte [1 2 3]))))

11:00 clojurebot: true

11:00 justin_smith: TimMc: wrong about something I love!

11:02 TimMc: justin_smith: I actually don't see the problem.

11:02 justin_smith: "mapcat isn't part of a protocol, so can't be made to work on other types"

11:02 mapcat calls map and concat, both call seq, seq operates on a protocol

11:02 implement ISeq and mapcat works on your thing

11:03 hyPiRion: yeah, but then you've just made the object a collection though

11:03 stuartsierra: It's true that Clojure's core abstractions are not typically "monadic" in the same way that Scala's are.

11:03 TimMc: OK, but I don't see the disparaging part.

11:06 justin_smith: maybe I was misreading something...

11:07 probably better I didn't have permission to comment

11:08 hyPiRion: well, it is possible to make own collections and use them though

11:08 so 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:09 justin_smith: look at how, for example, you can get a seq from a string or a hashmap or a record made with defrecord

11:09 the clojure idiom is to turn everything into a collection

11:09 so the dude kind of misses a point there I think

11:09 bbloom: now 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:10 sure, the do synax in haskell & the for syntax in scala are based on that type class interface

11:10 justin_smith: we use monads too, it's just that we prefer the sequence monad and stick to that one

11:10 (mostly)

11:10 bbloom: but all the higher level monadic stuff that most people in clojure actually use like lift, etc are an artifact of the type system

11:10 justin_smith: right

11:11 brainproxy: all 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:11 justin_smith: or 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:11 bbloom: http://lambda-the-ultimate.org/node/4786

11:11 brainproxy: you actually get some flexibility there, because "in the monad" basically boils down to implementing an interface/protocol

11:11 bbloom: i'll keep pitching that idea :-)

11:12 brainproxy: and do syntax is not necessarily an artifact of a type system

11:12 it's just more sugar for monadic plumbing

11:12 bbloom: no, the do syntax is the primary consumer of the monadic interface

11:12 brainproxy: so you don't have to write bind..bind...bind... manually

11:13 bbloom: it's THE use case that justifies bothering to reify the protocol

11:13 brainproxy: anything you can do with monadic do you can do with monadic bind and functions

11:13 it's just more verbose

11:13 bbloom: of course

11:13 brainproxy: i mean doing it by hand with bind is verbose

11:13 bbloom: we also have the do syntax already, it's just not built in terms of a protocol

11:14 we call it clojure.core/for

11:14 :-P

11:14 brainproxy: i don't think that really holds true for all monads

11:14 justin_smith: apropos, 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:14 brainproxy: e.g. I don't think "for" directly corresponds to "do" with the state monad

11:14 justin_smith: but a dynamic var is easier to work with, if I can get it to be correct

11:14 bbloom: brainproxy: sure it does. it's just like scala's map & flatMap

11:15 brainproxy: it has some *extra* list-monad stuff, like :when and :let

11:15 brainproxy: 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:16 brainproxy: bbloom: 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:16 and I mean that sincerely, not being a doubter or insincere

11:17 coffee needs to kick in

11:17 bbloom: brainproxy: i don't know the interface, so i'm just looking at jim duey's blog post and i see this:

11:17 (def state-mv (m/do [x (m/state 9) y (m/state 2)] (+ x y)))

11:17 clearly that m/do form has the same underlying structure as c.c/for

11:19 brainproxy: well there is a superficial similarity, but I'm not sure that the plumbing for State can be realized with for

11:20 maybe it can, that would be pretty cool

11:20 bbloom: not the build in for it can't

11:21 http://www.scala-lang.org/api/current/#scala.collection.generic.FilterMonadic

11:21 http://www.scala-lang.org/old/node/111

11:21 notice the "if" part of the comprehension

11:21 that's like clojure's :when

11:22 brainproxy: sure, but those are comprehensions and pertain to the List (aka Sequence) monad

11:22 which has entirely different plumbing from, say, State

11:22 or Writer

11:22 Borkdude: hmm, something very stranged happened to my nick earlier today, because of a typo... sorry for that

11:23 bbloom: brainproxy: in scala, if you implement the FilterMonadic trait, then you can participate in for comprehensions

11:23 brainproxy: 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:23 brainproxy: there is no reason clojure couldn't do that

11:23 other than it being generally not that useful

11:24 brainproxy: I don't get it, I still see apples and oranges, but you may be correct

11:25 but, if you do a macroexpand-1 of a monadic/do using protocol monads and example from jim's page

11:25 maybe you will see what I mean about plumbing being different, when you look at impl for bind and invoke

11:42 bbloom: 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:42 it's a similar thing with -> and ->> of course, but more robust

11:43 bbloom: brainproxy: i prefer to implement interpreter-like machines

11:43 brainproxy: that's what I'm using it for in a big project at the moment

11:43 bbloom: brainproxy: rather than bringing the state to your functions, bring your functions to your state

11:43 brainproxy: I've worked up a varient of the monadic/do macro that lets me use go-block symbols as well

11:44 and the steps will get appropriately wrapped in go

11:44 so you get the "magic" effect of parking the computation somewhere deep in some branched/nested step

11:45 seangrove: brainproxy: Sounds very cool indeed.

11:45 brainproxy: pass in one or more external queues via "the world" (i.e. the state) and suddenly you're building a custom event loop

11:45 of course you could do that with go-loop as well

11:46 but 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:47 jim's monadic/do doesn't provide a mechanism for recursion to be expressed cleanly within a do block

11:47 I worked one out though

11:48 and it's backed by a trampoline, so doesn't blow the stack

11:48 edolouglin: Does 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:49 brainproxy: edolouglin: check the prelude package perhaps?

11:49 edolouglin: brainproxy: ok. Will do. Thanks

11:49 brainproxy: https://github.com/bbatsov/prelude

11:49 edolouglin: ^

11:49 anyway, whatever bindings come standard prelude are working well for me

11:49 I haven't done any personalizing of the smartparens config

11:51 upwardindex: Anyone knows if there is a way to get some kind of list of all my compojure handlers?

11:52 edolouglin: brainproxy: 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:52 brainproxy: edolouglin: dpm

11:52 whoops

11:53 edolouglin: ignore the naysayers, prelude is awesome

11:53 edolouglin: I'll give it a look...

11:53 seangrove: edolouglin: I think the creator of that repo's own words summarize the 'better defaults' best: http://p.hagelb.org/lies.gif

11:53 brainproxy: give 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:53 upwardindex: prelude is pretty nice indeed, the only thing I miss is the M-1 ( from paredit

11:54 brainproxy: better yet, fork prelude, then you can keep up with the bug fixes, new features, etc.

11:54 while at the same time having a git-backed store of your stuff in .emacs.d/personal

11:56 foolano: what'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:56 ordnungswidrig1: foolano: use partition and map

11:56 foolano: ordnungswidrig1: thx

11:57 brainproxy: upwardindex: been awhile since paredit, remind me what that keysequence accomplished?

11:58 upwardindex: brainproxy: Wrap the next "1" sexp in parens, M-3 ( to wrap the next 3 sexps

11:58 etc

11:58 brainproxy: ah right

11:58 Bronsa: uuuh that's handy

11:59 (inc upwardindex)

11:59 lazybot: ⇒ 1

11:59 brainproxy: upwardindex: there's probably a smartparens command for that, but not sure

12:00 upwardindex: brainproxy: indeed, I'll try #emacs

12:01 brainproxy: upwardindex: M-( acts like M-1 ( in my setup

12:02 * gfredericks had no idea about M-1 (

12:02 gfredericks: I think my life has been forever changed

12:02 upwardindex: brainproxy: oh nice, M-5 M-( does it!

12:02 brainproxy: upwardindex: for me its C-# M-(

12:03 where # is 1,2,3...

12:03 upwardindex: brainproxy: both work here

12:03 brainproxy: my favorite is C-M-@

12:04 upwardindex: huh?

12:04 brainproxy: put on an opening paren of some large s-expr to highlight the whole thing at once

12:04 i mean move to an opening paren of some large s-expr

12:04 and then C-M-shift-2

12:05 upwardindex: brainproxy: is that for visual reference?

12:05 brainproxy: nice for following up with C-w, or M-w or M-;

12:05 upwardindex: I usually just C-M-k

12:05 brainproxy: sure

12:06 upwardindex: brainproxy: ah for commenting it is nice indeed

12:06 brainproxy: :)

12:06 upwardindex: what is uncomment?

12:07 m0g: I'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:07 any idea why ?

12:08 the 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:12 gfredericks: m0g: is it possible that test is nil?

12:12 java 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:12 m0g: gfredericks: it should not be at least. In Java it isn't and I am using the same file

12:13 hiredman: m0g: 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:13 gfredericks: yeah I guess load-instances would have thrown an NPE

12:13 hiredman's observation sounds correct

12:13 you'd need to give an empty array

12:13 hiredman: which in clojure, for no args, means you need to pass an empty array or nil depending

12:13 m0g: oh

12:15 sm0ke: is it possible to set the logger name in tools.logging

12:15 can i cahange it some other than the current namespace?

12:17 gfredericks: sm0ke: I think one of the arities lets you pass an ns

12:17 brainproxy: upwardindex: re-highlight and M-; usually works for me

12:18 sm0ke: gfredericks: i dont see any such thing in the debug info etc conterparts

12:18 upwardindex: brainproxy: hahahha I was trying all kinds of stuff C-u M-; C-M-; etc but had not tried the simplest :)

12:19 sm0ke: its just fmt & fmt-args

12:19 or throwable fmt & args

12:20 m0g: hiredman: Adding (into-array Object []) as last argument indeed fixed it. Thanks a ton, this was driving me nuts <3

12:22 sm0ke: wow tools.logging looks pretty ancient

12:22 dnolen: hrm, I wonder how hard it would be to make a cljs.core/defmacro in CLJS so we get sensible symbol resolution?

12:22 sm0ke: even before lein was born i guess

12:23 gfredericks: sm0ke: I guess the best you can do is the log* function which takes a logger as the first arg

12:25 sm0ke: gfredericks: :( hard work!! i would have to rewrite/copy all the macros!!

12:25 gfredericks: can i overrite the settings which picks default ns?

12:26 gfredericks: you could monkey-patch impl/get-logger I suppose?

12:26 sm0ke: i couldnt figure out how tool.logging get the current namesapce

12:26 gfredericks: I was just examining (source clojure.tools.logging/logp)

12:26 dabd: could anyone please recommend a debugger for clojure with the ability to step through forms?

12:26 using emacs+nrepl atm

12:27 ToBeReplaced: sm0ke: what is your issue? the macros all accept a logger ns i thought?

12:28 devn: Anyone here do clojure on Android?

12:28 For fun or for profit?

12:28 What's the current state of that whole thing?

12:28 nDuff: devn: Slow.

12:28 devn: How slow?

12:28 nDuff: devn: 3-5 seconds at startup.

12:28 sm0ke: ToBeReplaced: no they do not, at least according to my limited knowledge of reading clojure source

12:28 devn: nDuff: responsive once it's running, oui ou non?

12:28 nDuff: devn: AIUI, reasonably so.

12:29 coventry: dabd: 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:29 nDuff: devn: ...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:30 sm0ke: not very flexible api design

12:30 ToBeReplaced: sm0ke: https://github.com/clojure/tools.logging/blob/5c7f87f023288afe074d26bb3a26fe5e88b10429/src/main/clojure/clojure/tools/logging.clj#L70

12:30 devn: nDuff: we're considering doing a datalog impl on sqlite for a client-side data store

12:31 sm0ke: ToBeReplaced: Yes, thats the log macro, but info debug do much more that just passing :info :debug keywords, so i can not use then

12:32 ,*ns*

12:32 clojurebot: #<Namespace sandbox>

12:32 nDuff: devn: ...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:32 sm0ke: every other macro is using *ns*

12:32 technomancy: I always read that as "Dalek"

12:33 devn: nDuff: i know little about droid -- what's the new thing going to be?

12:33 does it have a name?

12:33 dabd: coventry: ty

12:33 ToBeReplaced: sm0ke: i don't understand what you are looking for... is it that you need logp/logf functionality with the ns functionality?

12:34 nDuff: devn: 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:34 sm0ke: ToBeReplaced: ok if i do a (info "something") i get a log like org.mystupidnamespace: INFO: somthing, right?

12:34 devn: nDuff: interesting

12:34 ToBeReplaced: sm0ke: 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:34 devn: nDuff: thanks for the info.

12:35 sm0ke: ToBeReplaced: what if i want to change org.mystupidnamespace to org.sanenamspace?

12:35 ok i agree thats a bizzare use case

12:35 but i need it

12:35 justin_smith: coventry: 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:35 ToBeReplaced: (log "org.sanenamespace" :info nil "something")

12:36 sm0ke: ToBeReplaced: man! there are sanity checks in the info debug etc macros, which your example doesnt cover

12:37 actually just the logf logp macros to be precise

12:38 so ideally i should be able to do (info "org.saneamespace" "my log")

12:38 coventry: justin_smith: I believe you. I heard it's "a browser UI for step debugging." I may have misinterpreted that.

12:39 ToBeReplaced: sm0ke: straight up, i don't grok the implementation of logp, so i can't be of help here

12:39 justin_smith: coventry: s/step/stack

12:39 coventry: Oh! Thanks.

12:39 justin_smith: though you get a repl where you can do arbitrary stuff, that can look like stepping

12:40 (one repl per stack frame)

12:40 sm0ke: ugh! another bummer

12:41 ToBeReplaced: sm0ke: 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:42 sm0ke: ToBeReplaced: no thats for string formatting

12:42 justin_smith: coventry: 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:42 sm0ke: like (info "{0} hates {1}" "clojure" "logging")

12:42 coventry: justin_smith: How to do get it to stop on the next instruction?

12:43 s/to do/do you/

12:43 ToBeReplaced: sm0ke: okay just looked at logp... what sanity checking are you looking for? it's the same as log macro

12:43 logp and logf both just do log exactly... there's no sanity checking

12:44 sm0ke: ToBeReplaced: they check wether msg is String ?

12:44 justin_smith: coventry: 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:44 sm0ke: check wether t is actually Throwable

12:44 justin_smith: coventry: at this point I am thinking outloud about how we could implement stepping in schmetterling.

12:45 ToBeReplaced: sm0ke: sure, but you are passing the throwable to log, and passing a message .... logf/logp is just convenience

12:46 sm0ke: ToBeReplaced: well you are working on the premise that one will actually pass an throwable

12:46 what if i pass a string instead of throwable

12:47 ToBeReplaced: sm0ke: 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:54 alandipert: dnolen: https://github.com/tailrecursion/stasis/blob/master/src/tailrecursion/stasis/nanorel.clj re: core.logic awesome power

12:54 dnolen: i'm sure my core.logic is absolutely atrocious, so thanks in advance for tips

12:58 sm0ke: ToBeReplaced: you are right

12:58 ToBeReplaced: thanks

12:59 i am little slow with understanding macros

12:59 :P

13:02 can i force tools.logging to use log4j first?

13:05 jonasen: Bronsa: Any input on this: https://www.refheap.com/21499

13:06 ToBeReplaced: sm0ke: 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:09 BobSchack: devn ping

13:09 joegallo: sm0ke: https://groups.google.com/d/msg/clojure/xhdK4M67ji4/9mZWD0b4V0gJ

13:09 sm0ke: hmm configuring logging in the code

13:09 joegallo: and there's that

13:09 sm0ke: not so attractive

13:10 ToBeReplaced: alter-var-root on logger-factory seems like the way to go

13:10 sm0ke: ok well it makes sense for the logging library to do that

13:12 ToBeReplaced: we 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:13 sm0ke: ToBeReplaced: interesting

13:13 you mean you use slf4j-api

13:14 logback by default is not listed in tools.logging wiki

13:14 i guess it can be used via slf4j oly

13:14 only*

13:14 ToBeReplaced: ch.qos.logback/logback-classic

13:17 sm0ke: 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:19 sm0ke: you have both log4j and logback

13:20 it would come down to who is in the classpath first

13:21 i am not sure if slf4j also has a preference

13:22 ToBeReplaced: it looks like that's a dep that doesn't need to be there anymore

13:24 sm0ke: yes i think one of them is unecessary

13:24 you can chose over log4j or logback

13:24 its the same nonsense over years

13:25 can i define a compilation order in lein?

13:26 i 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:27 technomancy: sm0ke: lein defaults to java first, then clojure

13:27 but you can change it with prep-tasks

13:27 :prep-tasks ["compile" "javac"] ; iirc

13:28 eric_normand: dnolen: do you know of a way of suppressing the JSDoc warnings when using React.js?

13:28 aconbere: ztellman: got a sec?

13:28 ztellman: aconbere: sure

13:28 aconbere: https://gist.github.com/ztellman/03fae5146befe9c24868#file-gistfile1-clj-L14

13:29 doesn't that line block the netty thread?

13:29 sm0ke: technomancy: thanks, but still no luck

13:29 aconbere: (since it's using the blocking take operation?)

13:29 blocking put

13:29 bleh

13:29 ztellman: aconbere: it's in a (future ...)

13:29 aconbere: ah!

13:29 ztellman: which puts it on a separate thread

13:30 sm0ke: this is rather intriguing example https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L202

13:30 aconbere: ztellman: doesn't that suffer the same ordering problems as my initial attempt?

13:30 ztellman: aconbere: no, because only once message is in flight at any given time

13:31 by spinning off a goroutine for each new message, depending on how the underlying thread pool works you might get reordering

13:31 aconbere: ooooo

13:31 i think I see

13:31 technomancy: sm0ke: do you have a circular dependency between java and clojure?

13:31 aconbere: you're putting the digestion of the lazy sequence in a future

13:31 but the actual eating of that seek is not ordered

13:31 ztellman: yes, which is strictly ordered

13:31 aconbere: because of the blocking put

13:32 gotcha!

13:32 ztellman: wait, no, it *is* ordered

13:32 sm0ke: technomancy: no just java calling clojure

13:32 aconbere: bleh

13:32 it's still earlier her

13:32 yes

13:32 "eating of the seek *IS* ordered"

13:32 and obviously I mean sequence

13:32 and I should just stop and drink more coffee now

13:33 * aconbere sighs

13:33 aconbere: ztellman: thanks

13:33 ztellman: np

13:33 sm0ke: technomancy: i just have a single import in my java class and a single function in my clojure ns

13:33 trying to call that function from java class

13:34 technomancy: sm0ke: simplest thing is to do it reflectively; then compilation order doesn't matter

13:34 sm0ke: :D

13:35 do you think the _ is the culprit

13:36 technomancy: I'm probably not the right person to ask since I don't know Java

13:36 sm0ke: so i have import my_namesapce.core; then core.func()

13:36 hmm somehow i dont believe you

13:36 technomancy: what

13:37 no, seriously

13:37 mdrogalis: I have never seen technomancy kid.

13:37 sm0ke: come on

13:37 mdrogalis: Well, maybe once.

13:37 technomancy: I have written one class in java, and that was a test case for a jruby patch in 2007.

13:37 mdrogalis: It was the worst year of his life.

13:37 sm0ke: thats bullshit

13:37 Bronsa: jonasen: looks like a tools.analyzer bug to me, I have to go now, will look into this in a couple of hours

13:37 technomancy: http://jira.codehaus.org/browse/JRUBY-3189 2008, sorry

13:38 aconbere: ztellman: 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:38 jonasen: Bronsa: Thanks.

13:38 technomancy: even that took me like five tries to compile

13:38 sm0ke: author of lein doesnt know java

13:38 fucking hilarious

13:38 oh man you are awesome!

13:42 TimMc: That's nothing, I use Java and don't know x86 assembler.

13:42 mdrogalis: I always wondered what it would be like using Clojure and not knowing Java. Obviously I can't undo that to experience it.

13:42 technomancy: I'm pretty handy with transistors though.

13:43 gfredericks: technomancy: do you wear flip flops?

13:43 and eat nand bread?

13:43 technomancy: not in the winter

13:44 garlic nand

13:44 TimMc: gfredericks: Not to be confused with NaaN

13:44 aconbere: mdrogalis: I learned scala before learning java which I imagine is somewhat similar

13:45 mdrogalis: mostly I found that the hardest part was learning how to interface with the JVM environment (debuggers / frameworks / libraries / vocabulary)

13:46 mdrogalis: aconbere: Right, the vocabularly would seem like the most daunting thing to me.

13:46 technomancy: yeah, mostly it's just a matter of learning the jdk classes

13:46 mdrogalis: But it wasn't so bad?

13:46 aconbere: nah

13:47 mdrogalis: That's pretty excellent. Good for you. :)

13:47 aconbere: heh

13:47 technomancy: the only tricky part was java.io.*, (readers, writers, inputstreams, etc) but I had to learn it before clojure.java.io

13:47 kids these days have it easy

13:48 sm0ke: yes, there is no fun learning clojure if you havent seen assembly

13:50 ugh, i remember making a disk reader in assembly during college

13:50 cruel

13:52 TimMc: sm0ke: On the other hand, I wrote a 5-stage pipeline MIPS processor in Clojure during college.

13:52 mdrogalis: I did MIPS in college. Ugh.

13:52 TimMc: It felt a little silly.

13:52 sm0ke: TimMc: what college is that?

13:53 TimMc: College of Computer and Information Science (at Northeastern University in Boston, MA, USA)

13:53 sm0ke: Masters?

13:54 TimMc: No, BS in CS.

13:54 I had to ask for an exception to use Clojure -- the default option were C(++) and Java.

13:56 sm0ke: TimMc: must be having your own OS written in clojure?

13:57 mdrogalis: Yeah, I actually had a similar situation asking to use clojure, TimMc.

13:57 It went well. :)

13:57 TimMc: I mostly learned Clojure via school projects. It's important to have a project of some sort.

13:58 sm0ke: Nah, for that I think I'd want to use Erlang, OCaml, or Rust.

13:58 mdrogalis: Yeah, agreed with that sentiment. I think it's important to put in a lot of time alone too.

13:58 TimMc: (none of which I actually know, mind you)

13:58 mdrogalis: People start to lean pretty heavily on others in teams and end up not learning as a habit.

13:58 sm0ke: so MIPS is basically RISC instruction set right

14:00 TimMc: IIRC, yes.

14:01 sm0ke: TimMc: i dont understand how did you program in Clojure?

14:02 our cpu design lab was on small microprocessors

14:03 TimMc: sm0ke: Oh, sorry, it was just a simulator.

14:03 ToxicFrog: sm0ke: he implemented a MIPS processor emulator in clojure.

14:03 He didn't write clojure targeting a MIPS processor.

14:03 sm0ke: ah!

14:04 TimMc: Nothing so exciting.

14:04 No wonder you were asking if it was a Master's program.

14:05 sm0ke: yea simulator lab are challenging to brain, hardware lab are challenging to spine

14:05 fking cpu lab

14:06 nDuff: Heh.

14:06 sm0ke: ok guys, later

14:06 * nDuff fondly remembers gxSPIM

14:11 dsrx: i 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:12 hm

14:13 oh nice, the are macro

14:15 gfredericks: (inc are)

14:15 lazybot: ⇒ 1

14:15 gfredericks: hey we can track karma for specific vars

14:15 (inc clojure.test/are)

14:15 lazybot: ⇒ 1

14:16 gfredericks: even hypothetical vars

14:16 (inc clojure.core/update)

14:16 lazybot: ⇒ 1

14:16 TimMc: (inc clojure.core/dissoc-in)

14:16 lazybot: ⇒ 1

14:16 gfredericks: ^ register your support

14:16 technomancy: (inc map-keys)

14:16 lazybot: ⇒ 1

14:16 technomancy: (inc map-vals)

14:16 lazybot: ⇒ 1

14:17 ToxicFrog: (doc are)

14:17 clojurebot: Titim gan éirí ort.

14:17 ToxicFrog: Unhelpful, clojurebot.

14:17 TimMc: I have faith that Rich will come in here one day and check $karma for each of these to see what to implement next.

14:17 technomancy: needs jira integration

14:21 * nDuff grumbles about lazybot's inc being side-effecting without a trailing !

14:22 dsrx: it's like println

14:22 stuartsierra: I don't get map-vals/map-keys. reduce-kv is just as easy.

14:23 gfredericks: you don't get using them at all or just don't think they meet the clojure.core threshold?

14:23 stuartsierra: I don't get why people so often seem to want them. Their lack has never bothered me.

14:23 technomancy: stuartsierra: can you do reduce-kv without a #()?

14:24 gfredericks: I feel messy using reduce for something where each step is independent of the others

14:24 e.g., why do we have map at all when reduce works?

14:24 stuartsierra: `map` is lazy

14:24 * gfredericks was about to say "laziness aside"

14:24 stuartsierra: :)

14:25 gfredericks: so 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:25 the same reason that it's nice to have map even though (laziness aside) you can do map with reduce

14:26 it makes it obvious that the things are being mapped independently

14:26 technomancy: yeah, reduce is too general/heavy

14:27 gfredericks: you could be doing just about anything in reduce and it takes a bit of concentration to rule out those other possibilities

14:27 technomancy: we wrote a map:for::reduce:reducate macro at seajure once; that was kind of fun

14:27 to avoid needing an anon fn the way that for does

14:30 gfredericks: technomancy: is it possible for eval-in-project to ignore compilation failures and eval in a previous build of the project?

14:30 ToBeReplaced: the map-keys/map-vals candy is nice for nested structures, which seem to come up often enough

14:30 technomancy: ToBeReplaced: yeah, works much better than reduce for update-in

14:30 gfredericks: no. you might be able to write a higher-order task for that though.

14:31 something that monkeys with :compile-path

14:31 gfredericks: technomancy: a buddy is seeing that behavior with `lein ring server :headless` and I'm trying to figure out why

14:33 * gfredericks tries to reproduce

14:35 gfredericks: technomancy: oh nm I misunderstood the problem

14:41 this was about auto reloading

14:42 on a compile error it serves the stacktrace once and then reverts to the old code

14:43 mklappstuhl: hey 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:43 mdrogalis: ,(pr-str {:a 1})

14:43 clojurebot: "{:a 1}"

14:44 mdrogalis: ,(read-string "{:a 1}")

14:44 clojurebot: {:a 1}

14:44 coventry: I'm curious, could you pull out a fn's byte code and persist that?

14:44 mdrogalis: Oh, you wrote function.

14:45 I'll just sit here and pretend I know what's going on.

14:45 TimMc: serializable-fn

14:45 sort of

14:45 mdrogalis: What's your problem, mklappstuhl?

14:46 mklappstuhl: mdrogalis: that looks pretty helpful already, thanks

14:47 mdrogalis: Sure :)

14:55 teslanick: Ok. 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:01 seangrove: 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:05 sritchie: magnars: boom, got cloudfront working :)

15:05 for some reason, though, chrome doesn't seem to be respecting the Cache-Control and Expires headers

15:05 magnars: (though cloudfront does). Chrome still hits cloudfront on every request

15:06 dnolen: alandipert: cool stuff will have to look more closely at it later

15:07 magnars: sritchie: 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:07 dnolen: eric_normand: use master

15:07 sritchie: magnars: ah, interesting. I was doing a refresh, perhaps that's it

15:07 magnars: the right headers are coming through

15:08 magnars: boom! btw, I ended up using Enlive to go rewrite all of the static resources paths inline

15:08 so, with a one line addition to my main page template, optimus works everywhere, no big changes required

15:08 pretty cool :)

15:08 eric_normand: dnolen: thanks

15:09 magnars: sritchie: oh, that is sweet! Care to share the code?

15:09 sritchie: sure, one sec

15:09 clojurebot: Huh?

15:10 gfredericks: ~botsmack

15:10 clojurebot: Owww!

15:10 * gfredericks wonders how tasteless bot abuse jokes are

15:10 dnolen: eric_normand: included required project settings to the gist

15:12 sritchie: magnars: https://gist.github.com/sritchie/7794646

15:12 that's the idea

15:13 not sure if you've used enlive

15:14 magnars: but the entries are pairs of selector and transformation (that gets applied to every match)

15:14 so :img just matches every image tag on the page (after the user's code gets subbed into the :main div

15:14 and rewrites the url, if it starts with /img, in this case

15:14 magnars: sritchie: 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:14 sritchie: magnars: please do

15:15 magnars: Excellent, thanks

15:15 clojurebot: Pardon?

15:15 sritchie: magnars: of course the same idea applies for hiccup

15:16 magnars: a tree-walking function that replaces all img tags right before serving

15:16 zanes: seangrove: That's exciting!

15:18 bitemyapp: seangrove: I look forward to the cljs meetup.

15:18 seangrove: zanes: You going to come?

15:18 zanes: seangrove: I'd love to! I assume you mean Etsy's offices in NYC?

15:18 magnars: sritchie: very nice! It's going in the readme :)

15:18 seangrove: zanes: Of course not, in SF ;)

15:19 zanes: seangrove: :(

15:19 seangrove: With dnolen, cljs is actually *over-represented* in NYC

15:19 zanes: I was going to say — but we have dnolen!

15:19 seangrove: We have to do more with it out here to catch up

15:19 zanes: I see, I see.

15:19 eric_normand: dnolen: with the project settings, I shouldn't need to use master?

15:19 dnolen: eric_normand: no you need master for those project settings to do anything

15:19 bitemyapp: zanes: SF brings all the boys to the yard, damn right, better than yours.

15:19 eric_normand: dnolen: I see

15:20 dnolen: thanks!

15:25 gfredericks: clojure.core.async/map< will "send a nil through the channel" if your map function returns nil

15:25 is that intentional?

15:27 bitemyapp: gfredericks: it probably is, it should be understood by now that nil has special meaning in any core.async context.

15:27 gfredericks: the onus is on the user to remember that.

15:27 gfredericks: sure

15:27 bitemyapp: I feel like core.async needs a flashing neon sign that says, "nil has special meaning!"

15:28 I feel like an empty defrecord instance baked into the library would've been cleaner, but you know, whatever.

15:28 gfredericks: we can put it in the pom.xml

15:29 TimMc: What *does* it mean?

15:29 I haven't worked with core.async at all.

15:29 gfredericks: channel is closed

15:29 bitemyapp: TimMc: pool's closed.

15:29 gfredericks: closed channels return nil when you read from them

15:29 TimMc: Yuck.

15:30 gfredericks: I think the horse is already dead on this one

15:30 bitemyapp: gfredericks: the horse is in miscible pieces.

15:30 gfredericks: I just didn't expect map<'s behavior

15:30 bitemyapp: it's a fine red mist.

15:31 coventry: What's the advantage of that?

15:31 bitemyapp: coventry: advantage of what?

15:31 gfredericks: easy to say (when-let [x (a/<!! ch)] ...)

15:31 bitemyapp: oh yes, that.

15:31 gfredericks: while trying not to think about false of course

15:32 coventry: Of nil closing the channel. Happy for a transcript/video of the horse's beating up to this point.

15:32 bitemyapp: gfredericks: pattern matching would be more generally useful. oh well.

15:32 gfredericks: coventry: I expect you could find a long ML thread

15:32 bitemyapp: coventry: if you use core.async it becomes obvious quickly.

15:32 gfredericks: clojure; it's the worst language out there except for all the other ones

15:33 * bitemyapp zips his mouth shut on this one

15:33 hiredman: gfredericks: that seems like a bug, I thought you weren't allowed to pass nils over channels

15:34 gfredericks: hiredman: it technically doesn't go through a channel, which is obvious when you look at the source of map<

15:34 it's more of an API question

15:34 i.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:35 the docs for map< claim that it returns a channel

15:36 bitemyapp: discounts for unpopularity of course

15:37 bitemyapp: gfredericks: not even what I was thinking of.

15:38 gfredericks: well then your mouth-zipping was effective

15:45 seangrove: Hrm, just finished the Pete Hunt Reactjs talk dnolen linked to, very interesting.

15:45 dnolen: seangrove: it's good stuff just had lunch with him, I think React is likely to be a very good fit for ClojureScript

15:46 seangrove: they are using persistent structures + React at Instagram & Facebook, they "get it"

15:46 seangrove: dnolen: The high-level ideas seem very sound, pretty much what I've been thinking of, similar to how pedestal approaches things, etc.

15:46 dnolen: seangrove: exactly

15:46 hiredman: gfredericks: sounds like a bug waiting to waste someones time to me

15:46 dnolen: seangrove: React is nice in that the part we care about is properly modular - event handling & UI representation

15:46 seangrove: dnolen: Wow, did he say if they had a cultural struggle getting engineers to use persistent data structures?

15:47 dnolen: seangrove: no, because its ... wait for it ... wait .. FASTER

15:47 gfredericks: hiredman: well fixing it requires an extra check; who knows if that's worth the perf effort

15:47 seangrove: dnolen: but.. but... what about banging on it in place! How dare you *demand* I not mutate!

15:47 dnolen: seangrove: currently React uses bad default because JS programmers mutate everything, so they have to rewalk everything

15:47 seangrove: if you're data is pure, React can be up to 10X faster (and it's not slow)

15:47 bitemyapp: ~reactjs

15:47 clojurebot: reactjs is a poorly implemented comonad

15:48 stompyj: shots fired!

15:48 seangrove: dnolen: I'm with you, but also very interested in the cultural changes/fixing misconceptions, etc.

15:48 ~gentlemen

15:48 clojurebot: You can't fight in here. This is the war room.

15:48 bitemyapp: it's kitschy, but I'm going to bump for that one.

15:48 (inc stompyj)

15:48 lazybot: ⇒ 1

15:49 dnolen: seangrove: it's super small team from what I understand and they hated the MVC stuff they had before

15:49 seangrove: I think converting was not hard

15:49 seangrove: dnolen: I see, so it's not like the entire org was willing to try it then

15:49 Well, that makes sense. Start small and prove it out first, then maybe it'll spread.

15:50 tos9: 1

15:52 seangrove: Oh jesus, I just realized that talk was at JSConf EU

15:52 I was *there*. I can't believe I didn't go to that talk. Damnit.

15:59 Raynes: seangrove: http://wpmedia.o.canada.com/2013/05/kittensleep.gif

15:59 Slept through it, clearly.

16:00 seangrove: Raynes: True, the conference didn't have a ton of material that caught my eye.

16:00 But the people were nice

16:00 owengalenjones: question, 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:01 bitemyapp: owengalenjones: timeout or sentinel.

16:01 owengalenjones: but still just sending a keyword is acceptable?

16:02 hiredman: owengalenjones: 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:02 bitemyapp: owengalenjones: if you want, but it's usually a sign you're not using core.async correctly.

16:02 mdrogalis: Wasn't Tim trying to get a closed? function into the API?

16:02 sritchie: anyone here using amazonica?

16:02 bitemyapp: owengalenjones: you're better off closing the channel.

16:02 sritchie: a lot of Pallet people use it.

16:02 sritchie: but beware, Pallet people are a bit warped.

16:03 smart, but warped.

16:03 sritchie: :) I used it for a while

16:03 pallet, that is

16:03 bitemyapp: too loopy 4 me

16:03 not at all how I think about deployment or provisioning.

16:03 sritchie: what do you use?

16:03 bitemyapp: massive mental model / library model mismatch.

16:03 sritchie: idempotent fabric+cuisine (python) or haskell.

16:04 sritchie: what's the recommended haskell deploy lib?

16:05 owengalenjones: bitemyapp: 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:06 is this using async incorrectly?

16:06 rhickey basically cites this as a use case in the async introduction video

16:08 mdrogalis: bitemyapp: Basically owengalenjones is seeing that values in the channel that were put in before closing the channel come out as nil.

16:11 gfredericks: owengalenjones: (alts!! [ch] :default :drained) or something like that?

16:14 owengalenjones: gfredericks: thanks that might be what I need

16:22 hiredman: owengalenjones: 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:41 bitemyapp: sritchie: there's not one, I've been tinkering with my own.

16:48 gfredericks: I want to write http APIs by defn's that have metadata to help the ring server translate the request into args

16:48 * gfredericks tires of compojure

16:50 brehaut: liberator ?

16:50 its not defns but its more like what you are asking about

16:50 http://clojure-liberator.github.io/liberator/

16:51 gfredericks: I'm not sure if I'm a fan of the rest thing

16:51 brehaut: ~guards

16:51 clojurebot: SEIZE HIM!

16:51 gfredericks: conditioned on me being a fan then liberator is probably what I want, yeah

16:52 brehaut: im not a fan of rest where it means 'lets make rails apps look kinda like rest'

16:52 gfredericks: right now I'm in the mud because there's a bug in some app logic that exists inline in my compojure route

16:52 which means testing it involves going through http which is rather awkwarder than testing a regular function

16:53 so I could pull the logic out into a .server.data namespace perhaps

16:53 justin_smith: you can't just call your handler?

16:53 gfredericks: I think I can

16:53 justin_smith: I usually call my handler with a request map

16:53 gfredericks: I've been using this peridot thing for no good reason

16:53 justin_smith: I made a lib that records requests for replay and serializes them

16:53 gfredericks: oh I made a vcr lib too :P

16:54 justin_smith: in mine the map is fully ring compatible, ie. the body is a stream

16:54 brehaut: gfredericks: 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:54 gfredericks: that's not an issue at the moment too

16:54 justin_smith: with the same contents as the initial request

16:54 gfredericks: justin_smith: yeah this test wouldn't benefit from vcr

16:54 justin_smith: if you have that, why do you need to use http?

16:55 just call your handler as a function on the request if it is properly serialized

16:56 gfredericks: it's still clunkier than calling a function with normal args

16:56 if the translation from http to clojure was declarative then I wouldn't have as much of a burden to test that part

16:57 brehaut: gfredericks: xml-rpc!

16:57 justin_smith: what does your compojure route do that doesn't translate out of http to serialized request?

16:57 bitemyapp: in liberator, is there a way to use a custom rendering function with Content Negotiation

16:58 I 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:58 gfredericks: justin_smith: e.g., parsing a UUID from the route

16:58 justin_smith: the route is in the request map

16:58 well, the uri is

16:59 gfredericks: sure

16:59 gotta pull the component out and parse it to a UUID

16:59 and to call the handler in a test I have to shove the uuid back into the uri

16:59 justin_smith: if it is recorded, then you just reuse it

17:00 if it is serialized, you can paste it into a deftest form

17:00 or a file that gets read by the deftest

17:00 bitemyapp: n/m, found the multimethod, just need to smash it.

17:00 monkeypatching ftw.

17:01 gfredericks: justin_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:02 justin_smith: fair enough, then you probably want a more functional and less macro oriented router than compojure I guess

17:02 * gfredericks tries to figure out how much effort it would take

17:03 gfredericks: I don't know how the collecting of functions into a single handler would work best

17:04 e.g., would the route be defined in the route listing or on the function metadata? both seem important

17:04 justin_smith: no, you make the routes combine to make a handler function, but each is also just a standalone function

17:04 well in my ideal design they do

17:04 riley526: fwiw, you might check out https://github.com/mwmitchell/wire for another routing approach

17:05 justin_smith: https://github.com/caribou/polaris a buddy / coworker of mine made this

17:05 more function / edn oriented routing

17:05 also has reverse routing

17:06 ie. 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:09 gfredericks: a map comes out?

17:10 oh with params and such?

17:11 alandipert: gfredericks: https://github.com/tailrecursion/castra might interest you, RPC + csrf

17:12 gfredericks: hmm

17:12 jrubino: Will performance ever be a development priority or is Clojure devs consider it "fast enough "

17:13 gfredericks: I'm not doing web apps

17:13 bitemyapp: okay, I've had enough, Liberator is getting defenestrated.

17:13 jrubino: "fast enough" is a reference to the python BDFL remarks on python performance

17:13 stompyj: bitemyapp: how come? I ask because I just started a project with it

17:13 gfredericks: jrubino: in what respect do you see performance as not a development priority?

17:14 arrdem: gfredericks: cinc and c2host aren't exacly rush rush core projects :P

17:14 justin_smith: gfredericks: yes, see the demo at the bottom of that github page

17:14 gfredericks: though you may need more fancy parsing of request into params than it provides

17:15 jrubino: gfredericks: I have read third hand comments that say the focus on clojure was usability while the focus on scala was on performance

17:15 gfredericks: arrdem: c2host?

17:15 arrdem: gfredericks: my nickname for a cinc backed to host binary compiler. sorry.

17:15 dnolen: jrubino: Clojure can be competitive with Java if you care enough to bother

17:16 bitemyapp: stompyj: changing content negotiation/representation behavior is Vietnam.

17:16 arrdem: dnolen: if you use a subset of clojurescript that can run atop asm.js you could do better than java. maybe.

17:16 gfredericks: arrdem: how would one recognize a rush rush core project?

17:16 dnolen: arrdem: asm.js w/o GC story is useless

17:16 TimMc: dnolen: Meh, RAM is cheap these days. ;-)

17:18 stompyj: bitemyapp: Ahh. LOL

17:18 dnolen: arrdem: 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:18 arrdem: gfredericks: 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:19 dnolen: right. you could probably pull off fast math through CLJS+asm.js but that'd be it.

17:20 gfredericks: arrdem: I suppose "performance" is relative. I think clojure has a good performance reputation conditioned on being a jvm language

17:21 or more specifically that it has been a "development priority"

17:22 arrdem: jrubino: have I snarked on your question enough to answer it?

17:23 gfredericks: every 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:24 jrubino: arrdem: I think it rates with the generic "fast enough".

17:24 arrdem: jrubino: correct. attempting to qualify it with anything else would be silly.

17:25 jrubino: arrdem: Clojure; fast enough for android apps?

17:25 arrdem: jrubino: dalvik, fast enough to be a really shitty JVM?

17:25 jrubino: more seriously I don't know

17:25 gfredericks: in context we're comparing with scala

17:26 jrubino: arrdem: LMAO

17:26 scottj: jrubino: last I heard startup time for Clojure on android is much worse than Scala.

17:26 technomancy: treating "performance" like a single-dimensional property is silly

17:26 gfredericks: I suppose the one thing clojure hasn't optimized for is a slim runtime

17:27 technomancy: criticizing it as "not performant enough" because it takes a long time to boot makes no sense

17:27 gfredericks: technomancy: I tried out clojure as a DSL for starting JVMs and it sucked

17:27 arrdem: agreed. the HPC apps I work with have insane boot sequences and then run like a bat out of hell.

17:28 technomancy: scottj: scala doesn't have a compiler in the runtime, so tree-shaking is a lot easier

17:29 eric_normand: react.js's virtual dom is great

17:29 arrdem: technomancy: for most apps can't the compiler tree shake itself out tho?

17:30 technomancy: arrdem: yeah, but there's enough dynamic/reflective stuff common in clojure to discourage anyone from spending a lot of time on that

17:30 dnolen: jrubino: 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:31 jrubino: unlike most dynamic languages, Clojure was designed from day one with performance in mind - and thank goodness for that

17:32 jrubino: 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:32 * gfredericks has not heard of this arboreal roughhousing

17:33 justin_smith: dropping definitions or data that won't be needed at runtime

17:35 nDuff: ...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:35 Haven't validated that that isn't due to a bug in Soot / behavior not matching intent, though.

17:36 ...my hope is to have it taught to follow Var indirections soon, at which point things will get considerably more exact.

17:37 arrdem: nDuff: a framework like soot should be insanely conservative... any refinements should only make it more agressive

17:37 nDuff: thanks for mentioning that tho. I'll definitely play with it some.

17:37 nDuff: arrdem: *nod*, just so. That said, given how awful Soot's implementation is, I have trust issues as to its correctness. :)

17:38 arrdem: ...it's mutable singletons everywhere. Abandon all hope, &c.

17:38 arrdem: nDuff: ::sadface::

17:38 nDuff: ...anyhow, off to catch a train.

17:51 aconbere: I'm going to feel a little dumb here

17:51 but what's the current state of contrib libraries?

17:51 (in particular math)

17:51 arrdem: aconbere: questionable

17:51 aconbere: some have been ported forwards, others abandoned

17:51 aconbere: :-/

17:51 is the best bet just to call java?

17:51 * aconbere just wants to logarithm some stuff

17:52 ztellman: aconbere: missed the first part of your question

17:52 what are you trying to do?

17:52 aconbere: ztellman: I want to take the log2 of a number

17:53 ztellman: but I can't quite figure out the state of contrib libraries

17:53 ztellman: (/ (Math/log n) (Math/log 2))

17:53 aconbere: yay!

17:53 my googling all gave examples like (math/log ...)

17:53 or brought up contrib libraries

17:53 that didn't exist

17:58 zanes: Yikes. That's a pretty horrible experience for newbies.

17:59 Pupeno: What 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:00 dnolen: Pupeno: Clojure Programming is pretty good if you know Python/Ruby/Java

18:04 Pupeno: Thanks dnolen

18:04 sritchie: anyone using http-kit for async responses in clj?

18:04 not long polling, but setting up an async response, then moving on

18:08 bitemyapp: sritchie: I'm not sure what that means.

18:08 sritchie: well, say I get a request,

18:08 bitemyapp: sritchie: generally you're reading/writing a websocket or long-poll.

18:09 sritchie: and I want to do some async work (like uploading an image), then return it to the user once it's done

18:09 then close the connection

18:20 amalloy: sritchie: how is that different from long polling?

18:21 sritchie: amalloy: would it be a mistake to do that for every single request?

18:21 technomancy: Pupeno: hey, do I know you from another channel?

18:21 sritchie: amalloy: a la finagle thrift services in scala,, where every network method returns a future

18:21 amalloy: i don't see why. that's how aleph works

18:21 Pupeno: technomancy: it's possible.

18:22 technomancy: Pupeno: maybe #ruby-lang from way back in the day

18:22 Pupeno: technomancy: yes. I've been hanging out in #ruby-lang for a few years already. :)

18:24 technomancy: well nice to see you again after so many years

18:24 Pupeno: So, you are clojuring instead of rubying now?

18:24 aconbere: :-/

18:25 I want to take the bitwise and of a hashed string value

18:25 bleh

18:25 maybe I should just use java here

18:25 the problem I'm having is bit-and doesn't support BigInteger (nor BigInt)

18:25 and doesn't list what it /does/ support

18:25 :-/

18:26 technomancy: Pupeno: since about this time of year in 2008

18:26 Pupeno: Oh! long time.

18:26 SegFaultAX: aconbere: (.and my-bigint my-other-bigint)

18:27 aconbere: technomancy: see... this is where if I knew java I'm sure I would be happier :-/

18:27 justin_smith: aconbere: you can read the javadocs for the object that is giving you trouble, and try any methods that look useful

18:27 SegFaultAX: aconbere: I assume that was to me... also: Google is a thing.

18:28 justin_smith: as is (javadoc)

18:28 aconbere: SegFaultAX: clearly google is a thing, otherwise I wouldn't know a lot of what I just asked

18:28 :P

18:28 SegFaultAX: aconbere: :)

18:28 justin_smith: (javadoc BigInteger) should open your web browser to the docs for that class

18:29 if your jvm is properly configured with your OS

18:31 Pupeno: I'm thinking of using Clojure for my next startup.

18:31 * SegFaultAX listens intently to Pupeno

18:32 Pupeno: SegFaultAX: 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:32 mklappstuhl: how can I use korma's predicates like >= when only a single attribute is relevant? http://sqlkorma.com/docs

18:33 bitemyapp: Pupeno: 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:33 mklappstuhl: (where {:myattr [> 5]}) ?

18:33 Pupeno: bitemyapp: 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:33 SegFaultAX: Pupeno: 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:34 But don't despair about that, RoR is literally optimized for that kind of thing.

18:34 You might even say it's RoR bread 'n butter, if you like that sort of thing.

18:34 bitemyapp: Pupeno: it depends on how far outside RoR's sweet spot your app will be, and how quickly you learn Clojure idioms.

18:35 Pupeno: SegFaultAX: 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:35 SegFaultAX: Pupeno: Clojure web stack tends to be optimized more towards services. RoR is obviously heavily oriented towards monolithic architectures.

18:35 The latter tends to make the very early stages of a project much faster.

18:36 At least that has been my experience.

18:36 Pupeno: Which framework are people using these days? Pedestal seems to be the most active.

18:37 SegFaultAX: Pupeno: Caribou just dropped and it has been getting a lot of love in here and on the mailing list.

18:37 I haven't actually used it yet.

18:37 mklappstuhl: bitemyapp: tried that. always resulted in sth like: "SELECT \"days\".* FROM \"days\" WHERE (\"days\".\"date\" >= ?) LIMIT 3"

18:46 ToBeReplaced: for the clojurescript + emacs crowd -- how do you organize your folders for clojurescript-test?

18:59 augustl: made 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:00 https://github.com/augustl/traffic-police

19:00 whoops, I some words.

19:01 ossareh: I some thoughts, thus I am.

19:01 augustl: ossareh: indeed, that was what I.

19:14 nkozo: There 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 `cbp: nkozo: no, use a map

19:20 nkozo: `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:21 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:21 Raynes: Will the keyword arguments always be the last arguments passed?

19:22 nkozo: Raynes: yes

19:22 but the non-keyword argument can be present or not

19:22 I want a single destructuring expression to handle all three cases

19:22 Raynes: Are these the only cases that are ever going to happen?

19:23 It feels like there are a lot of variables here.

19:23 nkozo: Raynes: yes, you can handle that in python by simply using def f(a=nil,b=nil)

19:24 `cbp: well don't try to write python in clojure :P

19:24 amalloy: nkozo: that's not really a popular style in clojure

19:24 `cbp: include the :a in your arguments

19:25 nkozo: I don't want to use :a :)

19:25 amalloy: i mean, what does it mean to call (f 1 :a 2)?

19:26 nkozo: I don't want to handle that case

19:26 the :b argument is really exceptional

19:26 amalloy: well heck, i don't want to handle the (f 1 :b 2) case either

19:26 so this should be easy; just write it to accept (f 1) or (f 1 2)

19:27 nkozo: great, but I only want to know if a single destructuring expression can handle all these three cases or is impossible :)

19:27 amalloy: no

19:27 `cbp: nkozo: that was my first answer to you

19:27 amalloy: you can write one yourself, if you want it to be easy for python coders to read your code, and hard for clojure coders

19:41 danenania: anyone know where i can find contrib.seq-utils nowadays?

19:41 TimMc: ~contrib

19:41 clojurebot: Monolithic 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:41 danenania: looked there, isn't listed

19:42 TimMc: Hmm, what did you want from it?

19:42 danenania: indexed

19:42 TimMc: This would be like (partial map-indexed identity)?

19:43 danenania: yep, i could use map-indexed

19:43 but indexed would be cleaner for my use case

19:43 TimMc: Err, not quite that, but you know what I mean.

19:44 danenania: i want to do: (for [[x i] (indexed l)...)

19:44 TimMc: &(map vector '[a b c] (range))

19:44 lazybot: ⇒ ([a 0] [b 1] [c 2])

19:44 TimMc: I'd say just define it yourself.

19:45 danenania: so some of the old contrib packages aren't around anymore?

19:48 amalloy: arrdem: i'm pretty sure http://stackoverflow.com/a/20389154/625403 is wrong

20:00 pmap: hey, I'm getting some unexpected behavior out of java arrays in clojure

20:00 I thought that (aclone arr) would return a new array, and that changes to one array wouldn't affect the other

20:01 but look at this

20:01 ,(let [a (make-array Integer 2 2) b (aclone a)] (aset a 0 0 (int 2)) (aget b 0 0))

20:01 clojurebot: 2

20:01 pmap: setting a[0][0] = 2 causes b[0][0] == 2

20:02 amalloy: pmap: 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:02 pmap: ok

20:02 so does that mean I have to clone the array myself?

20:03 oh, I see what you mean

20:03 it's cloning the rows

20:03 but the colums still point to the same thing

20:04 amalloy: if 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:04 pmap: I'm only cloning it once

20:04 but using the two arrays many times

20:04 at least thousands of times

20:05 so the performance loss of cloning should be outweighed by the performance gain of using arrays

20:05 basically everything in my program works except for the fact that the arrays are interdependent

20:06 so I'm not changing that at this point

20:06 arrdem: amalloy: you're correct

20:06 pmap: and I'm not excited about using arrays :P

20:06 arrdem: amalloy: I forgot that the only valid operator has to be monad -> monad

20:06 pmap: arrays are awful

20:06 amalloy: arrdem: well, not monad->monad

20:06 a -> m b

20:06 arrdem: right.

20:07 amalloy: oh god, he's accepted your answer now

20:08 arrdem: amalloy: I got this

20:08 amalloy: haha

20:09 arrdem: amalloy: dunno if he'll ever see the change tho

20:09 amalloy: looks like he has

20:09 high five!

20:09 arrdem: yaaaay I fail at SO karma farming...

20:09 * arrdem high fices amalloy

20:09 amalloy: arrdem: but you win at learning about monads

20:10 arrdem: amalloy: don't let bitemyduche hear about that

20:10 ~monads

20:10 clojurebot: monads are the new gotos

20:10 arrdem: LIEZ

20:11 pmap: hmm

20:11 maybe instead of creating an array and trying to clone that

20:12 I make a lazy sequence

20:12 and use to-array-2d

20:12 twice

20:14 hiredman: maybe we gaze too long in to the abyss

20:20 TimMc: pmap: Perhaps amap could be useful?

20:20 amap and System/arraycopy or whatever

20:20 clojurebot: I don't understand.

20:22 gfredericks: ,(doc aclone)

20:22 clojurebot: "([array]); Returns a clone of the Java array. Works on arrays of known types."

20:22 gfredericks: what are arrays of unknown types?

20:24 amalloy: gfredericks: that's quite poorly worded, isn't it

20:25 gfredericks: amalloy: I don't know what it's trying to mean.

20:25 amalloy: &(aclone (into-array ["a" "b"]))

20:25 lazybot: ⇒ #<String[] [Ljava.lang.String;@1b82cb6>

20:25 bitemyapp: clojurebot: forget monads are the new gotos

20:25 clojurebot: Cool story bro.

20:25 bitemyapp: ~monads

20:25 clojurebot: monads are #<RuntimeException java.lang.RuntimeException: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "=" at line 1, column 38.>

20:25 amalloy: bitemyapp: you're just making it worse

20:25 that is not the forget syntax

20:25 gfredericks: clojurebot: that is not the forget syntax

20:25 clojurebot: Ok.

20:26 bitemyapp: ~that

20:26 clojurebot: that is not the forget syntax

20:26 bitemyapp: ~forget monads

20:26 clojurebot: excusez-moi

20:26 amalloy: is String[] a subtype of Object[] in java? i think it is, which is kinda awful

20:26 gfredericks: ~this

20:26 clojurebot: this is a better one i think: https://github.com/michaelklishin/neocons

20:26 bitemyapp: amalloy: of course it is.

20:26 ~which

20:26 clojurebot: It's greek to me.

20:26 bitemyapp: ~greek

20:26 amalloy: of course?

20:26 clojurebot: Gabh mo leithscéal?

20:26 bitemyapp: amalloy: I am well acquainted with the awfulness of Java's type system.

20:26 so, "of course".

20:27 gfredericks: ideally it's a subtype for reading and a supertype for writing?

20:27 * gfredericks is types dumb

20:27 bitemyapp: that's just policy-wonking an unforgivable horror. Don't even bother.

20:27 amalloy: gfredericks: 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:28 gfredericks: bitemyapp: no idea what you're referring to

20:28 amalloy: "but only if it's hinted as primitive[] or Object[], not some other fancy nonsense?"

20:28 that last bit doesn't really make sense, though

20:28 especially since afaict from reading the source it's not actually true

20:30 gfredericks: bitemyapp: I think core.typed treats references this way?

20:30 they're parameterized twice even I think

20:33 pmap: what's a better way of doing (let [x (foo bar) y (foo bar)] ...) ?

20:33 in this case (foo bar) is making that array

20:34 I thought about doing something like (let [[x y] (repeat 2 (foo bar))] ...)

20:34 maybe that's not best, though

20:34 brehaut: odd

20:34 wrong window

20:34 hyPiRion: no "better way" really, although it's possible to do (let [[x y] (repeatedly #(foo bar))] ...

20:35 pmap: ooh, I like that actually

20:35 hyPiRion: perhaps punch in a 2 there for good measure

20:37 kristof: In core.async, does a go body have a return value?

20:37 no, it doesn't, because it's a macro...

20:37 pmap: using repeatedly is about twice as slow

20:38 compared to repeat

20:38 kristof: these ported goroutines are magic, geez

20:38 pmap: wait

20:38 I'm doing it wrong

20:38 repeat is making duplicates which point to the same thing

20:38 derp

20:39 guess repeatedly is the only way

20:40 amalloy: kristof: doesn't (go ...) return some kind of channel?

20:42 yeah. from the docstring of go: "Returns a channel which will receive the result of the body when completed"

20:43 kristof: amalloy: I don't think so, considering you can make lots of channels within a single go body

20:43 .....................wait, no you can't

20:43 amalloy: i mean...of course you can

20:44 kristof: that would be an improper use of go

20:44 amalloy: 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:45 amalloy: so? 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:45 kristof: I'm not making any sense, you're right

20:46 amalloy: absolutely the routines you made are usually the primary purpose of a go block

20:46 kristof: Let's see what the macroexpand is of 'go'

20:46 amalloy: oh boy

20:47 i mean, i encourage you to look, but don't expect you to understand any of it. i know i wouldn't

20:47 kristof: Oh, that's right, it expands into a state machine

20:47 amalloy: it's only 12 lines :P

20:48 I'm sure the REAL beefy stuff is in 'ioc/state-machine' and in 'ioc/run-state-machine-wrapped'

20:50 dabd: i love emacs but this seems to be a nice project: https://github.com/cursiveclojure/cursive

20:50 if they can provide Paredit-style structural editing

20:51 kristof: what's wrong with lighttable?

20:52 dabd: kristof: you asking me»?

20:53 Bronsa: paredit should be easy to support thanks to https://github.com/laurentpetit/paredit.clj

20:53 kristof: dabd: Yeah.

20:53 dabd: kristof: i am not familiar with it

20:53 kristof: dabd: I mean it was more of a rhetorical question, because only the Cursive people can answer it.

20:53 dabd: are you using it for clojure?

20:54 amalloy: Bronsa: 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:54 kristof: dabd: 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:54 Bronsa: amalloy: yeah, I read that just after linking it

20:55 kristof: dabd: 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:55 dabd: Could use some work. But it's nice.

20:56 dabd: I 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:56 and configure

20:58 kristof: pfft, debuggers

21:03 wooooooah baby that's cool

21:03 dabd: Not a debugger, but check this out: https://www.youtube.com/watch?v=d8-b6QEN-rk

21:03 dabd: Relevant blog post: http://www.chris-granger.com/2013/08/22/light-table-050/

21:04 dabd: that's cool. the power of clojurescript

21:06 kristof: Apparently they had a problem with threading and stuff that was blocking

21:06 I wonder how much of core.async they used? :P

21:29 jarodzz: :jarodzz haha

22:18 arohner: is there a core.async fn similar to clojure.core/take?

22:18 i.e. take upto N items off the chan, without blocking?

22:18 (or with blocking is fine too)

22:18 I just want more than one

22:18 I can reduce, but that seems like overkill

22:22 blur3d: I 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:22 (sql/insert! db-url :series {:low 1 :high 20} ;; works

22:22 (sql/insert! db-url :series [:low :high] [1 10] [2 8] [3 9]) ;; works

22:22 but I am trying to insert using [[1 10] [2 8] [3 9]]

22:23 the docs have (defn insert! [db table & options])

22:24 is there a way to explode the data into args... or somehow just use a list of rows to insert

22:25 guns: arohner: (repeatedly n (<! chan))

22:25 blur3d: In ruby you could do it with splat *list_of_args... but just not sure in clojure

22:26 guns: blur3d: the corollary of arg splat is apply

22:27 blur3d: ok, but apply takes two args, and splat just one

22:27 ToBeReplaced: (apply sql/insert! db-url :series [:low :high] coll)

22:28 blur3d: yeah, but isn't that going to perform an insert for each one... instead of batching

22:29 ToBeReplaced: blur3d: no - apply is equivalent to your second example above... apply is not map

22:30 gl gotta run

22:30 guns: blur3d: apply executes f with your args, spreading the last one

22:30 blur3d: ok, ill give it a go. thanks

22:33 awesome, works. cheers

22:59 bitemyapp: arohner: what you want is something I called "draining" a channel. Let me know if the repeatedly thing works for your use-case.

23:30 murtaza52: Need help in deploying to clojars. I get the ReasonPhrase: Forbidden. error

23:30 I 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:30 Any help will be appreciated ...

23:35 jph-: is there any clojuresque way to cache results for a period of time

23:36 im using an API and i dont want to go over the limit, plus the results wont chance much in a few seconds

23:36 so i kind of want to cache results and only fetch again after x seconds

23:36 i was thinking of setting an atomic timestamp and checking that... wasn't sure if there was something more elegant available

23:37 arrdem: jph-: there's clojure.core.cache which provides a ttlcache :D

23:37 jph-: arrdem: lovely

23:37 i'll investigate

23:37 so helpful here

23:37 :D

23:38 SegFaultAX: core.cache doesn't get enough love.

23:38 It's an incredibly handy library

23:39 It also happens to be pretty simple.

23:39 jph-: perfect

23:39 arrdem: w00t!

23:40 jph-: 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:41 hence going down some sort of caching path

23:42 murtaza52: Need help in deploying to clojars. I get the ReasonPhrase: Forbidden. error

23:42 blur3d: has anyone had this before when running leon reps :tree

23:42 Possibly confusing dependencies found:

23:42 [clj-time "0.6.0"]

23:42 overrides

23:42 [clj-time "0.6.0"]

23:43 murtaza52: I 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:43 Any way I can debug what is going wrong ..

23:43 jph-: (pst)

23:43 SegFaultAX: murtaza52: Probably an auth problem.

23:43 arrdem: jph-: no need to whisper in here

23:44 jph-: it happened with me when my new machine didnt have config setup for the lib

23:44 arrdem: i mean (pst) stack trace


23:44 jph-: in repl

23:44 arrdem: ~gentlemen

23:44 clojurebot: You can't fight in here. This is the war room.

23:44 jph-: heheh

23:44 danenania: is 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:44 arrdem: SegFaultAX: ~paddlin

23:44 damnit clojurebot, you're supposed to back me up here

23:46 murtaza52: SegFaultAX: jph: http://pastebin.com/FGE9gftb

23:46 arrdem: ~paste

23:47 clojurebot: paste is not gist.github.com

23:47 blur3d: worked it out... was duplicated in my profiles.clj

23:47 arrdem: ~pastebin

23:47 clojurebot: excusez-moi

23:47 arrdem: (dec clojurebot)

23:47 lazybot: ⇒ 32

23:48 SegFaultAX: murtaza52: Probably you don't have the right pubkey registered.

23:48 arrdem: murtaza52: if you changed computers that's extremely likely.

23:48 murtaza52: I had a different pubkey before, I generated a new one this time, and updated it in clojars

23:48 SegFaultAX: Orly?

23:49 murtaza52: orly?

23:49 arrdem: (or yarly barely)

23:49 SegFaultAX: murtaza52: http://4.bp.blogspot.com/-9B5oDjm1wgM/T3gFww7jqlI/AAAAAAAABoY/c79rs-PrfPM/s1600/ORLY+Wallpapers.png

23:50 murtaza52: :)

23:50 I updated both the ssh and the pgp pub keys

23:50 sorry gpg

23:51 SegFaultAX: murtaza52: Well damnit now I'm all confused. Get your g's and p's straight.

23:52 arrdem: HOOOOM. I see that we have avout for distributed atoms & refs, but is there a library for doing a multi-host (pmap)?

23:52 murtaza52: SegFaultAX: its the gpg pub key that I also updated …

23:53 SegFaultAX: murtaza52: I was kidding. :)

23:53 murtaza52: :) I am frustrated …

23:53 SegFaultAX: murtaza52: 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:53 Maybe you registered the wrong pubkey?

23:54 murtaza52: let me a generate a new one and try again

23:56 technomancy: murtaza52: if you are using `lein deploy` and getting Forbidden then its your password that's wrong, not your key

23:56 murtaza52: lein deploy clojars is what I am using

23:57 does that also indicate my password is wrong ?

23:59 sm0ke: guys, can i not call a foo(Object... objs) method in java class , like this in clojure (foo ClassName. "aa" "bb") ?

Logging service provided by n01se.net