#clojure logs

2013-02-14

00:03RaynesRich_Morin: Either way, they're still pulling the plug soon.
00:03RaynesYoutube is the canonical location for Clojure videos now.
00:03Rich_Morincool; tnx
00:05antares_Raynes: did you ever figure out how to read and update project.clj programmatically? e.g. to do releases?
00:09cemerickthere's ~3 plugins for that
00:09cemerickI can't vouch for any, but...
00:10antares_cemerick: I need to do something other than releases, so I'm afraid those plugins won't help in my case
00:20callenbotRaynes: first time deploying clojure with monger to Heroku - getting an NPE on DB connect!, you wouldn't happen to know what's up, would you?
00:21Raynescallenbot: antares_ wrote in monger to refheap, so I wouldn't know. :(
00:21antares_callenbot: posting stack trace may help
00:21Raynesantares_: I noticed you still inc the version every once in a while too. You're pretty cool!
00:22callenbotantares_: https://www.refheap.com/paste/11274
00:22antares_Raynes: ocassionally even to incorrect versions ;)
00:22RaynesHaha
00:22callenbot(mg/connect-via-uri! (config :dburi))
00:23antares_callenbot: maybe config has no :dburi?
00:23callenbotantares_: it most certainly does.
00:23callenbotantares_: the question is why does it care at compile time?
00:23antares_callenbot: but why does it happen during code compilation? are you connecting in top-level code?
00:23RaynesThat's strange.
00:24callenbotantares_: yes @ top-level.
00:24callenbotantares_: I'm a bad monkey. I know.
00:24antares_callenbot: that's wrong
00:24antares_do it in -main or initializer functions
00:24antares_at compile time I suspect config is empty, although I don't know much about heroku
00:25cemerickanyone clojurescripting?
00:26callenbotantares_: I put it in my lein-ring :init, thanks.
00:26tommohaving a hard time with clojure, care to help me out :p? http://pastebin.com/FtkRjfbU
00:26tommoit throws an arityexception wrong number of args to me
00:27tommoit's probably very wrong and impossibly un-idiomatic ^.^
00:28tommooops, forgot i had the % in the arguments
00:29antares_tommo: yeah, I was going to ask what % is about
00:29antares_callenbot: note that Monger docs demonstrate connection in -main, at least I tried to make them do so
00:30antares_exactly because connecting at compile time makes no sense and will fail if you use Heroku URIs and such
00:30callenbotantares_: they still have the compile-time thing in the docs...
00:30callenbotantares_: I should've known better anyway. Thanks.
00:30antares_callenbot: where?
00:30dnolencemerick: you running into more trouble?
00:30callenbotdnolen: carthago delenda est.
00:30cemerickdnolen: my middle name of late, it seems
00:33tommoantares_: any ideas what's wrong with it? it just returns with nilnil - http://pastebin.com/TtE0bM6u
00:33cemerickdnolen: I'm just wondering about current wisdom re: writing macros and coping with the resolving of symbols to Clojure (and not ClojureScript) namespaces by `
00:33cemerickJust ~' everywhere?
00:34antares_tommo: c is always greater than i in the first iteration
00:34antares_tommo: if will return nil if it only has 1 branch and it does not "match". Everything is an expression.
00:35dnolencemerick: hmm yeah, I think that can only be avoided if the namespace of the macro file matches the source file?
00:36tommoantares_: oh i thought (< 5 8) meant 5 < 8, doesnt it?
00:36tommo,(< 5 8)
00:36clojurebottrue
00:36tommooh nvm, now i understand, xD
00:37cemerickdnolen: right; and there's some special-casing of clojure.core/* symbols in the analyzer, so e.g. (clojure.core/+ 1 1) will evaluate successfully
00:38cemerickIMO, it'd almost be better if that special-casing didn't exist, just to have some consistency
00:39dnolencemerick: no longer following
00:39dnolencemerick: as in I don't understand what you're saying
00:40cemerickdnolen: evaluating (clojure.core/+ 1 1) in a cljs repl works, presumably as a concession to many (most?) symbols coming out of macros being resolved to clojure.core
00:40tommoantares_: well now i switched the i and c around, but i still cant figure out why its not working :s
00:41dnolencemerick: I still don't understand your point - (clojure.core/+ 1 1) ... ok .. but in relation to what?
00:41tommohow do i know where recur actually "recurs" to?
00:42antares_tommo: in loop to the beginning of the loop. In function bodies, to the top of the function
00:42tommoantares_: thanks
00:46cemerickdnolen: in relation to the quoting that is (sometimes) required in cljs macros. e.g. `(+ x# y#) will work, but `(other-fn x# y#) won't. Anyway, nm, was just wondering if there were better options.
00:47dnolencemerick: I think you may be confused (though I may be wrong about that)
00:49dnolencemerick: the issue is that macro symbol resolution happens in Clojure, nothing to do w/ the analyzer far as I know
00:52cemerickdnolen: yeah, I know Clojure is doing the symbol resolution; I was just noting the special-casing of clojure.core-namespaced symbols in the analyzer https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L162
00:52tommoif conj appends an item to the front of a list, what appends to the end?
00:53cemerick...presumably to avoid the need for ~' for some portion of cljs macros
00:53llasramtommo: ##(map #(conj % :bar) '(:foo) [:foo])
00:53lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: sandbox8276$eval23657$fn
00:54llasramtommo: Ok, let's try again ##(map #(conj % :bar) ['(:foo) [:foo]])
00:54lazybot⇒ ((:bar :foo) [:foo :bar])
00:55tommoi dont quite understand :p
00:56llasramtommo: There isn't a function which appends onto the end of a list. Instead, you have a different data structure (vectors) which `conj` places onto then end
00:57tommollasram: ahh ok, well i just solved it by reversing once finished
00:57dnolencemerick: hmm, I can't say I understand exactly what that is for. not sure what macros would emit clojure.core/foo and not clj.core/foo
00:58dnolencljs.core/foo I mean
00:58llasramtommo: And that's a common solution in other Lisps, but generally in Clojure you solve that by using list vs vector to build your result in the order you want to start with
01:00tommollasram: i see, the reason i was using a list weas because the problem (4clojure) specifically used lists
01:00tommo,(= '(1 2 3) [1 2 3])
01:00llasramAh, fair enough
01:00cemerickdnolen: `(+ x# y#) will emit (clojure.core/foo x_sym y_sym); only `(cljs.core/+ x# y#) will emit cljs.core/+
01:00clojurebottrue
01:00tommooh that works, cool
01:01cemerick(unless *ns* is 'cljs.core, I suppose)
01:01tommollasram: care to check if my code is horrendous :p? http://pastebin.com/VV2RJskc
01:02llasramtommo: I've seen worse :-p
01:03dnolencemerick: right because in the macro file + will refer to clojure.core/+
01:03dnolencemerick: if you did not exclude it and make it refer to something else
01:03tommollasram: thats very reassuring :D, well it's literally some of the first lines of code i've written so hopefully i'll improve :p
01:04cemerickdnolen: Of course. All I was saying is that it's interesting (odd?) that the analyzer swaps the effective namespace of any symbols qualified to clojure.core.
01:05llasramtommo: Cool! Welcome to Clojure, then :-)
01:05dnolencemerick: s/odd/expedient
01:05cemerick:-)
01:06llasramtommo: specific code-wise though -- isn't `i` always going to be less than `c` right off the bat? Well, assuming positive `c` arguments
01:06llasramOh, right
01:06llasramGlorm
01:06llasramIt's getting a bit late EST
01:07llasramLess specific (even though it's getting a bit late), -- in general, loop/recur is a tool you need pretty rarely. Unless the 4clojure problem calls for them, you can probably solve this more compactly using seq operations
01:08dnolencemerick: I don't really see a better solution then naming the macro file the same as the source file. at least then your symbols to default to the same ns.
01:08dnolencemerick: clojure.core/foo just seems like a simple hack to avoid a lot of tediousness
01:09dnolenclojure.core/foo -> cljs.core/foo I mean
01:11cemerickdnolen: The other options might be either not adjusting namespaces at all (which might make understanding the difference in behaviour easier), or — less trivially — offering an unhygenic ~ that doesn't resolve symbols at all
01:13dnolencemerick: neither sound like improvements to me
01:15michaelr525good morning
01:16cemerickFair enough.
01:20llasramHmm, bug? ##(class (read-string (pr-str (/ 0.0 0.0))))
01:20lazybot⇒ clojure.lang.Symbol
01:20callenbotRaynes: it's time.
01:20callenbotRaynes: http://www.youtube.com/watch?v=8OB28fTKSds
01:22cemerickllasram: ##(/ 0.0 0.0)
01:22lazybot⇒ NaN
01:22llasramcemerick: Right. I found the ticket. http://dev.clojure.org/jira/browse/CLJ-1074
01:23Raynescallenbot: This is reasonable music.
01:23Raynescallenbot: I've got one for you!
01:24Raynescallenbot: http://www.youtube.com/watch?v=AypvuzhVlrc
01:25RaynesI suddenly realized I love this woman today. Weirdest music.
01:27andyfingerhutAhhhh. 1.5.0 looks like it is pretty close now. Good.
01:27callenbotRaynes: Lana Del Rey makes me want to go gay.
01:28Raynescallenbot: I take that as "I hate this woman so much I'd prefer to…"
01:28RaynesHow much have you heard from her? This song is pretty peculiar.
01:28RaynesYou might like others.
01:29callenbotRaynes: this song is very unlike her breakout album.
01:32michaelr525nice song actually..
01:32michaelr525i'm not sure I want to hear more songs like these in the close future but it's nice..
01:34Raynesmichaelr525: None of her songs are anything like this, to be fair.
01:34RaynesAt least, none of the others seem similar to me.
01:34RaynesI just enjoy the vocal variety in this song.
01:35michaelr525it's something in her voice.. it's nice but after a couple of minutes you don't want to hear it anymore ;)
01:35RaynesI didn't have quite that experience. :p
01:36Raynescallenbot: If you do decide to go gay, LA would be perfect for you.
01:36michaelr525when i'm satisfied i just roll over and ignore her.. ;)
01:36RaynesHahaha
01:39callenbotRaynes: too bad I hate California. If I switched teams it'd be more BBM than LA fab.
01:39callenbotRaynes: I'm gtfo'ing this state ASAP
02:14aeosynthi've never programmed seriously in a lisp language; should i learn clojure first, or can i dive in with the clojurescript tutorial?
02:17danebezanyone familiar with installing auto-compile in emacs? emacs newbie here
02:20callenbotRaynes: http://www.youtube.com/watch?v=u3ltZmI5LQw
02:22michaelr525aeosynth: i think you can start with clojurescript as well.. although it will probably be harder and more confusing
02:45magopiani know what :foo is, and i know what '(1 2 3) is, but what about 'foo ? (working through the clojure koans)
02:49andyfingerhutIt is a shorthand for (quote foo), where foo is a symbol
02:50magopianmmm, a symbol?
02:53andyfingerhutyes. It is a kind of data that was introduced in Lisp long ago, and Clojure has it, too. It isn't a string, or a number, or a keyword (like :foo). It isn't a collection like '(1 2 3) or [1 2 3]. It is an indivisible thing.
02:54andyfingerhutIt is equal to itself, but not equal to any other symbol with another name.
02:55magopianandyfingerhut: strange, so it's like a keyword, but it's not a keyword
02:56andyfingerhutmagopian: It has many similarities to a keyword. I'm at a loss for the moment to give a great explanation for all the ways it is and isn't like a keyword, unfortunately :)
02:58andyfingerhutAh, one important difference: keywords always evaluate to themselves, whereas symbols can be used as names of vars that can hold values, or via let can be bound to values.
02:59andyfingerhute.g. you can do (let [foo 5] (+ foo foo) to get 10, but you can't put :foo in place of the three foo's there and have it work, because you can't bind values to a keyword.
03:00magopianmmm, so a symbol is "a bit" like an unassigned variable, some kind of value holder
03:00magopianmaybe i'll understand better if i see them used in some code, thanks a lot andyfingerhut for the explanation !
03:01andyfingerhutsymbols in Clojure can be used as names for things, but they can also be used as part of a collection, e.g. '(a b c) is a list of three symbols, a, b, and c.
03:01andyfingerhutYes, if you are going through the koans I'm sure you will get a better idea of things as you work through them.
03:06magopianandyfingerhut: is '(a b c) valid even if you didn't "let" a, b and c previously?
03:07andyfingerhutYes. At least in that case, because of the ' in front, the (a b c) does not get evaluated, so none of a, b, nor c need have been given a value before that.
03:08andyfingerhutand they don't ever need to be assigned values in order for that to work.
03:09magopianandyfingerhut: but if you try to use (first '(a b c)) then it'll fail
03:11andyfingerhutIf you've got Clojure installed and can start a REPL, experimenting can sometimes help understanding (but can also be confusing at first). (first '(a b c)) when evaluated will return the value that is the symbol a. Not a's value, just the symbol a
03:11magopiani do have a REPL, yes, sorry for not just trying it straight away ;)
03:12magopianit's still "early" in the morning, i need my brain cell to wake up :)
03:12magopian(i've been awake for a few hours now, but today seems like a slow day for my brain ;)
03:12andyfingerhutNo problem. I said it can be confusing at first, because while the REPL will give you some kind of answer, there is no "why did it just do that?" button :)
03:13AimHereWell other than 'emacs clojure/src/clojure/core.clj' or whatever ;)
03:19lpetitHello
03:19andyfingerhutBonjour
03:20lpetitI'm having right now some crazy ideas for Counterclockwise, so I'd like some feedback from users or challengers, either to encourage me or to refrain me … let's see :)
03:21magopianlpetit: ccw ? the eclipse plugin?
03:22lpetitIf there must be *ONE* thing all JVM languages, libraries, frameworks, project tools, etc. agree upon, it's that project dependencies must be hosted in maven repositories, right ?
03:22lpetitmagopian: right. I'm the developer of CCW.
03:22magopianok ;)
03:23magopiani'm not (anymore) a user of eclipse, so i won't be able to help, sorry ;)
03:24lpetitAnd yet, CCW, being an Eclipse plugin, follows Eclipse conventions of managing plugins, and their dependencies, in "P2" repositories (P2 are repositories of OSGi bundles. OSGi bundles are "enhanced" maven artifacts, with ways to declare extension points, imported packages from other bundles, exported packages to other bundles, etc.)
03:25lpetitBut it's a shame, because it forces CCW to be less friendly with maven. Right now you have either to choose between OSGi or maven.
03:25lpetitOr so it seemd
03:26lpetitIt seems there are ways to use as few of OSGi as possible to please Eclipse, and then be able to fall back to maven land. Because there are some ways, in Eclipse, to "hook" into the class loader machinery and (i hope), add dynamically (when launched) additional entries to the plugin classpath.
03:26lpetit.
03:27lpetitSee what I mean ?
03:28lpetitCCW could declare no dependency "the OSGi way", and all its dependency "the maven/leiningen way". Then at runtime, the regular Eclipse platform will wire my plugin with no other OSGi bundle, but then my contributed Eclipse "platform hook" would enhance the class loader with dependencies found in ~/.m2/repository !
03:28andyfingerhutIt is possible that the intersection of people on the channel, paying attention, and understanding the nuances of your statements is empty :-(
03:29lpetitandyfingerhut: Rubber duckies never answer questions :-)
03:30lpetitandyfingerhut: it's a private joke between grand and me, I'm generally his "rubber ducky" when he tries to articulate new ideas I barely understand :-)
03:30andyfingerhutlpetit: Thanks for explaining. I tried Googling that phrase and it wasn't very helpful :)
03:32lpetitandyfingerhut: you have references to it, as far as I remember, in "The mythical man month" from Frederick P. Brooks. Something like: a professor told his students to first explain their problems to the rubber ducky next to the entrance in his office. More than often, having forced them to articulate their problem made them find out an answer by themselves, saving him time :-)"
03:33andyfingerhutlpetit: My lack of having read that book is once again reminded to me. I should fix that some day.
03:34lpetitandyfingerhut: and it's a quick and easy read, but quite enjoyable. Old material giving almost universal lessons.
03:35andyfingerhutlpetit: I read "Soul of a New Machine" a couple of years ago, and although the events are mid to late 1970s, the motivations and personalities of typical computer engineers haven't changed much since then.
03:35lpetitandyfingerhut: interesting
04:06pimeysok, three days in a row without touching vim, only emacs
04:07pimeysnow my evil mode starts to feel complete
04:09magopianpimeys: so, how does it feel, switching to emacs? (i used to only use emacs, a long long time ago, but it never "clicked" the way it did with vim)
04:13pimeysmagopian: well, I have to emulate the whole vim command mode
04:13pimeysto be able to do my work
04:13pimeysso evil-mode is great
04:13pimeysbut the whole emacs ecosystem seems to be much better
04:13magopianwow, ok, maybe that's a bit over the top ;)
04:13pimeysonly thing where vim shines is the editor
04:13pimeysvimscripts suck
04:14pimeyselisp doesn't suck
04:14magopianpimeys: i've been told that emacs is a pretty good operating system, it just lacks a decent editor :P
04:14pimeyswell, with evil-mode it has a decent editor :)
04:14magopianhave you tried slimv ?
04:14pimeysnot yet
04:15pimeysbut some repl I did try
04:15pimeyswasn't worth it
04:20FoxboronI am not sure who wrote "slurp" and "spit", but i am sure they are the most awsome function names ever.
04:20noidi:)
04:30rcgFoxboron, imho http://clojuredocs.org/clojure_contrib/clojure.contrib.java-utils/wall-hack-method is the greatest function name :D
04:31rcgand its companion http://clojuredocs.org/clojure_contrib/clojure.contrib.java-utils/wall-hack-field
04:33Foxboronrcg: hahahaha, i have actually not seen those before
04:34clgvrcg: but remember that the old contrib is deprecated
04:34rcgFoxboron, :)
04:35rcgclgv, well that was just a quick google for that name ;)
04:38clgvrcg: yeah, just wanted to mention it. some new people still think they should use old contrib since it is mentioned in the older books ;)
04:41rcgclgv, roger that :)
04:47lpetitclgv: hello
04:47clgvlpetit: hello
04:49lpetitclgv: I CCW started to install parts of it from maven repositories instead of only software update sites, would that make a difference for you ?
04:49lpetits/I/If
04:49clgvlpetit: as end-user?
04:49lpetityes, would that make you uneasy, for instance ?
04:50clgvlpetit: depends on how it works. do you want to implement silent updates?
04:50lpetitThis would mean some of CCW dependencies would be picked from e.g. ~/.m2/repository
04:51lpetitWhen installing a new version of CCW, first the update site which would download a rather thin jar (ccw proper), then pick up remaining dependencies (clojure, leiningen 2, parsley, nrepl, etc.) from ~/.m2/repository (re-downloading them when required, when the plugin starts)
04:52clgvhumm the global repository could be dangerous, I guess. couldnt it use maven in a "CCW-local" repository?
04:53lpetitclgv: yeah, maybe, using a local repository private to CCW, located in the private repo eclipse allows for plugin stuff
04:54clgvlpetit: your purpose is to not have to build eclipse artifacts everytime but to just release them to maven/clojars and have CCW pull in the latest stable automatically?
04:54lpetitclgv: it would be indeed unfortunate if ccw breaks down (or takes forever to restart) each time the user resets its private local repo
04:54lpetitI have several purposes in mind, some short term, some long term
04:55lpetitclgv: first, simplifying ccw internals. And simplifying the addition of dependencies to ccw
04:56lpetitcurrently, this means "ossifying" (or Eclipse-plugification if you want) of dependencies, and their transitive dependencies, etc. A mess. A real barrier to innovation.
04:56clgvlpetit: I think if you have "CCW-local" repo that should be safe for the start
04:56lpetitclgv: ok, so I'll investigate this way this way
04:57clgvleptit: did you already include the repl settings in beta channel?
04:57clgv*repl history settings I meant
04:57lpetitclgv: I can also create a maven repository proxy hosted on the same server as ccw update site, so that I don't depend on the rest of the internet
04:58lpetitclgv: no, I've been stuck by "analysis paralysis" these last few weeks, and only recovering now that I'm finally figuring out a way out of the current status quo
04:58clgvlpetit: oh right, this is another concern to have a reliable source for the deps
04:58clgvthe proxy I meant ^^
05:01lpetitclgv: and I also have future ideas about how to contribute to CCW via lightweight contributions. E.G. just lightweight clojure scripts or leiningen projects. So if CCW itself already uses leiningen to manage its dependencies, the path will be easy
05:02clgvlpetit: ah great. exposing leiningen tasks in eclipse/CCW would be a nice and probably not that complicated addition as well
05:03lpetitclgv: yes, and using leiningen for ccw itself will help find the motivation to develop this :-)
05:03lpetitclgv: so right now, ccw has its internals totally open in front of me, and I'm rearranging things so that it will hopefully work again someday :)
05:04clgvlpetit: that means you toe your local CCW codebase apart totally? :P
05:04clgv*tore
05:05lpetitclgv: no, don't be afraid :-). but i'm removing totally the ccw.clojure, ccw.clojure-contrib, clojure.osgi away. And also the need to have nrepl and contrib. incubator bundles in the development target platform.
05:05lpetitclgv: and I also want to get rid of ccw.parsley as well.
05:06lpetitAll these will become regular maven dependencies now.
05:06clgvah thats great. I hated the nrepl dependency that one needs to put in the runtime dep folder manually^^
05:06lpetitme too :-)
05:07clgvon my new work computer Clojure development with Eclipse is lighting fast now :)
05:07lpetitclgv: and I'm still not sure about bundles internal to ccw : ccw.debug, ccw.leiningen, ccw.util. 2 possibilities : I merge their content into ccw.core. Or I keep them around as ccw.core plugin fragments
05:07lpetitclgv: cool :-)
05:08clgvlpetit: what is preventing you from having them as lein/maven dependencies as well?
05:08lpetitclgv: I also want a more stable CCW. There has been reports, recently, of people having weird exceptions like "-?> not found", etc.
05:09lpetitclgv: well, they are part of ccw, and tied to it (meaningless without ccw)
05:09lpetittho not ccw.util, maybe
05:09clgvlpetit: one thought about version updates. it's probably a good idea to be able to choose which CCW version one wants to have - just in case there are bugs that break in ones production environment
05:10lpetitclgv: ?
05:10lpetitccw.core will remain managed via eclipse software update site
05:11clgvok. and ccw.core with a version say 0.X.Y will have hard-wired dependency versions?
05:11lpetityep
05:11lpetitwe don't loose configuration management with this move
05:11clgvah good. so updating will involve updating the eclipse plugin from the software update site
05:13lpetityes. cgrand wants to go a step further, by having just a "shell" installed from the software update site, which would then download ccw clojure sources e.g. from github (and updating would just mean switching to another commit). I think we may eventually do this,but I'm not ready yet.
05:13lpetitBut still, this would not mean loosing configuration management. Each commit would list the right versions of dependencies to use.
05:15clgvright, thats more effort on the UI part of selecting the versions then ;)
05:16lpetitclgv: right, and since nobody has written a SWT / JFace wrapper yet :-)
05:17clgvlpetit: that's exactly what is missing to write CCW in pure clojure ;)
05:17lpetitclgv: then I need to go full-time on the subject and launch a kickstarter :-)
05:18clgvlpetit: we need a sponsorship for the seesaw guy to have him work on SWT/JFace ;)
05:18lpetityeah -)
05:18clgvlpetit: or that. but I dont know if that would succeed since light-table already succeeded. the question "why another kichstarter financed clojure IDE? doesnt lighttable suffice?"
05:18clgvwill arise
05:19lpetitindeed, light-table people were there first, nice of them
05:19lpetitso far for use :-(
05:19lpetits/use/us/
05:20clgvpeople do to much webdev with clojure. otherwise someone should have started an SWT wrapper already.^^
05:20lpetitclgv: so, for ccw stability, I want to get rid of the "clever" clojure.osgi plugin. And have, "at runtime", everything into a single bundle class loader, so everything into a single class loader: clojure, its dependencies, the remaining java code of ccw, etc.
05:21clgv*too
06:00piranhaI wonder what am I doing wrong with ClojureScript, if executing "cljs.core.type_satisfies_(cljs.core.ISeqable, new cljs.core.PersistentVector())" in browser console returns false?
07:03yediis anyone here using aws beanstalk for any clojure deployments? if so how's it going?
07:03yediit says beanstalk supports java, so i'm assuming that means it supports clojure by extension
07:05babilenHi all -- I am facing an issue with reducers and am not entirely sure how to solve it. I have a reducer which is the result of multiple applications of various r/map, r/filter, ... calls. At the end of all these transformations I want have to call a single function solely for its side-effects for every element in the reducer. How can I do that? Will it be done in parallel? What if the entire collection does not fit in memory?
07:05babilens/want have/have to/
07:41llasrambabilen: Just do something like (r/reduce #(do (your-side-effecting-call %2) nil) coll)
07:42llasram`r/reduce` won't be parallelized, even if the underlying collection supports it -- that's only possible with the `r/fold` semantics
07:43llasramAnd nothing from the generated stream of values is held in memory -- your reducer stack collapses to a single composed function
07:43babilenllasram: Exactly, but IIRC r/fold explicitly states that I cannot fold with non-pure functions.
07:44llasramRight. So yes, you cannot do that :-)
07:47babilenllasram: Ok, so it is essentially not possible to get parallel performance if I cannot hold the entirety of data in a vector - That means that I have to either be able to partition a reducer into smaller pieces or simply use smaller data sets from the start.
07:48babilenllasram: To make it a bit less abstract: I am essentially working on data I read from N files, do something with that data and then write it somewhere. I would love to have the precessing done parallel, but I fail to get the end (non-pure) step right in a parallel fasjion
07:53llasrambabilen: Well, it's impossible to do it using reducers. The semantics surrounding reducers are all about, well, reduction.
07:53llasramIf you're going for side effects, you can always stick with seq. Or split your initial sequence and `pmap` a chain of reducers finishing with `r/reduce` on each one
07:56babilenyeah, thanks for the heads up. The latter sounds as if it is exactly what I want.
07:57dchnoob question, I've added some dependent snapshot jars for a project into ./libs and expecting lein to pick them up. Is this supposed to work?
07:57llasramdch: It is not
07:57dchlein is still only checking on clojars for the site.
07:57llasram~jars
07:57llasramAwww
07:58clojurebotclojars migration is done simply with a bunch of sql defns in a single namespace: https://github.com/ato/clojars-web/blob/master/src/clojars/db/migrate.clj
07:58llasramHmm, not quite clojurebot!
07:59clgvdch: not anymore
07:59dchllasram: not working for me still unfortunately.
07:59clgvdch: you have to add them as dependencies in your project.clj
07:59clgvthat means you have to at least install them in your local maven repository
08:00dchits not my project (githubc cloned). oh was hoping to avoid maven repo, not ventured this far before.
08:00llasramFree-floating JAR files make your project build unreproducable. There is a hack to use them, but it may not be the best
08:01llasramIs this a "normal" dependency which just isn't in a repo, or is it something odd-ball?
08:01dchits a build off master to see if the fix for my issue fixes my issue.
08:01dchso it has a ..-SNAPSHOT.jar at the moment
08:02llasramAh, so a normal dep, and you just need to get it to pick up the new version? Then yeah -- like clgv said, installing in your local maven repo and bumping your dep version is the way to go
08:02dchok I might be better off leaving this for the moment, and setting up a local maven repo when i have time to figure that out. Thanks for the guidance!
08:02llasramOh, you already have one!
08:03llasramIf the dep project was built with lein, junt run `lein install`
08:03llasrams,junt,just,
08:03clgvdch: if it is a leiningen project you checked out, just do `lein install`
08:06AdamChas anybody here played with pomegranate and separate classloaders?
08:07AdamCI have a core program which I want to pull in optional modules at runtime, and I'd like to have the pulled in modules in separate classloaders to avoid dependency conflicts
08:07AdamCpossible?
08:09dchllasram: oh right, I see `lein install` stashes stuff in /~.m2/repository/ I think that is what I needed! After doing that in the dependencies all is well again - thanks.
08:10llasramdch: np. Sorry for all the obfuscation, and glad you did run off before finding there was an obvious solution :-)
08:10llasramEr, didn't
08:11dchllasram: actually the lein / clojure docs are pretty awesome. just annoying that the books I've got don't quite match up to the current state. par for the course.
08:12llasramlein has always had great documentation, and I think having good doco is starting to be an important part of Clojure engineering culture. But it does move fast, so alas for the poor dead trees...
08:13dchetrees in this case, but the publishers drag so
09:35solussdis there a function in core that takes n functions and applies them to n items in a seq? e.g. (apply-funcs [myfunc1 myfunc2] [data1 data2]) => [(myfunc1 data1) (myfunc2 data2)] ?
09:36solussdcould be handy for mapping across a seq of seqs
09:37magopianthat looks like something very easy to do with map
09:39solussdbut it's always a special case, e.g. (map (fn [[x y]] [(myfunc1 x) (myfunc2 y)]) [[data1 data2] [data3 data4]])
09:40magopian[x &y]
09:40solussdi'd want to replace that anonymous function w/ (partial func-im-looking-for [myfunc1 myfunc2])
09:40solussd?
09:41magopianyou can write functions which take an arbitrary number or elements
09:41solussdi'm looking for the "opposite" of juxt. :)
09:41solussdthat's not my problem.
09:41magopiani think i don't understand your issue properly then ;)
09:42solussde.g. juxt takes several functions and returns a seq of the results of applying those functions to one value
09:42solussdi want to take n functions and apply them to n values and return n results
09:42magopianapplying those functions to _one_ value ?
09:42magopianah, ok, n values, that's what i understood
09:43alexnixon,(map #(%1 %2) [inc dec] [10 20])
09:43clojurebot(11 19)
09:43Bronsa,(map deliver [inc dec] [1 2])
09:43clojurebot(2 1)
09:43alexnixonBronsa: nifty
09:43magopian,(doc deliver)
09:43clojurebot"([promise val]); Alpha - subject to change. Delivers the supplied value to the promise, releasing any pending derefs. A subsequent call to deliver on a promise will throw an exception."
09:43solussdBronsa: that's what I want!
09:43magopianahhh nice
09:43Bronsait relies on the curet implementation of deliver though.
09:44solussdthough… using deliver is .. interesting. :)
09:44borkdudehuh
09:44Bronsacurrent*
09:44magopian,(map deliver [inc dec] [1 2 3 4])
09:44clojurebot(2 1)
09:44Bronsawell, that's how map works
09:44magopiansure
09:44magopianjust testing ;)
09:45borkdude,(map trampoline [inc dec inc] [10 20 30])
09:45clojurebot(11 19 31)
09:46borkdude:P
09:46Bronsathere is a actually a function that takes a collection and returns an infinite lazy seq of the concat of that coll with itself
09:46Bronsabut I don't remember how it's called.
09:46solussdcycle
09:46Bronsathat.
09:47Bronsa,(map deliver (cycle [inc dec]) [1 2 3 4 5])
09:47clojurebot(2 1 4 3 6)
09:47borkdudeor:
09:47borkdude,(map trampoline (cycle [inc dec]) [1 2 3 4 5])
09:47clojurebot(2 1 4 3 6)
09:48borkdudefar from idiomatic though ;)
09:49borkdude,(map (fn [f & args] (apply f args)) (cycle [inc dec]) [1 2 3 4 5]) ;; is better imho
09:49clojurebot(2 1 4 3 6)
09:50solussd,(apply hash-map (mapv trampoline (cycle [keyword identity]) '(mykey "myval" mykey2 "anotherval" mykey3 6)))
09:50clojurebot{:mykey2 "anotherval", :mykey3 6, :mykey "myval"}
09:52canweriotnow,(reduce + '(1 2 3 4))
09:52clojurebot10
09:52canweriotnowzomg the channel is a repl.
09:52solussd:D
09:53Bronsaborkdude: definitely.
09:53canweriotnow(def my-mind "blown")
09:54solussdi feel like there should be a more generically named function with the implementation of 'deliver'
09:54borkdudecanweriotnow yes, it's not a session aware repl though, it's all on off
09:54borkdudeone
09:54clgvcanweriotnow: clojurebot is "a repl" ;)
09:54Bronsasolussd: funcall :)
09:54clgv,*ns*
09:54clojurebot#<Namespace sandbox>
09:54borkdudeyeah funcall
09:54solussdwe dont have funcall, do we?!?
09:54clgv&*ns*
09:54lazybot⇒ #<Namespace sandbox15649>
09:54Bronsano
09:54canweriotnowborkdude - yeah, I assumed that. Still. ZOMG.
09:54clgv&*ns*
09:54lazybot⇒ #<Namespace sandbox15649>
09:54clgvthere is my session^^
09:55borkdudesolussd nope, but apparently trampoline and deliver both behave as funcall
09:55borkdude&*ns*
09:56lazybot⇒ #<Namespace sandbox15649>
09:56clgvah damn^^
09:56solussdcool, thanks all
09:56clgvbut clojail can be used to implement repl sessions^^
09:56alexnixonborkdude: trampoline doesn't quite
09:56borkdude,(trampoline inc 1)
09:56clojurebot2
09:56canweriotnowNow we just need a twitter-bot that eval's tweets :D
09:56borkdude,(deliver inc 1)
09:56clojurebot2
09:57alexnixon,(deliver (fn [_] (constantly 7 )) 2)
09:57clojurebot#<core$constantly$fn__2351 clojure.core$constantly$fn__2351@31aba72e>
09:57alexnixon,(trampoline (fn [_] (constantly 7 )) 2)
09:57clojurebot7
09:57borkdudealexnixon I see
09:58canweriotnow,(iterate inc 5)
09:58clojurebot(5 6 7 8 9 ...)
09:58borkdudealexnixon another reason not to abuse those
09:58solussdyeah, i wont be using deliver for this- it'll confuse anyone reading it. :)
09:58canweriotnow,(take 100 (iterate (partial * 2) 1))
09:58clojurebot(1 2 4 8 16 ...)
10:11alexnixonsolussd: also see https://github.com/flatland/useful/blob/develop/src/flatland/useful/fn.clj#L94-L100
10:11solussdalexnixon: that is _exactly_ what I was looking for, thanks
10:53TimMc,*1
10:54clojurebot#<Unbound Unbound: #'clojure.core/*1>
10:54gfredericks,(binding [*1 "HAR"] (str *1 "!"))
10:54clojurebot"HAR!"
10:54gfredericks,(meta #'*1)
10:54clojurebot{:ns #<Namespace clojure.core>, :name *1, :dynamic true, :added "1.0", :doc "bound in a repl thread to the most recent value printed", ...}
10:54borkdudeany org-mode knowers here? how do I produce a verbatim string literal, like ~"foo"~
10:55gfredericksborkdude: why doesn't that work?
10:55jweissif i have two sets of functions that do the same thing but in different ways (in my case, communicate with an app i'm testing either via its UI or API), is there some way to switch between implementations? all i can think of is just use java interface and methods.
10:55borkdudegfredericks I have no clue, but it doesn't
10:55gfredericksborkdude: this is for HTML export?
10:55borkdudegfredericks yes and latex
10:56gfredericksborkdude: I do the html export all the time and that syntax works fine for me; also you can use = instead of ~
10:56gfredericksit wraps with <code> tags
10:56TimMcjweiss: As in, dynamically switch?
10:56borkdudegfredericks I get this ~"de data zijn gelijk"~ in the HTML
10:57gfredericksborkdude: what org-mode version?
10:57jweissTimMc: yes, but also it would be nice if i'd get a compile error if one or the other impl diverged from the interface
10:57borkdudegfredericks 7.9.3d
10:57jweissor from each other
10:58gfredericksborkdude: mine is 6.33x
10:58gfredericksborkdude: not sure what else to say; you're not in a funny context like a code block are you?
11:00TimMcjweiss: Ah, you want static typing! :-P
11:01borkdudegfredericks lemme paste on refheap - o wait, I've got refheap.el installed… now I can use it :)
11:01jweissTimMc: well, doesn't reify throw an error if you dont, for example implement the interface correctly?
11:01TimMcSure.
11:01borkdudegfredericks https://www.refheap.com/paste/11287 (at the bottom)
11:02jweissTimMc: i'm just saying that's the kind of checking i'd like, vs just 2 collections of functions where nothing checks the fn signatures against anything.
11:02TimMcjweiss: But you could just as well write a test that checks if both namespaces contain the required defns. :-)
11:02gfredericksborkdude: do your = expressions export correctly?
11:02borkdudegfredericks yes
11:03TimMcIt feels slightly silly, but I don't actually see anything wrong with it.
11:03gfredericksborkdude: what about switching your ~ expressions to =?
11:03borkdudegfredericks same error
11:03gfredericksborkdude: what about switching your = to ~? :)
11:03vijaykiranborkdude: "Geef de String =de data zijn gelijk= terug" works for me
11:03TimMcTry ALL the ASCII!
11:03vijaykiranborkdude: org-version - 7.9.3.e
11:04gfredericksman my org so old
11:04borkdudevijaykiran I want a string literal, so surrounded with "
11:04gfredericksI wish I knew how to do computers
11:04borkdudegfredericks I updated org-mode from marmalade (or something, I just type package-list-packages)
11:05borkdudealso ~ blocks not seem to work when you start with =
11:05vijaykiranor el-get-update org-mode
11:05borkdudeso ~=~ is a function in clojure
11:06borkdudeah wait, that works
11:06borkdudevijaykiran I haven't got that one
11:07borkdudeI will do without the surrounding " for now
11:07borkdude "~de data zijn gelijk~" works though
11:08borkdudegfredericks the dates are equal
11:08gfredericks"the data is gaelic"?
11:09borkdudeupdating my practicum exercises (created by students last year): first step, convert from latex to org-mode and then change the exercises themselves
11:10vijaykiranborkdude: http://orgmode.org/manual/shebang.html#shebang seems to have what you want to have - may be you can try checking the source of that :)
11:11borkdudevijaykiran hmm yeh
11:12borkdudevijaykiran hm, next challenge: find the source for this
11:12borkdudevijaykiran http://stackoverflow.com/questions/4209611/is-the-org-mode-manual-available-in-org-file <- argh
11:13vijaykiranah - crap
11:14borkdudevijaykiran of course, some websites about clojure are also written in ruby right
11:18vijaykiranborkdude: http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg01417.html
11:19borkdudevijaykiran tnx!
11:24borkdudeI did customize variable on that one and now it works - but where did it save this change when I pressed "save for future sessions"?
11:24gfredericksyour .emacs file?
11:25borkdudegfredericks I have no .emacs file, only init.el and nothing changed in there
11:25gfredericksthat's my only guess then; I only know that org-mode has a habit of editing my .emacs
11:32borkdudegfredericks added it manually anyway
11:42dnolen`fogus: 85 people signed up for Confo, crazy!
11:42gfredericks(inc confo)
11:42lazybot⇒ 1
11:42dnolen`fogus: I would have been excited about 30!
11:43borkdudednolen maybe core.logic was used for marketing and yielded the entire possible search space for people interested in it
11:46borkdudednolen I didn't mean that in a positive way
11:46borkdudednolen I did. typo.
11:47gfredericks~rimshoto
11:47clojurebotBadum, *tish*o
11:47dnolenborkdude: heh :)
11:51borkdudeis it possible to have multiple headings in org-mode but to start only numbering at the second one?
11:57`fogusdnolen: It's wild! I'm hoping for 100 ;-)
11:59`fogusdnolen: I think Friedman was expecting ~12
11:59`fogusincluding speakers.
12:08dnolen`fogus: hehe
12:13SurlyFrogIs there a standard way to `pr` a date as an EDN #inst such that it can then be read back by `clojure.tools.reader.edn/read`? I don't see an appropriate formatter in clj-time.
12:14gfredericksSurlyFrog: I've just done a defmethod for print-method and print-dup
12:14gfredericksSurlyFrog: what do you mean by a date? java.util.Date already works that way doesn't it?
12:15SurlyFroggfredericks: not that I can see. If I `(pr (time/now))` I get #<DateTime 2013-02-14T17:16:05.578Z>
12:15SurlyFrogwhere time is clj-time.core
12:16gfredericksah that's probably a Joda thing then
12:16gfredericksI'll find you what we have
12:16SurlyFrogthanks so much. I really appreciate it. I'm not entirely sure what the whole Joda time thing is...
12:16SurlyFrogI imagine it's my basic Java naivety
12:17gfredericksSurlyFrog: https://www.refheap.com/paste/11290
12:17gfredericksJoda is just a java library for time
12:17gfredericksthat clj-time uses
12:17technomancyJoda is the thing that saves you from the insanity of the built-in Java date/time handling classes
12:17SurlyFrog:-)
12:18SurlyFroggfredericks: thanks again
12:21gfredericksSurlyFrog: no problem
12:21gfredericksSurlyFrog: if you figure out how to do it without the java.util.Date conversion let me know :)
12:21SurlyFrog:-
12:21SurlyFrog:-)
12:22SurlyFrogWhere would `clojure.instant` be documented?
12:22gfredericksno idea :)
12:22gfredericksI hardly knew about it
12:22gfredericksin the source maybe?
12:23ghadishaybanhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/instant.clj
12:23ghadishaybanthe formatters namespace in clj-time has useful methods that you can leverage to print out #inst literals
12:24SurlyFrogghadishayban: thanks. I still get confused as to whether I should be looking at docs from clojure.org, clojuredocs.org, ....
12:24technomancyclojure.org has some good essays on it, but it's not a good reference other than that
12:29dabdanyone knows why pattern matching is not in the clojure.core? https://github.com/clojure/core.match/wiki/Overview
12:30gfredericksdabd: not often necessary? the lib isn't fully baked yet?
12:30gfrederickseasy enough to use as a lib
12:31dabdi don't mean this implementation but pattern matching in general, like Ocaml has
12:31dnolendabd: definitely fully baked and pattern matching will probably never make it in.
12:31dnolendabd: rhickey doesn't like pattern matching
12:31dabdreally? any reason?
12:31dnolendefinitely *not* fully baked I meant
12:31gfredericksphew
12:31technomancydnolen: we got to give core.match a run at the last seajure; it was a lot of fun
12:32dnolendabd: pattern matching is order complected and closed
12:32dnolentechnomancy: sweet
12:32SurlyFrogSo is there any advantage to using a DateTime versus a java.util.Date object?
12:33gfredericksSurlyFrog: java.util.Date is mutable
12:33SurlyFrogtechnomancy: thanks for the tip on clojure.org vs. clojuredocs.org
12:33SurlyFrogoh
12:33SurlyFroggot it
12:33dabddnolen: "order complected and closed" not sure I understand this but google brings me to rhickey's talk http://www.infoq.com/presentations/Simple-Made-Easy :-)
12:33technomancyerror messages had everyone in the room confused at a few points, but we figured it out
12:33technomancyI'd buy the whole "hard-baked ordering is bad" argument a lot more easily if I'd ever seen anyone actually use prefer-method.
12:33technomancySurlyFrog: java.util.Date is completely batshit
12:34dabddnolen: maybe he criticized pattern matching in this talk?
12:34dnolentechnomancy: heh, core.match uses prefer-method in several places
12:34SurlyFrogtechnomancy: okay then….I'll take your word for it and stear clear :-)
12:34dnolendabd: he does talk about why he does like it
12:35technomancydnolen: is there a prefer-method for protocols?
12:35dnolenit seems to me even the Scala luminaries now look down on overuse of pattern matching
12:35dnolentechnomancy: no, but I use multimethods in core.match, I may even switch to them completely in the future, pattern match compilation speed is not a bottleneck
12:36technomancyright; makes sense for core.match
12:36dabdmaybe pattern matching is more interesting in statically typed languages?
12:36dnolendabd: no
12:36technomancyI'm just saying in general, that's not a problem people encounter frequently, and prefer-method with derivation hierarchies easily makes for code that's very difficult to follow.
12:36SurlyFrogActually, it looks like I have to use java.util.Date anyways as that's what the edn reader returns:
12:36dnolendabd: racket has a completely rocking pattern matcher which is extensible.
12:36SurlyFrog(type (edn/read-string "#inst \"2013-02-14T17:09:12.503Z\"")) ; => java.util.Date
12:37gfredericksSurlyFrog: that's configurable
12:37dnolendabd: most typed languages the pattern matching is a pretty frozen language feature
12:37SurlyFroggfredericks: oh
12:37SurlyFrogI'll look at that
12:37gfredericksSurlyFrog: just put this in /src/data_readers.clj: {inst clj-time.format/parse}
12:37mefistopattern matching seems quite nice for clearer algorithm expression
12:38dabdthen I don't understand why you said first that rhickey doesn't like pattern matching but you said in the talk he says why he likes it
12:38dnolendabd: quite a few papers on improving pattern matching in statically typed languages - esp. F# & Haskell
12:38dabdanyway going to watch it now
12:38SurlyFroggfredericks: I didn't follow that. Does that go in /my/ code, or in the tools.reader code someplace?
12:38dnolendabd: er mistyped, he says why he doesn't like it in the talk.
12:38dabddnolen: ok
12:38gfredericksSurlyFrog: that goes in your project; the reader looks for it and uses it to read data literals
12:39gfredericksSurlyFrog: see the bottom of (or all of) clojure.org/reader
12:39SurlyFrogSeriously? Inside any file, or in a file specifically named 'data_readers.clj'
12:39gfredericksthe latter
12:40SurlyFrogGot it
12:40dabdwell it looks useful and the overtone project uses pattern matching
12:40gfredericksSurlyFrog: if you're on the latest 1.5 this might be slightly different; I'm not sure how the dust settled
12:40SurlyFrogI'm on 1.4, so no worries about that, though thanks for the heads up
12:42dnolendabd: pattern matching is useful, and I like it regardless of what rhickey thinks :) core.match works great as a lib.
12:42dabddnolen: definitely I am going to use it
12:42dabdwill you keep working on it?
12:43dnolendabd: yes - it needs refactoring, internal documentation, & bug squashing. still a bit busy with core.logic tho so I haven't given it much love.
12:47technomancydnolen: the other thing that tripped us up was the divide between seqs and vectors; having two things that = considers equivalent not match led to bugs that were difficult to find
12:47technomancyis that one of the things you'd revisit?
12:48dnolentechnomancy: yes that misfeature will be eliminated
12:48technomancygreat
12:48dnolentechnomancy: only vector syntax, no :seq stuff
12:48technomancyyeah, that's how everyone assumed it worked =)
12:49technomancybut that kind of thing isn't always obvious from the outset from an API design standpoint
12:50dnolentechnomancy: yeah, it was a fun experiment - seq matching is really fast - but it's best left as a feature for some else to add if they need it who understands the issues around it.
12:50SurlyFrogThe sentence: "I'm doing this because according to technomancy; 'java.util.Date is completely batshit.'" was just committed as a comment in my source :-)
12:50technomancyheh
12:51technomancy(java.util.Date. 2013 2 14) -> #inst "3913-03-14T07:00:00.000-00:00" ; wat
12:52SurlyFrogo_O
12:53TimMcI just realized that conversion between 24-hour time and 12-hour time has a corner case at midnight.
12:54progoalmost like a branch cut.
12:54TimMc?
12:54progocomplex analysis, nvm
12:55TimMcI've always been uncomfortable with 12:00 AM belonging to the following day (or existing at all), but I hadn't realized that aspect.
12:55gfrederickstechnomancy: it's just the principle of weirdest surprise
12:55gfredericksTimMc: I made a lib for plain dates so I could stop worrying about that nonsense when it didn't matter
12:55dabdI got this: Exception Can't connect to native server - no compatible libraries for your system are available. overtone.sc.machinery.server.connection/boot-internal-server (connection.clj:202)
12:55technomancygfredericks: the best part is how Javascript was all "where should we get ideas about how to design our Date API" they were like "I KNOW JAVA"
12:55dabdafter evaluating (use 'overtone.live)
12:56dabdanyone knows what could be the cause?
12:56technomancyor rather "I KNOW, JAVA"
12:56gfredericksdabd: you've read the docs about the system requirements and such?
12:56ivanhttps://en.wikipedia.org/wiki/12-hour_clock not with Japanese legal convention
12:57dabdgfredericks: I was following the readme, I didn't find any system requirements there
12:57gfredericksdabd: okay; I've barely used it but I remember having to have a server for something or other installed at the OS level
12:59dabdgfredericks: probably I have to install supercollider
13:00technomancyTimMc: yet another reason not to use 12-hour time
13:07TimMcivan: I love how German train schedules work: "Departs at 22:00, arrives at 27:15."
13:08sisciaHi guys, I do have a problem with rest
13:09sisciaI want a function that work like so:
13:09siscia(defn func [f a & more] (map f a more))
13:09sisciabut it doesn't really works...
13:10dnolensiscia: what is that supposed to do?
13:11sisciadnolen, it is a little more complex that it...
13:11sisciadnolen, however I want to apply map to nested structure
13:11sisciadnolen, something like:
13:12SegFaultAXsiscia: Have you looked at clojure.walk?
13:12siscia(map + [[1 2] [2 3]] [[1 2] [2 3]])
13:12siscia[[2 4] [2 6]]
13:12sisciadnolen, nope, I didn't...
13:12sisciaLet me take a look...
13:14dnolen,(map #(map + %1 %2) [[1 2] [2 3]] [[1 2] [2 3]])
13:14clojurebot((2 4) (4 6))
13:14dnolensiscia: ^
13:14sisciayeah ok, but what if it is deeper nested...
13:14sisciadnolen,
13:14sisciaThanks SegFaultAX
13:16sisciano other ideas ?
13:16ChongLisiscia: explicit recursion (as a last resort)
13:16dnolensiscia: I'm sure you can come up with something that does what you want
13:16sisciaChongLi, I was doing something like so:
13:17siscialet me gits it...
13:18sisciahttps://gist.github.com/siscia/4954934
13:18sisciabut it doesn't work with the rest
13:18sisciaI am honestly thinking is just a syntax proble,..
13:22TimMc,(apply str (mapcat (fn [c n] [\u0003 (-> n str first) c \u0003]) "COLORS" (range 2 10)))
13:22clojurebot"COLORS"
13:22TimMcOh, huh.
13:23TimMcWell, that was a lot prettier in PM with clojurebot.
13:23gfrederickseverything's prettier when in PM with clojurebot
13:24TimMcNow, is that a client issue or a difference in how the bots handle PM and channels?
13:25ChongLiTimMc: that'd be my guess; they don't want people messing up the channel with colors
13:26TimMc:-(
13:26technomancyIIRC there's no standard for colors in IRC; some clients just copy mIRC
13:26technomancythe spec doesn't even tell you what encoding to use =\
13:27TimMcOh, I know how to test this.
13:27TimMcC
13:27TimMcOK, it's the bots.
13:32SurlyFrogI forget, do all Clojure files need to be named foo_bar.clj instead of foo-bar.clj?
13:32SurlyFrogthat's what Java wants, right??
13:32lazybotSurlyFrog: Definitely not.
13:32Bronsahiredman: https://github.com/clojure/tools.reader/commit/9c3fead6083d5b39a7f7755223dc0e838bc30f4b here you are.
13:32SurlyFrogokay
13:33ivan"Because of IRC's Scandinavian origin, the characters {}|^ are considered to be the lower case equivalents of the characters []\~, respectively. This is a critical issue when determining the equivalence of two nicknames, or channel names."
13:33dnolenSurlyFrog: yes dashes must become underscores
13:33SurlyFrogokay..
13:39TimMcivan: wat
13:53austinhdnolen: Thanks for your resonses about that bug report I filed (and sorry for the noise).
13:55austinhdnolen: TRS had really made me think conde/condi clause ordering was important, but I can see how that evolved (and I was also conflating goal ordering with clause ordering).
13:55dnolenaustinh: no problem - it's a bit strange - but it really is how it's supposed to work. yes things have changed since TRS
13:56dnolenaustinh: TRS preserved Prolog depth first, but miniKanren is only conde now and no promises are made about order
13:57ChongLithis?: https://github.com/clojure/core.logic/wiki/Differences-from-The-Reasoned-Schemer
13:57austinhdnolen: I saw the comment that core.logic's conde is TRS's condi, but I still understood condi to operate top-down, and I had a mental model of a depth first search.
13:59dnolenaustinh: yeah trying to get answers in a specific order just will never work in miniKanren nore core.logic
13:59dnolenmodern miniKanren
13:59ChongLiI really need to get TRS and learn this stuff
13:59borkdudewhy is add-watch still alpha/subject to change in clojure-1.5-RC16
14:00TimMcPerpetual alpha.
14:05austinhdnolen: That investigation began with this bit of core.logic code that is overflowing the stack: https://gist.github.com/austinhaas/4955349
14:06dnolenaustinh: huh ... overflow and not non-termination?
14:07austinhdnolen: Yes. java.lang.StackOverflowError
14:08austinhdnolen: It works fine with vectors, and also if that last clause of matcha only wraps a single list around a.
14:08dnolenaustinh: the stack overflow is definitely a bug, please open a ticket for that with that example program.
14:11austinhdnolen: Ok.
14:13dnolenaustinh: the conda/u code was slightly wrong and I can see why your code would produce a SO error - so this needs fixing
14:13dnolenaustinh: thanks
14:16dnolenaustinh: in that particular example did you try swapping with matche?
14:17austinhdnolen: Yes. Same error.
14:20rhg135Hello all, is there any proper way to call a protected method using gen-class?
14:21dnolenaustinh: huh, OK will look into it
14:22TimMcrhg135: gen-class allows you to define methods, not call them.
14:23rhg135then can you suggest an alternative I'm quite new to clojure
14:23TimMcWhat are you trying to do?
14:24ToBeReplacedi find myself doing (apply hash-map (interleave (map func values) values)) often; am i missing a more idiomatic alternative?
14:24technomancyToBeReplaced: zipmap prolly
14:24rhg135I
14:25austinhdnolen: Any tips on debugging? I can't seem to get any print statements to go to the repl in my core.logic code.
14:25ToBeReplacedtechnomancy: yep thanks
14:25rhg135I'm trying to subclass PircBot's class and call setName
14:25SegFaultAXToBeReplaced: That is a nifty way to do the same thing, though :)
14:26TimMcrhg135: Ah, you want to call a protected method from inside a gen-class method?
14:27rhg135yeah from post-init, I have a class i wrote in java which works from clojure
14:27dnolenaustinh: core.logic is lazy, you need to wrap in doall. Also you need to use the logging goals, or just put your println in (fn [a] (println ...) a)
14:27dnolenaustinh: the joys of monadic code
14:28austinhdnolen: Ok. Thanks.
14:29amalloyToBeReplaced: or (into {} (map (juxt func identity) values))
14:30ToBeReplacedamalloy: that's even cuter, ha
14:45rhg135hello?
14:45clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline rhg135
14:45devnwhoa
14:45rhg135lol
14:45devnrhg135: hi
14:46pppaulyou broke clojurebot
14:47SegFaultAXclojurebot is on the frtiz.
14:49technomancyeh, that's pretty typical
14:51seangrov`Goodness, angry people are angry
14:51pppaulyou talking about me?
14:52seangrov`technomancy: You've got to stop misleading people about lein being an IDE
14:52technomancywhat, it's not integrated enough for you?
14:52seangrov`No, just a customer/user that spewed a lot of anger on olark to me, and the clojure ml thread about "Why is this so difficult" or something along those lines
14:53technomancy(that was a joke fwiw)
14:53seangrov`It needs to be more "develop-y"
14:53gfrederickspjstadig: ping
14:53pppaullein is great
14:53technomancyseangrov`: maybe more environmental too? I've been working on supporting compostable functions for the next release.
14:54pppaulwhat is a compostable function?
14:54seangrov`pppaul: Only organic materials
14:54pppaulorganic functions
14:55gfredericksartesian parentheses?
14:55eggheadtechnomancy: is there a way to tell 'lein deploy' how to create the jar?
14:55pppaulwill you support the raw function movement as well?
14:55eggheadI'm using the lein ring plugin so I need to use 'lein ring uberjar' to create my jar
14:55technomancywe're also looking at using fair-trade vars for 2.5, but you can't just blindly follow certifications.
14:55eggheadhowever 'lein deploy' seems to just 'lein uberjar'
14:56technomancyegghead: hrm; yeah currently that's not possible since it calls the jar defn directly rather than going through apply-task
14:56technomancyyou'd have to write your own task. could be quick if you stoop to a with-redefs.
14:57technomancyjust ignore this guy: http://www.netmeister.org/blog/images/dijkstra-quick-n-dirty.jpg
14:57technomancyegghead: you raise a good point that deploy should be easier to parameterize. if you open an issue we can address it in a future release perhaps.
14:58eggheadthanks technomancy
14:58eggheadso lein deploy doesn't uberjar currently? just calls 'lein jar' and ships the result off to sonatype or w/e ?
14:58eggheadlooks like I'll have to go another route, thanks technomancy :)
14:59technomancyyeah; I mean from what I understand mvn repos are designed with single jars in mind rather than uberjars. it might work with uberjars; there might be subtle gotchas to watch out for. but Leiningen shouldn't prevent it.
15:15xavrileysmall announcement - I've forked the clojuredocs site to make documentation for the Overtone project. It's here if anyone is interested - http://overtone-docs.herokuapp.com/
15:17austinhC-c C-p is a great feature I should've learned earlier.
15:18finnjcan anyone point me in the general direction to how I do mocking in Clojure?
15:18llasramfinnj: ##(doc with-redefs)
15:18lazybotjava.lang.SecurityException: You tripped the alarm! with-redefs is bad!
15:18llasramha
15:18llasram&(doc with-redefs)
15:18lazybotjava.lang.SecurityException: You tripped the alarm! with-redefs is bad!
15:18llasram,(doc with-redefs)
15:18clojurebot"([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mockin...
15:18llasramSrsly, lazybot
15:19rhg135Can someone please help be able to use protected java methods?
15:20SurlyFrogAnyone know why trying to force a Long to print as a 64-bit hexadecimal value isn't always consistent? Doing `(printf "%#016x" Long/MAX_VALUE)` yields what I would expect, but `(printf "%#016x" 1)` seems to be missing two nibbles of zeros.
15:20finnjlol ok thanks llasram
15:22llasramSurlyFrog: ##(format "%#03x" 1)
15:22lazybot⇒ "0x1"
15:23llasramSurlyFrog: It seems that Java counts the '0x' in the length
15:23SurlyFrogllasram: oh, …. well that's dumb.
15:23SurlyFroger, I should say…I didn't expect that to be the case...
15:24llasramIt seems consistent-ish. I actually didn't know about the '#' format flag -- always do "0x%016x" myself
15:25SurlyFrogllasram: thanks much
15:43tommo,(false)
15:43clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>
15:50akhudekwhoa, korma's delete results all the results
15:50akhudekreturns rather
15:50akhudekI did not expect that
15:51abpakhudek: in production? :o
15:51akhudekabp: no, but it caused my dev server to blow it's heap
15:53akhudekI'm really starting to feel that straight jdbc is perhaps the best way to go. I've had too many surprises like this with korma.
15:53TimMcReturns *what* results?
15:53brehautakhudek: straight jdbc has been my conclusions re:korma too. its just too often surprising as an abstraction. jdbc is blunt but at least its pretty predictable
15:54akhudekI think it's intended to return the keys of the tuples being deleted. But since it does this naively it will read all the tuples then select out the keys. When you do this with a bunch of tuples containing binary data, it's not exactly performant.
15:55akhudekI had a similar problem at one point inserting into a write only table.
15:56TimMcHaha, nice.
15:56akhudekInsert also reads back it's data by default.
15:57thalassios_xelonhello :))
15:58thalassios_xeloni am using a chain of functions that get a lazyseq as argument,and returns another lazyseq
15:59borkdudehow can I use parse on just a string representing xml? wrap the string in some object?
15:59thalassios_xelonis that normal?
15:59TimMcthalassios_xelon: Sure.
15:59borkdudethalassios_xelon yes, that's quite normal
16:00thalassios_xelonok :) something else might be the bug thx
16:00TimMcthalassios_xelon: Any side-effects involved?
16:00thalassios_xelonno
16:01thalassios_xelonif you want to check is something is a collection how you do it?
16:01TimMccoll?
16:01clojurebotReader syntax of collections has gotchas
16:02thalassios_xelonok :)
16:02thalassios_xelongoodnight
16:06thalassios_xeloni think my function works ok for a list,and not with a lazyseq,could this happen?
16:07TimMcthalassios_xelon: Not if you're using generic collection and seq fns.
16:08TimMcCan you make a small example of what's not working?
16:08thalassios_xelonf is a lazyseq that represents a simple list
16:09thalassios_xelon(evaluate-postfix (apply list f) demorgan add-parenthensis) its works
16:09thalassios_xelon(evaluate-postfix f demorgan add-parenthensis) its doesnt work...
16:13gfredericks,(conj {} [1 2])
16:13clojurebot{1 2}
16:13gfredericks,(conj {} '(1 2))
16:13clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry>
16:15Frozenlockgfredericks: ... why?
16:15TimMcgfredericks: Yeah, but lists and seqs and basically the same thing.
16:15gfredericksFrozenlock: why does it do that or why do I mention it?
16:16FrozenlockWhy does it do that
16:16gfredericks,(doc conj)
16:16clojurebot"([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."
16:16FrozenlockYou forced me to type the entire question, damn you!
16:16brehautbecause magic
16:16gfredericks,(conj {} (list [1 2] [3 4]))
16:16clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.Map$Entry>
16:17gfredericks,(conj {} {1 2 3 4})
16:17clojurebot{3 4, 1 2}
16:17gfredericks:/
16:17Frozenlockgfredericks: stop confusing me!
16:17gfredericksdo any other types have varying behavior with conj?
16:18gfredericksI bet that annoyed the crap out of ambrose
16:19gfredericksalso what is the use case for conjing a map onto a map?
16:19dnolengfredericks: I don't see why second arg to conj must necessarily be Any I would think
16:20gfredericksdnolen: well if the first arg is a map then it's only going to accept a vector, a map-entry, or a seq of map-entries, AFAICT
16:20gfrederickswhereas for most other collection types I think the second arg can be anything
16:22dnolengfredericks: oh you're right, http://github.com/frenchy64/typed-clojure/blob/master/src/typed/ann.clj#L374
16:23gfrederickshuh; I'm not used to reading these but I don't _think_ the case for a seq of entries is there?
16:39ayiaHi Guys, I am reading one intro to clojure... Russion version of the http://www.lisperati.com/casting.html for clojure... And I am trying to understand this line of code: (defmacro defspel [& rest] `(defmacro ~@rest)). Actually I don't understand it... Can somebody explain? What does ~@ mean?
16:40vijaykiranayia: http://stackoverflow.com/questions/4571042/can-someone-explain-clojures-unquote-splice-in-simple-terms
16:41technomancyayia: someone can explain it, but if I recall that tutorial correctly, that line is one you're just supposed to enter and ignore; it gets explained much later in the tutorial.
16:41technomancyit's just a clever trick to make Clojure fit better into the metaphor he's using
16:42ayiatechnomancy: i see... I understand the purpose... But want understand the root:) Is anybody using this "SPELs" technique in real life?
16:42technomancyI recommend coming back to it after you've finished the tutorial; it will probably make sense then.
16:44ayiatechnomancy: ok will try)
16:44ayiavijaykiran: thanks bro, got the meaning of ~@ !
16:44vijaykiranayia: shh -- just follow technomancy's advice :)
16:45tommopeople always know better ;p
16:47dnolencemerick: good catch, so you see a warning *and* an error?
16:47jro_do you know any CMS apps written in clojure?
16:48vijaykiranjro_: like https://github.com/fmw/vix ?
16:48vijaykiranjro_: depends on what you mean by CMS though
16:50jro_thanks!
16:51jro_I wrote a social training blog app, which has gained small userspace, and thought that if there are some projectes, from which I could find some useful functionality
16:52vijaykiranjro_: cool - url ?
16:52jro_http://ontrail.net or http://www.github.com/jrosti/ontrail
16:54jro_(and, my friend wrote most of the clientside functionality)
16:55vijaykiranjro_: sorry, what language is the TODO in ? (Google translate thinks its german)
16:55jro_finnish :-|
16:57vijaykiranjro_: site looks nice - though I can't read finnish
16:58jro_thanks. I've been very happy with clojure as a backend language.
16:59vijaykiranjro_: where do you run it ? on your own server or "cloud" >
16:59jro_it is a small finnish iaas-cloud provider called upcloud.
17:00devinusis there a complex number library for clojure?
17:02magopianguys, is there a "better" (cleverer, other?) way of doing that? https://github.com/magopian/clojure-koans/commit/0b8a8889f4fcd125eb300830b1f2f087ed6cc7e9#L0R25
17:02magopian(context: it's the clojure-koans)
17:03magopian(do you say "guys" when you're also addressing gals?)
17:04technomancymagopian: I often open up with "greetings, humans" but then the bots feel left out. you really can't win.
17:06magopianhaha technomancy ;))
17:06vijaykirantry "hey gang"
17:06magopianhey, there :)
17:06magopiananyway, i'll just take my answer (in the github link) as the correct one (for now), and go to sleep
17:07magopiani'll see tomorrow if somebody told me that i was wrong ;) nighty night
17:07hiredmanfuture sentients are the worst, they are always so smug just because they live in a universe with higher entropy
17:18devinusanybody know of a complex number library for clojure? (imaginary numbers)
17:18dnolendevinus: haven't heard of anything
17:19jro_Apache Commons Math
17:19jro_it is rather good for basic math stuff
17:20devinusif it only supported clojures "numeric tower"
17:21jro_devinus? "numeric tower"?
17:22devinusjro_: it's what this library calls the way Clojure can handle different types : https://github.com/clojure/math.numeric-tower
17:25gfredericksI hacked up my own complex number stuff for clojurescript
17:30ayiatechnomancy: vijaykiran: so... reading further the "casting" tutorial... There is a function definition there: (defn have? [object] (some #{object} (inventory))). Inventory is a function that returns list of objects. object is supposed to be one of them, or not:). Question: How does it work? I read what (some pred coll) do... But can't understand how it works in this example...
17:31technomancyayia: are you familiar with the #{} syntax?
17:31ayiaI assume this is a set, no?
17:31technomancyright
17:31technomancyand you know what happens when you call a set as a function?
17:32gfredericksermahgerd we need a normal seq-contains? function :(
17:32ayiaups, got it... sorry)
17:32amalloygfredericks: be sure to make it subtly wrong in some way
17:33ayiatechnomancy: I have just tested in in the REPL... Now I see...
17:33gfredericksamalloy: if you call it with finger trees it evals something from the internet
17:34technomancyhah
17:34ayiatechnomancy: sorry... I tried to test this in REPL before asking, but made a mistake, called a set as a function but gave it a list of objects, not the object as parameter... Got weid error, and decided to ask here...
17:35gfrederickslet's start an underground core.incubator
17:35gfredericksit can have update and seq-contains? and exactly five more things
17:37hiredmanugh, those things are all yuck
17:38gfredericksthose two functions are yuck?
17:38the-kennySomeone should start beaming IRC sessions to random directions of the sky
17:38hiredmangfredericks: yes
17:38gfrederickshiredman: I am interested in why you think that
17:39hiredmangfredericks: because seqs are not sets, if you want to check for membership, use a set
17:39hiredmanif you want to filter, use filter
17:39gfrederickswhat if you have a seq? putting it in a set just for that seems silly
17:40hiredmangfredericks: then don't put it in a set just for that
17:40hiredman(use sets more often everywhere)
17:41gfredericksI am not a set hater
17:42technomancyyes you are gfredericks just admit it
17:42gfredericksI like the reasoning, I just think there are a lot of cases where seq-contains? would be useful and loading the seq into a set might be overkill
17:42gfrederickshiredman: how about (defn update [m k f & args] (apply update-in m [k] f args))?
17:42hiredmangfredericks: I think the arguement there cuts both ways "oh, it a small enough dataset to just do a linear search"
17:43hiredmangfredericks: use update-in
17:43gfredericks90% of my update-in uses have a single key
17:43hiredmangfredericks: and?
17:43gfredericksit is rather repetitive
17:46gfredericksclojure likes functions that are more general to support 10% more use cases
17:46arohneris anyone else having trouble requiring clj-time 0.4.4 on CLJ-1.5.0-RC16?
17:46amalloygfredericks: a problem with the update function is that its contract is not immediately obvious
17:46brehautis it possible to hook clj-time into java.jdbc so that time fields are translated from stupid java date objects and joda dates?
17:47amalloydoes it use the varargs to act like assoc, or like update-in?
17:47gfredericksbrehaut: I think we've been doing this
17:47gfredericksamalloy: update-in seems more expected to me
17:47gfredericksoh
17:47gfredericksI see why
17:48gfredericksbrehaut: we forked java.jdbc to have a read-result-set protocol so the java.sql types come out as joda
17:48gfredericksthere's a jira ticket for it but not much has happened
17:48brehautgfredericks: oh well. thanks anyways
17:49AtKaaZhi, how would you create a subclass of java.land.RuntimeException with the purpose of having a class with a different name (so without adding methods and stuff) ?
17:49technomancyAtKaaZ: ex-info
17:49technomancyit doesn't do what you are asking, but it does what you need =)
17:49Rayneslol
17:49AtKaaZok:)
17:50technomancy
17:50AtKaaZdojo?
17:50technomancyhttps://en.wikipedia.org/wiki/Mu_(negative)
17:50gfrederickswell you can't catch ExceptionInfo based on contents :/
17:51amalloygfredericks: sure you can, with slingshot
17:51gfredericksI looked at that today; it looked like it's still AOT?
17:51AtKaaZi'm using ccw, so aot = not working
17:51ibdknoxtechnomancy: thoughts on the rapgenius HN thing? It's getting a bit ridiculous heh
17:51AtKaaZelse I would've used gen-class I think
17:52hiredmangfredericks: I would be surprised if that is the case
17:53hiredmanhttps://github.com/scgilardi/slingshot/blob/master/project.clj
17:53amalloygfredericks: slingshot is? no, it uses ex-info if it's on clojure 1.4+
17:53technomancyibdknox: they're doing a good job of getting a lot of attention, but the way that they're doing so nearly drowns out the fact that there is a legitimate problem at the root.
17:53gfrederickswell I don't know how lein works then
17:54hiredmantechnomancy: rails?
17:54hiredman~rimshot
17:54clojurebotBadum, *tish*
17:54gfrederickshiredman: that's what I was thinking
17:54ibdknoxeh
17:54ibdknoxit has nothing to do with rails :p
17:54technomancyhiredman: heh... well yeah, the way they've framed it as "you hate rails" makes it seem pretty lolworthy
17:54gfrederickssingle-threaded servers?
17:54ibdknoxgfredericks: all servers
17:54ibdknoxdoesn't matter whether they're single threaded or not
17:55technomancybut the lack of a runtime-agnostic way to indicate loadedness back upstream to a load balancer is a real problem
17:55technomancynot a problem that's specific to Heroku at all; it's just more obvious at Heroku's scale
17:55ibdknoxtechnomancy: it seems like you could cheat
17:55ibdknoxyou control the flow in and out
17:55ibdknoxjust keep count
17:55technomancyibdknox: not across a cluster as large as our routing cluster
17:55ibdknoxdo a naively intelligent load-balancing scheme based on that
17:56ibdknoxtechnomancy: not sure I understand which part of that won't scale?
17:56technomancyanyway, I'm not supposed to talk about it; there'll be a blog post coming out about it soon
17:56ibdknoxmm
17:57p_ltechnomancy: fun fact - I stumbled upon rapgenius claims just after reading instructions on how the same change involved support for concurrency and how to use that with rails to get ~4 times the speed
17:57technomancyit's a really difficult problem; the way they framed it trivializes the hard parts while ignoring the demands of modern runtimes, but that doesn't mean it's not a problem
17:58technomancythe second image here is pretty telling: http://code.dblock.org/in-defense-of-heroku
17:58p_libdknox: afaik pre-cedar there was some kind of counting, but I'm not a heroku person :)
17:58ibdknoxp_l: well pre-cedar the problem was *much* simpler
17:59p_ltechnomancy: I prefer the post that someone put with description on how to use Unicorn with fork() workers to get I think even 8x ther request/s :>
17:59ibdknoxartificially limiting a server to one request isn't going to cut it these days though
17:59ibdknoxp_l: unicorn doesn't actually solve the problem though, it simply moves it to a higher scale factor
17:59brehautquestion. how does internet beef differ from grain feed or grass feed beef?
18:00ibdknoxbrehaut: it's not kosher.
18:00p_libdknox: yes, but it helps deal with low support for concurrency in certain too-magical frameworks
18:01AtKaaZwhere do I find ex-info usage examples? and why isn't there one here: http://clojuredocs.org/search?x=0&amp;y=0&amp;q=ex-info
18:02gfredericksAtKaaZ: the docstrings for ex-info and ex-data?
18:02gfredericksthey're not that complicated
18:02AtKaaZoh you may be right, I was using google so far
18:02gfredericksthe ExceptionInfo class lets you stuff a map into the exception
18:03thheller@AtKaaZ : (throw (ex-info "msg" {:some data}))
18:03gfredericksapparently slingshot is okay to use if you want to filter based on the data
18:03AtKaaZthheller: thanks, I was mostly wondering about the ex-data / catching
18:03AtKaaZgfredericks: I looked at it for ex-info in the tests, but found none
18:04thheller(catch ExceptionInfo e (do-with-ex-data (ex-data e))) :P
18:04hiredmanjust make sure to read the slingshot docs if you use it
18:04thhellerno idea about conditional catching
18:05austinh[core.logic] Is there a way to instruct run not to reify certain terms?
18:05AtKaaZthheller. thanks but where is ExceptionInfo
18:05AtKaaZhiredman: ok
18:05hiredmandon't ask run for them
18:06hiredmanaustinh: if you introduce new terms via fresh they will not be in the result
18:06hiredman(run [q a b c] ...) vs (run [q] (fresh [a b c] ...))
18:06austinhhiredman: And there is no way to inhibit that? It's the same if you introduce them with lvar.
18:06thheller@AtKaaZ: clojure.lang.ExceptionInfo
18:07hiredmanaustinh: inhibit what?
18:07hiredmanaustinh: if you don't ask for a value you don't get it
18:07austinhhiredman: the reification of certain terms, like a binder
18:08hiredmanaustinh: binder?
18:09austinhhiredman: nom/tie
18:09hiredmanaustinh: still doesn't mean anything to me
18:09AtKaaZactually slingshot does look like better
18:10austinhhiredman: A binder is a term introduce by tie, which is in the nominal library. But that doesn't matters, s/binder/lvar
18:10gfredericksaustinh: what is the problem you're observing?
18:11hiredmanaustinh: are you asking about how to limit the which logic vars are included in the result of run?
18:11austinhhiredman: no
18:11hiredmanah, ok, then I have no idea
18:13ravsteris there a way to use friend to do authorization dependant on params sent in the URL?
18:13austinhgfredericks: I'm not observing any problem. There are times when it makes sense to create a logic var outside of run (to be used later).
18:13austinhgfredericks: I'm asking if it is possible to write a logic program that returns an un-reified lvar.
18:14hiredmanaustinh: have you tried just calling clojure.core.logic/lvar ?
18:14ayiatechnomancy: vijaykiran: so... I have finished reading... Actually it did not clarified me all stuff... So... The tutorial says: put (defmacro defspel [& rest] `(defmacro ~@rest)) in your code and then you can (defspel walk [direction] `(walk-direction '~direction)). But why can't I just write like: (defmacro walk [direction] `(walk-direction '~direction)) ?
18:14hiredman(outside of run)
18:14hiredmanthat is the function that creates lvars
18:15technomancyayia: you can, and that's what people actually do in real life. the "spel" metaphor is a cute way he tries to work "magic" thematically into the tutorial.
18:16technomancyit's like an alias
18:16austinhhiredman: Yes, calling lvar doesn't make a difference.
18:16technomancybasically he is concerned that when people see the term "macro" they think "oh, I know how this works; it's like in C" and completely misunderstand what's going on, so he in engaged in his own Rectification of Names
18:16hiredmanaustinh: what are you trying to do with lvar outside of run?
18:17hiredmanunify it with the same value across different calls to run?
18:17hiredman(because the environment is doesn't exist out side of a call to run, so that is not going to work)
18:17ayiatechnomancy: hm... So - (defmacro defspel [& rest] `(defmacro ~@rest)) - just makes the "defspel" alias for "defmacro"...
18:17austinhhiredman: I'm not using lvar. I'm trying to create binders to use in a theorem prover.
18:18technomancyayia: basically, yes
18:19ayiatechnomancy: hm... so the guy tried to change the world, but finally he did not...
18:19austinhhiredman: If you look at the sudoku example here: https://github.com/clojure/core.logic/wiki/Examples there is a call to "repeatedly" generate lvars outside of a run expression.
18:19technomancyayia: well I don't know if he intended his terminology to be used outside a learning context. it may be that if you know C, that is a good way to avoid falling into a common trap.
18:19abpI'm reducing some code of my contribution to nothing. Can't stop.
18:20hiredmanaustinh: sure, which is sort of exactly what I thought I asked about, calling lvar, but you said that doesn't work?
18:20technomancybut yeah, it's a bit capricious.
18:20austinhhiredman: I'm asking if it is possible to replace that repeatedly expression with a call to run.
18:22hiredmanaustinh: I dunno, but I doubt it, and I have trouble seeing why you want that given that the environment (where lvars are constrained or bound) exists only inside run, and is not globally shared between calls to run
18:22hiredmanso if you got a lvar back, it would be just the same as the lvars created outside of run
18:23ayiaSo I hope, as a Lisper, you'll consider supporting this new term- Naturally, any new memes like this have a very low likelihood of success.
18:23ayiaIf you have a library or are a Lisp implementation author, please drop everything you are doing right now and add the following line to your library:
18:23ayia(defmacro defspel (&rest rest) `(defmacro ,@rest))
18:23ayiatechnomancy: that was an exceprt from the tutorial... seems like he really intended.... Here is the exceprt: ""
18:23technomancyayia: that's funny... I can't tell if he's joking or not.
18:24hiredmantechnomancy: on the internet the crazier it is the more likely it is to be serious
18:24technomancyhiredman: this is Conrad Barski though
18:25technomancydude spoke at the conj
18:25hiredmanserious бизнес
18:25technomancyI bet he'd like Racket though; Racket is all about defining new languages.
18:25hiredmantechnomancy: https://github.com/bbatsov/clojure-style-guide/issues/14
18:26hiredmanyep
18:27austinhhiredman: The alphaLeanTap implementation here: https://github.com/namin/leanTAP rewrites expressions to include binders. This occurs outside of a run. The expressions are fed to a theorem prover that uses run.
18:27technomancywell if anyone submits a pull request for that to clojure-mode you can assure it will be closed with extreme prejudice
18:27technomancycan be assured
18:27austinhhiredman: I was wondering if it is possible to rewrite the expression parser as a logic program (which means that it would have to produce un-reified binders).
18:29hiredmanaustinh: it looks like it builds them as clojure forms (not a core.logic thing) and passes them in to run
18:29technomancyhiredman: attempted to pre-emptively shoot it down; fingers crossed
18:29austinhhiredman: Yes. That is what it does.
18:29hiredmanjust from scanning the code there
18:30TimMcreiddraper: Meetup was cancelled?
18:31hiredmanaustinh: so if that is an example of what you want to do, why not just do what it does
18:31hiredman?
18:32austinhhiredman: I'm exploring my options.
18:35Frozenlocktechnomancy: I might make a pull request just for the trolling :)
18:36technomancyFrozenlock: a little drama helps keep things exciting
18:36FrozenlockHe could however make a clojure-hiccup mode; this is clearly what he was asking it for.
18:37technomancyFrozenlock: sure, if he wants to never get a pull request from someone not using clojure-hiccup mode =\
18:39devinusis there a way to import only a specific function?
18:41FrozenlockIn your namespace? (:require [some-other-ns :refer [fn-name]])
18:42devinusFrozenlock: it's a java function
18:42ivanJava has functions?
18:43devinusjava method
18:43devinus>.>
18:44Frozenlockdevinus: why 'just one'? I'm no expert, but shouldn't (import '(some.java.class)) do the job?
18:45devinusFrozenlock: sure, but then id have to use the namespace every time
18:45devinuse.g.
18:45devinusMath/sqrt
19:02FrozenlockIs there an ever smaller webrepl than tryclj?
19:02Frozenlock*even
19:04llasramdevinus: Old clojure-contrib had import-static, but it didn't make the 1.3+ move. You can pull it into your code if you really want it: https://github.com/clojure/clojure-contrib/blob/1.2.x/src/main/clojure/clojure/contrib/import_static.clj
19:04llasramBut there's a reason no one took ownership -- honestly isn't that big of a deal to just reference static methods as Class/method
19:16TimMcllasram: I did make org.baznex/imports
19:16llasramOh, cool
19:16TimMcbots can't spit
19:16llasramWell now I know, and can so-inform future questioners
19:17callenbotTimMc: way to blow my cover.
19:17Raynes$latest me.raynes/laser
19:17llasramcallenbot: Actually, why are you bot?
19:17lazybot[me.raynes/laser "0.1.22"] -- https://clojars.org/me.raynes/laser
19:17callenbotllasram: long story, very sad. Involves node.js and tales of horror.
19:17llasramOr rather, I think you're lying, and are not in fact a bot
19:17callenbotllasram: I am now a cyborg.
19:17llasramHmm. Well, that's plausible then
19:17callenbotI speak through my bot for technical reasons.
19:17callenbotmy normal nick (callen) is indisposed...
19:17callenbothrm yes, I need to implement that this weekend actually.
19:18llasramI need to go back properly group-id my libraries...
19:19TimMcllasram: Honestly, (.importClass *ns* 'P2D java.awt.geom.Point2D$Double) is better than pulling in org.baznex/imports just for #'rename.
19:20cljScrubClojure + GUI question: because of immutability concurrent programming is a far less tricky beast to tackle right? So how effective would it be to write the core of an app in Clojure and pass relevant data to a rendering engine for processing in real time? Would the transaction time be too large to allow smooth rendering? Is it better to keep these
19:20cljScrub two processes more closely coupled?
19:20llasramTimMc: Err. If I felt compelled to do that, I'd like *some* layer of abstraction separating me from implementation details
19:21hiredmanchanging names is not an abstraction
19:22TimMcllasram: Here's an actual example: (.importClass *ns* 'AddrType javax.mail.Message$RecipientType)
19:22llasramhiredman: I was referring to Namespace#importClass
19:22TimMcAnd then I can say AddrType/TO.
19:23llasramTimMc: Oh, I can totally see the draw. I just meant I'd rather use your library than depend on the implementation of the Clojure namespace class remaining unchanged :-)
19:23ravsterI'm using 'friend'. I've got the following identity stuff in my session. What is the best way to extract the ':id'?
19:23TimMcllasram: Then copy my implementation of #'rename and use that in the same file. :-P
19:23llasramHeh
19:23ravsterhttps://www.refheap.com/paste/11307
19:24callenbotravster: 1. Don't use friend
19:24llasram...
19:24callenbotravster: there is no step 2
19:25ravsterouch. Not a fan?
19:25amalloystep 0 is to ignore advice given by people who sound angry
19:25callenbotravster: listen to amalloy, but don't use friend either.
19:25callenbotravster: friend is a great idea if you're integrating with a complicated system
19:25callenbotravster: if you don't need to manage the complexity of a complicated system...don't use friend.
19:27callenbotravster: https://www.refheap.com/paste/11308
19:27abpcallenbot: It works pretty well in my apps. :P
19:27callenbotabp: I'm so glad you have that kind of free time.
19:29callenbotwhat technomancy said.
19:29technomancytwo functions and a compojure route: https://github.com/technomancy/syme/blob/master/src/syme/web.clj#L31
19:29technomancyof course, you can only get away with that if you're lucky, but if you can... man.
19:29callenbotmore to the point: https://github.com/technomancy/syme/commit/114a47a602e80427fda4e7de3ce57f407e6562dd
19:29ravsterwow. good stuff.
19:30callenbotravster: in my code...don't ask about put-context.
19:30callenbotravster: you...don't want to know.
19:30ravstercallenbot: lol
19:30callenbotravster: magic I wrote
19:30callenbotI needed RequestContext.
19:30callenbotRing didn't have it, so I made it.
19:30callenbotin like, 3 lines of code.
19:32weavejestercallenbot: RequestContext?
19:32abpcallenbot: request context is still the request map. :P
19:32ravsterwow. okay. so use friend if dealing with something that already exists? Else roll your own thing that satisfies your requirements?
19:32callenbotweavejester: https://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext
19:32callenbotravster: that's my opinion. It's a complexity trade-off.
19:33callenbotI prefer to refactor on-demand rather than building for more complexity than I actually need to handle.
19:33ravstercool
19:33callenbotravster: if you understand friend and can use it, cool - but you seemed to be having trouble.
19:33callenbotravster: it's worth implementing some auth middleware manually just so you understand Ring better anyway
19:34callenbotit's more valuable to understand Ring natively than it is some middleware.
19:34ravstermakes sense
19:34weavejestercallenbot: What's the purpose of RequestContext? It's hard to tell from the docs.
19:34callenbotweavejester: template context processors
19:34callenbotweavejester: GLOBULL DATA!
19:34callenbotweavejester: sie enemy, according to you :)
19:34callenbotravster: IME: Ring doesn't have any particularly good tutorials or documentation, so you have to implement middleware to really learn it.
19:35callenbotI think Vijay's tutorial might touch on it.
19:35callenbotsorta.
19:35technomancyI thought the ring spec was pretty thorough, if not particularly suited for an introduction.
19:35abpcallenbot: I wrote paging today using a middleware that takes paging information from the route and puts it into the request under :paging, while striping down the route. Routes that invoke paging views do (view (:paging request)) now.
19:35callenbottechnomancy: https://github.com/mmcgrana/ring/blob/master/SPEC really?
19:36callenbotabp: pagination?
19:36technomancycallenbot: hm; I guess it's been a while
19:36weavejestercallenbot: Ah, I see. Out of interest, what are you using it for? As in, what global data are your templates using?
19:36callenbottechnomancy: you know too much.
19:36abpcallenbot: An example for general information retrieval.
19:36callenbotweavejester: user, principally.
19:36callenbotI'm not going to manually kick around a user document all over the place. stupid.
19:37callenbotweavejester: http://codespatter.com/2008/12/22/django-requestcontext-example/
19:37weavejesterhttps://github.com/ring-clojure/ring/wiki/Concepts is perhaps a little more descriptive than the spec
19:37abpcallenbot: It's stupid to pass a map along and not extend it but instead make your own little atom store just for convinience. :P
19:37callenbotabp: don't diss my atom store damn you.
19:38abpcallenbot: I'll do till it dies.
19:38callenbotabp: it just merges the provided context on top of the template context anyway.
19:38callenboter, provided context overrides global
19:38ravsterthanks again callenbot, I'll be looking at those links you posted.
19:38weavejestercallenbot: I tended to use a *user* dynamic var for that, but I've been thinking about alternatives
19:38callenbotravster: I've got an example Clojure app I'm slapping together. You could use that or refheap to learn.
19:38callenbotweavejester: mine is better.
19:38callenbotweavejester: mine doesn't reify specific datapoints.
19:38callenbotweavejester: it's generally applicable and nice.
19:39weavejestercallenbot: Reify datapoints?
19:39Raynes$latest me.raynes/laser
19:39lazybot[me.raynes/laser "0.1.22"] -- https://clojars.org/me.raynes/laser
19:39callenbotweavejester: *user* is a reference to a single datapoint
19:40callenbotweavejester: things like that don't merit reification to being a top-level var.
19:40RaynesMaybe I can finish moving refheap to laser this weekend and up laser's version to 1.0.0.
19:40callenbotweavejester: just use an atom container of a map.
19:40callenbotRaynes: I look forward to it.
19:40callenbotRaynes: I'll update the benches tonight or tomorrow.
19:40RaynesUpdate them to what?
19:40callenbotRaynes: type-hint for laser.
19:40RaynesOh, with the type hinted benchmark I added?
19:40RaynesYeah, no big deal.
19:40RaynesI don't recall it being significant.
19:41callenbotI know but I feel bad :(
19:41RaynesI'm still surprised it's faster than enlive and happy that it is as such.
19:41technomancy(:require [me.raynes.laser :as pew.pew.pew])
19:41weavejestercallenbot: The advantage of using a dynamic var is that you explicitly declare what data you're going to make dynamic.
19:41Raynes(for the benchmarks, at least)
19:41weavejesterAnd you can't mutate it - only override it
19:41Raynestechnomancy: That's the spirit!
19:41callenbotweavejester: you do declare a dynamic var. the context.
19:41RaynesOh my God.
19:41RaynesI've missed such a grand opportunity!
19:41callenbotRaynes: yeah you messed up there.
19:41technomancyRaynes: there is still time
19:42Raynestechnomancy: I could have named 'document' and 'fragment' 'pew' and 'pewpew' respectively!
19:42RaynesIn all seriousness, I have an 'at' function that works on a single node. I should rename it to 'pew', just as a little easter egg.
19:42weavejestercallenbot: If I'm understanding correctly, you have an atom bound to a dynamic var that acts as a context for the life of the request
19:42callenbotweavejester: da comrade
19:43weavejestercallenbot: Like… (defn [handler] (fn [request] (binding [*context* (atom {})] (handler request))))
19:43callenbotweavejester: https://www.refheap.com/paste/11310
19:43callenbotweavejester: not quite.
19:43callenbotweavejester: it might be semantically incorrect but works for me.
19:44callenbotweavejester: https://github.com/bitemyapp/neubite/blob/master/src/neubite/middleware.clj please ignore the really dumb database queries. kthxbai.
19:45amalloycallenbot: isn't this totally un-threadsafe, whereas weavejester's code does the exact same thing but safely?
19:45weavejestercallenbot: Where's the (binding [g (atom {})] ) part?
19:45loliveirais there a numpy alike in clojure?
19:45weavejesterWhat amalloy said :)
19:47weavejesterIt's not thread safe. You want something more like: https://gist.github.com/weavejester/4957775
19:47weavejesterAlthough I'd personally avoid an atom in this case.
19:48callenbotweavejester: I figured it might not be. Thanks!
19:48weavejesterBut I see what you're doing
19:48callenbotweavejester: of course you do. It's simple.
19:49weavejesterI tend to prefer to keep data constrained, which is why I prefer a *user* over a more general context map
19:49weavejesterIf a function doesn't need a piece of data, ideally it shouldn't have access to it :)
19:49callenbotweavejester: every single view needs the data in g.
19:50weavejestercallenbot: But the only thing in g is the user? Or do you have more data?
19:55callenbotweavejester: user, superuser, staff.
19:56callenbotweavejester: it's simpler than complecting stuff concerned exclusively with security.
19:56callenbotweavejester: the g is a "nexus" designed to make it simpler to decomplect things like security from how users are stored, how templates are rendered from how users are auth'd, etc.
19:56callenbottoo many people rely on invasive dependencies in Clojure code to maintain statelessness. It's not worth it.
19:57weavejestercallenbot: To my mind it adds complexity
19:57callenbothardly.
19:57RaynesTo his mind.
19:57weavejesterWell, lets say you have 3 dynamic vars instead
19:57weavejesterThen you've isolated them from one another
19:57weavejesterPutting them together in a global map adds connections
19:57callenbotI can change how users are auth'd behind the scene and not worry how other functions or templates are made aware of users.
19:58weavejesterIt ties them together when perhaps they don't need to be.
19:58weavejesterBut you could do that with a *user* var as well
19:58callenbota one-stop-shop is simpler than littering the namespace with miscellaneous data.
19:58callenbotand it makes it more sensible to just merge the contexts for the templates.
19:58weavejesterNot in the sense of simple being a way of avoiding tangling things together
19:59callenbotI already said it helped avoid that.
19:59callenbotI've seen too much hiccup code calling directly into the database. absurd.
19:59weavejesterIsolated variables are "simpler" than variables combined into one data structure.
19:59callenbotI can't even fathom something @g would make more complicated for me, let alone what it already makes simpler.
20:00weavejesterIt might make things easier
20:01callenbotweavejester: you appear to value your religious aesthetic over sensible, maintainable, modifiable code.
20:01weavejesterNo, no, quite the opposite
20:02weavejesterI want things to be maintainable, and functions that are isolated are easier to reason able than functions that have more data
20:02weavejesterPure functions are amazing when you can have them
20:02weavejesterYou give it only the data it needs
20:03weavejesterAnd you get a return value with no side effects
20:03weavejesterThat's wonderful from a maintainabily and testability point of view
20:03callenbotoh please.
20:03callenbotyou talk as if there is going to be a swarm of race conditions or threads
20:04callenbotit's just a way to kick around a map without explicit dependence.
20:04weavejesterIf the map has a small number of keys, then I can't see it doing much harm
20:05weavejesterBut if it only has a small number of keys, why not make them explicit with vars?
20:05weavejesterAnd if it has a large number of keys, then each function is getting more data than it needs.
20:06callenbotweavejester: it's made my life a lot simpler, especially in auth/security.
20:06callenbotweavejester: you can pry it from my cold dead fingers.
20:06weavejesterHaha :)
20:06weavejesterI think it's made your life easier
20:06weavejesterI'm not certain about simpler, at least in the "rich hickey" sense
20:07callenbotweavejester: I know the distinction and you're wrong, in this case.
20:08callenbotweavejester: look at user and is_superuser
20:08weavejesterWhy? I mean, why is tying variables together in one map simpler than isolating them?
20:08callenbotweavejester: think carefully about the implications if I let is_superuser be defined in terms of user exclusively with a *user* var.
20:08callenbotweavejester: it complects the data dependencies.
20:08callenbotNot worth it.
20:09yediis anyone here using aws beanstalk for any clojure deployments? if so how's it going?
20:09weavejesteryedi: I have. I also need to update it at some point.
20:10yediweavejester: did you hit any major road bumps when setting it up for the first time?
20:11weavejestercallenbot: I'm not sure I follow. In the example you give, it seems like "superuser?" should be a predicate on a user.
20:12weavejestercallenbot: i.e. you'd have (superuser? user) to check if a particular user was a superuser
20:12callenbotweavejester: what if you need a superuser status that exists outside of the user subsystem?
20:12callenbotweavejester: one that isn't statefully or logically bound to the user data?
20:12weavejesteryedi: No, although the default environments for lein-beanstalk are a bit screwy.
20:13callenbotweavejester: do you use AWS a lot?
20:13callenbotweavejester: you seem to write a lot of stuff for it.
20:13weavejestercallenbot: So then you'd have a *superuser?* var, although I'm not sure I can see the purpose of that
20:14weavejestercallenbot: A fair bit, yep.
20:14callenbotwe agree to disagree. :)
20:14weavejesterSure :)
20:14technomancycallenbot: doesn't seem like your style
20:14callenbotweavejester: I'm not a fan of the performance I saw with the EC2 nodes, or much of anything else.
20:14callenbottechnomancy: seems so.
20:15weavejestercallenbot: The performance of EC2 nodes has never really been relevant to me
20:15weavejesterMost of the stuff I do is I/O bound or embarrassingly parallel
20:15callenbotweavejester: I prefer to reserve AWS for overflow/batch stuff.
20:15callenbotweavejester: dude, I/O is horrible on EC2.
20:15callenbotEBS is a travesty.
20:16weavejesterNetwork I/O, not disk I/O
20:16technomancymy uncle is a travesty https://github.com/technomancy/sokoban/blob/master/README.md
20:17callenbottechnomancy: heroku's infrastructure is open source?
20:17callenbothow did I miss this?
20:17technomancyeh; some is and some isn't?
20:17technomancyeverything I'm working on is either OSS or being replaced by OSS
20:17callenbotobviously your funky router queueing mechanism isn't
20:17abp`lol
20:17technomancyyeah, I don't have enough erlang chops to hack on that part
20:18technomancyit's a router, of course it's written in erlang =)
20:18callenbottechnomancy: my github score is increasing.
20:18callenbottechnomancy: I'll be caught up to isaacs within a month >:)
20:18brehauttechnomancy: surely node.js would give you better scalability
20:18callenbotbrehaut: because node.js is webscale and FAST
20:19technomancybrehaut: https://twitter.com/mongodbfacts/status/302181757174833153
20:19brehauttechnomancy: sorry im late to the jokes
20:19callenbottechnomancy: LOL
20:19callenbottechnomancy: the funny thing is, I use MongoDB :(
20:21callenbot"Using MongoDB is like getting a free ticket to a magic show. Where'd your data go?"
20:22RaynesI use and am happy I use mongodb.
20:22Raynes*shrug*
20:22Raynesrefheap doesn't mind it.
20:23callenbotRaynes: I use MongoDB happily too
20:23callenbotRaynes: that doesn't mean I don't know it's silly. :)
20:23RaynesI don't know that it's silly because I've never cared enough to learn why it's silly.
20:24RaynesI use it for a relatively simple open source website.
20:26callenbotsee, the fact you don't care and it "just works" is a lot of why it has grown popular.
20:27callenbotthere's no pilgrim's path to travel like with PGSQL
20:27Raynescallenbot: Well, I don't care for a specific reason.
20:27callenbotRaynes: oh?
20:27akhudekthere is a pilgrims path for PGSQL?
20:27callenbotakhudek: if you didn't already know how proper SQL databases worked, yes.
20:27akhudekah
20:27RaynesI don't care because the data isn't so important that whatever horrible things are wrong with mongodb. I have backups that would work just fine in a catastrophe.
20:28callenbotRaynes: to be fair, if you were that worried about catastrophe you wouldn't have used Heroku :)
20:28RaynesI don't know what you mean.
20:28callenbotRaynes: I'm making fun of Heroku :(
20:29RaynesOh. I think I'm okay with that these days.
20:29callenbotRaynes: they go down more regularly than a vegas escort.
20:29RaynesThey take my money, idle me after an hour of no activity, and then go down for 12 hours on two occasions.
20:29RaynesI'm happy to leave.
20:29Raynes:p
20:29callenbotthe spin up times with my clojure apps is really frustrating.
20:30callenbottechnomancy: you should rewrite the slug compiler in node.js so it goes faster.
20:31technomancytotes
20:32Raynestechnomancy should hook me up with Heroku sponsorship so I get a free SSL endpoint addon and maybe a second free dyno. He could get Heroku people using refheap internally.
20:33technomancythe frustrating thing is we can't do SSL properly (where properly here means "in a way where we don't go down when amazon's ELBs go down) without SNI, and uptake on SNI has been slow on the client side
20:34technomancyRaynes: I thought you had SSL covered by keming?
20:34RaynesFor a year, yes. But I don't want to have to hold another fundraiser and try to explain why I need money for something I can do for free, since amalloy currently pays for our vps.
20:35Raynescause <3 amalloy.
20:35RaynesSo it's really just "Meh. This is open source. Our Linode is super stable. I don't have to pay an extra $20 per month for SSL."
20:36RaynesBut I don't blame Heroku for having to pay for the SSL addon.
20:36RaynesI think I read that that cost is passed on to amazon or something.
20:36RaynesSo it comes with the territory, I suppose.
20:38technomancyyeah... I have high hopes for a better solution with SNI that wouldn't cost a bundle, but I'm not sure of the priorities on that
20:38technomancygiven that it would give some abysmal error message in older versions of IE or something
20:39Raynestechnomancy: Hah. IE.
20:39RaynesThey should provide it anyways then. Make it the "I don't give a fuck about IE" option.
20:42FrozenlockOk this is a long shot... I'm trying to implement a repl just like tryclj.com in my webserver. Everything seems to work, but the web REPL gives me this error every time I try to type something in it: "java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.Atom" So at least I can tell that the communication between the page and the jvm works, but nothing more... Does this error rings a bell to someone?
20:42FrozenlockLike I said: long shot.
20:47gfredericksFrozenlock: the only vars I know of that are unbound are *1 *2 *3 *e unquote unquote-splicing
20:48gfredericksFrozenlock: check wherever you call swap!?
20:48FrozenlockYes I do
20:49FrozenlockOhhhh
20:49FrozenlockI think I forgot to add the noir session middleware.
20:52FrozenlockWell, at least I progress: java.lang.NullPointerException :)
21:01gfredericksthe best kind of PointerException
21:17warzthe docs for -> say that it threads the value through the forms. does this literally mean using threads?
21:18Iceland_jackwarz: no
21:30eggheadwarz: it "threads" in the same way that "comp" threads
21:31warzok, i figured it was just the terminology used
21:31yediweavejester: i'm gonna push a clojure service to beanstalk, mind if i ping you if i get stuck somewhere?
21:31eggheadi.e. (dec (inc 3)) (-> 3 inc dec)
21:31warzso its just a different syntax, basically
21:31eggheadit's a macro, ya
21:32warzcool
21:32egghead&(-> 1 (* 10) (+ 3))
21:32lazybot⇒ 13
21:32warznow thats neat
21:33warzso hard to think about what macros to use and stuff, for me. haha.
21:33warzim sure time will help there
21:34Iceland_jackwarz: you can make use of macroexpand, it should clear it up
21:34pppaulyou aint seen nothing yet
21:35pppaul&(-> + (apply [1 2 3 4]) (->> (* 7))
21:35lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
21:35pppaulawww
21:35pppaul&(-> + (apply [1 2 3 4]) (->> (partial * 7))
21:35lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
21:36pppaul&(-> + (apply [1 2 3 4]) (->> (partial * 7)))
21:36lazybot⇒ #<core$partial$fn__4072 clojure.core$partial$fn__4072@3503e7>
21:36pppaulwell, i fucked that up
21:36abp`pppaul: partially
21:36warzive been programming in mostly c-like languages since like 1998, and i can admit that trying to learn clojure and sitting in here i basically feel like im reading a foreign language every day
21:37warzbut that makes me want to comprehend it all, haha
21:37abp`&(-> + (apply [1 2 3 4]) (->> (* 7)))
21:37lazybot⇒ 70
21:37egghead:)
21:37eggheadthreading fns through forms, aw ya
21:37abp`pppaul: But then the thread last isn't necessary at all
21:37warzmy goal is to make it through 1 day while understanding everything said in here
21:37pppaulwarz, (diff) (xml-seq) (file-seq) and zippers are pretty cool stuff too look into
21:38pppaulabp`i wasn't trying to write something that made sense
21:38eggheadzippers
21:38abp`pppaul: Yes but i thought getting results from useless code would be helpful. ;)
21:39eggheadpppaul: do you know of a good writeup on clj zippers, I've been trying to get a better understanding of them
21:39pppauli don't get results. i get paid
21:40abp`That's my current neatest threading usage in the code I'm working on: https://www.refheap.com/paste/11313
21:41abp`egghead: What do you want to do? Just learn about zippers?
21:41tmciverpppaul: you get paid to not get results?
21:41tmciver:)
21:42Iceland_jacktmciver: He doesn't make sense, he gets paid.
21:42abp`egghead: http://www.ibm.com/developerworks/library/j-treevisit/index.html?cmp=dw&amp;cpb=dwjav&amp;ct=dwnew&amp;cr=dwnen&amp;ccy=zz&amp;csr=092211 That's the best I know.
21:44eggheadthanks abp`
21:44pppauli'm a pro at getting paid
21:44pppauldon't know what the hell results are
21:44pppaulsounds like a variable name
21:44abp`pppaul: accumulator please. :P
21:45gfrederickswarz: I have a coworker who can't use the phrase "threading macro" because he associates it with multithreading so he calls it "stabby"
21:45pppaulahahaha
21:45pppaulit's a pipe
21:45abpHe, let me stab my forms throuhgh what I dislike.
21:45pppaulpipe macro
21:45pppaulthere are a bunch of thread macros, though… i was looking at as-> the other day
21:45pppaullooks interesting
21:46gfredericksbunch got added in 1.5
21:46gfredericksused to be just -> and ->>
21:46eggheaddid the nil short circuit one get added
21:46egghead-?> or w/e
21:46abpsome->
21:46pppauli didn't see it
21:46gfredericksthey're in core.incubator
21:46pppauli saw some-> didn't realize it was the same as -?>
21:46abpas well as as-> and let->
21:47gfrederickspppaul: it's not the same
21:47gfredericksoh maybe it is
21:48gfredericksnot sure how -?> handles false
21:48S11001001I believe it stops on nil only
21:48gfredericksman I don't know anything about anything
21:48pppaulfalse is sometimes useful
21:48abpoah written nonsense, some->, let-> and cond->
21:48pppaulnil means 'missing' a lot
21:48S11001001which makes it compatible with maybe-m defined in algo.monads
21:57AtKaaZhey, is there some way to prevent (ns ...) from implicitly doing a (:use clojure.core) ?
21:58AtKaaZor can I do a :refer-clojure with :except everything?
21:58AtKaaZI mean :exclude
21:59ChongLiyou're not going to have a very usable environment if you do that
22:00AtKaaZI'm thinking that I could include only what I need after doing that
22:01AtKaaZoh wait, I can do (in-ns 'newns) instead of (ns newns) ?
22:02AtKaaZand then (clojure.core/use 'clojure.core) if I want the old (ns...) behaviour back
22:02AtKaaZis there something else I would be missing?
22:03ChongLiI don't know, I've never tried it
22:04AtKaaZoki
22:04ChongLiwhy do you want to do this?
22:05AtKaaZto avoid some warnings/errors as per reported here: https://groups.google.com/d/msg/clojure/Yht7g3Hi6VI/GxZ2l4jirTcJ
22:06ChongLiwhy not just follow Raynes' advice and do require instead of use
22:06ChongLi?
22:06ChongLiit's not really a good habit to pull everything into one namespace
22:07ChongLinamespaces are a very good organizational tool
22:07AtKaaZbut then I have to qualify it
22:07ChongLiyou can make a short alias with :as
22:07AtKaaZso if I want to switch to clojure.core behavior i have to search/replace
22:08AtKaaZyes a one char alias I had in mind like o/
22:08ChongLiwhy do you want to switch behaviour back and forth? just for learning?
22:08AtKaaZthing is, it's easy to forget to qualify it and it will thus use the clojure.core one
22:09AtKaaZi guess just for the idea of it or something
22:09ChongLigenerally I don't think it's very common to want to exactly duplicate functions from clojure.core
22:09AtKaaZit's just too easy to fall back to using the "wrong" one that I don't want by forgetting to qualify, assuming I get many overridden eventually
22:10AtKaaZnot sure waht you mean by that
22:10ChongLiwhy not do this:
22:11ChongLi(require '[clojure.core :as c])
22:11AtKaaZdoes that work? trying...
22:11ChongLiyes
22:12bttfdoes leiningen 2.0 deal with :hooks differently now?
22:13ChongLiI'm not sure
22:13AtKaaZChongLi, where did you mean that I should put that? not in the (ns...) ?
22:13ChongLiif you put it in the ns form
22:13ChongLiit has to look like this
22:13ChongLi(:require [clojure.core :as c])
22:14AtKaaZtrue but, what does that do? other than add c/sorted? but also sorted? would work
22:14ChongLiright
22:14ChongLibut now you can switch between c/ and o/
22:14ChongLieasily
22:14bttfwell .. i've got src/leiningen/js.clj with (ns leiningen.js) ... in my project.clj i've got :hooks [leiningen.js] ... and it's complaining "unable to resolve leiningen.js/activate hook"
22:14AtKaaZtrue but I'm still getting the warn/errors :/
22:15bttfi'm thinking that its trying to access an 'activate' function but it seems thats not the case, after i renamed my js function to activate
22:15ChongLiAtKaaZ: that's because you're still doing :use
22:16ChongLibttf: I don't know, I've never written a leiningen hook
22:16ChongLihopefully someone who has will show up :)
22:16bttfok
22:16FrozenlockCompojure: Is there something to do to get query string into a route arguments?
22:16bttfi'm going to try using lein 1.7 in the meantime
22:17AtKaaZChongLi: you do have a point, but if I do require and :as I'm still stuck with sorted? and c/sorted? still working; or I don't understand what :use you meant (not the implicit refer 'clojure.core from ns)
22:17ChongLiAtKaaZ: I don't see why that's a problem
22:18ChongLiit's just not a common use case to blow away the clojure.core namespace
22:18ChongLisince you'd then have to bootstrap everything
22:18AtKaaZChongLi: that's why i have both sorted? from clojure.core and from my ns, which are causing the warning/errors in ccw
22:18AtKaaZChongLi: but I think I could just do with in-ns
22:19AtKaaZChongLi: there doesn't seem to be a clean way with (ns...)
22:19AtKaaZIf :refer-clojure is not used, a default (refer 'clojure) is used.
22:20abpFrozenlock: {q :query-string} or [a b :as {q :query-string}]
22:21ChongLiAtKaaZ: I still don't see the problem
22:21ChongLithose warnings are there for a good reason
22:21AtKaaZi agree, except currently they are breaking ccw but that will probably be fixed (in a month xD j/k)
22:22ChongLiyeah it sounds like a problem with ccw
22:22ChongLiI don't use it so I can't say
22:23AtKaaZChongLi: really thank you for your time on this! I appreciate it. I'll see what I can do with in-ns, it seems to be what I want, even though it's far from clojure idiomatic
22:23ChongLiAtKaaZ: if you like you can ns-unmap everything from clojure.core
22:23ChongLibut that'll give you a pretty useless environment
22:24AtKaaZhow?
22:24clojurebotwith style and grace
22:24AtKaaZlol
22:26ChongLijust use ns-unmap and ns-publics
22:27AtKaaZlike: (map #(ns-unmap 'clojure.core (first %)) (ns-publics 'clojure.core))
22:27ChongLins-publics returns a map
22:27ChongLiso you'll want (keys (ns-publics 'clojure.core))
22:28AtKaaZoh I should've specified my own namespace for ns-unmap xD
22:30AtKaaZok this: (clojure.core/map #(clojure.core/ns-unmap clojure.core/*ns* %) (clojure.core/keys (clojure.core/ns-publics 'clojure.core)))
22:32Frozenlockabp: thanks!
22:38AtKaaZChongLi: looks like ccw is loading clojure.core after done executing my file, because pasting that in repl works but in file doesn't and the warning is after the return value of the last thing in my file
22:39abpFrozenlock: That's because (GET "/" {{:keys [id]} :params :as request} ...) = (GET "/" [id :as request] ...)
22:40FrozenlockYeah, I was expecting the query paramaters to go into the arguments automagically.
22:40FrozenlockJust found out I needed a middleware for that.
22:42abpFrozenlock: what? xxx?a=1&b=2 = (GET "/xxx" [a b] ...)
22:42Frozenlocko_O
22:43Frozenlockdaphok
22:43FrozenlockI tried again and again...
22:43abpFrozenlock: https://github.com/weavejester/compojure/wiki/Destructuring-Syntax read point 2 at the top about destructuring
22:43abpit merges all the parameters
22:43abpinto params
22:43ChongLiAtKaaZ: yeah I don't know how to get around that
22:43ChongLiblame ccw
22:43AtKaaZi'll check with in-ns also
22:43abp:params rather
22:48AtKaaZChongLi: it works ok with in-ns but i lost ccw functionality ie. switching to the loaded namespace or specifically switching to it (Ctrl+Alt+N), oh well, time to stop
23:10sgarrettI'm trying to create a server using Ring/Compojure. I have several routes setup. Once I run `lein ring server` it opens a tab in my web browser and the correct response is shown, however when trying to make a call via javascript in the site that I'm building I get an error. Any ideas?
23:11abpsgarrett: On which side do you include the js? How do you include the js? How do you return resources from the server?
23:11abp*which site
23:11tmciversgarrett: try confirming the request and uri with the browser debugger.
23:12sgarrettI'm including the js on my index.html page at localhost:8000/. The responses from the ring server are rendering fine if I do something like localhost:8100/user or localhost:8100/user/id.
23:13sgarretttmciver: With the browser debugger I see the request going out, just no response. :S
23:13abpsgarrett: hm :8000 and :8100 look distinct
23:14sgarrettYep. I have the site running via nginx on port 8000 and specifically have the port for ring setup to 8100.
23:14abpok
23:14abpsgarett: and you can view the url you request from javascript from the browser?
23:15sgarrettI'm using jQuery .ajax() to make the call to the compojure server. Yep, the url is hitting localhost:8100/user
23:16abpsgarrett: Probably because that's cross-site scripting.
23:16warzyes, cant make ajax calls cross domains
23:16warzports count
23:16sgarrettAh damn.
23:16sgarrettOkay.
23:17sgarrettI guess I could use compojure to serve my site as well and skip nginx.
23:17warzif youre using nginx, its simple enough to put both of those behind the same uplink of whatever the term nginx uses is
23:17warzbeen awhile since ive used nginx
23:17sgarrettOkay. I'll see if I can find anything with compojure and nginx.
23:18warzupstream, thats it
23:18warzwell you can crteate multiple upstreams for both of your web services, and create some rules in nginx that if a request matches a route then use upstream A, otherwise use upstream B
23:19warzyou can also try jsonp
23:19warzor cors
23:19sgarrettwarz: I see. I'd still run the compojure server with `lein ring 8000` then right?
23:20warzsgarrett, yea and in your nginx config youd use that as an upstream
23:20warzlocalhost:8000, for example
23:20sgarrettwarz: Okay cool. I think that will be simple enough.
23:20sgarrettThanks for the help. :)
23:21warzits using nginx for what its good at, which is request proxying
23:24sgarrettwarz: this is what you're talking about right: http://stackoverflow.com/a/5877989/1183294
23:26warzyup
23:26warzif you see there, he specifies several upstream sources
23:26warzand in the locations, he proxies to one of the servers
23:26warzbased on route
23:27sgarrettwarz: Yep, which is nice. Didn't think about doing load balancing with it.
23:27warzso for yours, you could proxy anything matching /api to your ring server
23:27warzyaaa i wouldnt classify it as true load balancing
23:28warzbut at work we have 2 production systems using that setup
23:28sgarrettwarz: Gotcha. This will definitely work for now. Thanks again!
23:36warzhm, ring-json's wrap-json-response middleware doesnt seem to be working with compojure for me. im most likely doing it wrong.
23:36warzit just returns text/plain with no data