#clojure log - May 22 2013

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

0:00 muhoo: friend does both

0:01 it also provides a common framework for authorization/authentication using passwords, openid, and oauth

0:02 if i want to provide one of those annoying race-car screens with a million logos offering different ways to log in, i can't think of a manageable way to do that without friend.

0:03 * muhoo looks into writing a twitter workflow for friend

0:03 tomoj: why not have reducers implement conj?

0:03 some people would abuse it, but.. it would be handy

0:04 oh

0:04 they can't implement the rest of it

0:04 I guess you can just write a conj reducer

0:04 or maybe (r/cat [x] coll) ?

0:05 muhoo: I think ddellacosta has an example

0:09 it would also be cool I think to define a sorted-kv reducer which supports conj

0:09 wish you could add one or two more readers too

0:11 amalloy: yeah, i think it has to be cat [x], tomoj

0:11 certainly you can't implement IPersistentCollection

0:11 tomoj: right

0:12 I remember again rich saying "maybe all we need is conj!"

0:12 except I'm equivocating I think

0:12 (that's not a direct quote)

0:12 muhoo: tomoj: his is for fb and github, yes, i'm looking at it (and modding it)

0:13 tomoj: twitter uses oauth1 tho.

0:13 tomoj: oh, I misremembered twitter being in there

0:15 muhoo: i've done this before, created a workflow for google apps which used a modified openid. it was not fun tho.

0:17 tomoj: :)

0:17 muhoo: i am going to write a library to do this, and i'm going to call it "bird flu"

0:18 sinistersnare: noob to clojure: if noir is deprecated, what can be used that is just as simple?

0:19 muhoo: sinistersnare: there's libnoir. and someone created an attempt at a batteries-included thing to replace noir, but i forget what it's called

0:19 sinistersnare: muhoo: people say compojure, but when i look at that, it seems a lot more complicated than noir

0:19 egghead: sinistersnare: compojure is just routing

0:19 but it's actually the routing lib that noir used

0:20 muhoo: i just write directly to compojure

0:20 egghead: http://www.luminusweb.net/ is the 'batteries included' one but I agree about just using compojure :3

0:21 sinistersnare: muhoo: i understand, but it seems scary D:

0:21 egghead: let me look into that, thanks

0:21 muhoo: sinistersnare: luminus, i think was its name

0:21 pedestal too

0:21 hell, i don't remember

0:21 egghead: pedestal, ya

0:21 muhoo: sinistersnare: it's not scary. it's just functions :-)

0:22 egghead: that one is all kinds of involved tho

0:22 but at least it's cljs :)

0:22 brehaut: egghead: strangely enough, compojure doesnt do the actual routing either :P

0:22 muhoo: i had a bad experience that made me suspicious of any big framework

0:22 brehaut: thats clout

0:22 sinistersnare: i come from python/java and i really wanna get into FP.

0:23 muhoo: sinistersnare: then learn ring, and how compojure is built on ring. it'll take you longer, but ring is beautifully functional

0:23 egghead: ^

0:23 sinistersnare: that may take a while, but thanks!

0:23 good to know

0:23 brehaut: sinistersnare: http://brehaut.net/blog/2011/ring_introduction

0:23 sinistersnare: brehaut: thanks!

0:23 brehaut: its a little out of date on specific versions, but it covers all the basics

0:23 sinistersnare: i like how thats your thing

0:24 brehaut: yeah sorry to toot my own horn

0:24 sinistersnare: its fine, i dont mind, its a good read

0:25 brehaut: biggest change id make if i edited it, is my comment about preferring moustache for routing. ive changed my mind and prefer compojure

0:25 sinistersnare: brehaut: ok, ill remember that

0:25 i dont know why, but i convinced my girlfriend to learn programming, and my time is being taken up on that

0:26 so ill just have all of these tabs ssaved

0:26 muhoo: brehaut: could you edit it and add that note?

0:26 brehaut: muhoo: i guess i should

0:26 bit of a pain though; i broke my metaweblog post editing endpoint :/

0:27 sinistersnare: :(

0:27 brehaut: obviously i should fix both

0:28 just remember, friends dont let friends do xml-rpc

0:28 muhoo: something tells me that your blog is backed by a db somewhere

0:28 brehaut: muhoo: it is indeed

0:28 muhoo: i've brute forced stuff like that by using an sql console

0:28 "just gimmme the damn data!"

0:28 brehaut: muhoo: lol

0:28 pgadmin to the rescue

0:30 what could go wrong

0:31 muhoo: i've never had a problem with that

0:31 watch your escaping tho

0:31 brehaut: i accidentally destroyed all my code formating last time i edited something in pgadmin

0:32 (which lets me sidestep the escaping problem)

0:32 muhoo: i'd dump the string with a psql select, edit it in $EDITOR, then slap quotes around it and put it in an update statement. but i am a violent man sometimes.

0:33 did that in wordpress once when a bunch of links went stale. just wrote one SQL statement that changed them to the new location. much easier than clicking around in WP for an hour changing a bunch of links one by one

0:34 brehaut: hah

0:34 you are brave to tackle the wordpress schema imo

0:34 muhoo: i got lucky. the links were all in one field, and it had nothing else in it, IIRC

0:34 brehaut: phew

0:36 muhoo: this was like 2007 tho. maybe it's gotten worse.

0:36 bairui: hand-editing sql updates against a hostile schema with backups isn't bravery but rather prudence :p

0:36 muhoo: come on guys, it's just SQL :-P

0:36 brehaut: i have been lucky enough to not have used wordpress in years

0:37 muhoo: how could anyone writing in clojure be scared of SQL

0:37 brehaut: lol

0:37 muhoo: my blog is still in wordpress. i have no need to change. blogging peaked and mostly ended in 2010, AFAICT

0:38 i think my last blog entry was early 2011 or something

0:38 brehaut: wait, blogging in general, or just for you?

0:39 muhoo: in general, AFAICT. it was a steep drop-off after 2010. i blame twitter and FB

0:39 brehaut: muhoo: updated as requested

0:39 muhoo: brehaut: thanks!

0:40 brehaut: i do need to find time to update all the code samples to use modern clojure and lib versions

0:40 muhoo: second-order issue :-)

0:40 brehaut: heh

0:40 i like to think that at least it states the dependancies explicitly, so its not a surprise to anyone

0:41 muhoo: by the way, thank you for that particular entry. it helped me get started with clojure web stuff last year.

0:41 brehaut: no problem, glad it helped

0:46 bairui: sql isn't scary; live updates against a production schema without backups is. for a personal blog, the cost is negligible; for systems that are attached to your paycheck... better not.

1:01 avishai: hi

1:01 a question about agent error-handlers

1:01 suppose i want to restart the agent to a sane state

1:01 restart-agent isn't allowed in error-handlers

1:02 so i have to either queue that action to some supervisor

1:02 or instead of restarting (send a (fn [_] new-state))

1:03 send doesn't :clear-actions

1:03 and having a supervisor feels unclean

