#clojure log - Jul 27 2012

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

0:04 muhoo: heh, hello world applet in seesaw is 8mb

0:06 Frozenlock: With a little chance your app will be below 10 mo :P

0:06 dnolen: muhoo: in an era when 16gb of RAM and 1TB of HD, and web browsers that consume 1/2 GB of RAM is the norm it truly baffles me that anybody cares anymore.

0:07 muhoo: i'm thinking about the download time

0:08 not everyone has 100mb fiber to the home

0:08 (or their phone)

0:09 dnolen: muhoo: so write it in ClojureScript ~40k gzipped ;)

0:09 muhoo: that makes a lot more sense, yes :-)

0:09 plus, it'll run on phones, which seesaw likely won't

0:10 amalloy: but muhoo, google will be giving everyone free 1gb/s internet speeds Real Soon Now!

0:10 Frozenlock: I thought the 5mb was the free one

0:11 amalloy: i dunno, maybe it is. their webpage is mostly flowers and pretty lights

0:12 Frozenlock: Eh. I watched the entire hour google-fiber "infopub" today. Guess I didn't want to get things done.

0:13 Oh neat, I found how to get the collection size: (server-eval "db.DBNAME.validate().datasize")

0:14 technomancy: leiningen is still under 10mb

0:14 just barely =)

0:14 Frozenlock: technomancy: And we love you for that :)

0:14 technomancy: hehe

0:17 muhoo: technomancy: how is nrepl.el coming along?

0:18 technomancy: muhoo: it's great! the latest release landed a bunch of features, and we're hoping to make a wider announcement next week after we've had a bit more time to find bugs and stabilise it

0:19 Frozenlock: Yay (server-eval "db.DBNAME.stats()") is even faster. (I'm leaving this for the logging, if anyone is wondering to whom I'm talking)

0:19 nrepl.el? As in elisp?

0:19 muhoo: technomancy: thanks very much for making that happen.

0:19 technomancy: Frozenlock: yup!

0:19 Frozenlock: O_o

0:19 * Frozenlock starts the google machine

0:20 Raynes: muhoo: FWIW, I don't use SLIME anymore.

0:20 muhoo: Go use it.

0:21 Frozenlock: Is it a replacement for slime and swank?

0:21 Raynes: Yes.

0:21 muhoo: Raynes: i'm itching to

0:21 Raynes: muhoo: Well, scratch. It isn't perfect yet, but it's usable.

0:21 And fun.

0:22 <3

0:22 semperos: very cool

0:22 Raynes: Feels good to be working with Clojure through a single clean .el file instead of through some weird crufty protocol and 4 million lines of elisp.

0:23 technomancy: the main things that are missing are eldoc support, tracing, and the inspector

0:23 but it's way more hackable than swank

0:23 Raynes: None of which I use.

0:23 :D

0:23 I don't even know what eldoc is!

0:23 It's greart.

0:23 great*

0:24 muhoo: how do you hook nrepl.el into an existing running lein project?

0:24 Frozenlock: (add-hook 'emacs-lisp-mode-hook 'eldoc-mode)

0:24 (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)

0:24 (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)

0:24 (setq eldoc-idle-delay 0.01)

0:24

0:24 .emacs porn :)

0:24 Raynes: muhoo: You mean an existing nrepl server?

0:24 technomancy: Raynes: eldoc is what shows you arglists in the minibuffer. its lack is probably my biggest annoyance right now.

0:25 muhoo: Raynes: yes

0:25 Raynes: technomancy: Okay, so I do sometimes use that, but very rarely.

0:26 technomancy: Looks like M-x nrepl

0:27 Er, muhoo

0:27 muhoo: ok, it just hits localhost at whatever the nrepl port is i guess then

0:28 Raynes: technomancy: Why doesn't it take a host too?

0:28 technomancy: Raynes: dunno, sounds like an oversight

0:29 Raynes: technomancy: Also, a way to cleanly close a connection might be nice. If I close the *nrepl-server* buffer I get a trace.

0:29 technomancy: there's an open issue for that

0:29 Raynes: It works, but not cleanly.

0:29 technomancy: yep

0:29 Raynes: Cool.

0:29 technomancy: https://github.com/kingtim/nrepl.el/issues/33

0:29 Raynes: You rock.

0:29 muhoo: oic, nrepl-connect takes host and port

0:29 it's one page of elisp, nice

0:29 Raynes: muhoo: Yeah, but it isn't interactive.

0:30 muhoo: well, 1200 lines of elisp, but still, one file

0:30 technomancy: I wonder if the bencode stuff should be in its own library?

0:30 probably at some point

0:31 muhoo: (interactive "nPort: ") maybe could take host too

0:31 semperos: dnolen: I've been tinkering with implementing unification for my custom defrecord, and I'm probably not doing it correctly, but I don't see how (run* [q] (== q my-record)) gets affected by my implementation of IUnifyTerms, since it dispatches on the LVar

0:32 and since that dispatch uses some sort of identity-like fn for solving the unification, I'm confused that it doesn't return (identity my-record)

0:33 muhoo: technomancy: haha, it loaded on emacs22. i have to try this out and see if it works

0:33 technomancy: whoa; on 22?

0:33 I was kind of surprised it worked on 23

0:33 muhoo: ya

0:34 dnolen: semperos: (== q my-record) is handled for you.

0:34 muhoo: how do i start an nrepl server?

0:34 dnolen: semperos: same for (== my-record q)

0:34 technomancy: muhoo: M-x nrepl-jack-in should do the trick

0:34 dnolen: semperos: you only need to the handle the cases where q is bound to something else.

0:34 muhoo: christ, it works!

0:34 dnolen: semperos: I mean that those two cases are handle if q is fresh.

0:35 muhoo: technomancy: you can put "tested on emacs22" in the readme :-)

0:35 semperos: dnolen: right, but why is q finally bound to a PersistentArrayMap, and not my Element record type proper?

0:35 I'm missing something obvious, I feel

0:36 dnolen: semperos: PersistentArrayMap is IPersistentMap, so you should be able to handle that by implementing unify-with-map for your record.

0:37 semperos: as I said before, this *may not* work given how protocols are implemented.

0:37 semperos: dnolen: thanks for patiently repeating things til they sink in for me :)

0:37 dnolen: semperos: also in general there's no such thing as saying which term type takes precedence.

0:37 semperos: ok

0:38 dnolen: semperos: I believe at the moment there a latent guarantee that in (== u v), the type of u supersedes v

0:39 semperos: needs thought as to whether that should be a real contract.

0:45 semperos: if you want to guarantee a behavior you could define IUnifyWithPersistentArrayMap

0:46 semperos: and then you could ensure that unification w/ your record always results in your record.

0:46 semperos: though this again assumes that concrete types take precendence over interfaces ... not sure about that.

0:47 when using extend-type I mean.

0:47 semperos: right

0:48 I'll give that a stab, too

0:49 brehaut: re:special editions

0:49 http://forum.rpg.net/showthread.php?638384-Cthulhu-my-French-special-edition-of-Masks-just-arrived-(pics!)

0:49 bah wrong window sorry

0:54 dnolen: semperos: I think I had looked at this in the past - I believe concrete types always take precedence over interfaces.

0:54 semperos: so it should work I think.

0:55 semperos: cool

0:56 I'll give it a try, though the combo of learning as I go has made it slow-going

1:01 dnolen: semperos: heh, I bet. would be helpful if you document your exploration somehow, otherwise I have no idea how to improve the situation.

1:02 semperos: dnolen: sure thing, I plan to put together some blog posts once webdriver-logic reaches some critical API mass and I've spent more time in core.logic's implementation

1:08 dnolen: semperos: I mostly mean keep me posted. Not many people have ventured into extending core.logic.

1:08 semperos: dnolen: can do

1:11 dnolen: semperos: yeah looking at the source, seems like concrete types always win over interfaces.

1:11 semperos: sweet

1:11 dnolen: semperos: if it doesn't work then I have some thinking to do.

1:11 semperos: thanks for checking

1:30 sridatta: hey all. new to clojure and just got started with Noir. one thing that surprises me is that HTML templating in clojure is done in clojure code. isn't this generally a bad practice (mixing presentation with business logic)?

1:31 semperos: sridatta: there are a few ways to approach templating with Clojure, Hiccup and Enlive representing two distinct approaches

1:32 Hiccup uses Clojure data structures, which doesn't prevent you from keeping your Clojure-as-template-code limited to presentation, it just gives you a very powerful language to template with

1:33 Enlive lets you write plain HTML and then use a CSS-like query language to insert values into that HTML when you build your page

1:34 sridatta: interesting. are both equally idiomatic/supported among the community?

1:35 muhoo: sridatta: there's slso mustache

