#clojure log - Jun 19 2012

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

0:00 tvladeck: uvtc: so using `(require 'foo.core :reload)` will reload any new functions that you have written in the namespace?

0:00 emezeske: tvladeck: Just realized this machine doesn't have a clj dev env setup, so I can't help :(

0:00 tvladeck: b/c i have been exiting and restarting the repl each time

0:01 uvtc: tvladeck, Yes. Reloads the whole core.clj file.

0:01 tvladeck: uvtc: well, if nothing else, that's a huge win

0:01 emezeske: uvtc, tvladeck: I actually find running the repl outside of vim to be much better

0:01 SrPx: hmm

0:01 uvtc: tvladeck, Oh, yeah. The repl that comes with lein 2 is so nice.

0:01 SrPx: dnolen: but how did you search it? google?

0:02 dnolen: I can never find useful papers on google

0:02 tvladeck: uvtc, emezeske: thanks! i will quit hitting my head against the wall now

0:02 uvtc: tvladeck, :)

0:07 dork_: what is the best startup environment for a begginer?

0:07 uvtc: dork_: If you're on GNU/Linux, maybe have a look at http://www.unexpected-vortices.com/clojure/brief-beginners-guide/index.html .

0:08 muhoo: in ring/noir, what's the right way to throw an exception with a particular HTML status code? i.e. to throw a 4xx exeption so that noir will catch it with a particular error page?

0:08 uvtc: dork_, see also http://dev.clojure.org/display/doc/Getting+Started

0:08 ~getting-started

0:08 clojurebot: It's greek to me.

0:08 technomancy: muhoo: I don't know anything about noir, but that sounds like a job for slingshot

0:09 antares_: dork_: IDEs like IDEA or Eclipse/Counterclockwise also provide REPL so if that is your kind of thing, it's good for beginners, too

0:09 technomancy: slingshot plus a ring middleware I guess; would make a nice combo if it doesn't exist yet

0:09 dork_: use whatever you already know

0:09 antares_: dork_: for tinkering with one liners, http://tryclj.com

0:09 muhoo: thanks, i see friend uses slingshot, wasn't sure how exactly it works, will read up on it

0:09 SrPx: god how I see this article

0:09 I freaking have U$3

0:09 but I can't pay

0:09 on the internet, damn

0:09 dork_: Just looking for something beyond the repl and not the emacs plugin/server setup

0:10 muhoo: it's got throw+ and catch+ all over the place

0:10 antares_: muhoo: I don't think there is a middleware that passes control via exceptions

0:10 dork_: uvtc: thanks most tutorials were a bit dated but the first reccomendation seems to hit the mark

0:11 brehaut: dork_: if it doesnt start with 'go to leiningen and start with its tutorial' you are probably being sent down a garden path

0:11 uvtc: uvtc, y/w. (I wrote that one. :) )

0:11 technomancy: brehaut: is that bad? gardens are usually nice.

0:12 brehaut: hmm

0:12 being sent to a blasted apocolyptic wasteland?

0:12 uvtc: brehaut, It does start with "go get lein". Have a look, and let me know if you see anything you think could use improvement. :)

0:12 technomancy: maybe a rabbit trail or a wild goose chase

0:12 muhoo: snipe hunt

0:12 brehaut: uvtc: it has a cat, thats a good start

0:14 muhoo: this is interesting. ring appears to be purely functional, noir uses mutation of dynamic vars, and friend passes exceptions around with slingshot :-/

0:14 uvtc: brehaut, Oh, I do need to update it for lein 2.0.0-preview6 and OpenJDK 7 though.

0:14 muhoo: i have a nice casserole here

0:15 mixing all 3

0:15 brehaut: uvtc: you have avoided all the major pitfalls of many previous getting started guides. good work

0:15 technomancy: muhoo: strongly suggest sticking with the functional approach

0:15 uvtc: brehaut, thanks :)

0:16 muhoo: technomancy: good idea. my sanity is a thin enough reed already

0:16 technomancy: muhoo: I think exceptions could be put to good use for things like detecting unauthorized access, but I haven't tried it myself yet.

0:17 uvtc: thanks for getting the emacs docs moved over to github

0:17 so much nicer to be able to edit in emacs now instead of that silly confluence rich-text nonsense

0:18 uvtc: technomancy, y/w! I like how you've eliminated duplication by pointing users directly to the swank-clojure readme if they want to set up Emacs+Swank+Slime.

0:19 technomancy: oh yeah, we could still use some help fleshing out the docs for OSes other than Debian/Ubuntu if anyone wants to do some documentationoring: https://github.com/technomancy/clojure-mode/tree/master/doc

0:19 uvtc: technomancy, the new getting+started+with+emacs page looks nice and clean. Though, I'm guessing someone will probably want to go through those comments on that page and see if anything should be merged into the swank-clojure readme/docs.

0:24 ~getting-started is <reply> Maybe have a look at http://dev.clojure.org/display/doc/Getting+Started .

0:24 clojurebot: In Ordnung

0:24 technomancy: uvtc: I don't have permission to delete comments. I asked someone from core to do it and they refused =(

0:27 uvtc: technomancy, Perhaps once someone goes through the comments there and can show that the swank-clojure readme/docs have incorporated anything that needs to be incorporated, the comments can then be deleted. I'm not up for that though, since I just use the delightful repl that comes with lein 2. :)

0:29 technomancy: I don't have a lot of patience when it comes to trying to get core to do things. I've found it more productive to focus on things that I can control on your own.

0:29 which is why I'm wondering why I didn't move the docs to github sooner =)

0:31 uvtc: technomancy, I suppose you didn't move them sooner because you didn't want to go deleting wiki content wholesale. I can understand that, because people get attached to wiki content they've written, and you probably didn't want to step on any toes.

0:31 technomancy: actually most of the stuff on the wiki page was either me or Raynes =)

0:32 all the other content never made it past the comments

0:33 uvtc: Incidentally, I just mailed in my signed CA today to get access to edit the wiki. What is the process by which a bill becomes a law ... wait. No, the process by which a wiki page comment becomes wiki page content?

0:33 Or is there no process? Perhaps it just happens by osmosis when no one's looking? :)

0:33 technomancy: I think you just have to make noise on the mailing list

0:34 provided you've filed your form in triplicate

0:34 plus you need to be sure you have a 27B-6: http://www.youtube.com/watch?v=eosrujtjJHA

0:35 uvtc: You can't make a move without a 27B stroke 6.

0:36 Personally though, I came into this game for the action, the excitement. Go anywhere, travel light, get in, get out, wherever there's trouble, a man alone.

0:36 technomancy: You're a good man to have in a tight corner.

0:37 uvtc: We're all in it together.

0:38 technomancy: whoa, someone actually made one: http://www.suberic.net/~dmm/27B-6.pdf

0:41 uvtc: Must be a real stickly for paperwork.

0:41 Agh. s/stickly/stickler/

