2011-08-21
| 00:36 | ibdknox | srid: that is probably true |
| 00:43 | srid | reading the java examples to do this makes me cringe, http://stackoverflow.com/questions/637100/ |
| 00:43 | srid | nothing like a python one-liner ... urlopen(url).read(). sigh. |
| 00:47 | ibdknox | since that's a buffer I think you can just slurp it |
| 00:48 | ibdknox | I didn't look closely though |
| 00:51 | srid | slurp returns java.lang.String. the URL in question actually returns gzip encoded data. so slurp 'decoded' a gzipped binary stream?! |
| 00:52 | srid | right, as expected i cannot decompress the data returned by slurp: jvm throws "Not in GZIP format" |
| 00:52 | ibdknox | ah, like I said, I didn't look at it closely ;) |
| 00:53 | ibdknox | isn't there a header you can pass to say you don't support gzip? |
| 00:53 | ibdknox | that would be the simple solution |
| 00:53 | srid | no, the site will always return gzip compressed data; here's their rationale - http://api.stackoverflow.com/1.1/usage/gzip |
| 00:54 | ibdknox | wow |
| 00:54 | ibdknox | that makes me a little sad |
| 01:24 | srid | damn, I don't know why this error keeps coming up when compiling a .clj file: |
| 01:24 | srid | java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IObj |
| 01:24 | srid | this is what I have in the top of the file: |
| 01:24 | srid | (ns notaskinnerbox.stackexchange |
| 01:24 | srid | (:require [clj-http.client :as client]) |
| 01:24 | srid | (:import [java.util.zip GZIPInputStream] [java.net URL])) |
| 01:26 | srid | or the error is happening somewhere else, but line number is always 1 |
| 01:29 | srid | yup, it was on a different line. compiler error reporting is less than ideal. |
| 03:04 | furd | I'm having issues getting lein to do... anything really |
| 03:04 | furd | If I create a new lein project and go into it |
| 03:04 | furd | and attempt to open the repl or get deps or do any commands |
| 03:04 | furd | It gives me https://gist.github.com/1160272 |
| 03:10 | furd | Any ideas why? I'm not finding anything via google |
| 03:14 | furd | Running any lein command, even help or version, causes that error in a project directory |
| 03:17 | jli | furd: looks like something's wrong with your project.clj |
| 03:18 | jli | can you put it somewhere? |
| 03:18 | jli | this is from looking at "Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Named (project.clj:1)" |
| 03:18 | furd | yeah it's from a brand new lein new command, here I'll put it on the gist |
| 03:19 | furd | Added it as a comment, though it removed the indentation for some reason |
| 03:20 | furd | Oh is it as my project name is an int |
| 03:20 | pmbauer | furd: (defproject 14 <--- |
| 03:20 | pmbauer | 14 is not a symbol, but a numeric literal |
| 03:20 | pmbauer | So you can't name a lein project 14 |
| 03:21 | furd | Never would have assumed you can't name your project a number, though I suppose aside from doing Project Euler I don't know why you would |
| 03:21 | pmbauer | furd: try 'lein new fourteen' |
| 03:22 | pmbauer | or euler14 |
| 03:22 | furd | Will do, thank you very much. |
| 07:47 | msappler | hey |
| 07:48 | msappler | trying out amazon cloudfront for my clojure game application, can somebody test please (java webstart should work linux/mac/win): http://resatori.com/cyber-dungeon-quest |
| 07:51 | mikera | @msappler - works for me.... looks good! what graphics library are you using and how are you wrapping it? |
| 07:53 | msappler | I am using slick2d |
| 07:54 | msappler | i have open sourced a previous alpha you can take a look herehttps://code.google.com/p/clojure-rpg/ |
| 08:05 | MasseR | msappler: Works great |
| 08:08 | MasseR | A bit sluggish on loading and starting though |
| 08:12 | msappler | thanks ok |
| 08:20 | MasseR | And by "a bit sluggish" I mean that it took like 5 minutes starting the game after loading the jar files |
| 08:31 | msappler | yeah i know it takes a bit long |
| 08:32 | msappler | maybe because so many class files |
| 08:33 | michaelr525 | Hi! |
| 08:33 | michaelr525 | Is there a standard way to dechunkify sequences? |
| 08:34 | michaelr525 | I have a sequence of URLs that I intend to scrap one by one.. |
| 08:35 | mrBliss` | michaelr525: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ |
| 08:36 | michaelr525 | thanks, I've seen this one |
| 08:36 | michaelr525 | Was wondering maybe there is something more standard |
| 08:49 | fantazo | hi, could someone say me, what I'm making here wrong, so that the innerest fn of "connect-with" doesn't get executed? from my syntactic and semantic understanding of clojure it should execute. but why doesn't it? http://pastebin.com/0gqumjd0 |
| 08:55 | raek | fantazo: 'map' and 'for' are lazy and generate a sequence of values, which are only calculated when they are used. you are probably looking for (dorun (map ...)) or (doseq ...) if you want the side-effects from the functions rather their return values |
| 09:00 | raek | fantazo: also: (swap! atom (fn [x] (foo x a b c))) --> (swap! atom foo a b c) (map (fn [x] ...) coll) --> (for [x coll] ...) |
| 09:38 | fantazo | raek, thanks. |
| 09:49 | fantazo | when I want something like: {:a 1 :b {:thing (1 2 3)}} => {:a 1 :b {:thing (1 2 3 4}}, what is the best routine in the clojure library to do it? I'm currently trying to plug it together by myself, but it seems that I'm doing it not the clojure way. |
| 09:53 | raek | fantazo: ##(update-in {:a 1, :b {:c [1 2 3]}} [:b :c] conj 4) |
| 09:53 | lazybot | ⇒ {:a 1, :b {:c [1 2 3 4]}} |
| 09:54 | michaelr525 | how do you people debug in emacs? |
| 09:54 | michaelr525 | i'm not sure this sldb thing is working.. |
| 09:54 | fantazo | raek, you are very helpful, thank you sir. |
| 09:55 | michaelr525 | I get an exception and want the check the parameters of the function which has thrown the exception |
| 09:55 | michaelr525 | to check |
| 10:05 | michaelr525 | it shows no locals |
| 10:05 | michaelr525 | why? |
| 10:05 | clojurebot | why not? |
| 10:05 | michaelr525 | becase |
| 10:11 | raek | michaelr525: on the JVM the locals are not stored when an exception is thrown, so at the time you get hold of it they're gone. this is a bit unfortunate, but is the reason why that part of the slime/swank protocol is not implemented for clojure |
| 10:11 | raek | you need to use a real debugger to be able to see the locals |
| 10:13 | raek | for pure functions debugging is pretty simple: just call them with the interesting parameters in the repl. for non-pure code, the need for a debugger is of course more obvious |
| 10:15 | raek | so my personal way of debugging is to write as much of the code (that makes sense to be functional) in a functional style |
| 10:16 | raek | if a function does a computation and writes the result, split it into two functions: one that only does the calculation (pure) and one that does the I/O (impure) |
| 10:24 | pdk | sounds about what haskell imposes usually |
| 10:30 | Norrit | Hi, any idea where I can find the source code of let* ? |
| 10:31 | mudge | Is there a way in clojure to cause destructuring to work like this: (let [{keys}] code) and have each value in the keys collection assigned to a name of the same key for each value ? |
| 10:32 | Norrit | mudge: (let [{:keys [fred ethel lucy]} m] ... |
| 10:33 | mudge | Norrit: yes, i want it to work like that except I don't want to list the vector ie [fred ethel lucy], how do i do the same thing but not list the vector? |
| 10:33 | mudge | Norrit: so the vector is implicitly the keys in the collection |
| 10:34 | Norrit | ah, I don't think that is possible at the moment |
| 10:35 | Norrit | perhaps you could write a macro |
| 10:36 | mudge | Norrit: yea, maybe |
| 10:57 | michaelr525 | hey people |
| 10:57 | michaelr525 | so... can anyone help me with slime debugging? |
| 10:58 | michaelr525 | I'm using clojure-jack-in and I don't get locals in stack traces when an exception is throws |
| 10:58 | michaelr525 | thrown |
| 10:58 | michaelr525 | is this a known issue? |
| 11:00 | mudge | I want to user clj-time but when I look in Clojars, there's multiple jars for it: http://clojars.org/search?q=clj-time |
| 11:01 | mudge | how do i know which clj-time I should use? |
| 11:01 | mudge | how do I find out the latest and best clj-time to use? |
| 11:03 | michaelr525 | mudge: I'd look for the original author latest version and continue from there |
| 11:06 | mudge | the original author doesn't have clj-time on Clojars, or at least i can't tell if he does or not |
| 11:09 | michaelr525 | then take the latest version |
| 11:19 | raek | michaelr525: locals in stack traces are not suported without a debugger, for the reasons I mentioned before |
| 11:22 | michaelr525 | raek: sorry, I wasn't connected, is it in the channel log? |
| 11:23 | michaelr525 | raek: should I use cdt for debugging then? |
| 12:43 | jli | /a/u |
| 12:43 | jli | whoops |
| 12:50 | srid | learning clojure makes me humble; there is much to learn. |
| 12:58 | dnolen | hmm how can you do a fast array type instance check? |
| 13:04 | dnolen | oh yes matching on primitive array is disgustingly fast, https://gist.github.com/1160849 |
| 13:06 | jli | dnolen: nice. what's the :vec for? |
| 13:06 | dnolen | jli: :vec is a vector pattern |
| 13:06 | dnolen | that means you're pattern matching on a datatype that supports random access |
| 13:07 | dnolen | :vec without extra specialization works for persistent vectors |
| 13:09 | dnolen | but you can specialize the pattern matching to other types like i've shown here, with little effort |
| 13:09 | dnolen | not certain on the syntax yet for this, but it's working. |
| 13:15 | dnolen | hmm for primitive arrays I suppose you'd like to specify an offset … then you can use recur without much hassle |
| 13:18 | saalaa__ | could anyone give me a hand on this: |
| 13:18 | saalaa__ | (defmacro object [identifier documentation fields] `(defstruct ~identifier ~(keys fields))) |
| 13:18 | saalaa__ | as you'll probably have noticed, the struct won't be created correctly because the result of (keys fields) is a list |
| 13:19 | saalaa__ | I can't seem to find a way to "break" that list |
| 13:19 | dnolen | saalaa__: defstruct is deprecated. use ~@ to splice in the keys. |
| 13:19 | saalaa__ | dnolen: oh right |
| 13:20 | saalaa__ | also I'm using an old version of clojure |
| 13:20 | saalaa__ | thanks, I'll give ~@ a try |
| 13:21 | saalaa__ | I don't really need the features of defstruct; I guess I'll go for a map |
| 13:45 | dnolen | matching bits, a bit silly but fun, https://gist.github.com/1160849 |
| 13:46 | amalloy | mudge: you can't do the destrucuring thing you wanted |
| 13:47 | amalloy | (let [{[k1 k2]} m] ...) would be illegal because a map has to have an even number of entries: keys and values |
| 15:18 | dnolen | well match leaves Scala in the dust when matching primitive arrays. > 30X faster. |
| 15:33 | dnolen | faster than Racket too... |
| 15:41 | mudge | when I run "lein uberjar jobboard", it create two files, a jar file and a file named jobboard, what is the jobboard file? |
| 15:42 | mudge | why does "lein uberjar jobboard" create two files? |
| 16:05 | srid | question regarding accessing clojure docs: where do I go to see a list of all functions that are specific to a clojure hash map? |
| 16:06 | srid | for eg., I was specifically looking for a function that would return a subset of the map (chosen keys specified by me) |
| 16:08 | ibdknox | ,(doc select-keys) |
| 16:08 | clojurebot | "([map keyseq]); Returns a map containing only those entries in map whose key is in keys" |
| 16:08 | ibdknox | http://clojure.org/data_structures |
| 16:08 | ibdknox | srid |
| 16:09 | srid | right, thanks! .. i missed the official site. |
| 16:16 | coopernurse | srid: clojuredocs is also good, and has a quick ref that groups by data structure http://clojuredocs.org/quickref/Clojure%20Core |
| 16:16 | coopernurse | I like the examples on clojuredocs |
| 16:26 | srid | coopernurse: that's very handy! examples are what I most like about clojuredocs as well. |
| 16:26 | srid | coopernurse: btw, when I clicked on your link I see "Logged in as coopernurse" on the top-right corner. |
| 16:26 | srid | session caching bug? |
| 16:26 | coopernurse | srid: woah. on the clojuredocs site it says that? |
| 16:26 | srid | yes |
| 16:27 | srid | I hit the same bug while developing code.activestate.com |
| 16:27 | srid | then I remembered the I mistakenly cached the page header too. so if one user loaded the page, and when the next did the same immediately he would see the former user's page header |
| 16:27 | coopernurse | interesting.. so this is just a cosmetic issue? |
| 16:27 | coopernurse | for example, can you change my email address? |
| 16:28 | coopernurse | on my clojuredocs profile page |
| 16:28 | srid | no, it is only a page caching bug. it just loads it from the cache for me (which cache was last-updated when you did) |
| 16:29 | coopernurse | ah, interesting. I'll see if anyone has reported that on their feedback site |
| 16:30 | coopernurse | I don't see anything related to that |
| 16:31 | coopernurse | perfect, thanks |
| 16:31 | coopernurse | srid: I see you're at ActiveState.. I've walked by those offices many times (I'm in Seattle) |
| 16:32 | srid | oh, nice. |
| 16:35 | michaelr525 | hey people! |
| 16:44 | ibdknox | Open call for feedback on Noir: https://groups.google.com/forum/#!topic/clj-noir/rh3f8CyR9RE |
| 16:44 | ibdknox | I'm hoping to get 1.2.0 out in the next few days |
| 16:45 | srid | would creating a appengine noir project be as simple as running 'lein noir new' (without having to custom patch things later)? |
| 16:46 | srid | (in 1.2.0 rel., I mean) |
| 16:48 | coopernurse | srid: not sure. I've used appengine-magic to make appengine compojure projects |
| 16:48 | coopernurse | but not noir |
| 16:49 | coopernurse | https://github.com/gcv/appengine-magic |
| 16:50 | dnolen | new blog post, Solving the Mapping Dilemma - http://dosync.posterous.com/solving-the-mapping-dilemma |
| 16:50 | dnolen | please upvote on HN if you feel inclined. |
| 16:52 | srid | weird, (println) doesn't print anything for some reason. prints on repl, but not via 'lein run' |
| 16:54 | coopernurse | dnolen: great stuff |
| 16:54 | dnolen | coopernurse: thx! |
| 16:55 | eskatrem | is 4clojure.com down today? |
| 16:57 | michaelr525 | so, nobody ever has a problem with chunking? or everybody is using fogus' solution? or maybe there is some other secret dechunking trick? :) |
| 16:58 | srid | chunking? not sure what you are talking about. |
| 16:59 | michaelr525 | chunking in sequences.. |
| 16:59 | srid | ah ok |
| 16:59 | ibdknox | srid: there's a post in the mailing list about getting Noir running on appengine |
| 16:59 | dnolen | michaelr525: you can force one at time |
| 17:00 | michaelr525 | dnolen: how? |
| 17:00 | ibdknox | srid: https://groups.google.com/d/topic/clj-noir/5a-3mYzs8dA/discussion |
| 17:00 | michaelr525 | dnolen: oh, btw I like your blog posts but I think you are a bit crazy ;) |
| 17:01 | ibdknox | all the good ones *are* crazy |
| 17:01 | ibdknox | (inc dnolen) |
| 17:01 | lazybot | ⟹ 3 |
| 17:01 | dnolen | (fn lazier [s] (when s (cons (first s) (lazy-seq (lazier (next s)))) |
| 17:01 | dnolen | michaelr525: ^ |
| 17:02 | michaelr525 | let me try it.. |
| 17:02 | michaelr525 | it should go into core |
| 17:03 | dnolen | michaelr525: most of people that ask for it are solving Project Euler ;) |
| 17:04 | ibdknox | hmm |
| 17:04 | ibdknox | is clojurescript broken for anyone else if you do script/bootstrap |
| 17:04 | ibdknox | I just did a fresh clone of the repo |
| 17:05 | michaelr525 | me not. I'm just trying to scrap some website. I have a lazy list of urls, when evaluated the urls are actually fetched. so instead of fetching them one by one, I fetch them 24 by 24 |
| 17:07 | skelternet | Should I expect to have to resort to a macro when implementing a with-someresource pattern that uses a var? |
| 17:08 | srid | how do find the root cause of an error when the traceback has no source/line information? eg: https://gist.github.com/1161172 |
| 17:08 | srid | (inc srid) |
| 17:08 | lazybot | You can't adjust your own karma. |
| 17:08 | ibdknox | fun. |
| 17:09 | ibdknox | if you set clojurescript home with a trailing slash it blows up |
| 17:09 | ibdknox | lol |
| 17:09 | srid | ,(loop [u "srid"] (inc u) (recur u)) |
| 17:09 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number> |
| 17:09 | joshuahickman | Was there another intended effect of that code? |
| 17:10 | ibdknox | he's trying to increment his own karma |
| 17:10 | ibdknox | by getting the bot to do it |
| 17:10 | tufflax | ,(println "(inc srid)") |
| 17:10 | clojurebot | (inc srid) |
| 17:10 | lazybot | ⟹ 1 |
| 17:10 | joshuahickman | lol |
| 17:10 | srid | wow, nice |
| 17:10 | tufflax | hax! |
| 17:10 | srid | i was trying to find an exploit |
| 17:10 | tufflax | &(println "(inc srid)") |
| 17:10 | lazybot | ⇒ (inc srid) nil |
| 17:10 | ibdknox | OMG you're ruining our karma system |
| 17:10 | ibdknox | lol |
| 17:11 | tufflax | ,(println "(dec srid)") |
| 17:11 | clojurebot | (dec srid) |
| 17:11 | lazybot | ⟹ 0 |
| 17:11 | tufflax | :) |
| 17:11 | clojurebot | Huh? |
| 17:11 | ibdknox | hah |
| 17:14 | amalloy | eskatrem: yikes, thanks for the heads up. i'll see if i can figure out what's going oin |
| 17:16 | srid | answering my own question (above) - i forgot to put a "&" to form: (let [[a & b] aList] ...) |
| 17:16 | eskatrem | amalloy: I cant believe I was the only one using it! that website is awesome |
| 17:16 | tufflax | been there, done that, got the t-shirt |
| 17:16 | srid | tracebacks are not very useful, i have to think in possibilities to find where the error could have come from. |
| 17:17 | srid | would be very nice to have an IDE (including emacs) that can directly highlight the sexp form where the exception originates from |
| 17:17 | amalloy | eskatrem: no idea what was wrong, but the server was not running at all. back up now |
| 17:18 | eskatrem | amalloy: thank you. I am still stuck in the "easy" category, but I think I am improving |
| 17:19 | michaelr525 | srid: i wish i had locals in my tracebacks.. |
| 17:19 | srid | i would very happy even if there was line number information. |
| 17:21 | joshuahickman | You know, Dr. Scheme's error tracebacks are really useful |
| 17:21 | amalloy | dnolen: isn't that just (defn lazier [s] (iterate rest s))? |
| 17:21 | joshuahickman | I wish more IDEs were like that, particular ones where I don't have to use scheme |
| 17:21 | raek | srid: use (require ...ns... :reload) to get line numbers for the definitions. while in the stack trace, press "v" when an item is selected to jump to that place |
| 17:21 | amalloy | dnolen: or i guess rest knows about and preserves chunks, never mind |
| 17:23 | raek | you don't get line numbers if you load code by sending it to the repl, but you get them if clojure loads the code for you. |
| 17:23 | srid | raek: i don't understand. in the stack trace I saw <https://gist.github.com/1161172> there were no symbols used in my source, except for some unusual references like "core.clj:2382" (but core.clj has only a dozen lines or so) |
| 17:23 | raek | the "v" thing might not work for everything |
| 17:24 | raek | ah, this is a compiler exception... |
| 17:24 | raek | those are indeed not very helpful |
| 17:25 | amalloy | eskatrem: weird. the logs indicate that someone was looking up /problems/63— |
| 17:25 | raek | srid: the core.clj is clojure/core.clj |
| 17:25 | michaelr525 | dnolen: this lazier func did something weird |
| 17:25 | raek | srid: which version of clojure are you using? |
| 17:25 | amalloy | afaict it just issued a warning and survived, but what a bizarre uri |
| 17:25 | michaelr525 | maybe I should not defn it? |
| 17:25 | srid | raek: 1.2.1 I believe. |
| 17:26 | raek | srid: do you have a paste of the code? |
| 17:26 | raek | it is a syntax error somewhere in the code, but the exception message is not very helpful for finding out where |
| 17:26 | michaelr525 | it evaluated the lazy seq inside a defn while compiling from emacs-slime |
| 17:26 | michaelr525 | this is really bizarre |
| 17:27 | dnolen | michaelr525: paste |
| 17:27 | eskatrem | amalloy: I was looking at "Drop every Nth item" |
| 17:27 | raek | ,(let [[a b c] {:a 1, :b 2}] nil) |
| 17:27 | clojurebot | #<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap> |
| 17:27 | srid | raek: yes, the error was caused my forgetting to include a "&" in the loop assign [item & items] and [idx & indices]; see the full diff here, https://github.com/srid/notaskinnerbox/commit/db9bcd7b444b5985d6607242b8189e82f8f8ae06 |
| 17:28 | michaelr525 | dnolen: ok. I will prepare a small test case |
| 17:28 | srid | the commit above was the fixed version with & properly included. |
| 17:29 | srid | raek: it seemed more of a runtime error (because destructuring happens at runtime) than syntax error (shouldn't syntax errors be caught during compile time?) |
| 17:30 | amalloy_ | srid: you can write invalid destructuring forms |
| 17:31 | amalloy_ | &(let [{x :x}] (inc x)) ;; compiler exception |
| 17:31 | lazybot | java.lang.IllegalArgumentException: let requires an even number of forms in binding vector |
| 17:32 | raek | &(fn [] (let [{x :x}] (inc x))) |
| 17:32 | lazybot | java.lang.IllegalArgumentException: let requires an even number of forms in binding vector |
| 17:32 | raek | &(fn [] (let [[x y z] {:a 1, :b 2}] nil)) |
| 17:32 | lazybot | ⇒ #<sandbox13213$eval17885$fn__17886 sandbox13213$eval17885$fn__17886@7792e0> |
| 17:32 | raek | srid: you are right. it was a runtime exeption... |
| 17:34 | raek | hrm. and the stacktrace includes the line "at notaskinnerbox.core$_main.doInvoke(core.clj:24)" |
| 17:34 | coopernurse | I want to run (read-string) against each line in a file I'm reading, but still treat it as a lazy sequence. any suggestions? |
| 17:34 | raek | which points to the line which you fixed |
| 17:35 | coopernurse | I'm using (line-seq rdr) - and basically want to wrap (read-string) around it |
| 17:35 | raek | coopernurse: then you don't want to slurp the file and call read-string on that |
| 17:35 | raek | you can call read repeatedly on the reader |
| 17:35 | coopernurse | raek: ok thanks |
| 17:35 | raek | to lazilly read each form |
| 17:35 | coopernurse | but I thought (line-seq) is lazy |
| 17:36 | raek | this requires you to store the data as separate top-level forms, though |
| 17:36 | srid | raek: ah. I overlooked that. yes, #24 is the error's origin. |
| 17:36 | raek | coopernurse: ah, if each line is a clojure form then that works fine too |
| 17:36 | srid | yet the traceback _can_ be improved a bit. |
| 17:36 | coopernurse | yep, each line is a separate form |
| 17:37 | raek | then (map read-string (line-seq ...)) should work too |
| 17:37 | coopernurse | ah, of course |
| 17:37 | coopernurse | thanks |
| 17:37 | coopernurse | I keep forgetting that map is lazy |
| 17:38 | joshuahickman | I've got an insane question |
| 17:38 | joshuahickman | Is there any way to get leiningen to work for vanilla projects? |
| 17:38 | joshuahickman | It seems the people at work like it significantly better than their current build system |
| 17:38 | coopernurse | raek: that worked great, thanks |
| 17:39 | joshuahickman | *vanilla JAVA |
| 17:39 | joshuahickman | I suppose that vital detail should be included |
| 17:39 | raek | it should work for simple projects, at least |
| 17:40 | joshuahickman | Do you know if there is a reference for this somewhere? |
| 17:40 | joshuahickman | Google isn't helpful |
| 17:40 | coopernurse | does lein just wrap maven calls? |
| 17:40 | raek | "For projects that include some Java code, you can set the :java-source-path key in project.clj to a directory containing Java files. (You can set it to "src" to keep Java alongside Clojure source or keep them it in a separate directory.) Then the javac compiler will run before your Clojure code is AOT-compiled, or you can run it manually with the javac task." |
| 17:40 | coopernurse | oh, nice |
| 17:40 | michaelr525 | dnolen: here http://pastie.org/2408368 |
| 17:40 | coopernurse | that could come in handy |
| 17:40 | raek | joshuahickman: see the tutorial and the :java-source-path option |
| 17:41 | raek | someone mentioned a problem where lib/ was not on the classpath for javac, but I dunno if that has been solved |
| 17:41 | joshuahickman | Hmm... |
| 17:41 | joshuahickman | Thanks |
| 17:42 | raek | I just thought you might want to know that. if it is a bug, then it will probably be fixed very soon (updates are released quite frequently) |
| 17:43 | dnolen | michaelr525: so what's the problem? |
| 17:44 | joshuahickman | Yeah, that's ligit |
| 17:45 | joshuahickman | I'll have to figure out if having more than one leiningen project is needed, and if so, how to set up dependencies between them in that case |
| 17:46 | dnolen | gotta run. |
| 17:47 | michaelr525 | hmm |
| 17:47 | michaelr525 | thanks anyway |
| 17:51 | coopernurse | joshuahickman: you could probably use a standard maven repo to store your dependencies between projects. I haven't read the docs to see if you can tell lein which repo to publish to |
| 17:52 | coopernurse | yep, looks like you can. see this thread: http://stackoverflow.com/questions/3468461/push-to-nexus-using-leiningen |
| 17:52 | coopernurse | so you could run your own maven repo internally (e.g. artifactory) and setup your lein projects to deploy to that |
| 17:54 | coopernurse | going to head out for a while too.. bye all |
| 18:02 | eskatrem | why is this line not working? (apply and [true true false]) |
| 18:03 | gstamp | and is a macro |
| 18:03 | eskatrem | and it's not possible to apply a macro over a vector? how to do that then? |
| 18:04 | gstamp | I guess you could try something like this: (reduce #(and %1 %2) [false true true]) |
| 18:05 | gstamp | not sure if there is a better alternative |
| 18:07 | lucca | and normally takes a &rest |
| 18:07 | lucca | well.. that sort of thing |
| 18:07 | lucca | not &rest here, heh |
| 18:07 | lucca | if you reduce, you can't get the short-circuit eval |
| 18:08 | gstamp | that's true |
| 18:08 | gstamp | (excuse the pun) |
| 18:09 | eskatrem | (reduce #(and %1 %2) [false true true]) works |
| 18:09 | lucca | that was already mentioned |
| 18:11 | lucca | the difficulty here is you're mixing strict eval functions and a non-strict eval macro |
| 18:11 | lucca | something with reductions might be a better approach... |
| 18:29 | michaelr525 | damn |
| 18:30 | michaelr525 | I can't get slime/swank to show locals in exception traces |
| 18:30 | michaelr525 | I'm trying to do it from noon and now it's 1:30 am |
| 18:31 | michaelr525 | hhh |
| 18:33 | raek | michaelr525: it can't. |
| 18:33 | raek | you need a debugger for that |
| 18:33 | raek | http://pastebin.com/FzWEXR9j |
| 18:35 | mudge | hey, anybody here use lein ring uberwar ? |
| 18:36 | mudge | i used lein ring uberwar to drop my clojure program into tomcat |
| 18:36 | mudge | and tomcat has been deploying my war file for the last 20 minutes |
| 18:36 | mudge | 20 minutes seems too long for tomcat to deploy a file, usually it takes 20 seconds |
| 18:36 | mudge | any thoughts? |
| 18:41 | michaelr525 | raek: but I am using a debugger, or at least I think so. check cdt: http://georgejahad.com/clojure/swank-cdt.html, and here is a video that demonstrates some debugging http://www.youtube.com/watch?v=d_L51ID36w4 |
| 18:41 | ibdknox | mudge: I've done it |
| 18:41 | ibdknox | it was instantaneous |
| 18:42 | ibdknox | do you have any code that runs outside of a function? |
| 18:55 | mudge | hi ibdknox |
| 18:55 | mudge | ibdknox, no why? |
| 18:56 | ibdknox | that's often the source of such weird errors |
| 18:56 | ibdknox | for example |
| 18:56 | ibdknox | you can have code that starts up some thread (like in a def) and then sit forever waiting for you project to jar :) |
| 18:57 | mudge | ibdknox: ah okay, |
| 18:58 | mudge | yea, basically I have my tomcat6 trying to deploy my war file and nothing happens |
| 18:59 | mudge | the tomcat log says: INFO: Deploying web application archive jobs.war and it is deploying forever |
| 18:59 | mudge | and doesn't stop deploying |
| 19:05 | ibdknox | weird |
| 19:05 | ibdknox | I've definitely seen it work |
| 19:05 | ibdknox | but I've only done it once |
| 19:05 | ibdknox | lol |
| 19:07 | mudge | i restarted tomcat and my war file is deployed now |
| 20:06 | replaca | 0. |
| 20:46 | chewbranca | anyone know of a readability port in clojure? all my google searches return flame wars about lisp readable-ness :/ |
| 20:47 | chewbranca | I was keeping an eye on goose, which was a java lib, but apparently they ported over to scala |
| 20:49 | chewbranca | found this: https://github.com/getwoven/webmine taking a peek now |
| 22:11 | dsantiago | dnolen, I took a look at match today and couldn't figure out how regexes would get added from the source code. Would it be something you add to LiteralPattern? |
| 22:11 | duncanm | dnolen: nice blog post |
| 22:11 | dnolen | duncanm: thx |
| 22:12 | dnolen | dsantiago: no, you would need to add a RegexPattern datatype. |
| 22:13 | dnolen | dsantiago: it's probably a bit too early days to try and do this yourself :) I need to write up a detailed explanation about how to extend match. |
| 22:13 | duncanm | dnolen: having match with regexp would be cool |
| 22:13 | duncanm | dnolen: i liked that about scala, but i was a bit disappointed that they don't statically determine the number of capture groups |
| 22:14 | dnolen | duncanm: it would, how to implement RegexPattern yourself would probably be a good match tutorial. but I'm a bit busy with VectorPattern at the moment... |
| 22:15 | dnolen | duncanm: interesting, I'll have to remember that when I take a shot at getting it working in match. |
| 22:15 | dsantiago | dnolen, yeah, I was not filled with confidence after taking a peek. |
| 22:15 | dsantiago | But it would be really awesome. |
| 22:16 | dnolen | dsantiago: the part that's a bit of mind warp is manipulating the matrix. that needs serious step-by-step explanation. |
| 22:18 | dsantiago | Yeah, I wasn't too clear on any of it, even before that. |
| 22:18 | dsantiago | The p-for-n stuff, or whatever that was. |
| 22:19 | icey | ibdknox: the remote stuff in pinot is pretty cool. Is there anything on the horizon for raising events from the server to clients? (i.e. push / comet?) |
| 22:19 | dnolen | dsantiago: you're a brave person for even daring to take a peek :) there's a lot renaming in match's future. |
| 22:23 | dsantiago | You can always hope it's just a really easy oversight. |
| 22:24 | icey | it looks like closure has something meant for bi-directional server/client communication called BrowserChannel; but it appears to need appropriate handlers running on the server to make it work |
| 22:28 | dnolen | dsantiago: I'll probably be adding - match.array, match.bits, match.regex soon so definitely keep your eyes open. should be easier to understand how to do it when they are not mixed in with everything else. |
| 22:31 | dsantiago | dnolen, why is it that the array manipulations aren't general? |
| 22:32 | dnolen | dsantiago: what do you mean? |
| 22:32 | dsantiago | I guess I don't understand why every type has to rewrite its own version of the matrix manipulation. |
| 22:33 | dnolen | dsantiago: vector / array / byte all share the same matrix manipulation. |
| 22:33 | dnolen | map and sequences are fundamentally different datastructures so must be deal w/ differently. |
| 22:34 | dsantiago | But aren't we talking about an array of regexes here? |
| 22:34 | dsantiago | Array or vector? |
| 22:34 | dsantiago | Seems like the true/false logic from string/int equality would apply. |
| 22:35 | dnolen | I'm assuming people will want to match the seq of matches produced by the regex tho right? |
| 22:35 | dsantiago | Oh, hm. That's not what I was thinking about. |
| 22:37 | dsantiago | I was thinking like you give it a vector of strings, ints, whatever, and if the literal is a regex, it has to match a string. |
| 22:37 | dsantiago | So like, you could break a web route on /'s, and then match it against a vector of strings and regexes. |
| 22:38 | dnolen | you could definitely do that. |
| 22:40 | dsantiago | Without having to do the matrix specialization? :) |
| 22:40 | dnolen | dsantiago: if you wanted to keep it simple, yes it wouldn't be much work, you wouldn't need manipulate the matrix. |
| 22:40 | dnolen | you just need to implement RegexPattern and it's p-to-clj method should do the test. |
| 22:41 | dsantiago | Nice. |
| 22:41 | chewbranca | dnolen: dsantiago late to the conversation, ran into the same issue last night with regex and match, but wasn't sure how to add it in; luckily my problem allowed me to drop regex and instead simplify the match clause down to one piece and basically do the heavy lifting later |
| 22:42 | chewbranca | here's what I ended up doing, using a combination of match and multimethods: http://paste.lisp.org/display/124168 |
| 22:42 | dsantiago | dnolen, which class should I be mimicking? |
| 22:42 | dnolen | dsantiago: LiteralPattern. |
| 22:42 | chewbranca | I'm still new to clojure and lisp, so I still get my mind blown how simple and elegant some things can be in it |
| 22:42 | dnolen | chewbranca: fun stuff :) |
| 22:43 | chewbranca | that code was ported from an object oriented hierarchy of processing classes |
| 22:43 | dnolen | chewbranca: nice you're taking advantage of the expression sugar. |
| 22:43 | chewbranca | much cleaner |
| 22:43 | dnolen | (match [(expr)] ...) |
| 22:44 | chewbranca | dnolen: yeah that was helpful, I was using expressions as the result of what to run on a match, but realized that would get ugly in a hurry, then realized multimethods would work very well with it |
| 22:47 | chewbranca | dnolen: so what I was trying to understand about match, is if its possible (or a likely feature) to allow expressions in the match clauses? as right now it seems only static elements are allowed as match clauses, and I could definitely see it getting tricky and slow in a hurry to allow everything to be expressions, but I don't see how you would do something like a regex in your match clauses otherwise? |
| 22:48 | dnolen | chewbranca: yes, I'm thinking about supporting apply functions to things being matched. |
| 22:48 | chewbranca | wow that was not a well structured sentence |
| 22:48 | dnolen | [(1 :app inc)] |
| 22:48 | dnolen | so that would match only if after inc is applied. |
| 22:49 | chewbranca | dnolen: hrmm... not exactly following that, how would that work with a regex for example? |
| 22:50 | dnolen | for regexes it would just be something like |
| 22:50 | dnolen | [(_ :regex #"hello")] |
| 22:50 | dnolen | or |
| 22:51 | dnolen | [("foo.com" :regex #"^www\.")] |
| 22:51 | chewbranca | it seems like the underlying logic matrices you use to determine what columns had the most relevance would be very tricky if you can't figure out what its operating on, or is that what you mean by using apply, where you would apply the regex to a particular column, so you would at least be able to score the columns |
| 22:52 | dnolen | chewbranca: not really, :app is a kind of pattern that can be scored. |
| 22:53 | dnolen | [#"hello"] also valid of course, re: regex syntax. |
| 22:53 | chewbranca | dnolen: ok I see what you mean, so you declare the match specifically to be an operation operating on some column, I was confused how you would determine what the column would be if you're just using an expression |
| 22:55 | dnolen | chewbranca: yeah group by operation. putting really complex operations inside the match clauses is kinda gnarly anyhow. |
| 22:55 | dnolen | complex expressions I mean. |
| 22:56 | chewbranca | very true |
| 23:09 | dnolen | chewbranca: dsantiago: minimal regex example. |
| 23:09 | dnolen | https://github.com/swannodette/match/blob/vector-patterns/src/match/regex.clj |
| 23:10 | dsantiago | How funny, right as I hit the button to fork. |
| 23:10 | dsantiago | And you're already done. |
| 23:11 | dnolen | don't consider this the API tho, just something to play around with. |
| 23:12 | dsantiago | That's pretty much what I was planning to write. |
| 23:12 | chewbranca | dnolen: oh nice, that's slick |
| 23:12 | dsantiago | Pretty much RegexPattern exactly. |
| 23:12 | dnolen | chewbranca: yeah not much code eh :) |
| 23:12 | dsantiago | I'd have run into more trouble with the rest. |
| 23:14 | chewbranca | dnolen: yeah code quantity is impressive |
| 23:15 | dnolen | to String bit not even really necessary, that's just for debugging. |
| 23:15 | dnolen | toString I mean. |
| 23:16 | dnolen | check it out |
| 23:16 | dnolen | https://github.com/swannodette/match/blob/vector-patterns/src/match/regex.clj |
| 23:17 | dnolen | chewbranca: dsantiago: way shorter/cleaner if you use defrecord |
| 23:17 | clojurebot | llahna: anyway the answer is no. you can use #(some-fn %1 default-arg %2), for example |
| 23:18 | dsantiago | dnolen, looks good enough for me to use. |
| 23:19 | chewbranca | dnolen: oh interesting, I need to look more into deftype and defrecord, just started looking into them today |
| 23:20 | dnolen | dsantiago: you should just copy and paste that for now, don't really want to mainline that just yet. |
| 23:20 | dsantiago | OK. |
| 23:21 | chewbranca | dnolen: cool, just grabbed a copy of it |
| 23:27 | chewbranca | any of the getwoven guys hang out here? |
| 23:39 | technomancy | ibdknox: pong |
| 23:49 | chewbranca | technomancy: hey quick question, any plans on supporting direct git sources in lein projects, or just sticking with local maven repos? |
| 23:51 | technomancy | chewbranca: not sure if it's quite what you want, but that sounds a bit like checkout dependencies; see the faq |
| 23:55 | chewbranca | technomancy: checking it out |
| 23:56 | dnolen | ,(.indexOf [:a :b :c :d] :c) |
| 23:56 | clojurebot | 2 |