1:35 semperos: sridatta: I'd say so

1:36 folks here like coding Clojure (go figure), so Hiccup might get used more often for examples in blog posts

1:36 but if you have a team with separate designers/front-end folk who don't want to see Clojure code, Enlive is probably a better option

1:37 Enlive is good both for parsing and generating, whereas Hiccup is specifically for generating HTML

1:37 sridatta: awesome. I'll try out both of them and see which I like more

1:38 also is Noir the de facto higher-level web library for Ring?

1:38 semperos: wouldn't say de facto, though Chris Granger has put together a nice collection of web libraries

1:38 Compojure has been around a lot longer, so it's used often

1:38 there are also low-level ones, like Mustache

1:38 muhoo: Raynes: technomancy: thanks, now using nrepl.el in emacs22, with "lein2 trampoline repl :headless" to start the projects and "M-x nrepl RET portnum" to connect. works!

1:39 semperos: sridatta: I'd suggest, before you write too much code in Noir, to at least build a small dummy app using a lower-level library, so you really understand what Ring is doing "under the hood"

1:40 Noir holds onto a lot of "hidden state" for you and provides a nice set of conventions, but you'll find that Clojure web dev is more about composing small, functional libraries than taking on the monolithic convention-based framework approach

1:40 muhoo: noir is pretty lightweight compared to, for example, rails.

1:40 semperos: it'll make writing your own middleware and extensions to Noir's base functionality *much* easier

1:41 sridatta: cool I'll dig in and see. from what I see, it's at the level of Express for node.js or Sinatra for ruby

1:41 semperos: intentionally so

1:46 babysnakes: hi, I've been reading great things about "the joy of clojure" book, but since it's written for clojure 1.2 I'm wondering if it's still that useful for clojure 1.4 (I already read "programming clojure")?

1:48 semperos: babysnakes: absolutely worth reading, it's a lot more than a "how to" book

1:48 not that Programming Clojure is just that either, but TJoC has a lot of value regardless of Clojure version

1:48 babysnakes: semperos: thx

1:58 muhoo: how do i get a lein2 plugin to be available on the classpath of the project?

1:59 in lein1, it was by default. in lein2, i can get the plugin to load via ~/.lein/profile.clj :plugins [], but the plugins aren't in the classpath in the project's repl, rendering them pretty useless (they're repl tools)

2:17 emezeske: muhoo: I believe that the idea of a Leiningen plugin is that it only runs as part of Leiningen, so the host project's classpath is never polluted with it

2:18 muhoo: If the host project uses it, it's not a plugin (by that definition)

2:18 muhoo: I would guess that you need to add it to just :dependencies, but probably only in the :dev profile

2:19 muhoo: I'm not technomancy, though, so don't take my word for it :)

2:20 amalloy: indeed, that doesn't sound much like a plugin; it's just a library

2:20 harja: This is a dumb question and I know perhaps I could find the answer myself but given that I have a Leiningen project that I've coded stuff to src/project_name/core.clj how do I import it to lein repl? I've basically did everything inside vimclojure now