1:15 amalloy: avishai: if your error-handler, which is called immediately from the agent, is going to unconditionally restart it immediately, why not just send the agent an action that never causes an error state? (defn send-and-fix [agent f reset-value & args] (send agent #(try (apply f % args) (catch Throwable t reset-value))))

1:16 i don't recommend automatically restarting agents anyway, but if you were going to then you might as well just force them to never enter an error state

1:19 avishai: yes, i guess a wrapper function would be an easy solution

1:21 btw, how can i print clojure data structures in reader format?

1:22 brehaut: ,(prn {:a [1 2 "three"]})

1:22 clojurebot: {:a [1 2 "three"]}\n

1:26 avishai: brehaut, 10x!

1:27 amalloy, what is the common use case for error handlers?

1:27 in many cases restart is necessary to preserve linearity

2:22 ddellacosta: how do I get the metadata associated with a namespace? Specifically trying to figure out the version of a lib in the repl.

2:24 Hmm, this gives me author and doc: (meta (ns-name 'clojure.core.cache))

2:25 tomoj: it shouldn't..

2:25 ddellacosta: I guess I don't have version info there

2:25 no?

2:25 clojurebot: no is tufflax: there was a question somewhere in there, the answer

2:25 ddellacosta: haha

2:25 tomoj: &(meta (ns-name 'clojure.core))

2:25 lazybot: ⇒ nil

2:25 tomoj: &(meta (find-ns 'clojure.core))

2:25 lazybot: ⇒ {:doc "Fundamental library of the Clojure language"}

2:25 ddellacosta: woah

2:25 tomoj: &(class (ns-name 'clojure.core))

2:25 lazybot: ⇒ clojure.lang.Symbol

2:25 ddellacosta: &(meta (ns-name 'clojure.core.cache))

2:25 lazybot: java.lang.Exception: No namespace: clojure.core.cache found

2:25 ddellacosta: d'oh

2:26 Can I use in this?

2:26 &(use 'clojure.core.cache)

2:26 lazybot: java.io.FileNotFoundException: Could not locate clojure/core/cache__init.class or clojure/core/cache.clj on classpath:

2:26 ddellacosta: yep

2:26 ro_st: yogthos|away: thanks for the speedy lib-noir update :-)

2:26 ddellacosta: anyways, I wonder what version of core.cache I'm using.

2:26 tomoj: oh, I see

2:26 ddellacosta: there's probably more productive ways to figure it out.

2:26 heh

2:26 tomoj: interesting

2:27 really weird

2:27 don't do that

2:27 :)

2:27 ddellacosta: hahaha

2:28 tomoj: ,(ns ^{:doc "foo"} foo)

2:28 clojurebot: nil

2:28 tomoj: ,(meta (ns-name 'foo))

2:28 clojurebot: nil

2:28 amalloy: ddellacosta: yeah, namespaces have no idea what their version is, except in the unlikely case someone goes to the trouble of updating the ns form for every release

2:28 instead, lein deps :tree shows you all the dependencies and versions you have, and why

2:28 tomoj: well, I dunno what's goin on with clojurebot

2:28 ddellacosta: amalloy: yeah, I think I remember seeing it somewhere so I ended up assuming it was consistent in the metadata

2:28 tomoj: but it looks like sometimes the metadata is left on the name of the ns

2:29 ddellacosta: tomoj: well, I'll stop trying to break it. heh

2:29 tomoj: but it might disappear if someone alter-meta!'s..

2:29 ddellacosta: haha

2:29 tomoj: not that people tend to do that

2:29 or maybe clojure.core is just a special case

2:29 in any case, look for ns metadata on the ns, not its name

2:30 ddellacosta: yeah, I mean, really I'm just trying to debug clojure.core.cache, and that led me to trying to pull the source, which led me to try to figure out what version I'm running, which led me to this...

2:30 tomoj: ah!

2:30 amalloy: tomoj: huh? in what cases is there metadata on the symbol naming a namespace?

2:30 ddellacosta: but I think I'll just explicitly put it in my project.clj and shortcut the whole thing

2:31 tomoj: https://www.refheap.com/paste/ef09e6fc74ab7122b1c59323f

2:31 ddellacosta: amalloy: this works for me in the repl: (meta (ns-name 'clojure.core.cache))

2:31 it gives me {:author "Fogus", :doc "A caching library for Clojure."}

2:32 tomoj: that's just a coincidence, ignore it :)

2:32 amalloy: &(doc ns-name)

2:32 lazybot: ⇒ "([ns]); Returns the name of the namespace, a symbol."

2:32 amalloy: ns-name on a symbol shouldn't even work at all, should it?

2:32 tomoj: well it calls the-ns on whatever you pass it

2:32 presumably to make that work

2:33 amalloy: the-ns, or find-ns?

2:33 tomoj: the-ns

2:33 amalloy: &(doc the-ns)

2:33 lazybot: java.lang.SecurityException: You tripped the alarm! the-ns is bad!

2:33 amalloy: ,(doc the-ns)

2:33 clojurebot: "([x]); If passed a namespace, returns it. Else, when passed a symbol, returns the namespace named by it, throwing an exception if not found."

2:33 tomoj: ,(ns-name 'foo)

2:33 clojurebot: foo

2:33 tomoj: er

2:33 ,(ns-name 'frobniz)

2:33 clojurebot: #<Exception java.lang.Exception: No namespace: frobniz found>

2:33 tomoj: ,(ns-name 'clojure.core)

2:33 clojurebot: clojure.core

2:34 amalloy: ,(the-ns clojure.core)

2:34 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.core, compiling:(NO_SOURCE_PATH:0:0)>

2:34 amalloy: huh. somehow i remembered the-ns being a macro

2:34 ddellacosta: naw, it's pretty simple isn't it, never looked at it before

3:28 dabd: The following function causes a stack overflow. https://gist.github.com/dabd/5625808. Perhaps a problem in the implementation of 'split-with'?

3:30 tomoj: no, it's building up so many concats

3:31 if you replace the concat with (into (vec left) (cons new-val right)) to make it eager, it will work

3:31 not that that is a very good implementation

3:31 dabd: yes i just found the problem is wih concat which builds lazy seqs

3:32 tomoj: what are you trying to do? looks like just a sort?

3:32 dabd: similar problem here: http://stackoverflow.com/questions/9814892/insertion-sort-in-clojure-throws-stackoverflow-error

3:33 tomoj: oh just for fun?

3:33 dabd: yes i should do a sort-by instead

3:55 wei_: does anyone have an example of a friend facebook example with a splash page? the given example goes straight to the facebook auth page

3:55 callen: wei_: this is #clojure not #facebook_support

3:56 wei_: oh you mean the library Friend

3:56 ddellacosta: wei: are you talking about setting up friend to use with facebook authentication?

3:56 wei_: check this out. https://github.com/ddellacosta/friend-oauth2-examples

3:56 callen: ddellacosta: neat.

3:57 ddellacosta: wei_: you'll need to use my friend-oauth2 lib, and I really really need to push the csrf stuff to production...

3:57 callen: thanks.

3:57 damn, I should do that right now while I'm thinking of it

3:58 callen: ddellacosta: I'm considering adding facebook auth to a project of mine but find Friend overbearing

3:58 #first_world_problems :(

3:58 wei_: thanks! i've been using your library. i was wondering how to extend the example to route unauthorized users to a page with the facebook login button, instead of directly to the auth dialog

3:58 ddellacosta: callen: I mean, I like it, but I can understand how you would think that. But, I come from Rails land, so it's light for me…haha

3:59 wei_: oh, that shouldn't be too hard--that's baked in Friend functionality, I think you should just be able to reset the login link

3:59 um, one sec

3:59 wei_: yep!

4:00 tomoj: it looks like it is not safe to bind Compiler/LOCAL_ENV to a map with non-LocalBinding values

4:00 during macroexpand

4:00 :(

4:00 ddellacosta: where the heck is that

4:00 ah, here you go

4:00 wei_: check this line out: https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj#L173

4:01 wei_: friend lets you pass in a number of configuration arguments when you set up your workflow in the main handler

4:02 wei_: login-uri is one of those. You should be able to just reset that to any path of your choosing. But, if you need more complex behavior you can pass in a function to override default-unauthenticated-handler.

4:05 callen: ddellacosta: the workflow nonsense is part of my problem.

4:05 ddellacosta: callen: what don't you like about it?

4:05 wei_: would I still use oauth2/workflow? I added the :login-uri "uri" but it's not redirecting

4:05 callen: ddellacosta: I come from Django and Flask, Friend doesn't have a good overhead/value ratio.

4:06 ddellacosta: wei_: hmm, hopefully I'm not wiping that config, it should work as is though

4:07 callen: ah, yeah, I'm less familiar with those so I can't compare. I mean, I was looking for something like Rails's devise gem when I first started working with it, and it was the closest thing out there

4:07 callen: it took me a bit of time to wrap my head around, but I like it now. But that may because I spent so much time wrapping my head around it to write the oauth2 lib. Stockholm syndrome perhaps. ha

4:08 amalloy: tomoj: IMO even if it worked, it would be disastrously unsafe to bind Compiler/LOCAL_ENV to anything at all

4:09 tomoj: I don't understand Compiler much at all

4:09 wei_: ddellacosta, btw your library saved the day during my last hackathon, got facebook auth working quickly

4:09 ddellacosta: wei_: sweet! Super happy to hear that someone is using it.

4:09 wei_: but i don't think i understand it fully so I'm paying the price now when I'm trying to change something like the landing page, haha

4:09 tomoj: I've doven in and understood seemingl many small parts of it but still don't understand it at all..

4:10 clojure.tools.macro pretty much does what I'm looking for I think

4:10 .. just reimplement macroexpansion

4:10 ddellacosta: wei_: haha…the code be nicer in any case, so that doesn't help if you are trying to grok it. Anyways, I've got a branch I've been waiting to push with CSRF protection baked in, I may try and push that in the next day or so.

4:10 wei_: unfortunately :login-uri is not having an effect, should I change unauthenticated-handler too?

4:11 tomoj: ddellacosta: btw, thanks, for fb example was extremely helpful to me

4:11 ddellacosta: wei_: still trying to find the answer to that question…worrying I'm killing it. Sorry, gimme one sec.

4:11 tomoj: any plans to just make it into a little library? :)

4:11 ddellacosta: tomoj: great! you're very welcome.

4:11 tomoj: huh, do you think that'd be useful? I guess it could be huh?

4:11 tomoj: I pretty much did

4:12 ddellacosta: nice. haha

4:12 tomoj: but felt uncomfortable doing it since I copied so much from you

4:12 so uh I hope the license on that is open

4:12 ddellacosta: meh, that's open-source so no worries.

4:12 yeah, MIT I believe, so pretty permissive.

4:12 no, that's totally the intent.

4:12 tomoj: can I EPL mine? I hate licenses

4:12 or if you release one I won't have to

4:12 :)

4:13 ddellacosta: sure, go for it!

4:13 ah, yeah, I have it under MIT.

4:13 I have no idea what the deal is with changing the license from a legalistic point of view, but I certainly have no problem if you do that personally.

4:14 tomoj: I guess it would be unwise to just blindly follow the masses and choose EPL

4:14 ddellacosta: wei_: sorry, still looking through my code to figure out what the deal is with login-uri

4:14 tomoj: I don't know anything about it

4:14 ddellacosta: heh

4:14 tomoj: I can't afford to hire a lawyer to tell me which to pick for my stupid little project..

4:14 wei_: ddellacosta: thanks for the help

4:15 ddellacosta: I read something on the clojure list recently that laid out the differences pretty well

4:15 but basically, MIT is super permissive

4:15 and EPL gives the author more rights I think

4:15 = my expert legal analysis

4:16 wei_: ah, okay, so it really shouldn't have anything to do with my lib

4:16 wei_: just make sure you are passing it into friend/authenticate

4:17 wei_: if you want to send me a gist or something I can take a look at how you're defining it and try to help

4:18 tomoj: I looked and realized I never finished my library extraction

4:18 because I already had something working in friend-less vanilla ring

4:18 callen: :D

4:19 SegFaultAX: Be extremely careful about taking advice on software licensing. Most people have an inaccurate, incomplete, or incorrect understanding of software licenses.

4:19 tomoj: but I think I'll just port to 'vanilla' interceptors because ring has been awkward with what I'm doing and

4:20 s/ and//

4:20 wei_: ddellacosta: here's my routes, it's a little long-winded https://gist.github.com/yayitswei/5626017

4:20 thanks again

4:21 ddellacosta: tomoj: I agree w/SegFaultAX re taking advice on licensing, especially mine

4:21 tomoj: I am acquainted with a software lawyer

4:21 does 'most people' include them? :)

4:21 ddellacosta: wei_: huh, okay

4:22 SegFaultAX: tomoj: The EFF also provides channels for getting advice on this topic if it really matters.

4:22 tomoj: isn't the EFF always going to tell me to use GPL

4:22 SegFaultAX: No.

4:22 ddellacosta: wei_: you know, I may be killing login-uri, in the older lib, I apologize

4:22 tomoj: oh did I mix them up with FSF

4:22 SegFaultAX: tomoj: I doubt the FSF would either.

4:23 tomoj: how about stallman?

4:23 SegFaultAX: Hah.

4:23 He'd definitely tell you to use a proprietary license.

4:29 callen: tomoj: :)

4:30 tomoj: callen: I think I'm going to try ripping interceptors out of pedestal..

4:30 callen: tomoj: solid.

4:30 tomoj: let me know how it goes.

4:31 tomoj: seemed like one of the few things worth salvaging.

4:31 tomoj: I still gotta try it to learn about the rest

4:31 clj-http also leaves me unsatisfied

4:32 I got core.async working so that is tempting

4:32 callen: tomoj: I haven't needed interceptors because the raison d'etre is something I've avoided via small and dirty trick.

4:33 tomoj: what's the trick?

4:34 callen: tomoj: request context (across middleware) that is forced to fetch data dependencies in parallel

4:35 which is hypothetically the only reason I'd want interceptors - multi-threaded request processing. Realistically, I just need to fetch data in parallel that is needed in more than one stage of request processing.

4:40 tomoj: this is partly why I was so hellbent on my request context thing - enables the avoidance of worse complexities.

4:40 tomoj: learned that lesson from Django and Flask.

4:43 SegFaultAX: Interceptors seem pretty complicated.

4:43 tomoj: so what I've seen in flask is you have a Pool or whatever

4:44 which is basically what I'm doing now, I put tasks onto an executor

4:45 in this case actually a flask app notices the output of those tasks so I just blackhole them..

4:47 but I have a bunch of stuff just synchronous that I really don't want

4:47 SegFaultAX: I didn't follow that bit above about flask at all.

5:15 tomoj: SegFaultAX: what bit?

5:19 now persona tells me I don't have cookies enabled in conkeror

5:34 Anderkent: So... (-> a-sorted-map rseq first key) or ((comp key first rseq) a-sorted-map)? #bikeshed-colors

5:50 tomoj: https://www.refheap.com/paste/c674e1ffbb91c5af973a423c7

5:59 kral: namaste

6:14 amalloy: Anderkent: false dichotomy. why not, for example, (key (-> m rseq first))? they all do the same thing, but this makes the "key" part of it more prominent

6:22 Anderkent: hm, yeah, that slightly better than just the threading form.

6:27 tomoj: there seems to be no way to tell that a channel is closed

6:27 except maybe trying to put and catching an exception..

6:29 callen: tomoj: that's not true

6:29 tomoj: just add a trigger callback for the channel's closing

6:29 tomoj: I'm talking about core.async, are you talking about lamina?

6:29 callen: dammit. sorry.

6:29 tomoj: no, my fault

6:30 'channel' should probably mean at least 80% lamina for the time being :)

6:30 callen: tomoj: it's WIP, file an issue.

6:30 ddellacosta: callen and tomoj: where in the world are you guys? It seems like you're roughly on the same schedule I am, or else you are just up super late.

6:30 callen: tomoj: 4rlz. if something doesn't make sense, make a documented query.

6:30 ddellacosta: It's 0323 where I am. I'm awake because I'm the goddamn Batman.

6:30 ddellacosta: haha. gotcha.

6:30 tomoj: I never can tell whether a missing feature is supposed to be missing

6:30 callen: green tea and beef stew to keep me company.

6:30 ddellacosta: mm, sounds good.

6:31 callen: tomoj: "supposed to be" is sophistry. File an issue.

6:31 ddellacosta: it's golden oolong. Delicious tea.

6:31 tomoj: the world needs to at least know it's a problem through the documented issue

6:31 tomoj: you think relevance/rich want to field questions in github issues?

6:31 callen: tomoj: even if they refuse to fix it.

6:31 ddellacosta: callen: ha, I'm drinking oolong cold right now. Love oolong in general.

6:31 callen: tomoj: sigh. are they doing that bullshit on JIRA too?

6:31 tomoj: no, there's no jira last I checked

6:31 callen: ddellacosta: oolong is probably my favorite. I used to be into pu-ehr big time but less so these days. Probably because the quality of tea upgraded.

6:32 ddellacosta: gotcha.

6:32 tomoj: my guess would just be that they'd rather just keep their heads down and push it out, then answer questions later

6:32 callen: tomoj: just file an issue and if you get redirected, do the appropriate copy-pasta.

6:32 tomoj: urufkjdsfnkjdnjhh

6:32 tomoj: what happened to fast-iterations and early feedback?

6:32 tomoj: what do you think will distract them more, a polite querying issue from you?

6:32 tomoj: or an angry blustery trolling from me?

6:33 tomoj: file the issue...

6:33 tomoj: or else? :)

6:33 callen: tomoj: come on, you've seen me in here.

6:33 but realistically, I don't want to bother Rich either. One of the nicest people on the planet.

6:34 tomoj: but it needs documented. so do it or I will :P

6:35 tomoj: okay so why can't you access the closed mutex?

6:35 tomoj: ManyToMany channel right?

6:35 tomoj: I'm making a patch that adds closed? by doing that now

6:35 well closed is an atom

6:36 so for closed? I wonder if you even need to grab the mutex

6:36 callen: tomoj: well that's what puzzled me, I figured you could just grab the mutex.

6:36 tomoj: (.mutex chan) ?

6:37 callen: I don't know the exact API, I'm just pilfering through the core.async code.

6:37 tomoj: I thought timeout was another chan impl but looks like it is just another MMC, so I guess you could rely on MMC specifics

6:38 callen: the quick-n-dirty is definitely a wrapper-fn that handles the catching and wrapping of failed put!, but I still think you can just read mutex state.

6:38 which would make *me* happier anyway.

6:38 abusing exceptions in clojure makes me feel stupid unless it's to paper over bad java code.

6:38 I intentionally avoid loading slingshot partly for that reason

6:39 tomoj: wait

6:39 closed? can't be there

6:40 see, a bit of thinking saved rich 10min or whatever :)

6:40 (if (closed? c) (<! c) ...) this seems useless

6:40 callen: tomoj: hrm?

6:41 https://github.com/clojure/core.async/blob/master/src/clj/core/async/impl/ioc_macros.clj this perked me up

6:42 inversion of control has been an on-and-off again subject here

6:42 I saw a mention of monads

6:42 I'm very curious about this code.

6:42 tomoj: oh, I hadn't figured out what "ioc" stood for

6:43 I can't help wondering whether we really need a monad though

6:43 callen: tomoj: you haven't spent enough time around java nerds.

6:45 tomoj: "The moral is this: if you’ve got an Applicative functor, that’s good; if you’ve also got a Monad, that’s even better! And the dual of the moral is this: if you want a Monad, that’s good; if you only want an Applicative functor, that’s even better!"

6:45 callen: oh it seems useless because the channel might have been closed in between the time you checked and the time you <!

6:45 then you will receive a nil and think it was actually a nil message

6:47 callen: the likelihood of a timing issue approaches nil, but you should file an issue and query about it.

6:49 tomoj: wilco

6:49 I just thought of a nice solution I think, though, so still thinking for a bit

6:52 callen: https://github.com/clojure/core.async/issues/3

6:53 mindbender1: Please can someone throw more light on what a pure function is?

6:53 or is not

6:54 tomoj: hmm, my first thought was "meaning of the return value is a function of the meanings of the arguments"

6:54 but that seems to beg the question :)

6:54 clgv: mindbender1: A pure function always returns the same result when called with the same arguments

6:55 mindbender1: even shorter but using a second term: a function without side-effects

6:55 tomoj: which presupposes a sound meaning for 'same' on the argument and result types

6:56 'without external side-effects' maybe?

6:56 clgv: tomoj: if you need a lawyer definition, yes ;)

6:56 mindbender1: clgv: even if its computation is not fully dependent in the totality of its argument?

6:56 on

6:58 maybe like reference something that's not local

6:59 tomoj: it doesn't matter how, just what

6:59 mindbender1: tomoj: makes sense

7:00 tomoj: another example, a pure function can use aset or set! or transients or something

7:00 mindbender1: and *what* almost always refer to the return value?

7:00 tomoj: as long as the impurity doesn't leak out of the function

7:01 what matters is 'same args => same return' like clgv said

7:01 mindbender1: tomoj: can you please give an example of impurity leaking out of a function?

7:02 tomoj: (fn [coll] (conj! coll 3))

7:02 it takes a transient and mutates it and then returns it

7:02 so people who call it have to worry about side-effects

7:02 clgv: tomoj: huh? why?

7:03 tomoj: it doesn't take or return values

7:04 clgv: it always adds a 3. if you provide the same transient each time you'll get the same result

7:04 mindbender1: 3 is a constant

7:04 tomoj: there's no such thing as 'same transient'

7:04 &(= (transient []) (transient []))

7:04 lazybot: ⇒ false

7:05 clgv: well, rephrase it to euqality in terms of clojures immutable datastructures

7:05 tomoj: you can't implement equality on a transient

7:05 except by identity

7:05 clgv: &(let [f (fn [coll] (conj! coll 3))] (println (f (transient [1 2]))) (println (f (transient [1 2]))))

7:05 lazybot: ⇒ #<TransientVector clojure.lang.PersistentVector$TransientVector@464462> #<TransientVector clojure.lang.PersistentVector$TransientVector@13396b0> nil

7:05 tomoj: which is not an acceptable meaning for 'same' in the definition we gave of a pure function :)

7:06 clgv: &(let [f (fn [coll] (conj! coll 3))] (println (persistent! (f (transient [1 2])))) (println (persistent! (f (transient [1 2])))))

7:06 lazybot: ⇒ [1 2 3] [1 2 3] nil

7:06 tomoj: clgv: https://www.refheap.com/paste/f64dd676ba2acc5986fa61436

7:06 clgv: I'd say that is clearly the behavior of a pure function

7:07 tomoj: it's not even in the running

7:07 the plane crashed and exploded on the runway

7:08 clgv: lol, ah k. I see what I forgot

7:08 tomoj: speaking of which, channels!

7:08 :/

7:11 mindbender1: so if I understand correctly, equality of output for the same arguments defines a pure function?

7:11 clgv: mindbender1: do you ask for an academic definition or just to understand the concept?

7:11 tomoj: http://en.wikipedia.org/wiki/Pure_function

7:11 it also can't send you an e-mail

7:12 clgv: tomoj: in combination with agents it can ;)

7:12 ah transcations and agents I mean

7:12 tomoj: the agent handles that

7:12 clgv: yep

7:12 tomoj: not the pure function :)

7:12 mindbender1: clgv: I'm worried because when I read a doc and someone says there function is pure I don't really know how to evaluate that statement for truthiness

7:13 clgv: mindbender1: if it reads or changes globals, this is a good hint that it is not pure

7:13 mindbender1: tomoj's transient example is another to look out fot

7:13 mindbender1: yeah

7:13 tomoj: 1) it has to take values as args and return a value

7:14 2) it can't affect important parts of the rest of the program/system/world

7:14 clgv: mindbender1: closures with atoms are another hint

7:14 tomoj: oh and yeah, uh, same args => same return

7:14 mindbender1: I was waiting for that clgv

7:15 tomoj: but memoize has a closed-over atom, and it is pure and returns a pure function

7:15 clgv: mindbender1: counter example: (let [f (let [c (atom 0)] (fn [] (swap! c inc))] (println (f) (f)))

7:15 &(let [f (let [c (atom 0)] (fn [] (swap! c inc))] (println (f) (f)))

7:15 lazybot: java.lang.RuntimeException: Unmatched delimiter: ]

7:16 clgv: &(let [f (let [c (atom 0)] (fn [] (swap! c inc)))] (println (f) (f)))

7:16 lazybot: ⇒ 1 2 nil

7:17 clgv: tomoj: well, it is an edge case. in a strict "pure function" definition considering the whole context it is not pure. it will allocate more and more memory for the cache

7:18 tomoj: if you just limit it to the function call you can call it pure

7:18 tomoj: hmm, yeah

7:18 I almost said "arguably"

7:18 I chose "important" above carefully

7:19 lazy seqs are kinda weird too

7:19 I wouldn't say they're an edge case though

7:20 clgv: but memoize can be important in that sense if the used parameter domain is too large for memory but still only sparse in the whole parameter domain

7:20 tomoj: yeah

7:20 clgv: luckily there is core.memoize ;)

7:22 mindbender1: thanks

7:23 tomoj: mindbender1: http://en.wikipedia.org/wiki/Referential_transparency_(computer_science)

7:35 mindbender1: referentially opaque! :) Thanks tomoj, was helpful.

7:45 xificurC: leiningen installation on Windows day 3: a new clean attempt with lein.bat downloads the lein jar, no errors. Running `lein repl` in the cmd starts the repl with an initialisation error java.lang.IllegalArgumentException: Unknown signal: CONT at com.bim.misc.AbstractSignalInfo.GetSignalNumber(AbstractSignalInfor.java:59)

7:46 and `lein new first`just keeps hanging and never finishes

7:46 any tips?

7:46 Anderkent: which jar did it download?

7:47 https://github.com/technomancy/leiningen/issues/1172 seems possibly related?

7:47 xificurC: leiningen-2.1.3-standalone.jar

7:49 Anderkent: java 6 or java 7?

7:49 xificurC: 6

7:50 Anderkent: ok, as a hotfix try `lein upgrade 2.1.0`

7:51 (apparently that might not work on windows, so try just downloading https://github.com/technomancy/leiningen/blob/2.1.0/bin/lein.bat and using that instead)

7:51 as you might notice, windows is definitely a second-class citizen for lein :P

7:51 Once you get it working, you should probably post a comment to https://github.com/trptcolin/reply/issues/37 and/or https://github.com/technomancy/leiningen/issues/1121

7:53 xificurC: Anderkent: trying out thanks a lot

7:54 Anderkent: unfortunately i cant switch to linux at work

7:54 mindbender1: xificurC: fortunately you can run windows within linux from virtualbox ;)

7:55 Anderkent: it's also supposed to work better with cygwin

7:57 xificurC: mindbender1: i cant reinstall my pc just like that heh

7:58 Anderkent: I could try that too. I tried to install leiningen via the linux lein script but I hit in some thick walls when I tried to get nrepl working on emacs

7:58 ucb: can anybody share an example of the entries I need to add to my project.clj to be able to push to clojars? If I try to push with no entries at all in there, it'll ask me for username/password the first time. Subsequent times will fail with a NPE :(

7:59 interestingly enough, "upgrading" leiningen fixes the NPE even if the upgrade is a noop

7:59 lotia: exit

7:59 Anderkent: ucb: probably because it tries to cache the credentials

7:59 lotia: \q

7:59 ucb: Anderkent: possibly

7:59 haven't looked into it :)

7:59 I'd still like to not have to type these credentials in every time :)

8:00 Anderkent: did you try `lein help deploying` ?

8:01 ucb: Anderkent: I did. I've read it all, but it's mostly about private repos? Perhaps I missed it.

8:01 Anderkent: there's a bit about authentication in the middle

8:01 https://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md might be nicer to read

8:02 :q

8:02 oups

8:03 ucb: thanks Anderkent, will read

8:04 Anderkent: basically you want a ~/.lein/credentials.clj.gpg so that you don't have to type the creds every time

8:04 xificurC: Anderkent: even with the provided batch file it downloaded 2.1.3, I even checked the file and it explicitly asks for 2.1.0

8:06 Anderkent: xificurC: can you post the output somewhere?

8:07 xificurC: Anderkent: I realised I had a LEIN_JAR environment variable that might have caused the issue so I deleted it and am trying again

8:26 Grievre: Why is Clojure so much more popular than kawa?

8:26 (I've never used either, I'm just curious)

8:32 clgv: Grievre: is it? what source did you read?

8:35 Grievre: I found a discussion on stackoverflow: http://stackoverflow.com/questions/1413390/why-clojure-over-other-jvm-lisps-kawa-armed-bear-or-sisc

8:37 Grievre: clgv: I mean I'm just going off of the fact that I hear clojure mentioned fairly often and kawa very rarely

8:40 dnolen`: Grievre: probably because it's yet another Scheme variant, Clojure offers quite a few enhancements over Scheme.

8:41 xificurC: Anderkent: same issues with 2.1.0

8:43 Grievre: dnolen`: Like?>

8:43 Like?

8:44 dnolen`: Grievre: better data structures, better concurrency support, multimethods, protocols, sensible module system, reducers, etc etc

8:54 tomoj: callen: "nil messages are not supported by design" - this is what I expected :)

8:59 trptcolin: xificurC: reading the logs - looks like you're getting a CONT error? that should have already been handled as of lein 2.0.0 (and REPLy 0.1.0). mind pasting the full stack trace on refheap.com?

9:00 it sounds like an error that existed in lein 2.0.0-preview2 and older

9:01 https://github.com/trptcolin/reply/issues/37

9:01 xificurC: trptcolin: give me a minute ill try to get the error again

9:01 trptcolin: also, does `lein version` verify that you're not actually using an older lein version?

9:02 xificurC: ok

9:04 xificurC: `lein version` shows Leiningen 2.1.3

9:05 however I do have a Java 1.6.0 IBM version

9:05 can I copy the stacktrace from cmd?

9:06 trptcolin: xificurC: yes, please do

9:08 xificurC: trptcolin: https://www.refheap.com/paste/14878

9:13 wink: this is really interesting: http://prog21.dadgum.com/41.html

9:14 xificurC: trptcolin: cygwin managed to create a new project with `lein new first` so I cd'd in and tried `lein repl` there, here is the result: https://www.refheap.com/paste/14879

9:20 trptcolin: xificurC: the second error is probably https://github.com/technomancy/leiningen/issues/1121

9:23 the first one is annoying but it appears things are actually working after it finishes starting up - is that correct?

9:25 xificurC: trptcolin: yes it does indeed

9:27 trptcolin: I tried to get leiningen working by now through cmd, cygwin and git bash, none of them produced a full solution as in: be able to run the repl, be able to lein repl in a new project, be able to M-x nrepl-jack-in in emacs

9:27 I could live without the last one but the first two should work

9:29 trptcolin: ok, i need to drop off and get ready to head in to work. there have been several windows issues fixed since 2.1.3, so hopefully you'll find fewer issues in 2.2.0 when it's out in the next week or two.

9:29 xificurC: trptcolin: thanks for the support, I can wait for that :) Also I will try and look if I can get jre 7 on my pc

9:31 clgv: xificurC: do you use Eclipse+CCW on windows?

9:31 trptcolin: for that stack trace, i don't see that on 2.1.3 on my windows VM, so i almost wonder if there could be some special :repl-options or :init-ns settings (whether in the project or in $HOME/.lein/profiles.clj) that are trying to set that signal handler but not catching the error. the "Got throwable in Signal initialisation" doesn't appear to be a message ever generated by reply, as far as i can tell.

9:32 xificurC: clgv: no and I dont know what it is

9:32 trptcolin: actually in googling that, looks like an IBM JDK-specific thing. perhaps they print the error themselves rather than bubbling an exception up like reasonable people?

9:33 clgv: xificurC: in case you are not sold to emacs: Eclipse with the Counterclokwise plugin is a Clojure IDE which has basic leiningen integration.

9:33 xificurC: trptcolin: that is possible, I am no real programmer to answer that though

9:33 trptcolin: I'd just like to learn

9:34 clgv: xificurC: task support for uberjar or install is still missing AFAIK but you can start developing rightaway

9:35 xificurC: clgv: i'd like to stay loyal to emacs to be honest, but if i wont be able to get it running I'll remember this option, thanks a lot

9:38 clgv: xificurC: yeah, if you cant get it running soon, just try CCW so that you do not have to wait until the next leiningen release just to start learning

9:39 xificurC: clgv: yeah the moment I lose all my nerves I'll do that :)

9:40 noncom: hi, i need to calculate 3 values from each number in a sequence, and all the results have to be in a vector. what is the best way? currently i do this: http://pastebin.com/8nv99LpE but it takes too long. I do not like: 1) it is taking long, 2) it uses (nth), 3) the result is a vector where each element is a vector with 3 elements (x, y and z) and flattening it with (flatten) takes rather long too

9:40 any suggestions on possible improvements?

9:43 oh, please discard the first concern - it takes too long because of the subsequent flatten, not by itself. so only points 2 and 3 are of question

9:46 ummm.. anyone?

9:46 trptcolin: xificurC: unfortunately the IBM jvm isn't open source and i have the sun jvm in my windows vm, so i'm at a bit of a dead end w/ that error.

9:47 but i suspect it's just printing to stderr. if you're tied to the ibm jvm perhaps you can find some jvm flags to pass to avoid having it print that garbage. but i don't think it's actually propagating that exception all the way up to REPLy, just the printing

9:48 xificurC: trptcolin: oh nevermind go do something more useful than taking care of my errors, you helped me enough by now. I will try to upgrade my jre hopefully tomorrow and see if it brings better results

9:49 also that stacktrace only printed in plain cmd, when I ran the command via Console I didnt get the stacktrace printed

9:58 chronno_: nomcom: maybe something like (mapv (juxt dec identity inc) (range 10))

9:59 nomcom: juxt returns the vector you want

10:00 ,(mapv (juxt dec identity inc) (range 10))

10:00 clojurebot: [[-1 0 1] [0 1 2] [1 2 3] [2 3 4] [3 4 5] ...]

10:01 chronno_: noncom:^^

10:01 tomoj: I'm guessing implementing the seq/reducer fns on channels is missing the point ?

10:01 s/channels/core.async channels/

10:03 noncom: chronno_: but i need to flatten the vector, not огче it i think. like i get this: [[1 2 3] [4 5 6] [7 8 9]] while ineed this: [1 2 3 4 5 6 7 8 9]

10:04 i get the triplets because of how i calculate data

10:04 chronno_: noncom: try wrapping it with (apply concat (mapv (juxt dec identity inc) (range 10))

10:04 noncom: but there should be another way, which is as fast..?

10:04 chronno_: ,(apply concat (mapv (juxt dec identity inc) (range 10))

10:04 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

10:04 noncom: wait, i'll try apply concat.

10:05 chronno_: ,(apply concat (mapv (juxt dec identity inc) (range 10)))

10:05 clojurebot: (-1 0 1 0 1 ...)

10:05 clgv: noncom: reduce+into instead of map?

10:06 noncom: reduce takes toooo long...

10:08 clgv: noncom: I doubt that

10:10 noncom: provided you now have (mapv f some-coll) which returns [[1 2 3] [4 5 6] [7 8 9]] - you can use reduce like (reduce #(into % (f %2)) [] some-coll) to get [1 2 3 4 5 6 7 8 9]

10:13 noncom: ... trying out the proposed solutions...

10:34 asteve: how would you abbreviate total time?

10:34 tott or ttot?

10:34 I've seen ttot in the past and it doesn't make sense to me

10:35 justin_smith: seems frenchlish

10:35 duree totale - time totale - ttot

10:35 llasram: hah, I was going to say the same thing. TAI and all

10:35 tos9: asteve: why abbreviate it :D

10:35 clojurebot: It's greek to me.

10:37 noncom: clgv: i have checked

10:37 reduce is really slower than apply concat

10:37 with apply concat i get around 1200 fps while with reduce into i get 800-900 fps

10:38 clgv: noncom: unlikely since concat and map are lazy and introduce the related overhead

10:38 noncom: (time) shows that apply+concat take about 0.1 ms while reduce+into takes about 0.7 ms

10:38 clgv: noncom: can you post the code on refheap or the link to the file on github?

10:38 asteve: tos9: because total-time-sub1s-vars is super duper long :)

10:38 S11001001: noncom: change your (apply concat ...) to (vec (apply concat ...)) and see if you get the same results, because you need vec or something similar to actually get equivalence here

10:38 clojurebot: Something weird that I noticed: & (use '[clojure.contrib.json :as json]) & &| (json/pprint-json nil) |&

10:39 clgv: noncom: concat is lazy and thus meauring the duration of the call doesnt give you any information

10:39 noncom: ok, wait, let's try the extracted code now, wait a sec..

10:39 llasram: clojurebot is in rare form this morning

10:39 clgv: noncom: measure the time with (doall (apply concat ...))

10:39 tos9: asteve: meh. I don't mind long variable names. Especially when the abbreviation is not immediately totally obvious.

10:40 asteve: perhaps tt would make more sense

10:40 noncom: actually the seq then goes into java direct buffer constructor, so it is unlazed there

10:40 .. anyway

10:41 S11001001: if your measurements include the full force too

10:43 noncom: http://pastebin.com/hMT9zsVd

10:43 here

10:43 the first function does the calc of vertices, the second function sends them into a nio buffer creator

10:44 S11001001: never do variant 3

10:44 noncom: event if i'm applying (time) to a unlazed sequence, having wrong timing, the 3D engine's fps counter won't lie...

10:44 S11001001: yeah :D quickly learned that :D

10:45 i experience around 300 fps drop while using reduce

10:45 S11001001: well, ok. I think then maybe you could get away with map over mapv

10:46 pandeiro: would simply blocking on a ring handler be a decent way to implement long-polling on the browser side?

10:46 tomoj: pandeiro: as long as you don't have a whole lot of users

10:46 I think..

10:47 clgv: noncom: well if you write it like that you should use `conj` instead of into - that saves you a vector construction as well

10:47 pandeiro: hmm..

10:47 weavejester: pandeiro: It's a reasonable solution if you expect no more than, say, 1000 users per server.

10:47 clgv: noncom: for full speed use a transient vector in the reduce

10:47 pandeiro: concurrent users right?

10:47 weavejester: pandeiro: Right

10:48 pandeiro: ok thanks, i'll go with that for this implementation and think about switching out jetty in the future

10:48 jetty does not do websockets right?

10:49 Ember-: it sure does

10:49 pandeiro: is there a way i can hook that up to compojure & ring-jetty-adapter?

10:49 clgv: noncom: http://pastebin.com/RAnWWySs

10:50 Ember-: pandeiro: most likely yes, will require some work though

10:50 websockets are very different from regular requests

10:50 pandeiro: right

10:51 i noticed i couldn't even import org.eclipse.jetty.websocket.* but i guess that's just a matter of grabbing the right jar...

10:51 Ember-: yes it is

10:51 I've used websockets in jetty with java

10:51 worked without problems

10:51 pandeiro: i also noticed jetty is at version 9 and ring-jetty-adapter pulls in 7 something

10:51 Ember-: yeah, 7 is old. I think websockets came in 8

10:51 pandeiro: ok

10:52 cool for now i will just use my naive long-polling and later i will investigate websockets properly

10:52 Ember-: the right solution

10:52 pandeiro: i need to check out this httpkit too sometime

10:52 Ember-: :)

10:53 noncom: clgv: ehhh.. clojure.lang.ArityException: Wrong number of args (4) passed to: core$conj-BANG-

10:53 pandeiro: thanks everybody

10:53 Ember-: with httpkit you'll enter the world of async

10:53 noncom: it takes only 1 elem to add...

10:53 i will sequence the calls i think..

10:53 Ember-: httpkit is basically node.js with clojure

10:53 clgv: noncom: oh than `conj!` doesnt have the same arity as `conj`

10:54 Ember-: so all I/O must be done in an asynchronous way or you'll kill your performance

10:54 pandeiro: Ember-: i'd be entering the world of async if i used aleph too, right?

10:54 Ember-: application has to be built from ground up to support that paradigm to get the performance benefits

10:54 aleph I do not know

10:54 clgv: noncom: use multiple `conj!` then, e.g. (-> c (conj! ...) (conj! ...))

10:54 pandeiro: or maybe the solution is to just serve most of the app out of jetty and run the websockets server in a different thread?

10:55 Ember-: well, you could do that yes

10:56 httpkit is pretty lightweight

10:56 so you could use it and it's websocket support

10:56 pandeiro: yeah i just need to think about all the io i'm doing then

10:56 Ember-: just be certain you're not using blocking I/O with your websocket stuff though

10:56 pandeiro: yeah

10:56 clgv: noncom: http://pastebin.com/EpCJimMG

10:57 * nDuff scowls

10:58 nDuff: clgv: pastebin.com is full of animated ads for anyone not using adblock; would you mind using refheap.com, gist.github.com, or such in the future?

10:58 noncom: clgv: checking.. doing time tests..

10:58 gfredericks: is there still no canonical implementation of a lazy hashmap?

10:58 jcromartie: pastebin is awful now

10:58 noncom: nDuff: it was me who initiated usage of pastebin, clgv originally proposed using refheap

10:58 nDuff: noncom: tsk, tsk.

10:58 S11001001: ~pastebin

10:58 clojurebot: Huh?

10:58 clgv: nDuff: noncom used pastebin.com so it was easiest to stay there...

10:59 jcromartie: Well anyway :)

10:59 hi #clojure, I miss writing Clojure

10:59 so I will

10:59 * clgv would not stop using adblock

10:59 mischov: hi jcromartieL, you've made the right choice.. :P

11:01 mefesto: is there a paredit command for flipping the positions of sibling forms?

11:01 ex: (do (this) (that)) => (do (that) (this))

11:02 something like in org-mode when moving list items around M-up / M-down

11:05 vijaykiran: mefesto: transpose-sexps ?

11:06 noncom: clgv: well, the result is quite great! with your code, the increase in fps is about +250 or even +300 on average! (so now i have like 1300-1400 instead of 1000-1100) however, there is some strange behavior.. when i start the app from scratch (killing repl), it gives around 2000 fps! then, in like 40 seconds it drops to 1400 fps and as far as i observe now, stays there... there was no drop with previous ways that i have tried. can i

11:06 ?

11:06 if it would remain at 2000, that would be just the killer-solution!

11:07 Anderkent: noncom: did you try timbre?

11:07 clgv: noncom: without more context, it is hard to tell why this happens

11:07 Anderkent: https://github.com/ptaoussanis/timbre

11:08 mefesto: vijaykiran: that's pretty much it! thanks :-)

11:09 clgv: noncom: you should profile your code with jvisualvm or yourkit

11:14 noncom: yeah, i will go into profiling soon, as i finish some part of the project. thanks for the kewl solution with transients (i havent ben into them yet) and the link for timbre!

11:15 Kowboy: I have a question about compiled classes with :gen-class

11:16 in my main method, one of the first things I do is try to set! *data-readers* to add some custom reader macros

11:16 but when I run my main class, it complains that "Can't change/establish root binding of: *data-readers* with set"

11:18 I'm guessing this has to do with the fact that my main class is pre-compiled

11:22 Anderkent: Kowboy: that doesn't sound like a gen-class related order, it's just something must be binding *data-readers* before you do set! in your tests/whetever. Whereas in your main you get the root *data-readers*, which cannot be set! and must be either alter-var-root'ed , with-redef'd or bound with binding

11:24 i.e. you cannot call set! on a var that has not been thread-bound with (binding [var this-or-that] ...)

11:32 jtoy: hi all

11:35 * gfredericks waves

11:42 * ucb waves at gfredericks

11:42 pjstadig: gfredericks: are you going to strangeloop?

11:51 Kowboy: Anderkent, this set! call works when I run it not as a pre-compiled main class, but through -m my.namespace

11:52 Anderkent: Kowboy: via lein run or via java clojure.main ?

11:52 Kowboy: clojure.main

11:52 also works via lein run

11:53 mefesto: is there an official mimetype for edn? (ex. text/edn)

11:58 Anderkent: Kowboy: can you do (println (.getThreadBinding (var *data-readers*))) and see if they're different

11:58 my expectation is that something is binding *data-readers* when you run through clojure.main or lein run

11:58 but not when you run directly through your main

11:58 trptcolin: shoreleave & clj-http both use application/edn

11:58 gfredericks: pjstadig: I just last night decided not to

11:59 mefesto: trptcolin: thanks

11:59 Anderkent: btw why do you have to set! instead of doing (binding [*data-readers* (add-readers *data-readers*)] (do-stuff-with-new-data-readers))?

12:00 trptcolin: mefesto: sure

12:00 gfredericks: pjstadig: calendar math forecasts a good chance of my wife being 37 weeks pregnant at that point.

12:00 now I'm no calendar mathematician

12:00 Kowboy: Anderkent, it prints nil when running my compiled class

12:00 trptcolin: gfredericks: congrats. same reason (-ish) i won't make lambda jam

12:00 Kowboy: and #<TBox clojure.lang.Var$TBox@225bb9ae> when running with lein rn

12:00 gfredericks: trptcolin: curses!

12:01 Anderkent: yeah, so something is wrapping your code and providing the binding

12:01 which is why your set! works

12:01 you could just make a wrapper around the main that does (binding [*data-readers* *data-readers*] (real-main))

12:12 jcromartie: I would like to start "lein repl" but my main namespace currently does not load

12:12 is there a way I can skip loading the main ns?

12:13 aside from temporarily changing project.clj..

12:13 trptcolin: jcromartie: it's a "soft" failure in lein master. one workaround is to set an :init-ns (which takes precedence over :main)

12:16 so you could do that in the project.clj too or use the higher-order task (HOT?) update-in

12:16 i find update-in a little tricky to get the syntax right, but it's kind of nice

12:23 technomancy: update-in is tricky to use on top-level keys unfortunately

12:24 you have to give it an empty keyseq: lein update-in "" assoc :main clojure.main/main -- run

12:24 * gfredericks did not know about this task

12:26 technomancy: it's new

12:27 gfredericks: new is also a task

12:28 Anderkent: technomancy: lein help update-in says : is the project root

12:28 technomancy: Anderkent: oh yeah, that works too

12:31 gfredericks: technomancy: my coworker informs me that the creator of the GIF just mandated a particular pronunciation; I propose you choose some obnoxiously counterintuitive pronunciation for "lein" and "leiningen"

12:31 first suggestion: "LEE-in"

12:31 Anderkent: clean - the c is invisible

12:31 gfredericks: haha

12:32 technomancy: what, default German pronunciation isn't counterintuitive enough?

12:32 "Just watch the movie and say it the opposite of how they do"

12:33 trptcolin: the creator of the image format responsible for this has no right to tell me how to pronounce things: http://i.minus.com/i756CgF9tf78w.gif

12:34 gfredericks: you're allowed to decide the pronunciations of words you coin as long as they don't refer to tools that are ever used for inane things

12:34 Anderkent: http://www.forvo.com/search/leiningen that sounds reasonable and not counterintuitive at all

12:34 Kowboy: Anderkent, the binding worked

12:35 trptcolin: exactly. when someone uses reply for cat videos they can pronounce it as they see fit

12:35 technomancy: gfredericks: https://mobile.twitter.com/ieure/status/336983116910579712?p=v

12:35 gfredericks: "layNING-en"

12:38 frankenBits: Hi

12:38 I am looking for some advice on Clojure & Webservices

12:38 Anyone here familiar with using Clojure with WSDL & SOAP technologies?

12:39 trptcolin: https://github.com/seancorfield/clj-soap

12:41 Anderkent: Hm. I can't use findfn in a standalone repl anymore. Weird

12:44 https://www.refheap.com/paste/14883 Any ideas?

12:44 Foxboron: Anderkent: what you trying todo?

12:45 Anderkent: load findfn in a standalone repl

12:45 Foxboron: (ns findfn.core)?

12:45 Anderkent: https://github.com/Raynes/findfn

12:47 txdv: (ns libuv)?

12:48 TimMc: gfredericks: lay-NIN-jen

12:49 trptcolin: Anderkent: bump the version. looks like 0.1.0 does that; 0.1.3 doesn't

12:49 justin_smith: Anderkent: that second error is weird, because clojail is in findfn's project.clj - which makes me think the first error may be an error clojail is causing?

12:50 Anderkent: 0.1.3 works

12:50 weird stuff, I remember it working

12:50 ah, guess I did upgrade lein in the meantime, so maybe that broke it

12:50 supersym: gfredericks: lol... they even have a web site about pronounciation :D nice one

12:51 justin_smith: Anderkent: sometimes I find when I want more info about an error in a repl I need to do a try catch to get more info (or was there a more informative stack trace you are eliding)

12:51 swank does this in some odd situations - no error even reported, but with a try/catch I can see the error and print the stack trace

12:52 Anderkent: wow, but trying to use it with clojails blows up pretty hard

12:52 can't even ctrl-c it

12:53 https://www.refheap.com/paste/14884 it doesn't like trying to update history from within the jail, I guess

12:54 trptcolin: there's work on reply master to handle read-only filesystems

12:54 Anderkent: it's not read only

12:54 trptcolin: same effect

12:54 Anderkent: ah, I see

12:54 trptcolin: try to write file, catch exception

13:08 djwonk: how can I convert a var (pointing to a function) to a string?

13:09 or keyword?

13:09 this could be a terrible idea, but I want to see if it solves a problem I have

13:10 nDuff: djwonk: what are you trying to accomplish? Could you give an example?

13:10 djwonk: is your goal to recover the function's source?

13:10 ...just get the name of the var? ...?

13:11 djwonk: nDuff: (defn x [] nil) (str x) ; "my-lib.core$x@6b59cf26"

13:12 I'd like to get just "x" out

13:12 I don't need the source

13:13 justin_smith: djwonk: (defmacro bare [x] `'~x)

13:13 (bare fn) -> fn

13:14 that is a bad name, but whatever

13:14 you could throw a call to str in there too if that is what you need

13:14 djwonk: justin_smith: thanks

13:14 justin_smith: djwonk: np

13:15 actually, (quote) may do what you want

13:15 (quote fn) -> fn

13:15 djwonk: ah! (str 'x)

13:16 justin_smith: (comp str quote) if you want to make it a function all classy like

13:16 oops, no, because quote is a macro

13:17 djwonk: right. so I've looked over a bunch of validation libraries but decided to try to write a super simple one myself. famous last words probably

13:18 gzmask: when I use fireplace.vim, :FireConnect localhost:port and leon repl gives "usage: proto://" error. what am I doing wrong?

13:19 justin_smith: I think it wants http:// or ssh:// or whatever in front of localhost

13:19 maybe tcp://?

13:20 gzmask: justin_smith: tried those, didn't work

13:20 tos9: gzmask: That sounds like an old version. It's called Connect now. And if you're using lein repl it should automatically connect, if you hadn't seen that.

13:21 gzmask: tos9: I tried :Connect , gives not found error. did I missed something in the depandcy chain?

13:22 justin_smith: maybe nrepl:// is recognized as a protocol? or repl://

13:22 tos9: gzmask: No, I was saying it sounds like your fireplace.vim is outdated.

13:24 arkh: does anyone know of example code that uses org.flatland/tokyocabinet?

13:25 gzmask: tos9: what repo should I be using? I used one from github with 268 stars. looks offical

13:26 tos9: gzmask: Oh, no, never mind, carry on, FireplaceConnect is right, the docs are just wrong I think (I never use FireplaceConnect because of ^)

13:27 gzmask: tos9: what is ^)?

13:28 tos9: gzmask: "if you're using lein repl it should automatically connect,"

13:36 djwonk: are there some rough (or better) guidelines when to use metadata?

13:37 https://github.com/bbatsov/clojure-style-guide is cool but is about the how, not the why

13:40 noidi: djwonk, use metadata for data that shouldn't affect object equality

13:42 djwonk: noidi: great. any more tailored guidelines for functions?

13:43 noidi: functions don't have metadata

13:43 vars do

13:43 djwonk: noidi: right, I should speak more carefully. defn can attach metadata, that's what I meant

13:45 here is an example I'm thinking about. I know there are many validation libraries, BTW, but I'm finding it useful to do a simple one for now

13:45 https://gist.github.com/bluemont/43216ec4543115c29ee7

13:45 noidi: sorry, I was wrong about that, function objects can have metadata. it's just defn that attaches it to the var and not the function object.

13:46 djwonk: oh

13:46 so in my example, I'm putting a string into metadata, which ultimately will show up to a user. that feels wrong

13:47 doing this right means thinking multilingual, too -- I probably should look around more.

13:50 noidi: I think metadata shouldn't affect what your function does

13:50 metadata does not impact equality, and two functions that do different things can hardly be called equal

13:52 I don't know what I'm rambling on about, of course a function can't access its own metadata

13:52 just ignore me :(

13:53 oops, that should've been a ":)"

13:55 mefesto: is clojure.edn available from cljs?

14:01 lynaghk`: What's the nice trick for integrating YourKit with Clojure? Just attaching to a Swank or nrepl REPL session fills the results with unrelated gunk.

14:02 hiredman: lynaghk`: are you sure you are attaching to the right process?

14:02 lein starts two jvms

14:02 lynaghk`: hiredman: yeah, I'm grabbing the higher PID

14:03 hiredman: lynaghk`: with visualvm (not sure about yourkit) you can see the command line args to the jvm

14:03 I would use those to make sure

14:03 lynaghk`: I can see some of my classes, but my execution time seems dominated by reflection--however, there is no reflection going on in the code I'm actually running

14:03 jodaro: hrm

14:03 codox seems to eat my ns level docs

14:03 lynaghk`: at least, my code (no reflection warnings are printed when I define the fns)

14:03 hiredman: lynaghk`: if the profiler says reflection, that is what it is

14:04 lynaghk`: hiredman: are there cases where (set! *warn-on-reflection* true) doesn't actually warn about all reflections?

14:04 hiredman: lynaghk`: check to make sure you have warn on reflection turned on correctly, are you calling other code?

14:04 lynaghk`: it only warns about code as it compiles

14:04 lynaghk`: hiredman: just clojure.core stuff and than calls to jBLAS

14:05 hiredman: are you sure you are running the code you think you are? (stale class files with reflection?)

14:07 lynaghk`: hiredman: now that I've double checked, there are a few places with reflection still

14:07 hiredman: is there a way to annotate the return type of a function passed in as an arg?

14:08 hiredman: what?

14:08 clojurebot: what is cells

14:08 lynaghk`: Or do I have to annotate the anon fn directly where I call it?

14:08 (fn [x f] (f x))

14:08 hiredman: you'll have to type hint where you call it

14:08 lynaghk`: er, that's not a good example. (fn [x f] (.native (f x)))

14:09 I can annotate (f x) directly?

14:09 well, I'll be damned. I thought type annotations were on vars only.

14:09 hiredman: type hints

14:13 lynaghk`: hiredman: any chance you know how to hint a 2d array of doubles?

14:13 technomancy: array type hints are so wacky

14:13 lynaghk`: that something is a 2d array of doubles, I mean.

14:13 technomancy: just completely baffling

14:15 lynaghk`: technomancy: awww yeah: ^"[[D"

14:15 technomancy: I'm sure there are humans to whom that makes perfect logical sense, but I don't think I want to be one of them.

14:30 gzmask: is clojure namespace referenced due to path or the definition of (ns *) in that file?

14:33 asteve: I have a vector that is ["a" "b" "c"] and a vector that is [1 2 3] I would like to create a new vector that is ["a" 1 "b" 2 "c" 3]; should I use map?

14:34 hiredman: ~namespace

14:34 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

14:34 noidi: ,(interleave ["a" "b" "c"] [1 2 3])

14:34 clojurebot: ("a" 1 "b" 2 "c" ...)

14:34 asteve: noidi: that is magic, thank you

14:37 djwonk: noidi: speaking of our earlier conversation: http://stackoverflow.com/a/16699128/109618

14:38 gzmask: does that mean path/file.clj and (ns path.file) has to be equivalently mapped? any (ns name.space) not mapping the file path will behave faulty?

14:39 asteve: I would like to take the index of vector1 and divide it by X then insert that into the same index point of vecto2

14:39 do I want to use into and a for loop?

14:40 antares_: gzmask: various toolchain parts assume the ns name structure is the same as directory/file structure against one of the source roots

14:40 asteve: so, assuming vector1 was [10 20 30], X = 10, I want a new vector to be [1 2 3]

14:41 gzmask: antares_: so this is a convention everyone has to follow?

14:41 djwonk: asteve: you might also look at `map-indexed`

14:41 antares_: gzmask: that's not a language requirement, you can define any namespace in the REPL. But when you AOT compile, or use gen-class, etc tools will expect this convention to be respected

14:41 djwonk: ,(doc map-indexed)

14:41 clojurebot: "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."

14:42 antares_: gzmask: yes. It is a good idea anyway.

14:42 gzmask: antares_: i see, thanks

14:53 asteve: so, I'm missing something

14:53 ,(let [v1 ["a" "b" "c"] v2 (vec (repeat 3 0))] (update-in v2 (map-indexed (fn [idx itm] (+ itm 10)) v2)) (interleave v1 v2))

14:53 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$update-in>

14:53 asteve: I'm trying to achieve a result that is ["a" 10 "b" 10 "c" 10]

14:54 update-in requires 3 parameters but I'm not sure what the parameter would be for every element in the array

14:54 gzmask: what's the difference between :dependencies and {:dev {:dependencies in project.clj? is the dev ones enable in my lein repo?

14:54 asteve: sorry, vector

14:54 gzmask: lein repl*

14:56 gfredericks: gzmask: yes they are

14:56 :dev is a profile

14:57 leiningen has a whole md file on profiles

14:57 which can be a bit subtle

14:57 IamDrowsy: asteve: if you don't use the idx arg, you can just use map instead of map-indexed

14:58 hyPiRion: asteve: update in works as follows:

14:58 IamDrowsy: and update-in won't change v2.

14:58 gfredericks: ,(interleave ["a" "b" "c"] (repeat 0))

14:58 clojurebot: ("a" 0 "b" 0 "c" ...)

14:58 hyPiRion: ,(doc update-in)

14:58 clojurebot: "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."

14:59 asteve: I would like to update v2, what should I use instead

14:59 I see that I can do (map #(+ % 10) v2)

14:59 hyPiRion: You cannot "update" v2, you must create a new list/vector.

15:00 asteve: ah, ok

15:00 so

15:00 hyPiRion: You can shadow v2 though, using something like ##(let [a 10 a (+ a 10)] a)

15:00 lazybot: ⇒ 20

15:00 asteve: ,(let [v1 ["a" "b" "c"] v2 (vec (repeat 3 0))] (interleave v1 (map #(+ % 10) v2)))

15:01 clojurebot: ("a" 10 "b" 10 "c" ...)

15:01 asteve: what is the … for?

15:01 hyPiRion: it's there because the list is long, and clojurebot won't print everything

15:01 ,[1 2 3 4 5 6 7 8 9 10]

15:01 asteve: got it, thanks for the help

15:01 clojurebot: [1 2 3 4 5 ...]

15:11 Okasu: ,'#(% %1 %2 {})

15:11 clojurebot: (fn* [p1__29# p2__30#] (p1__29# p1__29# p2__30# {}))

15:11 Okasu: ,'#(% %1 %2 {})

15:11 clojurebot: (fn* [p1__59# p2__60#] (p1__59# p1__59# p2__60# {}))

15:15 Okasu: ,'#(%1000)

15:15 clojurebot: (fn* [p1__90# p2__91# p3__92# p4__93# p5__94# ...] (p1000__89#))

15:15 Okasu: ,'#(%100000)

15:15 clojurebot: #<CompilerException java.lang.OutOfMemoryError: Java heap space, compiling:(NO_SOURCE_PATH:0:0)>

15:15 amalloy: i always forget about interleave. asteve, just for entertainment you might also try (mapcat list v1 v2)

15:15 asteve: thanks

15:16 amalloy: or, i guess, since you wanted to add ten to each key-thing, it would be (mapcat (fn [a b] [a (+ 10 b)]) v1 v2)

15:17 Okasu: ,#(%100)

15:17 clojurebot: #<CompilerException java.lang.RuntimeException: Can't specify more than 20 params, compiling:(NO_SOURCE_PATH:0:0)>

15:17 Okasu: Heh.

15:23 hyPiRion: wait

15:23 ,#(%100000)

15:23 clojurebot: eval service is offline

15:23 hyPiRion: oops

15:24 Okasu: LoL.

15:24 &(#(%-10) lol)

15:24 lazybot: java.lang.RuntimeException: Unable to resolve symbol: p-10__14395# in this context

15:24 amalloy: &(%100000)

15:24 lazybot: java.lang.RuntimeException: Unable to resolve symbol: %100000 in this context

15:24 amalloy: &#(%100000)

15:24 hyPiRion: That should be a clojure core "bug"/"enhancement"

15:25 amalloy: hyPiRion: you mean, the reader should refuse to read the form?

15:25 Okasu: Agreed, but to lazy to fill forms.

15:25 too*

15:25 hyPiRion: amalloy: more like not expand it. What happens is that the function expansion casts the 20-max exception

15:26 ,'#(%25)

15:26 clojurebot: (fn* [p1__200170# p2__200171# p3__200172# p4__200173# p5__200174# ...] (p25__200169#))

15:26 lazybot: java.lang.RuntimeException: Can't specify more than 20 params

15:26 Okasu: &'#(%-100)

15:26 lazybot: ⇒ (fn* [] (p-100__114422#))

15:26 Okasu: Totally broken thing.

15:26 amalloy: hyPiRion: not expand is the same thing as not read

15:27 hyPiRion: right. I don't think I said anything about not reading though

15:27 Okasu: ,'#(%-1.0)

15:27 clojurebot: (fn* [& rest__200222#] (rest__200222#))

15:27 Okasu: Whoa.

15:28 hyPiRion: Okasu: what did you just do

15:28 amalloy: Raynes: lazybot's timeout doesn't apply to reading code, only to evaluating it

15:28 llasram: Okasu: That's *amazing*

15:28 Okasu: Ha-ha. :)

15:28 Raynes: amalloy: Okay.

15:28 amalloy: tricky code like '#(%100000) can read to very large forms

15:29 Raynes: That sucks.

15:29 I'll pretend to look into that tonight.

15:29 llasram: ##'#(%-2/2)

15:29 lazybot: ⇒ (fn* [& rest__114552#] (rest__114552#))

15:32 hyPiRion: &(->> a b (->> c d))

15:32 ^ that one should be more dangerous

15:32 mikerod: can you depend on (conj (seq some-coll) 'item) to always add 'item to the front of the resulting collection type?

15:33 hyPiRion: mikerod: no

15:33 Or wait, for seq?

15:33 mikerod: hyPiRion: If you call seq on any collection data structure.

15:33 llasram: Yeah, with the seq in there, that's just a funny way of writing `cons`

15:33 hyPiRion: hmm

15:33 llasram: So you it'll go on the "front", but of a seq wrapping the original data structure

15:34 mikerod: llasram: I didn't know if the returned structure from seq could vary depending on what data structure it was called on.

15:34 llasram: And I know conj just adds to wherever is "best" or whatever.

15:35 llasram: If the behavior is just cons onto the "front" of the original structure, that make sense though.

15:36 hyPiRion: The only guarantee is that the resulting thing is an ISeq -

15:36 llasram: mikerod: There are different concrete seq type implementations, but they are still seqs, not whatever the impl is wrapping

15:42 mikerod: llasram: I thought conj behavior was based on the concrete type. So this is where I wasn't sure if I could depend on all concrete seq type implementations to have conj add to the "front".

15:43 Is (conj (into '() some-coll) 'item) a more dependable way? Or more idiomatic? Or what is the most idiomatic way of adding an item to the front of any type of collection?

15:44 hyPiRion: ,(cons 'item (seq '[some coll]))

15:44 Raynes: hyPiRion: Hi.

15:44 hyPiRion: &(cons 'item (seq '[some coll]))

15:44 lazybot: ⇒ (item some coll)

15:44 hyPiRion: Raynes: hay there

15:44 Raynes: hyPiRion: Your madness keeps you sane.

15:45 gzmask: I added :profiles {:dev {:dependencies [[ring-serve "0.1.2"] … in project.clj and (use 'ring.util.serve) gives FileNotFoundException. I ran lein deps beforehand. anyone?

15:45 mikerod: hyPiRion: That makes sense.

15:45 Thanks!

15:45 amalloy: wait, is lazybot still working on that (->> a b (->> c d))? macroexpansion should be within the timeout context for sure

15:46 TimMc: bwahaha

15:46 hyPiRion: Raynes: yeah

15:46 amalloy: it should've blown the stack

15:46 &(reduce + (range))

15:46 lazybot: Execution Timed Out!

15:47 TimMc: amalloy: No, I remember it erroring out.

15:47 llasram: mikerod: and `cons` calls `seq` and it's collection arg if necessary, so even just ##(cons :foo [:bar :baz])

15:47 lazybot: ⇒ (:foo :bar :baz)

15:47 TimMc: Disregard that.

15:47 &(->> a b (->> c d)) ;; maybe it was a glitch?

15:48 Could it be throwing during macroexpansion and then just not printing anything?

15:48 hyPiRion: Raynes: how far are you now on sandman? (since I assume you quoted it)

15:48 TimMc: &(macroexpand '(->> a b (->> c d))

15:48 lazybot: java.lang.RuntimeException: EOF while reading, starting at line 1

15:48 TimMc: &(macroexpand '(->> a b (->> c d)))

15:48 lazybot: java.lang.StackOverflowError

15:48 hyPiRion: TimMc: Oh, watch this

15:48 ,#(%100000)

15:48 * TimMc braces

15:49 Raynes: hyPiRion: A little over halfway through volume 6.

15:49 Which appears to be the largest volume.

15:49 Holy netsplit.

15:50 mikerod: llasram: Thanks, good to know.

15:51 hyPiRion: oh, it's still alive?

15:51 ,1

15:51 Hm, no.

16:04 supersym: somehow I get a kick out of closing parens.. how weird is that

16:12 guns: Is there an equivalent to calling select() on *in*? I can use a Selector in /proc/self/fd/0, but that only works on Linux

16:12 amalloy: guns: i'd look into either java.nio or lamina

16:13 one of them probably has a way to do non-blocking reads from system.in

16:13 guns: amalloy: I couldn't find a reliable solution in the nio package. I will look at lamina, thanks

16:14 gfredericks: &#(%100000)

16:14 hyPiRion: gfredericks: :D

16:14 gfredericks: hyPiRion: what does it do? cause the reader to hang?

16:15 naively it could compile to #((nth %& 100000))

16:15 hyPiRion: "Oh, you want a function with 100,000 arguments? I'll give you a function with 100,000 arguments, then try to evaluate it."

16:15 gfredericks: I guess it does probably construct a 100000 element arg vector eh?

16:15 hyPiRion: yeah

16:16 with 100 000 gensyms

16:16 gfredericks: but that's not too big to manage. And the compiler should balk at it being >21 or something?

16:16 lazybot: java.lang.RuntimeException: Can't specify more than 20 params

16:16 rasmusto: haha

16:16 * gfredericks high fives self

16:16 gfredericks: so apparently lazybot doesn't have a timeout on the compile phase

16:17 hyPiRion: yeah

16:19 then we have ##(#(+ %1.0 %2.0) 5 7) which is kind of funny

16:19 lazybot: ⇒ 12

16:20 kanwei: is there a better way to check if a string is an integer besides this shenanigans? (try (Integer/parseInt website-id) (catch Exception e nil))

16:20 rasmusto: ##(#(+ %2/1 %10/5) 5 7)

16:20 lazybot: ⇒ 14

16:20 gfredericks: kanwei: does #"-?\d+" work for you?

16:21 kanwei: what's the -? mean?

16:21 hyPiRion: kanwei: allows minuses

16:21 kanwei: oh right

16:23 is there any case where Integer/parseInt would be unsafe?

16:23 gfredericks: I'd hope not

16:23 justin_smith: blowing the stack if it uses peono representation :P

16:23 hyPiRion: don't think so

16:23 gfredericks: &(Integer/parseInt (apply str (repeat 999 \3)))

16:23 lazybot: java.lang.NumberFormatException: For input string: "33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333

16:24 kanwei: sooooo

16:24 test with regex and then edn/read-string is more idiomatic?

16:24 gfredericks: if it's really generic edn data then you'd probably also want to check for \N at the end

16:26 &(clojure.edn/read-string (apply str (repeat 999 \3)))

16:26 lazybot: java.lang.ClassNotFoundException: clojure.edn

16:27 justin_smith: ,(clojure.edn/read-string (apply str (repeat 999 \3)))

16:27 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.edn>

16:27 kanwei: yeah you have to require it

16:27 it does work tho, thanks

16:28 altho

16:28 gfredericks: #"-?\d+" would also succeed for "asdf12356asdf"

16:28 no?

16:28 clojurebot: no is tufflax: there was a question somewhere in there, the answer

16:28 hyPiRion: kanwei: no

16:29 ,(re-matches #"-?\d+" "asdf12356asdf")

16:29 clojurebot: nil

16:29 hyPiRion: ,(re-matches #"-?\d+" "12356")

16:29 clojurebot: "12356"

16:29 kanwei: &(re-seq #"-?\d+" "asdf1235")

16:29 lazybot: ⇒ ("1235")

16:29 hyPiRion: yeah, use re-matches

16:30 kanwei: aight

16:33 pjstadig: gfredericks: i was going to say you should run a clojure help desk at strangeloop, but that's a good reason to stay back. congrats

16:38 djwonk: I'm looking for the simplest way to 'map' over a hash map, returning a hash map

16:39 gfredericks: pjstadig: thx

16:40 still haven't committed to avoiding the conj

16:42 Raynes: gfredericks: What's the congrats for?

16:42 I can't see you making any wonderful announcements in my backlog.

16:42 gfredericks: Raynes: it was a few hours ago

16:42 what's a good nerdy clever way to imply that you're reproducing?

16:43 Raynes: "I have multiplied."

16:43 gfredericks: I have chosen another random subset of my genes to instantiate

16:43 djwonk: i.e. {:a 3} --> {:a 4} with something like (map-map (fn [k v] [k (inc v)]) {:a 3})

16:43 gfredericks: djwonk: amalloy would say it's questionable whether using maps is appropriate given you want to do that

16:44 but I want to do it all the time too

16:44 (into {} (for [[k v] m] [k (f v)]))

16:44 justin_smith: or even (into {} (map (fn [[k v]] [k (f v)]) m))

16:44 djwonk: gfredericks: thanks

16:46 gfredericks: ~thanks

16:46 clojurebot: We live to serve.

16:46 amalloy: gfredericks: my goal is to eventually dispense the same advice so many times that it will be repeated and attributed to me even when i'm not here. then i can stealth-retire, and continue to collect my irc paycheck

16:46 gfredericks: ~thanks

16:46 clojurebot: We live to serve.

16:47 gfredericks: clojurebot: thanks is <reply> the best way to thank your friendly #clojure resident is with (inc nick)

16:47 clojurebot: c'est bon!

16:48 gfredericks: amalloy: it's in my list of amalloy folklore

16:48 amalloy: (inc nick)

16:48 lazybot: ⇒ 2

16:48 gfredericks: we should start establishing tribes of idioms

16:48 clojurebot: Huh?

16:49 gfredericks: "The amalloy clan avoids mapping over a map"

16:49 amalloy: gfredericks: this particular bit of folklore was stolen from the hiredman tribe

16:49 jugimaster: > (into {} (for [[k v] m] [k (f v)])) <-- are the square brackets there just aliases for parenthesis?

16:50 Raynes: Aliases for parentheses. Nice. No. They're a different data structure than lists. Vectors.

16:50 amalloy: jugimaster: try it and see

16:50 pjstadig: aww i want my own tribe

16:50 jugimaster: well, i haven't even installed clojure yet

16:50 Raynes: You don't need to.

16:50 jugimaster: .. just considering using it :p

16:50 Raynes: We have an app for that.

16:51 gfredericks: pjstadig: you have to have your advice repeated on three separate occasions

16:51 Raynes: &(+ 3 3)

16:51 lazybot: ⇒ 6

16:51 amalloy: jugimaster: coming from scheme?

16:51 jugimaster: amalloy: coming from python, and came from java before python

16:51 Raynes: You're in the right place, si.r

16:51 amalloy: (i ask just because i can't think of any other language where [] is sometimes a synonym for ())

16:51 jugimaster: but i'm not yet sure i'll come :P

16:51 Raynes: Pull up a chair.

16:51 jugimaster: :P

16:51 Raynes: Yes you will.

16:51 rasmusto: the water's pretty warm

16:51 * pjstadig tries to think of advice to dispense

16:52 jugimaster: well, i have a feeling that clojure might be great

16:52 gfredericks: technomancy: it's not conceivable that `lein test` should fail in the leiningen project is it?

16:52 Raynes: You can't come this far and then just abandon is. Think of the children, jugimaster.

16:52 jugimaster: :P

16:52 Raynes: us*

16:52 jugimaster: i'm mostly tempted by the performance (which is probably just silly), and that clojure might be a better tool for asyncy stuff than python

16:52 djwonk: amalloy: why is (defn map-values [f m] (into {} (map (fn [[k v]] [k (f v)]) m))) not to your liking?

16:52 Raynes: You're already asking Clojure questions. You're nearly a Clojure programmer already. Just need you install leiningen.

16:52 trptcolin: gfredericks: be sure you're all `lein bootstrap`'ed up

16:52 jugimaster: :p

16:52 technomancy: gfredericks: lein's own test suite isn't great

16:53 Raynes: Probably because I never add tests when I make changes.

16:53 :D

16:53 gfredericks: trptcolin: I definitely didn't make sure of that

16:53 amalloy: jugimaster: come for the parallel programming, stay for the immutable data structures

16:53 callen: jugimaster: clojure is awful, I'm just here for the music. Save yourself while you can!

16:53 jugimaster: :p

16:53 callen: jugimaster: also amalloy is right, the stuff you think is important won't be after a year.

16:53 Raynes: callen: Speaking of music, the new 30 Seconds to Mars album is pretty great.

16:53 callen: simply having not the sand shift beneath you is enough reason to stick around.

16:53 not having*

16:54 Raynes: I'm not surprised you like them

16:54 I'm starting to get a read on your tastes.

16:54 jugimaster: amalloy: yeah.. the concurrency stuff is interesting too.. though i've never even had to deal with serious concurrency before

16:54 callen: jugimaster: advice? Don't unless you really have to.

16:54 seriously, it's not worth it.

16:54 Raynes: callen: You can have full on bloody statistics on my taste if you want, bro: http://last.fm/user/RaynesFM

16:54 jugimaster: callen: yeah, but clojure would mostly just magically keep me safe? :P

16:54 STM and all

16:55 callen: jugimaster: it can if you use the containers right. mostly. but still, it rarely matters.

16:55 amalloy: STM doesn't really matter most of the time either, because you'll rarely be mutating anything

16:55 callen: atom suffices for most of my use-cases

16:55 jugimaster: callen: so are you saying i'll be in trouble if i ever do anything "concurrent" with clojure either? :p

16:55 Raynes: They lure you in with their refs, but you stay for the atoms.

16:55 callen: the last time I used a ref was for that goddamn client driver.

16:56 amalloy: jugimaster: not at all. concurrency support in clojure is very good, and it's fairly easy to get it right

16:56 callen: jugimaster: no, quite the opposite. Clojure is a heaven filled with naked angels and bowls of grapes compared to doing concurrent programming in pthreads.

16:56 amalloy: you just...don't need most of the tools you think you need, because everything is easier when you don't mutate things

16:56 jugimaster: can Clojure apps be run on a 256MB VPS or would the memory be hopelessly small?

16:56 Raynes: Heaven with naked angels isn't very useful callen.

16:56 callen: Raynes: wayyyyy too much My Chemical Romance.

16:57 amalloy: jugimaster: that's fine as long as you tell the JVM to limit its heap size to, say, 40MB

16:57 hiredman: stm is there, but you should avoid it, stm implies coordinated state changes, coordination for a multithread system implies slow

16:57 jugimaster: hmm

16:57 callen: Raynes: This has low odds of working, but I want to try it anyway: https://soundcloud.com/deathwishinc/deafheaven-sunbather

16:57 Raynes: callen: What's amusing is that I don't really listen to MCR much at all these days, but when I did listen to them a lot I listened so much that it just completely eclipsed everything else I've listened to since.

16:57 callen: Raynes: I have weeks like that with shoegaze.

16:57 hiredman: but sometimes you need it

16:58 (I mean, I don't, but someone might...)

16:58 callen: hiredman: I've needed it.

16:58 hiredman: I hated myself.

16:58 amalloy: jugimaster: lazybot is running on a VPS with 1.5GB of ram, along with three other clojure servers

16:58 callen: hiredman: I quickly got rid of it.

16:58 amalloy: four others? i see five java processes but i don't know what they all are

16:58 jugimaster: amalloy: well, that's quite a bit of RAM :P

16:58 Raynes: amalloy: If we ever restart it it'll be running on a server with 3GB of ram.

16:59 amalloy: jugimaster: divide it by four, and how much is it?

16:59 jugimaster: not much?

16:59 :p

16:59 Raynes: &(/ 1500 4)

16:59 lazybot: ⇒ 375

16:59 Raynes: callen: Miss.

16:59 My throat is hurting from the first 2 minutes.

16:59 gfredericks: haha I like the line "Unable to resolve symbol: failure-expected-here-dont-freak-out"

17:00 callen: Raynes: okay, I can shift melodic.

17:00 trptcolin: i freak out every. time.

17:03 callen: Raynes: http://www.youtube.com/watch?v=AiZxCVXhgmM

17:04 tieTYT: i'm looking at http://clojuredocs.org/clojure_core/clojure.core/derive is there any magic behind ::rect? Is that just a keyword that starts with a colon?

17:04 Raynes: callen: You should use google all access and share things with me.

17:04 callen: Oh man. You send me an Assassin's Creed video. It's impossible for me to not like this song.

17:04 amalloy: ,::rect

17:04 clojurebot: :sandbox/rect

17:05 technomancy: gfredericks: grep the test suite for "squirrel"

17:05 callen: ,'amalloy

17:05 clojurebot: amalloy

17:05 callen: technomancy: SQUIRREL?! WHERE?!

17:06 technomancy: callen: https://github.com/technomancy/leiningen/blob/master/test_projects/sample_failing/src/nom/nom/nom.clj

17:06 tieTYT: that extra colon seems to tie it to the current ns?

17:06 trptcolin: lol, i forgot about that

17:06 gfredericks: technomancy: I did it!

17:07 so apparently `bin/lein test` works while using my installed leiningen doesn't

17:07 I guess that was the trick

17:07 callen: technomancy: LOL

17:07 technomancy: callen: that wasn't me FWIW

17:08 gfredericks: tieTYT: keywords can have namespaces

17:08 tieTYT: the double-colon syntax automatically adds the current namespace

17:08 callen: technomancy: who?

17:08 gfredericks: the "namespace" of a keyword is not directly related to general namespaces otherwise

17:08 tieTYT: gfredericks: how do you add a different namespace from the current?

17:09 technomancy: callen: looks like it was alandipert

17:09 https://github.com/technomancy/leiningen/commit/93535c5a17df197ba8ee5470da49b2a22e096492 \m/

17:09 amalloy: tieTYT: look at the output of ::foo and see if you can guess

17:09 tieTYT: oh yeah I see it

17:09 technomancy: gfredericks: are you fixing the run task?

17:10 tieTYT: so with one colon, does that mean it's in no namespace?

17:10 or in every namespace?

17:11 hyPiRion: ,::foo

17:11 clojurebot: :sandbox/foo

17:11 Raynes: tieTYT: Namespacing in keywords is not a special thing.

17:11 hyPiRion: ,(= :sandbox/foo ::foo)

17:11 clojurebot: true

17:11 Raynes: tieTYT: The 'namespacing' is just the extra information on the keyword.

17:11 You can just do :foo.diddly/bar and have the same effect if you want.

17:12 trptcolin: &((juxt namespace name) :foo/bar/baz)

17:12 lazybot: ⇒ ["foo/bar" "baz"]

17:13 justin_smith: &((juxt namespace name) (keyword ":::::::foo"))

17:13 lazybot: ⇒ [nil ":::::::foo"]

17:13 callen: Raynes: http://www.youtube.com/watch?v=NiIMqSqabGs ?

17:14 tieTYT: why does derive require a namespace on the keyword?

17:15 gfredericks: technomancy: are you interested in mundane refactorings such as use->require?

17:15 technomancy: gfredericks: eh; sure

17:15 separate pull reqs would be better though

17:15 gfredericks: fo sho

17:15 mikerod: The use of https://github.com/clojure/clojure/blob/master/src/clj/clojure/gvec.clj is just for vectors of primitives created through `vector-of`?

17:16 gfredericks: man running leiningen tests is so meta

17:16 even this acronym

17:16 mikerod: Otherwise, vectors are defined in the Java classes under IPersistentVector?

17:16 hyPiRion: gfredericks: wat

17:17 you're testing lein with lein itself? Is that so hard? :p

17:17 amalloy: hyPiRion: someone once told me gcc was written in c, but i've blocked out that painful memory

17:17 bbloom: amalloy: c'mon now, bootstrapping is fun :-)

17:18 wink: not sure

17:18 I find recompiling lein with lein annoying enough

17:18 Raynes: callen: Hit.

17:18 wink: and it's not exactly hard

17:18 bbloom: amalloy: and dangerous: http://cm.bell-labs.com/who/ken/trust.html

17:19 amalloy: yes, that's a neat trick

17:19 gfredericks: oh nice there are windows line endings in this file

17:19 amalloy: Raynes: are you playing youtube battleship?

17:20 callen: Raynes: http://www.youtube.com/watch?v=XmGdSOhBx8E

17:20 Raynes: amalloy: Yes.

17:20 callen: amalloy: I'm your DJ for the day. Want some depressive black metal?

17:20 Raynes: amalloy: Because callen is too cheap for google music.

17:20 callen: Raynes: I use spotify generally.

17:20 Raynes: I also have a spotify subscription.

17:20 technomancy: what your life needs right now is more Google services

17:20 gfredericks: man embedding songs in a youtube video is like embedding text in a gif

17:20 callen: technomancy nails it, really.

17:21 Raynes: I haven't decided if I want to actually keep google music.

17:21 *shrug*

17:21 I'm fine with more google services.

17:21 callen: I'm already attached to Google by umbilical cord via gmail.

17:21 * technomancy is researching escape pods

17:21 callen: I don't need more.

17:21 technomancy: I should write a webmail service in clojure.

17:21 with search!

17:21 technomancy: for the first time in years I'm actually glad I kept my dreamhost account around

17:21 hyPiRion: callen has now 10,000 problems

17:22 callen: ^^ accurate.

17:22 deliverability with private mail servers is GAG GAG GAG

17:22 gfredericks: is google cutting off something else?

17:22 muhoo: you guys aren't running your own sendmail on your VPS'es? are you wizards or what?

17:22 technomancy: gfredericks: always

17:22 hyPiRion: gfredericks: they're removing SMTP and e-mail in general. The new way of doing things is sending Google hangout messages

17:22 callen: muhoo: wouldn't the wizards be the ones willing to fuck with m4 long enough to get sendmail to work?

17:22 * nightfly is too lazy

17:22 bbloom: i know a guy who still runs his own mail servers… he has emailed me twice now to apologize for losing previous emails from me that he needed...

17:23 muhoo: callen: well, postfix, for the sane. still.

17:23 callen: hyPiRion: I think there's a way to do it though, if you use a service like fastmail for deliverability and a private domain, you could run a custom webmail service with relatively little hassle.

17:23 hyPiRion: callen: oh sure thing

17:23 muhoo: webmail is not hard. people wrote them in PHP in the early 2000's FFS

17:23 nightfly: And they sucked

17:23 hard

17:23 hyPiRion: It's just all the addons people require

17:24 then the server goes down

17:24 you have to scale the thing

17:24 +++

17:24 callen: muhoo: it's not that it's hard

17:24 muhoo: it's making it reliable and having good deliverability with your mail server that is a pain.

17:24 muhoo: nightfly: i know, i'm one of the people who wrote himself a sucky one back then :-)

17:24 trptcolin: i guess it's like aphyr's series. if it doesn't have to get there, sure it can be easy.

17:24 callen: ^^ that.

17:24 gfredericks: does anybody know about leiningen's tests wrt testing error message output?

17:25 it looks like it's just printing to stderr so I'm not sure how to expect on that

17:25 hyPiRion: gfredericks: binding [*err* *out*] (with-out-str ...

17:26 gfredericks: hyPiRion: I think this is running in a different jvm

17:26 hyPiRion: I think I made some in the core library

17:26 gfredericks: but I don't know for sure

17:26 hyPiRion: oh what

17:26 That shouldn't matter, unless my pipes totally fail

17:26 gfredericks: it's the leiningen.test.run tests in particular

17:27 hyPiRion: why would binding *err* on my jvm do anything with the other one?

17:27 I don't think binding it on the other one is really an option

17:27 Raynes: callen: Kinda sorta not really on that one. A little too rough for my tastes.

17:29 muhoo: trptcolin: thanks for pointing me to aphyr. interesting stuff, interspersed with lulz: http://aphyr.com/data/posts/284/-055.jpg

17:29 callen: Raynes: http://www.youtube.com/watch?v=sZTpLvsYYHw

17:29 hyPiRion: gfredericks: maybe I misunderstand, but you're running the leiningen tests and want to make new tests which checks the error message output, right?

17:29 callen: muhoo: you really want to follow his stuff, it's solid.

17:29 Raynes: callen: Of course I like The Killers.

17:29 callen: Raynes: ok I'll move onto something less obvious.

17:29 Raynes: callen: I was just telling someone 5 minutes ago how much better Hot Fuss is than all their other albums. :p

17:29 callen: Raynes: slightly less obvious: http://www.youtube.com/watch?v=MQvZ4N1RfS8

17:30 hitting Toronto scene indie after this one.

17:30 Raynes: I haven't been able to bring myself to like Arcade Fire, but I've never heard this one.

17:30 callen: Raynes: give it a whirl, it's anthemic ala Killers

17:30 Raynes: Are you my Pandora now?

17:30 callen: Raynes: yes

17:31 Raynes: I've aggregated and listened to over a terabyte of music (and not all junky mixes, original content). I find things *_*

17:31 Raynes: I'm okay with that.

17:31 callen: *______________________*

17:31 weavejester: how are you?

17:31 technomancy: new game music bundle is coming up in a few hours if you're into that kind of thing

17:31 Raynes: callen: I like this.

17:31 weavejester: callen: Huh?

17:32 technomancy: http://www.gamemusicbundle.com/

17:32 they've had some fantastic offerings the past few times

17:32 Raynes: I'm not into game music.

17:32 Not quite nerd enough.

17:32 callen: technomancy: there was this clicky adventure game that had an amazing soundtrack, it was part of the humble bundles.

17:32 technomancy: the scott pilgrim game soundtrack is the best possible music to hack to

17:33 callen: technomancy: I can't remember the name of it just this moment though. Do you know what I'm talking about?

17:33 Raynes: I like game music simply because they're purpose-built for mood and very functional to that end.

17:33 tend to be more consistent too.

17:33 Apage43: i listen to a lot of trailer music

17:34 gfredericks: hyPiRion: yes, the error message from the result of doing 'eval-in-project

17:34 indirectly

17:34 the test is just calling run

17:34 callen: Raynes: you should be about done: http://www.youtube.com/watch?v=xl3PyTqsc5c

17:35 gfredericks: hyPiRion: the call throws an ExceptionInfo but all it has is {:exit-code 1}

17:35 and I see the actual error message printed to presumably the STDERR of my process running the test

17:35 hyPiRion: oh durr. Let's see here.

17:35 callen: technomancy: http://en.wikipedia.org/wiki/Machinarium

17:35 technomancy: ^^ check out that soundtrack.

17:36 Raynes: let me know how the BSS treats you.

17:38 hyPiRion: gfredericks: https://github.com/technomancy/leiningen/blob/master/leiningen-core/test/leiningen/core/test/helper.clj

17:39 gfredericks: hyPiRion: so I'd use (abort-msg run the-project)?

17:40 callen: technomancy: retro game music no less. dis gon b gud

17:40 hyPiRion: yeah, presumably

17:41 though that one only takes suppressed exits somehow

17:41 gfredericks: hrm....

17:42 testing leiningen is hard

17:43 oh eval-in-project apparently puts a lot of effort into this sort of thing already o_O

17:43 maybe I can just look to *err*

17:44 pjstadig: gfredericks: obviously you should be using simulation testing instead

17:45 i hear they're much better guard rails than unit tests

17:46 gfredericks: oh man that totes worked

17:46 (inc leiningen)

17:46 lazybot: ⇒ 1

17:47 muhoo: i prefer jazz for coding, but if you want retro game music, and jazz, there's this: http://www.youtube.com/watch?v=zNFQkgb9Ib8

17:47 callen: muhoo: way too kitschy.

17:50 bbloom: pjstadig: i know you were kidding, you should be using both… where appropriate :-)

17:51 ie more overall testing, less skewed towards unit tests

17:52 pjstadig: i just do as the latest cargo culting fad tells me, you're saying that's not sufficient?

17:52 bbloom: right, you need to do what the three most recent cargo culting fads tell you!

17:53 callen: pjstadig: want some gasoline for that strawman?

17:53 I have maaaatchessss

17:53 pjstadig: bbloom: only if that's what the latest cargo cult is preaching

17:53 bbloom: heh.

17:53 trptcolin: which segment of the ThoughtWorks Technology Radar can I review to find those?

17:53 pjstadig: trptcolin: strawmen or gasoline?

17:53 muhoo: http://blog.fogus.me/2012/06/20/not-enough/

17:54 trptcolin: pjstadig: ok, that's 2, what's the third?

17:54 callen: bbloom: next time you want to have a circlejerk in here, could you tell me ahead of time so I can remember to bring oil?

17:54 bbloom: I'm unprepared for this man.

17:54 Raynes: callen: This song scares me.

17:54 callen: Raynes: GOOOOOOOD

17:54 bbloom: it's going to be a mess by the time you and pjstadig finish.

17:55 Raynes: Taken out of context, that message is really sexy.

17:55 callen: Raynes: bbloom and pjstadig are having their 5 minutes of hate in public.

17:55 Raynes: apparently "dem other peoples" are stupid and not to be trusted. And their ways are false.

17:55 muhoo: is it hate? sounds a bit more erotic to me

17:55 in any case, i hope it stops soon.

17:56 callen: the best way to defuse hate is with sexy-times.

17:56 see a nazi rally? strip down to undies and offer to dance with the participants.

17:56 bbloom: pjstadig: was there any hate? or sexy times? i'm confused. i thought we were having a few relatively friendly laughs… *shrug*

17:56 muhoo: naw, humor. my monitor has some coffee damage now due to your oil comment earlier

17:57 * callen dances happily

17:58 muhoo: ok, procrastinating. the friend workflow function is one of the most opaque things i've dealt with in a while.

17:58 callen: of course the Haskell people would make a DSL called Flask.

17:58 Dicks.

17:59 muhoo: i've written one before, it worked, and i'm trying to write another one, and i'm completely lost.

17:59 * muhoo rereads docs again

17:59 callen: muhoo: see, this is why I don't use Friend. :|

18:00 patchwork: Hmm…. latest clojure.java.jdbc borks with-naming-strategy

18:00 Anyone else seen this?

18:00 muhoo: callen: what do you do instead?

18:00 patchwork: Or maybe I am the only one using with-naming-strategy

18:00 muhoo: callen: specifically, how do you deal with several auth methods which need to coexist in the same app?

18:00 callen: muhoo: wrap them myself, because I'm a big boy.

18:01 muhoo: callen: and then when you need to write another app that does the same thing?

18:01 callen: muhoo: this isn't hard stuff, it usually takes less time to write your own util or middleware fns than to sacrifice the right ordering of goats, doves, and cows to overbearing libraries.

18:01 muhoo: well then you reuse the code. Something I do all the time.

18:01 I've actually measured how much code I usually reuse across web projects in Clojure that I wrote, it's 60-80%

18:02 slightly higher than it was in Flask

18:02 much higher than in Django.

18:02 muhoo: do you deliver all that duplicated code to each client, each with their own copyright statement in it?

18:02 callen: I don't deliver Clojure code to clients

18:02 my consulting hasn't hit upon a clojure gig yet. (fingers crossed)

18:03 reifying the utility stuff I write into libraries would be strange.

18:03 some of it I might consider cleaning up for libnoir.

18:03 muhoo: huh. what do you write in usually?

18:04 callen: muhoo: whatever the client needs. I'm a polyglot in the extreme.

18:04 it's bad for my long term development, but I'm a mercenary.

18:04 that's why I focus on Clojure on my own time, so I don't become completely retarded.

18:06 muhoo: well i have become allergic to libraries and inclined to DIY, but with something like auth, i'd rather abstract it out into something i can reuse. and friend is already there, so why not contribute to it, is how i look at it.

18:07 callen: muhoo: uhm, I would agree but you aren't going to get him to change the design/overbearing nature of Friend

18:07 adding more code won't unfuck it.

18:07 the solution is a library that's less obnoxious to work with, but still abstracts the unnecessary details of the problem

18:07 muhoo: that'd be nice, i agree.

18:09 i'd have to wonder if it'd be more work than just dealing with this one weird function in friend.

18:10 callen: muhoo: "ONE WEIRD TIP TO LOSE WEIGHT IN YOUR CLOJURE CODE"

18:10 muhoo: ???

18:10 lazybot: muhoo: Oh, absolutely.

18:13 muhoo: callen: anyway, if you feel like writing an alternative to friend, great, i'll try it out and pitch in to add features if i end up using it.

18:13 but for now... this is what i gots.

18:16 callen: muhoo: I'd not likely bother unless I picked up a contract doing Clojure, but I'll ping you if it happens regardless.

18:17 arohner: is there a library out there that pretty prints persistent queues?

18:21 pppaul: how do i add content type for pedestal responses?

18:34 gfredericks: technomancy: w00t got a test/patch

18:34 * gfredericks wants his sticker

18:41 amalloy: arohner: (defmethod print-method ...)

18:41 arohner: amalloy: yup. just checking to see if someone did that, and made a nice constructor, etc

18:41 amalloy: you could bundle it up in a library, but then any two such libraries can't help but step on each others' toes

18:42 arohner: that would be a concern, if there was more than one :-)

18:42 amalloy: fwiw, useful has a constructor for it: https://github.com/flatland/useful/blob/develop/src/flatland/useful/utils.clj#L144

18:54 gzmask: cljs-build giving me No implementation of method: :as-file of protocol error. anyone?

18:58 amalloy: ~helpme

18:58 clojurebot: A bug report (or other request for help) has three parts: What you did; what you expected to happen; what happened instead. If any of those three are missing, it's awfully hard to help you.

19:29 alandipert: bbloom: have you noticed equiv being way slower on firefox in your cljs perf laboratory?

19:39 aphyr: Is there a good way to figure out what part of lein compile is slow?

19:40 Been trying strace and jvisualvm but nothing really obvious is coming out of it

19:40 pandeiro: math.combinatorics is dangerous if you're in nrepl and not on a super computer...

19:46 anyone got an estimate how many 6-char combinations are possible with upper and lower case alphanumeric? or how i can figure that out?

19:49 antares_: pandeiro: with or without repetition?

19:50 brehaut: its n! / (k! * (n - k)!)

19:50 amalloy: $google combinations permutations

19:50 lazybot: [Combinations and Permutations - Math is Fun] http://www.mathsisfun.com/combinatorics/combinations-permutations.html

19:51 pandeiro: antares_: actually yeah i would mean selections i guess, with repetition

19:55 hyPiRion: pandeiro: n^6 where n = is the amount of characters

19:56 so 52^6

19:57 pandeiro: hyPiRion: yeah, 62 [A-Za-z0-9]

19:57 hyPiRion: yeah, forgot about those nums

19:57 pandeiro: hyPiRion: that seems intuitive... why would i need to take the factorials of everything?

19:58 (reading the article amalloy posted)

19:58 amalloy: factorials would answer a different question, because "6-char combinations" is ambiguous

19:58 pandeiro: is 'selections' the math word?

19:59 for repetitive combinations?

19:59 lynaghk: aphyr: if you are trying to optimize clojure compilation, I would talk to sattvik_, who has done a lot of work to use Clojure on Android

20:00 aphyr: I know it's using the disk a ton--5 MB/s sustained for 30 seconds

20:01 lynaghk: aphyr: dang. I wish I could help, but I don't know much about Java Clojure compiler internals

20:01 alandipert: aphyr: are you AOTing for interop, obfuscation, perf, or other?

20:02 (if for perf, AOT generally not the way ime)

20:02 aphyr: Naw, I need AOT to generate a jar

20:03 alandipert: can't just put clj source in the jar and let it dyn-pile?

20:03 aphyr: Not sure, really. It complains it can't find a class if I do that.

20:04 It's all writes--I think maybe it's just stuck writing class files to disk

20:05 technomancy: aphyr: what kind of jar?

20:05 aphyr: Well, eventually I build a fat jar

20:05 technomancy: if boot time isn't a concern you can usually piggyback on clojure.main with -m

20:05 aphyr: but even lein clean, lein repl takes like a full minute now

20:06 technomancy: strongly recommend not doing AOT during dev if possible

20:08 aphyr: Hmm. If I comment out :aot [riemann.bin] in project.clj, it complains ClassNotFoundException: riemann.bin, compiling:(riemann.bin/clj:18)

20:08 That's at the REPL

20:08 technomancy: using gen-class?

20:08 aphyr: Yeah

20:08 technomancy: oh, ok then

20:08 aphyr: May be because I actually refer to riemann.bin on that line

20:08 technomancy: can't avoid AOT if you need gen-class

20:09 aphyr: Yeah, and I need gen-class to build runnable jars

20:09 technomancy: you mean for java -jar?

20:09 aphyr: yeah

20:09 technomancy: have you tried java -cp whatevs.jar clojure.main -m riemann.main?

20:10 hyPiRion: pandeiro: it's common to just say with or without replacement

20:10 * Raynes trampolines technomancy

20:11 hyPiRion: where "without replacement" means that once you've used an element, you cannot reuse it

20:11 technomancy: lein trampling

20:11 aphyr: hmm, well, disabling aot means it doesn't get bogged down writing to disk

20:11 but it still takes pretty much as long to load the repl

20:12 technomancy: then it's out of my hands =\

20:12 aphyr: maybe ~25% faster, it's a start...

20:13 technomancy: lein 2.2 will let you set :aot just in the :uberjar profile, if that'll help

20:13 aphyr: Yeah, sounds like.

20:13 Still wish I knew what was making it so slow

20:14 technomancy: compy layshun

20:14 aphyr: used to be much faster, haha

20:14 Something changed at some point

20:30 * jcromartie begins his 7 day news/media fast, maybe I'll write more code that way

20:30 technomancy: not if IRC isn't media

20:34 flu-: or is this a media fast like a juice fast, i.e., all you will do is consumer news and media

20:34 *consume

20:55 jcromartie: technomancy: IRC doens't count

20:55 flu-: hah, that sounds terrible :)

20:56 near-real-time interaction with people (not in comments sections) doesn't count

20:56 I mean media published in a top-down/broadcast fashion: news (incl. aggregators), blogs

20:57 callen: jcromartie: it does seem rather time-wastey doesn't it?

20:57 jcromartie: I like the idea.

20:58 jcromartie: it stresses me out just to read headlines… I feel the effect on my body

20:58 but it's addictive to get that hit of novelty

20:58 to think that somewhere out there, just around the next link, is that new bit of information that will change everything!

20:59 some major event that means everything is different now: either SHTF, or we've stumbled on a real utopia

21:00 or some programming language or technique that will finally solve all the problems of software development: do it in no time, with no bugs, and it can be changed on a whim

21:00 those things don't exist, but your mind wants to believe that they do

21:01 </rant>

21:01 callen: jcromartie: I've experienced the same things. right down the list.

21:02 jcromartie: :) well I'm glad I'm not just crazy, then

21:02 or at least we both are

21:02 callen: jcromartie: including that feeling of stress, right in your chest, from reading a headline.

21:03 jcromartie: incidentally, I have the same reaction listening to NPR sometimes because of some cultural disparity on my part.

21:03 jcromartie: http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0047189

21:04 that study only concluded a correlation for women

21:08 xeqi: Raynes: needed a gravatar lib and found clavatar, thanks

21:08 callen: jcromartie: I find HN to be distressing even if I agree with the general sentiment of a particular thread.

21:14 yogthos: ping

21:24 pandeiro: can anyone show me how'd connect to the drawbridge repl in the vanilla heroku lein template app?

21:25 gfredericks: hyPiRion: woah man you are some kind of leiningen admin or something

21:25 hyPiRion: did the commit look sane?

21:25 hyPiRion: gfredericks: yeah, I looked at it

21:25 Looked sane from my point of view. :)

21:26 gfredericks: phew

21:26 trptcolin: gfredericks / hyPiRion: this is a breaking change, right?

21:26 pandeiro: `REPL_USER=a REPL_PASSWORD=b lein run` (with app.web added as :main) and then `lein repl :connect a:b@localhost:5000/repl` ?

21:26 gfredericks: trptcolin: for an undocumented feature, yes

21:26 trptcolin: e.g. reply's :main is just ReplyMain

21:26 and now fails

21:26 gfredericks: oh noes!

21:27 trptcolin: i mean, i can personally deal, no big deal. but i hack on lein.

21:28 so i'm not sure how many folks will see issues

21:28 hyPiRion: well, I never thought it would break anything not already broken

21:28 cemerick: pandeiro: need http://

21:28 trptcolin: what is the recommended :main option for a java main?

21:28 hyPiRion: didn't realize it broke working stuff

21:28 gfredericks: trptcolin: I don't know of one

21:29 pandeiro: cemerick: ha. thanks

21:29 got spoiled with curl

21:29 trptcolin: i'm not 100% opposed, just want to make sure we think it through before we push out 2.2.0

21:29 gfredericks: I didn't feel qualified to assess the issue; I just deferred to the thumbs up from phil

21:29 I should find that to make sure I didn't misinterpret

21:30 hyPiRion: trptcolin: Yeah, I think `lein run` should run java mains without issue too.

21:30 gfredericks: what error should be shown if both fail?

21:31 hyPiRion: gfredericks: "Nobody here but us chickens"

21:32 gfredericks: well my motivation for this is that when your main ns fails to load it shows a ClassNotFoundException

21:32 which is terribly misleading

21:33 trptcolin: hyPiRion: http://clojure-log.n01se.net/date/2013-05-21.html#14:22b

21:33 trptcolin: heh, the awful hack i'm imagining is branching on the first letter being upper-case/lower-case

21:33 gfredericks: looks like he had a couple ideas for other ways to do it

21:33 a plugin or a different option than -m

21:34 trptcolin: i like that. -m for an ns, -something-else for a class.

21:35 gfredericks: -c ?

21:36 trptcolin: that wouldn't allow you to put :main ReplyMain in your project.clj though, eh?

21:36 hyPiRion: gfredericks: :main-class

21:36 gfredericks: ah ha

21:37 trptcolin: right. again, not that it's an issue for me personally, but we can keep using that as an example, that's fine.

21:37 gfredericks: dangit now I need to write moar tests

21:37 trptcolin: there was a related issue where we were thinking of making :main have nothing to do w/ the starting repl ns

21:37 but i seem to recall we decided to hold off for 3.0

21:38 * gfredericks has no idea what that means

21:38 gfredericks: oh

21:38 right

21:39 trptcolin: i guess we really oughta move this into #leiningen

21:40 hyPiRion: Oh hah

21:40 callen: I forgot that was a thing.

21:40 hyPiRion: I thought we were in #leiningen

21:44 bttf: is there a way i can insert an element in between the elements of a vector, such as [1 2 3] into [1 a 2 a 3]

21:44 gfredericks: bttf: not efficiently

21:44 you can interleave and get a seq

21:45 and throw that back into a vector if you really want to

21:45 bttf: well i have a (str "With different sentences." "Like this." "And I'd like to get a space in between each string programmatically")

21:45 gfredericks: you want a string output?

21:45 callen: bttf: join?

21:46 bttf: i have string output but

21:46 gfredericks: &(clojure.string/join " " ["some sentences." "in a vector." "like this."])

21:46 lazybot: ⇒ "some sentences. in a vector. like this."

21:46 bttf: ,(str "These strings have" "no spaces inbetween")

21:46 clojurebot: "These strings haveno spaces inbetween"

21:46 bttf: cool

21:46 thx

21:56 akurilin: Quick question. Say I have a ref whose value I want to double-check, and if it matches a certain condition, I need to update it. Is dereferencing the ref inside the dosync the way I would handle the initial check of the value?

21:57 gfredericks: akurilin: I believe so

21:58 hyPiRion: akurilin: use ensure to avoid other transactions to update the value of said ref

21:58 brehaut: if its important that you dont change it when the predicate doesnt match then yeah

21:59 hyPiRion: i.e. ##(let [a (ref {})] (dosync (ensure a)))

21:59 lazybot: ⇒ {}

21:59 hyPiRion: if you just use @ref, the value may be updated if the transaction is retried

22:00 akurilin: Does dosync retry? I must have misread this, I thought this happened only for atmos.

22:00 *atoms

22:01 gfredericks: it does

22:01 akurilin: That was actually why I didn't want to work with swap! since I have a counter in the value I'm working with, and so retries would totally break that.

22:03 gfredericks: you can't use atoms because the atom would have a counter?

22:04 akurilin: As I said, I must have misread how the different concurrent types work.

22:04 hyPiRion: akurilin: a dosync may be retried, yes, but they won't update any reference twice

22:04 akurilin: hyPiRion, so what you're saying is that something like "alter" will only be called once at most?

22:05 muhoo: ddellacosta: that was an interesting collision

22:05 hyPiRion: for instance, (dosync (alter a + 1) (println "heyooo") (alter b * 3)) may print "heyooo" multiple times, but a will only be incremented at most 1 from this transaction, and b will only be multiplied by 3

22:05 gfredericks: akurilin: they can be called several times, but if they're pure functions then it doesn't hurt anything

22:06 ddellacosta: muhoo: what do you mean, sorry?

22:06 muhoo: ddellacosta: https://github.com/ddellacosta/friend-oauth2/pull/8

22:06 ya

22:06 ddellacosta: oh, haha!

22:06 muhoo: yes, thanks for those changes, really awesome. Sorry I just updated everything yesterday! Murphy's law.

22:06 muhoo: sorry, it seems we were working on the exact same stuff at the exact same time, in never expected that.

22:07 ddellacosta: it is as the Universe ordained. Or, more likely, random coincidence.

22:07 muhoo: quntum entanglement.

22:07 akurilin: gfredericks, in hyPiRion's example, wouldn't altering ref a and b be considered a side-effect?

22:07 gfredericks: no

22:07 that's controlled by the transaction

22:08 muhoo: ddelacosta: well i made the changes because i didn't understand what was going on, and needed to. now i'm looking at a hairy merge, and i'm lost again.

22:08 gfredericks: akurilin: i.e., the transaction is watching for those and can "undo" them before it retries

22:08 akurilin: gfredericks, Ah perfect. I'm assumign it'll also make sure to use the latest values of a and be as well.

22:09 ddellacosta: muhoo: well, the updates you made to the arguments are great, and I like some of the other clean-up you made. I was actually in the midst of a merge when I realized you were on an older branch. So, I don't know if you want to go through the effort again, but I would certainly appreciate it. I mean, even if you see stuff in the new code that could be nicer. Not that I want to dump all that work on you…heh.

22:09 gfredericks: akurilin: yep

22:09 callen: muhoo: is this what you were referring to earlier?

22:09 muhoo: ddellacosta: that might be best then. what i did won't apply cleanly, but i could manually redo it

22:09 ddellacosta: muhoo: sorry. :-(

22:10 muhoo: callen: friend/oauth2

22:10 akurilin: gfredericks, and so, is the difference with swap! that swap! simply doesn't care about preventing the side-effect, unlike dosync?

22:10 gfredericks: akurilin: no, it's that it's not coordinated with other atoms

22:10 so you don't need a transaction at all

22:10 callen: which is preferable, when applicable.

22:10 gfredericks: it still can be retried and should therefore be side-effect-free

22:10 so if you're using just one ref then you probably could use an atom instead

22:12 callen: gfredericks: or put differently, if you don't need to coordinate changes across your atoms, you don't need ref.

22:12 muhoo: ddellacosta: tis all good. i guess my fault for not checking first.

22:12 akurilin: gfredericks, got it! Perfect.

22:13 ddellacosta: muhoo: not at all. Thanks again for taking the time!

22:14 gfredericks: akurilin: counters are the classic example of atom usage

22:14 akurilin: Is there actually a safe way of pulling off that "check condition and modify" with an atom, or would only ref fit in this case?

22:14 gfredericks: the swap function you provide can see the current value of the atom

22:15 brehaut: akurilin: if you hoist the check inside the function you pass to the atom, then it can safely be done attomically

22:15 * gfredericks starts a band called "Hoist the Check"

22:15 akurilin: Oh actually there's compare-and-set for very simple cases

22:15 * gfredericks starts another band called "Hoist the Czech"

22:16 brehaut: Hoist the Cheque

22:20 akurilin: brehaut, sounds good

22:32 konr: What was that function that could slice seqs as in (mysterious-function [1 2 3 4] 2) -> [[1 2] [3 4]]?

22:32 amalloy: $findfn 2 [1 2 3 4] [[1 2] [3 4]]

22:33 lazybot: [clojure.core/split-at clojure.core/partition-all clojure.core/partition]

22:33 egghead: wut

22:33 konr: thanks! didn't know of that bot

22:33 egghead: what just happened

22:33 amalloy: akurilin: if you go to the effort of making c-a-s useful, you'll have just reinvented swap!

22:36 akurilin: amalloy, definitely not in the reinventing business right now, I'll stick to swap! :)

22:40 konr: $findfn [1] 0 [0 1 0]

22:40 lazybot: []

22:40 konr: $findfn 0 [1] [0 1 0]

22:41 lazybot: []

22:42 amalloy: konr: are you looking for like..."add on both ends"? there are no built-in collection types for which that is efficient

22:43 konr: amalloy: yes, I think I'll have to use (concat [0] foo [0]) :(

22:44 gfredericks: finger trees?

22:44 I guess they're not quite "built in"

22:44 amalloy: konr: are you trying to build pascal's triangle?

22:45 konr: amalloy: something similar :)

22:46 gfredericks: pascal's wide triangle

22:48 bbloom: alandipert: firefox is generally much slower than v8 for cljs

22:48 alandipert: dnolen is the man to ask though

22:49 brehaut: bbloom, alandipert: i recall dnolen was submitting tickets to firefox about that just the other day

22:51 bbloom: http://www.50ply.com/cljs-bench/

22:51 brehaut: https://bugzilla.mozilla.org/show_bug.cgi?id=874174

22:51 bbloom: i don't see equiv in those benchmarks though, probably should be there

22:52 we do, however, need to add a fast path for equiv. clojure has one for strings, numbers, etc, that cljs doesn't have yet

22:52 that work is behind reified keywords, i think

22:52 brehaut: http://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv

22:53 bbloom: dnolen told me that major cljs development is basically driven by whenever he and i can find a day to hack together :-) we've mentioned starting a google hangout to try to increase the number of "deep" contributors

22:55 alandipert: equiv is a particular issue for arraymap, if that's a NEW problem that you're encountering. dnolen has some notes here: https://github.com/clojure/clojurescript/commit/08489f39060be1097fa23abc8d5042c86e68dd4d

22:56 alandipert: brehaut: if either of you want to take a crack at the equiv fast-paths, i'd be happy to help point you in the right direction

22:57 hint: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L24-L40

22:58 brehaut: thanks, that's an interesting thread

22:58 brehaut: no problem.

23:00 tomoj: bbloom: so do you understand yet how you're supposed to use channels?

23:02 like a process is (fn [in out]) or something?

23:02 bbloom: tomoj: only theoretically. it's the same design patterns as golang (mostly)

23:03 your code that writes to/from channels is just gonna look more procedural… get over it :-)

23:04 tomoj: yeah I just haven't been able to build/imagine a single thing I thought was a good example of core.async's intended usage

23:04 I haven't used alt at all for example

23:04 bbloom: go emulate the mini google search example from rob pike's talk

23:05 maybe that will make it click

23:05 tomoj: I've been trying to make (fn fork [in out1 out2]) but can't make it work

23:06 I don't see how to deal with close! at all either

23:06 (fn fork [in] [out1 out2]) with auto-closing makes sense, but that doesn't seem to fit csp

23:11 bbloom: i haven't tried it yet, so i dunno for sure

23:12 tomoj: not sure if go is a good model. hoare neither. and the slides rich linked to 404'd :)

23:35 the google query thing doesn't seem like a good fit

23:35 or at least, it needs major translation I think

23:44 bbloom: https://www.refheap.com/paste/ed841903a7ea3e9f05b9087a2 hmm

23:45 broken

Logging service provided by n01se.net