#clojure logs

2010-02-28

00:17brian_tes
00:27_atotechnomancy|away: Clojars had run out of memory, not sure whether that was causing the hanging or was the because of it (too many connections building up). I've restarted it and put in a cron to monitor it in case it happens again.
00:30maxhodakis it possible to get a string of a symbol?
00:30DeusExPikachu,(doc name)
00:30clojurebot"([x]); Returns the name String of a symbol or keyword."
00:30maxhodaklol
00:30maxhodakfacepaml
00:30maxhodakfacepalm
00:32_atoalso note:
00:32_ato,(name 'foo/bar)
00:32clojurebot"bar"
00:32_ato,(namespace 'foo/bar)
00:32clojurebot"foo"
00:33maxhodakwhat about going the other way? returning the symbol named in a string?
00:33DeusExPikachu,(doc symbol)
00:33clojurebot"([name] [ns name]); Returns a Symbol with the given namespace and name."
00:34maxhodakawesome
00:34maxhodakthanks
00:34DeusExPikachunp
00:40Luyt,(1)
00:40clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
00:40Luyt,('1)
00:40clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
00:40Luyt,(int 1)
00:40clojurebot1
00:40LuytThat's my boy.
00:46brian_seeking help with a library classpath issue
00:52rickmodeJust starting with Clojure. What's the current best practice for getting clojure going with Aquamacs? I'm looking at various tutorials and they all do things a bit different (perhaps some or too old?)
00:57technomancyrickmode: check the docs for swank-clojure
00:57technomancyaquamacs is not officially supported, but it should work.
00:57technomancy_ato: thanks
00:58technomancy_ato: have you thought about sharing the maintenance of clojars so someone else can reset it if there are problems in the middle of the Aussie-time night?
00:59rickmodetechnomancy: so we dont' start with clojure-mode?
01:01technomancyrickmode: installing swank-clojure will pull in clojure-mode as a dependency
01:01technomancythough you can use clojure-mode standalone if you like
01:09zaphar_psany ideas what might strip the meta away from a namespace after it's compiled into a jar?
01:10danlarkinzaphar_ps: it's a bug in clojure
01:10technomancyclojurebot: #130
01:10clojurebotTitim gan éirí ort.
01:10technomancyclojurebot: ticket #130
01:10clojurebot{:url http://tinyurl.com/ndkovn, :summary "Namespace metadata lost in AOT compile", :status :new, :priority :normal, :created-on "2009-06-19T04:47:33Z"}
01:11zaphar_psahhh ok so I'm not going crazy then
01:12zaphar_psbummer that makes what I was planning to do a little difficult
01:16brian_hi,im new to clojure. I have a clojure library I'm trying to invoke in a file :
01:18brian_using (:require [com.twinql.clojure.http :as http]), but when I call file in repl user=> (load-file "http01.clj") I get java.lang.ClassNotFoundException: com.twinql.clojure.http (http01.clj:1)
01:21brian_however , the library is in my classpath: user=> (System/getProperty "java.class.path")
01:21brian_user=> (System/getProperty "java.class.path")
01:21brian_however, I know the library is in my classpath user=> (System/getProperty "java.class.path") ... compojure/clj-apache-http-standalone.jar:"
01:22hiredmanand com.twinql.clojure.http is in clj-apache-http-standalone.jar?
01:24brian_well... root# jar vtf clj-apache-http-standalone.jar -> ...17123 Sat Feb 27 20:30:34 MST 2010 com/twinql/clojure/http.clj
01:24hiredmanoh
01:25hiredmanbrian_: are you using the ns macro?
01:25brian_oh
01:26hiredmanif you are using load-file, you shouldn't be
01:26brian_hmm
01:26hiredmanbut :require is for the ns macro
01:26hiredmanyou want require
01:26brian_wait a sec
01:26hiredmanand you'll need to quote the arguments
01:27brian_thats probably iy
01:27brian_it
01:28brian_this is all i have in the file (:require [com.twinql.clojure.http :as http])
01:28hiredman:require is just a keyword
01:29brian_(ns (:require [com.twinql.clojure.http :as http])) ?
01:29hiredmanno
01:29hiredmanI told you
01:29brian_ok
01:30hiredmanif you are using load-file like that you shouldn't use the ns macro
01:30hiredmanjust use require
01:30hiredman(require '[com.twinql.clojure.http :as http])
01:30brian_require not :require?
01:30hiredmanright
01:30brian_oh
01:30hiredman:require is just a keyword
01:31brian_yea
01:31hiredmanit doesn't do anything
01:31brian_thanks
01:31brian_why no ns in load-file out of curiosity
01:32hiredmanif you use the ns macro your file needs be in the correct place relative to the classpath and should be loaded using require or use, not load-file
01:33brian_oh, thanks much, that clarifies things
01:41rickmodetechnomancy: still no joy. getting errors during ELPA install: swank-clojure.el:48:1:Error: Cannot open load file: clojure-mode
01:48rickmodetechnomancy: nevermind... the error were innocuous - slime comes up with the Clojure REPL. Thanks!
03:32LauJensenMorning
04:05Leafwany means to specify the return type of a function, as a form of type checking?
04:10vyLeafw: AFAIK, no.
04:10Leafwhum, not even in the meta? I am surprised
04:11vyLeafw: From java_interop doc.: All arguments are passed to Clojure fns as objects, so there's no point to putting non-array primitive type hints on fn args.
04:11vyLeafw: Hrm... It might work for non-primitive data types, IMHO.
04:11Leafwthat is what I thought
04:12Leafwplus clojure's reader/compiler has been improving its type inference capabilities. It complains a lot more than before, for example when trying to call a method to an object that doesn't support it.
04:13Leafwbut a search for 'clojure function fn "return type"' in google didn't return anything beyond datatype and gen-class
05:33LauJensenDoes anyone have a good description of what exactly -server does, compared to -client?
05:47TheBusbyLot's of info here, http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
05:56LauJensenThanks
06:58LauJensenI'm wondering a little about how -Xmx works. If you set it too low, you risk that you program starts swapping which blows performance, but why this initial performance degradation, why not just a heap-explosion ?
07:01TheBusbyif you google around, I think Rich made a few comments about why it's not always good to set everything high
07:01TheBusbyI guess if the JVM doesn't have an appropriate ceiling it doesn't work very efficiently in some cases
07:04LauJensenI'm just not following the logic - is the Xmx the amount of memory that it hogs at boot, so that if you exceed it, it will start swapping or looting system memory until finally consuming all the systems memory and then the heap blows, or what ?
07:05ChousukeMy guess would be the gc
07:06ChousukeIt would make sense if, as you approch the limit, the GC goes wild trying to free memory for you :P
07:06LauJensenSo your guess is that the GC is blowing the heap ?
07:08Chousukeno, I'm guessing it's causing the performance degradation
07:08ChousukeBut I really don't know, so any guess is as good as mine :P
07:10LauJensenoh...
07:10LauJensenWouldn't be too hard to find out, but yes it does make sense
07:13LauJensenChousuke: Are you on Twitter?
07:13Chousukeno
07:13the-kennyWhich version from contrib should I use with [org.clojure/clojure "1.1.0"]?
07:14the-kennys/from/of/
07:14Chousukethere's a 1.1.0 release of contrib
07:14the-kennyChousuke: huh? The only 1.1.0-stuff I'm seeing is 1.1.0-master-SNAPSHOT
07:15Chousukehm
07:15the-kenny(In http://build.clojure.org/snapshots/org/clojure/clojure-contrib/)
07:15Chousukehttp://build.clojure.org/releases/org/clojure/clojure-contrib/
07:15the-kennyhuh
07:16the-kennyDidn't knew there is a releases-directory
07:16ChousukeI just found tht out a few days ago too :P
07:17dm3anyone using vimclojure here?
07:19Leafwdm3: meikel, the creator, hangs around here often
07:19dm3I see, thanks
07:20LauJensendm3: under the name "kotarak"
08:05rrc7cz-hmwhy doesn't (read) like strings with forward slashes? I'm getting an invalid token on "bar/baz" within a string like "foo bar/baz"
08:16vyrrc7cz-hm: (let [rdr (java.io.PushbackReader. (java.io.StringReader. "bar/baz"))] (println (read rdr)) (println (read rdr))) works without a problem, do I miss something?
08:19rrc7cz-hmvy: I was trying to deserialize a large data structure (vec<map>). I manually wrapped it in a def and changed it to a .clj, used load-file, and found a missing "
08:20rrc7cz-hmsomething screwed up the serialization
08:20rrc7cz-hmvy: is print-dup still the correct way to serialize clj data structures?
08:24vyrrc7cz-hm: API docs say that "By default, pr and prn print in a way that objects
08:24vycan be read by the reader"
08:37rrc7cz-hmvy: aha.. when I was writing (println ["one" "two" "three"]) it outputs the (un-deserializable) [one two three], but (prn) gives ["one" "two" "three"]
08:58miltondsilva(take 2 (for [vector (vec (repeat 9 nil))] [vector])) why isn't the result two vectors with 9 elements each?
09:04Chousukemiltondsilva: the name vector gets bound to each item in the vec of nils
09:05miltondsilvais there some way of getting it bound to the vecs instead of the items?
09:05Chousukethat's not what for is for :P
09:06Chousukeyou could just do (let [v (vec (repeat 9 nil))] [v v])
09:07miltondsilvaok I see, I was trying to make something that didn't make much sense :S
09:14vyAny clojure-ant-tasks user in the house?
09:34djpowelljust having a play with leiningen, as a maven-skeptic
09:35djpowellbit worried about people shipping aot compiled libraries unless absolutely necessary
09:36djpowellseems like it is more of a packaging choice for the app, and it causes lots of breakage if you try to use them with a different version of clojure
09:37djpowellleiningen does look fun tho
09:38esjleiningen is fabulous
09:39djpowelli guess some code needs aot compilation for interop, but i wonder if there could be some sort of half-way point, where the interop stuff could be compiled (eg gen-class, deftype, etc), but not all of internal stuff that is likely to have binary compatability problems with different versions of clojure
09:41djpowellyeah leiningen does look good. i'd never consider using maven really for java stuff, and ant feels like writing build scripts in an imaginary world where doing in in a procedural xml language would be a good idea. but i plan to use leiningen on clojure projects
09:42defnto me it's just that XML is noisy lisp
09:42defnso of course leiningen makes sense
09:43defnthere's really no thinking involved -- that's just the way it is
09:45defnleiningen is really just a lisp-like way of speaking to maven
09:46kotarakdjpowell: This is perfectly possible: http://paste.pocoo.org/show/183865/ <- short example. Just name.classes must be compiled. name.space and name.room can be "normal" clojure files.
09:47djpowellmaven scares me tho. maybe because i am very conservative with dependencies, and don't use commons-*.*, so i don't really have problems with dependencies that require something as complex as maven. i like lein as a build system tho
09:47Rayneskotarak: Do you remember how you told me to run kickoff.sh the other day?
09:48kotarakRaynes: I'm about fixing it.
09:48djpowell(I do use the odd commons jar, but yeah, i'm a bit conservative with stuff)
09:48kotarakRaynes: It works for me, btw.
09:48RaynesWell, I don't know if it broke. It put gradle in cache.
09:48RaynesI was just wondering what I was supposed to do after that point. :p
09:49djpowellkotarak: yeah that might be a good aproach
09:50kotarakRaynes: export GRADLE_HOME pointing to the directory, where you put it. Then use "$GRADLE_HOME/bin/gradle build" in the vimclojure directory.
09:51vyCan anybody help with this Apache Ant problem please: http://privatepaste.com/226857830b
09:53kotarakvy: a) (ns com.acme.projects.nails (:gen-class) (:load "nails/main")), b) (in-ns 'com.acme.projects.nails) in main.clj. There you go.
09:54Rayneskotarak: Alrighty, that worked. What else? >.>
09:55vykotarak: Thanks so much! Worked like a charm! But why using in-ns instead of ns?
09:55kotarakRaynes: ".../gradle install" to install the vimclojure jar in your local repo and ".../gradle installVim" to install the vimfiles.
09:56kotarakvy: because ns is only for setting up the namespace. In sub-files being (load)'ed, one uses in-ns to tell clojure to which namespace they belong.
09:56kotarakRaynes: you can then depend in your projects on the vimclojure jar and will be automatically added to your classpath (if you use gradle or maven, that is).
09:57RaynesLeiningen would work as well, right?
09:58kotarakRaynes: dunno. If it looks in the local .m2 maven repo, it should. Yes.
09:58RaynesIt does.
09:58RaynesYay. Syntax highlighting works without breakage. You must have fixed whatever problem I was having before.
09:58kotarakRaynes: then there souldn't be a problem.
09:59RaynesI'll play with this more later.
09:59RaynesThanks.
09:59kotarakYou are welcome.
09:59defnAnyone know how to log into an SSL site with clojure and scrape it with enlive?
10:00defnI've been looking for an answer for weeks after spending way too long trying to figure out a good solution, but I couldn't find one due to my java ignorance
10:01defnsomeone suggested apache-http-client
10:01defnbut i simply do not get how the hell im supposed to negotiate SSL based on the examples
10:01defn(for the clojure lib)
10:22djpowellif I wanted to have a project-local leiningen repository for some reason, I was hoping I could do something like: :repositories {"project" "repo"} , but it looks like you can't just use a relative path there, you need a full file:// url. Are there any substitution variables or anything that you can use?
11:59mschhi, any idea where i can find this paper: http://portal.acm.org/citation.cfm?id=1408682
12:03patrkrismsch: don't think you can find a paper - i think it refers to a talk given by Rich Hickey
12:06mschpatrkris: ok, too bad. but thanks nevertheless!
12:59arkrostHi! I have some questions about memory model in clojure. Whom can I ask?
12:59anarsarkrost: just ask
13:00anarsif you're referring to the STM in clojure, check http://clojure.org/refs
13:01anarsif not, then you're probably looking for info on the JVM memory model :)
13:01arkrostOk. For example I have seq. What happens when I apply functions such as conj or rest..Will it create a new seq?
13:01hiredmanyes and no
13:02hiredmanyou know linked lists?
13:02hiredmanseqs are like that
13:02bosiehiredman: are they doubly linked lists?
13:03hiredmanbosie: nope
13:03hiredmanand they aren't "linked lists" either
13:03hiredmanbut they have the same interface
13:03bosieok
13:04arkrostSo if i have a seq containing n elements, when I will apply conj function, I'll get another seq containing n+1 element. So I will save 2*n + 1 element?
13:05arkrostOr I will save n+1 element ?
13:05hiredmanwhat do you mean save?
13:05esjno, you'll have 1 element until you realise the seq
13:05esjconj is lazy too
13:06hiredmanesj: nope
13:06esjhiredman: rats ! I thought I had one :)
13:06bosieesj: had what?
13:06esjan correct answer
13:07hiredmanconj'ing onto a lazy-seq should keep the rest of the seq lazy, but the operation is not lazy
13:07hiredman,(class (conj (seq [1]) 2))
13:07clojurebotclojure.lang.Cons
13:07bosiehow does the garbage collector work on lazy seqs?
13:08hiredmansame as on any other object
13:08bosieif i map a lazy seq and apply a side effect free function on it, does it keep both sequences in the memory?
13:08hiredmanmap is lazy
13:08bosieye
13:08bosieso i realize map
13:09hiredmanthe datastructures are all immutable
13:09bosiewhat datastructure?
13:09hiredmanall of the clojure ones
13:09bosiei have a function returning a lazy sequence i use in map
13:09hiredmanseqs, vectors, maps, sets, etc
13:09bosiewhy would clojure keep that list in memory?
13:09bosiethe entire list i mean, at the same time, in memory
13:10hiredmanif you hang on to the head of a seq, and realize the whole seq, you have a reference to the whole seq, so it cannot be gc'ed
13:10arkrostwill elements containing in seq be copying after applying conj function?
13:10bosiebut i guess it doesn't anyway? would make the lazy sequence kinda useless
13:10bosiehiredman: damn
13:10hiredmanarkrost: why would they be copied?
13:11hiredmanbosie: just don't hang on to the head
13:11bosiehiredman: how would you not?
13:11hiredmanbosie: by not hanging on to the head
13:11esjbosie: In clojure you must differentiate between the concrete types and the seqs. Concrete types like vectors and sets keep everything in memory, and seq's can be thought of (initially) as clever iterators, they do not make any copies.
13:12hiredmanesj: yeah they do
13:12bosieesj: wrong again i guess ;)
13:12esjdammit !
13:12hiredmanthey have to
13:12bosiehiredman: but if a function returns the a lazy list and i use it as a parameter to map
13:13hiredmanevery pass of a lazy seq function over a lazy seq creates a new layer of lazy seqs
13:13bosiehiredman: wouldn't that mean i hang on to the head for as long as map iterates?
13:13hiredmanmap does not hang on to the head
13:13esjhiredman: ok, they make a copy in the persistent datastructure sense, right ?
13:13esjso its just the trie
13:13hiredmana seq is not a trie
13:14bosiehiredman: so if the first lazy seq has N elements, i only ever have I+1 elements (I being the current index of map) in memory and not I + N ?
13:14hiredmanit's, uh, like a linked list
13:15hiredmanbosie: I can't make guarantees about when the gc will run
13:15hiredmanand thus I can't tell you what is sitting around in memory
13:15bosiehiredman: if the gc would be executed after each operation, it would be I + 1
13:16hiredmanbosie: what do you mean by the current index of map?
13:16kotarakhiredman: when does a seq create a copy?
13:16bosiehiredman: the current iteration
13:17hiredmankotarak: copy is maybe the wrong word, but a chain of maps, say, builds up layers of lazy-sqs
13:17kotarakhiredman: yeah that's true
13:18kotarak... which can eventually create a stackoverflow.
13:18kotarakIf the chain is to long.
13:18hiredmanbosie: depends how you are "iterating" through a map
13:18bosiehiredman: excuse me?
13:18bosiehiredman: isn't map fixed?
13:18bosiehiredman: oh no i am talking about the function map
13:18hiredmanbosie: what do you mean "fixed"?
13:20bosiehiredman: thanks, will have to read up on it, somewhere ;)
13:21hiredmanif you realize the lazy seq produced by map in such a way as to keep a reference to the head, as much of the map as you realize will be in memory and live
13:22kotarak(let [s (map foo coll)] (doall s)) <- no good
13:22kotaraksubstitute doall with something useful
13:23hiredmanif you use doseq or reduce and don't have a reference to the head, only one node in the seq at a time will be live
13:23kotarak(reduce bar (map foo coll)) <- good
13:26esjbollocks - chasing the source for seq takes one directly to java, do not pass begin, do not collect 200.
13:27hiredman,(->> clojure.lang.ISeq .getMethods (map #(.getName %)))
13:27clojurebot("more" "next" "cons" "first" "equiv" "count" "cons" "empty" "seq")
13:29esjso its a linked list, is it just of pointers elements in the conceret coll, which are lazily filled in (if its over a concerete coll ?), or the values themselves ?
13:30esji'm guessing values so that when its generated by lazy-seq they are just filled in
13:30hiredmanwhat?
13:30clojurebotWhat is meta
13:30esjthanks cb.
13:30esjthe seq is a linked list.
13:30esjwhat are the elements on the linked list ?
13:31hiredmanlike a linked list
13:31esjright, like a linked list.
13:31hiredmaninstead of the next pointer pointing to the rest of the linked list, it is a function which generates the rest of the list
13:31esjok, i get that
13:43bosiehiredman: i have another question. so i have (map .... lazy-seq)
13:43bosiehiredman: if i realize map, i realize both lazy seqs at the same time?
13:45hiredmanhow could you not?
13:45bosiehiredman: what?
13:45hiredmanif A depends on B and B doesn't exist yet, in order to get A you have to generate B
13:46bosieexactly
13:46hiredmanthen why ask?
13:47bosiedont understand the advantage of lazy seqs
13:48hiredmanyou can do operations over large datasets without having it all in memory
13:48bosieright
13:48kotarakbosie: with (filter bar? (map foo coll)) you traverse coll once, otherwise you have traverse it twice.
13:49bosiehiredman: so if i have a seq and want to split it up into N seperate parts so i can concurrently run operations on the seperate parts, how would one do that?
13:49bosiehiredman: i can't even read the length of the seq
13:50bosiekotarak: true
13:51hiredmanbosie: depends on this that and the other
13:52bosiehiredman: funny
13:52hiredmanit's not meant to be
13:53kotarakbosie: there is a talk of someone where he shows that linked lists (in particular seqs) are not well suited for such operations. tree (eg. Clojure vectors) are a better fit.
13:53hiredmanit does depend on what you want realized where
13:53kotarakbosie: but don't ask me who "he" is or what the talk was called.
13:53hiredmanguy steele
13:54kotarakhiredman: ah, yes! exactly
13:54hiredmanI would remember the name, I think he shows a lot of potential and is going places...
13:55bosiehiredman: he went to harvard and mit ....
13:55kotarakhttp://groups.csail.mit.edu/mac/users/gjs/6.945/readings/MITApril2009Steele.pdf
13:56chouserhiredman: ha!
13:56hiredmanbosie: because of the lazy nature of seqs, the partitioning and map can be done on a single thread, and then the results realized on other threads
13:56hiredmanchouser: :D
13:56hiredmanbosie: I think maybe where he went to school is the least interesting thing
13:57bosiehiredman: if you get a PHD from MIT one can assume he 'shows potential'
13:57djpowelli googled guy steel without the e at work the other day, and the sites that i got back definitely weren't about lisp
13:57djpowellwith some other term too, i forget what
13:57kotarakbosie: well, you have to pay and they have to keep the customers happy...
13:57chouserI actually saw him at ILC2009, but couldn't think of a thing to say...
13:57bosiekotarak: appreciated
13:58hiredman"will you sign my parens!"
13:59kotarakman! I'm really jealous. Why can't some cool clojure conf be here in Frankfurt?
13:59bosiehere is a noob question. if i want to store the result of a function (which returns a sequence) for later, i store it in a Var, and realize it first?
14:00hiredmanI have no idea what I'd say to guy steele either
14:00hiredmanbosie: what do you mean "for later"?
14:01chouserbosie: a var or local, but you don't necessarily need to realize it first.
14:01bosiehiredman: if i have to use it later on
14:01bosiehiredman: later during the execution of the program
14:02hiredmanbosie: why do you have it before you need it?
14:02bsteuberbosie: Did you already watch the videos on clojure.blip.tv? I really learned a lot from them concerning data structures etc.
14:03Rayneskotarak: Does vimclojure look in the lib/ directory for the vimclojure jar?
14:03RaynesIt doesn't seem to be finding it.
14:04kotarakRaynes: vimclojure doesn't look anywhere. If you use lein, set up a lein task which starts the nailgun server. I think there was some plugin for that.
14:04bosiebsteuber: unfortunately i did
14:04bosiehiredman: i have it when i need it. but i need it more than once
14:05Rayneskotarak: Well, I actually did that already. I had the server running, but it's still saying it can't execute nail because it can't find the class that starts the server.
14:05RaynesI assumed it was trying to start the server itself.
14:05kotarakRaynes: then you are classpath is wrong. How did you include vimclojure.jar in your classpath?
14:06Raynes-cp lib/*
14:06kotarakIs the class he claims not to find in the jar?
14:06hiredmanbosie: if you keep a reference to a lazy seq, any parts you realize are not going to be gc'ed until the reference goes away
14:06RaynesIndeed.
14:07bosiehiredman: ok
14:08Raynes"Reason: Vim(echoer
14:08Raynesr):Couldn't execute Nail! Exception in thread "main" java.lang.NoClassDefFoundEr
14:08Raynesror: com/martiansoftware/nailgun/NGServer"
14:08RaynesOops, didn't realize that was three lines.
14:09kotarakRaynes: did you quote the *? java -cp 'lib/*' ....?
14:09RaynesLet me check.
14:10StartsWithKkotarak, have you considered constructing a full installer for vimclojure?
14:11StartsWithKif not, do you mind if i take a stab at such a thing?
14:11RaynesYep.
14:11bosiefor what are you guys using clojure?
14:12Rayneskotarak: I think I just have bad luck with Vim.
14:12RaynesIt's obviously not VimClojure's fault.
14:13kotarakStartsWithK: if have. It's a huge amount of work and headache for questionable use. I'm working on a multistep install: a zip with the vim stuff, which can simply extracted to .vim as usual, and a jar on clojars for the server part. Only the ng client makes me some headaches. If you want, to invest time on a installer, I'm happy to accept your efforts! I will not work on an installer however.
14:13bosieor to be more precise: anyone implemented a genetic algorithm in clojure? :)
14:14StartsWithKkotarak, i was thinking izpack based, not from scratch, ng looks like the bigest problem on unix, but izpack can exec stuff in its pre/post install hooks
14:14kotarakRaynes: I dunno. I have a working setup since about one and a half year. No problem with the classpath ever. Maybe I'm just lucky.
14:14StartsWithKonly thing i would leave out is messing with a vimrc
14:14StartsWithKthats just asking for it
14:15kotarakStartsWithK: never mess with config files. Especially not vims. ;)
14:15StartsWithKso ng would still need a manual configuration to work
14:15kotarakStartsWithK: well, just put in the PATH.
14:15kotarakThen the standard should work.
14:20StartsWithKkotarak, what is the main problem with ng client? the fact that is native?
14:20kotarakStartsWithK: Bingo
14:20StartsWithKhmm
14:20StartsWithKand..
14:20StartsWithKwhat if you could replace it with a shell script
14:20StartsWithKsomethinkg netcat/socat based
14:21hiredmanit would be complex
14:21kotarakStartsWithK: I thought about nc. How does this work on Windows?
14:21StartsWithKon unix, win has its .exe i see
14:21clojurebotThe bird, bird, bird, the bird is the word.
14:21StartsWithKizpack can have selective downloads for different platforms
14:23StartsWithKhttp://izpack.org/
14:29djpowellrhickey: i was wondering about binary compatability between aot compiled libs and later versions of clojure - eg 1.1 compiled libs on 1.2. is that mixing libs and clojure versions something to always avoid?
14:29kotarakStartsWithK: izpack looks interesting. I think the client is the only problem.
14:30StartsWithKkotarak, i would then try to recreate client with netcat or socat and make a simple installer by the end of the week
14:30kotarakStartsWithK: wow, looking forward to it :)
14:49rickmodeI'm beating my head against Aquamacs / clojure-mode / slime. I want my IDE to use my language. I dont' want my IDE to own and manage my language. So is there a no-voodoo way to get a REPL working in Aquamacs?
14:50ordnungswidrigrickmode: I start swank using "lein swank" and connect from within emacs using "M-x slime-connect" without problems.
14:50somniumrickmode: define voodoo
14:50ordnungswidrigrickmode: using clojure-mode from elpa
14:51hiredmanit's kind of depressing to see steele pushing for stack allocated objects for java in 1998
14:53rickmodeSwank-clojure wants to download it's own copies of clojure and clojure-contrib. That's too much voodoo. It also wont' work should I have two projects using different versions of clojure (ties the dev environment to the particular versions too tightly).
14:54fanaticorickmode: have you looked at leiningen? lein-swank will start a server using the clojure version specified in the project.clj file.
14:54somniumrickmode: clojure-mode comes with a swank-clojure-project function that uses only the libs in your project
14:54rickmodeMaybe that's not a real concern. Anyway - I'd just like something straightforward to get started. Is the *right* solution to use the Aquamacs 2 preview (based on Emacs 23)?
14:54somnium+ lein-swank ^^
14:55fanaticoany reason to use aquamacs? the vanilla release is better tested.
14:57rickmodefanatica: Aquamacs is a good Emacs for mortals. I've spent the past 19 years coding on IDEs (TurboPascal to Visual C++ to Visual Studio to IntelliJ IDEA to Eclipse to Xcode). Emacs is wildly different. Aquamacs is an excellent bridge. I can use my muscle memory to get around while learning Emacs.
14:58rickmodefanatics: so it's an anti-frustration thing
14:58fanaticofair enough. pretty sure swank requires 23, so you'll need to use the preview.
14:59hiredmanrickmode: I don't know much about aquamacs, but I do know #emacs things it is too different from actually emacs to be on topic for #emacs
14:59hiredmanwell, I don't know much emacs in generally
15:00hiredmanso if you are trying to do emacs things in aquamacs it may be frustrating
15:00hiredmanI don't use OSX but for OSX I see carbonemacs recommended
15:02rickmodehiredman: I'm not married to Emacs. Just looking for a solid dev environment.
15:03hiredmanemacs is decent, the main thing is paredit
15:05hiredmanit's just aquamacs is kind of off the beaten path, so if you are looking for something to keep down the frustration, I don't know that that is it
15:05hiredmanof course I am sure there are people around somewhere that are happily using aquamacs
15:06fanaticorhickey :P
15:06fanaticobut he doesn't use slime.
15:07hiredmanwhen you are writing java, slime doesn't really work
15:08fanaticothe curse of the language designer is the amount of time spent working outside their language.
15:09grzmrickmode: I feel your frustration. I don't spend enough time in slime/clojure to have figured out the nitty-gritty, but I have finally gotten swank-clojure-project to work in Aquamacs (2.0preview4b)
15:09grzmI went the ELPA route
15:09rickmodegrzm: I was wondering if that was the route.
15:09grzms/figured out/fully understand/
15:10rickmodethe clojure.org page points to an older clojure-mode. It should perhaps be updated or at least note that this information is old.
15:10grzmrickmode: I think so. I followed technomancy's guide, iirc
15:14rickmodeI'm not griping here. I just spent a few weeks in CL library hell (Aquamacs + SLIME + SBCL was easy - anything else was busted, underdocumented, and/or undersupported). I want to build web apps with Lisp. I initially didn't want to look at Clojure because i'm super anti-java (used it since 2000). So after watching the first video on clojure.blip.tv I was sold. Lisp + more core types + good concurrency. I'm in.
15:16opqdonutrickmode: i've done a web app in cl
15:16opqdonutused hunchentoot and cl-who mostly
15:16raekrickmode: seen this? http://www.bestinclass.dk/index.php/2009/12/dynamic-interactive-webdevelopment/
15:16opqdonutit was even cross-platform, worked on both sbcl and cmucl
15:17rickmodeopqdonut: those bits are sollid... getting into a persistence and anything higher level (UCW / Weblocks) was a mess.
15:17opqdonuti feel you
15:17opqdonutwe did everything ourselves for a reason :)
15:18opqdonutor actually two reasons, one of which was stubbornnes
15:19rickmodeopqdonut: Clojure also feels less crufty. There's a bit of design-by-committee plus i actually felt like I had stepped back to 1990 with some of the path weirdness and other minor inconsistencies.
15:19rickmodemember:opqdonut: Edit: Clojure also feels less crufty. In *CL* there's a bit of design-by-committee plus i actually felt like I had stepped back to 1990 with some of the path weirdness and other minor inconsistencies.
15:20opqdonutyeah
15:20opqdonutclojure is nice
15:20rickmoderaek: checking out the video. thanks
15:20opqdonutunfortunately we use it for stuff that is nearly realtime, so we ended up making our own compiler
15:20opqdonut(not for clojure, for a small dsl)
15:22raekif you want to do web apps in clojure, I really recommend looking at compojure
15:22rickmodeopqdonut: seems like for something truly hard-core using C (or simplified C++) plus an embedded Scheme might be best. Never dont' a project that way though. I'm just thinking it would avoid Greenspun's 10th rule.
15:22raekthat video is a great intro
15:23opqdonutit's pretty nice this way actually, we have a high-level description of the system with a domain specific language
15:23opqdonutfacilitated by macros, of course
15:23opqdonutwhich then gets turned into something that runs fast
15:24opqdonutthe point here is that the dsl and produces only a couple of primitives, so the compiler can be kept pretty small
15:24hiredmansort of the inverse of greenspun
15:24opqdonutyeah :)
15:24rickmodeopqdonut: so you used Clojure to create a DSL?
15:25opqdonutbasically
15:25hiredmanmmmm
15:26hiredman(Forget spreadsheets: trying to do cash flow projections based on the royalty schedule in this contract really demands an expert system. These contracts would be easier to understand if they were written in Lisp or ML ...)
15:26hiredmanhah
15:26hiredmanhttp://www.antipope.org/charlie/blog-static/2010/02/cmap-3-how-books-are-sold.html
15:27rickmodeOK so got lein install.. not sure of next step - I'm googling away but not seeing how to get the other bits going.
15:27djpowellhmm in leiningen, something, somewhere is pulling an ant-1.6.2 into my project and breaking 'leiningen test'
15:54drockocan someone point me in the right direction on clojure, google app engine, and setting up the appropriate classpaths, etc? I am having issues getting my environment set up?
15:55drockoi guess the second half of that is not a question
15:56hiredmanthere is a skeleton lein appengine project on github
15:58hiredmanI have a ant build.xml for generating an appengine project, but I haven't touched it in many months, so it is sort of bit rotted
15:58hiredmanhttp://github.com/otfrom/blank-appengine-clj
15:59hiredmanhttp://github.com/hiredman/appengine-helper I definitely recomend the lein one
15:59hiredmanoi
16:00hiredmaneven the readme has errors on mine
16:03technomancyman... people suck at reading docs.
16:04technomancyreading about 2 pages into the swank-clojure readme would have answered rickmode's concerns about swank downloading its own copy of clojure.
16:05hiredman:|
16:05technomancynot saying swank doesn't have its issues, but the stuff he was running into is well-explained.
16:05kotaraktechnomancy: where does this myth come from, that someone reads docs? You have to deliver everything on a silver tablet nowadays :|
16:06drockohiredman: ah i did see your lein appengine project
16:06technomancykotarak: yup... time to /join #silver-platter and hang out there I guess.
16:06technomancyclojurebot: swank?
16:06clojurebotPardon?
16:06kotarakcomparing scars and exchanging war stories?
16:07technomancyclojurebot: swank is try the readme. seriously.
16:07clojurebotAlles klar
16:07kotarakclojurebot: vimclojure
16:07clojurebotvimclojure is state-of-the-art
16:07technomancykotarak: trying to outsource my job. =)
16:07danleibtw, is there something new about slime cvs compatibility?
16:08technomancydanlei: someone's submitted a patch that should bring it up to date, but it's fairly invasive... haven't gotten a chance to integrate it yet.
16:09danleitechnomancy: no problem, just wanted to know if there is some progress
16:09danleii just froze the last working config
16:09danleis/last/latest
16:10technomancydanlei: I'm reluctant to open that can of worms just because I _know_ the current versions work.
16:10technomancyI barely have enough time to keep up with that; don't feel like pulling in more variables.
16:11patrkriskotarak: hey - do you plan on pushing official vimclojure builds to clojars.org at some point?
16:11technomancybut this contributor was pretty gung-ho about helping out
16:11kotarakpatrkris: yup
16:11danleitechnomancy: I fear the day I finally update. Using your repo, is it possible to keep things in "one's own hands"? (no automatic downloading and stuff)
16:11patrkriskotarak: coolio
16:11technomancydanlei: sure
16:11danleitechnomancy: very good
16:12technomancydanlei: it only downloads jars if you haven't configured it to use your own stuff
16:12kotarakpatrkris: I'll try to setup also a SNAPSHOTS repo, since everyone wants to cut their fingers...
16:12danleitechnomancy: perfect.
16:12patrkriskotarak: yeah, that's great :)
16:43raekis the Math/.... functions defined for all clojures number types?
16:45hiredmanMath is java
16:45hiredmanit's all doubles
16:45hiredmanhttp://java.sun.com/j2se/1.5.0/docs/api/java/lang/Math.html
16:46hiredmanthey are not functions, they are static methods
16:48raek,(Math/floor 10000000000000000000000000000/3)
16:48clojurebot3.333333333333333E27
16:48grzmerg. trying to escape double-quotes and backslashes in a string:
16:48grzm(require '(clojure.contrib [string :as string]))
16:49raekis this a resonable approach for getting the fraction part without losing precision?: (defn frac [x] (- x (int x)))
16:49grzm(println (string/replace-by #"[\"\\]" #(str "\\\\" %) "the \""))
16:49grzmthe \"
16:49grzm(println (string/replace-by #"[\"\\]" #(str "\\\\" %) "the \" and \\"))
16:49grzmString index out of range: 3
16:50raekhmm, before I do too much... is there a round-half-to-even in java that can be directly used with any clojure number?
16:51drockohiredman: do you think you could give me like a quick overview of how to get started with lein-gae? or maybe a link to some docs on it? I'm a bit new to all of this stuff i suppose
16:52drockoi have it installed, but i suppose i need to create a new project.clj someplace to get going with it?
16:52hiredmandrocko: oh, my lein-gae? it's a project half started, I would not recommend it, I think there maybe a fork or two better a long
16:52drockoah yeah?
16:52drockorats
16:52hiredmanyeah
16:52drockook
16:52hiredman:/
16:52drockocould you maybe help me with my gae strategy then?
16:52drockohah
16:52grzmraek: looks like there might be: googling "java rounding to even" shows some stuff
16:53drockolike i have some code written and i want to test it, but i can't seem to get the dev server started with all the right services so i can test things like logging in and out
16:53hiredmanI haven't done that much with the dev server
16:54drockoi think that the code from the hackerswithattitude post about interactive GAE development has the code that resolves my issues there, but i can't get that to work because of all the classes that it requires
16:54jcromartiesomnium: Does congomongo support sorting and paging?
16:54drockoand i cant seem to use swank-project because i'm using a different directory structure
16:54drockohiredman: so how do you develop with it? perhaps i'm just approaching this wrong
16:54hiredmandrocko: figuring out the jars the sdk stuff needs is a pain
16:54drockohiredman: yes i agree
16:54drockohah
16:55raekgrzm: yes, but they seem to be only for BigDecimal and such
16:55drockohiredman: so how do you do it? are you using lein or ant? how do you structure your code?
16:55hiredmanI did it with my appengine-helper
16:55hiredmanwhich uses ant
16:55grzmraek: casting won't work?
16:56hiredmanbut I didn't ever setup a repl for it
16:56hiredmanthe build.xml for appengine-helper has a runserver target
16:57drockohiredman: ahh i see. are you using the users service here?
16:57raekgrzm: I guess I can always do that, but was thinking about something more general
16:58hiredmanno
16:58hiredmanI am kind of surprised that it would need to be switched on though
16:58drockohmm ok
16:58drockoyeah i may be misunderstanding it
16:59hiredmanI think it must be split into two parts
16:59drockobut it's like if you want it to work in your test environment you have to start up like a proxy that catches that information
16:59hiredmanthe client side and the server side
16:59hiredmanthe client side must be some jar you need in with the other libs
16:59hiredmancompojure.jar clojure.jar etc
17:00drockoyeah
17:00keith-ok so i'm missing clojure-contrib.jar and i cannot seem to find where it should come from.
17:00hiredmanshould it come from anywhere?
17:01keith-is there a reason that it does not exist? a few things seem to want to use it
17:01Licenserevening
17:02hiredmanah, well, if you have something that wants it, that drives where you would get it
17:02hiredmanbut expecting it to exist in a vacuum is nonsense
17:02hiredmanso what requires contrib and what version does it require?
17:02keith-for some reason i like you.
17:03keith-well both vimclojure and swank-clojure want it. i'm not partial to either editor but i would like syntax highlighting in one
17:03hiredmanhttp://www.thelastcitadel.com/images/social-skills.png
17:03hiredmanhow did you install swank-clojure?
17:04keith-git
17:04hiredmandid you follow the instructions from the swank-clojure readme?
17:04hiredmanhmm
17:04hiredmanif you install from epla you should get contrib with it
17:05kotarakkeith-: you can have syntax highlighting in vimclojure without contrib
17:05hiredmanyou shouldn't need contrib for syntax highlighting in either vimclojure or emacs
17:05hiredmanin emacs for syntax highlighting you just need clojure-mode
17:05keith-that is the only thing i can't find and i can't seem to get them to work properly. thanks for the tip and i will investigate further
17:05hiredmanfor vim you can disable the dynamic stuff from vimclojure
17:05keith-and yes but i want slime to work fully
17:05kotarakkotarak: in vimclojure set "let clj_want_gorilla = 0" in your .vimrc
17:06hiredmanthe swank-clojure readme has good update instructions that should be followed, and all others ignored
17:06grzmraek: looks like clojure.contrib.math includes a round mulitmethod: perhaps you could extend that in your app to take a rounding method argument?
17:06keith-alright. i will try to figure out what's happening. thanks for the tips
17:12jcromartiesomnium: did you find that the ClojureDBObject really helped performance?
17:57radsis clj-record the only ORM for clojure? it doesn't look like it's maintained anymore
18:00somniumjcromartie: yes, but it could be refactored into a set of static methods that operate on any collection. purcell tried to rewrite it in clojure, but said he could only get 6x slower. he thought it was related to the jit, I have no idea.
18:01jcromartiehmm
18:01jcromartieI would think multimethods would be perfect for that
18:01jcromartieto-mongo
18:01jcromartieto-clojure
18:01jcromartiebut if it's really slow, then it's really slow
18:01somniumjcromartie: yeah, but multimethods are slow. double dispatch and all
18:01jcromartieyeah
18:01somniumjcromartie: protocols fit like a glove
18:01jcromartieah, yes
18:02jcromartiewe'll see I guess
18:02jcromartiehow about sorting?
18:02somniumjcromartie: Im just waiting for a stable 1.2, already have a prototype
18:02jcromartieI have been playing with the mongo driver
18:02somniumjcromartie: its in the java driver, .sort on the cursor
18:02jcromartieit sems like a great API
18:02somniumjcromartie: the mongo driver?
18:02jcromartieyeah
18:03jcromartieit is pretty straightforward
18:04somniumyeah, just wish it didnt force DBObjects to be mutable hash-maps
18:05the-kennyGithub now supports org-mode files as readmes :) </offtopic>
18:05somniumooh
18:08jcromartieeven if multimethods are slow, they make it easy to extend the lib
18:08jcromartieI just wonder: did anybody really hit performance problems?
18:09jcromartieI mean, the fact that a Ruby driver exists pretty much guarantees that a pure-clojure wrapper around the Java driver wouldn't be the slowest thing ever.
18:09somniumjcromartie: the ruby-driver is more-or-less unusable without the C-extension
18:09jcromartieheh
18:10hiredmanstuartsierra posted a macro for doing double dispatch with protocols
18:18somniumjcromartie: the protocol version I had was roughly as fast as the current one. afaict the only reason its slower than java at all is because theres no direct way to override object creation in bytes, so everything gets traversed twice :/
18:18jcromartieyeah
18:18jcromartiehmm
18:18jcromartiewait, so what's the slow part?
18:19jcromartiecoercing the cursor results from mongo objects -> clojure maps?
18:19somniumjcromartie: double walking, turning strings into keywords and array-lists into persistent vectors
18:19jcromartiewas it a bottleneck?
18:20somniumyeah, the first pass I used keywordize-keys from clojure.walk
18:21somniumthat was 20x + slower for very simple objects
18:23jcromartieinteresting
18:24jcromartieI'm only looking to pull out a few objects at time
18:24jcromartieI wonder if it would be a problem for me
18:24jcromartiei.e. it would always be paged results
18:24clojurebotamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
18:25somniumjcromartie: right now its plenty fast enough for the intranet kind of things I use it for
18:32jcromartiesomnium: it might not be wise, but what about a memoized multimethod
18:32jcromartiefor converting back and forth
18:33somniumjcromartie: you mean hashing every DBObject? O_o
18:36jcromartienot quite
18:36jcromartienot sure what the idea was, really :P
18:58radshmm, trying to use congomongo, but when I do a fetch I get com.mongodb.MongoException$Network: can't call something (NO_SOURCE_FILE:0)
19:11somniumrads: that usually means you havent done $ mongod
19:27tcrayfordis there anybody about who knows their way around clojure/core.clj
19:27tcrayford?
20:06meeWhat's a good way of returning the items in a collection in random order?
20:07danleiclojure.contrib.seq/rand-elt
20:08danleioh, sorry, that's a random element
20:08meeI guess I can call java.util.List.shuffle
20:09danleithere is permutations in clojure.contrib.combinatorics
20:11meehmm, that returns /all/ permutations, which is a bit overkill
20:12danlei(rand-elt (permutations s))
20:12meethanks
20:12jcromartiewow nailgun is seriously awesome
20:15{newbie}jcromartie: is it possible to use nailgun with javac?
20:15jcromartieI don't think so
20:16jcromartieI think you need to reload nailgun when your classes/jars are updated, if that's what you're asking.
20:16{newbie}No I was asking
20:16{newbie}to keep javac loaded
20:17jcromartienot unless javac is powered by a class that has a main()
20:17jcromartiebut I don't think that's the case
20:17jcromartie(not positive)
20:17{newbie}:\
20:17{newbie}I saw another project
20:17{newbie}jolt
20:17{newbie}it works with javac
20:17{newbie}it's very nice for people who use make
20:24danleimee: here is a more explicit solution: http://paste.lisp.org/display/95763
20:28meeah, nice
20:29meethanks again
20:29danleimee: np, as an exercise: (shuffle [1 1])
20:29meeI forgot about loop/recur
20:30meeI kept avoiding 'building' the shuffle deck, thinking that I was restricted by the immutability of objects.. oops
20:34meeI also just discovered clojure.contrib.seq/shuffle
20:34danleioh, overlooked that, too
20:36meebut I was more interested in the how-to-fish part anyway
20:37danlei:)
20:38jcromartieI'm not really sure how to make clojure work with nailgun... aside from getting clojure.main to work, I don't see how I can have a reasonable classpath
20:39jcromartiei.e. one like lib/*:src:test:.
20:50jcromartieI guess it's not really useful for assorted projects, and is more of a sysadmin thing, where you have a fairly fixed set of classes that you might want to have ready.
22:40atrerushas clojure.contrib.str-utils moved to a different namespace in the current version?
22:41atreruscurrent being 1.1...
22:46zaphar_psatrerus: a lot of stuff looks like it moved in 1.1
22:46zaphar_psit definitely doesn't seem to be a backwards compatible release
22:46zaphar_psbut to be fair a few things in there were marked as being unstable
22:47atrerusk... trying to get Stuart Holloway's book examples to run... I might have to go back to 1.0
22:54danleiatrerus: str-utils moved to clojure.contrib.string recently
22:54atrerusyeah, saw the git notes for that
22:54atreruscool, glad I'm understanding :)
22:55atrerusI switched lein back to using clojure 1.0 and the book examples are going more smoothly now
23:00brandonwhas anyone had trouble with using org.clojars.ato/nailgun "0.7.1" instead of lein-nailgun "0.1.0"?
23:01brandonwif i use lein-nailgun it works fine. on `lein deps` ato's nailgun has two warnings about the the POM not being a good 4.0.0 POM. after that, nailgun doesn't show up as a task in `lein help`
23:09brandonwalso, i'm using lein for my first project that will actually need build management; i have a top level dir, and inside that classes,lib,src,test dirs. src and test both have a subdir of foo
23:10brandonwand src/foo/core.clj has (ns foo.core)
23:10brandonwyet if i run lein compile, it says `All :namespaces already compiled.` - but nothing is in the classes directory
23:11brandonwand the repl generated by lein nailgun fails when i load src/foo/core.clj
23:11brandonwit seems like i have some namespace issue somewhere, but i haven't a clue where. everything to do with namespaces was autogenerated from `lein new foo`
23:18iceydoes anyone know of anybody working on an event-based clojure framework similar to node.js or possibly twisted?
23:23chouserJava anonymous classes have no access to their outer lexical scope, right? What about Groovy classes?
23:23dnolenicey: no, but that would be cool.
23:24hiredmanchouser: what?
23:24iceydnolen: yeah, i was just browsing some node.js stuff and all i could think of is that that style of development would be *amazing* in clojure
23:26chouserI mean in Java I can define an anonymous inner class entirely inside a method that has its own local variables and parameters, but the code inside my anon class can't access any of those, right?
23:27dnolenchouser: I think you can if the variables it's trying to access are declared "static final"
23:27hiredmanchouser: it can, they just need to be final
23:27chouseroh! hm.
23:28chouserok, thanks.
23:32dnolenicey: it could potentially cooler (perhaps via macros). I like the idea of Node.js but I'm not sold on the idea of writing a bunch of code with callbacks. I like Clojure's implementation of promise/deliver better.
23:34iceydnolen: i'm a huge fan of event driven program flows for the web; for whatever bizarre reason it fits my brain better - I feel like it's easier to take a vision of what the page should do and work backwards to the solution.
23:47woobyis there anything like CL's parenscript for clojure?