#clojure log - Nov 28 2009

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:13 technomancy: there's no crazy workaround trick to call protected methods from a Java API, is there?

0:15 cark: i think there is

0:15 using reflection

0:16 _ato: wall-hack-method

0:16 ,(doc wall-hack-method)

0:16 clojurebot: "clojure.contrib.java-utils/wall-hack-method;[[class-name method-name params obj & args]]; Calls a private or protected method. params is a vector of class which correspond to the arguments to the method obj is nil for static methods, the instance object otherwise the method name is given as a symbol or a keyword (something Named)"

0:17 cark: ahwell nice =)

0:19 _ato: but yeah, it just uses felction to turn off protection

0:21 reflection*

0:32 technomancy: oh that's right; nice

1:55 j3ff86: whats the quickest way to convert a str to an int in clojure?

1:56 _ato: ,(Integer/parseInt "30")

1:56 clojurebot: 30

1:56 j3ff86: thanks

1:59 piccolino: Is there some way you can generate a function with a macro that references code in a namespace that the user himself hasn't use/referred?

1:59 somnium`: anything that implements iterator should be seqable right?

2:00 _ato: (,doc iterator-seq)

2:00 cark: ,(doc iterator-seq)

2:00 clojurebot: "([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly."

2:02 somnium`: thanks

2:02 piccolino: Ah, ns-resolve, cool.

2:03 cark: piccolino: as long as the namespace is loaded, you can refer to functions with fully qualified symbols

2:03 piccolino: Ah, ns-resolve isn't what I wanted.

2:03 Yeah, I was looking to be able to use things in a namespace that the user has not necessarily imported.

2:04 But in the results of a macro.

2:04 _ato: does the namespace that the macro is in import it?

2:04 piccolino: Yes.

2:04 Tbhat's good enough?

2:04 _ato: then just use syntax quote

2:04 ,`flatten

2:04 clojurebot: clojure.contrib.seq-utils/flatten

2:04 piccolino: Ah, OK, cool.

2:05 Thanks again, _ato.

2:07 Why wouldn't regular quote do it?

2:08 _ato: ,'flatten

2:08 clojurebot: flatten

2:08 _ato: it doesn't namespace qualify it

2:08 of course if you namespace quality it yourself then you'd also be fine:

2:08 piccolino: Rephrase: does ` return basically the same thing as '? A list?

2:08 _ato: ,'clojure.contrib.seq-utils/flatten

2:08 clojurebot: clojure.contrib.seq-utils/flatten

2:08 _ato: what?

2:08 piccolino: Err.

2:08 _ato: ' doesn't return a list

2:09 it returns whatever you give it, unevaluated

2:09 piccolino: OK, I'm rying to build up a function from pieces of source in a macro.

2:09 _ato: ,`(flatten ~x)

2:09 clojurebot: java.lang.Exception: Unable to resolve symbol: x in this context

2:09 _ato: ,`(flatten x)

2:09 clojurebot: (clojure.contrib.seq-utils/flatten sandbox/x)

2:09 _ato: ,`(defn foo [x] (map inc (flatten x)))

2:09 clojurebot: (clojure.core/defn sandbox/foo [sandbox/x] (clojure.core/map clojure.core/inc (clojure.contrib.seq-utils/flatten sandbox/x)))

2:11 _ato: syntax-quote is just like normal, except that it namespace qualifies all the symbols you give it and it allows for unquoting with ~ and ~@ to insert stuff you actually want evaluated.

2:11 piccolino: OK, thanks.

2:11 Sorry, I know what I want, I have a hard time expressing it.

2:11 _ato: no worries :)

2:19 lgas: is there an easy way to create a lazy sequence that returns a chunk of n items at a time from another sequence? I was thinking I could do a lazy-seq on split-at but I think split-at is strict?

2:21 _ato: ,(partition 3 [:a :a :b :b :b :c :c :d :e :f])

2:21 clojurebot: ((:a :a :b) (:b :b :c) (:c :d :e))

2:21 _ato: lgas: like that?

2:22 ,(doc partition)

2:22 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

2:22 lgas: yes, exactly like that. Also I'm having massive de ja vu right now. I bet I've asked this before.

2:23 thanks.

3:06 _ato: _mst: I hacked your clj-import hack a bit so that it inserts in the ns macro and then recompiles the imports: http://github.com/ato/emacs-starter-kit/blob/ato/ato/clj-import.el

3:07 it'll no doubt break if you have a docstring or something in there but it does the job for me

3:07 probably be nicer to parse the whole ns declaration, sort it, remove duplicates etc, but meh, I'll need to learn some more elisp for that

5:37 hamza: hey guys, i just updated the clojure-mode from github and now inferior-lisp is not working. Did something changed?

5:43 LauJensen: Morning gents - Have we got a clever way of calling Dlls from Clojure yet, or am I starting from scratch ?

5:49 _ato: LauJensen: indeed we do: http://github.com/Chouser/clojure-jna/

5:50 LauJensen: Perfecto, thanks

6:05 hamza`: anyone having trouble with clojure-mode and inferior-lisp? cant send

6:05 expressions to buffer using clojure mode but if set the mode to lisp

6:05 mode it works? [13:04]


6:09 no one uses? inferior-lisp.. seems like support has been removed.

6:14 michaeljaaka: hi

6:14 code on http://clj-me.cgrand.net/2009/11/18/are-pipe-dreams-made-of-promises/

6:14 uses deliver function

