#clojure log - Apr 09 2014

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:53 paxan: Is 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?

0:56 beamso: https://github.com/clojure/tools.reader#differences-from-lispreaderjava ?

1:06 amalloy: verma: 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

1:06 seancorfield: If you only need to read _data_ you're safer using clojure.edn/read-string

1:09 beamso: this is probably a stupid question but does anyone serialise to edn?

1:12 seancorfield: (pr-str data) produces edn - for data structures :)

1:18 btw, if there are any ops around nanaki PM'd me with a spam/malware link so they probably ought to be kicked and banned

1:18 beamso: i probably got the same spam

1:27 amalloy: seancorfield: 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?

1:50 seancorfield: dunno about spam but connectivity sure has sucked lately on freenode :(

1:56 amalloy: seancorfield: the past day or so are probably due to the openssl vulnerability

1:57 seancorfield: evrything being patched and restarted you mean?

1:57 amalloy: yeah

1:57 https://twitter.com/freenodestaff alleges some of that

1:58 i haven't had any connectivity issues, but then i don't usually notice them anyway, since i connect through a bouncer

2:02 seancorfield: I'll follow that Twitter account. Thanx amalloy !

2:02 dammit nanaki is spamming me again :(

2:15 paxan: seancorfield: 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?

2:27 Frozenlo`: 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?

2:32 bob2: did you do cider-jack-in

2:32 did you fix up your .emacs to not refer to dead nrepl things

2:32 etc

2: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?

2:34 bob2: is it public?

2:34 did you pass the right number of args?

2:34 [Neurotic]: bob2: THANK YOU

2:34 getter takes an argument. I totally missed that

2:35 bob2: woo

2:35 [Neurotic]: yep, that works now

2:35 *facepalm*

2:35 I was staring at that for hours

2:35 (well not quite hours, but still)

2:38 Frozenlock: Well, I installed the git repository instead of the ELPA package and now it looks fine.

3:18 waynr: could anyone recommend a good example of partial function application where the order of arguments matters?

3:19 wink: pow()?

3:26 waynr: nevermind, i think the docstring actually explains partial well enough

4:40 maxthoursie: anyone knows anything about dates for this years conj ?

4:42 _kardan: I'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?

4:45 More 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.

5:50 zhzhxtrrk: how to override a java method with varargs?

5:50 with gen-class

6:03 clgv: zhzhxtrrk: have a look at the "-main" method for jars

6:03 zhzhxtrrk: though thats defining and not overriding, but the varargs syntax is the same

6:31 noncom: how do i set a single element in a primitive java array?

6:33 dnolen_: noncom: aset

6:38 zhzhxtrrk: clgv: I'll try.

6:39 clgv: thanks

6:40 clgv: ,(apropos "aset")

6:40 clojurebot: (aset-long aset-float aset-double aset-boolean aset-char ...)

6:40 clgv: noncom: depending on the concrete type you should choose one of those ^^

6:41 noncom: hmm, 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?

6:42 oh and just noticed that clojure 1.6.0 is released... where can i see the list of changes for it?

6:43 zhzhxtrrk: clgv: how to declare the method sigatures? I never see the sigature for -main.

6:43 clgv: noncom: and the penalty of (un)boxing

6:43 zhzhxtrrk: it's (defn -main [& args] ...)

6:44 noncom: the Changes.md on the github repo ;)

6:44 zhzhxtrrk: I mean the (gen-class :methods [[main ....]])

6:44 noncom: clgv: oh right, just found it. i think i googled it wrong before asking :)

6:44 clgv: zhzhxtrrk: seems that is not needed for "-main"

6:45 zhzhxtrrk: clgv: I know it's not needed for -main, but with my case, I do need one.

6:46 clgv: We have a test framework writen in java, it's need a class overriding it's method with extra annotations.

6:47 clgv: zhzhxtrrk: do you own a copy of clojure programming? there is a gen-class example on page 378

6:49 zhzhxtrrk: here is one as well http://clojure-doc.org/articles/language/interop.html#gen-class-and-how-to-implement-java-classes-in-clojure

6:54 zhzhxtrrk: clgv: thanks

8:06 aka: do any of you guys have advice for deploying clojure apps to aws?

8:07 I guess I'll checkout pallet since I can't stand the idea of using tomcat (aws beanstalk uses it)

8:10 yotsov: aka: 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 :)

8:16 that 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 :)

8:16 petron: is there a channel for Om?

8:21 broquaint: petron: I don't think there's a dedicated channel but #clojurescript is a good channel for it.

8:21 petron: thx, broquaint

8:22 yotsov: petron: also #reactjs potentially

8:39 aka: j clojurescript

8:40 I meant to do that

8:40 yotsov: I've been using http-kit behind nginx and varnish

8:40 it's depressing thinking of tomcat

8:43 just ran across nginx-clojure benchmarks that indicate it is better than anything ever

8:44 now to figure out what it is

8:47 okay that just seems insane

8:48 pallet is not working

8:48 anyone know if pallet is still relevant?

8:48 (the clojure lib for cloud deployment)

8:52 clgv: aka: yeah, why should it not be?

8:53 mdrogalis: Does bitemyapp not hang around here anymore?

8:57 hugod: mdrogalis: I think you pinged me the other day - still relevant?

8:57 mdrogalis: hugod: Indeed. clj-ssh question. Figured it out, ty :)

8:57 hugod: aka: you can get pallet help in #pallet, though there are usually more people around later in the day

9:03 aka: clgv: 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

9:04 I see it's totally active

9:04 thanks hugod

9:06 hugod: aka: try pallet-jclouds 1.7.0-alpha.3 to get round jclouds/guava issues with the latest jdk

9:09 aka: hugod: thx, giving that a try

9:25 mdrogalis: dnolen_: ping

9:33 _tim__: Anyone using datomic with geo spatial data?

9:35 john2x: how do I call a function, that takes `& {:as optargs}` as optional args, with a hashmap? basically **kwargs in python..

9:35 so given {:foo :bar}, I want to be able to call (somefn "fizz" :foo :bar)

9:36 jcromartie: ,(flatten {:foo 1 :bar 2})

9:36 clojurebot: ()

9:36 jcromartie: oops

9:36 ,(flatten (seq {:foo 1 :bar 2}))

9:36 clojurebot: (:bar 2 :foo 1)

9:36 jcromartie: so you could apply that

9:37 (apply f "fizz" (flatten (seq m)))

9:37 kind of ugly

9:38 john2x: jcromartie: thanks!

10:09 dnolen_: mdrogalis: pong

10:12 mdrogalis: dnolen_: 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:13 dnolen_: mdrogalis: what are you trying to do? (om/value cursor) will work during render, @cursor outside, you can pr-str that.

10:13 mdrogalis: PM

10:47 bodie_: ,(= (20 (fn [f] (f 10 10) fn [x y] (+ x y))))

10:47 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/fn, compiling:(NO_SOURCE_PATH:0:0)>

10:48 bodie_: Anyone know why this doesn't work?

10:49 llasram: I honestly don't know where to start

10:49 You 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:49 bodie_: "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:50 ah, I must have misplaced that parenthese before 20. woops :) thanks

10:52 llasram, I understood what you said, except the bit about fn in a non call position

10:52 the goal there was to define an inline function which gets passed as the argument to the first defined function

10:54 so I don't understand why an inline function can't be an argument to another function

10:55 or I'm misunderstanding something else

10:57 in fact, the very next koan does what appears to me to be exactly the same thing

10:57 ,(= 25 (fn [f] (f 5) fn [n] (* n n)))

10:57 clojurebot: #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/fn, compiling:(NO_SOURCE_PATH:0:0)>

10:57 bodie_: oh, that doesn't work either... hmm

10:57 llasram: bodie_: You're still using `fn` in non-call position

10:58 Are you trying to do ? ##(= 25 ((fn [f] (f 5)) (fn [n] (* n n))))

10:58 lazybot: ⇒ true

11:00 bodie_: 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:00 llasram: You create anonymous functions with `(fn [args..] body...)`

11:00 bodie_: 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:00 llasram: All the `body...` forms become the body of the function

11:01 bodie_: "body..." needs to be an sexp right?

11:01 llasram: vs what it looks like you're expecting, that any free sequence of `fn [args...] body` becomes a function

11:01 bodie_: yes, clearly my expectations were misaligned, which is why I came here ;)

11:01 llasram: `body...` is any number of forms, which can be atomic values or s-expressions

11:01 bodie_: I see

11:02 I think that does clarify :)

11:02 appreciate the help

11:04 oh, I get it. the "fn" macro gets evaluated into an actual function

11:04 when it is the function of an sexp

11:07 llasram: Pretty much

11:20 durm: hello guys

11:20 can you help me with compojure

11:20 ?

11:20 llasram: ~anyone

11:20 clojurebot: Just 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:20 cbp: durm: just ask yor questions

11:20 llasram: #clojure is in a surly mood today :-)

11:21 durm: I want to specify directory for upload files by passing cli params. How can I get access to this param from request handlers?

11:24 cbp: durm: cli params?

11:25 durm: (command line interface) args to main function

11:25 I have param which is called media

11:26 But when I do run-jetty

11:26 with routes

11:27 how can I pass param to handlers?

11:27 jcromartie: durm: there are a few ways you could do it

11:28 you could construct your handler as a closure over the media argument

11:28 cbp: durm: you can use a global variable such as an atom that you modify in your main and have your routes depend on that

11:28 jcromartie: or you could use middleware to attach the value to the request

11:29 (defn wrap-media [handler media] (fn [req] (handler (assoc req :media media))))

11:30 actually 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:30 sszzqq: what use for "clojure-1.6.0-slim.jar"?

11:31 Slim is related with emacs?

11:31 durm: jcromartie: 2nd way. param will be in {params :params}?

11:34 jcromartie: durm: no, it will be a key of the request map itself

11:34 you can destructure that with compojure's map destructuring

11:34 or you can just write handler functions that take the whole request and not really worry about the destructuring in the compojure routes

11:35 gtrak: ibdknox: 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:36 coventry: Oh, was that your video on /r/clojure today? Nice work.

11:36 _tim__: any datomic users here?

11:36 gtrak: ibdknox: useful in the context of light-table

11:37 technomancy: _tim__: probably more in #datomic

11:37 durm: jcromartie: cbp: thanks guys

11:39 gtrak: coventry: thanks! :-)

11:40 _tim__: thanks

11:44 gtrak: coventry: the coolest thing about it is it's not specific to cider.

11:44 just nrepl middlewares.

11:45 bbloom: interesting 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:46 which 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:46 gtrak: tpope: 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:47 '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:00 stuartsierra: bbloom: Those are using types, right? So you couldn't have different sets of "tags" in one program?

12:06 bbloom: stuartsierra: yeah, uses types, but i think it's per module, not per program

12:06 stuartsierra: which is not much better, but still

12:06 stuartsierra: presumably you can use newtype to work around that restriction quite easily, which is essentialy the same as defining a new tag

12:08 gfredericks: (defprotocol IZero (zero [x]))

12:10 hlship: Anyone familiar with Korma and HSQLDB handy?

12:10 rasmusto: ~anyone

12:10 clojurebot: anyone is anybody

12:10 rasmusto: ~anyone

12:10 clojurebot: anyone is anybody

12:10 rasmusto: ugh

12:10 cbp: clojurebot: you troll

12:10 clojurebot: Titim gan éirí ort.

12:10 llasram: SO SURLY

12:10 rasmusto: hlship: long story short, ask questions first :)

12:11 hlship: Korma is putting double quotes around table and columns names

12:11 works in Postgres but not in HSQLDB (using for testing)

12:15 Ok, I think I've got it worked out; the double quotes enable case sensitivity, and HSQLDB converts unquoted table names to upper-case.

12:15 arohner: stupid question. In :foo/bar, (namespace) returns "foo". what fn returns "bar" ?

12:16 gfredericks: name

12:16 arohner: ah, thanks

12:17 justin_smith: name also works on symbols

12:18 as does namespace, I now see

12:22 aka: is there an idiomatic way to put a noop placeholder in clojure?

12:23 justin_smith: aka: in what context?

12:23 gtrak: aka: if it's a function call, identity works great.

12:23 in a let binding, _ is a good placeholder

12:24 justin_smith: {} is good for a value that will be filled in later

12:24 aka: I 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:25 justin_smith: functions don't need bodies

12:25 ,((fn []))

12:25 clojurebot: nil

12:26 justin_smith: ,((fn [] #_ (eventually this will shut something down)))

12:26 clojurebot: nil

12:26 justin_smith: <3 #_

12:26 aka: perfect

12:26 thanks

12:27 justin_smith: just note that the data following #_ needs to be a valid / readable form

12:27 even if the symbols in it are not bound

12:28 aka: gotcha

12:30 ambrosebs: Bronsa: apparently the stale :deftype class didn't fix Sean's issue

12:30 Bronsa: I'll try and recreate the situation

12:30 I assume it's something to do with definterface

12:39 * gfredericks forgot about seque again

12:40 gfredericks: seque covers about 90% of the times I've had the thought "I could do that with core.async"

12:41 Bronsa: ambrosebs: I'll look into this in ~10 minutes, let me know if you can reproduce

12:42 gtrak: gfredericks: you probably don't want to use core.async for a single queue :-).

12:45 so, 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:46 maybe 90% is a little generous

12:46 ssqq_: How to know current namespace symbol table?

12:46 justin_smith: ssqq_: (ns-publics *ns*)

12:47 ,(ns-publics *ns*)

12:47 clojurebot: {}

12:47 justin_smith: ,(do (def foo :foo) (ns-publics *ns*))

12:47 clojurebot: {foo #'sandbox/foo}

12:47 hyPiRion: ns-refers for all the functions you can use in a namespace

12:47 ,(ns-refers *ns*)

12:47 clojurebot: {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:48 justin_smith: hyPiRion: that is only for things you can use unqualified by a ns prefix, right?

12:48 hyPiRion: justin_smith: yes

12:48 justin_smith: ,(map ns-publics (all-ns)) ; to get EVERYTHING

12:48 clojurebot: ({} {} {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:50 justin_smith: oh wait, that lacks things from the current ns that are not public (but are still visible since you are in said ns...)

12:51 ,(cons (ns-interns *ns*) (map ns-publics (all-ns))) ; OK that should be everything

12:51 clojurebot: ({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:53 Bronsa: ambrosebs: so, nothing to do with definterface.

12:54 ambrosebs: 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:56 tpope: gtrak: you taking completion or a bigger picture?

12:56 ambrosebs: Bronsa: ah. Haven't tried it yet

12:56 gtrak: tpope: we use file/line for navigating source.

12:56 so, hover over a symbol, get the info, jump to the file, which might be inside a jar.

12:57 so I'd type 'om/build', hit M-., then I'd be in the om.core namespace source looking at the impl.

12:58 'om' is an alias resolved from the current repl namespace, that's one of the arguments to info.

12:58 the "info" nrepl op

12:58 tpope: this was a middleware right? I've forgotten most of the context

12:58 gtrak: yea yea

12:59 tpope: can you link me?

12:59 gtrak: to what, specifically?

12:59 tpope: where does this middleware live?

13:00 gtrak: https://github.com/clojure-emacs/cider-nrepl

13:02 technomancy: gtrak: so you're working on making that less emacs-specific?

13:02 gtrak: it's already not emacs-specific, unless I'm missing something

13:02 gotta run for a few mins, but I'll scroll up.

13:02 technomancy: well, the readme at least

13:03 gtrak: ah.. I guess I could :-)

13:04 tpope: and the name :)

13:04 but if that's the worst problem I'll take it

13:12 myguidingstar: hi 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:14 Bronsa: ambrosebs: I think I got a fix

13:17 stuartsierra: myguidingstar: Try (pst)

13:23 myguidingstar: stuartsierra, I set up things like your reloaded template, but (pst) returns nil even after an :error-while-loading

13:28 Bronsa: ambrosebs: http://sprunge.us/LDTP this seems to fix the issue

13:29 gtrak: tpope: I had to get assimilated to get help from bbatsov, name wasn't really up to me, sorry :-).

13:31 ambrosebs: Bronsa: thanks! how did you figure that out?

13:31 justin_smith: myguidingstar: so you are using component to reload the ns?

13:31 myguidingstar: if so, try (require 'some.ns :reload) and then looking at the error

13:31 Bronsa: ambrosebs: https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/jvm/utils.clj#L16-L20 :)

13:31 ambrosebs: ;)

13:33 Bronsa: amazing commit msg typo https://github.com/clojure/tools.analyzer.jvm/commit/e11a81a98bccd2e5d4052c89fcaf10ab5663541a

13:34 Bronsa: ambrosebs: yeah

13:34 ambrosebs: I also copy-pasted that commit message in tools.analyzer and tools.emitter.jvm

13:34 when I noticed it was too late.

13:34 ambrosebs: love it

13:34 justin_smith: I would know exactly what someone meant if they said some feature was contribugged to their repo

13:34 myguidingstar: justin_smith, thanks for pointing out that. Though I expected it somehow replace the :error-while-loading message

13:35 Bronsa: justin_smith: hah

13:35 myguidingstar: (so no more keystroke ;)

13:36 justin_smith: "dude's been contribuging me about his email client patch for ages, he really needs to take a hint"

13:37 bodie_: 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:38 (if you could keep algorithm criticisms separate, that would be nice. ;) )

13:38 justin_smith: bodie_: (acc) should be acc

13:39 bodie_: also, pop sometimes takes off the beginning, sometimes the end, depending on type, you probably want rest

13:39 bodie_: and there you have it

13:39 thank you sir

13:39 justin_smith: np

13:40 also (= foo 0) is the same as (zero? foo)

13:40 Bronsa: ambrosebs: 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:40 justin_smith: or at least close enough for your usage :)

13:40 jwm: hmm lighttable is kind of dead.. anyone point me to a good way of using node.js based cljs nrepl with lighttable?

13:42 ambrosebs: Bronsa: not sure

13:42 Bronsa: might have figured it out a few years ago.

13:44 Bronsa: ambrosebs: 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:44 ambrosebs: Bronsa: thanks

13:46 oskarth: Getting 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:46 justin_smith: oskarth: don't use "use"

13:47 ambrosebs: oskarth: I think this is fixed in core.logic master

13:47 bodie_: justin_smith / anyone else -- do you think my solution was a good approach? (link for reference: http://cljbin.com/paste/5345848de4b088e54dd68ef0)

13:47 ambrosebs: oskarth: whether there's a release, not sure

13:47 bodie_: 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:47 Bronsa: uh. so the issue is because interfaces don't have Object in their ancestors

13:47 bodie_: s/?/./

13:48 justin_smith: bodie_: that is still the old version

13:48 oskarth: I see, I'll do it with require for now then, thanks :)

13:48 jwm: so another question if I just use mongodb, snmp, websockets would I be better off just switching to clojure/jvm library

13:48 bodie_: woops

13:49 http://cljbin.com/paste/53458763e4b088e54dd68ef5

13:49 that

13:49 hiredman: yes

13:50 justin_smith: bodie_: yeah, that's better, though I still think (zero? (count orig)) would be better than (= (count orig) 0) style wise

13:50 at least it is now correct, and for multiple sequential datatypes

13:50 rasmusto: what about (empty? orig)

13:50 bodie_: right, that makes sense. but algorithmically / efficiency-wise how is it, or are there other means I should use?

13:50 hmm, gp

13:50 justin_smith: (inc rasmusto)

13:50 lazybot: ⇒ 6

13:50 cbp: bodie_: you need rest not pop

13:50 justin_smith: even better

13:51 cbp: he updated it

13:51 bodie_: cbp, http://cljbin.com/paste/53458763e4b088e54dd68ef5 corrected version

13:51 cbp: ah

13:51 soz

13:51 rasmusto: wasn't sure if 'empty? works similarly for things that are counted/not

13:51 bodie_: ^^

13:51 justin_smith: bodie_: yeah, rasmusto's suggestion to use (empty? acc) is best

13:52 bodie_: that makes sense, but now I'm interested in beefing my alg design

13:52 would this be a candidate for mutable state?

13:52 let's say there are 100,000,000 elements in the sequence

13:52 that seems like it would be quite a few copies

13:52 klokbaske: Hi! Is it possible to interop with Clojure from Java without building a jar?

13:53 rasmusto: ,(take 10 (reverse (range)))[C[C

13:53 hiredman: very

13:53 clojurebot: #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>

13:53 justin_smith: bodie_: transients would not really help, sadly, because conj! appends to the end of a vector

13:53 rasmusto: ,(take 10 (reverse (range 1e6)))

13:53 clojurebot: #<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>

13:53 rasmusto: hrm

13:53 justin_smith: I guess you could use last/butlast instead of first/rest plus a transient vector and conj!

13:53 dunno if that would do any good

13:54 bodie_: interesting to think about

13:54 cbp: ,(reduce conj () [1 2 3 4 5])

13:54 clojurebot: (5 4 3 2 1)

13:54 llasram: (inc cbp)

13:54 lazybot: ⇒ 2

13:54 bodie_: lol, niiiiice

13:54 justin_smith: ,(reduce conj [] [1 2 3 4 5])

13:54 clojurebot: [1 2 3 4 5]

13:54 hyPiRion: bodie_: what do you want to do? Will you always work on a vector?

13:54 rasmusto: hah, cool

13:54 bodie_: hyPiRion, it's just to solve a Koan :)

13:54 hyPiRion: oh

13:55 ,(into [] (rseq [1 2 3 4 5]))

13:55 clojurebot: [5 4 3 2 1]

13:55 bodie_: but in principle, I'd like to know the "Right Way" of solving the general problem

13:55 justin_smith: cbp's version is the same as the source of clojure.core/reverse

13:55 which is a good hint it is the right way :)

13:55 bodie_: :D

13:55 Jaood: is clojure.core a good read?

13:55 hyPiRion: well, look up rseq if performance is a concern

13:56 cbp: a must read at some point in time

13:56 justin_smith: Jaood: the clojure code often is, but not the java code imho

13:56 bodie_: thanks hyPiRion!!

13:56 justin_smith: but even the clojure code is more fiddly and performance oriented than most clojure code in normal projects

13:56 hyPiRion: Jaood: to understand Clojure, it is. It's a bad idea to use the style used in core though

13:57 bodie_: yw

13:57 bodie_: 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:58 Jaood: yeah, that's what I though, it may impose bad style on beginner, maybe later ;)

13:58 +a

13:58 bodie_: lol -- hyPiRion -- am I right in thinking that rseq simply reverses the direction the list is accessed in?

13:59 justin_smith: Jaood: 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:59 Jaood: bodie_: in constant time

13:59 hyPiRion: bodie_: Hrm, sorta. It's not a reversed vector, it's a lazy sequence

13:59 So looking up the nth element in it is O(n), not O(1)

14:00 pyrtsa: bodie_: Also rseq won't work for lists because they don't support O(1) reversal.

14:00 ,(rseq ())

14:00 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList$EmptyList cannot be cast to clojure.lang.Reversible>

14:00 pyrtsa: ,(rseq '(1 2 3))

14:00 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Reversible>

14:00 pyrtsa: ,(rseq [1 2 3])

14:00 clojurebot: (3 2 1)

14:00 pyrtsa: Curiously:

14:00 ,(rseq (rseq [1 2 3]))

14:00 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.APersistentVector$RSeq cannot be cast to clojure.lang.Reversible>

14:00 bodie_: interesting, the distinction between lists, vectors, and sequences is still really murky for me

14:01 ew

14:01 pyrtsa: bodie_: A list is a linked list.

14:01 bodie_: that's a good point about rseq not being 1-1

14:02 justin_smith: a vector is a hash-array

14:02 http://en.wikipedia.org/wiki/Hash_array_mapped_trie

14:02 bodie_: nice

14:02 justin_smith: or wait - that is the hashmap, but vector is related...

14:02 hyPiRion: it's not a HASH-array, it's a persistent trie

14:02 justin_smith: hyPiRion: cool, thanks

14:03 Jaood: justin_smith: nice, thanks

14:03 hyPiRion: but you're right about the hashmap though

14:03 bodie_: 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:03 or as its abstracted form

14:04 justin_smith: bodie_: 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:04 hyPiRion: shameless self-plug on persistent vector explaination: http://hypirion.com/musings/understanding-persistent-vector-pt-1

14:05 justin_smith: (inc hyPiRion)

14:05 lazybot: ⇒ 35

14:05 bodie_: polymatheia... love it!

14:05 (inc hyPiRion)

14:05 lazybot: ⇒ 36

14:05 hyPiRion: :D

14:05 cbp: Ah, so that's where that post went, I was googling for it the other day and came up empty

14:06 bodie_: damn, this is awesome

14:06 hyPiRion, I assume you use clojure professionally?

14:06 (and justin_smith)

14:07 justin_smith: bodie_: yes, I develop the caribou lib as an in-house tool for a web shop

14:07 hyPiRion: bodie_: I'm still a student, but my master thesis is very closely related to the persistent vector

14:07 but I'm going to work in Clojure for a startup from July and onwards

14:08 bodie_: congrats :)

14:08 justin_smith: startups have this ingenious system where you can cash in SAN points for large amounts of money

14:08 it's a great deal if you have more sanity than you know what to do with :)

14:08 bodie_: lol

14:09 I keep telling myself it depends on the startup

14:09 justin_smith: the vcs

14:09 they call shots

14:09 hyPiRion: yeah, it really does

14:09 bodie_: some people really suck at leadership

14:09 I also keep telling myself it's possible to bootstrap without vc, lol

14:10 justin_smith: bodie_: but the good money is post-vc, and they call the shots once their money is in the mix

14:10 pjstadig: hyPiRion: what is your master's thesis?

14:10 Jaood: while 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:10 hyPiRion: bodie_: we still don't have any VCs, only a single angel

14:10 technomancy: Jaood: I'm a fan

14:10 bodie_: awesome... what problem domain?

14:10 technomancy: for a lot of things anyway

14:11 hyPiRion: pjstadig: improving constant factors in the RRB-tree

14:11 Jaood: technomancy: oh cool, for what domains do you use it?

14:12 pjstadig: hyPiRion: cool

14:12 hyPiRion: bodie_: building industry tooling

14:13 technomancy: Jaood: 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:13 hyPiRion: It'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:13 justin_smith: hyPiRion: so many industries are like that

14:13 bodie_: heh

14:14 justin_smith: some day I may just make the killer warehouse management app, having used a piece of shit one once upon a time

14:14 hyPiRion: justin_smith: yeah, but the thing is, there seems to be noone trying to solve the problem

14:14 Jaood: technomancy: hasn't the bigcouch code been merge into couchdb yet?

14:14 bodie_: there's so much shit out there it's almost impossible to know where to start

14:14 technomancy: Jaood: IIRC it's in progress as we speak

14:14 justin_smith: hyPiRion: yeah, lots of inertia and "well it's almost good enough" in specific domain oriented tech all around

14:14 hiredman: hyPiRion: selling ads faster to the highest bidder is the challenge of our generation

14:14 technomancy: I haven't used any database nontrivially in years though

14:15 bodie_: most of the problems which are currently solved with shit, aren't looking for solutions, is the major abstract problem

14:15 technomancy: unless you want to get pedantic and count s3

14:15 justin_smith: hyPiRion: the hard point is selling them on the retraining (unless you plan on totally insane backwards compat quagmire)

14:15 hyPiRion: justin_smith: "we can't afford the training of this almost equivalent tool UI-wise, which processes stuff 5 times faster"

14:15 bodie_: lol

14:16 I mean, look at the software places like Sears use at registers

14:16 hyPiRion: "oh no, now I can't make coffee while my 4 GB model loads on my computer"

14:16 "let's switch back guys"

14:16 bodie_: it sucks horribly but it'll be around forever because they don't have a real need to improve

14:17 lol hyPiRion

14:17 seems legit

14:17 justin_smith: hyPiRion: you have users who don't understand the software, they just have a very specific workflow memorized

14:17 they hate any replacement because they hate learning

14:17 it's a big problem

14:18 bodie_: solution: all jobs should be a single button press

14:18 hiredman: Jaood: 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:18 justin_smith: also 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:18 hyPiRion: justin_smith: Well, not necessarily learning, but the fear of wasting money on something insignificant

14:19 justin_smith: and yeah, with the old system it was easy to do that

14:19 technomancy: hiredman: but you can mapreduce in erlangggg!

14:19 bodie_: dat erlang

14:19 hiredman: technomancy: oh boy!

14:19 justin_smith: hyPiRion: no, the people actually using the tool hate change and hate learning and hate the fact they even have to use a computer

14:20 bodie_: so the real problem is even bigger than the fact that all the shitty situations out there aren't being improved

14:20 hyPiRion: justin_smith: I'm still too young I guess, with a naive optimistic world view. :p

14:20 bodie_: the real problem is the people perpetuating them

14:21 justin_smith: I saw first hand the reason new tools don't catch on, before I even got into the software biz

14:21 hiredman: eventual consistency is also something I would only choose if backed in to it

14:22 bodie_: 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:22 Jaood: hiredman: http://docs.couchdb.org/en/latest/intro/consistency.html :)

14:23 bodie_: so then the problem to solve isn't "everyone is stupid", it's "how do I get smart people together"

14:23 hiredman: Jaood: what is the purpose of this link?

14:23 justin_smith: bodie_: 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:24 bodie_: 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:24 you have to be like 500% better than the status quo

14:24 hiredman: I am well aware of cap

14:24 bodie_: heh

14:24 Jaood: hiredman: oh, misundertand you, though you were asking about eventual consistency in couchdb and was reading that at the moment

14:25 hiredman: oh no, http://couchdb.apache.org/ has everthing that triggers a "pass" from me, no futher reading required :)

14:25 bodie_: 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:26 hiredman: I am sure it's great or whatever, I am just not interested :)

14:26 bodie_: 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:26 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:27 then again... sell what they're buying, right

14:27 mapreduce all the things

14:27 gtrak: bodie_: it's the logical outcome.

14:27 llasram: hiredman: But it's written in Erlang!

14:28 bodie_: seems illogical to me ;)

14:28 gtrak: don't worry, in 20 years we'll all be writing netkernel.

14:28 hiredman: great, so the log files will be in linear b

14:28 bodie_: i'm still holding out hope for hurd :P

14:29 miseria: "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:29 bodie_: juuuust kidding.

14:29 gtrak: bodie_: when it's easier to add another hack than to generalize, you get layers of virtualization :-)

14:30 if we had a top-down-enforced distributed lisp machine, this wouldn't be a problem.

14:30 pandeiro: could 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:31 gtrak: or at least we'd have better abstractions than bash scripts

14:31 pandeiro: I specifically don't know interop well enough to translate the XLib interface into Clojure

14:31 bodie_: lol

14:31 amalloy: pandeiro: 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:31 bodie_: "We're from the IRS. It seems your DLISP node isn't performing up to the expectations of your salary level."

14:32 "Do not resist."

14:32 pandeiro: amalloy: you may be able to, but i was unable to figure out how ;)

14:32 gtrak: bodie_: tradeoffs :-)

14:32 amalloy: there's a Share button at the bottom-left of each answer

14:32 bodie_: fair enough

14:32 I for one welcome our LISPy overlords

14:32 pandeiro: amalloy: that's not a button

14:33 but i grant your point

14:33 oskarth: Using 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:33 pandeiro: the piece i am trying to do is here: http://stackoverflow.com/a/18275492

14:33 amalloy: as for the question - i wouldn't write that in clojure. it's much easier to just write that interface in java

14:34 include it in your clojure project if you want; lein makes that easy

14:34 pandeiro: amalloy: interesting, i didn't know that

14:35 what i don't get is where the xlib.XGetInputFocus() implementation is coming from

14:35 amalloy: pandeiro: jni magic

14:35 pandeiro: that's that weird INSTANCE property i take it

14:36 way 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:40 justin_smith: pandeiro: can't you access the windowing framework that the web plugin is using? I doubt it is using xlib / x11 directly

14:42 pandeiro: justin_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:43 justin_smith: ahh so you want to find the window via X11 and close it

14:43 dbasch: quick question: how do I disable html stacktraces in a ring webapp?

14:43 bodie_: ugh, what's the trick to this? http://cljbin.com/paste/53459425e4b088e54dd68efb

14:43 amalloy: dbasch: don't include the wrap-stacktrace wrapper :P

14:44 bodie_: do I need type hinting?

14:44 (for bigint)

14:44 dbasch: amalloy: I’m not including it, and I still get them :(

14:44 justin_smith: pandeiro: 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:44 pandeiro: justin_smith: exactly, just need to close it

14:44 amalloy: you're including it transitively through some other wrapper. like maybe compojure's "site" wrapper, or something

14:44 pandeiro: xwit and wmctrl, cool i will look into those

14:44 dbasch: amalloy: that’s what I suspect, but I can’t find it. Oh well.

14:45 justin_smith: bodie_: use recur and an accumulator so that each call is a tail call

14:45 cbp: bodie_: bigintegers have nothing to do with that error, you're blowing the stack because your algorithm is recursive a

14:45 ..and the input is too large

14:45 justin_smith: bodie_: the trick to tail calls is that no calculation must be left to do after the last call returns

14:45 dbasch: amalloy: I’m using the “api” wrapper

14:45 justin_smith: bodie_: so you use an acc arg much like in the reverse, but instead of a list it is a number

14:46 cbp: no, it just isn't tail recursive

14:46 cbp: well yes

14:47 justin_smith: yeah, the number is too large for unoptimized recursion

14:47 but the solution isn't a smaller input number, it's to do tail recursion (or a non-recursive algo)

14:49 bodie_: right -- of course, I got sidetracked by the error I got from my REPL

14:49 "StackOverflowError clojure.lang.Numbers.toBigInt (Numbers.java:249)"

14:50 justin_smith: so do you get the idea of creating an acc arg so that each recursive call can be a recur?

14:51 you can either make it an optional arg to the function, or a binding in a loop/recur

14:51 bodie_: yeah, that part I get

14:52 the error about "toBigInt" doesn't make sense to me

14:52 so I'd assumed it was bigint related

14:52 justin_smith: that's the function that overflowed

14:52 with a stackoverflow, often the specific funciton that overflowed the stack is kind of random

14:52 bodie_: so I guess um, probably the multiply or dec was attempting to cast to a bigint?

14:52 justin_smith: other than the fact that it just happens to be in the recursive call chain

14:52 bodie_: makes sense

14:52 justin_smith: bodie_: that is irrelevant

14:53 bodie_: yeah, but I'm curious. XD

14:53 I guess the world will never know.

14:53 justin_smith: stack overflow means, "consume less stack"

14:53 bodie_: right, that part I do grasp :) it evaded my attention

14:53 justin_smith: you could use jvisualvm or the like to interact with the stack

14:53 if you really want to see what is going on

14:54 or even just trigger a full stack trace via (pst)

14:55 likely 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:56 (that's just a guess)

14:56 bodie_: woot, tco version passed

14:56 justin_smith: congrats

14:56 bodie_: um, there IS a trampolining tco technique in clojure, isn't there?

14:56 justin_smith: ,(doc trampoline)

14:56 clojurebot: "([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:57 bodie_: ah

14:57 whee

14:57 cbp: bodie_: it was the = that was casting

14:57 to compare 1 with a bigint

14:57 justin_smith: cbp: oh, cool

14:57 bodie_: interesting

14:57 how'd you get that?

15:06 justin_smith, thanks for the pointer to jvisualvm. I've never used this. cool!

15:08 justin_smith: np, it comes with the jdk (as you probably already noticed)

15:08 it helps with many of those "what is my program on the jvm actually doing, and where did the ram go?" type questions

15:13 bodie_: cbp, I see how you got that

15:14 or do I...

15:14 ,(= 1 1N)

15:14 clojurebot: true

15:14 bodie_: ,(#(= 1 %) 1N)

15:14 clojurebot: true

15:15 bodie_: :S

15:15 justin_smith: = is calling the cast function, as he said

15:15 bodie_: right, but what's wrong with the cast to compare 1 and 100003N?

15:15 justin_smith: nothing

15:16 remember the cast is not a problem, it just happened to be the call that blew the stack

15:16 bodie_: oh, the stack overflow happened in that cast function

15:16 justin_smith: the real problem is the stack

15:16 bodie_: I see

15:16 justin_smith: it was the straw the blew the camel's stack

15:16 or whatever

15:17 mimieux: Hi!

15:17 How to run "local code" on a remote repl?

15:18 jcromartie: like a file?

15:18 mimieux: yes

15:19 justin_smith: you 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:19 both should do the same thing (except for gen-class I guess?)

15:22 mimieux: I want to issue a command like: ssh user@host -C "command"

15:22 and process its results, all with clojure.

15:22 clj user@host -C "command.clj"

15:22 Xeago: (crossposting from #riemann; the given code is written for riemann): can I write this differently? (where* #(not (predicate? %)) …)?

15:23 cbp: that #() is (complement predicate?)

15:23 justin_smith: mimieux: 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:24 mimieux: justin_smith: yeah, this is what i want. thx.

15:25 cYmen: phew

15:26 evening...now where do I find some motivation to look at om

15:26 cbp: Xeago: you can replace #(not (predicate? %)) with (complement predicate?)

15:26 justin_smith: mimieux: 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:27 mimieux: justin_smith: I see. :)

15:28 justin_smith: I think it is easiest to create the tunnel using ssh and then point clojure at the local tunnel endpoint

15:29 bodie_: justin_smith, checking out caribou. seems supe neat :)

15:29 justin_smith: bodie_: thanks, it is still very much a work in progress, but we find it very useful for our own web stuff at least

15:30 Xeago: ,(doc complement)

15:30 clojurebot: "([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:31 justin_smith: ,((-> even? complement complement complement) 2)

15:31 clojurebot: false

15:33 Xeago: ,(doc ->)

15:33 clojurebot: "([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:34 justin_smith: Xeago: that thing I did was pretty pointless actually. But -> and complement are actually useful.

15:36 mdrogalis: YouTube just suggested the video "Functional Programming is Terrible"

15:36 Well, I'm sure this isn't biased or anything.

15:36 justin_smith: lol

15:37 check out google auto-complete for "functional programming is "

15:37 bbloom: wow.

15:37 that's pretty sad

15:37 that's our comp sci education failing right there

15:38 mdrogalis: Hah, wow.

15:38 blake__: "functional programming is challenging and makes me uncomfortable in my head"

15:38 wink: stupid hard not the answer :)

15:38 akhudek: bbloom: worse than that, many people think CS is hard and stupid too :-(

15:38 blake__: I just wanted to program computers, not think, dammit!

15:38 cbp: cs isnt hard? that's news to me :-P

15:38 bbloom: akhudek: meanwhile, just a tiny bit of computer science and suddenly problems that are 10+ man years turn in to < 10 man hours

15:39 akhudek: yep

15:39 wink: mdrogalis: did you check the description?

15:39 Rú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:40 those "django sucks" rant talks are some of the best of pycon I heard. and usually not bashing :P

15:40 mdrogalis: wink: Ah. Did not even click it.

15:40 Couldn't be distracted ATM

15:40 wink: hehe

15:40 I suspected something like this

15:40 bbloom: happy ending: "functional programming is not terrible. YOU'RE TERRIBLE"

15:40 also, you smell.

15:40 wink: cf http://programmingisterrible.com/

15:41 justin_smith: actually, 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:42 mdrogalis: Hah

15:43 wink: "best way to get people on a mailing list to explain stuff is to say 'X cannot do Y'"

15:43 justin_smith: right

15:44 kenrestivo: i'm trying to track down a weird error:

15:44 "ErrnoException open failed: ENOENT (No such file or directory) libcore.io.Posix.open (Posix.java:-2)"

15:45 when C-k'ing a namespace in neko/android/nrepl/emacs

15:46 how would one go about debugging/tracing nrepl-related weirdness?

15:47 justin_smith: kenrestivo: was the jvm spawned in a director that has since been deleted?

15:47 *directory

15:47 kenrestivo: interesting. it's not a jvm, it's dalvik :-/

15:48 justin_smith: that is my first guess when random commands complain about no such directory

15:48 kenrestivo: thanks

15:49 in 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:50 cYmen: justin_smith: crap, now I need to look at core async to understand your om example ;)

15:51 justin_smith: cYmen: the core.async part is a stub, that will be filled in when we get to the user interaction part

15:51 kenrestivo: aha! it's the dvm, complaining the class isn't there. i can now track this down.

15:51 cYmen: hm...i really have no strategy when it comes to understanding clojure codebases

15:52 justin_smith: cYmen: that codebase isn't exemplary either, sorry

15:52 there is some noise in it, as you have seen

15:52 cbp: use a repl and break things :-P

15:52 cYmen: I'll go check out some docs for httpkit and om and such...

15:52 justin_smith: yeah, try corner cases that you think should fail, corner cases you think should succeed, etc.

15:53 cYmen: Hm...I wouldn't even know what to call from the repl ^^

15:53 justin_smith: cYmen: 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:54 in that particular case, try modifying one function call, see if it changes the thing you expect it to change

15:56 kenrestivo: one 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:57 justin_smith: kenrestivo: something that clojure evaluated generated some class, that is an autogenerated name

15:57 cYmen: alright, baby steps

15:57 justin_smith: if it were an fn it would have $fn instead of $eval I think

15:57 * cYmen tries to figure out how to fork the project on github.

15:58 cbp: ,(fn [])

15:58 clojurebot: #<sandbox$eval25$fn__26 sandbox$eval25$fn__26@d085f8>

15:58 cbp: ,(fn [])

15:58 clojurebot: #<sandbox$eval51$fn__52 sandbox$eval51$fn__52@af84e>

15:58 kenrestivo: hmm, but there's no fn in this case

15:58 justin_smith: ahh, it has $eval$fn...

15:58 kenrestivo: smells like ns macro magick

15:59 justin_smith: kenrestivo: could be, but I think other things make classes too

15:59 kenrestivo: i 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:00 * kenrestivo budgets several hours for this

16:00 justin_smith: another option is a binary search

16:00 is the error in the top or bottom half of the ns...

16:00 etc.

16:00 kenrestivo: good point. that $eval in top level smells to me like it's in the ns declaration or something

16:10 gfredericks: ,(let [xs (->> (iterate inc 0) (take 30) (map #(/ 3 (- 8 %))))] (try (doall xs) (catch Throwable t xs)))

16:10 clojurebot: gfredericks: excusez-moi

16:10 gfredericks: &(let [xs (->> (iterate inc 0) (take 30) (map #(/ 3 (- 8 %))))] (try (doall xs) (catch Throwable t xs)))

16:10 lazybot: java.lang.SecurityException: You tripped the alarm! catch is bad!

16:10 * gfredericks glares back and forth at the two bots

16:11 hiredman: ,(+ 1 2)

16:11 clojurebot: 3

16:11 llasram: &(try true (catch Throwable false))

16:11 lazybot: java.lang.SecurityException: You tripped the alarm! catch is bad!

16:11 * rasmusto ,(+ 1 2)

16:11 justin_smith: llasram: you missed the binding of the Throwable

16:12 llasram: &(try true (catch Throwable _ false))

16:12 lazybot: java.lang.SecurityException: You tripped the alarm! catch is bad!

16:12 bbloom: catch is bad?

16:12 llasram: &Throwable

16:12 lazybot: ⇒ java.lang.Throwable

16:12 bbloom: why?

16:12 clojurebot: why is the ram gone

16:12 bbloom: *sigh*

16:12 llasram: ~botsmack

16:12 clojurebot: clojurebot evades successfully!

16:13 bbloom: ~botsmack

16:13 clojurebot: Owww!

16:13 bbloom: got him.

16:13 hiredman: bbloom: you can setup infinite loops using try and catch that are difficult to break out of

16:13 llasram: &catch

16:13 lazybot: java.lang.SecurityException: You tripped the alarm! catch is bad!

16:13 llasram: Soooo bad

16:14 bbloom: hiredman: doesn't the jvm support timeouts?

16:14 amalloy: bbloom: not without a little cooperation from the code being interrupted

16:14 llasram: clojurebot: catch is bad

16:14 clojurebot: Roger.

16:14 hiredman: bbloom: it is all in the literature (by which I mean #clojure logs from 3 or 4 years ago)

16:14 tuft: Interrupted

16:14 amalloy: mostly timeout support is that syscalls can throw InterruptedException, and you're required to declare how you deal with it

16:14 bbloom: *sigh*. the VM would be the new OS, if only the the VM was a half decent OS

16:15 amalloy: so if clojurebot tried to run code that caught InterruptedException by continuing to process...

16:15 tuft: hah, indeed

16:15 ClojureOS

16:16 bbloom: amalloy: surely InterruptedException is just being polite

16:16 if the thread doesn't behave, you murder it instantly, no?

16:16 amalloy: there's no safe way to murder a thread

16:16 hiredman: that is how thread murdering sort of works

16:16 technomancy: there's no safe way to murder anything

16:16 amalloy: because like, what if it took a mutex before you kill it, etc

16:17 see, eg, the docs for java.lang.Thread/stop

16:17 technomancy: you'll always leave some hint leading back to you

16:17 bbloom: amalloy: yeah, this is why the VM is a bad OS

16:17 hiredman: bbloom: this problem seems to exist even at the os level http://stackoverflow.com/questions/2084830/kill-thread-in-pthread-library/2084849#2084849

16:17 bbloom: when you kill an OS process, the kernel releases it's resources

16:17 hiredman: ok then let me extend my statement: this is why threads are bad processes

16:18 and that's why our VMs are bad OSes and our OSes are bad OSes too

16:18 gfredericks: is erlang good at this?

16:19 bbloom: gfredericks: i dunno enough erlang, but i'd guess so, what with the crash-only design and all

16:19 gfredericks: why can't we all just erlang

16:19 bbloom: in general, i think "finally" is a bad idea

16:20 all dynamic-wind related resource management strategies are a bad idea really

16:20 hiredman: gfredericks: because it has plenty of other warts

16:20 TimMc: I read that as "cash-only design".

16:20 technomancy: gfredericks: but we can.. if you just believe.

16:20 gfredericks: the erlang was inside your heart all along!

16:20 bbloom: TimMc: mo' exceptions, mo' problems

16:20 hiredman: gfredericks: 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:20 blake__: 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:21 gfredericks: hiredman: any easy examples?

16:21 amalloy: $google lein try

16:21 lazybot: [rkneufeld/lein-try · GitHub] https://github.com/rkneufeld/lein-try

16:21 blake__: amalloy: doh! Thanks! I forgot about "try"...

16:21 amalloy: that's for blake__ - i guess in context it could have been about try/catch

16:21 gfredericks: blake__: I worked up an add-dep macro using pomegranate I think

16:21 hiredman: gfredericks: 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:22 technomancy: "Oh, I see your problem, right here." *points to gauge* http://p.hagelb.org/erlangs.png

16:22 gfredericks: blake__: https://github.com/fredericksgary/repl-utils/blob/master/src/com/gfredericks/repl.clj#L9-15

16:22 blake__: gfredericks: Also cool, thanks!

16:23 hiredman: I am not terrible fond of actors as a primitive to start with

16:23 if you compose actors you get something that isn't an actor

16:23 bbloom: hiredman: yeah, i think that we'll discover that actors are to turing machines what ??? is to the lambda calculus

16:24 gfredericks: lambda calculuses

16:24 pronounced "calc you loosies"

16:25 hiredman: 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:25 hiredman: orleans 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:26 gfredericks: well, that part is outdated now I think, erlang has maps now

16:27 gfredericks: oh well

16:27 hiredman: to 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:28 per cpu, maybe shared per core

16:28 bbloom: i mean "shared nothing" at the CPU level is kinda splitting hairs

16:28 they share a bus, and therefore share memory attached to that bus

16:28 gfredericks: hiredman: looks like a pretty comprehensive essay though, thanks

16:28 clojurebot: Titim gan éirí ort.

16:28 bbloom: whether it's registers or hard disks or anything in between, they share something

16:29 hiredman: bbloom: sure

16:29 technomancy: gfredericks: it's a mix of stuff that makes sense and stuff that's just dumb

16:30 like ... complaining about no nil or complaining about no let is just stupid

16:30 justin_smith: bbloom: 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:30 technomancy: but the stuff about strings and the standard library is right-on

16:30 justin_smith: hell, even write to it

16:30 bbloom: justin_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:31 ie unbounded non-determinism may exist, but i don't want to have to bound it myself every time

16:31 technomancy: gfredericks: and he doesn't even mention the lack of higher-order functions or the fact that the shell isn't a real rep

16:31 repl

16:32 bbloom: justin_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:32 hiredman: hah

16:32 bbloom: you laugh, but this crazy thing exists: http://research.google.com/pubs/pub38125.html

16:33 justin_smith: bbloom: if you grant that the datastructures will be immutible, I can consider it

16:33 bbloom: justin_smith: yeah, look what google has managed to accomplish on the crazy big table quasi-sql model

16:33 imagine what you could do with immutable underpinnings

16:34 tuft: wow cool http://sicpinclojure.com/

16:34 hiredman: bbloom: 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:34 bbloom: hiredman: this also exists: http://terracotta.org/products/bigmemory

16:34 and works better than you'd think lol

16:35 it's basically virtual memory implemented with massive page sizes & backed by a machine cluster

16:35 again, imagine with functional underpinnings

16:35 tuft: hah, some spam generator puked itself in the second comment http://sicpinclojure.com/?q=sicp/front-matter

16:35 enquora: anyone using clara-rules for production code (no pun intended)? is it the best choice if clojurescript is needed too?

16:36 hiredman: I was just reading some paper about doing shared memories using pointer swizzling for c programs

16:37 maybe this one ftp://ftp.cs.utexas.edu/pub/garbage/swizz.ps

16:49 gfredericks: technomancy: I don't understand no let -- what's not local about erlang's variables?

16:50 jwm: anyone using node.js for cljs nrepl?

16:57 gfredericks: oh I'd forgotten that atoms are syntactically identical to reserved words

16:57 (inc lisp)

16:57 lazybot: ⇒ 2

16:58 nightfly: (inc inc)

16:58 lazybot: ⇒ 8

16:58 gfredericks: (ink deck)

17:07 I'm about to write a wrapper around the scheduledThreadPool's .scheduleWithFixedDelay that lets you have a state arg/return values from the fn

17:08 poppingtonic: Hello people :)

17:08 technomancy: gfredericks: 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:08 poppingtonic: Does 1.6 break anything from 1.5.1?

17:08 hiredman: gfredericks: :( for why?

17:08 technomancy: "It's not a general purpose language" -> http://www.penny-arcade.com/comic/2006/09/06

17:08 gfredericks: hiredman: sometimes it's useful to know what happened in the past?

17:10 hiredman: it's like using loop; but with a thread pool managing the loopiness

17:10 hiredman: gfredericks: 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:11 gfredericks: oh I might expose it as well; but the function I write for the thread pool doesn't need to know it's exposed

17:12 ambrosebs: poppingtonic: there is a change log in the clojure repo

17:12 gfredericks: poppingtonic: that's kind of a squishy question

17:13 ,(->> (range 5000) (set) (take 5))

17:13 clojurebot: (0 2721 893 2558 920)

17:13 gfredericks: &(->> (range 5000) (set) (take 5))

17:13 lazybot: ⇒ (0 1024 2048 3072 4096)

17:14 * arubincloud considers an expression to send the bots into an infinite loop.

17:14 arubincloud: Or are they programmed to ignore each other?

17:14 hiredman: http://awelonblue.wordpress.com/2012/10/21/local-state-is-poison/

17:15 DaReaper5: I am getting the runtime exception "Map literal must contain an even number of forms" from http://pastebin.com/hmqvWRam

17:15 i do not understand why

17:15 If I remove the third "~@(if" it goes away, but again i dont understand why

17:15 stuartsierra: poppingtonic: Hashing in collections changed, which may lead to breakage in code that made assumptions about the order of keys in maps or sets.

17:16 bbloom: +1 on the local state is poison thing

17:17 poppingtonic: ambrosebs: cloning

17:17 stuartsierra: interesting. any hints as to what drove that choice?

17:17 stuartsierra: DaReaper5: ~@ doesn't get expanded until after the map is read.

17:17 poppingtonic: I don't remember. There's probably something on dev.clojure.org or JIRA.

17:18 DaReaper5: stuartsierra: sorry, i dont understand why that would cause the error?

17:18 bbloom: poppingtonic: stuartsierra: that behavior just falls out naturally from the way it gets parsed

17:18 amalloy: DaReaper5: your map literal has 9 elements in it, three of which look like: ~@(if ...)

17:19 bbloom: '{~@x} parses as (clojure.core/syntax-quote (some.magic/map (clojure.core/unquote-splicing x)))

17:19 amalloy: what those expand to doesn't matter, because compilation doesn't get that far: the map literal with 9 elements is abandoned

17:19 michaniskin: DaReaper5: 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:19 hiredman: bbloom: it is so easy to forget that closed over state is still state

17:19 bbloom: hiredman: yup. and all state is global!

17:19 tim: basically, using ~@ outside of a seq/vector shouldn't be done

17:19 bbloom: hiredman: it's not global state that's bad, it's unregulated global access

17:20 michaniskin: DaReaper5: disregard, i was being dumb

17:20 bbloom: hiredman: but the subtly there is that global read-access is vital for debugging purposes :-)

17:20 DaReaper5: amalloy: michaniskin would you suggest i use a merge then to fix it?

17:20 bbloom: but also super useful for lots of other things too

17:20 DaReaper5: (goes to try)

17:20 hiredman: bbloom: unregulated global mutation

17:20 bbloom: hiredman: yup

17:20 brb

17:20 amalloy: DaReaper5: that'd be one workable solution

17:20 DaReaper5: amalloy: ahhh i getit

17:21 amalloy: 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:21 but with 3 there is an issue

17:46 mmitchell: what'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:46 I *think* I was looking at something called hickory a while ago, or maybe enlive?

17:50 stuartsierra: enlive

17:59 aka: mmitchell: there is also https://github.com/Raynes/laser and https://github.com/weavejester/crouton

17:59 blake__: Why would someone take out a Google ad to advertise their (open-source, freely available) Clojure library?

18:00 technomancy: blake__: sometimes google hands out free adwords credits

18:00 I ran a campaign for Leiningen for a few weeks on a $100 voucher they sent me

18:00 blake__: Ahh. "One weird library that Rich Hickey doesn't want you to know about."? That's kinda funny.

18:00 technomancy: that one wasn't mine =)

18:01 aka: blake__: hahah that sounds sketch

18:01 blake__: It's for "proteus", which allows local, mutable variables.

18:01 aka: did you by chance see what lib it was?

18:01 kenrestivo: huh, 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:01 DaReaper5: Anyone know how to convert a map to an hstore ?

18:01 technomancy: DaReaper5: yeah it's kinda crappy

18:01 DaReaper5: i am using korma atm

18:01 kenrestivo: sorry, every 30ms

18:01 technomancy: oh, actually not so bad

18:02 DaReaper5: https://github.com/heroku/buildkits/blob/master/src/buildkits/db.clj#L11

18:02 DaReaper5: Can i just ::hstore?

18:02 technomancy: oh, no idea how korma does it

18:07 mmitchell: aka: thanks!

18:10 aka: laser does exactly what i want! :)

18:10 already working, nice

18:25 lemonodor: kenrestivo: you’re doing clojure on android? what are you making?

18:26 (i’ve been working on an AR.Drone speech interface for android)

18:27 kenrestivo: lemonodor: oh just playing around. was attempting to make some mods to this http://github.com/kenrestivo/spazradioapp

18:27 i *think* this may be the dalvik or dex optimizing out a class that isn't called from anywhere else

18:28 lemonodor: ah 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:28 kenrestivo: i can duplicate the problem by creating an empty ns

18:28 lemonodor: i recognize yours too. you did a lisp blog that was fairly well known at one time?

18:29 lemonodor: yes, eons ago

18:31 kenrestivo: and 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:34 lemonodor: well, welcome to clojure. hope you are having fun so far.

18:34 lemonodor: oh yeah, i love it.

18:35 aka: mmitchell: nice :)

18:48 jwm: I'm trying to transition from nodejs to clojure + http-kit hehe

18:49 so far having some bad success with lighttable

18:49 justin_smith: light table seems to have a few really nifty gee-whiz features but not be mature

18:49 not cranky and weird like emacs / vim, just immature

18:52 bob2: emacs is only cranky until you bring it its' tea and biscuits

18:52 and listen to its' stories about the war

18:52 justin_smith: heh

18:52 bob2: then it's all M-x cider-jack-in C-c C-t

18:52 justin_smith: but you do have to do things its way. It gets kind of pissed if you call a frame a window

18:53 bob2: back in emacs's day, we called a window a frame

18:53 also, get off emacs's lawn

18:55 DaReaper5: i have a simple issue but im probably getting tired, how do i convert this { :key1 "aValue" } into this: { "name" "key1" "value"

18:55 "value" aValue" } **

18:56 (pressed enter by acident)

18:57 simplier question would be how to i iterate over values in a sequence, getting their keys and values

18:59 justin_smith: DaReaper5: you're gonna find this hilarious

18:59 ,(keys {:a 0 :b 1 :c 2})

18:59 clojurebot: (:c :b :a)

18:59 justin_smith: ,(values {:a 0 :b 1 :c 2})

18:59 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: values in this context, compiling:(NO_SOURCE_PATH:0:0)>

18:59 justin_smith: err

18:59 ,(vals {:a 0 :b 1 :c 2})

18:59 clojurebot: (2 1 0)

19:00 justin_smith: ,(map identity {:a 0 :b 1 :c 2}) ; or even this, swap out some fn which takes a pair for identity

19:00 clojurebot: ([:c 2] [:b 1] [:a 0])

19:01 DaReaper5: justin_smith: when i use map will the key and value be separate arguments?

19:01 justin_smith: nope, it will be a pair

19:01 DaReaper5: like (map (fn [k v]

19:01 justin_smith: first element key, second element val

19:01 like (map (fn [[k v]]

19:02 DaReaper5: kk

19:02 justin_smith: ,(map (fn [[k v]] {:key k :value v}) {:a 0 :b 1 :c 2})

19:02 clojurebot: ({:key :c, :value 2} {:key :b, :value 1} {:key :a, :value 0})

19:03 DaReaper5: justin_smith: so i can (map (fn [pair] {(key pair) (val pair}) pairs)

19:03 hmm kk

19:03 justin_smith: thanks alot

19:04 justin_smith: yeah, key and val also work

19:04 though I think the destructuring version is simpler

19:05 blake__: 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:05 justin_smith: (fn [[k v]] ...)

19:05 rasmusto: ,(map key '((a b) (c d e) (f g)))

19:05 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.util.Map$Entry>

19:05 DaReaper5: i agree

19:05 justin_smith: rasmusto: I think key works on map entries

19:05 rasmusto: o ok, thought that was the case

19:05 justin_smith: well duh, that's what the exception says, but anyway

19:05 rasmusto: I misread part of the convo

19:06 DaReaper5: justin_smith: and with that im done for the day Cheers!

19:06 justin_smith: np

19:07 amalloy: blake__: 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:10 blake__: Sorry. https://www.refheap.com/74140

19:13 justin_smith: blake__: those are not errors, they are just reflection warnings

19:14 someone turned *warn-on-reflection* on

19:14 amalloy: blake__: those all basically don't matter. i don't know why *warn-on-reflection* is on, but it's flagging potential performance problems

19:14 justin_smith: everything 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:15 blake__: This is just a git clone of jvm.tools.analyzer. I was trying to get to the ast function.

19:15 er, macro

19:15 justin_smith: that should be fine

19:15 they just have some warnings on

19:16 blake__: Well, I couldn't get to it, so the obvious messages were the first place I thought to check.

19:16 justin_smith: what did you try?

19:16 blake__: I started with (ast [1]) because I saw that example from an early version of the code.

19:17 Then just "ast"

19:17 "Unable to resolve symbol: ast..."

19:17 Then went down from the top of analyzer.clj.

19:17 justin_smith: you need to require the ns that it is in

19:17 blake__: Maybe it's not loaded.

19:17 justin_smith: nrepl does not autoload any part of an ns

19:17 *project

19:17 blake__: Right, I started with (ns ...)

19:18 justin_smith: no, that defines an ns

19:18 you need to require it

19:18 blake__: yeah, that throws me a lot...

19:18 justin_smith: (ns ...) means "hey, this ns now exists"

19:18 (require ...) means "find the definition for this ns"

19:19 blake__: 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:20 justin_smith: now you can do (clojure.jvm.tools.analyzer/... )

19:20 you probably wanted an :as in there so you won't need to type in the full ns

19:20 (require '[clojure.jvm.tools.analyzer :as analyzer]) perhaps

19:20 then you can do (analyzer/whatever ...)

19:22 blake__: I gotta have the '...or it tries to eval clojure.jvm.etc...

19:22 justin_smith: yes, that is normal

19:22 blake__: *phew* OK, thanks, justin_smith. That works.

19:22 justin_smith: np

19:26 antonv: Sorry, I have quit for a moment. So is there a way to load newly downloaded dependencies without restarting nREPL?

19:27 tuft_: antonv: i believe so, but can't remember which project. something gives you lein within the repl

19:27 cbp: $google clojure alembic

19:27 lazybot: [pallet/alembic · GitHub] https://github.com/pallet/alembic

19:29 tuft_: cool

19:37 antonv: tuft: cbp: thanks

19:42 Raynes: arrdem: I don't think we could possibly be more musically incompatible.

19:53 michaniskin: i'm using classlojure, but cannot dynamically change the classpath for the classloader created by classlojure. is there a way to accomplish this?

19:54 blake__: justin_smith: If I'm doing this in a project.clj, would I use "dependencies" rather than "requires"?

19:55 Wait, there's not a big connection, is there.

19:56 Dependencies in the project make it available to the cljs, which then use require?

19:56 michaniskin: blake__: that's correct

19:57 blake__: require allows you to refer to vars in other namespaces

19:57 blake__: Thanks, michaniskin. Dunno why I'm struggling with it.

19:57 michaniskin: blake__: dependencies makes it so that those namespaces are on the classpath

19:58 blake__: so they can be require'd

19:58 blake__: Got it. (I hope.) Thanks.

20:02 amalloy: michaniskin: if you want a different classloader, you can use the lower-level constructs like eval-in, instead of the high-level function classlojure

20:03 build a classloader however you want, either on your own or with classlojure functions, and then pass it to eval-in

20:05 michaniskin: amalloy: is there a classloader you'd recommend?

20:05 amalloy: i get an exception that tells me the classloader is not dynamic

20:09 amalloy: nm i think i have a plan

20:11 kenrestivo: so, dumb nrepl question: when i do (clojure.core/load-file "/somewhere/foo.clj") what actually gets executed and where?

20:12 does 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:12 technomancy: kenrestivo: it's on the target

20:13 scottj: antonv: pomegranate, with latest-clojure-libraries.el if you use emacs.

20:13 technomancy: there 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:13 kenrestivo: technomancy: wow. then i'm baffled as to how it can find a file on a filesystem it doesn't even have

20:13 and open it, and compile it. i suspect magick.

20:14 context 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:15 hiredman: kenrestivo: 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:16 amalloy: hiredman: 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:17 perhaps the android runtime handles it differently

20:18 hiredman: oh

20:18 hmmm

20:18 I 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:19 technomancy: iirc this is basically a textbook case for why to use nrepl ops

20:19 because they can be intercepted without shenanigans

20:19 hiredman: it doesn't intercept

20:19 it is an op

20:19 https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/load_file.clj

20:20 kenrestivo: hiredman: thanks, that looks like it

20:21 hiredman: kenrestivo: seems unlikely

20:21 kenrestivo: it doesn't futz with stuff, so if you typing (load-file ...) in to the repl, that wouldn't effect it

20:21 kenrestivo: then 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:21 hiredman: are you sure you are connected to the target?

20:22 kenrestivo: yep

20:22 hiredman: why?

20:22 clojurebot: why is startup slow is busy compiling the `for` macroexpansion

20:22 kenrestivo: well, i'm sure i'm connected. i'm not necessarily sure that the code i'm executing is executing on the target

20:22 hiredman: so check?

20:22 kenrestivo: but it seems likely. i'm looking at the packet traces of nrepl

20:23 hiredman: ok, so you see packets being sent to the target?

20:23 kenrestivo: and emacs is sending d2:id1:92:op4:eval7:session36:b7a2b815-c36a-49ea-9694-ea8fa189adb24:code135:(clojure.core/load-file 3"

20:24 and is getting back OKAY, then WRTER...........H8......d2:ex35:class java.io.FileNotFoundException2:id1:97:root-ex31:class libcore.io.ErrnoException7: ...

20:24 hiredman: so it is getting back an exception

20:24 kenrestivo: which implies to me that it's executing on the target

20:24 hiredman: and it is not getting back an exception for /tmp/foo.clj ?

20:25 kenrestivo: nope.

20:26 hiredman: how do you know /tmp/foo.clj doesn't exist?

20:26 (.exists (java.io.File. "/tmp/foo.clj"))

20:27 kenrestivo: true

20:27 hiredman: so it does exist

20:27 kenrestivo: which is bizarre, because it does NOT exist on the target

20:27 hiredman: (slurp "/tmp/foo.clj") will give you a string of the contents

20:27 kenrestivo: it exists on my host

20:28 it will. hmm

20:28 hiredman: kenrestivo: how do you know it does not exist?

20:28 kenrestivo: and it does

20:28 will adb shell in and look

20:29 wat!??

20:29 lazybot: kenrestivo: Uh, no. Why would you even ask?

20:29 kenrestivo: it does exist

20:29 now i'm even more confused

20:30 hiredman: wow that's odd. it does in fact exist on the target vm, in that path, somehow. how exactly, i have no idea

20:30 clojurebot: Excuse me?

20:31 hiredman: kenrestivo: so why does it exist?

20:31 technomancy: http://p.hagelb.org/mystery.gif =)

20:32 kenrestivo: i have a few ideas. will look

20:34 * kenrestivo facepalms

20:35 kenrestivo: because 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:35 solveded

20:36 got 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:37 hiredman: technomancy: thanks for helping me untangle my way out of the trap i created for myself

20:37 hiredman: if cider user the load-file middleware for C-k it could work

20:41 amalloy: if 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:44 hiredman: amalloy: nah, they'll just pick some random other key binding for it and do it in a way that breaks half the time

20:52 * kenrestivo considers forking cider back to nrepl

20:53 kenrestivo: i've held out this long with nrepl and plan to do so more or less indefinitely

20:53 * kenrestivo gets off his own lawn

20:57 pdk: sounds like a forkin' good plan!

21:07 gwz: hey, if you are doing walk function, is it possible to get the next value during an iteration

21:09 hiredman: no

21:20 gfredericks: hiredman: I'm having a hard time interpreting your IRC toot unless s/asking/answering/

21:21 for some reason it's become important to me to know which way that was supposed to go

21:22 hiredman: gfredericks: oh, well most of my lines in my recent exchange with kenrestivo ended with question marks

21:23 kenrestivo: and, 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:24 gfredericks: hiredman: I was wondering if it was something like that; and here I could have figured that out myself by scrolling up a page :/

21:24 Frozenlock: kenrestivo: Oh wow... I would have wondered wtf was going on

21:24 kenrestivo: so, (in-ns 'foobar) will not have any fn's, refs, atoms, or what have you, if the foobar ns is considered dead code

21:24 that's what started me on this journey of discovery... let's see (checks logs)... 3 hours ago

21:25 Frozenlock: kenrestivo: the other I had a similar journey, only to end up realizing that clj-time doesn't work well on Android. :-(

21:25 *the other day

21:26 kenrestivo: yeah, i'm using the android-specific stuff, java.text.SimpleDateFormat java.util.Locale java.util.TimeZone

21:27 pulling 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:27 Frozenlock: btw, 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:28 kenrestivo: Frozenlock: https://github.com/kenrestivo/spazradioapp/blob/master/src/clojure/org/spaz/radio/schedule.clj

21:28 amalloy: my understanding is that, up to experimental error, everything is slower on android than elsewhere

21:29 Frozenlock: amalloy: thanks. It 'felt' that way, but I wanted to have another input.

21:29 hiredman: gfredericks: dakrone told me I was a practitioner of maieutics once

21:29 gfredericks: ,(->> ["a" "z" "c"] sort last) ; how to do this with fewer logs?

21:29 clojurebot: "z"

21:30 hiredman: gfredericks: reverse the sort?

21:30 gfredericks: hiredman: logs not n's

21:30 it's a linear algorithm

21:30 easy to do with ugly code via reduce & compare

21:30 just seemed strange to have to resort to that

21:31 hiredman: use a sorted data structure to begin with?

21:31 gfredericks: ,(->> ["a" "z" "c"] (reduce #(if (neg? (compare %1 %2)) %2 %1)))

21:31 clojurebot: "z"

21:32 hiredman: maybe one of those fancy trees in contrib

21:32 gfredericks: they'll be in a map, so I'd have to go find a lib that has a sorted-by-function-of-vals map

21:32 I'll take that as a "no, it's not easy" :)

21:32 amalloy: gfredericks: i mean, you can write it once, and then it's easy for everyone else forever

21:32 hiredman: gfredericks: you want multiple indices (maps) instead of a single one

21:33 gfredericks: no I need it in clojure.core right now hold on while I make a pull request

21:33 hiredman: use derby and java jdbc and make sure to use indices on the right columns

21:33 kenrestivo: amalloy: 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:34 s/faster/slower/

21:35 amalloy: some of the issues were discussed here https://www.youtube.com/watch?v=8NUI07y1SlQ

21:35 might have been in the Q&A tho

21:51 hiredman: huh https://github.com/clojure/java.internal.invoke

21:54 gfredericks: is there any pattern between libs named java.* vs jvm.*?

21:54 hiredman: gfredericks: brosa does one, halloway does the other?

21:55 Jaood: ;)

21:56 gfredericks: looks like the only jvm.* is jvm.tools.analyzer

21:56 which has only ambrose in the recent commit log

21:56 hiredman: oh well

21:56 gfredericks: fun fact: jvm.tools.analyzer != tools.analyzer.jvm

21:56 hiredman: ah, no wonder

21:57 gfredericks: perhaps someday we can invent meanings for even more permutations of those words

21:57 hiredman: toolsanalyzerjvm..

21:58 gfredericks: (inc hiredman)

21:58 lazybot: ⇒ 40

22:10 antonv: quick poll: what IDE do you use?

22:10 I tried CIDER and LightTable, lookin for better options

22:10 bodie_: I'm using Emacs Live and it's quite nice

22:11 xeqi: antonv: what would make it better?

22:11 bodie_: in particular, the in-flight completion, command suggestions (including substring matches e.g. "jack" matches cider-jack-in)

22:11 also comes with lots of bundled goodies

22:12 xeqi, I was going to use LightTable until I noticed that it doesn't have current Leiningen compatibility.

22:12 bob2: emacs

22:12 bodie_: Emacs Live plays _really_ nice with lein

22:13 Jaood: antonv: check out cursive if you want a real "IDE"

22:14 bodie_: why use a "real IDE" when Emacs is already built from the ground up around Lisps?

22:14 everything you need is either in Leiningen, lein bundles, or Emacs and its bundles

22:14 Jaood: maybe IntelliJ is his thing

22:14 bodie_: possible

22:14 seems overwrought for clojure

22:15 antonv: xeqi: in CIDER cmpletion doesnt' work for me, no hints for function arguments

22:15 I have tried inspector - problems there too

22:16 in LightTable other problems

22:16 bodie_: 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:16 i.e., deftype, defrecord, etc

22:16 antonv: I think I would like EmacsLive, but I already have my .emacs configuration, how to use them together?

22:17 bodie_: you can put your stuff into a personal bundle. it backs up your existing .emacs when you install it using their install script

22:17 but a word of warning, emacs is .... weird and different if you're not used to it

22:17 but you prolly know that

22:18 I mean, we're in #clojure right

22:19 pterygota: yeah i've moved my personal configuration to the emacs live setup and it's working fine

22:20 bodie_: oh nvm he has a personal emacs setup, so why am I telling him emacs is weird

22:20 pterygota: use the instructions for creating a custom live pack with your existing configs in it

22:20 antonv: bodie_: I need my Emacs config active, not backed up in other dir

22:21 bodie_: right, can put it into a personal subpack

22:21 antonv: because I use emacs not only for Clojure coding, but of other things too

22:21 pterygota: yeah it's active

22:21 antonv: bodie_: subpack? any hints on that?

22:21 pterygota: steps are well described in the emacs-live readme

22:22 and in the the readme in the user-template-pack directory

22:23 antonv: pterygota: OK thanks. I would be more natural if EmacsLive was a subpack of my config than other way around...

22:24 bodie_: yeah, it's kind of opinionated / dominating lol

22:24 antonv: :)

22:24 pterygota: yeah 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:25 also 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:27 that way i can just git pull to the .emacs.d in order to update emacs-live from github

22:28 antonv: pterygota: how does it work with other package managers? I have various emacs packages installed (paredit, ect)

22:29 pterygota: i started over and reinstalled everything after setting my user-package-dir to a directory within the live-pack i made for myself

22:29 so it works fine with other package managers

22:29 i 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:30 but i'm pretty sure emacs-live has its own paredit setup

22:31 antonv: pterygota: thanks for the info

22:32 pterygota: no problemo

22:38 bodie_: 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:39 bob2: Programming Clojure has stuff about it

22:39 tldr for java interop

22:39 bodie_: hm

22:39 Frozenlock: bodie_: http://vimeo.com/53223938

22:40 Cr8: http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/

22:40 arrdem: Raynes: lolz... it's gonna take a while before my collection stabilizes

22:41 bodie_: thanks Frozenlock

22:52 Raynes: arrdem: <3

22:52 We both have Owl City plays!

22:52 So there's that!

22:53 arrdem: Raynes: I mainly shuffle my collection...

22:53 Raynes: so the next two months are gonna be a random walk through my tastes in no order

22:54 Raynes: arrdem: I've never met anyone else who does that.

22:54 It's what I do as well.

22:54 Everyone else is playlists and radio and crap.

22:54 I just want to hear my favorite stuff on repeat...

22:54 Occasionally explore to find new music, but not constantly...

22:54 I can't like music until I've accepted it and appreciated it for a period of time.

22:58 arrdem: eh... I've enjoyed spotify radio as an exploratory tool..

22:59 but ultimately I'll just take what I liked and buy it for myself

23:01 Raynes: yeah.. I'm kinda of the oppinion that if I'm not happy to hear it shuffle in, rm -rf

23:02 Raynes: arrdem: Oh, I certainly don't buy mp3s.

23:02 I don't pirate though.

23:02 I just use a streaming service.

23:02 Any of spotify, google play, or rdio.

23:02 All of them are totally cool with me.

23:02 But yeah, radio is good when you actually want to explore.

23:02 arrdem: you should work harder to incur their wrath then :P

23:02 Raynes: But sometimes, and most of the time in fact, I just want to hear my good stuff, man.

23:03 arrdem: Spotify has been really nice... I just grab a radio station based on anamanaguchi and I'm golden

23:36 bodie_: Frozenlock, this video on polymorphism in clojure is exactly what I needed! awesome. much appreciated

23:41 Frozenlock: bodie_: You are very welcome. You should thank the guy speaking in the video :p

23:42 bodie_: :)

Logging service provided by n01se.net