#clojure logs

2011-10-29

00:19callentechnomancy: ubuntu does that a lot.
01:24Raynesibdknox: Ping.
03:17ibdknoxRaynes: pong
03:17Raynesibdknox: Already forgot what I was going to say.
03:18RaynesBut since you're here… Just moved try-clojure to noir in just under 30 minutes.
03:18RaynesGood stuff, man. Good stuff.
03:18ibdknoxAwesome :)
03:19ibdknoxI saw the doc clarification, I agree that that's clearer. I'll merge that in tomorrow.
03:19RaynesYeah, it took me a minute to realized why my json looked like it had been converted to a string 86 times.
03:19ibdknoxlol
08:11scodeIs this idiomatic?: (read (java.io.PushbackReader. (reader (file "/path/to/file"))))
08:11scodeSeems awfully verbose just to use the clojure reader to read from a file.
08:11scode(Dis-regarding that I'm not closing it in the example.)
08:35ziltiHow do I have to add new functions to a class extended with proxy? With letfn?
08:37sn197did you know that (file-seq dir) may return file paths that cannot be opened subsequently, if unicode chars are in the pathnames
08:44ziltiI have to extend java.awt.Canvas by adding a new variable, a new function and overwrite paint.
08:44ziltiAnd I have no idea how.
10:43mbacdoes the ->> function have a name?
10:43mbacs/function/macro/
11:09MrKotterok, I know its probably been asked a million times, but is there a formula for getting emacs to work with the clojure-clr on windows?
11:10MrKotterthe VS plugin is not cutting it
11:20zippy314_I'm looking for people's experience and best-practices writing tests for clojurescript apps. Have folks been using Google Closure's test functions? Anybody tried integrating Jasmine? Any other approaches? What I'd love is something like midje for a more BDD approach...
11:38zilti"Parameter declaration proxy should be a vector" What am I doing wrong here?
11:38ziltiOh. Nevermind
11:40ziltiCopied the wrong thing. "Metadata can only be applied to IMetas" Here it is. I get this every time I validate a file in the SLIME buffer (using C-c C-l)
11:41ziltiHad this the first time today, yesterday everything worked fine.
11:42scottjzippy314_: I haven't seen any mailing list posts or blog articles with details
12:10ziltiIsn't let allowed inside a proxy? I always get "Unsupported binding form".
12:18raekI can't see any reason lets shouldn't be allowed. maybe the left hand side of a let binding is incorrect...
12:18ziltiraek: How could that be? It's just a name there.
12:18ziltiBasically I want to define a new variable inside that class, but how?
12:19raekzilti: are you sure you are calling proxy with the correct syntax?
12:19raekah, you meant a let between the (proxy ...) and the method?
12:20raekyou can do this (let [x 1] (proxy ... x ...))
12:20raekand this (proxy ... (foo-method [...] (let [x 1] ...)))
12:21raekbut you can't do something like (proxy ... (let [x 1] (foo-method ...)))
12:21ziltiI want that additional var to be available inside that class.
12:21ziltiAh ok
12:22raeklet will just give you access to a value
12:22raekyou can let an atom or a ref though if you want to have state
12:22raek(let [state (atom {:a 1, :b 2})] (proxy ...))
12:23raekeach instance will have each own atom
12:23ziltiAh that way around ok
12:23ziltiGood to know
12:23raekyou have to be explicit when doing mutation in clojure :-)
12:33zippy314scottj: thanks!
12:42ziltiraek: How can I instantiate a proxy then?
12:46duck1123zilti: I don't use proxy much, but does (let [klass (proxy ...)] (new klass arg1)) work?
12:47ziltiduck1123: Right now I have stored the proxy in a def
12:47duck1123well, try using it with new
12:48ziltiI have it in (def canv ...) now, but unfortunately (new canv) doesn't work
12:48ziltiUnable to resolve class name
12:49duck1123Are you using proxy for a case where some java code needs to accept a class?
12:50duck1123try (.newInstance canv)
12:50ziltiduck1123: No, I just have to use that proxy inside my clojure code
12:51zilti(.newInstance canv) gives me a "no matching field found".
12:51ziltimaybe init-proxy?
12:53ziltiJup, init-proxy seems to be the way to go
12:55duck1123zilti: have you looked to see if deftype might not work for you?
13:03duck1123There was a really good flowchart for determining what type of data structure you need, but I can't seem to find it
13:04duck1123I take that back http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/
13:07ziltiduck1123: Thanks! Looks like deftype is the recommended. After following the arrows all over the chart ;)
13:09duck1123nice. That'll keep you out of interop zone, and should make things easier for you
13:10zilti"Each spec consists of a protocol or interface name" so that can be a class name, too, I guess?
13:11duck1123no, it only does interfaces and protocols. It won't subclass
13:11ziltiSo there's something wrong in the flowchart
13:12duck1123so you're extending a base java class?
13:12ziltiUsing the way "no -> yes -> named type -> no -> no"
13:13ziltiduck1123: yes
13:13duck1123if you're extending a base class, wouldn't your first answer be yes?
13:14ziltiErr, ignore the first "no" ;)
13:14ziltiyes -> named -> no -> no -> deftype ;)
13:15duck1123oh, I'm wrong about deftype
13:15duck1123that explains it
13:15ziltiOh, someone already wrote this in the comments :)
13:21duck1123I hate it, one of the libraries I'm embedding finds it's parts by opening up every jar on the classpath and loading all the classes to see if any of them implement it's interface.
13:23ziltiweird lib
13:23duck1123It's cool if there's not much on the classpath, but with all the dependencies I have, it blows my permgen unless I add just about everything to it's exclusion list
13:24jamiltronOn that flowchart - why is deftype and defrecord suggested over a regular map if the type is related to performance-sensitive code?
13:26duck1123it's not perfect
13:26jamiltronWhat would the benefits be performance-wise using a record + protocol instead of just using a map with namespace'd functions?
13:28duck1123Isn't access to a declared field of a record faster than access to the same field in a regular map
13:29duck1123Of course, it's odd to think that anyone would ever say "no, I don't care about performance"
13:30ziltihmm now the only problem that's left is how to access functions inside the proxy
13:31duck1123(.getFoo this)
13:31daakuanyone have suggestions for an embedded db? i'm messing around with some stuff and just want an easy-ish db. i found clj-orient, and i'm trying that out (OrientDB), was wondering if anyone had suggestions
13:32daakui don't need sql or anything, just basic id based lookups for the most part
13:33duck1123daaku: so this is all key-value data?
13:33daakuduck1123: mostly, i think i have a few things indexed by more than one field, but it isn't even that important atm
13:34duck1123you might also want to look at jiraph or fleetdb
13:35daakucool, thanks duck1123 -- will check em out
13:35duck1123and it has to be embedded?
13:35ziltiduck1123: Gives me a "no matching method found"
13:37duck1123zilti: so you're in one of the proxied methods, and you're trying to call another method of this class?
13:37ziltiduck1123: No, I'm outside the proxy.
13:38duck1123zilti: oh, so do you have an instance of this class?
13:38ziltiI did (init-proxy canv {}) not sure if that's considered to be an instance
13:39jamiltrondaaku: You might want to take a look at Chris Granger's simpledb and see if that's something you could use: https://github.com/ibdknox/simpledb
13:40duck1123zilti: to be honest, the only time I've used proxy was when a java class wanted an anonymous class
13:41daakujamiltron: nice, it's simple alright: :dependencies [[org.clojure/clojure "1.2.1"]]
13:42jamiltrondaaku: It's pretty much a wrapper over an atom with some Java concurrency methods thrown in, iirc.
13:43jamiltrondaaku: It's in memory though, so I don't know if that's a problem, but it should be pretty easily extendable to write to disk.
13:43duck1123if you don't need to write, you could look at the config module in my ciste library
13:43daakuyep, 50 lines of code -- persists to disk too actually
13:43jamiltrondaaku: Oh you're right. I haven't used it in a while. I forgot it uses .db files.
13:44jamiltrondaaku: it's great for prototyping. It replaces sqlite3 for me in that regard
13:45daakujamiltron: i think i want something slightly more sophisticated -- but this is good for other random j0nx
13:48daakubut i imagine the slow start up time means it's a bit unlikely i'll be doing many of those random scripts in clojure sadly
13:49duck1123clojure's better for stuff where the run time outweighs the startup time, but there are ways to have a persistent vm to work around that
13:55daakufleetdb looks pretty cool.. but i haven't found docs about embedding it. duck1123 any ideas if that's a supported way of using it?
13:56daakuduck1123: yeah, cake makes things pretty good with the persistent vm. i am no longer afraid of starting a repl or running tests ;)
13:58duck1123daaku: there used to be docs on how to embed the server component. looking
13:58narkisrHey fellow Clojurians, I keep getting java.lang.NoSuchMethodError: clojure.lang.RT.keyword(Ljava/lang/String;Ljava/lang/String;)Lclojure/lang/Keyword;
13:59duck1123you should be able to require fleetdb.server and then call -main
13:59narkisrIm trying to migrate to 1.3 using the unoficial compat contrib
13:59narkisrhttps://github.com/arohner/clojure-contrib
14:00daakuduck1123: cool, will try it
14:00duck1123narkisr: make sure lein is updated, try cleaning
14:01narkisrIv tried cleaning couple of time, ill try now again :)
14:01duck1123a lot of contrib doesn't work with 1.3, and it's really worth looking to see what parts you really need
14:01narkisrlein clean and then lein jar result with the same
14:01narkisrYeah iv started to look on the modular contrib
14:02narkisrbut it lacks a lot of things iv used which is why I went trying the unofficial non modular one
14:02narkisrIt seems that this error is related to datalog which I use
14:02duck1123Personally, I recommend globally excluding the old contrib and then running lein test and adding new contrib libs till it works
14:03narkisrHmm, what do you do about missing things?
14:03duck1123where did contrib go?
14:03duck1123clojurebot: where did contrib go?
14:03clojurebotwell... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
14:03narkisrYeah iv read that one
14:04narkisrstill there are small functions that weren't migrated,
14:04narkisrI could try and replace those but in large code bases its not always an option
14:05duck1123[org.clojure.contrib/datalog "1.3.0-SNAPSHOT"] was the latest, does that work?
14:05narkisrIn order to use it ill have to drop the non-modular one I was trying, I guess ill need to use the modular one any how
14:06narkisrclasspath hell at its best ;)
14:07narkisrThank you duck
14:08duck1123now we just need someone to care enough about datalog to port it over
14:11narkisrIts a nice tool,
14:12narkisrNot sure what it takes to migrate it tough
14:13duck1123Upgrading to 1.3 has gotten so much easier. When I first made the switch, almost nothing worked
14:13duck1123thankfully, one more of the libs I use just integrated my patches today. One less fork for me to manage.
14:15narkisrMakes me wonder on how many have made the switch, didn't a lot of noise in the mailing list about missing things
14:15seancorfieldat least this should be a one off and future migrations will be much easier
14:16seancorfieldand, if clojure's user base grows as we all hope, the number of future users will far exceed the number of current users so only a small number of people will have to deal with the contrib break up
14:17duck1123the contrib reorginization is a pain, but it's good for clojure in the long run
14:17narkisrsure is but I wonder if they coudln't have made it more gradual
14:18RaynesI'm not sure how gradual would have helped anything.
14:18RaynesInstead of doing it all at once and getting it over with, drop a library a week out of contrib?
14:18RaynesThey released contrib at the same time they released Clojure.
14:19RaynesIf they did it gradually, it would have been done in chunks over the next 20 years.
14:19seancorfieldi started experimenting with with clojure in spring 2010 but we did start using it at work until the end of 2010 and we didn't go to production until spring 2011 so we were on 1.3.0 before we had much code written
14:20duck1123I think it's usually best to move over to modular contrib when you're still in 1.2, then make the jump once everything is still working
14:20seancorfieldduck1123: agreed - that's why modular contrib must be 1.2.x compatible
14:20duck1123most people just go to 1.3 and then fix things till it works again
14:21narkisrIs the modular contrib 1.2 compatible?
14:21seancorfieldnow we have the matrix tests, it's easier to see what's 1.2.x compatible
14:21narkisrOh
14:21seancorfieldnarkisr: mandate from clojure/core! :)
14:21seancorfieldcheck build.clojure.org for the reality tho'
14:21seancorfieldnot all of them pass the matrix test
14:23narkisrI guess the community will have to step up and migrate things also
14:23duck1123and then you have the mult-deps support in lein to allow you to work on both versions before making the jump
14:23narkisrTime to dig in the datalog source ;)
14:23seancorfieldif folks care enough about an old contrib library that has no maintainer, they can volunteer
14:23seancorfieldthat's how several have been migrated recently
14:24duck1123clojure.?.datalog
14:24narkisrI need to sign the CA in order to migrate no?
14:24duck1123algo?
14:24seancorfieldyup
14:24seancorfieldalgo is migrated
14:25duck1123I was saying clojure.algo.datalog ?
14:25seancorfieldah, no, no one has stepped up to maintain datalog
14:25narkisrdatalog is in algo?
14:25seancorfieldisn't it superceded by cascalog tho'?
14:25duck1123no, I was proposing a new name
14:25seancorfieldneeds a volunteer maintainer first
14:26duck1123narkisr was going to send in his CA :)
14:26narkisrI will
14:26seancorfieldquite a few will die on the vine for want of an active maintainer
14:26duck1123that's not a bad thing
14:26seancorfieldand for the growth of the language, we don't want a bunch of inactive libraries in there
14:27seancorfieldmornin' cemerick !
14:28duck1123narkisr: like seancorfield said, you might want to see if cascalog fits the bill first
14:28cemerickseancorfield: :-P
14:28narkisrsure
14:29narkisrisn't cascalog an hadoop based framework?
14:29duck1123I want to see lamina become clojure.data.channels
14:29ibdknoxI don't
14:29ibdknoxI want it to remain free of the CA process
14:30seancorfieldif a 3rd party library is actively maintained and popular, it doesn't need to become part of the clojure tree
14:30duck1123fair enough
14:30seancorfieldlast year there was talk of ring and enlive migrating to new contrib but there's no obvious benefit in doing so really
14:31narkisrI was thinking of adding a log based persistency layer for datalog
14:31seancorfieldalthough i actually think it would be good for clojure's growth in the web space to have ring be part of contrib...
14:31ibdknoxbut lots of detriment
14:31cemerickseancorfield: I don't think either the authors or core suggested those.
14:32ibdknoxat this point it would also be a nightmare trying to get everything under CA for that to happen
14:32ibdknoxsince they've taken patches I believe
14:33duck1123That's an interesting point. Say I've signed a CA, and I've also contributed a patch to a library. If that library gets ported, do they need a separate agreement from me?
14:34cemerickduck1123: http://dev.clojure.org/display/design/Moving+Projects+Into+Contrib
14:34RaynesDeployed.
14:34Raynesibdknox: http://try-clojure.org/ now runs on noir and proudly display's its affection in the footer.
14:34ibdknoxin short, you have to give up your rights
14:34Raynesdisplays*
14:34ibdknoxRaynes: :)
14:35Raynesibdknox: If you want to see it, check out the noir branch of tryclojure.
14:35RaynesI also remembered what I was going to tell you last night.
14:35Raynescssgen is pulling in contrib. Looks like technomancy updated it to remove contrib deps, but the only release with that in it is a snapshot.
14:36cemerickibdknox: EPL means retaining copyright doesn't fundamentally matter.
14:36ibdknoxRaynes: hah! I've been trying to figure out what was doing that.
14:36ibdknoxcemerick: I see
14:37cemerickResponses like that make me nervous. :-P
14:38ibdknoxlol
14:38ibdknoxI have only a cursory understanding of licenses
14:39ibdknoxRaynes: you shouldn't need to add that middleware at the bottom, except for wrap-file. The rest is all handled by noir :)
14:39RaynesI wasn't sure. Thanks for the tip.
14:40ibdknoxI love how simple try clojure is :) Granted it hides a lot behind the sandbox, but still.
14:41ibdknoxseancorfield: I don't envy you
14:42seancorfieldassignment of copyright is extremely important in gaining legal protection for the project - and reassuring companies that want to use said project
14:44Raynesibdknox: Does it meet your approval? ;)
14:45ibdknoxRaynes: A+
14:45ibdknoxKorma is very close to a first release :D
14:46moogatronicwhat is supposed to happen wehn i type tutorial?
14:46ibdknoxmoogatronic: the bottom text will change and give you instructions
14:46ibdknoxthough it seems to be showing the same thing
14:46moogatronicdoesn't seem to be doing that in chrome.
14:46ibdknoxRaynes: ^
14:47ibdknoxRaynes: haha you never defined a page for /tutorial
14:48RaynesYeah, I just noticed that.
14:48RaynesDur.
14:48ibdknoxjava logging is retarded
14:49moogatronicibdknox: log4j?
14:49ibdknoxmoogatronic: I was using c3p0 which has its own logging mechanism. I was trying to turn it off
14:49ibdknoxmoogatronic: the fix ended up being simple, but it took me forever to figure it out
14:50moogatronicyeah, it's a problem when someone uses alternate libs, or reads configuration from weird spots.
14:50hugodlogback is nicer than log4j, imho
14:50ibdknoxlogback?
14:50moogatronici'm just used to log4j after having used it for so long.
14:50ibdknoxhttp://logback.qos.ch/
14:51ibdknoxhugod: advantages?
14:51hugodlogback is very similar. It has a contexts and a nice sifting appender
14:51moogatronichow many xml files does it take to configure?
14:51hugodit has a default config that logs to console
14:51hugodone file
14:51moogatronicwin!
14:51Raynesibdknox: Looks like my tutorial handler disappeared entirely. Heh.
14:52RaynesWhen I refactor, I really refactor.
14:52ibdknoxthat's the way to do it.
14:52moogatronicI only checked tutorial, beause I'm tutorializing myself this weekend.
14:52moogatronic=)
14:53ibdknoxhugod: I assume since it's slf4j it'll work with tools.logging?
14:54hugodibdknox: it does
14:54ibdknoxsweet, I'll have to give it a try
14:54duck1123ibdknox: both slf4j and log4j work AFIK
15:00moogatronicI'm really finding autocomplete and ac-slime extremely helpful in my noob to noob+1 conversion.
15:06spoon16is there an easy way to go from a byte array to a string
15:06spoon16?
15:07duck1123that's one of String's constructors
15:07duck1123(String. ba)
15:07cemerickNo!
15:08cemerick(String. array "some-encoding")
15:08cemericksystem-default character sets are evil
15:08duck1123ok, I was about to say that
15:08cemerickAnd, yeah, get off my lawn! ;-P
15:09duck1123do you have to init a Charset for that?
15:10cemerickNo, just use the charset name.
15:10cemerick"UTF-8" is generally the only sane choice, unless you have distinct reasons to go another way.
15:10duck1123(inc cemerick)
15:10lazybot⇒ 4
15:10cemerick:-)
15:11cemerickibdknox: Hot chocolate, perhaps? It's snowing buckets here.
15:11ibdknoxor that
15:11ibdknoxlol
15:11ibdknoxcemerick: high of 76 here today ;)
15:12RaynesMan, I really wish I knew JavaScript.
15:12cemerickibdknox: I love snow. :-D
15:12cemerick76º is nice too, other times
15:12ibdknoxRaynes: no you don't
15:12cemerickRaynes: no you don't
15:12ibdknoxlol
15:13cemerickwhoa
15:13cemerickthat's gotta be a sign
15:13Raynesibdknox: Unfortunately, a large portion of tryclojure is written in it. Knowing it would be in my best interest.
15:13cemerick(not= "getting by" "knowing Javascript")
15:13RaynesFair enough.
15:13cemerickI prefer the former. Less maddening.
15:14RaynesBut now I have to google for something. I've got like 15 slides written and it's like a week and a half before the conj. I do not have time for Javascript. x_x
15:14moogatronicis there a quick and easy way to reset my REPL if I've accidentally collided functions from multiple namespaces?
15:18dnolenemacs is just insane, jira mode
15:24Raynesmoogatronic: Tutorial should be fixed now. Thanks for pointing that out.
15:25moogatronicRaynes: awesome, thanks. Will check it out.
15:25RaynesIt is… brief.
15:25moogatronicI'm trying to hit it from multiple angles. so any help helps. =)
15:25ibdknoxmoogatronic: build a website! ;)
15:26moogatronicibdknox: it's on the list. =) First I need to build some synths and implement some of the GAs and CA systems i alreayd know how to implmeent in other langs.
15:26moogatronicgot overtone all setup and working last night.
15:27moogatronicwell, the parts that were missing from before.
15:27ibdknoxovertone is awesome
15:27moogatronicibdknox: yeah, I couldn't for a while, figure out why (piano) wasn't working.
15:27moogatronicbut I worked that out after much googling.
15:28moogatronicmy level of clojure now is pretty low.. I pretty much have to google everything.. How do I open files, how do I iterate over lines, how do I do stuff with contents.. =)
15:28moogatronichell, i have to google how do I iterate. =)
15:29ibdknoxhehe :)
15:30cemerickmoogatronic: you could do worse than to read all of the docstrings in clojure.core clojure.github.com/clojure/
15:30cemerickhttp://clojure.github.com/clojure/ that is
15:30cemerickYears in, I still discover nuggets in there that I hadn't internalized.
15:32Raynesjodaro: I got my wunderground swag. They somehow magically knew my tshirt size.
15:33moogatroniccemerick: I am reading lots of docstrings too.. C-c C-d d
15:33moogatronicthat and the ac-slime popus have been really nice
15:37moogatronicRaynes: try-clojure is nice. I think it would be pretty cool to "try-clojure"-ify the contents of Friedmans "The Little Schemer". At least to me, these seem to have a similar interaction feel.
15:38gtrak,(. Syste­m/err print­ln "will it run out of disk space if I DOS it?")
15:38clojurebot#<CompilerException java.lang.RuntimeException: No such namespace: Syste�m, compiling:(NO_SOURCE_PATH:0)>
15:39gtrak&(. Syste­m/err print­ln "test")
15:39lazybotjava.lang.RuntimeException: No such namespace: Syste�m
15:39zilti,(. java.lang.Syste­m/err print­ln "will it run out of disk space if I DOS it?")
15:39clojurebot#<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: java.lang.Syste­m, compiling:(NO_SOURCE_PATH:0)>
15:39gtrakhuh
15:39gtrakweird!
15:39gtraktryclojure is just silent on the matter
15:40Raynesgtrak: What did you do, rebind *out*?
15:40gtrakRaynes, huh? no
15:40moogatronicRaynes: you could have pluggable storylines for the interactive code / thought / lecture stuff...
15:41gtrakjust tried to println :-), it didn't yell at me or anything
15:41RaynesOh. I probably forgot to redirect out./
15:41gtrakyou may see some messages in your log :-P :-)
15:41RaynesI do.
15:42ibdknox,(. *err* println "hey")
15:42clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: println for class java.io.StringWriter>
15:42gtrakso what's going on with the bots then?
15:42ibdknox,(. *err* write "hey")
15:42clojurebothey
15:42clojurebotnil
15:43gtrak,*err*
15:43clojurebot#<StringWriter >
15:44gtrakthey just can't see java.lang.System?
15:44Raynes&(System/exit 0)
15:44lazybotjava.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
15:44gtrak&(System/out)
15:44lazybot⇒ #<PrintStream java.io.PrintStream@cedaea>
15:45ziltiEvery time I read an "access denied" I hear that Half-Life-"access denied" in my head
15:45gtrak&(. System/out println "test")
15:45lazybot⇒ nil
15:45gtrak&(. System/err println "test")
15:45lazybot⇒ nil
15:46gtrak,(. System/err println "test")
15:46clojurebotnil
15:46zilti&(println "test")
15:46lazybot⇒ test nil
15:46gtrakhuh, maybe i copy-pasted an invalid character
15:46ibdknoxwriting docs: important, but boring.
15:47Raynesibdknox: I spent an hour documenting the shit out of clojail last night.
15:47ibdknoxyeah I'm writing content for the Korma site
15:47ibdknoxRaynes: it takes forever
16:04ziltiI don't understand why I get "No Message. NullPointerException" when wrapping a seesaw dialog inside a function, but it works flawlessly when getting called directly...
16:09lnostdal_zilti, "inside a function" can mean many things .. does this function get called at a later time or in a different context where some expected context is missing or have changed?
16:09arohneris there a clojure fn for (.getNamespace :foo)?
16:09ziltilnostdal_: There is no context. And it never works, not even when I call the function directly in the REPL
16:10ziltilnostdal_: It's basically just a (defn get-dialog (dialog ...))
16:10gfredericksthere's no clojure library for complex numbers is there? I'm on my own?
16:11scottjgfredericks: clojure.contrib.complex-numbers
16:12gfredericksscottj: that's not as empty as it looks?
16:12scottjgfredericks: how empty does it look?
16:12gfredericksscottj: the API page shows no public functions
16:13gfrederickslooking in the source I see there's some stuffs. Checking it out.
16:13scottjgfredericks: the code will show you that is because the multimethods are defined in clojure.contrib.generic.comparison
16:14lnostdal_arohner, do you mean (namespace 'user/some-symbol) ?
16:14scottjgfredericks: I haven't used it so I don't know how well it works
16:14arohnerlnostdal_: yes, thank you
16:14lnostdal_seems weird having to explicitly supply the namespace like that though .. hm
16:15lnostdal_or maybe not
16:15gfredericksline 37 shows something I've never seen before: (deftype ::complex complex ...) <-- what does this mean?
16:15arohnerlnostdal_: my use-case was determining whether a keyword is namespaced
16:15arohner,(namespace ::foo)
16:15clojurebot"sandbox"
16:16lnostdal_ok, arohner
16:16scottjgfredericks: that's from before deftype was in clojure there was a different thing called deftype
16:17gfredericksscottj: ah ha! so it is. The world is right again.
16:41ziltiI just noticed that if one has a zero-argument function that returns something, and one needs that something, one has to wrap that zero-argument function in parens so it gets evaluated first...
16:42ziltiI'm not really sure if I should consider this logical or weird.
16:42gfrederickszilti: you mean like ##(rand)?
16:42lazybot⇒ 0.3344012713783572
16:43ziltigfredericks: No, like if I have the function (defn get-dialog [] (dialog ...)) I have to call it like this: (show! (pack! (get-dialog))) because (show! (pack! get-dialog)) doesn't work
16:44gfredericksyeah. Functions are objects too, so you have to distinguish whether you're calling it or just mentioning it
16:45ziltiThere are two ways one can interpret "everything's a value" and obviously I misinterpreted it this time
16:48ziltiWell "they" say that in Clojure everything's a value, so one could think that the value of a zero-argument function is its return value
16:48ziltilazily retrieved at the time it is needed
16:49gfrederickszilti: that would kind of mess up those zero-arg functions that return different values each call
16:50gfredericksfor example, what would you expect (= rand rand) to evaluate to?
16:50ziltigfredericks: I don't think so, if they're evaluated lazily.
16:51ziltigfredericks: Hmm yes I forgot about that :(
16:51zilti,(not= (rand) (rand))
16:51clojurebottrue
16:51zilti,(= rand rand)
16:51clojurebottrue
16:52gfredericksit kind of destroys your ability to reference functions as objects, and at that point you can hardly do functional programming anymore
16:52gfrederickse.g., what if I wanted to do ##(sort-by rand [7 38 4 5 6])
16:52lazybot⇒ (4 7 5 6 38)
16:53gfredericksinstead of passing the rand function, I would have passed a random number, which does me no good
16:56gfredericksfor some reason I am finding it impossible to obtain algo.generic with leiningen :/
17:26gfredericks(inc seancorfield) ; <-- for the "Where Did Clojure.Contrib Go" page
17:26lazybot⇒ 2
17:30cemerickcan you query for people's scores?
17:30cemericklazybot: cemerick?
17:30cemerick&cemerick
17:30lazybotjava.lang.RuntimeException: Unable to resolve symbol: cemerick in this context
17:30cemerickheh
17:30Raynes$help karma
17:30lazybotRaynes: Checks the karma of the person you specify.
17:30cemerickfancy
17:30cemerickkarma cemerick
17:30cemericklazybot: karma cemerick
17:31Raynes$karma cemerick
17:31RaynesTeh brokes.
17:31RaynesNot at all surprising.
17:31cemerick(dec cemerick)
17:31lazybotYou can't adjust your own karma.
17:31cemericksorta brokes
17:31gfredericks(dec cemerick)
17:31lazybot⇒ 3
17:31gfredericks(inc cemerick)
17:31lazybot⇒ 4
17:31RaynesOnly get-karma is broken.
17:32cemerickan un-deref-able atom.
17:32gfredericks(def check-carma (comp inc dec))
17:33gfredericksThis feels like a principle from physics. The only way to observe the karma also changes it.
17:33cemerickclojuredocs still highlights old contrib. :-|
17:47Raynes$karma cemerick
17:47lazybotcemerick has karma 0.
17:47RaynesClose enough.
17:47Iceland_jack$karma Iceland_jack
17:47lazybotIceland_jack has karma 0.
17:47Iceland_jackBloody favoritism
17:47RaynesYeah, it's going to give 0 for everybody. But hey, at least it responds now. ;)
17:48abedra$karma abedra
17:48lazybotabedra has karma 0.
17:48abedras/0/100000
17:48abedras/0/100000/
17:48abedradamn
17:48abedraI fail at gaming the system yet again
17:49Raynes:p
17:49abedraRaynes: what is the list of available commands now for the bot?
17:49abedraRaynes: is there a quick reference?
17:55gfrederickslazybot: help
17:55lazybotYou're going to need to tell me what you want help with.
17:55gfrederickslazybot: wut I can say
17:55technomancylazybot: help help
17:55lazybottechnomancy: Get help with commands and stuff.
17:56ziltilol
17:56abedralazybot: help commands
17:56lazybotTopic: "commands" doesn't exist!
17:56ziltiThis is the most awesome answer ever
17:56abedralazybot: are you skynet
17:57gfredericks$karma lazybot
17:57lazybotlazybot has karma 0.
17:57gfredericks(dec lazybot) ; $karma is broke
17:57lazybot⇒ -1
18:08maxbbciao list
18:11Raynesabedra: There isn't an up-to-date reference.
18:11Raynesabedra: https://github.com/flatland/lazybot/wiki/Commands There is this, but your mileage may vary.
18:13Raynesabedra: One cool thing is that the only reason there isn't an up-to-date list is because I haven't written a command for that yet. It wouldn't be hard to generate docs from within lazybot. :>
18:14Raynes$forecast Eldridge Alabama
18:14Raynes^ That worked, he just does it in query rather than in the channel.
18:14RaynesI should probably make him point out that he is querying the caller.
18:18zilti$forecast Eldridge Alabama
18:18ziltiwow.
18:20Rayneszilti: That had HTML encoding in it, didn't it?
18:21RaynesI guess I forgot to unuglify those.
18:21ziltiyes it did. But only for my hometown since for Elridge it didn't display degrees.
18:21ziltiThere was only &deg;
18:22spoon16 hey in lein when I am defining dependencies
18:22spoon16how do I find the name of the dependency?
18:22spoon16javax.activation/activation (for example)
18:23spoon16where are those values coming from?
18:24ziltispoon16: Those are from Maven
18:26RaynesHeh.
18:26ziltiUse a maven search page if you don't know if it's on maven - e.g. http://mvnrepository.com/artifact/javax.activation/activation
18:26RaynesYes, those are maven artifacts. The part before the / is the group id and the part after it is the artifact id.
18:27RaynesIf you're trying to find out what a dependency is called, you can search for it. If it's a Clojure library, it's probably on clojars.org. If it's Java, it's probably on maven central. search.maven.org
18:27RaynesAlas, lein (and cake if you're on the develop branch) have a 'search' feature that allows you to search all the maven repos you have configured (clojars and central by default) for artifacts.
18:28ziltibtw isn't the javax.activation included in the standard jdk anyway?
18:28RaynesFor example, 'cake search activation' gives me a list of javax.activation/activation artifacts of various versions.
18:36ziltiDoes someone here use Noir?
18:36ziltiI just deployed a "Hello World" packed using "lein ring uberjar" to a Tomcat 6 and get the following error: "java.io.FileNotFoundException: /home/dzilti/public_html/beta/WEB-INF/classes/public (Is a directory)"
18:40schowhello?
18:40clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline schow
18:40Scriptorhi schow
18:40schowI have a newbie question I was hoping someone could help me out with
18:41ziltischow: Just ask
18:41schowright.
18:41RaynesThat'd be the purpose of the channel. ;)
18:41schowI'm trying to write a simple script that processes stdin. For example as part of a series of unix commands cat input.txt | clj myscript.clj
18:42schowI found a posting on stackexchange that describes this
18:42schow;; (doseq [line (line-seq (java.io.BufferedReader. *in*))]
18:42schow;; (println "x" line))
18:43schowwhich gets the job done partially but in addition to the output from my println form I also get the original stdin output
18:44schowI've been playing with similar lines such as
18:44ziltischow: Yes, that's because "line" contains the input
18:44schow(doseq [line (clojure.contrib.io/read-lines "testinput.txt")] (println "y" line))
18:44schowand (doseq [line (clojure.contrib.io/read-lines "testinput.txt")] (println "y" line))
18:44schowi mean (doseq [line `("A" "B" "C")] (println "z" line))
18:44zilticontrib is outdated
18:44schowwhich both produce the expected result
18:44zilti,(doseq [line `("A" "B" "C")] (println "z" line))
18:44clojurebotz A
18:45clojurebotz B
18:45clojurebotz C
18:45schowcorrect
18:45schowbut when I have A\nB\nC\n in my input file and cat it into the first script I not only get the output prepended with "x" I get the original output as well
18:47ibdknoxschow: what is it that you're trying to do exactly?
18:47ziltiibdknox: He wants to pipe the output of one program to his script
18:47schowcat inputfile.txt | <a clojure script>
18:48ziltiWhich works, but the contents of inputfile.txt get printed as well before the output of his script
18:48cemerickDoes that happen every time now?
18:48cemerickhello?
18:48clojurebotBUENOS DING DONG DIDDLY DIOS, fRaUline cemerick
18:48schowIn my simple test I'm just putting A B C (each on their own line) into my inputfile.txt
18:48schowI see the following output
18:48schowA
18:48schowx A
18:48schowB
18:48schowx B
18:48schowC
18:48schowx C
18:48cemerickhiredman: step away from the gin. ;-)
18:49ibdknoxk, one second
18:49schowThe issue seems to be either with line-seq or java.io.BufferedReader since my other 2 tests seem to produce the expected otuput
18:51ziltiit can't be line-seq because there's no print function in it
18:52ibdknoxtry binding in
18:52schowAnother clue which might implicate my use of BufferedReader is the fact that sometimes I see something like this
18:52schowA
18:52schowB
18:52schowx A
18:52schowx B
18:52schowC
18:52schowx C
18:53schow"binding in"?
18:53ibdknox(binding [*in* (io/reader *in*)] (let [lines (line-seq ....
18:53gfredericksit almost seems like when lazy seqs get printed. but if you're using doseq I don't think that would make sense.
18:56schow@ibdknox can you post the your full script proposal?
18:57ziltiibdknox: *io* is already a reader
18:57ibdknoxyeah, I'm messing around with it
19:01ziltischow: Maybe it's because you do input.txt | clj myscript.clj. Did you try to turn your clj file into a script file? Like adding these three lines at the beginning and make it executable:
19:02zilti#! /bin/sh
19:02ziltiexec clj "$0" "$@"
19:02schowyes I've tried both with a #!
19:02zilti!#
19:02ziltithen run it without prepending clj
19:02schowcat input.txt | ./test.clj
19:02schowas well as
19:02schowcat input.txt | clj test.clj
19:02ziltiBoth didn't work?
19:03schowsame behavior
19:03ibdknoxI can't get *in* with lein :/
19:04abedraRaynes: thanks for the info
19:05schowjust figured it out
19:05schowdoh
19:05ibdknox?
19:05schowmy "clj" script looks like this
19:05schow#!/bin/sh java -cp /Users/schow/clojure/helloworld/lib/clojure-1.2.1.jar:/Users/schow/clojure/helloworld/lib/clojure-contrib-1.2.0.jar:/Users/schow/clj/clojure-1.1.0/jline-0_9_5.jar jline.ConsoleRunner clojure.main $1
19:06schow(and I cut and copied the same line into my #! at the beginning of my test.clj)
19:06ibdknoxah
19:06schowin both cases jline is present and the script is being run inside jline.ConsoleRunner
19:06schowwhich appears to be what is adding the extra output
19:06schowWhen I remove that it is fine.
19:07ziltishow: Nice. And btw, since you're a beginner: Upgrade to Clojure 1.3 and don't touch Clojure Contrib.
19:07ibdknoxever
19:08schowIn case you're curious here is the resulting working test.clj
19:08schow#!/usr/bin/java -cp /Users/schow/clojure/helloworld/lib/clojure-1.2.1.jar clojure.main
19:08schow(doseq [line (line-seq (java.io.BufferedReader. *in*))] (println "x" line))
19:09schowDoes 1.3 contain some of the contrib libs within core?
19:09schowWhat are the drawbacks of contrib?
19:10ziltiyes, a few. And most of the other parts are in its own projects
19:10brehauthttp://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
19:10ziltiIt's discontinued
19:10dnolenschow: io stuff got move to clojure.java.io
19:12ziltiI just deployed a "Hello World" packed using "lein ring uberjar" to a Tomcat 6 and get the following error: "java.io.FileNotFoundException: /home/dzilti/public_html/beta/WEB-INF/classes/public (Is a directory)"
19:15ziltiAnyone know a solution?
19:18schowthx guys. see ya
19:21cemerickzilti: that's a bug in ring
19:22zilticemerick: So there's currently no way to deploy a ring application to tomcat (without a lot of handwork)?
19:22cemerickUpgrade (or add) your dependency on ring to 1.0.0-RC1
19:23master5o1!help
19:23master5o1clojurebot: herp?
19:23clojurebotI don't understand.
19:23zilticemerick: Will that overwrite the noir dependency?
19:24cemerickzilti: no, noir and ring are separate
19:24cemericknoir depends upon ring
19:24ziltiyes
19:24ziltibut if I use noir, can I simply add the dependency to ring 1.0.0-RC1 and it will work?
19:25master5o1!dice
19:25master5o1:O
19:25RaynesIt depends on whether or not noir is compatible with it. Your dependency *will* override the noir one, but that doesn't mean noir will run.
19:25Raynes$help dice
19:25lazybotTopic: "dice" doesn't exist!
19:25master5o1!google herp
19:25master5o1oh.
19:25master5o1$hel
19:25master5o1$help
19:25lazybotYou're going to need to tell me what you want help with.
19:25RaynesI have a dice command somewhere.
19:25cemerickzilti: you should have no problem using the newer rev of ring
19:26ziltiOk, thanks!
19:26cemerickIf you do, downstream projects need to get up to speed, as that particular bug is *really* irritating.
19:27zilti(inc cemerick)
19:27lazybot⇒ 5
19:27zilti:)
19:33cemerickCan I trade lazybot karma for miles or something? :-P
19:33zerokarmaleftthere isn't an exchange rate for conj beers?
19:34cemerickoh, that'll work :-D
19:35Raynescemerick: Sure.
19:39SaturnationJust going through https://github.com/technomancy/clojure-mode and am a bit stuck on Basic REPL. In particular how does M-x run-lisp us Leiningen? Did the previous packages installs do this, or is there something implied I missed?
19:39SaturnationIn other words, is there a sanity test for making sure everything has been installed correctly thus far?
19:44scodeWhat's an idiomatic way for one method in a deftype to refer to another? Getting a compile time error saying the referee is unknown, presumably because the side-effects of the deftype macro haven't happened yet or some such.
19:44scodeI'd like to avoid forwarding calls to a function defined with a (defn...) separately.
19:45scodeWell, (declare ...) works. But feels a bit assymetric to keep that outside of the deftype.
19:46dnolenscode referring methods of the same type? or referring to a method in another type?
19:46dnolenif other type, you need declare
19:49scodednolen: Same type.
19:49dnolenscode: then you shouldn't need declare.
19:50dnolensince those fns are defined by the protocol.
19:51scode*face palm*
19:51scodeI only added it to my implementations and not the protocol.
19:51scodeHow stupid.
19:51scodeSorry :)
19:51scodeNo actually I did add it to the protocol.
19:51scodeOk, I must have made some mistake. Will investigate.
19:52cemerickscode: don't be so hard on yourself
19:52cemerick:-)
19:53cemerickfeel free to paste code if you continue to have trouble
19:53scodeMy mistake was that I had failed to namespace qualify my calls to the protocol methods so they were of course resolving to the namespace of the implentation rather than the protocol..
19:53scodecemerick: Thanks :)
19:55cemerickoh, that's tricky
19:55cemerickI can see that taking a little while to sort out
19:56scodeMostly just the fact that I've written far less clojure than I would want, which is showing. So minor pitfalls like these show up ;)
19:56cemerickI generally use a * or -impl suffix on implementing functions, just to keep things like that straight in my head
19:57scodeI wonder if it's a good idea to actually :use the protocol namespace in the implementing namespace.
19:58cemerickusing :use without :only is decidedly not idiomatic
19:58cemerick(in general) ;-)
20:00scodeYep, I'm not doing it. Was mostly an idle thought for the specific case of an implementation of a protocol. But that assumes the namespace of the protocol is *only* used for the protocol.
21:31ibdknoxyou know you've reached the level of awesome when you've created a DSL for writing your library documentation
21:33ibdknoxlibrary's, rather
22:08WuHoUnitedDoes anybody know the best way to pass an integer to a java function?
22:12ibdknox,(doc int)
22:13clojurebot"([x]); Coerce to int"
22:13ibdknoxWuHoUnited: ^
22:13WuHoUnitednevermind i had a different problem