6:14 _ato: hamza`: I think most people use SLIME, not inferior-lisp

6:14 michaeljaaka: can you tell where I can find this function?

6:15 _ato: ~def deliver

6:15 hamza`: yeah thats what i figured i am making the switch now :) seems that inferior-lisp stuff has been removed..

6:17 michaeljaaka: _ato: thanks

6:17 _ato: michaeljaaka: you might need to upgrade to use the master branch of Clojure from github if you're using 1.0 or an older git snapshot

6:18 michaeljaaka: ok

6:18 hmm probably using 1.0 since enclojure uses that

6:26 _mst: _ato: lovely, thanks. I'll have a play with it in the morning

6:42 hamza`: gents, i just switched to slime but how can i set a relative class path to it? such as (setq swank-clojure-extra-classpaths (list "./")) does not set the current working directory in my class path?

6:45 _ato: hamza`: are you trying to setup per-project classpaths?

6:46 M-x swank-clojure-project is for doing this

6:46 hamza`: yes pretty much all my projects use the same layout.

6:46 _ato: create a lib directory under your project's root and put all the jars you need (including clojure and contrib) in it

6:46 put your src under project/src

6:46 and then M-x swank-clojure-project to switch between projects

6:47 hamza`: all the procjects has a lib folder containg the jars, all i need is that lib folder and . under my classpath

6:47 are these dirs preset? or can i change them.

6:47 _ato: not sure

6:48 hamza`: M-x swank-clojure-project is not availible?

6:48 only swank-clojure-import shows up?

6:48 _ato: oh

6:48 sounds like you have an old version of swank-clojure

6:49 hamza`: used this repo git://github.com/jochu/swank-clojure.git

6:49 _ato: yeah

6:49 use technomancy's

6:49 hamza`: kk

6:49 _ato: and not the master branch

6:49 looks like the "lein" branch has the latest

6:50 hamza`: so this one git://github.com/technomancy/swank-clojure.git right?

6:50 _ato: yeah

6:51 looking at the code, you can define a swank-clojure-project-hook to do whatever you like

6:51 so you could add ./ to the classpath in it if you want

6:51 hamza`: ok thanks you

6:51 * thank

6:52 _ato: http://github.com/technomancy/swank-clojure/tree/lein

6:54 hamza`: I think most people install swank-clojure with ELPA these days rather than by checking out the github tree. But I know some people prefer installing by hand

6:56 hamza`: for future refenrece how do i check which repo has the lastest? why not merge them in to one?

6:57 _ato: hamza`: I think technomancy basically took over maintaining the project

6:58 http://github.com/technomancy/swank-clojure/network

6:58 ^ that's how I check which repo and branches the action is happening on. ;-)

