#clojure logs

2010-03-19

00:06zaphar_psare there any decent compojure tutorials?
00:56zaphar_psgahhh
00:56zaphar_pscompojure out of the box won't work on appengine
01:01psykotici wish that s/concat/cat/
01:02psykoticshorter, reminiscent of unix cat, symmetric with mapcat, etc
01:13bytecoderzaphar_ps: the change required to make compojure work on app engine is quite simple though.
01:13zaphar_psyeah I don't even have to modify compojure like I thought
01:13zaphar_psjust change my use statements
01:14zaphar_pslose a little convenience but gain appengine
01:14bytecoderzaphar_ps: that's right.
01:14zaphar_psnow that I have a working hello world on appengine I should blog my setup with appengine, leiningen, compojure and emacs
01:15zaphar_psafter some sleep
01:15zaphar_psthat took longer than I thought it would getting everything setup.
01:16bytecoderi followed this blog to setup a helloworld app in appengine: http://elhumidor.blogspot.com/2009/04/clojure-on-google-appengine.html
01:18hiredmanyou know there is a skeleton lein appengine project on github you can checkout and run with
01:18hiredman(well, I guess you must not know)
01:34psykotichiredman: did you see my promise-based hack for tying knots with letrec? http://gist.github.com/336461
01:36hiredmana generalized letfn often seems like it would be nice
01:38psykoticyeah. you always want letrec references to be "guarded" behind a lambda, but often the lambda isn't the whole thing, only a part of something bigger (e.g. a list in the case of my lazy-seq example, or another case might be in a recursive monadic expression)
01:43psykotici came up with this implementation based on the standard way letrec is implemented in terms of let, and the standard implementation of assignable locals in scheme compilers ("assignment conversion", where you explicitly box and unbox when something is the target of a set! call).
01:50psykoticgotta love WIFI receivers with an apparent range of 2 meters
02:55omakaseyo
02:55Raynesyoyo
02:56omakasehow can i get the current unix timestamp?
02:58bytecoder,(System/currentTimeMillis)
02:58clojurebot1268981981848
02:58gko(int (Math/floor (/ (System/currentTimeMillis) 1000)))
02:58gko,(int (Math/floor (/ (System/currentTimeMillis) 1000)))
02:58clojurebot1268981985
02:58gko,(int (Math/floor (/ (System/currentTimeMillis) 1000)))
02:58clojurebot1268981994
02:58omakase:)
03:01gko,(int (/ (System/currentTimeMillis) 1000))
03:01clojurebot1268982190
03:12rfg,(int (/ (System/currentTimeMillis) 1000))
03:12clojurebot1268982814
03:12zmila,(int (/ (System/currentTimeMillis) 1000))
03:12clojurebot1268982831
03:38LauJensenMorning guys
03:42gkoHow to make a "return" in a function ?
03:43LauJensengko, last evaluated expression is always the return
03:43LauJensen(defn return-2 [] (println "no return") (+ 1 1))
03:44gkoLauJensen: I know, I meant if I want to do an early return...
03:44LauJensenconcept doesnt change if you want branches
03:45gkoLauJensen: but I want to prevent identation:
03:45gkoI'd like something like this:
03:46gko(if a return-from-function) (if b return-from-function) (if c return-from-function)
03:46gkoinstead of:
03:46benatkinWhen I try running lein deps with the lein-swank plugin in my project.xml, I get a "1 required artifact is missing" message.
03:46defnhi all
03:46benatkinDo I need to add a path to my repositories?
03:46benatkindefn: hi
03:46gko(if a nil (if b nil (if c ...))) => this will indent fastly
03:47defnmaybe a silly question: user> (.getRegion database "207.100.100.1") => #<Region com.maxmind.geoip.Region@66d7a9c9>
03:47defnHow do I get an actual value?
03:47gko(show Region)
03:47LauJensen(cond (even? 2) do-this (odd? 5) do-that :else do-something-else)
03:47LauJensenWould that work gko ?
03:48defngko: I'm not sure I follow
03:48LauJensendefn: C-S-i Region
03:49LauJensenThat will give you a list of all the methods, one of them will likely be called "getValue" or similar
03:49LauJensenoops, C-I ofc
03:49defnhm that doesnt work
03:50LauJensenCan you be a little more specific ? :)
03:50defnC-I I mean
03:50gko(use 'clojure.contrib.repl-utils)
03:50defnweird, still nothing...
03:50LauJensenC-I is bound to the inspector by default, so no need to use extra libraries
03:51LauJensendefn, by try (.countryName region) (.countryCode region) etc
03:51LauJensens/by/but
03:55defnyeah it's official, i have no idea what I'm doing
03:55defn(.getCountry (LocationService. "/path/to/geoip.dat") "1.2.3.4")
03:56defn.getCountry is supposed to return an IP address
03:56defnohhhh wait wait
03:57defnthere we go:
03:57defn(.getName (.getCountry (LocationService. "/path/to/geoip.dat") "1.2.3.4"))
03:58gkoLauJensen: actually, it's more to avoid something like: (if (do-a-and-fail) (return) (if (do-b-and-fail) (return) (if (do-c-and-fail) (return) ...))) that is, the do-b-and-fail must be true to execute do-b-and-fail... oh, unless I change it to (if (do-a) (if (do-b) (if (do-c) (return)) (return)) (return))
03:59defnso to use .. with my above code...
03:59gkoLauJensen: but the point is to avoid the additional indentations, which could be avoided if I could return ..
03:59benatkinI figured my problem out. I had my brackets wrong.
04:00LauJensengko: Im not following, my example would behave as you suggest - The indentation concern should be put second to learning functional programming, you seem to be thinking in terms of imperative statements
04:01LauJensendefn: (-> (LocationService. "") (.getCountry ""))
04:01gkoLauJensen: yes, it's about socket stuff, so I can continue only if the previous request succeeded...
04:01defnLauJensen: why not ..?
04:01LauJensen.. puts dots between the args useful for chained calls, you're not doing a chained call
04:02LauJensen~source -?>>
04:02clojurebotHuh?
04:02gkoLauJensen: of course, I could split all this stuff in different functions...
04:02LauJensengko: In contrib, there's a short-circut -?>> which I think you could leverage to good efffect, its like ->> but aborts first time a member returns nil
04:02RaynesOh no.
04:02RaynesNot another symbol.
04:02gkoLauJensen: OK, I'll check. Thanks.
04:02RaynesI'm just getting used to -> and ->>
04:02LauJensennp
04:03LauJensenRaynes: this is the same, just with the nil check added
04:03RaynesAs a matter of fact, I just updated my irc bot code with it last night.
04:03Raynes@_@
04:03Raynes~def -?>>
04:03clojurebotHuh?
04:03Raynes:o
04:03RaynesWorth a try.
04:04gkowhat's the clj file ?
04:04gkoRaynes: what's the clj file for -?>> ?
04:04RaynesI have no idea.
04:04RaynesNever used it.
04:05Raynescore.clj I think.
04:05LauJensenno
04:05LauJensenContrib but I forgot where, so grep for it
04:05RaynesOr not.
04:05Raynes:\
04:06gkoOh, OK, it's in clojure.core
04:06gko,(doc ->)
04:06clojurebot"([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."
04:06RaynesNo it isn't.
04:06gko,(doc ->>)
04:06clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
04:06defnoh god this is beautiful
04:07gkoclojure.contrib.core
04:07defndisgusting java dung => beautiful, elegant clojure
04:07RaynesS'not in core.
04:07RaynesJust checked.
04:11LauJensengko: you noticed I said -?>> and not ->> right?
04:16psykoticgood old maybe monad
04:18LauJensenmsg chanbot +enforce wordban: monad Monad Monads monads
04:18LauJensenoops forgot the /
04:18LauJensen:)
04:20defnokay so now I need to figure out multimethods I think a bit better so I don't need 10,000 defns to implement all of the java geoip stuff
04:21LauJensendefn the ClojureQL backend is the finest example around :)
04:21defni will take a peek
04:24defnI must say this is awfully fun watching java turn into clojure in front of my eyes
04:25psykoticLauJensen: do you have a github link to the file?
04:26LauJensenpsykotic: There's more than one file on github nowadays, so can you be more specific?
04:26psykoticthe clojureql backend example with multimethods :)
04:26LauJensen~clojureql
04:26clojurebotclojureql is http://gitorious.org/clojureql
04:26psykoticah, wrong site, that explains it :)
04:27LauJensenYea, we liked the simplicity and didn't have the patience to wait for Github to resolve their responsetimes
04:27LauJensenclojurebot: forget clojureql
04:27clojurebotclojureql is http://gitorious.org/clojureql
04:28LauJensenclojurebot: clojureql is http://gitorious.org/clojureql and tracked @ http://clojureql.lighthouseapp.com/
04:28clojurebotYou don't have to tell me twice.
04:28LauJensen~clojureql
04:28clojurebotclojureql is http://gitorious.org/clojureql
04:28gkoLauJensen: yes. I'll look for it. Thanks.
04:28LauJensen~forget clojureql
04:28clojurebotclojureql is http://gitorious.org/clojureql
04:28defnomg i need to quit using clojure or I will never use another language again
04:28defni am giddy right now this is so fun
04:34psykoticLauJensen: nice, i read the code. i like the 'operator hierarchy' for joins, etc
04:35psykoticit would be nice if you could say (derive [::Join ::LeftJoin ... ::FullJoin] ::Join] to cut down on repetition. good thing we have macros :)
04:35LauJensenTurns out that once you get the structure in your head, its quite easy to work with. Its a concern though, that right now the entire structure takes too long up commit mentally, so things are being restructured and moved around before we declare it 1.0
04:37RaynesHow does Gitorious compare to github? Only thing I've ever heard people say about it is "But, it's Open Source and Github isn't."
04:38psykoticgithub is so superior to everything else out there right now that i find it hard to consider switching
04:38psykotici'm paying them the monthly fee even if i don't use the extra features, just because of how much i like what they're doing
04:38RaynesI'm not considering it. Everything I have is on github.
04:38LauJensenRaynes: The main pull was speed and the fact that they aim to be more community centered - Im not sure they achieved that goal though
04:39LauJensenOh - And we had planned on embedding documentation directly in the source container. Github used different mark-ups in different places, Gitorious was uniform
04:39RaynesYou forgot something.
04:39Raynes"AND IT'S OPEN SOURCE!!1!"
04:39psykoticRaynes: that actually IS useful if you want to deploy a gitorious thing internally at a company
04:40RaynesMost people don't look at the practicality of such a thing.
04:40eintrpsykotic: true. github:fi isn't viable if you're < 100 devs or so
04:40psykoticone issue with DVCS at large companies is that you need to superimpose some 'discovery/exploration' infrastructure that a centralized VCS provides
04:41psykoticand something like gitorious could fit that bill
04:42RaynesWell, on an unrelated note, I has Chedder Jalapeño Crunchy Cheetos. Envy me.
04:42psykoticon an unrelated note, i feel like the star of one of those DDT infomercials from the 60s where children are paying in dense DDT fog
04:42psykotic*playing
04:42Raynes:o
04:43RaynesLauJensen: How do you pronounce your first name?
04:43LauJensenI dont know
04:43LauJensen...how to put it in writing :)
04:43psykoticit's Jen as in the Japanese Yen
04:43RaynesFirst name, not last.
04:43LauJensenNot my first name
04:44LauJensenRaynes: like you would lay Loud, but without the d
04:44psykoticit's close but not exactly the same as 'Lao' in 'Laos'
04:44psykoticor loud, yeah
04:44RaynesOh.
04:44RaynesI pronounced it as 'La'.
04:44psykoticwhen i moved to the us, i told people to pronounce my name as in 'pair'
04:44LauJensenWhich is wrong
04:45psykoticbecause they couldn't even come close to the real pronunciation. so now i just introduce myself as 'pair'.
04:46psykotici think even in denmark, the pronunciation of 'Lau' will vary a bit depending on whether you're a farmer from western jutland or from copenhagen :)
04:48LauJensenNot too much - When I present myself, once in a while some kind secretary will ask "Is the L A V", to which I respond "No, then I would be called Lav (low)".
04:48LauJensenBut it is more common in China than in Denmark I'll give you that
04:50psykoticbtw speaking of github, i just found out that their search feature can also search code, a la codesearch.google.com
04:50psykotici remember someone was writing a log searcher for #clojure to find usage examples of functions. either github's search or codesearch.google.com would also be good for that.
04:50RaynesYou're just finding that out? ;o
04:50RaynesI'm about to do a codesearch for the word 'penis'. That's right.
04:50psykoticyes, i never thought to try it before
04:51psykotici don't think github does regexp searches like codesearch, though
04:51RaynesWhereas most programmers use 'foo' 'bar' and 'baz', I use genitalia. :D
04:52RaynesIt keeps things interesting on my side, especially when I have to pastebin code.
04:53Raynes"epenis.py ... class epenis(loadable)"
04:53RaynesAlrighty then.
04:54SynrGwin 2
04:54SynrGsure
05:03LauJensenWhat I really like about #Clojure, is that it has consistently held to a high standard for conversation. I would be sorry to see that go Raynes.
05:04RaynesWell, at 4:00am...
05:04psykoticmaybe #clojure-bullshit is called for :)
05:04RaynesThere was nothing to disrupt or discuss in this particular situation, so I think we can let it slide.
05:04Raynespsykotic: I tried that about a year ago. Didn't stick.
05:08LauJensenRaynes: You see what Im saying though right?
05:08RaynesAbsolutely, and I wouldn't purposely disrupt the room for the sole purpose of being an idiot.
05:08LauJensenAnd btw, you should be sleeping now - If you want to be up at this hour you should move to Denmark
05:08RaynesI woke up at 1:00am.
05:08LauJensenRaynes: You see what Im saying though right?
05:09Raynes#haskell has three times as many users as #clojure, and I've never seen the high-standard of discussion really break, despite brief off-topic chatter that usually spills over into #haskell-blah.
05:10Raynes#clojure just doesn't have enough users for it's own active off-topic channel at this point.
05:10RaynesBut soon. Oh yes, very soon.
05:12psykoticRaynes: i just registered #clojure-casual. we can be a community of two :)
05:13RaynesJoy!
05:13RaynesNow we need to get somebody to put it in the channel topic, and we might get somewhere.
05:23patrkrispsykotic: shouldn't it be #clojure-cajual?
05:23RaynesClever.
05:24psykotici think even by my pun-happy standards, that's a bit much
05:24RaynesAgreed.
05:24patrkris:)
06:08LauJensenwow psykotic: deporting Raynes really did the trick, peace and quiet is restored
06:08Raynes;)
06:09psykoticwe're having so much fun over there with you, Lau. you killjoy :)
06:09psykoticwithOUT you, even :)
06:17psykotichow do i test whether something is an instance of a deftype type? i've tried (instance? mytype (mytype 42)) and that doesn't work--mytype is the constructor function for the type, not the java.lang.Class itself.
06:18LauJensenisa?
06:18psykoticisa? checks relationship between classes by default, not instances and their class
06:19psykotici think instance? is what i want, the problem is how i get to the type behind a 'deftype' rather than the constructor function
06:19psykoticah damn, i looked at the deftype code and they use a gensym for the generated type
06:19psykoticthat is.. useless.
06:20spariev_have you tried type ?
06:20spariev_,(doc type)
06:20clojurebot"([x]); Returns the :type metadata of x, or its Class if none"
06:20psykoticdoesn't work
06:21psykoticit gives you the type of the constructor function.
06:21psykotic(a generated class that implements IFn)
06:21psykotichere's what the relevant code looks like:
06:22psykotic ~(emit-deftype* name gname (vec hinted-fields) (vec interfaces) methods)
06:22psykoticthe gname is a generated (gensymmed) name
06:22psykoticso the type isn't directly accessible
06:27Raynes,(clojure.contrib.duck-streams/slurp* "https://sourceforge.net&quot;)
06:27clojurebotjava.lang.ClassNotFoundException: clojure.contrib.duck-streams
06:27Raynes,(clojure.contrib.io/slurp* "https://sourceforge.net&quot;)
06:27clojurebotjava.lang.ClassNotFoundException: clojure.contrib.io
06:27RaynesI thought he could access contrib? :o
06:40psykoticbtw, for my hack all you need is to add the following in deftype's `(do ...) block:
06:40psykotic (defn ~(symbol (str name "?")) [~'x]
06:40psykotic (instance? ~classname ~'x))
06:41psykotic(deftype foo [bar]), (foo? 42) => false, (foo? (foo 42)) => true
06:43Chousukethere's no need to use ~'x, just use a gensym
06:47psykotici hate needless gensyms
06:47psykoticno need to make macro expansions needlessly unreadable
06:49psykoticokay, 'hate' is a bit strong :)
07:16haptiKtest
07:16Raynes~def test
07:16Raynes:p
07:33SynrGzmila: welcome, classmate :)
07:33RaynesWhat he said.
08:54defnhello all
08:54defnWhat's the best way to chunk a large file of text, say 350MB worth?
08:55defnIt is a logfile, so by line is best, but what I'm wondering is if anyone has any suggestions for re-writing alex osborne's widefinder2 'chunk-file' in pure clojure, with no Java
08:55defnor at least, less Java, more clojure
08:55defnsee http://meshy.org/code/wf2-faster.clj
08:56AWizzArddefn: what is bad about a split by line?
08:56AWizzArdI developed a split-by-regex, but this is unfortunately closed source.
08:56defnAWizzArd: nothing in particular I guess, just trying to learn
08:57defnive never worked with data sets as large as 300MB before, which to some probably seems so minor and simple, but I am trying to learn when it is appropriate to split a file into chunks, how many chunks to split it into, etc.
09:01defnoptimization does not come first!
09:04spariev_defn: here's how I parsed Rails log files, partitioning by request - http://gist.github.com/337484
09:05clowbarAWizzArd: Is that lib in clojure, or JAVA you wrote that is closed source??
09:05spariev_nothing fancy, just line-seq & partition-by
09:09licoresseI am not getting this to work, component count is always showing 0, what am I doing wrong? http://paste.lisp.org/display/96610
09:11licoresseI suspect I am doing something wrong in the constructor
09:17defnspariev_: pretty cool
09:18defnhow quick is it?
09:20spariev_haven't measured, actually, my main bottlenecks with this code was in actual log processing, not io
09:20spariev_s/was/were
09:20defnyeah i would imagine
09:20spariev_it could be sped up by using pmap, though :)
09:21defnid be happy if i could do a 300MB log in...oh...20 seconds?
09:22powr-tocDoes anyone know how to stop a server with ring?
09:22licoressecan I override the constructor in a proxy?
09:22licoressecannot find examples of this
09:22powr-tocI've called run-jetty, but I'd like to restart it
09:39Raynestechnomancy: ping
09:41spariev_licoresse: I believe you can override only interface/class method's in proxy, not constructors
09:41spariev_s/method's/methods
09:42LauJensenI just got banned - in the sense that I could just log in straight after
09:42licoressespariev_: ok, then the only other option is gen-class
09:43RaynesI'm getting this: Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/contrib/def__init.class or clojure/contrib/def.clj on classpath: (core.clj:1), whereas it works in lein repl. :|
09:43RaynesClojure-contrib /is/ on the classpath. :\
09:43RaynesApparently, clj-time is asking for it, but can't find it.
09:45RaynesWhat's weird is that I can do the same thing in lein repl and it works. Makes me wonder if I'm not setting up the classpath right.
09:45Raynesjava -cp src:lib/* clojure.main src/sexpbot/core.clj
09:45RaynesI'm not sure if lein repl is doing something special, but it appears so.
09:48LauJensenRaynes: You know that you can check the cp at runtime right?
09:48RaynesLauJensen: That's exactly what I'm doing.
09:48RaynesAnd contrib is there.
09:48licoressespariev_: thanks for the input, case solved!!
09:49spariev_licoresse: np, glad I helped :)
09:51RaynesLooks like something is wrong with my contrib jar. Isn't opening up right in Emacs.
09:51RaynesLooks corrupted.
09:51RaynesI'll delete it.
09:56LauJensenIf you hand-compile, make sure you link to clojure.jar
09:57defnI have a list: ("nil" "nil" "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil)
09:58defnerr the first two nils not in quotes
09:58defnbut basically I want to count occurrences of a string in a map, where the count is the value and the key is the string
09:58clojurebotmaps are *AWESOME*
09:59defnmy question is, what is an efficient way of turning the above list into such a map?
09:59chouserso awesome that two completely different things are named "map"
09:59Chousukehm
09:59ChousukeI think there's something in contrib to do just that.
09:59chouserso awesome that two completely different things are named "map"
10:02defnChousuke: if you know or find it let me know, im hunting ATM
10:06ChousukeIf we had fnil, (reduce (fn [m val] (update-in m [v] (fnil inc 1))) (remove nil? seq))
10:06defnChousuke: id like to count nils as well
10:06defnis it possible to have nil as a key
10:07chouseryes
10:07defn,{nil 4}
10:07clojurebot{nil 4}
10:07defncool
10:07zmila,(reduce
10:07clojurebotEOF while reading
10:07zmila (fn [acc-map item] (assoc acc-map item (inc (get acc-map item 0))))
10:07zmila {}
10:07zmila '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))
10:07Chousukeah, well, then you need to remove nils
10:07zmila(reduce (fn [acc-map item] (assoc acc-map item (inc (get acc-map item 0)))) {} '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))
10:07zmila,(reduce (fn [acc-map item] (assoc acc-map item (inc (get acc-map item 0)))) {} '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))
10:07clojurebot{"c" 4, "b" 4, "a" 2, nil 3}
10:08defnzmila: cool
10:08fogus,(apply merge-with + (for [x '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil)] {x 1}))
10:08clojurebot{"c" 4, "b" 4, "a" 2, nil 3}
10:08LauJensenhasn't that been sugared zmila ?
10:08LauJensen,(reduce (fn [acc-map item] (assoc acc-map item (inc (acc-map item 0)))) {} '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))
10:08clojurebot{"c" 4, "b" 4, "a" 2, nil 3}
10:08LauJensenyup
10:09ChousukeI wonder why fnil hasn't been introduced to core yet :/
10:09LauJensenbecause its redundant
10:09Chousukeheh, argue & escape :P
10:09ChousukeI don't see how it's redundant though. :/
10:09fogus,(reduce #(assoc %1 %2 (inc (%1 %2 0))) {} '(nil nil "a" "b" "b" "a" "b" "c" "c" "c" "c" "b" nil))
10:09clojurebot{"c" 4, "b" 4, "a" 2, nil 3}
10:12zmilai need this function for ProjectEuler75 :)
10:13defnJava Heap Space
10:13defn:(
10:13defnmaybe atoms are in order
10:14RaynesFor the public record, the problem was indeed that my clojure-contrib jar was corrupted.
10:17Chousukedefn: if you're running out of space, use the reduce approach, but with a transient instead
10:17defnoo!
10:20spariev_is there something like Java's entrySet() for clojure maps ?
10:20Chousuke,(.entrySet '{a 1})
10:20clojurebot#< [[a 1]]>
10:21rhickeyspariev_: is your objective to get key/value entries or the set lookup capability?
10:21zmilaspariev_ (seq your-map) - is like iterator, then use param destruction (fn [ [key value] ] ...)
10:21spariev_thanks, zmila, just need to get k/v entries to iterate
10:22Chousukethe general rule of thumb in clojure is that if you need to iterate over something, call seq on it :P
10:22zmilaok, spariev_, but remember to prefer existing seq-functions over iteration :)
10:22spariev_hehe, I'll try :)
10:24defnrhickey: what do you mean by set lookup capability?
10:28rhickeydefn: being able to lookup map entries in the resulting set
10:31defnah, i asked this question originally, and the former is what *I'm* looking for. I can't speak for spariev_
10:32rhickey(.contains (.entrySet {:a 1 :b 2}) (clojure.lang.MapEntry. :b 2))
10:32rhickey,(.contains (.entrySet {:a 1 :b 2}) (clojure.lang.MapEntry. :b 2))
10:32clojurebottrue
10:33defnrhickey: ah-ha. thank you much.
10:33Raynes,(apply hash-map [:key "v" :key2 "v2"])
10:33clojurebot{:key "v", :key2 "v2"}
10:37spariev_defn: btw, have you managed to setup circumspec ?
10:38defnspariev_: stuart halloway msg'd me back on github this morning
10:38defnhe gave some hints
10:38defni will take a whack at it later tonight
10:40defnspariev_: it is such a weird feeling to be corresponding with your heroes. i remember receiving a letter back from noam chomsky once upon a time and being amazed he wrote back.
10:41spariev_defn: :)
10:41defnim still amazed every time i get a reply from someone with a prolific "commit" or "create" schedule.
10:42defnstuart h wrote a book, wrote a bunch of fantastic code, and managed to write me back within 24 hours. I can barely manage a single one of those 3 items.
10:42defntec*nomancy is another example. that guys is absolutely prolific, and yet he hops on IRC and talks to me for 15 minute here and there about some silly problem I'm having.
10:43defnguy is*
10:50spariev_defn: Clojure community is amazingly awesome, and it's a well known fact :)
10:51defn spariev_: yeah i have had absolutely 0 bad experiences with the community thus far
10:51defnand very receptive, creative, intelligent community
10:52The-KennyThat's my experience too
10:53The-KennyAnd I try to be a part of this community :)
11:11defn<3
11:11AWizzArdclowbar: I wrote this in Clojure.
11:13AWizzArdI had a file that contained several "rows" of data. But each data set did not sit in one line of the text file. Instead it had other complex markers that told me where one data line ends. And as I wanted to process each data set on its own I wrote a split-by-regex fn that returns a lazy sequence of "lines" or "rows" of data.
11:28remledufftechnomancy: I've been working on writing lein repl in clojure, and have got it working, with one small issue. I either need to make the bat file not use -Xbootclasspath, or I need to use a custom class loader that doesn't delegate to the parent for classes that start with "clojure."
11:28remleduffIf you want to take a look: http://github.com/remleduff/leiningen/blob/master/src/leiningen/repl.clj
11:28remleduffThe version I did using a custom classLoader is still at home on my harddrive
11:32remleduffThe problem with -Xbootclasspath is that it makes leiningen's version of clojure override the project's version of clojure unless I play more ClassLoader games.
11:38psykotici wish juxt with one argument would treat it as a list of functions to apply. that's a common enough pattern that avoids 'apply' and i don't see when juxt with a single function argument would be very useful.
11:38chouserrhickey: I can't supply my own 'meta' implementation for a reify. Is this intentional?
11:38rhickeychouser: you are making something mutable?
11:39chouserno sir!
11:39Raynes,x
11:39clojurebot1
11:39rhickeythen what's the use case?
11:39RaynesEh,.
11:39Raynes,rgerer
11:39clojurebotjava.lang.Exception: Unable to resolve symbol: rgerer in this context
11:40RaynesThank you.
11:41chouserrhickey: One use case is an implementation of IPersistentVector and I just want to be able to attach some metadata.
11:41chouserI don't even need to "modify" it in this case -- providing the meta when the object is created is sufficient.
11:42chouserI've been making do with my own IMeta-like protocol, but now I've run into a case where I'd like to be able to provide a real vector (from a literal) and want to specify the same kind of metadata on that.
11:43rhickeylooking...
11:58rhickeyaargh - could someone please fix it so that all test errors aren't reported at: test_clojure.clj:77 ?
12:12rhickeychouser: http://github.com/richhickey/clojure/commit/67864eb0d91867ff03b87d6874be28f1476d27df
12:13chouseroh sweet -- so I don't even have to implement meta myself
12:14rhickeythe implementation was already there, that's why you got the dupe error, but there was no path to set the metadata and IObj wasn't an implicit super
12:14rhickeyso now it works like fn metadata
12:15chouserexcellent, I'll try it out right away
12:15RaynesHow would one write a function that takes a function that times out after so many seconds? :\
12:16chouserRaynes: there's not a universally correct way to stop a running thread in the JVM
12:17chouserRaynes: there's something that sorta works but may leave locks in a bad state, among other problems.
12:18chouserunless the function is taking so long doing IO stuff and not just computation
12:18chouserI think
12:18RaynesI'm want something like clojurebot's evaluation timeout.
12:18RaynesI'm doing the same thing.
12:19chouserah. I'd actually recommend doing that kind of thing in a separate process entirely.
12:19arohnerare there any clojure wrappers for working with S3?
12:19chousersend forms over to it -- if you don't hear back soon enough, kill off the whole process and start a new one for next time.
12:19RaynesEh.
12:20chouseryeah, hiredman didn't like my suggestion either. :-)
12:20RaynesJust seems like too much work.
12:21dakronearohner: check out jclouds
12:22arohnerdakrone: thanks
12:22dakroneyou're welcome
12:23Rayneschouser: It appears Chousuke wrote some sort of timeout function using FutureTask.
12:23RaynesAnd it appears that hiredman used that.
12:25chouserhm, interesting! .Future/cancel doesn't seem to have the kind of warnings that .Thread/stop does.
12:25RaynesI think I'll snatch this function.
12:27chouserRaynes: you may just be able to use 'future'
12:27rhickeychouser: that's because it uses the interruption mechanism to politely coordinate
12:27RaynesI figured that too, but I'm not sure how.
12:28RaynesI guess I'm just not smart enough to piece things together. ;)
12:28esjrhickey: +1 on Van Roy and Haridi on your Amazon list. It tremendous.
12:28chouser,(let [f (future (Thread/sleep 10000))] (.cancel f true) (.isCancelled f))true
12:28clojurebottrue
12:29chouserheh
12:29chouser(let [f (future (Thread/sleep 10000))] (.cancel f true) (.isCancelled f))
12:29chouserblah
12:29chouser,(let [f (future (Thread/sleep 10000))] (.cancel f true) (.isCancelled f))
12:29clojurebottrue
12:32rhickeychouser: but all of those things are independent of the thread itself - try with (future (loop [] (recur))) and watch your CPU
12:33rhickeyThread/sleep may be interruptable
12:33rhickey.cancel will not kill the thread
12:33chouserah, indeed. so not sufficient for some kinds of sandboxing
12:34rhickeythe interruption system will work for most blocking actions though
12:35chousersounds like the pragmatic studio was a hit
12:42Rayneshttp://gist.github.com/337795
12:43chouserRaynes: you saw that busy loops won't be stopped?
12:45RaynesNo, I didn't -.-
12:47chouserthat's what rhickey was saying -- most blocking actions will be interrupted (locks, IO, etc.)
12:47chouserbut a flat-out busy computation loop will just keep right on going. (loop [] (recur)) and (last (iterate inc 0)) for example
12:51hiredmanhmmm
12:52RaynesThen, I suppose I'll be stealing that function after all.
12:52RaynesI'd rather not think about this particular task. :>
12:53chouserI don't think there's a way around this within a single JVM. Either some operations will not be stoppable, or you may leave locks in a bad state.
12:53hiredman,(loop [] (recur)) ;this will timeout using .cancel on FutureTask
12:53esjelephant guns are dangerous
12:53RaynesIndeed.
12:53clojurebotExecution Timed Out
12:53chouserhiredman: it's not still cranking away?
12:54RaynesIt's (.stop ..)ing the thread.
12:54hiredmanit sure ain't
12:54Rayneshttp://gist.github.com/337804
12:54chouseroh, which is the dangerous one.
12:54hiredmanoh, right
12:54hiredmanit does both
12:54chouserheh
12:55RaynesI'll go with dangerous. :>
12:56chouserthat's what my add-break-thread! does too. :-/
13:00hiredmanyou could write a fn that wraps starting up a new jvm and manages it, then making an infinite seq of calls to that function and use seque to keep a few jvms on hot standby
13:02hiredmanhttp://java.sun.com/j2se/1.4.2/docs/api/java/lang/Process.html#destroy() I do like the sound of that
13:03drewris passing a bunch of args to str a no-no that I'm forgetting about?
13:03drewrI thought StringBuilder was easy on the heap
13:03hiredmanit should be
13:04drewrI must be retaining a head somewhere and it happens to bomb out on an (apply str ...)
13:05drewrbecause 99% of the time the stacktrace includes that
13:05lpetitoff topic: any sh scripting power user here ?
13:07drewrlpetit: try us
13:07hiredmandrewr: str looks like it was written to avoid head holding
13:08chouserdoes anyone here use polyglot maven for real?
13:08lpetitthe unzip command returns 1 when warnings are emitted. I want to somehow "encapsulate it" with the appropriate code to return 0 if 1 is returned, or else $?
13:09lpetitI've tried several things without success for the last 30 minutes, arrgh
13:09drewrhiredman: I agree
13:13lpetitdrewr: so I tried you :-)
13:16drewrlpetit: http://gist.github.com/337856
13:19lpetitdrewr: I have this code: cmd1 && unzip file && cmd2 . How do I transform it so that it continues with cmd2 even if unzip file returns 1. That's the (better formulated) question
13:20chouseronly if unzip returns 1, right? other errors should fail?
13:21lpetitdrewr: I tried a lot of permutations of cmd1 && (unzip file; if [ $? -eq 1 ]; then; return 0; else; return $?;) && cmd2 (with {} () w/o ; etc .
13:21lpetitchouser: yes, 1 should be treated like 0; only special case
13:21drewrlpetit: try exit instead of return there
13:21drewryour () is a subshell, not a function
13:22chousercmd1; if [ "$?" = 1 ]; then cmd2; fi # this seems to work, though the error code doesn't come through
13:22chouserI can't get exit $? to work
13:22lpetitI also tried exit :-( . But since there are a lot of permutations, I think I just can't get everything right at the same time
13:22drewrhm
13:24lpetitbest I came up with: lpetit@lpetit-desktop:~/projets/missManners/tmp$ (unzip -qo project.zip ; if [$? -eq 1] then; exit 0 else; exit $? fi) && echo "hello"
13:24lpetitbash: syntax error near unexpected token `)'
13:24lpetitlpetit@lpetit-desktop:~/projets/missManners/tmp$
13:24chouseryou need exit $?; note the semicolon. But as I said, I can't get that to work
13:24chousera literal number like exit 10; works
13:25drewrlpetit: your if statements need to be: if [...]; then ...; fi
13:25drewri.e., move the semicolon before the then
13:25chouserah, got it
13:26chouser(unzip ; v="$?"; if [ "$?" = 1 ]; then echo "keep on swimming"; else exit $v; fi )
13:31lpetitchouser: yes, with this it's better indeed: (unzip -qo project.zip; v="$?"; if [ $v = "1" ]; then exit 0; else exit $v; fi )
13:32lpetitchouser, drewr: many thanks !
13:40rhickeyprag studio was fun
13:48rhickeyConstantine Vetoshev presented dgraph at ClojureNYC last night - looks like fun: http://github.com/gcv/dgraph
14:08chouserlooks very clean
14:12konrWhat difficulties will I face programming with Common Lisp? Do you thing these things can be learned on-the-fly? I was proposed working in a big project on CL, but I'm a little afraid of committing, considering that the payment per hour is 4 times what I charge
14:20clowbarIs there a clojure lib that would be similar to a cron?
14:22hiredmanhttp://github.com/hiredman/clojurebot/blob/master/src/hiredman/schedule.clj
14:33zaphar_pskonr: your afraid to do it because the pay is too high? that seems a little weird.
14:34zaphar_psgetting paid to expand your horizons sounds like a dream come true to me
14:42KirinDavekonr: If you're new to CL your code is going to be much worse than a CL's regular. CL has an incredibly long learning curve with lots of gradations.
14:43KirinDavekonr: You're professional caliber if you can read Let Over Lambda and have fewer questions than when you started.
14:43chouserheh
14:43clowbarDamn it it seems all the good libs have been written. :p
14:44chouserisn't that a good thing?
14:44KirinDavechouser: I guess you'll have to take solace that you're an expert in clojure. :)
14:44clowbarAlthough as nice as pircbot lib is I wonder if a clojure version would be worth the work.
14:44chouserooh, I am? Cool.
14:44KirinDavechouser: The community here seems much less infatuated with things like macros than the CL community.
14:45KirinDavechouser: You're not? Your imposter syndrome is taking over.
14:45KirinDaveCrowb4r: I don't see any clojure bindings and utils for nailgun.
14:45KirinDaveCrowb4r: So there is that to write.
14:45hiredmanclowbar: I want a pircbot like lib for xmpp
14:46chouserhuh! "imposter syndrome" is interesting...
14:46Crowb4rhiredman: Hmm, that would be nice. I was thinking an AIM lib would be nice, but thank you AOL for making OSCAR needlessly complex.
14:46hiredmanit be really nice
14:46hiredmanit would be
14:47bozhidarKirinDave: CL devs are hardcore lispers and many Clojure users(like me) are with extensive Java background
14:47hiredmanI don't want to have to deal with smack
14:47bozhidarbut even I enjoy macros a lot ;-)
14:47KirinDavebozhidar: I mean, for example...
14:47Crowb4rI'm just trying to get involved with developing clojure and contributing some libs seems liek a good place to start.
14:48KirinDavePeople in Clojure are uncomfortable with adding a type? function as an implicit definition of (deftype ...)
14:48KirinDaveCrowb4r: Nailgun. Please.
14:48technomancyKirinDave: what are you trying to do that's not already easy through standard java interop?
14:48KirinDavebozhidar: Whereas in CL it'd be like a dozen things.
14:48technomancygenuinely curious
14:49KirinDavetechnomancy: I think it'd be better if there was just a form, sorta like the command line interface, to let you make a nailgun interface for your app
14:49Crowb4rKirinDave: That would require me to be better with nailgun.
14:49KirinDavetechnomancy: Just define some commands in a form (nailgun-server commands (cmd-name (fn (args) ...))
14:49technomancyoh yeah; I've been using it mostly for straight-up repls so far
14:49KirinDaveCrowb4r: Probably not.
14:49technomancyI guess invoking arbitrary commands could certainly be easier
14:49KirinDavetechnomancy: Well a one-liner invocation for repl spawning would be rad too
14:50technomancyKirinDave: ng clojure.main, I think
14:50Crowb4rActually my background is not in JAVA, it's in C/#, Python and a little bit of CL.
14:50technomancythrow in an rlwrap for good measure
14:50KirinDavetechnomancy: But it'd be nice to be able to say "start a repl in THIS name space"
14:50KirinDaveCrowb4r: The nailgun interface is very easy. That's why i suggested it.
14:51KirinDaveCrowb4r: It's mostly macro-ology and some java interop for a better nailgun binding.
14:51KirinDaveI've been considering doing it myself since i have so much free time right now
14:51KirinDaveMy house is flooded and so my wife, dogs and I are in a tiny boring hotel room.
14:51KirinDaveAnd we can't leave the dogs alone, so we can't go anywhere or do anything. :(
14:52KirinDavetechnomancy: Do you agree there'd be value in some macro building for nailgun?
14:52KirinDaveI mean, a 1line repl server would be great too.
14:52Crowb4rKirinDave: I will look into it. I think that would be good. I'm aiming to get decent enough with clojure to land a job in it.
14:52technomancyKirinDave: yeah, I'm wondering if you could integrate with it in a way that wouldn't require AOT
14:52KirinDavetechnomancy: Deftype might let that happen.
14:52technomancyI'm not sure whether the new 1.2 features would allow that, but if they did it would be a big win
14:53technomancyas long as it's not called clj-nailgun
14:53KirinDavetechnomancy: But
14:53technomancylet's raise the bar for project names, please. =)
14:53Crowb4rTrying to move from hobbiest to pro in essence.
14:53KirinDavetechnomancy: Also, running a nailgun server in your long-running app. I've seen where people can do things like dump logs and synch dbs from the command line on long running apps.
14:53KirinDavetechnomancy: The AOT isn't a problem there.
14:54Crowb4rtechnomancy: I will keep that in mind. clj-* seems like it's going to get to be overpopulated with libs soon.
14:54technomancyyeah, no-AOT just makes getting started easier.
14:54Crowb4rbrb
14:54technomancyKirinDave: people use swank for that now, but having a client in C is preferrable
14:55Crowb4rwow, nailgun libs would be nice
14:56technomancyCrowb4r: it's always hard to find a good starting project, but I think that would be a good one.
14:56sh10151does anyone have any nice wrappers around XPath and XSLT evaluation for clojure?
14:58Crowb4rWe are a nailgun wrapper I assume.
14:59Crowb4rwe are talking*
14:59remledufftechnomancy: Did you see what I had directed to you earlier about lein repl? Should have /msg'ed you
14:59technomancyremleduff: I didn't see it; I was disconnected when I switched networks.
15:00remleduffI've been working on writing lein repl in clojure, and have got it working, with one small issue. I either need to make the bat file not use -Xbootclasspath, or I need to use a custom class loader that doesn't delegate to the parent for classes that start with "clojure."
15:00remleduffIf you want to take a look: http://github.com/remleduff/leiningen/blob/master/src/leiningen/repl.clj The version I did using a custom classLoader is still at home on my harddrive.
15:01remleduffThe problem with -Xbootclasspath is that it makes leiningen's version of clojure override the project's version of clojure unless I play ClassLoader games.
15:01remleduffSo I was thinking about the best way to approach it, the custom classloader is a little icky, but the alternative is to do more work in the shellscript to avoid using bootclasspath if a parameter is given or some project setting is given or if the shell script notices the clojure versions don't match.
15:02remleduffSorry for the wall of text
15:02Crowb4rmeh
15:04technomancyremleduff: sorry, missing some context here... are you saying you tried with eval-in-project, and the bootclassloader took precedence there too?
15:05remleduffWell, eval-in-project forks a new VM if it sees -Xbootclassloader, right?
15:06technomancyno, only on OS X or in cases of native dependencies
15:07bozhidartechnomancy: is not normal for one to get a lot of compile warnings and a couple of warnings when installing swank-clojure from ELPA
15:07bozhidarone time something went so wrong that it crashed my Emacs...
15:07technomancybozhidar: those are normal; they don't affect usage
15:07technomancyjust means it didn't get byte-compiled
15:07technomancyuhh... ok, that's not normal. ={
15:07bozhidaryes, I know that
15:08Crowb4rtechnomancy: I know this sounds stupid, but with a nailgun lib Is there a format to it you could reccommend. An example of the way a good lib is structured would be nice. I would love to avoid making it look like a hack job. :p
15:08bozhidarI just wondered if they were normal
15:08technomancybozhidar: if you can reproduce reliably please open an issue on my package.el project on github
15:09technomancyCrowb4r: you could use leiningen to create a project skeleton for you
15:09technomancy$ lein new dont-use-a-name-based-on-clj
15:10Crowb4rtechnomancy: Ohh that sounds nice. I mean if it looks like a pos thats what opensource communities are for.
15:11Crowb4rtechnomancy: I'm annoyed with the amount of clj-* libs around as well. my emacs autocomplete when I type clj is just filled.
15:11technomancyCrowb4r: I've been taking names from literary characters; plenty of good material there.
15:12bozhidartechnomancy: I'll do that, but I doubt I'll reproduce it reliably - I've installed it many time before without any problems(other than the compile warnings/errors)
15:13technomancybozhidar: that does seem to be common with package.el issues unfortunately =\
15:14bozhidartechnomancy: I hope that when ELPA become part of the official Emacs distribution the situation will improve rapidly
15:14technomancyyeah, that should help
15:14Crowb4rtechnomancy: My irc bot program is named after a Wheel of time character. However the nailgun lib will either be named something from a more known and pretentious book or something stupid like hammer,
15:14zaphar_pstechnomancy: I finally got emacs to launch lein swank in the project and then connect slime all in one function the other day
15:14bozhidartechnomancy: btw, I've been using many of your projects for a long time, but just recently started to join the irc community - I just wanted to congratulate you for the great work you're doing
15:14zaphar_psmade stuff much nicer
15:14bozhidaryou're a real inspiration
15:15technomancybozhidar: awesome. it just takes time and perseverance; I'm sure you'll be coming up with neat code once you ramp up too. =)
15:16technomancyzaphar_ps: yeah, launching the swank server with lein is nice since it guarantees a consistent environment
15:16zaphar_psas a bonus I got to learn all about emacs processes process-filters and process-buffers
15:19Crowb4rI think clojure in general conforms more to my thought process with programming. strong types and defining every var just seemed to be a waste of time for a lot of programs I've wrote. As a bonus to clojure I learned emacs as I used vim and a full blown ide for other languages.
15:21polypusi need to pipe output to another process started from clojure. c.c.shell's sh has an :in option but that only accepts a string, whereas i want to rebind *out* to a pipe because my strings are too big. what should i be looking at? do i need to hit javaland?
15:23bozhidarCrowb4r: do you enjoy Emacs Lisp as well?
15:24bozhidarEmacs Lisp got me into Lisp programming, but Clojure's modern and practical approach for solving problems got me hooked
15:24bozhidar:)
15:25Crowb4rbozhidar: meh, but I have not used it that much. I just did LISP in textmate and gvim for the most part.
15:25Crowb4rwell Common LISP
15:26Crowb4rI like CL, but the ONLY IMUTABLE THINGS! was somtimes a problem.
15:29Crowb4rCL did get me to use closures because C# 2.0 just ignored that whole concept.
15:30Scriptorthat's it, I'm having a try at installing vimclojure again
15:30Chousukeonly immutable things? :/
15:31Crowb4rChousuke: I overstated that, I mean more along the lines of pure functions.
15:31Chousukeyou mean in CL or in Clojure?
15:40arkrostHi! Explain me please why function (defn sample [#^String s] s) don't throw exception when I do this: (sample 1)
15:42arkrosthey. Is anyone here?
15:43Chousukearkrost: type hints are just hints
15:43Chousukearkrost: you're not actually trying to use s as a string so it doesn't fail
15:43Chousukearkrost: the type hint is just telling the compiler you expect s to be a string so that it can avoid reflection if you use String methods
15:45sh10151anyone use swank-clojure-project? i'm wondering how to get it to use my log4j.properties
15:53etateis lein supposed to be working? I can't seem to build it following instructions :[
15:54mabeshas anyone seen this error when trying to compile before? java.lang.Exception: namespace 'my_namespace' not found after loading '/my_namespace'
15:54mabesI have a project which compiles fine on OSx but throws that error on ubuntu
15:54etatemessage is: "your leiningen is missing dependencies... please download a stable version"... I downloaded the stable script and this doesnt work :/
15:54arohnermabes: it means your ns declaration doesn't match the filename
15:55arohnermabes: if you have (ns foo.bar.baz), it expects it to find that file in foo/bar/baz.clj on your classpath
15:55Chousukemabes: I think the namespace should be my-namespace :P
15:56mabesChousuke, arohner: right, for some reason I had to name the file my_namespace even though the ns is named my-namespace... so what you are saying make sense. Maybe it is a osx specific issue.. Let me try switching it..
15:56Chousukemabes: it's not
15:56arohnermabes: my-namespace is not valid for a java filename
15:56Chousukeright
15:56arohnerso clojure converts my_namespace to my-namespace
15:56Chousukeclojure does some munging
15:57Chousuketo support lispy identifiers
15:57Chousukebecause underscores are icky
15:57mabesok, so there is some expected mismatch
15:57mabes(and harder to type)
15:57KirinDaveUnderscores are icky?
15:57KirinDaveWhere are they icky?
15:57technomancymabes: OS X vs Ubuntu problems often stem from the fact that the OS X filesystem is case-insensitive by default =(
15:58Chousuketechnomancy: I've never found that to be a problem yet
15:58mabestechnomancy: hmm... I don't think I've been using any caps in my ns though..
15:58Chousuketechnomancy: at least it's case-preserving
15:58technomancyChousuke: sure, but it's really easy to get Works on My Box™ bugs
15:58Crowb4rFor times sake I'm just going to use the pircbot java lib to handle my stuff... for now.
16:01technomancyhttp://www.codeodor.com/images/works-on-my-machine-starburst.png
16:01Crowb4rSo, How much of an advantage in terms of preformance does a native clojure lib have over calling the java ones. I know that question is slightly subjective in a lot of ways, but in general?
16:02chousernone
16:02KirinDaveCrowb4r: Generally java will be slightly faster. For uninteresting things, anyways.
16:02Crowb4rk
16:03KirinDaveI wonder when someone is gonna bite down on the proverbial leather strap and update server-socket to use nio.
16:03Crowb4rI like having the speed of java and the ability to use a repl. Speed when compared to the other big p languages.
16:03chouserI guess I do have a few cases here where I can use macros to do work at compile time that the Java lib does at runtime, so my wrapper can actually be a bit faster.
16:03sh10151of course it won't matter much because you'll be waiting on the network or disk I/O 99% of the time anyway
16:04KirinDaveAnd this little toy is still the #1 hit for "clojure netty" on google
16:04KirinDavehttp://github.com/ngocdaothanh/telchat-clojure
16:04KirinDaveWhich is cute, but is Doin' It 'Rong
16:05KirinDavechouser: Speaking of this subject; do you know if it's possible to put annotations on deftype'd classes?
16:05Crowb4rsh10151: Ohhh I know. I get into constant arguments with some C++ fanboys.
16:05chouserKirinDave: pretty sure not
16:05KirinDavechouser: So either write a java class or use gen-class, eh?
16:05mabesSo.. I only get the compile but when I have this in my leinigen project.clj: :main my_namespace (which I need since that is where my-main resides)..
16:05chouserI don't think gen-class can generate annotations either
16:06KirinDavechouser: It can
16:06mabeser. I only get the *compile* error...
16:06Chousukemabes: shouldn't that still be my-namespace?
16:06etatejust testing, can you guys see what i write?
16:06Chousukeno :P
16:06mabesetate: yes
16:06etateokay thanks :D
16:06KirinDavechouser: http://www.mail-archive.com/clojure@googlegroups.com/msg17628.html
16:07mabesChousuke: no, it needs to be the java class version
16:07mabesChousuke: I have verified that via experimentation
16:08Crowb4rsh10151: I got blasted pretty good for making something threaded in clojure (an irc bot to be specific) because the C++ friends of mine thought it was a waste because it would take much longer to write. I did it in less time and my bot does not get hung-up doing somethign thus missing his ping and getting disconnected. :)
16:08KirinDaveI do wonder why clojure doesn't provide more ways to do annotations tho.
16:09chouserKirinDave: that's a example of how they'd *like* annotations to work. I see no evidence that they do.
16:09KirinDavechouser: Oh?
16:09KirinDaveI thought they were saying this is what it does.
16:09KirinDaveWhat's with the hate?
16:09KirinDaveI mean, Netty alone justifies the existence of an annotation interop.
16:09technomancyKirinDave: indifference is more likely than hate
16:10chouserjust an requested but unimplemented feature
16:10KirinDaveWell you look on the list
16:10KirinDaveAnd every time it comes up
16:10KirinDavethe first question is "WHY do you need this?"
16:10KirinDave"YOU are doing it WRONG."
16:11chousercan annontations be added via reflection?
16:11technomancyok, maybe I haven't been paying attention. =)
16:12KirinDavechouser: If so that'd help a lot. You could deftype and then annotate that.
16:12KirinDaveugh
16:13chouserdeftype is mostly not about host interop. annotations would be entirely about interop.
16:14KirinDavechouser: I thought we were to use deftype in place of gen-class if its limitations were not prohibitive?
16:18Crowb4rwow....... http://stuffthathappens.com/blog/2007/12/17/java-upgrade-hammer/
16:19Crowb4r*palm* on face
16:34KirinDaveCrowb4r: Man there is this world of like java app developers I don't understand.
16:35KirinDaveCrowb4r: I gotta get a plane with a huge "This just in, cross platform app development sucks. Stop bitching about it." banner and just cruise around silicon valley
16:38dnolenKirinDave: haha, so true.
16:39KirinDaveJava is not going to solve this problem. Neither is ANYTHING ELSE.
16:39KirinDaveIf you can't deal, pack up and go to infrastructure where you can hit a smaller subset of platforms. Be happier. Collect a larger paycheck, too.
16:41slyphonin for, :when acts as a filter?
16:41chouserslyphon: yes
16:41slyphonok
16:41slyphoncool, thought so
16:42lancepantzi love when you you work with the jdbc wrapper and you have a lazy sequence of a lazy resultset
16:42slyphonwell, that seems like a good fit
16:45lancepantzsuppose i just haven't found a use where i don't have to doall on them
16:45slyphonyeah, exactly
16:49arohnerso I want to use jclouds, but google code is sucking right now, so lein isn't working. I've downloaded the distribution zip that's full of jars. Is there a way to tell maven to import all of that, so lein will pull the deps out correctly?
16:51arohnera more convenient way than reading poms and manually copying, that is
16:59lpetithi all
16:59lpetitccw 0.0.50 released
17:03lpetitseems like everybody is at lunch in USA, see you guys
17:03mabesarohner: what is the dir stricture of the zip? you may be able to drop it into your ~/.m2/repository
17:03arohnermabes: doesn't look convenient, and it looks like the zip doesn't contain poms
17:04arohnerI'm going to see if I can build from source and mvn install
17:04mabesyeah, probably next best thing.. unless you know someone with it cached in there ~/.m2 :)
17:04mabesany ideas on why I can't set the :main with leinigen like this? http://gist.github.com/338153
17:05arohnermabes: is that file naming again?
17:05duncanmhmm
17:05duncanmweird
17:05mabesyeah, well foo.core works but foo_bar.core gives the java.lang.Exception: namespace 'foo_bar.core' not found after loading '/foo_bar/core'
17:05arohneris the directory named foo_bar?
17:06duncanmin a destructuring let, if i have things that I don't care for, I can bind it to _, right?
17:06arohnermabes: java doesn't like files or directories with '-' in them, and clojure munges '_' to '-'
17:07mabesarohner: the file name is src/foo_bar/core.clj
17:07mabesarohner: you can clone the gist for the dir structure
17:11arohnermabes: it ran without errors here
17:12mabesarohner: really? what OS are you on?
17:13arohnerosx 10.6
17:13arohnerthough this doesn't look like an OS issue
17:13arohnerare you running what you think you're running? do a clean checkout of your gist and run it
17:14mabesarohner: yep, did a clean checkout and ran "lein compile" with the same results
17:15mabes(the error)
17:16mabesarohner: I get that error on osx 10.5.8 and ubuntu
17:18mabesscrew it, I'll just not use - or _ in my main ns
17:19technomancymabes: there's a simple rule: dashes in the namespaces, underscores on disk.
17:19technomancyso in defproject, :main should be foo-bar.core
17:21mabestechnomancy: that compiles but when I try to run the jar I get: "Exception in thread "main" java.lang.NoClassDefFoundError: foo-bar/core"
17:21mabestechnomancy: so it looks like :main needs to use the java class naming convention..
17:31technomancychouser: any chance you could look at http://www.assembla.com/spaces/clojure/tickets/246 any time soon?
17:31technomancyI got verbal agreement from Rich in here on that fix, but I don't know if he's seen the actual patch. Since it's a one-liner do you think that's a problem?
17:32slyphon,(contains? (list "a" "b") "a")
17:32clojurebotfalse
17:32slyphonwtf?!
17:32drewrfaq
17:32drewr,(contains? {:a 1 :b 2} :a)
17:32clojurebottrue
17:33slyphonyeah, but i'm trying to find out if a list-of-something contains something else
17:33technomancyslyphon: it's a misnomer. think of contains? as has-key? instead
17:33slyphonah
17:33technomancytrips everyone up though
17:33slyphonok
17:33slyphonok, well i can make that work
17:33drewr,(#{1} [1 2 3])
17:33clojurebotnil
17:33drewrer
17:34drewr,(#{1 2 3} 1)
17:34clojurebot1
17:34drewr,(#{1 2 3} 4)
17:34clojurebotnil
17:34slyphon,(some #{1} [1 2 3])
17:34clojurebot1
17:34drewrah yes
17:34dakrone,(boolean (some #{1} [1 2 3]))
17:34clojurebottrue
17:38slyphonok, so then
17:38slyphon,(boolean (some (set "a") (list "a" "b")))
17:38clojurebotfalse
17:38slyphonwut?
17:39technomancy,(set "a")
17:39clojurebot#{\a}
17:39technomancyslyphon: set treats its argument like a collection
17:39slyphonoh son of a bitch
17:39technomancyheh
17:39slyphonthat's not the first time that's gotten me
17:40slyphon,(boolean (some (set ["a"]) (list "a" "b")))
17:40clojurebottrue
17:40slyphonhahahahha
17:40slyphonso is a vector the same "weight" as a list or a set?
17:40scottjIs there a function foo that (foo bar tar) = (some #(= % bar) tar)? (I know I can write one, just wondering if I'm missing a name)
17:41hiredmanI am pretty sure there is something in contrib somewhere
17:41slyphonif i just have a bag-o-items, should i prefer one over the others?
17:42scottjhiredman: ahh, thanks. seq-utils/includes?
17:46mabesok, so I've verified that my compile error goes away with Leiningen 1.0.1, but it comes back with Leiningen 1.1.0
17:47technomancymabes: if you could tar up a repro case and post it to the mailing list that would be great
17:47technomancyalong with a github issue
17:48mabestechnomancy: okay.. will be clonable gist be enough though?
17:48technomancymabes: oh sure... I've been out of it; I didn't realize gists could contain multiple files. =)
17:48technomancycools
17:49mabestechnomancy: yeah, you can say "git clone git://gist.github.com/338153.git gist-338153" and see my exact project
18:15KirinDavehttp://news.ycombinator.com/item?id=1200389
18:16KirinDaveDoh
18:16KirinDavemispost
18:16KirinDavesorry
18:17arohnerhttp://gist.github.com/338257
18:17arohnerany ideas what that exception means?
18:24StartsWithKarohner, i may be wrong but it looks like api should use local variable (java) that has annotation of some kind and is of type String
18:25StartsWithKsomething like void someMethod() { String @annot myVar = "bla"; /* use myVar with api.. */ }
18:28StartsWithKok, RT/loadResourceScript can load any clojure script, with any ns in it, but, require will reload the script again if called later, even without :reload-all flag
18:28StartsWithKare they not connected?
18:33technomancywhy doesn't bound-fn just take a function?
18:33StartsWithKVar require = RT/var("clojure.core", "require"); require.invoke(new Symbol("foo.bar")); is then a right way to load a namespace from java?
18:34StartsWithKtechnomancy, isn't then there a risk that var was already resolver inside a function body?
18:35StartsWithKthere is bound-fn* that takes a function
18:36technomancyStartsWithK: oh, nice; thanks
18:37technomancyStartsWithK: vars wouldn't be bound in the function body at the time you call bound-fn
18:37duncanmis that scala syntax?
18:37technomancywell, modulo direct binding, in which case you're stuck either way
18:38StartsWithKtechnomancy, brr
18:38StartsWithKduncanm, no.. its a weird clojure/java mix :) RT.var not RT/var :)
18:39StartsWithKyesterday i was trying to write for loop in js, and after four-five tries i managed not to write it as (for ..)
18:40remleduffStartsWithK: Why not just (RT/load "foo.bar") ?
18:42StartsWithKremleduff, it looks like RT/load and friend don't register with clojure lib functions
18:42StartsWithKs*
18:42StartsWithKso, if i do (RT/load "foo.bar") and then (require 'foo.bar) it will load the lib twice
18:44remleduffWhy do you need to require it after loading it?
18:45StartsWithKfirst time from java so i can reset a var value, and all other times from normal clojure code
18:45StartsWithKi think i can guard the var with defone, so maybe its not a problem after all
18:46remleduffNamespace.findOrCreate(Symbol.create("clojure.core")) or something simliar might be even better, it's how RT does it. Or just Namespace.find
18:47StartsWithKyap, defone helped
18:47StartsWithKthere is RT/CLOJUR_NS
18:49StartsWithKthanks all
18:50StartsWithKso.. what is the best way to send clojure structures from one clojure to another loaded in different classloaders?
18:50StartsWithKjust prn and read?
18:51slyphonchouser: hey is there an example of the clojure.contrib.condition lib somewhere?
19:01tomswi'd like to run something in a separate thread, using try & finally to ensure a thread-local resource is cleaned up, and then get the return value or throw any error raised. Do I want an agent?
19:02StartsWithKtomsw, yes, then use agent-error to check for exceptions
19:02StartsWithK,(doc agent-error)
19:02clojurebotExcuse me?
19:02StartsWithK,(doc agent-errors)
19:02clojurebot"([a]); Returns a sequence of the exceptions thrown during asynchronous actions of the agent."
19:08tomswbut if I want block until the agent's work is finished? If I use await and the function throws an error it looks like I wait for ever
19:08StartsWithK,(doc await)
19:08clojurebot"([& agents]); Blocks the current thread (indefinitely!) until all actions dispatched thus far, from this thread or agent, to the agent(s) have occurred."
19:08StartsWithKhmm
19:08StartsWithKthat could be a bug :)
19:09StartsWithK,(doc agent)
19:09clojurebot"([state] [state & options]); Creates and returns an agent with an initial value of state and zero or more options (in any order): :meta metadata-map :validator validate-fn If metadata-map is supplied, it will be come the metadata on the agent. validate-fn must be nil or a side-effect-free fn of one argument, which will be passed the intended new state on any state change. If the new state is unacceptable, the validate-fn
19:10StartsWithKin master, there is :error-handler
19:10StartsWithKyou can declare on agent
19:16tomswI think it will be simpler just to use a normal thread and a ref for the result and the error
19:33kylesmithIs there a way to limit the number of elements that remove will eliminate from a sequence?
19:36Chousukenot with remove. you need a custom function for that
19:36Chousukeor a stateful predicate, but that's ugly
19:38kylesmith@Chousuke That's what I thought. I'm trying to probabilistically remove elements from an infinite seq, and vanilla remove might never quit.
19:39hiredmanremove is lazy
19:39hiredmanwhy would it be a problem with an infinite seq?
19:39Chousukeyes, but it will remove elements until it finds something not to remove
19:39Chousukeso if you're randomly deciding whether something needs to be removed, it might never quit :)
19:40JonSmithoh man, but it probably will
19:40hiredmanbut it doesn't do anything until you walk the seq
19:40Chousukehiredman: it's enough to try to consume the first item
19:40kylesmithit's in the context of a genetic algorithm
19:40hiredmanremove or filter both won't stop removing or filtering no matter what predicate you use on an infinite seq
19:41Chousukehiredman: I meant to say remove is strict until it finds something that fails the predicate
19:42Chousukeif you have an infinite seq of nils and run remove nil? on it, it will run forever if you try to do anything with it.
19:42hiredmanno, because you are asking for the next thing,
19:42hiredmanthat is lazy, not strict
19:42JonSmithwhat if i have an infinite seq of numbers and remove all primes
19:42JonSmithit will stop at the first non prime?
19:42hiredmanit won't stop
19:43JonSmithhmm
19:43Chousukeyou have a different idea of "stop" than I
19:43Chousukeit WILL stop
19:43hiredmanChousuke: the seq won't end
19:43Chousukeit won't compute past the first non-prime until you ask for more
19:43Chousukehiredman: yes, but the computation will stop
19:43JonSmithoh ok
19:43hiredmanChousuke: no, it's still computing
19:43hiredmanjust spinning
19:43Chousukehiredman: what.
19:44ChousukeI don't understand your point anymore.
19:44hiredmanChousuke: in the case of (remove nil? (cycle [nil]))
19:45JonSmithi think what chosuke is saying if you do like (take 2 (remove even? (iterate inc 0)))
19:45Chousukeright, of course.
19:45JonSmithit will stop
19:45Chousukein the nil case it will never stop
19:45hiredmanseveral points, a) remove will not stop on an infinite seq, you may stop consuming it, but the lazy-seq generated by remove is still there
19:45hiredmanb) uh, there was something
19:46hiredmanremove is not strict
19:46kylesmithhow do I paste code in here again?
19:46ChousukeI know remove is not strict, but it computes until it finds the next value
19:46JonSmithlisppaste.org (?)
19:46JonSmithhttp://paste.lisp.org/
19:46Chousukeand it does stop in the sense that it doesn't compute any more, until you ask for the next item in the infinite seq
19:46JonSmiththat one
19:47Chousukeif remove never stopped you would have a buggy program :)
19:47hiredman 16:43 Chousuke : hiredman: I meant to say remove is strict until it finds
19:47hiredman something that fails the predicate
19:48Chousukehiredman: yes, with which I meant to say that it keeps computing until it can give you an item
19:48JonSmith,(take 2 (remove even? (iterate inc 0)))
19:48clojurebot(1 3)
19:48hiredmanChousuke: yes, but you have to ask for the item, which makes it lazy
19:49hiredmanI think the sun is frying my brain
19:49ChousukeI think this is a pointless argument :P
19:49hiredmangorgeous day in seattle
19:49Chousukeapparently just a bad choice of wording on my part
19:50hiredman:)
19:50Chousukeand I really need some sleep :P
19:53kylesmithhmm, paste doesn't seem to be working. Do I need to do anything different now that freenode requires registration?
19:53JonSmithhm let me check
19:54JonSmithyou can also do a normal one and just paste the link
19:55JonSmithhttp://paste.lisp.org/display/96652
19:56JonSmithetc.
19:58kylesmithhttp://paste.lisp.org/display/96653 There's my solution, if anyone's interested.
19:59JonSmithare you using it on an infinite seq?
20:00kylesmiththe input is from repeatedly, where I generate new candidate solutions.
20:02JonSmithcool
20:07kylesmithI also need to put a fixed number of elements into a set lazily. Do I need to make a custom function for this as well?
20:08JonSmithlazily?
20:09kylesmithIf the set function were lazy, I think I could just do (take n (set some-infinite-seq))
20:10JonSmithyou can't just do (set (take n seq-here))?
20:10JonSmithi mean, set returns a datastructure
20:11qbgMaybe you want distinct
20:11kylesmithno, because I want the *resulting* set to have n members.
20:11qbg,(doc distinct)
20:11clojurebot"([coll]); Returns a lazy sequence of the elements of coll with duplicates removed"
20:11kylesmithI was replying to JonSmith. Distinct looks like it would work.
20:12JonSmithyeah so (set (take n (distinct some-infinite-seq)))
20:13kylesmithwhat I actually want to do is (set (take n (distinct (map some-equal-fn some-infinite-seq)))) but have the resulting set contain members from some-infinite-seq. Is there an easy way to do that?
20:14JonSmithi think that you just wrote the way to do that
20:15JonSmithoh
20:15JonSmithor do you want filter
20:15JonSmith?
20:16qbgI think you might need to write a function based on distinct
20:17JonSmithwhat does some-equal-fn do?
20:17JonSmithlike a predicate?
20:18qbgProbably like the key keyword argument to REMOVE-DUPLICATES in Common Lisp
20:18clojurebotlisp is the red pill
20:18kylesmithWell, it looks like I'll have to make another custom function. thanks for the help, everyone, I have to go.
20:20JonSmithoh its distinct based on the eq function
20:26slyphonso, does clojure.contrib.sql take care of connection pooling and such?
20:26slyphonor it just relies on the driver for that?
20:30dhessHi, can anyone point me to definitive documentation on how to write a command-line script that'll run when invoked as 'java -cp clojure.jar clojure.main script.clj' ?
20:31dhessI've found some blog posts and github repos with examples, but I can't get any of them to work.
20:33dhesssorry, more specifically with the clojure.contrib.command-line library
20:34dhessI can get a simple (prn *command-line-args*) script to run, I just can't figure out the mojo to write a script with a "main" function that takes & args
20:34hiredmandhess: there is no default function that clojure calls
20:35hiredmanso you would do something like (apply my-main *command-line-args*) at the end of the script
20:35dhessapply ahhh gotcha
20:35dhessall of the examples I've seen use :gen-class with a -main
20:35dhessbut it looks like those are compiling a jar first
20:36hiredmanthat is for aot compiling
20:36dhesshiredman: is this documented anywhere?
20:36hiredmanclojurebot: compiling
20:36clojurebotNo entiendo
20:37hiredmanclojurebot: jerk
20:37clojurebotGabh mo leithscéal?
20:37hiredmanclojurebot: compile
20:37clojurebotthe unit of compilation in clojure is the namespace. namespaces are compiled (not files). to compile a namspace the namespace needs to be on the classpath and so does ./classes/ (and the directory needs to exist) because clojure writes the class files to that directory. http://clojure.org/compilation
20:37dhesshiredman: sorry, I meant the bit about clojure not calling a default function, needing to (apply ...) etc.
20:38hiredmandhess: well there is no documentation that says it calls a default function
20:38dhesshiredman: it'd be nice if there were somewhere on clojure.org that said: here is how to write a script
20:38dhessI see
20:39dhesshiredman: it's obvious that I should have tried this approach in retrospect, but it wasn't before I found out about it ;) So a FAQ or short wiki page would be a good idea, I think.
20:39hiredmanthe lightweight scripting use of clojure doesn't seem to happen much
20:40hiredmanwhich is too bad
20:40dhessinteresting that *none* of the informal "how-tos" or answered questions I found said anything about this
20:40hiredman(it works great)
20:40psykotichiredman: i like the #! reader macro :)
20:40dhesshiredman: the start-up cost is a bit much for short jobs.
20:40technomancyhiredman: it would work a lot better if you could have a shebang that was honored
20:40technomancyor rather, if there was one obvious way to do it
20:40hiredmandhess: depends
20:40hiredman*shrug*
20:41StartsWithKsome one posted a easy way to do it as: java -cp clojure.jar:src-dir clojure.main -e "(use 'foo.bar) (main)"
20:41dhessI guess on Windows there's some fancy fast startup/cache/preload functionality, but it doesn't appear to exist on other platforms
20:41psykotica simple command line utility that takes a second to get going feels bad in the same way that a UI that locks up for a second after you click a button feels bad.
20:41psykoticwhether or not it's more or less productive in some objective sense is another matter.
20:41hiredmandhess: depends on what you think is a suitable start up time
20:42hiredmanI generally don't mind, but that is mostly for batch processing whatever
20:42dhesshiredman: well, at least as good as a shell script would be a good start
20:42hiredmanso, you know, just fire and forget
20:42dhesshiredman: anyway, I'm not complaining, just pointing out one reason why it might not be commonplace to use Clojure for scripting.
20:42psykotichas anyone tried nailgun?
20:42dhessI was just complaining that there's no "best known method" for it in the Clojure docs ;)
20:43hiredmandhess: there are several shell scripts floating around, that may or may not work, and are most likely mutually incompatible
20:43hiredmanpsykotic: many people have
20:43hiredmanvimclojure uses nailgun
20:43hiredmanthere is a lein nailgun plugin
20:43psykoticare there any gotchas?
20:43hiredmanmy netbook fires up a nailgun server at boot
20:44hiredmanyou are stuck with the classpath the nailgun server was started with
20:44psykoticreally? i thought you could create a new classloader with another classpath in java?
20:44dhessI was quite surprised to see that java doesn't appear to have any way to run in a "server" mode with hot caches
20:44hiredmanpsykotic: you can, but it doesn't work well
20:45psykoticbtw does nailgun use the underlying os's forking?
20:45StartsWithKno
20:45hiredmanyou can write your own classloader to use as a system classloader
20:45psykotichow does it isolate things then?
20:45hiredmanand give your classloader a .add method
20:45dhesshiredman: anyway, thanks, your advice re: using apply just brought my blood pressure down to a normal level again.
20:45hiredmanpsykotic: doesn't
20:45StartsWithKit dosn't
20:46hiredmaneverything runs on one jvm
20:46psykoticalso, java's monotonic-growth heap would be annoying with a 'wrapper' like nailgun, since it would generally stay up continually
20:46StartsWithKfor a 'isolation' see something like classworlds
20:48StartsWithKwith multiple clojure instances, each in its own urlclassloader
20:48clojurebotvimclojure is state-of-the-art
20:48hiredman~botsnack
20:48clojurebotthanks; that was delicious. (nom nom nom)
20:48technomancywith the -Xbootclasspath you can get boot times to around half a second
20:48technomancy(with caveats)
20:48hiredman:(
20:48hiredmanyes, caveats
20:51psykoticlike what?
20:53psykotici wonder what horrible things would go awry if you just called out to unix fork()
20:54StartsWithKpsykotic, nothing realy, ant can do that
20:55StartsWithKalso, there is extracted api for forking jvm in apache commons, based on ant's code
21:04psykoticStartsWithK: couldn't that be used to avoid some startup cost?
21:05psykotici assume almost everyone is going to be java.lang.*, etc
21:05psykotic*be loading
21:07StartsWithKthere are other ways to speed up loading of core jars
21:08StartsWithKpsykotic, http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html
21:09psykoticah i'll have to play around with that
21:10StartsWithKhttp://pastebin.com/7kcmTqr1 to load just core jars, and do something with them, startup time is ok
21:15StartsWithK*in*, *out* and *err* are never updated from System after the first bind?
21:15StartsWithKif i update System version, they will stay the same
21:20maxhodakis it possible to do something like (require (symbol (str "foo." classname))) ?
21:21RaynesLicenser: Thank you for clj-sandbox. Has been very useful.
21:21hiredmanwhy would you be requiring something with a classname?
21:21maxhodakhiredman: or, whatever that variable might be. the idea is just generating the require symbol at runtime
21:21maxhodakwhich seems to be giving me compile errors
21:22maxhodaks/require symbol/symbol to require
21:22hiredman,(if (:macro (meta #'require)) "no" "yes")
21:22clojurebot"yes"
21:23slyphonargh
21:23slyphonmysql, FEEL THE HATE
21:24maxhodakhiredman: does that mean that the function that makes the require form needs to be a macro as well?
21:25hiredmanmaxhodak: as well?
21:25slyphonis it possible to "clear out" the memoized results of a function?
21:26slyphonby re-loading the class, maybe?
21:26slyphons/class/lib/
21:35maxhodakhiredman: so basically, (require (symbol "com.foo.baz.quux")) doesn't work?
21:36maxhodakor ok: how would you get it to evaluate the inner statement first?
21:36maxhodakoh
21:36maxhodakjust kidding
21:36maxhodakJUST KIDDING
21:36hiredman
21:39dcnstrctserious question: is it possible to port this style of java code to clojure ? http://pastebin.com/QngijPp7
21:39dcnstrctlook at all that method chaining
21:39dcnstrctI can't even imagine what it would look like it hurts my head
21:40slyphonyou'd use the .. macro a lot, i would imagine
21:40dcnstrctwould I use one bit (.. expression ?
21:40dcnstrctahhhh
21:40hiredmanno
21:40hiredmanno ..
21:40hiredmanuse ->
21:40slyphonah
21:40slyphontoo right
21:40dcnstrctneat, I will investigate ->
21:41hiredman,(-> "foo" .getBytes String. .toUpperCase .getBytes first char)
21:41clojurebot\F
21:42JonSmithso, would you really want to write that java code in java?
21:43JonSmithit looks totally crazy to me
21:43dcnstrctthats the code neatbeans gui builder spits out when I make a simple swing form.. heh
21:43slyphonjava makes people do strange things
21:43JonSmithdoto macro might also be helpful
21:44slyphonnot if you're chaining
21:44JonSmithyeah i'll say it makes them do crazy stuff
21:44slyphonbut yeah, it's useful in other situations
21:44JonSmithsome of the.adds maybe
21:45JonSmithi don't really know what it is doing honestly
21:45hiredmanthe code from most gui builders is not meant to be read or written
21:45hiredmanjust machine generated
21:45slyphonheh
21:45dcnstrctor ported to clojure
21:45dcnstrctlol
21:45hiredmanit's true
21:45psykoticmethod chaining is one of the nicer smalltalk patterns. although it can get excessive, like anything.
21:45hiredmanthey tell people that all the time in #java
21:45slyphondoes anyone have 'electric-{' working in paredit mode
21:46slyphonthere are like 4 different ways to do it, and i can't seem to find one that works consistently
21:48slyphonwow, i'm just batting 1.000 tonight with the questions
21:48dcnstrctI think I will try to compile this form as java and stick it in a .jar then import it from clojure
21:49hiredmanright, that is essentially the same thing you would do with java
22:22seangroveHey all, having a hard time differentiate between what's java and clojure sometimes
22:22seangrovewhat is (io!)?
22:23seangroveI can't seem to find the documentation on it
22:23hiredman,(doc io!)
22:23clojurebot"([& body]); If an io! block occurs in a transaction, throws an IllegalStateException, else runs body in an implicit do. If the first expression in body is a literal string, will use that as the exception message."
22:23seangrovehaha
22:23seangroveAiya... yes, there is (doc ... :P
22:23seangroveMy bad
22:35TalkingHeadwhat is the clojure way of filtering one collection with another?
22:35TalkingHeadSay I had 2 collections like so
22:35TalkingHead(def flight '("SUN" "SUN" "MON" "TUES" "WED" "THURS" 13:25 RF200 ))
22:36TalkingHead(def filter-flight '("SUN" "TUES"))
22:38TalkingHeadCan I find out if the first collection contains elements of the second without looping through?
22:38technomancyTalkingHead: (filter (set filter-flight) flight)
22:38danlei(for [x '[su su mo tu we th] p '[su mo] :when (= x p)] x)
22:39TalkingHeadthx guys