#clojure logs

2014-04-09

00:53paxanIs there any differences between https://github.com/clojure/tools.reader and whatever EDN reading facilities that are part of Clojure stdlib: clojure.edn/read-string and …/read?
00:56beamsohttps://github.com/clojure/tools.reader#differences-from-lispreaderjava ?
01:06amalloyverma: because it's not uncommon to write (apply dissoc m ks), and you don't want that to break if ks happens to be empty
01:06seancorfieldIf you only need to read _data_ you're safer using clojure.edn/read-string
01:09beamsothis is probably a stupid question but does anyone serialise to edn?
01:12seancorfield(pr-str data) produces edn - for data structures :)
01:18seancorfieldbtw, if there are any ops around nanaki PM'd me with a spam/malware link so they probably ought to be kicked and banned
01:18beamsoi probably got the same spam
01:27amalloyseancorfield: the only op who's here regularly is technomancy. there's been a lot of spam the last week or so; maybe it's time for another op?
01:50seancorfielddunno about spam but connectivity sure has sucked lately on freenode :(
01:56amalloyseancorfield: the past day or so are probably due to the openssl vulnerability
01:57seancorfieldevrything being patched and restarted you mean?
01:57amalloyyeah
01:57amalloyhttps://twitter.com/freenodestaff alleges some of that
01:58amalloyi haven't had any connectivity issues, but then i don't usually notice them anyway, since i connect through a bouncer
02:02seancorfieldI'll follow that Twitter account. Thanx amalloy !
02:02seancorfielddammit nanaki is spamming me again :(
02:15paxanseancorfield: clojure.tools.reader.edn/read-string and friends seem to be exactly same signature/option-wise to clojure.end/read-string and friends. So is there any reason to prefer one over another?
02:27Frozenlo`I switched to Cider (from the older nrepl.el) and now I'm getting "invalid function: 'some-function-I-want-to-complete'" when I press tab. Any idea how to solve this?
02:32bob2did you do cider-jack-in
02:32bob2did you fix up your .emacs to not refer to dead nrepl things
02:32bob2etc
02:32[Neurotic]Hey all, I've got some clojure->java interop that is throwing me the error: "IllegalArgumentException No matching field found: getCenter for class com.badlogic.gdx.math.Rectangle" - but the method is clearly there. More details here: https://www.refheap.com/73692 . Am I doing something stupid I just can't see?
02:34bob2is it public?
02:34bob2did you pass the right number of args?
02:34[Neurotic]bob2: THANK YOU
02:34[Neurotic]getter takes an argument. I totally missed that
02:35bob2woo
02:35[Neurotic]yep, that works now
02:35[Neurotic]*facepalm*
02:35[Neurotic]I was staring at that for hours
02:35[Neurotic](well not quite hours, but still)
02:38FrozenlockWell, I installed the git repository instead of the ELPA package and now it looks fine.
03:18waynrcould anyone recommend a good example of partial function application where the order of arguments matters?
03:19winkpow()?
03:26waynrnevermind, i think the docstring actually explains partial well enough
04:40maxthoursieanyone knows anything about dates for this years conj ?
04:42_kardanI'm building an application using Stuart Sierras component framework. One component uses Langohr & Rabbit. I'm a bit unsure how to deal with the fact that I need a reference to my datastore component in the message handler (that I pass to langohr.consumer/subscribe). Any tips on how to solve this?
04:45_kardanMore specific I need to access "ds" form https://github.com/kardan/akvo-notifications/blob/feature/8-refactor-app/src/akvo/notifications/message_shredder.clj#L46 in the simple_handler at https://github.com/kardan/akvo-notifications/blob/feature/8-refactor-app/src/akvo/notifications/message_shredder.clj#L33 to be able to do more than println.
05:50zhzhxtrrkhow to override a java method with varargs?
05:50zhzhxtrrkwith gen-class
06:03clgvzhzhxtrrk: have a look at the "-main" method for jars
06:03clgvzhzhxtrrk: though thats defining and not overriding, but the varargs syntax is the same
06:31noncomhow do i set a single element in a primitive java array?
06:33dnolen_noncom: aset
06:38zhzhxtrrkclgv: I'll try.
06:39zhzhxtrrkclgv: thanks
06:40clgv,(apropos "aset")
06:40clojurebot(aset-long aset-float aset-double aset-boolean aset-char ...)
06:40clgvnoncom: depending on the concrete type you should choose one of those ^^
06:41noncomhmm, i gonna use aset-float then, but i guess that if idk the exact primitive type i can still use plain aset with the penalty of reflection?
06:42noncomoh and just noticed that clojure 1.6.0 is released... where can i see the list of changes for it?
06:43zhzhxtrrkclgv: how to declare the method sigatures? I never see the sigature for -main.
06:43clgvnoncom: and the penalty of (un)boxing
06:43clgvzhzhxtrrk: it's (defn -main [& args] ...)
06:44clgvnoncom: the Changes.md on the github repo ;)
06:44zhzhxtrrkI mean the (gen-class :methods [[main ....]])
06:44noncomclgv: oh right, just found it. i think i googled it wrong before asking :)
06:44clgvzhzhxtrrk: seems that is not needed for "-main"
06:45zhzhxtrrkclgv: I know it's not needed for -main, but with my case, I do need one.
06:46zhzhxtrrkclgv: We have a test framework writen in java, it's need a class overriding it's method with extra annotations.
06:47clgvzhzhxtrrk: do you own a copy of clojure programming? there is a gen-class example on page 378
06:49clgvzhzhxtrrk: here is one as well http://clojure-doc.org/articles/language/interop.html#gen-class-and-how-to-implement-java-classes-in-clojure
06:54zhzhxtrrkclgv: thanks
08:06akado any of you guys have advice for deploying clojure apps to aws?
08:07akaI guess I'll checkout pallet since I can't stand the idea of using tomcat (aws beanstalk uses it)
08:10yotsovaka: I guess I would just build a war and deploy it to the tomcat. Tomcat had some issues years ago but is fairly OK about now, or at least I am very used to it after all these years :)
08:16yotsovthat being said, every time I use tomcat I make sure that 1. it is behind apache proxy, 2. something restarts it regularly, like every 4 hours, 3. something checks all the time if it is alive, 4. something cleans up / archives away its logs :)
08:16petronis there a channel for Om?
08:21broquaintpetron: I don't think there's a dedicated channel but #clojurescript is a good channel for it.
08:21petronthx, broquaint
08:22yotsovpetron: also #reactjs potentially
08:39akaj clojurescript
08:40akaI meant to do that
08:40akayotsov: I've been using http-kit behind nginx and varnish
08:40akait's depressing thinking of tomcat
08:43akajust ran across nginx-clojure benchmarks that indicate it is better than anything ever
08:44akanow to figure out what it is
08:47akaokay that just seems insane
08:48akapallet is not working
08:48akaanyone know if pallet is still relevant?
08:48aka(the clojure lib for cloud deployment)
08:52clgvaka: yeah, why should it not be?
08:53mdrogalisDoes bitemyapp not hang around here anymore?
08:57hugodmdrogalis: I think you pinged me the other day - still relevant?
08:57mdrogalishugod: Indeed. clj-ssh question. Figured it out, ty :)
08:57hugodaka: you can get pallet help in #pallet, though there are usually more people around later in the day
09:03akaclgv: the reason I asked was because the current site aws ec2 example errors due to jcloud version bug and I was looking at the wrong repo with a 2 year last commit date
09:04akaI see it's totally active
09:04akathanks hugod
09:06hugodaka: try pallet-jclouds 1.7.0-alpha.3 to get round jclouds/guava issues with the latest jdk
09:09akahugod: thx, giving that a try
09:25mdrogalisdnolen_: ping
09:33_tim__Anyone using datomic with geo spatial data?
09:35john2xhow do I call a function, that takes `& {:as optargs}` as optional args, with a hashmap? basically **kwargs in python..
09:35john2xso given {:foo :bar}, I want to be able to call (somefn "fizz" :foo :bar)
09:36jcromartie,(flatten {:foo 1 :bar 2})
09:36clojurebot()
09:36jcromartieoops
09:36jcromartie,(flatten (seq {:foo 1 :bar 2}))
09:36clojurebot(:bar 2 :foo 1)
09:36jcromartieso you could apply that
09:37jcromartie(apply f "fizz" (flatten (seq m)))
09:37jcromartiekind of ugly
09:38john2xjcromartie: thanks!
10:09dnolen_mdrogalis: pong
10:12mdrogalisdnolen_: In the Om docs, you say that UIs are EDN backed and therefore snapshottable. Couldn't figure out a way from the docs to pull out the actual EDN representation.
10:13dnolen_mdrogalis: what are you trying to do? (om/value cursor) will work during render, @cursor outside, you can pr-str that.
10:13mdrogalisPM
10:47bodie_,(= (20 (fn [f] (f 10 10) fn [x y] (+ x y))))
10:47clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/fn, compiling:(NO_SOURCE_PATH:0:0)>
10:48bodie_Anyone know why this doesn't work?
10:49llasramI honestly don't know where to start
10:49llasramYou have a macro (`fn`) in non-call position. You try to use the number `20` as a function. And you call `=` with only one argument
10:49bodie_"a function f is called with args 10 and 10; let this function be a function of two values X and Y, which is the sum of those values."
10:50bodie_ah, I must have misplaced that parenthese before 20. woops :) thanks
10:52bodie_llasram, I understood what you said, except the bit about fn in a non call position
10:52bodie_the goal there was to define an inline function which gets passed as the argument to the first defined function
10:54bodie_so I don't understand why an inline function can't be an argument to another function
10:55bodie_or I'm misunderstanding something else
10:57bodie_in fact, the very next koan does what appears to me to be exactly the same thing
10:57bodie_,(= 25 (fn [f] (f 5) fn [n] (* n n)))
10:57clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/fn, compiling:(NO_SOURCE_PATH:0:0)>
10:57bodie_oh, that doesn't work either... hmm
10:57llasrambodie_: You're still using `fn` in non-call position
10:58llasramAre you trying to do ? ##(= 25 ((fn [f] (f 5)) (fn [n] (* n n))))
10:58lazybot⇒ true
11:00bodie_llasram -- I think I understand that the problem is that I didn't wrap the first function in parentheses, which would cause it to be evaluated
11:00llasramYou create anonymous functions with `(fn [args..] body...)`
11:00bodie_I'm still learning Clojure obviously :) so I'm not quite sure I was "trying" to do that since I didn't realize I needed to do so :)
11:00llasramAll the `body...` forms become the body of the function
11:01bodie_"body..." needs to be an sexp right?
11:01llasramvs what it looks like you're expecting, that any free sequence of `fn [args...] body` becomes a function
11:01bodie_yes, clearly my expectations were misaligned, which is why I came here ;)
11:01llasram`body...` is any number of forms, which can be atomic values or s-expressions
11:01bodie_I see
11:02bodie_I think that does clarify :)
11:02bodie_appreciate the help
11:04bodie_oh, I get it. the "fn" macro gets evaluated into an actual function
11:04bodie_when it is the function of an sexp
11:07llasramPretty much
11:20durmhello guys
11:20durmcan you help me with compojure
11:20durm?
11:20llasram~anyone
11:20clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
11:20cbpdurm: just ask yor questions
11:20llasram#clojure is in a surly mood today :-)
11:21durmI want to specify directory for upload files by passing cli params. How can I get access to this param from request handlers?
11:24cbpdurm: cli params?
11:25durm(command line interface) args to main function
11:25durmI have param which is called media
11:26durmBut when I do run-jetty
11:26durmwith routes
11:27durmhow can I pass param to handlers?
11:27jcromartiedurm: there are a few ways you could do it
11:28jcromartieyou could construct your handler as a closure over the media argument
11:28cbpdurm: you can use a global variable such as an atom that you modify in your main and have your routes depend on that
11:28jcromartieor you could use middleware to attach the value to the request
11:29jcromartie(defn wrap-media [handler media] (fn [req] (handler (assoc req :media media))))
11:30jcromartieactually I was wondering about this earlier… we've often used closures to capture stuff like this, but I wonder if it's better to use middleware
11:30sszzqqwhat use for "clojure-1.6.0-slim.jar"?
11:31sszzqqSlim is related with emacs?
11:31durmjcromartie: 2nd way. param will be in {params :params}?
11:34jcromartiedurm: no, it will be a key of the request map itself
11:34jcromartieyou can destructure that with compojure's map destructuring
11:34jcromartieor you can just write handler functions that take the whole request and not really worry about the destructuring in the compojure routes
11:35gtrakibdknox: ping. wondering if you've had a chance to look at cider-nrepl. I was hoping it might be useful, since I'm actually not attached to emacs :-). But cljs support is working pretty well now.
11:36coventryOh, was that your video on /r/clojure today? Nice work.
11:36_tim__any datomic users here?
11:36gtrakibdknox: useful in the context of light-table
11:37technomancy_tim__: probably more in #datomic
11:37durmjcromartie: cbp: thanks guys
11:39gtrakcoventry: thanks! :-)
11:40_tim__thanks
11:44gtrakcoventry: the coolest thing about it is it's not specific to cider.
11:44gtrakjust nrepl middlewares.
11:45bbloominteresting to see haskell get something tagged-literal-ish: http://www.haskell.org/ghc/docs/7.8.1/html/users_guide/type-class-extensions.html#overloaded-lists
11:46bbloomwhich reminds me, clojure needs "zero" and "one" functions: http://julia.readthedocs.org/en/latest/manual/integers-and-floating-point-numbers/#literal-zero-and-one
11:46gtraktpope: I'm pretty comfortable with the nrepl cljs support now. I have a ticket to support cljs macros, but i think the interface is already baked.
11:47gtrak'info' gives you everything you might want about a symbol/namespace, which we use for file/line. 'complete' gives you completions, as easy as that.
12:00stuartsierrabbloom: Those are using types, right? So you couldn't have different sets of "tags" in one program?
12:06bbloomstuartsierra: yeah, uses types, but i think it's per module, not per program
12:06bbloomstuartsierra: which is not much better, but still
12:06bbloomstuartsierra: presumably you can use newtype to work around that restriction quite easily, which is essentialy the same as defining a new tag
12:08gfredericks(defprotocol IZero (zero [x]))
12:10hlshipAnyone familiar with Korma and HSQLDB handy?
12:10rasmusto~anyone
12:10clojurebotanyone is anybody
12:10rasmusto~anyone
12:10clojurebotanyone is anybody
12:10rasmustough
12:10cbpclojurebot: you troll
12:10clojurebotTitim gan éirí ort.
12:10llasramSO SURLY
12:10rasmustohlship: long story short, ask questions first :)
12:11hlshipKorma is putting double quotes around table and columns names
12:11hlshipworks in Postgres but not in HSQLDB (using for testing)
12:15hlshipOk, I think I've got it worked out; the double quotes enable case sensitivity, and HSQLDB converts unquoted table names to upper-case.
12:15arohnerstupid question. In :foo/bar, (namespace) returns "foo". what fn returns "bar" ?
12:16gfredericksname
12:16arohnerah, thanks
12:17justin_smithname also works on symbols
12:18justin_smithas does namespace, I now see
12:22akais there an idiomatic way to put a noop placeholder in clojure?
12:23justin_smithaka: in what context?
12:23gtrakaka: if it's a function call, identity works great.
12:23gtrakin a let binding, _ is a good placeholder
12:24justin_smith{} is good for a value that will be filled in later
12:24akaI have a shutdown function that will need to do something eventually but it isn't doing anything right now while I do initial development
12:25justin_smithfunctions don't need bodies
12:25justin_smith,((fn []))
12:25clojurebotnil
12:26justin_smith,((fn [] #_ (eventually this will shut something down)))
12:26clojurebotnil
12:26justin_smith<3 #_
12:26akaperfect
12:26akathanks
12:27justin_smithjust note that the data following #_ needs to be a valid / readable form
12:27justin_smitheven if the symbols in it are not bound
12:28akagotcha
12:30ambrosebsBronsa: apparently the stale :deftype class didn't fix Sean's issue
12:30ambrosebsBronsa: I'll try and recreate the situation
12:30ambrosebsI assume it's something to do with definterface
12:40gfredericksseque covers about 90% of the times I've had the thought "I could do that with core.async"
12:41Bronsaambrosebs: I'll look into this in ~10 minutes, let me know if you can reproduce
12:42gtrakgfredericks: you probably don't want to use core.async for a single queue :-).
12:45gtrakso, every time you might feel like you need it, that's 90%. If you need it ten times, that's .9^10, or 35% likely that you don't need core.async :-)
12:46gtrakmaybe 90% is a little generous
12:46ssqq_How to know current namespace symbol table?
12:46justin_smithssqq_: (ns-publics *ns*)
12:47justin_smith,(ns-publics *ns*)
12:47clojurebot{}
12:47justin_smith,(do (def foo :foo) (ns-publics *ns*))
12:47clojurebot{foo #'sandbox/foo}
12:47hyPiRionns-refers for all the functions you can use in a namespace
12:47hyPiRion,(ns-refers *ns*)
12:47clojurebot{primitives-classnames #'clojure.core/primitives-classnames, +' #'clojure.core/+', decimal? #'clojure.core/decimal?, restart-agent #'clojure.core/restart-agent, sort-by #'clojure.core/sort-by, ...}
12:48justin_smithhyPiRion: that is only for things you can use unqualified by a ns prefix, right?
12:48hyPiRionjustin_smith: yes
12:48justin_smith,(map ns-publics (all-ns)) ; to get EVERYTHING
12:48clojurebot({} {} {primitives-classnames #'clojure.core/primitives-classnames, +' #'clojure.core/+', decimal? #'clojure.core/decimal?, restart-agent #'clojure.core/restart-agent, sort-by #'clojure.core/sort-by, ...} {foo #'sandbox/foo} {source-fn #'clojure.repl/source-fn, doc #'clojure.repl/doc, stack-element-str #'clojure.repl/stack-element-str, find-doc #'clojure.repl/find-doc, dir #'clojure.repl/dir, ...}...
12:50justin_smithoh wait, that lacks things from the current ns that are not public (but are still visible since you are in said ns...)
12:51justin_smith,(cons (ns-interns *ns*) (map ns-publics (all-ns))) ; OK that should be everything
12:51clojurebot({foo #'sandbox/foo} {} {} {primitives-classnames #'clojure.core/primitives-classnames, +' #'clojure.core/+', decimal? #'clojure.core/decimal?, restart-agent #'clojure.core/restart-agent, sort-by #'clojure.core/sort-by, ...} {foo #'sandbox/foo} ...)
12:53Bronsaambrosebs: so, nothing to do with definterface.
12:54Bronsaambrosebs: it's a classloader issue, works fine from a lein repl but fails on a slime repl here. I'm still trying to figure out if it's a bug in t.a or in core.typed
12:56tpopegtrak: you taking completion or a bigger picture?
12:56ambrosebsBronsa: ah. Haven't tried it yet
12:56gtraktpope: we use file/line for navigating source.
12:56gtrakso, hover over a symbol, get the info, jump to the file, which might be inside a jar.
12:57gtrakso I'd type 'om/build', hit M-., then I'd be in the om.core namespace source looking at the impl.
12:58gtrak'om' is an alias resolved from the current repl namespace, that's one of the arguments to info.
12:58gtrakthe "info" nrepl op
12:58tpopethis was a middleware right? I've forgotten most of the context
12:58gtrakyea yea
12:59tpopecan you link me?
12:59gtrakto what, specifically?
12:59tpopewhere does this middleware live?
13:00gtrakhttps://github.com/clojure-emacs/cider-nrepl
13:02technomancygtrak: so you're working on making that less emacs-specific?
13:02gtrakit's already not emacs-specific, unless I'm missing something
13:02gtrakgotta run for a few mins, but I'll scroll up.
13:02technomancywell, the readme at least
13:03gtrakah.. I guess I could :-)
13:04tpopeand the name :)
13:04tpopebut if that's the worst problem I'll take it
13:12myguidingstarhi all, when I make changes to source files during REPL and cause some file unable to compile, how do I get more verbose feedback other than ':error-while-loading ...'?
13:14Bronsaambrosebs: I think I got a fix
13:17stuartsierramyguidingstar: Try (pst)
13:23myguidingstarstuartsierra, I set up things like your reloaded template, but (pst) returns nil even after an :error-while-loading
13:28Bronsaambrosebs: http://sprunge.us/LDTP this seems to fix the issue
13:29gtraktpope: I had to get assimilated to get help from bbatsov, name wasn't really up to me, sorry :-).
13:31ambrosebsBronsa: thanks! how did you figure that out?
13:31justin_smithmyguidingstar: so you are using component to reload the ns?
13:31justin_smithmyguidingstar: if so, try (require 'some.ns :reload) and then looking at the error
13:31Bronsaambrosebs: https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm/utils.clj#L16-L20 :)
13:31ambrosebs;)
13:33ambrosebsBronsa: amazing commit msg typo https://github.com/clojure/tools.analyzer.jvm/commit/e11a81a98bccd2e5d4052c89fcaf10ab5663541a
13:34Bronsaambrosebs: yeah
13:34Bronsaambrosebs: I also copy-pasted that commit message in tools.analyzer and tools.emitter.jvm
13:34Bronsawhen I noticed it was too late.
13:34ambrosebslove it
13:34justin_smithI would know exactly what someone meant if they said some feature was contribugged to their repo
13:34myguidingstarjustin_smith, thanks for pointing out that. Though I expected it somehow replace the :error-while-loading message
13:35Bronsajustin_smith: hah
13:35myguidingstar(so no more keystroke ;)
13:36justin_smith"dude's been contribuging me about his email client patch for ages, he really needs to take a hint"
13:37bodie_I'm having a really hard time understanding why this is failing. Can anyone point me in the right direction? http://cljbin.com/paste/5345848de4b088e54dd68ef0
13:38bodie_(if you could keep algorithm criticisms separate, that would be nice. ;) )
13:38justin_smithbodie_: (acc) should be acc
13:39justin_smithbodie_: also, pop sometimes takes off the beginning, sometimes the end, depending on type, you probably want rest
13:39bodie_and there you have it
13:39bodie_thank you sir
13:39justin_smithnp
13:40justin_smithalso (= foo 0) is the same as (zero? foo)
13:40Bronsaambrosebs: also, I don't know if you're aware of this or even need it but since you're using clojure.reflect, I discovered that `reflect` even with :ancestors true does not return any of the Object members if they don't get overritten
13:40justin_smithor at least close enough for your usage :)
13:40jwmhmm lighttable is kind of dead.. anyone point me to a good way of using node.js based cljs nrepl with lighttable?
13:42ambrosebsBronsa: not sure
13:42ambrosebsBronsa: might have figured it out a few years ago.
13:44Bronsaambrosebs: I don't know if it's by design or if it's a bug, but I'm opening a ticket regardless. Wasted an evening trying to figure out why I was getting a reflection warning :/
13:44ambrosebsBronsa: thanks
13:46oskarthGetting a "record? already refers to #'clojure.core.logic/record?" error when using core.logic and Clojure 1.6. What is the recommended solution for this?
13:46justin_smithoskarth: don't use "use"
13:47ambrosebsoskarth: I think this is fixed in core.logic master
13:47bodie_justin_smith / anyone else -- do you think my solution was a good approach? (link for reference: http://cljbin.com/paste/5345848de4b088e54dd68ef0)
13:47ambrosebsoskarth: whether there's a release, not sure
13:47bodie_I'm kinda new to fp, and I could see how this might be a bad idea since it makes tons and tons of copies?
13:47Bronsauh. so the issue is because interfaces don't have Object in their ancestors
13:47bodie_s/?/./
13:48justin_smithbodie_: that is still the old version
13:48oskarthI see, I'll do it with require for now then, thanks :)
13:48jwmso another question if I just use mongodb, snmp, websockets would I be better off just switching to clojure/jvm library
13:48bodie_woops
13:49bodie_http://cljbin.com/paste/53458763e4b088e54dd68ef5
13:49bodie_that
13:49hiredmanyes
13:50justin_smithbodie_: yeah, that's better, though I still think (zero? (count orig)) would be better than (= (count orig) 0) style wise
13:50justin_smithat least it is now correct, and for multiple sequential datatypes
13:50rasmustowhat about (empty? orig)
13:50bodie_right, that makes sense. but algorithmically / efficiency-wise how is it, or are there other means I should use?
13:50bodie_hmm, gp
13:50justin_smith(inc rasmusto)
13:50lazybot⇒ 6
13:50cbpbodie_: you need rest not pop
13:50justin_smitheven better
13:51justin_smithcbp: he updated it
13:51bodie_cbp, http://cljbin.com/paste/53458763e4b088e54dd68ef5 corrected version
13:51cbpah
13:51cbpsoz
13:51rasmustowasn't sure if 'empty? works similarly for things that are counted/not
13:51bodie_^^
13:51justin_smithbodie_: yeah, rasmusto's suggestion to use (empty? acc) is best
13:52bodie_that makes sense, but now I'm interested in beefing my alg design
13:52bodie_would this be a candidate for mutable state?
13:52bodie_let's say there are 100,000,000 elements in the sequence
13:52bodie_that seems like it would be quite a few copies
13:52klokbaskeHi! Is it possible to interop with Clojure from Java without building a jar?
13:53rasmusto,(take 10 (reverse (range)))[C[C
13:53hiredmanvery
13:53clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
13:53justin_smithbodie_: transients would not really help, sadly, because conj! appends to the end of a vector
13:53rasmusto,(take 10 (reverse (range 1e6)))
13:53clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
13:53rasmustohrm
13:53justin_smithI guess you could use last/butlast instead of first/rest plus a transient vector and conj!
13:53justin_smithdunno if that would do any good
13:54bodie_interesting to think about
13:54cbp,(reduce conj () [1 2 3 4 5])
13:54clojurebot(5 4 3 2 1)
13:54llasram(inc cbp)
13:54lazybot⇒ 2
13:54bodie_lol, niiiiice
13:54justin_smith,(reduce conj [] [1 2 3 4 5])
13:54clojurebot[1 2 3 4 5]
13:54hyPiRionbodie_: what do you want to do? Will you always work on a vector?
13:54rasmustohah, cool
13:54bodie_hyPiRion, it's just to solve a Koan :)
13:54hyPiRionoh
13:55hyPiRion,(into [] (rseq [1 2 3 4 5]))
13:55clojurebot[5 4 3 2 1]
13:55bodie_but in principle, I'd like to know the "Right Way" of solving the general problem
13:55justin_smithcbp's version is the same as the source of clojure.core/reverse
13:55justin_smithwhich is a good hint it is the right way :)
13:55bodie_:D
13:55Jaoodis clojure.core a good read?
13:55hyPiRionwell, look up rseq if performance is a concern
13:56cbpa must read at some point in time
13:56justin_smithJaood: the clojure code often is, but not the java code imho
13:56bodie_thanks hyPiRion!!
13:56justin_smithbut even the clojure code is more fiddly and performance oriented than most clojure code in normal projects
13:56hyPiRionJaood: to understand Clojure, it is. It's a bad idea to use the style used in core though
13:57hyPiRionbodie_: yw
13:57bodie_the koan specifically was a problem about recursive functions, so I suspect that recursion is not the answer to the problem of list reversal :)
13:58Jaoodyeah, that's what I though, it may impose bad style on beginner, maybe later ;)
13:58Jaood+a
13:58bodie_lol -- hyPiRion -- am I right in thinking that rseq simply reverses the direction the list is accessed in?
13:59justin_smithJaood: I think the code in flatland/useful is generally good, and you will probably learn some tricks and style hints from it https://github.com/flatland/useful/tree/develop/src/flatland/useful
13:59Jaoodbodie_: in constant time
13:59hyPiRionbodie_: Hrm, sorta. It's not a reversed vector, it's a lazy sequence
13:59hyPiRionSo looking up the nth element in it is O(n), not O(1)
14:00pyrtsabodie_: Also rseq won't work for lists because they don't support O(1) reversal.
14:00pyrtsa,(rseq ())
14:00clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList$EmptyList cannot be cast to clojure.lang.Reversible>
14:00pyrtsa,(rseq '(1 2 3))
14:00clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Reversible>
14:00pyrtsa,(rseq [1 2 3])
14:00clojurebot(3 2 1)
14:00pyrtsaCuriously:
14:00pyrtsa,(rseq (rseq [1 2 3]))
14:00clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.APersistentVector$RSeq cannot be cast to clojure.lang.Reversible>
14:00bodie_interesting, the distinction between lists, vectors, and sequences is still really murky for me
14:01bodie_ew
14:01pyrtsabodie_: A list is a linked list.
14:01bodie_that's a good point about rseq not being 1-1
14:02justin_smitha vector is a hash-array
14:02justin_smithhttp://en.wikipedia.org/wiki/Hash_array_mapped_trie
14:02bodie_nice
14:02justin_smithor wait - that is the hashmap, but vector is related...
14:02hyPiRionit's not a HASH-array, it's a persistent trie
14:02justin_smithhyPiRion: cool, thanks
14:03Jaoodjustin_smith: nice, thanks
14:03hyPiRionbut you're right about the hashmap though
14:03bodie_when you program in clojure, do you typically think of it as manipulation of these fundamental building blocks (like how I think when using C++?)
14:03bodie_or as its abstracted form
14:04justin_smithbodie_: I think of a program as a function from the input data structure(s) to the output data structure(s), typically at the top level of the design I can ignore the impl details, and it is only for pragmatic reasons that I choose between list and lazy-seq and vector and array etc.
14:04hyPiRionshameless self-plug on persistent vector explaination: http://hypirion.com/musings/understanding-persistent-vector-pt-1
14:05justin_smith(inc hyPiRion)
14:05lazybot⇒ 35
14:05bodie_polymatheia... love it!
14:05bodie_(inc hyPiRion)
14:05lazybot⇒ 36
14:05hyPiRion:D
14:05cbpAh, so that's where that post went, I was googling for it the other day and came up empty
14:06bodie_damn, this is awesome
14:06bodie_hyPiRion, I assume you use clojure professionally?
14:06bodie_(and justin_smith)
14:07justin_smithbodie_: yes, I develop the caribou lib as an in-house tool for a web shop
14:07hyPiRionbodie_: I'm still a student, but my master thesis is very closely related to the persistent vector
14:07hyPiRionbut I'm going to work in Clojure for a startup from July and onwards
14:08bodie_congrats :)
14:08justin_smithstartups have this ingenious system where you can cash in SAN points for large amounts of money
14:08justin_smithit's a great deal if you have more sanity than you know what to do with :)
14:08bodie_lol
14:09bodie_I keep telling myself it depends on the startup
14:09justin_smiththe vcs
14:09justin_smiththey call shots
14:09hyPiRionyeah, it really does
14:09bodie_some people really suck at leadership
14:09bodie_I also keep telling myself it's possible to bootstrap without vc, lol
14:10justin_smithbodie_: but the good money is post-vc, and they call the shots once their money is in the mix
14:10pjstadighyPiRion: what is your master's thesis?
14:10Jaoodwhile looking for db it seems couchdb doesn't get much love in the clojure community, seems practical since you only need a http client
14:10hyPiRionbodie_: we still don't have any VCs, only a single angel
14:10technomancyJaood: I'm a fan
14:10bodie_awesome... what problem domain?
14:10technomancyfor a lot of things anyway
14:11hyPiRionpjstadig: improving constant factors in the RRB-tree
14:11Jaoodtechnomancy: oh cool, for what domains do you use it?
14:12pjstadighyPiRion: cool
14:12hyPiRionbodie_: building industry tooling
14:13technomancyJaood: I haven't used bigcouch at all, but the "user can own their own data" aspecst of its replication model are very appealing to me
14:13hyPiRionIt's a bit strange, because as far as I've seen, the tooling is horrible, and you only have to implement tools which are of standard quality to get the upper hand
14:13justin_smithhyPiRion: so many industries are like that
14:13bodie_heh
14:14justin_smithsome day I may just make the killer warehouse management app, having used a piece of shit one once upon a time
14:14hyPiRionjustin_smith: yeah, but the thing is, there seems to be noone trying to solve the problem
14:14Jaoodtechnomancy: hasn't the bigcouch code been merge into couchdb yet?
14:14bodie_there's so much shit out there it's almost impossible to know where to start
14:14technomancyJaood: IIRC it's in progress as we speak
14:14justin_smithhyPiRion: yeah, lots of inertia and "well it's almost good enough" in specific domain oriented tech all around
14:14hiredmanhyPiRion: selling ads faster to the highest bidder is the challenge of our generation
14:14technomancyI haven't used any database nontrivially in years though
14:15bodie_most of the problems which are currently solved with shit, aren't looking for solutions, is the major abstract problem
14:15technomancyunless you want to get pedantic and count s3
14:15justin_smithhyPiRion: the hard point is selling them on the retraining (unless you plan on totally insane backwards compat quagmire)
14:15hyPiRionjustin_smith: "we can't afford the training of this almost equivalent tool UI-wise, which processes stuff 5 times faster"
14:15bodie_lol
14:16bodie_I mean, look at the software places like Sears use at registers
14:16hyPiRion"oh no, now I can't make coffee while my 4 GB model loads on my computer"
14:16hyPiRion"let's switch back guys"
14:16bodie_it sucks horribly but it'll be around forever because they don't have a real need to improve
14:17bodie_lol hyPiRion
14:17bodie_seems legit
14:17justin_smithhyPiRion: you have users who don't understand the software, they just have a very specific workflow memorized
14:17justin_smiththey hate any replacement because they hate learning
14:17justin_smithit's a big problem
14:18bodie_solution: all jobs should be a single button press
14:18hiredmanJaood: I suspect I have never given couch a fair shake because descriptions of it don't appeal, I am not wild about "document" stores, or javascript, or mapreduce, or json
14:18justin_smithalso because their old tools were total pieces of shit, they are afraid to try anything out, because they are sure it will randomly destroy the whole system
14:18hyPiRionjustin_smith: Well, not necessarily learning, but the fear of wasting money on something insignificant
14:19justin_smithand yeah, with the old system it was easy to do that
14:19technomancyhiredman: but you can mapreduce in erlangggg!
14:19bodie_dat erlang
14:19hiredmantechnomancy: oh boy!
14:19justin_smithhyPiRion: no, the people actually using the tool hate change and hate learning and hate the fact they even have to use a computer
14:20bodie_so the real problem is even bigger than the fact that all the shitty situations out there aren't being improved
14:20hyPiRionjustin_smith: I'm still too young I guess, with a naive optimistic world view. :p
14:20bodie_the real problem is the people perpetuating them
14:21justin_smithI saw first hand the reason new tools don't catch on, before I even got into the software biz
14:21hiredmaneventual consistency is also something I would only choose if backed in to it
14:22bodie_I think the solution to that problem is to create subsets of society that DO use good solutions, and when those subsets inevitably overtake the more wasteful / slower ones, then people will start to transition to a new way of thinking about problem-solving
14:22Jaoodhiredman: http://docs.couchdb.org/en/latest/intro/consistency.html :)
14:23bodie_so then the problem to solve isn't "everyone is stupid", it's "how do I get smart people together"
14:23hiredmanJaood: what is the purpose of this link?
14:23justin_smithbodie_: the problem is these people may hate change but they also have very valuable domain knowledge, so a bunch of whippersnappers aren't neccissarily going to out compete just because they have better tooling
14:24justin_smithbodie_: I think the solution is to introduce tooling that is so much better that the pain of change is less than the pain of the current system, but this is a much higher bar to clear than just being better than the status quo
14:24justin_smithyou have to be like 500% better than the status quo
14:24hiredmanI am well aware of cap
14:24bodie_heh
14:24Jaoodhiredman: oh, misundertand you, though you were asking about eventual consistency in couchdb and was reading that at the moment
14:25hiredmanoh no, http://couchdb.apache.org/ has everthing that triggers a "pass" from me, no futher reading required :)
14:25bodie_ideally, the tooling gives you the extra time and leverage you need to spend on the real problems you're trying to solve, I think
14:26hiredmanI am sure it's great or whatever, I am just not interested :)
14:26bodie_it seems like an awful lot of devops related stuff over the last couple of years has been so, so configuration and deploy oriented, and so much less about .. you know... the actual problem
14:26bodie_I mean, yes, it's great to solve problems with powerful tools, but when the problem IS the tool, you know you've gone too far
14:27bodie_then again... sell what they're buying, right
14:27bodie_mapreduce all the things
14:27gtrakbodie_: it's the logical outcome.
14:27llasramhiredman: But it's written in Erlang!
14:28bodie_seems illogical to me ;)
14:28gtrakdon't worry, in 20 years we'll all be writing netkernel.
14:28hiredmangreat, so the log files will be in linear b
14:28bodie_i'm still holding out hope for hurd :P
14:29miseria"los discursos politicos y su demagogia, para torturar un pueblo, son decorados con la frase: *derechos humanos*" bienvenidos: http://castroruben.com *temo_a_un_ser_sin_rival*
14:29bodie_juuuust kidding.
14:29gtrakbodie_: when it's easier to add another hack than to generalize, you get layers of virtualization :-)
14:30gtrakif we had a top-down-enforced distributed lisp machine, this wouldn't be a problem.
14:30pandeirocould anyone help me translate the third answer here: http://stackoverflow.com/questions/5206633/find-out-what-application-window-is-in-focus-in-java (Unix/Linux version) from Java to Clojure?
14:31gtrakor at least we'd have better abstractions than bash scripts
14:31pandeiroI specifically don't know interop well enough to translate the XLib interface into Clojure
14:31bodie_lol
14:31amalloypandeiro: you can link to a specific answer - "third" isn't very good because people may have different answer-sort preferences. i assume you're talking about http://stackoverflow.com/a/18275492/625403
14:31bodie_"We're from the IRS. It seems your DLISP node isn't performing up to the expectations of your salary level."
14:32bodie_"Do not resist."
14:32pandeiroamalloy: you may be able to, but i was unable to figure out how ;)
14:32gtrakbodie_: tradeoffs :-)
14:32amalloythere's a Share button at the bottom-left of each answer
14:32bodie_fair enough
14:32bodie_I for one welcome our LISPy overlords
14:32pandeiroamalloy: that's not a button
14:33pandeirobut i grant your point
14:33oskarthUsing core.logic, is it possible to use a finite domain consisting of operators (like for example plus and minus), and then use the resulting Lvars to apply as functions (like (x 4 6) where x is the Lvar +)?
14:33pandeirothe piece i am trying to do is here: http://stackoverflow.com/a/18275492
14:33amalloyas for the question - i wouldn't write that in clojure. it's much easier to just write that interface in java
14:34amalloyinclude it in your clojure project if you want; lein makes that easy
14:34pandeiroamalloy: interesting, i didn't know that
14:35pandeirowhat i don't get is where the xlib.XGetInputFocus() implementation is coming from
14:35amalloypandeiro: jni magic
14:35pandeirothat's that weird INSTANCE property i take it
14:36pandeiroway out of my league here but i have to figure out a way to programatically close a java web plugin popup window and i am grasping at straws
14:40justin_smithpandeiro: can't you access the windowing framework that the web plugin is using? I doubt it is using xlib / x11 directly
14:42pandeirojustin_smith: yes it must be using swing or something but i have no idea how i can get into another jvm process' windows - i don't control the plugin
14:43justin_smithahh so you want to find the window via X11 and close it
14:43dbaschquick question: how do I disable html stacktraces in a ring webapp?
14:43bodie_ugh, what's the trick to this? http://cljbin.com/paste/53459425e4b088e54dd68efb
14:43amalloydbasch: don't include the wrap-stacktrace wrapper :P
14:44bodie_do I need type hinting?
14:44bodie_(for bigint)
14:44dbaschamalloy: I’m not including it, and I still get them :(
14:44justin_smithpandeiro: I bet using xwit and / or wmctrl via the shell will be much easier. This can be done in a shell script or via shell calls in a clojure program, maybe using raynes' conch lib
14:44pandeirojustin_smith: exactly, just need to close it
14:44amalloyyou're including it transitively through some other wrapper. like maybe compojure's "site" wrapper, or something
14:44pandeiroxwit and wmctrl, cool i will look into those
14:44dbaschamalloy: that’s what I suspect, but I can’t find it. Oh well.
14:45justin_smithbodie_: use recur and an accumulator so that each call is a tail call
14:45cbpbodie_: bigintegers have nothing to do with that error, you're blowing the stack because your algorithm is recursive a
14:45cbp..and the input is too large
14:45justin_smithbodie_: the trick to tail calls is that no calculation must be left to do after the last call returns
14:45dbaschamalloy: I’m using the “api” wrapper
14:45justin_smithbodie_: so you use an acc arg much like in the reverse, but instead of a list it is a number
14:46justin_smithcbp: no, it just isn't tail recursive
14:46cbpwell yes
14:47justin_smithyeah, the number is too large for unoptimized recursion
14:47justin_smithbut the solution isn't a smaller input number, it's to do tail recursion (or a non-recursive algo)
14:49bodie_right -- of course, I got sidetracked by the error I got from my REPL
14:49bodie_"StackOverflowError clojure.lang.Numbers.toBigInt (Numbers.java:249)"
14:50justin_smithso do you get the idea of creating an acc arg so that each recursive call can be a recur?
14:51justin_smithyou can either make it an optional arg to the function, or a binding in a loop/recur
14:51bodie_yeah, that part I get
14:52bodie_the error about "toBigInt" doesn't make sense to me
14:52bodie_so I'd assumed it was bigint related
14:52justin_smiththat's the function that overflowed
14:52justin_smithwith a stackoverflow, often the specific funciton that overflowed the stack is kind of random
14:52bodie_so I guess um, probably the multiply or dec was attempting to cast to a bigint?
14:52justin_smithother than the fact that it just happens to be in the recursive call chain
14:52bodie_makes sense
14:52justin_smithbodie_: that is irrelevant
14:53bodie_yeah, but I'm curious. XD
14:53bodie_I guess the world will never know.
14:53justin_smithstack overflow means, "consume less stack"
14:53bodie_right, that part I do grasp :) it evaded my attention
14:53justin_smithyou could use jvisualvm or the like to interact with the stack
14:53justin_smithif you really want to see what is going on
14:54justin_smithor even just trigger a full stack trace via (pst)
14:55justin_smithlikely it calls toBigInt because thanks to the lack of type hinting it doesn't know that the arg to factorial will already be a bigint
14:56justin_smith(that's just a guess)
14:56bodie_woot, tco version passed
14:56justin_smithcongrats
14:56bodie_um, there IS a trampolining tco technique in clojure, isn't there?
14:56justin_smith,(doc trampoline)
14:56clojurebot"([f] [f & args]); trampoline can be used to convert algorithms requiring mutual recursion without stack consumption. Calls f with supplied args, if any. If f returns a fn, calls that fn with no arguments, and continues to repeat, until the return value is not a fn, then returns that non-fn value. Note that if you want to return a fn as a final value, you must wrap it in some data structure and un...
14:57bodie_ah
14:57bodie_whee
14:57cbpbodie_: it was the = that was casting
14:57cbpto compare 1 with a bigint
14:57justin_smithcbp: oh, cool
14:57bodie_interesting
14:57bodie_how'd you get that?
15:06bodie_justin_smith, thanks for the pointer to jvisualvm. I've never used this. cool!
15:08justin_smithnp, it comes with the jdk (as you probably already noticed)
15:08justin_smithit helps with many of those "what is my program on the jvm actually doing, and where did the ram go?" type questions
15:13bodie_cbp, I see how you got that
15:14bodie_or do I...
15:14bodie_,(= 1 1N)
15:14clojurebottrue
15:14bodie_,(#(= 1 %) 1N)
15:14clojurebottrue
15:15bodie_:S
15:15justin_smith= is calling the cast function, as he said
15:15bodie_right, but what's wrong with the cast to compare 1 and 100003N?
15:15justin_smithnothing
15:16justin_smithremember the cast is not a problem, it just happened to be the call that blew the stack
15:16bodie_oh, the stack overflow happened in that cast function
15:16justin_smiththe real problem is the stack
15:16bodie_I see
15:16justin_smithit was the straw the blew the camel's stack
15:16justin_smithor whatever
15:17mimieuxHi!
15:17mimieuxHow to run "local code" on a remote repl?
15:18jcromartielike a file?
15:18mimieuxyes
15:19justin_smithyou can send the forms in the file to be evaluated one at a time, or copy the file to the remote host and load it
15:19justin_smithboth should do the same thing (except for gen-class I guess?)
15:22mimieuxI want to issue a command like: ssh user@host -C "command"
15:22mimieuxand process its results, all with clojure.
15:22mimieuxclj user@host -C "command.clj"
15:22Xeago(crossposting from #riemann; the given code is written for riemann): can I write this differently? (where* #(not (predicate? %)) …)?
15:23cbpthat #() is (complement predicate?)
15:23justin_smithmimieux: probably you want to use clojure.tools.nrepl.client to connect and send the contents of the file, unless there is some tool or lein plugin that already does that
15:24mimieuxjustin_smith: yeah, this is what i want. thx.
15:25cYmenphew
15:26cYmenevening...now where do I find some motivation to look at om
15:26cbpXeago: you can replace #(not (predicate? %)) with (complement predicate?)
15:26justin_smithmimieux: another thing to consider is that nrepl does not by default accept remote connections (for obvious security related reasons) so you should create and use an ssh tunnel (or some other protected manner of connecting)
15:27mimieuxjustin_smith: I see. :)
15:28justin_smithI think it is easiest to create the tunnel using ssh and then point clojure at the local tunnel endpoint
15:29bodie_justin_smith, checking out caribou. seems supe neat :)
15:29justin_smithbodie_: thanks, it is still very much a work in progress, but we find it very useful for our own web stuff at least
15:30Xeago,(doc complement)
15:30clojurebot"([f]); Takes a fn f and returns a fn that takes the same arguments as f, has the same effects, if any, and returns the opposite truth value."
15:31justin_smith,((-> even? complement complement complement) 2)
15:31clojurebotfalse
15:33Xeago,(doc ->)
15:33clojurebot"([x & forms]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
15:34justin_smithXeago: that thing I did was pretty pointless actually. But -> and complement are actually useful.
15:36mdrogalisYouTube just suggested the video "Functional Programming is Terrible"
15:36mdrogalisWell, I'm sure this isn't biased or anything.
15:36justin_smithlol
15:37justin_smithcheck out google auto-complete for "functional programming is "
15:37bbloomwow.
15:37bbloomthat's pretty sad
15:37bbloomthat's our comp sci education failing right there
15:38mdrogalisHah, wow.
15:38blake__"functional programming is challenging and makes me uncomfortable in my head"
15:38winkstupid hard not the answer :)
15:38akhudekbbloom: worse than that, many people think CS is hard and stupid too :-(
15:38blake__I just wanted to program computers, not think, dammit!
15:38cbpcs isnt hard? that's news to me :-P
15:38bbloomakhudek: meanwhile, just a tiny bit of computer science and suddenly problems that are 10+ man years turn in to < 10 man hours
15:39akhudekyep
15:39winkmdrogalis: did you check the description?
15:39winkRúnar Bjarnason loves functional programming, but here he plays devil's advocate and addresses some of its shortcomings. (Don't worry, there's a happy ending)
15:40winkthose "django sucks" rant talks are some of the best of pycon I heard. and usually not bashing :P
15:40mdrogaliswink: Ah. Did not even click it.
15:40mdrogalisCouldn't be distracted ATM
15:40winkhehe
15:40winkI suspected something like this
15:40bbloomhappy ending: "functional programming is not terrible. YOU'RE TERRIBLE"
15:40bbloomalso, you smell.
15:40winkcf http://programmingisterrible.com/
15:41justin_smithactually, a nuanced video called "functional programming sucks ass" that actually ends up introducing a couple of concepts that could lead a skeptic to seeing how fp would be useful would probably be a good way to convert people (if conversion is a goal)
15:42mdrogalisHah
15:43wink"best way to get people on a mailing list to explain stuff is to say 'X cannot do Y'"
15:43justin_smithright
15:44kenrestivoi'm trying to track down a weird error:
15:44kenrestivo"ErrnoException open failed: ENOENT (No such file or directory) libcore.io.Posix.open (Posix.java:-2)"
15:45kenrestivowhen C-k'ing a namespace in neko/android/nrepl/emacs
15:46kenrestivohow would one go about debugging/tracing nrepl-related weirdness?
15:47justin_smithkenrestivo: was the jvm spawned in a director that has since been deleted?
15:47justin_smith*directory
15:47kenrestivointeresting. it's not a jvm, it's dalvik :-/
15:48justin_smiththat is my first guess when random commands complain about no such directory
15:48kenrestivothanks
15:49kenrestivoin this case, i want to first figure out who is throwing that error: the dvm, nrepl server, what exactly? it's unclear whether it's the host or client complaining
15:50cYmenjustin_smith: crap, now I need to look at core async to understand your om example ;)
15:51justin_smithcYmen: the core.async part is a stub, that will be filled in when we get to the user interaction part
15:51kenrestivoaha! it's the dvm, complaining the class isn't there. i can now track this down.
15:51cYmenhm...i really have no strategy when it comes to understanding clojure codebases
15:52justin_smithcYmen: that codebase isn't exemplary either, sorry
15:52justin_smiththere is some noise in it, as you have seen
15:52cbpuse a repl and break things :-P
15:52cYmenI'll go check out some docs for httpkit and om and such...
15:52justin_smithyeah, try corner cases that you think should fail, corner cases you think should succeed, etc.
15:53cYmenHm...I wouldn't even know what to call from the repl ^^
15:53justin_smithcYmen: remember that if you connect to that project's nrepl server you can run clojure.repl/doc and/or clojure.repl/source on any function to see what is up with it
15:54justin_smithin that particular case, try modifying one function call, see if it changes the thing you expect it to change
15:56kenrestivoone more dumb java/compiler question: "CompilerException java.lang.RuntimeException: Failed to load generated class foo.bar.baz$eval10734., compiling:(NO_SOURCE_PATH:2:1)" what's with the $eval10734?
15:57justin_smithkenrestivo: something that clojure evaluated generated some class, that is an autogenerated name
15:57cYmenalright, baby steps
15:57justin_smithif it were an fn it would have $fn instead of $eval I think
15:58cbp,(fn [])
15:58clojurebot#<sandbox$eval25$fn__26 sandbox$eval25$fn__26@d085f8>
15:58cbp,(fn [])
15:58clojurebot#<sandbox$eval51$fn__52 sandbox$eval51$fn__52@af84e>
15:58kenrestivohmm, but there's no fn in this case
15:58justin_smithahh, it has $eval$fn...
15:58kenrestivosmells like ns macro magick
15:59justin_smithkenrestivo: could be, but I think other things make classes too
15:59kenrestivoi think i'll just brute force this. strip that ns down to nothing, and gradually start adding in fns to the ns to see which one breaks everything
16:00justin_smithanother option is a binary search
16:00justin_smithis the error in the top or bottom half of the ns...
16:00justin_smithetc.
16:00kenrestivogood point. that $eval in top level smells to me like it's in the ns declaration or something
16:10gfredericks,(let [xs (->> (iterate inc 0) (take 30) (map #(/ 3 (- 8 %))))] (try (doall xs) (catch Throwable t xs)))
16:10clojurebotgfredericks: excusez-moi
16:10gfredericks&(let [xs (->> (iterate inc 0) (take 30) (map #(/ 3 (- 8 %))))] (try (doall xs) (catch Throwable t xs)))
16:10lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
16:11hiredman,(+ 1 2)
16:11clojurebot3
16:11llasram&(try true (catch Throwable false))
16:11lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
16:11justin_smithllasram: you missed the binding of the Throwable
16:12llasram&(try true (catch Throwable _ false))
16:12lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
16:12bbloomcatch is bad?
16:12llasram&Throwable
16:12lazybot⇒ java.lang.Throwable
16:12bbloomwhy?
16:12clojurebotwhy is the ram gone
16:12bbloom*sigh*
16:12llasram~botsmack
16:12clojurebotclojurebot evades successfully!
16:13bbloom~botsmack
16:13clojurebotOwww!
16:13bbloomgot him.
16:13hiredmanbbloom: you can setup infinite loops using try and catch that are difficult to break out of
16:13llasram&catch
16:13lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
16:13llasramSoooo bad
16:14bbloomhiredman: doesn't the jvm support timeouts?
16:14amalloybbloom: not without a little cooperation from the code being interrupted
16:14llasramclojurebot: catch is bad
16:14clojurebotRoger.
16:14hiredmanbbloom: it is all in the literature (by which I mean #clojure logs from 3 or 4 years ago)
16:14tuftInterrupted
16:14amalloymostly timeout support is that syscalls can throw InterruptedException, and you're required to declare how you deal with it
16:14bbloom*sigh*. the VM would be the new OS, if only the the VM was a half decent OS
16:15amalloyso if clojurebot tried to run code that caught InterruptedException by continuing to process...
16:15tufthah, indeed
16:15tuftClojureOS
16:16bbloomamalloy: surely InterruptedException is just being polite
16:16bbloomif the thread doesn't behave, you murder it instantly, no?
16:16amalloythere's no safe way to murder a thread
16:16hiredmanthat is how thread murdering sort of works
16:16technomancythere's no safe way to murder anything
16:16amalloybecause like, what if it took a mutex before you kill it, etc
16:17amalloysee, eg, the docs for java.lang.Thread/stop
16:17technomancyyou'll always leave some hint leading back to you
16:17bbloomamalloy: yeah, this is why the VM is a bad OS
16:17hiredmanbbloom: this problem seems to exist even at the os level http://stackoverflow.com/questions/2084830/kill-thread-in-pthread-library/2084849#2084849
16:17bbloomwhen you kill an OS process, the kernel releases it's resources
16:17bbloomhiredman: ok then let me extend my statement: this is why threads are bad processes
16:18bbloomand that's why our VMs are bad OSes and our OSes are bad OSes too
16:18gfredericksis erlang good at this?
16:19bbloomgfredericks: i dunno enough erlang, but i'd guess so, what with the crash-only design and all
16:19gfrederickswhy can't we all just erlang
16:19bbloomin general, i think "finally" is a bad idea
16:20bbloomall dynamic-wind related resource management strategies are a bad idea really
16:20hiredmangfredericks: because it has plenty of other warts
16:20TimMcI read that as "cash-only design".
16:20technomancygfredericks: but we can.. if you just believe.
16:20technomancygfredericks: the erlang was inside your heart all along!
16:20bbloomTimMc: mo' exceptions, mo' problems
16:20hiredmangfredericks: this particular one is a pain when writing sandboxes for irc bots, but hasn't been elsewhere, so I am accepting this wart to avoid the others
16:20blake__Is it possible to use a clojars library from a repl? If I want to try it out? Or do I need a project with dependencies?
16:21gfrederickshiredman: any easy examples?
16:21amalloy$google lein try
16:21lazybot[rkneufeld/lein-try · GitHub] https://github.com/rkneufeld/lein-try
16:21blake__amalloy: doh! Thanks! I forgot about "try"...
16:21amalloythat's for blake__ - i guess in context it could have been about try/catch
16:21gfredericksblake__: I worked up an add-dep macro using pomegranate I think
16:21hiredmangfredericks: http://www.unlimitednovelty.com/2011/07/trouble-with-erlang-or-erlang-is-ghetto.html is my go to blog post, in large part because it was written by a guy who was gung ho about erlang to start with
16:22technomancy"Oh, I see your problem, right here." *points to gauge* http://p.hagelb.org/erlangs.png
16:22gfredericksblake__: https://github.com/fredericksgary/repl-utils/blob/master/src/com/gfredericks/repl.clj#L9-15
16:22blake__gfredericks: Also cool, thanks!
16:23hiredmanI am not terrible fond of actors as a primitive to start with
16:23hiredmanif you compose actors you get something that isn't an actor
16:23bbloomhiredman: yeah, i think that we'll discover that actors are to turing machines what ??? is to the lambda calculus
16:24gfrederickslambda calculuses
16:24gfrederickspronounced "calc you loosies"
16:25gfrederickshiredman: I did not understand the first section at all; "Erlang has this feature. There's pretty much universal disagreement that having the feature is a huge limitation." ?
16:25hiredmanorleans is interesting, they talk about being an actor system, but they are not very strict actors, e.g. you can have multiple instances of the same actor when you don't care about exclusivity for that actor
16:26hiredmangfredericks: well, that part is outdated now I think, erlang has maps now
16:27gfredericksoh well
16:27hiredmanto be fair, it looks like the hardware side is trending towards share nothing memory per core, so some kind of future actor system could take advantage of that
16:28hiredmanper cpu, maybe shared per core
16:28bbloomi mean "shared nothing" at the CPU level is kinda splitting hairs
16:28bbloomthey share a bus, and therefore share memory attached to that bus
16:28gfrederickshiredman: looks like a pretty comprehensive essay though, thanks
16:28clojurebotTitim gan éirí ort.
16:28bbloomwhether it's registers or hard disks or anything in between, they share something
16:29hiredmanbbloom: sure
16:29technomancygfredericks: it's a mix of stuff that makes sense and stuff that's just dumb
16:30technomancylike ... complaining about no nil or complaining about no let is just stupid
16:30justin_smithbbloom: well the question is whether idiomatic and normal usage of the lang / lib / whatever assumes sharing, right? Because I can totally just open up the right file under proc to read a random program's memory if I have the perms
16:30technomancybut the stuff about strings and the standard library is right-on
16:30justin_smithhell, even write to it
16:30bbloomjustin_smith: sure. i think that shared memory is an extremely useful abstraction & even in distributed contexts it's an abstraction that should be preferred when you can get away with it
16:31bbloomie unbounded non-determinism may exist, but i don't want to have to bound it myself every time
16:31technomancygfredericks: and he doesn't even mention the lack of higher-order functions or the fact that the shell isn't a real rep
16:31technomancyrepl
16:32bbloomjustin_smith: if you've got a reliable-enough and low-enough-latency datacenter, you might as well treat an entire cluster of machines as a single shared memory node :-)
16:32hiredmanhah
16:32bbloomyou laugh, but this crazy thing exists: http://research.google.com/pubs/pub38125.html
16:33justin_smithbbloom: if you grant that the datastructures will be immutible, I can consider it
16:33bbloomjustin_smith: yeah, look what google has managed to accomplish on the crazy big table quasi-sql model
16:33bbloomimagine what you could do with immutable underpinnings
16:34tuftwow cool http://sicpinclojure.com/
16:34hiredmanbbloom: I would consider a distributed database as something different from "treat an entire cluster of machines as a single shared memory node" but I can see how you could make the case that that is what it is
16:34bbloomhiredman: this also exists: http://terracotta.org/products/bigmemory
16:34bbloomand works better than you'd think lol
16:35bbloomit's basically virtual memory implemented with massive page sizes & backed by a machine cluster
16:35bbloomagain, imagine with functional underpinnings
16:35tufthah, some spam generator puked itself in the second comment http://sicpinclojure.com/?q=sicp/front-matter
16:35enquoraanyone using clara-rules for production code (no pun intended)? is it the best choice if clojurescript is needed too?
16:36hiredmanI was just reading some paper about doing shared memories using pointer swizzling for c programs
16:37hiredmanmaybe this one ftp://ftp.cs.utexas.edu/pub/garbage/swizz.ps
16:49gfrederickstechnomancy: I don't understand no let -- what's not local about erlang's variables?
16:50jwmanyone using node.js for cljs nrepl?
16:57gfredericksoh I'd forgotten that atoms are syntactically identical to reserved words
16:57gfredericks(inc lisp)
16:57lazybot⇒ 2
16:58nightfly(inc inc)
16:58lazybot⇒ 8
16:58gfredericks(ink deck)
17:07gfredericksI'm about to write a wrapper around the scheduledThreadPool's .scheduleWithFixedDelay that lets you have a state arg/return values from the fn
17:08poppingtonicHello people :)
17:08technomancygfredericks: and the part about "its GC isn't as good as Azul's" ... um, okay? raise your hand if you are actually deploying on Azul?
17:08poppingtonicDoes 1.6 break anything from 1.5.1?
17:08hiredmangfredericks: :( for why?
17:08technomancy"It's not a general purpose language" -> http://www.penny-arcade.com/comic/2006/09/06
17:08gfrederickshiredman: sometimes it's useful to know what happened in the past?
17:10gfrederickshiredman: it's like using loop; but with a thread pool managing the loopiness
17:10hiredmangfredericks: keeping that state in a global atom (under a namespaced keyword or whatever) means you can poke it via the repl in a running system
17:11gfredericksoh I might expose it as well; but the function I write for the thread pool doesn't need to know it's exposed
17:12ambrosebspoppingtonic: there is a change log in the clojure repo
17:12gfrederickspoppingtonic: that's kind of a squishy question
17:13gfredericks,(->> (range 5000) (set) (take 5))
17:13clojurebot(0 2721 893 2558 920)
17:13gfredericks&(->> (range 5000) (set) (take 5))
17:13lazybot⇒ (0 1024 2048 3072 4096)
17:14arubincloudOr are they programmed to ignore each other?
17:14hiredmanhttp://awelonblue.wordpress.com/2012/10/21/local-state-is-poison/
17:15DaReaper5I am getting the runtime exception "Map literal must contain an even number of forms" from http://pastebin.com/hmqvWRam
17:15DaReaper5i do not understand why
17:15DaReaper5If I remove the third "~@(if" it goes away, but again i dont understand why
17:15stuartsierrapoppingtonic: Hashing in collections changed, which may lead to breakage in code that made assumptions about the order of keys in maps or sets.
17:16bbloom+1 on the local state is poison thing
17:17poppingtonicambrosebs: cloning
17:17poppingtonicstuartsierra: interesting. any hints as to what drove that choice?
17:17stuartsierraDaReaper5: ~@ doesn't get expanded until after the map is read.
17:17stuartsierrapoppingtonic: I don't remember. There's probably something on dev.clojure.org or JIRA.
17:18DaReaper5stuartsierra: sorry, i dont understand why that would cause the error?
17:18bbloompoppingtonic: stuartsierra: that behavior just falls out naturally from the way it gets parsed
17:18amalloyDaReaper5: your map literal has 9 elements in it, three of which look like: ~@(if ...)
17:19bbloom'{~@x} parses as (clojure.core/syntax-quote (some.magic/map (clojure.core/unquote-splicing x)))
17:19amalloywhat those expand to doesn't matter, because compilation doesn't get that far: the map literal with 9 elements is abandoned
17:19michaniskinDaReaper5: those ~@(if ...) expressions could return nil, and there are 3 of them and they don't have "else" clauses, so {"luid" x "type_code" y nil nil nil} has an odd number of things in it
17:19hiredmanbbloom: it is so easy to forget that closed over state is still state
17:19bbloomhiredman: yup. and all state is global!
17:19timbasically, using ~@ outside of a seq/vector shouldn't be done
17:19bbloomhiredman: it's not global state that's bad, it's unregulated global access
17:20michaniskinDaReaper5: disregard, i was being dumb
17:20bbloomhiredman: but the subtly there is that global read-access is vital for debugging purposes :-)
17:20DaReaper5amalloy: michaniskin would you suggest i use a merge then to fix it?
17:20bbloombut also super useful for lots of other things too
17:20DaReaper5(goes to try)
17:20hiredmanbbloom: unregulated global mutation
17:20bbloomhiredman: yup
17:20bbloombrb
17:20amalloyDaReaper5: that'd be one workable solution
17:20DaReaper5amalloy: ahhh i getit
17:21DaReaper5amalloy: if there where only two ~@(if then even if they return null there are two of them and the key would be null: null
17:21DaReaper5but with 3 there is an issue
17:46mmitchellwhat's the best library for reading an html string and providing a way to replace an attribute within an element, then re-render as an html string?
17:46mmitchellI *think* I was looking at something called hickory a while ago, or maybe enlive?
17:50stuartsierraenlive
17:59akammitchell: there is also https://github.com/Raynes/laser and https://github.com/weavejester/crouton
17:59blake__Why would someone take out a Google ad to advertise their (open-source, freely available) Clojure library?
18:00technomancyblake__: sometimes google hands out free adwords credits
18:00technomancyI ran a campaign for Leiningen for a few weeks on a $100 voucher they sent me
18:00blake__Ahh. "One weird library that Rich Hickey doesn't want you to know about."? That's kinda funny.
18:00technomancythat one wasn't mine =)
18:01akablake__: hahah that sounds sketch
18:01blake__It's for "proteus", which allows local, mutable variables.
18:01akadid you by chance see what lib it was?
18:01kenrestivohuh, this is a fun one: https://www.refheap.com/74124 that's what's getting spammed every second from android back to emacs via nrepl
18:01DaReaper5Anyone know how to convert a map to an hstore ?
18:01technomancyDaReaper5: yeah it's kinda crappy
18:01DaReaper5i am using korma atm
18:01kenrestivosorry, every 30ms
18:01technomancyoh, actually not so bad
18:02technomancyDaReaper5: https://github.com/heroku/buildkits/blob/master/src/buildkits/db.clj#L11
18:02DaReaper5Can i just ::hstore?
18:02technomancyoh, no idea how korma does it
18:07mmitchellaka: thanks!
18:10mmitchellaka: laser does exactly what i want! :)
18:10mmitchellalready working, nice
18:25lemonodorkenrestivo: you’re doing clojure on android? what are you making?
18:26lemonodor(i’ve been working on an AR.Drone speech interface for android)
18:27kenrestivolemonodor: oh just playing around. was attempting to make some mods to this http://github.com/kenrestivo/spazradioapp
18:27kenrestivoi *think* this may be the dalvik or dex optimizing out a class that isn't called from anywhere else
18:28lemonodorah i should have recognized your name; i bookmarked that to read over the code. i’m new to clojure and even newer to android.
18:28kenrestivoi can duplicate the problem by creating an empty ns
18:28kenrestivolemonodor: i recognize yours too. you did a lisp blog that was fairly well known at one time?
18:29lemonodoryes, eons ago
18:31kenrestivoand this if-let nonsense appears to be no if-let present in whatever dalvik env that nrepl-default-err-handlr is trying to execute in
18:34kenrestivolemonodor: well, welcome to clojure. hope you are having fun so far.
18:34lemonodoroh yeah, i love it.
18:35akammitchell: nice :)
18:48jwmI'm trying to transition from nodejs to clojure + http-kit hehe
18:49jwmso far having some bad success with lighttable
18:49justin_smithlight table seems to have a few really nifty gee-whiz features but not be mature
18:49justin_smithnot cranky and weird like emacs / vim, just immature
18:52bob2emacs is only cranky until you bring it its' tea and biscuits
18:52bob2and listen to its' stories about the war
18:52justin_smithheh
18:52bob2then it's all M-x cider-jack-in C-c C-t
18:52justin_smithbut you do have to do things its way. It gets kind of pissed if you call a frame a window
18:53bob2back in emacs's day, we called a window a frame
18:53bob2also, get off emacs's lawn
18:55DaReaper5i have a simple issue but im probably getting tired, how do i convert this { :key1 "aValue" } into this: { "name" "key1" "value"
18:55DaReaper5"value" aValue" } **
18:56DaReaper5(pressed enter by acident)
18:57DaReaper5simplier question would be how to i iterate over values in a sequence, getting their keys and values
18:59justin_smithDaReaper5: you're gonna find this hilarious
18:59justin_smith,(keys {:a 0 :b 1 :c 2})
18:59clojurebot(:c :b :a)
18:59justin_smith,(values {:a 0 :b 1 :c 2})
18:59clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: values in this context, compiling:(NO_SOURCE_PATH:0:0)>
18:59justin_smitherr
18:59justin_smith,(vals {:a 0 :b 1 :c 2})
18:59clojurebot(2 1 0)
19:00justin_smith,(map identity {:a 0 :b 1 :c 2}) ; or even this, swap out some fn which takes a pair for identity
19:00clojurebot([:c 2] [:b 1] [:a 0])
19:01DaReaper5justin_smith: when i use map will the key and value be separate arguments?
19:01justin_smithnope, it will be a pair
19:01DaReaper5like (map (fn [k v]
19:01justin_smithfirst element key, second element val
19:01justin_smithlike (map (fn [[k v]]
19:02DaReaper5kk
19:02justin_smith,(map (fn [[k v]] {:key k :value v}) {:a 0 :b 1 :c 2})
19:02clojurebot({:key :c, :value 2} {:key :b, :value 1} {:key :a, :value 0})
19:03DaReaper5justin_smith: so i can (map (fn [pair] {(key pair) (val pair}) pairs)
19:03DaReaper5hmm kk
19:03DaReaper5justin_smith: thanks alot
19:04justin_smithyeah, key and val also work
19:04justin_smiththough I think the destructuring version is simpler
19:05blake__Trying to use jvm.tools.analyzer. I git cloned it, but when I "lein repl" (did "lein deps" already), I get errors from clojure/tools/nrepl (ack.clj, middleware.clj, server.clj) and complete/core.clj. They're all "reverence to" and "call to" {something} "can't be resolved."
19:05justin_smith(fn [[k v]] ...)
19:05rasmusto,(map key '((a b) (c d e) (f g)))
19:05clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.util.Map$Entry>
19:05DaReaper5i agree
19:05justin_smithrasmusto: I think key works on map entries
19:05rasmustoo ok, thought that was the case
19:05justin_smithwell duh, that's what the exception says, but anyway
19:05rasmustoI misread part of the convo
19:06DaReaper5justin_smith: and with that im done for the day Cheers!
19:06justin_smithnp
19:07amalloyblake__: you seem to have carefully stripped all meaningful information from the error message. paste a real error message to gist.github.com or refheap.com or something: maybe someone else can make more sense of it than you can
19:10blake__Sorry. https://www.refheap.com/74140
19:13justin_smithblake__: those are not errors, they are just reflection warnings
19:14justin_smithsomeone turned *warn-on-reflection* on
19:14amalloyblake__: those all basically don't matter. i don't know why *warn-on-reflection* is on, but it's flagging potential performance problems
19:14justin_smitheverything will work as normal, but if you type hint some of those things, the warnings will go away and the code will be faster :)
19:15blake__This is just a git clone of jvm.tools.analyzer. I was trying to get to the ast function.
19:15blake__er, macro
19:15justin_smiththat should be fine
19:15justin_smiththey just have some warnings on
19:16blake__Well, I couldn't get to it, so the obvious messages were the first place I thought to check.
19:16justin_smithwhat did you try?
19:16blake__I started with (ast [1]) because I saw that example from an early version of the code.
19:17blake__Then just "ast"
19:17blake__"Unable to resolve symbol: ast..."
19:17blake__Then went down from the top of analyzer.clj.
19:17justin_smithyou need to require the ns that it is in
19:17blake__Maybe it's not loaded.
19:17justin_smithnrepl does not autoload any part of an ns
19:17justin_smith*project
19:17blake__Right, I started with (ns ...)
19:18justin_smithno, that defines an ns
19:18justin_smithyou need to require it
19:18blake__yeah, that throws me a lot...
19:18justin_smith(ns ...) means "hey, this ns now exists"
19:18justin_smith(require ...) means "find the definition for this ns"
19:19blake__So, when I type "(require 'clojure.jvm.tools.analyzer)" there's a lag, and I get a nil, but I haven't loaded anything?
19:20justin_smithnow you can do (clojure.jvm.tools.analyzer/... )
19:20justin_smithyou probably wanted an :as in there so you won't need to type in the full ns
19:20justin_smith(require '[clojure.jvm.tools.analyzer :as analyzer]) perhaps
19:20justin_smiththen you can do (analyzer/whatever ...)
19:22blake__I gotta have the '...or it tries to eval clojure.jvm.etc...
19:22justin_smithyes, that is normal
19:22blake__*phew* OK, thanks, justin_smith. That works.
19:22justin_smithnp
19:26antonvSorry, I have quit for a moment. So is there a way to load newly downloaded dependencies without restarting nREPL?
19:27tuft_antonv: i believe so, but can't remember which project. something gives you lein within the repl
19:27cbp$google clojure alembic
19:27lazybot[pallet/alembic · GitHub] https://github.com/pallet/alembic
19:29tuft_cool
19:37antonvtuft: cbp: thanks
19:42Raynesarrdem: I don't think we could possibly be more musically incompatible.
19:53michaniskini'm using classlojure, but cannot dynamically change the classpath for the classloader created by classlojure. is there a way to accomplish this?
19:54blake__justin_smith: If I'm doing this in a project.clj, would I use "dependencies" rather than "requires"?
19:55blake__Wait, there's not a big connection, is there.
19:56blake__Dependencies in the project make it available to the cljs, which then use require?
19:56michaniskinblake__: that's correct
19:57michaniskinblake__: require allows you to refer to vars in other namespaces
19:57blake__Thanks, michaniskin. Dunno why I'm struggling with it.
19:57michaniskinblake__: dependencies makes it so that those namespaces are on the classpath
19:58michaniskinblake__: so they can be require'd
19:58blake__Got it. (I hope.) Thanks.
20:02amalloymichaniskin: if you want a different classloader, you can use the lower-level constructs like eval-in, instead of the high-level function classlojure
20:03amalloybuild a classloader however you want, either on your own or with classlojure functions, and then pass it to eval-in
20:05michaniskinamalloy: is there a classloader you'd recommend?
20:05michaniskinamalloy: i get an exception that tells me the classloader is not dynamic
20:09michaniskinamalloy: nm i think i have a plan
20:11kenrestivoso, dumb nrepl question: when i do (clojure.core/load-file "/somewhere/foo.clj") what actually gets executed and where?
20:12kenrestivodoes nrepl intercept that and do some magick? or does it get executed in the target vm. if the latter, that's impossible, because on android that file doesn't exist but the operation succeeds (for some files)
20:12technomancykenrestivo: it's on the target
20:13scottjantonv: pomegranate, with latest-clojure-libraries.el if you use emacs.
20:13technomancythere are ways to make that smarter using nrepl ops, but if load-file is what is being called, it's not going to be that smart
20:13kenrestivotechnomancy: wow. then i'm baffled as to how it can find a file on a filesystem it doesn't even have
20:13kenrestivoand open it, and compile it. i suspect magick.
20:14kenrestivocontext is: some files it succeds on, some files it ENOENT's on. the files are right next to each other, in the same directory path.
20:15hiredmankenrestivo: I suspect it would load it from the classpath, I know load does, but I haven't used load-file in a long time
20:16amalloyhiredman: it looks to me like load-file is a compiler special form, implemented as Compiler/loadFile(String), and that uses FileInputStream - no classpath tomfoolery
20:17amalloyperhaps the android runtime handles it differently
20:18hiredmanoh
20:18hiredmanhmmm
20:18hiredmanI know there is some nrepl middleware that will load files up as strings and pass them to the compiler that way, I forget if it actually intercepts load-file calls
20:19technomancyiirc this is basically a textbook case for why to use nrepl ops
20:19technomancybecause they can be intercepted without shenanigans
20:19hiredmanit doesn't intercept
20:19hiredmanit is an op
20:19hiredmanhttps://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/load_file.clj
20:20kenrestivohiredman: thanks, that looks like it
20:21hiredmankenrestivo: seems unlikely
20:21hiredmankenrestivo: it doesn't futz with stuff, so if you typing (load-file ...) in to the repl, that wouldn't effect it
20:21kenrestivothen i'm stuck. i have no idea how i can run (clojure.core/load-file "/tmp/foo.clj") and it will succeed when there is no such file on the target
20:21hiredmanare you sure you are connected to the target?
20:22kenrestivoyep
20:22hiredmanwhy?
20:22clojurebotwhy is startup slow is busy compiling the `for` macroexpansion
20:22kenrestivowell, i'm sure i'm connected. i'm not necessarily sure that the code i'm executing is executing on the target
20:22hiredmanso check?
20:22kenrestivobut it seems likely. i'm looking at the packet traces of nrepl
20:23hiredmanok, so you see packets being sent to the target?
20:23kenrestivoand emacs is sending d2:id1:92:op4:eval7:session36:b7a2b815-c36a-49ea-9694-ea8fa189adb24:code135:(clojure.core/load-file 3"
20:24kenrestivoand is getting back OKAY, then WRTER...........H8......d2:ex35:class java.io.FileNotFoundException2:id1:97:root-ex31:class libcore.io.ErrnoException7: ...
20:24hiredmanso it is getting back an exception
20:24kenrestivowhich implies to me that it's executing on the target
20:24hiredmanand it is not getting back an exception for /tmp/foo.clj ?
20:25kenrestivonope.
20:26hiredmanhow do you know /tmp/foo.clj doesn't exist?
20:26hiredman(.exists (java.io.File. "/tmp/foo.clj"))
20:27kenrestivotrue
20:27hiredmanso it does exist
20:27kenrestivowhich is bizarre, because it does NOT exist on the target
20:27hiredman(slurp "/tmp/foo.clj") will give you a string of the contents
20:27kenrestivoit exists on my host
20:28kenrestivoit will. hmm
20:28hiredmankenrestivo: how do you know it does not exist?
20:28kenrestivoand it does
20:28kenrestivowill adb shell in and look
20:29kenrestivowat!??
20:29lazybotkenrestivo: Uh, no. Why would you even ask?
20:29kenrestivoit does exist
20:29kenrestivonow i'm even more confused
20:30kenrestivohiredman: wow that's odd. it does in fact exist on the target vm, in that path, somehow. how exactly, i have no idea
20:30clojurebotExcuse me?
20:31hiredmankenrestivo: so why does it exist?
20:31technomancyhttp://p.hagelb.org/mystery.gif =)
20:32kenrestivoi have a few ideas. will look
20:35kenrestivobecause i have a debian installation on my android device, with the same directory structure as my desktop, and my source files in there... but an earlier git version that does not have that particular source file.
20:35kenrestivosolveded
20:36kenrestivogot too damn fancy. C-k is not supposed to ever work on a remote android target. the fact that it did for some files was weird, not the fact that it didn't for others. not working is the normal operating mode for load-file or C-k
20:37kenrestivohiredman: technomancy: thanks for helping me untangle my way out of the trap i created for myself
20:37hiredmanif cider user the load-file middleware for C-k it could work
20:41amalloyif cider used load-file middleware to load files from my desktop instead of the env i'm connected to for C-c C-k, that would be like the first feature that might get me excited enough to switch from swank
20:44hiredmanamalloy: nah, they'll just pick some random other key binding for it and do it in a way that breaks half the time
20:53kenrestivoi've held out this long with nrepl and plan to do so more or less indefinitely
20:57pdksounds like a forkin' good plan!
21:07gwzhey, if you are doing walk function, is it possible to get the next value during an iteration
21:09hiredmanno
21:20gfrederickshiredman: I'm having a hard time interpreting your IRC toot unless s/asking/answering/
21:21gfredericksfor some reason it's become important to me to know which way that was supposed to go
21:22hiredmangfredericks: oh, well most of my lines in my recent exchange with kenrestivo ended with question marks
21:23kenrestivoand, just for the benefit of the aether, people googling irc logs, and to shout into the void: something in the clojure-android build toolchain will remove namespaces which are "dead" and not referenced elsewhere in the codebase
21:24gfrederickshiredman: I was wondering if it was something like that; and here I could have figured that out myself by scrolling up a page :/
21:24Frozenlockkenrestivo: Oh wow... I would have wondered wtf was going on
21:24kenrestivoso, (in-ns 'foobar) will not have any fn's, refs, atoms, or what have you, if the foobar ns is considered dead code
21:24kenrestivothat's what started me on this journey of discovery... let's see (checks logs)... 3 hours ago
21:25Frozenlockkenrestivo: the other I had a similar journey, only to end up realizing that clj-time doesn't work well on Android. :-(
21:25Frozenlock*the other day
21:26kenrestivoyeah, i'm using the android-specific stuff, java.text.SimpleDateFormat java.util.Locale java.util.TimeZone
21:27kenrestivopulling in yet another library is something i avoid in an app that is 8mb and climbing and all it does is play streams off the internet
21:27Frozenlockbtw, would you know if a clojure app is faster on linux/java, or on android? (say for an AllWinner A10 or something like it)
21:28kenrestivoFrozenlock: https://github.com/kenrestivo/spazradioapp/blob/master/src/clojure/org/spaz/radio/schedule.clj
21:28amalloymy understanding is that, up to experimental error, everything is slower on android than elsewhere
21:29Frozenlockamalloy: thanks. It 'felt' that way, but I wanted to have another input.
21:29hiredmangfredericks: dakrone told me I was a practitioner of maieutics once
21:29gfredericks,(->> ["a" "z" "c"] sort last) ; how to do this with fewer logs?
21:29clojurebot"z"
21:30hiredmangfredericks: reverse the sort?
21:30gfrederickshiredman: logs not n's
21:30gfredericksit's a linear algorithm
21:30gfrederickseasy to do with ugly code via reduce & compare
21:30gfredericksjust seemed strange to have to resort to that
21:31hiredmanuse a sorted data structure to begin with?
21:31gfredericks,(->> ["a" "z" "c"] (reduce #(if (neg? (compare %1 %2)) %2 %1)))
21:31clojurebot"z"
21:32hiredmanmaybe one of those fancy trees in contrib
21:32gfredericksthey'll be in a map, so I'd have to go find a lib that has a sorted-by-function-of-vals map
21:32gfredericksI'll take that as a "no, it's not easy" :)
21:32amalloygfredericks: i mean, you can write it once, and then it's easy for everyone else forever
21:32hiredmangfredericks: you want multiple indices (maps) instead of a single one
21:33gfredericksno I need it in clojure.core right now hold on while I make a pull request
21:33hiredmanuse derby and java jdbc and make sure to use indices on the right columns
21:33kenrestivoamalloy: it's the launch that's super slow. execution is, i'm told, no faster in re java on dalvik than on a jvm, modulo type hints and other optimizations
21:34kenrestivos/faster/slower/
21:35kenrestivoamalloy: some of the issues were discussed here https://www.youtube.com/watch?v=8NUI07y1SlQ
21:35kenrestivomight have been in the Q&A tho
21:51hiredmanhuh https://github.com/clojure/java.internal.invoke
21:54gfredericksis there any pattern between libs named java.* vs jvm.*?
21:54hiredmangfredericks: brosa does one, halloway does the other?
21:55Jaood;)
21:56gfrederickslooks like the only jvm.* is jvm.tools.analyzer
21:56gfrederickswhich has only ambrose in the recent commit log
21:56hiredmanoh well
21:56gfredericksfun fact: jvm.tools.analyzer != tools.analyzer.jvm
21:56hiredmanah, no wonder
21:57gfredericksperhaps someday we can invent meanings for even more permutations of those words
21:57hiredmantoolsanalyzerjvm..
21:58gfredericks(inc hiredman)
21:58lazybot⇒ 40
22:10antonvquick poll: what IDE do you use?
22:10antonvI tried CIDER and LightTable, lookin for better options
22:10bodie_I'm using Emacs Live and it's quite nice
22:11xeqiantonv: what would make it better?
22:11bodie_in particular, the in-flight completion, command suggestions (including substring matches e.g. "jack" matches cider-jack-in)
22:11bodie_also comes with lots of bundled goodies
22:12bodie_xeqi, I was going to use LightTable until I noticed that it doesn't have current Leiningen compatibility.
22:12bob2emacs
22:12bodie_Emacs Live plays _really_ nice with lein
22:13Jaoodantonv: check out cursive if you want a real "IDE"
22:14bodie_why use a "real IDE" when Emacs is already built from the ground up around Lisps?
22:14bodie_everything you need is either in Leiningen, lein bundles, or Emacs and its bundles
22:14Jaoodmaybe IntelliJ is his thing
22:14bodie_possible
22:14bodie_seems overwrought for clojure
22:15antonvxeqi: in CIDER cmpletion doesnt' work for me, no hints for function arguments
22:15antonvI have tried inspector - problems there too
22:16antonvin LightTable other problems
22:16bodie_I actually came here to ask about classy Clojure programming -- newish to the language (so don't take my advice.) I'm finding it really complicated and weird and I'd like to know if there are any good docs not on WHAT it is as much as how and when to use it, and why
22:16bodie_i.e., deftype, defrecord, etc
22:16antonvI think I would like EmacsLive, but I already have my .emacs configuration, how to use them together?
22:17bodie_you can put your stuff into a personal bundle. it backs up your existing .emacs when you install it using their install script
22:17bodie_but a word of warning, emacs is .... weird and different if you're not used to it
22:17bodie_but you prolly know that
22:18bodie_I mean, we're in #clojure right
22:19pterygotayeah i've moved my personal configuration to the emacs live setup and it's working fine
22:20bodie_oh nvm he has a personal emacs setup, so why am I telling him emacs is weird
22:20pterygotause the instructions for creating a custom live pack with your existing configs in it
22:20antonvbodie_: I need my Emacs config active, not backed up in other dir
22:21bodie_right, can put it into a personal subpack
22:21antonvbecause I use emacs not only for Clojure coding, but of other things too
22:21pterygotayeah it's active
22:21antonvbodie_: subpack? any hints on that?
22:21pterygotasteps are well described in the emacs-live readme
22:22pterygotaand in the the readme in the user-template-pack directory
22:23antonvpterygota: OK thanks. I would be more natural if EmacsLive was a subpack of my config than other way around...
22:24bodie_yeah, it's kind of opinionated / dominating lol
22:24antonv:)
22:24pterygotayeah i kind of agree antonv but i like it enough and now that it's set up i basically can do the same things i used to
22:25pterygotaalso changed my package-user-dir to install inside of my personal live-pack so basically the .emacs.d directory belongs entirely to emacs live now and everything custom happens inside the personal live-pack
22:27pterygotathat way i can just git pull to the .emacs.d in order to update emacs-live from github
22:28antonvpterygota: how does it work with other package managers? I have various emacs packages installed (paredit, ect)
22:29pterygotai started over and reinstalled everything after setting my user-package-dir to a directory within the live-pack i made for myself
22:29pterygotaso it works fine with other package managers
22:29pterygotai just did that to simplify the process of updating emacs-live, so now really everything custom is in my live-pack including my package archives
22:30pterygotabut i'm pretty sure emacs-live has its own paredit setup
22:31antonvpterygota: thanks for the info
22:32pterygotano problemo
22:38bodie_anyone have suggestions for a resource to learn about deftypes / etc besides the docs? I'm not confused about how they work or how to use them, but why and when
22:39bob2Programming Clojure has stuff about it
22:39bob2tldr for java interop
22:39bodie_hm
22:39Frozenlockbodie_: http://vimeo.com/53223938
22:40Cr8http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
22:40arrdemRaynes: lolz... it's gonna take a while before my collection stabilizes
22:41bodie_thanks Frozenlock
22:52Raynesarrdem: <3
22:52RaynesWe both have Owl City plays!
22:52RaynesSo there's that!
22:53arrdemRaynes: I mainly shuffle my collection...
22:53arrdemRaynes: so the next two months are gonna be a random walk through my tastes in no order
22:54Raynesarrdem: I've never met anyone else who does that.
22:54RaynesIt's what I do as well.
22:54RaynesEveryone else is playlists and radio and crap.
22:54RaynesI just want to hear my favorite stuff on repeat...
22:54RaynesOccasionally explore to find new music, but not constantly...
22:54RaynesI can't like music until I've accepted it and appreciated it for a period of time.
22:58arrdemeh... I've enjoyed spotify radio as an exploratory tool..
22:59arrdembut ultimately I'll just take what I liked and buy it for myself
23:01arrdemRaynes: yeah.. I'm kinda of the oppinion that if I'm not happy to hear it shuffle in, rm -rf
23:02Raynesarrdem: Oh, I certainly don't buy mp3s.
23:02RaynesI don't pirate though.
23:02RaynesI just use a streaming service.
23:02RaynesAny of spotify, google play, or rdio.
23:02RaynesAll of them are totally cool with me.
23:02RaynesBut yeah, radio is good when you actually want to explore.
23:02arrdemyou should work harder to incur their wrath then :P
23:02RaynesBut sometimes, and most of the time in fact, I just want to hear my good stuff, man.
23:03arrdemSpotify has been really nice... I just grab a radio station based on anamanaguchi and I'm golden
23:36bodie_Frozenlock, this video on polymorphism in clojure is exactly what I needed! awesome. much appreciated
23:41Frozenlockbodie_: You are very welcome. You should thank the guy speaking in the video :p
23:42bodie_:)