6:59 hamza`: cool thanks,

7:11 hamza: _ato: now i have swank project but it does not do anything it asks for a project root but does not accept enter or anything?

7:12 _ato: hamza: weird. So you get the prompt but you can't actually enter anthing at it?

7:13 that sounds like an old bug to do with ido-mode. I thought it got fixed though :/

7:13 hamza: yes its a read only prompt(green nstead of white) enter just makes it grow

7:14 _ato: hamza: try turning on ido-mode temporarily (or turning it off if you have it on) with M-x ido-mode and see if that changes anything

7:15 I haven't encountered the problem myself (swank-clojure just works fine for me) but I've heard others talking about it

7:15 hamza: with ido-mode enabled it worked?

7:16 _ato: it did? hmm.

7:16 http://github.com/technomancy/swank-clojure/commit/96f8ce3868155916ac987234185e0ce136ff33a5

7:17 hamza: ok so i need to turn it on :)

7:18 _ato: well if you're using the lein branch then you shouldn't encounter that problem due to that commit

7:18 So I dunno what's going on

7:19 you did do: git checkout lein

7:19 right?

7:19 sorry, maybe I wasn't clear about what "don't use master" actually meant

7:19 ;-)

7:19 hamza: hold on i added as a submodule to my emacs git repo did no check out any branch :) maybe that

7:32 _ato: now check out lein branch but lost slime :(

8:40 Jomyoot: anyone knows how to get la-clojure working with intellij beta 9.0?

8:40 i keep getting "incompatible" no matters what version I try

9:09 arj: hi

9:10 not directly clojure related, but

9:10 does anyone know why java runtime exec has problems with a command like ls <path with space> on linux?

9:12 the-kenny: arj: files or directory with spaces in the name are evil ;)

9:12 However, I don't know how java handles this

9:12 arj: :D

9:12 the-kenny: You could try to scape it with \

9:13 arj: it seems like there might be a problem with exec in java

9:13 let me try with an array

9:17 Jomyoot: where is good guide on getting start with emacs + clojure on a mac?

9:17 the-kenny: Jomyoot: I recommend aquamacs. Setting up clojure and swank-clojure isn't different to any other *nix

9:18 Jomyoot: aquamacs better than regular emacs?

9:19 the-kenny: It's my personal impression, but you can also try both.. If you load slime etc. in your .emacs, it should work in aquamacs and emacs.app

9:21 Jomyoot: does emacs support search in project across multiple files?

9:24 arj: the-kenny: cool, array is the trick :)

9:43 maacl: Jomyoot: I recommend using Emacs (either version) + ELPA ( http://tromey.com/elpa/ ). Use ELPA to install clojure-mode, that will give you all you need.

12:02 technomancy: aquamacs is not technically supported since it's not cross-platform, so things are not well-tested there. but most of the time it should work

12:22 the-kenny: technomancy: Aquamacs is working fine :)

12:51 thehcdreamer: guys, I'm just playing around with clojure and clojure.contrib.sql. I am using with-query-results, and I want to return a list with the result set. However from the documentation I see that with_query_results only evaluate the body argument, so it does not return anything. Anyone know how I can return a list or something similar?

12:53 this is my code: http://pastie.org/718305

12:58 arbscht: thehcdreamer: return the seq bound to posts by making it the last form to be evaluated in the body

12:59 thehcdreamer: arbscht: not sure what you mean

12:59 arbscht: (with-query-results posts ["SELECT ..."] posts)

13:01 thehcdreamer: here is an example where the results are returned as a vector: http://github.com/richhickey/clojure-contrib/blob/3ce0c3bd3178fc8de29d4e22646764aa07583673/src/clojure/contrib/sql/test.clj#L115

13:01 thehcdreamer: arbscht: I tried that but I got java.sql.SQLException: Operation not allowed after ResultSet closed

13:01 arbscht: thanks for the link

13:02 It worked, thanks a lot!

13:03 arbscht: I see, it is a resultset-seq, which won't make sense outside of the c.c.sql context, so you must copy it to a vector or other collection

13:05 LauJensen: thehcdreamer, otherwise try (query table1 [row1 row2 row2] (> row1 row2)) using ClojureQL - That'll give you the resultset-seq :)

13:06 thehcdreamer: LauJensen: I'll try ClojureQL as well, right now I'm just trying to create a blog with compojure to learn the language

13:06 LauJensen: Interesting

13:08 arbscht: LauJensen: which wiki are you using for cql online docs? github or gitorious?

13:09 LauJensen: Everything should be under Gitorious now, but really the best thing to do before we are 1.0, is to get the source and read through the demo common.clj + appropriate backend

13:10 arbscht: LauJensen: the gitorious home says "Please find detailed documentation in the wiki on github." with a dead link

13:10 LauJensen: I know - Soon as I have half an hour I'll work my way through the docs and pending merge-requests/patches :)

13:10 arbscht: ah :)

13:11 LauJensen: Like I've said before, the worst part about OpenSource software is that paid work gets priority :)

13:50 maacl: thehcdreamer: What happens if you leave out the doseq part?

14:01 thehcdreamer: did it work?

14:34 thehcdreamer: maacl: yes, but the list is still on a format which I'm not able to iterate.

14:34 maacl: thehcdreamer: is it +

14:34 ?

14:34 thehcdreamer: what do you mean by + ?

14:34 maacl: what type is it?

14:35 thehcdreamer: maacl: good question, how can I see? It's my 2nd day in clojure

14:36 the-kenny: ,(class 42)

14:36 clojurebot: java.lang.Integer

14:36 thehcdreamer: blog$fetch_archive_posts__288 where blog is the namespace and fetch_archive_post is the function name

14:36 I guess nothing useful

14:38 the-kenny: Lazy-Seqs and Files/Streams are evil

14:39 maacl: thehcdreamer: you should get a seq back

14:40 thehcdreamer: maacl: I should, but that's not the case apparently

14:42 maacl: thehcdreamer: you can't do a doseq on it ?

14:42 thehcdreamer: maacl: nope, neither use first for example

14:45 maacl: thehcdreamer: try inserting a posts at the end of the function

14:50 thehcdreamer: maacl: it's the same. I'm going to try with ClojureQL

14:51 maacl: thehcdreamer: like this http://pastie.org/718430

14:52 thehcdreamer: maacl: that returns a lazy seq

14:53 maacl: thehcdreamer: well there you go

14:54 thehcdreamer: maacl: but that doesn't solve the problem. I still can't do anything with it

14:56 maacl: thehcdreamer: what do you want to do ?

14:56 thehcdreamer: maacl: iterate in it inside other functions

14:57 maacl: thehcdreamer: so use doseq, dorun or doall

14:58 thehcdreamer: maacl: but it still says Don't know how to create ISeq from: blog$fetch_archive_posts__76

14:58 I know, it's weird

14:59 maacl: could you post what it is you try to do?

14:59 thehcdreamer: sure

15:01 http://pastie.org/718447

15:04 Drakeson: is there a way to say: (let [current-directory "/foo"] (slurp "bar")) ?

15:04 the-kenny: thehcdreamer: Uhm.. you have to call the function

15:05 thehcdreamer: (first (fetch-archive-posts))

15:05 notallama: so i noticed that if you start a thread with future or send/send-off, the program won't end on its own. is there a way to make some sort of weak thread that doesn't do that?

15:05 the-kenny: Drakeson: I don't think so. As far as I know, it isn't possible to change the current directory in java

15:06 thehcdreamer: the-kenny: that still returns clojure.lang.LazySeq cannot be cast to clojure.lang.IFn

15:06 the-kenny: maacl this is weird. I'm going to try something else, thanks for your patience

15:07 Drakeson: the-kenny: what does (System/setProperty "user.dir" x) do? I thought it changes the current directory

15:08 slashus2: Drakeson: You could try (.getCanonicalPath (java.io.File. ".")) or (System/getProperty "user.dir")

15:10 devlinsf: duck-streams has a pwd function as well

15:10 Drakeson: slashus2: I am looking for chdir, not pwd.

15:11 the-kenny: Drakeson: It's mentioned in the docs for duck-streams that changing the current dir isn't possible.

15:11 somnium`: Drakeson: might look at c.c.shell-out too

15:12 devlinsf: Drakeson: I wouldn't recommend trying to change the current directory. It doesn't fit into the "clojure way" of doing things. Instead, you might want to use a ref or and agent.

