#clojure logs

2009-06-22

01:10arohnerdanlarkin: ping
02:44vika23Is there a function to convert string to numbers in clojure ?
02:45grrrtvika23: you could do (Integer. "123")
02:45grrrt(java equivalent of new Integer("123") )
02:47vika23grrrt: Thanks a lot :)
02:47hoeckvika23: or (Integer/valueOf "123")
02:48hiredman,(Integer/parseInt "123")
02:48clojurebot123
03:08frodefhow do I write a macro that expands to something like (let [foo bar] ~@body (zot foo)) ? I get "Can't let qualified name foo" error..
03:09hiredmanyeah
03:09hiredmanclojure's macro system doesn't like non gensymed names because they make for unhygenic macros
03:09hiredmanso you need to replace foo with foo#
03:10hiredmaninside a syntax quote (`) foo# expands into a gensymed symbol
03:10hiredman,`foo#
03:10clojurebotfoo__3466__auto__
03:10hiredman,`foo#
03:10clojurebotfoo__3470__auto__
03:10frodefbut the same one each time?
03:10frodef,`(foo# foo#)
03:10clojurebot(foo__3474__auto__ foo__3474__auto__)
03:10frodefaparently :)
03:11hiredmanfrodef: in the same syntax quote it will be the same
03:11frodefok, thanks.
03:11hiredman`(foo# ~`foo#)
03:11hiredman,`(foo# ~`foo#)
03:11clojurebot(foo__3479__auto__ foo__3478__auto__)
03:37grrrthm. I'm trying to create a function that generates a string consisting of a character c repeated n times.
03:37grrrtI have ,(take 10 (cycle ["-"]))
03:37grrrtbut I'm not sure how to make a string from that
03:38hiredmanapply str
03:38grrrtah of course! thanks!
03:38hiredmanyou might use repeat instead of cycle
03:38hiredman,(doc repeat)
03:38clojurebot"([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs."
03:38grrrtyes much better
03:39hiredman,(take 10 (repeat \c))
03:39clojurebot(\c \c \c \c \c \c \c \c \c \c)
03:39grrrtI thought cycle was a bit strange in this case. cheers
03:40grrrt,(apply str (repeat 10 "-"))
03:40clojurebot"----------"
07:18Lau_of_DKIs there a demo up somewhere of a small compojure app which uses the new session middle-ware stuff?
07:37emacsenChouser, you around?
07:39opqdonutcan for iterate over two lists at the same rate?
07:39opqdonutlike cl loop does
07:40emacsenusually if you're iterating you're doing something wrong
07:40emacsen(not always but so many times)
07:40Lau_of_DKemacsen: by what logic ?
07:40emacsenLau_of_DK, you can usually accomplish the same thing with a filter of one or another sort
07:40emacsenoperating on a data structure rather than iterating through results
07:41Lau_of_DK(filter even? (iterate inc 1)) ? :)
07:41Lau_of_DKSometimes it exactly what you want
07:41emacsenand I'm late for work so I'm gonna shower and go
07:41Lau_of_DKAnd it beats recursion
07:41emacsenI said usually :)
07:41Lau_of_DKlooping is not really iterating though, and if we make that distinction I agree, usually when I loop its for some sideeffect :(
07:44opqdonutemacsen: iterating? wrong?
07:45opqdonuti'd just like to be able to write stuff like (map f data (range 1)) using a for
07:46opqdonuterr, by (range 1) i really meant (iterate inc 0)
08:04Lau_of_DKCouldnt you just use apply ?
08:05emacsenLau_of_DK, that was kinda my point. Oftentimes people want to use iterate but they could easily use a different style, as you said, he could probably use apply
08:05emacsenhey pjb3
08:06pjb3emacsen: hey
08:06Lau_of_DKemacs, I kinda got your point, eventually :)
08:06emacsenSo, since Chouser isn't here, anyone familiar with the Java "exec", as used in the shell-out contrib?
08:06emacsenI just want to pass the program some arguments, and that causes it to fail, eg "find /home/foo"
08:06emacsenit looks for a program named "find /home/foo"
08:07Lau_of_DKemacsen, check out Gitdoc on Github, its not updated, but I use that functionality
08:07emacsenGitdoc?
08:07Lau_of_DKhttp://github.com/Lau-of-DK/gitdoc/tree/master
08:08emacsenheh, love the last commit "removed shell-out" :)
08:08Lau_of_DKhehe :)
08:09Lau_of_DKit should be in engine.clj
08:09emacsenwhich file.. thank you :)
08:10emacsenthe Runtime/getRunTime part with your exec?
08:10Lau_of_DKhttp://github.com/Lau-of-DK/gitdoc/blob/26b219792b14c3535850047d3e2c2c7072e56855/src/dk/bestinclass/gitdoc/engine.clj#L137
08:10Lau_of_DKYea, thats what youre looking for I hope
08:11emacsenpossibly. I'm so java ignorant I have to look up each of those :)
08:11Lau_of_DKI dont use a buffer at all though, like I said its outdated, but you'll get the picture, compare that to shell_out and you can make the perfect func
08:11Lau_of_DKI gotta jet, l8r
08:11emacsenokay thanks
08:15frodefis sort and sort-by a stable sort?
08:15maaclNewbie question: Why does the following blow the heap: (map (fn [s](apply str s)) (selections (map char (range 97 123)) 4))
08:18maaclselections is the selections function from clojure.contrib.combinatorics btw
08:24Chousermaacl: works fine here.
08:25ChouserIt's going to print a lot if you run it at the repl, but wrapping either first or last around it works fine.
08:27maaclChouser I run out of Java heap space if I run the whole thing ie java.lang.OutOfMemoryError: Java heap space
08:32maaclChouser: Also if I try to do a "last"
08:32ChouserI don't think there's anything inherently wrong with your expression. It produces 456976 strings which isn't nothing.
08:33jaohi. sorry if this a FAQ, but what's the way of writing bindings to a C library in clojure? (asked by someone who knows very little java)
08:33Chouserbut with 'last' or 'first' it should be throwing them away as fast as they're created.
08:33Chouserjao: If you're not overly concerned with speed, I'd recomment JNA: http://github.com/Chouser/clojure-jna
08:34jaoChouser: aha, thanks! and if i were concerned? ;)
08:34Chouserjao: otherwise you'll have to use JNI, the Java Native Interface.
08:34maaclChouser: I thought so, but "last" just hangs and just running it runs out of heap space
08:34eevar2jao: http://java.sun.com/docs/books/jni/
08:35jaoChouser, eevar2: i see, thanks again
08:36Chousermaacl: very odd. works fine here. What versions of Java and Clojure are you using?
08:36eevar2jao: if you're concenred with speed, you're probably better off finding a Java library which does what you want, tho
08:36maaclChouser: java 1.6.0_13
08:38maaclChouser: clojure 1.1 alpha
08:39maaclChouser: oh, "last" actually completes - just took 4-5 mins
08:41Chousermaacl: 3 seconds here, on the same jvm and recent clojure
08:43maaclChouser: I will update clojure and try again
08:43maaclChouser: The CPU runs beserk, and no extra memory is used
08:44Chouserthat sounds right. perhaps that's just how long it takes to compute everything you're asking for on that CPU?
08:46maaclChouser: A Athlon 64 3400+? now brand new, but still?
08:46Chouserhmph. that's probably faster than what I'm using. weird.
08:48rhickeywhat's the code?
08:48maaclrhickey: (map (fn [s](apply str s)) (selections (map char (range 97 123)) 4))
08:49rhickeyselections?
08:50Chouser(use '[clojure.contrib.combinatorics :only [selections]])
08:50maaclrhickey: from clojure.contrib.combinatorics
08:50durka42(doc selections)
08:50clojurebot"clojure.contrib.combinatorics/selections;[[items n]]; All the ways of taking n (possibly the same) elements from the sequence of items"
08:51rhickeymaacl: how much memory are you giving the JVM?
08:52maaclrhickey: I haven't set any options? should I ?
08:53maaclrhickey Chouser: Just tried on my MacBook too - same thing
08:54Chousermaacl: are you loading anything else first? using an IDE?
08:54rhickeymaacl: usually, yes, the default heap is puny use: -Xmx512m where 512 is however many mbs you want to give it
08:54Chouserhuh. I never set a heap option.
08:55rhickeydidn't contrib's build used to have a nice message when trying to compile saying it wasn't really without a path to clojure.jar?
08:55Chouseryeah
08:55maaclrhickey Chouser: I user emacs/slime
08:55achimi can reproduce with SLIME, but not in the terminal,with otherwise identical (= default) settings
08:55Chouseroooh, we have a culprit
08:55rhickeywhat happened to it?
08:56maaclChouser: sounds like it
08:56clojurebotWho??
08:57Chouserrhickey: with the latest contrib, I get a WARNING if I don't suppot -Dclojure.jar=... on the ant command-line
08:58rhickey.9 secs on my machine
08:59maaclrhickey: from slime?
08:59rhickey(calling last on that map return)
09:03rhickeymy bad, old contrib
09:06maaclrhickey: did you get .9 from slime?
09:07maaclah
09:08achimi'm getting a strage exception when trying to build clojure & contrib using ant ... has anybody seen something like this before?
09:09lisppaste8achim pasted "exception when building via ant" at http://paste.lisp.org/display/82282
09:09Chouserachim: yeah
09:10Chouserachim: http://www.assembla.com/spaces/clojure/tickets/124
09:10Chousercompiling with Java 5, I assume?
09:13achimChouser: don't think so, unless ant overrides the system default. java -version is "1.6.0_13"
09:14rhickeywhen tests burn in broken behavior:
09:14rhickey [java] FAIL in (test-range) (sequences.clj:840)
09:14rhickey [java] expected: (= (range 2.5) (quote (0 1)))
09:14rhickey [java] actual: (not (= (0 1 2) (0 1)))
09:14rhickey [java]
09:14rhickey [java] FAIL in (test-range) (sequences.clj:840)
09:14rhickey [java] expected: (= (range 7/3) (quote (0 1)))
09:14rhickey [java] actual: (not (= (0 1 2) (0 1)))
09:14clojurebot
09:14Chouseroh, I guess Steve reported Java 6 failing on Leopard as well.
09:15maaclChouser: confirm I got it to work from the REPL. Who should I report the error to?
09:16ChouserI guess that agent shutdown patch should be backed out. It was only meant to solve an annoyance -- current behavior sure seems more annoying for the poeple it affects.
09:16Chousermaacl: for a slime bug? I don't really know, sorry.
09:17maaclChouser: ok, also hard to know if it is a slime or swank-clojure bug really
09:19achimChouser: ah, thanks for the pointer!
09:42frodefwhat does this mean? java.lang.NoClassDefFoundError: clojure/lang/IteratorSeq
09:42frodefDo I need to import some iterator-seq library?
09:46frodefIt seems to happen when I try to access an ArrayList I get from java.
09:47frodef,(seq (new java.util.ArrayList))
09:47clojurebotnil
09:47frodefI get that error..?
09:57Chousukefrodef: classpath problems probably :P
09:58frodefyes, I had messed up my jars, it seems. fixed it.
09:58frodefthanks.
10:11achimre: http://www.assembla.com/spaces/clojure/tickets/124 - if i have ant fork the JVM for compilation, it seems to work fine
10:13achimgranting a modifyThead permission as outlined here doesn't seem to work:http://ant.apache.org/manual/CoreTypes/permissions.html - all other permissions seem to get revoked when doing that
10:13achimdoes anybody have a deeper understanding of the ant/java permissions scheme?
10:13Chouserachim: thanks a lot for looking at that. I spent 2 minutes googling and gave up.
10:29Chouserachim: you could attach a patch to that ticket
10:29achimChouser: seems to work for java 1.5/osx, 1.6/osx and 1.6/ubuntu - i'll see if i get git to make me a patch
10:30achimit's a patch to a patch - how to go about this? should my patch include the other change? is there a way to do this and preserve authorship info?
10:30Chouserachim: there are instructions at http://clojure.org/patches
10:31Chousersince the other patch is already committed, I think you should go ahead and patch again master
10:32achimChouser: ok
10:56dhazahow does clojurebot prevent people from evaling evil things?
10:57stuartsierra,(eval '(System/exit 0))
10:57clojurebotDENIED
10:57Chouserdhaza: a combination of a java sandbox and special form blacklisting
10:57Chouserthat was the blacklist
10:58Chouser,(System/exit 0)
10:58clojurebotjava.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
10:58Chouserthere's the sandbox
10:58Jonathan-Smith(eval '(+ 2 3))
10:59Jonathan-Smith,(eval '(+ 2 3))
10:59clojurebotDENIED
11:00Jonathan-Smitheval is denied
11:00Chouserindee
11:00Chouserindeed
11:00achimclojure-contrib has the same compilation issue. is it okay to file contrib tickets?
11:03Chouserachim: I think so, but I guess file it in the contrib project.
11:07danlarkinarohner: sorry we keep missing eachother. Short answer (if you haven't found it already) is that keys in json objects must be strings
11:08achimChouser: of course. i wasn't sure because of missing GC tickets
11:08Chouserachim: oh, I see. yeah, go ahead.
11:09ChouserI'm not sure if anyone's going to bother bringing over all the closed tickets or not.
11:10arohnerdanlarkin: and that's a restriction imposed by JSON?
11:11ChousukeChouser: We did that with Clojure, but I suppose it's not really needed.
11:11ChouserChousuke: yes, and I'm sure it's appreciated. Clojure's history is a bit more critical than contrib's, I think.
11:11ChouserAnd contrib's tickets may be brought over yet.
11:12danlarkinarohner: correct, to be valid json the keys must be strings. Of course, nothing stopping you from producing invalid json, but yeah that's why clojure-json prints them as strings
11:12ChouserBut having the closed tickets a bit out of order hardly seems critical.
11:12Chousukeyeah.
11:13arohnerdanlarkin: is that json different from a map literal in a javascript call?
11:14arohneror do the JS libraries violate the spec?
11:14danlarkinarohner: an object literal in javascript has non-string keys
11:14arohnersigh. ok. I thought they were the same thing
11:15Chouserdanlarkin: really?
11:15danlarkinChouser: yep :-/ it's dumb
11:15Chouserwhat kind of object literal?
11:15dhazamany json libraries dont implement json correctly
11:15dhazawhich is funny, because it has one of the sparsest syntax i've seen
11:15danlarkinChouser: {foo:1, bar:2}
11:16dhazaand the pretty graphs on json.org make it even easier
11:16Chouser({foo:1, bar:2})["foo"] returns 1 for me in firefox
11:16dhazaChouser, keep in mind that many implementations will try to accept malformed json if it can
11:17ChousukeChouser: I think JS will allow you to access attributes using strings.
11:17Chousukeit's quite dynamic :P
11:17danlarkinChouser: oh.. yes... attribute access uses strings, defining the literal object, though, uses non-strings
11:17arohnerdanlarkin: thanks for your help
11:18dhazaChousuke, yes - obj["foo"] <=> obj.foo
11:18Chouserbut if I can get and set object literals using string keys, what's the difference?
11:18dhazain js
11:18dhazahttp://stackoverflow.com/questions/61088/hidden-features-of-javascript
11:19danlarkinChouser: just that when you're defining the object literal in JS, you can't use string keys, you have to use symbols... {foo:1} instead of {"foo":1} like most languages
11:20Chouseroh, as in {"foo":1} is legal json but not legal js?
11:21danlarkinChouser: correct... and the opposite is also true: {foo:1} is legal js but not json
11:22Chouserbeautiful.
11:23Chouserso all this time I thought I was using json so I could eval in the brower, I was only doing json-ish.
11:24Chousukehm
11:24danlarkineval() is a really bad javascript json parser, which is ironic of course... most javascript libraries like jquery et al. package their own json parser
11:25Chousukefirefox doesn't complain about {"foo":1}.foo
11:25Chousukeit gives 1
11:26Chousukebut I thought the whole point of json is that it's valid javascript.
11:26Chouserdanlarkin: in what way is it bad? I mean, I wouldn't eval js from untrusted sources, but other than that it runs very fast and has worked fine for me.
11:26danlarkinChousuke: yeah it's just trying to do the right thing IMO, other engines are less forgiving
11:27dhazaChousuke, it would be nice, but it would uglify things
11:27dhazafor example
11:27dhazais {false:true} a bool or a string key?
11:27dhazawell, i guess you cant have bool keys
11:27dhaza:(
11:28dhazai meant a bool or string value
11:28danlarkinChouser: yeah, eval just has security implications... it's true that it's very fast
11:28dhazadanlarkin, i don't think that should be a concern with modern javascript engines coming to the forefront
11:28dhazav8/squirrelfish/etc
11:29dhazathey compile js down to native code
11:30dhazaps: why are we talking about json?
11:32Chouserstring keys appear to be allowed for object initializers, according to the ecmascript spec
11:32Chouserhttp://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf page 41 and 42
11:33Chouserpropertyname can be an Identifier, StringLiteral, or NumericLiteral
11:33Chouseridentifiers and numbers are converted to strings for use as the property name
11:35danlarkinHmmmmm
11:42danlarkinChouser: welp, looks like you're right!
11:42Chouserdanlarkin: don't worry, I won't let it go to my head
13:24tsdhHi. Are hyphens in namespaces somehow forbidden? I have de.tsdh.utils.tgraph-inspector but the ant job fails because it cannot find de/tsdh/utils/tgraph_inspector__init.class or de/tsdh/utils/tgraph_inspector.clj.
13:25kotaraktsdh: - translates to _ in the filename
13:25Chouser(and the class name)
13:25tsdhSo the file should be tgraph_inspector.clj, right?
13:25kotarakyup
13:26tsdhkotarak: Works! Thanks a lot.
13:26kotaraknp
13:56kotarakOfftopic, but.. : why do I get different git checksums for commits I pulled via githubs ForkQueue?
13:57dysingerask on #github or #git ?
13:58kotarakk, just thought, there might be a simple answer one of the git fans could give.
14:04dysingerkotarak I only notice different checksums when I cherry pick
14:05dysingerI haven't used github fork queue but about 3 times so not sure what's going on there - it should be just a merge
14:07danlarkingithub's fork queue does a cherry pick
14:07dysingerthere you go
14:07kotarak-.- That means, I get double commits, when I pull now from the master repo?
14:17dysingerEven if you get double commits the second commit will not add anything strange
14:20danlarkinright, they are idempotent!
14:20danlarkinright? I think
14:24kotarakI'll try and see what happens...
14:33dhazathe diff should fail
14:33dhazayou can just ignore it
15:06eliantorhi
15:07dhazahowdy
15:08eliantorhow can i change a global variable defined in another namespace?
15:08eliantorfor example *print-pretty* or *load-tests* from clojure contrib?
15:09technomancy~binding
15:09clojurebotNo entiendo
15:09technomancyeliantor: use binding
15:09kotarak(doc binding)
15:09clojurebot"([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before."
15:09eliantorso i've to wrap everithing in the binding form?
15:10kotarakyes
15:10eliantorok thanks
15:10kotarakbeware of thread boundaries
15:10kotarakand lazy seqs (read map and friends)
15:11eliantori knew of binding but i thought there was another way
15:11technomancyyou can use set! and with-ns, but that's shaky
15:12ataggartif you def a function from inside a binding, will invokgin that function from outside the binding use the original value or the bound value?
15:12ataggartI guess I should just try it
15:12kotarakataggart: I think, the value in effect during the call.
15:13ataggartbindings being threadlocal, that would be my assumption as well
15:13weissjsorry this has probably been asked a million times, but i have searched and can't find anything: where is the equivalent of caar or cddr in clojure? there's no ffirst or rrest.
15:14kotarak(doc nnext)
15:14clojurebot"([x]); Same as (next (next x))"
15:14Chousukeweissj: ffirst is there :/
15:15ataggartso is fnext
15:15kotarak(doc ffirst)
15:15clojurebot"([x]); Same as (first (first x))"
15:15Hunsomehow i like c[ad]{1,5}r better...
15:15weissjok, sorry i was looking for rrest - so, next and rest are the same?
15:15Chousukenot quite.
15:16weissjHun: me too. car and cdr are meaningless but you can make better complex forms out of them :)
15:16ataggartalso, it's not arbitrary like c[a|d]r
15:16ataggartin terms of how deep you go
15:16Chousukenext is equivalent to (seq (rest ..))
15:17Chousukeso it returns nil if rest returns an empty seq
15:17Hunweissj: and they're faster than first and rest. you know, they are hardware ;)
15:18weissjso, nnext is not the same as rrest. there is no rrest. so it's just missing then?
15:18ChousukeI'm not much of a fan of combining car and cdr though.
15:18ChousukeI find them difficult to read :/
15:18ataggartHun: when does one typically use the deep c[ad]r stuff?
15:18weissjHun: the hardware is so old I'm not so sure :)
15:19Chousukeif you're nesting a lot then you should have a more meaningful function to extract the parts you want. even if it's just an alias for caddr or something :P
15:20Chouserweissj: right, rest is used when you're explicitly avoiding realizing the next step of the seq. Thus rrest would almost never be used.
15:20Hunataggart: i haven't used anything deeper than 3 - in this case it was an optimization for a tree i knew to be at max 3 levels deep
15:21weissjChouser: i have a data type that is a name, desc, and then a seq of nested data. isn't rrest exactly what i want to get the list of nested data?
15:22Chousernnext
15:22vika23I am trying java-gnome with clojure . There is a Window class and it has a nested interface DeleteEvent , i want to implement it. How do i use with proxy, (proxy [???] ...).
15:22duncanmvika23: did you check out the API docs online?
15:22ChousukeWindow$DeleteEvent
15:22kotarakweissj: {:name .. :desc ... :data seq-here} is probably what you want instead of nnext...
15:23ataggartthen (:data mymap)
15:24vika23Chousuke: thanks
15:25eliantori'm following the example of using binding on clojure.org, but it doesn't work
15:25eliantorit always use the bindings estabilished by def
15:26hiredmaneliantor: pastebin
15:26eliantorhttp://clojure.org/vars what's wrong?
15:26hiredmanlisppaste8: url?
15:26lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
15:28hiredmaneliantor: are you doing exactly what it shows there?
15:29lisppaste8eliantor pasted "untitled" at http://paste.lisp.org/display/82294
15:30eliantorhiredman: yes
15:30hiredmaneliantor: are you using clojure 1.0?
15:30eliantorhiredman: 1.1, is there a bug?
15:31hiredmaneliantor: nope
15:32hiredmandunno what to tell you, works perfectly with my pre-1.0 clojure and my 1.1-alpha clojure
15:32eliantor...
15:32hiredmaneliantor: restart your repl and try again
15:34eliantorhiredman: always the same behaviour, i'll try to update and recompile
15:36ataggarteliantor: are you using the 1.0.0 jar?
15:37weissjwhat's the equivalent in clojure to '#
15:37weissjto pass a function by name without evaluating it
15:38kotarak?? You mean the Var?
15:38kotarak#'foo
15:38eliantori've updated clojure and the problem is solved, thanks
15:38Chouserweissj: you can just refer to a function by name
15:39Chouser,map
15:39clojurebot#<core$map__4435 clojure.core$map__4435@6f2a75>
15:39hoeckweissj: clojure is a lisp-1, so vars have no function and value slots
15:42weissjin the REPL, if my code throws an exception how can i tell where the exception was thrown from? the error message just has (repl-1:110) as the line number
15:43weissjthe error is definitely NOT on that line: (all-subtasks-complete? x)
15:43Chouser(.printStackTrace *e)
15:49weissjChouser: perfect thanks
15:50weissjok, and if i want the exception that i throw to have a message and concat the string representation of a list, how to convert?
15:51weissji want the string that print prints, but print doesn't return this string
15:51stuartsierrapr-str
15:52Chouser,(throw (Exception. (str "This is a bad list: " (pr-str '(bad wrong icky nasty)))))
15:52clojurebotjava.lang.Exception: This is a bad list: (bad wrong icky nasty)
15:53Chousukehmm
15:53Chousuke,(str '(foo bar))
15:53clojurebot"(foo bar)"
15:54emacsenChouser, you still here?
15:54Chouseremacsen: yes
15:55kotarak,(str '("foo" "bar"))
15:55Chouser,(str '(foo "foo" :foo))
15:55clojurebot"(\"foo\" \"bar\")"
15:55clojurebot"(foo \"foo\" :foo)"
15:55Chouserhmm.
15:55emacsenChouser, in your shell-out "sh" function, how do you pass the command arguments?
15:56Chouseremacsen: there are examples at the end of the file
15:56emacsenoh, okay, I'm just an idiot :)
15:56Chouser(sh "ls" "-l")
15:56emacsenI coulda sworn I tried that but apparently not :)
15:57Chouseremacsen: not at all! someday all the documentation will be full of examples, easily searchable, and cross-linked.
15:57Chouserfor now, asking here is fine. :-)
15:57emacsenah. I see. I tried passing it a list
15:57emacsenI did (sh '("ls" "-l"))
15:57emacsenyour way is better :)
15:58ChousukeChouser: You dream big.
15:58Chouserwell, maybe. if you're constructing a list of args and also want to use keyword args, you have to do something like (apply sh :out :bytes "ls" args-list) ...not sure that's ideal
15:58bpattison Chouser what namespace is printStackTrace in?
15:59ChouserChousuke: heh. :-)
15:59kotarakbpattison: it's a method of the exception. (.printStackTrace *e) (note the leading dot)
15:59Chouserbpattison: it's not! It's a method of the Java Excpetion class.
16:00kotarakIs there now a Core team?
16:00Chouserkotarak: I don't think so.
16:01kotarakChouser: I saw some committers besides Rich, no?
16:01Chouserthe git commits give primary credit to the original patch author, so it looks like there are lots of committers now.
16:01kotarakOh.
16:01Chouserbut anyone who's signed a CA can get a patch in.
16:02Chouserinstructions here: http://clojure.org/patches
16:06ChouserI'm not sure I said that quite right. rhickey has always taken patches from contributors, but he manually gave credit in the commit message, so his name was still the most prominent.
16:06Chouserso other than some process techincallities the only real change is that git automatically gives primary credit to the original patch author.
16:07vika23how old is clojure ?
16:08ataggartjust a couple of years
16:08kotarak3.5 years, 1.5 years in the public
16:08hiredman~git e54a1ff1ac0d02560e80aad460e77ac353efad49
16:08clojurebotcreated IDEA project
16:08hiredmanbah
16:09hiredmanclojurebot: why don't you show the date?
16:09clojurebotwhy not?
16:09kotarakChouser: I just thought, that there is now a team, because there are some signed-off-by things, if I saw this correctly. So I thought there is now a team of Leutnants doing some filtering for rhickey.
16:11Chouserkotarak: I'm doing some of the grunt work pushing patches in for him, but no patch gets in without rhickey's explicit approval.
16:11kotarakYes. I wouldn't expect that there is some change w/o rhickey's approval.
16:12ataggartis it possible to do a no-arg defmethod ?
16:12Chouserataggart: what would it dispatch on?
16:13ataggartwell, it wouldnt need to
16:13ataggartince there could only be one
16:13Chouserataggart: why make it a defmethod instead of just a defn?
16:13ataggartheh
16:14ataggartI was thinking of a no-arg that called an arg'd method using a default value
16:14Chouseroh, I see.
16:14Chousukeyou could use rest args for the dispatch?
16:15ataggartthen I'd need a more funky dispatch function
16:15ataggartright?
16:15kotarakOne could use (fn [& args] (if (> 0 (count args)) (dispatch-somehow) :default)) as dispatch function, no? and (defmethod bla :default ([] (bla :xxx)) ...))
16:15ataggartsomehow (my-fn) needss to get routed to the right method
16:16ataggartahh I see
16:16ataggartdidn't realize you could return :default from the dispatch function
16:16ataggartthough it makes perfect sense that it should work
16:17kotarakHaven't tried, though.
16:28ataggartwhat's the most straightforward way to dispatch on the types of more than one arg?
16:29kotarakataggart: a vector (fn [&args] (vec (map type args))) (defmethod bla [Integer String] ...)
16:29ataggartah excellent thx
16:31kotarakataggart: note that there is no [Integer :default]. For that one needs a ::Bottom type, which one derives everything from.... (derive Object ::Bottom) (defmethod bla [Object ::Bottom] ...)
16:31ataggartwhat's the double-colon notation mean?
16:31kotaraknamespace-qualified keyword
16:31ataggartah k
16:31kotarak,::foo
16:31clojurebot:sandbox/foo
16:32kotarakKeywords need to be qualified to be allowed in a derive.
16:35stuartsierraThings you never knew about Java: http://stackoverflow.com/questions/15496
16:43Chouserthat's a great thread
16:47bpattisonis there a string construct in clojure similar to python's triple quote where line break don't need to be escaped?
16:48Chouserline breaks in regular double-quotes don't need to be escaped.
16:48bpattisonso I don't need "\n\n" ?
16:48Chouserright, you can just continue on the next line.
16:48bpattisonah -- okay -- great
16:49bpattisonah. sweet
16:51Chouserof course python's triple-quote allows unescaped double quotes as well -- there's no way to do that in Clojure code currently.
16:52bpattisonline-breaks is a big plus -- especially with test data
16:56dhazareader macros ftw
17:00Drakesonis there anyone using mac? git clone git://github.com/richhickey/clojure.git and then cd clojure, and run ant. it fails.
17:01ChouserDrakeson: hang on a sec.
17:01Drakesonmaster~2 does not fail. apparently the commit before last is at fault.
17:01Chouseryes
17:03ataggartis there a more sensible way to do default values than: (let arg (if arg arg default-value) ...) ?
17:03ChouserDrakeson: http://www.assembla.com/spaces/clojure/tickets/124
17:09DrakesonThere is a patch that allegedly resolves it. Is it a workaround until a real fixed is developed?
17:09ChouserDrakeson: I don't know. try a fresh pull now.
17:09Drakesons/allegedly// (I tried and it works)
17:10ChouserI don't know enough about the issue to know if the ant fork solution is a good permanent solution or not.
17:10Drakesonthanks.
17:11ChouserFor now the change that broke Compile is removed until the right way forward is decided.
17:28lazy1..
17:28Jetienhi kotarak! sorry to bother you but i'm having problems with vimclojure again. I try to run this example http://java.ociweb.com/mark/clojure/article.html#DesktopApps and again no side-effects (no windows open, etc.) occur when this is evaluated from within vimclojure. same problem as the snake example from yesterday. do you have any hints?
17:33kotarakJetien: I'm not sure, I understand, what's going on.
17:33kotarak(doto (JFrame.) (.setVisible true)) opens a new window.
17:35Jetienyep, i can confirm that
17:36Jetieni was afraid that wasn't going to work at all
17:37kotarakI don't know, why it sometimes doesn't work. I'm not really a Java guy...
17:38Jetienis there a way to debug?
17:38kotarakThe Repl does nothing return, right? Not even nil or something.
17:40Jetiencorrect
17:40Jetienbut it should at least return something, right?
17:40kotarakYeah.
17:42kotarakSomething cheesy is going here...
17:42Jetienis there a way to circumvent the nailgun server and use clojure directly?
17:42kotarakyou can start a normal repl and the nailgun server from there.
17:42kotarakSo you can work directly in the clojure.main repl, but still can send forms from inside vim.
17:43Jetieni wonder if this solves the problem
17:44kotarakif so, it's a VC problem, otherwise it's maybe a deeper thing in Clojure itself.
17:45Jetienhow do you start the ng server? (ng ?)
17:47kotarakcom.martiansoftware.nailgun.NGServer/main
17:47Jetienthanks
17:47kotarakYou probably want to do this in a separate thread. Haven't tried that manually actually.
17:48kotarakBut it should work... in theory... ;)
18:27hircusanyone here using Netbeans?
18:28ataggartI tried. Gave up.
18:28hircusmy problem is not really with Netbeans+Enclojure, but with trying to use the generated classes from a Java project
18:29hircusI use Enclojure to generate a class (:gen-class) that implements an interface, yet the Java project that uses it claims that that class does not exist
18:29hircus(building using Ant works, though, so obviously the class does exist)
18:30ataggartis the dir where the classes are dumped to in the classpath for netbeans?
18:30ataggartfor the project, I mean
18:31hircusEnclojure creates a JAR, and the other project referenced that JAR, so yes
18:31hircus(Netbeans can actually build the project just fine, since that just triggers an Ant task -- but when editing the code, the part that imported the clojure class is always marked as an error
18:31hircusi.e. the "import com.example.myclojureclass" part
18:32ataggartk, my knowledge has been exhausted. sry
18:32hircusno prob. it's really rather bizarre
19:37dreishchunked branch slows down (reduce + (range 1000000)) by roughly a factor of 10.
19:46hiredmandreish: what about apply?
19:46dreishI think that was worse.
21:11Jonathan-Smithare there any good articles on getting data out of xml/parsed stuff using clojure?
21:12combasait seems that sometimes Slime gets disconnected from the current frame with my clojure file, how can stop slime and then restart from that frame?
21:12combasahmm thats probably more of an emacs question I guess
21:12hiredmanJonathan-Smith: you've seen clojure.xml/parse ?
21:13hiredmanoh
21:13hiredmanxml/parsed is the past tense of clojure.xml/parse then?
21:13Jonathan-Smithyes i've got it turned into a structure of what looks like vectors and maps
21:14Jonathan-Smithjust wondering if there is a simple rule for how to traverse it
21:15hiredmanthere is xml-zip
21:15hiredmanclojure.zip/xml-zip
21:15Jonathan-Smithoh really?
21:15hiredmanyeah
21:15Jonathan-Smithdoes that let you treat it like a tree or something?
21:16hiredmanyeah
21:16hiredmana zipper
21:16hiredmanthere is also some stuff in contrib, and enlive
21:16hiredman(doc xml1->)
21:16clojurebot"clojure.contrib.zip-filter.xml/xml1->;[[loc & preds]]; Returns the first item from loc based on the query predicates given. See xml->"
21:17Chouserdreish: Intersting -- I'm seeing more like x7 slowdown, but chunked is definitely slower than master for that expression.
21:17hiredman~def xml1->
21:18dreishI'd believe x7. I didn't do a very careful analysis.
21:18Jonathan-Smithi think this filter is what i want as i want to extract a set of nodes from the xml
21:22ChouserI really really need to try enlive so that I can authoritatively direct people away from zip-filter.
21:42Jonathan-Smithi get this error:
21:42Jonathan-Smith java.lang.ClassNotFoundException: clojure.contrib.zip-filter.xml (repl-1:8)
21:42Jonathan-Smithwhen trying to use clojure.contrib.zip-filter.xml
21:43Jonathan-Smithi'm using clojure-dev and have looked in my sources and it is there
21:45holmak__You are using Eclipse?
21:46Jonathan-Smithyes
21:46Jonathan-Smithshould i build a new clojure-contrib?
21:46holmak__Hm. You have to make sure clojure-contrib.jar is on the classpath, but I'm not familiar with Eclipse.
21:47holmak__I thought clojure-dev provided clojure.jar and clojure-contrib.jar for you prebuilt, but I may be wrong.
21:48Jonathan-Smithit does, i can see them in the refrenced libraries section
21:50holmak__I can type "(use 'clojure.contrib.zip-filter.xml)" fine at the REPL on the command line, so it's definitely a legitimate library. I don't know what's going wrong in Eclipse.
21:51Jonathan-Smithhmm
21:51Jonathan-Smithi can do that too
21:52Jonathan-Smithhmm
21:53Jonathan-Smithit seems that if i 'use' it it works but if I 'require' it it does not work
21:53Jonathan-Smithnote to self...
21:54holmak__require behaves strangely, I always had weird problems with it
21:54holmak__I think the general recommendation is to stick to :use and :import, or so I've read.
21:55grrrthm I tend to use require so I don't pollute my namespaces
21:55ChouserI've never had an issue with 'require'
21:56ChouserI very much dislike naked use -- it makes it harder to read code because you can see names being used and not know where they're coming from.
21:56Jonathan-Smithis interesting because :require has been working fine with all of the Java libraries i've been been calling
21:57holmak__I just always have awful luck getting Java namespace stuff to work right.
21:57Chouserbut (use '[clojure.contrib.zip-filter.xml :only [xml1->]]) or something is fine.
21:57ChouserJonathan-Smith: :require does do Java libraries -- it's only for Clojure namespaces.
21:57Chouser:import is for Java classes.
21:57Jonathan-Smithooh
21:58Jonathan-Smithi was trying to import clojure.contrib
22:00Chousergah. :require does NOT do Java libraries. sheesh.
22:00ChouserI only forget the word "NOT" when it's really critical
22:19jwinter_Does this logo look familiar to anyone else? http://en.wikipedia.org/wiki/Super_Fresh
22:20MononcQcjwinter, how about http://blog.plover.com/prog/haskell/logo.html
22:21jwinter_heh
22:25emacsenChouser: any idea why w/ sh "find" seems to fail miserably?
22:26Chouser(sh "find" "/tmp") worked fine for me just now.
22:26clojurebotfor is a loop...in Java
22:27grrrt,(doc sh)
22:27clojurebot"clojure.contrib.shell-out/sh;[[& args]]; Passes the given strings to Runtime.exec() to launch a sub-process. Options are :in may be given followed by a String specifying text to be fed to the sub-process's stdin. :out option may be given followed by :bytes or a String. If a String is given, it will be used as a character encoding name (for example \"UTF-8\" or \"ISO-8859-1\") to convert the sub-process's stdout to a Stri
22:27Chouserclojurebot! What's a "Stri"!?
22:28emacsenlol... it just started working... I swear I just used the up arrow in my buffer and now it works
22:29Chouserhm. lovely.
22:29emacsenand now it fails again... maybe it's my inferior lisp
22:32emacsenah... the problem is my side... stupid symlinks... nevermind :)
22:36Chouserwhew