#clojure logs

2009-12-25

00:47piccolino_ato: did you get clojars working on couchdb yet?
01:07tolstoyERROR: No matching method found: println for class swank.util.io.proxy$java.io.StringWriter$0
01:07tolstoyOh, boy.
01:24hiredmanhttp://github.com/hiredman/Repl
01:25hiredmanso back to feature parity with what I had before I rewrote it all
01:26hiredman(but now you can set! *font*)
03:20tolstoyadadasd
03:20tolstoyasdasd
03:21tolstoyOops. Sorry. Thought I was in my test channel.
04:14lithper1i have a file in /root/com/mem.clj, and i include /root as part of the classpath when i launch the REPL using java -cp "..." clojure.jar. However, when i require com.mem, it says it can't find mem.clj in the classpath. am i setting the classpath incorrectly?
04:16hiredmanwhat is the exact exception?
04:16lithper1FileNotFoundException
04:16_mstyou're not using "-jar clojure.jar" or anything like that?
04:16lithper1could not locate com/mem_init.class or com/mem.clk on classpath
04:17hiredmanhow are you setting the classpath?
04:17lithper1java -cp "/root:clojure.jar" clojure.lang.Repl.
04:18hiredmanuse clojure.main not Repl
04:18hiredman(not that it will solve you problem)
04:19hiredmanwhat does (System/getProperty "java.class.path") say?
04:20lithper1.
04:21lithper1it says "/root:clojure.jar"
04:22lithper1i might have an idea
04:22hiredmanwhat does the namespace declaration in mem.clj look like?
04:23lithper1ok it works now. i made a small typo in the namespace name. i'm going to go hide in the corner.
04:25lithper1i remember once when i tried to include a path in the classpath, i had this error Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath
04:26lithper1do i really need clojure.contrib?
04:39hoecklithper1: there is a lot uf useful stuff in there, you mentioned duck-streams already
04:39hoecklithper1: almost all my namespaces use except and pprint
04:40lithper1i'm just adding a directory to the classpath, why is it looking for the clojure.contrib library?
04:42hiredmanyou don't need contrib, but some library you are using might depend on it
04:43lithper1does it scan the classpath to find which files use other libraries?
04:44hiredmaneh?
04:44hiredmanit doesn't have to
04:45hiredmanwhen you load a file that use's or "require's another namespace it looks for a file providing that namespace on the classpath
04:45lithper1i'm getting that error when i just try and add a path to the classpath, without requiring anything.
04:46hiredmanthen you are loading a clojure file that trys to use contrib
04:47lithper1it can't be the case that the clojure jar is loading clojure-contrib?
04:47hiredmannope
04:47hiredmanare you using any other libraries?
04:48hiredmanpastebin your file?
04:48lithper1no, i'm just adding a path without using anything else. i'm literally just luanching the REPL with an additional classpath.
04:49hiredmanwhat command are you using?
04:49lithper1java -cp "directory:clojure.jar" clojure.lang.Repl. also tried it with clojure.main.
04:50hiredmanand what is in directory?
04:51lithper1there's one .clj file, and other dictories.
04:52hiredmanwhere did you get your clojure.jar?
04:52lithper1code.google.com
04:52hiredman
04:53lithper1http://code.google.com/p/clojure/
04:53hiredman1.0?
04:53lithper11.0.0
04:55hiredmanand what is the exact exception?
04:55hiredmandon't type something out, copy and paste to a pastebin
04:56lithper1ok
04:59lithper1http://pastebin.com/d24456523
05:04hiredmanwhere is utils.clj?
05:04hiredmanand what is line 1 of utils.clj?
05:05hiredmando you have a file named user.clj?
05:05lithper1yes it's inside one of the directories in code/ and it starts with (ns examples.utils (:user [clojure.contrib.duck-stream ...
05:06hiredmanand user.clj?
05:06lithper1user is inside code/ and it starts with (user 'examples.utils'), which refers to user.clj i just mentioned.
05:08hiredmanyou mean it refers to utils
05:08lithper1sorry, yes utils
05:08hiredmanok, well at start up clojure looks for a user.clj on the classpath and loads it
05:08hiredmanthe idea being you stick some useful utility functions in there
05:10lithper1i see. i just found the same thing being mentioned in the manual, but somehow it's missing from the book i'm reading. thanks for pointing it out.
05:13lithper1probably jumped too quick into loading libraries. thanks for the help.
07:10Drakesonhow should I turn (seq "abc") back to "abc" ?
07:11hiredmanapply str
07:11Drakesonthanks
07:56emacsenMorning folks (of afternoon where you are)
09:18emacsenliebke, were you part of the Clojure study group last year?
09:18liebkeemacsen: no
09:38emacsenI was hoping Lao_of_Dk would be on
10:33fliebelIs an observer pattern suitable for implementing a simple plugin system in a Clojure app? And how would I do that?
10:52cp2mornin guy
10:52cp2s
10:59ambienti thought design patterns were only needed for oop languages to fix their defincies
11:00ambient...well, in this case design patterns specifically designed for oop
11:10cp2ambient: just shutup and add another layer of indirection
11:10cp2;)
11:13ambientim just a noob who thinks immutability and lisp will save us all. who needs patterns when you have lambdas and macros? :\
11:14ambientfunctions that swing other functions
11:14ambientdo we really need a higher level of abstraction?
11:14cp2well, the ideal 'design pattern' in a mostly pure functional language such as clojure is... functional programming
11:15ambienti personally dont think the GoF book or others are highly useful with clojure
11:21fliebelI don't know if obeserver is the way, but I need to notify plugins that an event occurred.
11:24fliebelIs there a way I can do something like (apply -> [#(print "some") #(print "functions")])? I know I can not apply to a macro, but I need to thread a value to a vector of functions.
11:36fliebelHmm, reduce seems to work. This is my observer for now: http://gist.github.com/263669
13:22quizmewhat's the difference between an array, vector, and a list?
13:30ambientarrays are mutable, and i would like to know myself the differences between vector and list when it comes to the implementation details and performance characteristics
13:33quizmearrays are the naughty java data structure
13:33tolstoyhttp://clojure.org/data_structures
13:41quizmevectors are indexed by integers, lists are not (?)
13:43tolstoyThat's kinda what I gathered.
13:46tolstoyNot sure why you'd prefer one over the other in general programming. I always use List because that's just generally how I think.
13:48emacsentolstoy, In Clojure one generally uses indexes because it's easier to visually differentiate
13:48quizmeare vectors arguments to functions (the stuff between [ ])?
13:48emacsenLauJensen, are you actually here? I have a question for you
13:49tolstoy,(:2 ["a" "b" "c"])
13:49clojurebotnil
13:49LauJensenemacsen: Actually I'm just passing by, so can we either make it real quick, or meet up in about 15 hours? :)
13:49emacsenquizme, the bound symbols are inside the function, so yes
13:49emacsenLauJensen, quick one then...
13:49LauJensenk
13:49emacsenLauJensen, Are you going to put sqlite support in ClojureQL soon?
13:49emacsenyou mention it in the docs, but no backend in the git repo
13:49LauJensenNo plans, for 1.0, the Derby support is actually a mutated sqlite support, so it should be very quick to fit it for sqlite
13:50LauJensenI gotta run - send me an email if you got more questions :)
13:50emacsenok
13:50emacsenthx
14:01quizmewhat's the difference between conj and into ?
14:07tolstoyconj can take a non-list thing and add it to a list, while into adds one list into another?
14:10quizmesounds good to me
14:12quizmeinto strips off a set of parens
14:12tolstoyI'm not really sure, but I think I've seen conj use when you're building up a list, and into used when you're transforming a collection.
14:13tolstoy(into {} (map some-transform original-map)) ; something like that
14:17quizmei bet you could write an xml parser in just a few lines of code
14:18hiredman,(doc clojure.xml/parse)
14:18clojurebot"([s] [s startparse]); Parses and loads the source s, which can be a File, InputStream or String naming a URI. Returns a tree of the xml/element struct-map, which has the keys :tag, :attrs, and :content. and accessor fns tag, attrs, and content. Other parsers can be supplied by passing startparse, a fn taking a source and a ContentHandler and returning a parser"
14:51quizmeAre there any wrappers for more aesthetically pleasing access syntax for, say, an rss feed?
14:51quizmee.g. something prettier than: (((((((clojure.zip/xml-zip (clojure.xml/parse "http://rss.slashdot.org/Slashdot/slashdot")) 0) :content) 0) :content) 0) :content)
14:53quizmee.g. something like this would be nice: ((parse "http://rss.slashdot.org/" ) :channel :title)
14:58hiredmanhttp://richhickey.github.com/clojure-contrib/zip-filter-api.html
15:23quizmehiredman: how do you get the channel title using that api, for example?
15:29quizmenm i see an example in the halloway book
15:33lisppaste8Anniepoo pasted "why no stream?" at http://paste.lisp.org/display/92641
15:33Anniepoook, my brains obviously got a short. Why isn't that picking up stream?
15:34Anniepoo#<CompilerException java.lang.Exception: No such var: http/stream (test_sui_client.clj:11)>
15:35fliebelHuh, I'm doing something strange again… I got a clj file referred by :use in the ns declaration. When I print loaded-libs the thing shows up, but using a def in that file results in an exception. Using the same def from another file does work. How is it possible that a namespace is imported but… not working?
15:40Anniepoois http-agent broken, or not work with 1.0?
15:43Anniepoosilence on the wire
15:45Anniepoomerry Christmas Clojurebot
15:45fliebelhm, most people are celebrating christmas I guess...
15:46AnniepooI'm celegrating christmas by writing code that's not for work
15:46Anniepoo8cP I've gone over the edge
15:48Anniepooanybody on using clojure.contrib.http.agent?
15:50fliebelNot me...
15:50Anniepoook, thanks fliebel
15:50fliebelAnyone knows if using load-file breaks things? I'm stuck with a strange import problem...
15:51Anniepoowhat dev environment are you using?
15:51fliebelvim
15:51AnniepooI'm having similar weird problems with Enclojure
15:52PrinceOfAhow do i redefine a function?
15:52hiredmanfliebel: lets see some examples and some exceptions
15:52hiredmanclojurebot: how can PrinceOfA redefine a function
15:52clojurebota is b
15:53hiredmanI see
15:53fliebelhiredman: coming…
15:53Anniepoo@PrinceOfA, just use defn again
15:54Anniepoo,(defn foo [] 7)
15:54clojurebotDENIED
15:54fliebelhiredman: utterson.plugin.tesplugin prints #{clojure.main utterson.plugin} when using (loaded-libs) but when I access a function in there I get: Exception in thread "main" java.lang.Exception: Unable to resolve symbol: register in this context (testplugin.clj:4)
15:55hiredmanfliebel: lets see the code
15:55fliebelhiredman: When I access the same def (register) from another file in them same dir as plugin.clj it works
15:55Anniepooah! fliebel, you're confusing 'require', which makes clojure know about the namespace, with 'use', which eliminates the need to qualify it
15:55AnniepooI bet
15:55hiredmanhave you loaded this all in a fresh repl?
15:56ieurehttp://clojars.org/ is down. :(
15:56fliebelhiredman: http://github.com/pepijndevos/utterson/blob/master/src/utterson/plugin/testplugin.clj http://github.com/pepijndevos/utterson/blob/master/src/utterson/plugin.clj
15:56PrinceOfAi tried to redefine clojure.contrib.test-is/report by writing (defn report [event]...) but i got "Name conflict, can't def report because namespace: test.run refers to:#'clojure.contrib.test-is/report"
16:00fliebelhiredman: I don't feel very confident about my namespace setup… sometimes it works and sometimes it does not.
16:01fliebel(load "utterson.plugin") does not work, but (require 'utterson.plugin) does *puzzled*
16:02hiredmanfliebel: some kind of println in that doseq
16:03fliebelhiredman: what should I print?
16:04hiredmanfliebel: whatever
16:04hiredmanmaybe file
16:04Anniepootired of slamming head against bad clojure docs. Work on it later.
16:05fliebelhiredman: you know what… I solved it my moving the doseq below the functions! How stupid of me!
16:05hiredmanI think you must have a problem with that doseq
16:05PrinceOfAso how do i redefine function that are not in the same namespace?
16:05fliebelBy the time those plugins are imported those functions do not yet exist!
16:05fliebelhiredman: thanks for setting me on the right track… by mentioning the doseq things began to connect again in my head.
16:07ordnungswidrighi all!
16:19fliebelIs there a way I can get a script running on both repl and jar? I need to get around *warn-on-reflection* and *command-line-args*
17:57jweissany compojure folks here? i'm a newbie, problem is i want to use the "session" variable, and it seems to be nil when i go to put stuff into it
17:57jweissis there a way to initialize it
17:58AnniepooI'm baffled that clojure-contrib isnt' available as a jar file
18:03Anniepoosorry jweiss
18:07liebkeAnniepoo: http://build.clojure.org/job/clojure-contrib/lastSuccessfulBuild/artifact/clojure-contrib.jar
18:09lisppaste8Anniepoo pasted "why no stream?" at http://paste.lisp.org/display/92650
18:09Anniepoo.
18:10Anniepooodd, I just pasted at http://paste.lisp.org/+1ZHM
18:10Anniepooit didn't announce here
18:14hiredmanhttp://github.com/richhickey/clojure-contrib/blob/clojure-1.0-compatible/src/clojure/contrib/http/agent.clj <-- no string
18:20AnniepooThanks liebke!
18:22AnniepooAh!
18:23Anniepoothanks
18:23Anniepoofigured it was the version
18:24Anniepoo8cP Enclojure's broken with the latest RC
19:05neotykNew blog post "Clojure Start Again" http://bit.ly/4CHKFq
19:29the-kennyHas anyone playes with lejos (the pc api) and clojure?
19:29the-kennys/playes/playes/
19:33pdklast semester one team in our AI class used it for their mindstorms bot i believe
19:33pdki imagine it wouldn't be much harder to use it with clojure cause you can just call functions from java code directly
19:46somniumare there any implementations of seq or list with types/protocols?
19:49emacsensomnium, types?
19:49emacsenand list is a type of seq
19:49somniumemacsen: deftype
19:50emacsenoh that's all the new stuff :)
19:50somniumemacsen: deftype Cons [car cdr] ...
19:51emacsenevery time someone says cdr in a modern lisp, an elf has his toenails pulled out
19:51somnium:)
19:51somniumCons would be used internally by list/seq presumably
19:51somniumat least everyone (here) knows what it means
19:54pdkwe like to think of ourselves as cons artists
19:54pdkba dum tschh
20:01somniumah, looks like Rich used first and more in the .java
20:02somniumI sincerely apologize for uttering the profane 'car' and 'cdr' in these halls
20:20tolstoyCan't take value of a macro? Hm.
20:29somniumclojars is down?
20:46the-kennysomnium: 503 here
20:46somniumsame here :/
21:07ohpauleezholidays everyone
21:08ohpauleezawhile back someone in here was trying to optimize euler #14
21:08ohpauleezI have a pretty good one that uses primitive types and transients for intermediate steps
21:17tolstoyohpauleez: I think that was qed.
21:17ohpauleezah, yes, thank you
21:25ohpauleezqed: ping me or pm me if you want to see my latest attempt