15:14 Drakeson: devlinsf: are you refering to the :dir option to shell-out/sh ?

15:16 devlinsf: Drakeson: No, I'm just refering to the general practice of storing information in a Java object, not an immutable clojure one.

15:16 thehcdreamer: LauJensen: if you are still here, does clojureQL needs a module for derby to build?

15:16 LauJensen: You need the driver, which in Derbys case also is the server yes

15:16 thehcdreamer: ok

15:17 Drakeson: devlinsf: I don't actually want to "change" it. I want to bind it to something else in a scope. I am looking for a (with-current-dir "/foo" (do stuff))

15:17 devlinsf: Drakeson: Ah, now I understand

15:17 Drakeson: Hmmmm....

15:18 Drakeson: I wrote a filecat function that might do 90% of what you're looking for.

15:19 Drakeson: http://github.com/francoisdevlin/devlinsf-clojure-utils

15:19 Check the file-utils namespace

15:19 Drakeson: It should be enough for you to get where you're going.

15:21 Drakeson: devlinsf: I already have a `path' function that I use to create paths. I was looking for a way to get rid of it.

15:21 Now it seems that I shouldn't.

15:21 devlinsf: Drakeson: Why not use path to build the macro?

15:22 Should be easy enough

15:22 rlb: Doesn't shell-out's sh run the risk of blocking forever when it tries to print the entire input string to the sub-process's standard input (before reading any output)?

15:23 Drakeson: I was trying to reduce (slurp (path "bar")) to just (slurp "bar").

15:25 devlinsf: Drakeson: Yeah, that in particular won't work, because slurp is designed to handle any stream source.

15:26 * Drakeson wishes clojure gets a path reader macro.

15:27 rlb: I think sh might need to read the output and write the input in parallel.

15:29 devlinsf: Drakeson: Could you what the macro would look like?

15:29 Drakeson: I have this problem frequently, would like to see another approach.

15:30 Drakeson: I think clojure could get a whole lot of shell related improvements. One day you could (use 'sh), and start doing "shell"ish stuff in a clojure repl.

15:30 rlb: chouser: I might be able to help with that if you think it sounds likely. (I've been working on a related cmd that allows lazy sub-process sequences. Some of the code might transfer.)

15:31 Drakeson: I've mad progress on something that's intended to support a lazy clojure analog to shell pipelines.

15:31 i.e. (foo "xargs" "grep" ... :in (foo "find" ...))

15:32 Drakeson: devlinsf: Currently, I believe the best approach for shell convenience is really a reader macro. maybe it could look like (slurp #/usr/share/foo)

15:33 rlb: Still some significant unresolved issues, though -- like how best to handle any sub-process failures.

15:33 the-kenny: Drakeson: # is for regex :p

15:33 Drakeson: the-kenny: #"" is regex.

15:33 though I don

15:33 oops

15:33 the-kenny: Drakeson: I think another symbol would be better.. maybe $ or so

15:34 Drakeson: though I don't have any strong feelings for #/foo notation, it is a simple option

15:34 devlinsf: Drakeson: The problem I have with that is that it is unix centric. I think a good path function should take a list, hide away the os

15:34 Drakeson: I need wora.

15:36 Drakeson: devlinsf: I have a bad feeling when I hear platform independent path. paths themselves are really platform dependent. it just handles the separator and some other tiny issues.

15:36 devlinsf: maybe I hate common-lisp's paths too much.

15:36 devlinsf: Drakeson: Good point

15:39 Drakeson: Also, I think a namespace that can be called clojure's shell would useful to many. That needs a bunch of convenient syntatic sugar to be really a viable option.

15:40 devlinsf: Drakeson: Okay, I gotta go. This is really interesting, though. Put a set of functions & macros together, and post it to the group

15:40 Drakeson: Happy hacking

15:40 Drakeson: :)

15:41 Chousuke: Some way to have namespaced reader macros would be useful I guess.

15:41 Without them I doubt Clojure will ever have user definable ones anyway :/

15:43 Drakeson: Chousuke: I miss them, but also I understand the argument against them.

15:43 somnium`: Chousuke: how hard would it be to add a heredoc based on your reader experience?

15:43 Chousuke: somnium`: heredoc?

15:43 somnium`: like """ in python

15:44 Chousuke: ah, right. hm.

15:44 Shouldn't be too difficult I guess.

15:46 somnium`: they could provide be a poor-man's alternative to reader macros

15:52 -> (perl-in-my-clojure """ $% -> ?#("foo") """)

15:54 I saw a post about an evil hack on the current reader to add reader macros somewhere

15:54 hiredman: ,(pl (↕map (replicate 3 (↕apply vector $ (↕map range $ 10 inc · inc · inc) call · ⌽* $ 10 · call · (⌽+ -2) map)) shuffle)))

15:54 clojurebot: ((20 90 70 10 40 30 100 60 50 80) (60 70 20 100 30 50 10 80 40 90) (60 80 30 20 100 70 90 50 10 40))

15:55 hiredman: somnium`: the table is just a private array of IFns

15:55 and wall-hack-field is in java-utils

15:56 chouser: rlb: I'd welcome a shell-out patch as long as it is careful to keep the burden on the user low, while maintaining correct behavoir as far as cleaning up stream and process resources.

15:56 somnium`: hmm, this could make for an interesting variant on clojure golf

15:56 chouser: brb