0:41 muhoo: now this is a weird one. (require 'nsname :reload) is not causing the ns to actually reload

0:41 'twas working fine a few days ago, last i used it

0:43 and :reload-all does nothing, just returns

0:44 oic, if the file didn't change, it ignores it

0:44 :reload doesn't mean :force-reload i guess

0:50 Raynes: technomancy: I don't think I'm legally able to edit those pages anymore though.

0:51 brehaut: technomancy: even without having seen brazil i was able to guess that it was from there. thats quite astounding

0:51 Raynes: technomancy: I signed my CA as Simpson, but later decided on Grimes. I've been told I need to sign another CA, but blah.

0:51 technomancy: Raynes: but your intellectual properights!

0:51 brehaut: <3 gilliam

0:52 brehaut: he does good stuff

1:04 sergey: hey there

1:04 how can I check how many certain characters does the string contain?

1:09 uvtc: ,(count (filter #(= % \a) "fooaaba"))

1:09 clojurebot: 3

1:09 sergey: uvtc, cool, thanks

1:10 technomancy: ,(count #{\a \b} "fooaba")

1:10 clojurebot: #<CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: core$count, compiling:(NO_SOURCE_PATH:0)>

1:10 technomancy: oops

1:10 uvtc: Oh, right.

1:10 ,(count (filter #{\a} "fooaaba"))

1:10 clojurebot: 3

1:11 uvtc: thanks, technomancy.

1:12 brehaut: ,(.length (.replaceAll "fooaaba" "[^a]" ""))

1:12 clojurebot: 3

1:13 brehaut: (for a slower, more oblique way)

1:19 SrPx: About macros, are they limited to the (macro-name stuff) syntax, or can I set something like, every "a.b" means "(foo a b)" from here?

1:20 brehaut: SrPx they work on s-expressions

1:20 so you have to have at least (macro-name …) as a wrapping form at some level

1:21 SrPx: so the best I can do is "every (. a b) means (foo a b)"?

1:21 brehaut: you can reinterpret the symbols inside the sexp however you wish

1:21 SrPx: which is not very syntax-changing at all

1:21 brehaut: so in a way macros are just a way of resorting whats inside the () ?

1:22 brehaut: yes

1:22 if you want to trivialise it that way

1:22 a macro is a function that takes a s-expression and returns an s-expression, and that function is run at compile time not run time

1:22 SrPx: brehaut: great definition

1:23 brehaut: thats all* they are (*caveat: details differ)

1:23 uvtc: brehaut, Wait. The macro does its rearranging of s-exp's at compile-time, but the resulting s-expr's execute at runtime with all the rest of the code, correct?

1:24 brehaut: uvtc: it really depends what the macro does

1:24 uvtc: you can make a macro that does everythign at compile time if you wish

1:24 and just results in a value

1:24 uvtc: brehaut, thanks.

1:24 brehaut: but if it produces something like a function, or an expression that is within another function that is executed at runtime, then yes, it will be at runtime too

1:25 uvtc: an example of lots of compile time macro trickery is the algo.monads library, which uses a library i have forgotten the name of to remove runtime indirection at compile time

1:26 SrPx: the limitation to working only on s-expressions makes macros more powerful rather than less. it allows much easier composition of macro created languages than a pure text to text macro language does, and it simplifies the implementation of the macro considerably

1:27 its still possible to make incompatible macros, but at least it controls the scope of their application

1:27 SrPx: however, its fairly idiomatic in clojure to make macros as surgical and small as possible and stick to functions whereever possible

1:30 SrPx: brehaut okay... thanks !

1:48 rdsr: What's the best approach to proceed if I have to convert from one json object (a tree?) to another json object

1:54 zipper / walk?

1:59 uvtc: rdsr, I haven't used it yet, but have you looked into https://github.com/clojure/data.json ?

1:59 (part of contrib)

2:01 rdsr: @uvtc, Yes I'm using that library, But the problem I need to solve is how do I convert from a nested json structure (obtained from json-read) to another deeply nested structure.

2:01 amalloy: rdsr: json-read returns a normal clojure data structure. just do whatever transformations you want on that, and then convert back to json; the fact that it's json at both ends has no bearing on what you need to do in the middle

2:03 rdsr: @amalloy, yes I understand that. I was just wondering what's a good approch to it.

2:04 one naive way is to just have a list of key paths mappings from one structure to the other and keep the target structure through reduce and update-in etc...

2:04 amalloy: well, at that point your question is "how do i transform a data structure into another data structure?" - there's no substance there for anyone to speculate on. the most relevant thing i can say is "use a function"

2:06 unless you have a more specific kind of transformation in mind

2:07 rdsr: @amalloy, nothing specific, it's just that the structure are very deeply nested, and I have to have to write down the keys manually for my naive approach. Sorry about not being clear before

2:08 s/have/hate

3:08 miclorb: anyone know how I can set a system property with lein (so that the app that it launches has the property set?)

3:19 ro_st: i've got (route/resources "/") and a resources folder with a public folder inside it in my project, but any request to a file inside public instead serves my 404 handler. how do i determine what i've done wrong?

3:28 is it possible to deploy an uberjar that reads static files from outside the uberjar?

3:28 i ask because i have two git projects, one for the clj backend, and one for the gclosure js frontend app, and i'd like to deploy each to the server independently of each other

3:29 otherwise i'll have to always rebuild the backend whenever deploying the front end

3:29 which is not ideal

4:06 _ulises: for all of you emacs users, do you use clojure-test-mode or do you run tests from a shell?

4:06 ro_st: i use lein2 midje —lazytest from a shell

4:07 _ulises: I was interested in the integration so that you could jump to the test that's broken ... I used clojure-test-mode about 1yr ago and it was fine but I don't know if it'd work with midje, etc.

4:08 I suppose I'm actually asking what's the best way to integrate midje and emacs?

4:09 scottj: _ulises: I don't think very many people use clojure-test-mode. I think midje has its own emacs stuff.

4:09 ro_st: there's a midje-mode minor mode for emacs

4:09 https://github.com/marick/Midje/wiki/Midje-mode

4:09 _ulises: ah, great, that's what I actually wanted to know :D

4:09 ro_st: i haven't done enough midje-fu to want to install this, yet

4:09 but i'll get there

4:09 gtuckerkellogg: i use both clojure-test-mode and midje mode. They work fine side by side

4:10 ro_st: midje-mode looks great

4:10 _ulises: great stuff!

4:12 kay__: what a weird channel

4:15 ro_st: argh. i'm struggling with ring's (route/resources "/"). i have that and route/not-found defined. folder resources, in there, folder public. in there, index.html. localhost:8080/index.html triggers the not-found. what could i be doing wrong?

4:16 sorry, not ring's route/resources; compojure's route/resources

4:18 typical. had to reboot the repl

4:28 anyone using ring.util.serve know how i can see stracktraces?

4:29 server is working when using lein2 ring server but not when using ring.util.serve

4:56 michaelr`: why do I get javax.net.ssl.SSLPeerUnverifiedException: peer not

4:56 authenticated when trying when clj-http.client/get GETs something

4:56 from http://graph.facebook.com? I'm trying to run this clojure project: https://github.com/metadaddy-sfdc/facebook-template-clojure

8:31 joshua__: $findfn ["one" "two"] "one two"

8:31 lazybot: []

8:31 joshua__: $findfn ["one" "two"] " " "one two"

8:31 lazybot: []

8:31 joshua__: msg lazybot " " ["one" "two"] "one two"

8:32 ohpauleez: joshua__: You want join

8:32 http://clojuredocs.org/clojure_core/clojure.string/join

8:33 joshua__: ohpauleez, thanks

8:33 ohpauleez: np

8:33 xiefei: ;(str "one" "two")

8:34 ohpauleez: &(str "one" "two")

8:34 lazybot: ⇒ "onetwo"

8:34 ohpauleez: xiefei: ^

8:35 xiefei: :)

8:40 archaic: how do I coerce a 2-d float array into a 2-d double array?

8:42 clgv: $findfn "one" "two" "one two"

8:42 lazybot: [clojure.core/print-str]

8:43 clgv: $findfn " " ["one" "two"] "one two"

8:43 lazybot: [clojure.string/join]

8:46 gfredericks: $findfn 1 1 2

8:46 lazybot: [clojure.core/+ clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-add-int clojure.core/bit-shift-left]

8:52 gfredericks: &(->> (range) (drop 1) (take 2) (map (partial clojure.pprint/cl-format nil "~r")) (clojure.string/join " "))

8:52 lazybot: ⇒ "one two"

8:57 clgv: why?

8:57 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

9:30 TimMc: archaic: ##(double-array (float-array [1 2]))

9:30 lazybot: ⇒ #<double[] [D@193209a>

9:31 clgv: TimMc: thats not 2d but the function to use ^^

9:32 TimMc: Oh! Right.

9:32 clgv: ,(doc into-array)

9:32 clojurebot: "([aseq] [type aseq]); Returns an array with components set to the values in aseq. The array's component type is type if provided, or the type of the first value in aseq if present, or Object. All values in aseq must be compatible with the component type. Class objects for the primitive types can be obtained using, e.g., Integer/TYPE."

9:33 clgv: (into-array (map double-array float-2d)) should do the trick

9:36 ro_st: i'm struggling with an issue with ring and post-data.

9:37 when i manually invoke my ring handler in the repl with a string-input-stream, i get nice data in my compojure handler. when i actually post via http, :body is set to #<HttpInput org.eclipse.jetty.server.HttpInput@523e0f04>, and the middleware which parses the json comes up nil

9:37 the middleware in question is wrap-json-params from https://github.com/ngrunwald/ring-middleware-format

9:38 clgv: ro_st: maybe that wrap-json-params middleware is at a position too early in the chain

9:40 xeqi: ro_st: is the content type set correctly?

9:42 AWizzArd: I noticed a strange bug. When I import some specific classes from JavaFX 2.2 I can not compile an Überjar with Leiningen. I get an NPE from a JFX class. So I wonder what import is doing to trigger the execution of some code.

9:43 I thought mostly import is doing something like: (def Label javafx.scene.control.Label)

9:43 Chiron_: Hi all, would you please have a look at: http://pastie.org/4114497

9:43 appreciate your time

9:44 cshell: YOu're keying by hour/date?

9:45 Chiron_: bad idea :) isn't ?

9:45 it is only what I'm thinking right now

9:46 ro_st: xeqi: good catch. it's going out as x-www-form-urlencoded. sodding xhr.

9:46 Chiron_: I need to collect analytics data , hour and date are vital parts

9:46 nDuff: Chiron_: YYYY-MM-DD has the advantage that it's ASCII sortable; when you tack HHHH on in front, you discard that advantage.

9:47 cshell: what if they collide?

9:47 oh, you're aggregating anyway

9:48 nDuff: Chiron_: ...putting the hour on the end would preserve sortability without needing to write your own comparison function.

9:48 cshell: why don't you just make hour and date each a key value pair inside the object?

9:49 AWizzArd: The import macro expands into import* whose definition I can not find.

9:49 Chiron_: cshell: would you please provide me with a sketch of your design?

9:51 nDuff: AWizzArd: it's defined in clojure.lang.Compiler, which is Java.

9:52 cshell: Chiron_: I don't know the exact syntax, but something like http://pastie.org/4114534

9:52 clgv: AWizzArd: it's a compiler expression

9:52 cshell: Chiron_ without the second hour and date

9:52 Chiron_: so something like http://pastie.org/4114542

9:54 then you can do analytics based off the discrete hours

9:55 Chiron_: trying to digest

9:58 what if I need a new 'log-entry' for the hour 13 ? I'm batching by 250 requests. a batch may start at 12:57 and completes its 250 at 13:10 so I need different log-entries

9:59 ro_st: weird. i'm setting a Content-Type header on my xhr to 'application/json', but i don't see it on the outgoing request in the Network panel. also, the outgoing request is OPTIONS instead of POST

9:59 huh?!

10:00 ohpauleez: ro_st: in CLJS?

10:00 ro_st: from 'traditional' gclosure, using goog.net.XhrIo

10:00 target is clojure ring service, though

10:00 cshell: Chiron_: if you're batching by requests then the ones before 13 would go in 12 and the ones in 13 would be 13

10:01 ohpauleez: Just send it standard

10:01 use pr-str to turn your clojure data into a string

10:01 and then on the server do a safe read

10:01 ro_st: it's json data going up

10:01 not clojure data

10:02 i'm actually trying to suss why wrap-json-params isn't working on the server side

10:02 ohpauleez: Is it in ClojureScript or straight JavaScript?

10:02 ro_st: straight js

10:02 ohpauleez: there's your problem right there :)

10:02 Chiron_: cshell: yes I know in you snippet you hard coded "log-entry" . I'm only thinking how to make the data structure dynamic (adding new log-entry for hour 13)

10:02 ro_st: -cry-

10:02 Chiron_: maybe I'm not expressing myself :)

10:04 cshell: Chrron: it's basically a map, right? so { "hour" (cur-hour) "date" (cur-date) "view" { "blog-1" 1 "blog-2" 1} "search" { "blog-1" 1}}

10:05 you could create one of those for every request and then merge them in to another map where the keys hour and date match - then you can aggregate/count

10:05 xeqi: ro_st: are you doing something like http://www.googleclosure.com/google-closure-ajax/ ?

10:08 ro_st: xeqi: yes

10:08 precis

10:08 with the content-type in, i get this weirdness:

10:09 http://rationalist.co.za/uploads/Screen%20Shot%202012-06-19%20at%204.08.50%20PM-D92cCfHW9R.PNG (sorry for horrid url)

10:10 without, i get a POST with 200 OK, but the wrap-json-params middleware doesn't parse out the json

10:10 i literally copy and paste the json from chrome's network panel into my repl in a manual ring request and it works

10:11 right now, just trying to determine where i've performed idiocy; on client or on server

10:11 ohpauleez: trust me, i would LOVE to drop gclosure and use cljs right now, but this app has to go out

10:12 xeqi: ro_st: you're running up against the same origin policy

10:12 if I'm reading it right

10:12 ro_st: nope. i have middleware that fixes that already

10:13 lemme do a refheap of the differences in the request data in clojure between a web request and manually in the repl

10:13 ohpauleez: ro_st: My guess is that the client is nor forming the headers correctly

10:14 You should look at the headers going out, either with browser inspection tools, or fire up wireshark

10:14 ro_st: i'm using Charles

10:14 ohpauleez: Are the headers correct?

10:15 ro_st: which mirrors what chrome shows: a 404 OPTIONS request

10:15 ohpauleez: So it looks like Closure isn't even making the request correctly

10:15 ro_st: let me get this refheap done. it's the real problem i'm trying to deal with, anyway

10:19 Chiron_: cshell: will think how to implement that with atom

10:19 xeqi: ro_st: same origin policy is client side, how can you fix that with middleware?

10:20 ro_st: by adding a header: https://www.refheap.com/paste/3229

10:20 that lets me hit webserver 2 (:8080) from webserver 1 (:3000)

10:22 so this is the situation: https://www.refheap.com/paste/3230

10:22 i'm probably doing something really daft

10:23 xeqi: ro_st: for CORS it looks the server has to respond with whats allowed on the OPTION request

10:24 https://developer.mozilla.org/en/http_access_control

10:24 see Preflight request

10:24 ro_st: :o

10:24 i would never have found this in a bazillion years

10:24 you beauty

10:25 so i need to also add headers that specify -Methods and -Headers

10:26 and because currently i don't have any routing set up for OPTIONS, i get a 404, which is precisely right

10:27 so i'll need to add an OPTIONS route for each distinct POST, PUT, DELETE uri i create which returns these headers

10:27 (this is the part where you say, don't bother, just use ring-unicorns-with-rainbows, find it on clojars)

10:42 hmm. i only need this for development mode. so if i can get wrap-json-params to work even if it's 'application/x-www-form-urlencoded', that'll do

10:46 xeqi: ro_st: change the predicate you're passing

10:46 to (constantly true) or something better

10:47 matteop: i all . Is there a incanter programmer to ask a question ?

10:47 TimMc: You'll never know until you ask your question. :-P

10:49 matteop: right . I want to draw a image with the incanter library, use scatter plot or similar, where i must draw several retangle on it . Now i try to use add-polygon function , but draw only the line . I must have colorated retangle on it

10:49 suggest ?

10:49 ro_st: xeqi: i copied the src for wrap-json-params out into my own server file and altered the internal predicate to allow x-www-form-urlencoded as well as json

10:49 it works now

10:50 -phew-

10:51 thanks for the help

10:58 clgv: matteop: you can have a look at the JFreeChart API and the corresponding examples of howto build a rectangular annotation that is colored. incanter uses org.jfree.chart.annotations.XYPolygonAnnotation

10:58 matteop: thanks

11:19 joshua__: $findfn [1 2 3] 1 [2 3]

11:19 lazybot: [clojure.core/nthrest clojure.core/subvec clojure.core/nthnext]

11:23 joshua__: ,(.indexOf (list 1 2 3 1 2 3) 3 2)

11:23 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: indexOf for class clojure.lang.PersistentList>

11:27 joshua__: hmm I guess I can do (+ start (.indexOf (drop start (list ...) find_me))) .. I feel like this is something that probably already exists in core though

11:28 locojay: hi is there a good lib for sparse vectors in clojure or just i just go with mahout RandomAccessSparseVector

11:28 bhenry: ibdknox: ping.

11:39 clgv: locojay: depends what you want to do with it. in certain settings a map can be used

11:40 locojay: but probably you want some kind of efficient multiplication?

11:56 blcooley: 10:54 *** Eldariof-ru QUIT Ping timeout: 264 seconds

12:10 edoloughlin: I want to generate args to a function from a (for) but it's not destructuring them properly: http://pastebin.com/ni4ZkY7s — any ideas?

12:11 (some editing required in that pastebin - I didn't use clojure.data.xml/emit)

12:12 * nDuff fires up a text-based browser (pastebin.com being full of obnoxious ads)

12:12 TimMc: nDuff: Adblock?

12:12 I don't know how people do without.

12:12 nDuff: TimMc: Interferes with my ability to see sites the same way my customers do, which has been a problem in the past.

12:12 TimMc: nDuff: Eep.

12:13 Good thing I don't have customers. But it's something to keep in mind when sending links to relatives.

12:13 * nDuff hugs gist.github.com

12:13 TimMc: edoloughlin: Missing an apply?

12:13 edoloughlin: oh...

12:14 TimMc: nDuff: Isn't there some extension that replaces ad images with kittens?

12:14 edoloughlin: Is that really what's wrong - should I apply (element) to what (for) returns? I'm not sure how (element) will behave then - the examples have multiple args...

12:15 nDuff: TimMc: Doesn't help much when one's employer is responsible for some of the kittens.

12:15 TimMc: haha

12:15 zach_: Is there currently a way to declare a specific build of clojurescript to use as the compiler in lein-cljsbuild?

12:15 edoloughlin: TimMc: ok. I get it. Thanks.

12:15 TimMc: edoloughlin: Yeah, (apply element :e ...)

12:27 oskarth: in clojurescript, is there supposed to be a difference between (. something) and (.something)? (there is in my compiled cljs)

12:28 ohpauleez: oskarth: You should use the (.method obj) form

12:28 oskarth: ohpauleez: yeah I noticed, but I thought (. qqqq) was eqv like with java interop

12:31 ohpauleez: any idea why that is? that in java both forms are ok but with js only the (. x). Is it by design?

12:33 TimMc: oskarth: JS "methods" are actually functions, so foo.bar is as valid as foo.bar().

12:34 CLJS had to be rejiggered to allow a distinction between property access and method calls.

12:34 ohpauleez: it is by design, the (. ) call is legacy. To get around the fact that JS has first class functions (.method ) and (.-method) was introduced

12:34 oskarth: ah I see

12:34 ohpauleez: the latter gets the method as a property, but that meant that the . call had to be removed

12:34 oskarth: thank you

12:34 ohpauleez: np

12:50 jimi_hendrix: so i want to use a lib that isnt in the repo that lein pulls deps from. do i just compile it to a jar and plop it into myproject/lib?

12:50 solussd: what does everybody use as a protocol naming convention? I've been using simply the name with an uppercase first letter and no prefixes/suffixes.

12:52 dnolen: solussd: depends but IFoo is common.

12:52 joegallo: jimi_hendrix: don't do that, leiningen can be told about other repositories. tell it about the right one. if this is some strange library that doesn't publish into a maven repo, you can install it into your local maven repo using mvn. leiningen treats lib as a directory that it has total control over, so you really don't want to drop random things in there.

12:53 joshua__: $findfn {"me" "you"} "this is me me" "this is you you"

12:53 lazybot: []

12:53 jimi_hendrix: joegallo, i see. the lib is music-as-data, which afaik, is in no maven repo so i will make a local one

12:56 joegallo: if you git checkout, i think you can probably "lein deps, install" and then it will just be available for you.

12:56 didn't realize it was a clojure library that you were talking about

13:04 metajack: clj-http seems to return a string instead of something like a byte array for binary content. Is there a way to get the latter? calling .getBytes on the string does seem to get me the raw data.

13:05 zach_: Can someone give me a short walkthrough on "requiring" libraries within a browser-connected cljs repl?

13:05 dakrone: metajack: pass {:as :byte-array} as opts to the request

13:05 metajack: and then clj-http won't coerce the output to a string

13:05 metajack: dakrone: thanks!

13:11 dnolen: zach_: from what I understand it triggers a compile and eval.

13:12 zach_: dnolen: Well I'm not even able to do it at the moment. (I'm working in your cljs-demo project.)

13:14 jimi_hendrix: joegallo, well i installed it via lein and it is now in my project, but i cant seem to import anything. for example, the lib defines the namespace music-as-data.mad, and if i do (require 'music-as-data.mad) in the swank repl for my project, i get a ClassNotFoundException

13:14 dnolen: zach_: to do what?

13:14 zach_: dnolen: I found something on SO that suggested using something along the lines of (ns test.domina (:require [domina :as d]))

13:14 dnolen: zach_: I wouldn't use cljs-demo, it's likely out of date.

13:14 adu: does clojure have something like scribble?

13:14 dnolen: adu: no

13:14 zach_: dnolen: I'd just like access to domina from within the repl

13:15 dnolen: zach_: and domina is specified in your project.clj?

13:15 zach_: Yes

13:15 dnolen: zach_: what version of lein-cljsbuid?

13:16 zach_: I'm still in cljs-demo, so 0.1.6

13:16 dnolen: zach_: might not work.

13:16 zach_: just start from scratch using the latest lein-cljsbuild.

13:16 zach_: dnolen: Yeah, good idea

13:17 dnolen: zach_: I wouldn't mess with the browser REPL bit until you have a JS program that runs at the command line.

13:18 zach_: once that's working include browser REPL in your ns, write the connect expr - lein trampoline lein-cljsbuild repl-listen. See how that goes.

13:18 zach_: dnolen: yeah, you're right

13:19 dnolen: thanks for suggestions

13:19 dnolen: zach_: I could be very wrong BTW, it may not be able possible to require libs dynamically at the REPL. That's not something I've really tried before.

13:20 zach_: dnolen: If that's the case, it seems like a bit of a deficiency, and something else to work on, no?

13:22 dnolen: zach_: yes, would be nice for interactive development.

13:26 jweiss: i know eval should generally be avoided. but i would really like to use vector literals where some of the items eval to the same thing each time (like, kw, string, int etc), and other items give a different value each time the list is "used". i am using a no-arg function that returns a list. But I could just use `[(System/currentTimeMillis) 2 3] and get the value each time with eval.

13:26 zach_: dnolen: When you say JS program that runs at the command line, do you mean a program that can be compiled and run with rhino, for instance?

13:27 dnolen: Or just generally being able to serve your cljs on a page?

13:27 nDuff: jweiss: Wouldn't it make more sense for the items that vary to return callables?

13:27 dnolen: zach_: Rhino, V8, JavaScriptCore, SpiderMonkey etc :)

13:27 zach_: dnolen: Awesome, cool :)

13:27 jweiss: nDuff: i could, but then the code that reads the list has to check what type each item is.

13:28 and also, i already have 1500 functions in my codebase, and it's going to get a lot bigger.

13:28 nDuff: jweiss: Yup. That's a lot more explicit and less surprising than making a normally-immutable data structure be mutable.

13:28 jweiss: ...if the problem is that that code happens in lots of places, well, encapsulate it in a function.

13:29 jweiss: nDuff: ok, how would i do that :)

13:29 nDuff: jweiss: ...but if it looks like a normal vector index reference, it's not going to help comprehendability / maintainability if it doesn't _act_ that way.

13:29 jweiss: ...well, that depends. :)

13:29 jweiss: without having 1500 anonymous no-arg functions

13:30 nDuff: (err, why would there be any anonymous functions involved at all?)

13:30 (except for the ones living within the vector, of course)

13:30 jweiss: (def data [(fn [] [(System/currentTimeMillis) 2 4]) (fn [] ... ) etc)

13:30 yeah, i have 1500 of those.

13:31 nDuff: How's this a problem?

13:31 jweiss: well, it's ugly, and it takes a long time to compile.

13:32 nDuff: You have one vector. It's immutible, and instantiated only once. It has a bunch of little anonymous functions, which are instantiated only once.

13:32 jweiss: granted, eval still has to compile at runtime

13:32 nDuff: *nod*. Things always have to be compiled _somewhere_.

13:32 ...what's the history behind wanting these to live in a vector, anyhow?

13:33 Opcodes for an emulator, or such?

13:33 jweiss: nDuff: they don't need to be in a vector, any seq is fine

13:33 nDuff: it's data for data driven testing

13:33 the reason it needs to vary each time is so i can re-run the test without name collisions in the (stateful) app under test.

13:34 nDuff: Ahh. Lots of flexibility there, then -- you could build that up with a minilanguage, for that matter, if you wanted to do something less ugly.

13:35 S11001001: jweiss: you could automatically factor out the like-structured expressions to a shared set of functions

13:35 HOFs are also useful for reducing lambda count

13:35 nDuff: *nod*.

13:36 jweiss: S11001001: mostly all i need are timestamped strings insstead of constant strings.

13:36 * jweiss tries to figure out how HOF would help

13:37 S11001001: jweiss: as a specific example, cl-format produces a tree of closures (that were written literally in clojure.pprint) calling each other to produce the output described in the string specifier

13:38 jweiss: oh god, please don't use that as an example, i would really love to know how the hell that works, but I couldn't figure it out

13:38 i was trying to write a custom pprint format for days and never got it working

13:38 the only docs are for CL

13:38 S11001001: that's a totally different area than how the implementation is structured

13:39 it's an imposition of CL; CL requires a currying version of format

13:39 so, let's take the expression [[(blah) 4 2] [8 4 (blah)]]

13:41 you can figure out at compile-time which subexpressions aren't pure, and extract them to lambdas

13:41 nDuff: ...though, if the (blah) are going to mostly be timestamp references, well, just put the timestamp in a dynamic var -- *blah* -- and bind it before each use.

13:41 S11001001: like {:some-gensym (fn [] (blah))}, and [[((:some-gensym x)) 4 2] [8 4 ((:some-gensym x))]]

13:42 or you could drop the shared table of lambdas in a wrapping `let' and reference them directly

13:44 jweiss: S11001001: sounds like a lot of effort - [[{:x (blah) :y 2} 4 2]]

13:44 wouldn't i have to traverse the entire structure to find function calls?

13:44 S11001001: yes

13:45 as for HOFs, while I can't make specific recommendations not knowing your code, they do frequently replace lambdas. #(f x y %) is (partial f x y); #(vector (f %1) (g %1)) is (juxt f g); and of course #(f (g %)) is (comp f g)

13:45 nDuff: ...but the compiler is traversing the entire structure anyhow

13:45 jweiss: sounds bug prone to me

13:45 S11001001: and you're proposing using eval

13:45 nDuff: :)

13:45 jweiss: well, i know eval is not ideal either :) was hoping for a clear-cut winner, but i guess that wasn't realistic :)

13:45 S11001001: partial and comp alone are enough to avoid an incredible amount of lambdas

13:47 jweiss: S11001001: that is not going to help me, the data rows are literals. in the cases where i can generate rows with a function, i already do.

13:47 xeqi: point-free style can get ugly quickly

13:47 S11001001: jweiss: and traversing structures isn't that hard; if you're willing to go non-functional, you can use prewalk-replace from clojure.walk

13:47 xeqi: false dichotomy

13:48 Scriptor: using lein-cljsbuild to compile essentially one line of code

13:48 jweiss: S11001001: what do you mean non-functional?

13:48 TimMc: xeqi: If taken too far, yeah.

13:48 Scriptor: (one line of cljs code, excluding the ns declaration)

13:49 and somehow the output is 5k lines, even with advanced optimizations

13:49 even though I'm only using alert, not touching any closure libs

13:49 S11001001: jweiss: collecting expressions to a shared table requires state monad, or using an equivalent mutable, while traversing. I suppose you could also use a zipper...

13:50 TimMc: $inc zippers

13:50 lazybot: ⇒ 1

13:50 Scriptor: is this normal behavior or is there something I need to do to completely remove all the extra code?

13:50 duck11231: Scriptor: at least all that other junk is more or less a constant overhead. (it's not 5K per line)

13:50 S11001001: Scriptor: yes, it's normal

13:51 Scriptor: duck11231: right

13:51 jweiss: S11001001: ok i think I see what you are saying - wouldn't I have to traverse twice - once to lambda-ify expressions, and again when I need to get the value (to call all the lambdas)?

13:51 S11001001: jweiss: if you can't express your structure as Clojure code, and write this into a macro, then yes

13:52 Scriptor: hmm, isn't google closure supposed to optimize out code that isn't used, or does js/alert really use all that?

13:52 duck11231: If you turn off the advanced compiliation, you'll see that it's all the other cljs code that has to be included the first time

13:52 jweiss: S11001001: each test has a different structure for the data

13:52 S11001001: doesn't matter

13:52 Scriptor: yea, I tried it with whitespace earlier and it was up to 18k lines

13:53 jweiss: S11001001: then i'm not sure what structure you mean

13:53 Scriptor: still seems like a lot

13:53 S11001001: [1 2 3] can be expressed as the clojure expression that will yield the vector containing the integers 1, 2, and 3. Are your structures like this?

13:54 jweiss: S11001001: yes, wouldn't any vector be like that?

13:54 S11001001: indeed

13:55 so you can perform the above example replacement at compile time

13:55 solussd: is there a format function in clojurescript, somewhere?

13:55 *for

13:56 jweiss: S11001001: you mean by writing it as a macro, and then at runtime traversing again to calculate the 'delayed' values?

13:56 S11001001: not quite

13:56 you end up with the (->) a monad, which you run by giving the functions and values you want to use to "complete" the expression

13:57 jweiss: hm. maybe this is when i finally start understanding monads :)

13:57 brainproxy: using enlive.. doing something like (h/set-attr :myattr ...)

13:57 S11001001: (fn [x] [(x) 2 3]) is a "a -> b" monadic value, where a is a zero-arg function that produces a value the monadic value uses to "complete" the vector b it produces as a result

13:57 brainproxy: but I'd like the value I'm setting to be built up from the old value and some new information

13:58 how I can I refer to the current value of :myattr

13:58 S11001001: that is, *every* function that does this transformation for a given a (which is the map of functions in our earlier example), has the monadic type "a ->", that is, without the b, because each gives a different result

13:58 * jweiss still processing that

13:59 S11001001: so, (fn [x] [(x) 2 3]) is a vector, but in the context (provided by the monad that wraps it) of all possible "x"s

13:59 jweiss: i should probably go read about monads and come back and read that again

13:59 S11001001: have fun

13:59 TimMc: No, that way lies madness.

14:01 jweiss: S11001001: thanks for the pointers, hopefully i'll be back :)

14:13 adu: omg, ring-core is awesome

14:15 weavejester: adu: Out of curiosity, what parts did you like about it?

14:15 jweiss: i suppose i should have asked, what exactly are the pitfalls for using eval?

14:15 no compile time checking, ok, doubt that matters for my purposes

14:15 adu: I was just looking through the stores (MemoryStore, CookieStore) and was astounded at how clean the implementation was

14:16 weavejester: jweiss: It's slower and *usually* not necessary, but there are exceptions

14:16 ohpauleez: jweiss: It's kind of a sloppy, dangerous to use with untrusted sources, and there are generally better solutions

14:16 jweiss: heh, yeah, monads.

14:16 * adu <3 monads

14:16 ohpauleez: adu: weavejester, I agree, the code is exceptionally clean, clear, and a nice read

14:17 weavejester: adu, ohpauleez: That's encouraging :)

14:17 adu: I'm getting sick and tired of genshi and django

14:18 ohpauleez: I personally don't like monads. I don't think they offer significant advantages over other things. But that's the great thing about Clojure - Choose your own abstraction

14:18 adu: so right now I'm looking for a webapp backend, and I really only have 2 requirements: must have existing json/mustache libs

14:18 and clojure fits the bill

14:18 ohpauleez: adu: If you're going to use mustache, take a seriously look at enlive

14:19 jweiss: so I have a list [(System/currentTimeMillis) 2 3] that i want to re-evaluate several times. seems like eval is a quick and easy solution

14:19 ohpauleez: decoupling structure and data, and applying data declaratively to your structure is a powerful approach

14:19 nDuff: jweiss: Why not bind a dynamic var to the current time before each test invocation?

14:20 jweiss: nDuff: because i am running multiple threads

14:20 adu: ohpauleez: are you talking about me?

14:20 ohpauleez: yes

14:20 nDuff: jweiss: ...each test has multiple threads, or you're running different tests in different threads?

14:21 jweiss: i mean, it's still unlikely to collide i guess, but right now i use a function that produces sequential stamps when i need more than one

14:21 adu: ohpauleez: oh, why thank you, I didn't realize it was what I was trying to do :)

14:21 jweiss: nDuff: different tests in different threads

14:21 nDuff: jweiss: then a dynamic var is _perfect_; their bindings are thread-local.

14:21 (err, non-root bindings)

14:21 jweiss: nDuff: so? it can still be bound to the exact same timestamp.

14:22 nDuff: jweiss: ...and you expect to get uniqueness the way you're doing it now?

14:22 ieure: jweiss, When testing this kind of code, I've found that it's often helpful to pass a function which returns a timestamp, rather than passing time values themselves around.

14:22 nDuff: jweiss: if you want a guarantee, use an agent to populate your binding and have it increment a counter.

14:22 jweiss: ieure: that's what i'm doing :)

14:23 ieure: jweiss, Okay; hard to tell what you're doing without more context.

14:23 jweiss: nDuff: a var just doesn't solve my problem.

14:23 ieure: jweiss, Maybe you could gist your code

14:23 jweiss: if i have a literal vector that refers to a var, as soon as it's compiled, the timestamp is fixed forever.

14:23 rebinding is too late.

14:23 nDuff: jweiss: ...that may be true, you haven't given enough information to compel that conclusion.

14:23 jweiss: not if you put the symbol in the vector.

14:24 s/true, you/true, but you/

14:24 jweiss: nDuff: ok then i have to traverse looking for symbols

14:24 * nDuff sighs.

14:24 adu: ohpauleez: the github page says it has no support for xml namespaces

14:24 enlive, that is

14:25 nDuff: jweiss: s/the symbol in the vector/a reference to the Var itself in the vector/ -- in that case, resolution is automatic, annoyingly so at times.

14:25 ohpauleez: It sounded like your were just using content/json and substitutions

14:25 nDuff: jweiss: ...anyhow: It can be done. I've done it without wanting to, and it annoyed me. :)

14:25 ohpauleez: are you serving up xml?

14:25 adu: ^

14:26 adu: well, mostly no, but I do have some custom xml and svg templates

14:26 jweiss: nDuff: ok, i believe you, it's just not clear to me what the vector would be, and then how would i say "ok vector, give me a new value".

14:26 adu: curently in django form

14:26 ohpauleez: aahh, gotcha

14:27 adu: most of the templates are html

14:27 duck11231: for serving xml, hiccup and {:xmlns ""} works fine. for parsing namespaced xml, i ended up using xml-picker-seq

14:28 adu: i see

14:29 hiccup sounds pretty cool

14:30 * nDuff tries to reproduce (when this happened, he was introspecting clojure Var$Frame objects)

14:31 jweiss: nDuff, i am guessing you mean (def ^:dynamic x nil) (defn thisvec [] [x 2 3]) (binding [x 7] (thisvec))

14:32 nDuff: jweiss: No -- what I was doing when I ran into the behavior in question was... err... considerably more interesting.

14:32 jweiss: nDuff: oh, well if you can give me an example that'd be awesome :)

14:32 * nDuff is trying to reproduce it without Doing Evil.

14:33 jweiss: or Doing Eval?

14:33 nDuff: Two spellings, same thing. :)

14:33 (walking a structure and explicitly dereffing vars, though, _is_ at least less evil than eval)

14:35 ...yar, looks like an explicit deref is called for.

14:35 *sigh*.

14:35 jweiss: aside from security and slowness, (which I honestly don't care about - this is testware, not production, and 99% of my program's time is spent waiting for the app under test)

14:36 eval is also bad for other reasons?

14:36 i mean if it was significantly harder to reason about, that'd put me off it

14:38 TimMc: jweiss: If you built it with eval, how hard would it be to change the data structures to support tree-walking?

14:38 (Ignoring the difficulty of changing the code that uses the data structures.)

14:39 jweiss: TimMc: not that hard, an hour of editing probably

14:39 or less

14:39 TimMc: Yeah, go with eval and leave a big ol' explanation. :-P

14:39 And ASCII art of McCarthy frowning.

14:39 jimi_hendrix: is there a way to print all namespaces my repl can presently see?

14:40 TimMc: &loaded-libs

14:40 lazybot: ⇒ #<core$loaded_libs clojure.core$loaded_libs@dca5f4>

14:40 TimMc: &(loaded-libs)

14:40 lazybot: ⇒ #{cd-client.core cheshire.core cheshire.factory cheshire.generate cheshire.parse clj-config.core clj-http.client clj-http.cookies clj-http.core clj-http.util clj-time.core clj-time.format clojail.core clojail.jvm clojail.testers clojure.contrib.zip-filter clojur... https://www.refheap.com/paste/3236

14:41 jimi_hendrix: well that answers why i cant access a namespace

14:41 jweiss: TimMc: hehe, i'm just trying to get a feel for brick walls i might hit before i head off in any direction. i can see eval would end up recompiling a lot of stuff needlessly. not sure that'd affect perf

14:47 duck11231: jimi_hendrix: If you're using slime: C-c M-p [tab]

14:48 jimi_hendrix: alright, that double confirms it

14:51 so if i have a jar in my lib dir and it is listed as a dep in my project.clj, why isnt it showing up when i run lein swank?

14:51 duck11231: you need to require it first

14:51 the loaded libs are user and the ones needed by swank so far

14:53 jimi_hendrix: duck11231, i tried that, but it cant find it

14:54 duck11231: I like to keeps something like "(do (require 'foo.core) (in-ns 'foo.core))" in my history for quick access.

14:54 are you launching lein swank from the project dir?

14:55 you could try "lein classpath" or "lein deps :tree" (2.x) to confirm it's there

14:55 technomancy: duck11231: (doto 'foo.core require in-ns)

14:55 jimi_hendrix: duck11231, yeah, i was launching swank from the project dir

14:56 duck11231: Nowadays, I just have my server launch my swank connection so that my repl is all ready to use

14:56 jimi_hendrix: and the jar is in my classpath

14:57 jtoy: normally in a clojure project include other libs, if i need to modify the lib, how do i then install that lib into my project?

14:58 raek: jtoy: change the name, group and version in its project.clj and run lein install

14:59 for example, change [foo "1.2.3"] into [org.clojars.jtoy/foo "1.2.3-fix1"]

14:59 ohpauleez: jtoy: You can clone the project's repo, make your changes, push, and release the jar to your personal group on clojars. Or do what raek said

14:59 raek: and then depend on that in the other project

14:59 ohpauleez: If you just need to add to it, you can just add to that namespace in your project

14:59 jtoy: ok, which method do you guys do in general?

15:00 raek: though if you use lein install, it will only work for you (but it can be useful to try it thay way before you push to clojars)

15:00 ~repeatability

15:00 clojurebot: repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability

15:00 raek: also, see that

15:01 in essence, avoid "free floating jars". put it in a repo and things gets simpler

15:01 duck11231: and if you're hacking on that sub lib a lot, symlink it to {projectdir}/checkouts/{sublibname}

15:01 that way you don't have to install after every change

15:02 again, bad for repeatability, good for ease of development

15:07 jtoy: lein install downloads a milion different files

15:08 duck11231: You've obviously never deleted your ~/.m2 then ran mvn site

15:08 great way to kill 45 minutes

15:09 jtoy: i did lein install, do i put the jar into classes of the parent project?

15:10 oskarth: how do you pass in a java fn and its arguments into a clojure function and call that java function with those (variable amount of) arguments?

15:10 duck11231: you need to put the project's information into your project's dependencies then run a lein command (most will fetch the dep) or lein deps to be certain

15:10 gfredericks: oskarth: instance method or static method?

15:11 oskarth: gfredericks: instance method

15:11 gfredericks: oskarth: do you have the instance up front or is that supplied later?

15:11 oskarth: gfredericks: up front, it's a global

15:11 dnolen: so constraint lookup and purging from constraint store is looking pretty zippy ...

15:12 jtoy: duck11231: ok, i see that, but how does it know where to grab the file from? i am testing it locally for now, not with clojars

15:12 gfredericks: oskarth: I'm not sure what you mean by "pass ... into a clojure function"

15:13 duck11231: jtoy: when you installed it, it put it in the appropriate directory in ~/.m2/ that's where lein looks

15:14 jtoy: duck11231: oh, i didn't realize that what install does, i saw it created a big had too in the subproject's directory

15:14 oskarth: gfredericks: I want to intern something like (fn [& args] (. global args))

15:15 gfredericks: &(doc memfn)

15:15 lazybot: ⇒ "Macro ([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."

15:15 gfredericks: oskarth: I think you can use that ^

15:15 oskarth: gfredericks: ok nice, will check it out, thanks!

15:16 gfredericks: oskarth: wait maybe not

15:16 I give up

15:16 oskarth: alright, thanks anyway

15:16 gfredericks: as a last resort you can use reflection

15:16 or eval :)

15:18 oskarth: is this a java method with java-varargs?

15:18 oskarth: gfredericks: we are looping through a bunch of methods that have diff amounts of arguments

15:19 ynniv: has anyone used java.jdbc with tomcat's context resources?

15:19 it appears that java.jdbc has no way of operating on an existing connection object

15:29 uvtc: Watched the talk by cemerick on what sucks ... and why you'll love it anyway. I think he did a good job. Definitely didn't come across as any sort of a rant.

15:30 No deal-breakers in there.

15:30 For Clojure, I mean.

15:30 ohpauleez: yeah, I enjoyed that talk a lot

15:30 cemerick: did anyone think it was a rant?

15:31 uvtc: No, but in the beginning of the talk you mentioned something about not wanting it to come across that way,

15:31 and I was saying that I think you succeeded.

15:31 cemerick: ah, thanks :-)

15:31 Funny that the talk came out the same day that fogus blogged about "why I don't use _____" posts.

15:32 uvtc: Oh, didn't see that on rss yet.

15:33 cemerick, I wasn't sure what to make of your slide about "big ball of mud". I think the gist of it is: "Don't go overboard". :)

15:34 cemerick: uvtc: I still have it running in the background, not to that point yet. I honestly don't remember that slide. :-)

15:35 uvtc: It's the one where you show your (camel->keyword) fn.

15:35 "pile of yarn" (great pic, btw :) )

15:35 uraimo: are the videos of clojure west available somewhere?

15:36 uvtc: uraimo, my understanding is that they come out little-by-little, and we'll see them on planet clojure as they become available.

15:36 uraimo: ah ok, thanks

15:37 uvtc: cemerick, Oooh, also, you pronounce 2 words funny: leiningen and chasm. ;)

15:37 ynniv: ah, sql/with-connection can take { :name "java:comp/env/jdbc/database" }

15:37 cemerick: Yeah, I've always pronounced 'Leiningen' wrong. :-P

15:38 I think both variants of 'chasm' are acceptable. ;-)

15:38 uvtc: I can excuse "chasm", because of your first name. :)

15:38 edoloughlin1: ,(clojure.data.xml/emit-str "")

15:38 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.data.xml>

15:39 xeqi: uraimo: http://clojurewest.org/news/2012/5/11/clojurewest-video-schedule.html

15:40 uraimo: thanks xeqi

15:47 cshell_w: cemerick: I was able to get friend working with noir and a new workflow - very simple now that I understand the whole stack

15:48 cemerick: sweet :-)

15:50 cshell_w: definitely make some noise when you publish it

15:50 * cemerick needs to get on the ball re: a comprehensive friend demo app

15:51 kmicu: cemerick: ... in clojurescript one ;)

15:51 cemerick: heh

15:52 kmicu: probably not, but you can :-)

15:54 dnolen: kmicu: I recall seeing your frustrations about getting CLJS1 working with CLJS 1236, still running into those problems?

15:54 kmicu: cemerick: I can't even update it to recent clojurescript :], I'll wait for source maps support in cljs and after that I do it.

15:56 dnolen: kmicu: heh, I suspect source maps will alleviate debugging - it won't solve it out the door. not without a lot of patches anyway.

15:56 kmicu: dnolen: I took a little break, too much javascript debugging. Now I recreating cljs1 with new deps.

16:07 dnolen: btw where can I find what has changed in http://mvnrepository.com/artifact/org.clojure/google-closure-library/0.0-1376 ? ;)

16:13 dnolen: kmicu: no idea

16:13 kmicu: pretty sure there's a google group fro GClosure, would ask there.

16:21 gtrak: &#java.net.URL["http://localhost:3030/dataset/query"]

16:21 lazybot: ⇒ #<URL http://localhost:3030/dataset/query>

16:22 gtrak: why does that work, but if I try to compile it it gives me an error, "can't embed object in code"?

16:22 S11001001: gtrak: because AOT is strange, but the message is not a bug

16:23 gtrak: S11001001: not AOT, slime

16:23 S11001001: C-c C-l or C-c C-k?

16:25 gtrak: k

16:28 S11001001: try l

16:29 gtrak: S11001001: yea, same deal, "Can't embed object in code, maybe print-dup not defined: http://localhost:3030/dataset/query"

16:30 S11001001: maybe define that method then

16:32 ,(type print-dup)

16:32 clojurebot: clojure.lang.MultiFn

16:39 gtrak: S11001001: I think I can get around it anyway, just want to understand!

16:42 kmicu: dnolen: "This non-official distribution was prepared by the ClojureScript team", but no problem, only asking ;)

16:43 dnolen: kmicu: hmm? we're using released versions of GClosure Lib and & Compiler

16:43 S11001001: gtrak: #-syntax happens at read-time, so the compiler literally sees a URL in the source

16:43 gtrak: it's not at all just a shortcut for calling the constructor

16:43 it's *calling* the constructor before compiling

16:43 you can't stick arbitrary java objects in class files

16:44 so

16:44 ,(doc print-dup)

16:44 clojurebot: "; "

16:44 S11001001: oh come on

16:44 there's a CL equivalent, hold on

16:44 that is actually documented

16:45 brooksbp: I wrote some clojure to read a file line-by-line and use regex to build an ir of the syntax in the file... but using a global function and refs to build the ir as we process lines

16:45 is there a better way to do this?

16:46 S11001001: ,(doc line-seq) -- brooksbp

16:46 clojurebot: "([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."

16:46 S11001001: ,(doc reduce) ; brooksbp

16:46 clojurebot: "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val i...

16:47 technomancy: clojurebot: java.util.concurrent is "When I find myself in times of trouble / Prof. Doug Lea comes to me / Coding lines of wisdom / j.u.c."

16:47 clojurebot: 'Sea, mhuise.

16:47 kmicu: dnolen: but unfortunately cljs1 project uses it :). Can you do in the future, one open streaming with KitchenTC ? ;) Maybe only 1 free hour :)

16:47 S11001001: gtrak: http://www.lispworks.com/documentation/HyperSpec/Body/f_mk_ld_.htm#make-load-form

16:47 brooksbp: yeah I'm doing a line-seq and processing the thing line-by-line... (process-line line)... process-line mutates a global ref... the thing is littered with regex to turn syntax into an IR... then that IR is stored in the global ref

16:48 amalloy: brooksbp: he linked reduce too, for a reason :P

16:48 brooksbp: how are they related?

16:48 S11001001: brooksbp: f = process-line, make it conform

16:48 val = initial state

16:49 amalloy: (reduce (fn [ir line] (...new ir from line...)) (line-seq file))

16:50 mfex: technomancy: re: leiningen 2.0 and clojars repo: why not have the repos explicitly in project.clj rather than built into leiningen?

16:50 brooksbp: amalloy, what's the point of doing it that way?

16:51 amalloy: "process-line mutates a global ref... the thing is littered with regex to turn syntax into an IR... then that IR is stored in the global ref"

16:51 all of those are exactly what reduce avoids

16:54 S11001001: reduce is pointless if you're the maintainer of CPython; otherwise, it can be pretty useful

16:54 cemerick: Has anyone yet put together an alternative to test.generative's defspec that plays nicely with clojure.test?

16:54 brooksbp: I think I see how to use reduce and process-line here

16:54 this is just to avoid using a global ref, right?

16:54 S11001001: "just"?

16:55 brooksbp: ?

16:55 S11001001: it's a pretty major benefit

16:55 brooksbp: sorry, clojure is blowing my mind. I am probably missing something that you're hinting at

16:56 why do you say reduce is pointless if you're from python?

16:56 S11001001: the version with reduce is thread-safe, can have delayed calculations trivially, can use parallelism internally safely, is a function so can be composed with other processes...

16:57 I don't, guido doesn't get reduce

16:58 uvtc: brooksbp, functional programming is not one of Python's focuses ... (foci?).

16:58 S11001001: you can't mess up by leaving a partial state around or forgetting to initialize the state...

16:58 etc etc

17:00 brooksbp: by thread-safe... do you mean something like... call reduce with a function f that spawns a new thread ?

17:01 thus it can be parallelized... multiple calls to f at once

17:01 S11001001: you can use your parser in multiple threads

17:02 and, if one step of your parser wants to use a new parser (say, for an include) with its own state, it can, without messing around

17:03 since you only have a linear fold at this point, you can pull out the state-free portions of the computation and turn them into a map, giving clearer separation of concerns

17:03 brooksbp: I still don't follow... isn't that the point of immutable state rather than something special reduce provides?

17:03 S11001001: which opens up further parallelization possibilities on its own

17:03 yes

17:05 brooksbp: and when you chip away at python... you're saying that it's possible to mutate global state in the function f when you're reduce'ing... thus boo python...?

17:05 but it's okay for clojure because of refs & stm...?

17:07 S11001001: no, it's bad for both

17:07 I'm talking about guido, not python

17:08 guido doesn't get reduce, tail calls, or hell, lambda

17:08 sucks for pythonistas that they can't have nice things

17:11 brooksbp: why is it bad to mutate a ref while reduce'ing?

17:12 are you worried about the contention?

17:14 S11001001: it's needless use of a mutable state feature

17:15 nDuff: brooksbp: ...I'm coming into this without full context, but the big thing that gets me there is side effects; it means what you're doing is no longer pure and can't be reasoned about (either by you _or_ by the compiler) in isolation.

17:15 gtrak: S11001001: thanks for the explanation, there are few places where you have to think about the fact that your NS compiles to a static initializer, I guess that's one of them! So I guess that's what reader literals are all about?

17:17 emezeske: brooksbp: The reasons to avoid refs and mutation in general are not at all clojure-specific

17:17 brooksbp: You should read about the rationale for functional programming as a whole

17:17 brooksbp: This is an interesting read: http://web.mac.com/ben_moseley/frp/paper-v1_01.pdf

17:18 gtrak: clojure gives you more high-level tools than python without losing java perf

17:19 I was sad about jython sucking, now I am not sad

17:19 technomancy: gtrak: the former jython lead comes to seajure =)

17:19 gtrak: yea, he's on ironpython now right?

17:20 technomancy: no, he's full-time clojure

17:20 brehaut: technomancy: is that also the ironpython guy?

17:20 gtrak: awesome!

17:20 brehaut: oh

17:20 technomancy: he may be the prior prior jython guy

17:20 gtrak: still awesome

17:20 mfex: technomancy: repost: re: leiningen 2.0 and clojars repo: why not have the repos explicitly in project.clj rather than built into leiningen?

17:21 technomancy: mfex: I think in most cases it would just be redundant

17:21 I want the defaults to make sense

17:21 brehaut: the ironpython/jython guy was jim hugunin?

17:21 technomancy: mfex: in 2.0 final if you want the old repo you can certainly ask for it

17:21 but out of the box you'll get central and clojars-releases

17:21 mfex: technomancy: wouldn't that make the clojars free-for-all vs clojars strict orthogonal to the release version?

17:21 technomancy: brehaut: Brian Zimmer is the guy I know

17:22 mfex: it would, but it's a hassle for everyone

17:22 brooksbp: nDuff, emezeske, thanks

17:24 uvtc: At one point I thought someone was working on an updated version of clojars.org. Has there been any movement on that?

17:24 technomancy: uvtc: functionally or visually?

17:24 mfex: my thinking was add the standard two repo's with lein new in project.clj, be explicit about changing to clojars strict or the other way around (similar to ubuntu repos)

17:25 uvtc: It would be nice if a given clojars page rendered the project's readme.

17:25 and included the project's github page (or wherever it's hosted)

17:25 S11001001: gtrak: pretty much, just more abstractly

17:25 technomancy: uvtc: it includes a link if the project specifies it

17:26 uvtc: Right. Right, it does. Actually, now I remember discussing this with you (I think). I'd asked about if there were a way to get more github links up there.

17:26 technomancy: mfex: I'm optimistic that we can populate the releases repo in order to reduce breakage of existing projects as they update. if there's a lot of pushback from maintainers then I may reconsider it.

17:26 uvtc: Leiningen will yell at you now if you try to deploy without specifying a URL =)

17:27 xeqi: uvtc: I've been working on it for a couple months, focusing more recently on hte https deploy stuff

17:27 uvtc: technomancy, xeqi : that's great. Thanks. :)

17:27 Ideally, it would be wonderful to see autodocs (or other docs) for a given lib up on clojars.

17:27 technomancy: yeah the http deploy stuff is key

17:27 uvtc: clojuredocs.org used to support third-party libraries

17:28 if that could be resurrected it would be great to link to there from clojars

17:28 uvtc: Like how Perl's CPAN (er, search.cpan.org) automatically displays perldocs for all uploaded modules.

17:29 mfex: technomancy: one time effort of explicitly defining repos per project means that this issue cannot come up anymore, although that is on project deployers rather than lib maintainers, but the deployers can be forced into this issue/be notified by new leiningen

17:30 uvtc: Maybe even beat Python's Cheeseshop to that one, since they don't yet have that functionality (auto display of a module's docs).

17:30 :)

17:30 technomancy: uvtc: there's a lot we can learn from cpan I think =)

17:30 they even do automated testing, which luckily we can delegate to travis

17:30 brehaut: and lets not look to pythons packaging for ideas ;P

17:30 uvtc: technomancy, Yes, I agree.

17:30 brehaut, Yes, I agree.

17:30 gtrak: oh god, virtualenv and ilk were messy

17:31 brehaut: woeful

17:31 and sadly, not past tense

17:32 uvtc: One thing I think cpan gets very right is rendering perldocs for everything. It shouldn't be too hard to get clojars to look for a doc dir containing .md files and --- if it finds them --- render them to html and host them.

17:32 gtrak: but this is also why I don't understand why people use a linux distro's pre-packaged java-libs/clojure stuff when we have maven

17:32 brehaut: haha oh man, specifying .md files is going to anger some people ;)

17:33 technomancy: uvtc: I dunno; I think autogenerated docs give a false sense of "there I documented it"

17:33 uvtc: brehaut, Could be any recognizable format. As long as they could be extracted and formatted as html automatically.

17:33 technomancy: oh, actually a pile of .md files is much more likely to be useful than stuff generated from .clj files

17:33 borkdude: gtrak I don't understand either: it turns out you always want a slightly different version anyway

17:33 technomancy: uvtc: I think the main problem is there's no consensus

17:34 uvtc: technomancy, I prefer the pile of .md files (or .html files, or .tex files, or whatever) myself.

17:34 brehaut: theres not even a consensus on autodoc tools

17:34 uvtc: How about this: if your project contains an html directory at the top level, and it contains .html files, clojars will host them?

17:36 technomancy: uvtc: I guess the question at the root of this is why don't people write documentation?

17:36 xeqi: uhh, security?

17:36 ~guards

17:36 clojurebot: SEIZE HIM!

17:36 gtrak: borkdude: worst case I have ever seen is the packaged eclipse on ubuntu ~3 years ago

17:37 uvtc: technomancy, I wrote up some reasons why I think that is: http://www.unexpected-vortices.com/sw/gouda/rationale-and-benefits.html

17:37 hiredman: you know, apparently haskell has a parser that can parse code blocks out of latex

17:37 uvtc: (Actually, regarding having projects supply html ... that's no good. No one checks in html --- they usually write in some other source format.)

17:38 technomancy: uvtc: sounds like you need to team up with sjl and bring clojuredocs out of the mothballs =)

17:38 `lein pushdocs`

17:38 uvtc: Push docs to clojuredocs.org or clojars.org?

17:38 xeqi: its unlikely clojars will host docs anytime soon

17:38 its an artifact based repo, not a source one

17:38 dakrone: technomancy: I have an email out to Tom Faulhaber about using autodoc for clojuredocs extraction, but he never responded :(

17:38 uvtc: Last I heard, clojuredocs.org was going to get rewritten in Clojure...

17:39 dakrone: doing extraction for 3rd party stuff is pretty easy, it's all the weird clojure-core extraction that really sucks

17:39 technomancy: dakrone: yeah, the autodoc implementation has to do some crazy gymnastics in order to be able to be used on clojure itself; I'm not sure it's appropriate for arbitrary projects

17:40 borkdude: one n00b question: why can I rebind *out* in clojure 1.3, while it is not declared dynamic - exception for clojure.core things maybe?

17:40 dakrone: technomancy: yea, I just don't want to have to write a billion special-casing methods for everything, and the clojure-core stuff is definitely the most important

17:40 technomancy: right; uniformity is good

17:41 dakrone: anyone know Tom personally? bug him for me.

17:41 uvtc: technomancy, perhaps a start would be to have `lein new` create a doc dir in new projects.

17:41 technomancy: dakrone: maybe it's best to use HTML as the lowest-common-denominator and have the HTML generation done client-side by maintainers?

17:41 uvtc: I approve of this notion!

17:41 S11001001: ,(bean #'*out*)

17:41 technomancy: is the jvm's markdown rendering lib any good?

17:41 clojurebot: {:rawRoot #<OutputStreamWriter java.io.OutputStreamWriter@1eb70ea3>, :class clojure.lang.Var, :watches {}, :dynamic true, :public true, ...}

17:42 technomancy: I've been spoiled by github-flavoured markdown with its excellent syntax highlighting

17:42 borkdude: S11001001 hmm

17:42 dakrone: technomancy: that's possible, but definitely sucks for any kind of API, which is what I'd like to do for clojuredocs, start with an API and have the web part just a consumer of it

17:42 borkdude: S11001001 I tried this: (-> (meta #'*out*) :dynamic)

17:42 ,(-> (meta #'*out*) :dynamic)

17:42 clojurebot: nil

17:42 technomancy: dakrone: oh, you mean for non-browser user agents?

17:42 uvtc: For markdown processing, I find Pandoc to be excellent. http://johnmacfarlane.net/pandoc/

17:43 dakrone: technomancy: I just mean, have a clojuredocs 'core' that serves up json/clj/etc, make that available, then have clojuredocs.org just use the API in a fashionable way

17:43 technomancy: uvtc: something that can be fully-JVM-hosted is going to offer a much better experience

17:44 dakrone: much better than the tacked-on API it currently has

17:44 uvtc: technomancy, right --- for now, just create the doc dir, and leave it to users to take the cue and put some docs in there. Then, hopefully soon, we can take the next step of (1) converting to html (maybe have the user do this manually at first), and (2) upload to clojuredocs somewhere.

17:44 technomancy: what's the current state of in-jvm syntax highlighting? didn't brehaut have something for that?

17:44 brehaut: technomancy: nope, mines all javascript/clientside

17:45 xeqi: if you guys build somewhere that does this hosting let me know

17:45 dakrone: uvtc: I was hoping to do part of #2 with https://github.com/dakrone/lein-clojuredocs

17:45 technomancy: this looks brilliant, but it's all python-centric: http://read-the-docs.readthedocs.org/en/latest/getting_started.html

17:45 brehaut: technomancy: though i did see someone talking about the lossless reader again recently

17:46 technomancy: brehaut: cgrand is cooking something up

17:46 brehaut: ah of course

17:46 uvtc: dakrone, have not yet looked at that. Will do so, but need to run in a few minutes.

17:47 dakrone: uvtc: cool, help appreciated

17:48 uvtc: technomancy, I still don't really understand what readthedocs does. The Cheeseshop lets you upload html docs for modules listed there.

17:48 brehaut: technomancy: it'd be really straight forward to write a nice syntax highlighter ontop of the lossless reader though. the majority of my brush is a crappy lossless reader imp

17:50 uvtc: Gah. Gotta go.

17:50 brehaut: i have mixed opinions about sphinx docs. they seem to too easily become really squirrelly

17:52 borkdude: S11001001 where is *out* actually set to System/out?

17:55 technomancy: brehaut: haven't used it. what's the issue?

17:55 the pile-o-markdown has worked fine for lein, but mostly because we rely on ```clj blocks that github provides

17:55 it's not standard markdown

17:56 brehaut: technomancy: ive mostly used it as a consumer; it seems to cause people to write docs that are very poorly structured and hard to navigate

17:57 i suspect because the writer doesnt have to consider the document as a whole

17:57 borkdude: S11001001 ah found it.. . https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L173

17:57 brehaut: technomancy: vs a pile of markdown where its generally a much simpler structure and the author has thoguht about how it fits together a bit more

17:58 technomancy: brehaut: yeah, as a bunch of independent guides it works great

17:58 S11001001: borkdude: cool, go look at Var now :)

17:58 technomancy: I haven't written any serial documentation that needed to be broken up into multiple pages

17:59 clojure needs someone to come up with a solid canonical "here is how maintainers should document" tutorial and get that integrated with the tooling; maybe we can rope uvtc into that =)

17:59 brehaut: technomancy: i think the size of most clojure projects means that serial documention fits that. its much harder to build a squiggly mess like django, so we dont need to write a gigantic pile of document

17:59 borkdude: ,(.isDynamic #'*out*)

17:59 clojurebot: true

18:00 technomancy: brehaut: yeah, that helps a lot

18:01 brehaut: technomancy: re:jvm markdowns, i dont think you can safely mix and match markdown imps :(

18:01 even aside from the nicities of github flavoured markdown

18:01 technomancy: I wonder if we could handle ```clj blocks with a lossless reader and then delegate the rest to markdownj

18:02 brehaut: technomancy: a markdown impl should ignore any HTML in the document, so if we implemented ``` as a preprocessor, it shouldnt be too hard

18:04 technomancy: brehaut: feel like giving it a go?

18:04 =)

18:04 brehaut: technomancy: not this week :/

18:05 technomancy: maybe I should start a thread

18:05 brehaut: might be a good idea

18:30 uvtc: (backlogging) brehaut: I also find Sphinx docs difficult to navigate. That may just be due to the default style though. Not sure.

18:30 brehaut: uvtc: its not just the default style. the django project uses it extensively, and its frequently a rabbit warren

18:31 hiredman: I tempted to try literate programming, but I don't want to be one of "those guys"

18:31 uvtc: brehaut, I find that you get better structure in general with a pile of doc source files (.md, for example) than you do with, say, a wiki.

18:31 technomancy: dakrone: clojuredocs right now is focused around an API reference; have you thought at all about whether it would be appropriate for prose documentation?

18:32 dakrone: technomancy: haven't thought about it, would be interesting to think about

18:32 uvtc: dakrone, do you run clojuredocs.org?

18:33 technomancy: uvtc: how would you feel about porting gouda to a leiningen plugin with markdownj? =)

18:33 brehaut: uvtc: im a big pile of md files guy too

18:34 uvtc: technomancy, I'm still learning Clojure, but that sounds like a cool idea.

18:34 brehaut, Nice!

18:36 brehaut: uvtc: in reality though, my projects are generally small enough that the result is small pile of md :P

18:36 uvtc: brehaut, One .md file is fine. It's a great way to get docs started. Authors can provide a brief readme, then direct the user to docs/index.md for more complete info.

18:37 Er, actually, the preference here seems to be s/docs/doc actually.

18:39 Regarding syntax highlighting of Clojure code in markdown documents: Pandoc uses its own Haskell impl of whatever KDE's Kate uses (so it can then make use of its syntax def files).

18:39 Will look into markdownj and what it might provide.

18:40 Our very own refheap (Raynes++) uses pygments.

18:40 * Raynes incs

18:42 brehaut: yeah, most people have avoided the whole syntax highligher in clojure or java route because the foundational work has been a lot more than anyone wanted to tackle

18:42 its much easier to leverage someone elses work

18:43 pygments works ok for clojure but not great. purely lexical highlighting is pretty weak sauce for a lisp

18:43 Raynes: I remember when I first released refheap, there was this guy who shot me down because I didn't write my own syntax highlighter and therefore refheap is hardly an example of Clojure.

18:43 brehaut: thats insane

18:43 Raynes: I also got refheap released in 2 weeks, so there.

18:43 I thought people liked people who ship or whatever?

18:44 brehaut: yeah, it took me a whole week to just write a clojure brush for an existing highlighter package

18:44 uvtc: Perhaps it would be possible to offload to Vim or Emacs?

18:44 Raynes: Could totally do that.

18:45 But that involves getting Emacs set up with all of the syntaxes and stuff.

18:45 It's pretty complicated

18:45 It would be unreliable, methinks.

18:45 It'd be a great project for technomancy.

18:45 uvtc: technomancy, although I think a lein plugin to process docs into html will be useful, my hunch is that first things first we should figure out if it will work to host clojars libs docs on clojuredocs.org.

18:45 brehaut: also, emacs's clojure mode only does lexical highlighting unless swank is running right?

18:46 dakrone: uvtc: I don't run it, zkim does, I help him with it

18:46 Raynes: brehaut: Yeah, but so what? Emacs highlighting is considered defacto, so even if it too isn't perfect nobody would care.

18:46 uvtc: dakrone, thanks for the info.

18:47 technomancy: general syntax highlighting in Clojure is hard, but documenting Clojure libraries really only requires highlighting Clojure code in most cases

18:47 Raynes: haha nice try

18:47 Raynes: :)

