#clojure logs

2013-05-22

00:00muhoofriend does both
00:01muhooit also provides a common framework for authorization/authentication using passwords, openid, and oauth
00:02muhooif 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.
00:03tomojwhy not have reducers implement conj?
00:03tomojsome people would abuse it, but.. it would be handy
00:04tomojoh
00:04tomojthey can't implement the rest of it
00:04tomojI guess you can just write a conj reducer
00:04tomojor maybe (r/cat [x] coll) ?
00:05tomojmuhoo: I think ddellacosta has an example
00:09tomojit would also be cool I think to define a sorted-kv reducer which supports conj
00:09tomojwish you could add one or two more readers too
00:11amalloyyeah, i think it has to be cat [x], tomoj
00:11amalloycertainly you can't implement IPersistentCollection
00:11tomojright
00:12tomojI remember again rich saying "maybe all we need is conj!"
00:12tomojexcept I'm equivocating I think
00:12tomoj(that's not a direct quote)
00:12muhootomoj: his is for fb and github, yes, i'm looking at it (and modding it)
00:13muhootomoj: twitter uses oauth1 tho.
00:13tomojoh, I misremembered twitter being in there
00:15muhooi've done this before, created a workflow for google apps which used a modified openid. it was not fun tho.
00:17tomoj:)
00:17muhooi am going to write a library to do this, and i'm going to call it "bird flu"
00:18sinistersnarenoob to clojure: if noir is deprecated, what can be used that is just as simple?
00:19muhoosinistersnare: there's libnoir. and someone created an attempt at a batteries-included thing to replace noir, but i forget what it's called
00:19sinistersnaremuhoo: people say compojure, but when i look at that, it seems a lot more complicated than noir
00:19eggheadsinistersnare: compojure is just routing
00:19eggheadbut it's actually the routing lib that noir used
00:20muhooi just write directly to compojure
00:20eggheadhttp://www.luminusweb.net/ is the 'batteries included' one but I agree about just using compojure :3
00:21sinistersnaremuhoo: i understand, but it seems scary D:
00:21sinistersnareegghead: let me look into that, thanks
00:21muhoosinistersnare: luminus, i think was its name
00:21muhoopedestal too
00:21muhoohell, i don't remember
00:21eggheadpedestal, ya
00:21muhoosinistersnare: it's not scary. it's just functions :-)
00:22eggheadthat one is all kinds of involved tho
00:22eggheadbut at least it's cljs :)
00:22brehautegghead: strangely enough, compojure doesnt do the actual routing either :P
00:22muhooi had a bad experience that made me suspicious of any big framework
00:22brehautthats clout
00:22sinistersnarei come from python/java and i really wanna get into FP.
00:23muhoosinistersnare: then learn ring, and how compojure is built on ring. it'll take you longer, but ring is beautifully functional
00:23egghead^
00:23sinistersnarethat may take a while, but thanks!
00:23sinistersnaregood to know
00:23brehautsinistersnare: http://brehaut.net/blog/2011/ring_introduction
00:23sinistersnarebrehaut: thanks!
00:23brehautits a little out of date on specific versions, but it covers all the basics
00:23sinistersnarei like how thats your thing
00:24brehautyeah sorry to toot my own horn
00:24sinistersnareits fine, i dont mind, its a good read
00:25brehautbiggest change id make if i edited it, is my comment about preferring moustache for routing. ive changed my mind and prefer compojure
00:25sinistersnarebrehaut: ok, ill remember that
00:25sinistersnarei dont know why, but i convinced my girlfriend to learn programming, and my time is being taken up on that
00:26sinistersnareso ill just have all of these tabs ssaved
00:26muhoobrehaut: could you edit it and add that note?
00:26brehautmuhoo: i guess i should
00:26brehautbit of a pain though; i broke my metaweblog post editing endpoint :/
00:27sinistersnare:(
00:27brehautobviously i should fix both
00:28brehautjust remember, friends dont let friends do xml-rpc
00:28muhoosomething tells me that your blog is backed by a db somewhere
00:28brehautmuhoo: it is indeed
00:28muhooi've brute forced stuff like that by using an sql console
00:28muhoo"just gimmme the damn data!"
00:28brehautmuhoo: lol
00:28brehautpgadmin to the rescue
00:30brehautwhat could go wrong
00:31muhooi've never had a problem with that
00:31muhoowatch your escaping tho
00:31brehauti accidentally destroyed all my code formating last time i edited something in pgadmin
00:32brehaut(which lets me sidestep the escaping problem)
00:32muhooi'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.
00:33muhoodid 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
00:34brehauthah
00:34brehautyou are brave to tackle the wordpress schema imo
00:34muhooi got lucky. the links were all in one field, and it had nothing else in it, IIRC
00:34brehautphew
00:36muhoothis was like 2007 tho. maybe it's gotten worse.
00:36bairuihand-editing sql updates against a hostile schema with backups isn't bravery but rather prudence :p
00:36muhoocome on guys, it's just SQL :-P
00:36brehauti have been lucky enough to not have used wordpress in years
00:37muhoohow could anyone writing in clojure be scared of SQL
00:37brehautlol
00:37muhoomy blog is still in wordpress. i have no need to change. blogging peaked and mostly ended in 2010, AFAICT
00:38muhooi think my last blog entry was early 2011 or something
00:38brehautwait, blogging in general, or just for you?
00:39muhooin general, AFAICT. it was a steep drop-off after 2010. i blame twitter and FB
00:39brehautmuhoo: updated as requested
00:39muhoobrehaut: thanks!
00:40brehauti do need to find time to update all the code samples to use modern clojure and lib versions
00:40muhoosecond-order issue :-)
00:40brehautheh
00:40brehauti like to think that at least it states the dependancies explicitly, so its not a surprise to anyone
00:41muhooby the way, thank you for that particular entry. it helped me get started with clojure web stuff last year.
00:41brehautno problem, glad it helped
00:46bairuisql 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.
01:01avishaihi
01:01avishaia question about agent error-handlers
01:01avishaisuppose i want to restart the agent to a sane state
01:01avishairestart-agent isn't allowed in error-handlers
01:02avishaiso i have to either queue that action to some supervisor
01:02avishaior instead of restarting (send a (fn [_] new-state))
01:03avishaisend doesn't :clear-actions
01:03avishaiand having a supervisor feels unclean
01:15amalloyavishai: 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))))
01:16amalloyi 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
01:19avishaiyes, i guess a wrapper function would be an easy solution
01:21avishaibtw, how can i print clojure data structures in reader format?
01:22brehaut,(prn {:a [1 2 "three"]})
01:22clojurebot{:a [1 2 "three"]}\n
01:26avishaibrehaut, 10x!
01:27avishaiamalloy, what is the common use case for error handlers?
01:27avishaiin many cases restart is necessary to preserve linearity
02:22ddellacostahow do I get the metadata associated with a namespace? Specifically trying to figure out the version of a lib in the repl.
02:24ddellacostaHmm, this gives me author and doc: (meta (ns-name 'clojure.core.cache))
02:25tomojit shouldn't..
02:25ddellacostaI guess I don't have version info there
02:25ddellacostano?
02:25clojurebotno is tufflax: there was a question somewhere in there, the answer
02:25ddellacostahaha
02:25tomoj&(meta (ns-name 'clojure.core))
02:25lazybot⇒ nil
02:25tomoj&(meta (find-ns 'clojure.core))
02:25lazybot⇒ {:doc "Fundamental library of the Clojure language"}
02:25ddellacostawoah
02:25tomoj&(class (ns-name 'clojure.core))
02:25lazybot⇒ clojure.lang.Symbol
02:25ddellacosta&(meta (ns-name 'clojure.core.cache))
02:25lazybotjava.lang.Exception: No namespace: clojure.core.cache found
02:25ddellacostad'oh
02:26ddellacostaCan I use in this?
02:26ddellacosta&(use 'clojure.core.cache)
02:26lazybotjava.io.FileNotFoundException: Could not locate clojure/core/cache__init.class or clojure/core/cache.clj on classpath:
02:26ddellacostayep
02:26ro_styogthos|away: thanks for the speedy lib-noir update :-)
02:26ddellacostaanyways, I wonder what version of core.cache I'm using.
02:26tomojoh, I see
02:26ddellacostathere's probably more productive ways to figure it out.
02:26ddellacostaheh
02:26tomojinteresting
02:27tomojreally weird
02:27tomojdon't do that
02:27tomoj:)
02:27ddellacostahahaha
02:28tomoj,(ns ^{:doc "foo"} foo)
02:28clojurebotnil
02:28tomoj,(meta (ns-name 'foo))
02:28clojurebotnil
02:28amalloyddellacosta: 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
02:28amalloyinstead, lein deps :tree shows you all the dependencies and versions you have, and why
02:28tomojwell, I dunno what's goin on with clojurebot
02:28ddellacostaamalloy: yeah, I think I remember seeing it somewhere so I ended up assuming it was consistent in the metadata
02:28tomojbut it looks like sometimes the metadata is left on the name of the ns
02:29ddellacostatomoj: well, I'll stop trying to break it. heh
02:29tomojbut it might disappear if someone alter-meta!'s..
02:29ddellacostahaha
02:29tomojnot that people tend to do that
02:29tomojor maybe clojure.core is just a special case
02:29tomojin any case, look for ns metadata on the ns, not its name
02:30ddellacostayeah, 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...
02:30tomojah!
02:30amalloytomoj: huh? in what cases is there metadata on the symbol naming a namespace?
02:30ddellacostabut I think I'll just explicitly put it in my project.clj and shortcut the whole thing
02:31tomojhttps://www.refheap.com/paste/ef09e6fc74ab7122b1c59323f
02:31ddellacostaamalloy: this works for me in the repl: (meta (ns-name 'clojure.core.cache))
02:31ddellacostait gives me {:author "Fogus", :doc "A caching library for Clojure."}
02:32tomojthat's just a coincidence, ignore it :)
02:32amalloy&(doc ns-name)
02:32lazybot⇒ "([ns]); Returns the name of the namespace, a symbol."
02:32amalloyns-name on a symbol shouldn't even work at all, should it?
02:32tomojwell it calls the-ns on whatever you pass it
02:32tomojpresumably to make that work
02:33amalloythe-ns, or find-ns?
02:33tomojthe-ns
02:33amalloy&(doc the-ns)
02:33lazybotjava.lang.SecurityException: You tripped the alarm! the-ns is bad!
02:33amalloy,(doc the-ns)
02:33clojurebot"([x]); If passed a namespace, returns it. Else, when passed a symbol, returns the namespace named by it, throwing an exception if not found."
02:33tomoj,(ns-name 'foo)
02:33clojurebotfoo
02:33tomojer
02:33tomoj,(ns-name 'frobniz)
02:33clojurebot#<Exception java.lang.Exception: No namespace: frobniz found>
02:33tomoj,(ns-name 'clojure.core)
02:33clojurebotclojure.core
02:34amalloy,(the-ns clojure.core)
02:34clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.core, compiling:(NO_SOURCE_PATH:0:0)>
02:34amalloyhuh. somehow i remembered the-ns being a macro
02:34ddellacostanaw, it's pretty simple isn't it, never looked at it before
03:28dabdThe following function causes a stack overflow. https://gist.github.com/dabd/5625808. Perhaps a problem in the implementation of 'split-with'?
03:30tomojno, it's building up so many concats
03:31tomojif you replace the concat with (into (vec left) (cons new-val right)) to make it eager, it will work
03:31tomojnot that that is a very good implementation
03:31dabdyes i just found the problem is wih concat which builds lazy seqs
03:32tomojwhat are you trying to do? looks like just a sort?
03:32dabdsimilar problem here: http://stackoverflow.com/questions/9814892/insertion-sort-in-clojure-throws-stackoverflow-error
03:33tomojoh just for fun?
03:33dabdyes i should do a sort-by instead
03:55wei_does anyone have an example of a friend facebook example with a splash page? the given example goes straight to the facebook auth page
03:55callenwei_: this is #clojure not #facebook_support
03:56callenwei_: oh you mean the library Friend
03:56ddellacostawei: are you talking about setting up friend to use with facebook authentication?
03:56ddellacostawei_: check this out. https://github.com/ddellacosta/friend-oauth2-examples
03:56callenddellacosta: neat.
03:57ddellacostawei_: you'll need to use my friend-oauth2 lib, and I really really need to push the csrf stuff to production...
03:57ddellacostacallen: thanks.
03:57ddellacostadamn, I should do that right now while I'm thinking of it
03:58callenddellacosta: I'm considering adding facebook auth to a project of mine but find Friend overbearing
03:58callen#first_world_problems :(
03:58wei_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
03:58ddellacostacallen: 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
03:59ddellacostawei_: 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
03:59ddellacostaum, one sec
03:59wei_yep!
04:00tomojit looks like it is not safe to bind Compiler/LOCAL_ENV to a map with non-LocalBinding values
04:00tomojduring macroexpand
04:00tomoj:(
04:00ddellacostawhere the heck is that
04:00ddellacostaah, here you go
04:00ddellacostawei_: check this line out: https://github.com/cemerick/friend/blob/master/src/cemerick/friend.clj#L173
04:01ddellacostawei_: friend lets you pass in a number of configuration arguments when you set up your workflow in the main handler
04:02ddellacostawei_: 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.
04:05callenddellacosta: the workflow nonsense is part of my problem.
04:05ddellacostacallen: what don't you like about it?
04:05wei_would I still use oauth2/workflow? I added the :login-uri "uri" but it's not redirecting
04:05callenddellacosta: I come from Django and Flask, Friend doesn't have a good overhead/value ratio.
04:06ddellacostawei_: hmm, hopefully I'm not wiping that config, it should work as is though
04:07ddellacostacallen: 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
04:07ddellacostacallen: 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
04:08amalloytomoj: IMO even if it worked, it would be disastrously unsafe to bind Compiler/LOCAL_ENV to anything at all
04:09tomojI don't understand Compiler much at all
04:09wei_ddellacosta, btw your library saved the day during my last hackathon, got facebook auth working quickly
04:09ddellacostawei_: sweet! Super happy to hear that someone is using it.
04:09wei_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
04:09tomojI've doven in and understood seemingl many small parts of it but still don't understand it at all..
04:10tomojclojure.tools.macro pretty much does what I'm looking for I think
04:10tomoj.. just reimplement macroexpansion
04:10ddellacostawei_: 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.
04:10wei_unfortunately :login-uri is not having an effect, should I change unauthenticated-handler too?
04:11tomojddellacosta: btw, thanks, for fb example was extremely helpful to me
04:11ddellacostawei_: still trying to find the answer to that question…worrying I'm killing it. Sorry, gimme one sec.
04:11tomojany plans to just make it into a little library? :)
04:11ddellacostatomoj: great! you're very welcome.
04:11ddellacostatomoj: huh, do you think that'd be useful? I guess it could be huh?
04:11tomojI pretty much did
04:12ddellacostanice. haha
04:12tomojbut felt uncomfortable doing it since I copied so much from you
04:12tomojso uh I hope the license on that is open
04:12ddellacostameh, that's open-source so no worries.
04:12ddellacostayeah, MIT I believe, so pretty permissive.
04:12ddellacostano, that's totally the intent.
04:12tomojcan I EPL mine? I hate licenses
04:12tomojor if you release one I won't have to
04:12tomoj:)
04:13ddellacostasure, go for it!
04:13ddellacostaah, yeah, I have it under MIT.
04:13ddellacostaI 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.
04:14tomojI guess it would be unwise to just blindly follow the masses and choose EPL
04:14ddellacostawei_: sorry, still looking through my code to figure out what the deal is with login-uri
04:14tomojI don't know anything about it
04:14ddellacostaheh
04:14tomojI can't afford to hire a lawyer to tell me which to pick for my stupid little project..
04:14wei_ddellacosta: thanks for the help
04:15ddellacostaI read something on the clojure list recently that laid out the differences pretty well
04:15ddellacostabut basically, MIT is super permissive
04:15ddellacostaand EPL gives the author more rights I think
04:15ddellacosta= my expert legal analysis
04:16ddellacostawei_: ah, okay, so it really shouldn't have anything to do with my lib
04:16ddellacostawei_: just make sure you are passing it into friend/authenticate
04:17ddellacostawei_: 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
04:18tomojI looked and realized I never finished my library extraction
04:18tomojbecause I already had something working in friend-less vanilla ring
04:18tomojcallen: :D
04:19SegFaultAXBe extremely careful about taking advice on software licensing. Most people have an inaccurate, incomplete, or incorrect understanding of software licenses.
04:19tomojbut I think I'll just port to 'vanilla' interceptors because ring has been awkward with what I'm doing and
04:20tomojs/ and//
04:20wei_ddellacosta: here's my routes, it's a little long-winded https://gist.github.com/yayitswei/5626017
04:20wei_thanks again
04:21ddellacostatomoj: I agree w/SegFaultAX re taking advice on licensing, especially mine
04:21tomojI am acquainted with a software lawyer
04:21tomojdoes 'most people' include them? :)
04:21ddellacostawei_: huh, okay
04:22SegFaultAXtomoj: The EFF also provides channels for getting advice on this topic if it really matters.
04:22tomojisn't the EFF always going to tell me to use GPL
04:22SegFaultAXNo.
04:22ddellacostawei_: you know, I may be killing login-uri, in the older lib, I apologize
04:22tomojoh did I mix them up with FSF
04:22SegFaultAXtomoj: I doubt the FSF would either.
04:23tomojhow about stallman?
04:23SegFaultAXHah.
04:23SegFaultAXHe'd definitely tell you to use a proprietary license.
04:29callentomoj: :)
04:30tomojcallen: I think I'm going to try ripping interceptors out of pedestal..
04:30callentomoj: solid.
04:30callentomoj: let me know how it goes.
04:31callentomoj: seemed like one of the few things worth salvaging.
04:31tomojI still gotta try it to learn about the rest
04:31tomojclj-http also leaves me unsatisfied
04:32tomojI got core.async working so that is tempting
04:32callentomoj: I haven't needed interceptors because the raison d'etre is something I've avoided via small and dirty trick.
04:33tomojwhat's the trick?
04:34callentomoj: request context (across middleware) that is forced to fetch data dependencies in parallel
04:35callenwhich 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.
04:40callentomoj: this is partly why I was so hellbent on my request context thing - enables the avoidance of worse complexities.
04:40callentomoj: learned that lesson from Django and Flask.
04:43SegFaultAXInterceptors seem pretty complicated.
04:43tomojso what I've seen in flask is you have a Pool or whatever
04:44tomojwhich is basically what I'm doing now, I put tasks onto an executor
04:45tomojin this case actually a flask app notices the output of those tasks so I just blackhole them..
04:47tomojbut I have a bunch of stuff just synchronous that I really don't want
04:47SegFaultAXI didn't follow that bit above about flask at all.
05:15tomojSegFaultAX: what bit?
05:19tomojnow persona tells me I don't have cookies enabled in conkeror
05:34AnderkentSo... (-> a-sorted-map rseq first key) or ((comp key first rseq) a-sorted-map)? #bikeshed-colors
05:50tomojhttps://www.refheap.com/paste/c674e1ffbb91c5af973a423c7
05:59kralnamaste
06:14amalloyAnderkent: 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
06:22Anderkenthm, yeah, that slightly better than just the threading form.
06:27tomojthere seems to be no way to tell that a channel is closed
06:27tomojexcept maybe trying to put and catching an exception..
06:29callentomoj: that's not true
06:29callentomoj: just add a trigger callback for the channel's closing
06:29tomojI'm talking about core.async, are you talking about lamina?
06:29callendammit. sorry.
06:29tomojno, my fault
06:30tomoj'channel' should probably mean at least 80% lamina for the time being :)
06:30callentomoj: it's WIP, file an issue.
06:30ddellacostacallen 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.
06:30callentomoj: 4rlz. if something doesn't make sense, make a documented query.
06:30callenddellacosta: It's 0323 where I am. I'm awake because I'm the goddamn Batman.
06:30ddellacostahaha. gotcha.
06:30tomojI never can tell whether a missing feature is supposed to be missing
06:30callengreen tea and beef stew to keep me company.
06:30ddellacostamm, sounds good.
06:31callentomoj: "supposed to be" is sophistry. File an issue.
06:31callenddellacosta: it's golden oolong. Delicious tea.
06:31callentomoj: the world needs to at least know it's a problem through the documented issue
06:31tomojyou think relevance/rich want to field questions in github issues?
06:31callentomoj: even if they refuse to fix it.
06:31ddellacostacallen: ha, I'm drinking oolong cold right now. Love oolong in general.
06:31callentomoj: sigh. are they doing that bullshit on JIRA too?
06:31tomojno, there's no jira last I checked
06:31callenddellacosta: 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.
06:32ddellacostagotcha.
06:32tomojmy guess would just be that they'd rather just keep their heads down and push it out, then answer questions later
06:32callentomoj: just file an issue and if you get redirected, do the appropriate copy-pasta.
06:32callentomoj: urufkjdsfnkjdnjhh
06:32callentomoj: what happened to fast-iterations and early feedback?
06:32callentomoj: what do you think will distract them more, a polite querying issue from you?
06:32callentomoj: or an angry blustery trolling from me?
06:33callentomoj: file the issue...
06:33tomojor else? :)
06:33callentomoj: come on, you've seen me in here.
06:33callenbut realistically, I don't want to bother Rich either. One of the nicest people on the planet.
06:34callentomoj: but it needs documented. so do it or I will :P
06:35callentomoj: okay so why can't you access the closed mutex?
06:35callentomoj: ManyToMany channel right?
06:35tomojI'm making a patch that adds closed? by doing that now
06:35tomojwell closed is an atom
06:36tomojso for closed? I wonder if you even need to grab the mutex
06:36callentomoj: well that's what puzzled me, I figured you could just grab the mutex.
06:36tomoj(.mutex chan) ?
06:37callenI don't know the exact API, I'm just pilfering through the core.async code.
06:37tomojI thought timeout was another chan impl but looks like it is just another MMC, so I guess you could rely on MMC specifics
06:38callenthe 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.
06:38callenwhich would make *me* happier anyway.
06:38callenabusing exceptions in clojure makes me feel stupid unless it's to paper over bad java code.
06:38callenI intentionally avoid loading slingshot partly for that reason
06:39tomojwait
06:39tomojclosed? can't be there
06:40tomojsee, a bit of thinking saved rich 10min or whatever :)
06:40tomoj(if (closed? c) (<! c) ...) this seems useless
06:40callentomoj: hrm?
06:41callenhttps://github.com/clojure/core.async/blob/master/src/clj/core/async/impl/ioc_macros.clj this perked me up
06:42calleninversion of control has been an on-and-off again subject here
06:42callenI saw a mention of monads
06:42callenI'm very curious about this code.
06:42tomojoh, I hadn't figured out what "ioc" stood for
06:43tomojI can't help wondering whether we really need a monad though
06:43callentomoj: you haven't spent enough time around java nerds.
06:45tomoj"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!"
06:45tomojcallen: oh it seems useless because the channel might have been closed in between the time you checked and the time you <!
06:45tomojthen you will receive a nil and think it was actually a nil message
06:47callenthe likelihood of a timing issue approaches nil, but you should file an issue and query about it.
06:49tomojwilco
06:49tomojI just thought of a nice solution I think, though, so still thinking for a bit
06:52tomojcallen: https://github.com/clojure/core.async/issues/3
06:53mindbender1Please can someone throw more light on what a pure function is?
06:53mindbender1or is not
06:54tomojhmm, my first thought was "meaning of the return value is a function of the meanings of the arguments"
06:54tomojbut that seems to beg the question :)
06:54clgvmindbender1: A pure function always returns the same result when called with the same arguments
06:55clgvmindbender1: even shorter but using a second term: a function without side-effects
06:55tomojwhich presupposes a sound meaning for 'same' on the argument and result types
06:56tomoj'without external side-effects' maybe?
06:56clgvtomoj: if you need a lawyer definition, yes ;)
06:56mindbender1clgv: even if its computation is not fully dependent in the totality of its argument?
06:56mindbender1on
06:58mindbender1maybe like reference something that's not local
06:59tomojit doesn't matter how, just what
06:59mindbender1tomoj: makes sense
07:00tomojanother example, a pure function can use aset or set! or transients or something
07:00mindbender1and *what* almost always refer to the return value?
07:00tomojas long as the impurity doesn't leak out of the function
07:01tomojwhat matters is 'same args => same return' like clgv said
07:01mindbender1tomoj: can you please give an example of impurity leaking out of a function?
07:02tomoj(fn [coll] (conj! coll 3))
07:02tomojit takes a transient and mutates it and then returns it
07:02tomojso people who call it have to worry about side-effects
07:02clgvtomoj: huh? why?
07:03tomojit doesn't take or return values
07:04clgvit always adds a 3. if you provide the same transient each time you'll get the same result
07:04mindbender13 is a constant
07:04tomojthere's no such thing as 'same transient'
07:04tomoj&(= (transient []) (transient []))
07:04lazybot⇒ false
07:05clgvwell, rephrase it to euqality in terms of clojures immutable datastructures
07:05tomojyou can't implement equality on a transient
07:05tomojexcept by identity
07:05clgv&(let [f (fn [coll] (conj! coll 3))] (println (f (transient [1 2]))) (println (f (transient [1 2]))))
07:05lazybot⇒ #<TransientVector clojure.lang.PersistentVector$TransientVector@464462> #<TransientVector clojure.lang.PersistentVector$TransientVector@13396b0> nil
07:05tomojwhich is not an acceptable meaning for 'same' in the definition we gave of a pure function :)
07:06clgv&(let [f (fn [coll] (conj! coll 3))] (println (persistent! (f (transient [1 2])))) (println (persistent! (f (transient [1 2])))))
07:06lazybot⇒ [1 2 3] [1 2 3] nil
07:06tomojclgv: https://www.refheap.com/paste/f64dd676ba2acc5986fa61436
07:06clgvI'd say that is clearly the behavior of a pure function
07:07tomojit's not even in the running
07:07tomojthe plane crashed and exploded on the runway
07:08clgvlol, ah k. I see what I forgot
07:08tomojspeaking of which, channels!
07:08tomoj:/
07:11mindbender1so if I understand correctly, equality of output for the same arguments defines a pure function?
07:11clgvmindbender1: do you ask for an academic definition or just to understand the concept?
07:11tomojhttp://en.wikipedia.org/wiki/Pure_function
07:11tomojit also can't send you an e-mail
07:12clgvtomoj: in combination with agents it can ;)
07:12clgvah transcations and agents I mean
07:12tomojthe agent handles that
07:12clgvyep
07:12tomojnot the pure function :)
07:12mindbender1clgv: 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
07:13clgvmindbender1: if it reads or changes globals, this is a good hint that it is not pure
07:13clgvmindbender1: tomoj's transient example is another to look out fot
07:13mindbender1yeah
07:13tomoj1) it has to take values as args and return a value
07:14tomoj2) it can't affect important parts of the rest of the program/system/world
07:14clgvmindbender1: closures with atoms are another hint
07:14tomojoh and yeah, uh, same args => same return
07:14mindbender1I was waiting for that clgv
07:15tomojbut memoize has a closed-over atom, and it is pure and returns a pure function
07:15clgvmindbender1: counter example: (let [f (let [c (atom 0)] (fn [] (swap! c inc))] (println (f) (f)))
07:15clgv&(let [f (let [c (atom 0)] (fn [] (swap! c inc))] (println (f) (f)))
07:15lazybotjava.lang.RuntimeException: Unmatched delimiter: ]
07:16clgv&(let [f (let [c (atom 0)] (fn [] (swap! c inc)))] (println (f) (f)))
07:16lazybot⇒ 1 2 nil
07:17clgvtomoj: 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
07:18clgvtomoj: if you just limit it to the function call you can call it pure
07:18tomojhmm, yeah
07:18tomojI almost said "arguably"
07:18tomojI chose "important" above carefully
07:19tomojlazy seqs are kinda weird too
07:19tomojI wouldn't say they're an edge case though
07:20clgvbut 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
07:20tomojyeah
07:20clgvluckily there is core.memoize ;)
07:22mindbender1thanks
07:23tomojmindbender1: http://en.wikipedia.org/wiki/Referential_transparency_(computer_science)
07:35mindbender1referentially opaque! :) Thanks tomoj, was helpful.
07:45xificurCleiningen 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)
07:46xificurCand `lein new first`just keeps hanging and never finishes
07:46xificurCany tips?
07:46Anderkentwhich jar did it download?
07:47Anderkenthttps://github.com/technomancy/leiningen/issues/1172 seems possibly related?
07:47xificurCleiningen-2.1.3-standalone.jar
07:49Anderkentjava 6 or java 7?
07:49xificurC6
07:50Anderkentok, as a hotfix try `lein upgrade 2.1.0`
07:51Anderkent(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)
07:51Anderkentas you might notice, windows is definitely a second-class citizen for lein :P
07:51AnderkentOnce 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
07:53xificurCAnderkent: trying out thanks a lot
07:54xificurCAnderkent: unfortunately i cant switch to linux at work
07:54mindbender1xificurC: fortunately you can run windows within linux from virtualbox ;)
07:55Anderkentit's also supposed to work better with cygwin
07:57xificurCmindbender1: i cant reinstall my pc just like that heh
07:58xificurCAnderkent: 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
07:58ucbcan 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 :(
07:59ucbinterestingly enough, "upgrading" leiningen fixes the NPE even if the upgrade is a noop
07:59lotiaexit
07:59Anderkentucb: probably because it tries to cache the credentials
07:59lotia\q
07:59ucbAnderkent: possibly
07:59ucbhaven't looked into it :)
07:59ucbI'd still like to not have to type these credentials in every time :)
08:00Anderkentdid you try `lein help deploying` ?
08:01ucbAnderkent: I did. I've read it all, but it's mostly about private repos? Perhaps I missed it.
08:01Anderkentthere's a bit about authentication in the middle
08:01Anderkenthttps://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md might be nicer to read
08:02Anderkent:q
08:02Anderkentoups
08:03ucbthanks Anderkent, will read
08:04Anderkentbasically you want a ~/.lein/credentials.clj.gpg so that you don't have to type the creds every time
08:04xificurCAnderkent: even with the provided batch file it downloaded 2.1.3, I even checked the file and it explicitly asks for 2.1.0
08:06AnderkentxificurC: can you post the output somewhere?
08:07xificurCAnderkent: I realised I had a LEIN_JAR environment variable that might have caused the issue so I deleted it and am trying again
08:26GrievreWhy is Clojure so much more popular than kawa?
08:26Grievre(I've never used either, I'm just curious)
08:32clgvGrievre: is it? what source did you read?
08:35clgvGrievre: I found a discussion on stackoverflow: http://stackoverflow.com/questions/1413390/why-clojure-over-other-jvm-lisps-kawa-armed-bear-or-sisc
08:37Grievreclgv: I mean I'm just going off of the fact that I hear clojure mentioned fairly often and kawa very rarely
08:40dnolen`Grievre: probably because it's yet another Scheme variant, Clojure offers quite a few enhancements over Scheme.
08:41xificurCAnderkent: same issues with 2.1.0
08:43Grievrednolen`: Like?>
08:43GrievreLike?
08:44dnolen`Grievre: better data structures, better concurrency support, multimethods, protocols, sensible module system, reducers, etc etc
08:54tomojcallen: "nil messages are not supported by design" - this is what I expected :)
08:59trptcolinxificurC: 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?
09:00trptcolinit sounds like an error that existed in lein 2.0.0-preview2 and older
09:01trptcolinhttps://github.com/trptcolin/reply/issues/37
09:01xificurCtrptcolin: give me a minute ill try to get the error again
09:01trptcolinalso, does `lein version` verify that you're not actually using an older lein version?
09:02trptcolinxificurC: ok
09:04xificurC`lein version` shows Leiningen 2.1.3
09:05xificurChowever I do have a Java 1.6.0 IBM version
09:05xificurCcan I copy the stacktrace from cmd?
09:06trptcolinxificurC: yes, please do
09:08xificurCtrptcolin: https://www.refheap.com/paste/14878
09:13winkthis is really interesting: http://prog21.dadgum.com/41.html
09:14xificurCtrptcolin: 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
09:20trptcolinxificurC: the second error is probably https://github.com/technomancy/leiningen/issues/1121
09:23trptcolinthe first one is annoying but it appears things are actually working after it finishes starting up - is that correct?
09:25xificurCtrptcolin: yes it does indeed
09:27xificurCtrptcolin: 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
09:27xificurCI could live without the last one but the first two should work
09:29trptcolinok, 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.
09:29xificurCtrptcolin: thanks for the support, I can wait for that :) Also I will try and look if I can get jre 7 on my pc
09:31clgvxificurC: do you use Eclipse+CCW on windows?
09:31trptcolinfor 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.
09:32xificurCclgv: no and I dont know what it is
09:32trptcolinactually 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?
09:33clgvxificurC: in case you are not sold to emacs: Eclipse with the Counterclokwise plugin is a Clojure IDE which has basic leiningen integration.
09:33xificurCtrptcolin: that is possible, I am no real programmer to answer that though
09:33xificurCtrptcolin: I'd just like to learn
09:34clgvxificurC: task support for uberjar or install is still missing AFAIK but you can start developing rightaway
09:35xificurCclgv: 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
09:38clgvxificurC: 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
09:39xificurCclgv: yeah the moment I lose all my nerves I'll do that :)
09:40noncomhi, 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
09:40noncomany suggestions on possible improvements?
09:43noncomoh, 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
09:46noncomummm.. anyone?
09:46trptcolinxificurC: 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.
09:47trptcolinbut 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
09:48xificurCtrptcolin: 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
09:49xificurCalso that stacktrace only printed in plain cmd, when I ran the command via Console I didnt get the stacktrace printed
09:58chronno_nomcom: maybe something like (mapv (juxt dec identity inc) (range 10))
09:59chronno_nomcom: juxt returns the vector you want
10:00chronno_,(mapv (juxt dec identity inc) (range 10))
10:00clojurebot[[-1 0 1] [0 1 2] [1 2 3] [2 3 4] [3 4 5] ...]
10:01chronno_noncom:^^
10:01tomojI'm guessing implementing the seq/reducer fns on channels is missing the point ?
10:01tomojs/channels/core.async channels/
10:03noncomchronno_: 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:04noncomi get the triplets because of how i calculate data
10:04chronno_noncom: try wrapping it with (apply concat (mapv (juxt dec identity inc) (range 10))
10:04noncombut there should be another way, which is as fast..?
10:04chronno_,(apply concat (mapv (juxt dec identity inc) (range 10))
10:04clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:04noncomwait, i'll try apply concat.
10:05chronno_,(apply concat (mapv (juxt dec identity inc) (range 10)))
10:05clojurebot(-1 0 1 0 1 ...)
10:05clgvnoncom: reduce+into instead of map?
10:06noncomreduce takes toooo long...
10:08clgvnoncom: I doubt that
10:10clgvnoncom: 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:13noncom... trying out the proposed solutions...
10:34astevehow would you abbreviate total time?
10:34astevetott or ttot?
10:34asteveI've seen ttot in the past and it doesn't make sense to me
10:35justin_smithseems frenchlish
10:35justin_smithduree totale - time totale - ttot
10:35llasramhah, I was going to say the same thing. TAI and all
10:35tos9asteve: why abbreviate it :D
10:35clojurebotIt's greek to me.
10:37noncomclgv: i have checked
10:37noncomreduce is really slower than apply concat
10:37noncomwith apply concat i get around 1200 fps while with reduce into i get 800-900 fps
10:38clgvnoncom: unlikely since concat and map are lazy and introduce the related overhead
10:38noncom(time) shows that apply+concat take about 0.1 ms while reduce+into takes about 0.7 ms
10:38clgvnoncom: can you post the code on refheap or the link to the file on github?
10:38astevetos9: because total-time-sub1s-vars is super duper long :)
10:38S11001001noncom: 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:38clojurebotSomething weird that I noticed: & (use '[clojure.contrib.json :as json]) & &| (json/pprint-json nil) |&
10:39clgvnoncom: concat is lazy and thus meauring the duration of the call doesnt give you any information
10:39noncomok, wait, let's try the extracted code now, wait a sec..
10:39llasramclojurebot is in rare form this morning
10:39clgvnoncom: measure the time with (doall (apply concat ...))
10:39tos9asteve: meh. I don't mind long variable names. Especially when the abbreviation is not immediately totally obvious.
10:40asteveperhaps tt would make more sense
10:40noncomactually the seq then goes into java direct buffer constructor, so it is unlazed there
10:40noncom.. anyway
10:41S11001001if your measurements include the full force too
10:43noncomhttp://pastebin.com/hMT9zsVd
10:43noncomhere
10:43noncomthe first function does the calc of vertices, the second function sends them into a nio buffer creator
10:44S11001001never do variant 3
10:44noncomevent if i'm applying (time) to a unlazed sequence, having wrong timing, the 3D engine's fps counter won't lie...
10:44noncomS11001001: yeah :D quickly learned that :D
10:45noncomi experience around 300 fps drop while using reduce
10:45S11001001well, ok. I think then maybe you could get away with map over mapv
10:46pandeirowould simply blocking on a ring handler be a decent way to implement long-polling on the browser side?
10:46tomojpandeiro: as long as you don't have a whole lot of users
10:46tomojI think..
10:47clgvnoncom: well if you write it like that you should use `conj` instead of into - that saves you a vector construction as well
10:47pandeirohmm..
10:47weavejesterpandeiro: It's a reasonable solution if you expect no more than, say, 1000 users per server.
10:47clgvnoncom: for full speed use a transient vector in the reduce
10:47pandeiroconcurrent users right?
10:47weavejesterpandeiro: Right
10:48pandeirook thanks, i'll go with that for this implementation and think about switching out jetty in the future
10:48pandeirojetty does not do websockets right?
10:49Ember-it sure does
10:49pandeirois there a way i can hook that up to compojure & ring-jetty-adapter?
10:49clgvnoncom: http://pastebin.com/RAnWWySs
10:50Ember-pandeiro: most likely yes, will require some work though
10:50Ember-websockets are very different from regular requests
10:50pandeiroright
10:51pandeiroi noticed i couldn't even import org.eclipse.jetty.websocket.* but i guess that's just a matter of grabbing the right jar...
10:51Ember-yes it is
10:51Ember-I've used websockets in jetty with java
10:51Ember-worked without problems
10:51pandeiroi also noticed jetty is at version 9 and ring-jetty-adapter pulls in 7 something
10:51Ember-yeah, 7 is old. I think websockets came in 8
10:51pandeirook
10:52pandeirocool for now i will just use my naive long-polling and later i will investigate websockets properly
10:52Ember-the right solution
10:52pandeiroi need to check out this httpkit too sometime
10:52Ember-:)
10:53noncomclgv: ehhh.. clojure.lang.ArityException: Wrong number of args (4) passed to: core$conj-BANG-
10:53pandeirothanks everybody
10:53Ember-with httpkit you'll enter the world of async
10:53noncomit takes only 1 elem to add...
10:53noncomi will sequence the calls i think..
10:53Ember-httpkit is basically node.js with clojure
10:53clgvnoncom: oh than `conj!` doesnt have the same arity as `conj`
10:54Ember-so all I/O must be done in an asynchronous way or you'll kill your performance
10:54pandeiroEmber-: i'd be entering the world of async if i used aleph too, right?
10:54Ember-application has to be built from ground up to support that paradigm to get the performance benefits
10:54Ember-aleph I do not know
10:54clgvnoncom: use multiple `conj!` then, e.g. (-> c (conj! ...) (conj! ...))
10:54pandeiroor maybe the solution is to just serve most of the app out of jetty and run the websockets server in a different thread?
10:55Ember-well, you could do that yes
10:56Ember-httpkit is pretty lightweight
10:56Ember-so you could use it and it's websocket support
10:56pandeiroyeah i just need to think about all the io i'm doing then
10:56Ember-just be certain you're not using blocking I/O with your websocket stuff though
10:56pandeiroyeah
10:56clgvnoncom: http://pastebin.com/EpCJimMG
10:58nDuffclgv: 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:58noncomclgv: checking.. doing time tests..
10:58gfredericksis there still no canonical implementation of a lazy hashmap?
10:58jcromartiepastebin is awful now
10:58noncomnDuff: it was me who initiated usage of pastebin, clgv originally proposed using refheap
10:58nDuffnoncom: tsk, tsk.
10:58S11001001~pastebin
10:58clojurebotHuh?
10:58clgvnDuff: noncom used pastebin.com so it was easiest to stay there...
10:59jcromartieWell anyway :)
10:59jcromartiehi #clojure, I miss writing Clojure
10:59jcromartieso I will
10:59mischovhi jcromartieL, you've made the right choice.. :P
11:01mefestois there a paredit command for flipping the positions of sibling forms?
11:01mefestoex: (do (this) (that)) => (do (that) (this))
11:02mefestosomething like in org-mode when moving list items around M-up / M-down
11:05vijaykiranmefesto: transpose-sexps ?
11:06noncomclgv: 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:06noncom?
11:06noncomif it would remain at 2000, that would be just the killer-solution!
11:07Anderkentnoncom: did you try timbre?
11:07clgvnoncom: without more context, it is hard to tell why this happens
11:07Anderkenthttps://github.com/ptaoussanis/timbre
11:08mefestovijaykiran: that's pretty much it! thanks :-)
11:09clgvnoncom: you should profile your code with jvisualvm or yourkit
11:14noncomyeah, 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:15KowboyI have a question about compiled classes with :gen-class
11:16Kowboyin my main method, one of the first things I do is try to set! *data-readers* to add some custom reader macros
11:16Kowboybut when I run my main class, it complains that "Can't change/establish root binding of: *data-readers* with set"
11:18KowboyI'm guessing this has to do with the fact that my main class is pre-compiled
11:22AnderkentKowboy: 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:24Anderkenti.e. you cannot call set! on a var that has not been thread-bound with (binding [var this-or-that] ...)
11:32jtoyhi all
11:42pjstadiggfredericks: are you going to strangeloop?
11:51KowboyAnderkent, this set! call works when I run it not as a pre-compiled main class, but through -m my.namespace
11:52AnderkentKowboy: via lein run or via java clojure.main ?
11:52Kowboyclojure.main
11:52Kowboyalso works via lein run
11:53mefestois there an official mimetype for edn? (ex. text/edn)
11:58AnderkentKowboy: can you do (println (.getThreadBinding (var *data-readers*))) and see if they're different
11:58Anderkentmy expectation is that something is binding *data-readers* when you run through clojure.main or lein run
11:58Anderkentbut not when you run directly through your main
11:58trptcolinshoreleave & clj-http both use application/edn
11:58gfrederickspjstadig: I just last night decided not to
11:59mefestotrptcolin: thanks
11:59Anderkentbtw why do you have to set! instead of doing (binding [*data-readers* (add-readers *data-readers*)] (do-stuff-with-new-data-readers))?
12:00trptcolinmefesto: sure
12:00gfrederickspjstadig: calendar math forecasts a good chance of my wife being 37 weeks pregnant at that point.
12:00gfredericksnow I'm no calendar mathematician
12:00KowboyAnderkent, it prints nil when running my compiled class
12:00trptcolingfredericks: congrats. same reason (-ish) i won't make lambda jam
12:00Kowboyand #<TBox clojure.lang.Var$TBox@225bb9ae> when running with lein rn
12:00gfrederickstrptcolin: curses!
12:01Anderkentyeah, so something is wrapping your code and providing the binding
12:01Anderkentwhich is why your set! works
12:01Anderkentyou could just make a wrapper around the main that does (binding [*data-readers* *data-readers*] (real-main))
12:12jcromartieI would like to start "lein repl" but my main namespace currently does not load
12:12jcromartieis there a way I can skip loading the main ns?
12:13jcromartieaside from temporarily changing project.clj..
12:13trptcolinjcromartie: it's a "soft" failure in lein master. one workaround is to set an :init-ns (which takes precedence over :main)
12:16trptcolinso you could do that in the project.clj too or use the higher-order task (HOT?) update-in
12:16trptcolini find update-in a little tricky to get the syntax right, but it's kind of nice
12:23technomancyupdate-in is tricky to use on top-level keys unfortunately
12:24technomancyyou have to give it an empty keyseq: lein update-in "" assoc :main clojure.main/main -- run
12:26technomancyit's new
12:27gfredericksnew is also a task
12:28Anderkenttechnomancy: lein help update-in says : is the project root
12:28technomancyAnderkent: oh yeah, that works too
12:31gfrederickstechnomancy: 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:31gfredericksfirst suggestion: "LEE-in"
12:31Anderkentclean - the c is invisible
12:31gfrederickshaha
12:32technomancywhat, default German pronunciation isn't counterintuitive enough?
12:32technomancy"Just watch the movie and say it the opposite of how they do"
12:33trptcolinthe 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:34gfredericksyou'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:34Anderkenthttp://www.forvo.com/search/leiningen that sounds reasonable and not counterintuitive at all
12:34KowboyAnderkent, the binding worked
12:35trptcolinexactly. when someone uses reply for cat videos they can pronounce it as they see fit
12:35technomancygfredericks: https://mobile.twitter.com/ieure/status/336983116910579712?p=v
12:35gfredericks"layNING-en"
12:38frankenBitsHi
12:38frankenBitsI am looking for some advice on Clojure & Webservices
12:38frankenBitsAnyone here familiar with using Clojure with WSDL & SOAP technologies?
12:39trptcolinhttps://github.com/seancorfield/clj-soap
12:41AnderkentHm. I can't use findfn in a standalone repl anymore. Weird
12:44Anderkenthttps://www.refheap.com/paste/14883 Any ideas?
12:44FoxboronAnderkent: what you trying todo?
12:45Anderkentload findfn in a standalone repl
12:45Foxboron(ns findfn.core)?
12:45Anderkenthttps://github.com/Raynes/findfn
12:47txdv(ns libuv)?
12:48TimMcgfredericks: lay-NIN-jen
12:49trptcolinAnderkent: bump the version. looks like 0.1.0 does that; 0.1.3 doesn't
12:49justin_smithAnderkent: 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:50Anderkent0.1.3 works
12:50Anderkentweird stuff, I remember it working
12:50Anderkentah, guess I did upgrade lein in the meantime, so maybe that broke it
12:50supersymgfredericks: lol... they even have a web site about pronounciation :D nice one
12:51justin_smithAnderkent: 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:51justin_smithswank 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:52Anderkentwow, but trying to use it with clojails blows up pretty hard
12:52Anderkentcan't even ctrl-c it
12:53Anderkenthttps://www.refheap.com/paste/14884 it doesn't like trying to update history from within the jail, I guess
12:54trptcolinthere's work on reply master to handle read-only filesystems
12:54Anderkentit's not read only
12:54trptcolinsame effect
12:54Anderkentah, I see
12:54trptcolintry to write file, catch exception
13:08djwonkhow can I convert a var (pointing to a function) to a string?
13:09djwonkor keyword?
13:09djwonkthis could be a terrible idea, but I want to see if it solves a problem I have
13:10nDuffdjwonk: what are you trying to accomplish? Could you give an example?
13:10nDuffdjwonk: is your goal to recover the function's source?
13:10nDuff...just get the name of the var? ...?
13:11djwonknDuff: (defn x [] nil) (str x) ; "my-lib.core$x@6b59cf26"
13:12djwonkI'd like to get just "x" out
13:12djwonkI don't need the source
13:13justin_smithdjwonk: (defmacro bare [x] `'~x)
13:13justin_smith(bare fn) -> fn
13:14justin_smiththat is a bad name, but whatever
13:14justin_smithyou could throw a call to str in there too if that is what you need
13:14djwonkjustin_smith: thanks
13:14justin_smithdjwonk: np
13:15justin_smithactually, (quote) may do what you want
13:15justin_smith(quote fn) -> fn
13:15djwonkah! (str 'x)
13:16justin_smith(comp str quote) if you want to make it a function all classy like
13:16justin_smithoops, no, because quote is a macro
13:17djwonkright. 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:18gzmaskwhen I use fireplace.vim, :FireConnect localhost:port and leon repl gives "usage: proto://" error. what am I doing wrong?
13:19justin_smithI think it wants http:// or ssh:// or whatever in front of localhost
13:19justin_smithmaybe tcp://?
13:20gzmaskjustin_smith: tried those, didn't work
13:20tos9gzmask: 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:21gzmasktos9: I tried :Connect , gives not found error. did I missed something in the depandcy chain?
13:22justin_smithmaybe nrepl:// is recognized as a protocol? or repl://
13:22tos9gzmask: No, I was saying it sounds like your fireplace.vim is outdated.
13:24arkhdoes anyone know of example code that uses org.flatland/tokyocabinet?
13:25gzmasktos9: what repo should I be using? I used one from github with 268 stars. looks offical
13:26tos9gzmask: Oh, no, never mind, carry on, FireplaceConnect is right, the docs are just wrong I think (I never use FireplaceConnect because of ^)
13:27gzmasktos9: what is ^)?
13:28tos9gzmask: "if you're using lein repl it should automatically connect,"
13:36djwonkare there some rough (or better) guidelines when to use metadata?
13:37djwonkhttps://github.com/bbatsov/clojure-style-guide is cool but is about the how, not the why
13:40noididjwonk, use metadata for data that shouldn't affect object equality
13:42djwonknoidi: great. any more tailored guidelines for functions?
13:43noidifunctions don't have metadata
13:43noidivars do
13:43djwonknoidi: right, I should speak more carefully. defn can attach metadata, that's what I meant
13:45djwonkhere 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:45djwonkhttps://gist.github.com/bluemont/43216ec4543115c29ee7
13:45noidisorry, 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:46djwonkoh
13:46djwonkso in my example, I'm putting a string into metadata, which ultimately will show up to a user. that feels wrong
13:47djwonkdoing this right means thinking multilingual, too -- I probably should look around more.
13:50noidiI think metadata shouldn't affect what your function does
13:50noidimetadata does not impact equality, and two functions that do different things can hardly be called equal
13:52noidiI don't know what I'm rambling on about, of course a function can't access its own metadata
13:52noidijust ignore me :(
13:53noidioops, that should've been a ":)"
13:55mefestois clojure.edn available from cljs?
14:01lynaghk`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:02hiredmanlynaghk`: are you sure you are attaching to the right process?
14:02hiredmanlein starts two jvms
14:02lynaghk`hiredman: yeah, I'm grabbing the higher PID
14:03hiredmanlynaghk`: with visualvm (not sure about yourkit) you can see the command line args to the jvm
14:03hiredmanI would use those to make sure
14:03lynaghk`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:03jodarohrm
14:03jodarocodox seems to eat my ns level docs
14:03lynaghk`at least, my code (no reflection warnings are printed when I define the fns)
14:03hiredmanlynaghk`: if the profiler says reflection, that is what it is
14:04lynaghk`hiredman: are there cases where (set! *warn-on-reflection* true) doesn't actually warn about all reflections?
14:04hiredmanlynaghk`: check to make sure you have warn on reflection turned on correctly, are you calling other code?
14:04hiredmanlynaghk`: it only warns about code as it compiles
14:04lynaghk`hiredman: just clojure.core stuff and than calls to jBLAS
14:05hiredmanare you sure you are running the code you think you are? (stale class files with reflection?)
14:07lynaghk`hiredman: now that I've double checked, there are a few places with reflection still
14:07lynaghk`hiredman: is there a way to annotate the return type of a function passed in as an arg?
14:08hiredmanwhat?
14:08clojurebotwhat is cells
14:08lynaghk`Or do I have to annotate the anon fn directly where I call it?
14:08lynaghk`(fn [x f] (f x))
14:08hiredmanyou'll have to type hint where you call it
14:08lynaghk`er, that's not a good example. (fn [x f] (.native (f x)))
14:09lynaghk`I can annotate (f x) directly?
14:09lynaghk`well, I'll be damned. I thought type annotations were on vars only.
14:09hiredmantype hints
14:13lynaghk`hiredman: any chance you know how to hint a 2d array of doubles?
14:13technomancyarray type hints are so wacky
14:13lynaghk`that something is a 2d array of doubles, I mean.
14:13technomancyjust completely baffling
14:15lynaghk`technomancy: awww yeah: ^"[[D"
14:15technomancyI'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:30gzmaskis clojure namespace referenced due to path or the definition of (ns *) in that file?
14:33asteveI 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:34hiredman~namespace
14:34clojurebotnamespaces 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:34noidi,(interleave ["a" "b" "c"] [1 2 3])
14:34clojurebot("a" 1 "b" 2 "c" ...)
14:34astevenoidi: that is magic, thank you
14:37djwonknoidi: speaking of our earlier conversation: http://stackoverflow.com/a/16699128/109618
14:38gzmaskdoes 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:39asteveI would like to take the index of vector1 and divide it by X then insert that into the same index point of vecto2
14:39astevedo I want to use into and a for loop?
14:40antares_gzmask: various toolchain parts assume the ns name structure is the same as directory/file structure against one of the source roots
14:40asteveso, assuming vector1 was [10 20 30], X = 10, I want a new vector to be [1 2 3]
14:41gzmaskantares_: so this is a convention everyone has to follow?
14:41djwonkasteve: you might also look at `map-indexed`
14:41antares_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:41djwonk,(doc map-indexed)
14:41clojurebot"([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:42antares_gzmask: yes. It is a good idea anyway.
14:42gzmaskantares_: i see, thanks
14:53asteveso, I'm missing something
14:53asteve,(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:53clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$update-in>
14:53asteveI'm trying to achieve a result that is ["a" 10 "b" 10 "c" 10]
14:54asteveupdate-in requires 3 parameters but I'm not sure what the parameter would be for every element in the array
14:54gzmaskwhat's the difference between :dependencies and {:dev {:dependencies in project.clj? is the dev ones enable in my lein repo?
14:54astevesorry, vector
14:54gzmasklein repl*
14:56gfredericksgzmask: yes they are
14:56gfredericks:dev is a profile
14:57gfredericksleiningen has a whole md file on profiles
14:57gfrederickswhich can be a bit subtle
14:57IamDrowsyasteve: if you don't use the idx arg, you can just use map instead of map-indexed
14:58hyPiRionasteve: update in works as follows:
14:58IamDrowsyand update-in won't change v2.
14:58gfredericks,(interleave ["a" "b" "c"] (repeat 0))
14:58clojurebot("a" 0 "b" 0 "c" ...)
14:58hyPiRion,(doc update-in)
14:58clojurebot"([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:59asteveI would like to update v2, what should I use instead
14:59asteveI see that I can do (map #(+ % 10) v2)
14:59hyPiRionYou cannot "update" v2, you must create a new list/vector.
15:00asteveah, ok
15:00asteveso
15:00hyPiRionYou can shadow v2 though, using something like ##(let [a 10 a (+ a 10)] a)
15:00lazybot⇒ 20
15:00asteve,(let [v1 ["a" "b" "c"] v2 (vec (repeat 3 0))] (interleave v1 (map #(+ % 10) v2)))
15:01clojurebot("a" 10 "b" 10 "c" ...)
15:01astevewhat is the … for?
15:01hyPiRionit's there because the list is long, and clojurebot won't print everything
15:01hyPiRion,[1 2 3 4 5 6 7 8 9 10]
15:01astevegot it, thanks for the help
15:01clojurebot[1 2 3 4 5 ...]
15:11Okasu,'#(% %1 %2 {})
15:11clojurebot(fn* [p1__29# p2__30#] (p1__29# p1__29# p2__30# {}))
15:11Okasu,'#(% %1 %2 {})
15:11clojurebot(fn* [p1__59# p2__60#] (p1__59# p1__59# p2__60# {}))
15:15Okasu,'#(%1000)
15:15clojurebot(fn* [p1__90# p2__91# p3__92# p4__93# p5__94# ...] (p1000__89#))
15:15Okasu,'#(%100000)
15:15clojurebot#<CompilerException java.lang.OutOfMemoryError: Java heap space, compiling:(NO_SOURCE_PATH:0:0)>
15:15amalloyi always forget about interleave. asteve, just for entertainment you might also try (mapcat list v1 v2)
15:15astevethanks
15:16amalloyor, 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:17Okasu,#(%100)
15:17clojurebot#<CompilerException java.lang.RuntimeException: Can't specify more than 20 params, compiling:(NO_SOURCE_PATH:0:0)>
15:17OkasuHeh.
15:23hyPiRionwait
15:23hyPiRion,#(%100000)
15:23clojureboteval service is offline
15:23hyPiRionoops
15:24OkasuLoL.
15:24Okasu&(#(%-10) lol)
15:24lazybotjava.lang.RuntimeException: Unable to resolve symbol: p-10__14395# in this context
15:24amalloy&(%100000)
15:24lazybotjava.lang.RuntimeException: Unable to resolve symbol: %100000 in this context
15:24amalloy&#(%100000)
15:24hyPiRionThat should be a clojure core "bug"/"enhancement"
15:25amalloyhyPiRion: you mean, the reader should refuse to read the form?
15:25OkasuAgreed, but to lazy to fill forms.
15:25Okasutoo*
15:25hyPiRionamalloy: more like not expand it. What happens is that the function expansion casts the 20-max exception
15:26hyPiRion,'#(%25)
15:26clojurebot(fn* [p1__200170# p2__200171# p3__200172# p4__200173# p5__200174# ...] (p25__200169#))
15:26lazybotjava.lang.RuntimeException: Can't specify more than 20 params
15:26Okasu&'#(%-100)
15:26lazybot⇒ (fn* [] (p-100__114422#))
15:26OkasuTotally broken thing.
15:26amalloyhyPiRion: not expand is the same thing as not read
15:27hyPiRionright. I don't think I said anything about not reading though
15:27Okasu,'#(%-1.0)
15:27clojurebot(fn* [& rest__200222#] (rest__200222#))
15:27OkasuWhoa.
15:28hyPiRionOkasu: what did you just do
15:28amalloyRaynes: lazybot's timeout doesn't apply to reading code, only to evaluating it
15:28llasramOkasu: That's *amazing*
15:28OkasuHa-ha. :)
15:28Raynesamalloy: Okay.
15:28amalloytricky code like '#(%100000) can read to very large forms
15:29RaynesThat sucks.
15:29RaynesI'll pretend to look into that tonight.
15:29llasram##'#(%-2/2)
15:29lazybot⇒ (fn* [& rest__114552#] (rest__114552#))
15:32hyPiRion&(->> a b (->> c d))
15:32hyPiRion^ that one should be more dangerous
15:32mikerodcan you depend on (conj (seq some-coll) 'item) to always add 'item to the front of the resulting collection type?
15:33hyPiRionmikerod: no
15:33hyPiRionOr wait, for seq?
15:33mikerodhyPiRion: If you call seq on any collection data structure.
15:33llasramYeah, with the seq in there, that's just a funny way of writing `cons`
15:33hyPiRionhmm
15:33llasramSo you it'll go on the "front", but of a seq wrapping the original data structure
15:34mikerodllasram: I didn't know if the returned structure from seq could vary depending on what data structure it was called on.
15:34mikerodllasram: And I know conj just adds to wherever is "best" or whatever.
15:35mikerodllasram: If the behavior is just cons onto the "front" of the original structure, that make sense though.
15:36hyPiRionThe only guarantee is that the resulting thing is an ISeq -
15:36llasrammikerod: There are different concrete seq type implementations, but they are still seqs, not whatever the impl is wrapping
15:42mikerodllasram: 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:43mikerodIs (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:44hyPiRion,(cons 'item (seq '[some coll]))
15:44RayneshyPiRion: Hi.
15:44hyPiRion&(cons 'item (seq '[some coll]))
15:44lazybot⇒ (item some coll)
15:44hyPiRionRaynes: hay there
15:44RayneshyPiRion: Your madness keeps you sane.
15:45gzmaskI 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:45mikerodhyPiRion: That makes sense.
15:45mikerodThanks!
15:45amalloywait, is lazybot still working on that (->> a b (->> c d))? macroexpansion should be within the timeout context for sure
15:46TimMcbwahaha
15:46hyPiRionRaynes: yeah
15:46hyPiRionamalloy: it should've blown the stack
15:46hyPiRion&(reduce + (range))
15:46lazybotExecution Timed Out!
15:47TimMcamalloy: No, I remember it erroring out.
15:47llasrammikerod: and `cons` calls `seq` and it's collection arg if necessary, so even just ##(cons :foo [:bar :baz])
15:47lazybot⇒ (:foo :bar :baz)
15:47TimMcDisregard that.
15:47TimMc&(->> a b (->> c d)) ;; maybe it was a glitch?
15:48TimMcCould it be throwing during macroexpansion and then just not printing anything?
15:48hyPiRionRaynes: how far are you now on sandman? (since I assume you quoted it)
15:48TimMc&(macroexpand '(->> a b (->> c d))
15:48lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
15:48TimMc&(macroexpand '(->> a b (->> c d)))
15:48lazybotjava.lang.StackOverflowError
15:48hyPiRionTimMc: Oh, watch this
15:48hyPiRion,#(%100000)
15:49RayneshyPiRion: A little over halfway through volume 6.
15:49RaynesWhich appears to be the largest volume.
15:49RaynesHoly netsplit.
15:50mikerodllasram: Thanks, good to know.
15:51hyPiRionoh, it's still alive?
15:51hyPiRion,1
15:51hyPiRionHm, no.
16:04supersymsomehow I get a kick out of closing parens.. how weird is that
16:12gunsIs 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:12amalloyguns: i'd look into either java.nio or lamina
16:13amalloyone of them probably has a way to do non-blocking reads from system.in
16:13gunsamalloy: I couldn't find a reliable solution in the nio package. I will look at lamina, thanks
16:14gfredericks&#(%100000)
16:14hyPiRiongfredericks: :D
16:14gfrederickshyPiRion: what does it do? cause the reader to hang?
16:15gfredericksnaively it could compile to #((nth %& 100000))
16:15hyPiRion"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:15gfredericksI guess it does probably construct a 100000 element arg vector eh?
16:15hyPiRionyeah
16:16hyPiRionwith 100 000 gensyms
16:16gfredericksbut that's not too big to manage. And the compiler should balk at it being >21 or something?
16:16lazybotjava.lang.RuntimeException: Can't specify more than 20 params
16:16rasmustohaha
16:16gfredericksso apparently lazybot doesn't have a timeout on the compile phase
16:17hyPiRionyeah
16:19hyPiRionthen we have ##(#(+ %1.0 %2.0) 5 7) which is kind of funny
16:19lazybot⇒ 12
16:20kanweiis 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:20rasmusto##(#(+ %2/1 %10/5) 5 7)
16:20lazybot⇒ 14
16:20gfrederickskanwei: does #"-?\d+" work for you?
16:21kanweiwhat's the -? mean?
16:21hyPiRionkanwei: allows minuses
16:21kanweioh right
16:23kanweiis there any case where Integer/parseInt would be unsafe?
16:23gfredericksI'd hope not
16:23justin_smithblowing the stack if it uses peono representation :P
16:23hyPiRiondon't think so
16:23gfredericks&(Integer/parseInt (apply str (repeat 999 \3)))
16:23lazybotjava.lang.NumberFormatException: For input string: "33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
16:24kanweisooooo
16:24kanweitest with regex and then edn/read-string is more idiomatic?
16:24gfredericksif it's really generic edn data then you'd probably also want to check for \N at the end
16:26gfredericks&(clojure.edn/read-string (apply str (repeat 999 \3)))
16:26lazybotjava.lang.ClassNotFoundException: clojure.edn
16:27justin_smith,(clojure.edn/read-string (apply str (repeat 999 \3)))
16:27clojurebot#<ClassNotFoundException java.lang.ClassNotFoundException: clojure.edn>
16:27kanweiyeah you have to require it
16:27kanweiit does work tho, thanks
16:28kanweialtho
16:28kanweigfredericks: #"-?\d+" would also succeed for "asdf12356asdf"
16:28kanweino?
16:28clojurebotno is tufflax: there was a question somewhere in there, the answer
16:28hyPiRionkanwei: no
16:29hyPiRion,(re-matches #"-?\d+" "asdf12356asdf")
16:29clojurebotnil
16:29hyPiRion,(re-matches #"-?\d+" "12356")
16:29clojurebot"12356"
16:29kanwei&(re-seq #"-?\d+" "asdf1235")
16:29lazybot⇒ ("1235")
16:29hyPiRionyeah, use re-matches
16:30kanweiaight
16:33pjstadiggfredericks: 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:38djwonkI'm looking for the simplest way to 'map' over a hash map, returning a hash map
16:39gfrederickspjstadig: thx
16:40gfredericksstill haven't committed to avoiding the conj
16:42Raynesgfredericks: What's the congrats for?
16:42RaynesI can't see you making any wonderful announcements in my backlog.
16:42gfredericksRaynes: it was a few hours ago
16:42gfrederickswhat's a good nerdy clever way to imply that you're reproducing?
16:43Raynes"I have multiplied."
16:43gfredericksI have chosen another random subset of my genes to instantiate
16:43djwonki.e. {:a 3} --> {:a 4} with something like (map-map (fn [k v] [k (inc v)]) {:a 3})
16:43gfredericksdjwonk: amalloy would say it's questionable whether using maps is appropriate given you want to do that
16:44gfredericksbut I want to do it all the time too
16:44gfredericks(into {} (for [[k v] m] [k (f v)]))
16:44justin_smithor even (into {} (map (fn [[k v]] [k (f v)]) m))
16:44djwonkgfredericks: thanks
16:46gfredericks~thanks
16:46clojurebotWe live to serve.
16:46amalloygfredericks: 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:46gfredericks~thanks
16:46clojurebotWe live to serve.
16:47gfredericksclojurebot: thanks is <reply> the best way to thank your friendly #clojure resident is with (inc nick)
16:47clojurebotc'est bon!
16:48gfredericksamalloy: it's in my list of amalloy folklore
16:48amalloy(inc nick)
16:48lazybot⇒ 2
16:48gfrederickswe should start establishing tribes of idioms
16:48clojurebotHuh?
16:49gfredericks"The amalloy clan avoids mapping over a map"
16:49amalloygfredericks: this particular bit of folklore was stolen from the hiredman tribe
16:49jugimaster> (into {} (for [[k v] m] [k (f v)])) <-- are the square brackets there just aliases for parenthesis?
16:50RaynesAliases for parentheses. Nice. No. They're a different data structure than lists. Vectors.
16:50amalloyjugimaster: try it and see
16:50pjstadigaww i want my own tribe
16:50jugimasterwell, i haven't even installed clojure yet
16:50RaynesYou don't need to.
16:50jugimaster.. just considering using it :p
16:50RaynesWe have an app for that.
16:51gfrederickspjstadig: you have to have your advice repeated on three separate occasions
16:51Raynes&(+ 3 3)
16:51lazybot⇒ 6
16:51amalloyjugimaster: coming from scheme?
16:51jugimasteramalloy: coming from python, and came from java before python
16:51RaynesYou're in the right place, si.r
16:51amalloy(i ask just because i can't think of any other language where [] is sometimes a synonym for ())
16:51jugimasterbut i'm not yet sure i'll come :P
16:51RaynesPull up a chair.
16:51jugimaster:P
16:51RaynesYes you will.
16:51rasmustothe water's pretty warm
16:52jugimasterwell, i have a feeling that clojure might be great
16:52gfrederickstechnomancy: it's not conceivable that `lein test` should fail in the leiningen project is it?
16:52RaynesYou can't come this far and then just abandon is. Think of the children, jugimaster.
16:52jugimaster:P
16:52Raynesus*
16:52jugimasteri'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:52djwonkamalloy: why is (defn map-values [f m] (into {} (map (fn [[k v]] [k (f v)]) m))) not to your liking?
16:52RaynesYou're already asking Clojure questions. You're nearly a Clojure programmer already. Just need you install leiningen.
16:52trptcolingfredericks: be sure you're all `lein bootstrap`'ed up
16:52jugimaster:p
16:52technomancygfredericks: lein's own test suite isn't great
16:53RaynesProbably because I never add tests when I make changes.
16:53Raynes:D
16:53gfrederickstrptcolin: I definitely didn't make sure of that
16:53amalloyjugimaster: come for the parallel programming, stay for the immutable data structures
16:53callenjugimaster: clojure is awful, I'm just here for the music. Save yourself while you can!
16:53jugimaster:p
16:53callenjugimaster: also amalloy is right, the stuff you think is important won't be after a year.
16:53Raynescallen: Speaking of music, the new 30 Seconds to Mars album is pretty great.
16:53callensimply having not the sand shift beneath you is enough reason to stick around.
16:53callennot having*
16:54callenRaynes: I'm not surprised you like them
16:54callenI'm starting to get a read on your tastes.
16:54jugimasteramalloy: yeah.. the concurrency stuff is interesting too.. though i've never even had to deal with serious concurrency before
16:54callenjugimaster: advice? Don't unless you really have to.
16:54callenseriously, it's not worth it.
16:54Raynescallen: You can have full on bloody statistics on my taste if you want, bro: http://last.fm/user/RaynesFM
16:54jugimastercallen: yeah, but clojure would mostly just magically keep me safe? :P
16:54jugimasterSTM and all
16:55callenjugimaster: it can if you use the containers right. mostly. but still, it rarely matters.
16:55amalloySTM doesn't really matter most of the time either, because you'll rarely be mutating anything
16:55callenatom suffices for most of my use-cases
16:55jugimastercallen: so are you saying i'll be in trouble if i ever do anything "concurrent" with clojure either? :p
16:55RaynesThey lure you in with their refs, but you stay for the atoms.
16:55callenthe last time I used a ref was for that goddamn client driver.
16:56amalloyjugimaster: not at all. concurrency support in clojure is very good, and it's fairly easy to get it right
16:56callenjugimaster: no, quite the opposite. Clojure is a heaven filled with naked angels and bowls of grapes compared to doing concurrent programming in pthreads.
16:56amalloyyou just...don't need most of the tools you think you need, because everything is easier when you don't mutate things
16:56jugimastercan Clojure apps be run on a 256MB VPS or would the memory be hopelessly small?
16:56RaynesHeaven with naked angels isn't very useful callen.
16:56callenRaynes: wayyyyy too much My Chemical Romance.
16:57amalloyjugimaster: that's fine as long as you tell the JVM to limit its heap size to, say, 40MB
16:57hiredmanstm is there, but you should avoid it, stm implies coordinated state changes, coordination for a multithread system implies slow
16:57jugimasterhmm
16:57callenRaynes: This has low odds of working, but I want to try it anyway: https://soundcloud.com/deathwishinc/deafheaven-sunbather
16:57Raynescallen: 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:57callenRaynes: I have weeks like that with shoegaze.
16:57hiredmanbut sometimes you need it
16:58hiredman(I mean, I don't, but someone might...)
16:58callenhiredman: I've needed it.
16:58callenhiredman: I hated myself.
16:58amalloyjugimaster: lazybot is running on a VPS with 1.5GB of ram, along with three other clojure servers
16:58callenhiredman: I quickly got rid of it.
16:58amalloyfour others? i see five java processes but i don't know what they all are
16:58jugimasteramalloy: well, that's quite a bit of RAM :P
16:58Raynesamalloy: If we ever restart it it'll be running on a server with 3GB of ram.
16:59amalloyjugimaster: divide it by four, and how much is it?
16:59jugimasternot much?
16:59jugimaster:p
16:59Raynes&(/ 1500 4)
16:59lazybot⇒ 375
16:59Raynescallen: Miss.
16:59RaynesMy throat is hurting from the first 2 minutes.
16:59gfrederickshaha I like the line "Unable to resolve symbol: failure-expected-here-dont-freak-out"
17:00callenRaynes: okay, I can shift melodic.
17:00trptcolini freak out every. time.
17:03callenRaynes: http://www.youtube.com/watch?v=AiZxCVXhgmM
17:04tieTYTi'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:04Raynescallen: You should use google all access and share things with me.
17:04Raynescallen: Oh man. You send me an Assassin's Creed video. It's impossible for me to not like this song.
17:04amalloy,::rect
17:04clojurebot:sandbox/rect
17:05technomancygfredericks: grep the test suite for "squirrel"
17:05callen,'amalloy
17:05clojurebotamalloy
17:05callentechnomancy: SQUIRREL?! WHERE?!
17:06technomancycallen: https://github.com/technomancy/leiningen/blob/master/test_projects/sample_failing/src/nom/nom/nom.clj
17:06tieTYTthat extra colon seems to tie it to the current ns?
17:06trptcolinlol, i forgot about that
17:06gfrederickstechnomancy: I did it!
17:07gfredericksso apparently `bin/lein test` works while using my installed leiningen doesn't
17:07gfredericksI guess that was the trick
17:07callentechnomancy: LOL
17:07technomancycallen: that wasn't me FWIW
17:08gfrederickstieTYT: keywords can have namespaces
17:08gfrederickstieTYT: the double-colon syntax automatically adds the current namespace
17:08callentechnomancy: who?
17:08gfredericksthe "namespace" of a keyword is not directly related to general namespaces otherwise
17:08tieTYTgfredericks: how do you add a different namespace from the current?
17:09technomancycallen: looks like it was alandipert
17:09technomancyhttps://github.com/technomancy/leiningen/commit/93535c5a17df197ba8ee5470da49b2a22e096492 \m/
17:09amalloytieTYT: look at the output of ::foo and see if you can guess
17:09tieTYToh yeah I see it
17:09technomancygfredericks: are you fixing the run task?
17:10tieTYTso with one colon, does that mean it's in no namespace?
17:10tieTYTor in every namespace?
17:11hyPiRion,::foo
17:11clojurebot:sandbox/foo
17:11RaynestieTYT: Namespacing in keywords is not a special thing.
17:11hyPiRion,(= :sandbox/foo ::foo)
17:11clojurebottrue
17:11RaynestieTYT: The 'namespacing' is just the extra information on the keyword.
17:11RaynesYou can just do :foo.diddly/bar and have the same effect if you want.
17:12trptcolin&((juxt namespace name) :foo/bar/baz)
17:12lazybot⇒ ["foo/bar" "baz"]
17:13justin_smith&((juxt namespace name) (keyword ":::::::foo"))
17:13lazybot⇒ [nil ":::::::foo"]
17:13callenRaynes: http://www.youtube.com/watch?v=NiIMqSqabGs ?
17:14tieTYTwhy does derive require a namespace on the keyword?
17:15gfrederickstechnomancy: are you interested in mundane refactorings such as use->require?
17:15technomancygfredericks: eh; sure
17:15technomancyseparate pull reqs would be better though
17:15gfredericksfo sho
17:15mikerodThe 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:16gfredericksman running leiningen tests is so meta
17:16gfrederickseven this acronym
17:16mikerodOtherwise, vectors are defined in the Java classes under IPersistentVector?
17:16hyPiRiongfredericks: wat
17:17hyPiRionyou're testing lein with lein itself? Is that so hard? :p
17:17amalloyhyPiRion: someone once told me gcc was written in c, but i've blocked out that painful memory
17:17bbloomamalloy: c'mon now, bootstrapping is fun :-)
17:18winknot sure
17:18winkI find recompiling lein with lein annoying enough
17:18Raynescallen: Hit.
17:18winkand it's not exactly hard
17:18bbloomamalloy: and dangerous: http://cm.bell-labs.com/who/ken/trust.html
17:19amalloyyes, that's a neat trick
17:19gfredericksoh nice there are windows line endings in this file
17:19amalloyRaynes: are you playing youtube battleship?
17:20callenRaynes: http://www.youtube.com/watch?v=XmGdSOhBx8E
17:20Raynesamalloy: Yes.
17:20callenamalloy: I'm your DJ for the day. Want some depressive black metal?
17:20Raynesamalloy: Because callen is too cheap for google music.
17:20callenRaynes: I use spotify generally.
17:20RaynesI also have a spotify subscription.
17:20technomancywhat your life needs right now is more Google services
17:20gfredericksman embedding songs in a youtube video is like embedding text in a gif
17:20callentechnomancy nails it, really.
17:21RaynesI haven't decided if I want to actually keep google music.
17:21Raynes*shrug*
17:21RaynesI'm fine with more google services.
17:21callenI'm already attached to Google by umbilical cord via gmail.
17:21callenI don't need more.
17:21callentechnomancy: I should write a webmail service in clojure.
17:21callenwith search!
17:21technomancyfor the first time in years I'm actually glad I kept my dreamhost account around
17:21hyPiRioncallen has now 10,000 problems
17:22callen^^ accurate.
17:22callendeliverability with private mail servers is GAG GAG GAG
17:22gfredericksis google cutting off something else?
17:22muhooyou guys aren't running your own sendmail on your VPS'es? are you wizards or what?
17:22technomancygfredericks: always
17:22hyPiRiongfredericks: they're removing SMTP and e-mail in general. The new way of doing things is sending Google hangout messages
17:22callenmuhoo: wouldn't the wizards be the ones willing to fuck with m4 long enough to get sendmail to work?
17:22bbloomi 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:23muhoocallen: well, postfix, for the sane. still.
17:23callenhyPiRion: 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:23hyPiRioncallen: oh sure thing
17:23muhoowebmail is not hard. people wrote them in PHP in the early 2000's FFS
17:23nightflyAnd they sucked
17:23nightflyhard
17:23hyPiRionIt's just all the addons people require
17:24hyPiRionthen the server goes down
17:24hyPiRionyou have to scale the thing
17:24hyPiRion+++
17:24callenmuhoo: it's not that it's hard
17:24callenmuhoo: it's making it reliable and having good deliverability with your mail server that is a pain.
17:24muhoonightfly: i know, i'm one of the people who wrote himself a sucky one back then :-)
17:24trptcolini guess it's like aphyr's series. if it doesn't have to get there, sure it can be easy.
17:24callen^^ that.
17:24gfredericksdoes anybody know about leiningen's tests wrt testing error message output?
17:25gfredericksit looks like it's just printing to stderr so I'm not sure how to expect on that
17:25hyPiRiongfredericks: binding [*err* *out*] (with-out-str ...
17:26gfrederickshyPiRion: I think this is running in a different jvm
17:26hyPiRionI think I made some in the core library
17:26gfredericksbut I don't know for sure
17:26hyPiRionoh what
17:26hyPiRionThat shouldn't matter, unless my pipes totally fail
17:26gfredericksit's the leiningen.test.run tests in particular
17:27gfrederickshyPiRion: why would binding *err* on my jvm do anything with the other one?
17:27gfredericksI don't think binding it on the other one is really an option
17:27Raynescallen: Kinda sorta not really on that one. A little too rough for my tastes.
17:29muhootrptcolin: thanks for pointing me to aphyr. interesting stuff, interspersed with lulz: http://aphyr.com/data/posts/284/-055.jpg
17:29callenRaynes: http://www.youtube.com/watch?v=sZTpLvsYYHw
17:29hyPiRiongfredericks: maybe I misunderstand, but you're running the leiningen tests and want to make new tests which checks the error message output, right?
17:29callenmuhoo: you really want to follow his stuff, it's solid.
17:29Raynescallen: Of course I like The Killers.
17:29callenRaynes: ok I'll move onto something less obvious.
17:29Raynescallen: I was just telling someone 5 minutes ago how much better Hot Fuss is than all their other albums. :p
17:29callenRaynes: slightly less obvious: http://www.youtube.com/watch?v=MQvZ4N1RfS8
17:30callenhitting Toronto scene indie after this one.
17:30RaynesI haven't been able to bring myself to like Arcade Fire, but I've never heard this one.
17:30callenRaynes: give it a whirl, it's anthemic ala Killers
17:30RaynesAre you my Pandora now?
17:30callenRaynes: yes
17:31callenRaynes: I've aggregated and listened to over a terabyte of music (and not all junky mixes, original content). I find things *_*
17:31RaynesI'm okay with that.
17:31callen*______________________*
17:31callenweavejester: how are you?
17:31technomancynew game music bundle is coming up in a few hours if you're into that kind of thing
17:31Raynescallen: I like this.
17:31weavejestercallen: Huh?
17:32technomancyhttp://www.gamemusicbundle.com/
17:32technomancythey've had some fantastic offerings the past few times
17:32RaynesI'm not into game music.
17:32RaynesNot quite nerd enough.
17:32callentechnomancy: there was this clicky adventure game that had an amazing soundtrack, it was part of the humble bundles.
17:32technomancythe scott pilgrim game soundtrack is the best possible music to hack to
17:33callentechnomancy: I can't remember the name of it just this moment though. Do you know what I'm talking about?
17:33callenRaynes: I like game music simply because they're purpose-built for mood and very functional to that end.
17:33callentend to be more consistent too.
17:33Apage43i listen to a lot of trailer music
17:34gfrederickshyPiRion: yes, the error message from the result of doing 'eval-in-project
17:34gfredericksindirectly
17:34gfredericksthe test is just calling run
17:34callenRaynes: you should be about done: http://www.youtube.com/watch?v=xl3PyTqsc5c
17:35gfrederickshyPiRion: the call throws an ExceptionInfo but all it has is {:exit-code 1}
17:35gfredericksand I see the actual error message printed to presumably the STDERR of my process running the test
17:35hyPiRionoh durr. Let's see here.
17:35callentechnomancy: http://en.wikipedia.org/wiki/Machinarium
17:35callentechnomancy: ^^ check out that soundtrack.
17:36callenRaynes: let me know how the BSS treats you.
17:38hyPiRiongfredericks: https://github.com/technomancy/leiningen/blob/master/leiningen-core/test/leiningen/core/test/helper.clj
17:39gfrederickshyPiRion: so I'd use (abort-msg run the-project)?
17:40callentechnomancy: retro game music no less. dis gon b gud
17:40hyPiRionyeah, presumably
17:41hyPiRionthough that one only takes suppressed exits somehow
17:41gfrederickshrm....
17:42gfrederickstesting leiningen is hard
17:43gfredericksoh eval-in-project apparently puts a lot of effort into this sort of thing already o_O
17:43gfredericksmaybe I can just look to *err*
17:44pjstadiggfredericks: obviously you should be using simulation testing instead
17:45pjstadigi hear they're much better guard rails than unit tests
17:46gfredericksoh man that totes worked
17:46gfredericks(inc leiningen)
17:46lazybot⇒ 1
17:47muhooi prefer jazz for coding, but if you want retro game music, and jazz, there's this: http://www.youtube.com/watch?v=zNFQkgb9Ib8
17:47callenmuhoo: way too kitschy.
17:50bbloompjstadig: i know you were kidding, you should be using both… where appropriate :-)
17:51bbloomie more overall testing, less skewed towards unit tests
17:52pjstadigi just do as the latest cargo culting fad tells me, you're saying that's not sufficient?
17:52bbloomright, you need to do what the three most recent cargo culting fads tell you!
17:53callenpjstadig: want some gasoline for that strawman?
17:53callenI have maaaatchessss
17:53pjstadigbbloom: only if that's what the latest cargo cult is preaching
17:53bbloomheh.
17:53trptcolinwhich segment of the ThoughtWorks Technology Radar can I review to find those?
17:53pjstadigtrptcolin: strawmen or gasoline?
17:53muhoohttp://blog.fogus.me/2012/06/20/not-enough/
17:54trptcolinpjstadig: ok, that's 2, what's the third?
17:54callenbbloom: 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:54callenbbloom: I'm unprepared for this man.
17:54Raynescallen: This song scares me.
17:54callenRaynes: GOOOOOOOD
17:54callenbbloom: it's going to be a mess by the time you and pjstadig finish.
17:55RaynesTaken out of context, that message is really sexy.
17:55callenRaynes: bbloom and pjstadig are having their 5 minutes of hate in public.
17:55callenRaynes: apparently "dem other peoples" are stupid and not to be trusted. And their ways are false.
17:55muhoois it hate? sounds a bit more erotic to me
17:55muhooin any case, i hope it stops soon.
17:56callenthe best way to defuse hate is with sexy-times.
17:56callensee a nazi rally? strip down to undies and offer to dance with the participants.
17:56bbloompjstadig: was there any hate? or sexy times? i'm confused. i thought we were having a few relatively friendly laughs… *shrug*
17:56muhoonaw, humor. my monitor has some coffee damage now due to your oil comment earlier
17:58muhoook, procrastinating. the friend workflow function is one of the most opaque things i've dealt with in a while.
17:58callenof course the Haskell people would make a DSL called Flask.
17:58callenDicks.
17:59muhooi've written one before, it worked, and i'm trying to write another one, and i'm completely lost.
17:59callenmuhoo: see, this is why I don't use Friend. :|
18:00patchworkHmm…. latest clojure.java.jdbc borks with-naming-strategy
18:00patchworkAnyone else seen this?
18:00muhoocallen: what do you do instead?
18:00patchworkOr maybe I am the only one using with-naming-strategy
18:00muhoocallen: specifically, how do you deal with several auth methods which need to coexist in the same app?
18:00callenmuhoo: wrap them myself, because I'm a big boy.
18:01muhoocallen: and then when you need to write another app that does the same thing?
18:01callenmuhoo: 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:01callenmuhoo: well then you reuse the code. Something I do all the time.
18:01callenI've actually measured how much code I usually reuse across web projects in Clojure that I wrote, it's 60-80%
18:02callenslightly higher than it was in Flask
18:02callenmuch higher than in Django.
18:02muhoodo you deliver all that duplicated code to each client, each with their own copyright statement in it?
18:02callenI don't deliver Clojure code to clients
18:02callenmy consulting hasn't hit upon a clojure gig yet. (fingers crossed)
18:03callenreifying the utility stuff I write into libraries would be strange.
18:03callensome of it I might consider cleaning up for libnoir.
18:03muhoohuh. what do you write in usually?
18:04callenmuhoo: whatever the client needs. I'm a polyglot in the extreme.
18:04callenit's bad for my long term development, but I'm a mercenary.
18:04callenthat's why I focus on Clojure on my own time, so I don't become completely retarded.
18:06muhoowell 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:07callenmuhoo: uhm, I would agree but you aren't going to get him to change the design/overbearing nature of Friend
18:07callenadding more code won't unfuck it.
18:07callenthe solution is a library that's less obnoxious to work with, but still abstracts the unnecessary details of the problem
18:07muhoothat'd be nice, i agree.
18:09muhooi'd have to wonder if it'd be more work than just dealing with this one weird function in friend.
18:10callenmuhoo: "ONE WEIRD TIP TO LOSE WEIGHT IN YOUR CLOJURE CODE"
18:10muhoo???
18:10lazybotmuhoo: Oh, absolutely.
18:13muhoocallen: 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:13muhoobut for now... this is what i gots.
18:16callenmuhoo: I'd not likely bother unless I picked up a contract doing Clojure, but I'll ping you if it happens regardless.
18:17arohneris there a library out there that pretty prints persistent queues?
18:21pppaulhow do i add content type for pedestal responses?
18:34gfrederickstechnomancy: w00t got a test/patch
18:41amalloyarohner: (defmethod print-method ...)
18:41arohneramalloy: yup. just checking to see if someone did that, and made a nice constructor, etc
18:41amalloyyou could bundle it up in a library, but then any two such libraries can't help but step on each others' toes
18:42arohnerthat would be a concern, if there was more than one :-)
18:42amalloyfwiw, useful has a constructor for it: https://github.com/flatland/useful/blob/develop/src/flatland/useful/utils.clj#L144
18:54gzmaskcljs-build giving me No implementation of method: :as-file of protocol error. anyone?
18:58amalloy~helpme
18:58clojurebotA 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:29alandipertbbloom: have you noticed equiv being way slower on firefox in your cljs perf laboratory?
19:39aphyrIs there a good way to figure out what part of lein compile is slow?
19:40aphyrBeen trying strace and jvisualvm but nothing really obvious is coming out of it
19:40pandeiromath.combinatorics is dangerous if you're in nrepl and not on a super computer...
19:46pandeiroanyone got an estimate how many 6-char combinations are possible with upper and lower case alphanumeric? or how i can figure that out?
19:49antares_pandeiro: with or without repetition?
19:50brehautits n! / (k! * (n - k)!)
19:50amalloy$google combinations permutations
19:50lazybot[Combinations and Permutations - Math is Fun] http://www.mathsisfun.com/combinatorics/combinations-permutations.html
19:51pandeiroantares_: actually yeah i would mean selections i guess, with repetition
19:55hyPiRionpandeiro: n^6 where n = is the amount of characters
19:56hyPiRionso 52^6
19:57pandeirohyPiRion: yeah, 62 [A-Za-z0-9]
19:57hyPiRionyeah, forgot about those nums
19:57pandeirohyPiRion: that seems intuitive... why would i need to take the factorials of everything?
19:58pandeiro(reading the article amalloy posted)
19:58amalloyfactorials would answer a different question, because "6-char combinations" is ambiguous
19:58pandeirois 'selections' the math word?
19:59pandeirofor repetitive combinations?
19:59lynaghkaphyr: 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:00aphyrI know it's using the disk a ton--5 MB/s sustained for 30 seconds
20:01lynaghkaphyr: dang. I wish I could help, but I don't know much about Java Clojure compiler internals
20:01alandipertaphyr: are you AOTing for interop, obfuscation, perf, or other?
20:02alandipert(if for perf, AOT generally not the way ime)
20:02aphyrNaw, I need AOT to generate a jar
20:03alandipertcan't just put clj source in the jar and let it dyn-pile?
20:03aphyrNot sure, really. It complains it can't find a class if I do that.
20:04aphyrIt's all writes--I think maybe it's just stuck writing class files to disk
20:05technomancyaphyr: what kind of jar?
20:05aphyrWell, eventually I build a fat jar
20:05technomancyif boot time isn't a concern you can usually piggyback on clojure.main with -m
20:05aphyrbut even lein clean, lein repl takes like a full minute now
20:06technomancystrongly recommend not doing AOT during dev if possible
20:08aphyrHmm. If I comment out :aot [riemann.bin] in project.clj, it complains ClassNotFoundException: riemann.bin, compiling:(riemann.bin/clj:18)
20:08aphyrThat's at the REPL
20:08technomancyusing gen-class?
20:08aphyrYeah
20:08technomancyoh, ok then
20:08aphyrMay be because I actually refer to riemann.bin on that line
20:08technomancycan't avoid AOT if you need gen-class
20:09aphyrYeah, and I need gen-class to build runnable jars
20:09technomancyyou mean for java -jar?
20:09aphyryeah
20:09technomancyhave you tried java -cp whatevs.jar clojure.main -m riemann.main?
20:10hyPiRionpandeiro: it's common to just say with or without replacement
20:11hyPiRionwhere "without replacement" means that once you've used an element, you cannot reuse it
20:11technomancylein trampling
20:11aphyrhmm, well, disabling aot means it doesn't get bogged down writing to disk
20:11aphyrbut it still takes pretty much as long to load the repl
20:12technomancythen it's out of my hands =\
20:12aphyrmaybe ~25% faster, it's a start...
20:13technomancylein 2.2 will let you set :aot just in the :uberjar profile, if that'll help
20:13aphyrYeah, sounds like.
20:13aphyrStill wish I knew what was making it so slow
20:14technomancycompy layshun
20:14aphyrused to be much faster, haha
20:14aphyrSomething changed at some point
20:30technomancynot if IRC isn't media
20:34flu-or is this a media fast like a juice fast, i.e., all you will do is consumer news and media
20:34flu-*consume
20:55jcromartietechnomancy: IRC doens't count
20:55jcromartieflu-: hah, that sounds terrible :)
20:56jcromartienear-real-time interaction with people (not in comments sections) doesn't count
20:56jcromartieI mean media published in a top-down/broadcast fashion: news (incl. aggregators), blogs
20:57callenjcromartie: it does seem rather time-wastey doesn't it?
20:57callenjcromartie: I like the idea.
20:58jcromartieit stresses me out just to read headlines… I feel the effect on my body
20:58jcromartiebut it's addictive to get that hit of novelty
20:58jcromartieto think that somewhere out there, just around the next link, is that new bit of information that will change everything!
20:59jcromartiesome major event that means everything is different now: either SHTF, or we've stumbled on a real utopia
21:00jcromartieor 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:00jcromartiethose things don't exist, but your mind wants to believe that they do
21:01jcromartie</rant>
21:01callenjcromartie: I've experienced the same things. right down the list.
21:02jcromartie:) well I'm glad I'm not just crazy, then
21:02jcromartieor at least we both are
21:02callenjcromartie: including that feeling of stress, right in your chest, from reading a headline.
21:03callenjcromartie: incidentally, I have the same reaction listening to NPR sometimes because of some cultural disparity on my part.
21:03jcromartiehttp://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.pone.0047189
21:04jcromartiethat study only concluded a correlation for women
21:08xeqiRaynes: needed a gravatar lib and found clavatar, thanks
21:08callenjcromartie: I find HN to be distressing even if I agree with the general sentiment of a particular thread.
21:14callenyogthos: ping
21:24pandeirocan anyone show me how'd connect to the drawbridge repl in the vanilla heroku lein template app?
21:25gfrederickshyPiRion: woah man you are some kind of leiningen admin or something
21:25gfrederickshyPiRion: did the commit look sane?
21:25hyPiRiongfredericks: yeah, I looked at it
21:25hyPiRionLooked sane from my point of view. :)
21:26gfredericksphew
21:26trptcolingfredericks / hyPiRion: this is a breaking change, right?
21:26pandeiro`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:26gfrederickstrptcolin: for an undocumented feature, yes
21:26trptcoline.g. reply's :main is just ReplyMain
21:26trptcolinand now fails
21:26gfredericksoh noes!
21:27trptcolini mean, i can personally deal, no big deal. but i hack on lein.
21:28trptcolinso i'm not sure how many folks will see issues
21:28hyPiRionwell, I never thought it would break anything not already broken
21:28cemerickpandeiro: need http://
21:28trptcolinwhat is the recommended :main option for a java main?
21:28hyPiRiondidn't realize it broke working stuff
21:28gfrederickstrptcolin: I don't know of one
21:29pandeirocemerick: ha. thanks
21:29pandeirogot spoiled with curl
21:29trptcolini'm not 100% opposed, just want to make sure we think it through before we push out 2.2.0
21:29gfredericksI didn't feel qualified to assess the issue; I just deferred to the thumbs up from phil
21:29gfredericksI should find that to make sure I didn't misinterpret
21:30hyPiRiontrptcolin: Yeah, I think `lein run` should run java mains without issue too.
21:30gfrederickswhat error should be shown if both fail?
21:31hyPiRiongfredericks: "Nobody here but us chickens"
21:32gfrederickswell my motivation for this is that when your main ns fails to load it shows a ClassNotFoundException
21:32gfrederickswhich is terribly misleading
21:33gfrederickstrptcolin: hyPiRion: http://clojure-log.n01se.net/date/2013-05-21.html#14:22b
21:33trptcolinheh, the awful hack i'm imagining is branching on the first letter being upper-case/lower-case
21:33gfrederickslooks like he had a couple ideas for other ways to do it
21:33gfredericksa plugin or a different option than -m
21:34trptcolini like that. -m for an ns, -something-else for a class.
21:35gfredericks-c ?
21:36gfrederickstrptcolin: that wouldn't allow you to put :main ReplyMain in your project.clj though, eh?
21:36hyPiRiongfredericks: :main-class
21:36gfredericksah ha
21:37trptcolinright. again, not that it's an issue for me personally, but we can keep using that as an example, that's fine.
21:37gfredericksdangit now I need to write moar tests
21:37trptcolinthere was a related issue where we were thinking of making :main have nothing to do w/ the starting repl ns
21:37trptcolinbut i seem to recall we decided to hold off for 3.0
21:38gfredericksoh
21:38gfredericksright
21:39trptcolini guess we really oughta move this into #leiningen
21:40hyPiRionOh hah
21:40callenI forgot that was a thing.
21:40hyPiRionI thought we were in #leiningen
21:44bttfis 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:44gfredericksbttf: not efficiently
21:44gfredericksyou can interleave and get a seq
21:45gfredericksand throw that back into a vector if you really want to
21:45bttfwell i have a (str "With different sentences." "Like this." "And I'd like to get a space in between each string programmatically")
21:45gfredericksyou want a string output?
21:45callenbttf: join?
21:46bttfi have string output but
21:46gfredericks&(clojure.string/join " " ["some sentences." "in a vector." "like this."])
21:46lazybot⇒ "some sentences. in a vector. like this."
21:46bttf,(str "These strings have" "no spaces inbetween")
21:46clojurebot"These strings haveno spaces inbetween"
21:46bttfcool
21:46bttfthx
21:56akurilinQuick 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:57gfredericksakurilin: I believe so
21:58hyPiRionakurilin: use ensure to avoid other transactions to update the value of said ref
21:58brehautif its important that you dont change it when the predicate doesnt match then yeah
21:59hyPiRioni.e. ##(let [a (ref {})] (dosync (ensure a)))
21:59lazybot⇒ {}
21:59hyPiRionif you just use @ref, the value may be updated if the transaction is retried
22:00akurilinDoes dosync retry? I must have misread this, I thought this happened only for atmos.
22:00akurilin*atoms
22:01gfredericksit does
22:01akurilinThat 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:03gfredericksyou can't use atoms because the atom would have a counter?
22:04akurilinAs I said, I must have misread how the different concurrent types work.
22:04hyPiRionakurilin: a dosync may be retried, yes, but they won't update any reference twice
22:04akurilinhyPiRion, so what you're saying is that something like "alter" will only be called once at most?
22:05muhooddellacosta: that was an interesting collision
22:05hyPiRionfor 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:05gfredericksakurilin: they can be called several times, but if they're pure functions then it doesn't hurt anything
22:06ddellacostamuhoo: what do you mean, sorry?
22:06muhooddellacosta: https://github.com/ddellacosta/friend-oauth2/pull/8
22:06muhooya
22:06ddellacostaoh, haha!
22:06ddellacostamuhoo: yes, thanks for those changes, really awesome. Sorry I just updated everything yesterday! Murphy's law.
22:06muhoosorry, it seems we were working on the exact same stuff at the exact same time, in never expected that.
22:07ddellacostait is as the Universe ordained. Or, more likely, random coincidence.
22:07muhooquntum entanglement.
22:07akurilingfredericks, in hyPiRion's example, wouldn't altering ref a and b be considered a side-effect?
22:07gfredericksno
22:07gfredericksthat's controlled by the transaction
22:08muhooddelacosta: 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:08gfredericksakurilin: i.e., the transaction is watching for those and can "undo" them before it retries
22:08akurilingfredericks, Ah perfect. I'm assumign it'll also make sure to use the latest values of a and be as well.
22:09ddellacostamuhoo: 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:09gfredericksakurilin: yep
22:09callenmuhoo: is this what you were referring to earlier?
22:09muhooddellacosta: that might be best then. what i did won't apply cleanly, but i could manually redo it
22:09ddellacostamuhoo: sorry. :-(
22:10muhoocallen: friend/oauth2
22:10akurilingfredericks, and so, is the difference with swap! that swap! simply doesn't care about preventing the side-effect, unlike dosync?
22:10gfredericksakurilin: no, it's that it's not coordinated with other atoms
22:10gfredericksso you don't need a transaction at all
22:10callenwhich is preferable, when applicable.
22:10gfredericksit still can be retried and should therefore be side-effect-free
22:10gfredericksso if you're using just one ref then you probably could use an atom instead
22:12callengfredericks: or put differently, if you don't need to coordinate changes across your atoms, you don't need ref.
22:12muhooddellacosta: tis all good. i guess my fault for not checking first.
22:12akurilingfredericks, got it! Perfect.
22:13ddellacostamuhoo: not at all. Thanks again for taking the time!
22:14gfredericksakurilin: counters are the classic example of atom usage
22:14akurilinIs 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:14gfredericksthe swap function you provide can see the current value of the atom
22:15brehautakurilin: if you hoist the check inside the function you pass to the atom, then it can safely be done attomically
22:15akurilinOh actually there's compare-and-set for very simple cases
22:16brehautHoist the Cheque
22:20akurilinbrehaut, sounds good
22:32konrWhat was that function that could slice seqs as in (mysterious-function [1 2 3 4] 2) -> [[1 2] [3 4]]?
22:32amalloy$findfn 2 [1 2 3 4] [[1 2] [3 4]]
22:33lazybot[clojure.core/split-at clojure.core/partition-all clojure.core/partition]
22:33eggheadwut
22:33konrthanks! didn't know of that bot
22:33eggheadwhat just happened
22:33amalloyakurilin: if you go to the effort of making c-a-s useful, you'll have just reinvented swap!
22:36akurilinamalloy, definitely not in the reinventing business right now, I'll stick to swap! :)
22:40konr$findfn [1] 0 [0 1 0]
22:40lazybot[]
22:40konr$findfn 0 [1] [0 1 0]
22:41lazybot[]
22:42amalloykonr: are you looking for like..."add on both ends"? there are no built-in collection types for which that is efficient
22:43konramalloy: yes, I think I'll have to use (concat [0] foo [0]) :(
22:44gfredericksfinger trees?
22:44gfredericksI guess they're not quite "built in"
22:44amalloykonr: are you trying to build pascal's triangle?
22:45konramalloy: something similar :)
22:46gfrederickspascal's wide triangle
22:48bbloomalandipert: firefox is generally much slower than v8 for cljs
22:48bbloomalandipert: dnolen is the man to ask though
22:49brehautbbloom, alandipert: i recall dnolen was submitting tickets to firefox about that just the other day
22:51bbloomhttp://www.50ply.com/cljs-bench/
22:51brehauthttps://bugzilla.mozilla.org/show_bug.cgi?id=874174
22:51bbloomi don't see equiv in those benchmarks though, probably should be there
22:52bbloomwe do, however, need to add a fast path for equiv. clojure has one for strings, numbers, etc, that cljs doesn't have yet
22:52bbloomthat work is behind reified keywords, i think
22:52brehauthttp://jsperf.com/objmap-vs-persistentarraymap-assoc-7kv
22:53bbloomdnolen 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:55bbloomalandipert: 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:56bbloomalandipert: 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:57bbloomhint: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L24-L40
22:58bbloombrehaut: thanks, that's an interesting thread
22:58brehautno problem.
23:00tomojbbloom: so do you understand yet how you're supposed to use channels?
23:02tomojlike a process is (fn [in out]) or something?
23:02bbloomtomoj: only theoretically. it's the same design patterns as golang (mostly)
23:03bbloomyour code that writes to/from channels is just gonna look more procedural… get over it :-)
23:04tomojyeah 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:04tomojI haven't used alt at all for example
23:04bbloomgo emulate the mini google search example from rob pike's talk
23:05bbloommaybe that will make it click
23:05tomojI've been trying to make (fn fork [in out1 out2]) but can't make it work
23:06tomojI don't see how to deal with close! at all either
23:06tomoj(fn fork [in] [out1 out2]) with auto-closing makes sense, but that doesn't seem to fit csp
23:11bbloomi haven't tried it yet, so i dunno for sure
23:12tomojnot sure if go is a good model. hoare neither. and the slides rich linked to 404'd :)
23:35tomojthe google query thing doesn't seem like a good fit
23:35tomojor at least, it needs major translation I think
23:44tomojbbloom: https://www.refheap.com/paste/ed841903a7ea3e9f05b9087a2 hmm
23:45tomojbroken