15:59 somnium`: ,(macroexpand '(pl call · ⌽* $ 10))

15:59 clojurebot: (do (comp call ((uncurry *) 10)))

16:00 Chousuke: I find that impossible to read but I guess that's just me.

16:00 somnium`: they speak a strange tongue in these lands

16:01 hiredman: Chousuke: it is impossible

16:28 hamza`: guys, i just updated clojure and contrib today when i try to use clojure.contrib.pprint, i started getting java.lang.ClassNotFoundException: clojure.contrib.pprint.PrettyWriter... did something removed?

16:31 efarrar: hamza`: i got that same problem once when i built clojure-contrib.jar but forgot to point it to my clojure.jar when i built it

16:32 is that possible in your case?

16:39 hamza`: efarrar: clojura.jar was in my lib folder and it did not complain about not finding it. doesn't it complaint in that case?

16:43 Drakeson: Assume I have namespaces `A' and `B'. Namespace A defines functions that depend on a global variable `V' in A (right now it is a ref, actually). How could namespace B `use' or `require' A, while binding a different value for V?

16:44 tcrayford: you need to do something like ant -Dclojure.jar=$PATHTOCLOJURE.JAR$ when building contrib

16:45 hamza`: thank you both, yeah it did complain at the beggining must have missed it. it did work with the flag

16:46 somnium`: Drakeson: you want A/V and B/V ? require will work in that case

16:47 or just 'use and then use 'binding to manipulate A/V from B

16:50 Drakeson: somnium`: A doesn't know about B. B requires A. imagine A.clj: (ns A) (def V (ref {:a 1})) (defn foo [x] (get @V x)). B.clj: (ns B (:require A)). (binding [A/V (ref {:a 2})] (A/foo :a))

16:51 how can I avoid wrapping every call to A/foo in a binding statement?

16:52 I don't necessarily need V to be a ref. Anything else is fine by me.

16:53 somnium`: its more usual for the root to be a default constant or nil

16:54 with-foo macros/funs that establish bindings usually keep the code from getting verbose

16:55 what exactly is the scoping problem you need to solve?

16:55 in the fns in B and A

16:58 Drakeson: B wants to use fns from A. Those fns depend on a certain value that should be local to the consumer of A (i.e., local to B). So, A should be designed in a way to have "virtual" variables that the consumer of library A should set for itself.

16:58 the-kenny: Drakeson: Use dynamic scope.. But parameters are the "more functional" way of doing that.

16:59 somnium`: then in A (def *v* nil) and in B (with-A ...) to establish bindings

16:59 is a common idiom

17:00 the-kenny: However, you have to be careful if you're using threads. (binding)s are thread-local.

17:00 Drakeson: somnium`: I wanted to avoid wrapping every call to the fns of A

17:00 hiredman: that doesn't compose very well

17:01 somnium`: Im thinking of c.c.duckstreams / json

17:05 ieure: technomancy, Mind giving http://github.com/ieure/ports/tree/master/devel/leiningen/ a look-see and making sure I’m not insane?

17:06 I wrote a build.xml to bootstrap leiningen with Ant.

17:09 technomancy: ieure: aha. I was wondering why you were messing with XML for this; now I see.

17:09 peeking

17:10 Drakeson: ,boundp

17:10 clojurebot: java.lang.Exception: Unable to resolve symbol: boundp in this context

17:10 Drakeson: ,bound?

17:10 clojurebot: java.lang.Exception: Unable to resolve symbol: bound? in this context

17:12 technomancy: ieure: while I hesitate to use the word "sane" to describe something that uses both macports and ant, apart from that this looks great. =)

17:12 ieure: technomancy, Yeah. I really don’t have much idea what I’m doing, but it seems to install okay, and I built swank-clojure with it just fine.

17:13 technomancy, I’d hesitate to describe myself as sane after dealing with MacPorts and Ant. :/

17:13 technomancy: oh, there is one thing. the "dist" target seems to still have some swank-clojure strings left in; I suspect those need to be replaced.

17:13 qed: 'lo

17:13 Drakeson: how can I check if something is bound?

17:14 ieure: technomancy, Indeed. I’ll just remove that rule, since it’s not needed.

17:14 technomancy: ieure: 1.0.0 won't need any AOTing fwiw

17:16 ieure: thanks for taking the time to get this loaded up

17:16 ieure: technomancy, No problem. Thanks for leiningen. The Java tool issue was a huge stumbling block for me, a big reason why I never wrote anything substantial in Clojure.

17:17 My only complaint is that it’s slow, but I think a lot of that is the Java startup overhead.

17:17 technomancy: ieure: I was reading back to when I was just getting started a year ago, and it amused me to note that I was complaining about the lack of dependency management within an hour of starting. =)

17:18 ieure: danlarkin is working on integrating the -Xbootclasspath option to leiningen, which cuts startup time from ~5s to ~1.9 on his OS X box.

17:18 I have a client JVM here, (32-bit) so it's not as painful.

17:19 ieure: The startup time isn’t quite that bad for me, but it takes a few seconds for `lein help' to finish.

17:20 * the-kenny will try leiningen now

17:21 technomancy: ieure: so as soon as this stuff gets merged upstream to some macports master server then folks will be able to use it? how long does that typically take?

17:23 notallama: anyone want to help debug this? http://paste.lisp.org/display/91218 it prints nil, but it should print 1. if i use a literal instead of *daemon-pool*, it works fine. (it needs to be a def, though. this is just a minimal example)

17:23 ieure: technomancy, I don’t usually send stuff upstream. The MacPorts dudes are hard to work with.

17:23 technomancy, I just have people clone my ports and add them as a source to their local install. But if you think it’s worthwhile, I’ll try to get it in the official repo.

