2011-09-07
| 00:00 | technomancy | user317_: I think this is in the faq with lein help readme |
| 00:02 | user317_ | technomancy: thanks for the help, i am totally new to java and related technologies |
| 00:04 | user317_ | so far it sucks less then most things :) |
| 00:04 | technomancy | I'm quoting you on that |
| 00:05 | brehaut | its sad that thats a glowing endorsement for a software ecosystem :P |
| 00:06 | user317_ | hehe |
| 00:22 | user317_ | does the pattern match module work on functions that take more then 1 argument? |
| 00:25 | dnolen | user317_: are you talking about match? |
| 00:26 | user317_ | yea |
| 00:26 | dnolen | user317_: match doesn't yet provide any sugar for creating fns that pattern match. |
| 00:27 | user317_ | dnolen: ok, thanks |
| 01:15 | user317_ | is there anyway to reload the libraries from repl? |
| 01:17 | brehaut | (use :reload 'lib-name) |
| 01:17 | brehaut | works with require too |
| 01:17 | brehaut | and :reload-all is also handy |
| 01:57 | user317_ | how do i run the :test tests that are defined in the function metadata? |
| 01:57 | user317_ | cake test doesn't seem to run them |
| 04:04 | tsdh | Is there no automatic promotion from numbers to bignums in clojure 1.3? |
| 04:05 | tsdh | (+ Long/MAX_VALUE 1) throws an ArithmeticException "integer overflow" in 1.3, while in 1.2 you got an BigInteger... |
| 04:09 | raek | tsdh: you can use the +' function instead, which does promotion |
| 04:09 | tsdh | Yes, thanks. I've just found the relevant git log entry. :-) |
| 04:11 | tsdh | Strange that I didn't encounter that earlier. The entry is from June 2010... |
| 04:56 | kzar | I was thinking of porting this little PHP script to Clojure, couldn't think how to structure it though. It provides a class that lets you step through a hex string in bits and bytes, taking care of shifting. Thing is you don't normally have a class with mutable state in Clojure right? So how do you keep track of the position and spare bits? https://github.com/kzar/bit-ratchet |
| 04:58 | ilyak | kzar: You should return a fn |
| 04:58 | ilyak | or maybe a lazy seq |
| 04:58 | ilyak | what does that class methods do? |
| 04:58 | clgv | +1 for lazy seq |
| 04:59 | kzar | ilyak: It let's you do things like take 3 bits, take a couple of bytes, skip, jump to a certain position, take some of the actual ascii hex |
| 04:59 | ilyak | but in case of your api it's complicated |
| 04:59 | ilyak | yeah, I see |
| 05:00 | ilyak | I think that it's okay to make an object with a mutable state if you clearly need e.g. jumps |
| 05:00 | clgv | hmm maybe a protocol + deftype combo with mutable state if you need it. |
| 05:00 | ilyak | After all, bit fiddling is pretty low level |
| 05:03 | ilyak | So if I were you I'd implement it as a straight port with mutable state and then try and see if you can make it easier and better |
| 05:03 | ilyak | for example, you might find yourself routinely chaining calls, and then you might it work like |
| 05:04 | ilyak | (br :read 4 :read-ascii 2 :jump 0) returning the last thing retrieved |
| 05:04 | ilyak | maybe not |
| 05:04 | clgv | kzar: the problem is your current implementation's semantic is to return something and advance the internal state, that wont playout well with immutable datastructures. but you could change semantics to "peek( n-bits )" "pop( n-bits )" |
| 05:05 | kzar | clgv: Say I do that, and I peek 3 bits how do I keep track of the spare 5 bits for next time? |
| 05:06 | clgv | kzar: example? otherwise I'd say: same way as in php |
| 05:08 | kzar | clgv: OK, well example would be "F" string, if you read 3 bits of it you've got a spare 5 to worry about next time |
| 05:09 | clgv | kzar: my suggestion is to define (defprotocol IBitRatchet (peek [this, n]) (pop [this, n])) where pop will return a new IBitRatchet instance that only contains the spare bits |
| 05:09 | clgv | kzar: another option is to use a clojure over an atom |
| 05:09 | clgv | s/clojure/closure// |
| 05:10 | kzar | clgv: Ah right I see, so each time you read further it's really returning a whole new object instead of changing the state in the current one |
| 05:10 | clgv | right |
| 05:10 | kzar | clgv: Not slow? |
| 05:16 | clgv | kzar: the closure approach could look like ##(let [bit-racket (fn [data] (let [d (atom data)] (fn [n] (let [f (first data)] (swap! data rest) f))) |
| 05:17 | clgv | lazybot: what's up? |
| 05:17 | clgv | &(let [bit-racket (fn [data] (let [d (atom data)] (fn [n] (let [f (first data)] (swap! data rest) f))) |
| 05:17 | lazybot | ⇒ nil ; Adjusted to (let [bit-racket (fn [data] (let [d (atom data)] (fn [n] (let [f (first data)] (swap! data rest) f))))]) |
| 05:17 | clgv | &(let [bit-racket (fn [data] (let [d (atom data)] (fn [n] (let [r (take n @d)] (swap! d #(drop n %)) r)))), b (bit-racket "ABCDEFG")] (println (b 2)) (println (b 1)) (println (b 4)) (println (b 5))) |
| 05:17 | lazybot | ⇒ (A B) (C) (D E F G) () nil |
| 05:20 | clgv | kzar: in the closure approach you have to compose your interpretation functions with reading one defined above, e.g. (signed (b 1)) or (unsigned (b 3)) |
| 06:43 | khaliG | are the snapshot jars with the build date in the filename made by hand or is there is a way to do that using lein? |
| 06:48 | clgv | khaliG: I only know that I do it via abuding the version-data in defproject |
| 06:48 | clgv | *abusing |
| 06:48 | khaliG | clgv, ah trickery |
| 06:49 | clgv | khaliG: the good thing is that this part of defproject gets evaluated - not like the key-value-pairs where the values are taken literally |
| 06:56 | khaliG | clgv, if it's not too much trouble could i ask to see it? |
| 06:57 | clgv | khaliG: just write (defproject AntColonyOptimization (my-version-string) ...) and define (defn my-version-string ...) in front of it |
| 06:57 | clgv | lol |
| 06:57 | clgv | replace it with your projectname^^ |
| 06:57 | khaliG | haha okay |
| 06:58 | clgv | I also determine the git branch name in my version and add it^^ |
| 06:58 | khaliG | nice |
| 07:01 | clgv | it's quite easy with clojure.contrib.shell-out |
| 07:22 | raek | khaliG: the build date is added automatically by lein for SNAPSHOT versions |
| 07:23 | raek | but you probably need to do something like what clgv said if you need something more sophisticated |
| 07:24 | raek | clgv: the key-value parts can be evaluated too if you put a ~ in front of it |
| 07:24 | clgv | raek: oh ok. didn't know that |
| 07:25 | khaliG | raek, good to know. i have snapshot in my project.clj file, so i'll take a closer look to see what's up since i'm not getting the dates |
| 07:25 | raek | or maybe it's clojars that adds them |
| 07:25 | clgv | the parameter with the unquote is literally put into the inside syntaxquote? |
| 07:26 | raek | dunno. it is possible that it is handled manually by the defproject macro |
| 07:27 | khaliG | i can't even remember how i installed lein but i've got version 1.4.2 installed and i see the latest is 1.6.2 |
| 07:27 | raek | ,(read-string "~foo") |
| 07:27 | clojurebot | (clojure.core/unquote foo) |
| 07:28 | raek | khaliG: the date is probably appended by clojars when you push a new snapshot version |
| 07:28 | khaliG | ah |
| 07:28 | raek | I don't know if the local maven repo (lein install) does the same thing |
| 07:29 | raek | khaliG: also, "lein upgrade" |
| 07:29 | khaliG | raek, cool i just ran it :) |
| 07:37 | clgv | lein even works good on windows but without "lein upgrade" ... I only noticed that the windows filesystem file naming rules limit clojure's naming conventions |
| 07:38 | clgv | definitions with the same name but in caps collide there^^ |
| 07:38 | clgv | I had that in my DSL definition |
| 07:39 | raek | which things in clojure was affected? |
| 07:39 | raek | namespace names? |
| 07:42 | clgv | macro-/function-names |
| 07:48 | ambrosebs | ,(fn a) |
| 07:48 | clojurebot | #<sandbox$eval4295$a__4296 sandbox$eval4295$a__4296@1414c92> |
| 07:49 | ambrosebs | ,(fn) |
| 07:49 | clojurebot | #<sandbox$eval4323$fn__4324 sandbox$eval4323$fn__4324@18dbeeb> |
| 07:49 | ambrosebs | would it be wrong for those cases to throw an exception? |
| 07:57 | clgv | ambrosebs: same for defn - (defn f) with the neat result of: (meta #'f) => {:ns #<Namespace user>, :name f, :file "NO_SOURCE_PATH", :line 21, :arglists (nil)} |
| 07:58 | clgv | so actually you can never call that function^^ |
| 07:58 | clgv | since your arg list is always false |
| 07:58 | ambrosebs | im working on error msgs for defn + fn, i've already got a nice "Parameter declaration is missing" exception, but is it a breaking change? |
| 07:59 | pyr | i see leiningen has a dev-resources-path option |
| 07:59 | pyr | i just wonder what characterizes as "dev" in leiningen's opinion |
| 07:59 | ambrosebs | AFAICT (fn a) is undefined behavior |
| 08:00 | pyr | i.e: is lein repl dev, is lein run ? |
| 08:00 | clgv | ambrosebs: could be defined to a "nil constant", i.e. function without args returning nil always |
| 08:00 | clgv | but an error would be better I guess |
| 08:00 | manutter | ambrosebs: I'd say it's an undefined behavior, the correct syntax for fn without args is (fn [] ...) |
| 08:00 | manutter | an error makes perfect sense to me |
| 08:01 | ambrosebs | my thinking also |
| 08:01 | manutter | granted I'm way down at the beginner end of the clojure pool, so my opinion probably doesn't count for much ;) |
| 08:02 | clgv | I saw that clojure master now has a Counted interface to mark those collections that provide O(1) access to the number of their objects |
| 08:02 | clgv | good move^^ I stumbled into the O(n) trap with vectors earlier |
| 08:02 | ambrosebs | manutter: me too, don't worry :) |
| 08:03 | clgv | ah well not count. meant last ^^ |
| 08:03 | clgv | humm ok have to change if that is changed as well |
| 09:06 | solussd | are :each test fixtures run sequentially on each test? |
| 09:11 | joegallo | you only get one each fixture, and one once fixture |
| 09:12 | joegallo | i mean, you can stuff as much in those two individually as you'd like, and then, yes, those are run sequentially |
| 09:12 | joegallo | but yeah, multiple (use-fixtures :each ...) expressions would be a no-no. |
| 09:34 | khaliG | is there way to get the methods of an interface from the repl? |
| 09:35 | manutter | ,(javadoc IRunnable) |
| 09:35 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: javadoc in this context, compiling:(NO_SOURCE_PATH:0)> |
| 09:36 | manutter | *snap* |
| 09:38 | joegallo | khaliG: clojure.contrib.repl-utils/show |
| 09:41 | mprentice | joegallo: neat |
| 09:41 | khaliG | joegallo, thanks .. do you have that added to your project.clj so it's always handy? |
| 09:42 | joegallo | that's one way to do it |
| 09:43 | joegallo | (can't really think of any other way atm, though...) |
| 09:43 | khaliG | cool |
| 09:49 | fliebel | &java.util.concurrent.ForkJoinPool |
| 09:49 | lazybot | java.lang.ClassNotFoundException: java.util.concurrent.ForkJoinPool |
| 09:51 | clgv | fliebel: no java 7 I guess;) |
| 09:52 | fliebel | clgv: Meh, works locally. I wonder what it would take to get that branch anywhere. |
| 09:52 | clgv | fliebel: you got java 7 or the forkjoin jar locally then ;) |
| 09:53 | fliebel | 7 ;) |
| 09:53 | clgv | I didn't dare to install java 7 yet ;) |
| 09:53 | manutter | heh, that's what VirtualBox is for... :) |
| 09:53 | khaliG | dumb question feel free to ignore.. but i'd like to translate a snippet of clj code to java src code |
| 09:54 | manutter | khaliG: you'll have to port it by hand, the clojure compiler writes directly to java byte code without any java intermediary code |
| 09:54 | khaliG | manutter, ah ok, forget it then *grin* |
| 09:55 | fliebel | khaliG: You coud try ClojureScript. It has braces at leats... |
| 09:55 | khaliG | i wrote some swing code for someone in clj, but he doesnt know clj - nothing important |
| 09:56 | michaelr525 | you can dissasmble the byte code to java ;) |
| 09:56 | clgv | khaliG: just compile a jar for him to use ;) |
| 09:56 | clgv | khaliG: and wrap your code in a defprotocol ;) |
| 09:57 | khaliG | haha it was to illustrate how to do some swing thing .. a jar wont show him how :) |
| 09:58 | khaliG | michaelr525, lol i might try that just to see |
| 09:58 | fliebel | khaliG: That's how you accomplish stuff in Java, download jars. |
| 09:58 | khaliG | true that ;) |
| 09:59 | jweiss | is there a simple way to print fns and java objects with pr such that they can be read back in with "read"? (I don't mean that i get the same object back, just something readable) |
| 09:59 | jweiss | #<blah$blah> can't be read |
| 10:02 | manutter | jweiss: I'm going to guess "No" -- pretty sure Java objects can't and real sure functions can't. |
| 10:03 | jweiss | manutter: i know it can be done using the print-method multimethod, i am just trying to figure out something "readable" to print about these objects |
| 10:03 | manutter | jweiss: if it's a serializable Java object you might be able to use Java method calls to serialize it and then de-serialize it later |
| 10:04 | jweiss | manutter: i'm not interested in getting the same object back, it just has to be something that doesn't break the reader, and a human reader would recognize as a fn or a java object of some class |
| 10:04 | manutter | jweiss: wait, by "readable" you mean something a human can read (as opposed to something Clojure will understand)? |
| 10:04 | manutter | oh, ok, that's different |
| 10:04 | jweiss | manutter: sorry i mean something that the clojure reader won't throw an exception on AND is somewhat human readable |
| 10:05 | manutter | I don't have any simple techniques off the top of my head, but I wonder if you could do something useful with metadata, hmmm |
| 10:05 | duck1123 | relevant:https://groups.google.com/d/topic/clojure/nyOJjcynl2Q/discussion |
| 10:06 | jweiss | manutter: for fn's, i use serializable-fn (a simple lib from technomancy that adds metadata just as you suggest). however if I forget or someone else's code is being run, i don't want my logging to fail |
| 10:06 | jweiss | (trace logging is what i'm working on here, logging with pr to convert to html later) |
| 10:07 | khaliG | manutter, perhaps ~/.lein/init.clj is a good place to put a reference to show |
| 10:08 | manutter | khaliG: I think you meant that for joegallo, but it is a good idea |
| 10:08 | khaliG | oops, yes |
| 10:08 | duck1123 | jweiss: Would it help if you just printed out the vars? They should be readable and user friendly |
| 10:08 | manutter | (I actually had init.clj open after reading that, but I wasn't sure exactly how to do it) |
| 10:09 | jweiss | duck1123: printed how? |
| 10:09 | jweiss | i'm logging fn calls, some arguments to fns are fns :) |
| 10:09 | jweiss | and of course some are java objects |
| 10:09 | duck1123 | yeah, I guess it would only really work if you had the var to begin with |
| 10:10 | jweiss | i'm sure print-method is the answer here, just not sure what exactly to have it print :) |
| 10:10 | duck1123 | In Ciste, I pass around vars all the time for similar uses |
| 10:10 | joegallo | how do you get it there to be referenceable, if it's not on your classpath already? |
| 10:10 | jweiss | something similar to what pr already does, but none of that #<> business |
| 10:11 | jweiss | by the way is that behavior documented somewhere? seems like the only thing pr does that is not readable |
| 10:13 | jweiss | hm this might help http://amalloy.hubpages.com/hub/Dont-use-XML-JSON-for-Clojure-only-persistence-messaging |
| 10:13 | khaliG | joegallo, yeah i'm not sure |
| 10:14 | jweiss | although so might just converting everything to strings before I write :) |
| 10:17 | manutter | khaliG: joegallo: couldn't you put in some code to have lein automatically add repl-utils to :dev-dependencies somehow? |
| 10:18 | manutter | I've never tried mucking about in lein's innards, but I thought that was the sort of thing you could do. |
| 10:18 | duck1123 | isn't there a param in project.clj for code to be run when the repl starts? |
| 10:18 | khaliG | manutter, looking through trying to find a place to do just that - https://github.com/technomancy/leiningen/blob/stable/sample.project.clj |
| 10:19 | joegallo | manutter, yes, that's a very very clever thought |
| 10:19 | joegallo | make it an implicit dev-depedency, so to speak :) |
| 10:39 | khaliG | joegallo, manutter well a little progress, kind of: added a :repl-init clojure.contrib.repl-utils to project.clj - and now lein repl drops me to a repl with the ns c.c.r-u |
| 10:41 | manutter | now if it would just work with lein swank |
| 10:41 | manutter | hmm, though I typically use clojure-jack-in, wonder how that would work... |
| 11:06 | Menthy | Anyone proficient with ClojureQL on ? |
| 11:06 | bendlas | Menthy: what do you need? |
| 11:08 | Menthy | (difference (table :one) (table :two)) should have an option to give in a keyword that will replace the default "EXCEPT" |
| 11:08 | Menthy | (SELECT one.* FROM one ) EXCEPT (SELECT two.* FROM two) |
| 11:08 | Menthy | So I was thinking that modifying the expression should work |
| 11:09 | Menthy | And (modify (difference (table :one) (table :two)) :minus) should give (SELECT one.* FROM one ) MINUS(SELECT two.* FROM two) |
| 11:09 | Menthy | instead it gives (SELECT MINUS one.* FROM one ) EXCEPT (SELECT two.* FROM two) |
| 11:11 | Menthy | That's the behavious I would expect from (difference (modify (table :one) :minus) (table :two)) |
| 11:14 | coopernurse | let's say I have a compojure/noir app. I've got a views.clj that has a bunch of hiccup code |
| 11:14 | coopernurse | there's some data I need to render in the sidebar of every page that comes from a database |
| 11:14 | coopernurse | I'd like to avoid having to pass in a variable from routes to each view function that contains that data |
| 11:15 | bendlas | Menthy: yes, that's not implemented |
| 11:15 | coopernurse | but I also don't want to tightly couple the views to the database |
| 11:15 | coopernurse | what's a smart way to design around that? |
| 11:15 | bendlas | is there a database, that needs "EXCEPT"? |
| 11:15 | coopernurse | I'm considering having an atom in the views module that points to a function that returns the sidebar data |
| 11:16 | coopernurse | and then the app at startup can inject a function into the views namespace that swaps the atom |
| 11:16 | Menthy | bendlas: Most databases need EXCEPT, which seems the default, buf Oracle (of course) has MINUS |
| 11:16 | coopernurse | is that a reasonable approach? |
| 11:16 | Menthy | bendlas: The strange thing is, it seems to suggest from the docs that it should be possible. Tried to dive into the source, but it's reasonably complicated |
| 11:16 | bendlas | Menthy: I see. Well, that can be implemented as a dialect in CQL |
| 11:18 | bhenry2 | coopernurse, it doesn't have to be an atom. just have a sidebar function and put that in the views that need it. |
| 11:18 | coopernurse | bhenry2: you mean have the view functions call a function to load the data explicitly? |
| 11:19 | coopernurse | bhenry2: I wanted to add some indirection to avoid tightly binding the view to the database |
| 11:20 | Menthy | btw, is there a way to generate SQL from disj! conj! and update-in! instead of having them executed directly in ClojureQL ? |
| 11:20 | bhenry2 | i don't get why you need to connect the view and the database. your view gets some data and you send a response back. if the sidebar depends on said data, have your sidebar function take args |
| 11:23 | bhenry2 | coopernurse: ^^ |
| 11:23 | coopernurse | right, so I could pass the sidebar data into every view function |
| 11:23 | coopernurse | but then every route would need to load the sidebar data (redundant) |
| 11:24 | bendlas | Menthy: You can always use clojureql.core/compile |
| 11:24 | coopernurse | or I could inject a function into the view module that knows how to load sidebar data |
| 11:24 | coopernurse | and the sidebar view could load it when called |
| 11:24 | coopernurse | eliminating the need to pass that var around |
| 11:24 | coopernurse | from route -> top level view -> sidebar layout |
| 11:25 | coopernurse | I'm trying to be as DRY as possible |
| 11:25 | bendlas | Menthy: oh, sorry, you were talking about the DML statements |
| 11:25 | bendlas | I think there is no way to get the compiled sql there |
| 11:27 | bhenry2 | coopernurse: where you want to put the sidebar you will have to either deref the atom or call the sidebar function. so i'm not sure how either way is dryer than the other. |
| 11:27 | bhenry2 | i think i'm misunderstanding how you have your views set up |
| 11:28 | coopernurse | bhenry2: well, if I localize loading the data to the sidebar function (calling the injected function to load data), then no one else needs to know that the sidebar depends on that data |
| 11:28 | coopernurse | if the data is passed to the sidebar, then everyone up the call stack has to know about this bit of data |
| 11:28 | coopernurse | I'll post a gist of what I have in mind |
| 11:29 | Menthy | bendlas: Thanks, that's too bad. Probably means I'll have to roll my own query constructor then (if it's going to deserve that name). Always a shame when you're *this* close to something that works. |
| 11:30 | coopernurse | bhenry2: https://gist.github.com/1200882 |
| 11:30 | bendlas | Menthy: but you don't use an SQL difference in a DML, do you? |
| 11:31 | coopernurse | not sure if that code works, but hopefully illustrates the point |
| 11:31 | bhenry2 | coopernurse: *looking* |
| 11:34 | duck1123 | Has anyone experienced an issue where having clojure 1.3 in their dev dependencies causes every lein command to throw: NoSuchMethodError: clojure.lang.KeywordLookupSite.<init> |
| 11:35 | duck1123 | I have the same dependency on my lib/ folder, but one of my dev dependencies is pulling it in |
| 11:37 | Menthy | bendlas: It's two different problems for this project: I need to generate scripts instead of executing directly, because execution should be repeatable without the code itself. It would be nice to have the choice (bang form and without). The 'EXCEPT' clause is used in a delete statement with two subselects, and SQL generated should have a choice of Oracle and MS SQL. |
| 11:39 | Menthy | bendlas: I was expecting the difference function to be able to take a modifier for the keyword used from the clojuredoc |
| 11:41 | Menthy | bendlas: But I can understand if it's not done yet, it's a pretty complicated project. I hope I'll once get proficient enough in Clojure to contribute :) |
| 11:49 | bhenry2 | coopernurse: i'm forgetting how this works, but what if two requests come in at the same time for different views. the set-sidebar-loader! gets called for each view before the sidebar defpartial gets loaded for either. wouldn't you be displaying the last sidebar loaded for both views, instead of their respective sidebards? |
| 11:49 | bendlas | Menthy: if you want to dive into the source and need help with it, feel free to send me a message on github |
| 11:49 | coopernurse | bhenry2: in my case, the function would be injected when the app loads - not per request |
| 11:50 | bendlas | i'd love to talk more, but I'm heavily multitasking right now |
| 11:50 | bendlas | but I can respon async |
| 11:50 | arohner | duck1123: that's almost always caused by mixing AOT'd 1.2 code with 1.3 |
| 11:50 | bendlas | s/respon/respond |
| 11:50 | lazybot | <bendlas> but I can respond async |
| 11:51 | bendlas | also, you can open a ticket to implement that MINUS syntax for oracle |
| 11:51 | bhenry2 | coopernurse: so once you load your app your sidebar is static until reloading? |
| 11:52 | coopernurse | bhenry2: no, the data changes constantly, but the function itself would only need to be set once |
| 11:52 | coopernurse | I'm calling the function in sidebar per request |
| 11:52 | bhenry2 | oh i see |
| 11:55 | bhenry2 | coopernurse: so basically mock-sidebar-loader would be the sidebar function that i'm talking about. i really don't think it needs to be an atom if you're only going to assign it when the app loads |
| 11:56 | bhenry2 | if sidebar-loader was just a function alone and not in an atom, you can still call (let [stats (sidebar-loader)] . . .) |
| 11:58 | coopernurse | bhenry2: yeah, I mean for this example the indirection isn't much of a win, but logically I'd like the view to be separated from the db. so the idea with the mock function is that it could be used during ui dev, but swapped out later without changing views.clj |
| 11:58 | coopernurse | bhenry2: I'm just experimenting with how one might structure clojure code to achieve loose coupling between layers without reinventing spring |
| 11:59 | coopernurse | since we have first class functions, this seems like a reasonable compromise |
| 12:04 | bhenry2 | coopernurse: i guess it will work. i'm just not sure i see any benefit of a function in an atom over a regular function |
| 12:04 | duck1123 | arohner: That was it. There's a dependency on ordered-set that is compiled against 1.2. It's odd that it didn't do this on any of the other systems I tested against |
| 12:04 | coopernurse | bhenry2: if I make it a regular function, how can I swap it out externally? I can't redefine it right? |
| 12:05 | bhenry2 | coopernurse: i guess i don't know. when i deploy new code, my app is reloaded with no downtime. so i've never had to deal with that |
| 12:06 | coopernurse | bhenry2: oh, I don't mean at deploy time, I simply mean that without an atom, the (set-sidebar-loader!) function isn't possible, and the views.clj file would be tightly coupled to a single implementation for loading data |
| 12:07 | bhenry2 | with noir everytime you recompile your changes should take place without having to reload the whole thing. |
| 12:07 | bhenry2 | so if you changed the sidebar function then recompiled it should just pick up the changess. |
| 12:07 | coopernurse | bhenry2: right, that isn't my concern. it's a design issue, not a class reloading issue. |
| 12:54 | fliebel | What is the correct way for a view server *not* to respond to a command? Say, I get a show or list that I can't handle. |
| 13:08 | coopernurse | fliebel: not sure what you mean. are you writing a web app? |
| 13:09 | fliebel | coopernurse: Oh, I only now noticed that I posted to the wrong channel. |
| 13:09 | fliebel | This was about CouchDB |
| 13:09 | coopernurse | fliebel: ah, ok cool |
| 13:09 | Raynes | fliebel: As long as cemerick is here, #clojure *is* #couchdb |
| 13:10 | fliebel | Raynes: cemerick is everywhere... But I'd say it's the other way around. |
| 13:30 | wunki | is there an easy way for `paredit-mode` to show me the corresponding parenthesis |
| 13:30 | wunki | it stopped doing that when I enabled paredit |
| 13:31 | amalloy | wunki: there's show-paren-mode, but that's a bit too loud for me |
| 13:33 | wunki | amalloy: hey, I actually like it :) Thanks |
| 13:33 | TimMc | I've got highlight-parentheses-mode |
| 13:34 | duck1123 | Would setting up a executor elsewhere in my code cause futures to fail? |
| 13:34 | duck1123 | I'm getting a rejection everytime I try to use a future and I can't see why |
| 13:34 | amalloy | clojurebot: rejectedexecutionexception? |
| 13:34 | clojurebot | RejectedExecutionException in swank means you need to upgrade swank to 1.3.2 or higher. |
| 13:35 | duck1123 | using 1.4.0-SNAPSHOT |
| 13:35 | amalloy | technomancy: duck1123 wants some help with the agent threadpool |
| 13:35 | amalloy | (probably) |
| 13:36 | technomancy | duck1123: are you on a frozen snapshot? |
| 13:36 | duck1123 | no |
| 13:36 | technomancy | try the 1.3.2 release if you don't need cdt |
| 13:37 | duck1123 | also, I don't know if this matterd, but I'm starting swank from within my -main |
| 13:37 | technomancy | oh, I see. in that case make sure you block on whatever thread is keeping the JVM alive |
| 13:37 | technomancy | or just @(promise) |
| 13:39 | technomancy | it's a workaround for the shortcomings of the clojure agent thread pool, but I think it's proven to be more trouble than it's worth |
| 13:39 | technomancy | will probably turn it off by default until Clojure adds a restart-agents function |
| 13:43 | duck1123 | adding @(promise) did the trick |
| 13:56 | miltondsilva | Hi, is there some where where I can read a good clojure zipper tutorial? I can't understand how to use them just with the examples in clojuredocs + the documentation |
| 13:57 | aufrank | hey all, just getting started with clojure |
| 13:58 | aufrank | can anyone help me figure out why the last line of this code isn't working? https://gist.github.com/1201257 |
| 13:58 | aufrank | it returns (nil nil nil nil) |
| 13:58 | aufrank | I expected (0.2 0.2 0.2 0.2) |
| 13:59 | hiredman | have you tried (:neighbors kaet) |
| 14:00 | hiredman | http://en.wikipedia.org/wiki/Lisp_%28programming_language%29#Self-evaluating_forms_and_quoting |
| 14:00 | aufrank | returns (k ae t cat) |
| 14:01 | hiredman | aufrank: and? |
| 14:01 | manutter | how about (:activation k)? |
| 14:01 | hiredman | you mean (:activation 'k) |
| 14:01 | amalloy | manutter: that's going to work fine, and doesn't get at the problem |
| 14:01 | hiredman | on line k is quoted |
| 14:02 | hiredman | line 7 |
| 14:02 | manutter | sorry, typo |
| 14:02 | manutter | amalloy: I assume nothing :) |
| 14:03 | aufrank | (:activation k) returns 0.2 |
| 14:03 | bhenry2 | well (:activation 'n) where n is anything will be nil. |
| 14:03 | aufrank | (:activation 'k) returns nil |
| 14:03 | aufrank | so I'm asking for the activation of the symbol k, not what it evaluates as |
| 14:03 | hiredman | (:activation (first '(k ae t cat))) |
| 14:04 | hiredman | symbols don't have :activations |
| 14:04 | aufrank | right |
| 14:06 | aufrank | (:activation (first '(k ae t cat))) works, and I think I understand why |
| 14:06 | aufrank | but I don't understand how to replicate it in a map function |
| 14:06 | manutter | so a quoted list of symbols is a list of quoted symbols? I'm confused |
| 14:06 | hiredman | not it doesn't |
| 14:06 | hiredman | no |
| 14:06 | hiredman | if it works you did it wrong |
| 14:07 | aufrank | s/works/fails/ |
| 14:07 | aufrank | =P |
| 14:08 | hiredman | did you read the wikipedia page on quoting? |
| 14:09 | mprentice | manutter: '(a b c d) is shorthand for (list 'a 'b 'c 'd) |
| 14:09 | manutter | mprentice: learn sumpin new every day, tks :) |
| 14:10 | aufrank | ok, just reread it. unfortunately I still don't see the way forward |
| 14:10 | aufrank | conceptually, I think I want to de-quote k inside of (:activation k) |
| 14:11 | aufrank | when the map runs, it calls (:activation 'k), but I want it to call (:activation k) |
| 14:11 | aufrank | but I don't know what the de-quote operator is |
| 14:11 | bhenry2 | aufrank: instead of quoting your list, list them. '(k ae t cat) => (list k ae t cat) |
| 14:11 | bhenry2 | or is it quoted for a reason? |
| 14:11 | aufrank | quoted because I thought it was a convenient short hand |
| 14:12 | hiredman | I think your life would be a whole lot easier if you stopped and said "do circular structures make sense with immutable data structures" and then acted in a sane way based on the answer |
| 14:13 | mprentice | hiredman: s/structures/references |
| 14:13 | mprentice | hiredman: circular immutable graphs make perfect sense |
| 14:14 | aufrank | bhenry2: that does solve the problem I presented, thank you kindly |
| 14:14 | hiredman | mprentice: shhh, stop confusing the newb |
| 14:14 | hiredman | bhenry2: you just broke it for him |
| 14:14 | aufrank | hiredman: I'd like to understand more, but I don't know how to start thinking about that question |
| 14:15 | manutter | hiredman: what exactly did that break? |
| 14:15 | hiredman | bhenry2: you gave him an example that only works because he already has stuff def at his repl, and the moment he restarts the repl it won't work due to the circular references |
| 14:15 | manutter | ah, the problem of building the neighbors list |
| 14:16 | hiredman | manutter: if you have already run those defs in a repl, and do what bhenry2 suggests it will seem to work for some value of "work" but not really |
| 14:16 | bhenry2 | hiredman: touche |
| 14:16 | bhenry2 | i missed the cat being predetermined. |
| 14:16 | hiredman | aufrank: so step back, look at your problem, and do it without circular data structures |
| 14:19 | jamiltron | Maybe I'm a bit dense but is there a simple way to map a function onto every-other element of a seq, sans recur? |
| 14:19 | hiredman | ,(map inc (take-nth 2 (range 10))) |
| 14:19 | clojurebot | (1 3 5 7 9) |
| 14:19 | aufrank | hiredman: the point of my toy example is to spread information among nodes in a network where cycles are allowed |
| 14:20 | mprentice | aufrank: in order to understand why it's not working, you should understand symbols. they are a separate data type and don't really have an equivalent in java |
| 14:20 | bhenry2 | jamiltron: do you need all the original sequence with every other updated, or does hiredman's solution work for you? |
| 14:20 | hiredman | aufrank: thats an unfornate thing to be doing in a language you don't really know |
| 14:20 | aufrank | hiredman: defining the network structure by allowing each node to know its neighbors was the most sensible starting point for me |
| 14:21 | jamiltron | I do need to "update" the original sequence. |
| 14:21 | jamiltron | Which I assume is done in a similar manner to hiredman's solution above (thank you, by the way). |
| 14:21 | hiredman | you model it like a real network, in a real network a node the neighbors are not contained in a node, a node just has references to neighbors |
| 14:21 | bhenry2 | ,(doc map-indexed) |
| 14:21 | clojurebot | "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item." |
| 14:22 | jamiltron | Ah, I didn't even know such a function existed, thank you! |
| 14:23 | bhenry2 | ,(map-indexed #(if (even? %1) (inc %2) %2) (range 10) |
| 14:23 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 14:23 | bhenry2 | ,(map-indexed #(if (even? %1) (inc %2) %2) (range 10)) |
| 14:23 | clojurebot | (1 1 3 3 5 ...) |
| 14:23 | mprentice | bhenry2: i didn't know about that either. i made my own function to do it. i should have known better. |
| 14:23 | joly | a more common representation of a graph is of a map from node names to a list of their neighbors, like {:k [:kaet] :ae [:kaet] :t [:kaet] :kaet [:k :ae :t :cat]} |
| 14:24 | joly | and a separate map for the activations: {:k 0.2 :ae 0.2 ...} |
| 14:25 | aufrank | joly: thanks, I'll try to rethink things in that representation |
| 14:25 | mprentice | joly: that's a much more sensible and practical explanation than what i was trying to form. |
| 14:27 | mprentice | joly: which means, of course, that you must die! en garde! |
| 14:27 | aufrank | hiredman: I would like to know how to store references to neighbors instead of the nodes themselves. is this a sensible approach in clojure? if so, what are the key concepts I should read about? |
| 14:27 | joly | mprentice: d'oh! |
| 14:29 | mprentice | aufrank: that is what the code joly showed you does |
| 14:29 | mprentice | aufrank: instead of trying to store objects inside each other, you are just calling them by names. that is storing a reference. |
| 14:30 | aufrank | mprentice: thanks! |
| 14:42 | chouser | inequality tests are the last place where prefix notation still bugs me |
| 14:44 | chouser | I think "when <big long expr> is less than 5, <dosomething>" |
| 14:45 | technomancy | chouser: doesn't it help to think of < as "increasing-args?" rather than "less-than?"? |
| 14:45 | chouser | I can either write (< ((big-long-expr)) 5) in which case the short but important constant gets lost in the parens |
| 14:45 | chouser | or I can write (>= 5 ((big-long-expr))), but I have to think carefully every time I read or write that and still get it wrong too often. |
| 14:46 | technomancy | why not let then? |
| 14:46 | chouser | hm. yeah, that may be best. |
| 14:46 | upwardindex | Anyone has deployed clojure apps to Jelastic? |
| 14:48 | chouser | technomancy: or maybe (-> ((big-long-expr)) (< 5)) |
| 14:48 | chouser | "Is your Clojure code too hard to read? Try adding more parens!" |
| 14:49 | technomancy | I almost suggested that, but I don't think it has any advantage over let |
| 14:49 | technomancy | I don't know what big-long-expr is, but it probably deserves a name |
| 14:50 | chouser | in the case in front of me, (count (set kids)) |
| 14:51 | pjstadig | you can also put big-long-expr and 5 on different lines |
| 14:51 | bhenry2 | haha. chouser is the doc string for < a joke? |
| 14:51 | bhenry2 | ,(doc <) |
| 14:51 | clojurebot | "([x] [x y] [x y & more]); Returns non-nil if nums are in monotonically increasing order, otherwise false." |
| 14:52 | pjstadig | but maybe a name like num-kids would work |
| 14:53 | chouser | in this case a name works well |
| 14:54 | chouser | bhenry2: too much jargon to be serious? |
| 14:55 | bhenry2 | it's just silly i think |
| 14:56 | technomancy | bhenry2: calling < "less than" is really confusing with prefix notation |
| 14:56 | bhenry2 | definitely. |
| 14:57 | bhenry2 | technomancy: i liked your description |
| 15:06 | TimMc | Maybe "less than" should be worked into the doc. |
| 15:06 | TimMc | "Returns non-nil if each argument is strictly less than any following argument." |
| 15:07 | TimMc | More greppable. |
| 16:02 | ikr | . |
| 16:16 | belun | hello. does this symbol hve special meaning ? => |
| 16:16 | belun | is used in midje |
| 16:17 | bhenry2 | belun: it's to compare the input and expected results inside of a fact |
| 16:17 | belun | ya but in clojure |
| 16:17 | belun | does it do anythg ? |
| 16:18 | bhenry2 | no i think it's a midje macro or something |
| 16:18 | belun | damn good point i can search for it now |
| 16:23 | bhenry2 | belun: it's really nothing at all. fact must take care of it's args some how because => is just def'ed as "=>" |
| 16:26 | belun | how did you find out |
| 16:26 | belun | its description |
| 16:26 | belun | ? |
| 16:26 | bhenry2 | (clojure.repl/source midje.sweet/=>) |
| 16:27 | bhenry2 | returns (def => "=>") |
| 16:30 | belun | is not here https://github.com/marick/Midje/blob/master/src/midje/sweet.clj |
| 16:32 | bhenry2 | he must have changed it from 1.2.0 to 1.3-alpha1 |
| 16:35 | belun | (:use midje.sweet) |
| 16:35 | bhenry2 | belun: https://github.com/marick/Midje/blob/master/src/midje/ideas/arrow_symbols.clj |
| 16:35 | belun | is there a bot here anymore ? |
| 16:35 | belun | to run code for u ? |
| 16:35 | bhenry2 | there is but that won't work anyway. |
| 16:35 | bhenry2 | use a comma or ampersand to begin your expression |
| 16:36 | arohner | belun: yes, there are several, but 1) that code isn't correct 2) most of them prevent state changes |
| 16:36 | belun | ,(:use midje.sweet) |
| 16:36 | clojurebot | #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: midje.sweet, compiling:(NO_SOURCE_PATH:0)> |
| 16:36 | mattmitchell | how can i get every other x item from an array? Example, I want only items at even positions: [1 2 3 4 5 6 7] => [2 4 6] |
| 16:37 | belun | (doc fact) |
| 16:37 | clojurebot | I don't understand. |
| 16:37 | belun | ,(doc fact) |
| 16:37 | clojurebot | Gabh mo leithscéal? |
| 16:37 | chouser | (doc take-nth) |
| 16:37 | clojurebot | "([n coll]); Returns a lazy seq of every nth item in coll." |
| 16:37 | bhenry2 | ,(take-nth 2 [1 2 3 4]) |
| 16:37 | clojurebot | (1 3) |
| 16:37 | mattmitchell | bhenry2: thanks! |
| 16:37 | belun | so can i test anythg midje here ? |
| 16:37 | bhenry2 | belun: nope |
| 16:38 | bhenry2 | belun: he is handling his arrow stuff here https://github.com/marick/Midje/blob/master/src/midje/semi_sweet.clj#L15 |
| 16:38 | bhenry2 | clone the project and play around. |
| 16:39 | seancorfield | can anyone give me pros and cons for using david santiago's clojure-csv library vs clojure.data.csv (from jonas enlund, based on cljcsv)? |
| 16:40 | mattmitchell | yo |
| 16:40 | mattmitchell | wrong room |
| 16:41 | ferd | Newbie here.... Regarding the issue of Clojure being slow to start (making it unpractical for quick scripts): Why does everyone blame the JVM? |
| 16:42 | ferd | I mean, the JVM is slow to start, but most of the startup time seems to be clojure-specific |
| 16:43 | theignorati | cause it's easy |
| 16:44 | hiredman | ferd: you have measurements? can you share them? |
| 16:44 | ferd | sure... trivial non-scientific example: |
| 16:44 | hiredman | I think there is a "the jvm is slow to startup" and "the jvm is slow to load code" and they just get lumped together |
| 16:44 | ferd | "time mvn" gives me: real 0m0.591s |
| 16:45 | arohner | seancorfield: any idea why jdbc/do-prepared doesn't appear to throw exceptions on bad SQL, while jdbc/do-commands does not? |
| 16:45 | hiredman | that is really unscientific |
| 16:45 | hiredman | and actually times startup and shutdown |
| 16:45 | ferd | while: "time lein" gives me: 0m3.419s |
| 16:45 | hiredman | lein is loading clojure+lots of libs including parts of maven |
| 16:46 | ferd | ok, right then |
| 16:46 | ferd | so the slowness is on loading clojure itself (whatever than means) |
| 16:46 | seancorfield | arohner: hmm, sounds like a bug... could you create an issue in JIRA with repro examples so i can take a look? |
| 16:46 | ferd | or may be lein is the one that is particularly slow ? |
| 16:46 | seancorfield | http://dev.clojure.org/jira/browse/JDBC |
| 16:46 | arohner | seancorfield: sure |
| 16:47 | hiredman | no you mistunderstand, 'lein' is just doing more than running 'mvn' |
| 16:47 | mattmitchell | ,(take-nth 2 [1 2 3 4 5 6 7]) |
| 16:47 | clojurebot | (1 3 5 7) |
| 16:47 | seancorfield | no takers on the CSV question? i'm trying to consolidate the libraries we're using and would prefer "standard" libraries over (random) 3rd party libraries if possible |
| 16:47 | seancorfield | (and, yes, i know that contrib is _not_ a "standard" library!) |
| 16:48 | bhenry2 | ,(take-nth 2 (drop 1 (range 10))) |
| 16:48 | clojurebot | (1 3 5 7 9) |
| 16:49 | bhenry2 | ,(take-nth 2 (drop 1 [1 2 3 4 5 6])) |
| 16:49 | clojurebot | (2 4 6) |
| 16:50 | dsantiago | Wow, I'm shocked to learn about clojure.data.csv. |
| 16:50 | dsantiago | I offered clojure-csv to clojure contrib years ago and got no reply. |
| 16:51 | belun | anyknow how to get midje as project in intellij ? i forked it on github and pulled it localy |
| 16:52 | seancorfield | dsantiago: it seems the word about contrib isn't getting out there as well as it could / should... |
| 16:52 | dsantiago | I saw nothing on the lists about this. |
| 16:53 | seancorfield | i think the focus has mostly been on whether to promote old contrib to new contrib |
| 16:53 | seancorfield | a few new contrib libraries have appeared as (recent) volunteers have sprung up |
| 16:53 | technomancy | ferd: try timing "lein version" instead, and be sure you have access to a client JVM |
| 16:53 | technomancy | ferd: it's around 0.8s on my machine |
| 16:54 | technomancy | "lein" on its own invokes "lein help" which must load every task |
| 16:55 | arohner | seancorfield: just to make sure I'm doing things correctly before filing a bug, is (jdbc/do-prepared "invalid SQL") the correct way to call it? (jdbc/do-commands "invalid SQL") throws as expected |
| 16:55 | seancorfield | hmm, let me check... just a sec |
| 16:55 | choffstein | Anyone know a good clojure library for sending email that can handle attachments? |
| 16:55 | dsantiago | Really wish I hadn't spent all this time maintaining the library, fixing bugs, adding features for people, as my own use for it has long since passed. |
| 16:56 | seancorfield | arohner: yeah, they should work "identically" |
| 16:56 | chouser | dsantiago: Sorry -- that sucks. |
| 16:56 | arohner | seancorfield: ok thanks, I'll file |
| 16:57 | seancorfield | except insofar as do-prepared uses PreparedStatement and do-commands uses Statement :) |
| 16:58 | seancorfield | dsantiago: fwiw, clojure-csv is doing us proud in production |
| 16:58 | seancorfield | i only noticed clojure.data.csv the other day |
| 16:58 | dsantiago | seancorfield, glad to hear it, I guess. |
| 16:58 | ferd | technomancy: real 0m0.908s (default JVM, that is, Server) |
| 16:59 | dsantiago | I get that sort of message relatively frequently from people. |
| 16:59 | technomancy | ferd: keep in mind that loading clojure necessarily loads the entire compiler into memory, whereas mvn only loads that on demand. |
| 17:00 | ferd | understood |
| 17:00 | dsantiago | http://clojuresphere.herokuapp.com/cljcsv http://clojuresphere.herokuapp.com/clojure-csv |
| 17:00 | ferd | I'm not really comparing lein vs mvn |
| 17:00 | dsantiago | Fascinating. |
| 17:00 | ferd | I'm trying to figure out where's the bulk of the load a any CLI app |
| 17:01 | ferd | now, a precompiled "HelloWorld.clj" clocks around ~0.7s for me.... while a "mvn --help" (just to give an example) is 0.1s |
| 17:01 | hiredman | ferd: run jvisualvm |
| 17:02 | ferd | Hello World in java would be 0.05s or so |
| 17:02 | hiredman | actually, try sticking the clojure on the bootclasspath |
| 17:02 | seancorfield | dsantiago: i don't see any discussion on cljcsv becoming c.d.csv on clojure-dev ... no discussion of c.d.csv at all as far as i can see :( |
| 17:02 | hiredman | my guess is loading class files |
| 17:02 | dsantiago | Nope, no discussion at all. |
| 17:02 | seancorfield | cljcsv was mentioned on clojure back in may 2010 |
| 17:03 | hiredman | clojure generates more class files, the bytecode of which has to be walked and verified on load |
| 17:03 | ferd | so, my honest question is where the time is being spent (if anybody knows for sure) and if there's something which could be done to improve matters. |
| 17:03 | ferd | I'm no expert, but I'm whiling to help |
| 17:04 | seancorfield | clojure-csv has been discussed a lot on the clojure list (or at least there are a lot of posts from people who use it)... |
| 17:04 | ferd | I'll do more useful tests... Like, I care to see how the statup time grows with the size of the code-base |
| 17:05 | ferd | may be the initial ~1s is there for a HelloWorld, but grows only slowly from there |
| 17:05 | dsantiago | seancorfield, Yeah, I don't know. |
| 17:05 | seancorfield | well, i'm drafting a (long) email about the state of contrib for clojure-dev since we don't seem to have any guidance or consistency and think we need some... |
| 17:10 | seancorfield | i'm a bit surprised there's no http library in contrib... what do folks use for interacting with http servers? i'm currently using clj-http but interested in options... |
| 17:11 | dsantiago | seancorfield, yeah, I suppose. Maybe this other thing is better. It doesn't look as configuable to me. I'd have liked the opportunity to make my case (and given how quickly I turn around requests and bug fixes, a chance to make any changes to fix perceived inadequacies). |
| 17:11 | technomancy | seancorfield: stick with clj-http |
| 17:13 | technomancy | seancorfield: istr the old contrib http.agents lib was half-baked and probably shouldn't have gone into contrib by admission of its author, so it's unlikely to get promoted |
| 17:14 | technomancy | oh! I forgot, there is also gnir if you like symmetry. |
| 17:14 | technomancy | http://clojars.org/gnir |
| 17:15 | hiredman | clj-http while being the best there is, seems to be largly abandon ware :/ |
| 17:15 | hiredman | stupid get-woven |
| 17:15 | hiredman | and clj-sys or whatever |
| 17:16 | Raynes | seancorfield: I use slurp. ;) |
| 17:16 | seancorfield | Raynes: mostly i want to post xml and json to a search engine... |
| 17:17 | Raynes | Stop wanting to do that and you'll be fine. |
| 17:17 | Raynes | But in all seriousness, I use clj-http in all my projects. |
| 17:17 | seancorfield | ah, gee Raynes, i guess i'll just rewrite my application :) |
| 17:17 | seancorfield | maybe "we" should look at getting clj-http promoted to a new contrib so at least it would be maintained going forward? |
| 17:18 | seancorfield | (i know, getting everything under CA might be a problem) |
| 17:18 | pjstadig | things don't have to be in contrib to be maintained |
| 17:18 | pjstadig | Clojure/core is great, but they're not the be all end all of clojure |
| 17:19 | hiredman | the network graph for clj-http is large |
| 17:19 | seancorfield | is mark actively maintaining it tho'? |
| 17:20 | pjstadig | if not perhaps someone could pick it up |
| 17:20 | hiredman | and there are a lot of orphans because people forked from getwoven's copy and getwoven vanished |
| 17:20 | pjstadig | i'm not saying it shouldn't end up in clojure core |
| 17:20 | pjstadig | er...contrib |
| 17:20 | hiredman | mark's copy moved to getwoven, then getwoven vanished, and mark forked from some other random dude |
| 17:20 | seancorfield | heh, i was about to correct you on that :) |
| 17:20 | michaelr525 | does google docs works for you right now? |
| 17:20 | pjstadig | clojure contrib may be sufficient for it to be maintained, but its not necessary |
| 17:21 | seancorfield | hiredman: looks like mark's pretty much the only committer going back to dot...? |
| 17:21 | hiredman | https://github.com/medSage/clj-http/network |
| 17:21 | michaelr525 | hiredman: what do you mean by getwoven vanished? |
| 17:21 | hiredman | https://github.com/mmcgrana/clj-http/network |
| 17:24 | technomancy | github badly needs a "this fork considered canonical" marker |
| 17:26 | pcavs | technomancy: agreed |
| 17:26 | pcavs | I usually follow the fork tree down to the root, or try to at least |
| 17:27 | hiredman | it would be nice to get all those features merged back into the cannonical version |
| 17:27 | hiredman | although, really whatever has the most commits should be cannonical |
| 17:27 | seancorfield | hiredman: all mark mcgrana apart from bradford cross for the first few commits, yes? (barring three commits by mark from other authors recently) |
| 17:28 | technomancy | hiredman: yeah, because *that's* not ripe for gaming =) |
| 17:28 | hiredman | seancorfield: are you just looking a the git log? I don't really care about that, I care about all the forks with new features that haven't been merged in |
| 17:29 | hiredman | which are evidence of the original clj-http being dead |
| 17:29 | seancorfield | ah, ok... i was only looking at it from the point of view of getting it under CA and into contrib - which i think would be worthwhile, esp. given your assertion that mark stopped maintaining it in february |
| 17:30 | hiredman | *shrug* I think getting it under the CA makes it less likely that we'll get all the work people have been doing on improving it in |
| 17:31 | arohner | CAs definitely affect code velocity. When in doubt, I think they should be avoided |
| 17:32 | arohner | and I'm tired of fixing namespace changes because of promotions |
| 17:32 | hiredman | a real great thing would be a clj-http fork that just merges in the other forks |
| 17:33 | pjstadig | hiredman: you have my blessing |
| 17:34 | hiredman | hah |
| 17:34 | hiredman | to do something actually useful? I bet. |
| 17:34 | dakrone | eh, does it have tests? I'll maintain it? |
| 17:34 | pjstadig | better yet tell mcgrana to stop blogging about clojurescript and fix his stuff |
| 17:35 | pjstadig | dakrone: you have my blessing |
| 17:35 | dakrone | that was supposed to be "I'll maintain it" instead of a question |
| 17:35 | pjstadig | hiredman: you have my curse |
| 17:36 | pjstadig | clojurebot: clj-http is <reply>dakrone maintains clj-http |
| 17:36 | clojurebot | Ack. Ack. |
| 17:36 | michaelr525 | funny, I just finished writing a rather long document in google docs and when tried sharing it with someone google docs just went down |
| 17:36 | pjstadig | ~clj-http |
| 17:36 | clojurebot | dakrone maintains clj-http |
| 17:36 | pjstadig | there now it's official |
| 17:36 | michaelr525 | go trust a cloud word processor |
| 17:36 | dakrone | hah, okay, lemme fork Mark's and I can start |
| 17:39 | dakrone | https://github.com/dakrone/clj-http send pull requests gogogo |
| 17:42 | pjstadig | dakrone: no...now you have to go onto the githubs and merge in every single change that has been made in every fork of clj-http |
| 17:42 | dakrone | pjstadig: yea, I'll work on that too |
| 17:42 | pjstadig | and by Friday |
| 17:42 | dakrone | in the meantime, upgrading the deps |
| 17:43 | hiredman | I think one of the branches did |
| 17:43 | pjstadig | hehe |
| 17:54 | di-csuehs | Is there a canonical list of available lein plugins? |
| 17:54 | hiredman | how can there be canonical list? |
| 17:55 | di-csuehs | "sigh" (def canonical (enough (canonical))) |
| 17:55 | hiredman | what is enough? |
| 17:55 | technomancy | di-csuehs: plugin authors are encouraged to add links to the wiki page |
| 17:55 | technomancy | https://github.com/technomancy/leiningen/wiki/Plugins |
| 17:56 | di-csuehs | Thanks, tm! |
| 17:57 | technomancy | no problem |
| 18:03 | mccraig | what's the currently accepted approach for unit testing private functions ? |
| 18:05 | mccraig | is it the case that it's better to move private functions to a different namespace and make them public ? |
| 18:07 | technomancy | mccraig: IMO yes |
| 18:07 | technomancy | there are tricks to make it work with actual private defns, but I prefer the idea of entire private namespaces |
| 19:02 | miltondsilva | is there a "reduce" for coll f instead of f coll? |
| 19:05 | brehaut | #(reduce %1 coll) ? |
| 19:13 | miltondsilva | brehaut: hmm not what I'm looking for... |
| 19:13 | miltondsilva | (#(%1 oc) [zip/down zip/right zip/right zip/right]) |
| 19:13 | brehaut | (juxt zip/down zip/right …) |
| 19:14 | brehaut | ? |
| 19:14 | brehaut | no |
| 19:14 | brehaut | i have no idea what you are doing |
| 19:14 | technomancy | mybe the konami code? |
| 19:14 | technomancy | *maybe |
| 19:14 | brehaut | haha |
| 19:15 | miltondsilva | I have a vector with functions and I want to traver a zipper like that |
| 19:15 | miltondsilva | normally I would do |
| 19:15 | miltondsilva | (-> zipper fn1 fn2 fn3) |
| 19:15 | miltondsilva | but if they are |
| 19:16 | miltondsilva | inside |
| 19:16 | miltondsilva | a [] |
| 19:17 | brehaut | ((apply comp (reverse [zip/down zip/right zip/right zip/right])) zipper) ? |
| 19:18 | brehaut | excuse the Closuritis |
| 19:19 | technomancy | http://p.hagelb.org/konami.clj.html |
| 19:21 | miltondsilva | brehaut: it works :) I was doing something with eval... |
| 19:21 | miltondsilva | still it's a bit more complex than I would like |
| 19:22 | brehaut | (reduce (fn [acc f] (f acc)) zipper [zip/down zip/right zip/right zip/right]) ? |
| 19:26 | miltondsilva | also seems to work and I like it better :) |
| 20:35 | sn197 | hi, a java interop question - how do you obtain an instance of java.awt.geom.Path2D.Float in clojure (unfortunately I am not a java expert) |
| 20:39 | sn197 | Path2D.Float is a public static class, can an instance be obtained at all? |
| 20:48 | sn197 | hi, a java interop question - how do you obtain an instance of java.awt.geom.Path2D.Float in clojure (unfortunately I am not a java expert) |
| 20:59 | LuminousMonkey | Wish I could help sn197, I've just tried to figure it out, and I'm failing. |
| 21:00 | hiredman | the answer is: the same way you do it in java |
| 21:01 | sn197 | easier said than done, I did some homework before posting here |
| 21:01 | hiredman | if you know the operations in java, then ask how you do those operations here, otherwise read the javadocs |
| 21:02 | hiredman | well, looking at the javadocs, you can see the class name is Path2D.Float, which tells you it is an inner class |
| 21:03 | hiredman | so you say "how do you work with inner classes in clojure?" |
| 21:03 | TimMc | Answer: You need to use a weird syntax. |
| 21:03 | sn197 | thanks, is there a link to this on the net? |
| 21:03 | hiredman | and someone says "same as normal classes, just use $ in place of '.' in the classname because that is what the jvm does internally" |
| 21:03 | hiredman | ~google java.awt.geom.Path2D.Float |
| 21:03 | clojurebot | First, out of 240 results is: |
| 21:03 | clojurebot | Path2D.Float (Java Platform SE 6) |
| 21:03 | clojurebot | http://download.oracle.com/javase/6/docs/api/java/awt/geom/Path2D.Float.html |
| 21:03 | TimMc | sn197: https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/drawing.clj |
| 21:04 | sn197 | yup, I 've read the java docs, I will insert $ sign, thanks |
| 21:05 | sn197 | it worked, thanks guys, I won't be asking stupid questions any time soon |
| 21:06 | hiredman | well, the big thing is when you ask "how do you obtain an instance of java.awt.geom.Path2D.Float" unless someone knows the particular class no one knows the answer, but if you know enough to ask "construct/import/etc inner classes" it is easy to answer |
| 21:17 | TimMc | hiredman: It's hard to know to ask that one. |
| 21:18 | TimMc | Java disguises the difference between top-level and inner classes pretty well. |
| 21:27 | mdeboard | Ugh about to write a small Clojure program after not touching clj for a month+ |
| 21:28 | mdeboard | feels intimidating man |
| 21:32 | alandipert | mdeboard: fear not, nothing has changed... we are immutable :-) |
| 21:32 | mdeboard | alandipert: My memory is not |
| 21:32 | mdeboard | :( |
| 21:38 | mabes_ | lol |
| 21:38 | jli | I would kind of like to be able to use commas in numbers, but it doesn't work because they're whitespace. e.g., "1,000,000" is "1 000 000" instead of "1000000". I'm guessing rich would hate a patch that special cased commas when used inside numbers? |
| 21:39 | hiredman | ,1e6 |
| 21:39 | clojurebot | 1000000.0 |
| 21:40 | cemerick | jli: Yeah, that's not a high-probability change. |
| 21:41 | jli | cemerick: I figured :) oh well |
| 21:41 | jli | hiredman: that's useful, but doesn't work for numbers that aren't powers of 10 |
| 21:42 | jli | hum, is there a way to change the base, besides "0" for octal and "0x" for hex? |
| 21:42 | hiredman | ,10r13 |
| 21:42 | clojurebot | 13 |
| 21:43 | hiredman | ,2r13 |
| 21:43 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: For input string: "13"> |
| 21:43 | hiredman | ,2r10101 |
| 21:43 | clojurebot | 21 |
| 21:43 | hiredman | bah |
| 21:45 | jli | ah, cool. thanks |
| 21:59 | mdeboard | Anyone have a link to some code that uses read-line to prompt for user input? |
| 22:00 | mdeboard | or actually any technique to prompt for user input? :) |
| 22:03 | mdeboard | Oh yeah, read-line doesn't work right in slime-repl |
| 22:58 | hippiehunter | how do i debug this? "#<CompilerException java.lang.StackOverflowError (NO_SOURCE_FILE:0)>" |
| 23:00 | jeremyheiler | hippiehunter: is that from the repl? |
| 23:00 | hippiehunter | yeah |
| 23:02 | jli | hippiehunter: the stack overflow probably means you're recursing too much. is there a tail recursive function that's not using recur? also, if you throw your code in a file, you'll get a better error message |
| 23:04 | brehaut | (use 'clojure.stacktrace) |
| 23:05 | brehaut | (e) is useful for getting the full exception |
| 23:05 | brehaut | http://clojure.github.com/clojure/clojure.stacktrace-api.html |
| 23:09 | hippiehunter | building it in file form helped |
| 23:12 | alandipert | see also clojure.repl/pst; (pst) available by default in repl |
| 23:17 | bhenry1 | alandipert: what version has that in the repl? it's not defined for me |
| 23:17 | alandipert | ah, perhaps 1.3-forever, apologies |
| 23:18 | bhenry1 | sweet |
| 23:20 | jli | I'm not sure I understand the difference between var and let |
| 23:20 | jli | er, var and resolve |
| 23:25 | nickmbailey | anyone have a good way of getting the version number of the lein project when running from a jar/uberjar? |
| 23:25 | nickmbailey | i guess you can parse the project.clj file since it's in the jar |
| 23:25 | nickmbailey | seems like there should be an easier way |
| 23:30 | alandipert | jli: resolve is slightly lower-level (it can optionally take an ns arg, and resolves symbols that needn't necessarily have been referred) |
| 23:31 | bhenry1 | nickmbailey: https://gist.github.com/cd2293d656553faccf84 if you aot compile that you can reference the version var anywhere in your code. |
| 23:32 | icey | what is the general quality level like in open source java libraries? and what is a good way to ascertain if a library sucks if you don't know java? |
| 23:33 | bhenry1 | icey: google "library-name sucks" and see if you get hits |
| 23:40 | icey | bhenry1: hah, alright; thanks :) |
| 23:43 | nickmbailey | bhenry1: i don't think that will work when running from a jar/uberjar right? |
| 23:43 | bhenry1 | it does in my project |
| 23:43 | bhenry1 | but you have to aot compile it |
| 23:43 | nickmbailey | java -jar projectname-version-standalone.jar ? |
| 23:43 | nickmbailey | yeah i do |
| 23:44 | bhenry1 | java -cp projectname-version-standalone.jar clojure.main |
| 23:44 | bhenry1 | i don't know if it works with the java -jar way |
| 23:45 | jli | is it idiomatic to prefer deftype/defrecord over struct-maps? |
| 23:45 | bhenry1 | jli: yes |
| 23:47 | nickmbailey | bhenry1: yeah that should work, dumb mistake on my part |
| 23:51 | nickmbailey | bhenry1: many thanks btw, a creative use of macros i wouldn't have thought of :) |
| 23:52 | bhenry1 | nickmbailey: that was my first macro i ever wrote. i got help from technomancy earlier this year. |
| 23:53 | nickmbailey | yeah i donno how i would've realized it was getting passed as a property in the jvm lein spawns |