#clojure logs

2014-02-18

00:25logic_progwhere is tbaldridge?
00:25logic_progI have a core.async question
00:25logic_prog,(ns-lookup 'clojure-wizards 'tbaldridge)
00:25clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ns-lookup in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:25logic_prog,(ns-find 'clojure-sages 'tbaldridge)
00:26clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ns-find in this context, compiling:(NO_SOURCE_PATH:0:0)>
00:31ddellacostalogic_prog: why don't you ask your question and see if anyone else can answer it
00:32logic_progsure, https://groups.google.com/forum/#!topic/clojure/ApJPmJfijpU :-)
01:14kyledHey there! I'm trying to figure out the best way to determine how deep a list goes.
01:15kyledhttp://pastebin.com/raw.php?i=FjzZE1fv is the answer I came up with . I want to make it more succinct, and smaller if possible, any ideas?
01:15kyledcan the howDeep function be re factored into a tail-recursion call somehow?
01:18dsrx,(max 10 5)
01:18clojurebot10
01:19sm0ke,(def max min)
01:19clojurebot#<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)>
01:19kyledo, one lass function definition is always good =)
01:23kyledtechnically, i think i can remove the (if (seq? fl) part
01:24kyledso for (if (nil? .. i can just ask (if (notSeq? )) maybe
01:25TEttingerkyled, maybe take a look at how core.matrix does it
01:25kyledTettinger: will do! =) thanks
01:26TEttingerhttps://github.com/mikera/core.matrix/blob/develop/src/main/clojure/clojure/core/matrix/impl/sequence.clj hm...
01:27TEttingerhttps://github.com/mikera/core.matrix/blob/develop/src/main/clojure/clojure/core/matrix/impl/sequence.clj#L89 they do it by recursively checking each dimension, I believe scalars return 0
01:42seangroveIt's infuriating that most of the html5 tags don't seem to work with attributes properly
01:42seangroveYou have to call audioTag.mute() rather than <audio muted="true" />
01:56kyledTEttinger: whoops, didn't see your reply, willl look at the links =)
02:39szymanowskiis there a way to test arity of an anonymous function in clojure?
02:39devn,(#(count %&) 1 2 3 4 5)
02:40clojurebot5
02:40amalloyszymanowski: no
02:40voldyman,(count (list 1 2 3 4 5))
02:40clojurebot5
02:43szymanowskii'm trying to build an higher-order-fun that behaves differently accordingly to the arity of the given function
02:43szymanowskidoes it make sense?
02:43devn(defn foo ([x] ...) ([x y] ...) ([x y z] ...))
02:44szymanowskiyes i know this construct :) but it doesn't help
02:44szymanowskis
02:50sm0keszymanowski: you can write a macro which counts the arity
02:50sm0kebut it can be hairy if destructuring is involved
02:50szymanowskigreat, i will check this, thank you
03:14fredyrszymanowski: simplest would be to just wrap a macro to convert the args to a vector
03:14fredyr(defmacro wrapper [& rest] ..)
03:16szymanowskii will try that, thank you
03:16fredyroh, ofc you don't need to use a macro at all
03:16fredyr& rest works on defn just as fine
03:16lazybot⇒ #<core$rest clojure.core$rest@2835c8>
03:18fredyr(defn sum-times-nargs [& xs] (* (count xs) (reduce + xs)))
03:18fredyr,(defn sum-times-nargs [& xs] (* (count xs) (reduce + xs)))
03:18clojurebot#'sandbox/sum-times-nargs
03:19fredyr,(sum-times-nargs 1 1 1 1 1)
03:19clojurebot25
03:19TEttingernice fredyr
03:19TEttinger(inc fredyr)
03:19lazybot⇒ 4
03:19fredyr:)
03:28amalloyyou guys know you're not solving szymanowski's problem at all, right? he wants a function or macro arity, such that (let [f #(inc %), g #(+ % %2)] (map arity [f g])) returns [1 2]
03:28amalloywhich he can't have because functions don't know their arity
03:28szymanowskiactually the thing i'm trying to do is: (arity (fn [a b] ... )) => 2
03:28szymanowskiok
03:29szymanowskithank you amalloy :)
03:29amalloyszymanowski: i don't really believe that's what you want, because it only works if you put the lambda literal right inside the arity call (ie, in a context where you already know it takes two args)
03:29amalloy(let [f (fn [a b])] (arity f)) => 2 ;; you want this too, right?
03:30szymanowskiyes!
03:30amalloyright. that's what you can't have
03:30fredyr(dec fredyr)
03:30lazybotYou can't adjust your own karma.
03:30szymanowskiok :)
03:30fredyr:/
03:30amalloyyou can have the easy version, which only works if you already know the answer :)
03:30TEttinger(dec fredyr)
03:30lazybot⇒ 3
03:31TEttingerthere's always call with 21 args, then 20, then 19, catching all the exceptions it throws. but I wouldn't recommend it
03:31szymanowskiwow sounds dirty
03:31amalloyTEttinger: but what if the function accepts 8 args, and then throws an arityexception because it called something else with the wrong number of args?
03:31amalloyor when you call it with 20 args it deletes your hard drive
03:32szymanowski:)
03:32Pupnik_who do + and * give 0 and 1 with 0 parameters?
03:33eliyakmaths
03:33amalloybecause those are the answers that make sense, Pupnik_. 0 is the additive identity, and 1 the multiplicative identity
03:34Pupnik_thanks
03:35eliyakszymanowski: maybe this will be useful : http://stackoverflow.com/questions/3782970/how-can-i-display-the-definition-of-a-function-in-clojure-at-the-repl
03:39szymanowskithank you but i do not want to know the arity for myself calling the function, i want to know it when this function is passed to an higher-order-fun in order to make differents things based on the arity
03:39atyzHey all. I'm using a -> macro but I need to change the position of the value being passed around teh function. i seem to remember there being an as-> or something whcih allows you to define a var for the value being passed around. Does anyone recall this?
03:39szymanowski(as-> 1 x (inc x))
03:41fredyr,(doc as->)
03:41clojurebot"([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form."
03:42fredyror the diamond wand in swiss arrows, if you're looking for something even more funky
03:44zoldarszymanowski: do you have any practical example of a situation where a dispatch on arity would be needed?
03:45eliyakszymanowski: if you have control over all the functions involved, you could keep a record of how many args each takes in a Map. not sure if that's practical
03:47szymanowskithe function that i want to implement maps over a hash-map, if single arity fun is passed then apply this fun to all keys and all values, else if the given fun is arity two, map each map entries with it
03:50szymanowskihttps://www.refheap.com/41209
03:50szymanowskii would like to merge those two functions
03:53TEttingerszymanowski, what about fns that take 1 arg or 2 args
03:53TEttingeror variable args
03:53szymanowskihttps://www.refheap.com/41209
03:53szymanowskijust edit my paste
03:53szymanowskione helper function was missing
03:53zoldarszymanowski: just by the way, are you aware of reduce-kv?
03:54szymanowskii probably have to check that know
03:56TEttingerszymanowski, they seem like different concepts
03:56TEttingernot sure why you'd even want them under the same name
03:56szymanowskimaybe you're right
03:56szymanowski:)
04:06TEttingermy interpretation would be ##(let [kv-map (fn [f coll] (into {} (mapv (fn [[& kv]] (mapv f kv)) coll)))] (kv-map inc {1 10 2 20 3 31}))
04:06lazybot⇒ {2 11, 3 21, 4 32}
04:12dsrxtest test #(+ 1 3)
04:12dsrxtest test ##(+ 1 3)
04:12lazybot⇒ 4
04:12TEttingerhey dsantiago
04:12TEttingerdsrx sorry
04:13dsrx###(+ 1 %)
04:13lazybot⇒ #<sandbox12094$eval21574$fn__21575 sandbox12094$eval21574$fn__21575@f21ab5>
04:13dsrxhello
04:13TEttinger,``[]
04:13clojurebot(clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat)))
04:52allenj12hey im making a centroid fucntion and im a little stuck.. what would be the best way of taking in a vec of points [[1 1] [2 2] [3 5]] and returning the corresponding sums [6 8]
04:52bars0Hi all. I try to run nrepl in emacs but I got: "Lisp error: (wrong type argument stringp nil) get-buffer(nil) nrepl-sentile(#<process nrepl> "connection broken by remote peer"
04:53bars0I've copied my .emacs.d from windows to centos
04:53bars0on windows I hava oracle java 32 and on centos openjdk 64
04:53bars0Seems like emacs cannot get buffer name of nrepl
04:54bars0does anybody have same problem?
04:58ivanallenj12: (let [points [[1 1] [2 2] [3 5]]] [(reduce + (map first points)) (reduce + (map second points))])
04:58bars0Ok, when I start nrepl like this: M-x nrepl-jack-in, nrepl starts. But when I open .clj file first and then C-c M-j I've got error mentioned.
04:58ivannow wait a few seconds for someone to code golf that
04:59allenj12ivan: only works with specific dimension tho,
05:01ivan,(mapv #(reduce + %) (let [points [[1 1] [2 2] [3 5]]] (apply map vector points))) ; allenj12
05:01clojurebot[6 8]
05:02allenj12ivan: that will work!
05:10quizdri'm trying to figure out how to require a namespace with an alias, except for one function, which is refer
05:13alew(:require [my.namespace :as me]) ?
05:14quizdralew i figured it out. it uses both :as and :refer
05:15quizdr(:require [namesp :as myalias :refer [somefn]])
05:26voldymanhow salable is hiccup? my web app will get 500 concurrent users for about an hour, i don't want it to fail
05:26AeroNotixwhat webserver does it user internally?
05:26AeroNotixor is it something custom?
05:26AeroNotixHe
05:26AeroNotixJetty will handle that with ease
05:26voldymani'll run ningx in the front and lein ring uberjar
05:27voldymansince its luminus its jetty.
05:27AeroNotixSo should be fine.
05:27voldymanAeroNotix: the only problem i faced was very high CPU usage when testing on my computer
05:27AeroNotixhow did you test?
05:27AeroNotixhow did you generate load?
05:27AeroNotixif it's all local, then you fail hard.
05:27voldymanumm, wrote a script to fetch 4 pages * 200 users concurrently
05:28AeroNotixFail
05:28AeroNotixyou cannot test webservers all on the same box and expect to find any meaninful results.
05:28voldymanAeroNotix: why?
05:28AeroNotix^
05:28voldymani tried to run the same thing on a remote server to which caused the server to terminate the java process
05:28AeroNotixwell this is different
05:29AeroNotixYou mean you ran the jar remotely and generated load locally ?
05:29voldymanyes
05:29AeroNotixAnd what was the stacktracE?
05:29voldymanthere was none, it was a message like [memory limit reached]
05:30AeroNotixWhat was the spec of the remote machine?
05:30voldyman(there was no nignx in front though)
05:30voldymanits a shared server, i plan to run this on a cheap 5$ VPS (512mb ram)
05:30AeroNotixJetty uses a thread pool to scale load, afaik. So high peaks may cause high numbers of threads to spawn (do NOT quote me on that.)
05:31AeroNotix512mb ram for a JVM process is not going to cut it
05:31voldymanjvisualvm agrees with you
05:31AeroNotix*especially* if you have high numbers of concurrent users
05:31voldymanAeroNotix: where should i deploy, running cost is a bit thing
05:31AeroNotixWhy?
05:31clojurebotWhy is the ram gone
05:31AeroNotixif you have high peak, you have a need to spend money.
05:32AeroNotixYou can't have ponies
05:32AeroNotixI would at least have 2gb for a server running a jvm process.
05:33voldymanAeroNotix: what specs would you recommend? or a PaaS?
05:33voldymanoh, that would be too costly
05:33AeroNotixAWS using whichever is 2GB.
05:33AeroNotixvoldyman: what's the application doing?
05:33AeroNotixa 2GB box is pittance
05:33voldymanmostly fetching data from a sqlite db and generating hiccup/json response
05:34voldyman(i plan to move to Postgres or mysql later)
05:34AeroNotixvoldyman: you know sqlite doesn't deal with concurrency well, right?
05:34voldymanyes,
05:34AeroNotixGood.
05:34voldymanits just for testing, can easily swap db's
05:34AeroNotixSo, you have to choose between price and performance. You cannot, cannot, cannot, cannot have both.
05:34AeroNotixThere are no free ponies in programming.
05:35voldymanAeroNotix: the only thing that bothers me is that if this were written in php or python, i wouldn't have faced any problems
05:35AeroNotixvoldyman: you would also be writing in PHP
05:35AeroNotixso there's that
05:36AeroNotixIt's an inherent problem with the JVM, very well known.
05:36voldymani wanted to use lisp for real world applications but as you said there are no free ponies
05:36voldyman*too well known*
05:36AeroNotixExactly. You're making the choice between horrible languages (Python's ok though) and a somewhat higher system requirements
05:37voldyman:( i spent a week writing this one and had planned another that was supposed to start an hour a go
05:38AeroNotixvoldyman: just get a m3.medium on AWS. It's really cheap
05:39AnderkentAeroNotix: depending on the type of threadpools, peaks might either spawn additional threads or simply queue more jobs for the existing threads to pick up
05:39AeroNotixAnderkent: gotcha, ok
05:41voldymanAeroNotix: so to conclude, Jetty can handle 1000 connections easily, it just needs loads of RAM (?)
05:41Anderkentand yeah, I agree with the 2gb recommendation. Memory is cheap
05:41AeroNotixvoldyman: pretty much, but 2gb isn't 'loads'
05:41AeroNotixit's a pretty trivial amount of memory
05:41AnderkentIt's not even that. There's just a significant memory overhead; I wouldn't expect 1000 connections to eat much more ram than 10
05:41AeroNotixvoldyman: is this a school project or something you don't have business funding for?
05:42Anderkentbut running jvm on 512mb is an exercise in futility
05:42voldymancollege project. no funding
05:42Anderkentrun it on your home machine? :P
05:42AeroNotixNice idea
05:42ziltiIs there a way to execute a piece of code on the main thread while I'm on another thread?
05:42voldymanits for conducting tests around the college
05:43voldyman(+ i am in india, so internet is not good enough)
05:43AeroNotixUnfortunate but that is just your roll of the die in this world.
05:43Anderkentzilti: you'd have to have the main thread watch some kind of queue and pick up tasks from it.
05:43Anderkentvoldyman: I think you can find a 2 gb vps much cheaper than amazon
05:44AeroNotixDigitalocean's is $20/mo
05:44voldymanAnderkent: that would be awesome
05:44AnderkentI'd expect 10$ / mo at most, probably 5
05:44AeroNotixAnderkent: lolwat
05:44AeroNotixwhere?
05:44clojurebotsee logs
05:44ziltiBecause the problem I have is that Clojure seems to lose track of what's "require"d as soon as I'm on another thread
05:44AeroNotixzilti: post evidence
05:45Anderkentzilti: that's unlikely; are you maybe switching namespaces?
05:45voldymanoh shit, Anderkent i could run it on 5$ instance most of the time and switch to 2Gig instance and use hourly rantes
05:45AnderkentAeroNotix: quick google brings up http://www.2gbvps.com/ for example
05:45ziltiAeroNotix: Well if this is not the normal behaviour (other thread wasn't started by Clojure code) then I have a problem with my code ^^
05:45llasramzilti: Which namespaces are loaded is definitely global
05:45voldymanDigitalocean 2gig vps is 0.030$/hr
05:46llasramzilti: How is the other thread started?
05:46Anderkentllasram: doesn't clojure use its own classloaders though?
05:46Anderkentif you start a thread in java you might not have access to that classloader? not sure, guessing here
05:46llasramThere are some weird situations you can get into if you start calling Clojure code before the Clojure runtime is initialized (static class initializer)
05:46ziltillasram: If I haven't overlooked anything, by the Reactor framework (using Meltdown)
05:47llasramAnderkent: the custom class loaders are only used for defrecord/deftype by-name classes. You can get yourself in trouble with AOTed references to named classes, but normally not
05:47ziltillasram: So what's happening is that I have a function that gets called in a Meltdown thread apparently, and when evaluating code there Clojure can't resolve symbols relying on "require" statements in the ns-form
05:48AeroNotixzilti: can you reduce it to a test case?
05:48llasramzilti: By "evaluating" do you mean literally "calling `eval`"?
05:48ziltiAeroNotix: Oof. Could get very tricky
05:48ziltillasram: Yes.
05:50Anderkentvoldyman: AeroNotix: https://bluevm.com/cart.php?gid=42 scroll down to BLUE4, 2gb for $7USD/mo
05:50llasramzilti: Ah. Yeah, so the current namespace _is_ a per-thread-binding dynamic var (`*ns*`), and there is some complexity there.
05:50ziltillasram: Okay... Well I get back to tinkering around then. Thanks!
05:51AeroNotixAnderkent: and do you have root access on those?
05:51AnderkentAeroNotix: don't know
05:51voldymanAnderkent: woah thanks.
05:51AnderkentI mean I assume you get what you pay for, i.e. not much :P
05:51llasramzilti: Oh, no need to wander off. I just need to drink some more of this coffee before remembering how this works w/ `eval` :-)
05:51AeroNotixI'd probably re-evaluate whether I need eval in the first place.
05:51Anderkentllasram: zilti: surely (eval '(do (in-ns 'my.ns) (magic))) should work then?
05:52llasramAnderkent: Probably
05:52ziltiAnderkent: Thanks, I'll try that!
05:52llasramOh, no!
05:52llasramWell, maybe
05:53AeroNotixzilti: can you not solve the problem without eval?
05:53ziltillasram: ??
05:53lazybotzilti: Uh, no. Why would you even ask?
05:53llasramSo in normal Clojure code you use syntax-quote, and the forms are expanded to the namespace active at compile time
05:53llasramSo even though *ns* might be some arbitrary other namespace when `eval` actually runs, all the symbols are already expanded to point at what was available in the namespace of the code containing the `eval`
05:54Anderkentha, fair point
05:55ziltiAeroNotix: Hmm. Maybe, I don't know... I'd have to rewrite a lot of stuff
05:57llasramAnderkent: Quick REPL-checking suggests your approach works, which makes sense. If the symbols are not namespaced and not locals, the compiler resolves them against *ns*, and the `do` hack causes the compiler to consider each form w/in a `do` as a separate top-level form
05:57llasramzilti: So there you go! I am also curious though -- why `eval`?
05:58ziltiAnderkent: Usin "in-ns" now gives me "IllegalStateException: Can't change/establish root binding of: *ns* with set"
05:58Anderkentllasram: but you'd expect it to work without (in-ns) if I used ` instead of '
05:59ziltillasram: Well I have a helper macro that writes a function which in turn uses the arguments given to add them to the code before evaluating it
05:59llasramzilti: Why not just have the macro-expanded code be compiled normally?
05:59ziltillasram: Here's the macro in question: https://www.refheap.com/41226
06:00llasramOh my. You do not want this
06:00ziltiHmm.
06:01Anderkent,(.start (Thread. (fn [] (eval '(do (in-ns 'user) (println 'foo))))))
06:01clojurebot#<SecurityException java.lang.SecurityException: no threads please>
06:01Anderkentbah
06:01Anderkentanyway, that's a repro
06:01llasramzilti: You're using a macro to generate a function which calls `eval` every time the function is invoked?
06:01ziltillasram: Yes, it's invoked once for every UI element it has to generate
06:02llasramWhat is it about creating these elements which necessitates `eval`?
06:03ziltillasram: Basically 1. calling "cell" with the argument id# and 2. replacing those :%ID% things.
06:04llasramOk, but why can't you do that in a function?
06:04llasramWhy do you need to `eval` new code?
06:04ziltiWell how else can I do it when I want to do it inside that macro?
06:05AeroNotixjust call the function?
06:07llasramzilti: Maybe it would help if you also show an example use of this macro
06:10ziltillasram: Updated https://www.refheap.com/41226
06:12llasramzilti: I don't believe anything in the macro needs to be a macro, or the evals need to be evals
06:13llasramThe pre-walk for the `cell` forms could just be a local function. The `%ID%` could just be a normal local identifier
06:14ziltillasram: How a local function? The 'cell' forms aren't necessarily on the top level, they can be scattered throughout a nested form
06:16llasramYes, but lexically within the form. If that whole form were in a function which took a function-argument `cell`, then your `(cell ...)` forms would just be calls to that function
06:18llasramIf you want to just hack `eval` to work -- you can try wrapping at some level with something like `(binding [*ns* *ns*] ...)`
06:18llasramBut I think you're very much on the wrong track
06:18ziltillasram: You mean that the "cell" forms would be calls to another function (which they already are btw, cell is a function) to retrieve the id? I'd imagine hell of a lot of messy code for that?
06:19llasramzilti: Uh. Versus a macro which creates a `defn` which calls `eval`? :-)
06:20ziltillasram: about 20 lines of code versus probably 50 lines of complicated code?
06:21ziltillasram: Point is I can't really imagine what you have in mind
06:21llasramAlas, for lack of telepathy. I've exhausted my IRC helpfulness budget for the morning, I'm afraid, so at this point must just wish you luck!
06:22ziltiThanks
06:34AeroNotixis anyone using lein-ver?
06:35AeroNotixI'm having trouble with it telling me it cannot find the VERSION file in an uberjar
06:35llasramAeroNotix: Well, is VERSION ending up in your uberjar :-)
06:36AeroNotixllasram: looks like it, let me triple chjeck
06:37llasramHuh. That's an odd plugin. I'm not quite clear on the value
06:37AeroNotixllasram: it makes programmatically bumping versions easier
06:37AeroNotixso I can have my CI do the release/tag/deploy cycle for me
06:37AeroNotixand then be able to inject the version into my release artefact, too
06:37AeroNotix(well that's the idea)
06:38llasramSo you let your CI system determine the version to release the artifact?
06:38AeroNotixllasram: no, my CI bumps the :patch version and deploys to stage
06:38AeroNotixI manually bump :minor/:major depending
06:38AeroNotix:minor when I release to prod
06:38AeroNotix:major when we hit a new release stage
06:39llasramWell, I consider bumping the minor to be "determining the version," but point taken
06:40llasramIs that how your CI/deploy/release cycle works for other languages?
06:40AeroNotixllasram: kind of, we homegrew the tooling for that since there are no tools out there for it (Erlang)
06:40AeroNotixllasram: and yes, the VERSION file is in the jar
06:41AeroNotixI jar xf'd the jar file and even read the VERSION file. So it's there.
06:41AeroNotixCaused by: java.lang.IllegalArgumentException: Not a file: jar:file:/home/xeno/dev/payments/target/payments-0.0.1-standalone.jar!/VERSION
06:41sm0kehello hello
06:41AeroNotixllasram: I wonder what that !/ comes from?
06:42llasramAeroNotix: That's the syntax Java overlays on URLs to indicate a file w/in a jar
06:42AeroNotixllasram: ok, but the file is there.
06:42llasramBut the error points at the problem
06:43AeroNotixllasram: which is?
06:43llasramThe entry is in the JAR and (presumably) accessible by the URL, but is not a *file*
06:43llasramFile == OS file on a filesystem
06:43AeroNotixok
06:44AeroNotixhmm, so I think maybe this project didn't test with uberjars?
06:44AeroNotixbecause it works in `lein repl'
06:45AeroNotixas in, it should use getClass().getResource(...)
06:45llasramThat seems very likely -- This code is broken: https://github.com/jgrocho/lein-ver/blob/master/src/lein_ver/version.clj#L5
06:45llasramAeroNotix: Well, it needs to do that effect, but not exactly that
06:45AeroNotixllasram: exactly what I was thinking
06:45llasramIn the code posted, just dropping the `file` would work
06:46AeroNotixsec
06:46llasram`io/resource` does the `.getResource()`, returns a URL, which `io/reader` knows how to open
06:46AeroNotixok gotcha
06:46Anderkent(inc llasram)
06:46lazybot⇒ 17
06:46Anderkentfor going over budget
06:46llasramHaha
06:47llasramI got curious about the CI deployment process :-)
06:47Anderkentyeah I need to figure that out myself, currently doing everything by hand and that seems error prone
06:47AeroNotixllasram: it works for us. It means that we always know what's running in production.
06:47Anderkentplus, having travisci push snapshot builds from master would be so nice
06:47AeroNotixAnderkent: it is (though we use jenkins)
06:48AeroNotixllasram: yeah that fixed it
06:48allenj12hey, ive been using clojure for a while now and ive been mainly using light table for learning and its been great. but i wanna move on to a more advanced editor. ive never used either emacs or vim before but would one be better for clojure than the other?
06:49llasramI considered having our system manage versions, but rejected it for libraries, in part because it seems to be very uncommon and little tooling for any language supports automatically altering versions
06:49Anderkentmildly off-topic: I always feel so naughty when I hand-edit a third party clojure jar in my maven repo just to try something out. Tee-hee
06:49carkallenj12 : emacs is easier to get into and has probably better support for clojure
06:49Anderkentallenj12: I think the consensus is that emacs is a bit better, but probably not enough for someone well versed in vim to switch. They both get the job dnone
06:49jonathanjivan: that solution you gave earlier (summing columns in a matrix) seems kind of verbose, is there not a less wordy solution?
06:49Anderkent(said as a vim user)
06:49llasramI'm pretty happy with where I ended up though -- libraries have version numbers managed by humans, but just changing the version number in a commit triggers a release
06:50Anderkentllasram: oh, that's pretty cool. Is that specific to some ci system?
06:50carkallenj12 : there is also an eclipse plugin which is now very good
06:50allenj12hmm cool so ill try emacs then. emacs dosnt have live coding just to make sure right?
06:50jonathanjivan: my Python solution ended up being pretty terse, surprisingly: map(sum, zip(*[[1, 1], [2, 2], [3, 5]]))
06:51allenj12cark: hmm cool ill check that one out to
06:51Anderkentallenj12: not to the same degree as LT, I think
06:51carkallenj12 : the name of the plugin is counterclockwize
06:51llasramAnderkent: It's specific to the company-internal CI tooling glue I wrote, yeah :-)
06:51Anderkentbah :P
06:51Anderkenthave you not heard of code reuse!? I'd totally like to reuse your code. :P
06:52allenj12Anderkent: dam :( lol i guess it will be good enough tho although i really will miss it
06:52carkallenj12 : in emacs, you have a live repl and completion using cider
06:52allenj12cark: ahh kk, would you recommend eclipse or emacs if im split on the two?
06:52Anderkentwell, eclipse is easier to get started with I'd think
06:53llasramAnderkent: Haha. I've thought a few times about cleaning it up for an open source release, but I'm not sure how general it is. It pretty directly codifies all of my teams practices w/o much room for customization
06:53carkallenj12 : i'm using emacs... but it's surely isn't as easy to get into than eclipse
06:53AeroNotixpoint and click to create codez
06:53Anderkentllasram: my general answer to such questions is publish it anyway, even if it's too specific it can serve as a template for other people to start with
06:53carkallenj12: in particular, the setup is quite a lengthy process
06:54allenj12Anderkent: what about long term tho will i be happier with emacs? i have an easy semester so jumping into a bunch of things like slackware
06:54allenj12cark: o i see
06:54carkallenj12:long term, go for emacs ... it will serve you well over the years
06:54carknot only for clojure
06:54Anderkentallenj12: depends. Are you planning to do java development? then you want to learn eclipse (or intellij) anyway. Are you planning to manage your life email and stuff from emacs? Then learn emacs :P
06:55Anderkent*life, email, and stuff
06:55sm0kellasram: hello, do you have plans for providing a higher level api on top of abracad?
06:55carkbut then again, if talking long term... vim is worth learning too =)
06:55llasramsm0ke: In what sense?
06:55Anderkentmore seriously, I recommend learning at least one command line editor for at least basic competency, they make life easier
06:55llasramsm0ke: I've quietly added a few under-documented schema-definition helpers
06:55AeroNotixAnderkent: nano
06:56sm0kellasram: like consolidating data files, vertical partitioning data according to schema
06:56AnderkentAeroNotix: eh, if you have to. the point is being able to do simple changes to config files / whatever on a bare system
06:56Anderkentreading logs, debugging data issues, etc.
06:57allenj12Anderkent: lol nano :) but yea i think i will give emacs a try then. i mean light table is pretty minimalistic so i doubt it will take me long to get me back at that point
06:57llasramsm0ke: I hadn't considered it before, but a datafile-consolidation function might make sense -- that's something I find myself doing relatively frequently on the results of MR jobs. Not sure what you mean by the latter though
06:58carkallenj12:follow the install info from the cider github page to the letter and it should go qell
06:58carkwell*
06:58mark[oz]hey guys... just curious how i can use a function in my core.clj file (namespace is robot.core) in the REPL in my lein project and call a defined function (read-file) ??
06:58lazybotmark[oz]: Uh, no. Why would you even ask?
06:59allenj12cark: awsome thanks!!
06:59sm0kellasram: so if a avro schema is type which is union of many subtypes it would be great i could write data to a path , and each subtype goes to its own directry
06:59sm0kellasram: like namespace/typename
06:59llasramOh. Huh
06:59llasramI don't know... That one feels out-of-scope to me, but that may just be because I haven't needed it :-)
06:59Anderkentmark[oz]: run (use 'robot.core) in your repl
07:00sm0kellasram: also i wanted to ask if you are using it atop hdfs?
07:00llasramsm0ke: Yep
07:00Anderkentmark[oz]: or you can tell lein that robot.core is your main ns and then it'll automatically load it and switch to it when you start a repl
07:00llasramsm0ke: Ooof, which is something I need to add -- right now there isn't a clean way to read Avro files directly from HDFS
07:01llasramsm0ke: I keep working around it using Parkour's ability to `reduce` a dseq backed by an Avro Hadoop InputFormat
07:01quizdrif you are interested in the side effects of the map function in a map rather than the actual sequence that map returns, then you should just wrap map in dorun, right? or is there a better alternative?
07:01mark[oz]Anderkent: I've set :main in my project.clj file, and when i load the repl the namespace is robot.core =>
07:01Anderkentthen you should be able to just call your functions in there
07:01sm0kellasram: oh ok thats right, but write is fully supported?
07:01mark[oz]Anderkent: but when i (read-file "afile") I receive "CompilerException java.lang.RuntimeException: Unable to resolve symbol: read-file in this context"
07:02AeroNotixllasram: aha, stupidly I just sent a pull request for this change. But it seems it's already there. Weirdly it's not up on clojars, they probably forgot to do a release.
07:02mark[oz]Anderkent: I've defined read-file like so (defn read-file [] (dostuffhere))
07:02sm0kellasram: so how is that the data-file-wrtier can be given a hdfs:// path too?
07:02llasramsm0ke: Yeah, write is fine. Avro can write to any old OutputStream, but needs it's own SeekableInput for input
07:02Anderkentmark[oz]: do you get any errors on repl startup? I'd check for typos
07:03llasramsm0ke: Well, you can open an output-stream on it via any of the HDFS interfaces. I forget if Hadoop registers a Java URL handler for `hdfs://`, although I think those are read-only?
07:04llasramsm0ke: And Parkour adds Hadoop `Path` handlers to the Clojure IO functions, so you can just call `io/output-stream` on a `Path`
07:04mark[oz]Anderkent: I've got an error I'm trying to work through in that file. It's not within that function though... will an error in one function render each function within that namespace unavailable?
07:04Anderkentmark[oz]: it might if it stops the namespace from compiling
07:05sm0kellasram: nice, is that done internally via extend-type?
07:05llasramAeroNotix: Huh, really? The github link I sent was from me just poking at the source in master. That's weird
07:05mark[oz]Anderkent: thanks.. I'll have another look at cleaning that namespace up
07:06llasramsm0ke: Yep -- clojure.java.io internally uses a few protocols and type-based multimethods for everything, so they're all extensible to new types
07:07sm0kellasram: so i wanted to ask if it makes sense if instead of writing to individual files, abracad can write datafiles to a folder location? which could be then merged into each other
07:07sm0kellasram: i mean apart from writing to*
07:09mark[oz]Anderkent: you were right. it was a compilation error... thanks for your help
07:09llasramsm0ke: I'm not really clear on what that would mean, and I don't think it's a use-case I've had yet myself. Is this something you're doing currently yourself?
07:11sm0kellasram: yea kind of, i just think that append to a single file is not as efficent as writing to a number of files and moving them under a common location
07:11sm0kellasram: although i may be wrong,
07:11Anderkentsm0ke: shouldn't matter unless your file system is degenerate
07:12Anderkentuhm, or unless you have tons of threads competing for access to the file I guess
07:12allenj12cark: hey cider has it own keybindings im assuming?
07:12llasramsm0ke: Yeah, like if you have multiple threads?
07:13sm0kellasram: yes, which is typical if you filesystem is hdfs, which is meant to have writes from different machines probabaly at same time too
07:13llasramsm0ke: You can already just have each thread write to a file in a directory, so yeah -- just not quite picturing what extra functionality in Abracad would do
07:13sm0kellasram: well yea abracad does what its supposed to, its clean
07:13llasramsm0ke: I see. For that case, for all my uses so far, I'm producing that sort of output from Hadoop MapReduce, which handles that layer for me
07:14llasramAre you manually distributing tasks across a cluster somehow?
07:14sm0kellasram: so how do you write data to hdfs which you are using in your mapred jobs?
07:15llasramsm0ke: Most of our ETL processes are themselves MR jobs :-)
07:16atyzszymanowski: thanks, I got distracted taking my father to the airport
07:16szymanowskinp :)
07:17llasramsm0ke: For our main data feed, our appliances push data to S3. I have an MR job which gets a list of S3 *URLs* as input, then reads them, parses the binary format, and emits normal MR output to the Avro output format
07:18llasramWe do have one feed which locally writes out files, but that one is relatively tiny -- just one serial process keeps up with it fine
07:19sm0kellasram: makes sense, i see you do not really require to handle writes to S3
07:20llasramYeah. We just use S3 as a reliable hand-off location. Amazon has better uptime than we care to manage at the moment :-)
07:20sm0kellasram: makes sense, thanks
07:21llasramnp
07:21sm0kellasram: so you mapred cluster also runs on aws ?
07:22sm0keyour*
07:24sm0kehmm stupid question. it should, it would take insane amount of time for mappers otherwise to fetch blocks
07:31llasramsm0ke: Actually, no. We just bounce the data through S3, so everything after the initial ETL job uses local cluster storage
07:34sm0kellasram: so the whole data is copied on s3 as well as locally?
07:35llasramsm0ke: Kind of? It just passes through S3. We delete the S3 version after copying it down into our local cluster
07:35sm0kehmmm, whats the denefit of having s3 in between then?
07:36sm0kebenefit*
07:36sm0kei mean you are not useing it as data backup also
07:37llasramJust uptime of the service. The appliances need something to push to. We'll eventually just provide a service ourselves for them to push to directly, but right now there are other things we want to spend time on instead of making a reliable upload service which handle large bandwidth bursts
07:38sm0kehmm makes sense
07:38sm0kespecailly with the recent ddos attacks,
07:38sm0ke500GB is normal they say
07:40mark[oz]_hey guys, one last question before i get to bed. when I lein repl, I can (-main) and I get some output due to the println, but when i run it from the command line I don't get anything. http://pastie.org/8745170 is the code... can someone explain what's going on here?
07:41llasrammark[oz]_: `for` returns a lazy sequence. When you run it in the REPL, the REPL forces the sequence to print it, causing the `println`s to evaluate. When run from the command-line, nothing forces the evaluation, so nothing happens
07:41llasrammark[oz]_: Try changing `for` to `doseq`
07:41sm0keone last question , llasram , how is the data copied into local systems is it incremental or batch?
07:42llasramsm0ke: Batch right now. It's uploaded in batch, so it (mostly) makes sense to retrieve in batch
07:43sm0kellasram: no i mean, batch as in the WHOLE data is copied again or just new batches of data
07:43llasramUm, the latter :-p
07:43sm0kehaha
07:43mark[oz]_llasram: thanks for the explanation! that makes sense
07:43sm0keok thanks
07:43sm0kelater!
07:44llasramlater!
07:57mdrogalisMorning.
08:05CookedGryphonHey, does anybody have any ideas about how to profile core.async code in a sensible sort of a way
08:06CookedGryphonwithout just firing up visualvm - i find the output pretty incomprehensible
08:07CookedGryphonI sort of want to look at it from a go-block level, see what is doing a lot (i.e. I have written badly and is spinning in a loop) vs sitting there locked, etc
08:07CookedGryphoncan I get at the underlying state machine and track that sort of thing?
08:19Anderkent]lunchCookedGryphon: hm, you could try timbre, but I think you'd have to manually expand the profiling macros (because async won't let you do (profile (<! chan foo))
08:19CookedGryphonAnderkent]lunch: wouldn't that be weird, because it would be split across invocations of the state machine.......
08:19CookedGryphonor something
08:20CookedGryphonalso, I don't really want to go through allll my code inserting (profile ...), because then I would want to remove it
08:20CookedGryphonand i'd like to leave this as an option to turn on and look at at any time
08:20Anderkentwith timbre you don't have to remove it, you just change your logging level and it goes away :
08:21AnderkentI think the state machine would be transparent to timbre
08:21Anderkenti.e. it'd track time spent while parked as time of execution
08:21Anderkenthard to say if that's what you want or not
08:21CookedGryphonAnderkent: yeah, that's really not what I want
08:22CookedGryphondoing that, the most efficient functions which just sit there parked would show up as taking most time!
08:22Anderkentsure, so just look for functions with most invocations rather than most time spent
08:22Anderkentor don't wrap parking ops in profile
08:24CookedGryphonhmm
08:24AnderkentI guess I'm not sure what you're trying to find out; intuitively the costly functions (i.e. ones worth profiling) shouldnt live in go blocks, just be called from one. Is that intuition wrong?
08:25CookedGryphonyes that's correct - if I have coded it right :P
08:25AnderkentI haven't used core.async much, but always thought of it more as a communication mechanism than a processing engine
08:25Anderkentah :P
08:25CookedGryphonthe situation that's made me think of this
08:25CookedGryphonis I currently have a system which is getting hot while it should be idling
08:25Anderkenthm. Log more? :P
08:25CookedGryphonmaking me think that in one of my go-loops I'm accidentally recurring without doing any work
08:25CookedGryphonso it just spins
08:26CookedGryphonwhich would be easy to see if I could keep track of what's recurring when
08:26CookedGryphonI might just write a variation on go-loop which does just this
08:26Anderkentright, I see your point. You could swap your go blocks for thread blocks and then use a jvm profiler to see where the threads are spinning
08:26CookedGryphontracks the number of invocations and sends it off to riemann or something
08:27CookedGryphonI'm actually on android, and the profiling isn't great
08:27AnderkentI guess I don't know how big your app is; my intuition is just go read your code :P
08:27Anderkentbut if thats not feasible, sorry; can't help you
08:28CookedGryphonI think I'm going to tweak a go block
08:46szymanowskiis there a way to have wildcard in multimethod dispatch values?
08:46szymanowskidoes core.match can help on this?
08:46Anderkentszymanowski: as in just a catch-all method? use :default as the value
08:47szymanowskiyes i know that but it would be great to have wildcards
08:49Anderkenthm, can you provide an example? I guess I've never bothered with complicated hierarchy multimethod (always exact match, either on keyword or class)
08:49mdrogalisszymanowski: Arbitrary wild cards in multimethods: no
08:50szymanowskiok is there any implementations of sush a feature somewhere?
08:50szymanowskisuch
08:51mdrogalisszymanowski: Not that I'm aware of. But there might be.
08:51AnderkentI don't think so; seems a very weird thing to do to me
08:51szymanowskiwhy?
08:51clojurebotszymanowski: because you can't handle the truth!
08:52Anderkentit just doesnt fit the way I think of multimethods, I suppose.
08:53szymanowskiyou're maybe right i will think more about it
09:24quizdris it necessary to compile a source file before you require it another source file? the require call itself will not compile it for you?
09:24quizdrit appears to be the case.
09:25stuartsierraquizdr: `require` will compile & load the source file for you. `compile` is only necessary for Ahead-of-Time (AOT) compilation, which saves compiled .class files on disk.
09:26sritchieseangrove: hey; I'm working through it now, I can show you the not-quite-working-yet code
09:26sritchieseangrove: https://github.com/paddleguru/om-timer
09:26quizdrstuartsierra i get symbol not found errors relating to functions in a required namespace. when i go into that required namespace's source file and do a control-c control-k to compile that file, then go back to my original file, the issue is resolved.
09:27Anderkentquizdr: was that file required before and then edited? `require` will not reload a file from disk if it's already been loaded
09:28stuartsierraquizdr: clean out your compiled files (lein clean) and start a new repl
09:29quizdrstuartsierra anderkent would it make a difference that this other file I am requiring has been "lein install"ed previously and is not in my current project? would that require that I compile it separately?
09:30sritchiequizdr: that can happen from AOT compilation
09:31quizdrsritchie so when i restart a repl i will probably need to recompile any sources that are not in my project but i am requiring, yes? I assume AOT is in play here since perhaps that is what lein install does?
09:31sritchiequizdr: I've only seen that problem show up when AOT compilation's at play, yes
09:32sritchieand only then when you have some dependency mismatch
09:32sritchie(ie, you have a diamond dep, where you're requiring some version of a library, and the code you're requiring is compiled against a different version)
09:32sritchieif you fix the mismatch in your project or remove the AOT compilation you won't have to recompile
09:35CookedGryphonaphyr: Hey, I'm trying to use your riemann-clojure-client and I'm getting an issue when I AOT compile because IDref is defined twice - once in clojure and once in the riemann-java-client
09:36CookedGryphonis that okay on the jvm? (I'm using android + dexer which complains and falls over)
09:38Anderkentis that IDref with the same qualified name? Then I would expect it to break in every jvm
09:38Anderkent(if they're loaded in the same classloader)
09:38CookedGryphonAnderkent: yeah it appears to be exactly the same name
09:39Anderkentexcept riemann-clojure-client seems to depend on riemann-java-client and not define its own IDref
09:39Anderkentso I think you're having a classpath issue or something
09:41CookedGryphonIDref is a clojure class - clojure.lang.IDRef
09:42CookedGryphonwhich riemann-java-client seems to have pulled in
09:42Anderkenthm, can you post exactly what error you're getting?
09:43CookedGryphonUNEXPECTED TOP-LEVEL EXCEPTION:
09:43CookedGryphonjava.lang.IllegalArgumentException: already added: Lclojure/lang/IDeref;
09:43Anderkenton refheap pastebin or whatever
09:43CookedGryphonthere's a stacktrace, but it's just internal dexer stack
09:43Anderkentdo you know what your exact classpath is?
09:44Anderkentdo you for example have multiple versions of clojure on your cp?
09:44CookedGryphonI already said, this is defined in riemann-java-client (a dependency of riemann-clojure-client) as well as in clojure itself
09:45CookedGryphonso I want to know if this works for anyone
09:45Anderkentah, right I see it now
09:46Anderkentthat's a very weird thing to do
09:47Anderkentit does load for me on the jvm, the secondary implementation is probably never picked up
09:48Anderkenti.e. when the jvm is looking for a clojure.java.lang.IDeref.class file on the classpath, it finds it in the clojure jar and stops looking
09:54dnolen_sritchie: btw, it's not possible to reproduce your issues, even with lein cljsbuild auto, timer button always works for me.
09:54sritchiednolen_: yeah, saw that note - I get it every time, even after nuking .repl, out, target, lein cljsbuild clean -
09:54dnolen_sritchie: I'm inclined to close your ticket. One thought is that weird stuff happens if you have multiple lein cljsbuilds running at the same time - easy for this to happen.
09:54dnolen_sritchie: whatever it is, I'm very skeptical it's Om related.
09:54dnolen_sritchie: but hard to tell you have a complex setup and not a minimal case.
09:55sritchiednolen_: yeah, trying to reduce it now. Thanks a lot for taking a look, and feel free to close - I'm working on pushing the example to heroku,
09:55sritchieand cleaning out my .lein/profiles.clj
09:55sritchieto make sure no extra code is getting in the mix. still shows up every time for me
09:55dnolen_sritchie: Chrome?
09:55sritchieyeah, and firefox
09:57dnolen_sritchie: yep if I edit, wait for recompile and refresh Chrome & FF, I can always start stop the timer
09:57sritchieand no errors in the console?
09:57dnolen_sritchie: no errors
09:57sritchiednolen_: the timer was toggling, and I'd see the numbers change like they're supposed to,
09:58dnolen_sritchie: I do a goog.string multiple require error when the app loads, but seems unrelated to whatever problem you are having.
09:58sritchiethere's something goofed about my setup, whether it's the way I initialize cljsbuild auto and lein repl :headless in separate terminals,
09:58sritchieor the repl process...
09:58sritchieyeah, I see that too, but that showed up when things were working as well
09:59dnolen_sritchie: k closing for now, feel free to open a ticket you have a more minimal case. More than happy to take a look when you do.
09:59sritchiednolen_: you know, maybe it's the different clojurescript versions from austin.
09:59dnolen_sritchie: I don't use Austin - so that might be it?
10:00dnolen_sritchie: gotta say Austin really needs to support :none, your builds are criminally slow
10:00dnolen_11-13 seconds for me
10:00dnolen_should be .03 seconds
10:00dnolen_cemerick: ^
10:00sritchieyeah? that may just be my config goof.
10:00dnolen_sritchie: Austin doesn't work with :none
10:01sritchiednolen_: austin was in my lein config, so this may be a JVM classloading issue
10:01sritchiewhichever cljs wins...
10:01dnolen_sritchie: yeah, Om needs 2156
10:01cemerickdnolen_: where are builds 11s?
10:01sritchiebut yeah, thanks a lot for looking. I'll be much more suspicious of config going forward and try to isolate that stuff before reporting. will let you know how the investigation proceeds
10:02dnolen_cemerick: :whitespace + sourcemaps
10:02sritchiecemerick: yup
10:05dnolen_sritchie: fwiw, seems like a lot of people are using Om now, when I introduce a bug I get reports pretty quickly :)
10:05Anderkentdnolen_: hey, om looks cool! I saw that before but I didn't hear of react so I just figured it was an interface to some facebook api after the first line of the readme and stopped reading. Not sure if that might have happened to someone else before and is thus worth fixing!
10:05invasmaniOm is great, thanks for all of your hard work
10:05sritchiednolen_: yeah, our current stuff is in "reactive" style, and most of the code is watches and state updates
10:05dnolen_invasmani: no problem, thx
10:06sritchiednolen_: this is a huge win
10:07dnolen_Anderkent: I'll think about it, but I think React is making some waves so not long before most people know what it is :)
10:07cemerickdnolen_: Where does that compile time come from in the context of a browser-REPL interaction?
10:08dnolen_cemerick: Austin requires at least :whitespace optimizations no?
10:08Anderkentdnolen_: I think just changing the first line to something like 'A clojurescript UI library built on top of Facebook's React' would mostly do it
10:09cemerickdnolen_: Rumor has it; but, surely it's not 11s per expression beign eval'd?
10:10cemerickI've used source maps ~twice, so I'm generally not aware of the impact they have on the compilation process.
10:10dnolen_cemerick: it's significant, I think most people at this point use source maps all the time.
10:10dnolen_including myself.
10:11sritchieoh, yeah, nice. with :none, 0.76 seconds per change.
10:11cemerickdnolen_: yeah ok; but, where does the 11s-13s come from?
10:11dnolen_cemerick: :whitespace + source maps
10:11cemerickdnolen_: you mean in the context of cljsbuild auto?
10:11dnolen_cemerick: yep
10:12cemerickok; what does that have to do with austin?
10:12dnolen_cemerick: do you think that people don't run REPL & auto at the same time?
10:12cemerickcljsbuild supports :none, source maps, etc
10:12sritchiecemerick: does austin support :none?
10:13cemerickdnolen_: it's never occurred to me, but they're in different processes, and have different configurations.
10:13dnolen_cemerick: oh ok, so Austin doesn't require you to build your *own* source with :whitespace?
10:13cemerickdnolen_: goodness no
10:13michaniskindnolen_: cemerick: i'm using cljsc but not via lein-cljsbuild, and i'm seeing ~3sec compile times for one changed cljs source file, when it used to be a few hundred msec at most. i'm carefully preserving last-modified times of source files, i think. where should i look for issues that could slow down the cljs build?
10:14dnolen_cemerick: ok good to know - I was completely baffled by earlier conversation. Thanks for the clarification.
10:14cemerickdnolen_: That is, the austin server-side part has its own compilation env with its own compiler options; *those* need to be :whitespace/:simple, but that just doesn't matter in the REPL context.
10:15cemerick:cljsbuild configs can have :advanced, :none, whatever, and have no impact on austin's operation
10:15quizdrwhen I ctrl-c ctrl-k a source file, why would another source file in the same directory not be found on classpath if I require that file? the namespace name is indeed correct, but I get an error that the clj file could not be located.
10:15cemericksritchie: not AFAIK, though it's been a long time since I've tried
10:15dnolen_michaniskin: if you're not using lein cljsbuild than your need to preserve compiler environment between builds to get incremental compilation benefits
10:15dnolen_cemerick: got it
10:15michaniskindnolen_: by "compiler environment" you mean the temp files in :output-dir?
10:16cemerickmichaniskin: no; see cljs.env
10:16dnolen_michaniskin: no, the atom that holds analysis information needs to be bound.
10:16michaniskincemerick: dnolen_: oh awesome thanks!
10:16dnolen_michaniskin: (cljs.env/with-compiler-env compiler-atom (cljs.closure/build ...))
10:16cemerickmichaniskin: :-)
10:16michaniskinyou guys just saved me who knows how much time. thanks!
10:17cemerickmichaniskin: tribal knowledge FTW ;-P
10:17cemerickdnolen_: BTW, I have a patch ready for 656, but I wonder if you have any input re: my prior comment?
10:18dnolen_cemerick: yeah I saw that, will need to think about it for a little bit, will respond on the ticket.
10:18quizdrdoes your project.clj need to list as a dependency all the namespaces created in the same project's src/ directory?
10:18cemerickdnolen_: ok; I'll put a prospective patch on there anyway
10:19cemerickquizdr: no
10:20quizdrcemerick any idea what would cause a filenotfound exception when you require a namespace that is in the same src dir, just a different file?
10:20cemerickquizdr: typo, wrong filename extension, mismatch in filename and ns declaration
10:22quizdrcemeric thanks, obvious ideas that i've triple checked.
10:23quizdrcemerick could a hypen in a clj filename cause a problem?
10:23quizdr*hyphen
10:23S11001001quizdr: yeah; hyphens code as underscores when filenamifying
10:23cemerickquizdr: hyphens in namespaces need to be underscores in filenames
10:24quizdrah ha! thanks guys
10:32sritchiednolen_: fwiw, here's a recreation of the bug on heroku
10:32sritchiehttp://omtimer.herokuapp.com/timer
10:32sritchiednolen_: no one seems to be stomping the cljs version
10:32dnolen_sritchie: your markup seems very problematic to me
10:33dnolen_React & your code loaded twice
10:33sritchieoh, that's a pretty huge neon sign, and almost certainly the problem
10:34lvhHi
10:35lvhif I have a function that's more or less analogous to map, except it's doing multiple funcs over one coll (in a slightly involved way; I can't just spell it as "comp"), is it bad form to have the funcs arg come after the coll arg?
10:38sritchiednolen_: fixed, and the goog.string error's gone too
10:38ambrosebslvh: in most sequence functions, the collection comes last. good for threading with ->>
10:38ambrosebslvh: that said, the threading macros have improved, so this is less of an issue
10:39quizdris it better or more idiomatic to wrap a map function in dorun or use doseq if i need side effects created from items in a collection?
10:39quizdri use map so much, that i also use it for side effects and often wrap with dorun, but now i'm wondering if this is a bad habit.
10:40lvhambrosebs: Cool. So, inthis function, I should swap the args? https://gist.github.com/lvh/7b018a90cdafd119dc41
10:40ambrosebs,(doc dorun)
10:40clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."
10:40ambrosebsquizdr: do you mean doall?
10:40Anderkenton the other hand update-in etc. take the collection first
10:41ambrosebsquizdr: oh I see. I use doseq for side effects.
10:41quizdrambrosebs no, dorun. the difference is that doall retains the head, which i wouldn't usually need.
10:41Anderkentquizdr: dorun is explicitly made for lazy seqs of side effects. It's okay to do that
10:42quizdrok Anderkent i just find it easier to wrap a map in it than to pull out the doseq bindings. maybe like the sequence, i too am lazy?
10:47lvhHi! How can I get a sorted list of [[(f x0) x0] ... ] given xs?
10:47lvhIt's almost map, except not quite...
10:48lvhzipmap almost does what I want, I guess I can build a map and then seq it?
10:51joegallo,(partition 2 [:a 1 :b 2 :c 3])
10:51clojurebot((:a 1) (:b 2) (:c 3))
10:56arohneranyone remember that crazy ruby blog post where the guy monkeypatched everything to be in the same class? I'm trying to google for it and failing horribly
10:56AeroNotixarohner: I think that was titled: "How to be a moron"
10:56arohnerwell, my goal is to make fun of ruby :-)
10:56AeroNotixarohner: ruby doesn't need your help
11:01szymanowskiwhat is the simplest way to create a function that always return true?
11:01dnolen_szymanowski: (constantly true)
11:01szymanowskigreat thank you
11:04cemerickdnolen_: I have a JS library I'd like to use that uses some reserved words as property names, which gclosure complains about. Would like to provide a compiler option corresponding to the constants in CompilerOptions.LanguageMode. Reasonable?
11:04dnolen_cemerick: pretty sure there's an existing ticket for this
11:04cemerickdnolen_: ok, I'll track it down and put something together
11:05dnolen_cemerick: http://dev.clojure.org/jira/browse/CLJS-743
11:05cemerickoh, even better
11:08oskarkvIf I want to deref a reference and then set it without anyone else setting it inbetween, should I use a ref in a transaction? Or is there a way with an atom?
11:08AeroNotixoskarkv: ref+dosync
11:08oskarkvok thx
11:11hhenkelHi all...quick question...I managed to get a lazy-seq and now I'm wondering how to iterate over it...
11:11hhenkelI guess the key is doall?
11:12oskarkvhhenkel there are many ways, using map, reduce, loop/recur do name a few
11:12oskarkvto*
11:12oskarkvhhenkel what do you want to do with it?
11:13hhenkeloskarkv: first let me descibe what is in the lazy-seq...I read json data from a file, merge those data into each other and get it as a lazy-seq.
11:14hhenkeloskarkv: This seq holds config data for servers from which I want to create recuring jobs via at-at
11:14hhenkelTherefore I think I have to iterate over all items.
11:15borkdudehhenkel there are many functions that iterate over sequences
11:15borkdudehhenkel map, filter, reduce, etc
11:16borkdudehhenkel it depends on what you want to do
11:16oskarkvlike one job for each element? Then maybe (map create-job the-seq), and if there are side-effects then use doall/dorun
11:16oskarkvhhenkel ^
11:16borkdudehhenkel doall is only used to realize all elements in a lazy seq
11:17hhenkeloskarkv: I don't think that I got side-effects as I want to schedule my network request with at-at (running in threads as far as I know).
11:18hhenkelI guess I was looking for something much more complicated then a simple (map create-job my-lazy-seq).... ;)
11:21`cbphhenkel: (doseq [config my-lazy-seq] (create-job config))
11:25hhenkeloskarkv: `cbp: If I try your suggestions it seems like no data is given to my function.
11:25hhenkelI'll paste it in a min
11:29hhenkeloskarkv:
11:29hhenkel`cbp: https://www.refheap.com/41527
11:30oskarkvhhenkel you have missed a (
11:30oskarkvbefore the function, look at `cbp's example
11:32hhenkeloskarkv: yes, you're right....and what about your map example?
11:33oskarkvhhenkel but with map it should have worked. but note that the result of map is also a lazy seq, nothing will happen with it right away
11:33hhenkeloskarkv: I tried it with the same pprint function...
11:33oskarkvhow?
11:33clojurebotwith style and grace
11:34hhenkelIt also looks like something is still wrong with my data...is it possible that I managed to create a lazy-seq within a lazy-seq?
11:34oskarkvyes that certainly possible :P
11:35hhenkeloskarkv: It's also in tn the refheap.
11:35oskarkvhhenkel I don't see any pprint in the code there :P
11:36hhenkeloskarkv: yes...the trace...sorry.
11:36hhenkeloskarkv: Also added the function that works on my data...
11:36hhenkel...any hint how to not have to lazy-seq?
11:37oskarkvif you swapped trace for pprint? The schedule-request function will not run, because map is lazy.
11:37oskarkv(dorun (map ...))
11:37oskarkvor, doall if you want to retain it
11:39hhenkeloskarkv: missed the dorun / doall....any thoughts on the double lazy-seq?
11:39oskarkvhhenkel double lazy-seqs are not necessarily a problem
11:40hhenkelBut if you look at my data strucutre that I get, do you think it's necessary that it is wrapped twice?
11:40TimMcTicket filed for stupid clojure.string/split behavior: http://dev.clojure.org/jira/browse/CLJ-1360
11:40TimMc(not that it will accomplish anything)
11:41sverihi, is there a dedicated sum function for lists or should I use reduce?
11:41sritchiednolen_: hey, one Q about that timing app
11:42sritchiednolen_: any advice on how I can be careful about isolating the timer DOM updates from other updates on the page?
11:42hhenkeloskarkv: the data contains to "objects" I would like to work on...therefore it seems like an overhead to me.
11:42sritchieI have a list of "result entries"; every time you click the mark button, I grab the current time and add an entry to {:stopwatch {:results <vector-of-results>}}
11:43oskarkvhhenkel I'm not sure what you are doing with your data
11:43sritchiednolen_: :stopwatch has :results, :timestamp, :stopwatch-time, :active?… it looks like my :results rows are updated every 10ms. I feel like something about the way I'm passing cursors is triggering dom updates on :results changes...
11:44sritchiednolen_: probably I need to nest them differently?
11:44oskarkvhhenkel what is get-server-config, for example?
11:45hhenkeloskarkv: I added it to the refheap
11:45oskarkvhhenkel ok
11:45hhenkeloskarkv: That's what I was refering to earlier.
11:45oskarkvah :P
11:50dnolen_sritchie: is your :results row a vector that isn't changing?
11:50oskarkvhhenkel and what was your question/problem? :P
11:51sritchiednolen_: yeah, it is
11:51hhenkeloskarkv: Down below you see the result of "my work"...it is wrapped in (({ ...
11:51sritchiehttps://github.com/paddleguru/om-timer/blob/develop/src/cljs/paddleguru/client/timer.cljs#L207
11:51hhenkeloskarkv: all i want to do is iterate over those to objects...and it seems not right to have it double wrapped..
11:52sritchiednolen_: and I'm trying to be careful to only pass that vector down into my build-all call;
11:52sritchie:focus-cell is a piece of higher level state that leaks down, though. maybe that's triggering a re-render. Let me remove that and see if it helps
11:52hhenkeloskarkv: Or with other words, why should I pack it two times to unpack it twice later on.
11:54oskarkvhhenkel those come from `for`? So there is only one application and one server?
11:55sritchiednolen_: yeah, it's still really sluggish after adding 100 results (even though that vector doesn't change)
11:55sritchiednolen_: http://omtimer.herokuapp.com/timer
11:55hhenkeloskarkv: nope, there are multiple applications that can have multiple servers ( a weblogic domain for example, one domain multiple managed servers and we got multiple weblogic domains).
11:56dnolen_sritchie: yeah so that's not going to work, you're triggering a re-render every time.
11:56dnolen_sritchie: you need to do the reverse "inside"
11:56oskarkvhhenkel but right now only 1? And those lists come from for?
11:57oskarkvor, seqs
11:57dnolen_sritchie: a bit of a wart at the moment with how Om works, we can't use Clojure's equality test yet because of some implementation details.
11:58dnolen_sritchie: basically in order to avoid re-renders identical? must be true, not =
11:58sritchieah, gotcha
11:58sritchieso I need to make sure to build the results vector in reverse as I add stuff
11:58sritchieif I want those result entries to show up in reverse order
11:58dnolen_sritchie: no just do the reverse later
11:59hhenkeloskarkv: the description is in yaml files....there are two example objects in the data.
11:59dnolen_sritchie: like inside the component that shows it
11:59hhenkeloskarkv: first ends with :http-port 8080}
11:59hhenkeloskarkv: line 58
11:59dnolen_sritchie: even if I remove the wart, that will still be fastest
12:00paulfedorowwhy is it that i can't see the output of prn inside a go block when evaluating it in vim with fireplace?
12:00sritchiednolen_: huh, I thought this was inside the component that shows it (finisher-rows)
12:01sritchiefinisher-rows shows the group of them
12:01dnolen_sritchie: no you are reversing then calling build
12:01dnolen_no way identical? check can work
12:01oskarkvhhenkel sorry, when you said "the result of my work" I think I misunderstood. What work? What function output that? And how did the double (( come about?
12:01sritchieyeah, for sure - just wasn't clear on the return type of build-all
12:01sritchieso I can move the reverse outside
12:02dnolen_sritchie: build-all just returns a seq of components
12:02dnolen_sritchie: so you can use apply
12:02hhenkeloskarkv: The data shown is the result of "get-server-config"
12:03oskarkvah, now i see
12:03sritchiednolen_: nice. "ranked" is going to be a problem as well, I guess, since identical? will fail
12:03sritchiednolen_: though that's modeled after (defn people [app] …) in https://github.com/swannodette/om/wiki/Basic-Tutorial
12:03dnolen_sritchie: it's usually not a problem but for long lists of things yes, you're going to lose time comparing things that don't need to be compared
12:04hhenkeloskarkv: I gotta go - basketball time - be back later on.
12:04oskarkvSo right now there are 1 app and 2 servers? Anyway you can do this in for: (for [app apps, server app] ...), that sould get rid of the double wrapping
12:04oskarkvhhenkel ^
12:04hhenkeloskarkv: I'll give it a quick shot.
12:04paulfedorowah worked around it by wrapping the go block in a <!!. guess the go block wasn't executed fast enough for fireplace to grab the output
12:04whodidthisany way to destructure hashsets?
12:05oskarkvhhenkel note that comma is whitespace, no need for it
12:05hhenkeloskarkv: Perfect!
12:05hhenkeloskarkv: works now as expected.
12:05hhenkeloskarkv: Thank you!
12:05hhenkeloskarkv++
12:05oskarkvhhenkel great :p no problem
12:05oskarkv(inc oskarkv) :p
12:06`cbp(inc oskarkv)
12:06lazybot⇒ 1
12:07sritchiednolen_: the whole UI for this thing is poorly designed, anyway; since we insert at the top, you have to re-render everything below.
12:07sritchiednolen_: yeah, it's much faster without "ranked", presumably because you have to re-render everything to increment their rank by 1
12:10sritchiednolen_: the way forward is probably to implement that component that only re-renders items that are in the current window
12:10sritchiednolen_: thanks for the help. the fog is lifting.
12:15bbloomdnolen_: i think sritchie has your next blog post idea for you: you need to show how to implement a virtualizing stack panel
12:16dnolen_bbloom: heh, we'll see :)
12:16dnolen_sritchie: yes, this where if you came up with a generic component a lot of people would benefit.
12:17sritchieyeah, I'm planning on putting some time toward my Om + CLJS knowledge each day
12:17sritchieI'll see what I can do with this
12:18dnolen_sritchie: that's really the thing I'm most excited about. As people build out their applications there will be legitimately reusable things that should be easy to spin out like I've done w/ om-sync.
12:19bbloomdnolen_: it would be pretty easy if you assume fixed height items and just absolute position them: then you basically just render N items where N is like the number of items that fit vertically * 3 or whatever
12:19dnolen_bbloom: yep
12:20bbloomlegitimately reusable: as opposed to "we claim this is reusable, but nobody but us has ever reused it"
12:20dnolen_bbloom: most of the annoyances will simply be making it so that it works in every browser >= IE8
12:20bbloomdnolen_: if you just put a div in a scrollable div, set the inner div's height explicitly, and then absolutely position fixed height items within that: i see no reason why it shouldn't in any browser w/ minimal effort
12:21dnolen_bbloom: it should just work yes - but you know how these things are :)
12:21bbloomtrue story.
12:21dnolen_it works, except on Galaxy Tab or something
12:21sdegutisI think (id) would be a great name for some function.
12:21sdegutisExcept then we could never name variables "id"
12:22bbloomsdegutis: which is likely why rich choose identity
12:22bbloomsdegutis: haskell was more bold: http://hackage.haskell.org/package/base-4.6.0.1/docs/Prelude.html#v:id
12:22sdegutisWell I already feel paranoid when I name a symbol "id", having to check lazybot to see if it's already a function.
12:22bbloomlol
12:22sdegutisSo it might as well be unusable.
12:22bbloomsounds like an isolated problem...
12:22sdegutisbbloom: Doing Haskell lately?
12:23bbloomsdegutis: nope
12:23bbloomsdegutis: no plans to either
12:23sdegutis!!
12:23sdegutisWhy not?
12:23bbloomsdegutis: not gonna get in to a language war now....
12:23sdegutisNo I mean, I just thought everyone in here was getting into Haskell lately.
12:24sdegutis(Except that one guy.)
12:24technomancygentlemen. you'll have to wait till 1600 UTC for this.
12:24technomancy=)
12:24sdegutis(yeah, him)
12:24bbloomi've been enjoying his absence
12:24sdegutistechnomancy: I don't see it in the topic anymore.
12:24bbloomsdegutis: it's now well known policy, not a new announcement :-P
12:24technomancyhehe
12:25sdegutisI just saw a trend of Clojurians getting into Haskell. Not sure why it happened en masse like that. Kinda neat phenomenon.
12:25technomancyis Clojure big enough to have any "en masse" phenomenons happen in it?
12:25technomancyphenomena
12:25bbloomsdegutis: this community believes in understanding PLT and, like it or not, haskell has a strong foothold there. you basically need to read ML and Haskell to keep up with the theory
12:25sdegutis(en-masse & people) only requires >= 3 arguments.
12:26bbloomsdegutis: and, if you're lucky, scheme :-P
12:26sdegutisPLT?
12:26sdegutis$google PLT
12:26lazybot[Project Learning Tree] https://www.plt.org/
12:26sdegutisOh.
12:26bbloomno
12:26bbloomprograming language theory
12:27bbloomclojurebot: PLT is http://en.wikipedia.org/wiki/Programming_language_theory
12:27clojurebotIn Ordnung
12:27sdegutisOh dang, I'm off topic.
12:31dnolen_so w/ the React.js 0.9.0-rc1 changes, Om is 10X faster for initial render than the popular competitors :)
12:31dnolen_love it when perf is someone elses problems
12:32bbloomdnolen_: nice. what changed?
12:33dnolen_bbloom: bunch of internal tweaks, petehunt suspects JIT friendlier
12:33petehuntalso innerHTML size is a lot smaller since we reduced the size of ids
12:33petehuntprobably has a lot to do with it
12:34dnolen_petehunt: nice
12:34bbloompetehunt: JIT friendlier means less runtime metaprogramming? more use of objects as structs?
12:34petehuntbbloom: we fixed a few places where we created obj keys in different orders
12:34petehuntbig thing was not accessing undefined props in a few places
12:35bbloompetehunt: gotcha. so the hidden classes optimizations don't bail out w/o warning
12:35petehuntright
12:35bbloompetehunt: and by ids smaller, you literally mean fewer character strings? heh. hilarious
12:35petehuntyeah
12:35wei__compojure handlers/wrappers are called from inside out right? so that means if I use the -> operator my handlers are actually called in the reverse order in which they appear?
12:36sritchieyup
12:36sritchiewei__: that's correct
12:36wei__sritchie: thx
12:36petehuntgo measure the # of html bytes in the dom ni 0.8 and 0.9
12:36petehunt:)
12:37nkozadnolen_: are you using Om in production?
12:37bbloompetehunt: go team
12:37bbloomnice work
12:37dnolen_nkoza: not yet, but other people are
12:37bbloomnkoza: dnolen_ never uses his own stuff in production. where would the fun be in that? he just rathers you all gamble for him
12:37dnolen_haha
12:38nkozaI see, maybe I can be another guinea pig
12:40`cbpI cloned the stackoverflow new topic's add-tags-input for my app in about 250 lines of om. That was pretty nice.
12:41dnolen_`cbp: nice
12:43`cbpdnolen_: indeed, all i needed was the basic tutorial hehe
12:44`cbpOnce I port it to 0.4 i'll make a repo with my widgets
12:45dnolen_"we've replaced 17,000 lines of JavaScript with 2,000 lines of om/react" http://github.com/swannodette/om/issues/116#issuecomment-35410957
12:48bbloomglorious
12:48ambrosebsdnolen_: wow congrats!
12:53whodidthisis there a way to get ring to respond with status 400 if im not returning a status or body
12:53whodidthisso status 400 if my response-handler returns nil
12:53ystaelwhodidthis: sure, just interpose a middleware that replaces nil with a 400 response on the way back out
12:55whodidthiscool, havent lookd at any middleware yet
12:55ystael whodidthis: have you looked at Liberator?
12:56ystaelsomething like that takes care of a lot of these concerns for you
12:56whodidthisim not planning on doing that many http end points so ill try something simpler
12:56whodidthismore interested in websockets
13:00zanes_Huh. Odd that max doesn't take a comparator.
13:01hiredman,(doc max-key)
13:01clojurebot"([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."
13:01zanesI'm aware of max-key.
13:02zanesBut thanks.
13:03pyrtsaclojure.core is really lacking in Comparator based functions. :(
13:03llasrampyrtsa: In what sense?
13:04pyrtsaComparison operators only work on numbers. No min/max algorithms for collections of Comparables. etc.
13:04llasramOh, that. Yeah, not sure why
13:05pyrtsaFun fact: (< date1 date2) comparison works for java.util.Date when it's part of a Datomic query. But not when clojure.core/<.
13:09justin_smith,(< (.getTime (java.util.Date.)) (.getTime (do (Thread/sleep 1) (java.util.Date.))))
13:09clojurebottrue
13:09jonasenpyrtsa: < is for nums only (as per the docs).
13:10pyrtsajonasen: I know. Not sure if that's been a good design decision, though.
13:12justin_smith,(compare (java.util.Date.) (do (Thread/sleep 1) (java.util.Date.)))
13:12clojurebot-1
13:13zanespyrtsa: Is there some contrib library I should be reaching for?
13:14zanesAlso, this is a weird question, but is there a convention for naming deref'd variables? e.g. variable-name -> dvariable-name or similar
13:15pyrtsazanes: Don't know of any.
13:16zanesI guess just using @ everywhere is shorter in almost all instances.
13:17pyrtsaI usually try to avoid dereffing the same IDeref multiple times in the same function, if it's possible some other thread might be changing it.
13:18justin_smithreally you should be using a transaction (for a ref) or a swap function (for an atom)
13:18justin_smithdereffing multiple times in one fn sounds like a code smell
13:18pyrtsaNod.
13:18justin_smithalso "sounds like a code smell" is metaphor abuse
13:18pyrtsa:D
13:19llasramSoftware synesthesia
13:19justin_smithlol
13:20technomancywhy does everyone assume code smell is malodorous
13:20justin_smithcode perfume
13:20technomancycan't code smell fresh and lively?
13:20justin_smithdecoderant
13:20llasram(inc justin_smith)
13:20lazybot⇒ 27
13:20technomancynice
13:21SegFaultAXHaha, well done.
13:22bbloomjustin_smith: decoderant would be a great name for a linter
13:22bbloom"Eliminates those pesky code smells!"
13:22bbloom"Now with bleach!"
13:23pjstadig𝅘𝅥𝅮Your code's not fully clean until it's Zest fully clean!𝅘𝅥𝅮
13:23amalloybbloom: coderant.de is available
13:24amalloyde.coderant is the group-id - now what's the artifact-id?
13:24pjstadigspeed-stick
13:24bbloomfresh-blast
13:24bbloompjstadig: that's the the submodule that finds perf smells
13:26technomancydifferent versions have code names [de.coderant "0.5.0-ARCTIC-CHILL"] and [de.coderant "1.1.0-ISLAND-BREEZE"]
13:26justin_smithhaha
13:26pjstadigi always end up buying domain names because of #clojure
13:27pjstadigthis is how i ended up with clabango.org (which I finally let go)
13:27pjstadig~suddenly
13:27clojurebotCLABANGO!
13:27Raynes#firstworldproblems
13:27Raynes:P
13:41aphyrCookedGryphon: #riemann is the best way to get ahold of me BTW.
13:42aphyrCookedGryphon: haven't seen a compilation error before but I believe you, haha. Riemann-java-client defines it internally.
13:42aphyrAny idea how to let the java client implement the interface without copying the class?
13:43hiredmanhttp://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Proxy.html ?
13:55ptcekAnyone know how to configure jTDS or MSJDBC driver for MSSQL 2005 to use :fetch-size parameter and fetch lazily? I have a working example with Oracle, but cannot find out how to do that with MSSQL...
13:57ptcekIt always tries to load the whole dataset in memory in contracst with Oracle that uses fixed amount of memory no matter how large the dataset...
14:00aphyrCookedGryphon: https://github.com/aphyr/riemann-java-client/issues/34
14:02justin_smithptcek: clojure.java.jdbc should return a stream of result data, using constant memory space is a question of what you do with that stream
14:03ptcekjustin_smith: I will post the working code in a sec to make it clear...
14:06fitzohanyone have any experience with clj-webdriver?
14:16ptcekjustin_smith: Cannot connect to work, so just from memory http://pastebin.com/uewDgdau
14:18ptcekjustin_smith: this works well when connecting to Oracle (clojure process will take a few MBs more than when idle no matter how large the dataset) but MSSQL driver will try to load the whole dataset into memory so it blows up
14:23justin_smithoh, so this sounds like a bug somewhere in the integration of the mssql driver and clojure.java.jdbc - have you tried breaking it into explicit count and offset queries? that should work as a fallback
14:23justin_smiththough it is admittedly tedious
14:27ptcekjustin_smith: I did not and don't want to (I don't need to get the result now so I am not forced) and it bugs me that it works in Oracle
14:28justin_smithSounds like a problem with that mssql backend, yeah. I think your options are not use mssql, fix their driver, or use count and offset queries.
14:29justin_smithI'd be interested if you find something better though.
14:29ptcekas I am total noob and new to clojure/dbs and all I think I will not :)
14:30justin_smith:count and :offset keys, and breaking into multiple queries in a loop, should work OK
14:30borkdudeSo now I get what caribou is about: building crud apps
14:31justin_smithborkdude: yeah, that's a big part of it - or at least handling the crud part of setting up a website
14:31borkdudejustin_smith I'm impressed by the demo video
14:32justin_smiththanks, I'll let patchwork know
14:32ptcekjustin_smith: yeah this will work but if my approach is correct, I would even more like to see IT working. Could it be considered bug?
14:33ptcekjustin_smith: bug in what? drivers?
14:33justin_smithptcek: I think it is a bug in the mssql driver
14:33ptcekjustin_smith: I will try jTDS authors then...
14:34justin_smithor maybe it is a technically a missing feature and not a bug... dunno, sorry
14:34ptcekthey present that it should be working and all the opts are supported
14:34jonasenAnyone know of where I can read more about core.async pub/sub system (blog posts, examples etc)? All I found is basically the docstring for `core.async/pub`: https://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async.cljs#L597
14:35ptcekjustin_smith: after all, do you consider the aproach with, genrally, statefull function to be correct given the use case?
14:35aphyrjonasen: the docstrings are helpful: https://github.com/aphyr/core.async/blob/decomplecting/src/main/clojure/clojure/core/async.clj
14:37dnolen_jonasen: pub/sub is pretty simple, https://github.com/swannodette/om-sync
14:37dnolen_jonasen: pub takes a chan and returns something you can suscribe to, you must supply something that take the value of the channel and returns the topic, sub is simple, you subscribe to pub chan and you say what topic you want to listen in on.
14:38justin_smithptcek: as long as you don't ever run the code in parallel
14:39justin_smithptcek: if you would ever have two concurrent queries, you would want to bind the atom inside a closure, so they wouldn't compete for the same atom
14:39jonasendnolen_: thanks! I think pub/sub is what I want. Great to see om-sync is using it. I'll read through the code
14:39justin_smith(wrapping the whole thing in a let statement instead of using def, and probably putting that inside an fn)
14:39dnolen_jonasen: it's not so much using it, people who want to use it must follow this pattern.
14:40dnolen_jonasen: om-sync works by consuming a feed of all changes to the application state
14:40justin_smithgood clojure style is to refactor things so that all the caller will care about is the arguments (if any) and the return value
14:40ptcekjustin_smith: this is what I meant by stateful function, ie closure over atom, right?
14:40justin_smithright, once you close over a new atom, it is only locally stateful
14:41justin_smithand won't share state with another invocation
14:41stompyjClojure + Redis. It's like the dawn of a new day. That is all. :)
14:41ptcekyeah this is what I am planning
14:41justin_smith(let [sum (atom 0)] (clojure.java.jdbc/query ... (rest of your code goes here)))
14:41justin_smithof course dereffing the atom at the end
14:42ptcekjustin_smith: thanks for suggestions
14:43justin_smithalso, if you end up doing queries in a loop with :count and :limit parameters, you can probably make the queries in parallel, adding to the atom as each comes back, instead of waiting for them one at a time
14:44justin_smithso you only need deal with latency once, rather than multiplying latency by the query count
14:46ptcekjustin_smith: so use n atoms for n parallel queries?
14:46justin_smithum no
14:46justin_smithone atom, but swap as they come back
14:46justin_smithfor n parallel queries that are meant to derive 1 count
14:48ptcekok, actually I am using some "switches" that I switch while going through the dataset and adding only when some combination of switches is present, ie I process a row at a time and keep the necessary history in the atom
14:49amalloyjustin_smith: instead of hand-rolling some junk with an atom and spawning the threads yourself, why not use reducers/fold? that's what it's for; you just have to define a Reducer implementation for your database thing
14:49ptcek+ the accumulator, of course
14:49justin_smithptcek: yeah, amalloy's idea is much better
14:51ptcekok so use fold in place of result-set-fn
14:54justin_smithI think it's not quite that simple, you would define a fold that does a query, and reducers would combine the results http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
14:55justin_smithI haven't used reducers / fold myself though, but it sounds like the right solution, maybe amalloy has more specific suggestions
14:56justin_smiththe basic idea is that each query would construct its own sum, and the reducer would sum each of these as they are ready, I think
14:57amalloysorry, i don't really have time to dive back into the details of how to build custom foldables. i have slides and a script from a presentation i did on it back whenr educers were new, though: https://github.com/amalloy/reducers-presentation
15:00ptcekamalloy: thanks for this material I'll go through it
15:14ericdwhiteHi I have a questions about using merge to add items to list within a map. I'm looking for feedback on style as I'm new to clojure. What's the best way to post code in IRC? gist?
15:15llasramericdwhite: gists are fine, also https://www.refheap.com/
15:15ericdwhitehttps://gist.github.com/ericdwhite/9079003
15:17ericdwhiteIn the example I have a room with a list of people inside, and I want to create a method to allow people to join the room. I'm looking for feed back on the method (join-em)
15:17amalloyjoin-rm could be (update-in room [:people] merge person)
15:18justin_smithalso, in general, if you know the keys ahead of time, assoc makes more sense than merge
15:18amalloyalthough merge shouldn't work at all here, right? i mean, what i posted is a transformation of your existing code, but you can't merge vectors, only maps
15:18amalloyso really you mean more like (update-in room [:people] conj person), which is pretty normal
15:20`cbpI'd do like (defn add-people [room & people] (update-in room [:people] into people))
15:21amalloymeh
15:22amalloywhether one person or multiple people makes more sense depends on his context, which we don't know
15:22amalloyi certainly wouldn't use &, though - people being an explicit seq will be more convenient
15:24ericdwhiteI was adding 1 person at a time, because that was how the UI worked.
15:24notidQuick question: is there a splat operator in clojure? I'm wanting to make the vector inline here: (some-func [1 2 3] "hello")
15:24ericdwhiteso with 'conj' the result is: {:id "room1", :people [{:name "john", :id 1} {:name "sam", :id 2}]}
15:25ericdwhiteAnd the same for & people with into. Thanks for your help. What I was really missing was update-in!
15:38dnolen_notid: apply
15:39dnolen_notid: though you can't quite do what you want there.
15:39dnolen_(apply some-func (concat [1 2 3] ["hello"])) is about the best you can do.
15:40dnolen_notid: unless of course some-fun takes vectors as second arg, then (apply some-fun "hello" [1 2 3])
15:43ivanjonathanj: I think I'll go with (mapv (partial reduce +) (apply map list [[1 1] [2 2] [3 5]])) for summing columns; I don't think there's a shorter way to do sum or zip unless you want to define your own
15:56gfredericksdid java originally have characters or were they stapled on later?
15:57danneuIs there another way to sort strings alphabetically (case-insensitive) than to convert to lower-case?
15:58hiredman,(doc sort-by)
15:58clojurebot"([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator. If coll is a Java array, it will be modified. To avoid this, sort a copy of the array."
15:58gfredericksdanneu: String#compareToIgnoreCase
16:00gfredericks,(sort (comparator (fn [^String s1 ^String s2] (neg? (.compareToIgnoreCase s1 s2)))) ["foo" "BAR" "baz"])
16:00clojurebot("BAR" "baz" "foo")
16:00danneugfredericks: brilliant
16:01hiredman,(sort-by #(.toLowerCase %) ["foo" "BAR" "baz"])
16:01clojurebot("BAR" "baz" "foo")
16:09pjstadig,(sort-by (mem-fn toLowerCase) ["foo" "BAR" "baz"])
16:09clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: mem-fn in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:09pjstadig,(sort-by (memfn toLowerCase) ["foo" "BAR" "baz"])
16:09clojurebot("BAR" "baz" "foo")
16:12danneufor one use-case, the built-in comparator saves me 2 characters
16:13borkdudeis there no section on debugging in the clojure cookbook? https://github.com/clojure-cookbook/clojure-cookbook
16:14hiredmangfredericks: fns (if I recall correctly) implement whatever the comparing interface is, so you shouldn't need to call comparator or neg?
16:15llasramborkdude: Clojure code never has bugs. Once you get code working at the REPL, it generally just works
16:15borkdudellasram that is only true if your name is Rich Hickey
16:16borkdudeI just discovered this nice tool https://github.com/prismofeverything/schmetterling
16:16borkdudevia caribou docs
16:16danneumy debug workflow is about as sophisticated as it was at my first vbscriipt job
16:17borkdudedaniel_karlsson you mean println?
16:17borkdudeI mean danneu
16:17danneuyes
16:17borkdudedanneu mine too
16:17danneuor clojure.pprint/pprint
16:17borkdudedanneu and I used swank debug thing
16:17danneuwhen i'm feelin fancy
16:18borkdudedanneu but I haven't used it in a long while, I don't know if it is even ported to the new nrepl world?
16:19danneui dont know how to make nrepl helpful with stacktraces. right now it just shows the top line of the trace in a 1-inch-high popup which is usually good enough
16:19danneuthe default seemed to print the whole trace in its own buffer that i would have to manually close
16:20gfrederickshiredman: I knew there must be an easier way; that's a tricky one to guess though
16:20gfrederickspjstadig: that one reflects I think
16:31borkdudeis anyone around involved in schmetterling?
16:31borkdudeyeahyeah I can't use the word anyone here, but now it seems appropriate
16:32borkdudeI wanted to ask if it's normal that when I press "continue" the same exception comes up again and again
16:33justin_smithborkdude: patchwork is the guy behind schmetterling, I can ask him what is up
16:33justin_smiththere is a thing where if you do something in the inspector that throws an error, it goes into an error loop iirc
16:34justin_smithunless that is fixed
16:34borkdudejustin_smith yeah I got that, that is documented as well on the page
16:34justin_smithoh, ok
16:35patchworkborkdude: What is the exception? It all depends on the state of your process
16:36borkdudepatchwork I opened up a repl with 'lein try schmetterling'
16:36patchworkAlso, some libraries throw exceptions with the intention of catching them later, but schmetterling will still break on them
16:36borkdudeand then did this:
16:36borkdudeuser=> (let [x 10 y 15]
16:36borkdude #_=> (schmetterling.core/debugger))
16:36borkdudepatchwork I can inspect x and y
16:36borkdudebut when I press continue, I get the same thing over and over, the REPL never returns to the normal state
16:37patchworkpaste the exception here: https://www.refheap.com/
16:38patchworkI need to document this, but you can add certain exceptions to an exclusion list if certain libs you use pathologically throw them internally
16:38muhoois there some way to make liberator use cheshire instead of clojure.data.json?
16:40gfrederickstime to write a simple-json-facade-clj
16:41rasmustogfredericks: faceon
16:42gfredericksI'm still trying to solve the problem of making cheshire extensible for libraries
16:42rasmustotechnomancy: at least there's no ironicjure in it
16:43borkdudepatchwork https://www.dropbox.com/s/v9fr9vdt4p0uox9/Screenshot%202014-02-18%2022.38.21.png
16:43borkdudepatchwork I raised the expection from a repl, calling a function foo with args x y and z
16:43borkdudehttps://www.refheap.com/41562
16:44borkdudepatchwork when I click continue, I get the same screen over and over
16:45patchworkborkdude: Hmm…. strange. Must be something about how the exception is interacting with the repl
16:46patchworkit should just finish and continue, but I have never triggered the exception from the repl before, I usually do it from a running app
16:46hiredmangfredericks: a module system where every library gets its own copy of cheshire to extend, right?
16:46patchworkborkdude: What happens if instead you trigger a different exception, like (/ 1 0)?
16:47gfrederickshiredman: man I have no idea how seriously you meant that
16:47borkdudepatchwork I'll try now again
16:47bob2muhoo, how did you make it use either?
16:47technomancyparameterized namespacessssss
16:48bob2muhoo, I didn't think it did any implicit deserialisation
16:48hiredmanrewrite cheshire to use some kind of service object, so you instantiate this cheshire object with some parameters and use it
16:48sdegutistechnomancy: wat
16:48sdegutisthat would be so cool
16:49hiredmangfredericks: I don't know how serious the question is
16:49gfredericks(deftype ReadOnlyDereffable [r] clojure.lang.IDeref (deref [_] @r))
16:49muhootechnomancy: huh?
16:49muhoobob2: serialization not deserialization
16:49danneuHas anybody ever worked with BBCode with Clojure/Java? I'm looking for a good lib + editor combo
16:49gfrederickshiredman: reasonably serious; I have a structured logging lib and would like it to default to str rather than throwing; and maybe a couple other customizations
16:50bob2muhoo, ah
16:50hiredman(deftype Cheshire ...) (let [c (Cheshire.)] (add-encoder c ...) ...)
16:50technomancysdegutis: apparently OCaml modules do a good job at supporting this
16:50muhoobob2: it uses clojure.data.json to encode application/json types. i could manually just handle types but it defeats one of the purposes of using liberator
16:50bob2yeah, i'm less convinced of liberator than I was
16:50muhooit's a Great Beast
16:50gfrederickshiredman: the weird part is if I'm going to fork and rewrite or whatever anyhow, I actually solve the problem by using the new version from the logging lib and nowhere else :/
16:50danneuRather, can anyone recommend a good editor that also happens to support BBCode?
16:50borkdudepatchwork same problem
16:50gfredericksfsvo "solve"
16:51muhooit seems way more work than it's worth for some things, but i've got a project that already uses it and don't feel like ripping it all up and starting over ATM
16:51hyPiRiongfredericks: (defn read-only-deffable [val] (let [p (promise)] (deliver p val) p)) is not sufficient? Saves you a deftype
16:51hiredmangfredericks: stick a copy of cheshire in a classloader where no one else can get at it
16:51gfrederickshyPiRion: hey reify would do it too
16:52bob2also all the hooks are racey
16:52borkdudedanneu maybe there is a BBCode mode for emacs? http://www.emacswiki.org/emacs/BbCode#toc1
16:52gfrederickshyPiRion: also: (doto (promise) (deliver val))
16:52bob2does this url exist at hook time? no? better check in the handler anyway
16:52hyPiRiongfredericks: oh nice
16:52hyPiRionI don't usually deliver promises instantly, but I'll note it down
16:52danneuborkdude: oh, i meant for users. like my forum users.
16:52gfrederickshyPiRion: useful for any alter-then-return pattern
16:52rseniortechnomany: do you have any clojure swarming bootstrap scripts for syme?
16:52borkdudedanneu ah ok ;0)
16:52gfredericks(doto (def ...) (alter-var-root ...))
16:53gtrakgfredericks: any reason not to use delay there?
16:53llasramtechnomany == a system for cloning technomancy, ensuring the dominance of leiningen over all other build tools
16:53gfredericksgtrak: arbitrary refs can have changing values
16:53rseniordoh - thanks llasram
16:53gfrederickstechnomancy are the author of the clojure build tool leiningen
16:54rseniortechnomancy: do you have any clojure swarming bootstrap scripts for syme?
16:54technomancyrsenior: there should be one in the repo, but I think there's something wrong with the language detection
16:54technomancyit's just not getting applied somehow
16:55technomancyhttps://github.com/technomancy/syme/blob/master/resources/languages/Clojure.sh
16:55technomancyhttps://github.com/technomancy/syme/pull/37
16:55rseniorright, I was thinking emacs, starter-kit, clojure-mode etc
16:55technomancyoh, personal dotfiles; suer
16:55technomancysure
16:55technomancyhttps://github.com/technomancy/.symerc
16:57borkdudepatchwork I tested now without the repl, causing the exception from a 'lein run', same problem
16:58patchworkborkdude: Strange, I'll try to replicate
16:59borkdudepatchwork this is the code from which the exception is thrown: https://www.refheap.com/41564
16:59patchworkIt is like it is trying to execute the same function over and over again
16:59borkdudepatchwork this is my project.clj https://www.refheap.com/41565
17:00rseniortechnomancy: thanks! Going to give swarming a try this evening at the St Louis Clojure Meetup
17:07patchworkborkdude: Ah, if you notice the exception is in a different line and file each time
17:07patchworkI hit continue maybe 15 times and it completed
17:07gfredericks(defmacro while-> "Like -> but short-circuits as soon as pred returns falsy for the threaded value." [pred x & forms] ...)
17:07patchworkIt is just showing every exception getting thrown by the clojure compiler at every level it does that
17:07patchworkI think the main issue is that you trigger the exception when the file is loaded
17:08patchwork(foo 1 2 3) at the root level
17:08patchworkI will try an experiment, just a sec
17:14technomancyrsenior: great; good luck
17:14patchworkborkdude: Yeah, in general you want to avoid executing things when a file loads. Check this out: https://www.refheap.com/41567
17:15patchworkInstead of (foo 1 2 3) at the outer scope of your file, it is inside the -main function
17:15gfredericksoh hey another function with `some` in the name that uses traditional truthiness: some-fn
17:15patchworkThis protects it from evaluation at load time
17:15patchworkThen in your project.clj just say :main proj.core
17:17patchworkIt is still triggered maybe three times, this is the compiler rethrowing the same exception as it percolates up the stack
17:18technomancygfredericks: traditional truthiness is between one true and one false only.
17:20amalloytechnomancy: this sounds like some weird satire of gay rights
17:20amalloysatire? maybe i mean parody
17:20borkdudepatchwork I know, this was just for testing
17:21borkdudepatchwork testing without a repl that is. normally I don't create calls at top level ;)
17:21gfredericksamalloy: anti-gay-rights?
17:22gfrederickstechnomancy: traditional truthiness is int-based
17:22technomancyoh snap
17:22patchworkborkdude: What I am saying is, that is what makes it seem like the exception is repeating itself, when really it is just sending it through far more calls since it is loading it over and over again
17:22patchworkprobably something similar is happening with the repl
17:22technomancydon't get all von neumann on me
17:22borkdudepatchwork ah ok
17:22technomancygfredericks: I follow the teachings of the Church.
17:22borkdudepatchwork I'll try non-top-level call then
17:22gfrederickstechnomancy: von neumann said it, I believe it, that settles it
17:23rasmustoone man and von neumann, please
17:23technomancythe Church, who also happens to be A Church.
17:23hyPiRionhaha
17:23sdegutis:/
17:24hyPiRiongood old Alonzo.
17:24borkdudepatchwork I now got this. No difference. https://www.refheap.com/41569
17:26sdegutisoh thats a nice story, von Neumann died a Catholic :)
17:28patchworkborkdude: Keep hitting continue
17:28patchworkits location in the stack changes
17:31gfredericks,(as-> {:foo 12} {:keys [foo bar] :as m} (assoc m :foo 13) (assoc m :bar foo))
17:31clojurebot{:keys [13 13], :as {:bar 13, :foo 13}}
17:31gfrederickshaha
17:31sdegutisoh good, we're back on topic
17:31gfredericks(inc clojure)
17:31lazybot⇒ 15
17:33rasmustogfredericks: waaah, that's confusing me
17:34rasmusto,(doc as->)
17:34clojurebot"([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form."
17:34borkdudepatchwork that's true. when I keep pressing continue eventually the browser window is 'empty', but what should happen to the call to foo? now my program doesn't respond anymore
17:34borkdudepatchwork I think it should just finish now?
17:35rasmustogfredericks: is it supposed to stay 12?
17:35patchworkIt does finish with an exception in the terminal
17:35patchwork(at least for me)
17:35ztellmantechnomancy: I think you should be a little more open-minded when it comes to churches http://bit.ly/1jP4CEP
17:35patchworkWhich is correct, since it threw an exception and it is not in a loop
17:36borkdudepatchwork yes, I would expect that, but not in my terminal :-s
17:37amalloygfredericks: that's pretty silly. as-> could make this work, right, just by letting another gensym at the end? or i suppose by not letting the last version at all
17:38amalloyie, like https://gist.github.com/amalloy/9081844
17:38borkdudepatchwork only when I kill the schmetterling instance, my program finishes
17:39borkdudepatchwork with the exception thrown
17:41patchworkborkdude: Strange, not sure what is up with that
17:41patchworkI usually use it on a web server and trigger the exception on requests
17:41patchworkThen the process continues and you can trigger it again by reloading
17:42rhg135quick question, how would i compose a series of channel-returning functions?
17:42patchworkMaybe it has something to do with the dt_socket keeping the process alive?
17:42borkdudepatchwork I don't know. I haven't yet used this in a project, just discovered it.
17:43bob2rhg135, ? as in wait on them all?
17:43hhenkel(inc oskarkv)
17:43lazybot⇒ 2
17:43rhg135bob2, i'm such an idiot lol
17:43patchworkborkdude: Well, I haven't officially released it yet, but I use it all the time. I will work on that and see what I can find out. There are a lot of quirks in the java debugging interface I have discovered during this process
17:43rhg135knew i was overthinking this
17:44borkdudepatchwork it's great stuff
17:44rhg135just run it all in a go block
17:49patchworkborkdude: Thanks! all feedback welcome
17:59`cbpheh that as-> stuff
17:59`cbpmaybe make a jira ticket?
17:59technomancyseangrove: hey, are you still having issues with build speed?
18:00technomancywe rolled out a bunch of changes recently to speed things up; wondering if you've noticed any difference
18:01sdegutisoh i saw that on HN
18:02`cbpsdegutis: you saw what?
18:07TravisDis the seuqence library similar in spirit to the iterator abstraction in the STL for c++?
18:07TravisDlike, most containers are iterable, let's use that as a unifying interface?
18:08bbloomTravisD: you mean the seq abstraction in clojure?
18:09TravisDbbloom: yeah, I guess. The book I'm looking at calls something the "seq library", which I guess is just all the functions for dealing with seqable things
18:09bbloomTravisD: there's a tiny bit of commonality, but in reality it is muuch much different than the STL iterator idea
18:09TravisDah okay
18:09bbloomTravisD: oh i see you mean on http://clojure.org/sequences
18:10bbloomTravisD: nobody calls it that :-P
18:10bbloomthat's just a heading in that documentation page
18:11TravisDbbloom: in the book Programming Clojure they talk about the "seq library". But maybe that's just an informal name they are using
18:11bbloomTravisD: the major difference between iterators and seqs is that iterators have a much richer network of notions around forwards and backwards, "end" positions, types, etc
18:11TravisDah, right
18:11bbloomTravisD: i suspect that's just the author filling content by reading from the clojure home page :-)
18:11bbloomTravisD: seqs have basically two operations of interest: first and rest
18:12bbloomor next, instead of rest, depending on how you look at it
18:12bbloomiterators themselves are mutable, seqs are not
18:12bbloomthe fact that they help you traverse a sequential abstraction is basically where the similarities end
18:13sdegutisIterators rock.
18:13sdegutisDoes Clojure have any?
18:13AeroNotixsdegutis: persistent data structures
18:13AeroNotiximmutability
18:13AeroNotixiterators are at odds with those things
18:13TravisDhm, seems like the two concepts are quite related, no? They both are for traversing collections, with the intention of making it possible to write more general algorithms
18:13TravisDthe details are obviosuly different
18:13sdegutisAeroNotix: It could use atoms.
18:13amalloysdegutis: jillions of them
18:13amalloy&(.iterator [1 2 3])
18:13lazybot⇒ #< clojure.lang.APersistentVector$2@fcf9e1>
18:13sdegutisamalloy: as a Clojure-level feature
18:14bob2that's not really what atoms are for
18:14hiredmanseqs are a functional iteration protocol
18:15sdegutisHey now, let's not adopt a "can't do" attitude!
18:15sdegutisWe can do anything we set our minds to! Let's totally make iterators!
18:15turbofailit's not a "can't do" attitude, it's a "shouldn't do" attitude
18:15hyPiRionLet's implement goto guys
18:16yedi_lol bbloom: i was down with your pseudo troll in the scala thread on HN
18:16hiredmanhttp://okmij.org/ftp/continuations/
18:16bob2come-from
18:16hyPiRionThe return of TAGBODY
18:16sdegutishyPiRion: that'd be awesome
18:16bob2hyPiRion, (recur)
18:17turbofailrecur is too limited in its confusion-generation capabilities
18:17bbloomyedi_: using the parent response as a template was very trollish, but it was just too fun
18:17bob2haha
18:17turbofailwe need to go further
18:17bob2recur to arbitrary points above you in the stack?
18:17turbofailrandom points, preferably
18:17qbgIt's called throw :p
18:18hyPiRion(inc qbg)
18:18lazybot⇒ 2
18:18sdegutisBut throw only works if you go backwards in execution. I'd like to go forwards.
18:18sdegutisI'd like to skip a bunch of steps.
18:19qbgExceptions don't bring you backwards in execution
18:19qbgOnly forward :)
18:19sdegutisBackwards up the stack sir.
18:20bbloomyou guys should totally start where hiredman sent you :-)
18:20sdegutisYou may totally skip some steps, whatever is between the try high-point and its catch.
18:21bbloomoleg's continuations explorations are super insightful, if you have the patience
19:18whomphow do i test if a var is an int vs., say, a char?
19:18right1(class)
19:18`cbpor type
19:19whompso i'd say, (= (class a) Java.lang.Long) ?
19:19qbg_,[(integer? 5) (char? 5)]
19:19clojurebot[true false]
19:19whompthx :)
19:19qbg_YMMV w.r.t. integer?
19:20bob2can you make the caller just provide the right thing?
19:21akurilinSo let's say I'm bootstrapping some JS for my web application: is there a clojure library that will easily convert clj datastructures into JS syntax so I can inject it into a template?
19:21akurilinIt's also possible I'm going totally wrong about this.
19:21logic_progdnolen_ : ping
19:22`cbpakurilin: serialize into json?
19:22akurilin`cbp: oh derp. Ok cheshire it is then.
19:22`cbp:-P
19:22akurilinFor some reason I totally blanked about that one.
19:23qbg_clj->js
19:23`cbpqbg_: that's clojurescript
19:23qbg_sorry, misread :)
19:52AmnesiousFunesThe first prerelease of Typed Clojure for Light Table is available here: https://github.com/ndr-qef/light-typedclojure
20:25marcopolo`AmnesiousFunes: kudos!
20:26AmnesiousFunesThanks
20:27AmnesiousFunesSide effects: new LT bug confirmed and 2-3 PRs incoming.
20:39dsrxAmnesiousFunes: just curious, why the paredit dep?
20:40AmnesiousFunesdsrx: Annotation formatters require some sexp/cursor manipulation
20:40dsrxanyone in here using clojurescript to write a chrome extension, spotify application, or anything else that isn't served over http:// (and thus has issues using something like austin or the cljs browser repl)?
20:41dsrxif so I just released something you might be interested in, ping me
20:42dsrxAmnesiousFunes: ah, makes sense
20:50donmullendsrx: interested in using clojurescript for chrome extension development
20:50technomancyI wish I could use lisp for extending my browser too
20:50technomancyI don't use chrome though
20:51sdegutis_You can!
20:52sdegutis_All we need to do is invent a way less convoluted version of HTML/CSS/JS, and make it run inside a custom VM, and make it easy to write browsers for, and then write a browser for it!
20:52sdegutis_Then we'll just add Clojure as a scripting language.
20:53technomancyno, first you need to reinvent logic gates. the ones we have now are so clunky.
20:53sdegutis_Nonsense.
20:53technomancywhile we're at it, maybe we could find a better material than silicon for semiconductors
20:53TimMcwater-based gates are more elegant
20:54TimMcI have ethical objections to silicon doping.
20:54technomancy"a less convoluted version of HTML/CSS/JS" -> "Emacs buffers, overlays, and elisp"
20:54technomancy"make it run inside a custom VM" -> check
20:54technomancy"make it easy to write browsers for" -> check
20:55technomancy"write a browser for it" -> check
20:55technomancyok, that was fun
20:55sdegutis_technomancy: how is that last one a check?
20:55sdegutis_How is it easy to write a custom browser w/ the elisp vm?
20:56technomancythe Info reader is a hyperlinked browser
20:56sdegutis_Oh, right.
20:56sdegutis_I was thinking something with pixel-based margins.
20:56sdegutis_Yes I know, heresy etc.
20:56technomancypixels are so gauché
20:56technomancyif you're going to start from scratch at least use voxels
20:57technomancythere's also http://bzr.savannah.gnu.org/lh/emacs/trunk/annotate/head:/lisp/net/eww.el
21:09TravisDIs the list of libraries in a call to (use) is quoted because the symbols it contains may not be defined?
21:10sdegutisMore like because you don't want to access whatever they may point to.
21:10sdegutis,(def clojure.core 3)
21:10clojurebot#'sandbox/clojure.core
21:11sdegutis,(inc clojure.core)
21:11clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.core, compiling:(NO_SOURCE_PATH:0:0)>
21:11sdegutisUhh.
21:11TravisDYeah, I guess you don't want the symbols to be evaluated
21:13gfredericksTravisD: notably even after (use ...) finishes those symbols still aren't defined
21:13gfredericks,clojure.core
21:13clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.core, compiling:(NO_SOURCE_PATH:0:0)>
21:13TravisDAh, cool
21:14TravisDan alternative would be to use strings to name the libraries?
21:14gfredericks,(require "clojure.string")
21:14clojurebot#<ExceptionInfo clojure.lang.ExceptionInfo: Don't know how to create ISeq from: java.lang.Character {:instance \l}>
21:15gfredericksrequire certainly could have been written that way
21:15TravisDoh, I mean, that would have been an alternative way to do it
21:15gfredericksnamespaces in general are and endless source of n00b confusion
21:15TravisDhehe
21:16TravisDI haven't looked at them too closely yet, but some examples in this book were a bit confusing
21:16TravisDit's one of the only place I've seen quoted vectors
21:16gfredericksthey're not all that complicated, there are just a few things that aren't what you first expect
21:17gfredericksquoted vectors are just an alternative to quoting the things inside the vector instead
21:17gfrederickse.g. '[foo bar] vs ['foo 'bar]
21:17TravisDand you only need to quote it so that the symbols aren't evaluated
21:17gfredericksexactly
21:19TravisDcool, thanks
21:20muhoohow do i rebind a private function inside a ns i don't control?
21:21bob2are you sure you need to do that?
21:23dsrxdonmullen: http://github.com/tomjakubowski/weasel -- provides a websocket transport for the clojurescript repl, as suggested by dnolen in this thread https://groups.google.com/forum/#!topic/clojure/lC8me2Gx_B4
21:27dsrxdonmullen: I've not used CLJS for chrome extension development, but I faced a similar problem as the person in that thread connecting a CLJS repl to a spotify application (which is just a web page in an embedded chromium, served over a proprietary sp:// protocol)
21:36dnolen_dsrx: donmullen: you all should ping ericnormand when he's around, he's done quite a bit of Chrome Extension ClojureScript dev
21:39dsrxdnolen_: good to know, thanks
21:46echosaHey, #clojure. I'm having issues getting a number to always be two decimals places. Not just *display* two decimal places, but actually *be* two decimal places. I've been wroking with (with-precision) and a BigDecimal number, but I just can't quite get it right.
21:47echosa,(with-precision 2 (* 100M (/ 3 72)))
21:47clojurebot4.2M
21:47echosa,(with-precision 3 (* 100M (/ 3 72)))
21:47clojurebot4.17M
21:48echosa,(with-precision 3 (* 100M (/ 40 72)))
21:48clojurebot55.6M
21:49hiredmandecimal places are an artifact of notation, and hence display
21:50hiredmanyou'll have to be clearer about what you want
21:51echosaexcept with-precision is supposed to round them off, but I'm having problems getting it to always have 2 decimal places. I'm showing percentage, so I can assume that (until I hit 100), I'll only ever have 1 or 2 digits before the decimal point.
21:51echosaSo with 1 digit, I need a precision of 3 (1.23) while with 2 digits, I need a precision of 4 (12.34) it would seem.
21:52bob2so you want it to work like money?
21:52echosa,(with-precision 3 (* 100M (/ 1 72)))
21:52clojurebot1.39M
21:52hiredmanechosa: it certainly sounds like you are concerned with display to me
21:52hiredmanin which case you want format
21:52echosabob2: I suppose that's oen way to look at it.
21:53echosahiredman: ok, suppose I'm not and treat this as an excersize. Take display out of it. I want the function return value to be the correct value. I can't see whre I'm goign wrong.
21:53echosaThrough everythign I'm sending to clojurebot seems to be working-ish
21:53echosaI'll check my code for a fifth time
21:54systemfaultIs the source for clojurebot somewhere?
21:55hiredmanechosa: in what sense is it wrong?
21:55systemfaultA IRC bot is usually the first thing I try to write when learning a language :)
21:55muhoosystemfault: irclj
21:55muhoospecifically https://github.com/Raynes/irclj
21:56hiredmanclojurebot is perhaps the definition of a legacy software system
21:56hiredman~clojurebot is perhaps the definition of a legacy software system
21:56clojurebotAlles klar
21:56systemfaultThank you
21:56muhooi though clojurebot had a poetic soul
21:56echosahiredman: I'm getting something reproducable. one moment
21:57systemfaultIs clojurebot bad software or what? :P
21:57muhoosystemfault: read the source. it's got... quirks
21:57systemfaultNow I'm scared of looking at its code because I don't want to learn bad pattern.s
21:58dsrxthere's also lazybot
21:58muhoosystemfault: id suggest looking at irclj, and IIRC lazybot is built on it
21:58dsrxI can't speak for the relative quality of either of those projects :D
21:58systemfaultOk :)
21:59muhoook, i asked this, i think. i need to rebind clojure.tools.trace/tracer to a function, globally, that i define (hint: it'll use timbre to log the trace). but i don't reemember how to monkey around with private vars inside someone else's ns
21:59muhooi'm pretty sure it's possible though.
22:01hiredman~clojurebot
22:01clojurebotclojurebot has a lot of features, most of which are broken
22:01hiredman~botsnack
22:01clojurebotthanks; that was delicious. (nom nom nom)
22:01muhooaw, why y'all hatin' on clojurebot.
22:02muhooit's just different.
22:02systemfaultclojurebot should be a synonym for awesome :'(
22:02muhoodon't listen, clojurebot. you're ok at what you do and we all appreciate you despite your issues.
22:04hiredman~awesome
22:04clojurebotyour assessment smacks of bias, thus undermining your credibility further. (http://wondermark.com/560/)
22:05echosahiredman: I think it's a logic problem. Lack of sleep. :-/
22:05systemfaultOh god... nobody cares about the bot :P It hasn't been touched for 5 months now :P
22:08hiredmanwe have an instance of clojurebot running in our work irc channel, if you ask it about itsself it claims to be powered by neglect
22:09systemfaultThat's what I was saying... the source code of the bot looks neglect'ed
22:09hiredmanit is mature software
22:09amalloysystemfault: what's to change? clojurebot works
22:10hiredmanclojurebot: amalloy |claims| clojurebot works
22:10clojurebotIn Ordnung
22:10amalloythat's what i get for skimping on the "mostly"
22:10systemfaultamalloy: Just saying that nobody has committed to it in half a year :P Sorry
22:11systemfaultAnd it's saying that it's a WIP...
22:19voldymanAeroNotix: i swtchied from jetty-adapter to http-kit and sqlite to mysql 500 concurrent connections have negligible overhead.
22:24echosait's weird typing "true" instead of "t"
22:25muhoohmm, i'm not seeing any clues in dire. and google is failing me.
22:26muhooaha, robert.hooke looks lively
22:28systemfaultPerhaps I'm just saying this because I'm a noob... but I love clojurebot's code :/
22:28muhooit's got some funny stuff in it. and some really esoteric interesting stuff IIRC
22:39muhoodelightful! https://www.refheap.com/41829
22:49dnolen_pushing out Om 0.5.0-rc1 so people can test against React 0.9.0-rc1
22:54Tolstoydnolen_: Noticed that IWillUnmount isn't on the documentation page. File an issue?
22:54dnolen_Tolstoy: better, feel free to add it :)
22:55nopromptdnolen_: whoops, sorry i pinged you on twitter. thought you were away.
22:56nopromptdnolen_: wrt using om.core/value
22:56dnolen_noprompt: it's hooking a bit into implementation details but I don't forsee changes there in the near future
22:57dnolen_noprompt: one thing to be concerned about is that om.core/value will return a "cached" value
22:57noprompt(vector? data) doesn't work properly but (vector? (om.core/value data)) works fine
22:57dnolen_which may or may not reflect the application state
22:57nopromptah ok
22:57dnolen_noprompt: yes because we wrap IIndexed types, so it won't be a vector anymore, just IIndexed
22:58dnolen_noprompt: that might change in the future, but I haven't felt a need to more specific yet
22:58nopromptdnolen_: so how would you suggest going about building a component based inspector?
22:58dnolen_noprompt: I haven't put much thought into it honestly, though I'm pretty interested in that.
22:59dnolen_noprompt: kovasb has been doing some interesting work here as well
22:59dnolen_noprompt: you want to be able to inspect ClojureScript values right?
22:59nopromptdnolen_: awesome.
23:00nopromptdnolen_: right. and i need to known the type before i make a decision about class names, rendering etc.
23:00dnolen_noprompt: honestly the best thing would be to really examine how Om works
23:00dnolen_noprompt: and then tell me what you think you need that isn't already there
23:00dnolen_and we can discuss
23:01nopromptdnolen_: sure. that's how i came across om.core/value. i'm starting to dig through the source more.
23:02nopromptdnolen_: we successfully built a decent single page client side app with om/secretary at work.
23:02dnolen_noprompt: awesome :)
23:02nopromptdnolen_: there's a template we started working on but haven't finished it yet.
23:06dnolen_noprompt: kovasb is really working on exactly the same thing - ClojureScript value inspector
23:06dnolen_I would love to see this as a generic reusable component
23:06dnolen_super useful for everyone.
23:08nopromptdnolen_: i've got most of the pprint part working; just wanted to know what would be the safest route to ask vector? map? etc w/ cursors.
23:09nopromptdnolen_: this morning i noticed om.core/read is no longer a part of the API.
23:10dnolen_noprompt: yep it's been gone for a while now
23:10dnolen_noprompt: no longer needed
23:10dnolen_noprompt: you can just deref
23:10dnolen_noprompt: to deal w/ vectors you need to wrap in VectorCursor which of course I haven't implemented.
23:11dnolen_the hook is -to-cursor
23:11nopromptdnolen_: but i'd have to implement all the protocols right?
23:11dnolen_VectorCursor would need to support all the obvious ops, and implement the IVector marker protocol
23:11dnolen_noprompt: yes you would.
23:12dnolen_noprompt: but it's just boilerplate
23:13dnolen_noprompt: another way is perhaps to do this via metadata?
23:13mgaareis anything going on with ritz? plans to get it up to date with the current state of things in emacs, cider, etc?
23:16noprompt dnolen_: doesn't look like meta did it.
23:17nopromptdnolen_: i guess i could take a swing at the protocl implementation.
23:17nopromptdnolen_: it doesn't look to big. just wordy.
23:17dnolen_noprompt: oh, right ... you can check type of value to if that's what you were thinking about
23:17dnolen_noprompt: implementation detail for you that you can switch later
23:18nopromptdnolen_: yeah. basically that's all i'm doing is a cond with (type-fn? (value data))
23:19dnolen_noprompt: ok that's fine for now, and you can do something cleaner later I think.
23:19nopromptdnolen_: heh, well now i'm looking at the protocol thing. :)
23:29akurilinQuestion: ok so let's say you use Migratus for DDL migrations. What do you use for when you also need to "migrate" the data itself as part of that schema change? For example, say you're splitting a table into two: you'd make the new table, move the data from the old one, and then apply schema changes to the old table, all within one transaction.l
23:30akurilinYou can do it in Migratus as long as you can do the move 100% in sql statements, but it'd be cool to be able to plugin some jdbc/korma logic in there too.
23:31logic_progis there a way to define a function that is called every time a namesapce is loaded?
23:31logic_progI wnat my own tool to *sanity-check/lint* every namesapce that is loaded
23:31akurilinRight now I essentially do a partial migration, run a task from clojure, then complete the migration.
23:33noprompt,(ns foo (:println "foo"))
23:33noprompt
23:33clojurebotfoo\n
23:33nopromptlogic_prog: ^
23:34logic_prognoprompt ... hmm
23:34nopromptlogic_prog: dunno, if that helps but when you load the file that code will run.
23:34logic_prognoprompt: my question was poorly phrased
23:34logic_prognoprompt: let me write it up, spam the clojure list, and point you to the clojure list
23:36noprompthow did i not know about specify?
23:37logic_prognoprompt: https://groups.google.com/forum/#!topic/clojure/wx-naQUqi4o
23:37logic_prognoprompt: is specify a clojure function?
23:37logic_prognoprompt: I'm not seeing it here: http://clojuredocs.org/search?x=0&amp;y=0&amp;q=specify
23:38nopromptlooks like specify and specify! are clojurescript fns
23:38nopromptsorry, macros
23:40nopromptlogic_prog: honestly, and this could be the wrong idea, but you might need a macro for that.
23:40logic_prognoprompt: I agree, I think macros = wrong idea. :-)
23:40logic_progI don't want to do things like :my-require ...
23:40logic_progor hack ns
23:41nopromptlogic_prog: for instance (defmacro slurp [file] `(clojure.core/slurp ~file)) will work in clojurescript but only at compile-time.
23:41logic_progworse yet, it won't be called every time a clj file is reloaded
23:41nopromptwhoops drop the ` ~
23:42nopromptlogic_prog: that would at least give you the ability to read the file so it would be available in cljs land as a string.
23:44nopromptlogic_prog: in this case i'm not sure i would totally agree that macros are the wrong way to go because you may actually need *clojure* to do what you want.
23:49logic_prog(inc noprompt) ;; for effort :-)
23:49lazybot⇒ 1
23:51sdegutis,*clojure*
23:51clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: *clojure* in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:51sdegutisNope.
23:52nopromptguess my points got reset. :/
23:55sdegutis$karma noprompt
23:55lazybotnoprompt has karma 5.
23:56sdegutisnoprompt: it's just an eager regex
23:56sdegutis(inc noprompt) one more paren for good measure)
23:56lazybot⇒ 1
23:56sdegutis(inc noprompt) and another)
23:56lazybot⇒ 1
23:56sdegutis:)
23:58nopromptlogic_prog: here's the gist (ns foo.core
23:58noprompt (:refer-clojure :exclude [slurp]))
23:58noprompt(defmacro slurp [file]
23:58noprompt (clojure.core/slurp file))
23:58noprompt;; In CLJS
23:58noprompt(ns bar.core
23:58noprompt (:require [foo.core :include-macros true :refer [slurp]]))
23:58noprompt;; This is possible because we can evaluate *Clojure* code at compile time.
23:58noprompt(def project-clj
23:58noprompt (slurp "project.clj"))
23:58nopromptwell shit. i meant to give you a link. ;_;
23:58noprompthttps://gist.github.com/noprompt/9086232
23:58noprompti'll post to the ML too for good measure. ;-_
23:59_ericdoes clojure have a string quoting notation like ruby's %{} or scala's """ """?
23:59_eric(to make it so you don't have to escape a double quote)
23:59logic_progspammer!! :-)
23:59logic_prog(inc noprompt)
23:59lazybot⇒ 6
23:59noprompt_eric: no
23:59_ericbummer
23:59noprompt_eric: you've got str though