17:24 technomancy: ieure: ah, I have no idea of the politics of that scene. if adding a third-party source is common I will suggest that.

17:24 ieure: technomancy, It’s common for me. I added instructions to the README in my ports repo.

17:27 I’ll give it a shot, but it will probably take a while, since it depends on three other new ports.

17:28 technomancy: sure

17:28 the-kenny: How can I use lein with my own clojure.jar? It seems like it pulls a precompiled version which doesn't matches my .jar (RestFn-errors)

17:30 technomancy: the-kenny: unfortunately right now it's pretty tricky to use with a different clojure version. clojure 1.0 is not an option, though I want to make sure it is by the time we release leiningen 1.0.0.

17:31 the-kenny: you could try recompiling leiningen with your earlier build of the 1.1.0 snapshot, but I don't know if that would work.

17:31 the-kenny: hm :(

17:31 notallama: found the bug. apparently the type hint was required there.

17:34 technomancy: the-kenny: are you using clojure 1.0.0 or just an earlier snapshot?

17:34 the-kenny: technomancy: I'm using a checkout of the "new"-branch.

17:34 Sorry, forgot to mention the "new" earlier.

17:35 technomancy: the-kenny: aha. didn't realize there would be breakage there, but it doesn't surprise me. I guess that's just more incentive for us to support multiple clojure versions asap. sorry. =\

17:36 the-kenny: technomancy: It's a problem with every .jar for almost every new checkout. I think the .jar for leiningen should be built locally with a specified clojure.jar

17:38 technomancy: the-kenny: actually, leiningen 1.0.0-SNAPSHOT works without AOT now, which should solve the problem. but it doesn't have a command to build a standalone jar with .clj files only.

17:38 if you symlink lein from your checkout to your $PATH and just don't run compile on leiningen itself, it would probably do the trick.

17:39 but it's a bit convoluted, may not be worth the hassle.

17:42 ieure: technomancy, Okay, all the stuff to get leiningen into MacPorts has been submitted. I’ll let you know when/if it actually happens.

17:42 It’s sort of a pain, you don’t even become a committer until you’ve submitted ports. Makes managing things a pain.

17:45 the-kenny: hm.. maybe I'll stick to 1.0

17:53 https://gist.github.com/1baa3e3017ffb1a25e91 heh

17:54 technomancy: see Clojure bug #130. =(

17:54 hiredman: ~ticket #130

17:54 clojurebot: {:url http://tinyurl.com/ndkovn, :summary "Namespace metadata lost in AOT compile", :status :new, :priority :normal, :created-on "2009-06-19T04:47:33+00:00"}

17:55 the-kenny: :(

17:57 technomancy: the-kenny: help on individual tasks works luckily

17:57 I suppose I should just disable the summary output till that gets fixed.

17:57 the-kenny: It's in the readme, I'll use that.

18:04 ieure: They’re pretty self-explanatory.

18:08 the-kenny: technomancy: How I am supposed handle forks of other projects which are already in clojars? For example: I have a fork of clojure-couchdb with some breaking changes. Should I push a version with a custom package?

18:08 +to

18:09 Or maybe a special version-string?

18:09 _ato: the-kenny: put it in under your own group

18:09 org.clojars.the-kenny/clojure-couchdb

18:09 or whatever

18:10 clojars won't actually let you push to somebody else's group without permission

18:12 the-kenny: Oh I haven't seen the username-part. Thanks, _ato

18:13 _ato: usually projects that your own or officially maintain sould go under short name: just "clojure-couchdb" and other people's ones you've forked or leininezed should go under a custom group. Incanter's stuck some of its dependencies that weren't in maven central under: incanter/dependency-name, which is also fine.

18:19 technomancy: _ato: is it feasible to pre-populate all the groups from maven central in clojars to prevent squatting?

18:19 any idea how many there are?

18:20 also: I'm still accidentally squatting org.clojure. =)

18:21 _ato: technomancy: yeah, I'm intending to do that. Theres' probably a couple of thousand. I couldn't find any API or anything for maven central but they do provide FTP access, so I might just write a script to walk the directory tree

18:23 technomancy: or screen-scrape http://repo2.maven.org/maven2/

18:23 the-kenny: hm.. I can't push to clojars@clojars.org, connection refused

18:23 _ato: yep

18:23 technomancy: oh right; you still need to walk the tree

18:24 _ato: the-kenny: hmm working for me. Might you be behind a firewall or something that blocks SSH?

18:24 the-kenny: _ato: No, definately not.

18:25 Whoops

18:25 There was a typo in the hostname.. sorry

18:29 rzezeski: Does anyone know why the following thread died off? http://groups.google.com/group/clojure/browse_thread/thread/4a456f88681bab9b/2abc59e527c598db?#2abc59e527c598db

18:31 the-kenny: Ohh.. just had a small but bad error.. I had a " " too much in the version-string in the :dependencies-section... causes some strange errors

18:32 _ato: the-kenny: did clojars blow up? I should make it validate the version string, it does it for the jar name and group name.

18:32 the-kenny: _ato: I think it served me a broken .jar

18:33 _ato: oh... like when you specified a dependency with a space in it?

18:33 weird. The repository is static so it shouldn't be serving you anything

18:34 maybe lein needs some validation there

18:35 the-kenny: _ato: Yeah, try to add a space to the end of the "1.1.0-bla"-thing for clojure. clojars will serve a .jar with only 4kb

18:35 _ato: ah

18:35 it's probably serving you a 404

18:35 and lein is happily downloading it for some reason

18:35 the-kenny: Oh, yeah it does. Prints out some warnings too

18:38 Hah.. leiningen is very cool :)

18:55 _mst: _ato: further expanding on your modifications: dishevelled.net/elisp/clj-imports.el

18:56 makes it insert into your (ns ...), adding an :import if it needs one, and cleans up the import list once it's done that

18:57 _ato: _mst: awesome! :)

18:57 _mst: with a prefix arg, just creates a standalone (import ...), and I've got a separate "eval namespace" keybinding

18:58 also changed my user.clj to: http://dishevelled.net/user.clj. Now it generates the class list once (lazily) on startup. makes the import process instantaneous, which is nice :)

18:58 technomancy: _mst: there's some classpath search in swank-clojure itself now; you can probably just use that

18:59 I'd also be happy to add that elisp to swank-clojure.el if you're interested

18:59 _mst: ah good. I'll try that

18:59 yep, go for it

19:05 oops, just had to make a small fix to one of the macros

19:05 funny how the last change you make for vanity purposes invariably breaks your code ;)