18:52 technomancy: uvtc: github pages is another option

18:52 for hosting

18:53 uvtc: IIRC, github pages requires some setup that might be ok for bigger projects that want their own website, but I think it might be too much work for smaller lib docs.

18:56 For the Clojure lib doc story, how about this:

18:56 Step 1: have `lein new` by default create a "doc" directory in a new project.

18:56 Step 2: Encourage developers of libs to put at least a little something in their doc dir (either html or something that can be easily converted to html)

18:56 Step 3: Get either clojuredocs.org or some other doc hosting site set up to host static docs for Clojure libs present at clojars.org.

18:57 Step 4: Write a lein plug-in that can push any .html docs it finds in a project's doc dir to this lib doc-hosting site.

18:57 Step 5: Profit!

18:57 Wait.

18:57 xeqi: Step 6: XSS

18:57 mattmoss: Stop, hammertime?

18:57 uvtc: I suppose step 5 might be to write a lein plugin to create docs from a standard template for those who don't want to deal with any styling issues.

18:58 xeqi: ?

18:58 xeqi: you have to be very very careful accepting html from users

18:58 uvtc: xeqi: I'm guessing the lib docs site would require some sort of login before allowing upload of httml.

18:58 s/httml/html/

18:59 xeqi: Well, if I had my way, the docs would be .md files and Pandoc would be installed on the server hosting the docs and they'd be generated in a standardized way upon upload. :)

