#clojure logs

2009-11-28

00:13technomancythere's no crazy workaround trick to call protected methods from a Java API, is there?
00:15carki think there is
00:15carkusing reflection
00:16_atowall-hack-method
00:16_ato,(doc wall-hack-method)
00:16clojurebot"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)"
00:17carkahwell nice =)
00:19_atobut yeah, it just uses felction to turn off protection
00:21_atoreflection*
00:32technomancyoh that's right; nice
01:55j3ff86whats the quickest way to convert a str to an int in clojure?
01:56_ato,(Integer/parseInt "30")
01:56clojurebot30
01:56j3ff86thanks
01:59piccolinoIs 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?
01:59somnium`anything that implements iterator should be seqable right?
02:00_ato(,doc iterator-seq)
02:00cark,(doc iterator-seq)
02:00clojurebot"([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly."
02:02somnium`thanks
02:02piccolinoAh, ns-resolve, cool.
02:03carkpiccolino: as long as the namespace is loaded, you can refer to functions with fully qualified symbols
02:03piccolinoAh, ns-resolve isn't what I wanted.
02:03piccolinoYeah, I was looking to be able to use things in a namespace that the user has not necessarily imported.
02:04piccolinoBut in the results of a macro.
02:04_atodoes the namespace that the macro is in import it?
02:04piccolinoYes.
02:04piccolinoTbhat's good enough?
02:04_atothen just use syntax quote
02:04_ato,`flatten
02:04clojurebotclojure.contrib.seq-utils/flatten
02:04piccolinoAh, OK, cool.
02:05piccolinoThanks again, _ato.
02:07piccolinoWhy wouldn't regular quote do it?
02:08_ato,'flatten
02:08clojurebotflatten
02:08_atoit doesn't namespace qualify it
02:08_atoof course if you namespace quality it yourself then you'd also be fine:
02:08piccolinoRephrase: does ` return basically the same thing as '? A list?
02:08_ato,'clojure.contrib.seq-utils/flatten
02:08clojurebotclojure.contrib.seq-utils/flatten
02:08_atowhat?
02:08piccolinoErr.
02:08_ato' doesn't return a list
02:09_atoit returns whatever you give it, unevaluated
02:09piccolinoOK, I'm rying to build up a function from pieces of source in a macro.
02:09_ato,`(flatten ~x)
02:09clojurebotjava.lang.Exception: Unable to resolve symbol: x in this context
02:09_ato,`(flatten x)
02:09clojurebot(clojure.contrib.seq-utils/flatten sandbox/x)
02:09_ato,`(defn foo [x] (map inc (flatten x)))
02:09clojurebot(clojure.core/defn sandbox/foo [sandbox/x] (clojure.core/map clojure.core/inc (clojure.contrib.seq-utils/flatten sandbox/x)))
02:11_atosyntax-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.
02:11piccolinoOK, thanks.
02:11piccolinoSorry, I know what I want, I have a hard time expressing it.
02:11_atono worries :)
02:19lgasis 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?
02:21_ato,(partition 3 [:a :a :b :b :b :c :c :d :e :f])
02:21clojurebot((:a :a :b) (:b :b :c) (:c :d :e))
02:21_atolgas: like that?
02:22_ato,(doc partition)
02:22clojurebot"([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."
02:22lgasyes, exactly like that. Also I'm having massive de ja vu right now. I bet I've asked this before.
02:23lgasthanks.
03: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
03:07_atoit'll no doubt break if you have a docstring or something in there but it does the job for me
03:07_atoprobably 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
05:37hamzahey guys, i just updated the clojure-mode from github and now inferior-lisp is not working. Did something changed?
05:43LauJensenMorning gents - Have we got a clever way of calling Dlls from Clojure yet, or am I starting from scratch ?
05:49_atoLauJensen: indeed we do: http://github.com/Chouser/clojure-jna/
05:50LauJensenPerfecto, thanks
06:05hamza`anyone having trouble with clojure-mode and inferior-lisp? cant send
06:05hamza` expressions to buffer using clojure mode but if set the mode to lisp
06:05hamza` mode it works? [13:04]
06:05hamza`
06:09hamza`no one uses? inferior-lisp.. seems like support has been removed.
06:14michaeljaakahi
06:14michaeljaakacode on http://clj-me.cgrand.net/2009/11/18/are-pipe-dreams-made-of-promises/
06:14michaeljaakauses deliver function
06:14_atohamza`: I think most people use SLIME, not inferior-lisp
06:14michaeljaakacan you tell where I can find this function?
06:15_ato~def deliver
06:15hamza`yeah thats what i figured i am making the switch now :) seems that inferior-lisp stuff has been removed..
06:17michaeljaaka_ato: thanks
06:17_atomichaeljaaka: 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
06:18michaeljaakaok
06:18michaeljaakahmm probably using 1.0 since enclojure uses that
06:26_mst_ato: lovely, thanks. I'll have a play with it in the morning
06:42hamza`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?
06:45_atohamza`: are you trying to setup per-project classpaths?
06:46_atoM-x swank-clojure-project is for doing this
06:46hamza`yes pretty much all my projects use the same layout.
06:46_atocreate a lib directory under your project's root and put all the jars you need (including clojure and contrib) in it
06:46_atoput your src under project/src
06:46_atoand then M-x swank-clojure-project to switch between projects
06:47hamza`all the procjects has a lib folder containg the jars, all i need is that lib folder and . under my classpath
06:47hamza`are these dirs preset? or can i change them.
06:47_atonot sure
06:48hamza`M-x swank-clojure-project is not availible?
06:48hamza`only swank-clojure-import shows up?
06:48_atooh
06:48_atosounds like you have an old version of swank-clojure
06:49hamza`used this repo git://github.com/jochu/swank-clojure.git
06:49_atoyeah
06:49_atouse technomancy's
06:49hamza`kk
06:49_atoand not the master branch
06:49_atolooks like the "lein" branch has the latest
06:50hamza`so this one git://github.com/technomancy/swank-clojure.git right?
06:50_atoyeah
06:51_atolooking at the code, you can define a swank-clojure-project-hook to do whatever you like
06:51_atoso you could add ./ to the classpath in it if you want
06:51hamza`ok thanks you
06:51hamza`* thank
06:52_atohttp://github.com/technomancy/swank-clojure/tree/lein
06:54_atohamza`: 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
06:56hamza`for future refenrece how do i check which repo has the lastest? why not merge them in to one?
06:57_atohamza`: I think technomancy basically took over maintaining the project
06:58_atohttp://github.com/technomancy/swank-clojure/network
06:58_ato^ that's how I check which repo and branches the action is happening on. ;-)
06:59hamza`cool thanks,
07:11hamza_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?
07:12_atohamza: weird. So you get the prompt but you can't actually enter anthing at it?
07:13_atothat sounds like an old bug to do with ido-mode. I thought it got fixed though :/
07:13hamzayes its a read only prompt(green nstead of white) enter just makes it grow
07:14_atohamza: 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
07:15_atoI haven't encountered the problem myself (swank-clojure just works fine for me) but I've heard others talking about it
07:15hamzawith ido-mode enabled it worked?
07:16_atoit did? hmm.
07:16_atohttp://github.com/technomancy/swank-clojure/commit/96f8ce3868155916ac987234185e0ce136ff33a5
07:17hamzaok so i need to turn it on :)
07:18_atowell if you're using the lein branch then you shouldn't encounter that problem due to that commit
07:18_atoSo I dunno what's going on
07:19_atoyou did do: git checkout lein
07:19_atoright?
07:19_atosorry, maybe I wasn't clear about what "don't use master" actually meant
07:19_ato;-)
07:19hamzahold on i added as a submodule to my emacs git repo did no check out any branch :) maybe that
07:32hamza_ato: now check out lein branch but lost slime :(
08:40Jomyootanyone knows how to get la-clojure working with intellij beta 9.0?
08:40Jomyooti keep getting "incompatible" no matters what version I try
09:09arjhi
09:10arjnot directly clojure related, but
09:10arjdoes anyone know why java runtime exec has problems with a command like ls <path with space> on linux?
09:12the-kennyarj: files or directory with spaces in the name are evil ;)
09:12the-kennyHowever, I don't know how java handles this
09:12arj:D
09:12the-kennyYou could try to scape it with \
09:13arjit seems like there might be a problem with exec in java
09:13arjlet me try with an array
09:17Jomyootwhere is good guide on getting start with emacs + clojure on a mac?
09:17the-kennyJomyoot: I recommend aquamacs. Setting up clojure and swank-clojure isn't different to any other *nix
09:18Jomyootaquamacs better than regular emacs?
09:19the-kennyIt'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
09:21Jomyootdoes emacs support search in project across multiple files?
09:24arjthe-kenny: cool, array is the trick :)
09:43maaclJomyoot: 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:02technomancyaquamacs 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:22the-kennytechnomancy: Aquamacs is working fine :)
12:51thehcdreamerguys, 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:53thehcdreamerthis is my code: http://pastie.org/718305
12:58arbschtthehcdreamer: return the seq bound to posts by making it the last form to be evaluated in the body
12:59thehcdreamerarbscht: not sure what you mean
12:59arbscht(with-query-results posts ["SELECT ..."] posts)
13:01arbschtthehcdreamer: 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:01thehcdreamerarbscht: I tried that but I got java.sql.SQLException: Operation not allowed after ResultSet closed
13:01thehcdreamerarbscht: thanks for the link
13:02thehcdreamerIt worked, thanks a lot!
13:03arbschtI 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:05LauJensenthehcdreamer, otherwise try (query table1 [row1 row2 row2] (> row1 row2)) using ClojureQL - That'll give you the resultset-seq :)
13:06thehcdreamerLauJensen: I'll try ClojureQL as well, right now I'm just trying to create a blog with compojure to learn the language
13:06LauJensenInteresting
13:08arbschtLauJensen: which wiki are you using for cql online docs? github or gitorious?
13:09LauJensenEverything 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:10arbschtLauJensen: the gitorious home says "Please find detailed documentation in the wiki on github." with a dead link
13:10LauJensenI know - Soon as I have half an hour I'll work my way through the docs and pending merge-requests/patches :)
13:10arbschtah :)
13:11LauJensenLike I've said before, the worst part about OpenSource software is that paid work gets priority :)
13:50maaclthehcdreamer: What happens if you leave out the doseq part?
14:01maaclthehcdreamer: did it work?
14:34thehcdreamermaacl: yes, but the list is still on a format which I'm not able to iterate.
14:34maaclthehcdreamer: is it +
14:34maacl?
14:34thehcdreamerwhat do you mean by + ?
14:34maaclwhat type is it?
14:35thehcdreamermaacl: good question, how can I see? It's my 2nd day in clojure
14:36the-kenny,(class 42)
14:36clojurebotjava.lang.Integer
14:36thehcdreamerblog$fetch_archive_posts__288 where blog is the namespace and fetch_archive_post is the function name
14:36thehcdreamerI guess nothing useful
14:38the-kennyLazy-Seqs and Files/Streams are evil
14:39maaclthehcdreamer: you should get a seq back
14:40thehcdreamermaacl: I should, but that's not the case apparently
14:42maaclthehcdreamer: you can't do a doseq on it ?
14:42thehcdreamermaacl: nope, neither use first for example
14:45maaclthehcdreamer: try inserting a posts at the end of the function
14:50thehcdreamermaacl: it's the same. I'm going to try with ClojureQL
14:51maaclthehcdreamer: like this http://pastie.org/718430
14:52thehcdreamermaacl: that returns a lazy seq
14:53maaclthehcdreamer: well there you go
14:54thehcdreamermaacl: but that doesn't solve the problem. I still can't do anything with it
14:56maaclthehcdreamer: what do you want to do ?
14:56thehcdreamermaacl: iterate in it inside other functions
14:57maaclthehcdreamer: so use doseq, dorun or doall
14:58thehcdreamermaacl: but it still says Don't know how to create ISeq from: blog$fetch_archive_posts__76
14:58thehcdreamerI know, it's weird
14:59maaclcould you post what it is you try to do?
14:59thehcdreamersure
15:01thehcdreamerhttp://pastie.org/718447
15:04Drakesonis there a way to say: (let [current-directory "/foo"] (slurp "bar")) ?
15:04the-kennythehcdreamer: Uhm.. you have to call the function
15:05the-kennythehcdreamer: (first (fetch-archive-posts))
15:05notallamaso 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:05the-kennyDrakeson: I don't think so. As far as I know, it isn't possible to change the current directory in java
15:06thehcdreamerthe-kenny: that still returns clojure.lang.LazySeq cannot be cast to clojure.lang.IFn
15:06thehcdreamerthe-kenny: maacl this is weird. I'm going to try something else, thanks for your patience
15:07Drakesonthe-kenny: what does (System/setProperty "user.dir" x) do? I thought it changes the current directory
15:08slashus2Drakeson: You could try (.getCanonicalPath (java.io.File. ".")) or (System/getProperty "user.dir")
15:10devlinsfduck-streams has a pwd function as well
15:10Drakesonslashus2: I am looking for chdir, not pwd.
15:11the-kennyDrakeson: It's mentioned in the docs for duck-streams that changing the current dir isn't possible.
15:11somnium`Drakeson: might look at c.c.shell-out too
15:12devlinsfDrakeson: 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:14Drakesondevlinsf: are you refering to the :dir option to shell-out/sh ?
15:16devlinsfDrakeson: No, I'm just refering to the general practice of storing information in a Java object, not an immutable clojure one.
15:16thehcdreamerLauJensen: if you are still here, does clojureQL needs a module for derby to build?
15:16LauJensenYou need the driver, which in Derbys case also is the server yes
15:16thehcdreamerok
15:17Drakesondevlinsf: 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:17devlinsfDrakeson: Ah, now I understand
15:17devlinsfDrakeson: Hmmmm....
15:18devlinsfDrakeson: I wrote a filecat function that might do 90% of what you're looking for.
15:19devlinsfDrakeson: http://github.com/francoisdevlin/devlinsf-clojure-utils
15:19devlinsfCheck the file-utils namespace
15:19devlinsfDrakeson: It should be enough for you to get where you're going.
15:21Drakesondevlinsf: I already have a `path' function that I use to create paths. I was looking for a way to get rid of it.
15:21DrakesonNow it seems that I shouldn't.
15:21devlinsfDrakeson: Why not use path to build the macro?
15:22devlinsfShould be easy enough
15:22rlbDoesn'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:23DrakesonI was trying to reduce (slurp (path "bar")) to just (slurp "bar").
15:25devlinsfDrakeson: Yeah, that in particular won't work, because slurp is designed to handle any stream source.
15:27rlbI think sh might need to read the output and write the input in parallel.
15:29devlinsfDrakeson: Could you what the macro would look like?
15:29devlinsfDrakeson: I have this problem frequently, would like to see another approach.
15:30DrakesonI 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:30rlbchouser: 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:31rlbDrakeson: I've mad progress on something that's intended to support a lazy clojure analog to shell pipelines.
15:31rlbi.e. (foo "xargs" "grep" ... :in (foo "find" ...))
15:32Drakesondevlinsf: Currently, I believe the best approach for shell convenience is really a reader macro. maybe it could look like (slurp #/usr/share/foo)
15:33rlbStill some significant unresolved issues, though -- like how best to handle any sub-process failures.
15:33the-kennyDrakeson: # is for regex :p
15:33Drakesonthe-kenny: #"" is regex.
15:33Drakesonthough I don
15:33Drakesonoops
15:33the-kennyDrakeson: I think another symbol would be better.. maybe $ or so
15:34Drakesonthough I don't have any strong feelings for #/foo notation, it is a simple option
15:34devlinsfDrakeson: 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:34devlinsfDrakeson: I need wora.
15:36Drakesondevlinsf: 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:36Drakesondevlinsf: maybe I hate common-lisp's paths too much.
15:36devlinsfDrakeson: Good point
15:39DrakesonAlso, 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:40devlinsfDrakeson: Okay, I gotta go. This is really interesting, though. Put a set of functions & macros together, and post it to the group
15:40devlinsfDrakeson: Happy hacking
15:40Drakeson:)
15:41ChousukeSome way to have namespaced reader macros would be useful I guess.
15:41ChousukeWithout them I doubt Clojure will ever have user definable ones anyway :/
15:43DrakesonChousuke: I miss them, but also I understand the argument against them.
15:43somnium`Chousuke: how hard would it be to add a heredoc based on your reader experience?
15:43Chousukesomnium`: heredoc?
15:43somnium`like """ in python
15:44Chousukeah, right. hm.
15:44ChousukeShouldn't be too difficult I guess.
15:46somnium`they could provide be a poor-man's alternative to reader macros
15:52somnium`-> (perl-in-my-clojure """ $% -> ?#("foo") """)
15:54somnium`I saw a post about an evil hack on the current reader to add reader macros somewhere
15:54hiredman,(pl (↕map (replicate 3 (↕apply vector $ (↕map range $ 10 inc · inc · inc) call · ⌽* $ 10 · call · (⌽+ -2) map)) shuffle)))
15:54clojurebot((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:55hiredmansomnium`: the table is just a private array of IFns
15:55hiredmanand wall-hack-field is in java-utils
15:56chouserrlb: 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:56somnium`hmm, this could make for an interesting variant on clojure golf
15:56chouserbrb
15:59somnium`,(macroexpand '(pl call · ⌽* $ 10))
15:59clojurebot(do (comp call ((uncurry *) 10)))
16:00ChousukeI find that impossible to read but I guess that's just me.
16:00somnium`they speak a strange tongue in these lands
16:01hiredmanChousuke: it is impossible
16:28hamza`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:31efarrarhamza`: 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:32efarraris that possible in your case?
16:39hamza`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:43DrakesonAssume 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:44tcrayfordyou need to do something like ant -Dclojure.jar=$PATHTOCLOJURE.JAR$ when building contrib
16:45hamza`thank you both, yeah it did complain at the beggining must have missed it. it did work with the flag
16:46somnium`Drakeson: you want A/V and B/V ? require will work in that case
16:47somnium`or just 'use and then use 'binding to manipulate A/V from B
16:50Drakesonsomnium`: 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:51Drakesonhow can I avoid wrapping every call to A/foo in a binding statement?
16:52DrakesonI don't necessarily need V to be a ref. Anything else is fine by me.
16:53somnium`its more usual for the root to be a default constant or nil
16:54somnium`with-foo macros/funs that establish bindings usually keep the code from getting verbose
16:55somnium`what exactly is the scoping problem you need to solve?
16:55somnium`in the fns in B and A
16:58DrakesonB 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:58the-kennyDrakeson: Use dynamic scope.. But parameters are the "more functional" way of doing that.
16:59somnium`then in A (def *v* nil) and in B (with-A ...) to establish bindings
16:59somnium`is a common idiom
17:00the-kennyHowever, you have to be careful if you're using threads. (binding)s are thread-local.
17:00Drakesonsomnium`: I wanted to avoid wrapping every call to the fns of A
17:00hiredmanthat doesn't compose very well
17:01somnium`Im thinking of c.c.duckstreams / json
17:05ieuretechnomancy, Mind giving http://github.com/ieure/ports/tree/master/devel/leiningen/ a look-see and making sure I’m not insane?
17:06ieureI wrote a build.xml to bootstrap leiningen with Ant.
17:09technomancyieure: aha. I was wondering why you were messing with XML for this; now I see.
17:09technomancypeeking
17:10Drakeson,boundp
17:10clojurebotjava.lang.Exception: Unable to resolve symbol: boundp in this context
17:10Drakeson,bound?
17:10clojurebotjava.lang.Exception: Unable to resolve symbol: bound? in this context
17:12technomancyieure: while I hesitate to use the word "sane" to describe something that uses both macports and ant, apart from that this looks great. =)
17:12ieuretechnomancy, 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:13ieuretechnomancy, I’d hesitate to describe myself as sane after dealing with MacPorts and Ant. :/
17:13technomancyoh, 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:13qed'lo
17:13Drakesonhow can I check if something is bound?
17:14ieuretechnomancy, Indeed. I’ll just remove that rule, since it’s not needed.
17:14technomancyieure: 1.0.0 won't need any AOTing fwiw
17:16technomancyieure: thanks for taking the time to get this loaded up
17:16ieuretechnomancy, 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:17ieureMy only complaint is that it’s slow, but I think a lot of that is the Java startup overhead.
17:17technomancyieure: 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:18technomancyieure: 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:18technomancyI have a client JVM here, (32-bit) so it's not as painful.
17:19ieureThe startup time isn’t quite that bad for me, but it takes a few seconds for `lein help' to finish.
17:21technomancyieure: 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:23notallamaanyone 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:23ieuretechnomancy, I don’t usually send stuff upstream. The MacPorts dudes are hard to work with.
17:23ieuretechnomancy, 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:24technomancyieure: ah, I have no idea of the politics of that scene. if adding a third-party source is common I will suggest that.
17:24ieuretechnomancy, It’s common for me. I added instructions to the README in my ports repo.
17:27ieureI’ll give it a shot, but it will probably take a while, since it depends on three other new ports.
17:28technomancysure
17:28the-kennyHow 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:30technomancythe-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:31technomancythe-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:31the-kennyhm :(
17:31notallamafound the bug. apparently the type hint was required there.
17:34technomancythe-kenny: are you using clojure 1.0.0 or just an earlier snapshot?
17:34the-kennytechnomancy: I'm using a checkout of the "new"-branch.
17:34the-kennySorry, forgot to mention the "new" earlier.
17:35technomancythe-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:36the-kennytechnomancy: 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:38technomancythe-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:38technomancyif 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:39technomancybut it's a bit convoluted, may not be worth the hassle.
17:42ieuretechnomancy, Okay, all the stuff to get leiningen into MacPorts has been submitted. I’ll let you know when/if it actually happens.
17:42ieureIt’s sort of a pain, you don’t even become a committer until you’ve submitted ports. Makes managing things a pain.
17:45the-kennyhm.. maybe I'll stick to 1.0
17:53the-kennyhttps://gist.github.com/1baa3e3017ffb1a25e91 heh
17:54technomancysee Clojure bug #130. =(
17:54hiredman~ticket #130
17:54clojurebot{: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:55the-kenny:(
17:57technomancythe-kenny: help on individual tasks works luckily
17:57technomancyI suppose I should just disable the summary output till that gets fixed.
17:57the-kennyIt's in the readme, I'll use that.
18:04ieureThey’re pretty self-explanatory.
18:08the-kennytechnomancy: 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:08the-kenny+to
18:09the-kennyOr maybe a special version-string?
18:09_atothe-kenny: put it in under your own group
18:09_atoorg.clojars.the-kenny/clojure-couchdb
18:09_atoor whatever
18:10_atoclojars won't actually let you push to somebody else's group without permission
18:12the-kennyOh I haven't seen the username-part. Thanks, _ato
18:13_atousually 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:19technomancy_ato: is it feasible to pre-populate all the groups from maven central in clojars to prevent squatting?
18:19technomancyany idea how many there are?
18:20technomancyalso: I'm still accidentally squatting org.clojure. =)
18:21_atotechnomancy: 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:23technomancyor screen-scrape http://repo2.maven.org/maven2/
18:23the-kennyhm.. I can't push to clojars@clojars.org, connection refused
18:23_atoyep
18:23technomancyoh right; you still need to walk the tree
18:24_atothe-kenny: hmm working for me. Might you be behind a firewall or something that blocks SSH?
18:24the-kenny_ato: No, definately not.
18:25the-kennyWhoops
18:25the-kennyThere was a typo in the hostname.. sorry
18:29rzezeskiDoes anyone know why the following thread died off? http://groups.google.com/group/clojure/browse_thread/thread/4a456f88681bab9b/2abc59e527c598db?#2abc59e527c598db
18:31the-kennyOhh.. 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_atothe-kenny: did clojars blow up? I should make it validate the version string, it does it for the jar name and group name.
18:32the-kenny_ato: I think it served me a broken .jar
18:33_atooh... like when you specified a dependency with a space in it?
18:33_atoweird. The repository is static so it shouldn't be serving you anything
18:34_atomaybe lein needs some validation there
18:35the-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_atoah
18:35_atoit's probably serving you a 404
18:35_atoand lein is happily downloading it for some reason
18:35the-kennyOh, yeah it does. Prints out some warnings too
18:38the-kennyHah.. leiningen is very cool :)
18:55_mst_ato: further expanding on your modifications: dishevelled.net/elisp/clj-imports.el
18:56_mstmakes 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_mstwith a prefix arg, just creates a standalone (import ...), and I've got a separate "eval namespace" keybinding
18:58_mstalso 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:58technomancy_mst: there's some classpath search in swank-clojure itself now; you can probably just use that
18:59technomancyI'd also be happy to add that elisp to swank-clojure.el if you're interested
18:59_mstah good. I'll try that
18:59_mstyep, go for it
19:05_mstoops, just had to make a small fix to one of the macros
19:05_mstfunny how the last change you make for vanity purposes invariably breaks your code ;)
19:05_ato:D
19:08_ato_mst: looks like the class list in swank is swank.util.class-browse/available-classes
19:08_msttime to finally ugprade my swank I guess :D
19:13notallamais 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_mstmy check out of master doesn't have it
19:30_atolein
19:30_atomaster is very out of date
19:30_mstah right, thanks
19:44_mstok, updated to use that instead. excellent
19:45_mstthe regular expression required to separate the package from the class will haunt me forever :)
19:46chouserrhickey: so, the tickets are closed. what else do you need? got a list of docs that need to be written or anything?
20:02rhickey_chouser: I don't have a list of docs yet. I guess we'll need API docs generated - I
20:03rhickey_d like to use the latest from Tom F. for that
20:04rhickey_chunked seqs need to be integrated somewhere, and transients
20:05rhickey_I need to survey exactly what's new since release - only some things got tickets
20:07notallamai 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:08hiredmanerm
20:09Chousukenotallama: you should get a CA :)
20:09hiredmanwhat is the purpose?
20:10hiredmanto run agent actions on threadpools that are no the send-off or send threadpools?
20:10notallamawell, the purpose i want it for is to send to daemon threads. yeah.
20:15skyboundi 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:16hiredmanskybound: I'd just pass stuff to read-string and eval
20:17hamza`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:18hiredmanhamza`: what is your locale stuff set for?
20:18skyboundhiredman: yes, i found that works nicely; the primary motivation is understanding the java impl of the language
20:19hiredmanI don't see how that helps understand the java implementation
20:20hamza`hiredman: should be us, but stuff i am reading contains german turkish chars..
20:20_ato~def read-string
20:20hiredmanI suggest just going into clojure/src/jvm and rewriting stuff
20:21_atohamza`: construct your own StringReader
20:21_atoand use regular read
20:21hiredmanhamza`: well java's default encoding tries to follow the encoding set in the locale
20:21_atohamza`: I assume the string is okay?
20:21hiredmanso set that to utf-8
20:21hiredmanand be done with the whole mess
20:22_atoread-string shouldn't do anything with encoding, it should happen when you create the string
20:22hiredmanyes
20:23_atohamza`: if you're reading the string from a file or something you may need to specify the encoding when you do the read
20:23hamzai am reading from a file using (read-string (slurp f))
20:24_atoah
20:24_ato,(doc read)
20:24clojurebot"([] [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:24hiredmanhamza`: (System/getProperty "file.encoding")
20:25hamza`hiredman: it is set to MacRoman thats causing it
20:25hiredman:(
20:25hiredmanyeah
20:25hiredmanyou need to fix your locale to use UTF-8
20:26_atoyou could do something like: (read (PushbackReader. (InputStreamReader. (FileInputStream. f) "utf-8")))
20:26_atoor yeah, fix your locale
20:26hiredmanor java -Dfile.encoding=UTF-8
20:27hamza`thank you both...
20:27hiredmanhttp://www.bergek.com/2008/01/31/fix-perl-locale-warning-on-mac-os-x-105/ might be helpful
20:32hiredman~xml
20:32clojurebotXmL is case-sensitive
20:32hiredman~xml
20:32clojurebotxml is like violence; if it's not working, you're not using enough of it.
20:48technomancyso I assume Steve Gilardi's load patch isn't going to make it into 1.1?
20:49rhickey_technomancy: no, nothing of that magnitude is going to be added at this point
20:50technomancyright. 1.1 sounds like just a stabilization checkpoint before the really juicy stuff starts. makes sense.
20:51rhickey_a lot has been done since the release, and yes, this is a good point between major features
20:55notallamarhickey_: 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:56rhickey_notallama: you can wrap the provided factory fn in a fn that does that
21:31rlbchouser: 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:31hiredmanthat can get very task specific very fast
21:31rlbchouser: 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:32rlbhiredman: 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:32rlbif you can push a readable in and a readable out, then you can build much else.
21:33hiredmansure
21:33rlb(I think...)
21:33hiredmanbut sticking it into a flow of sequences, will get task specific
21:33rlbThe 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:34hiredmanis it a readable of xml, json, csv, just lines?
21:35rlbhiredman: 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:35rlbhiredman: 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:36hiredmanuh
21:36hiredmanok
21:37rlbWith the current code, you could do this:
21:37rlb (filter pred (foo "grep" ... :out #(line-seq %1)))
21:38rlbassuming pred filtered for lines -- of course that's not a very smart example.
21:38rlb(redundant, really)
21:40rlbbut (filter pred (foo "grep" ... :out #(token-seq #"\s+" %1))) would allow filter to receive a stream of "words" from the sub-process.
21:41rlbIn the :out function, %1 is stdout, %2 is stderr (right now).
21:41rlbAnyway, I'm not sure I like what I have, I'm just experimenting...
21:42j3ff86I 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_atoj3ff86: 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:44j3ff86yeah partitioning, coll2 would be [[0][1 1 1]]
21:45j3ff86say 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:46j3ff86based on [(0)(1 1 1)]
21:47_atogotcha
21:47_atook
21:47_atohmm
21:51iceyis anyone using technomancy's fork of swank-clojure?
21:52icey(if so, is the new swank-clojure-project worth upgrading for?)
21:52_atoj3ff86: there's a first attempt: http://gist.github.com/244769
21:54j3ff86whoa that works perfectly
21:54_atoicey: swank-clojure-project works really nicely
21:54j3ff86you're a clojure master
21:54j3ff86thanks
21:54icey_ato: did you used to use the old clojure-project that installed with elpa?
21:55iceyi'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_atoicey: ah. no I never used clojure-project. I guess it probably doesn't do anything different
21:55icey_ato: thanks :D
22:19iceyokay... 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:19icey(emacs 23 if it makes a difference)
22:19iceyis there something i need to tweak?
22:20technomancyicey: did you get it from elpa?
22:21technomancythat's a known bug in the completion mechanism that swank-clojure uses. temporary fix is to enable ido-mode. (M-x ido-mode)
22:21iceyno, i installed clojure-mode and swank-clojure directly from git
22:21_atotechnomancy: you really need to do something about that master branch, that's the second person to run into that today
22:21iceyoh, cool, thanks :D (sorry if this is something i should have found via google :/)
22:22technomancy_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:23iceytechnomancy: ido-mode did the trick, thank you sir :D
22:23technomancyicey: trust me, you want ido-mode anyway. =)
22:23_atotechnomancy: or alternatively make another branch the "main" one on github
22:23iceyyeah, i'm a total emacs noob; i'm always happy to take suggestions
22:23technomancyand now jochu gave me commit on his, so I can keep his in sync
22:24iceytotally unrelated, but do any of you guys want a google wave invite?
22:24technomancythough if you're using instructions that link to his, you're *really* out of date. but it never hurts.
22:24technomancy_ato: pushed to master
22:26_atoicey: sure, I wouldn't mind playing with it. ato@meshy.org
22:27icey_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_atoicey: cool, thanks. :-)
23:51somniumalexyk