19:05 _ato: :D

19:08 _mst: looks like the class list in swank is swank.util.class-browse/available-classes

19:08 _mst: time to finally ugprade my swank I guess :D

19:13 notallama: is there a way to proxy a private inner class?

19:28 _mst: _ato: hm, which branch of swank-clojure are you running to get swank.util.class-browse?

19:28 my check out of master doesn't have it

19:30 _ato: lein

19:30 master is very out of date

19:30 _mst: ah right, thanks

19:44 ok, updated to use that instead. excellent

19:45 the regular expression required to separate the package from the class will haunt me forever :)

19:46 chouser: rhickey: so, the tickets are closed. what else do you need? got a list of docs that need to be written or anything?

20:02 rhickey_: chouser: I don't have a list of docs yet. I guess we'll need API docs generated - I

20:03 d like to use the latest from Tom F. for that

20:04 chunked seqs need to be integrated somewhere, and transients

20:05 I need to survey exactly what's new since release - only some things got tickets

20:07 notallama: i just made a patch to add a thread pool argument to agent dispatch (in the java class). i don't have a contributor agreement, thoguh. should i post it in the google group, or what? and does anyone other than me want this patch?

20:08 hiredman: erm

20:09 Chousuke: notallama: you should get a CA :)

20:09 hiredman: what is the purpose?

20:10 to run agent actions on threadpools that are no the send-off or send threadpools?

20:10 notallama: well, the purpose i want it for is to send to daemon threads. yeah.

20:15 skybound: i am trying to learn how to make calls from java using the clojure.lang API; does this: http://pastebin.com/d6cfc7056 look sensible? any obvious mistakes?

20:16 hiredman: skybound: I'd just pass stuff to read-string and eval

20:17 hamza`: is there a way to choose an encoding for read-string i am reading a utf-8 file and non ascii chars are garbaled?

20:18 hiredman: hamza`: what is your locale stuff set for?

20:18 skybound: hiredman: yes, i found that works nicely; the primary motivation is understanding the java impl of the language

20:19 hiredman: I don't see how that helps understand the java implementation

20:20 hamza`: hiredman: should be us, but stuff i am reading contains german turkish chars..

20:20 _ato: ~def read-string

20:20 hiredman: I suggest just going into clojure/src/jvm and rewriting stuff

20:21 _ato: hamza`: construct your own StringReader

20:21 and use regular read

20:21 hiredman: hamza`: well java's default encoding tries to follow the encoding set in the locale

20:21 _ato: hamza`: I assume the string is okay?

20:21 hiredman: so set that to utf-8

20:21 and be done with the whole mess

20:22 _ato: read-string shouldn't do anything with encoding, it should happen when you create the string

20:22 hiredman: yes

20:23 _ato: hamza`: if you're reading the string from a file or something you may need to specify the encoding when you do the read

20:23 hamza: i am reading from a file using (read-string (slurp f))

20:24 _ato: ah

20:24 ,(doc read)

20:24 clojurebot: "([] [stream] [stream eof-error? eof-value] [stream eof-error? eof-value recursive?]); Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee. stream defaults to the current value of *in* ."

20:24 hiredman: hamza`: (System/getProperty "file.encoding")

20:25 hamza`: hiredman: it is set to MacRoman thats causing it

20:25 hiredman: :(

20:25 yeah

20:25 you need to fix your locale to use UTF-8

20:26 _ato: you could do something like: (read (PushbackReader. (InputStreamReader. (FileInputStream. f) "utf-8")))

20:26 or yeah, fix your locale

20:26 hiredman: or java -Dfile.encoding=UTF-8

20:27 hamza`: thank you both...

20:27 hiredman: http://www.bergek.com/2008/01/31/fix-perl-locale-warning-on-mac-os-x-105/ might be helpful

20:32 ~xml

20:32 clojurebot: XmL is case-sensitive

20:32 hiredman: ~xml

20:32 clojurebot: xml is like violence; if it's not working, you're not using enough of it.

20:48 technomancy: so I assume Steve Gilardi's load patch isn't going to make it into 1.1?

20:49 rhickey_: technomancy: no, nothing of that magnitude is going to be added at this point

20:50 technomancy: right. 1.1 sounds like just a stabilization checkpoint before the really juicy stuff starts. makes sense.

20:51 rhickey_: a lot has been done since the release, and yes, this is a good point between major features