19:00 (Pandoc does nice syntax highlighting for Clojure, OOTB.)

19:03 xeqi: security is very hard to get right sometimes

19:03 lazybot: thats true

19:04 uvtc: What are the hosting options right now? If we had docs to be hosted, where could they go?

19:05 And no wise cracks from you, lazybot.

19:05 I mean it.

19:05 technomancy: anybody want a peanut?

19:06 xeqi: nom nom

19:07 mattmoss: Never get involved in a land war in Asia.

19:07 uvtc: You were *supposed* to be this colossus. You were this great legendary thing! Yet he gains.

19:07 I think I know what to do.

19:09 emezeske: l

19:10 uvtc: emezeske, ell ?

19:11 amalloy: uvtc: he's checking to see whether this is a terminal window

19:12 uvtc: As clojurebot (or was it lazybot?) has said: no entiendo

19:12 joshua__: Is there any way to make (read-line) and other CLI input getting functions work without actually building?

19:12 technomancy: yeah, sounds like we have two good arguments for generating server-side: not making users install pandoc and solving the xss problem

19:13 emezeske: amalloy: :)

19:13 uvtc: technomancy, Yes.

19:18 talios: 'lo rbarraud

19:18 TimMc: amalloy: By typing l, enter?

19:18 amalloy: TimMc: in many bash shells that's aliased to "ls -CF"

