#clojure logs

2009-10-08

00:00hiredmandunno
00:01hiredmangenerally if you get disconnected and reconnect, but your ghost is still hanging around, irc servers give you nick_
00:01itistodayah gotcha
00:02itistodaywell thanks, gotta go
00:04hecktorIs there a command from within the repl to reset the state of the repl?
00:32rongenreso if I have a hash-map. eg {:a 1, :b 2}
00:33rongenre,{:a 1 :b 2}
00:33clojurebot{:a 1, :b 2}
00:33rongenreI can turn it into pairs with seq
00:33rongenre,(seq {:a 1 :b 2})
00:33clojurebot([:a 1] [:b 2])
00:33rongenrehow do I turn it back (easily, I can use reduce, but I don't think that's the right way)
00:35arbscht,(apply merge {} (seq {:a 1 :b 2}))
00:35clojurebot{:b 2, :a 1}
00:35rongenreNice, I like it. Thanks.
00:35arbscht,(into {} (seq {:a 1 :b 2}))
00:35clojurebot{:a 1, :b 2}
00:36arbscht,(reduce conj {} (seq {:a 1 :b 2}))
00:36clojurebot{:b 2, :a 1}
00:37arbschtinto is probably the best way
02:01RaynesWouldn't it be a good idea to have a separate Google Group for job postings? Or some other means of getting job offers to the Clojure community that isn't the primary Google Group?
02:41ztellmanjust wrote a mandelbrot viewer, if anyone's into that sort of thing
02:41ztellmanhttp://ideolalia.com/exploring-the-mandelbrot-set-with-your-gpu
03:00LauJensenMorning gents
03:05Fossihi
03:06tomojLauJensen: are you the clojureql person?
03:06LauJensenYes sir
03:06tomojso, is it true that I need to put jars for mysql/postgres/derby/... in lib/ in order to compile clojureql?
03:07Fossihi
03:08tomojah well just got a BUILD SUCCESSFUL so, even if I really didn't need all of them, it's OK :)
03:08LauJensentomoj, kotarak has almost exclusively set up the build environment - I don't think you need to put them there before running ant, Ivy should fetch whatever is necessary
03:08tomojwasn't using Ivy, was just doing `ant -Dclojure.jar=...`
03:09LauJensenk, you shouldn't need it for building, it's not nitted in anywhere, you do need your jdbc adapter on the classpath when you actually start interacting with the database
03:09tomojstrange, I got compile errors until I dumped in jars for mysql, postgres, and derby
03:10tomojoh well, it appears to have worked
03:13LauJensenI should look into that
03:24LauJensen1: public LabeledComponentGroup(String labelString, JComponent... components) {
03:24LauJensen2: public LabeledComponentGroup(String labelString, List<JComponent> components) {
03:24LauJensenI haven't seen the ... notation before, what's going on here?
03:28tomojI believe that just means a variable number of arguments
03:29cgrandthe last arg is just an array of JComponent
03:29LauJensenOk, that would be my guess, but the weird thing is that I cannot instantiate this class ... maybe I'm not getting JComponents...
03:29LauJensenI'll get back to you guys
03:32tomojLauJensen: so you pass a connection info map to clojureql every time you want to run a query. does it keep an active connection alive in the background, or does it make a new connection on every query?
03:32LauJensentomoj, You can review our progress on lighthouseapp.com, so far it's a connection that opens and closes which easy body of code, but that's of course unecessary in most cases, so we're trying to agree on a method of resolution
03:35tomojah, I see, thanks
03:36LauJensen,(javax.swing.JComponent.)
03:36clojurebotjava.lang.InstantiationError: javax.swing.JComponent
03:37LauJensenhttp://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComponent.html#JComponent()
03:37LauJensenAm I missing something here?
03:42ChousukeLauJensen: I don't think you're supposed to instantiate that
03:43Chousukeit's an abstract class :P
03:44jaiganeshhi
03:44LauJensenSo whats the use? When I need to pass it to a constructor like LabeledComponentGroup, is it (#^JComponent (JTextField. x y z)) ?
03:44LauJensenhi
03:44ChousukeLauJensen: Without the extra parens :P
03:45LauJensenNo dice
03:45LauJensenI can't instantiate the Labeledgroup
03:45LauJensen'no matching ctor'
03:46jaiganeshi am reading a file one line at a time using this function
03:46jaiganesh(defn file-lines
03:46jaiganesh [file-name]
03:46jaiganesh (line-seq (BufferedReader. (FileReader. file-name))))
03:46jaiganeshis there an alternate way in clojure?
03:46LauJensen(map #(do-stuff-to-line %) (.split (slurp "filename") "\n"))
03:47ChousukeLauJensen: it takes a List or an Array of JComponents apparently
03:47jaiganeshLauJensen: thanks a lot
03:48LauJensenChousuke, aaaah, into-array is my friend, thanks
03:48LauJensenjaiganesh, np
03:48ChousukeLauJensen: or you can just use a plain clojure list
03:48Chousukesince there's a List<JComponent> constructor as well
03:48LauJensenwow
03:48jaiganesh.split can you explain that?
03:49jaiganeshoh ok got it
03:49jaiganeshsplitting on newline character
03:49Chousukeslurp doesn't read the file one line at a time though.
03:49LauJensenChousuke, I gave up when I saw that Vector wasn't unified with []
03:49jaiganeshyeash slurp read the whole file into a string
03:50Chousukejaiganesh: if you're using contrib there's the duck-streams library
03:50jaiganeshchousuke:thks will check it out
03:51jaiganeshhow to know what functions defined in a library?
03:51LauJensenread the source?
03:51tomojjeez, I'm getting a segfault with clojureql
03:51jaiganeshyeah thats one way
03:52Chousukejaiganesh: contrib has documentation accessible via github
03:52Chousuke~contrib
03:52clojurebotcontrib is http://github.com/richhickey/clojure-contrib/tree/master
03:52LauJensensegfault?!
03:53tomojLauJensen: that's what I thought! didn't even know those could happen in java
03:53LauJensenThat has to be something in the jdbc driver you're using
03:53Chousukeit can't :)
03:53Chousukeyou're accessing some non-java code.
03:53LauJensenWhat we do is make AST's and compile those into text, passing that to your driver
03:53tomojah, yes, my sqlite JDBC driver
03:53LauJensenThat will never give you a segfault
03:55tomojjaiganesh: you can also do like (ns-interns 'clojure.contrib.duck-streams)
03:55tomojthough the docs on the the gh-pages are easier to read :)
03:59jaiganeshChousuke:ok
03:59tomojguess I will just try with postgres
04:00jaiganeshi wana find if a string contains a substring , like "hello" contains "h".. how to do it?
04:03tomoj,(.contains "hello" "h")
04:03clojurebottrue
04:04liwphow do I get to the namespace doc string in the repl. (doc contrib.walk) prints out nil
04:08LauJensentomoj, in our daily work I use postgres/mysql and kota is more on Derby, those 3 work well
04:09LauJensenWe are working on literal strings for the predicate clause to queries, until that's up, there are situations where you need to use 'raw'
04:09LauJensenat least one I can think of anyway
04:10LauJensen(query table [date name value] (> date (- (Date.) (Date. 14 0 0))) or something similar, to pull up dates from the last 14 days, in that case you'd use (raw "SELECT... WHERE >= date(now() - INTERVAL 14 DAY);")
04:14tomojLauJensen: yay, it works. thanks for making this!
04:14clojurebotfor is not used often enough.
04:15LauJensencool, np
04:49tomojLauJensen: have you had problems with :auto-inc in postgres?
04:50LauJensenWe had a create-table for postgres contributed, which was fundamentally flawed, I rewrote it a few commits ago and it's worked since, also with :auto-inc
04:51tomojis there something special you have to do to tell create-table to use postgres?
04:51tomojmy tables are created fine but :not-null and :auto-inc seem to be ignored
05:04LauJensentomoj, sorry, didn't catch your msg before now - You should run the demo, it demonstrates all facets of clojureql
05:19tomojLauJensen: feel free to ignore me, don't want to bug you. trying to run the demo now but I can't figure out how to. it looks like the demo classes didn't get compiled into the jar, are they supposed to be?
05:21LauJensenI start up a repl, then load clojureql/src/dk/bestinclass/clojureql/demos/mysql.clj for instance, making sure that I have the appropriate user created in the dbms, then eval (-main)
05:22LauJensenThat will then execute some 20 operations giving you the output, reading through the code, seeing the output will teach you just about everything you need to know about clojureql
05:24crios_hello. can anyone clear me the monad-expr documentation? http://github.com/richhickey/clojure-contrib/blob/master/src/clojure/contrib/monads.clj
05:25crios_:bind and :result should be m-bind and m-result ?
05:25crios_I mean, :m-bind and :m-result
05:25tomojLauJensen: thanks, that worked. and the demo successfully make a table with a primary key/serial
05:25tomojso I must have been doing something wrong
05:26LauJensenGood, then at least now you have some working code to look at
05:26tomojyep :)
05:28crios_no Leibniz friend here :) ?
05:29tomojLauJensen: aha. I simply forgot to require dk.bestinclass.clojureql.backend.postgres
05:29tomojthanks for your help
05:29LauJensenaah :) np
05:32liwpcrios_: yeah, I think you're right
05:33liwpcrios_: or possible m-bind and m-return
05:38liwpcrios_: but I don't think you need to worry about that with monad-expr, you simply pass in the steps as a binding vector and monad-expr will do the right thing for you
05:41crios_liwp: thanks. I was trying to understand how domonad works
05:41crios_The first part in http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/ is really obscure
05:41crios_(for me)
05:43crios_I understood that stuff as simply adding what in Java / OO would be a decorator pattern
05:43crios_with a known interface
05:44LauJensenAm I the only one here who thinks that monads are a complete waste of time?
05:44tomojI don't understand them yet :(
05:45crios_Well, I could add, if just could understand their purpose :D
05:47crios_Its purpose should be adding behaviour to existing functions, so that they can be chained together
05:47crios_at least, this is my feeling
05:47crios_what do you think?
05:47LauJensenFrom what I understood, researchers worked for years on monads, primarily in Haskell, extending, adapting, improving and when they we're done they looked up and saw that Excel had the same properties... ?
05:48liwp,(use clojure.walk)
05:48clojurebotjava.lang.ClassNotFoundException: clojure.walk
05:48liwp,(use 'clojure.walk)
05:48clojurebotnil
05:48liwp,(doc clojure.walk)
05:48clojurebotjava.lang.ClassNotFoundException: clojure.walk
05:49liwphuh?
05:49liwp(use 'clojure.contrib.base64)
05:49liwp,(use 'clojure.contrib.base64)
05:49clojurebotnil
05:49liwp,(doc clojure.contrib.base64)
05:49clojurebotjava.lang.ClassNotFoundException: clojure.contrib.base64
05:49liwp,(doc map)
05:49clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
05:50LauJensenliwp, you can query clojurebot directly and play with him there, or alternatively, open a REPL locally and experiment
05:51G0SUBLauJensen: btw, where can I get the code of Clojurebot?
05:51LauJensenclojurebot, where are you?
05:51G0SUBwhoops!
05:51LauJensen~where are you?
05:51clojurebothttp://github.com/hiredman/clojurebot/tree/master
05:52G0SUBnice
05:56crios_still regarding http://github.com/richhickey/clojure-contrib/blob/master/src/clojure/contrib/monads.clj , I don't understand what the let in 'add-monad-step' do
05:57crios_let [[bform expr] step]
05:57crios_What does it do?
05:59crios_the parameter mexpr is splitted in [bform expr] , correct?
06:03liwpLauJensen: I've done the playing locally, I just wanted to verify that clojure bot shows the same problem
06:03liwpLauJensen: try (doc clojure.walk) in your repl
06:03liwpdo you get a doc string?
06:04tomojis there a good way to define methods for multimethods in namespaces out of your control?
06:05liwpcrios_: yeah, the let binding destructures a vector and binds the first element to bform and the second element to expr
06:05LauJensenliwp, I have no clojure.walk
06:06liwpLauJensen: you don't? are you on HEAD? I think it might have been clojure.contrib.walk in earlier
06:06arbschtcrios_: step is destructured, not mexpr
06:07liwpLauJensen: anyhow, doc does not return a doc string for the name space even though one exists
06:07LauJensenI'm in a 2 weeks old snapshot
06:07LauJensen~def walk
06:07clojurebotExcuse me?
06:07LauJensen~def println
06:08LauJensenliwp, it's not in core
06:09liwpLauJensen: hmm, mine is src/clj/clojure/walk.clj
06:09LauJensenaaah, I see the problem
06:09LauJensenlook in the top of that file :author "Stuart Sierra" :D
06:09liwpLauJensen: but back to the namespace doc string: I can see a doc string for example for clojure.contrib.base64 and I'm trying to figure out why it doesn't work for clojure.walk
06:10liwpLauJensen: why is that a problem?
06:10LauJensen(use 'clojure.walk)
06:10LauJensen,(use 'clojure.walk)
06:10clojurebotnil
06:10LauJensen,(doc walk)
06:10clojurebot"([inner outer form]); Traverses form, an arbitrary data structure. inner and outer are functions. Applies inner to each element of form, building up a data structure of the same type, then applies outer to the result. Recognizes all Clojure data structures except sorted-map-by. Consumes seqs as with doall."
06:11liwpthat works for me too, but (doc clojure.walk) does not return the docstring for the namespace
06:13LauJensenWeird
06:14cgrandLauJensen: clojure.walk is more than 2 weeks old
06:14LauJensencgrand, can you fetch the doc string for it from your repl?
06:17cgrandLauJensen: yes. Are you running a compiled clojure?
06:18StartsWithKliwp: you didn't compile your clojure-contrib but you have compiled version of clojure.walk? aot removes namespace metadata, i think its a known bug
06:19liwpStartsWithK: I think I've got compiled versions of both, but I might be wrong
06:19liwpanyhow, that would explain it
06:19liwpthanks
06:19LauJensengood catch
06:20tomojis this a bad idea? https://gist.github.com/05542a0687e908fe2042
06:20Chousukethere's a macro like that in contrib
06:20Chousuke(doc with-ns)
06:20clojurebot"clojure.contrib.with-ns/with-ns;[[ns & body]]; Evaluates body in another namespace. ns is either a namespace object or a symbol. This makes it possible to define functions in namespaces other than the current one."
06:21Chousuketomoj: also, you don't need the # for bindings outside the syntax-quote :P
06:22tomojah, yes
06:22tomojwell since it's in contrib I guess it's not evil?
06:22ChousukeI dunno
06:22tomojI just want to define extra methods for multimethods in some other namespace
06:22Chousukeyou should be able to do (defmethod othernamespace/multi ...)
06:23liwpI've got clojure-contrib/src and clojure-contrib/classes in my classpath before clojure-contrib.jar so that might explain it
06:23liwpmaybe I should only have the jar file in my classpath...
06:27tomojChousuke: great, thanks
06:27tomojI tried (defn othernamespace/foo ...) (where foo wasn't in the other namespace) and got an error, and for some reason assumed that meant I couldn't (defmethod othernamespace/bar ...) (where bar IS in the other namespace)
06:36tomojLauJensen: shouldn't compile-sql-alter dispatch on the class of db, like compile-sql does?
07:29LauJensenalter is currently being reworked completely
07:29LauJensen@ tomoj
07:59AWizzArd~max people
07:59clojurebotmax people is 182
08:10tomojLauJensen: ah, ok. I'll check out the logs
08:33ambientanyone know what tech Penumbra uses? seems that it doesn't use CUDA or any of that.
08:44liwpambient: OpenCL?
09:06ambientdoubtful, because opencl doesn't seem to have even C libraries yet for most platforms
09:09jdzambient: you could as well go check the source code on github instead of guessing
09:10ambientwell i already read through the code, but seems i have to read opengl api now also
09:30Dawgmatixwhats used to write the documentation available on clojure.org ? and whats used to do the syntax highlighting of the examples ?
09:56chouserclojure.org is a wikispaces site, so it uses their markup. The coloring is done by a javascript file I believe.
10:07ffaillado clojure sets maintain insertion order?
10:08liwpno
10:08liwpyou can use ordered sets for that
10:08liwpI think they maintain insertion order
10:08chousersorted sets maintain sorted order
10:09chouser,(sorted-set 4 2 5 3 1 3 2)
10:09clojurebot#{1 2 3 4 5}
10:09ffaillasorted sets incur the cost of sorting per insertion correct?
10:09liwpchouser: so there is no set that maintains insertion order?
10:10chouserliwp: nothing it Clojure anyway -- dunno if Java has something like that. You can use a vector or a list of course, if you don't mind the O(n) search time.
10:11chouserffailla: sure, it's a red-black tree.
10:11Chousukeis that possible in the first place? :/
10:11chouserprobably. you might be able to cook up some combination of a map and a vector or something
10:12chouseractually, finger trees would do it I think.
10:12Chousukehow's your implementation doing?
10:12chouserO(1) insert keeping insertion order, O(log n) lookup.
10:13tomojhow fast are clojure sets at lookup?
10:13crios_liwp: in Java you can use LinkedHashSet
10:13liwpcrios_: thanks
10:13crios_http://java.sun.com/j2se/1.4.2/docs/api/java/util/LinkedHashSet.html
10:14chouserChousuke: not bad -- pretty much all working, just needs some performance improvements.
10:14liwpchouser: your impl relies on newnew?
10:15chouserliwp: yes
10:15chousertomoj: hash-sets are essentially O(1) lookup. sorted-sets are O(log n)
10:23tomojanyone done migrations in clojure?
10:23tomojby that I mean database schema migrations
11:43andysp how to restart nagios?
11:51replaca_ztellman: are you lurking?
11:51ztellmanreplaca_, yeah
11:52ztellmantrouble running the mandelbrot demo?
11:52replaca_sick of c#, eh? :-)
11:52replaca_ztellman: do you know who replaca_ is?
11:52ztellmanreplaca_, no
11:53replaca_ztellman: clue: I wrote the clojure pretty printer
11:53ztellmanah, gotcha
11:53replaca_so I just wanted to give you some grief when I saw you in channel after I heard you were sick
11:54ztellmanyeah, I'm trying to figure out whether to come into work today
11:54replaca_don't - we don't want to share our germs this year
11:54replaca_plus you're about to have vacation
11:54ztellmanyeah
12:32technomancyso it looks like the JDK is has primitives for reading zip files, but it doesn't seem to have any actually useful "unzip this file into this location" methods...
12:32technomancyis there anything like that for Clojure? maybe in contrib?
12:33tomojLauJensen: is there supposed to be a way to make multiple columns NOT NULL?
12:33technomancyprobably should be in contrib if it's not already
12:43cow-orkerinconsistent? on a sorted-map I'm allowed to run first and rest, but not destructure in let. (let [[x & xs] (sorted-map 1 2 3 4)] nil)
12:43cow-orkerjava.lang.UnsupportedOperationException: nth not supported on this type: PersistentTreeMap
12:43clojurebot
12:46corruptmemorydeploying latest devastator to QA
12:46corruptmemoryoops, wrong window
12:46corruptmemorycarry on
12:52rsynnottclearly, corruptmemory works for a company which makes weapons for bad scifi books
12:53corruptmemoryAlas, not far from the truth, although no weapons. Merely the other engineers here like to name things after Transformers, perhaps just as bad.
12:54rsynnott(happily, in the real world weapons either have non-threatening names, like Polaris, or meaningless names, like SS-18)
12:55ambientCarebear stare V9
12:56cow-orkeror maybe not "inconsistent" as there is no reader syntax for sorted-map. But it would have been nice anyway... some destructuring syntax that works with first/rest? anyway...no big deal :)
12:56rsynnottor downright deceptive names; Blue Peacock is a nuclear landmine filled with chickens, not peacocks, presumably for cost reasons
13:01JAS415anyone have experience with pneumbra?
13:01JAS415i'm trying to get it set upand having trouble
13:01JAS415not sure what i'm doing wrong
13:02replaca_JAS415: ztellman is your guy. He's around here sometimes
13:02JAS415ok
13:02ztellmanyeah, I'm here
13:02ztellmanwhat kind of problem are you having?
13:03JAS415well i'm on linux, and i'm getting an 'unsatisfied link error'
13:03JAS415that my nativewindow_jvm isn't on the library path
13:03JAS415interesting thing is all of the things in my library path have lib prepended to them
13:03ztellmanare you using the startup script from the wiki?
13:04JAS415so its libnativewindow_jvm
13:04JAS415trying to
13:04ztellmanhmm
13:04ambienti do -Djava.library.path=c:\path\to\penumbra\lib\windows
13:05JAS415oh
13:05JAS415maybe the ~ is screwing it up
13:05ztellmanyeah, you generally have to give the full path
13:06ztellmanseems like you shouldn't need to, but you do
13:08JAS415it is literally supposed to be something like "/home/jon/pneumbra/lib/linux" ?
13:09ztellmanyeah, though you transposed some characters in "penumbra"
13:09ztellmanin case that was a copy/paste
13:10JAS415well there's a problem
13:12JAS415thanks, now it works
13:12ztellmangreat
13:12ztellmanlet me know if you have any other issues
13:23tomojis it bad that I want to call a function whose namespace is known only at runtime?
13:24tomojI guess I can just eval it, but it seems wrong :(
13:27hiredman,((resolve (symbol "clojure.core" "+")) 1 2)
13:27clojurebot3
13:27tomojah, thanks
13:28tomojI was trying stuff like #'(symbol ...) and realized that was idiotic, then gave up
13:30ngocHow to start REPL and evaluate something right after (or before) REPL is started? I want to both run a .clj file and hava REPL at the same time
13:35ambienti use emacs for that
13:35ambientor some other ide
13:36Chousukengoc: java -cp clojure.jar clojure.main --help :)
13:36ngocI want to design a "make start" target that starts the program, and still gives REPL so that the user can interact with the program
13:37Chousukeyou can start a repl with a startup script
13:40ambientanyone have tips for fast buffer switching in emacs?
13:41funkenblattC-x <right>?
13:41funkenblattor left
13:41ambientwell i got like 40 buffers open but want to just switch between 4 or 5
13:41funkenblattoh
13:41funkenblattwell for that i usually just open up 4 or 5 windows
13:42ambientsome kind of a keybind/tab-bar system would be highly useful
13:43ambientM-x bind-buffer M-1 foo.clj M-2 bar.clj etc..
13:43funkenblattit might exist already
13:43rddcheck out iswitchb-mode or ido-mode
13:45rddhm, they're not like what you suggested, but better than the default buffer switching function imo
13:46tomojido and friends are great
13:50funkenblattwell anyway it wouldn't be hard to write something like what ambient said
13:51technomancyambient: yeah, ido is the way to go
13:51ambientsomekind of a priority list for autobinding would be kinda sweet also, the most used files bubbling onto the top, or manually defining the priorities
13:51ambientok, thx. i shall read about ido then
13:52technomancyido puts the most recently accessed at the front
14:05danleiI use a mix of ido-switch-to-buffer, winner-undo, and C-x r w / C-x r j
14:07danlei(C-x r w is especially helpful if I want to preserve a split of file+repl, when using different languages)
14:08danleibookmarks are nice too, but another story
14:18drewrI use elscreen
14:18konrAre there other screencasts besides Rich's?
14:18drewreach "screen" is a different window config
14:18drewrkeeps me sane switching between emacs and the terminal
14:19drewrC-z always does what I expect
14:19technomancykonr: there's PeepCode (not free)
14:19technomancykonr: and there's a few very introductory ones on youtube
14:20konrtechnomancy: hmm, is peepcode worth it?
14:20technomancykonr: I think so, but since I wrote it I just might be biased. =)
14:20konrtechnomancy: haha
14:20technomancymost reviews were pretty positive though.
14:32danleidrewr: what's the difference to C-x r w then?
14:47mrsoloknor: this is new http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure/
14:55savanniHey, I have a really simple JDBC question.
14:56savanniAs far as I can tell, I'm supposed to create a connection using the getConnection() method on java.sql.DriverManager. The problem is that when I call (. java.sql.DriverManager (getConnection)), it says that getConnection does not even exist, and I am expecting it to say that getConnection requires more parameters.
14:56savanniAm I going in totally the wrong direction?
14:58mrsolosvanni: i juse clojure.contrib.sql instead of jdbc directly...
14:59konrtechnomancy: I'm downloading your screencast! Sounds nice!
14:59Chousukesavanni: when it says it doesn't exist it means that it doesn't exist for the parameters you called it with :P
14:59technomancykonr: cool; thanks
15:00kotaraksavanni: there is also clojureql
15:01savanniActually, i'm going to jdbc because there's at least one function, getMetaData, which isn't strictly an SQL function.
15:02savanniChousuke: does that apply only to java methods?
15:02Chousukesavanni: yeah
15:02savanniAaaahhhhh.
15:02Chousuke,(identity 3 4)
15:02clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$identity
15:02savanniYeah, that's what I was expecting.
15:03Chousuke,(Math/sqrt 2 3 4 5)
15:03clojurebotjava.lang.IllegalArgumentException: No matching method: sqrt
15:03rstehwien konr: is that the Mire screencast from peepcode? It is awesome.
15:03konrrstehwien: yes! There are several interesting screencasts on it. I hope more clojure-related ones show up
15:04rstehwienkonr: me too, the more clojure screencasts the better
15:05slashus2Chousuke: You working on writing the reader in clojure? How is that going?
15:05savanniBooya! Access denied!
15:05savanniThanks, Chousuke.
15:09Chousukeslashus2: stalled right now, studies interfere. :P
15:11kotaraksavanni: you might want to look into show from clojure.contrib.repl-utils
15:12savanniOkay, I'll look at that, too.
15:12savanniI've got access, but it's a deep tree to traverse.
15:14woobyis use of test metadata idiomatic, or should one prefer test-is?
15:15Chousukewooby: test-is is clojure.test nowadays, so use it :)
15:16Chousukethough you need a git version of clojure for it :/
15:16danlarkinstuartsierra: got a minute? I'm getting weird behavior with duck-streams/copy
15:17woobyChousuke: thanks
15:17drewrdanlei: elscreen probably uses it underneath
15:17danlarkinstuartsierra: the output file is larger than the input file
15:17drewrdanlei: less to keep in my head
15:18drewrjust scroll through the tabs at top with C-z C-n
15:18danleiah, ok
15:33dermariushello everyone
15:33LauJensenGents - I'm working on a single namespace little app, where I want to use a few images, how can I avoid using fully qualified paths ? (user.dir = "/home/")
15:33LauJensenhi dermarius
15:33dermariusI'm just trying to get along with emacs and clojure-mode.... but somehow the keystrokes are still a mystery for me
15:34dermariusis there a command to eval the whole buffer?
15:34dermariusC-x C-e seems not to compete with line breaks
15:35danleidermarius: C-c C-l, C-c C-k the first one loads, the second one loads and compiles. besides, try C-h m in a blojure-mode buffer
15:35Mariusok, thanks... will give it a try
15:35danleiwelcome
15:40hiredmanLauJensen: if you don't put a '/' as the first element in the path it will not be fully qualified, and that is how you can avoid using fully qualified paths
15:40hiredman
15:41LauJensenhiredman, does it then guarantee to set user.dir to the directory where java is launched from ?
15:42hamzahey guys, i am building xml from a set using reduce (reduce f [] data) but i get everything wrapped in a vector and that produces empty tag. is there a way to overcome this?
15:42hiredmanLauJensen: if you want a nonspecific answer it's best to ask specific questions
15:43hiredmanhamza: [] is an emtpy vector, and you are using it as the init value to reduce
15:44hiredmanit is hard to say if that is the problem without looking at teh function, but that would be my guess
15:44hiredmanLauJensen: by user.dir you mean the java property?
15:45hiredmanand you want user.dir to be a relative path or something?
15:46LauJensenhiredman, yea - I just want to be sure, that when I ask people to run the app with java -cp . clojure.main proggy.clj - that it will always find the images in that folder
15:46hamzayeah thats the case function is (reduce (fn [f v] (conj f [:item [:desc (:desc v)]])) [] data) how would you produce an xml? or do i have to call first on the result
15:46hiredmanLauJensen: uh
15:46hiredmanLauJensen: that folder means the directory java is launched from?
15:46LauJensenyes
15:47hiredmanso just user (System/getProperty "user.dir")
15:47hiredmanuse
15:48hiredmanhamza: I've never produceded xml, just consumed it
15:49hiredmanbut your result is a bunch of xml fragments, I imagine you need to stick them in some kind of containing tag/element/whatever
15:50hiredmanwhat are you using to produce the xml?
15:50hiredmanI was thinking clojure.xml/emit or some such, but your format is completely different
15:57stuartsierradanlarkin: I'm back; what's the problem?
15:57danlarkinstuartsierra: the output file is larger than the input file
15:58stuartsierraoooo-kay
15:58stuartsierraWhat are you copying? File to File?
15:59danlarkinInputStream to Writer
15:59stuartsierraMight be an encoding issue.
16:00danlarkinit's binary data
16:01stuartsierraThen you should be writing to an OutputStream, no?
16:03danlarkinheh, I did not know that
16:04stuartsierraYes, Reader & Writer are only for character data; InputStream and OutputStream are for binary data.
16:04stuartsierra(copy InputStream Writer) will first convert the content of the input stream to a string using the default encoding.
16:04danlarkinwell that would explain it
16:05stuartsierraIf you just want to read from an input stream and write to disk, you can use (copy InputStream File)
16:06danlarkinYep, just made the change and now the tests pass, thanks :)
16:06stuartsierrano problem
16:12zakwilsonSo let's say I want to use Clojure to make a decent cross-platform GUI that's easy to distribute, and I don't want to tear out my hair. What tools should I be looking at?
16:12stuartsierrazakwilson: a magic lamp?
16:14dermarius:-D
16:15triyois that like magic pony?
16:16dermariusits like the holy grail, but brighter
16:16Chousukezakwilson: maybe Qt? :/
16:16dermariuszakwilson: one could say java already contains a cross-platform GUI... what will be special with the GUI you're thinking about?
16:17zakwilsonQt seems like it would make distribution significantly harder. I was hoping for something that makes Swing nicer to work with.
16:17zakwilsonBut I didn't phrase the question that way because I don't want to limit my options.
16:18fyuryu\who "owns" the the Clojure tshirts on zazzle.com?
16:18dermariusone thing which annoys me at swing is how the layout is managed
16:18hiredmanChouser maybe?
16:18dermariusi guess that's why ibm choose to develop SWT
16:19hiredmanzakwilson: the #java regulars all seem to swear by swing
16:19fyuryu\hiredman: thanks. That's what I thought.
16:19rstehwienzakwilson: There is a discussion at the following link that talks about guis. I like the idea of soemthing like the last declarative form or a groovy like gui builder http://stackoverflow.com/questions/233171/what-is-the-best-way-to-do-gui-in-clojure .... I don't like swing much either
16:19fyuryu\chouser: ping
16:20zakwilsonSwing seems like the obvious choice, but using it directly is pretty verbose.
16:20Chousukecontrib also has that miglayout wrapper thing but I don't know if it's any good.
16:20rstehwienzakwilson: mostly I liked swing until I wanted to do a tree or grid.
16:20hiredmanrstehwien: the highest voted answer there is bs
16:21chouserfyuryu\: hi
16:21rstehwienhiredman: yeah, I actually liked the lowest voted item
16:22fyuryu\chouser: hi, does any money from stuff on zazzle.com go to rhickey or is it all sold without any margins?
16:22rstehwienhiredman: my prefs were gui code that is declarative like "(form {:title :on-close dispose :x-size 500 :y-size 450}", a builder, maybe cells, or just straight swing
16:22zakwilsonShort answer: write a macro?
16:23zakwilsonOk. I guess I was hoping somebody already had, and tested it well and put it on github or some such.
16:24chouserfyuryu\: none of the profit that zazzle shares has gone anywhere yet. I believe I've promised in the past that it would all go to rich.
16:24danleirstehwien: yes, cells-gtk for example is a breeze to work with
16:25danleirstehwien: if you meant a sorta reactive approach with "cells"
16:25chouserfyuryu\: there's hardly been enought to bother about yet.
16:25fyuryu\chouser: I bought a something at a similar shop, but haven't made the shop itself public. I'm thinking about it. And I guess some cash for rhickey to pay for the servers etc would be nice
16:26rstehwiendanlei: do you know if the cells-gtk for CL is similar to the Clojure neman.cells lib http://bitbucket.org/ksojat/neman/ ?
16:27fyuryu\I don't care about the money anyway, I just wanted something to wear ;-)
16:27fyuryu\http://dl.getdropbox.com/u/820389/clj02.png
16:28hiredmanoooh
16:28hiredmanclojure track suits
16:29danleirstehwien: I never used it, but from what I read in the description, it looks alike, yes
16:30rstehwiendanlei: thanks! the neman.cells has moved up on the list of things to look at then... to bad that list is really long ;)
16:30danleirstehwien: in my opinion this is one of the best approaches to gui programming (at least the nicest I've ever worked with)
16:32ambientthere's something for clojure/swing?
16:35lisppaste8danlei pasted "cells<->fahrenheit" at http://paste.lisp.org/display/88401
16:35danleirstehwien: that's for example a fahrenheit celsius converter I did when learning cells-gtk
16:36danleirstehwien: btw. thanks for to pointer at neman.cells, I'll check it out
16:37lisppaste8danlei annotated #88401 "correct version" at http://paste.lisp.org/display/88401#1
16:37zakwilsonPaste is Cells-GTK?
16:37danleiyes
16:37danlei*pasted
16:38rstehwiendaneli: no problem newman.cells (there is a google groups thread on cells) and miglayout in clojure.contrib might be something close to what I'd like. I'd love a declarative framework for gui but using doto is pretty close
16:39danleihm ... I don't think so about doto :)
16:40technomancywouldn't it be handy if file-seq took a string?
16:40rstehwienI'd like a dsl that takes something like this and makes the Swing for me
16:40rstehwien(form {:title :on-close dispose :x-size 500 :y-size 450}
16:40rstehwien  [(button {:text "Close" :id 5 :on-click #(System/exit 0) :align :bottom})
16:40rstehwien   (text-field {:text "" :on-change #(.println System/out (:value %)) :align :center})
16:40rstehwien   (combo-box {:text "Chose background colour" :on-change background-update-function
16:40rstehwien               :items valid-colours})])
16:41rstehwiendaneli: code pasted not mine or my ideal, just snagged for example. I've been spoiled by declaritive frameworks in Adobe Flex (sucks in its own way but nice to declare a gui)
16:45danleirstehwien: I think cells-gtk (and maybe neman.cells) comes close. what I find most convenient is that you don't have to handle callbacks and such, just say what something contains and it updates automagically, that's the big win
16:46danleias far as kt's cells is concerned, he describes it as "spread cheet" like approach
16:47danleiso, there would be no "on change", for example
16:47danleijust say what goes there, and if it changes, it's not your problem :)
16:48danlei(as in my pasted example)
16:48rstehwiendanlei: That does sound nice. Flex has the ability to bind data in a similar fashion so that when the data changes the UI is updated and vice versa
16:48danleiyes, that's exactly what I mean
16:48rstehwiendanlei: and data binding is a big win
16:48StartsWithKneman.cells is broken :/ never updated it to new watchers
16:48danleiI think that's THE way to handle guis (at least for a great part)
16:49StartsWithKis there a interest in more feature rich (and working) version of cells?
16:49danleiI still have to look at it, but generally: sure
16:49rstehwiendanlei: I agree. Once you have that level of data binding it is hard to go back to having to do it yourself
16:49danlei(look at neman, that is)