#clojure logs

2012-07-02

00:00xeqiwhen there is a project.clj, yes
00:09wingywhat is the recommended way to have something like rake
00:10wingywhere i add a task and can run it eg. to git save my project on github
00:10wingyis it to add a task to lein?
00:10wingyif so, is it a plugin i should write?
00:14uvtcwingy, afaik, when you install a lein plug-in, it adds that plug-in's task into the list of tasks you seen when running `lein help`.
00:15wingyuvtc: yeah .. i wonder if adding a plugin is right thing to do if i wanna add eg. lein git save and it will commit and save my project to github
00:15uvtcwingy, Ah. Sorry --- dunno. I use git manually, myself.
00:16uvtcWhat is proper github issue closing etiquette?
00:39justditI use read-line in repl and it works, but when it comes to launching from file the program expects input forever though I enter a line several times
00:39justditis there something specific that should be done to get it working?
00:45wingyhow should i run my ring/compojure app in heroku?
00:45wingywhat should be in Procfile?
00:46justditwingy: there's the docs on heroku, but shortly web: lein run -m <path.to.file>
00:46technomancywingy: this might help: https://devcenter.heroku.com/articles/clojure-web-application
00:48wingyhmm
00:49wingyin my file i have this line: (def app (handler/site main-routes))
00:49wingyand i run it with: lein ring server
00:49wingyin the heroku doc (and ring doc) they have:
00:49wingy(defn -main []
00:49wingy (let [port (Integer. (System/getenv "PORT"))]
00:49wingy (start port)))
00:49wingyand run it with: lein run -m <namespace>
00:50wingyi was following this guide: https://github.com/weavejester/compojure/wiki/Getting-Started
00:51wingyso the question is: should i follow the heroku guide or compojure guide and what is the diff between those "server start" lines?
00:52akhudekI prefer the heroku/ring way of starting the server
00:52wingyakhudek: from the compojure doc it says: This adds a bunch of commonly-used Ring middleware to your routes. Without this, you couldn't access cookies, or form parameters, or work with session variables.
00:53wingyok ill make it simple and just follow the heroku/ring guide
00:53akhudekthat's true, but you can easily wrap those things around your top level handler yourself
00:53wingyyeah
00:53wingyand know what is going on
00:53akhudekall lein-ring does is wrap your routes for you and starts a server in the same way as the heroku/ring doc is showing
00:54wingyright
00:54akhudekthe only difference is that you have less control over things
00:54wingyyeah hate that
00:54akhudekalso, for production use you are going to want to run either as a jar or a war file
00:55akhudeknot sure if lein-ring is compatible with either
00:55wingyok i delete lein-ring and keep it simple .. no magic
00:55wingythat is ruby .. in clojure its called simplicity :)
00:56technomancyakhudek: nah, you can use `lein trampoline run` in production since heroku's build process freezes your dependencies, you don't need to generate a jar file.
00:58akhudektechnomancy: I figured heroku might do something special (I don't know much about it), but was speaking for general use cases.
01:28wingythe -main function seems to be a fn to run from cli only using "lein run"?
01:28wingythat is, it shouldn't be used inside the program itself?
01:31brehautyou can use it from inside the program itself
01:31brehautits probably atypical to do so, but theres no real reason why you couldnt
01:32adumight be nice for a busybox clone
01:32justditwingy: it's the same function as others, but can be interpreted as a launch point as it's say in C
01:42wingyjustdit: this is because java is starting the main function as well?
01:43wingykinda cool to have a default fn to launch .. i guess there is no need for me to have different tasks like in jake/rake/cake/make
01:44wingyi can just have them in -main fns and run them with: lein run -m <namespace>
01:44wingyhm .. or perhaps its still better to have it as a lein plugin i think
01:45wingyso others can reuse
01:56wingyis there a better way to write this: (if (System/getenv "PORT") (System/getenv "PORT") nil)
01:57wingykeeping it DRY
01:58xumingmingv(if-let [xxx (System/getenv "PORT")] xxx nil)
02:00amalloyuh, unless System/getenv returns false, you can just write (System/getenv port)
02:01amalloyand xumingmingv, that's just a long way to write ##(doc or)
02:01lazybot⇒ "Macro ([] [x] [x & next]); Evaluates exprs one at a time, from left to right. If a form returns a logical true value, or returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expression. (or) returns nil."
02:01xumingmingvamalloy, ah yes...
02:02Sindikathello everyone! in Clojure arrow macro allows to convert (f1 (f2 (f3 x))) to (-> x f1 f2 f3). but what if one of the function requires multiple arguments? how to convert the sexp (f1 "a" (f2 (f3 x)))?
02:03amalloy(->> x (f3) (f2) (f1 "a"))
02:03Sindikatamalloy: what if these required args go after x like in (f1 (f2 (f3 x)) "a")?
02:03amalloyand the ordering in your premise is backwards
02:03Sindikatamalloy: oh yeah, my bad
02:04amalloy(-> x (f3) (f2) (f1 "a"))
02:17cljs_newb_0245it has been said: if you are not doing most of your clojurescript devel in a repl, then you are doing it wrong
02:17cljs_newb_0245I ahve built web apps on top of cljs
02:17cljs_newb_0245i still do not know how to use the cljs repl
02:17cljs_newb_0245is tehre a way to use the cljs repl w/o using clojurescript one?
02:17cljs_newb_0245I like my cljs/clojure webstack using ring/compojre
02:17cljs_newb_0245and I dont' want to use clojurescriptone
02:36justdithow can I make optional arguments of the function not to nest in each function? here the code http://pastebin.com/6nfa9XyJ
02:38wei_is there a multiple-binding version of if-let? e.g. (if-let [a (could-be-nil) b (could-also-be-nil a) (do-something))
02:39jhowarthHow can I get paredit to work for cljs files?
02:40jhowarthNevermind I figured it out, thanks.
02:40adujustdit: apply
02:41adujustdit: also, & isn't optional arguments, it's rest arguments
02:41justditadu: ok, but what about if there's also required args?
02:41aduapply should work
02:41adu(defn f [a b & rest] …)
02:42adu(f a b c d) is the same as (apply f a b '(c d))
02:43justditadu: thanks
02:43adujustdit: oops vector
02:44aduI'm too used to scheme
02:44justdithaha :)
02:44adu(apply f a b [c d])
03:59michaelr525good morning
03:59michaelr525!
04:27SrPxWhat does ~@something stands for
04:29clgvSrPx: unquote splicing - it inserts element from something as enumeration in the code
04:29SrPxhm? like (foo ~@'(a b c)) = (foo a b c) ?
04:30clgvexample: `(hash-map ~@[:a 1 :b 2]) will return (hash-map :a 1 :b 2)
04:30hyPiRionSrPx: yes.
04:30SrPxokay, thanks.
04:31clgv&`(hash-map ~@[:a 1 :b 2])
04:31lazybot⇒ (clojure.core/hash-map :a 1 :b 2)
04:31clgv&`(hash-map ~[:a 1 :b 2])
04:31lazybot⇒ (clojure.core/hash-map [:a 1 :b 2])
04:31SrPxAlso I'm on lein repl, just modified core.clj, and called (require 'mystuff.core) followed by (mystuff.core/main) but it displayed the old main. any idea why
04:31clgvSrPx: I think there is a :reload option
04:33hyPiRionSrPx: If you use Emacs, this one is good for customizing Emacs for Clojure: https://github.com/ftravers/PublicDocumentation/blob/master/clojure-development-setup.md
04:33clgvI have a question as well: from an inserted println I see that a namespace is loaded twice. there is a deftype in the namespace which is defined twice as well, so that I get a ClassCastException - how can that happen? how can I fix it?
04:33hyPiRionAlso solves the issue you currently got.
04:35SrPxhyPiRion: hm
04:35hyPiRionSrPx: Though I know there's some way of doing it without Emacs, but I'm not sure how to do it. I'd think it's possible to google it.
04:39SrPxhyPiRion: I wish I was aware of this before
04:39SrPxI've already spent a day trying to get emacs to work so I'm not coming back to that now
04:39SrPx);
04:39SrPxbut thanks
04:41hyPiRionSrPx: Ah, I know the feeling.
04:42SrPxhyPiRion: =(
04:43hyPiRionSrPx: Okay, so if you do (require :reload-all 'mystuff.core) you should reload the code.
04:44SrPxhyPiRion: thanks!
04:45SrPxon emacs this is automatic everytime you edit?
04:46SrPxhyPiRion: also do I have to type (whatever.core/myfunc) everytime? );
04:46hyPiRionSrPx: No, you have to do Control-c Control-k
04:46SrPxoh
04:47hyPiRionSrPx: You can use 'use' instead, which gives you the possibility to do (myfunc ...) directly.
04:47hyPiRione.g. (use 'whatever.core)
04:47SrPxthaanks hyPiRion
04:47hyPiRionYou're welcome. :)
04:52ro_sttechnomancy: help, please! i've just put all this into ~/.lein/profiles https://www.refheap.com/paste/3411
04:53ro_sti've run lein2 deps, and restarted my swank repl with clojure-jack-in
04:53ro_stbut now i'm not getting warn-on-reflection errors and i'm not able to use ring-serve either. does the emacs repl stuff use .lein/profiles.clj?
04:54ro_sti've confirmed that those props are set in the output of lein2 pprint
05:21AWizzArdBtw, deutschsprachige Clojure-Nutzer sind auch nach #Clojure.de eingeladen. Btw, german speaking clojure users are also invited to #Clojure.de
05:49ro_stanyone using ring-serve figured the 'org.mortbay.log.Logger classnotfound exception' issue out?
05:52stainhi
05:53stainI have an int that seems to turn into a long on every second time I run a test
05:53stainis this expected, and should I be able to force it somehow?
05:57ro_sthow do i ensure that org.mortbay.log.Logger is available to my clojure program?
07:05fbru02hi all , anoyone has used classes in clojure from a mvn project in eclipse ?
08:15hyPiRionfbru02: If you use Leiningen as a project manager, you can add dependencies from the maven repository without much/any work.
08:16fbru02hyPiRion: hi , thanks ! I want to add clojure to an existing mvn/eclipse project.... it builds ok with mvn command line but eclipse doesn't find out about the new classes that are using gen-class
08:16fbru02any ideas ?
08:17hyPiRionfbru02: Ah, so you want it the other way around. I'm afraid I'm of little help there, I've not used Maven at all.
08:17fbru02thanks anyway !
08:18hyPiRionHowever, I'm pretty sure there should be some tutorials or something if you google enough. Clojure itself uses maven, so there should be compability.
08:43nDufffbru02: Can't help you with the "in Eclipse" part, but otherwise, yes.
08:43nDufffbru02: which Maven plugin for Clojure are you using?
08:45fbru02nDuff: com.theorinpractice.clojure-maven-plugin:1.3.10
08:46stainmy g.. this is f..d up, the longs turn into ints and the ints into longs, and nothing is correct
08:46fbru02nDuff: question though : should I name my files like util.clj and the ns should be sth like (ns com.company.Util)
08:46nDufffbru02: ...so, the more actively maintained one is probably org.cloudhoist.plugin.zi, though I personally have had some issues with it.
08:46fbru02?
08:47nDufffbru02: I personally stick with all-lower-case in both places.
08:48stainI've not really seen camel case namespaces much in either Java nor clojure
08:48fbru02nDuff: thanks and then in java sth like : util myUtil = new util();
08:48fbru02?
08:49stainoh, this is to make Java classes in the end?
08:49fbru02stain: yes i need to call clj from java
08:52stainif the (implied) class is meant to be used by Java, then should you not rather use reify, gen-class or proxy?
08:52fbru02stain: i'm using gen-class, soryy i left that bit of info out
08:52hugodnDuff: what issues have you had with zi?
08:55mystiiqhey, has anyone lately used this library: https://github.com/ugglan/cljaws
08:58stainfbru02: oh, then I guess CamelCase is the cleanest. Just avoid having a noncamelcased duplicate, as it would fall apart in Windows.
08:58mystiiqI cloned that repo, ran repl and tried to go through those samples on that README but I get this error: Can't dynamically bind non-dynamic var: cljaws.core/*aws-id*
08:59stainmystiiq: that should just be a warning
09:01stainmystiiq: using Clojure 1.1.. due for a fork?
09:02mystiiqI'm using 1.4 because it cant find 1.1 from the repos
09:02nDuffhugod: Unable to find the mojo 'compile' (or one of its required components) in the plugin 'org.cloudhoist.plugin:zi' Could not locate clojure/plexus/compiler/impl__init.class or clojure/plexus/compiler/impl.clj on classpath:
09:06nDuffhugod: https://gist.github.com/2dd7f8243fed14e2ab25 has the full thing (including a classpath dump)
09:07hugodnDuff: anything particular (zi related) in you pom?
09:09nDuffhugod: Added a pom.xml fragment to the gist.
09:14nDuff...odd, since clojure/plexus/compiler/impl.clj is there in clojure-maven-plexus-compiler-0.3.2.jar, which is present in the classpath dump...
09:16bordatouehello guys, just wondering how to interpret clojure doc for example when it says (writer x & opts) how do I find out what the opts are ?
09:17bordatouehello
09:18bordatouewhy is that there is no response
09:18kmicusmall community in Europe
09:18bordatoueback from weekends
09:19kmicugive a link to that doc
09:20bordatouekmicu http://clojuredocs.org/clojure_core/clojure.java.io/writer
09:22bordatouekmicu: even if i print the documentation using ;(doc clojure.java.io/writer)
09:23bordatouehow do i know what the supported options are ? please
09:24bordatouekmicu: http://clojure.github.com/clojure/clojure.java.io-api.html#clojure.java.io/writer
09:25bordatouenDuff: can you please help me with my query
09:25kmicubordatoue: this is only wrapper for http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Writer.html
09:26cmiles74bordatoue: This was a hard one, the options are part of the protocol for the writer. The documentation is on the protocol, under IOFactory. http://clojure.github.com/clojure/clojure.java.io-api.html
09:26kmicuthe same options apply
09:27bordatouekmicu: okay, so is there any identification tag used to indicate a wrapper
09:27bordatouecmiles74: thanks
09:27cmiles74I think kmicu beat me to it. :P
09:28bordatouekmicu: many thanks, is there any way to distinguish between a wrapper
09:28kmicubordatoue: (defn ^Writer writer
09:28kmicu^Writer is a type
09:28bordatouekmicu: so that mean i need to search the source ,
09:29kmicuonly for this java interop methods
09:29bordatouekmicu: thanks anyway, i think i got the gist of it
09:32kmicubordatoue: it is better if you explain what is your goal ;)
09:36bordatouekmicu: goal is to comprehend clojure doc without any ambiguities
09:46dnolenbordatoue: looks like the docs for opts are lacking. submit a doc patch.
09:56hugodnDuff: I should have time to try and repro a little later - I'm wondering if it is related to clojure 1.4 vs 1.3
09:59nDuffhugod: Seems possible -- there was a bug in the 1.3.x line which pushed me to 1.4 early.
10:08mystiiqhow can I use classpath and library path at the same time?
10:26ScorchinAre there any decent Clojure Spidering libs, or basic "link checkers" that you know of?
10:45mystiiqwhat could this mean: Exception in thread "main" java.lang.IllegalArgumentException: No matching method found: getOrCreateBucket for class clojure.lang.Var$Unbound
10:46tbaldridgemystiiq: context? It looks like you're trying to use a deffe'd var that's never been given a value
10:46tbaldridge*def'ed
10:47tbaldridgeSomething like (do (def foo) (.getOrCreateBucket foo))
10:47mystiiqI'm trying to use https://github.com/ugglan/cljaws library and I just followed the examples in the README, I am using clojure 1.4.0 though
10:48kmicuScorchin: https://github.com/michaelklishin/crawlista ?
10:49Scorchinkmicu: thanks, I'll check it out
10:49nDuffmystiiq: Presumably that var is expected to be bound to something.
10:49mystiiqtbaldridge: here should be the problem somewhere: https://github.com/ugglan/cljaws/blob/master/src/cljaws/s3.clj#L30
10:49nDuffmystiiq: If the examples show wrapping your calls within something else that sets up context, that would explain it.
10:50tbaldridgeyeah, it looks like you might be missing the with-s3 macro?
10:52mystiiqokay, I got it working, yeah I forgot to restore it to (with-aws :s3 ...)
11:29edoloughlinAnyone have any idea why 'lein ring server' isn't calling the specified :ring/:handler? https://gist.github.com/3033784
11:31foxdonutedoloughlin: that should point to api instead of boot
11:35edoloughlinfoxdonut: oh, thanks.
11:36foxdonutwelcome
11:39edoloughlinOne thing: I do config/init and websockets/init to init my DB and websockets in 'boot'. Where should I do these?
11:40edoloughlinAlso: how do I specify a port other than 3000?
11:41edoloughlinAm I just running up against the lein ring convention - should I stop using it and just run as a normal app?
11:44duck1123edoloughlin: That's part of the reason I've stayed away from that plugin. Couldn't figure out how to do the init correctly
11:44edoloughlinOk. I'm not being stupid/lazy then...
11:45duck1123well, at the very least, you're not the only one being stupid/lazy
11:46duck1123I wonder if you could use decorate to wrap a fn that's only called once on startup to hook in your init? (not sure that's a good idea)
11:48TimMcRaynes: RefHeap broken? A paste URL I posted the other day now has something different...
11:49edoloughlinduck1123: I'm using a defonce in another part of my app to initialise email templates, which is definitely stupid AND lazy.
11:51duck1123In Ciste, I have definitializer, which allows you to specify code to be evaluated as soon as the config system is ready
11:51TimMcRaynes: I think the ID was re-used for a new paste.
11:53foxdonutedoloughlin: for different port you can just do "lein ring server 8080"
11:54achenghi all. quick clojure.repl/source question: it "requires that the symbol resolve to a Var defined in a namespace for which the .clj is in the classpath." my classpath includes directory src/ ... i have src/foo/bar.clj with namespace foo.bar where baz is def'd and has a docstring. (doc baz) shows the docstring. but (source baz) and (source foo.bar/baz) both say "Source not found". what should i do differently?
11:55S11001001acheng: what's (meta #'foo.bar/baz)
11:55edoloughlinfoxdonut: thanks. I didn't think to look beyond 'lein ring help' (it's not mentioned there)
11:55S11001001,(meta #'into)
11:55clojurebot{:ns #<Namespace clojure.core>, :name into, :arglists ([to from]), :added "1.0", :static true, ...}
11:56S11001001,(drop 5 (meta #'into))
11:56clojurebot([:doc "Returns a new coll consisting of to-coll with all of the items of\n from-coll conjoined."] [:line 6026] [:file "clojure/core.clj"])
11:56achengS11001001: it shows namespace name doc line and file
11:56foxdonutedoloughlin: for init just define a no-arg function and specify it in :init next to :handler
11:56S11001001are you using slime?
11:56achengi think so :)
11:56edoloughlinfoxdonut: Ok. Thanks.
11:57achengM-x clojure-jack-in
11:57S11001001acheng: stick point on symbol, press M-.
11:57achengS11001001: takes me to the definition in the source code
11:58duck1123acheng: try doing C-c C-k in that file to make sure it's loaded properly
11:58foxdonutedoloughlin: you're welcome. you (and duck1123) might want to look at https://github.com/weavejester/lein-ring/ before you just write it off :-)
11:58S11001001is that more or less useful than c.r/source?
11:59achengS11001001: that's pretty good. the user would have to go back to the repl if that's where he wanted to be. duck1123: after compiling still says source not found.
11:59duck1123foxdonut: the other reason I've written it off is because I use Aleph
12:00S11001001acheng: seems that savings from not typing out source call more than balances out
12:00achengS11001001: you're right
12:00S11001001you also get context of surrounding comments &c
12:01duck1123acheng: ok. I don't use the source macro much, I just know that if I don't send code via C-c C-k then I lose acurate line numbers
12:01achengS11001001: still bothers me a little that it doesn't yet work for me
12:01achengS11001001: like i'm driving my old vw golf again
12:02S11001001I would rather liken it to wondering where the stick is in an automatic
12:03achengS11001001: ah yeah. "how do i do that thing that takes more work?"
12:03foxdonutduck1123: fair enough, if you found a solution that suits your needs..
12:04achengS11001001: i hadn't realized that M-. worked at the repl and not only in a source buffer. nice.
12:22clgvwhat's the shortest approach to find out whether a given symbol occurs in a nested form?
12:24technomancyclgv: that could be the first legitimate use of flatten I've seen
12:25clgvtechnomancy: flatten + some?
12:25technomancyright
12:25technomancyI almost said flatten+member; what is up with my brain this morning?
12:25gfredericksdon't you mean create an atom and then use clojure.walk?
12:26technomancy=P
12:26gfredericksI've literally seen that done. Otherwise I doubt I could have thought of it.
12:27clgvtechnomancy: though I am not sure if I have to check nested map literals as well. but thats very unlikely
12:28technomancyclgv: you could use tree-seq if you need to be picky
12:29clgvwell the forms have to be some kind of calculations from integer to integer - so there shouldnt be maps
12:52clgvidentical? checks only for object reference equality, right?
12:52dnolenclgv: yes
12:54clgvthx
12:54S11001001,({1 2, 2 3, 3 42} 3) ; clgv :)
12:54clojurebot42
12:55clgvS11001001: erm, what?
12:55S11001001is partial function from integer to integer
12:57clgvS11001001: what do you want to tell me with that?
12:57clgvmy search question is solved by `(not-any? #{sym} (flatten expr))`
13:09TimMc&(`[~@`#()](+))
13:09lazybot⇒ fn*
13:10progodidn't know K was supported here :o
13:12technomancyyou are in the #clojure channel on irc.freenode.net
13:12cshellthanks!
13:12technomancyexits are to the north and east.
13:12foxdonutLOL
13:12technomancy(you are likely to be eaten by a grue?)
13:13foxdonut,'(pick up wallet)
13:13clojurebot(pick up wallet)
13:13foxdonut,'(go north)
13:13clojurebot(go north)
13:13llasramYou see here a set of matched braces and a lambda symbol (providing light)
13:13wkellyhaha
13:14foxdonutthe last exchange between S11001001 and clgv lost me, then TimMc added the utterly.
13:16clgvfoxdonut: I didn't get what S11001001 wanted to tell me either
13:18foxdonutS11001001 is now known as S201
13:19llasramfoxdonut: TimMc's comment makes more sense once you realize that also:
13:19llasram &(`[~@`#()](*))
13:19llasram&(`[~@`#()](*))
13:19lazybot⇒ []
13:21clgv;)
13:23foxdonutllasram: that made my brain hurt, but I get it now :) thx
13:24TimMcfoxdonut: Reopening an old experiment in writing Clojure without alphanumeric characters.
13:25TimMcThis will not go far without getting resolve or str.
13:25foxdonutTimMc: once of those obfuscated code exercises? or like writing a story without using the letter e?
13:25foxdonut*one of those
13:26TimMcTHe latter. Obfuscation is simply a byproduct.
13:27foxdonutinteresting.
13:28foxdonuttechnomancy: that reference to a text adventure game was a hoot!
13:30TimMc19:15 < gfrlog> all we have is ints, booleans, ratios, and infinite recursion
13:32TimMcOh, here we are: http://clojure-log.n01se.net/date/2011-04-06.html#19:04
13:32foxdonutTimMc: how about never using if?
13:33TimMcIdeally we'd get eval, then defmacro...
13:33foxdonuthttp://www.antiifcampaign.com/
13:34TimMcOh, I see.
13:48TimMc&(`[~@'`[]](+)) ;; I can get interesting symbols, but not their vars
13:48lazybot⇒ clojure.core/apply
13:57gfredericksTimMc: I said that up there?
13:57TimMcgfredericks: Yep! It was funny to look through the conversation and realize how much I'd forgotten of what I had figured out.
13:58gfredericksTimMc: what on earth was I talking about?
13:58gfrederickswait I just googled it
13:59gfredericksthat is such a weird ability
13:59gfredericksoh that was a fun conversation
14:00TimMcIf only ~'clojure.core/apply was a valid way to resolve a symbol...
14:00gfredericks&`@+
14:00lazybot⇒ (clojure.core/deref clojure.core/+)
14:01gfredericksokay back to work. Was just weirded out to see the word 'gfrlog'
14:01TimMcExcept it's a symbol, not a var. :-)
14:03gfredericks,'[<TimMc> Except it's a symbol, not a var. :-)]
14:03clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
14:04gfredericksaw crap
14:04gfredericksit was almost readable
14:12gfredericks,1 2 3
14:12clojurebot1
14:12gfredericks,1 2 3)
14:12clojurebot1
14:12TimMc&5 Yep, all this is ignored.
14:12lazybot⇒ 5
14:12gfredericks&1 2 3)
14:12lazybot⇒ 1
14:13TimMc&(read "1 2 3")
14:13lazybotjava.lang.ClassCastException: java.lang.String cannot be cast to java.io.PushbackReader
14:13TimMc&(read-string "1 2 3")
14:13lazybot⇒ 1
14:13gfredericksyeah
14:19goodieboyhas anyone used the amazon dynamodb client, "rotary"? https://github.com/weavejester/rotary
14:19goodieboyI'm attempting to create a table, but only get a null pointer exception
14:24baoistHow would one go about dealing with optional arguments and recursion? (e.g.) I would be getting [& args] to be (a b c) ((b c)) (((c))) when I use (rest args)
14:26TimMcThe issue being that 'apply can't be used with 'recur?
14:27baoistTimMc: No, I just use (foo a b c) and with every recursion it will put it in another list
14:27TimMcOh, you're not using recur? Then (apply foo ...)
14:28TimMcThat will unwrap the restargs before sending them in.
14:28baoistTimMc: oh, gotcha.
14:28baoistThanks
14:28TimMcbaoist: Oh, and I was wrong... recur plays well with restargs after all.
14:29TimMc&((fn f [c & args] (if (seq args) (recur (inc c) (rest args)) c)) 0 'a 'b 'c)
14:29lazybot⇒ 3
14:29baoistwell yeah, I do that, but after the first run-through it's no longer b and c, it's (b c)
14:31baoistso I would call (foo a b c), and it will just continue to put it in another list, by the end it would be ((( c ))). If it would let me get that far without throwing an error
14:31TimMcbaoist: Right, (apply foo ...)
14:31baoistokay, great.
14:31baoistthanks much :D
14:32TimMcbaoist: And you can't just use recur here?
14:32TimMcYou're not recursing from the tail position?
14:32baoistI am
14:32baoistbut it continues to wrap (rest args) in another list with every recur run
14:33TimMc&((fn f [accum & args] (if (seq args) (recur (conj accum args) (rest args)) accum)) [] 'a 'b 'c) ;; works for me...
14:33lazybot⇒ [(a b c) (b c) (c)]
14:39baoisthuh, interesting. I must be doing something terribly not right. I'll look into this
14:45wingycool that you can connect through the repl to your app's env
14:46wingythis didn't seem possible on node.js
14:46wingyand manipulate your app on the fly
14:47dnolen_wingy: it's possible tho not as natural since Node.js code tends to be wrapped in closures to avoid collisions in the global context.
14:49wingyi c
15:17antares_Raynes: hey
15:21CheironHi, would you please have a look at http://pastie.org/4188934 ?
15:21Raynesantares_: ?
15:22Cheironany idiomatic way to achieve that?
15:23CheironI can embed a let form inside for form, but it is idiomatic?
15:24antares_Cheiron: for has the :let key, also there is nothing wrong with using let inside for
15:24antares_Raynes: how do you like monger?
15:25antares_Raynes: I fixed all the issues I could find that are in Clojure. The JS ones will take more time.
15:25Cheironantares_: I'm waiting for fortecass :) (hope I spelled it right)
15:25antares_cassaforte?
15:26Raynesantares_: I found an issue last night that I haven't fixed yet.
15:26fentonðð
15:26antares_yeah, it is very close to having most useful features but somehow prepared statements do not work with cassandra 1.1 :(
15:26Cheironyes, cassaforte. sorry :)
15:26Raynesantares_: Try creating two private pastes. They'll both have the same id, which is also your user id. Somewhere ids are getting mixed up, but I'm not sure where.
15:26RaynesYou don't have to fix that though. I'll get to it soon.
15:26antares_as soon as I figure out why, it will be trivial to add all the key operations on top of CQL and prepared statements
15:27Cheironcassandra 1.1.2 is just out of the oven
15:27antares_Raynes: well, there are like 3 ids in a document, I wasn't sure which one is for what
15:27antares_Cheiron: I tried master for like 3 hours on Saturday. I guess I need to read the source to understand what I may be doing wrong. Cassandra complains about ?s in the query :/
15:28antares_the ticket for prepared statements was closed in December last year
15:28Cheironantares_: regarding the :let modifier. I have to place it after all the binding i did in for form?
15:29Raynesantares_: The user id should have been called 'user'.
15:29RaynesAt least, that's usually how I did it I think.
15:29Raynespaste-id, IIRC, is the id you see in the URL when you visit a paste. If it is a number, then it is the same as 'id'.
15:30antares_Raynes: ok
15:35antares_Cheiron: see the 3rd example here: http://clojuredocs.org/clojure_core/clojure.core/for
15:41Cheironthank you
15:44arohnerdoes anyone have experience w/ JGroups?
15:44arohneri.e. would you recommend it for clojure + ec2?
16:06mindbendertechnomancy: it seems clojure-jack-in can't locate the swank specific slime and slime-repl that's why I'm getting void-function for slime-output-buffer
16:09zerokarmaleftmindbender: what version of swank-clojure do you have installed?
16:13mindbenderzerokarmaleft: I'm using lein2 so I added lein-swank 1.4.0 to profiles.clj
16:14zerokarmaleftmindbender: update to 1.4.4, that sounds similar to a problem i had a couple weeks ago
16:15foxdonutwow, if you go on amazon, select books and search for "closure", it actually says "Did you mean: clojure"
16:16pisketti_:D
16:20pipelinefoxdonut: i called a bookstore and had a long conversation on that subject
16:20pipeline"yes the author had a sense of humor"
16:22technomancyunlike google who take common terms and don't even change the spelling
16:34duck11231What do you mean you can't find relevant content for "go"
16:42foxdonutpipeline: the author of what?
16:43pipelinefoxdonut: the clojure language
16:44mindbenderzerokarmaleft: thanks 1.4.4 got me near, but now I have cygwin interferring with byte compilation by inserting stuff into path to compile, I suppose you are not using cygwin.
16:45zerokarmaleftmindbender: sorry no, i'm not
16:45qubit[01]is VirtualBox an option for you mindbender ?
16:45ForSparePartsI asked this in here once quite a while ago, but: do any of you know of a way (probably a macro?) to do an "inline let" with an imperative-style syntax? Like: http://pastebin.com/Ei5Lhv72
16:45mindbendernot really
16:46ForSparePartsObviously, it would still be invalid to redefine a in that example after you give it a value -- I'm not trying to break functional programming, just tweak syntax.
16:47mindbenderzerokarmaleft: I have run clojure-jack-in successfully on Ubuntu. i'm using windows for now to work
16:47tbaldridgemindbender: I'm sorry
16:47brehautForSpareParts: just use a let; for side effecting only stuff, just use _ as the LHS of the binding pair. ugly things should be ugly
16:48mindbendertbaldridge: thaks
16:48mindbendererr: thanks
16:48achengForSpareParts: i do the same as brehaut for web tests that have many steps that change the browser
16:49foxdonutpipeline: so you were talking to the bookstore person about the spelling of "clojure" ?
16:49ForSparePartsbrehaut, Wasn't really thinking of side-effect only stuff. Rather, I was imagining scenarios where it only really makes sense for something to have scope starting in the middle of the function -- let seems sort of over-the-top ugly, for that.
16:50ForSparePartsWould that really be such bad practice?
16:50brehautwhat do you mean 'has scope starting in the middle of the function'?
16:50pipelinefoxdonut: yes
16:51amalloyForSpareParts: no offense, but that's a bit ridiculous. let is for introducing scopes; it's not ugly or over the top. if you want some new variables in scope, use a let
16:52ForSparePartsbrehaut, I guess I probably mean "the standard use case for a let" -- I'm not trying to start a fight or anything, I just think it's easier to read and edit my code when I'm not starting new blocks all the time. Maybe I'm not writing my functions properly?
16:53foxdonutpipeline: that's funny
16:53brehautForSpareParts: i am guessing that you are doing something funny then.
16:53amalloyhaving new blocks all the time is a visual hallmark of the functional style
16:54amalloyit helps if you stop thinking of them as "blocks", because there's no such thing as statements and blocks of statements; just expressions nested inside expressions
16:54foxdonuthear here amalloy
16:54brehautForSpareParts: without actually seeing some of your code, i could say for sure, but it sounds like if you are creating lots of functions with many lets inside them that you are doing something unussual.
16:54ForSparePartsamalloy, That makes sense. I'm just thinking about how convenient it was to have the <- syntax in Haskell's do blocks. It made for nice, simple shorthand.
16:56amalloywell, that's fair enough. haskell flattens out your monadic code; clojure flattens out some of your lets and list-comprehensions
16:56brehautForSpareParts: using do inplace of a let in haskell is extraordinarily ugly too
16:57ForSparePartsamalloy, Would it be terribly... un-Clojurey to try to have both?
16:57foxdonutthe do blocks in haskell made me the feel the same way about veggie hot dogs; why go all pure and against procedural code only to end up with something that looks exactly like it?
16:57brehautfoxdonut: because sometime you have to write procedural code?
16:58foxdonutbrehaut: you're right. I just like clojure's approach better.
16:58amalloyForSpareParts: have you read On Lisp?
16:59amalloyi'm assuming not; there's a relevant excerpt at https://gist.github.com/ec2f11312dbae9f26224
16:59ForSparePartsfoxdonut, I only used Haskell a little bit, for a class, but I found that sometimes it was just easier to *think* about alogrithms if I broke them down into steps. Even if I'm not writing crazy, state-mutating code, it helps to be able to think "first this, then that, then the other thing"
16:59ForSparePartsamalloy, I have not. I'll look at that.
17:01brehautForSpareParts: are you tending to write long functions or short functions in most of your code?
17:01foxdonutForSpareParts: I agree, for the "first this then that" part I like to use ->
17:01foxdonutbut the pieces in the chain after -> are all functions.. similar to | on the command line
17:02ForSparePartsbrehaut, They feel long to me, in Clojure code. But I don't know how they'd stack up (and I don't have any samples handy)
17:03ForSparePartsfoxdonut, Hm. That looks interesting, I haven't seen it before (super noob, here). Not what I'm used to exactly, but it might do...
17:04foxdonutForSpareParts: you might like it. it's like (<other> (<then> (<first> x))) but instead is (-> x first then other)
17:05ForSparePartsfoxdonut, Definitely cool. What if I'm looking to reuse old results, though? Like if I calculate a number and then want to add it to two separate values for different purposes?
17:06gtrakis there a simple shortcut for seqofvectors->csv?
17:06amalloyuse a let, dude
17:06brehautForSpareParts: let ;)
17:06foxdonutwhat they said :)
17:07hyPiRiongtrak: you mean like ##(clojure.string/join ";" [1 2 3])
17:07lazybot⇒ "1;2;3"
17:07gtraksuppose so
17:07gtrakjust wonder if anyone's done it before I reinvent it :-)
17:07foxdonut(let [tuce tomates n mayo] (Double. "cheeseburger"))
17:08TimMc:-D
17:08TimMcgfredericks: Any thoughts on how to do "if" in alphanumerics-less Clojure?
17:09TimMcgfredericks: Or really, any lazy evaluation?
17:11uvtccemerick, in the Clojure Programming book, p 147 (maze example, `maze` function --- btw, a real mind-bender, thank you!), was there any reason `when-let` was used instead of `if-let`?
17:11uvtcMy understanding is that you would only use when-let if you wanted an implicit `do`.
17:15cemerickuvtc: when is equivalent to an if with no then form. If the condition isn't logically true, then nil is returned. Using when (or when-let in this case) is an explicit hint to the reader (of any code) that nil is the value of the form when the conditional isn't logically true.
17:16TimMc,(#(% [% (+ (*)(*)(*)(*)(*))]) #(if (= (% (*)) (+)) (*) (* ((% (+)) [(% (+)) (- (% (*)) (*))]) (% (*)))))
17:16clojurebot120
17:16technomancyuvtc: it's a hotly-contested controversy, but you are correct.
17:16cemerickOtherwise, you have (if condition (foo)), which would make a careful reader wonder if someone just forgot the 'then' form.
17:17technomancycemerick: you're arguing that making `if`'s third argument optional was a design mistake?
17:18uvtccemerick, Thanks!
17:18TimMc&(#(%[%(+(*)(*)(*)(*)(*)(*)(*))])#(if(=(%(*))(+))(*)(*((%(+))[(%(+))(-(%(*))(*))])(%(*)))))
17:18lazybot⇒ 5040
17:18cemericktechnomancy: I'd say so, yeah.
17:18TimMcSo close! Just need to get rid of that "if".
17:18gfredericksTimMc: why do you need ifs to generate numbers?
17:18technomancythat's ... interesting
17:18TimMcWell, I wanted to write facetorial, you see.
17:19TimMcfactorial, even
17:19uvtc(seems like the doc for `when-let` should mention (1) that there's an implicit `do`, and (2) that it evaluates to nil when the thing you're binding is falsey.
17:19cemerick,(doc when-let)
17:19clojurebot"([bindings & body]); bindings => binding-form test When test is true, evaluates body with binding-form bound to the value of test"
17:19hyPiRionTimMc: Is that a y-combinator in disguise?
17:19gfredericksTimMc: oh, I just saw your question
17:19technomancyuvtc: I'd argue that relying on the return value of when or when-let is a mistake
17:19gfredericksTimMc: one thing I know is that if can be emulated with a map
17:20cemericktechnomancy: are they going to return 42 or something?
17:20gfredericksTimMc: or a vector!
17:20TimMchyPiRion: Maaaaybe. :-)
17:20TimMcgfredericks: No good, lookups are eager.
17:20gfredericksTimMc: wat?
17:20technomancywell, not a mistake, but a smell
17:20uvtctechnomancy, inneresting food for thought. Thanks.
17:20TimMcWell, it's a recursive function, innit?
17:20cemerick"If else is not supplied it defaults to nil." — http://clojure.org/special_forms#if *shrug*
17:20gfredericksTimMc: if you can make your conditional return 0 or 1, you can emulate an if
17:21TimMcI remain unconvinced. You're going to get a stack overflow that way.
17:21TimMchttps://gist.github.com/3035760 for the expanded code, btw.
17:22technomancyuvtc: IMO it's crazy for seeing a 2-arg if to make you wonder if the author forgot a clause
17:22gfredericksTimMc: can the conditional be transformed to return 0/1?
17:23amalloytechnomancy: when i see a 2-arg if i wonder if the author forgot a clause or just hates me. but i'm aware that there are people who feel the same way about seeing a single-expression when-body
17:23cemerickI've always considered it good form to put an else form in other languages with a comment like "left intentionally empty" if it is so.
17:23TimMcgfredericks: Sure, but it's gonna be bad.
17:24gfredericksTimMc: so then replace #(if foo bar baz) with #([#(bar) #(baz)] numeric-foo)
17:24TimMcI'll use a map.
17:24gfrederickso_O?
17:24clojurebotreverse psychology is even less rigorous than forward psychology
17:24cemerick*Actually*, there was a bug in nREPL that trptcolin caught where I had written (if conditional then), but was missing the else. :-P
17:25TimMcgfredericks: THe args to the lookup are going to be evaluated first, meaning BOOM stack overflow.
17:25TimMcIf I could get a lazy seq...
17:26TimMc(if (= a b) c d) can be written ({a c} b d), but only for non-recursive c and d.
17:27amalloyTimMc: i think you're missing gfredericks's point. just use closures to get laziness
17:27technomancycemerick: ok, but for that to be your first thought when you see it would only make sense if there was consensus on the topic
17:27TimMcamalloy: Oh! Thanks.
17:27gfredericksokay so I'm not crazy?
17:27TimMcStill trouble, since I can't nest #().
17:27gfredericksoh fark
17:27amalloyTimMc: you don't have to
17:27gfredericksyeah I guess I was doing that
17:27cemericktechnomancy: hah, until a few minutes ago, I thought there was :-)
17:28technomancywell there you go =)
17:28amalloycemerick: technomancy's camp is in the minority, but exists
17:28gfredericksamalloy: what can we do to eliminate them?
17:28cemerickI shall continue to act in blatant disregard of the minority.
17:28TimMcMore args, eh?
17:28gfrederickscan we assume technomancy is their leader?
17:29gfredericksTimMc: ah yeah that should work
17:29TimMchurk
17:30TimMcMaybe I can write a macro to convert things to alphanumeric-less style. :-P
17:30technomancythere are plenty of places where I question the design of certain built-in Clojure functions, but `if` is not one of them.
17:30gfredericksso ((#({a %1} b %2) #(c) #(d)))
17:30amalloy(#(% #(%2 %3)) a b c) => (#(%1 %2) a (#(%1 %2) b c)), or something close to that
17:30TimMc%2 isn't an option
17:30gfredericksoh fark again
17:30gfredericksTHIS IS HARD
17:30TimMcEverything has to be a unary function.
17:30amalloyoh. well then curry that for me :P
17:30TimMcYou can build up a nice vector of fns and args and then dereference it.
17:31gfredericksTimMc: are you building up a code-transformer for this?
17:31gfredericksit begs to be automated
17:32gfrederickswe can't ever create locals can we? :/
17:32TimMcHmmm, %& would remove the need for unary fns, but dereferencing it requires vec'ing.
17:34seanmDoes anyone have a moment to help me w/ getting some awesome clojure-mode/swank stuff workin' ?
17:34TimMc&(#(+ (`[~@%&] (+(*)(*))) (*)) 10 20 30 40 50)
17:34lazybot⇒ 31
17:34seanmOn a fresh emacs install with clojure-mode I'm getting these entries in messages https://gist.github.com/743e0fe8b44b75630a9e
17:34seanmseems like something's not quite lined up
17:34gfredericksTimMc: nice
17:35TimMcNot wirth it,
17:35gfredericksdo we know if it's turing complete yet?
17:35qubit[01]yall use clojars ?
17:35gfredericksqubit[01]: yes
17:35hyPiRionGuys, I thought we were going away from perl-like syntax.
17:36qubit[01]yes please
17:36TimMcgfredericks: Seems Turing-complete. I can pass fns around, yeah? Once you get that it's probably all good.
17:36gfredericksI guess that has to be true
17:36gfredericksno wait
17:36gfredericksin lambda calc you get locals
17:37gfredericksyou have to have
17:37gfrederickslambda (x) -> lambda (y) -> x
17:37gfrederickscan we do that?
17:38TimMcSure. In Clojure-minus-AN, fns just have to be given everything as args.
17:39gfrederickswe can simulate closures with arguments?
17:39amalloygfredericks: clojure simulates closures with arguments :P
17:39TimMcI... think so?
17:39TimMcJust convey everything explicitly.
17:40hyPiRionWell.
17:40hyPiRion(let [a b c d] ...) => ((fn [a c] ..) b d)
17:40gfredericksTimMc: so can you create something that acts like (fn [x] (fn [y] x))?
17:41gfredericksamalloy: unary arguments? :P :P
17:41TimMcgfredericks: We have n-ary.
17:41TimMcIt's just ugly, or simulated with argvecs.
17:41gfredericksoooh right
17:41gfredericksthat might do it
17:42gfredericksit's like reverse-lambda calc. We simulate currying through multi-arity functions :)
17:42TimMchaha
17:43gfredericksso if you see a function that has a free variable, you convert it to an additional argument
17:44gfrederickssweet we have unlimited locals now
17:44TimMcThat would seem to be the only way.
17:44gfredericksTimMc: truely you are a pioneer
17:44augustlis there a canonical JSON parser and writer for clojure?
17:45gfredericksaugustl: there is one for people who care about performance and another for people who like their libs to have "clojure" and "json" in the name
17:45technomancyhaha
17:45brainproxyaugustl: have you looked at cheshire?
17:45llasramWeren't all the data.json performance problems fixed?
17:45treehug`augustl, probably clojure.data.json
17:45gfredericksllasram: I wouldn't know
17:45augustlgfredericks: jackson? :)
17:46augustlbrainproxy, treehug` looking those up, thanks
17:46gfredericksaugustl: I was referring to cheshire and clojure.data.json
17:46augustlI see
17:47amalloyTimMc: you could hang out in #()
17:47llasramI haven't seen comparisons between cheshire and data.json, but data.json got a ~10x speed-up about 9 months ago
17:47llasramHttps://groups.google.com/d/topic/clojure/gOrDeQ9bxl4/discussion
17:47S11001001,'#()
17:47clojurebot(fn* [] ())
17:48technomancyllasram: pretty sure all the 10x speedups possible from jackson happened years ago
17:48llasramhaha
17:48Raynesamalloy, TimMc: Hahaha, I and some friends created that channel like 5 years ago and used to hang out in it.
17:48RaynesI kid you not.
17:48gfrederickstechnomancy: next step -- quantum json parsing
17:48amalloyi know, dude
17:48gfredericksRaynes: wait how old were you then?
17:48llasramOk, ok, there are benefits to leveraging existing well-tested/-supported JVM libraries
17:48amalloyi spent some time in there before #sexpbot existed
17:49Raynesgfredericks: 5 years younger than I am now, assuming it actually was 5 years ago.
17:49llasrambut directly deserializing into Clojure data structures is nice
17:49gfredericksso 14?
17:49Raynesgfredericks: Think that'd make me 13.
17:49gfredericksit's really weird to think that I have a "Rayne's Age" register in my brain somewhere
17:49Raynesamalloy: Oh yeah, I guess you did.
17:50gfredericksRaynes: you have had a physical effect on me
17:50llasramtechnomancy: Oh, BTW, the uberjar'd data_readers.clj error I'd mentioned a while ago (it just now working at all, vs just not having sane merge behavior) turned out to be Yet Another Hadoop Issue
17:50amalloyhe hears that a lot
17:50RaynesI have that effect on fredericks.
17:50CheironHi, any body knows why I'm getting this when trying to bootstrap clojurescript? http://pastie.org/4170908
17:51treehug`Cheiron, tried removing the zip file and trying again?
17:51Cheironyes
17:52treehug`Cheiron, do you know where it downloads that from?
17:53Cheirondon't know really. I cloned clojurescript and tried to bootstrap it
17:53Cheironit supposed to get it from Google Code?
17:53dakronellasram: if you are curious about the speed, check out cheshire.test.benchmark (spoiler: cheshire is still faster)
17:54treehug`Cheiron, the one i have has sha1sum 4fac42c4921db7f97bdf672f71613a4a4b1f8c50
17:54dnolen_Cheiron: hmm, someone else metioned this before, but the url we're curling definitely exists and works.
17:54Cheironit looks that I'm having a problem when downloading it from google code
17:57llasramdakrone: Oh, cool beans. Thanks for the pointer!
18:03solussd_what exactly happens when I assoc a new key with a record that doesn't exist in the defrecord type?
18:04S11001001you keep record type and it gets stuck on the map
18:04S11001001you lose record type if you dissoc a key that's part of the type
18:05solussd_S11001001: what, if any, are the performance implications of adding a key?
18:05S11001001normal map assoc cost plus a record copy
18:05solussd_hmm.. how does it add a key to the record/map though? Aren't record fields Class ivars?
18:06S11001001generic map field
18:06TimMc,(#({} % 5) 8)
18:07clojurebot5
18:07TimMcgfredericks: ^ constant fn
18:07gfredericksTimMc: nice
18:09emezeskeCheiron: Do you have a specific reason to use the clojurescript compiler directly? If not you might have an easier time with https://github.com/emezeske/lein-cljsbuild (disclosure: I am the author)
18:12TimMc&(#((% (+(*))) %) [(+ (*)(*)(*)(*)(*)(*)(*)) #(({(+) (% (+(*)(*)))} (% (+)) (% (+(*)(*)(*)))) %) #({} % (+(*))) #(* ((% (+(*))) [(- (% (+)) (+(*))) (% (+(*))) (% (+(*)(*))) (% (+(*)(*)(*)))]) (% (+)))])
18:12lazybot⇒ 5040
18:12Cheironemezeske: will have a look at it
18:12Cheironthank you :)
18:13TimMc...and I'm done.
18:13TimMcamalloy: Damn, this could have been a 4clojure question. :-)
18:13augustlthis last line is quite intensive.. Any suggestions for improvements? http://pastie.org/4189686
18:14treehugemezeske: nice work on cljsbuild - can't imagine messing with the cljs command directly
18:14amalloy(-> (handler request) (update-in [:body] json-render) (assoc-in [:headers "Content-Type"] "application/json"))
18:14brehautaugustl: assoc-in ?
18:15brehautor that
18:15augustlit turns {} or {:headers {}} into {:headers {"Content-Type" "application/json"}}
18:15augustloh, nice
18:15emezesketreehug: Thanks!
18:16Raynesaugustl: https://github.com/noir-clojure/lib-noir/blob/master/src/noir/response.clj#L30
18:16pdkok
18:16pdk3rd time's a charm so
18:16pdkany idea why this piece of code would fail to compile throwing a null pointer exception on line 17? http://pastebin.com/RJaLUGp1
18:17amalloyi'm guilty of writing that before myself, but you should just use one that someone else wrote, augustl (like Raynes's link)
18:17augustlah I forgot how the threading macro automatically inserts the 1st argument for lists
18:17augustlRaynes: not using noir ;)
18:17Rayneslib-noir != noir
18:17RaynesIt is standalone.
18:18RaynesAnyways, this might not be useful to you anyways.
18:18RaynesIt isn't middleware.
18:18RaynesHowever, I'd love to see a pull request adding that middleware.
18:18augustlah, nice
18:18RaynesTo noir.util.middleware.
18:19hiredmanpdk: there is no :where
18:19hyPiRiononly :when
18:19pdkoh that figures
18:19pdki was staring at it for a couple days wondering why
18:19pdkcause it throws the error on the line that defines i in that doseq as opposed to the :where
18:20pdkWELP mystery solved and it compiles
18:20pdkhere i thought i was holding the COMPILER BUG SCANDAL OF THE CENTURY
18:21augustlare there any writeups on combining .clj and .java? I'm writing a HTTP API that will index and query Lucene, thought I'd might as well write the Lucene stuff with pure Java. I'm new to JVM stuff so I'm basically looking for best practices for a hybrid project I think.
18:21augustlalternatively, convince me I should use java interop and write the lucene stuff in clojure :)
18:22technomancyhttps://github.com/weavejester/clucy
18:22augustlwell well now
18:23amalloytechnomancy: i was just thinking about your desire to have (filter coll) be equivalent to (filter identity coll). i've previously been in favor, but doesn't that make it harder to read in a context-free way? that is, when i see `(filter (foo)`, i can't know whether foo is a function or a collection until i check whether there's something after it
18:23pdkbest practices for a hybrid project is basically "what gets the job done"
18:23augustla convincing argument for doing it all in Clojure then :) Even if I won't use that library, the code for it seems sensible etc.
18:23technomancyamalloy: that's the one drawback; I hate it when optional args aren't at the end of the arglist
18:23augustlpdk: I'm mostly curious how to set up leiningen, how to "link" things, etc
18:24technomancyaugustl: usually setting :java-source-paths in project.clj is all it takes
18:24hyPiRionaugustl: To answer your question though, in a leiningen project it's just adding a :java-source-paths option in project.clj
18:24augustltechnomancy: oh, that was simple. Then I suppose I just follow the traditional package name folders etc?
18:24technomancyjinx
18:24augustls/simple/easy/
18:24hyPiRionbummer.
18:24technomancyaugustl: I guess; I don't know the Java Programming Language™ myself
18:24augustl:)
18:25hyPiRionaugustl: yes.
18:25augustlI'm dangerously close to using Clojure at work now \o/
18:27solussd_anyone here use monger? Wondering what the point of the monger.result namespace is if any error throws an exception
18:28zelliowhat did clojure.contirb/cond-let get replaced with? if anything
18:28zellioor was it let-cond
18:28zellio...
18:28technomancyamalloy: in general confusion is less likely with a maximum of 2 args, but on the other hand filter is everywhere... I dunno.
18:29amalloytechnomancy: i almost feel like i'd rather require filter have exactly two args, and overload keep instead, since nobody really uses keep as it is
18:29technomancyI could go for that
18:30technomancyI was hoping to see it on every? and take-while too though
18:31amalloyyeah, i know
18:37zellionevermind that will work
18:42jweissanyone use slimv here? trying to set a coworker up with it, and it seems to be completely haywire - repl fires up fine, i can eval and all that, but tab completion dumps text into the repl buffer and it just stays there, screwing up my input.
18:42aperiodici use it, but i'm certainly not a pro and haven't run into that particular issue before
18:43jweissaperiodic: when you do tab completion, where do the completions show up?
18:43jweiss(or just type a function call, it shows the arguments)
18:43augustlI'd like to write automated tests for my HTTP api by spinning up a server and assert on actual HTTP requests. Any suggestions for how to do that?
18:44jweissfor me they show up on the line beneath where i'm typing in the repl, and they keep building up, and never go away
18:44augustlall I know about testing is "lein test" which automatically runs the tests themselves. I suppose performing HTTP requests is easy. So the only hard part is starting (and stopping) the server I suppose.
18:45aperiodicjweiss: the tab completion disambig shows up in a little menu like one would expect; docs and fn arity descriptions show up in a pane on the bottom of the vim window
18:47jweissaperiodic: huh, ok that is what i thought should happen. doesn't work that way for me. i must be missing soemthing.
18:47aperiodicjweiss: well, docs show up in a pane, fn arities are in the status/cmd line
18:48jweissaperiodic: and this is plain vim, not gvim, right?
18:48aperiodicjweiss: yup
18:48aperiodicjweiss: maybe try slimv in a clean vim setup (no other plugins)?
18:49jweissaperiodic: i never used vim before, so it was clean
18:49jweissAFAIK
18:49aperiodichuh
18:49technomancyaugustl: https://github.com/xeqi/kerodon
18:49technomancyit won't start an actual HTTP server, but it's just as good for most cases and much simpler
18:50augustltechnomancy: the reason I want an actual HTTP server is 1) I've had issues with mocks being too dissimilar to the actual stuff (Rack in Ruby) and 2) I can change how I implement my API without changing the tests
18:50technomancythat's really not a problem with ring
18:50augustlkerodon seems really awesome though, but mostly for web pages, not APIs
18:52augustltechnomancy: is it possible to add global before-run and after-run hooks to "lein test"? Or perhaps I could make my own test runner in the form of a lein plugin?
18:52aperiodicjweiss: you could also try stealing the vim setup from my dotfiles (https://github.com/aperiodic/dotfiles)
18:52augustltechnomancy: I'll just read the docs, nvm :)
18:52technomancyaugustl: if you're going to do something like that you should use clojure.test fixtures
18:52technomancybut you shouldn't really do that; just work at the ring level
18:53technomancyif you can't trust ring you can't trust anything
18:53weavejestertechnomancy: Can I quote you on that? :)
18:54augustlit rhymes too :D
18:54technomancyweavejester: I expect to see it on all your flyers and promotional mailings from here on out
18:55jweissaperiodic: so you are happy with slimv, you don't find it horribly buggy? just making sure it's my setup that is busted
18:55jweisswill try your dotfiles
18:55weavejestertechnomancy: Let's not push it ;)
18:56aperiodicjweiss: oh, i might be misunderstanding your problem. I never type directly in the REPL buffer, I only eval stuff from the file(s) I'm working on
18:57augustltechnomancy: do I have to package stuff into a plugin to leverage hooks? Or can I have project-local plugins/hooks without a separate project?
18:57technomancyweavejester: ever since my Joy of Cooking joke made it onto the back of the Joy of Clojure I guess I've had my expectations inflated.
18:58technomancyaugustl: if you want the server it in a separate process from the tests, it should go in a lein plugin; otherwise it should be used as a library integrated into your tests
18:59aperiodicjweiss: the REPL buffer does do a few odd things if I type in it directly, but not what you describe
18:59augustltechnomancy: and a lein plugin means publishing it on the interwebs, etc?
18:59technomancyright
19:00weavejesterI wonder if trying to cover the basics of Ring and Compojure in a 40 minute presentation means I'll go too fast...
19:00weavejesterI'm tempted to cut out some slides
19:00technomancyweavejester: where?
19:01weavejestertechnomancy: I've been talked into a presentation that's tomorrow :)
19:02technomancywhat's the audience?
19:02weavejestertechnomancy: Varied. Likely everyone knows at least a bit of Clojure. Some will have used Ring, others won't.
19:03augustlweavejester: for me, the coolest part of ring and compojure is that it's in Clojure.. So if I were to hold a presentation like that, I'd show off neat clojure tricks.
19:03weavejesteraugustl: Well, it's more an explanation of the technology behind it
19:04technomancyI'd focus on the fact that everything is a function. I recently had to tie together two separate defroutes invocations and I really appreciated the fact that it was as simple as (sub/app req) to delegate it off
19:04technomancyI don't think you can do that with stuff like noir, so it's where compojure really shines.
19:05pendlepantsanyone know how to update the version of clojure being used by 'lein repl'? I'm on leiningen 1.7.1, and it's using clojure 1.2.1 when I run 'lein repl'
19:05augustlweavejester: like the bindings to the JVM stack etc?
19:05brehautalso: parametric route definitions
19:05weavejestertechnomancy: That's actually pretty much the theme of the talk
19:05technomancyexcellent =)
19:05technomancypendlepants: run `lein repl` in a project
19:05weavejestertechnomancy: I explain Ring, then show how middleware is just higher order functions, then show how Compojure is made up of cascading handlers
19:05brehautweavejester: i think that would be a great intro, and totally achievable
19:06pendlepantsthanks technomancy.
19:06augustlweavejester: what technomancy said, I nerdgasmd when I realized that "dynamic" routing was as simple as this http://pastie.org/4189931
19:06akhudektechnomancy: that's my main complaint with noir. It seems to tie things together in a way that loses flexability.
19:06weavejesterThen the last bit will talk about structure - how to use group together routes so you can apply middleware or a context to a subset
19:06technomancyweavejester: drawbridge might be a nice demo of the flexibility of the HOF approach
19:08weavejestertechnomancy: I don't think I have too much space for that
19:08weavejestertechnomancy: But it's a good idea to include in a future talk
19:09weavejestertechnomancy: I want to do something that compares classic MVC with a more functional approach… but that's a later presentation.
19:12technomancyyeah, definitely
19:12lynaghkweavejester: please record a screencast of that talk, if you're going to put it together.
19:12adulein is magic
19:12lynaghkweavejester: that's something I've been very interested in lately.
19:13weavejesterlynaghk: Skillsmatter is usually pretty quick to upload videos of talks
19:13weavejesterlynaghk: And if not, I'll record a version myself :)
19:13lynaghkweavejester: I'll keep my eyes posted on it. Do you have an event where you're giving the MVC/FUN talk? Or it's just on the agenda?
19:14weavejesterI should have time to do that when I finish up my notice period and leave my current job
19:14weavejesterlynaghk: No, that's just an idea I want to do
19:15technomancyweavejester: where are you going?
19:15weavejestertechnomancy: The plan is to be 50% working on my own projects, 50% contracting
19:16weavejestertechnomancy: I haven't actually had time to really use the libraries I've written, which I really really want to do :)
19:16technomancygood luck!
19:16lynaghkweavejester: you have any interest in doing cljs stuff?
19:16xeqiaugustl: my peridot library is less html specific, but still stays within ring
19:16technomancyI know what you mean about getting out of touch with real-world usage patterns.
19:17weavejestertechnomancy: Thanks!
19:17xeqiaugustl: I think cemerick's friend has some tests that spin up jetty and use a clojure http library
19:17weavejesterlynaghk: I'm planning to use cljs heavily in a web app I've been intending to write.
19:18lynaghkweavejester: web app = lil' product of some kind?
19:18lynaghk(or big product.)
19:18weavejesterlynaghk: That's the idea
19:19weavejesterI want to do some experiments with communication protocols
19:20wingywhy isn't the shell/code in datomic using clojure
19:23augustlxeqi: is that open sourced and available somewhere?
19:24xeqiaugustl: https://github.com/xeqi/peridot or https://github.com/cemerick/friend/blob/master/test/test_friend/functional.clj ?
19:27augustlxeqi: so cemerik's friend wasn't a person, but a project :)
19:28xeqiaugustl: there is also https://github.com/semperos/clj-webdriver/ but not sure if you can just get the http requests from it
19:29augustlxeqi: very useful, thanks
19:29xeqi.. he might have some friends too
19:48augustlxeqi: having the fixture in a separate file is proving to be quite the challenge :)
19:48augustlnamely, starting at port 0 (read: get port assigned from OS) and somehow passing that port number onto the tests
19:51gfredericksglobal variables to the rescue!
19:53augustlyay, `declare` to the rescue
19:53augustlgfredericks: thanks :)
19:54gfredericksaugustl: oh any time
19:54augustlit's a shame clojure.test doesn't allow passing of arguments to test functions
19:54augustlthat's my real problem I suppose
19:55augustlthat is, a fixture for my tests creates a value the tests need to know about
19:55gfredericks:(
19:56augustlthe fixture API is kind of weird..
19:59gfredericksI think it's pretty straightforward with the exception of what you've already pointed out
20:34zippy314Hi, I've just updated an old clojurescript project to use cljsbuild, but now when when I launch my webapp, the javascript console complains that it can not find my files i.e. "goog.require could not find: myproj.core" Has anybody had any trouble updating to use cljsbuild?
20:35dnolenzippy314: are you compiling to a single file? i.e. using at least :whitespace optimizations?
20:35zippy314yep
20:36dnolenzippy314: are you using goog.require on your index.html page?
20:38dnolengetting warmer on cKanren ... can run basic constraints now.
20:39zippy314dnolen: yes, here's a clip from the html: http://pastie.org/4190263
20:41emezeskezippy314: does your directory structure match the namespace structure in your clojurescript files?
20:47zippy314emezeske: not sure what you mean. do you mean the directory structure of the javascript files in my htdocs?
20:48emezeskezippy314: Sorry, I mean is a file with e.g. (ns a.b.c) in .../a/b/c.cljs as opposed to just .../c.cljs ?
20:49wingyanyone here having experience with datomic using clojure?
20:49zippy314emezeske: no, actuall all the files are in a "src" directory, but have a namespace "ss.X" where x is the filename.
20:49zippy314emezeske: so I should rename that from src, to ss?
20:50dnolenwingy: a little.
20:51wingyit seems that clojure is not prioritized in the doc atm
20:51wingythere is an API for clojure but not much more
20:52dnolenwingy: it's not, though there are a lot of examples in the datomic directory, and lots of examples on the datomic mailing list.
20:52emezeskezippy314: You don't want to rename it; just create a subdir like src/ss/X.cljs
20:53wingydnolen: ok found some examples in the directory and online
20:54wingydo you know how to start up the shell for clojure?
20:54dnolenwingy: you don't need to start up a shell, just connect directly.
20:54wingyi mean a repl env where i can test out different commands like in java
20:55wingyoh
20:55wingyi see
20:57wingydnolen: eg. i wanna run this in the repl: https://gist.github.com/3036704
20:57wingybut how do i let "lein repl" know where datomic.api namespace is located
20:58dnolenwingy: put the datomic jar on the classpath
20:58dnolenwingy: by making datomic a project dependency.
20:59dnolenwingy: https://gist.github.com/3036709
21:00zippy314emezeske: I did that, and now I'm getting an stack overflow error when compiling one of my files, which it did't do before! (http://pastie.org/4190337)
21:08wingydnolen: it says jar cant be found
21:08wingythis one: [com.datomic/datomic "0.1.3099"]
21:08wingyi have to set up a private repo?
21:10emezeskezippy314: hmm, lein-cljsbuild is using [org.clojure/clojurescript "0.0-1424"] at the moment, is that the same as what you used before?
21:11emezeskezippy314: also, are there any symlinks or anything, in your directory structure?
21:13dnolenwingy: oh, I probably installed it locally.
21:13dnolenwingy: datomic readme in folder has instructions
21:14zippy314emezeske: here's what's weird, I just re-cloned clojurescript directly from github, and did the compilation manually: ".bin/cljsc ss/ > ss.js" and then moved the resultin ss.js file and out directory to the right places and it worked! But I'd much prefer to be using cljsbuild.
21:15emezeskezippy314: Well, that's just because lein-cljsbuild won't actually build stuff unless the output mtime is less than that of all the input files
21:15zippy314emezeske: I was doing a cljsbuild clean each time...
21:16emezeskezippy314: I mean, that's the reason that moving ss.js to the right places made things work
21:16wingydnolen: the README says i have to install it to a local maven repo .. that is a must?
21:16zippy314emezeske: but why would I be getting a stackoverflow durring compilation?
21:17dnolenwingy: if you want lein to work w/o copying the datomic.jar everywhere - yes
21:17emezeskezippy314: That's why I was asking about symlinks. Obviously somewhere there's an infinite loop happening
21:17zippy314emezeske: no symlinks
21:18emezeskezippy314: any cyclic dependencies?
21:18zippy314emezeske: maybe, I'm hunting for that now...
21:18emezeskezippy314: you've hit a very strange problem :)
21:19zippy314emezeske: your telling me!! :-)
21:22wingydnolen: i rather note maintain a maven repo .. i added datomic-0.1.3164.jar to my resources/ folder .. and according to the class path that folder is added
21:23wingybut when i run: (use '[datomic.api :only [q db] :as d])
21:23wingyit still cant find it
21:23wingyany idea what the issue is?
21:23dnolenwingy: why not, you're maintaining them by using lein
21:24dnolenwingy: lein works over maven
21:25zippy314emezeske: ok, here's something weird. When I restore the files to their original configuration (i.e. not inside the ss directory to match the ns) and I run cljsbuild, I just noticed that it gives me this error message: http://pastie.org/4190434
21:26TimMcRaynes: Clojail doesn't allow defn, yeah?
21:26zippy314emezeske: but it actually does complie everything.
21:27TimMcRaynes: I'm thinking of writing a sandboxer that whitelists a large number of core fns and macros and checks that only certain namespaces and vars are used.
21:27zippy314emezeske: and puts the ss.js file and the out files in the right places, they just don't work! And of course this is really odd to me because compiling it the manual way does work and does not complain about a circular reference!
21:28RaynesTimMc: Clojail can allow defn. Just depends on what tester you sue. lazybot doesn't allow it, but tryclj does.
21:28Raynesuse*
21:28TimMcCan it allow ns?
21:28Raynesns?
21:28clojurebotns is unfortunately more complicated than it needs to be, but http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns may be helpful.
21:29wingydnolen: ok that worked well .. just a oneliner :)
21:29TimMcI need something that can safe-require entire .clj files and call fns in them.
21:29dnolenwingy: ;)
21:29dnolenwingy: have fun, datomic is neato.
21:30wingyyeah .. converting from neo4j :)
21:30RaynesTimMc: You can use require in the sandbox.
21:31TimMcRaynes: OK, close enough. I can preprocess any (ns ...) stuff out.
21:31RaynesTimMc: Regarding whitelists, you can probably add support for whitelists to clojail.
21:31TimMcRaynes: The use-case is a server where people can submit bots to play a game against each other.
21:32RaynesI'd strongly recommend not writing your own sandboxer and just trying to make clojail work.
21:32RaynesYou'll want to kill yourself if you don't.
21:32TimMcheh
21:32RaynesI'll happily except patches to add features/functionality that doesn't completely change how clojail works (as in, keeps compatibility with existing code).
21:33TimMcSweet.
21:33TimMcI'm going to propose adding whitelists at the next baznex meetup.
21:34RaynesCool
21:36TimMcRaynes: Clojail just inspects the post-expansion syntax, yeah?
21:41TimMcI was pondering writing something that looks at pre-expansion syntax instead, and forces it to conform to a language subset.
21:43emezeskezippy314: You've got me!
21:45emezeskezippy314: All I can say is that you definitely want the dir structure to match the ns. I'm not sure why the compiler works without that; it seems accidental
21:49kovasb_emezeske: hey i have a q about cljsbuild
21:51kovasb_emezeske: i'm trying to define my own tagged literals in cljs. seems that i need to change the value of cljs.tagged-literals/*cljs-data-readers* when cljsbuild does its work
22:41frozenlockIs there a recursive merge? Say I have {:a {:b {:c 2}}} and {:a {:d 2 :b {:z 3}}}, I would like to obtain {:a {:d 2 :b {:c 2 :z 3}}}.
22:44wingyit feels far better to use clojure than java for datomic .. they have to create the queries in strings whereas in clojure you just use the regular data structures
22:44TimMcfrozenlock: merge-with and a function that calls merge-with, perhaps
22:45frozenlockI found http://clojure.github.com/clojure-contrib/map-utils-api.html, but I was hoping for something in .core :(
22:45wingypretty awkward for a java dev: http://www.datomic.com/company/resources/data-structure-literals
22:45wingybut perhaps they are used to it
22:45dnolenwingy: probably.
22:46TimMcfrozenlock: When keys collide, are the vals always both/neither maps?
22:47TimMcAnd how do you resolve conflicts on non-map collisions?
22:47frozenlockTimMc: yes, the merge will be with 2 identical datastructure
22:48TimMc&((fn f [a b] (if (and (map? a) (map? b)) (merge-with f a b) (throw (Exception.)))) {:a {:b {:c 2}}} {:a {:d 2 :b {:z 3}}})
22:48lazybot⇒ {:a {:d 2, :b {:z 3, :c 2}}}
22:49frozenlockOh! Clever!
22:49frozenlockThanks :)
22:50frozenlockI especially like the throw error part; I could easily forget about that
22:50TimMcYou could also just leave it out if you're really sure of yourself. :-P
22:50frozenlockWith time I learned to never trust myself :P
22:51TimMcHeh, good on you. :-)
22:51TimMcNow I'm trying to figure out how to convey path information down into that error message.
22:52TimMcI guess you can't, since merge-with doesn't tell you what key is in conflict.
22:53TimMcIt's not a hard function to replace, of course.
22:53frozenlockLet's rewrite Clojure!
22:53frozenlockWhen I'm done rewriting Emacs, of course
22:53brehautin clojure!
22:54frozenlockEmacs in clojure could be interesting...
22:54frozenlockEmacs (in clojure (in clojure)) would be terrific :)
22:55xeqiTimMc: I'm interested in you're bot game, is it going to be public?
22:55TimMcfrozenlock: Emacs in Emacs.
22:56TimMcxeqi: The code is in a public repo: https://github.com/baznex/crosscram/
22:56TimMctmciver: Crap, I forgot you had a pull request!
22:57frozenlockTimMc: I would like that. I hate it when I want to read the source of a function and it simply says "C source code"
22:57brehauti wish it said [madness ensues!] instead
22:58amalloy[Here there be dragons]
22:59brehaut[ia! ia! cthulhu ftaghn]
23:00amalloyfrozenlock: you might like useful.utils/adjoin, which is related to the deep-merge you seem to be trying to do
23:00amalloyit deals with sets and vectors in a reasonably-sensible, although not inarguably-correct, way
23:12emezeskekovasb_: there's no way to do that without modifying lein-cljsbuild, if that's your question
23:12emezeskekovasb_: I see that you just forked it, so I take it that you figured that out :)
23:12kovasb_emezeske: yup :)
23:12kovasb_should be easy right
23:12kovasb_;)
23:12emezeskeyeah
23:14TimMcxeqi: Are you in the Boston area by any chance?
23:14kovasb_i think i just need to modify run-compiler to require and run the needed code
23:14TimMcxeqi: If so, you should come to the next baznex meetup. :-)
23:14emezeskekovasb_: sounds right
23:15kovasb_great. now i just need to create the needed code.
23:20wingywhat is the difference between vector and tuple?
23:21brehauti dont think there is a standard tuple type in clojure? hiredman has one in his github i think?
23:21brehautmost clojure code uses vectors as both vectors and tuples
23:21wingybrehaut: no i keep hearing about tuples all the time so i wonder what that is
23:21wingybut what is the difference?
23:21frozenlock&,(keyword 2)
23:21lazybot⇒ nil
23:21brehautwell a tuple is a heterogeneous collection of a fixed size
23:22frozenlock...
23:22brehautwingy: s an n-tuple where 2=2 is a pair, n=3 is a triple
23:22frozenlockI want :2, not nil -_-
23:22brehaut&(-> 2 str keyword)
23:22lazybot⇒ :2
23:23frozenlockThanks. So you _have_ to convert it to a string beforehand?
23:23brehautappears to be the case
23:23wingy2-tuple is [[1 2][1 2]]?
23:23brehautno, a 2-tuple is [1 "two"]
23:24brehautwell, your example could be a 2-tuple as well
23:24wingy3-tuple is [1 2 3]?
23:24brehautyes
23:25wingyso that is kinda like arrays in other langs?
23:25brehautno
23:25brehautits most like a record in an SQL database
23:25xeqiTimMc: nope, but thanks for the invite
23:25wingyok
23:26brehautor if you are used to javascript, arguments (the magic local variable in functions) is a tuple of the arguments to the function
23:26friowingy: in practical terms, tuples are of a set length - a 2-tuple will always be 2 items long
23:26frioand they're probably immutable
23:26TimMcAnd you don't "conj onto" a tuple, either. You just build one or take it apart.
23:26friowhen you're using them though, their APIs generally match those of a list :)
23:27TimMcWell, maybe that depends on the language.
23:27brehauta common example is returning multiple things from a function
23:27frio(other than the fact that yeah, you can't add elements etc. onto them)
23:27friofor sure TimMc
23:27frioim thinking of python, where a list is [1, 2] and a tuple is (1, 2)
23:28frioaside from the fact the tuple is immutable, you can still do stuff like (1, 2)[0] to get the first element, etc.
23:28brehautfrio: in python a tuple is also a value type (it can be hashed) where a list isnt
23:28friomm brehaut
23:30brehautwingy: its kinda easy to over thing a tuple; its mostly a bunch of different things side by side
23:31wingytuple is an abstract term and not necessarily a specific data type?
23:31brehautright
23:31wingymeaning: 1. fixed length 2. immutable
23:31brehautand potentially heterogeneous
23:31frioits a mathematical concept :)
23:31wingyi c
23:32wingyin clojure we use vector as a tuple?
23:32brehautyup
23:32wingywhat about a list?
23:32brehautlists have O(n) access by index
23:32brehautmakes them a poor candidate
23:33brehautwhereas vectors are O(effectively 1)
23:33wingydont know what you did there .. but yeah lists have no indexes
23:33friolists are indexed
23:34brehauteh‽
23:34friooh
23:34friodw
23:34frioi see what you mean :)
23:34friobrain-fart
23:35brehautwingy: it means if you want to get the 5th item of a list, you have to walk past the first 4 to get it
23:35brehautwhereas a vector you can just go straight to the 5th item
23:37wingyyepp
23:43amalloybrehaut: tuples are small enough that a list's O(n) would be acceptable
23:44amalloybut they're more convenient, plus you might as well be fast
23:44amalloy"they" [vectors] are ..."
23:44amalloyjesus i'm just a mess. forget i tried to participate
23:47xumingmi_join #clojure-cn
23:47Farehi!
23:48FareI'm trying to standardize a "collections" / "containers" / however-you-call-it library for common lisp.
23:48FareI'd like to have the opinion of clojure people
23:48Fareyou seem to have interfaces already and collections libraries
23:49Farewhere is the docs, what do you like / dislike about it, what were the interesting tradeoffs you made?