19:18 brehaut: talios: you are lurking a bunch more recently

19:19 talios: doing more clojure lately?

19:19 rbarraud: hi talios :)

19:19 amalloy: so it's a common thing to accidentally send to the wrong window/buffer

19:19 technomancy: amalloy: second after xb =)

19:19 amalloy: haha yes

19:19 TimMc: amalloy: Huh, time for another read through the ls docs.

19:20 talios: brehaut - not yet, but possibly yes :) more lurking in #rest and this is also on auto-join so ;-)

19:20 amalloy: i've definitely typed xb into irc a few times; i think i've always stopped myself before hitting enter

19:23 talios: rbarraud / arbscht - joining us for the lunch time JUG today at all?

19:23 technomancy: joshua__: you mean in leiningen? try lein trampoline

19:24 rbarraud: doh - can't unfortunately - have eye appt at Greenlane at 1245

19:24 thanks for reminder though talios

19:24 talios: doh

19:24 rbarraud: hi arbscht

19:26 hoping to get to TNC tomorrow night though

19:26 <drool/> Pavlov was right!

19:27 ;-)

19:36 jsnikeris: Hi all. I'm trying to write a function or macro that accepts a list of symbols and imports all of them. I'm struggling a bit...do I need to write a macro that wraps import in order to do so?