2:21 on vimclojure I can just (use 'myproject.core)

2:21 amalloy: you can probably add it conditionally as a dependency only when in the dev profile, to get the effect of the old dev-dependencies; but Raynes or technomancy would know more specifics than i do

2:24 harja: never mind, I found an error, works now.

2:39 muhoo: emezeske: yep, thanks, it is indeed just a library, and {:dev {:dependencies seems to do it!

2:46 sayyestolife: Lets say I have a function which takes 3 parameters, and I have a vector, [3 4 5], can I somehow destruct/construct that vector so that I can pass it to my function? (Without modifying the function)

2:46 emezeske: muhoo: great!

2:49 sayyestolife: nevermind, got it

2:49 apply will do the trick :)

2:52 mritz: Just about to start learning clojure. I have a 24/hour webcam on me if any of you guys want to watch

2:54 scottj: mritz: haha, twitch.tv?

2:55 mritz: scottj: hehe I'm kidding, but the joke was based on that website

2:55 scottj: mritz: I don't know if you could actually get people to watch it, but if you were famous or something and could then they could spot mistakes and tell you in the chat

2:58 muhoo: technomancy: fyi, it's not perfect in emacs22. this nrepl network capture trace: https://www.refheap.com/paste/3826 yeilds this backtrace in emacs: https://www.refheap.com/paste/3825 . still, pretty cool it got that far.

2:58 mritz: scottj: Yeah, I suppose something more like a live HOWTO could work.

2:58 for live interaction

3:00 scottj: mritz: well if notch or pg or whoever were learning say js they could probably get 1000+ viewers to comment on their every move (or at least on their music)

3:12 kral: namaste

3:16 burt: hello

3:18 I need a bit of help: I have '(["fresh" :hello :world] ["" :foo :bar] ["" :bar :baz] ["cool" :qux :qex] ["" :etc :etc])

3:18 I would like to make the most recent first element in the vector propagate

3:19 so it becomes '(["fresh" :hello :world] ["fresh" :foo bar] ["fresh" :bar :baz] ["cool" :qux qex] ["cool :etc :etc])

3:19 a friend told me to use reductions but i cant figure out how

3:25 _tca_: burt: are you familiar with how reduce works?

3:25 burt: _tca_: im a newb, only a little bit

3:25 its a fold right, yeah?

3:25 im just having trouble with the function and whether i need init or now

3:26 ive tried a bunch of permutations but im getting a bit frustrated

3:27 toxmeister: burt: ,(first (reduce (fn[[acc pa] [a b c]] (let[a (if (empty? a) pa a)] [(conj acc [a b c]) a])) [] [["fresh" :hello :world] ["" :foo :bar] ["" :bar :baz] ["cool" :qux :qex] ["" :etc :etc]]))

3:30 burt: toxmeister: studying

3:30 toxmeister: burt: the key is to keep a record of the last valid "a" around for future reference (as part of the reduce accumulator)

3:30 burt: toxmeister: what happens to c?

3:31 amalloy: burt: why do "fresh" and "cool" 'propagate', but not ""?

3:31 burt: amalloy: because "" is supposed to be the most recent non-empty string value

3:32 amalloy: reductions does sound like the right answer

3:32 burt: amalloy: what is the vectors im "updating" are of variable length?

3:32 if*

3:32 amalloy: doesn't matter

3:33 burt: thanks toxmeister & amalloy

3:34 amalloy: so https://gist.github.com/3186665

3:35 burt: amalloy: great name

3:35 amalloy: thank you

3:36 amalloy: errr -- where is carry-over defined?

3:37 amalloy: oh, i left out the defn form

3:37 updated

3:37 burt: thanks amalloy

3:37 amalloy: (i'll tell my parents you like my name)

3:37 burt: ha ha

4:59 benedikt: technomancy: that sounds sensible. i might have an older version. What is the emacs-package called?

5:04 technomancy: looks like it is installed with leiningen

6:54 Raynes: muhoo: Pretty sure you win the award for longest paste ever: https://www.refheap.com/paste/3826

8:26 ambrosebs: How can I get lein-tarsier (aka. lein vimclojure) to not fetch it's own Clojure dep? I'm trying to run my own Compiler dep.

8:26 I'm using lein 1.7.1

8:31 clgv: ambrosebs: there is an :exclusions option you can specify for each dependency

8:32 ambrosebs: clgv: I'm installing it like so: lein plugin install lein-tarsier 0.9.3

8:32 Where do I put the :exclusions?

8:32 clgv: oh right, damn.

8:33 ambrosebs: clgv: I did try and make a :dev-dep ... didn't run.

8:33 clgv: ambrosebs: should though. but you have to be in the project directory

8:33 ambrosebs: clgv: It blew up on a nrepl dep

8:34 Maybe I need to add an extra dep myself..?

8:35 clgv: I dont know

8:35 ambrosebs: I worked around it by deleting the jar after running lein deps.

8:35 Seems to work.

8:39 XPherior: Hey cemerick. Was taking a peak at Friend and had a few question. Are you around?

8:39 Peek, rather.

9:09 cshell_: ,(macroexpand (defmacro f [name & args] `(defn ~name [& ~args])))

9:09 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

9:11 clgv: cshell_: you have to quote the expression you want to expand. and you cannot `def` in clojurebot's sandbox

9:12 cshell_: If I call that macro above, with name and no additional args, it expands to (defn name [& nil]) - could someone please tell me how to make those args not expand to nul if I'm creating a call to another function with my macro?

9:12 clgv: ah okay, sorry

9:12 I want it to expand to (defn name []) - I'm sure it's something simple that I'm missing

9:13 clgv: cshell_: give a complete example: macro call and expansion

9:14 cshell_: k, one sec

9:14 (defmacro f [name & args] `(defn ~name [& ~args]))

9:15 (macroexpand '(f my-fun))

9:15 (def my-fun (clojure.core/fn ([& nil])))

9:16 gfredericks: cshell_: use ~@args instead of ~args

9:16 cshell_: awesome, that worked, thanks gfredericks

9:17 mdeboard: you're welcome

9:17 my friend

9:17 gfredericks: cshell_: check that it does what you want for (f a b c d)

9:17 the example makes me suspicious that there's a deeper problem

9:18 cshell_: okay, onsec

9:21 (macroexpand '(f my-func a b c d))

9:21 (def my-func (clojure.core/fn ([a b c d])))

9:21 is it odd to have the '(' around the arguments?

9:25 clgv: cshell_: yes

9:26 cshell_: try that one (defmacro f [name & args] `(defn ~name ~(vec args)))

9:28 cshell_: appears to do something similar

9:28 (macroexpand '(f my-func))

9:28 (def my-func (clojure.core/fn ([])))

9:29 clgv: cshell_: try macroexpand-1

9:29 cshell_: (clojure.core/defn my-func [a b c d])

9:29 so the defn must be expanding it that way?

9:30 clgv: cshell_: I misread your previous post. defn expands to (def bla (fn ([a] ...) ([a b].. )))

9:30 cshell_: (clojure.core/defn my-func []) - with no args

9:30 ah cool

9:30 thanks clgv :)

9:30 clgv: cshell_: but what do you want to do?

9:32 cshell_: I just wanted to be able to have optional args passed in - the ~@args seemed to ensure that the nil didn't appear

9:32 that was pretty much my main problem, in hindsight - the parens in the defn expansion was a curiosity

9:33 clgv: cshell_: you want functions with optional args and default values?

9:34 cshell_: if so, you can have a look at the clojure.options library (version 0.2.0)

9:35 cshell_: I'm using enlive and trying to make a macro that will call deftemplate with some common transforms: http://pastebin.com/Gf0jbxjK

9:36 I made the defn macro as an example to make the question less complex

9:36 I'll check out the options lib too :)

9:37 clgv: I don't know enlive, but might there be a macro/defn that does something like common-pages already?

9:39 cshell_: You can do snippets and such which help you with common pieces of html that you want to inject in - they also have templates, but what I found was that I was repeating those lines of code in that pastebin for every call to deftemplate

9:40 I've never written a macro before, but it seemed to be a good fit because there was a lot of boilerplage

9:40 er, plate

9:41 clgv: cshell_: humm, in my opinion there should be a way to specify these transformations though a function

9:42 cshell_: So a function for each of the transformations? and then compose them together?

9:44 clgv: cshell_: that would be idiomatic. but with deftemplate alon that seems not possible

9:45 cshell_: because deftemplate is a macro?

9:45 and the way it treats the transformation forms?

9:45 clgv: the second I think

9:46 cshell_: yeah, that's what I've been struggling with - I have been thinking about a better way for a while but nothing has worked

9:48 clgv: cshell_: you can look at the source and build something that works

9:48 cshell_: maybe thats a sign to use a different templating lib? I don't know if there is a better one

9:51 cshell_: Yeah, I have an odd requirement to support in that I need the templates files (html) to be almost a snapshot of what the page should look like (so the web designers can work with them) and then I come in and make some parts dynamic

9:52 They don't understand templating, they only understand html and css

9:54 clgv: thanks for your help!

10:22 solussd: naming convention advice request: I have a namespaces called blah.auth.helpers, blah.auth.roles, etc… and I want a base "auth" namespace. I would usually call it blah.auth.core, but I'm considering blah.auth (which would mean there would be both an auth/ directory and an auth.clj in the blah directory of my project). Does anyone have a preference?

10:26 elliottw: solussd this isn't from clojure at all, but I've always like to keep my directories either full of files or full of directories… always seemed cleaner to me. fwiw

10:26 duck1123: I would choose blah.core over blah, but blah.auth and blah.auth.* is fine

10:26 that's how I do it, at least

10:27 solussd: duck1123: that's where I was leaning… I think core makes sense for the base of a project, but feels wrong in other namespaces…

10:28 cemerick/friend follows that convention too.

10:28 thanks guys

10:28 elliottw: solussd i also like core, because it implies others in it's name. if i just saw blah.auth i wouldn't get to assume that there was .helpers and .roles

10:28 solussd: hmm.

10:29 cemerick: XPherior: shoot

10:29 llasram: My understanding is that the `blah.core` convention is purely an artifact of how the Clojure compiler generates classes which use their namespace as a prefix, not a package. So single-component namespaces result in classes in the root package, which Make Java Unhappy Sometimes (tm)

10:29 duck1123: it seems highly dependant on what the namespaces actually do

10:30 solussd: yeah, i'm more concerned with 'further down' the namespace hierarchy, e.g. blah.auth.core vs. blah.auth

10:30 duck1123: llasram: but it's such a convention now, that is seems wrong to see it otherwise, even in cljs where it's not an issue

10:31 llasram: duck1123: Hmm, that is a good point

10:32 duck1123: I would possibly use core if blah.auth was a library and there is a single namespace that should be all you need

10:33 gtrak: is there a way to attach an eclipse debugger to a swank session?

10:34 solussd: duck1123: auth isnt a library in this case- just authentication/authorization stuff for the app

10:34 that makes sense as the litmus test though

10:39 gtrak: nevermind, I figured it out, swank shows a dt_socket when it starts and I can connect to that

10:43 Bronsa: hi, is it normal that use-ing aleph.tcp takes 7seconds?

10:44 stuartsierra: yse

10:44 *yes

10:44 Bronsa: ok

10:45 thanks

10:53 stuartsierra: solussd: for the record, I never liked 'core' names because I thought it was needless mimicry of the Clojure language, which only adopted the '.core' name when it became clear that single-part namespaces were a problem for Java interop.

10:53 pjstadig: (inc stuartsierra)

10:53 lazybot: ⇒ 2

10:54 solussd: stuartsierra: what should someone do for things that live at the top of their namespace? blah.blah?

10:54 i've seen that a lot

10:54 stuartsierra: solussd: 'your-group-id-or-name.blah'

10:55 llasram: OOC, why doesn't Clojure just use the namespace as the package name?

10:55 solussd: ah, like cemerick.friend. :)

10:55 stuartsierra: llasram: it used to

10:56 llasram: stuartsierra: It caused problems?

10:56 stuartsierra: But you still need to generate a class for the static initializer code

10:56 goodieboy: is there a way to test java interop? like... mock java methods via midje etc.? I'm guessing no?

10:56 solussd: maybe the default behavior of leiningen's (lein new) needs to change then since it's probably most responsible for the continuation of *.core namespaces

10:56 stuartsierra: solussd: I'd like that

10:57 llasram: stuartsierra: Ah. And someone / rhickey decided using the terminal namespace token as the class for the initializer code was better than reserving some name like `__clojure_init`?

10:58 cemerick: The .core convention in lein new is there because there's no clearly better approach. Single-segment namespaces shouldn't be encouraged, and so `lein new` would have to autogenerate a "groupId" segment.

10:58 pjstadig: technomancy had talked about detecting a multi-segment name and not auto-appending the ".core"

10:58 cemerick: I remember $USER being suggested, but no one liked that much.

10:59 pjstadig: cemerick: lein new can get a groupId segment

10:59 lein new foo/bar the groupId is foo

10:59 cemerick: sure, but what % of users will ever do that?

11:00 pjstadig: the % that know its there and why

11:00 cemerick: Well, that % probably won't use lein new anyways, for other reasons.

11:00 s/won't/don't

11:02 A `lein new` that interrogates the user for a groupId would work.

11:02 I'm sure there's lots of other options that could usefully be exposed that way.

11:06 acheng: emacs question: if my cursor is somewhere in the middle of a defn, is there a command or a keyboard chord for evaluating the defun?

11:07 craigbro: C-M-x

11:07 acheng: ooh thanks!

11:07 duck1123: bear in mind that evaling just 1 fn will screw up it's line numbers

11:07 craigbro: you know, I just look thru the SLIME menu

11:08 it lists most of the operationgs

11:08 opertaions

11:08 also F1-m

11:08 will list the mode docs and that includes keybindings

11:08 duck1123: C-h m is gread for seeing bindings for the current modes

11:08 great

11:22 locojay1: hi is there something like ipython notebook in clojure . web repl where i can add markdown , code , plots (incanter). then save the thing and open later. great for tutorial

11:26 i guess lightable would do this once released

11:27 georgek: locojay1, this is the closest I know of, http://vimeo.com/44968627, but still a POC as far as I know

11:27 he's working on it though and it looks very promising

11:27 as he used to work on mathematica, very close to what you're asking about

11:28 https://github.com/kovasb/session

11:28 don't think that repo represents the latest work though

11:29 locojay1: thanks missed that meetup

11:33 goodieboy: weavejester: hey, trying our your nifty rotary lib, thanks! I was wondering, how can i get a count of all docs in a table?

11:49 weavejester: goodieboy: I don't think there's code for that yet in Rotary. The library isn't complete yet. I think there is a pull request for it, but the author didn't reply to my comments. I may send a message to him to see if he's interested making the changes.

11:49 goodieboy: weavejester: ahh ok, np. Thanks!

11:51 weavejester: goodieboy: Wait, sorry, the pull request I was thinking of has already been merged.

11:51 goodieboy: The query function has a :count option key

11:52 goodieboy: weavejester: ahh ok! I'll have a look.

11:52 weavejester: goodieboy: Although there isn't an equivalent to `scan`… we might need a patch for that.

11:53 craigbro: weavejester: so I hope that email patch for clout.core/path-decode worked out ok, how do you prefer such things? git pull requests?

11:53 goodieboy: weavejester: gotcha, yeah scan is what i'm looking for. i'll have a look at the code

11:54 weavejester: craigbro: I think that slipped through my inbox, I'm afraid. Let me look it over now.

11:58 craigbro: A pull request would be best, though I think I might create a codec library for path-decode, since it's used in other places.

11:58 craigbro: Maybe I'll create a ring/ring-codec library.

11:58 Or maybe web-codecs

12:00 craigbro: weavejester: seems a reasonable approach

12:01 goodieboy: ,(+ 123456789.0 0.1)

12:01 clojurebot: 1.234567891E8

12:01 weavejester: craigbro: I didn't know about the quoteReplacement method - thanks for pointing that out

12:02 craigbro: weavejester: it bloweded up my app 8)

12:02 weavejester: craigbro: Ring had a similar problem, which I fixed but without quoteReplacement. I forgot to do the same to Clout, though.

12:06 cemerick: I've been thoroughly flummoxed by core.unify. To wit: https://www.refheap.com/paste/3829

12:06 Help?

12:07 (I expected the second unification to return nil or something.

12:09 oskarth: what is the best clojure eqv to http://play.golang.org/? ie online repl with multilines integrated simple pastebin

12:10 technomancy: pjstadig: there was some gripeage about whether dropping the .core suffix would cause issues for osgi or something

12:11 at which point I lost interest... but I'd be up for revisiting it

12:12 as long as it doesn't involve someone explaining what OSGi is to me in words that don't communicate any substantial meaning to my mind and me nodding blankly

12:14 oskarth: cljbin.com does evaluation

12:17 oskarth: technomancy: thanks!

12:22 cemerick: well, that's what I get for straying from core.logic. :-) https://www.refheap.com/paste/3829

12:27 dnolen: cemerick: I think there are still a couple of subtle bugs in the friendly unifier, bug reports welcome.

12:29 hiredman: cemerick: the examples show a function called `unifier` rahter than `unify`

12:29 mdeboard: Anyone here have any experience using iText in Clojure? I'm wondering whether I'm just not smart enough to do this or if iText just has a very poor API.

12:30 cemerick: hiredman: right; unify/unifier is the equivalent of logic/unify; unify/unify is supposed to be the equivalent of logic/binding-map (or, is, except when unification can't succeed, in which case it tosses an exception. :-|

12:31 dnolen: Noted. I'll be throwing a couple 100K iterations of data from test.generative at it, so we'll see what pops up. :-)

12:36 dnolen: cemerick: heh cool. I'm curious to see how well cKanren can be leveraged for automatic test generation.

12:50 lynaghk`: dnolen: I watched your NYC Clojure meetup talk yesterday. Nice job---I'm really interested to see if I can use core.logic for some positioning/layout stuff that I'm working on now.

12:51 eggsby: lynaghk`: it was so sad the way it cut off

12:51 lynaghk`: eggsby: I know! I was on the edge of my seat about that question =P

12:54 zerokarmaleft: went digging for those links...tom hickey's avatar always cracks me up

12:56 dnolen: lynaghk`: it's probably possible. I have yet to do any serious profiling / optimization work tho.

12:56 lynaghk`: it just depends on how many constraints and what is fast enough for your problem

12:57 lynaghk`: dnolen: I'm more interested in expressiveness over performance at this point; most of the layout will be for static concerns like margins, &c.

12:58 dnolen: not sure exactly what I need at the moment; I'm working on the semantics of a data visualization grammar and won't need to tackle rendering for a while.

12:59 dnolen: lynaghk`: yes then it would probably work for that. That said it doesn't seem slow. Solving dinesman and the stones problem takes like 3 / 4ms

12:59 lynaghk`: dnolen: yeah, that's nuts. I just need to grok a bit more so I can express layout in terms of finite domains

13:05 dnolen: lynaghk`: for doing layout stuff you should probably wait for the equation sugar, it pretty tedious at the moment to do anything even moderately complex.

13:06 lynaghk`: dnolen: equation sugar looking something like the ClojureScript API I slapped onto Cassowary?

13:06 (constrain! (== (+ 10 (right A)) (left B)))

13:07 dnolen: lynaghk`: I haven't looked closely at that, but is it a macro that expands expressions out into primitive constraint ops?

13:08 lynaghk`: no macro; excludes clojure core arithmetic and replaces with multimethod that builds primitive constraints

13:08 but yeah, basically the same thing I suspect.

13:08 dnolen: lynaghk`: yeah, same idea but this will be a macro.

13:14 mritz: I've converted a few of my most CPU intensive code to Clojure (from Python). I've had some pretty impressive gains with out trying hard or knowing much about JVM/Clojure. Is this typical?

13:14 craigbro: jvm vs python runtime?

13:14 mritz: yes

13:14 craigbro: jvm usually wins in my experience

13:15 mritz: In the area where I am serializing ~1 MB protobuff objects… Clojure is going at about 100x.

13:18 dnolen: mritz: regardless of the uninformed opinions you may find on the InterWebs - Clojure is not slow ;)

13:18 burt: mritz: that's a lot. :)

13:18 dnolen: do people really say that?

13:18 * burt boggles

13:18 dnolen: burt: you see lots of horrendously written benchmarks and judgements yes.

13:19 burt: written no doubt by ruby programmers

13:19 ;)

13:19 mritz: ruby programmers can write?

13:19 boom

13:20 burt: i kid the ruby guys, but when someone is using a language that has a community mantra about not needing to be fast, and then starts to care about performance, it's a little unsettling

13:22 solussd: could anyone tell me why this code isn't creating symbols as expected (e.g. group-mime-type should resovle to :my.name.space/group): https://www.refheap.com/paste/e7bfe3f0d81cb6ab53fd50425

13:24 llasram: solussd: (a) The macro is just repeatedly receiving the symbol `type-name` as its parameter

13:24 hiredman: solussd: macros don't work like that

13:24 ,(doc ns-name)

13:24 clojurebot: "([ns]); Returns the name of the namespace, a symbol."

13:24 solussd: llasram: oh geez. ok thanks

13:24 im not operating on much sleep today. :D

13:25 llasram: solussd: (b) not the immediate problem, but a separate bug: the reader metadata is applied at read-time, so you're annotating a random intermediate from with {:const true}, not the final symbol. You need to ensure that the symbol you generate in the macro has itself the metadata you want

13:25 s,from,form,

13:26 solussd: ah, that explains the expansion missing it

13:27 llasram: hiredman: Oh, nice. I've wondered why namespaces aren't Named, but that at least is a nicer way of going from namespace -> symbol

13:27 hiredman: ATR Named implies a string name, but the name of a namespace is a symbol

13:27 AtR?

13:28 llasram: Hmm. That makes sense

13:28 hiredman: I think AtR is better

13:34 alexyakushev: Hello everyone, a question on macros here. Suppose I want a macro with variable number of arguments, which method is correct? https://www.refheap.com/paste/3834

13:37 llasram: alexyakushev: Both?

13:37 joegallo: alexyakushev: i think a common approach is to use [& args] and then just solve it as a single arity

13:38 unless a and b are totally distinct things, then you might see [a & [b]] or something clever like that.

13:38 alexyakushev: joegallo: Thank you, I will try to do it this way

13:40 joegallo: that said, searching for "(defmacro" in core, i generally see: [& forms], [blah & forms], or multi-arity. of course, you shouldn't necessarily write your code like clojure/core.clj, but it's a small hint at what is out there.

13:40 for instance, if-not is pretty concisely written as two separate arities.

13:42 lynaghk`: cemerick: I've got a friend question for you.

13:42 cemerick: shoot

13:43 lynaghk`: cemerick: is there a nice way to perform some work and stick it in the session when a user first authenticates? I can put it in the credential map, but then I have to do quite a bit of digging to get it out agin

13:44 cemerick: and it seems like nosing into the implementation details: (get-in request [session identity current])

13:46 cemerick: lynaghk`: what is the data in question?

13:46 lynaghk`: cemerick: to give you a bit of context, I'm basically using a 3rd-party service to authenticate users. They have a Java API, and it returns an object that you can then query to get more info (the user's files, &c.)

13:47 cemerick: That seems like exactly the sort of thing that should be in current identity.

13:47 lynaghk`: cemerick: wait, is there some kind of (get-identity) fn I can call that will return the map?

13:47 cemerick: sure

13:47 lynaghk`: rather than me having to dig through the session manually

13:48 cemerick: (friend/identity req) gives you a map of all identities associated with the current session

13:48 (-> req friend/identity friend/current-authentication) gives you the current one.

13:48 s/one/identity

13:48 lynaghk`: ah, yeah. That's basically exactly what I've been doing except I did it manually. Thanks!

13:49 cemerick: Or, you can just call (current-authentication) if you're safely on the original request thread.

13:50 lynaghk`: cemerick: that sounds even better. There's no magic thread stuff going on under the standard ring/compojure stack, is there?

13:50 basically, I just couldn't call that fn within a future or something?

13:50 cemerick: lynaghk`: it depends upon the dynamic binding of friend/*identity*, so all the usual caveats about dynamic vars apply

13:57 lynaghk`: cemerick: works great. Thanks!

14:05 cemerick: dnolen: All the test data comes from test.generative at the bottom, but I am using core.logic to find useful queries over it. I think that qualifies as core.logic generating tests, though probably not in the way you mean.

14:06 juhu_chapa: Hi all! Why is not true the following expr? (= (.getReturnType (.getMethod String "length" nil)) int)

14:06 S11001001: ,(type int)

14:06 clojurebot: clojure.core$int

14:07 S11001001: ,(supers (type int))

14:07 clojurebot: #{clojure.lang.IMeta clojure.lang.IObj clojure.lang.Fn clojure.lang.IFn java.util.concurrent.Callable ...}

14:07 S11001001: juhu_chapa: int is not a type

14:07 otoh

14:07 ,(type Integer/TYPE)

14:07 clojurebot: java.lang.Class

14:08 S11001001: juhu_chapa: you have to be careful with the types of things you give to =; = is no help whatsoever if you don't line them up right, it just returns false

14:15 juhu_chapa: S11001001: what expr must go in order to get true?

14:17 cemerick: dnolen: And BTW, the unifier seems to do well, for me anyway: ~100K unifications so far without a hiccup.

14:17 dnolen: cemerick: sweet!

14:20 xumingmingv: is there a tool like javadoc for clojure?

14:20 craigbro: marginalia?

14:21 juhu_chapa: S11001001: I just read line above, thanks.

14:21 technomancy: xumingmingv: in general it's not needed nearly as much since you can access documentation at runtime in the repl. but there are a few tools for generating HTML if you need to publish something on the web

14:21 marginalia being the most commonly-used

14:21 xumingmingv: thanks technomancy craigbro

14:22 mdeboard: lol

14:24 Vinzent: xumingmingv, take a look at https://github.com/weavejester/codox

14:25 xumingmingv: Vinzent: thanks

14:57 KirinDave: I had this funny idea that when you had a nested class in java, clojure could reach it via (import 'org.byzantine.TopClass$NestedClass)

14:57 Is that wrong?

14:58 llasram: KirinDave: That's the way to do it

14:58 KirinDave: Hmm

14:59 Maybe there is a deps issue then.

15:00 scgilardi: that class name is also how java refers to it. getting a manifest of the jar (say, by opening it in emacs or jar -t) may be helpful.

15:00 java -> the jvm

15:13 amalloy: KirinDave: that's a fine import statement, as long as your code is referring to it as TopClass$NestedClass

15:13 and not, say, hoping to get away with just NestedClass

15:13 KirinDave: Yeah.

15:13 technomancy: hierarchy is an illusion

15:13 generally speaking

15:13 KirinDave: It is actually one of those fun things where multiple versions of a lib are included.

15:14 So now I am going through excluding from every package jetty so I make sure to get the version of jetty I want.

15:14 amalloy: can't you set a global exclusion and let lein do that?

15:16 KirinDave: amalloy: Can I?

15:16 amalloy: I've never seen that in the wild, and the exclusions stuff isn't exactly documented.

15:16 amalloy: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L42

15:17 KirinDave: That's a timesaver.

15:17 amalloy: good thing it was exactly documented

15:18 KirinDave: amalloy: Might be good to mention it in the readme, tutorial, wiki documentation, etc before you do a victory dance. :)

15:19 amalloy: i'm sure lein has a great readme/wiki, but the only docs i ever have a reason to look at are the sample project.clj options

15:20 emezeske: Why on earth would you need to put an advanced feature like that in the readme or tutorial? The wiki, sure. Anyway, if you're looking for advanced stuff, the sample.project.clj is *the* place to look, it's exhaustive.

15:21 KirinDave: emezeske: Irc is not a rich media format, so you'll have to just imagine me doing a fry face, then massaging my temples, and then making a face that suggests we both have better uses for our time than to argue the definition of documentation.

15:22 emezeske: I apologize for asking you to meet me on said metaphorical bridge, but I'm being beleaguered by tech gossip reporters and it's been a rough morning.

15:22 emezeske: Well, I thought it was a fine use of my time, or I wouldn't have typed it out :)

15:23 But sure, we don't need to argue about it.

15:30 duck1123: the global exclusions were great in the early days of 1.3 migration. All my projects had "don't want to see contrib anywhere on my classpath"

15:32 hiredman: kovasb: have you seen http://www.mathjax.org/demos/tex-samples/ ?

15:34 kovasb: hiredman: have not, looks pretty good

15:34 zerokarmaleft: with the exception of radicals

15:35 hiredman: zerokarmaleft: there are other rendering options that look better

15:35 rendering to html/css ends up with the funky looking radicals, but rendering to mathml or svg doesn't

15:36 http://www.mathjax.org/demos/mathml-samples/

15:38 KirinDave: hiredman: Seems to work right for me?

15:39 hiredman: KirinDave: it renders the radical, but the top line is not as smooth and crisp

15:40 zerokarmaleft: yea, it's visually segmented, the mathml and svg renders are better though

15:51 KirinDave: hiredman: Ah, so it does. A very subtle effect, like 1 pixel raised?

15:51 Periodically?

15:52 hiredman: I see this in Chrome, http://fayr.am/INxQ

15:53 hiredman: firefox is similar, but slightly different

15:53 I imagine the html/css rendering mode is most likely to have differences between browsers

15:53 KirinDave: hiredman: Barely perceptible on my screen.

15:54 hiredman: I'd take the anti-aliased text over slight artifacts in long radicals, personally.

16:07 solussd: ack! is clojars down?

16:08 Raynes: Oh no. Abandon all hope!

16:08 technomancy: siren sounds

16:08 solussd: we're scrreeewed!!

16:08 Raynes: The bloody sky is falling.

16:08 technomancy: eep; can't reach it over SSH

16:09 solussd: funny thing is… it kind of is that way. I cant 'clojure-jack-in' because I've added new deps that havent been pulled down yet. :)

16:09 Raynes: technomancy: Hold me.

16:09 * Raynes shakes

16:09 technomancy: and it's only 6:00 AM it _ato's time zone

16:09 solussd: at least it's friday. I'm sure it'll be back by monday

16:10 does clojars get any financial support from anyone? Seems like it's becoming more important all the time

16:10 duck1123: it's a good thing no one does anything with clojure over the weekend, right?

16:10 solussd: damn

16:11 Raynes: technomancy: What is clojars hosted on?

16:11 technomancy: Raynes: ato's VPS

16:12 Raynes: What company?

16:12 technomancy: linode, I think?

16:12 Raynes: Yikes.

16:12 $kill

16:12 lazybot: KILL IT WITH FIRE!

16:12 technomancy: there are backups

16:12 Raynes: At least he didn't take me down with him.

16:12 * Raynes adds context to his last few messages by pointing out that lazybot is on a Linode server.

16:13 technomancy: heh

16:16 shoot, https://github.com/ato/clojars-web/wiki/Data only shows backups that are on the same server, but I'm sure _ato has some offsite too

16:17 brainproxy: maybe clojars is protesting fogus' departure from core

16:17 hiredman: rebuild from caching repos

16:20 stuartsierra: Clojure and contrib libraries will still be available through Maven Central Repo.

16:23 Raynes: stuartsierra: But they're utterly useless without my libraries, which are on clojars!

16:23 Everybody uses my libraries, right?

16:23 technomancy: I'm fairly positive there won't be any data loss, just temporary unavailibility

16:24 stuartsierra: technomancy: But why spoil a good excuse for a panic attack?

16:25 technomancy: the crazy thing is I started to deploy a branch to get releases uploaded to S3 last week, but I never got the AWS creds to actually push it out

16:28 stuartsierra: Reportedly "Linode is having connectivity issues in their Atlanta data center."

16:28 technomancy: east coast: all the problems.

16:28 Raynes: technomancy: They're having issues at the Atlanta data center. It is just connectivity from what I can see.

16:28 technomancy: cool

16:29 still a good reminder for me to get crackin' on that S3 promotion branch

16:29 Raynes: Which is about what you'd expect from Linode. I think amalloy and my VPS has gone down for real once in its lifetime, and everything else has just been network problems.

16:29 Man, I never get that right. "amalloy's and my vps'?

16:30 I should keep an English text book with me at all times.

16:30 brainproxy: :)

16:30 technomancy: maybe lazybot could dispense tips from the Elements of Style the same way clojurebot does perlis epigrams?

16:30 llasram: I apologize on behalf of the ____ city of Atlanta

16:31 mdeboard: damn

16:31 I love madlibs

16:31 llasram: hehe

16:31 hiredman: more than just a major delta hub

16:32 llasram: We also have data centers and an aquarium!

16:32 TEttinger: and GA Tech

16:33 pjstadig: technomancy: i'll feel better when clojars pushes to S3 because amazon *never* has any outages

16:33 Raynes: Bahahaha

16:33 TEttinger: pjstadig haha I remember that last outage

16:33 Raynes: That last outage took out like half of Heroku.

16:33 I blame technomancy.

16:33 TEttinger: a significant fraction of the internet was disrupted!

16:33 pjstadig: tho to be fair i guess they rarely have S3 outages

16:33 mostly EBS

16:33 TEttinger: what did you do, technomancy!

16:34 technomancy: pjstadig: remind me the last time S3 lost data? =)

16:34 brainproxy: technomancy: how many VPSs make up clojars?

16:34 amalloy: i would be astonished if that number were larger than one

16:34 pjstadig: it's not just about losing data mind you, but connectivity too

16:35 and i already said that (to be fair) S3 rarely has issues :)

16:35 brainproxy: i was thinking, how hard would it be to just keep a mirror on a vps in one of rackspace's datacenters, something like that

16:35 technomancy: brainproxy: just one

16:35 brainproxy: I have a branch that runs on heroku with no single point of failure

16:36 err

16:36 well, apart from entire AZ outages

16:36 brainproxy: yeah

16:36 technomancy: that's why I want to get releases on to S3

16:38 frozenlock: Is there a function to round up a number?

16:39 emezeske: frozenlock: That would be a java question: http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#round(double)

16:40 amalloy: well, he wants ceil, not round

16:40 Raynes: &(Math/ceil 0.6)

16:40 lazybot: ⇒ 1.0

16:40 emezeske: amalloy: Oh, I think you're right

16:41 Raynes: amalloy: Would you believe me if I told you I was looking for ceil in javadocs before you said that?

16:41 frozenlock: Thank you very much

16:41 goodieboy: is anyone familiar with the clj-time lib?

16:42 frozenlock: goodieboy: Somehow

16:42 ,ask

16:42 S11001001: frozenlock: clojure.math.numeric-tower has more exciting versions of those functions

16:42 frozenlock: S11001001: I've never seen the word "exciting" coupled with the math function round or ceil :P

16:42 goodieboy: frozenlock: i'm trying to figure out how to calculate the difference, in milliseconds from the current time, to 1:00 AM

16:43 1:00 AM, the next day that is

16:45 duck1123: goodieboy: are you using jodatime for this?

16:45 goodieboy: duck1123: yeah i think the clj-time lib uses joda

16:46 Raynes: That's always 12 hours in The Twilight Zone.

16:50 duck1123: goodieboy: looks like you're going to want to create an interval (interval from to) and then call .toDuration on that, I assume that str will return the right thing, but I can't test it atm

16:50 goodieboy: duck1123: ok let me try that out, thanks!

16:51 duck1123: http://joda-time.sourceforge.net/apidocs/org/joda/time/Interval.html

16:51 technomancy: clojars is back, folks

16:51 Raynes: Wooooot!

16:51 brainproxy: clojars lives, yay

16:54 llasram: goodieboy: clj-time has some convenience methods. There's probably a cleaner way to do it, but maybe something like this: https://www.refheap.com/paste/3839

16:54 (I've used the library some, but not extensively)

16:55 goodieboy: llasram: nice, thank you for that. Very helpful.

17:27 mritz: whats the best way for changing a dependcy version a plugin has? I have protobuf plugins installed that brought down 2.3.1. I want to upgrade this to 2.4.1

17:28 technomancy: mritz: what's the context?

17:29 mritz: technomancy: so lein-protobuf has in its projects file a protobuf version number. It is set to 2.3. I have this plugin installed. I'd like to be able to reinstall this plugin with verson 2.4.1.

17:30 technomancy: so a dependency of the plugin itself... you could try declaring a top-level dependency on the newer version

17:30 sorry, declaring it in :plugins

17:30 mritz: hmm

17:30 it has a line (defn version [project]

17:30 (or (:protobuf-version project) default-version))

17:31 so I thought I could specify :protobuf-version in my project file

17:31 technomancy: Raynes might know more

17:31 Raynes: He might not though.

17:31 technomancy: it's possible

17:31 mritz: I just started clojure yesterday so that is probably the main issue

17:32 technomancy: no, this sounds like an issue with the plugin

17:32 Raynes: It should work if you use :protobuf-version. Can you paste your project.clj file to https://www.refheap.com for me?

17:32 technomancy: Watch your mouth.

17:32 * Raynes squints.

17:33 mritz: https://www.refheap.com/paste/3840

17:44 Raynes: mritz: I'm a little busy at the moment, but I'm making a note to look at this when I get a chance.

17:45 Sorry that it isn't working out for you. We've made a truckload of changes to all of this stuff recently. Bound to be some bugs.

17:45 I'll probably work on it on Monday.

17:46 Luckily I get paid for it. :p

17:56 mritz: Raynes: Thanks. Although I think this MAY have been my fault. What was confusing for me is that leon won't bring down the new version of protobuf until I actually call 'leon protobuf'

17:57 Raynes: So it did what you wanted?

17:58 mritz: Raynes: I did a local repo install from the github. I'll clear out everything again and try it from lein repo just to make sure it was my fault

17:58 sorry if my terminology is wrong here, I don't know wtf I'm doing

17:59 I'm still not positive it honors the version of my project file, but I have a bunch it will..I'll let you know

18:01 technomancy: clojurebot: leon?

18:03 clojurebot: snap out of it, man

18:03 llasram: It's been a sad time for bots of late

18:18 eggsby: anyone here familiar with korma? I'm having some trouble connecting to an oracle db with it

18:19 technomancy: eggsby: there are some known bugs with korma getting in the way of the standard jdbc adapter

18:19 not sure if this is the same problem you're seeing, but it might help: https://github.com/ibdknox/Korma/issues/62

18:21 eggsby: i'll dig into it, slightly irked that its working in grails using the same driver *ugh grails* but not in korma :(

18:22 I'm getting https://www.refheap.com/paste/3841 when trying to select, I wish there was some way to verify that the connection pool itself was successful

18:27 is there anything glaringly wrong here? https://www.refheap.com/paste/3842

18:29 technomancy: eggsby: have you tried raw clojure.java.jdbc?

18:29 I don't really trust defdb

18:29 eggsby: I haven't, i'll take a shot at it

18:29 thanks technomancy

18:29 hiredman: clojure.java.jdbc will let you pass in a url, just like what you have in grails there

18:32 eggsby: and so hiredman, I would just specify the subprotocol as oracle and the subname as the "(...)" TNS bit?

18:34 hiredman: eggsby: http://dev.clojure.org/jira/browse/JDBC-21

18:34 eggsby: ah, so this patch isn't in master?

18:35 nvm

18:35 hiredman: eggsby: https://github.com/clojure/java.jdbc/blob/629893eac45050197c37c3e1342de2ad1c232291/src/main/clojure/clojure/java/jdbc.clj#L150

18:35 connection-uri

18:52 eggsby: weird, now i'm getting a null pointer exception :/ https://www.refheap.com/paste/3844

18:55 hiredman: eggsby: I recommend reading beyond the first line of the stacktrace

18:56 eggsby: hiredman: that's just what lein repl returns, I wish I could read deeper :(

18:56 hiredman: the last exception thrown in the clojure repl is bound to *e

18:56 dnolen: eggsby: (clojure.repl/pst *e)

18:57 eggsby: thanks guys

18:58 hm, still just the one line

18:58 I'm doomed

19:17 casion: so I'm new to lisp, and clojure... I'm having difficulty understanding the differnce between a list and a vector

19:19 anyone have any words that might make it a bit more clear to me?

19:19 technomancy: casion: tl;dr is O(n) vs O(1) access

19:19 a list is just a head and a tail; a vector is addressable by offset

19:20 casion: technomancy: ahhhh ok

19:20 this tutorial did not make that clear at all

19:20 thank you

19:23 ToxicFrog: conceptually, a list is a linked list while a vector is, well, a vector: a resizeable array.

19:23 (this may not actually be how they are implemented internally, though)

19:24 casion: I'm going through the 'clojure tutorial for non-lisp programmers'

19:24 and it has not (yet?) made that clear

19:25 it makes more sense now though, thank oyu

19:25 technomancy: where's that?

19:25 casion: http://moxleystratton.com/clojure/clojure-tutorial-for-the-non-lisp-programmer

19:26 it's the only thing I could find that didn't come with a presumption of lisp or funtional programming knowledge (of which I have neither)

19:26 hiredman: "The vector is another data structure, similar to a list. Vectors are zero-based arrays."

19:26 technomancy: ~volkmann

19:26 clojurebot: volkmann is probably the best free introduction to the Clojure language: http://java.ociweb.com/mark/clojure/article.html

19:27 casion: hiredman: I read that, however the idea that a list was similar to a linked list was not made particularly clear

19:27 it seems obvious now though

19:28 technomancy: casion: I think he's pointing out that the tutorial is misleading and/or unhelpful.

19:29 hiredman: I dunno

19:29 Raynes: It's also about 200 years old. :|

19:29 muhoo: technomancy: fyi, nrepl.el on emacs22 https://www.refheap.com/paste/3825 doesn't like arrays.

19:29 Raynes: casion: FWIW, I wouldn't automatically expect anything that doesn't explicitly note a target audience of non-lispers to target lispers specifically.

19:30 muhoo: wiping my machine and reinstalling next week, then will upgrade to emacs24, and maybe nix this time.

19:30 Raynes: casion: Most Clojure programmers weren't Lispers to begin with.

19:30 casion: Raynes: good point

19:30 technomancy: muhoo: unsurprising

19:31 casion: I've stumbled into clojure with somewhat of a standoffish attitude

19:31 'this is nothing like C, I'm going to have a hard time' ... before I even got into it

19:31 Raynes: Oh, huh. I guess that guy keeps that tutorial updated.

19:31 casion: which I'm realizing right now :|

19:31 and obviously that's stupid

19:32 Raynes: Meh, you'll be fine.

19:32 You're a strong fellow.

19:32 muhoo: casion: i tend to fight new things tooth and nail, then, once i figure out their usefulness, i love them.

19:33 casion: muhoo: I"m the same way haha

19:33 eggsby: guys what is a command that should cause a large stacktrace in a repl? mine all seem to be getting cut off

19:33 muhoo: like, frinstance, i'm still running debian lemmy, with emacs22, and ion window manager :-)

19:34 casion: you'll be fine. i recommend clojure programming book

19:34 casion: muhoo: I moved to os x... where I use dwm

19:34 for which I am ridiculed often enough

19:34 muhoo: the orielly one

19:35 technomancy: dwm is badass

19:35 at least it is under X

19:35 casion: I can't live without dwm

19:35 eggsby: dwm... I use awesome

19:35 amalloy: eggsby: ((fn x [] (x)))

19:35 eggsby: awesome is by the author of dwm, right?

19:36 grr, a single line stacktrace amalloy :(

19:36 casion: is this o'reilly book well recommended around here?

19:36 emezeske: eggsby: After you get the single line, what if you do (pst)?

19:36 eggsby: https://www.refheap.com/paste/3845

19:37 unable to resolve symbol pst emezeske

19:37 emezeske: eggsby: what clojure version?

19:37 eggsby: I guess 1.2.1 according to the repl output

19:37 emezeske: eggsby: That's rather ancient, you probably want to upgrade to 1.4

19:37 eggsby: even tho my lein says 1.4

19:37 ToxicFrog: cacodaemon: I haven't read it myself, but O'Reilly generally does good stuff

19:37 emezeske: eggsby: Are you doing "lein repl" ?

19:37 eggsby: ya

19:38 my project.clj says *

19:38 technomancy: casion: I like it a lot

19:38 ToxicFrog: Er, casion: I haven't read it myself, but O'Reilly generally does good stuff.

19:38 null-: which book?

19:38 ToxicFrog: Also, going from C to Lisp with no intermediate HLL experience? That's going to be a fun head trip. Savour it. :)

19:39 null-: ToxicFrog: what's HLL?

19:39 ToxicFrog: High Level Language.

19:40 hyPiRion: I went from Java to Common Lisp. As long you've got an open mind, it's not a problem.

19:40 null-: ToxicFrog: wouldn't the most dramatic part be no functional programming experience?

19:40 muhoo: well, if you write c, then you've likely used bash, make, possibly python, depending on which build system you used.

19:41 ToxicFrog: hyPiRion: I wouldn't expect it to be a problem, it's just going to be a much more dramatic change than going from a HLL.

19:41 hyPiRion: ToxicFrog: Ah, I see. It's a very enjoyable ride :)

19:41 ToxicFrog: null-: this may be a bit snobby but personally I don't consider a language a HLL unless it at least supports things like first-class and higher-order functions, tail call elimination, and other "impure functional" features

19:42 hyPiRion: yeah, I approached it more gradually, going from C through Java, Perl, Python, Lua, Haskell and Scala on my way to Lisp, so it was much more gradual.

19:42 casion: I've worked in a large java project...

19:42 knowing nearly no java

19:43 somehow I ended up being the least incompetent though

19:43 eggsby: hm, hmm, I've never seen a stacktrace with a negative value for the line number of an error

19:43 null-: ToxicFrog: so you are a clojure fan now?

19:43 casion: a rather dangerous environment

19:43 muhoo: eggsby: paste?

19:44 hyPiRion: ToxicFrog: I think that's a great path, gives you a lot of insights in different paradigms.

19:44 eggsby: muhoo: https://www.refheap.com/paste/3846

19:45 hyPiRion: Those languages are used in production too, so why not?

19:45 hiredman: eggsby: you don't have the class for the oracle jdbc driver loaded

19:45 muhoo: i was whining in the #emacs channel about how much i hated dealing with java and php, and technomancy suggested i try clojure, and i've been hooked ever since.

19:46 casion: I'm only learning clojure because I realized it's getting to the point where at least having ssome basic functional programming knowledge is becoming very useful

19:46 technomancy: muhoo: haha; nice =)

19:46 ToxicFrog: null-: yes

19:46 null-: ToxicFrog: interesting route, haskell -> scala -> clojure

19:47 :)

19:47 eggsby: d'oh hiredman, I figured clojure.java.jdbc would find it on the classpath, dumb question but how do I load it?

19:47 ToxicFrog: null-: it does contain some aggravations but it is the only lisp that has really "clicked" with me; Scheme appeals to me more on paper but Clojure I actually do things with.

19:47 hiredman: (Class/forName "the-class-name")

19:47 ToxicFrog: (similarly, I love Haskell as a concept but somehow I always find myself reaching for Scala instead when I want to get my static typing on)

19:47 muhoo: Raynes: nice, refheap colorizes stacktraces

19:48 null-: ToxicFrog: cool

19:48 eggsby: same err hiredman

19:48 ToxicFrog: Also, having easily-"modified" immutable data structures as a core assumption is addictive.

19:48 eggsby: https://www.refheap.com/paste/3847

19:48 ToxicFrog: Lua is forever ruined for me now :/

19:48 null-: is there any Clojure book for no "functional" programmers?

19:49 Raynes: muhoo: No it doesn't.

19:49 muhoo: null-: again, i recommend the clojure programming book, o'reilly

19:49 Raynes: https://www.refheap.com/paste/3846 parts of it, seems like

19:49 Raynes: muhoo: That's purely coincidental because the Clojure lexer picks up those things.

19:49 null-: muhoo: thanks, I logged in after you mention it

19:49 Raynes: It isn't at all purposely.

19:51 hiredman: eggsby: pass in {:connection-uri "..."} instead of just the string

19:51 eggsby: i'll try hiredman

19:52 hiredman: passing in a string ultimately tries to find the classname based on the subprotocol, but jdbc doesn't have that mapping for oracle

19:52 seems lame to have it fail, if the classloading there was just removed it would work fine, because you already loaded the class

19:53 eggsby: well hiredman, at least that gives me a new err :p

19:54 hiredman: there should be a check, if it cannot map the subname to the class, don't try and load nil

19:54 eggsby: the connection-uri case might be missing the account params :/

19:54 eggsby: it says invalid oracle url, from the ojdbc driver

19:55 hiredman: it's oracle so who knows what that means

19:55 cemerick: hiredman: I think the connection-uri option went in because postgres requires credentials to be URL parameters

19:55 (along with other things, like ssl or not, etc)

19:56 jtoy: in vim clojure mode, how do I delete a a ( or ), when i hit x on it nothing happens

19:56 muhoo: cemerick: did you end up going with datomic or postgres for your project?

19:56 eggsby: jtoy: that's because there is content still inside the form

19:56 ibdknox: jtoy: da(

19:56 eggsby: type di( first if you want to delete inside the form

19:57 aperiodic: jtoy: <leader>S will strip the parens and leave the contents intact

19:57 cemerick: muhoo: Using postgres, though I'm taking a lot of inspiration from datomic.

19:57 jtoy: I have ((interests.sources/list_data :client client)) doing da( deletes the code too, i just want to remove the extra pair

19:57 cemerick: There's a lot to learn from voltdb as well, in general terms.

19:57 aperiodic: jtoy: <leader>S

19:59 jtoy: aperiodic: that worked, thanks

20:00 aperiodic: jtoy: you should read `:help paredit` when you have the time, so you can pick up on these sorts of things yourself

20:00 jtoy: aperiodic: i will reread, i tried reading it before and was very confused

20:00 probably because I'm still a clojure newb

20:01 muhoo: cemerick: i'm curious why. it seems you've had a lot of the db restlessness i've had, trying couchdb, then datomic, then settling on postgres. might make a good blog post if you feel up for one, or a chapter in a new book if you decide to go that route again.

20:01 cemerick: muhoo: I'm not sure I've been restless. Used couch for many years now. :-)

20:02 aperiodic: jtoy: most things in the paredit cheatsheet are also in paredit.vim, and it has much nicer presentation than the paredit help http://www.emacswiki.org/emacs/PareditCheatsheet

20:02 * Raynes takes endless streams of crap for using mongodb.

20:02 jtoy: aperiodic: pl

20:02 ok, thanks

20:02 aperiodic: jtoy: you're welcome

20:03 muhoo: cemerick: yes, i know, i've used clutch, and thanks for that. but still, i'd be very interested to hear why postgres got the win.

20:03 Raynes: but why? it's web scale.

20:04 Raynes: I didn't say I actually listened to any of it.

20:04 :p

20:04 It works for refheap and lazybot and hasn't ate me for dinner yet, so *shrug*.

20:07 muhoo: technomancy: will nrepl.el connect to this at some point? https://devcenter.heroku.com/articles/debugging-clojure

20:08 cemerick: muhoo: I probably would be using datomic now if it weren't so new.

20:08 And, my data model needs a little more wiggle room than its schemas readily allow, but I could have worked around it.

20:08 muhoo: cemerick: thanks, that's kind of what i guessed.

20:09 cemerick: muhoo: Not to be down on it at all; it's incredibly hot tech, and I was able to do a lot with it in a very short period of time in my experimentations.

20:09 I'm just a lot more conservative about databases.

20:10 And other things too, at least in contrast to my willingness to cut myself on programming languages. :-)

20:11 muhoo: makes sense, thanks

20:11 technomancy: muhoo: at some point, but writing an HTTP connector is still a fair bit of work

20:11 cemerick: There isn't a standard elisp http client?

20:11 technomancy: cemerick: sure there is, it just sounds like a fair bit of work to hook it into nrepl.el

20:11 cemerick: ah

20:11 technomancy: maybe not; I haven't looked into it enough

20:12 though it occurs to me it would probably be easier to just write an nrepl proxy

20:12 cemerick: that shouldn't be hard, right?

20:15 cemerick: technomancy: I wouldn't think so; but, nrepl.el should have a proper abstraction away from particular transports anyway. bencode and HTTP aren't going to be all there is.

20:17 technomancy: yeah, doing it in elisp would definitely be the Right Way

20:21 holo: hi

20:22 Raynes: cemerick: The elisp http client is Satan.

20:22 emezeske: holo: gooooooood evening!

20:22 technomancy: it wasn't bad when I used it to write a couchDB client

20:23 holo: emezeske, thanks for the warm greeting

20:24 connecting to a postgres db, i'm having the error "ERROR: syntax error at or near "user" Position:" using a connection uri like the one in http://tinyurl.com/d5jokze . the person using that uri claims it works on jdbc 0.2.3-SNAPSHOT. i'm using 0.2.3, but i get that error

20:25 the type of connection URI both used in that link and mine is like this: "jdbc:postgresql://ec2-22-11-231-117.compute-1.amazonaws.com:5432/d1kuttup5cbafl6?user=pcgoxvmssqabye&password=PFZXtxaLFhIX-nCA0Vi4UbJ6lH&ssl=true"

20:28 emezeske: holo: I can't help with postgres, but... you didn't just give us your password, did you?

20:31 cemerick: holo: Assuming that's a heroku postgres URL, and you're using java.jdbc, provide a map of {:connection-uri "that URL"} to with-connection. And, rotate your credentials. :-)

20:36 holo: emezeske, no, those are the credentials for the example on the link supplied ^^

20:36 cemerick, what do you mean by rotate?

20:36 cemerick: holo: like emezeske, I thought those were your actual database credentials.

20:36 emezeske: holo: Good deal. :)