20:55 notallama: rhickey_: i was playing around with deftypes, and i noticed one place that structs still have an advantage: structs can take ferwer args than they have fields. would it be possible to do the same with types, and have the remaining fields be nil?

20:56 rhickey_: notallama: you can wrap the provided factory fn in a fn that does that

21:31 rlb: chouser: I might want to talk to you about it then -- the function I was working on is a bit different. The intent is to be able to stick processes into normal clojure sequences (and function compositions), i.e. find -> xargs-grep -> partition -> filter -> ...

21:31 hiredman: that can get very task specific very fast

21:31 rlb: chouser: though I'll see if I can take a part of that to and provide safer (assuming I'm right about the risk) input.

21:32 hiredman: at a minumum I just want a way to run a sub-process, feeding it input from a readable (or seq) and routing its output to a readable.

21:32 if you can push a readable in and a readable out, then you can build much else.

21:33 hiredman: sure

21:33 rlb: (I think...)

21:33 hiredman: but sticking it into a flow of sequences, will get task specific

21:33 rlb: The tricky part is that you have to use a thread internally to feed the readable to the sub-process (to avoid blocking), and you want to be careful about exit statuses (somehow).

21:34 hiredman: is it a readable of xml, json, csv, just lines?

21:35 rlb: hiredman: the thought was that it was by default just a sequence of characters from standard output, but you can change that, and of course you can use adapters like line-seq (or a token-seq I wrote that uses Scanner) to modify the output as you pass it along.

21:35 hiredman: the main impetus initially, and the key thing, is just that there's no easy way to run a process that needs lazy input and output.

21:36 hiredman: uh

21:36 ok

21:37 rlb: With the current code, you could do this:

21:37 (filter pred (foo "grep" ... :out #(line-seq %1)))

21:38 assuming pred filtered for lines -- of course that's not a very smart example.

21:38 (redundant, really)

21:40 but (filter pred (foo "grep" ... :out #(token-seq #"\s+" %1))) would allow filter to receive a stream of "words" from the sub-process.

21:41 In the :out function, %1 is stdout, %2 is stderr (right now).

21:41 Anyway, I'm not sure I like what I have, I'm just experimenting...

21:42 j3ff86: I got a question, say i have 2 collections, coll1 [1 2 3 4] and coll2 [0 1 1 1], and i want to map the structure of coll2 on to coll1 so a function that takes both would return [[1][2 3 4]], does anyone have an idea how i could do that?

21:44 _ato: j3ff86: can you explain more what "map the structure" means? maybe some more examples? Are you just partitioning coll1 whenever there's a new value in coll2 or do the numbers in coll2 actually have some meaning?

21:44 j3ff86: yeah partitioning, coll2 would be [[0][1 1 1]]

21:45 say i have a set of x y points, [[1 2][3 4][5 6]], i want to group them like this: [[[1 2]][[3 4][5 6]]]

21:46 based on [(0)(1 1 1)]

21:47 _ato: gotcha

21:47 ok

21:47 hmm

21:51 icey: is anyone using technomancy's fork of swank-clojure?

21:52 (if so, is the new swank-clojure-project worth upgrading for?)

21:52 _ato: j3ff86: there's a first attempt: http://gist.github.com/244769

21:54 j3ff86: whoa that works perfectly

21:54 _ato: icey: swank-clojure-project works really nicely

21:54 j3ff86: you're a clojure master

21:54 thanks

21:54 icey: _ato: did you used to use the old clojure-project that installed with elpa?

21:55 i'm just asking because i'm weak on emacs, and i get nervous making changes without knowing if it's worthwhile. elpa has never worked well for me

21:55 _ato: icey: ah. no I never used clojure-project. I guess it probably doesn't do anything different

21:55 icey: _ato: thanks :D

22:19 okay... noob emacs question. I'm trying to run the new swank-clojure-project and when it asks me for the path to my project, hitting enter just creates a newline in the prompt instead of accepting it.

22:19 (emacs 23 if it makes a difference)

22:19 is there something i need to tweak?

22:20 technomancy: icey: did you get it from elpa?

22:21 that's a known bug in the completion mechanism that swank-clojure uses. temporary fix is to enable ido-mode. (M-x ido-mode)

22:21 icey: no, i installed clojure-mode and swank-clojure directly from git

22:21 _ato: technomancy: you really need to do something about that master branch, that's the second person to run into that today

22:21 icey: oh, cool, thanks :D (sorry if this is something i should have found via google :/)

22:22 technomancy: _ato: yeah... I know. I've been reluctant because M-x clojure-install pulls from master, but that has been deprecated now, so I will bite the bullet

22:23 icey: technomancy: ido-mode did the trick, thank you sir :D

22:23 technomancy: icey: trust me, you want ido-mode anyway. =)

22:23 _ato: technomancy: or alternatively make another branch the "main" one on github

22:23 icey: yeah, i'm a total emacs noob; i'm always happy to take suggestions

22:23 technomancy: and now jochu gave me commit on his, so I can keep his in sync

22:24 icey: totally unrelated, but do any of you guys want a google wave invite?

22:24 technomancy: though if you're using instructions that link to his, you're *really* out of date. but it never hurts.

22:24 _ato: pushed to master

22:26 _ato: icey: sure, I wouldn't mind playing with it. ato@meshy.org

22:27 icey: _ato: cool, I added you to the list; I'm not sure how long it takes for them to get sent out these days. I've seen anywhere from 24 hours to 10 days for them to go through

22:27 _ato: icey: cool, thanks. :-)

23:51 somnium: alexyk

Logging service provided by n01se.net