19:37 Raynes: (apply import [yourlist])

19:37 Actually...

19:37 &(doc impot)

19:37 lazybot: java.lang.RuntimeException: Unable to resolve var: impot in this context

19:37 jsnikeris: import is a macro

19:38 talios: rbarraud - mmm curry

19:38 Raynes: Yeah, that occurred to me after I said that.

19:38 jsnikeris: :)

19:38 so if I have 'entity' bound to a var in my REPL, this seems to print what I want to eval: `(import ~@(get-endpoints entity))

19:39 Raynes: (defmacro my-import [list-of-symbols] `(import ~@list-of-symbols)) should work, right?

19:39 jsnikeris: but when I stick that into a macro: (defmacro import-endpoints [service] `(import ~@(get-endpoints service)))

19:40 the symbol 'service' is passed to get-endpoints rather than the value of service

19:41 placing an unquote in front of service doesn't work either

19:41 do I need to double quote this or something?

19:42 Raynes: I'm going to try that out, that's a more general way of writing it

19:42 I'm still curious what I'm doing wrong though, if anyone has input

19:42 Raynes: That wont work for what you want.

19:43 amalloy: jsnikeris: doesn't import already accept multiple symbols? (import java.util.List java.util.Map)

19:44 Raynes: Yeah, but not a list of them.

19:44 jsnikeris: amalloy: yes it does, I basically need to splice the return value of a function into an import

19:44 amalloy: you can't do that

19:45 Raynes: jsnikeris: (defmacro import-endpoints [service] (cons 'import (get-endpoints service))) ;; I *think* this does what you want. Untested and I haven't wrote a macro in 6 months.

19:45 amalloy: Raynes: that's exactly identical to his last paste, which he says doesn't work

19:46 jsnikeris: you need get-endpoints to be a function, not a macro

19:46 jsnikeris: get-endpoints is a function

19:46 Raynes: Oh, hrm.

19:46 jsnikeris: it returns a list of symbols

19:46 I want to "Import all the symbols!"

19:47 Raynes: I'm unclear as to why this isn't working then.

19:47 amalloy: jsnikeris: i don't think the error message you describe is a possible result from the code you pasted, given that get-endpoints is a function. so you need to paste something more specific/involved

19:48 jsnikeris: OK, so if the macro looks like this: (defmacro import-endpoints [service] `(import ~@(get-endpoints service)))

