#clojure logs

2011-08-21

00:36ibdknoxsrid: that is probably true
00:43sridreading the java examples to do this makes me cringe, http://stackoverflow.com/questions/637100/
00:43sridnothing like a python one-liner ... urlopen(url).read(). sigh.
00:47ibdknoxsince that's a buffer I think you can just slurp it
00:48ibdknoxI didn't look closely though
00:51sridslurp returns java.lang.String. the URL in question actually returns gzip encoded data. so slurp 'decoded' a gzipped binary stream?!
00:52sridright, as expected i cannot decompress the data returned by slurp: jvm throws "Not in GZIP format"
00:52ibdknoxah, like I said, I didn't look at it closely ;)
00:53ibdknoxisn't there a header you can pass to say you don't support gzip?
00:53ibdknoxthat would be the simple solution
00:53sridno, the site will always return gzip compressed data; here's their rationale - http://api.stackoverflow.com/1.1/usage/gzip
00:54ibdknoxwow
00:54ibdknoxthat makes me a little sad
01:24sriddamn, I don't know why this error keeps coming up when compiling a .clj file:
01:24sridjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IObj
01:24sridthis is what I have in the top of the file:
01:24srid(ns notaskinnerbox.stackexchange
01:24srid (:require [clj-http.client :as client])
01:24srid (:import [java.util.zip GZIPInputStream] [java.net URL]))
01:26sridor the error is happening somewhere else, but line number is always 1
01:29sridyup, it was on a different line. compiler error reporting is less than ideal.
03:04furdI'm having issues getting lein to do... anything really
03:04furdIf I create a new lein project and go into it
03:04furdand attempt to open the repl or get deps or do any commands
03:04furdIt gives me https://gist.github.com/1160272
03:10furdAny ideas why? I'm not finding anything via google
03:14furdRunning any lein command, even help or version, causes that error in a project directory
03:17jlifurd: looks like something's wrong with your project.clj
03:18jlican you put it somewhere?
03:18jlithis is from looking at "Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Named (project.clj:1)"
03:18furdyeah it's from a brand new lein new command, here I'll put it on the gist
03:19furdAdded it as a comment, though it removed the indentation for some reason
03:20furdOh is it as my project name is an int
03:20pmbauerfurd: (defproject 14 <---
03:20pmbauer14 is not a symbol, but a numeric literal
03:20pmbauerSo you can't name a lein project 14
03:21furdNever 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:21pmbauerfurd: try 'lein new fourteen'
03:22pmbaueror euler14
03:22furdWill do, thank you very much.
07:47msapplerhey
07:48msapplertrying 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:51mikera@msappler - works for me.... looks good! what graphics library are you using and how are you wrapping it?
07:53msapplerI am using slick2d
07:54msappleri have open sourced a previous alpha you can take a look herehttps://code.google.com/p/clojure-rpg/
08:05MasseRmsappler: Works great
08:08MasseRA bit sluggish on loading and starting though
08:12msapplerthanks ok
08:20MasseRAnd by "a bit sluggish" I mean that it took like 5 minutes starting the game after loading the jar files
08:31msappleryeah i know it takes a bit long
08:32msapplermaybe because so many class files
08:33michaelr525Hi!
08:33michaelr525Is there a standard way to dechunkify sequences?
08:34michaelr525I have a sequence of URLs that I intend to scrap one by one..
08:35mrBliss`michaelr525: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/
08:36michaelr525thanks, I've seen this one
08:36michaelr525Was wondering maybe there is something more standard
08:49fantazohi, 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:55raekfantazo: '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:00raekfantazo: also: (swap! atom (fn [x] (foo x a b c))) --> (swap! atom foo a b c) (map (fn [x] ...) coll) --> (for [x coll] ...)
09:38fantazoraek, thanks.
09:49fantazowhen 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:53raekfantazo: ##(update-in {:a 1, :b {:c [1 2 3]}} [:b :c] conj 4)
09:53lazybot⇒ {:a 1, :b {:c [1 2 3 4]}}
09:54michaelr525how do you people debug in emacs?
09:54michaelr525i'm not sure this sldb thing is working..
09:54fantazoraek, you are very helpful, thank you sir.
09:55michaelr525I get an exception and want the check the parameters of the function which has thrown the exception
09:55michaelr525to check
10:05michaelr525it shows no locals
10:05michaelr525why?
10:05clojurebotwhy not?
10:05michaelr525becase
10:11raekmichaelr525: 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:11raekyou need to use a real debugger to be able to see the locals
10:13raekfor 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:15raekso my personal way of debugging is to write as much of the code (that makes sense to be functional) in a functional style
10:16raekif 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:24pdksounds about what haskell imposes usually
10:30NorritHi, any idea where I can find the source code of let* ?
10:31mudgeIs 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:32Norritmudge: (let [{:keys [fred ethel lucy]} m] ...
10:33mudgeNorrit: 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:33mudgeNorrit: so the vector is implicitly the keys in the collection
10:34Norritah, I don't think that is possible at the moment
10:35Norritperhaps you could write a macro
10:36mudgeNorrit: yea, maybe
10:57michaelr525hey people
10:57michaelr525so... can anyone help me with slime debugging?
10:58michaelr525I'm using clojure-jack-in and I don't get locals in stack traces when an exception is throws
10:58michaelr525thrown
10:58michaelr525is this a known issue?
11:00mudgeI 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:01mudgehow do i know which clj-time I should use?
11:01mudgehow do I find out the latest and best clj-time to use?
11:03michaelr525mudge: I'd look for the original author latest version and continue from there
11:06mudgethe original author doesn't have clj-time on Clojars, or at least i can't tell if he does or not
11:09michaelr525then take the latest version
11:19raekmichaelr525: locals in stack traces are not suported without a debugger, for the reasons I mentioned before
11:22michaelr525raek: sorry, I wasn't connected, is it in the channel log?
11:23michaelr525raek: should I use cdt for debugging then?
12:43jli/a/u
12:43jliwhoops
12:50sridlearning clojure makes me humble; there is much to learn.
12:58dnolenhmm how can you do a fast array type instance check?
13:04dnolenoh yes matching on primitive array is disgustingly fast, https://gist.github.com/1160849
13:06jlidnolen: nice. what's the :vec for?
13:06dnolenjli: :vec is a vector pattern
13:06dnolenthat means you're pattern matching on a datatype that supports random access
13:07dnolen:vec without extra specialization works for persistent vectors
13:09dnolenbut you can specialize the pattern matching to other types like i've shown here, with little effort
13:09dnolennot certain on the syntax yet for this, but it's working.
13:15dnolenhmm for primitive arrays I suppose you'd like to specify an offset … then you can use recur without much hassle
13:18saalaa__could anyone give me a hand on this:
13:18saalaa__(defmacro object [identifier documentation fields] `(defstruct ~identifier ~(keys fields)))
13:18saalaa__as you'll probably have noticed, the struct won't be created correctly because the result of (keys fields) is a list
13:19saalaa__I can't seem to find a way to "break" that list
13:19dnolensaalaa__: defstruct is deprecated. use ~@ to splice in the keys.
13:19saalaa__dnolen: oh right
13:20saalaa__also I'm using an old version of clojure
13:20saalaa__thanks, I'll give ~@ a try
13:21saalaa__I don't really need the features of defstruct; I guess I'll go for a map
13:45dnolenmatching bits, a bit silly but fun, https://gist.github.com/1160849
13:46amalloymudge: you can't do the destrucuring thing you wanted
13:47amalloy(let [{[k1 k2]} m] ...) would be illegal because a map has to have an even number of entries: keys and values
15:18dnolenwell match leaves Scala in the dust when matching primitive arrays. > 30X faster.
15:33dnolenfaster than Racket too...
15:41mudgewhen I run "lein uberjar jobboard", it create two files, a jar file and a file named jobboard, what is the jobboard file?
15:42mudgewhy does "lein uberjar jobboard" create two files?
16:05sridquestion regarding accessing clojure docs: where do I go to see a list of all functions that are specific to a clojure hash map?
16:06sridfor eg., I was specifically looking for a function that would return a subset of the map (chosen keys specified by me)
16:08ibdknox,(doc select-keys)
16:08clojurebot"([map keyseq]); Returns a map containing only those entries in map whose key is in keys"
16:08ibdknoxhttp://clojure.org/data_structures
16:08ibdknoxsrid
16:09sridright, thanks! .. i missed the official site.
16:16coopernursesrid: clojuredocs is also good, and has a quick ref that groups by data structure http://clojuredocs.org/quickref/Clojure%20Core
16:16coopernurseI like the examples on clojuredocs
16:26sridcoopernurse: that's very handy! examples are what I most like about clojuredocs as well.
16:26sridcoopernurse: btw, when I clicked on your link I see "Logged in as coopernurse" on the top-right corner.
16:26sridsession caching bug?
16:26coopernursesrid: woah. on the clojuredocs site it says that?
16:26sridyes
16:27sridI hit the same bug while developing code.activestate.com
16:27sridthen 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:27coopernurseinteresting.. so this is just a cosmetic issue?
16:27coopernursefor example, can you change my email address?
16:28coopernurseon my clojuredocs profile page
16:28sridno, 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:29coopernurseah, interesting. I'll see if anyone has reported that on their feedback site
16:30coopernurseI don't see anything related to that
16:31coopernurseperfect, thanks
16:31coopernursesrid: I see you're at ActiveState.. I've walked by those offices many times (I'm in Seattle)
16:32sridoh, nice.
16:35michaelr525hey people!
16:44ibdknoxOpen call for feedback on Noir: https://groups.google.com/forum/#!topic/clj-noir/rh3f8CyR9RE
16:44ibdknoxI'm hoping to get 1.2.0 out in the next few days
16:45sridwould creating a appengine noir project be as simple as running 'lein noir new' (without having to custom patch things later)?
16:46srid(in 1.2.0 rel., I mean)
16:48coopernursesrid: not sure. I've used appengine-magic to make appengine compojure projects
16:48coopernursebut not noir
16:49coopernursehttps://github.com/gcv/appengine-magic
16:50dnolennew blog post, Solving the Mapping Dilemma - http://dosync.posterous.com/solving-the-mapping-dilemma
16:50dnolenplease upvote on HN if you feel inclined.
16:52sridweird, (println) doesn't print anything for some reason. prints on repl, but not via 'lein run'
16:54coopernursednolen: great stuff
16:54dnolencoopernurse: thx!
16:55eskatremis 4clojure.com down today?
16:57michaelr525so, nobody ever has a problem with chunking? or everybody is using fogus' solution? or maybe there is some other secret dechunking trick? :)
16:58sridchunking? not sure what you are talking about.
16:59michaelr525chunking in sequences..
16:59sridah ok
16:59ibdknoxsrid: there's a post in the mailing list about getting Noir running on appengine
16:59dnolenmichaelr525: you can force one at time
17:00michaelr525dnolen: how?
17:00ibdknoxsrid: https://groups.google.com/d/topic/clj-noir/5a-3mYzs8dA/discussion
17:00michaelr525dnolen: oh, btw I like your blog posts but I think you are a bit crazy ;)
17:01ibdknoxall the good ones *are* crazy
17:01ibdknox(inc dnolen)
17:01lazybot⟹ 3
17:01dnolen(fn lazier [s] (when s (cons (first s) (lazy-seq (lazier (next s))))
17:01dnolenmichaelr525: ^
17:02michaelr525let me try it..
17:02michaelr525it should go into core
17:03dnolenmichaelr525: most of people that ask for it are solving Project Euler ;)
17:04ibdknoxhmm
17:04ibdknoxis clojurescript broken for anyone else if you do script/bootstrap
17:04ibdknoxI just did a fresh clone of the repo
17:05michaelr525me 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:07skelternetShould I expect to have to resort to a macro when implementing a with-someresource pattern that uses a var?
17:08sridhow do find the root cause of an error when the traceback has no source/line information? eg: https://gist.github.com/1161172
17:08srid(inc srid)
17:08lazybotYou can't adjust your own karma.
17:08ibdknoxfun.
17:09ibdknoxif you set clojurescript home with a trailing slash it blows up
17:09ibdknoxlol
17:09srid,(loop [u "srid"] (inc u) (recur u))
17:09clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number>
17:09joshuahickmanWas there another intended effect of that code?
17:10ibdknoxhe's trying to increment his own karma
17:10ibdknoxby getting the bot to do it
17:10tufflax,(println "(inc srid)")
17:10clojurebot(inc srid)
17:10lazybot⟹ 1
17:10joshuahickmanlol
17:10sridwow, nice
17:10tufflaxhax!
17:10sridi was trying to find an exploit
17:10tufflax&(println "(inc srid)")
17:10lazybot⇒ (inc srid) nil
17:10ibdknoxOMG you're ruining our karma system
17:10ibdknoxlol
17:11tufflax,(println "(dec srid)")
17:11clojurebot(dec srid)
17:11lazybot⟹ 0
17:11tufflax:)
17:11clojurebotHuh?
17:11ibdknoxhah
17:14amalloyeskatrem: yikes, thanks for the heads up. i'll see if i can figure out what's going oin
17:16sridanswering my own question (above) - i forgot to put a "&" to form: (let [[a & b] aList] ...)
17:16eskatremamalloy: I cant believe I was the only one using it! that website is awesome
17:16tufflaxbeen there, done that, got the t-shirt
17:16sridtracebacks are not very useful, i have to think in possibilities to find where the error could have come from.
17:17sridwould be very nice to have an IDE (including emacs) that can directly highlight the sexp form where the exception originates from
17:17amalloyeskatrem: no idea what was wrong, but the server was not running at all. back up now
17:18eskatremamalloy: thank you. I am still stuck in the "easy" category, but I think I am improving
17:19michaelr525srid: i wish i had locals in my tracebacks..
17:19sridi would very happy even if there was line number information.
17:21joshuahickmanYou know, Dr. Scheme's error tracebacks are really useful
17:21amalloydnolen: isn't that just (defn lazier [s] (iterate rest s))?
17:21joshuahickmanI wish more IDEs were like that, particular ones where I don't have to use scheme
17:21raeksrid: 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:21amalloydnolen: or i guess rest knows about and preserves chunks, never mind
17:23raekyou 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:23sridraek: i don't understand. in the stack trace I saw <https://gist.github.com/1161172&gt; 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:23raekthe "v" thing might not work for everything
17:24raekah, this is a compiler exception...
17:24raekthose are indeed not very helpful
17:25amalloyeskatrem: weird. the logs indicate that someone was looking up /problems/63—
17:25raeksrid: the core.clj is clojure/core.clj
17:25michaelr525dnolen: this lazier func did something weird
17:25raeksrid: which version of clojure are you using?
17:25amalloyafaict it just issued a warning and survived, but what a bizarre uri
17:25michaelr525maybe I should not defn it?
17:25sridraek: 1.2.1 I believe.
17:26raeksrid: do you have a paste of the code?
17:26raekit is a syntax error somewhere in the code, but the exception message is not very helpful for finding out where
17:26michaelr525it evaluated the lazy seq inside a defn while compiling from emacs-slime
17:26michaelr525this is really bizarre
17:27dnolenmichaelr525: paste
17:27eskatremamalloy: I was looking at "Drop every Nth item"
17:27raek,(let [[a b c] {:a 1, :b 2}] nil)
17:27clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap>
17:27sridraek: 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:28michaelr525dnolen: ok. I will prepare a small test case
17:28sridthe commit above was the fixed version with & properly included.
17:29sridraek: 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:30amalloy_srid: you can write invalid destructuring forms
17:31amalloy_&(let [{x :x}] (inc x)) ;; compiler exception
17:31lazybotjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector
17:32raek&(fn [] (let [{x :x}] (inc x)))
17:32lazybotjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector
17:32raek&(fn [] (let [[x y z] {:a 1, :b 2}] nil))
17:32lazybot⇒ #<sandbox13213$eval17885$fn__17886 sandbox13213$eval17885$fn__17886@7792e0>
17:32raeksrid: you are right. it was a runtime exeption...
17:34raekhrm. and the stacktrace includes the line "at notaskinnerbox.core$_main.doInvoke(core.clj:24)"
17:34coopernurseI 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:34raekwhich points to the line which you fixed
17:35coopernurseI'm using (line-seq rdr) - and basically want to wrap (read-string) around it
17:35raekcoopernurse: then you don't want to slurp the file and call read-string on that
17:35raekyou can call read repeatedly on the reader
17:35coopernurseraek: ok thanks
17:35raekto lazilly read each form
17:35coopernursebut I thought (line-seq) is lazy
17:36raekthis requires you to store the data as separate top-level forms, though
17:36sridraek: ah. I overlooked that. yes, #24 is the error's origin.
17:36raekcoopernurse: ah, if each line is a clojure form then that works fine too
17:36sridyet the traceback _can_ be improved a bit.
17:36coopernurseyep, each line is a separate form
17:37raekthen (map read-string (line-seq ...)) should work too
17:37coopernurseah, of course
17:37coopernursethanks
17:37coopernurseI keep forgetting that map is lazy
17:38joshuahickmanI've got an insane question
17:38joshuahickmanIs there any way to get leiningen to work for vanilla projects?
17:38joshuahickmanIt seems the people at work like it significantly better than their current build system
17:38coopernurseraek: that worked great, thanks
17:39joshuahickman*vanilla JAVA
17:39joshuahickmanI suppose that vital detail should be included
17:39raekit should work for simple projects, at least
17:40joshuahickmanDo you know if there is a reference for this somewhere?
17:40joshuahickmanGoogle isn't helpful
17:40coopernursedoes lein just wrap maven calls?
17:40raek"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:40coopernurseoh, nice
17:40michaelr525dnolen: here http://pastie.org/2408368
17:40coopernursethat could come in handy
17:40raekjoshuahickman: see the tutorial and the :java-source-path option
17:41raeksomeone mentioned a problem where lib/ was not on the classpath for javac, but I dunno if that has been solved
17:41joshuahickmanHmm...
17:41joshuahickmanThanks
17:42raekI 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:43dnolenmichaelr525: so what's the problem?
17:44joshuahickmanYeah, that's ligit
17:45joshuahickmanI'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:46dnolengotta run.
17:47michaelr525hmm
17:47michaelr525thanks anyway
17:51coopernursejoshuahickman: 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:52coopernurseyep, looks like you can. see this thread: http://stackoverflow.com/questions/3468461/push-to-nexus-using-leiningen
17:52coopernurseso you could run your own maven repo internally (e.g. artifactory) and setup your lein projects to deploy to that
17:54coopernursegoing to head out for a while too.. bye all
18:02eskatremwhy is this line not working? (apply and [true true false])
18:03gstampand is a macro
18:03eskatremand it's not possible to apply a macro over a vector? how to do that then?
18:04gstampI guess you could try something like this: (reduce #(and %1 %2) [false true true])
18:05gstampnot sure if there is a better alternative
18:07luccaand normally takes a &rest
18:07luccawell.. that sort of thing
18:07luccanot &rest here, heh
18:07luccaif you reduce, you can't get the short-circuit eval
18:08gstampthat's true
18:08gstamp(excuse the pun)
18:09eskatrem(reduce #(and %1 %2) [false true true]) works
18:09luccathat was already mentioned
18:11luccathe difficulty here is you're mixing strict eval functions and a non-strict eval macro
18:11luccasomething with reductions might be a better approach...
18:29michaelr525damn
18:30michaelr525I can't get slime/swank to show locals in exception traces
18:30michaelr525I'm trying to do it from noon and now it's 1:30 am
18:31michaelr525hhh
18:33raekmichaelr525: it can't.
18:33raekyou need a debugger for that
18:33raekhttp://pastebin.com/FzWEXR9j
18:35mudgehey, anybody here use lein ring uberwar ?
18:36mudgei used lein ring uberwar to drop my clojure program into tomcat
18:36mudgeand tomcat has been deploying my war file for the last 20 minutes
18:36mudge20 minutes seems too long for tomcat to deploy a file, usually it takes 20 seconds
18:36mudgeany thoughts?
18:41michaelr525raek: 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:41ibdknoxmudge: I've done it
18:41ibdknoxit was instantaneous
18:42ibdknoxdo you have any code that runs outside of a function?
18:55mudgehi ibdknox
18:55mudgeibdknox, no why?
18:56ibdknoxthat's often the source of such weird errors
18:56ibdknoxfor example
18:56ibdknoxyou can have code that starts up some thread (like in a def) and then sit forever waiting for you project to jar :)
18:57mudgeibdknox: ah okay,
18:58mudgeyea, basically I have my tomcat6 trying to deploy my war file and nothing happens
18:59mudgethe tomcat log says: INFO: Deploying web application archive jobs.war and it is deploying forever
18:59mudgeand doesn't stop deploying
19:05ibdknoxweird
19:05ibdknoxI've definitely seen it work
19:05ibdknoxbut I've only done it once
19:05ibdknoxlol
19:07mudgei restarted tomcat and my war file is deployed now
20:06replaca0.
20:46chewbrancaanyone know of a readability port in clojure? all my google searches return flame wars about lisp readable-ness :/
20:47chewbrancaI was keeping an eye on goose, which was a java lib, but apparently they ported over to scala
20:49chewbrancafound this: https://github.com/getwoven/webmine taking a peek now
22:11dsantiagodnolen, 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:11duncanmdnolen: nice blog post
22:11dnolenduncanm: thx
22:12dnolendsantiago: no, you would need to add a RegexPattern datatype.
22:13dnolendsantiago: 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:13duncanmdnolen: having match with regexp would be cool
22:13duncanmdnolen: i liked that about scala, but i was a bit disappointed that they don't statically determine the number of capture groups
22:14dnolenduncanm: 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:15dnolenduncanm: interesting, I'll have to remember that when I take a shot at getting it working in match.
22:15dsantiagodnolen, yeah, I was not filled with confidence after taking a peek.
22:15dsantiagoBut it would be really awesome.
22:16dnolendsantiago: the part that's a bit of mind warp is manipulating the matrix. that needs serious step-by-step explanation.
22:18dsantiagoYeah, I wasn't too clear on any of it, even before that.
22:18dsantiagoThe p-for-n stuff, or whatever that was.
22:19iceyibdknox: 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:19dnolendsantiago: you're a brave person for even daring to take a peek :) there's a lot renaming in match's future.
22:23dsantiagoYou can always hope it's just a really easy oversight.
22:24iceyit 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:28dnolendsantiago: 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:31dsantiagodnolen, why is it that the array manipulations aren't general?
22:32dnolendsantiago: what do you mean?
22:32dsantiagoI guess I don't understand why every type has to rewrite its own version of the matrix manipulation.
22:33dnolendsantiago: vector / array / byte all share the same matrix manipulation.
22:33dnolenmap and sequences are fundamentally different datastructures so must be deal w/ differently.
22:34dsantiagoBut aren't we talking about an array of regexes here?
22:34dsantiagoArray or vector?
22:34dsantiagoSeems like the true/false logic from string/int equality would apply.
22:35dnolenI'm assuming people will want to match the seq of matches produced by the regex tho right?
22:35dsantiagoOh, hm. That's not what I was thinking about.
22:37dsantiagoI 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:37dsantiagoSo like, you could break a web route on /'s, and then match it against a vector of strings and regexes.
22:38dnolenyou could definitely do that.
22:40dsantiagoWithout having to do the matrix specialization? :)
22:40dnolendsantiago: if you wanted to keep it simple, yes it wouldn't be much work, you wouldn't need manipulate the matrix.
22:40dnolenyou just need to implement RegexPattern and it's p-to-clj method should do the test.
22:41dsantiagoNice.
22:41chewbrancadnolen: 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:42chewbrancahere's what I ended up doing, using a combination of match and multimethods: http://paste.lisp.org/display/124168
22:42dsantiagodnolen, which class should I be mimicking?
22:42dnolendsantiago: LiteralPattern.
22:42chewbrancaI'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:42dnolenchewbranca: fun stuff :)
22:43chewbrancathat code was ported from an object oriented hierarchy of processing classes
22:43dnolenchewbranca: nice you're taking advantage of the expression sugar.
22:43chewbrancamuch cleaner
22:43dnolen(match [(expr)] ...)
22:44chewbrancadnolen: 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:47chewbrancadnolen: 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:48dnolenchewbranca: yes, I'm thinking about supporting apply functions to things being matched.
22:48chewbrancawow that was not a well structured sentence
22:48dnolen[(1 :app inc)]
22:48dnolenso that would match only if after inc is applied.
22:49chewbrancadnolen: hrmm... not exactly following that, how would that work with a regex for example?
22:50dnolenfor regexes it would just be something like
22:50dnolen[(_ :regex #"hello")]
22:50dnolenor
22:51dnolen[("foo.com" :regex #"^www\.")]
22:51chewbrancait 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:52dnolenchewbranca: not really, :app is a kind of pattern that can be scored.
22:53dnolen[#"hello"] also valid of course, re: regex syntax.
22:53chewbrancadnolen: 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:55dnolenchewbranca: yeah group by operation. putting really complex operations inside the match clauses is kinda gnarly anyhow.
22:55dnolencomplex expressions I mean.
22:56chewbrancavery true
23:09dnolenchewbranca: dsantiago: minimal regex example.
23:09dnolenhttps://github.com/swannodette/match/blob/vector-patterns/src/match/regex.clj
23:10dsantiagoHow funny, right as I hit the button to fork.
23:10dsantiagoAnd you're already done.
23:11dnolendon't consider this the API tho, just something to play around with.
23:12dsantiagoThat's pretty much what I was planning to write.
23:12chewbrancadnolen: oh nice, that's slick
23:12dsantiagoPretty much RegexPattern exactly.
23:12dnolenchewbranca: yeah not much code eh :)
23:12dsantiagoI'd have run into more trouble with the rest.
23:14chewbrancadnolen: yeah code quantity is impressive
23:15dnolento String bit not even really necessary, that's just for debugging.
23:15dnolentoString I mean.
23:16dnolencheck it out
23:16dnolenhttps://github.com/swannodette/match/blob/vector-patterns/src/match/regex.clj
23:17dnolenchewbranca: dsantiago: way shorter/cleaner if you use defrecord
23:17clojurebotllahna: anyway the answer is no. you can use #(some-fn %1 default-arg %2), for example
23:18dsantiagodnolen, looks good enough for me to use.
23:19chewbrancadnolen: oh interesting, I need to look more into deftype and defrecord, just started looking into them today
23:20dnolendsantiago: you should just copy and paste that for now, don't really want to mainline that just yet.
23:20dsantiagoOK.
23:21chewbrancadnolen: cool, just grabbed a copy of it
23:27chewbrancaany of the getwoven guys hang out here?
23:39technomancyibdknox: pong
23:49chewbrancatechnomancy: hey quick question, any plans on supporting direct git sources in lein projects, or just sticking with local maven repos?
23:51technomancychewbranca: not sure if it's quite what you want, but that sounds a bit like checkout dependencies; see the faq
23:55chewbrancatechnomancy: checking it out
23:56dnolen,(.indexOf [:a :b :c :d] :c)
23:56clojurebot2