#clojure logs

2012-06-19

00:00tvladeckuvtc: so using `(require 'foo.core :reload)` will reload any new functions that you have written in the namespace?
00:00emezesketvladeck: Just realized this machine doesn't have a clj dev env setup, so I can't help :(
00:00tvladeckb/c i have been exiting and restarting the repl each time
00:01uvtctvladeck, Yes. Reloads the whole core.clj file.
00:01tvladeckuvtc: well, if nothing else, that's a huge win
00:01emezeskeuvtc, tvladeck: I actually find running the repl outside of vim to be much better
00:01SrPxhmm
00:01uvtctvladeck, Oh, yeah. The repl that comes with lein 2 is so nice.
00:01SrPxdnolen: but how did you search it? google?
00:02SrPxdnolen: I can never find useful papers on google
00:02tvladeckuvtc, emezeske: thanks! i will quit hitting my head against the wall now
00:02uvtctvladeck, :)
00:07dork_what is the best startup environment for a begginer?
00:07uvtcdork_: If you're on GNU/Linux, maybe have a look at http://www.unexpected-vortices.com/clojure/brief-beginners-guide/index.html .
00:08muhooin 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?
00:08uvtcdork_, see also http://dev.clojure.org/display/doc/Getting+Started
00:08uvtc~getting-started
00:08clojurebotIt's greek to me.
00:08technomancymuhoo: I don't know anything about noir, but that sounds like a job for slingshot
00:09antares_dork_: IDEs like IDEA or Eclipse/Counterclockwise also provide REPL so if that is your kind of thing, it's good for beginners, too
00:09technomancyslingshot plus a ring middleware I guess; would make a nice combo if it doesn't exist yet
00:09technomancydork_: use whatever you already know
00:09antares_dork_: for tinkering with one liners, http://tryclj.com
00:09muhoothanks, i see friend uses slingshot, wasn't sure how exactly it works, will read up on it
00:09SrPxgod how I see this article
00:09SrPxI freaking have U$3
00:09SrPxbut I can't pay
00:09SrPxon the internet, damn
00:09dork_Just looking for something beyond the repl and not the emacs plugin/server setup
00:10muhooit's got throw+ and catch+ all over the place
00:10antares_muhoo: I don't think there is a middleware that passes control via exceptions
00:10dork_uvtc: thanks most tutorials were a bit dated but the first reccomendation seems to hit the mark
00:11brehautdork_: if it doesnt start with 'go to leiningen and start with its tutorial' you are probably being sent down a garden path
00:11uvtcuvtc, y/w. (I wrote that one. :) )
00:11technomancybrehaut: is that bad? gardens are usually nice.
00:12brehauthmm
00:12brehautbeing sent to a blasted apocolyptic wasteland?
00:12uvtcbrehaut, It does start with "go get lein". Have a look, and let me know if you see anything you think could use improvement. :)
00:12technomancymaybe a rabbit trail or a wild goose chase
00:12muhoosnipe hunt
00:12brehautuvtc: it has a cat, thats a good start
00:14muhoothis is interesting. ring appears to be purely functional, noir uses mutation of dynamic vars, and friend passes exceptions around with slingshot :-/
00:14uvtcbrehaut, Oh, I do need to update it for lein 2.0.0-preview6 and OpenJDK 7 though.
00:14muhooi have a nice casserole here
00:15muhoomixing all 3
00:15brehautuvtc: you have avoided all the major pitfalls of many previous getting started guides. good work
00:15technomancymuhoo: strongly suggest sticking with the functional approach
00:15uvtcbrehaut, thanks :)
00:16muhootechnomancy: good idea. my sanity is a thin enough reed already
00:16technomancymuhoo: I think exceptions could be put to good use for things like detecting unauthorized access, but I haven't tried it myself yet.
00:17technomancyuvtc: thanks for getting the emacs docs moved over to github
00:17technomancyso much nicer to be able to edit in emacs now instead of that silly confluence rich-text nonsense
00:18uvtctechnomancy, 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.
00:19technomancyoh 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
00:19uvtctechnomancy, 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.
00:24uvtc~getting-started is <reply> Maybe have a look at http://dev.clojure.org/display/doc/Getting+Started .
00:24clojurebotIn Ordnung
00:24technomancyuvtc: I don't have permission to delete comments. I asked someone from core to do it and they refused =(
00:27uvtctechnomancy, 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. :)
00:29technomancyI 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.
00:29technomancywhich is why I'm wondering why I didn't move the docs to github sooner =)
00:31uvtctechnomancy, 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.
00:31technomancyactually most of the stuff on the wiki page was either me or Raynes =)
00:32technomancyall the other content never made it past the comments
00:33uvtcIncidentally, 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?
00:33uvtcOr is there no process? Perhaps it just happens by osmosis when no one's looking? :)
00:33technomancyI think you just have to make noise on the mailing list
00:34technomancyprovided you've filed your form in triplicate
00:34technomancyplus you need to be sure you have a 27B-6: http://www.youtube.com/watch?v=eosrujtjJHA
00:35uvtcYou can't make a move without a 27B stroke 6.
00:36uvtcPersonally 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.
00:36technomancyYou're a good man to have in a tight corner.
00:37uvtcWe're all in it together.
00:38technomancywhoa, someone actually made one: http://www.suberic.net/~dmm/27B-6.pdf
00:41uvtcMust be a real stickly for paperwork.
00:41uvtcAgh. s/stickly/stickler/
00:41muhoonow this is a weird one. (require 'nsname :reload) is not causing the ns to actually reload
00:41muhoo'twas working fine a few days ago, last i used it
00:43muhooand :reload-all does nothing, just returns
00:44muhoooic, if the file didn't change, it ignores it
00:44muhoo:reload doesn't mean :force-reload i guess
00:50Raynestechnomancy: I don't think I'm legally able to edit those pages anymore though.
00:51brehauttechnomancy: even without having seen brazil i was able to guess that it was from there. thats quite astounding
00:51Raynestechnomancy: I signed my CA as Simpson, but later decided on Grimes. I've been told I need to sign another CA, but blah.
00:51technomancyRaynes: but your intellectual properights!
00:51technomancybrehaut: <3 gilliam
00:52brehauthe does good stuff
01:04sergeyhey there
01:04sergeyhow can I check how many certain characters does the string contain?
01:09uvtc,(count (filter #(= % \a) "fooaaba"))
01:09clojurebot3
01:09sergeyuvtc, cool, thanks
01:10technomancy,(count #{\a \b} "fooaba")
01:10clojurebot#<CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: core$count, compiling:(NO_SOURCE_PATH:0)>
01:10technomancyoops
01:10uvtcOh, right.
01:10uvtc,(count (filter #{\a} "fooaaba"))
01:10clojurebot3
01:11uvtcthanks, technomancy.
01:12brehaut,(.length (.replaceAll "fooaaba" "[^a]" ""))
01:12clojurebot3
01:13brehaut(for a slower, more oblique way)
01:19SrPxAbout 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?
01:20brehautSrPx they work on s-expressions
01:20brehautso you have to have at least (macro-name …) as a wrapping form at some level
01:21SrPxso the best I can do is "every (. a b) means (foo a b)"?
01:21brehautyou can reinterpret the symbols inside the sexp however you wish
01:21SrPxwhich is not very syntax-changing at all
01:21SrPxbrehaut: so in a way macros are just a way of resorting whats inside the () ?
01:22brehautyes
01:22brehautif you want to trivialise it that way
01:22brehauta 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
01:22SrPxbrehaut: great definition
01:23brehautthats all* they are (*caveat: details differ)
01:23uvtcbrehaut, 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?
01:24brehautuvtc: it really depends what the macro does
01:24brehautuvtc: you can make a macro that does everythign at compile time if you wish
01:24brehautand just results in a value
01:24uvtcbrehaut, thanks.
01:24brehautbut 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
01:25brehautuvtc: 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
01:26brehautSrPx: 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
01:27brehautits still possible to make incompatible macros, but at least it controls the scope of their application
01:27brehautSrPx: however, its fairly idiomatic in clojure to make macros as surgical and small as possible and stick to functions whereever possible
01:30SrPx brehaut okay... thanks !
01:48rdsrWhat's the best approach to proceed if I have to convert from one json object (a tree?) to another json object
01:54rdsrzipper / walk?
01:59uvtcrdsr, I haven't used it yet, but have you looked into https://github.com/clojure/data.json ?
01:59uvtc(part of contrib)
02:01rdsr@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.
02:01amalloyrdsr: 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
02:03rdsr@amalloy, yes I understand that. I was just wondering what's a good approch to it.
02:04rdsrone 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...
02:04amalloywell, 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"
02:06amalloyunless you have a more specific kind of transformation in mind
02:07rdsr@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
02:08rdsrs/have/hate
03:08miclorbanyone know how I can set a system property with lein (so that the app that it launches has the property set?)
03:19ro_sti'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?
03:28ro_stis it possible to deploy an uberjar that reads static files from outside the uberjar?
03:28ro_sti 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
03:29ro_stotherwise i'll have to always rebuild the backend whenever deploying the front end
03:29ro_stwhich is not ideal
04:06_ulisesfor all of you emacs users, do you use clojure-test-mode or do you run tests from a shell?
04:06ro_sti use lein2 midje —lazytest from a shell
04:07_ulisesI 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.
04:08_ulisesI suppose I'm actually asking what's the best way to integrate midje and emacs?
04:09scottj_ulises: I don't think very many people use clojure-test-mode. I think midje has its own emacs stuff.
04:09ro_stthere's a midje-mode minor mode for emacs
04:09ro_sthttps://github.com/marick/Midje/wiki/Midje-mode
04:09_ulisesah, great, that's what I actually wanted to know :D
04:09ro_sti haven't done enough midje-fu to want to install this, yet
04:09ro_stbut i'll get there
04:09gtuckerkelloggi use both clojure-test-mode and midje mode. They work fine side by side
04:10ro_stmidje-mode looks great
04:10_ulisesgreat stuff!
04:12kay__what a weird channel
04:15ro_stargh. 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?
04:16ro_stsorry, not ring's route/resources; compojure's route/resources
04:18ro_sttypical. had to reboot the repl
04:28ro_stanyone using ring.util.serve know how i can see stracktraces?
04:29ro_stserver is working when using lein2 ring server but not when using ring.util.serve
04:56michaelr` why do I get javax.net.ssl.SSLPeerUnverifiedException: peer not
04:56michaelr` authenticated when trying when clj-http.client/get GETs something
04:56michaelr` from http://graph.facebook.com? I'm trying to run this clojure project: https://github.com/metadaddy-sfdc/facebook-template-clojure
08:31joshua__$findfn ["one" "two"] "one two"
08:31lazybot[]
08:31joshua__$findfn ["one" "two"] " " "one two"
08:31lazybot[]
08:31joshua__msg lazybot " " ["one" "two"] "one two"
08:32ohpauleezjoshua__: You want join
08:32ohpauleezhttp://clojuredocs.org/clojure_core/clojure.string/join
08:33joshua__ohpauleez, thanks
08:33ohpauleeznp
08:33xiefei;(str "one" "two")
08:34ohpauleez&(str "one" "two")
08:34lazybot⇒ "onetwo"
08:34ohpauleezxiefei: ^
08:35xiefei:)
08:40archaichow do I coerce a 2-d float array into a 2-d double array?
08:42clgv$findfn "one" "two" "one two"
08:42lazybot[clojure.core/print-str]
08:43clgv$findfn " " ["one" "two"] "one two"
08:43lazybot[clojure.string/join]
08:46gfredericks$findfn 1 1 2
08:46lazybot[clojure.core/+ clojure.core/unchecked-add clojure.core/+' clojure.core/unchecked-add-int clojure.core/bit-shift-left]
08:52gfredericks&(->> (range) (drop 1) (take 2) (map (partial clojure.pprint/cl-format nil "~r")) (clojure.string/join " "))
08:52lazybot⇒ "one two"
08:57clgvwhy?
08:57clojurebotWhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
09:30TimMcarchaic: ##(double-array (float-array [1 2]))
09:30lazybot⇒ #<double[] [D@193209a>
09:31clgvTimMc: thats not 2d but the function to use ^^
09:32TimMcOh! Right.
09:32clgv,(doc into-array)
09:32clojurebot"([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."
09:33clgv(into-array (map double-array float-2d)) should do the trick
09:36ro_sti'm struggling with an issue with ring and post-data.
09:37ro_stwhen 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
09:37ro_stthe middleware in question is wrap-json-params from https://github.com/ngrunwald/ring-middleware-format
09:38clgvro_st: maybe that wrap-json-params middleware is at a position too early in the chain
09:40xeqiro_st: is the content type set correctly?
09:42AWizzArdI 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.
09:43AWizzArdI thought mostly import is doing something like: (def Label javafx.scene.control.Label)
09:43Chiron_Hi all, would you please have a look at: http://pastie.org/4114497
09:43Chiron_appreciate your time
09:44cshellYOu're keying by hour/date?
09:45Chiron_bad idea :) isn't ?
09:45Chiron_it is only what I'm thinking right now
09:46ro_stxeqi: good catch. it's going out as x-www-form-urlencoded. sodding xhr.
09:46Chiron_I need to collect analytics data , hour and date are vital parts
09:46nDuffChiron_: YYYY-MM-DD has the advantage that it's ASCII sortable; when you tack HHHH on in front, you discard that advantage.
09:47cshellwhat if they collide?
09:47cshelloh, you're aggregating anyway
09:48nDuffChiron_: ...putting the hour on the end would preserve sortability without needing to write your own comparison function.
09:48cshellwhy don't you just make hour and date each a key value pair inside the object?
09:49AWizzArdThe import macro expands into import* whose definition I can not find.
09:49Chiron_cshell: would you please provide me with a sketch of your design?
09:51nDuffAWizzArd: it's defined in clojure.lang.Compiler, which is Java.
09:52cshellChiron_: I don't know the exact syntax, but something like http://pastie.org/4114534
09:52clgvAWizzArd: it's a compiler expression
09:52cshellChiron_ without the second hour and date
09:52cshellChiron_: so something like http://pastie.org/4114542
09:54cshellthen you can do analytics based off the discrete hours
09:55Chiron_trying to digest
09:58Chiron_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
09:59ro_stweird. 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
09:59ro_sthuh?!
10:00ohpauleezro_st: in CLJS?
10:00ro_stfrom 'traditional' gclosure, using goog.net.XhrIo
10:00ro_sttarget is clojure ring service, though
10:00cshellChiron_: if you're batching by requests then the ones before 13 would go in 12 and the ones in 13 would be 13
10:01ohpauleezJust send it standard
10:01ohpauleezuse pr-str to turn your clojure data into a string
10:01ohpauleezand then on the server do a safe read
10:01ro_stit's json data going up
10:01ro_stnot clojure data
10:02ro_sti'm actually trying to suss why wrap-json-params isn't working on the server side
10:02ohpauleezIs it in ClojureScript or straight JavaScript?
10:02ro_ststraight js
10:02ohpauleezthere's your problem right there :)
10:02Chiron_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:02ro_st-cry-
10:02Chiron_maybe I'm not expressing myself :)
10:04cshellChrron: 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:05cshellyou 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:05xeqiro_st: are you doing something like http://www.googleclosure.com/google-closure-ajax/ ?
10:08ro_stxeqi: yes
10:08ro_stprecis
10:08ro_stwith the content-type in, i get this weirdness:
10:09ro_sthttp://rationalist.co.za/uploads/Screen%20Shot%202012-06-19%20at%204.08.50%20PM-D92cCfHW9R.PNG (sorry for horrid url)
10:10ro_stwithout, i get a POST with 200 OK, but the wrap-json-params middleware doesn't parse out the json
10:10ro_sti literally copy and paste the json from chrome's network panel into my repl in a manual ring request and it works
10:11ro_stright now, just trying to determine where i've performed idiocy; on client or on server
10:11ro_stohpauleez: trust me, i would LOVE to drop gclosure and use cljs right now, but this app has to go out
10:12xeqiro_st: you're running up against the same origin policy
10:12xeqiif I'm reading it right
10:12ro_stnope. i have middleware that fixes that already
10:13ro_stlemme do a refheap of the differences in the request data in clojure between a web request and manually in the repl
10:13ohpauleezro_st: My guess is that the client is nor forming the headers correctly
10:14ohpauleezYou should look at the headers going out, either with browser inspection tools, or fire up wireshark
10:14ro_sti'm using Charles
10:14ohpauleezAre the headers correct?
10:15ro_stwhich mirrors what chrome shows: a 404 OPTIONS request
10:15ohpauleezSo it looks like Closure isn't even making the request correctly
10:15ro_stlet me get this refheap done. it's the real problem i'm trying to deal with, anyway
10:19Chiron_cshell: will think how to implement that with atom
10:19xeqiro_st: same origin policy is client side, how can you fix that with middleware?
10:20ro_stby adding a header: https://www.refheap.com/paste/3229
10:20ro_stthat lets me hit webserver 2 (:8080) from webserver 1 (:3000)
10:22ro_stso this is the situation: https://www.refheap.com/paste/3230
10:22ro_sti'm probably doing something really daft
10:23xeqiro_st: for CORS it looks the server has to respond with whats allowed on the OPTION request
10:24xeqihttps://developer.mozilla.org/en/http_access_control
10:24xeqisee Preflight request
10:24ro_st:o
10:24ro_sti would never have found this in a bazillion years
10:24ro_styou beauty
10:25ro_stso i need to also add headers that specify -Methods and -Headers
10:26ro_stand because currently i don't have any routing set up for OPTIONS, i get a 404, which is precisely right
10:27ro_stso i'll need to add an OPTIONS route for each distinct POST, PUT, DELETE uri i create which returns these headers
10:27ro_st(this is the part where you say, don't bother, just use ring-unicorns-with-rainbows, find it on clojars)
10:42ro_sthmm. 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:46xeqiro_st: change the predicate you're passing
10:46xeqito (constantly true) or something better
10:47matteopi all . Is there a incanter programmer to ask a question ?
10:47TimMcYou'll never know until you ask your question. :-P
10:49matteopright . 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:49matteopsuggest ?
10:49ro_stxeqi: 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:49ro_stit works now
10:50ro_st-phew-
10:51ro_stthanks for the help
10:58clgvmatteop: 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:58matteopthanks
11:19joshua__$findfn [1 2 3] 1 [2 3]
11:19lazybot[clojure.core/nthrest clojure.core/subvec clojure.core/nthnext]
11:23joshua__,(.indexOf (list 1 2 3 1 2 3) 3 2)
11:23clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: indexOf for class clojure.lang.PersistentList>
11:27joshua__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:28locojayhi is there a good lib for sparse vectors in clojure or just i just go with mahout RandomAccessSparseVector
11:28bhenryibdknox: ping.
11:39clgvlocojay: depends what you want to do with it. in certain settings a map can be used
11:40clgvlocojay: but probably you want some kind of efficient multiplication?
11:56blcooley10:54 *** Eldariof-ru QUIT Ping timeout: 264 seconds
12:10edoloughlinI want to generate args to a function from a (for) but it's not destructuring them properly: http://pastebin.com/ni4ZkY7s — any ideas?
12:11edoloughlin(some editing required in that pastebin - I didn't use clojure.data.xml/emit)
12:12TimMcnDuff: Adblock?
12:12TimMcI don't know how people do without.
12:12nDuffTimMc: Interferes with my ability to see sites the same way my customers do, which has been a problem in the past.
12:12TimMcnDuff: Eep.
12:13TimMcGood thing I don't have customers. But it's something to keep in mind when sending links to relatives.
12:13TimMcedoloughlin: Missing an apply?
12:13edoloughlinoh...
12:14TimMcnDuff: Isn't there some extension that replaces ad images with kittens?
12:14edoloughlinIs 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:15nDuffTimMc: Doesn't help much when one's employer is responsible for some of the kittens.
12:15TimMchaha
12:15zach_Is there currently a way to declare a specific build of clojurescript to use as the compiler in lein-cljsbuild?
12:15edoloughlinTimMc: ok. I get it. Thanks.
12:15TimMcedoloughlin: Yeah, (apply element :e ...)
12:27oskarthin clojurescript, is there supposed to be a difference between (. something) and (.something)? (there is in my compiled cljs)
12:28ohpauleezoskarth: You should use the (.method obj) form
12:28oskarthohpauleez: yeah I noticed, but I thought (. qqqq) was eqv like with java interop
12:31oskarthohpauleez: any idea why that is? that in java both forms are ok but with js only the (. x). Is it by design?
12:33TimMcoskarth: JS "methods" are actually functions, so foo.bar is as valid as foo.bar().
12:34TimMcCLJS had to be rejiggered to allow a distinction between property access and method calls.
12:34ohpauleezit is by design, the (. ) call is legacy. To get around the fact that JS has first class functions (.method ) and (.-method) was introduced
12:34oskarthah I see
12:34ohpauleezthe latter gets the method as a property, but that meant that the . call had to be removed
12:34oskarththank you
12:34ohpauleeznp
12:50jimi_hendrixso 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:50solussdwhat 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:52dnolensolussd: depends but IFoo is common.
12:52joegallojimi_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:53joshua__$findfn {"me" "you"} "this is me me" "this is you you"
12:53lazybot[]
12:53jimi_hendrixjoegallo, i see. the lib is music-as-data, which afaik, is in no maven repo so i will make a local one
12:56joegalloif you git checkout, i think you can probably "lein deps, install" and then it will just be available for you.
12:56joegallodidn't realize it was a clojure library that you were talking about
13:04metajackclj-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:05zach_Can someone give me a short walkthrough on "requiring" libraries within a browser-connected cljs repl?
13:05dakronemetajack: pass {:as :byte-array} as opts to the request
13:05dakronemetajack: and then clj-http won't coerce the output to a string
13:05metajackdakrone: thanks!
13:11dnolenzach_: from what I understand it triggers a compile and eval.
13:12zach_dnolen: Well I'm not even able to do it at the moment. (I'm working in your cljs-demo project.)
13:14jimi_hendrixjoegallo, 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:14dnolenzach_: to do what?
13:14zach_dnolen: I found something on SO that suggested using something along the lines of (ns test.domina (:require [domina :as d]))
13:14dnolenzach_: I wouldn't use cljs-demo, it's likely out of date.
13:14adudoes clojure have something like scribble?
13:14dnolenadu: no
13:14zach_dnolen: I'd just like access to domina from within the repl
13:15dnolenzach_: and domina is specified in your project.clj?
13:15zach_Yes
13:15dnolenzach_: what version of lein-cljsbuid?
13:16zach_I'm still in cljs-demo, so 0.1.6
13:16dnolenzach_: might not work.
13:16dnolenzach_: just start from scratch using the latest lein-cljsbuild.
13:16zach_dnolen: Yeah, good idea
13:17dnolenzach_: I wouldn't mess with the browser REPL bit until you have a JS program that runs at the command line.
13:18dnolenzach_: 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:18zach_dnolen: yeah, you're right
13:19zach_dnolen: thanks for suggestions
13:19dnolenzach_: 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:20zach_dnolen: If that's the case, it seems like a bit of a deficiency, and something else to work on, no?
13:22dnolenzach_: yes, would be nice for interactive development.
13:26jweissi 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:26zach_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:27zach_dnolen: Or just generally being able to serve your cljs on a page?
13:27nDuffjweiss: Wouldn't it make more sense for the items that vary to return callables?
13:27dnolenzach_: Rhino, V8, JavaScriptCore, SpiderMonkey etc :)
13:27zach_dnolen: Awesome, cool :)
13:27jweissnDuff: i could, but then the code that reads the list has to check what type each item is.
13:28jweissand also, i already have 1500 functions in my codebase, and it's going to get a lot bigger.
13:28nDuffjweiss: Yup. That's a lot more explicit and less surprising than making a normally-immutable data structure be mutable.
13:28nDuffjweiss: ...if the problem is that that code happens in lots of places, well, encapsulate it in a function.
13:29jweissnDuff: ok, how would i do that :)
13:29nDuffjweiss: ...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:29nDuffjweiss: ...well, that depends. :)
13:29jweisswithout having 1500 anonymous no-arg functions
13:30nDuff(err, why would there be any anonymous functions involved at all?)
13:30nDuff(except for the ones living within the vector, of course)
13:30jweiss(def data [(fn [] [(System/currentTimeMillis) 2 4]) (fn [] ... ) etc)
13:30jweissyeah, i have 1500 of those.
13:31nDuffHow's this a problem?
13:31jweisswell, it's ugly, and it takes a long time to compile.
13:32nDuffYou have one vector. It's immutible, and instantiated only once. It has a bunch of little anonymous functions, which are instantiated only once.
13:32jweissgranted, eval still has to compile at runtime
13:32nDuff*nod*. Things always have to be compiled _somewhere_.
13:32nDuff...what's the history behind wanting these to live in a vector, anyhow?
13:33nDuffOpcodes for an emulator, or such?
13:33jweissnDuff: they don't need to be in a vector, any seq is fine
13:33jweissnDuff: it's data for data driven testing
13:33jweissthe 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:34nDuffAhh. 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:35S11001001jweiss: you could automatically factor out the like-structured expressions to a shared set of functions
13:35S11001001HOFs are also useful for reducing lambda count
13:35nDuff*nod*.
13:36jweissS11001001: mostly all i need are timestamped strings insstead of constant strings.
13:37S11001001jweiss: 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:38jweissoh 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:38jweissi was trying to write a custom pprint format for days and never got it working
13:38jweissthe only docs are for CL
13:38S11001001that's a totally different area than how the implementation is structured
13:39S11001001it's an imposition of CL; CL requires a currying version of format
13:39S11001001so, let's take the expression [[(blah) 4 2] [8 4 (blah)]]
13:41S11001001you can figure out at compile-time which subexpressions aren't pure, and extract them to lambdas
13:41nDuff...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:41S11001001like {:some-gensym (fn [] (blah))}, and [[((:some-gensym x)) 4 2] [8 4 ((:some-gensym x))]]
13:42S11001001or you could drop the shared table of lambdas in a wrapping `let' and reference them directly
13:44jweissS11001001: sounds like a lot of effort - [[{:x (blah) :y 2} 4 2]]
13:44jweisswouldn't i have to traverse the entire structure to find function calls?
13:44S11001001yes
13:45S11001001as 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:45nDuff...but the compiler is traversing the entire structure anyhow
13:45jweisssounds bug prone to me
13:45S11001001and you're proposing using eval
13:45nDuff:)
13:45jweisswell, i know eval is not ideal either :) was hoping for a clear-cut winner, but i guess that wasn't realistic :)
13:45S11001001partial and comp alone are enough to avoid an incredible amount of lambdas
13:47jweissS11001001: 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:47xeqipoint-free style can get ugly quickly
13:47S11001001jweiss: and traversing structures isn't that hard; if you're willing to go non-functional, you can use prewalk-replace from clojure.walk
13:47S11001001xeqi: false dichotomy
13:48Scriptorusing lein-cljsbuild to compile essentially one line of code
13:48jweissS11001001: what do you mean non-functional?
13:48TimMcxeqi: If taken too far, yeah.
13:48Scriptor(one line of cljs code, excluding the ns declaration)
13:49Scriptorand somehow the output is 5k lines, even with advanced optimizations
13:49Scriptoreven though I'm only using alert, not touching any closure libs
13:49S11001001jweiss: 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:50TimMc$inc zippers
13:50lazybot⇒ 1
13:50Scriptoris this normal behavior or is there something I need to do to completely remove all the extra code?
13:50duck11231Scriptor: at least all that other junk is more or less a constant overhead. (it's not 5K per line)
13:50S11001001Scriptor: yes, it's normal
13:51Scriptorduck11231: right
13:51jweissS11001001: 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:51S11001001jweiss: if you can't express your structure as Clojure code, and write this into a macro, then yes
13:52Scriptorhmm, isn't google closure supposed to optimize out code that isn't used, or does js/alert really use all that?
13:52duck11231If 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:52jweissS11001001: each test has a different structure for the data
13:52S11001001doesn't matter
13:52Scriptoryea, I tried it with whitespace earlier and it was up to 18k lines
13:53jweissS11001001: then i'm not sure what structure you mean
13:53Scriptorstill seems like a lot
13:53S11001001[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:54jweissS11001001: yes, wouldn't any vector be like that?
13:54S11001001indeed
13:55S11001001so you can perform the above example replacement at compile time
13:55solussdis there a format function in clojurescript, somewhere?
13:55solussd*for
13:56jweissS11001001: you mean by writing it as a macro, and then at runtime traversing again to calculate the 'delayed' values?
13:56S11001001not quite
13:56S11001001you end up with the (->) a monad, which you run by giving the functions and values you want to use to "complete" the expression
13:57jweisshm. maybe this is when i finally start understanding monads :)
13:57brainproxyusing enlive.. doing something like (h/set-attr :myattr ...)
13:57S11001001(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:57brainproxybut I'd like the value I'm setting to be built up from the old value and some new information
13:58brainproxyhow I can I refer to the current value of :myattr
13:58S11001001that 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:59S11001001so, (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:59jweissi should probably go read about monads and come back and read that again
13:59S11001001have fun
13:59TimMcNo, that way lies madness.
14:01jweissS11001001: thanks for the pointers, hopefully i'll be back :)
14:13aduomg, ring-core is awesome
14:15weavejesteradu: Out of curiosity, what parts did you like about it?
14:15jweissi suppose i should have asked, what exactly are the pitfalls for using eval?
14:15jweissno compile time checking, ok, doubt that matters for my purposes
14:15aduI was just looking through the stores (MemoryStore, CookieStore) and was astounded at how clean the implementation was
14:16weavejesterjweiss: It's slower and *usually* not necessary, but there are exceptions
14:16ohpauleezjweiss: It's kind of a sloppy, dangerous to use with untrusted sources, and there are generally better solutions
14:16jweissheh, yeah, monads.
14:16ohpauleezadu: weavejester, I agree, the code is exceptionally clean, clear, and a nice read
14:17weavejesteradu, ohpauleez: That's encouraging :)
14:17aduI'm getting sick and tired of genshi and django
14:18ohpauleezI 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:18aduso right now I'm looking for a webapp backend, and I really only have 2 requirements: must have existing json/mustache libs
14:18aduand clojure fits the bill
14:18ohpauleezadu: If you're going to use mustache, take a seriously look at enlive
14:19jweissso 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:19ohpauleezdecoupling structure and data, and applying data declaratively to your structure is a powerful approach
14:19nDuffjweiss: Why not bind a dynamic var to the current time before each test invocation?
14:20jweissnDuff: because i am running multiple threads
14:20aduohpauleez: are you talking about me?
14:20ohpauleezyes
14:20nDuffjweiss: ...each test has multiple threads, or you're running different tests in different threads?
14:21jweissi 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:21aduohpauleez: oh, why thank you, I didn't realize it was what I was trying to do :)
14:21jweissnDuff: different tests in different threads
14:21nDuffjweiss: then a dynamic var is _perfect_; their bindings are thread-local.
14:21nDuff(err, non-root bindings)
14:21jweissnDuff: so? it can still be bound to the exact same timestamp.
14:22nDuffjweiss: ...and you expect to get uniqueness the way you're doing it now?
14:22ieurejweiss, 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:22nDuffjweiss: if you want a guarantee, use an agent to populate your binding and have it increment a counter.
14:22jweissieure: that's what i'm doing :)
14:23ieurejweiss, Okay; hard to tell what you're doing without more context.
14:23jweissnDuff: a var just doesn't solve my problem.
14:23ieurejweiss, Maybe you could gist your code
14:23jweissif i have a literal vector that refers to a var, as soon as it's compiled, the timestamp is fixed forever.
14:23jweissrebinding is too late.
14:23nDuffjweiss: ...that may be true, you haven't given enough information to compel that conclusion.
14:23nDuffjweiss: not if you put the symbol in the vector.
14:24nDuffs/true, you/true, but you/
14:24jweissnDuff: ok then i have to traverse looking for symbols
14:24aduohpauleez: the github page says it has no support for xml namespaces
14:24aduenlive, that is
14:25nDuffjweiss: 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:25ohpauleezIt sounded like your were just using content/json and substitutions
14:25nDuffjweiss: ...anyhow: It can be done. I've done it without wanting to, and it annoyed me. :)
14:25ohpauleezare you serving up xml?
14:25ohpauleezadu: ^
14:26aduwell, mostly no, but I do have some custom xml and svg templates
14:26jweissnDuff: 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:26aducurently in django form
14:26ohpauleezaahh, gotcha
14:27adumost of the templates are html
14:27duck11231for serving xml, hiccup and {:xmlns ""} works fine. for parsing namespaced xml, i ended up using xml-picker-seq
14:28adui see
14:29aduhiccup sounds pretty cool
14:31jweissnDuff, i am guessing you mean (def ^:dynamic x nil) (defn thisvec [] [x 2 3]) (binding [x 7] (thisvec))
14:32nDuffjweiss: No -- what I was doing when I ran into the behavior in question was... err... considerably more interesting.
14:32jweissnDuff: oh, well if you can give me an example that'd be awesome :)
14:33jweissor Doing Eval?
14:33nDuffTwo spellings, same thing. :)
14:33nDuff(walking a structure and explicitly dereffing vars, though, _is_ at least less evil than eval)
14:35nDuff...yar, looks like an explicit deref is called for.
14:35nDuff*sigh*.
14:35jweissaside 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:36jweisseval is also bad for other reasons?
14:36jweissi mean if it was significantly harder to reason about, that'd put me off it
14:38TimMcjweiss: If you built it with eval, how hard would it be to change the data structures to support tree-walking?
14:38TimMc(Ignoring the difficulty of changing the code that uses the data structures.)
14:39jweissTimMc: not that hard, an hour of editing probably
14:39jweissor less
14:39TimMcYeah, go with eval and leave a big ol' explanation. :-P
14:39TimMcAnd ASCII art of McCarthy frowning.
14:39jimi_hendrixis there a way to print all namespaces my repl can presently see?
14:40TimMc&loaded-libs
14:40lazybot⇒ #<core$loaded_libs clojure.core$loaded_libs@dca5f4>
14:40TimMc&(loaded-libs)
14:40lazybot⇒ #{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:41jimi_hendrixwell that answers why i cant access a namespace
14:41jweissTimMc: 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:47duck11231jimi_hendrix: If you're using slime: C-c M-p [tab]
14:48jimi_hendrixalright, that double confirms it
14:51jimi_hendrixso 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:51duck11231you need to require it first
14:51duck11231the loaded libs are user and the ones needed by swank so far
14:53jimi_hendrixduck11231, i tried that, but it cant find it
14:54duck11231I like to keeps something like "(do (require 'foo.core) (in-ns 'foo.core))" in my history for quick access.
14:54duck11231are you launching lein swank from the project dir?
14:55duck11231you could try "lein classpath" or "lein deps :tree" (2.x) to confirm it's there
14:55technomancyduck11231: (doto 'foo.core require in-ns)
14:55jimi_hendrixduck11231, yeah, i was launching swank from the project dir
14:56duck11231Nowadays, I just have my server launch my swank connection so that my repl is all ready to use
14:56jimi_hendrixand the jar is in my classpath
14:57jtoynormally 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:58raekjtoy: change the name, group and version in its project.clj and run lein install
14:59raekfor example, change [foo "1.2.3"] into [org.clojars.jtoy/foo "1.2.3-fix1"]
14:59ohpauleezjtoy: 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:59raekand then depend on that in the other project
14:59ohpauleezIf you just need to add to it, you can just add to that namespace in your project
14:59jtoyok, which method do you guys do in general?
15:00raekthough 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:00raek~repeatability
15:00clojurebotrepeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability
15:00raekalso, see that
15:01raekin essence, avoid "free floating jars". put it in a repo and things gets simpler
15:01duck11231and if you're hacking on that sub lib a lot, symlink it to {projectdir}/checkouts/{sublibname}
15:01duck11231that way you don't have to install after every change
15:02duck11231again, bad for repeatability, good for ease of development
15:07jtoylein install downloads a milion different files
15:08duck11231You've obviously never deleted your ~/.m2 then ran mvn site
15:08duck11231great way to kill 45 minutes
15:09jtoyi did lein install, do i put the jar into classes of the parent project?
15:10oskarthhow 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:10duck11231you 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:10gfredericksoskarth: instance method or static method?
15:11oskarthgfredericks: instance method
15:11gfredericksoskarth: do you have the instance up front or is that supplied later?
15:11oskarthgfredericks: up front, it's a global
15:11dnolenso constraint lookup and purging from constraint store is looking pretty zippy ...
15:12jtoyduck11231: 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:12gfredericksoskarth: I'm not sure what you mean by "pass ... into a clojure function"
15:13duck11231jtoy: when you installed it, it put it in the appropriate directory in ~/.m2/ that's where lein looks
15:14jtoyduck11231: oh, i didn't realize that what install does, i saw it created a big had too in the subproject's directory
15:14oskarthgfredericks: I want to intern something like (fn [& args] (. global args))
15:15gfredericks&(doc memfn)
15:15lazybot⇒ "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:15gfredericksoskarth: I think you can use that ^
15:15oskarthgfredericks: ok nice, will check it out, thanks!
15:16gfredericksoskarth: wait maybe not
15:16gfredericksI give up
15:16oskarthalright, thanks anyway
15:16gfredericksas a last resort you can use reflection
15:16gfredericksor eval :)
15:18gfredericksoskarth: is this a java method with java-varargs?
15:18oskarthgfredericks: we are looping through a bunch of methods that have diff amounts of arguments
15:19ynnivhas anyone used java.jdbc with tomcat's context resources?
15:19ynnivit appears that java.jdbc has no way of operating on an existing connection object
15:29uvtcWatched 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:30uvtcNo deal-breakers in there.
15:30uvtcFor Clojure, I mean.
15:30ohpauleezyeah, I enjoyed that talk a lot
15:30cemerickdid anyone think it was a rant?
15:31uvtcNo, but in the beginning of the talk you mentioned something about not wanting it to come across that way,
15:31uvtcand I was saying that I think you succeeded.
15:31cemerickah, thanks :-)
15:31cemerickFunny that the talk came out the same day that fogus blogged about "why I don't use _____" posts.
15:32uvtcOh, didn't see that on rss yet.
15:33uvtccemerick, 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:34cemerickuvtc: I still have it running in the background, not to that point yet. I honestly don't remember that slide. :-)
15:35uvtcIt's the one where you show your (camel->keyword) fn.
15:35uvtc"pile of yarn" (great pic, btw :) )
15:35uraimoare the videos of clojure west available somewhere?
15:36uvtcuraimo, my understanding is that they come out little-by-little, and we'll see them on planet clojure as they become available.
15:36uraimoah ok, thanks
15:37uvtccemerick, Oooh, also, you pronounce 2 words funny: leiningen and chasm. ;)
15:37ynnivah, sql/with-connection can take { :name "java:comp/env/jdbc/database" }
15:37cemerickYeah, I've always pronounced 'Leiningen' wrong. :-P
15:38cemerickI think both variants of 'chasm' are acceptable. ;-)
15:38uvtcI can excuse "chasm", because of your first name. :)
15:38edoloughlin1,(clojure.data.xml/emit-str "")
15:38clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.data.xml>
15:39xeqiuraimo: http://clojurewest.org/news/2012/5/11/clojurewest-video-schedule.html
15:40uraimothanks xeqi
15:47cshell_wcemerick: I was able to get friend working with noir and a new workflow - very simple now that I understand the whole stack
15:48cemericksweet :-)
15:50cemerickcshell_w: definitely make some noise when you publish it
15:51kmicucemerick: ... in clojurescript one ;)
15:51cemerickheh
15:52cemerickkmicu: probably not, but you can :-)
15:54dnolenkmicu: I recall seeing your frustrations about getting CLJS1 working with CLJS 1236, still running into those problems?
15:54kmicucemerick: 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:56dnolenkmicu: heh, I suspect source maps will alleviate debugging - it won't solve it out the door. not without a lot of patches anyway.
15:56kmicudnolen: I took a little break, too much javascript debugging. Now I recreating cljs1 with new deps.
16:07kmicudnolen: btw where can I find what has changed in http://mvnrepository.com/artifact/org.clojure/google-closure-library/0.0-1376 ? ;)
16:13dnolenkmicu: no idea
16:13dnolenkmicu: pretty sure there's a google group fro GClosure, would ask there.
16:21gtrak&#java.net.URL["http://localhost:3030/dataset/query&quot;]
16:21lazybot⇒ #<URL http://localhost:3030/dataset/query&gt;
16:22gtrakwhy does that work, but if I try to compile it it gives me an error, "can't embed object in code"?
16:22S11001001gtrak: because AOT is strange, but the message is not a bug
16:23gtrakS11001001: not AOT, slime
16:23S11001001C-c C-l or C-c C-k?
16:25gtrakk
16:28S11001001try l
16:29gtrakS11001001: yea, same deal, "Can't embed object in code, maybe print-dup not defined: http://localhost:3030/dataset/query&quot;
16:30S11001001maybe define that method then
16:32S11001001,(type print-dup)
16:32clojurebotclojure.lang.MultiFn
16:39gtrakS11001001: I think I can get around it anyway, just want to understand!
16:42kmicudnolen: "This non-official distribution was prepared by the ClojureScript team", but no problem, only asking ;)
16:43dnolenkmicu: hmm? we're using released versions of GClosure Lib and & Compiler
16:43S11001001gtrak: #-syntax happens at read-time, so the compiler literally sees a URL in the source
16:43S11001001gtrak: it's not at all just a shortcut for calling the constructor
16:43S11001001it's *calling* the constructor before compiling
16:43S11001001you can't stick arbitrary java objects in class files
16:44S11001001so
16:44S11001001,(doc print-dup)
16:44clojurebot"; "
16:44S11001001oh come on
16:44S11001001there's a CL equivalent, hold on
16:44S11001001that is actually documented
16:45brooksbpI 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:45brooksbpis there a better way to do this?
16:46S11001001,(doc line-seq) -- brooksbp
16:46clojurebot"([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."
16:46S11001001,(doc reduce) ; brooksbp
16:46clojurebot"([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:47technomancyclojurebot: 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:47clojurebot'Sea, mhuise.
16:47kmicudnolen: but unfortunately cljs1 project uses it :). Can you do in the future, one open streaming with KitchenTC ? ;) Maybe only 1 free hour :)
16:47S11001001gtrak: http://www.lispworks.com/documentation/HyperSpec/Body/f_mk_ld_.htm#make-load-form
16:47brooksbpyeah 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:48amalloybrooksbp: he linked reduce too, for a reason :P
16:48brooksbphow are they related?
16:48S11001001brooksbp: f = process-line, make it conform
16:48S11001001val = initial state
16:49amalloy(reduce (fn [ir line] (...new ir from line...)) (line-seq file))
16:50mfextechnomancy: re: leiningen 2.0 and clojars repo: why not have the repos explicitly in project.clj rather than built into leiningen?
16:50brooksbpamalloy, what's the point of doing it that way?
16:51amalloy"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:51amalloyall of those are exactly what reduce avoids
16:54S11001001reduce is pointless if you're the maintainer of CPython; otherwise, it can be pretty useful
16:54cemerickHas anyone yet put together an alternative to test.generative's defspec that plays nicely with clojure.test?
16:54brooksbpI think I see how to use reduce and process-line here
16:54brooksbpthis is just to avoid using a global ref, right?
16:54S11001001"just"?
16:55brooksbp?
16:55S11001001it's a pretty major benefit
16:55brooksbpsorry, clojure is blowing my mind. I am probably missing something that you're hinting at
16:56brooksbpwhy do you say reduce is pointless if you're from python?
16:56S11001001the 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:57S11001001I don't, guido doesn't get reduce
16:58uvtcbrooksbp, functional programming is not one of Python's focuses ... (foci?).
16:58S11001001you can't mess up by leaving a partial state around or forgetting to initialize the state...
16:58S11001001etc etc
17:00brooksbpby thread-safe... do you mean something like... call reduce with a function f that spawns a new thread ?
17:01brooksbpthus it can be parallelized... multiple calls to f at once
17:01S11001001you can use your parser in multiple threads
17:02S11001001and, 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:03S11001001since 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:03brooksbpI still don't follow... isn't that the point of immutable state rather than something special reduce provides?
17:03S11001001which opens up further parallelization possibilities on its own
17:03S11001001yes
17:05brooksbpand 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:05brooksbpbut it's okay for clojure because of refs & stm...?
17:07S11001001no, it's bad for both
17:07S11001001I'm talking about guido, not python
17:08S11001001guido doesn't get reduce, tail calls, or hell, lambda
17:08S11001001sucks for pythonistas that they can't have nice things
17:11brooksbpwhy is it bad to mutate a ref while reduce'ing?
17:12brooksbpare you worried about the contention?
17:14S11001001it's needless use of a mutable state feature
17:15nDuffbrooksbp: ...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:15gtrakS11001001: 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:17emezeskebrooksbp: The reasons to avoid refs and mutation in general are not at all clojure-specific
17:17emezeskebrooksbp: You should read about the rationale for functional programming as a whole
17:17emezeskebrooksbp: This is an interesting read: http://web.mac.com/ben_moseley/frp/paper-v1_01.pdf
17:18gtrakclojure gives you more high-level tools than python without losing java perf
17:19gtrakI was sad about jython sucking, now I am not sad
17:19technomancygtrak: the former jython lead comes to seajure =)
17:19gtrakyea, he's on ironpython now right?
17:20technomancyno, he's full-time clojure
17:20brehauttechnomancy: is that also the ironpython guy?
17:20gtrakawesome!
17:20brehautoh
17:20technomancyhe may be the prior prior jython guy
17:20gtrakstill awesome
17:20mfextechnomancy: repost: re: leiningen 2.0 and clojars repo: why not have the repos explicitly in project.clj rather than built into leiningen?
17:21technomancymfex: I think in most cases it would just be redundant
17:21technomancyI want the defaults to make sense
17:21brehautthe ironpython/jython guy was jim hugunin?
17:21technomancymfex: in 2.0 final if you want the old repo you can certainly ask for it
17:21technomancybut out of the box you'll get central and clojars-releases
17:21mfextechnomancy: wouldn't that make the clojars free-for-all vs clojars strict orthogonal to the release version?
17:21technomancybrehaut: Brian Zimmer is the guy I know
17:22technomancymfex: it would, but it's a hassle for everyone
17:22brooksbpnDuff, emezeske, thanks
17:24uvtcAt one point I thought someone was working on an updated version of clojars.org. Has there been any movement on that?
17:24technomancyuvtc: functionally or visually?
17:24mfexmy 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:25uvtcIt would be nice if a given clojars page rendered the project's readme.
17:25uvtcand included the project's github page (or wherever it's hosted)
17:25S11001001gtrak: pretty much, just more abstractly
17:25technomancyuvtc: it includes a link if the project specifies it
17:26uvtcRight. 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:26technomancymfex: 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:26technomancyuvtc: Leiningen will yell at you now if you try to deploy without specifying a URL =)
17:27xeqiuvtc: I've been working on it for a couple months, focusing more recently on hte https deploy stuff
17:27uvtctechnomancy, xeqi : that's great. Thanks. :)
17:27uvtcIdeally, it would be wonderful to see autodocs (or other docs) for a given lib up on clojars.
17:27technomancyyeah the http deploy stuff is key
17:27technomancyuvtc: clojuredocs.org used to support third-party libraries
17:28technomancyif that could be resurrected it would be great to link to there from clojars
17:28uvtcLike how Perl's CPAN (er, search.cpan.org) automatically displays perldocs for all uploaded modules.
17:29mfextechnomancy: 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:30uvtcMaybe even beat Python's Cheeseshop to that one, since they don't yet have that functionality (auto display of a module's docs).
17:30uvtc:)
17:30technomancyuvtc: there's a lot we can learn from cpan I think =)
17:30technomancythey even do automated testing, which luckily we can delegate to travis
17:30brehautand lets not look to pythons packaging for ideas ;P
17:30uvtctechnomancy, Yes, I agree.
17:30uvtcbrehaut, Yes, I agree.
17:30gtrakoh god, virtualenv and ilk were messy
17:31brehautwoeful
17:31brehautand sadly, not past tense
17:32uvtcOne 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:32gtrakbut 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:32brehauthaha oh man, specifying .md files is going to anger some people ;)
17:33technomancyuvtc: I dunno; I think autogenerated docs give a false sense of "there I documented it"
17:33uvtcbrehaut, Could be any recognizable format. As long as they could be extracted and formatted as html automatically.
17:33technomancyoh, actually a pile of .md files is much more likely to be useful than stuff generated from .clj files
17:33borkdudegtrak I don't understand either: it turns out you always want a slightly different version anyway
17:33technomancyuvtc: I think the main problem is there's no consensus
17:34uvtctechnomancy, I prefer the pile of .md files (or .html files, or .tex files, or whatever) myself.
17:34brehauttheres not even a consensus on autodoc tools
17:34uvtcHow about this: if your project contains an html directory at the top level, and it contains .html files, clojars will host them?
17:36technomancyuvtc: I guess the question at the root of this is why don't people write documentation?
17:36xeqiuhh, security?
17:36xeqi~guards
17:36clojurebotSEIZE HIM!
17:36gtrakborkdude: worst case I have ever seen is the packaged eclipse on ubuntu ~3 years ago
17:37uvtctechnomancy, I wrote up some reasons why I think that is: http://www.unexpected-vortices.com/sw/gouda/rationale-and-benefits.html
17:37hiredmanyou know, apparently haskell has a parser that can parse code blocks out of latex
17:37uvtc(Actually, regarding having projects supply html ... that's no good. No one checks in html --- they usually write in some other source format.)
17:38technomancyuvtc: sounds like you need to team up with sjl and bring clojuredocs out of the mothballs =)
17:38technomancy`lein pushdocs`
17:38uvtcPush docs to clojuredocs.org or clojars.org?
17:38xeqiits unlikely clojars will host docs anytime soon
17:38xeqiits an artifact based repo, not a source one
17:38dakronetechnomancy: I have an email out to Tom Faulhaber about using autodoc for clojuredocs extraction, but he never responded :(
17:38uvtcLast I heard, clojuredocs.org was going to get rewritten in Clojure...
17:39dakronedoing extraction for 3rd party stuff is pretty easy, it's all the weird clojure-core extraction that really sucks
17:39technomancydakrone: 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:40borkdudeone n00b question: why can I rebind *out* in clojure 1.3, while it is not declared dynamic - exception for clojure.core things maybe?
17:40dakronetechnomancy: 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:40technomancyright; uniformity is good
17:41dakroneanyone know Tom personally? bug him for me.
17:41uvtctechnomancy, perhaps a start would be to have `lein new` create a doc dir in new projects.
17:41technomancydakrone: maybe it's best to use HTML as the lowest-common-denominator and have the HTML generation done client-side by maintainers?
17:41technomancyuvtc: I approve of this notion!
17:41S11001001,(bean #'*out*)
17:41technomancyis the jvm's markdown rendering lib any good?
17:41clojurebot{:rawRoot #<OutputStreamWriter java.io.OutputStreamWriter@1eb70ea3>, :class clojure.lang.Var, :watches {}, :dynamic true, :public true, ...}
17:42technomancyI've been spoiled by github-flavoured markdown with its excellent syntax highlighting
17:42borkdudeS11001001 hmm
17:42dakronetechnomancy: 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:42borkdudeS11001001 I tried this: (-> (meta #'*out*) :dynamic)
17:42borkdude,(-> (meta #'*out*) :dynamic)
17:42clojurebotnil
17:42technomancydakrone: oh, you mean for non-browser user agents?
17:42uvtcFor markdown processing, I find Pandoc to be excellent. http://johnmacfarlane.net/pandoc/
17:43dakronetechnomancy: 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:43technomancyuvtc: something that can be fully-JVM-hosted is going to offer a much better experience
17:44dakronemuch better than the tacked-on API it currently has
17:44uvtctechnomancy, 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:44technomancywhat's the current state of in-jvm syntax highlighting? didn't brehaut have something for that?
17:44brehauttechnomancy: nope, mines all javascript/clientside
17:45xeqiif you guys build somewhere that does this hosting let me know
17:45dakroneuvtc: I was hoping to do part of #2 with https://github.com/dakrone/lein-clojuredocs
17:45technomancythis looks brilliant, but it's all python-centric: http://read-the-docs.readthedocs.org/en/latest/getting_started.html
17:45brehauttechnomancy: though i did see someone talking about the lossless reader again recently
17:46technomancybrehaut: cgrand is cooking something up
17:46brehautah of course
17:46uvtcdakrone, have not yet looked at that. Will do so, but need to run in a few minutes.
17:47dakroneuvtc: cool, help appreciated
17:48uvtctechnomancy, I still don't really understand what readthedocs does. The Cheeseshop lets you upload html docs for modules listed there.
17:48brehauttechnomancy: 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:50uvtcGah. Gotta go.
17:50brehauti have mixed opinions about sphinx docs. they seem to too easily become really squirrelly
17:52borkdudeS11001001 where is *out* actually set to System/out?
17:55technomancybrehaut: haven't used it. what's the issue?
17:55technomancythe pile-o-markdown has worked fine for lein, but mostly because we rely on ```clj blocks that github provides
17:55technomancyit's not standard markdown
17:56brehauttechnomancy: 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:57brehauti suspect because the writer doesnt have to consider the document as a whole
17:57borkdudeS11001001 ah found it.. . https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L173
17:57brehauttechnomancy: 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:58technomancybrehaut: yeah, as a bunch of independent guides it works great
17:58S11001001borkdude: cool, go look at Var now :)
17:58technomancyI haven't written any serial documentation that needed to be broken up into multiple pages
17:59technomancyclojure 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:59brehauttechnomancy: 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:59borkdude,(.isDynamic #'*out*)
17:59clojurebottrue
18:00technomancybrehaut: yeah, that helps a lot
18:01brehauttechnomancy: re:jvm markdowns, i dont think you can safely mix and match markdown imps :(
18:01brehauteven aside from the nicities of github flavoured markdown
18:01technomancyI wonder if we could handle ```clj blocks with a lossless reader and then delegate the rest to markdownj
18:02brehauttechnomancy: a markdown impl should ignore any HTML in the document, so if we implemented ``` as a preprocessor, it shouldnt be too hard
18:04technomancybrehaut: feel like giving it a go?
18:04technomancy=)
18:04brehauttechnomancy: not this week :/
18:05technomancymaybe I should start a thread
18:05brehautmight be a good idea
18:30uvtc(backlogging) brehaut: I also find Sphinx docs difficult to navigate. That may just be due to the default style though. Not sure.
18:30brehautuvtc: its not just the default style. the django project uses it extensively, and its frequently a rabbit warren
18:31hiredmanI tempted to try literate programming, but I don't want to be one of "those guys"
18:31uvtcbrehaut, 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:31technomancydakrone: clojuredocs right now is focused around an API reference; have you thought at all about whether it would be appropriate for prose documentation?
18:32dakronetechnomancy: haven't thought about it, would be interesting to think about
18:32uvtcdakrone, do you run clojuredocs.org?
18:33technomancyuvtc: how would you feel about porting gouda to a leiningen plugin with markdownj? =)
18:33brehautuvtc: im a big pile of md files guy too
18:34uvtctechnomancy, I'm still learning Clojure, but that sounds like a cool idea.
18:34uvtcbrehaut, Nice!
18:36brehautuvtc: in reality though, my projects are generally small enough that the result is small pile of md :P
18:36uvtcbrehaut, 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:37uvtcEr, actually, the preference here seems to be s/docs/doc actually.
18:39uvtcRegarding 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:39uvtcWill look into markdownj and what it might provide.
18:40uvtcOur very own refheap (Raynes++) uses pygments.
18:42brehautyeah, 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:42brehautits much easier to leverage someone elses work
18:43brehautpygments works ok for clojure but not great. purely lexical highlighting is pretty weak sauce for a lisp
18:43RaynesI 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:43brehautthats insane
18:43RaynesI also got refheap released in 2 weeks, so there.
18:43RaynesI thought people liked people who ship or whatever?
18:44brehautyeah, it took me a whole week to just write a clojure brush for an existing highlighter package
18:44uvtcPerhaps it would be possible to offload to Vim or Emacs?
18:44RaynesCould totally do that.
18:45RaynesBut that involves getting Emacs set up with all of the syntaxes and stuff.
18:45RaynesIt's pretty complicated
18:45RaynesIt would be unreliable, methinks.
18:45RaynesIt'd be a great project for technomancy.
18:45uvtctechnomancy, 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:45brehautalso, emacs's clojure mode only does lexical highlighting unless swank is running right?
18:46dakroneuvtc: I don't run it, zkim does, I help him with it
18:46Raynesbrehaut: Yeah, but so what? Emacs highlighting is considered defacto, so even if it too isn't perfect nobody would care.
18:46uvtcdakrone, thanks for the info.
18:47technomancygeneral syntax highlighting in Clojure is hard, but documenting Clojure libraries really only requires highlighting Clojure code in most cases
18:47technomancyRaynes: haha nice try
18:47Raynes:)
18:52technomancyuvtc: github pages is another option
18:52technomancyfor hosting
18:53uvtcIIRC, 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:56uvtcFor the Clojure lib doc story, how about this:
18:56uvtcStep 1: have `lein new` by default create a "doc" directory in a new project.
18:56uvtcStep 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:56uvtcStep 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:57uvtcStep 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:57uvtcStep 5: Profit!
18:57uvtcWait.
18:57xeqiStep 6: XSS
18:57mattmossStop, hammertime?
18:57uvtcI 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:58uvtcxeqi: ?
18:58xeqiyou have to be very very careful accepting html from users
18:58uvtcxeqi: I'm guessing the lib docs site would require some sort of login before allowing upload of httml.
18:58uvtcs/httml/html/
18:59uvtcxeqi: 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:00uvtc(Pandoc does nice syntax highlighting for Clojure, OOTB.)
19:03xeqisecurity is very hard to get right sometimes
19:03lazybotthats true
19:04uvtcWhat are the hosting options right now? If we had docs to be hosted, where could they go?
19:05uvtcAnd no wise cracks from you, lazybot.
19:05uvtcI mean it.
19:05technomancyanybody want a peanut?
19:06xeqinom nom
19:07mattmossNever get involved in a land war in Asia.
19:07uvtcYou were *supposed* to be this colossus. You were this great legendary thing! Yet he gains.
19:07uvtcI think I know what to do.
19:09emezeskel
19:10uvtcemezeske, ell ?
19:11amalloyuvtc: he's checking to see whether this is a terminal window
19:12uvtcAs clojurebot (or was it lazybot?) has said: no entiendo
19:12joshua__Is there any way to make (read-line) and other CLI input getting functions work without actually building?
19:12technomancyyeah, sounds like we have two good arguments for generating server-side: not making users install pandoc and solving the xss problem
19:13emezeskeamalloy: :)
19:13uvtctechnomancy, Yes.
19:18talios'lo rbarraud
19:18TimMcamalloy: By typing l, enter?
19:18amalloyTimMc: in many bash shells that's aliased to "ls -CF"
19:18brehauttalios: you are lurking a bunch more recently
19:19brehauttalios: doing more clojure lately?
19:19rbarraudhi talios :)
19:19amalloyso it's a common thing to accidentally send to the wrong window/buffer
19:19technomancyamalloy: second after xb =)
19:19amalloyhaha yes
19:19TimMcamalloy: Huh, time for another read through the ls docs.
19:20taliosbrehaut - not yet, but possibly yes :) more lurking in #rest and this is also on auto-join so ;-)
19:20amalloyi've definitely typed xb into irc a few times; i think i've always stopped myself before hitting enter
19:23taliosrbarraud / arbscht - joining us for the lunch time JUG today at all?
19:23technomancyjoshua__: you mean in leiningen? try lein trampoline
19:24rbarrauddoh - can't unfortunately - have eye appt at Greenlane at 1245
19:24rbarraudthanks for reminder though talios
19:24taliosdoh
19:24rbarraudhi arbscht
19:26rbarraudhoping to get to TNC tomorrow night though
19:26rbarraud<drool/> Pavlov was right!
19:27rbarraud;-)
19:36jsnikerisHi 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:37Raynes(apply import [yourlist])
19:37RaynesActually...
19:37Raynes&(doc impot)
19:37lazybotjava.lang.RuntimeException: Unable to resolve var: impot in this context
19:37jsnikerisimport is a macro
19:38taliosrbarraud - mmm curry
19:38RaynesYeah, that occurred to me after I said that.
19:38jsnikeris:)
19:38jsnikerisso 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:39Raynes(defmacro my-import [list-of-symbols] `(import ~@list-of-symbols)) should work, right?
19:39jsnikerisbut when I stick that into a macro: (defmacro import-endpoints [service] `(import ~@(get-endpoints service)))
19:40jsnikeristhe symbol 'service' is passed to get-endpoints rather than the value of service
19:41jsnikerisplacing an unquote in front of service doesn't work either
19:41jsnikerisdo I need to double quote this or something?
19:42jsnikerisRaynes: I'm going to try that out, that's a more general way of writing it
19:42jsnikerisI'm still curious what I'm doing wrong though, if anyone has input
19:42RaynesThat wont work for what you want.
19:43amalloyjsnikeris: doesn't import already accept multiple symbols? (import java.util.List java.util.Map)
19:44RaynesYeah, but not a list of them.
19:44jsnikerisamalloy: yes it does, I basically need to splice the return value of a function into an import
19:44amalloyyou can't do that
19:45Raynesjsnikeris: (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:45amalloyRaynes: that's exactly identical to his last paste, which he says doesn't work
19:46amalloyjsnikeris: you need get-endpoints to be a function, not a macro
19:46jsnikerisget-endpoints is a function
19:46RaynesOh, hrm.
19:46jsnikerisit returns a list of symbols
19:46jsnikerisI want to "Import all the symbols!"
19:47RaynesI'm unclear as to why this isn't working then.
19:47amalloyjsnikeris: 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:48jsnikerisOK, so if the macro looks like this: (defmacro import-endpoints [service] `(import ~@(get-endpoints service)))
19:48RaynesI just tested your macro against a function that returns a list of symbols and the macroexpansion looks correct.
19:48jsnikeristhe symbol 'service' gets passed into get-endpoints
19:48jsnikerisrather than the value of the symbol service
19:49jsnikerisunless I'm misinterpreting the error message I'm getting
19:50amalloyyou must be
19:50jsnikerishmm
19:50Raynesamalloy: The error message says that it's trying to treat a symbol as an iseq.
19:51amalloywhat error message? i haven't seen one yet
19:51RaynesThe one that says it's trying to treat a symbol as a seq.
19:51jsnikerisI probably should have distilled this into a more general problem rather than it being specific to what I'm doing
19:53jsnikerisso if I call (get-endpoints entity), I get a list of symbols
19:53jsnikerisif I call (import-endpoints entity), as defined above I get:
19:53jsnikerisa null pointer exception
19:55jsnikerishaving the same stack trace that I would get if I called (get-endpoints 'service)
19:55amalloyentity is a symbol at macroexpansion time; it only has a value at runtime
19:55patchworkHello #clojure, anyone know how to convert a string into a byte-array?
19:55patchworkit seems like it should be a simple task
19:55hiredman~jdoc String
19:55clojurebotTitim gan éirí ort.
19:56patchworkbut there is nothing online about it that is not clojure.contrib
19:56hiredmanclojurebot: jerk
19:56clojurebotyou cut me deep, man.
19:56hiredman~javadoc String
19:56clojurebotCool story bro.
19:56amalloypatchwork: what language? what character encoding?
19:56hiredmanfeh
19:56amalloy$javadoc java.lang.String
19:56lazybothttp://docs.oracle.com/javase/6/docs/api/java/lang/String.html
19:57amalloyit's easy to do (badly) with String interop
19:57patchworkamalloy: shouldn't there be a method that works for any language and character encoding?
19:57patchworkIs a string not essentially an array of bytes?
19:57amalloyno, it is an array of characters
19:57amalloyhow those characters would be represented on disk as a bunch of bytes is up to your character encoding
19:58jsnikerisamalloy: I feel like I need to do something like this: (defmacro import-endpoints [service] `(import ~@(get-endpoints ~service)))
19:58jsnikerisThat doesn't work either, but do you see what I'm trying to get at?
19:59patchworkSo what would be the "non-bad" way to do this?
19:59patchworkif interop is bad?
19:59amalloyjsnikeris: 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:59amalloypatchwork: (.getBytes my-string "UTF-8")
19:59amalloyspecify the encoding you want to use
20:00jsnikerisamalloy: hmm, OK I'll have to think about another way to do this then. Thanks for your help.
20:01jsnikerisRaynes: you too
20:05jsnikerisso is it possible to import classes at runtime w/out knowing the symbols ahead of time?
20:05amalloyjsnikeris: if you don't know the symbols ahead of time there's no value in importing them
20:05jtoycan i include some other text files into my uberjar and if so how do i do it?
20:06amalloyall importing a class does is make an alias for convenience when programming
20:06amalloy,java.util.zip.ZipInputStream
20:06clojurebotjava.util.zip.ZipInputStream
20:06jsnikerisamalloy: I'm working on something that makes the REPL easier to use
20:06jsnikerisfor my domain
20:07jsnikerisso I'd like to import a bunch of classes if the user calls a function
20:07TimMcamalloy: What's wrong with .getBytes? You want normalization form selection too?
20:07amalloymeh. use eval then, i guess?
20:08aperiodicjtoy: anything in the resources/ directory will be packaged into the uberjar
20:08amalloyTimMc: 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:08jtoyaperiodic: how do i access say resources/foo.txt from inside my source? just use the regular FS ?
20:10jtoyi guess use this: http://stackoverflow.com/questions/7836030/compojure-access-filesystem
20:11jsnikerisamalloy: I'm not following your suggestion. Would you explain a little more how eval might help?
20:11amalloy(eval `(import ~@(get-endpoints whatever)))
20:11TimMcamalloy: Oh, sure. But with UTF-8 both places you have no objection?
20:12amalloyTimMc: sure
20:13aperiodicjtoy: hmm, i don't know. i don't think you can use the regular FS. light googling suggests you lik
20:13jtoyaperiodic: it seems to be io/resources
20:13aperiodicjtoy: s/lik/ask the classloader
20:14aperiodicjtoy: oh, cool. yeah, that should do the trick. note that the path will probably be "foo.txt", not "resources/foo.txt"
20:14jtoyhow would I change slurp to use resource though? (slurp "file")
20:15jtoycan I do (slurp (resource "file")) ?
20:15TimMcYeah.
20:15TimMcOr if not, you can get an inputstream for that resource and slurp that.
20:16jtoyok, ill try
20:16jsnikerisamalloy: that did it. thanks so much for your help.
20:20dabdi'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:20dabdIs there any workaround?
20:26hiredmandabd: use a real release version
20:27hiredmanand don't use 1.3 ever
20:29dabdmy project.clj looks like this https://gist.github.com/2957353
20:29dabdso i don't know where is it trying to get 1.3.0-beta1 from
20:30dabdi guess i'll have to spend some time moving it to 1.4.0
20:30hiredmanrun `lein pom` then `mvn dependency:tree`
20:31hiredmanalso you should use "1.2.0" for the version string
20:31hiredmanand there were 2 patch releases of 1.2
20:31hiredmanso 1.2.2
20:32dabdi ran lein pom and mvn dependency:tree but `lein deps` still issues the same error
20:34dabdisn't lein deps calling mvn depedency:tree too?
20:35hiredmanno
20:35hiredmanmvn 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:37dabdok, it is trying to pull clojure-1.3.0-beta1
20:38dabdbut i have "1.2.0" in the dependencies why is that?
20:38dabd1.2.2 didn't work btw
21:11muhoohiredman: what's wrong with 1.3?
21:13brehautpresumably its not 1.4
21:15TurnsI 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:16TurnsNow 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:17mthvedtturns: how are the updates for the other structure coming in?
21:19Turnsmthvedt: 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:21Turnsmthvedt: 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:21mthvedtturns: the document is being updated by the user?
21:21Turnsmthvedt: Yes, that's the tricky part.
21:22mthvedtturns: i think agents can support simple dataflows
21:23mthvedtbut those are async
21:23mthvedtwhich is probably not what you want
21:23Turnsmthvedt: 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:24mthvedtclojure style seems to encourage using concurrent constructs even in single threaded programming
21:24mthvedtbecause you can make mistakes not managing state even in one thread
21:25TurnsThat is good advice. I had been completely ignoring the multithreaded parts of Clojure.
21:26mthvedtif you're doing editing, often it's convenient to represent edit as a chain of undoable transforms
21:26mthvedtif that's the case you can just multiplex the edits to the original and the transformed
21:26mthvedtor brute-force re-transform, if performance is no issue
21:26TurnsWhat do you mean by multiplex?
21:27mthvedtyou have two structures, x and y, representing the same document
21:27mthvedta
21:27mthvedtn
21:27mthvedty u
21:27clojurebotMan, the living creature, the creating individual, is always more important than any established style or system. -- Bruce Lee
21:27mthvedtany update hits both
21:27mthvedtstick em both in an atom
21:27mthvedtor two atoms
21:27dabdthe latest lein generates project.clj with clojure-1.3.0. Shouldn't it be 1.4.0?
21:30Turnsmthvedt: 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:30mthvedtturns: well i don't know how you're handling updates, but that's one way
21:32Turnsmthvedt: 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:32mthvedtturns: are you using transients?
21:32Turnsmthvedt: What do you mean by "transients"?
21:33mthvedtturns: i guess i don't know what you mean by not needing a persistent representation
21:33mthvedtwhat's the other choice
21:33mthvedtjava collections? transients?
21:34brehautyou really shouldnt be using transients for anything other than internal operations
21:34Turnsmthvedt: 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:35Turnsmthvedt: 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:38TurnsUsing 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:39duck1123If 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:39Turnsduck1123: Don't you mean return a set containing only the keys?
21:40mthvedtturns: you could always do both, but if the input data structure is coming from java, no reason to add addt'l complexity
21:40duck1123(? {:a 1 :b 2 :c 3} #{:a :b}) => {:a 1 :b 2}
21:40Turnsmthvedt: The hard part will be how to represent modifications to a data structure in Clojure.
21:41Turnsduck1123: Oh, I see what you mean now.
21:41duck1123got it
21:41duck1123select-keys, even in core. :)
21:42mthvedtturns: if you can afford cpu cycles, you can just opt to run the transform on every update
21:42Turnsmthvedt: How do you mean?
21:42mthvedtso you have java structure j, and clojure structure c
21:42mthvedtand a function j => c, correct?
21:43Turnsmthvedt: Let's suppose I have that for the sake of discussion.
21:43mthvedtif you have your edit/undo log for j
21:43mthvedtyou can try creating a parallel one for c
21:43mthvedtbut if your function j => c is cheap enough, you can just keep track of all the c's in your undo log
21:45mthvedtinstead of having to worry about the effects of edits on c
21:47Turnsmthvedt: 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:47Turnsmthvedt: 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:48mthvedtturns: i thought it was all coming from java? how do you get your initial version of c
21:48mthvedtit would also be nice to have such a fn as a validating test
21:49Turnsmthvedt: 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:49mthvedtturns: well, there's a function from j to c
21:49mthvedtthough probably not a very efficient one
21:50Turnsmthvedt: Not efficient? Why?
21:50mthvedtshrug
21:50mthvedtjust a guess
21:57TurnsI 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:59dabdthe 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:59TurnsAnd 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:01TimMcdabd: Does line-seq do what you need?
22:01technomancyread-lines is a resource leak IIRC
22:02Turnsdabd: You might find this interesting: http://freegeek.in/blog/2011/06/10-clojure-one-liners/
22:02dabdyes line-seq does it
22:03dabdthanks
22:03dabdnice link
22:03TimMcdabd: Found it using (apropos 'line) at the REPL. :-)
22:10dabdxml-zip from clojure.zip is gone too and apropos doesn't show anything similar
22:13aperiodicdabd: it's there in the 1.4 docs; did you :use 'clojure.zip?
22:15dabdhere http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go it only mentions clojure.data.zip
22:15taliosarbscht: missed you at the JUG :(
22:15brooksbpI hope someone can help me with a basic ns problem
22:16TimMcdabd: apropos only helps for namespaces you already have on your classpath. :-/
22:16brooksbpI am trying to do (ns myns (:require [clojure.string :as str]))
22:16brooksbpbut the error: replace already refers to #'clojure.string/replace in namespace...
22:17brooksbpSo then I try to hide replace... (:refer-clojure :exclude [replace])
22:17brooksbpbut it happens again for reverse and split
22:17TimMcHmm, that error with #'replace shouldn't happen if you use :as.
22:17aperiodicdabd: 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:18dabdaperiodic: 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:19aperiodicdabd: that's because clojure.zip is not in contrib
22:21brehaut(not= clojure.data.zip clojure.zip)
22:23aduomg I love noir
22:23adubut I don't know how much of it is ring or hiccup
22:23brehautor compojure
22:24kennethhey 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:24dabdhow do i use clojure.data.zip?
22:24JanxSpiritjust tried to upgrade to lein 2 and am getting some errors - should I be using 2 or 1.*?
22:25brehautkenneth, its not just a thread, its a threadpool (and i think futures share the agent threadpull)
22:26brehautterrible use of england aside
22:26arbschttalios: sorry, had some work come up at the last minute
22:26JanxSpiritException in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
22:27JanxSpirit(error I'm getting)
22:27brehautyour ns decl is probably wrong
22:27JanxSpiritthis is just running 'lein help'
22:27brehautat a guess
22:27brehautthen i have no idea
22:27xeqiJanxSpirit: can you paste the whole stacktrace on a paste site?
22:29aduhey
22:29aduwhat does this mean: No :main namespace specified in project.clj
22:30tmciveradu: it means you ran 'lein run' without specifying :main in project.clj
22:30aduI thought it was supposed to run -main
22:31xeqiin what namespace?
22:31brehautadu: -main where
22:31JanxSpiritxeqi: http://pastebin.com/FuGM7KgJ
22:31brehautadu: yourproject.core is just a convention (partly for java interop)
22:31aduok
22:31xeqiJanxSpirit: is this outside a project?
22:33JanxSpiritxeqi: yes - do I need to do lein new first?
22:33adutmciver: brehaut: 'lein run' works now :)
22:33aduthanks
22:33JanxSpiritsame...
22:34xeqino, just getting all the info to debug
22:34JanxSpiritthanks - I do appreciate the help
22:34xeqido you know what version it installed?
22:34brehautkenneth: future also has deref semantics ontop of being a thread
22:36JanxSpiritself-installs has this jar: leiningen-2.0.0-preview6-standalone.jar
22:36JanxSpirit
22:37JanxSpiritis it ok to have more than one?
22:37xeqiyeah thats fine
22:37JanxSpiritI also have 1.6.2
22:37JanxSpiritok
22:38xeqido you have a ~/.lein/profiles.clj ?
22:39JanxSpirityes
22:39JanxSpiritI can blow it away
22:39xeqior just move it
22:40JanxSpiritall I had in there I think was swank - maybe a version mosmatch?
22:40JanxSpiritlein help
22:40JanxSpiritoops ;P
22:41JanxSpirithey that was it
22:41JanxSpiritthanks xeqi
22:41xeqiit was probably malformed
22:41JanxSpiritsorry for the newb questions
22:41xeqinp, if you just want swank it would be
22:41xeqi{:user {:plugins [[lein-swank "1.4.3"]]}}
22:42xeqioh, I think 1.4.4 is out
22:42JanxSpiritthank I'll give it a go - trying to get my emacs environment dialed in
22:43aduhmm, I ran 'lein install clojure-json' and got 'Wrong number of arguments to install task.'
22:43xeqiadu: using lein2?
22:43aduyes
22:43technomancyadu: why are you trying to install clojure-json?
22:43aduo wait 1.7.1
22:43adutechnomancy: I want to use it
22:44technomancyadu: two problems with that
22:44aduI've been using clojure for about 3 days now, still learning
22:44technomancysure, fair enough
22:44technomancyfirst it's not very good compared to cheshire
22:44technomancyand second, you just declare it in your project.clj file
22:44aduoh ok
22:44zawzeyHi, 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:44adutechnomancy: I have no idea how lein works
22:45technomancyadu: have you read `lein help tutorial`?
22:45technomancyif not start there
22:45aduI 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:45zawzeytechnomancy: didn't know lein has a tutorial, nice....
22:46zawzeyah found it, http://chasemerick.files.wordpress.com/2011/07/choosingtypeforms2.png
22:48zawzey0.
22:53TurnsThanks, zawzey, this looks great.
22:54cmajor7what's the latest and greatest XML parsing/creating clojure util?
22:54cmajor7I see "clojure.data.zip.xml", "clojure.xml"…
22:54aduhow do i get argv?
22:55zawzeyTurns: yeah credits goes to cemerick
22:55cmajor7maybe I can gen it with hiccup.. ? but then I need to parse it back it
22:56zawzeycmajor7: I haven't used any of those, but enlive works well for parsing on xml for my needs
22:57cmajor7zawzey: thx, let me check.. or creating & parsing ?
23:00zawzeycmajor7: enlive is only for parsing
23:00aduoic [& args]
23:00cmajor7I see.. "clojure.data.zip.xml" looks interesting (for both), but just wanted to see if anybody used it / has a better opinion
23:01brehautive used it i ithink
23:01brehautboth c.d.z.x and enlive are limited to a subset of xml though
23:01brehaut(roughly the same subset: things without namespaces)
23:02kennethhey 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:02brehautcmajor7: https://github.com/brehaut/necessary-evil/blob/master/src/necessary_evil/methodresponse.clj (also methodcal.clj and value.clj)
23:03kennethi'm getting a compile error (lein compile) on using [org.zmq Socket]; java.lang.ClassNotFoundException: org.zmq.Socket (log_scale.clj:1)
23:04talioshave you added the zeromq dependency to your lein project.clj?
23:04kennethyeah i think i did it correctly; here's what my project looks like https://gist.github.com/d18744cafa7df9527b0c
23:04brehautcmajor7: its parsing one of the dumbest XML formats in the wild though
23:06brehautkenneth: not related to your problem but your closing parens etc are non-idiomatic. bring them up to the end of the previous lines
23:06kennethbrehaut: i know, makes it easier to copy paste lines while i'm fucking around at this point
23:07talioskenneth - 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:07cmajor7brehaut: thx, I don't need much sophistication, but need to be able to work with USPS API which is XML in XML out..
23:08talioskenneth - mm, a google search tells me about org.zeromq.ZMQ.Socket tho - mm
23:08brehautcmajor7: 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:09cmajor7cool thx.
23:28aduhow do I read from a file?
23:29aduthis is what I'm doing: http://paste.lisp.org/display/130164
23:30aduand I get: "test.json"#<BufferedInputStream java.io.BufferedInputStream@6708f8e0>
23:31kennethjesus
23:31kennethi think at this point i've spent more time compiling zeromq than using it
23:31kennethin a month!
23:32adukenneth: do you know this lanugage?
23:33kennethadu: https://gist.github.com/1253f5c5800672324e38
23:33kennethline 29
23:34aduoh thanks
23:34kennethyou can read a file like that
23:34aduwhere does ->> come from?
23:35estebannkenneth: is pmap really faster than map in that context?
23:35kennethadu: macro makes code cleaner
23:36kennethadu: (->> (one two) (three four)) is equivalent to (three four (one two))
23:37aduis it builtin?
23:37kennethadu: for example (->> [1 2 3] (reduce +)) ;=> 4
23:37kennethfor big chains it's cleaner than nesting stuff
23:37kennether, my math is wrong, it's 6. </tired and drunk>
23:37adulooks monadic
23:38kennethestebann: probably not? idk, i wrote this 3 months ago, i don't remember the details :p
23:39estebannkenneth: gotcha... just curious
23:40amalloyadu: no, it's operating in a totally different arena than monads
23:40kennethtalios: uh, neither seem to work. this is killing me :/
23:41aduamalloy: I know, macros
23:41aduyey!
23:41adu(line-seq (reader filename)) worked
23:42amalloywhat 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:42aduamalloy: the first time I had seen that notation was 5 mins ago
23:42aduI've been using clojure for about 3 days total
23:42amalloywell, fair enough
23:44cemerickamalloy: down, boy ;-)
23:47amalloyindeed! sounds like he's doing pretty well
23:50aduok http://paste.lisp.org/display/130165 now I get: "test.json"("{\"hello\":\"world\"}"){"hello" "world"}
23:51aduhow do I get the "hello" entry from the json object?
23:57kennethadu: you're gonna have to parse the json
23:57aduI did
23:57adufound it: (get json "hello")
23:57adusweet
23:58brehautpresuming json is just a map, then (json "hello") would also work
23:58adureally?
23:59brehaut,({"hello" "world"} "hello")
23:59clojurebot"world"
23:59aduwow
23:59brehautworks for vectors and sets too
23:59adu,([1 2 3] 0)
23:59clojurebot1
23:59brehautthey are functions of their keys, indices and contents respectively