#clojure logs

2013-11-01

00:08amalloygfredericks: this isn't #clojure-confessions
00:08amalloykeep your filthy habits to yourself
00:09gfredericksthis is #clojure-confessions
00:09gfrederickseverybody confess something
00:10muhooforgive me rich, for i have mutated state
00:10Bronsalol
00:10muhooit's been 30ms since my last compile
00:11brehauti dont write tests if i can help it
00:11amalloyi'm proud of my complex functions
00:11brehauti like types
00:12amalloyyesterday i created a deftype instead of a vector, to hold a two-tuple, because i have an unrelated function that treats vectors specially
00:12muhoowow, i guess i'm the only one who survived catholic school. you guys are going all #dirtylittlesecrets instead
00:13technomancyI, um, actually enjoy elisp even though it's gross.
00:13muhoohahaha
00:14muhooy'all know this channel is logged, right?
00:14brehauthaha
00:14gfrederickss/this channel/life/
00:14muhooas for complex functions, i'm not sure that's a confession. ever looked at rich's code for codeq?
00:15muhoosome of those lets are longer than the longest functions i've written
00:15TimMcI... I write swearjure.
00:15muhooi have to woner how the hell you debug stuff like that, all that stuff buried inside a let where you can't test it
00:15gfredericksI've written (defn update [m k f & args] (apply update-in m [k] f args)) at least ten times
00:16amalloyhaha
00:16amalloygfredericks: that's one of ninjudd's favorite functions in useful
00:16brehautmuhoo: the secret is not writing bugs to start with
00:16gfredericksamalloy: yeah the confession is mostly about not using a utility lib instead
00:16muhoobrehaut: right, like linus explaining why he never uses a debugger. because he has no bugs.
00:16brehautexactly
00:17TimMcgfredericks: A short-hand for a single key update-in?
00:17gfredericksTimMc: yeah
00:17muhooit's so annoying to forget that [] around the k
00:17muhooyou get a lovely "cannot be cast to ISeq" or similar explosion
00:17gfrederickssometimes I :refer :all in production code
00:18gfredericksbut only for honeysql
00:18muhoogfredericks: wow, that's dirty
00:18muhoowhoops, if it's #confessions i suppose i shouldn't judge
00:18muhoomy bad
00:20muhooi guess my confession is: i suck at maths and have no fundamental understanding of what a factorial is or why it is "hello world" in every good language
00:20brehautmuhoo: hello world is the smallest program you can write that ensures you are invoking the compiler correctly and that you have an action occuring
00:21brehaut+, +!
00:24analognoiseIt's an invocation to the programming gods that the most basic components are playing correctly
00:24analognoiseA point where you should check you can get to before you do anything else
00:25analognoiseThe factorial is a function defined recursively, however more importatly it has a closed form solution that most people don't think about
00:25gfredericksI just copy-pasted
00:25analognoiseIt's closed form solution is the gamma function + or - 1, iirc
00:25abaranoskyflatten really does suck
00:26gfredericksflatten is the java.util.Date of clojure
00:26amalloyhaha
00:26brehauti have (def flatten (partial mapcat identity)) in my user.clj
00:26amalloywell, except nobody is putting a gun to your head and making you use flatten. unlike Date
00:27gfredericksamalloy: weirdest muggers ever
00:41muhoohmm, bishop and liberator seem to have nearly identical api's and functionality. why would i use one vs the other?
01:36jergasonsuper noob question about maps: what is the difference between (get map :name) and (:name map)?
01:39holojergason, one difference: the second is smaller
01:51`cbpbitemyapp: hi
01:52`cbpbitemyapp: queries are like 90% tested now, still a couple weird cases. But now we're basically only waiting for your connection magic :-) + some cleanup on my part
01:54ltwjergason: (map :name) too
01:54jergasonltw: whoa neato
01:55ltwjergason: although I feel like someone showed me an edgecase for that one
01:56andyfingerhutltw: Perhaps that if key :name is mapped to value nil, it will return nil, the same as if :name was not a key in the map?
01:57ltw,(:foo {:a 1 :b 2})
01:57clojurebotnil
01:57ltw,({:a 1 :b 2} :foo)
01:57clojurebotnil
01:58ltwthat's the same in (get {:a 1 :b 2} :foo) as well
01:59ltwthere must be a paranoid accessor for maps?
01:59Apage43You can specify a default
01:59Apage43,(:foo {:foo nil :a 1} ::actually-missing)
01:59clojurebotnil
02:00Apage43,(:bar {:foo nil :a 1} ::actually-missing)
02:00clojurebot:sandbox/actually-missing
02:02ltwApage43: still, is there nothing that errors by default?
02:04Apage43something like (defn get-or-die [in key] (let [sentinel (Object.) result (get in key sentinel)] (if (not= result sentinel) result (throw (ex-info "Key not found!" {:in in :key key})))))
02:06Apage43(but in general no, you're either using clojure's ILookup or the java.util.Map interface, which specify that null/nil is returned for not found)
02:13technomancygfredericks: almost spewed drink over "weirdest muggers ever" thanks
02:29RaynesAnd in heaven, an angel dies and his bones fall to earth and become sadness and pain among a civilization.
02:30RaynesAll because andyfingerhut used alter-var-root on a clojure.core function.
02:30andyfingerhutI'd kill a puppy for this feature.
02:30andyfingerhutI'm a little surprised more libraries don't do this.
02:32RaynesI'm going to send you to a base in Antarctica with no internet access if you keep talkin' like dis, man.
02:33andyfingerhutOK, I wouldn't kill a puppy for real for this, but why complain about changes to core that you personally like not getting in if you don't have to wait, and don't even have to build your own modified clojure.core to do it?
02:33andyfingerhutI realize that it could cause infinite pain and frustration if misused, but still.
02:35RaynesOh Andy, if you give them this power, I fear they will use it to destroy us! Be careful what you wish for, my friend, I plead!
02:36andyfingerhut:-) It's already been given. I just didn't see it before.
02:36RaynesKnowledge is power.
02:38andyfingerhutOr on a less havoc-causing level, it would be easy for someone to release a library that replaces all core doc strings with others, no changes to core required.
02:51amalloyandyfingerhut: isn't that basically what ambrosebs did by releasing some kind of project that adds type information to the functions in core.clj?
02:53andyfingerhutIf you mean core.typed, my understanding (hearsay only) is that it is a lint-like tool, with no effect during runtime.
02:55andyfingerhutI just grep'd through all contrib libraries, and the only ones I see that use alter-var-root are core.contracts, java.data, tools.namespace, tools.nrepl, and of course tools.trace for implementing its main feature
03:18mercwithamouthcan someone tell me how to turn on vim keybindings in light table? i'm not seeing it in the docs
03:19mercwithamouthor is it just the basics...saving/quitting?
03:36JardaIf I have a function that takes two parameters, like (def foo [item, options] ...)
03:37Jardaand I'd like to pass that to map
03:37Jardashould I do (map (fn [itm] (foo itm opts)) col) ?
03:37Jardaor is there a better way
03:39andyfingerhutJarda: There are almost certainly other ways, but that is clear and correct.
03:40andyfingerhutYou could shorten it slightly to (map #(foo % opts) col) if you wish
09:26silasdavismdrogalis, does he ever appear on here?
09:26silasdavisI was thinking I could have a go...
09:27silasdavispresumably it would just be a case of sucking the docstrings out of 1.5 in the first instance...
09:27mdrogalisI haven't see him. He's responsive on Twitter though.
09:27mdrogalisAnd the examples.
09:27teslanickSo maybe there's a right way to do this that's not super-imperative: I have a vector of digits, and I want to create from it a new vector in a particular way. So maybe I want to move index 0 to 4 and 4 to 5 and 5 to 12.
09:28mpenetmdrogalis: he is antares or antares_ on freenode I think
09:28teslanickI was thinking about creating a mapping object and a function that does the transformation. But it seems like that might already exist somewhere
09:28silasdavisso updating those where necessary and copying them to the the 1.5 entries?
09:29silasdavisyeoj___, not sure what you mean by a lazy replacement for doall...
09:30mdrogalismpenet: Ah, did not know that.
09:30jkkramersilasdavis: mdrogalis: babilen: https://github.com/clojuredocs/web
09:31mdrogalisjkkramer: That'
09:31mdrogalis's the one.
09:32silasdavisah hah
09:32jkkramerlooks like most of the hard part is done, just the boring web and UI work :)
09:32silasdavisperhaps I can make myself useful then
09:33silasdavisrather than just being a giant answer spunge
09:35yeoj___silasdavis: i did it with for... basically i wasn't interested in side-effects but wanted to eval a sequence (a jdbc resultset) lazily
09:35yeoj___silasdavis: i think it worked. i'm going to run it on a million rows and see if my laptop catches fire again.
09:56tbaldridgeI'm going to assume I'm missing something here. Why on earth was emacs nrepl renamed to cider?
09:56mdrogalistbaldridge: I just started wondering that last week.
09:57mdrogalisI was told to differentiate between nrepl and nrepl.el
09:57babilenmdrogalis: Yes, based on the assumption that the Clojure community at large is more likely to work/support a clojure/clojurescript project than a Ruby one. (nothing else really and no prerequisite at all)
09:57babilenjkkramer: Ah, thanks :)
09:58tbaldridgeI'm going to assume I'm missing something here. Why on earth was emacs nrepl renamed to cider?
09:58tbaldridgebleh, accident repost.
09:58mdrogalistbaldridge is broken D: Someone reset it.
10:35squidzdoes anybody know why dommy doesn't recognize the 'onChange' event. Am I missing something? Or is there a way to create the event if it isn't provided? I don't know enough about javascript to figure it out
10:37dnolensquidz: gist please
10:37dnolensquidz: if you adding it via JS event listener handler fn the event is "change"
10:42silasdavisis (lazy-cat (rest coll) [(first coll)]) any different to (concat (rest coll) [(first coll)])?
10:43squidzdnolen: https://www.refheap.com/20363 here a simplified version
10:46cemerickdnolen: it occurs to me that you probably have github notifications off; looking for info @ https://github.com/clojure/clojurescript/commit/b261447e598dd9463ace406337c9f2d1a02bb799#commitcomment-4487530
10:48dnolensquidz: sanity check w/ (.addEventListener el "change" (fn [e] (. js/console (log e))))
10:48dnolencemerick: I get notifications, commented
10:51cemerickdnolen: thanks, sorry for the noise
10:52squidzdnolen: hmm that seems to do nothing either
10:52cYmenHi guys
10:53squidzI used (.addEventListener (sel1 "#power-to") "change" (fn [e] (. js/console (log e))))
10:56cYmenI have a LAMP server, how easy is it to replace php with clojure?
10:57mdrogaliscYmen: Depends on your situation. I do it here. It's not fun.
10:58squidzdnolen: okay using a different target element seems to work, so I suppose something is up with the input element that I was trying to use
10:58squidzthe input is a jqueryUI datepicker so that may have something to do with it
10:59cYmenmdrogalis: Damn, then I won't do it.
10:59cYmenHow about using ring-clojure and compojure or something like that?
10:59cYmenAs long as it is reasonably stable and secure I don't mind not going through apache.
11:02silasdavisam I right to think there is no bounds to the memory used by a memoized function?
11:03squidzdnolen: clicking on the input brings up a visual datpicker. After clicking on that datepicker the input is changed, so I suppose I may be using the wrong listener type.
11:03CookedGryphonsilasdavis: use core.memoize
11:03silasdavisobviously it is bounded by some function of the number of possibly inputs
11:04squidzdnolen: yes, blur seems to do the trick
11:04silasdavisCookedGryphon, that's one I'm asking about yep
11:04CookedGryphonsilasdavis: you can pick your cache type (fifo, lu, ttl, etc) and how big
11:04jkkramercYmen: i've worked on projects that house php and clojure on the same domain, using stuff like apache proxypass
11:04CookedGryphonsilasdavis: not clojure.core/memoize, but org.clojure/core.memoize
11:04silasdavisCookedGryphon, oh...
11:04cYmenjkkramer: and your experience with that was...?
11:04CookedGryphonseparate library, more comprehensive memoization based on core.cache
11:05silasdavisah nice thanks
11:05jkkramercYmen: worked reasonably well
11:06jkkramercYmen: with shared site style, it's pretty transparent to end users
11:06cYmenthanks
11:36akrajan/set irc.look.smart_filter on
11:36morattiquit
11:43seangrove dnolen: I'm not sure where the analyzer.clj placeholder tests are in the clojurescript repo, any pointers so I can write tests that verify the default-warning-handler behavior?
11:44seangrovednolen: Ah, or do you mean the comment block at the bottom of all of the files? :)
12:03l4uwhat's nice about the prefix notation in clojure/lisp? when compared to a pipeline operator
12:04l4uor -> in clojure
12:12justin_smithl4u: prefix is easy to work with in automated ways
12:12silasdaviswhere does sine and cosine live currently?
12:12justin_smith,(Math/cos 1.0)
12:12clojurebot0.5403023058681398
12:13justin_smith,(Math/sin 1.0)
12:13clojurebot0.8414709848078965
12:13l4ujustin_smith what do you mean by automated ways? any examples?
12:13justin_smithl4u: macros, for example
12:13dnolenseangrov1: tset/clj/cljs/
12:13dnolenseangrov1: oops, test/clj/cljs/
12:13justin_smith-> would have been harder to implement without prefix notation
12:14seangrovednolen: I think undeclared var warnings is turned off by default, isn't it? https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/analyzer.clj#L33
12:15dnolenseangrov1: it probably not be, vestige of the early days
12:15dnolenprobably should not be
12:16justin_smithl4u: also, if you look at a compiler's internal representation for the code (the form it takes before optimization and assembly / bytecode output) pretty much any compiler produces somthing very much like lisp prefix notation (what they call a parse tree), by having a syntax that is closer to that format, programmatic access to the code structure is simpler
12:16l4ujustin_smith sometimes when I write an expression, i tend to rewrite it with -> operator. because it looks more like unix pipes. is it common or weird?
12:16seangrovednolen: Just wondering why it warns in script/repljs. If I set `:undeclared-var true` in my patch I get a ton of errors, and then it works: https://www.refheap.com/20364
12:17seangroveMaybe something about loading core.cljs?
12:17justin_smithl4u: beyond 3 nested calls I like to either make things into intermediate let values (if they deserve names) or break them out to a -> call
12:17justin_smiththat is normal
12:17seangroveI'll track it down, just trying to understand existing behavior
12:18seangroveAh, :warn-on-undeclared in script/repljs
12:18l4ujustin_smith ok maybe I should look into let usages thanks
12:21cemerickdnolen: is ana/namespaces intended to be read-only from macros, or is it a free-for-all?
12:22dnolencemerick: ana/namespaces is meant to be used by macros, tools, etc.
12:23dnolencemerick: we could design an api but I really don't see the point
12:24cemerickdnolen: yeah, I get that. I'm backing the compiler env into it, and just want to know if it needs to support writes (swap!) or just reads (@).
12:24cemerickI can do both, but the latter is far simpler.
12:25dnolencemerick: I can't see any value in writing to it.
12:25cemerickdnolen: that's what I figured as well; we can start with that
12:26cemerickFWIW, only macros should find ana/namespaces useful. External tools will likely have the compiler-env in hand already, and can/should just look there for namespaces information.
12:27cemerickTools that don't do this will end up getting the same race conditions that the compiler suffers from right now.
12:28dnolencemerick: yep
12:46vpak
12:46vpak.n
12:49vpakhelp
12:49vpakops sorry just trying to learn irssi
12:50TimMcvpak: Commands are prefixed with a "/", such as /quit and /join.
12:50vpak:) thanks
12:50rasmusto., .n, a call for help
12:51vpak.n
12:51vpak./
12:51vpak.,
12:51TimMcUm...
12:51rasmusto /join #devnull
12:51TEttingertake out the space
12:52dnolenthis probably only of interesting to people writing extremely perf sensitive JS, but I'm thinking about adding implements?, it is like satisfies? but it doesn't bother with the slow check for natives.
12:52dnolens/JS/CLJS
12:53mercwithamouthhow would one go about...populating or creating a key/map from a list of items?
12:53rasmustomercwithamouth: what's the list look like?
12:54TEttinger,(doc into)
12:54clojurebot"([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined."
12:54TEttinger(into {} '(:a 1 :b 2 :c 17))
12:54TEttinger##(into {} '(:a 1 :b 2 :c 17))
12:54lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
12:54TEttingeruhhh
12:55rasmusto,(into {} (partition 2 '(:a 1 :b 2 :c 3)))
12:55clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry>
12:55rasmusto,(apply into {} (partition 2 '(:a 1 :b 2 :c 3)))
12:55clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (4) passed to: core$into>
12:55rasmustobrb, coffee
12:55TEttinger##(into {} (vec '(:a 1 :b 2 :c 17)))
12:55lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
12:56mercwithamouthrasmusto: just general
12:56rasmusto,(into {} [[:a 1] [:b 2]])
12:56clojurebot{:a 1, :b 2}
12:56mercwithamouthTEttinger: hmmm
12:57mercwithamouthinto.
12:58mercwithamouthok i'm going to play with that for today...
13:00dobry-denWhat does it mean when this launches when you :require/:import a library? https://dl.dropboxusercontent.com/spa/quq37nq1583x0lf/8oy9dnb-.png
13:00dobry-den(a java app)
13:01dobry-denSometimes I get a few of them over the course of a work session
13:01muhoodobry-den: maybe that whomever wrote the library screwed up?
13:01muhoodobry-den: or something is weird in your setup maybe
13:02Raynesmuhoo's first suggestion, but not quite as mean.
13:02dobry-denit seems to happen with libs that provide a function that pop up a jpanel. like lamina.viz
13:02RaynesIf you for some reason load javax swing stuff, that happens.
13:03dobry-denthat's it
13:03RaynesOnly way to make it not happen is to not load swing stuff or use -Djava.awt.headless=true
13:04TEttingermercwithamouth, herp derp I'm not very good yet
13:04TEttinger##(apply hash-map '(:a 1 :b 2))
13:04lazybot⇒ {:a 1, :b 2}
13:05muhooRaynes: i say that because recently i stupidly forgot to wrap (fn []) around something and the body was exec'ing at compile time. took me a while to figure out what was going on.
13:05Raynes:p
13:05dobry-denRaynes: i imagine that headless also prevents the graphics from showing up
13:05Raynesdobry-den: I don't think that is true.
13:05RaynesBut I could be wrong.
13:05dobry-deni'll try it out
13:05RaynesI'm interested in knowing the answer, so do let me know please. :)
13:06dobry-denalso, it seems i usually have to run funcs that call swing stuff from a repl outside emacs
13:06muhoothere's crap you can do with DISPLAY=:0.0 etc
13:07muhoofun X tricks: getting GUI windows to show up anywhere you want, even on other machines over ssh, etc.
13:08dobry-denlost me at X
13:08muhooXwindows
13:08dobry-dener, fun X
13:09spacefugitivehai! Is this a place for noob clojure questions ?
13:09dobry-denyeh
13:10muhoodobry-den: if you don't have to dive deep into xwindows, you can consider yourself lucky. then again if you don't have to deal with swing in java, you can probably consider yourself just as lucky.
13:12spacefugitive@dobry-den was for me ?
13:12dobry-denspacefugitive: yeah just ask m8
13:12llasramspacefugitive: Also, no need to @-prefix people's nicks. IRC convention is to just mention people by bare name
13:12TimMcmuhoo: I <3 X-forwarding.
13:12spacefugitiveok thanks :)
13:13spacefugitiveIm trying to run my first clojure program and spec
13:14dobry-denmuhoo: i never used swing but id like to play with seesaw. unfortunately the last time i tried, iirc it couldnt even require into clojure 1.5.x
13:14spacefugitiveI am trying to return a hash from a fcn and bind it to a let variable
13:14spacefugitive(defn init-rover
13:14spacefugitive [planet]
13:14spacefugitive ([{:x 0 :y 0 :heading "N"}])
13:14spacefugitive)
13:14dobry-denspacefugitive: if you have some code related to the problem, you can throw it up on refheap.com
13:15dobry-den([{}])
13:16TimMcspacefugitive: Let me guess, that throws an arity exception?
13:16spacefugitiveyeah
13:16TimMc([...]) says "call this vector as a function with zero arguments"
13:16rasmustospacefugitive: it looks like you wrap a map in a vector and then try to call it (without any arguments)
13:16TimMc(x y z) almost always means call x with arguments y and z
13:17TimMc[x y z] is the vector of x, y, and z
13:17TimMcSo you just want {:x 0 :y 0 :heading "N"} on that line.
13:17spacefugitiveokay. I kinda want to kind it to a local let vairable ?
13:18dobry-denwithin the function?
13:18spacefugitivewithin the spec
13:18spacefugitivehttps://www.refheap.com/20368
13:19TimMcOh, you want the rover to be a map within a vector?
13:19TimMcJust drop that one set of parentheses, then.
13:20jared314why are you making it a vector, then destructuring it back into a value?
13:21dobry-denmaybe it's a budding CES engine
13:21spacefugitiveokay - thanks!
13:22spacefugitivejared314 : Thats something I tried to change when I was returning a fucntion that returns a map. I thought it work work somehow.
13:23jared314spacefugitive: ah, ok
13:31dnolenif anybody wants to get their hands dirty with some impactful CLJS optimizations around protocols I added a bunch of enhancement tickets http://dev.clojure.org/jira/browse/CLJS
13:31xeqicemerick: would you be interested in some PRs to piggieback / austin that will send javascript w/ inline sourcemaps for the repl?
13:33cemerickxeqi: you know I would be :-)
13:33cemerickI don't use source maps, but I might if they "just worked".
13:34cemerickxeqi: would you actually need to touch piggieback? It should be pretty darn porous. FWIW, if there's a barrier in there w.r.t. configuring compilation/analysis/etc, I'd much rather eliminate them entirely rather than poking holes for source maps.
13:35dondanin00b question: why is 'pr-str' called like that instead of 'pr-string'? the corresponding read function is called 'read-string' after all, right?
13:35TimMcI don't think there's a good reason.
13:36jared314I would add why is str not called string
13:36nooniannaming things is hard
13:36teslanickThat and cache invalidation
13:36noonianexactly
13:36jared314and what about string? and not str?
13:37edoloughlinDoes anyone using emacs know how I get the nrepl-server buffer window to scroll automatically with my log output?
13:37TimMcOh, and concurr -- not to mention off-by-one errors -- ency!
13:38xeqicemerick: hmm, I need to pass in a replacement for cljs-eval. It looks like I can do that through (cljs-repl ...), though thats in my server.clj stuff. I'll clean it up and see what happens
13:39cemerickTimMc: well done
13:39cemerickxeqi: wow, surprised it requires so much?
13:39teslanickTimMc: I had a problem and thought to use threads. has Now I problems. two.
13:40TimMc:-)
13:42cmiles74I have quick clojure.async question: Is it reasonable to want to call dosync to, say, update a ref from inside a call to go? For instance, update a value if a particular message shows up.
13:43xeqicemerick: well, my current version replaces cljs.repl/evaluate-form in order to generate a source map as part of emit and then append it on whats sent to the browser. I was hoping to pull it up into one of the others since I'm not sure it belongs there
13:44stuartsierracmiles74: Just FYI, "dosync" has nothing to do with "asnyc", despite the name.
13:44stuartsierraAnd yes, you can use `dosync` to modify a Ref inside a `go` block.
13:45xeqithough then it would require implementing something similar for other repls.. hmm
13:45cmiles74stuartsierra: Thank you. :-) Perhaps something else is happening, I'm getting a weird exception when compiling: "No such var: clojure.core/runInTransaction". I was wondering if it was just disallowed. Maybe I have an old version of the library.
13:46stuartsierracmiles74: Don't know what that is. Maybe a bug in the implementation of the `go` macro, which is complicated.
13:47cmiles74stuartsierra: I bet it is!
13:47stuartsierraOne thing I expect you can't do is use any non-blocking core.async operations like <! >! alt! inside a `dosync`.
13:49cmiles74stuartsierra: That makes sense. I'm loading an index with data and, when complete, I want to swap out the pointer to the old index with the new... It looks like this bug was, literally, fixed yesterday. http://dev.clojure.org/jira/browse/ASYNC-24
13:49mlb-How can I redirect pprint output to a file? Further, how can I format my timbre log output with pprint?
13:49rasmusto,(with-out-str (prn "foo"))
13:49clojurebot"\"foo\"\n"
13:50jared314rebind *out*
13:51jcromartiemore specifically, rebind *out* to a Writer that writes to your file
13:51rasmustomlb-: don't know about the second part
13:51mlb-jcromartie: ah, I see, cool. Thanks
13:51jcromartielike (with-open [w (clojure.java.io/writer "file.clj")] (binding [*out* w] (pprint whatever)))
13:51stuartsierramlb-: Be aware, pprint is very slow compared to regular print. May have an impact on logging.
13:52mlb-stuartsierra: No doubt, but I'd find it useful with timbre's "spy"
13:52stuartsierrasure
13:57justin_smithdoes partial force the creation of new anonymous functions at runtime? that is to say, is it a performance hit compared to a proper anonymous function if you know how many args are going to come in?
14:00cYmenWhy is (= 3) => true? Shouldn't that be an error?
14:01patchworkcYmen: it is equal to itself
14:01patchworkYou can pass any number of args into =
14:01patchworkand it checks the equality of all of them
14:01patchworkSame with < and >
14:02fizruk,(=)
14:02clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ->
14:02patchworkSo if you have one arg, it is trivially equal to itself
14:02patchwork,(= 3 3 3 3 3)
14:02clojurebottrue
14:02patchwork,(3 3 3 3 3 3 3 4)
14:02clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
14:02patchwork,(= 3 3 3 3 3 3 4)
14:02clojurebotfalse
14:03cYmenThat sounds like an excuse. :) Equality is just not a unary relation.
14:03tbaldridge,(reduce = [3]) ; would be nasty if this didn't work
14:03clojurebot3
14:03cYmentbaldridge: True...
14:03amalloytbaldridge: well, more like (apply = [3])
14:04amalloyreduce doesn't make any sense for =
14:04cYmen,(apply = [])
14:04clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$-EQ->
14:04cYmenThen again...
14:04patchworkcYmen: You are expecting strict mathematical equality
14:04tbaldridgeamalloy: yeah, you're right
14:04patchworkclojure has practical equality : )
14:05patchworkIt works for any value, not just numbers
14:05cYmenI don't know... I consider both (=) and (= 3) to be the same kind of error and would have liked the compiler to catch them.
14:05patchworkYou can always define your own mathematical equality: (fn [a b] (= a b))
14:05dnolenhmm, reiddraper simple-check for testing core.async deadlock?
14:05patchworkThat will fail for one arg
14:06TimMctbaldridge: I think >2-arity = *uses* reduce.
14:06justin_smith(source =)
14:06TimMcOh hmm, not quite.
14:06lisztcYmen: I don't know why you have a problem with this.
14:06justin_smith,(source =)
14:06clojurebotSource not found\n
14:06amalloyTimMc: highly unlikely
14:06justin_smithmeh
14:06TimMchttp://clojuredocs.org/clojure_core/clojure.core/=
14:07TimMcamalloy: Yeah, thinko.
14:07reiddraperdnolen: that'd be awesome, erlang quickcheck can do some similar things with a tool called PULSE
14:07cYmenliszt: It's not a serious problem I just actually made the mistake of missing one argument and it ran fine and gave weird results. :)
14:07lisztcYmen: "All of my arguments are equal to one another" is a completely consistent definition of =.
14:07TimMcIt does it pairwise, anyhow.
14:07dnolenreiddraper: would simple-check need tweaking for async testing?
14:08arunliszt: (=) => true would have been cool :)
14:08reiddraperdnolen: I'd need to dwell on that for a bit, certainly some things you could test with no changes
14:08lisztarun: Yep.
14:08tbaldridgeoh...async simple-check...yes please
14:09dnolenreiddraper: k, I've been wanting to do a post on simple-check on my blog, I think demo'ing simple-check for deadlock detection in ClojureScript core.async would be *killer*
14:09patchworkarun: Agreed. that would make it fully consistent
14:09patchworkRich probably has a reason though ; )
14:09dnolenreiddraper: it's main source of incidental complexity, and be able to get a minimum sequence of messages would be amazing
14:09akrajan,(+)
14:09clojurebot0
14:10sandbagsanyone know why cljsbuild would, apparently, lose track of the core Clojure functions like "ref". I'm getting "Use of undeclared Var" errors for core stuff like ref, dosync etc..
14:10reiddraperdnolen: right, that's probably going to be nontrivial, but I'll give it some thought. The erlang one works by taking over the scheduler
14:10akrajan(=) => true would have served as a identity function
14:10stuartsierraIs there any written documentation on CLJS source maps?
14:10stuartsierraI'm looking for references for our training course.
14:10amalloyuhhh, i don't think those exist in cljs, sandbags
14:10tbaldridgesandbags: clojurescript is single threaded, why on earth would you need STM?
14:10patchworkI feel like it is a zen koan: "Is nothingness equal to itself?"
14:10sandbagsah crap
14:11reiddraperdnolen: well, actually it rewrites your code, we might could just use a macro for that...
14:11sandbagsi failed to engage brain
14:11sandbagsi didn't notice that all those things were async constructs
14:11dnolenstuartsierra: only how to use it - https://github.com/clojure/clojurescript/wiki/Quick-Start
14:11sandbagsthanks
14:11`cbptbaldridge: can I ask you something?
14:11dnolenstuartsierra: and it's not fully baked quite yet - we still need the ability to relative URLs for CJLS + webserver case
14:12tbaldridge`cbp: no, never
14:12`cbptbaldridge: :-(
14:12stuartsierradnolen: OK, thanks, good to know.
14:12dnolens/relative/relativize
14:12tbaldridge`cbp: go ahead
14:13`cbptbaldridge: On your youtube videos I noticed you sent blocks of code from your source file to your nrepl. How do you do that?
14:13`cbprepl*
14:14stuartsierrahah
14:16tbaldridgeI got it from code I stole from stuartsierra.
14:17benmossdoes anyone know where clojurescript is supposed to be able to find clojure "1.6.0-master-SNAPSHOT"?
14:17stuartsierra`cbp: here it is https://github.com/stuartsierra/dotfiles/blob/8dc9a38e74f7c47927b7a98c0635ce30c303be9a/.emacs.d/local/init.el#L276-L301 but I don't think it works with the new "cider"
14:17stuartsierrabenmoss: http://dev.clojure.org/display/community/Maven+Settings+and+Repositories
14:17Raynesstuartsierra: How's things, hair color, etc
14:17stuartsierraRaynes: Brown.
14:18dnolenbenmoss: CLJS doesn't need 1.6, that because of the 1.6 profile in CLJS's project.clj
14:18Raynesstuartsierra: You're living on the edge, man.
14:18`cbpnice, nice
14:18tbaldridge`cbp: yeah it doesn't work with cider. yet, but it's really nice, I don't know why it doesn't come standard with the lib
14:18dnolenbenmoss: I think you just need to specify the 1.5 profile (i don't know how to do that)
14:18stuartsierraSLIME didn't have it either, as I recall.
14:19tbaldridgestuartsierra: I don't care who didn't have it. I just want it :-P
14:19RaynesHeh, aphyr changed his twitter name to 'Twitter'.
14:19benmossdnolen: hmm, just trying to run "lein test-all" which runs against both profiles
14:19Raynes"Retweeted by Twitter"
14:19stuartsierraYeah, maybe I should just submit that to nrepl.el, only now it's all different.
14:19tbaldridgeI don't know why by default cider would send stuff to the "echo" buffer, or whatever it's called. I love clojure in emacs, I just don't understand it sometimes.
14:20stuartsierratbaldridge: C'mon man, know your Emacsisms! It's "minibuffer."
14:20dnolenbenmoss: which you don't want or need to do
14:20dnolenbenmoss: also `lein test` doesn't do anything yet, there are no compiler infrastructure tests at the moment, only tests for CLJS code itself.
14:21benmossdnolen: gotcha, yeah i was trying to run the test suite to see that i had everything setup before modifying
14:21dnolencemerick: 649, I don't like the sound of more options :)
14:22cemerickdnolen: yeah, I don't either really, but :libs is not easy to understand at all. A big part of that is the conflation of two totally different types of entries. *shrug*
14:23cemerickI don't really grok the filesystem case; is it realistic to expect people to enumerate all of their js libs?
14:24cemerickespecially with the (hacky, but neat) magic of discovering js libs that have goog.provides and requires in them (but _only_ on the classpath!)
14:24dnolencemerick: I was confused about :libs, it seems you are right that you can specify directories or files. The classpath is the real issue, but people just don't understand this part
14:25dnolencemerick: everything that's going to be a part of your project needs to be on the classpath
14:25cemerickdnolen: you _can't_ specify directories
14:25stuartsierraIs it still true in CLJS that you can only catch js/Error and not, say, strings?
14:26jcromartiedo you think Clojure is modern or postmodern?
14:26dnolenstuartsierra: atm the moment yes, been hoping to get some word from Rich about cross platform catch all
14:26stuartsierradnolen: OK, thanks.
14:26cemerickdnolen: I'm 100% fine with everything needing to be on the classpath. That's how I work, but there's always (apocryphal, AFAICT?) usage of e.g. command-line cljsc by people that don't grok classpath, etc.
14:27shaungilchristjcromartie: postmodern for sure
14:27dnolencemerick: I don't consider educating people about the classpath a problem we need to solve
14:28dnolenstuartsierra: happy to revert the try/catch change until it gets settled, it was low level compiler enhancement in the first place.
14:28dnolenstuartsierra: I'm assuming you're interfacing w/ some lib that throws strings?
14:28cemerickdnolen: Yup. Well, if you're up for it, we can put dropping filesystem support for :libs up for consideration at some point in the future...
14:28stuartsierradnolen: It's not a problem for me, this is for teaching.
14:29dnolenstuartsierra: gotcha
14:30dnolencemerick: oh, I haven't look at :libs code, so are you saying it tries both io/resource and io/file or something?
14:30benmossdnolen: now trying to run ./script/test with v8, is the suite pretty instantaneous? seems like nothing is being run. I see "Tested with 1 out of 3 possible js targets", but the whole script takes 136ms
14:30dnolenbenmoss: v8 is magic
14:31dnolenbenmoss: but double checking run time on my machine one moment
14:32dnolenbenmoss: takes ~1.3-5 seconds on my machine, so something is up w/ your setup
14:32benmossgreat
14:35benmossah, my core-advanced-test.js is empty
14:38benmossand that is probably related to "Error: Could not find or load main class clojure.main"
14:39dnolenbenmoss: did you run the bootstrap script?
14:40benmosser, no
14:40dnolenbenmoss: ./script/bootstrap
14:40benmosscool, thanks
14:46cYmenHm...how do I tell filter to stop on the first non-match? Basically how do I make (filter #(< % 100) (range)) not run forever? :)
14:47S11001001cYmen: use take-while, not filter
14:47cYmenthanks
14:47cYmenThis may be a good point to ask how to properly search for functions?
14:47cemerickgah, that search for js files that contain goog.provide is too clever for anyone's good :-P
14:48S11001001cYmen: cheat sheets, source of core.clj
14:48rasmustocYmen: http://clojure.org/cheatsheet
14:48cemerickdnolen: Re: filesystem *and* classpath, oooh yes. :libs is gnarly, and I'd very much like to "fix" it, for some definition thereof we can agree on. The system property lookup is the biggest WTF IMO https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L146
14:48cYmenthanks
14:50cemerickThat'll keep javascript files from being picked up anytime the compiler is running in any env using classloaders for anything, e.g. via pomegranate, in immutant, etc.
14:50cYmenHm...How do I memoize a recursive function?
14:51justin_smithcYmen: (memoize (fn f-name [...] .... (f-name ...)))
14:52cYmenThat works? :o
14:52justin_smithyeah, you can give a name to an fn
14:52S11001001though you won't get memos for the subcalls
14:52cYmenYeah, but how does it know to replace the inner calls to f-name with calls to the memoized version?
14:52S11001001it doesn't
14:52cYmenS11001001: ah :)
14:54cYmenI'm not picky...can it be done using declare or something?
14:54Bronsaif you def it it should work though (def x (memoize (fn [] .. (x))))
14:54S11001001cYmen: I think the obvious way would work
14:54S11001001as Bronsa says
14:56hiredmanBronsa: that won't work
14:56hiredmanoh, sorry it will
14:56hiredmantoo fast, I am thinking of defn
15:01jcrossley3cemerick: dnolen: there is https://github.com/tobias/dynapath, but ideally clojure/java.classpath would subsume it.
15:01cemerickjcrossley3: we don't even need that; it should just be enumerating all resources from the context classloader, done.
15:02jcrossley3cemerick: i c
15:04jkkramerseancorfield: ping
15:09Morgawrhttp://havamal.morgawr.com/owncloud/public.php?service=files&amp;t=bc281860de4b911431db2e8c628c745d woo finally it arrived :D
15:09Jardadnolen: so I need to actually snail mail the contributor agreement to rich hickey? :)
15:10Jardadnolen: re: http://dev.clojure.org/jira/browse/CLJS-536
15:11dnolenJarda: yep
15:12Jardaok, so I'll just find me an envelope and drop it in a box. No idea when it might reach rich though :)
15:12dnolencemerick: I don't get understand the point of that code
15:13dnolenJarda: they processed by Cognitect
15:13dnolenget processed
15:13cemerickdnolen: it's walking all jars in the classpath finding javascript files that contain goog.provide and/or goog.require
15:14cemerickgoing about it in a very failure-prone way, but that's what it's doing
15:14dnolencemerick: yes but I'm confused *why* it needs to do this
15:15cemerickdnolen: Hrm, not sure how far up the chain to go. :-) Necessary in order to load javascript libraries via (:require) et al., fold them into optimization, etc.
15:16dnolencemerick: it doesn't seem neccessary for js lib loaded via :require to me.
15:17cemerickdnolen: how else would it find the source of the file to fold into optimization given (:require foo.bar)?
15:17dnolencemerick: actual goog libs are organized in dirs based on their namespace
15:17cemerickah
15:18dnolen(io/resource "goog/base.js")
15:18cemericksure
15:18dnolencemerick: for everything else you have a direct file ref
15:18dnoleni.e. :libs
15:19cemerickdnolen: well, I've taken some non-goog libs and made them goog-capable, but didn't want to disturb the upstream file organization, so the goog.provide discovery was very useful
15:19cemerickI've been going on the assumption that you simply can't expect anything in particular w.r.t. js file/project organization, so the discovery made sense to me when I saw it.
15:19dnolencemerick: this falls into :libs :foreign-libs, I don't see the problem here
15:19dnolenor why we need to walk jars like that
15:21cemerickdnolen: :foreign-libs is simply a PITA, and are impossible to distribute with a library to downstream consumers. It's not a useful mechanism except for Application development.
15:22dnolencemerick: ok, it seems to me because of :libs we don't need jar walking
15:22cemerickdnolen: you mean, you think direct filesystem references are sufficient?
15:23dnolencemerick: yes, for goog and cljs stuff we already have a sane layout
15:23dnolencemerick: for other random goog style stuff, :libs does the job
15:23dnolenI see no use case for jar walking except convenience probably best handled elsewhere
15:23cemerickgotta stop saying just :libs, since it implies classpath/jar walking :-P
15:25dnolencemerick: sorry I'm not familiar with the closure.clj convenience details, are you saying it walks to jar to attempt to find the lib you specified?
15:26cemerickdnolen: ah, also, even libs with goog-style file layout on the classpath aren't loaded based on the name. That only applies to libs shipped as part of Closure itself.
15:26dnolencemerick: like what?
15:27cemerickdnolen: i.e. if you put foo/bar/baz.js on your classpath, a (:require foo.bar.baz) would not bring in that js file, even if it had a goog.provide("foo.bar.baz")
15:27seancorfieldjkkramer: you rang sir?
15:28dnolencemerick: seems like something easily fixed
15:28dnolencemerick: and it probably should be
15:29jkkramerseancorfield: is the vec call here necessary? seems like it prevents results from being processed lazily when :as-arrays? option is given https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L647
15:30Jardahmmm. btw has someone been able to use goog.net.XhrIo to send multipart form posts (file uploads)
15:31spacefugitivecan someone give me some feedback on my specs - why does it only run my last spec? Should I be writing my specs differently ? https://www.refheap.com/20377 (my first clojure program)
15:32jkkramerseancorfield: this was a theoretical concern for me when writing a lib based on java.jdbc, but looks like someone may have run into it for real: http://stackoverflow.com/questions/19728538/clojure-java-jdbc-query-large-resultset-lazily
15:32seancorfieldjkkramer: that's by design if you ask for arrays - you'd have to check the original JIRA issue for why
15:33cemerickdnolen: so you're suggesting: (1) load goog-style js files from where they "should" be on the classpath, (2) make :libs support complete filesystem paths only?
15:33seancorfieldand remember that by default (query ..) uses doall anyway to realize the result set before the connection is closed
15:34seancorfieldif you want a lazy result set, you must a) keep your connection open long enough yourself and b) not use as-arrays? - by design
15:35dnolencemerick: yes, the other thing I would like to nuke - walking the directory putting all cljs source into the build.
15:36dnolencemerick: really we should specify a main file and dependencies should be solved based on the entry point.
15:36cemerickah
15:36cemerickI don't think I have any opinions on that
15:36cemerickdnolen: is there any harm in the sources walk?
15:37jkkramerseancorfield: ok, i'll see if i can find the case. that seems less than ideal, though. that means it's impossible to process results lazily AND guarantee preserved column order (or avoid overhead of map processing)
15:37hiredmancemerick: there are a lot of assumptions built in to that
15:37cemerickhiredman: do enlighten me
15:37hiredmancemerick: given ClassLoader, how can that be done efficiently?
15:38seancorfieldjkkramer: i'm open to tickets / patches offering better alternatives
15:38dnolencemerick: it's just doesn't make much sense, files get revisited over and over again for analysis and compilation
15:38seancorfieldbut remember that (query ..) is generally "atomic" in that you call it (with a db-spec) and you get a result (and the connection is closed)
15:39cemerickhiredman: oh, you're talking about the classpath walk?
15:39cemerickdnolen: Yeah, ok. I'll make some issues enumerating the things-to-be-done.
15:39hiredmancemerick: it seems to me they are connected, if you have a proper graph of requires you don't walk
15:40hiredmanuh, walk isn't the right word
15:40hiredmanyou don't try and scan everything on the classpath
15:40cemerickhiredman: well, I think we just agreed to ditch the classpath walk entirely, and assume goog/java/clojure-style layout
15:41hiredmancemerick: ok
15:42jkkramerseancorfield: right, understood; i'll look over the issues when i get a chance. so far it's not causing me any problems personally
15:42hiredmanI don't really clojurescript and people presuming things about classloaders is just a peeve of mine
15:46loliveirahi. does somebody know how to use the clause in with clojure.jdbc?
15:46cemerickhiredman: then you shouldn't look at what's being done now :-)
15:48hiredmancemerick: I avoid looking at things for exactly that reason
15:49hiredmanit is just going to upset me, and I don't have enough energy to do anything about it
15:49jkkramerseancorfield: even with the default doall for result-set-fn, it's calling (doall (cons (first rs) (vec (map row-fn (rest rs))))), making the vec superfluous, no?
15:49Jardaanyone used cucumber with clojure? In my clojure step definition files, should I use atoms for shared state between steps?
15:51hiredmanI rewrote the clojure part of cucumber-jvm once, because I thought I might use it and made the mistake of looking under the hood, and after rewriting and opening a pr I never ended up using it
15:51seancorfieldjkkramer: please read the specific JIRA ticket that introduced as-arrays? for the justification for this - users specifically wanted a vector result
15:51seancorfieldyou could argue the doall is superfluous for as-arrays? (but since it can be overridden by users, it could be anything)
15:51Jardahiredman: yeah I'm not interested what's there under the hood :)
15:52edoloughlinI upgraded leiningen (2.3.?) and now it's looking for a boot.clj in my classpath. This is a ring/compojure project. How do I tell it to use core.clj? I can't find a reference to boot.clj from google.
15:52jkkramerseancorfield: seems like if they want a vector, they can ask for one with :result-set-fn. calling vec explicitly prevents any other choice
15:52hiredmanJarda: sure, I am just using it as an example of looking and being upset, and the outcome of that
15:52hiredmanwheel spinning and nothing useful
15:54amalloyspacefugitive: i'm not familiar with whatever testing lib you're using, but it's probably the case that "it" and "should" are not side-effecting, but just produce a function or something, which describe uses. (let [...] x y z) evals x, then y, then z, then returns z; so unless x and y have some side effects, it's the same as (let [...] z)
15:56amalloyadditionally, as a style pointer, it is never the correct style to have a line containing only closing delimiters like ), ], or }: they should all just bunch up together on the same line
15:56spacefugitiveThats amalloy , thats very helpful, I figured that was happening since I posted. I am using speclj.
15:56spacefugitive*Thanks
15:58ohcibihi i want to iterate over a list working with 3 elements in each loop.. so the first loop should use the last, the first and the second element, the second loop the first the second and the third, and so on.. i'm thinking about (map-indexed) and then (get) the neighbors of the current element from the list.. but it feels kinda ugly.. anyone has an idea how to do this "nice"? 8-)
15:58amalloyso for your current example, i would just pull the describe inside of both lets, so that it reads (let ... (let ... (describe (it ...) (it ...))))
15:58amalloywhich looks like what speclj wants
15:59algalHi. Does anyone happen to know if there's a ring adapter that lets you serve some routes as plain HTTP, while wrapping others in SSL so they are served over HTTPS?
16:00spacefugitiveamalloy : awesome. Thanks! Also for the style tip !
16:00algalThe ordinary ring-jetty-adapter seems to be all or nothing, but the underlying jetty library seems to support this by allowing one Server to handle multiple Connectors..
16:00llasramedoloughlin: boot.clj isn't a file which is normally handled specially. Something in your project.clj or profiles.clj must be referencing it / a namespsace ending in `boot`
16:00amalloyohcibi: ##(partition 3 1 '(a b c d e))
16:00lazybot⇒ ((a b c) (b c d) (c d e))
16:00spacefugitiveI was just duplicating my inits - this is much better thanks!
16:01ohcibiamalloy: i'm stunned
16:03ohcibiamalloy: the two ## are syntax for the bot, right?
16:03amalloyindeed
16:05rasmustoohcibi: #(partition 2 1 %) and I are good friends
16:07Raynescemerick: You know, I still have that Postbox bug that causes all of my emails to have your picture attached to them.
16:07RaynesThis has been going on for like 8 months.
16:08cemerickpostbox?
16:08Raynes$google postbox email client
16:08lazybot[Postbox — Awesome Email] http://www.postbox-inc.com/
16:08cemerickRaynes: I'm there with you, always.
16:08RaynesIt's an otherwise fairly spectacular email client
16:08RaynesBut it just really likes to put your face on everything I get.
16:08amalloyplot twist: cemerick has hacked your mail client and has been intercepting and re-authoring every message you receive
16:08cemerickI wish I were so leet.
16:08RaynesNot that your face is unpleasant. It's just that sometimes I like to see other people's faces.
16:08cemericktraitor
16:09cemerickbummer its only mac/win
16:09RaynesYeah. It's a nice alternative to thunderbird which is mostly unsupported these days.
16:09RaynesIt's actually a fork of it iirc.
16:09cemerickoh? Been using thunderbird for some months, updates seem to come along at a reasonable clip.
16:10TimMccemerick: I stopped using Thunderbird when it started corrupting my mail.
16:10Raynes"On July 6, 2012, a confidential memo from Jb Piacentino, the Thunderbird Managing Director at Mozilla, was leaked and published to TechCrunch.[27] The memo indicated that Mozilla would be moving some of the team off the project and further development of new features would be left up to the community. The memo was slated for release on July 9, 2012. A subsequent article by the Mozilla Foundation Chair, Mitchell Baker, stated Mozilla's decision to
16:10Raynes make a transition of Thunderbird to a new release and governance model"
16:10Raynescemerick: ^
16:10TimMcClaws is slow and cranky but it stores each email as a separate file.
16:11amalloycemerick: for srs? i've been using thunderbird for years, and for a year or two it's been telling me it's unsupported
16:11llasramEmacs gnus 4eva
16:11muhoomutt ftw
16:11lazybotWoof!
16:11muhoohaha
16:11seancorfieldjkkramer: as-arrays? returns a completely different format result and was a common enough request that it should be in the library as a native format
16:11amalloyhaha yes. gotta be the first time anyone's ever triggered that easter egg
16:12seancorfieldremember: you do not have to use as-arrays? if you want different behavior!
16:12cemerickamalloy: dunno, I just get update notifications with all the other ubuntu stuff
16:12seancorfieldbut, yes, one of the key aspects of as-arrays? is guaranteed column order (which is why it needs to be native in the library)
16:12Raynesls
16:12lazybotbin boot dev etc lib lost+found opt src swap
16:12jcrossley3llasram: +1 for gnus
16:12jkkramerseancorfield: i'm not sure how that relates. i prefer to use as-arrays myself, but i don't think realizing *all* results should be necessary to do so. the vec call forces full realization regardless of the :result-set-fn
16:12Raynes$botsnack
16:12lazybotRaynes: Thanks! Om nom nom!!
16:13seancorfieldagain, (query ..) is deliberatly not lazy by default so that it can manage the connections internally
16:13seancorfieldyou can't return a lazy result and still close the connection
16:13jkkramerseancorfield: i understand results must be processed within the scope of the connection, but realizing all results *at once* should not be necessary
16:14jkkramerthe vec call forces all results to be realized regardless of :result-set-fn
16:14seancorfieldif you don't want that behavior, don't use as-arrays? and pass in your "work" as a row-fn
16:15seancorfieldas-arrays? is new behavior, added specifically for users who wanted that behavior
16:16jkkramerseancorfield: then you must process maps, which is superfluous work and doesn't preserve order
16:17zerokarmaleftohcibi: looking a bit more closely at the loop you described earlier...I think you actually want something like ##(let [v [:a :b :c :d :e]] (partition 3 1 (take (count v) (drop (dec (count v)) (cycle v)))))
16:17lazybot⇒ ((:e :a :b) (:a :b :c) (:b :c :d))
16:18edoloughlinllasram: Thanks. I think there might be a problem with my project config...
16:20dobry-denIs there a way to refer to a symbol that has no root binding because it's supplied by the user when the func is invoked?
16:20dobry-denor would you just declare nil root bindings for such vars in the ns where such a func exists
16:20ohcibizerokarmaleft: the number of partitions must be equal to the number of elements in the vector, so something is wrong... c,d,e and d,e,a are missing
16:21dobry-denfor instance, I have funcs that expect *host* and *port* to be bound when they're invoked by the user
16:21ohcibizerokarmaleft: i just (flatten [(last list) list (first list)])
16:21amalloydobry-den: so far everything you've described works fine
16:22zerokarmaleftohcibi: ##(let [v [:a :b :c :d :e]] (take (count v) (partition 3 1 (drop (dec (count v)) (cycle v)))))
16:22dobry-denamalloy: I just realized that I believe this is what declare is for
16:22lazybot⇒ ((:e :a :b) (:a :b :c) (:b :c :d) (:c :d :e) (:d :e :a))
16:22dobry-denamalloy: (declare ^:dynamic *host*, ^:dynamic *port*)
16:23amalloyohcibi: in many states, using flatten is considered devil-worship
16:23llasramdobry-den: Or just `def` 'em to `nil`
16:23ohcibiamalloy: how come?
16:23amalloy~flatten
16:23clojurebotflatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.
16:24amalloyin your example, suppose your list were, instead of '(a b c d e), actually '((a 1) (b 2) (c 3) (d 4) (e 5))
16:25ohcibiamalloy: i see your point, but the function that deals with flatten only takes list with atomic elements...
16:26ohcibiamalloy: you'd say i should (concat [(last list)] list [(first list)])?
16:26amalloysure, that's a fine choice
16:26amalloyor use cycle and take like zerokarmaleft suggested
16:27amalloylike, why write your function with flatten, which makes your function brittle and forms bad habits, when so many convenient and correct approaches exist?
16:41TimMc&(flatten 17)
16:41lazybot⇒ ()
16:43TimMcIf flatten didn't have that call to rest, I think that would work as expected.
16:43TimMc&(filter (complement sequential?) (tree-seq sequential? seq [[[17]]6]))
16:43lazybot⇒ (17 6)
16:43TimMc&(filter (complement sequential?) (tree-seq sequential? seq 17))
16:43lazybot⇒ (17)
16:48hiredmanflatten is just bad, so don't use it and don't change the behaviour, just leave it laying there rusting
16:49hiredmandead to you as those who use it are dead to me
16:56stuartsierraIs there actually a bug in `flatten`?
16:57hiredmanif you don't use it, does it matter?
17:00mikerodsounds like the "if a tree falls in the woods and no one is around, does it make a sound?" argument :)
17:01mikerodironically, anything the tree falls on would be flattened too
17:04jared314i read somewhere you can connect to an nrepl server with telnet. Is this still true?
17:06justin_smithjared314: you can, but you have to send a very specific kind of message to make it do anything interesting
17:07jared314justin_smith: message format or encoding?
17:07justin_smithformat, it expects a map literal iirc
17:08justin_smithit just disconnects if it doesn't understand what you are sending, no error message
17:08justin_smithlein repl :connect is much easier
17:09jared314i'm trying trying to write my first nrepl middleware so I actually want to know that format
17:10jared314i tried a map literal with keyword and quoted strings, nothing
17:11justin_smithjared314: https://github.com/clojure/tools.nrepl this page has an example
17:12justin_smith{:op "eval" :code "\"hello\
17:12justin_smith")
17:12justin_smithhit return too soon
17:13jared314tried that first
17:14jared314it doesn't close, but it doesn't respond either
17:14jared314does lein repl allow a tty transport?
17:20justin_smithjared314: you can launch an nrepl from your app and specify tty
17:20justin_smithalso, it looks like middleware are expected to take and return those maps with :op and such in them
17:24algalAre there any clojure-specific issues to be aware of, when it JVM options for what's supposed to be a long-running ring app?
17:27justin_smithset aside plenty of permgen, clojure makes lots of little classes
17:27justin_smiththere is probably more
17:28algaljustin_smith: Thanks. I know zero about JVM tuning so every pointer is helpful.
17:34mikerodcalling `str` on a lazyseq gave me "clojure.lang.LazySeq@f2143067"
17:34mikerodI would have expected that to always cause the lazy seq to be realized instead, hmm
17:36jared314mikerod: you need to use apply
17:36mikerodactually, I guess that makes no sense, have to seq or something first
17:36swarthy@mikerod, @jared314 beat me to it
17:36mikerodthanks, makes sense. don't know what I was thinking
17:37justin_smithsometimes pr-str works better
17:37jared314or just reduce with str
17:37justin_smithpr-str has the advantage that it can work on collections or individual values
17:37justin_smith,(pr-str 8)
17:37clojurebot"8"
17:37justin_smith,(apply str 8)
17:37clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
17:38jared314,(pr-str (range 1 5))
17:38clojurebot"(1 2 3 4)"
17:38jared314,(apply str (range 1 5))
17:38clojurebot"1234"
17:38justin_smithso yeah, often pr-str is better in my experience
17:38notofiIs there a function already for assoc'ing ONE value to a bunch of keys?
17:39justin_smith(apply assoc m (interpose keys (repeatedly val))) maybe?
17:40notofi. (apply assoc {} (interleave [:a :b :c :d] (repeat 1)))
17:40notofi, (apply assoc {} (interleave [:a :b :c :d] (repeat 1)))
17:40clojurebot{:d 1, :c 1, :b 1, :a 1}
17:41nightfly, 2
17:41clojurebot2
17:41notofiI thought that maybe there is a function that already does this
17:47dnolen,(zipmap [:a :b :c :d] (repeat 1))
17:47clojurebot{:d 1, :c 1, :b 1, :a 1}
17:53Raynescemerick: I don't have a lawn. Joke is on you.
17:54cemerickRaynes: stone frontice, whatever you west-coasters do
17:56leif-pI'm trying to figure out how to make batch inserts go faster using c.j.jdbc. Inserting the same rows takes korma < 1s, c.j.jdbc ~50s. Anybody ever run into this, and have a workaround?
17:59benmossis anyone here have vim-fireplace expertise?
17:59benmoss*does
18:01amalloy~anyone
18:01clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
18:02Apage43benmoss: I use it
18:02Apage43what up?
18:49biggbear(= java.lang.Integer (type 1)) -> false
18:50mtp(type 1)
18:50mtp,(type 1)
18:50clojurebotjava.lang.Long
18:54ta479is clojure faster than scala for functional programming? Does it do more optimizations with purity?
18:55mtptry it and see?
18:55mtpdefine "faster"
18:55mtpdefine optimization
18:55mtpwhat is your workload?
18:56mtpin short, you are asking a misleading question and i have no context with which to answer
18:56ta479no mutating variables
18:56ta479optimizations done by the compiler when optimizing that
18:57ta479in scala, lists won't be fused so a double filter takes twice as long as a filter with the predicate fused
18:57ta479because scalac can't be certain side effects won't factor in
18:58ta479what's clojure's situation?
18:59bbloomthat particular optimization is known as "stream fusion"
19:00bbloomclojure's core lazy sequence primitives do chunking, which is a different, but related optimization
19:00bbloomhowever, the clojure.reducers does something similar to stream fusion & better
19:00bbloomsee http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
19:01bbloomcompare with GHC's http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/rewrite-rules.html
19:01ta479so do you know if FP clojure is faster than FP scala?
19:01bbloomta479: i won't even attempt to answer that question
19:02gwstell me more about imperative clojure
19:02bitemyappta479: silly question.
19:11xuserta479: Scala is faster obviously, its on pair with Java
19:11beppus/pair/par/
19:12xuserbeppu: thanks
19:12xuserta479: the reason is the Scala compiler generates Java bytecode
19:12xuser
19:13llasram...
19:13llasramUm, what do you think the Clojure compile does?
19:14llasramcompiler, even
19:14Raynesxuser: The fact that Clojure code isn't usually compiled ahead of time isn't really a huge performance factor.
19:15Raynesxuser: You can make the Clojure compiler compile to bytecode ahead of time, but it *always* gets compiled to bytecode, even if it is on the fly.
19:15xuserllasram: ^^
19:15xuserwas referring to that
19:15RaynesIt still isn't as big a factor as you think it is.
19:16cYmenI'm trying to generate an integer range with end included. Is there something more idiomatic than (range (+ 7 0.1))?
19:16RaynesYou can write Clojure code that is on par or close to it. The problem is that that code is unpleasant to read, write, and work with a lot of the time.
19:19xuserRaynes: oh ok, I though that was huge performance hit actually, the big performance hit is on startup then?
19:20Apage43hm
19:20RaynesStartup time is a problem, yes, but still not the reason Clojure isn't usually as fast as Java. There are lots of things that go into that.
19:20Apage43how can I test if something is a byte array?
19:20Apage43,(into-array Byte/TYPE [1 2 3])
19:21clojurebot#<byte[] [B@1bfc699>
19:21Apage43got one of those, want to make sure that's what i have
19:21RaynesReflection (which can usually be eliminated with type hints for sometimes substantial speed improvements), and while persistent immutable data structures are blazing fast, sometimes mutating an array is faster.
19:22RaynesThe reason Clojure isn't usually as fast as Java is because people don't want to write the Clojure code necessary to make it as fast as Java, because it tends to chip away at the benefits of using Clojure instead of Java in the first place.
19:23xuserRaynes: you mean like non idiomatic Clojure code?
19:23RaynesYes.
19:23xuseror calling Java a lot
19:23bitemyappxuser: writing fast Clojure code typically means avoiding clojure.lang.RT and using hot-loops with tight data structures.
19:23bitemyappit can end up being on par with or faster than Java at that scope.
19:23Raynesdnolen has a blog post on what bitemyapp just said.
19:23bitemyappit won't be faster than java in the more abstract code, but who cares?
19:23RaynesAnd goes as far as to call it 'idiomatic' because all mutation occurs in an isolated environment.
19:24`cbpApage43: type?
19:24RaynesAnd I don't really disagree.
19:24bitemyappI'm meh on that. Haskell users do the same thing and box their mutation in with monads.
19:24bitemyappthe compiler output is tight either way.
19:24Raynesschmir: Piiiiing
19:24Apage43`cbp: i went and read byte-streams. It grabs the result of (class (byte-array 0)) and then uses instance?
19:25Apage43=P
19:25`cbp,(= (Class/forName "[B") (type (into-array Byte/TYPE [1 2 3])))
19:25clojurebottrue
19:26Apage43(let [byte-array-class (class (byte-array 0))] (instance? byte-array-class (into-array Byte/TYPE [1 2 3])))
19:26Apage43,(let [byte-array-class (class (byte-array 0))] (instance? byte-array-class (into-array Byte/TYPE [1 2 3])))
19:26clojurebottrue
19:26Apage43rather
19:26`cbpif it works it works
19:26Apage43Either works, I guess
19:26gwsApage43: http://stackoverflow.com/questions/14796964/how-to-check-if-a-clojure-object-is-a-byte-array
19:27xuserRaynes: bitemyapp: thanks
19:28RaynesI'm so sorry.
19:28Apage43thx
19:28`cbpbitemyapp: hi! You think we could get a release out this weekend?
19:28Apage43this is not the first time i've written this >.>
19:28bitemyapp`cbp: if my drinking last night doesn't finish killing me, sure.
19:29`cbp:-(
19:29bitemyapp`cbp: I've got a pretty bad headache. I'm pondering retry logic right now.
19:29Apage43but the first time was like > 3 years ago and I don't have it handy anymore
19:31`cbpbitemyapp: okies. Most of the rdb api is implemented and passes tests now, just 1-2 with odd results + the time stuff is a bit weird. If you could spare a minute sometime to check those failing tests that'd be awesome
19:31bitemyapp`cbp: hum. connections branch or master?
19:31`cbpbitemyapp: connections
19:31bitemyapphokey-dokey.
19:33`cbpThe time stuff fails because it compares 1.2123123123E9 vs 1.2123123123E9 (written)
19:38xuserRaynes: bitemyapp: so clojure.jar calls javac?
19:38Raynesjavac compiles java to jvm bytecode.
19:38RaynesClojure.jar compiles Clojure to JVM bytecode.
19:38RaynesJava is not an intermediate step.
19:41xuserRaynes: so it doesn't really compiles Clojure to JVM bytecode but calls the bytecode in clojure.jar as it parses a clojure source code right?
19:44S11001001xuser: it compiles to jvm bytecode
19:46S11001001xuser: for realsies
19:47xuserS11001001: interesting, so clojure.jar actually produces java bytecode from java bytecode
19:47S11001001it produces java bytecode from clojure source code
19:48S11001001there is no intermediate step!
19:48llasramxuser: Try playing around some with ASM
19:48S11001001as Raynes and bitemyapp mentioned, slowness typically comes from the fact that the JVM penalizes good practice and rewards bad practice. Everything else is the same.
19:49xuserS11001001: yeah, what I mean is the clojure compiler clojure.jar which is in java bytecode is use to produce java bytecode from clojure source
19:50xuserS11001001: is that right?
19:51S11001001xuser: yeah, but javac is no different in that regard
19:51xuserllasram: yeah, that would probably help
19:54bjaI think I need a pending state for my user interface
19:54bjasomething after the user interacts, but before the server responds
19:59xuserS11001001: yeah, I though producing the bytecode on the fly was the big performance issue
20:05xuserS11001001: Raynes: bitemyapp: thanks for clearing up this for me ;)
20:05allenj12hey does anyone know a good prop logic library i can use?
20:14ta479xuser: I don't think functional scala is very fast. Imperative scala is on par with java but I think clojure does better FP optimization
20:17xuserta479: yeah, I was confused, I though clojure code was interpreted by clojure.jar but clojure.jar is a actually a compiler
20:17xuserta479: maybe is has to with the JVM being tuned for Java
20:17ta479I don't really care for startup performance, just runtime performance
20:18xuserta479: altough I don't know how much of a penalty is incurred by producing bytecode on the fly, Raynes says is not really much
20:29ta479no state of clojure 2013 survey?
20:45xeqita479: I believe cemerick is planning to do one soon
20:52bbloomxuser: it's created on the fly when the code is *loaded* not run
20:53bbloomit's practically zero time for a server application & since most folkss do incremental live coding w/ a repl, it's a total non-issue for all major use cases
20:55Morgawris it possible to have an atom inside an agent? does it make sense to do so? I know agent communication is asynchronous and I have no guarantee on how immediate an action can be performed on an agent (only that it's going to be ordered)
20:55tbaldridgeMorgawr: everything can be inside everything (when it comes to clojure), but like you said, probably not a good idea
20:55Morgawrso I was thinking, since atoms are immediate (as in, not queued), would it make sense to store an atom inside an agent's state and then swap! that atom for instant communication/state-change?
20:57Morgawrtbaldridge: the only difference between atoms and agents is that with atoms you atomically change the state of some shared data in a concurrent way
20:57Morgawrwhereas for agents you have a separate thread change that state, right?
20:58Morgawris there a way to have an agent act like an atom?
20:59xuserbbloom: yeah, saw that in http://clojure.org/compilation , thanks
21:03bbloomMorgawr: take a step back and describe your goal, not some hypothetical solution to a problem you decided you have :-)
21:03xuserbbloom: interesting to see their are plans for a clojure compiler in clojure http://clojure.org/todo
21:04bbloomxuser: that's pretty old. clojurescript came out of it & there are several projects in project to produce a selfhosted compiler. Bronsa's is most promising
21:05seangrovebbloom: Oh? I thought clojurescript-in-clojurescript was where the selfhosted compiler was most likely to come out of
21:05Morgawrbbloom: the idea is that I am designing a situation where I have a lot of independent threads operating on a lot of independent data structures (like the Hickey's ant simulation) and I am using agents to do so
21:05seangroveBuilding on all of Bronsa's work, of course
21:05Morgawragents receive functions to manipulate their data independently in a totally asynchronous way
21:05Morgawrhowever agents have to queue events
21:05bbloomseangrove: *shrug* either which way. it's not an official project & the direction is in flux
21:06biggbearhow to execute multiple tasks in the body of a function "(defn fun [] ((task1)(task2)(tark3)))"
21:06Morgawrand sometimes I need to issue "immediate" events (imagine a soft realtime simulation)
21:06Morgawr(events are just data transforms)
21:06bbloomah, i see. you have both async AND synch events?
21:06Morgawrideally everything should be async
21:06Morgawrso that's not a problem
21:06Morgawrbut for some stuff (like collision detection for example in a videogame) it needs a fast response
21:06bbloombut you want a priority queue?
21:06seangrovebbloom: Yeah, I thought it was dead for awhile, and it looks like it's diverged hugely, but the talk he gave a few months back seemed like he had basically done everything (more or less) and intended to try to get it back into master
21:06Morgawrbbloom: yes, exactly
21:07Morgawra priority queue is exactly the idea
21:07Morgawrlike a priority queue for agent events
21:07bbloomis your game genuinely multithreaded with concurrent processes like that? what's MUCH MUCH MORE COMMON is to have task parallelism, where you ahve one master thread that does scatter/gather on tasks to workers
21:07bbloomand does things like physics in parallel
21:07MorgawrI remember somebody in here wrote this https://gist.github.com/halgari/7028120 when talking to me as a way to emulate clojure agents using core.async, maybe a priority queue with this might be a cool idea
21:08Morgawrbbloom: I'm planning to write a "simple" game engine/proof of concept for a fully multithreaded game
21:08bbloomusually C++ bases games achieve that sort of thing by block-copying large arrays of data structures & giving each parallel process an isolated world. like "here's all my physics matrices" and "here's all my game state"
21:08Morgawras in, each single entity is an independent agent
21:08bbloomyou're probably better off having a single thread WITHOUT AN ATOM that's literally just a normal loop w/ the state in it
21:08bbloomthen sending off work and having the master thread block for multiple clients
21:09bbloommultiple workers* rather
21:09bbloominstead of trying to shove everything in to atoms or agents
21:09MorgawrI'm going for a different approach though, I'm trying to abstract away from the idea of a fixed update loop with a synchronized update step
21:09Morgawr(not sure if it's a good idea or not, yet, it's going to be fun)
21:09Morgawrtrying to follow Hickey's idea that the world shouldn't stop just because we ask it to
21:09bbloomwell surely your rendering has to be a loop of some kind right?
21:10Morgawragents take care of themselves and then there's two priority threads, one for rendering and one for sending "tick" events to agents
21:10Morgawryeah rendering is its standalone threads
21:10Morgawrqueries all the agents and runs a rendering function on them
21:10bbloomand surely your physics happens on a time step too, right?
21:10Morgawrthat one I still need to decide, technically yes
21:10bbloomso all your game objects are the agents?
21:10Morgawrthe idea is yes
21:10Morgawrall game objects are agents
21:11Morgawrsome are physical entities too so they are affected by a physics standalone/priority thread (like rendering or updating)
21:11Morgawrand I'd need to make sure those entities receive "immediate" (or pseudo-immediate) response
21:11bbloomi think you're much better off sticking everything in one big atom & then writing a very simple message dispatch system
21:11Morgawrbut agents != message dispatch
21:12Morgawragents make sure that the events are executed independently and in an ordered fashion in their own thread
21:12Morgawrwhich is exactly what I want
21:12bbloomexcept it's not, b/c you need to synchronize some message types
21:12bbloomagents embody a queue, but that implies the sender has no control once the message is queued
21:12Morgawrthe idea is, if I have an agent like (agent { :something 0 :something-else 1 :atom (atom { :data "whatever" }) })
21:12xuserbbloom: Bronsa's is this one? http://clojure.github.io/tools.emitter.jvm/
21:13bbloomyou have some central authority, and so you should implement it explicitly
21:13Morgawrthen I can retrieve the "atom" compoent of that agent, right?
21:13bbloomxuser: https://github.com/Bronsa/CinC
21:13bbloomMorgawr: right, i understand what you're trying to do, but i'm saying you'd be much better off to be able to call deref ONCE and get "the state of the world"
21:13Morgawrthe state of the world is just composed of multiple independent agents
21:14bbloombut what happens when you want to save the world state?
21:14MorgawrI mean, I know what you're trying to say bbloom and I agree with you, but I am trying to go in another direction and see what happens
21:14bbloomyou need to walk each agent & then save it
21:14bbloomyou also need to save it's queue
21:14bbloomagents are not magic
21:14Morgawrsaving the world state is just taking a "snapshot" of the current world
21:14bbloomif you need something that is sorta like agents, but isn't, then you can implement your variant
21:14Morgawras in, I don't care about events that haven't been processed yet
21:15Morgawryeah, I guess
21:15bbloombut then you're going to get dropped messages, if you save/reload
21:15bbloomwhich everything will need to account for
21:15Morgawrthat's a good point, but... does it matter? saving should only save the *current* state of the world and the resume/load function should take care to make it consistent
21:16bbloomthe question is: are messages in flight part of the world?
21:16Morgawreven in traditional game engines you don't just save the current state of the game, you just save a loadable representation of that data
21:16Morgawrno
21:16bbloomi'd agree with you that their not... but only in a loop-based model
21:16bbloomif you don't have "frames" so to speak, then there is no point in time you can break and say "the world is consistent without queued messages"
21:16bbloomyou would never be able to prove that property of your system
21:16Morgawryou raise a good point
21:17bbloomif you processed all messages every frame, you could discard them all and save the PREVIOUS frame
21:17Morgawrthe thing is... is it really a problem? answer: I don't really know :V
21:17bbloombtw, i make a good point b/c i've implemented save-anywhere in real games before ;-)
21:17bbloomit's hard.
21:17bbloomand holy hell do i wish i had clojure then!
21:17Morgawrthe thing is, if we wanted to "save" the game then we could broadcast a "save" event to all agents
21:17Morgawronce those agents receive that "save" event then we know that they can be shut down
21:17Morgawrbecause agents have ordered events
21:18Morgawrhence their event queue has been processed up to that point
21:18bbloomhow do you know when everybody is done saving? you need coordination
21:18MorgawrI mean, it might need to take care of a few thing but that'd be the gist of it
21:18Morgawryou drop down to a coordinated model
21:18Morgawras in, you can always read instantly the state of an agent
21:18Morgawryou only need to send a message to change its state
21:19bbloomwhat i'm suggesting is that you *start* with a coordinated model, since even if you had 10,000 threads an atom could handle it fine & then you build a simple ansynchronous system on top of that
21:19bbloomit's really quite easy to build some worker loops, especially if you use core.async
21:19Morgawrcoordinated models are boring :P the idea is to implement a completely abstracted and asynchronous model
21:19Morgawrelse I'd just go back to normal game development
21:19MorgawrI mean, the whole point of this project is to try it out
21:19Morgawrand see how it works
21:19bbloomMorgawr: that's only interesting if you're going to go DISTRIBUTED
21:20bbloomif you're not distributed, then you should take advantage of the fact that you have shared memory & fast coordination
21:20bbloomyou can still program in an asynchonrous model
21:20bbloombut it's one that is controlled by a synchronous overlord... you know, like how your operating system works :-P
21:20Morgawryes and no
21:20bbloomreal games tend to look a lot like operating systems anyway :-)
21:21MorgawrI mean, I totally agree, but still agents help providing a message queue of some sort
21:21Morgawrthe whole point is, I want to distribute events as actions performed by independent threads
21:21Morgawrand not as messages passed around
21:21Morgawrthere is no "message passing"
21:21bbloomwhat agents do is message passing :-P
21:21Morgawryes but not in the traditional distributed way (like in erlang)
21:22bbloom*shrug* ok, don't say i didn't warn you :-)
21:22Morgawrbut that's beside the point, I get what you mean. I guess I can consider looking at the implementation of agents (or even use core.async) and see if I can implement some sort of priority queue or something similar
21:22Morgawrthanks for the good insights btw ;)
21:22Morgawrthis is just a hobby project
21:22bbloomimplementing a priority queue with core.async is hilariously easy
21:23MorgawrI never personally used core.async but I can read up, I've been done a lot of reading as of lately about it and it's really cool
21:23bbloomit's just a loop with a queue argument. then in the loop body you mulitplex on reads from a channel, plus executing what's in the queue. then recur
21:24bbloomgood luck!
21:25Morgawrthanks ;) going to sleep now, got some good food for thoughts, night
21:29arrdembitemyapp: pig
21:29arrdembitemyapp: ping
21:51bitemyapparrdem: yes?
21:52arrdembitemyapp: your monad protocol library was...
21:53arrdemoh. fluokitten.
21:55bitemyapparrdem: yissss
21:56bitemyapparrdem: also: http://en.wikibooks.org/wiki/Haskell/Monad_transformers
21:56bitemyapparrdem: http://www.haskell.org/tutorial/monads.html
21:56bitemyappwith that, I am heading home.
21:56arrdembitemyapp: starting a new project and your comments about having a single set of basic operations repeated again and again are making me feel bad about my initial design.
21:56bitemyappI didn't want to make you feel bad :(
21:57bitemyapparrdem: juuuust...inspire you to seek greatness!
21:57_scapeI want to be able to use repl within my openGL app, I started an nrepl server within the opengl initialization but realize I cannot access that context still. How would I do this? Here's my error when running openGL functions from repl:
21:57_scapeException: class java.lang.RuntimeExceptionRuntimeException No OpenGL context found in the current thread. org.lwjgl.opengl.GLContext.getCapabilities (GLContext.java:124)
21:59_scapePerhaps I can save the current entry into nrepl to an atom which I can access from the openGL thread, but I don't know how to hook in to nrepl to grab this
22:10udoprogHey, I'm trying to use the following to read all expressions from an PushbackReader; http://pastebin.com/PqDXSrus - however whenever I encounter a comment it just returns the eof character, does anyone know why?
22:11arrdemudoprog: is the comment the end of the string?
22:12udoprogarrdem: no, I will try to put together a complete example using a ByteArrayInputStream and see if I can encounter the same issue
22:19akurilinAm I correctly thinking that list comprehension in clojure is possibly the cleanest way of working with list indexes?
22:19akurilinAs in, sometimes you're basing logic on the position of the item in a list
22:19akurilinand you really need that index
22:19akurilinCan I do better than for?
22:29amalloy&(doc map-indexed)
22:29lazybot⇒ "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
22:30akurilinamalloy, oh yeah I remember using that once, good reminder.
23:12arohneris there a libraryfn out there for taking an instance of a defrecord, and returning its constructor(s)?
23:12arohneri.e. (find-constructor Foo) returns ->Foo ?
23:14_scapeanyone have a link on how to implement a middleware for nrepl? i want to hook in to it
23:17jared314_scape: take a look at ritz project's middleware
23:17jared314_scape: https://github.com/pallet/ritz/tree/develop/nrepl-middleware/src/ritz/nrepl/middleware
23:18jared314_scape: and the nrepl readme is pretty good
23:18_scapethanks jared314
23:18_scapethe readme portion on the middleware didn't make much sense to me actually :-\
23:20technomancynrepl-discover has an example of middleware too
23:21_scapethx i'll check it out
23:26akurilinSo I discovered that caching stuff from DB at boot with def is not fun when running with an empty test database which you populate at a later stage
23:28akurilinIs there a more elegant way to generate unique random integers than by recursively smashing random numbers at a set until it's large enough?
23:31varloghi, i am using pmap to distribute a function over a list. is it possible to identify the particular thread id (e.g. thread 1, 2, 3)
23:36jared314arohner: you could look it up by name in the map returned from ns-public
23:37arohnerjared314: right, and then you need to munge "Foo" into "->Foo" and resolve it. I was just hoping for a library fn
23:38jared314arohner: (symbol (str "->" (.getSimpleName (type myinstance))))
23:38jared314arohner: yeah i don't know one
23:57amalloyvarlog: you could use a thread-local variable, although in general i would be cautious of anything that cares what thread it is
23:59amalloyeg, if you don't mind depending on useful, you could use https://github.com/flatland/useful/blob/develop/src/flatland/useful/utils.clj#L197 like (let [counter (atom 0), thread-num (thread-local (swap! counter inc))] (defn which-thread [] @thread-num))
23:59varlogamalloy: thanks for the tip. Basiclly I am tryig to make sure that each thread calls a different port
23:59varlogelse there will be a logjam