#clojure logs

2009-04-24

00:06eeereading a paper now that says to do exactly what you guys are saying to do. separate the item from it's priority. actually a function that returns the priority verses the value
00:38durka42,(seq? 'a-symbol)
00:38clojurebotfalse
00:38durka42,(seq? '[1 2])
00:38clojurebotfalse
00:38durka42,(seq? '#(prn %))
00:38clojurebottrue
00:38durka42^ ??
00:39durka42i suppose this explains it
00:39durka42,(macroexpand '#(prn %))
00:39clojurebot(fn* [p1__2351] (prn p1__2351))
00:40durka42am i being dense, or does this make -> unusable with anonymous fns?
00:40Cark,'#(prn %)
00:40clojurebot(fn* [p1__2355] (prn p1__2355))
00:40Cark(-> 1 (#(prn %)))
00:40Cark,(-> 1 (#(prn %)))
00:40clojurebot1
00:41durka42er
00:41clojurebotatacontrol cap ad0 | grep serial | awk '{print $3}'
00:41durka42right i was being dense
00:41Carknot too pretty but it works
00:48hiredmanclojurebot: thanks, I was wondering how to get the serial number of my drive
00:48clojurebotatacontrol cap ad0 | grep serial | awk '{print $3}'
00:49Carki think clojurebot eventually lost it
00:53hiredmanI have had two friends that have started following clojurebot on twitter, because I guess they have mistaken incesent rambling about svn commits for me
00:53clojurebotsvn is http://clojure.googlecode.com/svn/trunk/
00:53hiredmanstow it
01:02durka42anyone know anything about the dict protocol?
02:31Cark,(prn {1 2 3})
02:31clojurebot3
03:01hiredman,{1 2 3}
03:01clojurebotjava.lang.ArrayIndexOutOfBoundsException: 3
03:03replacaa lot more autodoc than contrib tonight!
03:04Carkthat's a bug isn't it ?
03:07hiredmanit's undefined behavior
03:07replacaCark: no, that's me debugging
03:07Carkheh sorry i was asking about the (prn {1 2 3})
03:07replacaor do you mean {1 2 3}?
03:07felzixit should probably raise a more meaningful exception
03:08replacathere are a lot of places in clojure we could get better error reporting
03:08Carkhiredman : i'll never get to accept this
03:08felzixheh, true
03:09hiredmanCark: ?
03:09Carkhow are you supposed to print data structures ?
03:09Carkthe default clojure core ones
03:09hiredmanCark: well, for starts you use the same number of keys and values in the map
03:09Carkah right =/
03:09hiredman,(prn {1 2 3 4})
03:09replacayeah, print's not the problem, the map is
03:09clojurebot{1 2, 3 4}
03:09Carki was thinking sets
03:10Carkmy bad
03:10hiredman,(prn #{1 2 3})
03:10clojurebot#{1 2 3}
03:10replacabut I don't really understand what's happening there
03:10Carkright sorry
03:10replacawhat is the (prn {1 2 3}) doing that makes it think 3 is a good answer?
03:11hiredmanreplaca: you don't specify the correct number of values per the number of keys, behavior is undefined
03:11hiredmanso you get random weird things
03:12hiredman,(str {1 2 3})
03:12Carkthough i was on the wrong track, there is still a problem
03:12clojurebot3
03:12hiredmanit's undefined
03:12hiredmanCark: where?
03:12replacamakes me wonder about the internals though...
03:13Carkwell between you and me , both humans (i hope) it's an arror to specify a map with 3 forms ibetween the {}
03:13replacain any case, I'm off to bed
03:13replacagoodnight folks
03:13Carkso ignight replaca
03:13Carkso i think it should be an error
03:13Carktime to go to bed too look at my writing ...�
03:13hiredman,(macroexpand '{1 2 3})
03:13clojurebot3
03:14hiredmanthat is an odd failure mode though
03:14hiredman,(macroexpand '{1 2 1})
03:14clojurebot3
03:14Chousuke(macroexpand '{1 2 3 4})
03:14Chousuke,(macroexpand '{1 2 3 4})
03:14clojurebot{1 2, 3 4}
03:14hiredman,(macroexpand '{1 2 1 2 1})
03:14clojurebot5
03:14hiredman*giggles*
03:14Carkhehe =)
03:44AWizzArdMoin moin
04:19unlinkOK, so I understand what lazy-seq *does*. How does it *work*?
04:23liwpyou mean how it defers evaluating rest?
04:25unlinkWhat does it evaluate to? A opaque object which when iterated produces the next element and the functor to produce the rest of the list?
04:25liwpyeah, conceptually you get a pair (first, deferred rest)
04:25liwpfirst is available immediately
04:26liwpand rest must be forced, which is done automatically for you
04:26liwpusually deferred rest is implemented as a function that is evaluated when it is forced
04:26liwpin addition to that the evaluated rest results get memoized so that they will be evaluated only once
04:26unlinkk
04:27unlinkOh, you mean a pointer to the head of the list is kept?
04:27liwponly if you hold on to it
04:27unlinkok
04:27unlinkWhat is memoized?
04:27liwpso if you say (def *l* (foo)) to generate a lazy-seq, it will never be garbage collected
04:28liwpbut if you consume the list as it is generate, i.e. you do not hold on to the head, then it gets collected as you process it
04:29liwpmemoization means that you cache the result for a given argument so that the next time the function gets called with that same argument you can return the cached value without having to evaluate the function again
04:30unlinkI meant "what gets memoized?"
04:30liwpahh, the rest of a pair in the seq
04:30liwpbut only if it does not get GC'd
04:30liwpdoes that make sense?-)
04:31unlinkoh right ok
04:31unlinkyeah, got it
04:31unlinkAnother question, what's the difference between for and map?
04:31unlink(besides the syntax)
04:32liwpfor is used for side effects, whereas map is used for the resulting seq
04:32jdz_not really
04:32liwpotherwise they do the same thing
04:32jdz_doseq is used for side effects
04:32jdz_for i s a kind of list comprehension
04:33jdz_s/i s/is
04:33liwpahh, sorry, that's right
04:33unlinkmap accomplishes the same thing, right?
04:34liwpsort of
04:35liwpfor is a more elegant way to say some things, they are more declarative
04:35unlinkIt seems that for is plain a nicer syntax
04:36unlinkI guess if you're passed a function object, map is more natural.
04:36liwpmap also works well when you want to apply a function a pre-existing seq
04:37liwpso you can say (map f seq)
04:37liwprather than (for [x seq] [(f x)])
04:38AWizzArdmap should be the tool of choice for.. mapping
04:38AWizzArdIt documents the code.
04:39AWizzArdbtw, do Refs, Atoms, Agents and Futures have a common superclass which has no other derived classes (but those 4)?
04:39unlinkIs there a nice syntax for take . drop?
04:42unlinkLike slicing in python.
04:44liwpAWizzArd: dunno
04:44liwpunlink: I don't think so
04:53unlinkWhat's a good body of clojure to read? I'm still trying to figure out what's idiomatic--clojure is often very different from SML and Scheme.
06:06AWizzArdunlink: read the .clj files that you can find here: http://code.google.com/p/clojure/source/browse/#svn/trunk/src/clj/clojure
08:00Lau_of_DKDoes anybody here know how JLine or JCurses react when run through slime in Emacs ?
08:21gnuvinceHi
08:21cgrandhi!
08:21gnuvinceWhat's up Christophe?
08:23cgrandhaven't had time to look more closely at your perf problems you hade some time agao. Did you find a solution?
08:25AWizzArdWhen I have something like (def x (ref {:a 1, :b 2, :c {:x 10, :y 20, :z {5 6, 7 8}}})), is there then an easy way to (state) change the innermost hashmap? For example setting the value 8 of key 7 to 1000.
08:28cgrand(commute x assoc-in [:c :z 7] 1000)
08:29AWizzArdoh nice :)
08:33gnuvincecgrand: Cark helped me; I "compiled" the record definitions to lambdas to avoid some reprocessing. That brought down the execution time for 1050 files from 120 seconds to 82 seconds on my machine at home (versus 12 seconds for the same files with Java).
08:34gnuvinceAnd since I don't seem too alert today (I poured my coffee cream in the trash can this morning. Twice in a row), I think I'll stay away from any important project and look if I can make some further improvements.
08:34cgrandnot good enough I guess
08:34gnuvincecgrand: not good enough, but a very encouraging step in the right direction.
08:55lisppaste8cgrand pasted "diagnostic options" at http://paste.lisp.org/display/79132
09:01Lau_of_DKhaha - gnuvince twice? :D
09:02gnuvinceLau_of_DK: yeah
09:03gnuvinceDoes java -server work on Windows?
09:05cgrandgnuvince: yes
09:06gnuvinceI guess I don't have the JDK then...
09:13gnuvinceHmmm
09:14gnuvincestill the same error: Error: no 'server' JVM
09:16gnuvinceAh
09:17gnuvincenevermind
09:17cgrandgnuvince: check your path you must have a jre and a jdk
09:17gnuvince%PATH% problem on Windows
09:17gnuvincecgrand: exactly
09:22Lau_of_DKAs I understand, if I want to launch a clojure-script with a shebang, I just add #!/usr/bin/java -cp .:/clojure.jar clojure.lang.Script $1 -- Can I make my Clojure program aware that its being run from commandline?
09:31Lau_of_DKhuh? clojure.lang.Script has been removed?
09:31clojurebotclojure is the bestest programming language available.
09:33hiredmanLau_of_DK: clojure.main
09:35Lau_of_DKCould not find the main class: clojure.main.Script. Program will exit.
09:38hiredmanLau_of_DK: if I meant clojure.main.Script I would have typed clojure.main.Script
09:39Lau_of_DKGood to know
10:00Lau_of_DKSomebody got a good example of a build.xml which I can loot for a simple project?
10:04dliebkeLau_of_DK: I based mine on the one clojure uses, then just simplified it: http://github.com/liebke/incanter/blob/e6d34d1d50ee7356735f217e38425b1410a72ce2/build.xml
10:06Lau_of_DKkthx
10:22Lau_of_DKhttp://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Distributing_application_as_self_contained_.jar
10:22Lau_of_DKIs this horribly outdated?
10:24cemerickLau_of_DK: if you're using ant, what's presented there is incredibly over-complicated.
10:25Lau_of_DKI was using ant - but had a little trouble pulling in clojure.jar + contrib as dependencies
10:25cemerickyou just need to add the fileset of the jar's contents as another source for your destination jar...
10:27lisppaste8cemerick pasted "Lau_of_DK: adding clojure and contrib to existing jar" at http://paste.lisp.org/display/79134
10:27Lau_of_DKThanks alot
10:28cemerickEvery now and then, I think about putting together an ant plugin for building clojure stuffs, but that keeps settling to the bottom of the todo list.
10:28Lau_of_DKI know the feeling
10:33Lau_of_DKuser=> (System/getProperty "java.class.path")
10:33Lau_of_DK"./classes:./:./src:./src/:.:/home/lau/coding/lisp/clojure/libs/jline-0.9.94.jar:/home/lau/coding/clojure-root/clojure//clojure.jar"
10:33Lau_of_DKuser=> (compile 'dk.bestinclass.stress-test)
10:33Lau_of_DKjava.io.FileNotFoundException: Could not locate dk/bestinclass/stress_test__init.class or dk/bestinclass/stress_test.clj on classpath: (NO_SOURCE_FILE:0)
10:33Lau_of_DKuser=> lau@lau-laptop:~/coding/lisp/projects/stress-test$ ls src/dk/bestinclass/stress-test.clj
10:34Lau_of_DKSorry that was a bit more than what it looked like in the terminal - but doesnt that seem a bit odd cemerick ?
10:35cemerickI'm afraid I can't say -- I've literally never used the compile fn. Compiling interactively never made sense to me, so I just went straight to ant.
10:35cemerickI suppose I could put together a blog post and just brain-dump the script we use for building clojure stuff.
10:37Lau_of_DKThat would be sweet
10:37Lau_of_DKBut I only went to compile, because you said that the above build.xml stuff required me to precompile?
10:38cemerickright, but using clojure.lang.Compile, not the compile fn -- I really have no idea what that fn does (although I know many people do use it very successfully)
10:39Lau_of_DK [java] Could not find clojure.lang.Compile. Make sure you have it in your classpath
10:39Lau_of_DKIt doesnt seem to accept my $CLASSPATH var - Where do I manually set it ?
10:40lisppaste8cemerick annotated #79134 "our clojure-compile ant macro" at http://paste.lisp.org/display/79134#1
10:41cemerickLau_of_DK: that should get you started. I'll try to do a writeup on it this weekend.
10:41Lau_of_DKThanks alot friend, that seems like the exact thing I need
10:41Lau_of_DKI gotta jet
11:00chrnyboHello, I'm new to clojure (and Java, it seems). (new Socket "127.0.0.1" 80) gives "java.lang.IllegalArgumentException: Unable to resolve classname: Socket". Should I start clojure with particular args to get access to Java libraries or something?
11:01cemerickchrnybo: you need to import the Socket class into your current namespace. If you're in a REPL, (import 'java.net.Socket) should do it.
11:02cemerickNote that the ns macro (which defines a new namespace) is the canonical way to import java classes and refer to other clojure namespaces -- the import function is really just a convenience for REPL usage.
11:07chrnybocemerick: So if i wanted a namespace chrnybo.webclient and I wanted the symbols of the Socket class available there, I would say something akin to (ns chrnybo.webclient :import [java.net.Socket]) ?
11:08cemerickchrnybo: yes, although the ns macro is almost always used in an actual source file (which you can easily load into a REPL assuming you're in a sane editor/environment).
11:09hiredmanerm
11:09hiredmancemerick: you mean "no"
11:09chrnybohiredman: huh?
11:09cemerickthat would actually be :import (java.net Socket) though -- or :import java.net.Socket (if you only want one class from java.net
11:10chrnybocemerick: But java.net is not a function call. In parens all the same?
11:11cemerickchrnybo: ns is a macro, so it's free to interpret parenthesized symbols however it wants
11:12cemerickFWIW, that degree of variance from "normal" clojure syntax is very rare in the core lib, etc.
11:25tashafahi all... question: is there a quick way to find an element that isnt distinct in a seq without looping
11:25tashafa?
11:27rhickey_any here ever tried GridGain?
11:28cgrandtashafa: example?
11:30tashafacgrand: (<fn> '(0 1 2 3 4 5 1)) => 1
11:31tashafacgrand: (<fn> '(0 1 2 3 4 5 1)) => [1]
11:32tashafacgrand: (<fn> '(0 1 2 3 4 5 1 4)) => [1 4]
11:32gnuvincerhickey_: I haven't.
11:33acieroidit'll be hard without loops tashafa
11:33tashafayeah i thought so
11:35tashafai just thought there would bbe a more clojurey way to do it
11:36cgrand(defn find-repeated [coll] (remove nil? (map #(%1 %2) (seq-utils/reductions conj #{} coll) coll)))
11:37tashafacgrand: you are on some other ish...thanks man
11:38tashafaback to the repl
11:38tashafa... with my new toy
11:44AWizzArdrhickey_: btw, I managed to print refs, atoms and agents in a "nearly duplicatable way". When I read them back in they are not =, but if there would be an equalp as in (= (ref 0) (ref 0)), then they would be. It's nice for an in-ram db which wants to read data back into memory.
11:44AWizzArduhm (equalp (ref 0) (ref 0)) ==> true
11:46Chousukethat's pretty easy to define
11:46AWizzArdyes
11:49AWizzArdThe interesting case (which also work for me now) are circular refs.
11:56replacaAWizzArd_: but the key question is: if I modify the first ref in a "deserialized" object, does the other one change too?
11:57replacaAWizzArd_: because if they're really dups, that would be the expected behavior
12:00replacaAnyone planning on coming to SF for JavaOne in June?
12:08cemerickrhickey_: my only awareness of GridGain comes from a dustup between some of their people and Terracotta last year. So, no. :-)
12:08replacaOh, it looks like Rich is up for a talk and a panel
12:09replacarhickey_: shall we do an SF clojure-focused event while you're here?
12:26AWizzArdreplaca: what I made is good for writing a snapshot. I serialize an object as backup from time to time, and for planned restarts.
12:28replacaAWizzArd: Yeah, but if you restart and one ref turns into two, don't you get different semantics?
12:29ior3kerrr
12:30ior3kI'm probably doing something really stupid
12:30ior3kbut I keep getting ClassNotFoundException while trying to do a gen-class
12:30ior3kthe class not found has the same name of the fn I'm trying to define
12:30replacaior3k: did you add the classes/ output directory to your classpath?
12:31replacaior3k: that's a common reason for that
12:33ior3kreplaca: ahh, that was it
12:33ior3kreplaca: thanks, I'm still getting used to this whole new world :)
12:34replacaior3k: glad to help. We all seem to have a little trouble getting going with gen-class
12:36AWizzArdreplaca: I get the same semantics that I had before saving
12:39replacaAWizzArd: ok, as long as it works for you :-) Doesn't seem right to me.
12:41rhickey_replaca: what did you have in mind?
12:42replacarhickey_: Handn't thought about it too hard yet. Maybe a presentation session followed by drinking. :-)
12:43replacarhickey_: There are a bunch of clojurians here in the bay area and if more were coming in (esp. you) it seemed like a good time for a get together
12:43rhickey_well, I'll be at Java One, as you saw, two talks
12:44gnuvinceIs it expected in a hash-map/struct heavy program that java.lang.Integer.hashCode takes more than 50% of the processing time or might my profiling numbers be off?
12:44rhickey_heads up everyone, one will be the 'script bowl', a friendly competition where we'll have to implement the same task in each of our langs (beforehand), then demonstrate. Community participation is welcome/expected
12:45gnuvincerhickey_: is there a description of the problem somewhere?
12:45rhickey_gnuvince: not yet
12:45replacarhickey_: cool, we could build around your schedule. I can provide a meetup place (our corporate classroom) about three blocks from the convention center. And drinks are easy to find in this town
12:46gnuvincerhickey_: ok. Can you announce it in the discussion group when it is?
12:46rhickey_replaca: definitely interesting in meeting Clojurians
12:46rhickey_gnuvince: certainly
12:46rhickey_interested
12:47gnuvinceI am, although I should warn that I am probably not who you want on that team
12:47replacarhickey_: cool, we can organize in the group. We'll drag in the bay area group too. They've been meeting down in Palo Alto/Mtn View, but I bet we could drag a bunch of theem up to the city.
12:47gnuvinceIf it's a JavaOne thing, it'll certainly involve knowledge of the Java platform, which I still lack
12:48replacaalso, happy to help out/participate in script bowl, though I'm not (currently) planning to attend JavaOne for any other reasons
12:50replacahey folks, check out the new contrib function/var index at http://code.google.com/p/clojure-contrib/wiki/ApiDocIndex
12:50rhickey_replaca: nice!
12:50replacastill some stuff to do, but we're getting close
12:51rhickey_replaca: you could probably also generate a link into the source on google code
12:52replacarhickey_: Yeah, I was thinking that, but I think I can only do that at the file level
12:53hiredmanwell
12:53replacathe whole way google wiki does anchor tags is kind of a mess, though it's trying to be helpful
12:53hiredmanthe vars all have line number + filename information
12:54replacahiredman: is there a way I can generate a URL to get there?
12:54hiredmansure
12:54replacaw/o copying the data into the wiki?
12:54replacahiredman: show me!
12:54hiredmanerm
12:54rhickey_http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/probabilities/finite_distributions.clj#118
12:54replacahiredman: and I'll do it
12:54hiredmanwhat do you mean "copying the data into the wiki"
12:55replacarhickey_: awesome. Consider it added
12:55hiredmanhttp://github.com/hiredman/clojurebot/blob/9216e6b2f6c5402be06d093d01590a7dd33131c3/hiredman/clojurebot/code_lookup.clj
12:56rhickey_replaca: a search might be more useful, returning source and usage:
12:56rhickey_http://www.google.com/codesearch?q=cond-prob+package%3Ahttp%3A%2F%2Fclojure-contrib%5C.googlecode%5C.com&amp;origq=cond-prob&amp;btnG=Search+Trunk
12:56replacahiredman: I meant copying the source code. I didn't realize that google code tagged the lines
12:56hiredman~def max
12:58replacarhickey_: the search is cool, but doesn't always return what you want. (e.g. "add")
12:59gnuvinceCan macros be recursive?
12:59replacaso I'd put both
13:07Chousukegnuvince: yes
13:07Chousuke~def ->
13:12replacaAdding a source link would be easy if it weren't for that numbskull who wrote pprint. He loads his files from a sub-directory so the filenames don't fit namespace/filename.
13:19gnuvinceChousuke: thanks
14:16gnuvinceWell Google Code added support for Mercurial... :)
14:17stuhoodgoogle has spoken! mercurial is better than git!
14:17bitbcktbah
14:17gnuvinceThe git people are going to go batshit insane now :)
14:18gnuvincebitbckt: you're a git user?
14:18bitbcktVery much so.
14:18gnuvincebitbckt: that's a very unfortunate nickname then :)
14:18bitbcktI use hg, too.
14:18bitbcktHeh. I had it first. :P
14:18bitbcktFilthy mongrels.
14:20bitbcktI suspect the influence of He Who Shall Not Be Named(TM) on this Google Code nonsense.
14:21gnuvinceVoldemort?
14:21bitbcktClose.
14:21bitbckt>_>
14:21bitbckt<_<
14:21bitbcktWguido
14:21gnuvinceHa
14:22bitbcktI can't even type it..
14:22gnuvinceHe Who Doesn't Like Tail Recursion (TM)
14:22gnuvinceActually, this explains the reasons: http://code.google.com/p/support/wiki/DVCSAnalysis
14:22bitbcktSteeper learning curve. Excrement.
14:24bitbcktAlso, msysgit has come a long way, I hear.
14:25bitbcktSorry. I'll restore the channel to it's normal operating conditions. :-!
14:26stuhoodcould've been worse: you don't have to set off the fire suppression system
14:26p_lwell, I do consider mercurial to be easier. But I'm the kind of guy who uses both equally :D
14:27gnuvincep_l: so you're really well placed to make such a statement :)
14:28p_lgnuvince: Well, my older projects mainly used mercurial, now with some of the stuff I'm using git. I hate to go back to SVN or CVS :)
14:28bitbcktstuhood: A light switch is a better analogy. I haven't donned my asbestos suit, yet.
14:28bitbcktp_l: Completely agreed.
14:28gnuvincep_l: we use SVN at work. Makes me sad, but I'm leaving soon hopefully, so I don't care.
14:28bitbcktI use hg only when integrating with other devs. Internally I/we are all git.
14:28gnuvincePersonally, I like Mercurial
14:29Chousukewell, mercurial is better than SVN
14:29bitbcktThe Big Three all are.
14:30p_lI recall someone doing a rather objective analysis, and claiming that he found mercurial easier to start using, while git was the more powerful but more rocket-science brother :)
14:30bitbcktbzr, git, hg... if that wasn't obvious enough
14:30cemerickisn't it really trivial to use hg through git? If it can usefully "proxy" svn, then hg should be cake....
14:30Chousukeprobably.
14:31Chousukethough there's no git hg yet :P
14:31bitbcktI use git svn regularly. That's part of why we chose it.
14:31bitbcktIt's Subversion integration is top notch.
14:31bitbcktAnd there are other parts of our corporation that are still svn users.
14:32bitbcktIts. *ahem*
14:33gnuvinceI found it funny that one of the Mercurial summer of code project was not to make Mercurial a client for SVN repos, but for Git repos :)
14:36bitbcktMy bias is clear, but I'd attribute that partly to the perceived/real ease of migration svn -> git.
14:36bitbcktAnd the obvious "threat" git presents to hg's adoption.
14:37bitbcktEasy migration *off* git could be a huge advantage for hg.
14:37ChousukeI'm not so sure about that.
14:37bitbcktChousuke: Elaborate.
14:37cemerickI figured the battle was essentially over given github's massive superiority over bitbucket. Now GC goes and knocks things askew again. :-/
14:38Chousukethere's little to gain from migrating from git to hg, so migration would have to be *really* easy to be worthwhile.
14:38bitbcktI think that's the point.
14:38bitbcktIf hg wants to continue presenting itself as the "easier" git, then it should permit extremely "easy" migration.
14:39gnuvinceIt does
14:39gnuvincehg convert path/to/gitproject hgproject
14:39bitbcktSo that those that prefer hg could use their preferred tool to interface with the rest of the DVCS world.
14:39gnuvincesame with svn, cvs
14:40bitbcktgnuvince: I mean as an interface to git, not as a complete conversion.
14:40bitbcktala git-svn
14:41gnuvinceyeah, I wish it had something like git-svn
14:42bitbcktMigration was the wrong word. Integration with git.
14:43gnuvinceIntegration with git is what one of the GSoC project is about
14:43bitbcktRight.
14:44Chousukeseems kind of pointless to abbreviate a long option :/
14:45Chousuke(there's a -r short option counterpart)
14:45gnuvinceI don't know, I don't think I've ever used --rev
14:48ChousukeI guess it's due to the tendency to want to abbreviate things for convenience, even when it might not make sense.
14:48Chousukesomeone was too lazy to type revision, and rev stuck :/
14:52p_lbtw, since som
14:52p_l*some people here might be using java
14:52p_lis there anyone who can point me to some good documentation about JDEE? (Emacs)
14:56cemerickp_l: last I knew, it didn't have much of a following.
14:56Chousukehg seems to have a different idea of branches than git. the basics section makes new clones of repositories for things you'd just use a branch for in git. :/
14:56cemerickdoes anyone here use straszheimjeffrey's graph lib in contrib?
14:57cemerickChousuke: that was probably the #1 reason why we went with git
14:57p_lcemerick: pity, java-based IDEs are too much PITA for me, while I need completion due to not remembering all those long names
14:58Chousukethe way git handles branches together with the idea of "remotes" is awesome.
14:59cemerickp_l: A friend of mine got JDE working at some point about a year ago, and found it *really* lacking vis � vis eclipse and netbeans. *shrug*
14:59Chousuketrivial to track and interact with multiple remote repositories through a single local one.
14:59cemerickif you're going to be doing anything that involves Java in clojure, I'd strongly recommend trying netbeans + enclojure. NB has improved in leaps and bounds over the past year or so -- pretty "lightweight" as IDEs go.
15:01p_lcemerick: I know, I'm using Netbeans. The problem is that anything that uses Java libraries for GUI is a PITA on my system :)
15:02cemerickPITA in what way?
15:02p_lcemerick: not working
15:02cemerickheh
15:02p_lI have to run them under separate X server
15:03p_lcemerick: it's due to bugs in Java libs, actually.
15:11unlinkHow do you shadow symbols exported by clojure.core?
15:12dnolenbrain freeze today, how do you split a string in Clojure?
15:13Chousukeuse the java String .split method
15:14Chousukeunlink: what kind of shadowing do you mean?
15:16unlinkLike, clojure.core exports something like "val" or "map" and I want to bind to that symbol in a let or something.
15:21cemerickunlink: use (:refer-clojure :exclude [ancestors printf]) in your ns decl
15:22cemerickwith whatever defs you want to 'shadow', rather than ancestors + printf
15:22unlinkRight, but what if clojure introduces new exports from core in future versions?
15:23Chousukeyou can use (binding [map mymap] somecode), and somecode will run as of map were mymap instead
15:24stuhoodChousuke: but only if the var already existed
15:24cemerickunlink: oh, I didn't fully read your question...that "just works":
15:24cemerick,(let [+ 5] +)
15:24clojurebot5
15:24stuhoodoh... yea... let
15:25cemerickusing refer-clojure is only necessary when you want to def something in your ns that is already in core
15:25unlinkoh
15:45arohnerjava question: can I stick jars in a jar, and then if I do, are the sub-jars part of my classpath?
15:45dysingerno
15:46dysingeryou can make uber-jars (with the contents of other jars)
15:46dysingeror you can setup your jars to automatically expect other jars to be sitting next to them (classpath)
15:46dysingerwith the manifest
15:47arohnerhmm, ok
15:47arohnerthanks
15:47dysingermaven -> http://blog.jayway.com/2009/03/22/executable-jar-with-onejar-maven-plugin/
15:48dysingermaven probably has 3 ways to do a "one big jar"
15:48dysingerbuilt from your code + dependencies
15:49dysingerhttp://blog.taragana.com/index.php/archive/apache-ant-how-to-include-multiple-jar-files-in-a-single-jar-file/
15:49dysingerant probably has just as many ways to do "one jar to rule them all"
15:50arohnercool, thanks
15:51dysingerhttp://timshadel.com/2006/08/28/building-a-megajar-with-maven2-the-right-way/
16:15baetis-flyQ: What's the difference between ({:key "value"} :key) and (:key {:key "value"}) and which should I usually use?
16:17arohnerbaetis-fly: no difference
16:17devinushow fast is clojure?
16:17arohneryou can use both
16:17baetis-flyarohner: have people adopted one or the other?
16:17arohnerI like to use the first when looking up a single element, but the second when using, say, map
16:18arohneri.e. ({:key "value} :key) by itself, but (map :key [ {:key "value"} {:key "value2"} {:key "value3"}])
16:18arohnerdevinus: depends
16:18baetis-flyarohner: that makes sense. Many thanks.
16:18arohnerif you're very careful, it can be about as fast as java. typical usage is somewhat slower, but IME faster than python or ruby
16:21danlarkin"fast enough"
16:50cemerickwasn't there a variation on assert that took an optional exception message?
17:14hiredmanwhats that hack to get access to private vars?
17:17AWizzArdWhat privat vars?
17:18hiredmanit's privated :P
17:18arohneris metadata mutable? could you just strip the metadata off?
17:18dysingerno it's not
17:19AWizzArd,(doc alter-meta!)
17:19clojurebot"([iref f & args]); Atomically sets the metadata for a namespace/var/ref/agent/atom to be: (apply f its-current-meta args) f must be free of side-effects"
17:19dysingerAWizzArd http://www.onjava.com/pub/a/onjava/2003/11/12/reflection.html
17:20dysingerAWizzArd private means private unless you disregard and hack
17:20dysingerat least in java
17:20arohnerhiredman: oh, another way might be to just jump into the ns of the private var
17:20dysingerAWizzArd - ohh I didn't know you could atomically alter metadata
17:21arohner(in-ns 'foo) (println private-var)
17:21stuhooddysinger, AWizzard: only when it is attached to a mutable object
17:21Lau_of_DKSo - Ive compiled my little app into a jar, which can now be run with java -jar, but is there anyway to automate javas start up params? I need to fix the GC to concurrent mode...
17:24AWizzArdLau_of_DK: put the parames into your startup script, or into the link that you set up under Windows.
17:24Lau_of_DKI dont want to distribute a start-up script, just the jar
17:26technomancyhey folks! just released the PeepCode screencast on Clojure: http://peepcode.com/products/functional-programming-with-clojure
17:26Lau_of_DKSweet
17:27technomancyclojurebot: ping
17:27clojurebotPONG!
17:28technomancyclojurebot: peepcode is a professionally-recorded hour-long tutorial video at http://peepcode.com/products/functional-programming-with-clojure
17:28clojurebot'Sea, mhuise.
17:30technomancyclojurebot: botsnack
17:30clojurebotthanks; that was delicious. (nom nom nom)
17:34Lau_of_DKMan that look pro technomancy
17:34gnuvince_technomancy: did you send Rich a free copy?
17:37hiredmansomeone want to tweet at clojurebot (prn "Hello World")
17:37hiredman?
17:37stuhoodsure
17:37hiredmanExcellent
17:37stuhood@clojurebot (prn "Hello World")
17:37stuhood?
17:37hiredmanyeah
17:38arohnerI just did that
17:40hiredmanI think clojurebot only does a tweet every ten minutes, the last tweet was four minutes ago
17:40hiredmanso now we wait
17:41stuhoodgotcha
17:42technomancygnuvince_: yeah, he did the technical editing for it. =)
17:42Lau_of_DKIs there a java thingey for doing something like (+ (Date/now) "00:10:00") to get a Datetime thats 10 minz from now ?
17:43technomancyLau_of_DK: Joda time can do that.
17:43Lau_of_DKcool
17:43technomancyLau_of_DK: if you don't care about timezones (only using UTC, no daylight savings) you can use chrono, which is a clj wrapper around the built-in JDK stuff
17:45Lau_of_DKJoda time looks hot though
17:45hiredmanhttp://twitter.com/clojurebot/status/1607756949
17:46hiredmansomething isn't right
17:46arohnerLau_of_DK: it is
17:46hiredmanah
17:47hiredmaneval-in-box returns a vector of [stdout stder result]
17:56Lau_of_DKtechnomancy: Are you aware of any 'pretty printing' capabilities in Joda?
17:56Lau_of_DKIm looking for something like (DateTime/toString "hh:mm:ss")
17:56technomancyLau_of_DK: I haven't used it myself; just heard about it.
17:56technomancychrono has that, but it's no good if you need DST-awareness
17:57Lau_of_DKhaha
17:57Lau_of_DKI just followed my intution, and it worked straight off, just couldnt find it in the javadocs
17:57Lau_of_DKuser> (.toString (.plusMinutes m 8) "hh:mm:ss")
17:58Lau_of_DK"11:59:37"
18:28replacaAuto-doc: now with source links
19:05uninvertedWhat's clojure's equivalent to scheme and cl's append function?
19:05dnolenuninverted: like for vectors?
19:05uninvertedYes
19:05dnolen,(conj [1 2 3] 4)
19:05clojurebot[1 2 3 4]
19:05technomancyuninverted: probably conj if it adds to the head of lists
19:06dnolenuninverted conj does different stuff for different data structures.
19:06uninvertedNo, I mean this: (append [1 2 3] [4 5 6]) => [1 2 3 4 5 6]
19:06dnolen,(conj '(1 2 3) 4)
19:06clojurebot(4 1 2 3)
19:06dnolen,(concat [1 2 3] [4 5 6])
19:06clojurebot(1 2 3 4 5 6)
19:06uninvertedAh, that's what I needed. Thanks!
19:06dnolennote that the type gets lost tho.
19:06dnolenyou might want
19:07dnolen,(vec (concat [1 2 3] [4 5 6]))
19:07clojurebot[1 2 3 4 5 6]
19:08Cark,(type [1 2 3])
19:08clojurebotclojure.lang.LazilyPersistentVector
19:08hiredman,(into [1 2 3] [4 5 6])
19:08clojurebot[1 2 3 4 5 6]
19:09Carki wonder why the lazy in there
19:09Carkif i do (vec (concat [1 2 3] [4 5 6])) ... is the vector lazily created as i read it ?
19:10technomancyCark: pretty sure calling vec forces the seq to be realized
19:10Carkit would make sense ... but why lazy in the class name then ?
19:10hiredman,(first (vec (concat [1 2 3] [(print :foo) 5 6])))
19:10clojurebot1
19:10clojurebot:foo
19:11Cark~def c.c.LazilyPersistentVector
19:11Cark~def c.l.LazilyPersistentVector
19:12uninvertedCark: The tail (i. e. everthing but the first element) isn't computed until it is needed.
19:13Carkhiredman's example shows this is'nt true
19:15uninvertedBeing printed forces it to be computed.
19:16Cark,(take 1 (map identity '(1 2 3 (print "hello"))))
19:16clojurebot(1)
19:16Carkerr
19:17Carknot a good example !
19:17uninvertedWhy not?
19:17Carkmy example, because the list is quoted
19:18uninverted,(take 1 (map identity [1 2 3 (print "hello")]))
19:18clojurebot(1)
19:18clojurebothello
19:18uninvertedHa! I guess I'm thinking of something else.
19:19chessguyso lists aren't lazy by default?
19:19chessguy,(take 1 [1 2 3 (print "hi")])
19:19clojurebot(1)
19:19clojurebothi
19:20chessguy,(type [1 2 3 (print "hi")])
19:20clojurebotclojure.lang.LazilyPersistentVector
19:20clojurebothi
19:20chessguyheh
19:21chessguythat does seem like a strange name then
19:22ctdeanI think that lazy-cat is for being lazy, and concat is more immediate
19:22ctdeanWill defn work in the clojurebot?
19:23chessguyi don't think so
19:23ctdeanI'll try
19:23ctdean,(defn my-list [name]
19:23ctdean (printf "Making %s list\n" name )
19:23ctdean (list 1 name))
19:23clojurebotEOF while reading
19:23ctdean,(defn my-list [name] (printf "Making %s list\n" name ) (list 1 name))
19:23clojurebotDENIED
19:23uninverted,(defn foo [bar] bar)
19:23clojurebotDENIED
19:23uninvertedAww...
19:24Cark,(take 1 (map #(print %) '(1 2 3)))
19:24clojurebot(nil)
19:24uninvertedWell, just use anonymous functions, I guess.
19:24chessguy,(type (print 3))
19:24clojurebot3
19:25chessguy,(type '(print 3))
19:25clojurebotclojure.lang.PersistentList
19:25ctdeanConcat is not lazy
19:25ctdean(let [my-list (fn [name] (printf "Making %s list\n" name ) (list 1 name))]
19:25ctdean (take 1 (concat (my-list "red") (my-list "blue"))))
19:25ctdean,(let [my-list (fn [name] (printf "Making %s list\n" name ) (list 1 name))]
19:25ctdean (take 1 (concat (my-list "red") (my-list "blue"))))
19:25clojurebotEOF while reading
19:25ctdean,(let [my-list (fn [name] (printf "Making %s list\n" name ) (list 1 name))] (take 1 (concat (my-list "red") (my-list "blue"))))
19:25clojurebot(1)
19:25clojurebotMaking red list Making blue list
19:25ctdeanbut lazy-cat is lazy
19:25ctdean,(let [my-list (fn [name] (printf "Making %s list\n" name ) (list 1 name))] (take 1 (lazy-cat (my-list "red") (my-list "blue"))))
19:25clojurebot(1)
19:26ctdeanOn my repl it also prints making red list
19:28Carklazy-cat is a macro
19:28ctdeanwell, sure
19:28Carkconcat is not, so the parameters are evaluated
19:29hiredmanctdean: concast is somewhat lazy
19:29hiredmanconcat
19:30hiredmanif I recall the first 3 or 4 elements of each seq are evaluated
19:31ctdeanI see, good to know about the first N seqs
20:43chessguythe preview of the peepcode screencast that was announced today mentioned a free screencast on setting up clojure. anybody know where that is?
21:30dnolenis there a good example in contrib of updating a tree?
22:56jmanessdoes anyone know if there is a already a function similar to range that accepts an inclusive end? I find myself writing: (range (inc x)), but I was wondering if there is already something else that is better.
23:03replacajmaness: I don't think so, but not hard to write if you need it. I find I'm doing that a lot too
23:50unlinkWhat's the idiomatic way of writing helper functions? The letfn syntax seems to encourage never writing helpers
23:54replacaI just use defn- to create a root level private function in my namespace