20:42 holo: come on..

20:42 cemerick, oh, i understand now what you meant by "rotate"

20:43 cemerick, anyways, i did just like in the link... huh, i'm having still that parse error

20:44 cemerick: holo: can you paste your code somewhere?

20:47 holo: oh, sorry guys! i had appended "&sslfactory=org.postgresql.ssl.NonValidatingFactory"" , and that was making the error

20:47 cemerick, now i just have The connection attempt failed. - (class org.postgresql.util.PSQLException)

20:49 cemerick, this is what i have: (sql/with-connection {:connection-uri "jdbc:postgresql://ec2-23-23-237-0.compute-1.amazonaws.com:5432/xxxxxxxxx?user=yyyyyyyyyyy&password=zzzzzzzzzzzzzzzzzzzzzJ&ssl=true"}

20:52 "Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"

20:53 huh, i think it still needs the "&sslfactory=org.postgresql.ssl.NonValidatingFactory" but this produces a parse error

20:58 aphyr: Vaguely disturbing question...

20:58 What if I want to take a Map, and let it act as some other interface

20:58 Proxy, yeah?

20:58 Oh, wait, no, defrecords are open structs

20:59 HA

20:59 SAVED BY RICH HICKEYS FORESIGHT YET AGAIN

21:01 holo: ok, i'm trying to add the certificate somehow like this: http://code.naishe.in/2011/07/looks-like-article-no-more-unable-to.html

22:19 rbarraud: G'Day

23:37 mritz: ClassCastException java.lang.Class cannot be cast to protobuf.core.PersistentProtocolBufferMap$Def protobuf.core/protobuf-load (core.clj:54)

23:37 any idea what that is from?

23:38 aphyr: Looks like you passed a class to protobuf-load.

23:38 Got the source at :54?

23:40 mritz: (protobuf-load yo data)

23:40 yo is my protobuff class

23:40 data is from the file

23:41 aphyr: protobuf-load expects a (defprotobuf)

23:41 mritz: (def yo Ziften.report.Sweet$ScanReport)

23:41 aphyr: Nope.

23:42 mritz: hmm

23:42 this is my first day of closure

23:42 aphyr: (def yo (protodef Sweet$ScanReport))

23:42 from the example here: https://github.com/flatland/clojure-protobuf

23:42 mritz: thanks man, I've stared at that example for a long time today

23:43 no idea how I've been reading it wrong

23:45 well crap

23:45 IllegalArgumentException No matching method found: getDescriptor clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:53)

23:45 same line

23:46 jestinepaul: hey guys, I have raised a JIRA issue (JDBC-35) regarding the timezones returned from the ResultSet getter method.

23:46 http://dev.clojure.org/jira/browse/JDBC-35

23:48 aphyr: sorry mritz, I gotta go home. :/

23:49 mritz: aphyr: k, thanks for the help

23:50 jestinepaul: I have also attached a patch to the issue. It would be great if someone can take a look at it and suggest some ideas.

23:56 Raynes: mritz: Did you by chance open an issue on tryclj.com's github issue tracker a little while ago?

23:57 mritz: Raynes: nope, but I think I found the issue. an old IRC long said that option optimize_for = LITE_RUNTIME; is the culprit.. I'm trying that now

23:58 unfortunately the coder scattered that line in 400 different messages so I'm throwing a script together to rip them out

Logging service provided by n01se.net