19:48 Raynes: I just tested your macro against a function that returns a list of symbols and the macroexpansion looks correct.

19:48 jsnikeris: the symbol 'service' gets passed into get-endpoints

19:48 rather than the value of the symbol service

19:49 unless I'm misinterpreting the error message I'm getting

19:50 amalloy: you must be

19:50 jsnikeris: hmm

19:50 Raynes: amalloy: The error message says that it's trying to treat a symbol as an iseq.

19:51 amalloy: what error message? i haven't seen one yet

19:51 Raynes: The one that says it's trying to treat a symbol as a seq.

19:51 jsnikeris: I probably should have distilled this into a more general problem rather than it being specific to what I'm doing

19:53 so if I call (get-endpoints entity), I get a list of symbols

19:53 if I call (import-endpoints entity), as defined above I get:

19:53 a null pointer exception

19:55 having the same stack trace that I would get if I called (get-endpoints 'service)

19:55 amalloy: entity is a symbol at macroexpansion time; it only has a value at runtime

19:55 patchwork: Hello #clojure, anyone know how to convert a string into a byte-array?

19:55 it seems like it should be a simple task

19:55 hiredman: ~jdoc String

19:55 clojurebot: Titim gan éirí ort.

19:56 patchwork: but there is nothing online about it that is not clojure.contrib

19:56 hiredman: clojurebot: jerk

19:56 clojurebot: you cut me deep, man.

19:56 hiredman: ~javadoc String

19:56 clojurebot: Cool story bro.

19:56 amalloy: patchwork: what language? what character encoding?

19:56 hiredman: feh

19:56 amalloy: $javadoc java.lang.String

19:56 lazybot: http://docs.oracle.com/javase/6/docs/api/java/lang/String.html

19:57 amalloy: it's easy to do (badly) with String interop

19:57 patchwork: amalloy: shouldn't there be a method that works for any language and character encoding?

19:57 Is a string not essentially an array of bytes?

19:57 amalloy: no, it is an array of characters

19:57 how those characters would be represented on disk as a bunch of bytes is up to your character encoding

19:58 jsnikeris: amalloy: I feel like I need to do something like this: (defmacro import-endpoints [service] `(import ~@(get-endpoints ~service)))

19:58 That doesn't work either, but do you see what I'm trying to get at?

19:59 patchwork: So what would be the "non-bad" way to do this?

19:59 if interop is bad?

19:59 amalloy: jsnikeris: this is not a possible task. you don't get access to runtime values (eg, the value of the var 'entity) at macro time

19:59 patchwork: (.getBytes my-string "UTF-8")

19:59 specify the encoding you want to use

20:00 jsnikeris: amalloy: hmm, OK I'll have to think about another way to do this then. Thanks for your help.

20:01 Raynes: you too

20:05 so is it possible to import classes at runtime w/out knowing the symbols ahead of time?

20:05 amalloy: jsnikeris: if you don't know the symbols ahead of time there's no value in importing them

20:05 jtoy: can i include some other text files into my uberjar and if so how do i do it?

20:06 amalloy: all importing a class does is make an alias for convenience when programming

20:06 ,java.util.zip.ZipInputStream

20:06 clojurebot: java.util.zip.ZipInputStream

20:06 jsnikeris: amalloy: I'm working on something that makes the REPL easier to use

20:06 for my domain

20:07 so I'd like to import a bunch of classes if the user calls a function

20:07 TimMc: amalloy: What's wrong with .getBytes? You want normalization form selection too?

20:07 amalloy: meh. use eval then, i guess?

20:08 aperiodic: jtoy: anything in the resources/ directory will be packaged into the uberjar

20:08 amalloy: TimMc: suppose we write the results of (.getBytes some-string) to disk on one jvm, and create a (String. the-bytes) in another jvm. because we aren't careful about what character encoding we use, you might get out a different string

20:08 jtoy: aperiodic: how do i access say resources/foo.txt from inside my source? just use the regular FS ?

20:10 i guess use this: http://stackoverflow.com/questions/7836030/compojure-access-filesystem

20:11 jsnikeris: amalloy: I'm not following your suggestion. Would you explain a little more how eval might help?

20:11 amalloy: (eval `(import ~@(get-endpoints whatever)))

20:11 TimMc: amalloy: Oh, sure. But with UTF-8 both places you have no objection?

20:12 amalloy: TimMc: sure

20:13 aperiodic: jtoy: hmm, i don't know. i don't think you can use the regular FS. light googling suggests you lik

20:13 jtoy: aperiodic: it seems to be io/resources

20:13 aperiodic: jtoy: s/lik/ask the classloader

20:14 jtoy: oh, cool. yeah, that should do the trick. note that the path will probably be "foo.txt", not "resources/foo.txt"

20:14 jtoy: how would I change slurp to use resource though? (slurp "file")

20:15 can I do (slurp (resource "file")) ?

20:15 TimMc: Yeah.

20:15 Or if not, you can get an inputstream for that resource and slurp that.

20:16 jtoy: ok, ill try

20:16 jsnikeris: amalloy: that did it. thanks so much for your help.

20:20 dabd: i've been lazy to move a project i started with clojure 1.2.0 to 1.3.0 and now 1.4.0. Now when i run lein deps i get: Unable to resolve artifact: Missing org.clojure:clojure:jar:1.3.0-beta1

20:20 Is there any workaround?

20:26 hiredman: dabd: use a real release version

20:27 and don't use 1.3 ever

20:29 dabd: my project.clj looks like this https://gist.github.com/2957353

20:29 so i don't know where is it trying to get 1.3.0-beta1 from

20:30 i guess i'll have to spend some time moving it to 1.4.0

20:30 hiredman: run `lein pom` then `mvn dependency:tree`

20:31 also you should use "1.2.0" for the version string

20:31 and there were 2 patch releases of 1.2

20:31 so 1.2.2

20:32 dabd: i ran lein pom and mvn dependency:tree but `lein deps` still issues the same error

20:34 isn't lein deps calling mvn depedency:tree too?

20:35 hiredman: no

20:35 mvn depedency:tree would print out the list of dependencies in a tree so you could see what is trying to pull in the bogus clojure version

20:37 dabd: ok, it is trying to pull clojure-1.3.0-beta1

20:38 but i have "1.2.0" in the dependencies why is that?

20:38 1.2.2 didn't work btw

21:11 muhoo: hiredman: what's wrong with 1.3?

21:13 brehaut: presumably its not 1.4

21:15 Turns: I want to do some Clojure as part of a larger Java application, but I'm new to Clojure and I can't seem to figure out how it should work. I want the Clojure to maintain a data structure that is a transformed representation of another data structure that is changing over time.

21:16 Now I know that Clojure has troubles with mutation, but I still like the declarative style. The relationship between these data structures seems to fit with declarative programming. I'm just having trouble keeping the output data structure updated.

21:17 mthvedt: turns: how are the updates for the other structure coming in?

21:19 Turns: mthvedt: I'm not sure yet! It may depend on how the Clojure should work and what it needs. But right now I'm thinking of using a partially persistent data structure. In other words, a persistent data structure where you are only allowed to modify the most recent version. Since Clojure won't be needing to modify the input structure and Java would only ever modify the most recent one, I think that's pretty clever.

21:21 mthvedt: But more specifically it would be a tree representing markup of a document that needs to be formatted by the Clojure. And the output will be formatting information ready for rendering.

21:21 mthvedt: turns: the document is being updated by the user?

21:21 Turns: mthvedt: Yes, that's the tricky part.

21:22 mthvedt: turns: i think agents can support simple dataflows

21:23 but those are async

21:23 which is probably not what you want

21:23 Turns: mthvedt: Oh really? I hadn't considered agents because it didn't seem like my application was naturally multithreaded. But since multithreading is so easy in Clojure, perhaps even things which would normally be single-threaded should be done multithreaded.

21:24 mthvedt: clojure style seems to encourage using concurrent constructs even in single threaded programming

21:24 because you can make mistakes not managing state even in one thread

21:25 Turns: That is good advice. I had been completely ignoring the multithreaded parts of Clojure.

21:26 mthvedt: if you're doing editing, often it's convenient to represent edit as a chain of undoable transforms

21:26 if that's the case you can just multiplex the edits to the original and the transformed

21:26 or brute-force re-transform, if performance is no issue

21:26 Turns: What do you mean by multiplex?

21:27 mthvedt: you have two structures, x and y, representing the same document

21:27 a

21:27 n

21:27 y u

21:27 clojurebot: Man, the living creature, the creating individual, is always more important than any established style or system. -- Bruce Lee

21:27 mthvedt: any update hits both

21:27 stick em both in an atom

21:27 or two atoms

21:27 dabd: the latest lein generates project.clj with clojure-1.3.0. Shouldn't it be 1.4.0?

21:30 Turns: mthvedt: So what you are saying is that instead of giving the Clojure code direct access to the input document data structure, I just pass in some representation of changes to that data structure as they happen, and then the Clojure generates some representation of changes to the output data structure that keeps the two in parallel.

21:30 mthvedt: turns: well i don't know how you're handling updates, but that's one way

21:32 Turns: mthvedt: That would make things easier because it would mean that I don't need to create a persistent representation for the document structure, partial or otherwise. I only need to make each document update persistent, and since there'd be no reason to every modify such a thing, I get that for free.

21:32 mthvedt: turns: are you using transients?

21:32 Turns: mthvedt: What do you mean by "transients"?

21:33 mthvedt: turns: i guess i don't know what you mean by not needing a persistent representation

21:33 what's the other choice

21:33 java collections? transients?

21:34 brehaut: you really shouldnt be using transients for anything other than internal operations

21:34 Turns: mthvedt: Everything in Clojure is naturally persistent, all changes that you make to any data structure create a new version of the structure instead of modifying the original. I'm sure that seems like the only way to someone used to thinking in Clojure, but from the Java side of things, changing the original is quite common.

21:35 mthvedt: And since the input data structure is coming to Clojure from Java, I had reason to think that I would be needing to make it persistent. But if I won't give Clojure direct access, then I won't need to make it persistent. I can modify it directly.

21:38 Using a persistent data structure to represent the document seems nice for supporting Undos, but if I'm going to be constructing objects to represent edits, then instead of using a persistent document I can just store the edits.

21:39 duck1123: If I want to return a map containing only a set of the keys from the source map, is there a pre-made function to do that?

21:39 Turns: duck1123: Don't you mean return a set containing only the keys?

21:40 mthvedt: turns: you could always do both, but if the input data structure is coming from java, no reason to add addt'l complexity

21:40 duck1123: (? {:a 1 :b 2 :c 3} #{:a :b}) => {:a 1 :b 2}

21:40 Turns: mthvedt: The hard part will be how to represent modifications to a data structure in Clojure.

21:41 duck1123: Oh, I see what you mean now.

21:41 duck1123: got it

21:41 select-keys, even in core. :)

21:42 mthvedt: turns: if you can afford cpu cycles, you can just opt to run the transform on every update

21:42 Turns: mthvedt: How do you mean?

21:42 mthvedt: so you have java structure j, and clojure structure c

21:42 and a function j => c, correct?

21:43 Turns: mthvedt: Let's suppose I have that for the sake of discussion.

21:43 mthvedt: if you have your edit/undo log for j

21:43 you can try creating a parallel one for c

21:43 but if your function j => c is cheap enough, you can just keep track of all the c's in your undo log

21:45 instead of having to worry about the effects of edits on c

21:47 Turns: mthvedt: I think I see what you mean, but that requires I have a function j => c, which means I need j to be persistent, and also I do worry about performance a bit. I'd like to only recalculate the bit that changes if I can.

21:47 mthvedt: So what I really want is a function (change in j) => (change in c). Which I can use to make a function j => c if I need it, but also allows me to keep c updated after each change easily.

21:48 mthvedt: turns: i thought it was all coming from java? how do you get your initial version of c

21:48 it would also be nice to have such a fn as a validating test

21:49 Turns: mthvedt: I assume that c is initially empty, and so is j, and then when I load my document it's just a really big change to j.

21:49 mthvedt: turns: well, there's a function from j to c

21:49 though probably not a very efficient one

21:50 Turns: mthvedt: Not efficient? Why?

21:50 mthvedt: shrug

21:50 just a guess

21:57 Turns: I can represent each change as a pair of nodes, the first one a node that was included in a previously input change and the other a root node that represents the subtree to replace the first node.

21:59 dabd: the function read-lines seems to have disappeared (it was in contrib-duck-streams which changed to clojure.java.io). Does anyone know where it is now or an equivalent?

21:59 Turns: And then the Clojure code would need to maintain a map from input nodes to output nodes so that the output structure would be easily updated.

22:01 TimMc: dabd: Does line-seq do what you need?

22:01 technomancy: read-lines is a resource leak IIRC

22:02 Turns: dabd: You might find this interesting: http://freegeek.in/blog/2011/06/10-clojure-one-liners/

22:02 dabd: yes line-seq does it

22:03 thanks

22:03 nice link

22:03 TimMc: dabd: Found it using (apropos 'line) at the REPL. :-)

22:10 dabd: xml-zip from clojure.zip is gone too and apropos doesn't show anything similar

22:13 aperiodic: dabd: it's there in the 1.4 docs; did you :use 'clojure.zip?

22:15 dabd: here http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go it only mentions clojure.data.zip

22:15 talios: arbscht: missed you at the JUG :(

22:15 brooksbp: I hope someone can help me with a basic ns problem

22:16 TimMc: dabd: apropos only helps for namespaces you already have on your classpath. :-/

22:16 brooksbp: I am trying to do (ns myns (:require [clojure.string :as str]))

22:16 but the error: replace already refers to #'clojure.string/replace in namespace...

22:17 So then I try to hide replace... (:refer-clojure :exclude [replace])

22:17 but it happens again for reverse and split

22:17 TimMc: Hmm, that error with #'replace shouldn't happen if you use :as.

22:17 aperiodic: dabd: um... i don't see why that's relevant. if you use or require clojure.zip, you should be able to call zip-xml

22:18 dabd: aperiodic: i am using that page as a guide to migrate contrib code. But you are right it is in clojure.zip but that namespace is not mentioned in the document.

22:19 aperiodic: dabd: that's because clojure.zip is not in contrib

22:21 brehaut: (not= clojure.data.zip clojure.zip)

22:23 adu: omg I love noir

22:23 but I don't know how much of it is ring or hiccup

22:23 brehaut: or compojure

22:24 kenneth: hey all. what exactly is a future object? is it just an easy way of saying "do this in another thread?" i'm looking at this specifically in the context of zmq: https://antoniogarrote.wordpress.com/2010/09/08/zeromq-and-clojure-a-brief-introduction/

22:24 dabd: how do i use clojure.data.zip?

22:24 JanxSpirit: just tried to upgrade to lein 2 and am getting some errors - should I be using 2 or 1.*?

22:25 brehaut: kenneth, its not just a thread, its a threadpool (and i think futures share the agent threadpull)

22:26 terrible use of england aside

22:26 arbscht: talios: sorry, had some work come up at the last minute

22:26 JanxSpirit: Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword

22:27 (error I'm getting)

22:27 brehaut: your ns decl is probably wrong

22:27 JanxSpirit: this is just running 'lein help'

22:27 brehaut: at a guess

22:27 then i have no idea

22:27 xeqi: JanxSpirit: can you paste the whole stacktrace on a paste site?

22:29 adu: hey

22:29 what does this mean: No :main namespace specified in project.clj

22:30 tmciver: adu: it means you ran 'lein run' without specifying :main in project.clj

22:30 adu: I thought it was supposed to run -main

22:31 xeqi: in what namespace?

22:31 brehaut: adu: -main where

22:31 JanxSpirit: xeqi: http://pastebin.com/FuGM7KgJ

22:31 brehaut: adu: yourproject.core is just a convention (partly for java interop)

22:31 adu: ok

22:31 xeqi: JanxSpirit: is this outside a project?

22:33 JanxSpirit: xeqi: yes - do I need to do lein new first?

22:33 adu: tmciver: brehaut: 'lein run' works now :)

22:33 thanks

22:33 JanxSpirit: same...

22:34 xeqi: no, just getting all the info to debug

22:34 JanxSpirit: thanks - I do appreciate the help

22:34 xeqi: do you know what version it installed?

22:34 brehaut: kenneth: future also has deref semantics ontop of being a thread

22:36 JanxSpirit: self-installs has this jar: leiningen-2.0.0-preview6-standalone.jar


22:37 is it ok to have more than one?

22:37 xeqi: yeah thats fine

22:37 JanxSpirit: I also have 1.6.2

22:37 ok

22:38 xeqi: do you have a ~/.lein/profiles.clj ?

22:39 JanxSpirit: yes

22:39 I can blow it away

22:39 xeqi: or just move it

22:40 JanxSpirit: all I had in there I think was swank - maybe a version mosmatch?

22:40 lein help

22:40 oops ;P

22:41 hey that was it

22:41 thanks xeqi

22:41 xeqi: it was probably malformed

22:41 JanxSpirit: sorry for the newb questions

22:41 xeqi: np, if you just want swank it would be

22:41 {:user {:plugins [[lein-swank "1.4.3"]]}}

22:42 oh, I think 1.4.4 is out

22:42 JanxSpirit: thank I'll give it a go - trying to get my emacs environment dialed in

22:43 adu: hmm, I ran 'lein install clojure-json' and got 'Wrong number of arguments to install task.'

22:43 xeqi: adu: using lein2?

22:43 adu: yes

22:43 technomancy: adu: why are you trying to install clojure-json?

22:43 adu: o wait 1.7.1

22:43 technomancy: I want to use it

22:44 technomancy: adu: two problems with that

22:44 adu: I've been using clojure for about 3 days now, still learning

22:44 technomancy: sure, fair enough

22:44 first it's not very good compared to cheshire

22:44 and second, you just declare it in your project.clj file

22:44 adu: oh ok

22:44 zawzey: Hi, I remember there's a great flowchart graph/chart that shows when to use a normal clojure datatype, a defrecord, defprotocol etc, does anyone recall which site it's on?

22:44 adu: technomancy: I have no idea how lein works

22:45 technomancy: adu: have you read `lein help tutorial`?

22:45 if not start there

22:45 adu: I just followed the instructions, and I've been writing a website in webnoir, but I realized that I have no idea how to write a hello world, so I just did that a minute ago

22:45 zawzey: technomancy: didn't know lein has a tutorial, nice....

22:46 ah found it, http://chasemerick.files.wordpress.com/2011/07/choosingtypeforms2.png

22:48 0.

22:53 Turns: Thanks, zawzey, this looks great.

22:54 cmajor7: what's the latest and greatest XML parsing/creating clojure util?

22:54 I see "clojure.data.zip.xml", "clojure.xml"…

22:54 adu: how do i get argv?

22:55 zawzey: Turns: yeah credits goes to cemerick

22:55 cmajor7: maybe I can gen it with hiccup.. ? but then I need to parse it back it

22:56 zawzey: cmajor7: I haven't used any of those, but enlive works well for parsing on xml for my needs

22:57 cmajor7: zawzey: thx, let me check.. or creating & parsing ?

23:00 zawzey: cmajor7: enlive is only for parsing

23:00 adu: oic [& args]

23:00 cmajor7: I see.. "clojure.data.zip.xml" looks interesting (for both), but just wanted to see if anybody used it / has a better opinion

23:01 brehaut: ive used it i ithink

23:01 both c.d.z.x and enlive are limited to a subset of xml though

23:01 (roughly the same subset: things without namespaces)

23:02 kenneth: hey all, i'm having a lot of trouble using zmq from clojure. i'm not a java person and java dependency and namespacing stuff is confusing the shit out of me

23:02 brehaut: cmajor7: https://github.com/brehaut/necessary-evil/blob/master/src/necessary_evil/methodresponse.clj (also methodcal.clj and value.clj)

23:03 kenneth: i'm getting a compile error (lein compile) on using [org.zmq Socket]; java.lang.ClassNotFoundException: org.zmq.Socket (log_scale.clj:1)

23:04 talios: have you added the zeromq dependency to your lein project.clj?

23:04 kenneth: yeah i think i did it correctly; here's what my project looks like https://gist.github.com/d18744cafa7df9527b0c

23:04 brehaut: cmajor7: its parsing one of the dumbest XML formats in the wild though

23:06 kenneth: not related to your problem but your closing parens etc are non-idiomatic. bring them up to the end of the previous lines

23:06 kenneth: brehaut: i know, makes it easier to copy paste lines while i'm fucking around at this point

23:07 talios: kenneth - mm that looks ok, alto I don't see an actual dependency on zeromq, so I assume the the mikejs/jzmq deps don't have transitive deps on zeromq itself - either that, or the class isn't org.zmq.Socket

23:07 cmajor7: brehaut: thx, I don't need much sophistication, but need to be able to work with USPS API which is XML in XML out..

23:08 talios: kenneth - mm, a google search tells me about org.zeromq.ZMQ.Socket tho - mm

23:08 brehaut: cmajor7: you should be fine with either then. c.d.z.x is pretty nice, although i frequently forget the rules on how to walk a zip and probably have overused xml-> and xml1->

23:09 cmajor7: cool thx.

23:28 adu: how do I read from a file?

23:29 this is what I'm doing: http://paste.lisp.org/display/130164

23:30 and I get: "test.json"#<BufferedInputStream java.io.BufferedInputStream@6708f8e0>

23:31 kenneth: jesus

23:31 i think at this point i've spent more time compiling zeromq than using it

23:31 in a month!

23:32 adu: kenneth: do you know this lanugage?

23:33 kenneth: adu: https://gist.github.com/1253f5c5800672324e38

23:33 line 29

23:34 adu: oh thanks

23:34 kenneth: you can read a file like that

23:34 adu: where does ->> come from?

23:35 estebann: kenneth: is pmap really faster than map in that context?

23:35 kenneth: adu: macro makes code cleaner

23:36 adu: (->> (one two) (three four)) is equivalent to (three four (one two))

23:37 adu: is it builtin?

23:37 kenneth: adu: for example (->> [1 2 3] (reduce +)) ;=> 4

23:37 for big chains it's cleaner than nesting stuff

23:37 er, my math is wrong, it's 6. </tired and drunk>

23:37 adu: looks monadic

23:38 kenneth: estebann: probably not? idk, i wrote this 3 months ago, i don't remember the details :p

23:39 estebann: kenneth: gotcha... just curious

23:40 amalloy: adu: no, it's operating in a totally different arena than monads

23:40 kenneth: talios: uh, neither seem to work. this is killing me :/

23:41 adu: amalloy: I know, macros

23:41 yey!

23:41 (line-seq (reader filename)) worked

23:42 amalloy: what don't you get, then? i don't really understand how anyone could know how macros work and still say ->> looks like a monad

23:42 adu: amalloy: the first time I had seen that notation was 5 mins ago

23:42 I've been using clojure for about 3 days total

23:42 amalloy: well, fair enough

23:44 cemerick: amalloy: down, boy ;-)

23:47 amalloy: indeed! sounds like he's doing pretty well

23:50 adu: ok http://paste.lisp.org/display/130165 now I get: "test.json"("{\"hello\":\"world\"}"){"hello" "world"}

23:51 how do I get the "hello" entry from the json object?

23:57 kenneth: adu: you're gonna have to parse the json

23:57 adu: I did

23:57 found it: (get json "hello")

23:57 sweet

23:58 brehaut: presuming json is just a map, then (json "hello") would also work

23:58 adu: really?

23:59 brehaut: ,({"hello" "world"} "hello")

23:59 clojurebot: "world"

23:59 adu: wow

23:59 brehaut: works for vectors and sets too

23:59 adu: ,([1 2 3] 0)

23:59 clojurebot: 1

23:59 brehaut: they are functions of their keys, indices and contents respectively

Logging service provided by n01se.net