#clojure logs

2010-08-21

00:00bortreblooking at my problem more, it's actually when I call .start rather than .run where the thread fails to print to thr repl
00:00ninjuddhiredman: it &env the variables defined at macro expansion time?
00:00ninjuddbortreb: try (let [temp *out*] (.start (Thread. (fn [] (binding [*out* temp] (println "hi"))))))
00:02bortrebninjudd: nope --- it still prints to the swank terminal with binding
00:02ninjudds/it/is/
00:02dsantiagoI see that contrib.java-utils has marked as-str as deprecated in 1.2. I can't seem to google up a reason or replacement for this... does anyone know why it shouldn't be used?
00:03woobyninjudd: http://j.mp/cF4mNm, the trick is bound-fn
00:04ninjuddbortreb: hmm, i'm testing with cake.. i can spin up swank and see if the behavior is any different
00:04woobybortreb rather
00:06ninjuddbortreb: hmm, i just tested with swank. if i don't bind, it prints in the terminal. if i do, it prints in emacs
00:07bortrebwooby: using bound-fn works perfectly, thanks! but, why does closing over *out* and setting the thread-local copy to the one from the repl not work?
00:07phaerclojure.contrib.sql/insert-records excepts some maps. I'd like to give it some records (defrecord...) which implement IPersistentMap according to (map? record). Shouldn't that be enough for sql/insert-records?
00:07ninjuddwooby: awesome. i didn't know about bound-fn
00:09woobybortreb: because your *out* binding isn't copied to the function's thread, which is different
00:09woobyninjudd: np :)
00:10ninjuddwooby: strange that binding worked for me but not bortreb
00:10ninjuddeither way though, bound-fn is way simpler
00:11woobyi think the function may or may not run in the same thread context
00:11ninjuddi think it never does
00:11woobyi'm out folks, happy computing
00:12bortrebthanks
00:13ninjudd(println (Thread/currentThread))
00:13ninjudd(.start (Thread. (bound-fn [] (println (Thread/currentThread)))))
00:13ninjuddalways return different threads for me
00:14ninjuddwooby: thanks, later
00:15ninjuddhas anyone heard anything about clojars being down?
00:21slyrushiredman: so I think the interop syntax that I (mis)remember being annoyed about just has to do with lack of support from the printer
00:21slyrus,(into-array [1 2 3])
00:21clojurebot#<Integer[] [Ljava.lang.Integer;@cf5d90>
00:22slyrusand while I guess there are multiple built-in array types, it doesn't seem quite as flexible as I'm used to with CL arrays with (nominal) support for arbitrary-sized integers and actual support for 1,2, 4, 8, etc... bit integers
01:08technomancyhttp://downforeveryoneorjustme.com/clojars.org <= It's not just you! http://clojars.org looks down from here.
01:08technomancy=(
01:09technomancytime to get some mirrors going
01:09technomancyI have access to the new clojars server, but I have no idea what the transition timeline looks like =\
01:10technomancyif anyone who's good with sysadmin-y things could help out, please join http://groups.google.com/group/clojars-maintainers
01:12ihodesin my grogginess, I applied for membership. how good with sysadmin-y things…?
01:13ihodestechnomancy: and also, if I wanted to really understand the code behind defmacro (eg how it's defined in the clojure source), what would you recommend? reading through the source itself isn't totally enlightening.
01:13technomancyhonestly at this point I think even "I've used apt-get and have written a few shell scripts in my day" would help if you've got some time to spend on it. =)
01:14technomancythe implementation of defmacro? hmm...
01:14technomancyI can't say I'm familiar with the way it works under the covers myself. the cop-out answer is to wait for clojure-in-clojure so it'll be easier to understand through-and-through.
01:15ihodesthat's what i'm thinking, right now reading the source is a nasty dance of switching from reading the clojure and reading the BIZARRE java source. i think i'll wait, though i'm still curious…
01:16technomancyI'm sure there's plenty still to learn about how to use it before you dive into how it works.
01:16ihodesas for admining, i guess that makes me more than qualified ;) i should have time with school next term. let me know what you need; i'd be happy to start helping about around here. and I still plan on contributing the leiningen… just need to get around to reading the source
01:17ihodesthere certainly is, but I think i've got a decent handle on it now. and learning how something works is generally the precursor to groking how to use it, for me.
01:17ihodesforgive the awful spelling. this keyboard has had OJ spilled on it, and letters get missed… :(
01:18ihodesespecially e's.
01:18technomancyhrm; well you could switch to dvorak and then be missing your . key
01:18technomancylooking forward to some lein patches from you. =)
01:21technomancyhave you seen the 1.4 TODOs?
01:21technomancyI will try to post soon about more 1.4 low-hanging fruit
01:21ihodesi'm looking at them now :)
01:21technomancythough there will be a 1.3.1 first
01:22ihodesah not 1.4 nevermind -- don't see that
01:22technomancythe main thing missing there is a good heuristic for determing when to pass the project map into a task
01:22technomancysince now for install and repl some arities take the project arg and some don't; slighly tricky to figure a good heuristic
01:23technomancycurrently someone fixed the repl task but broke (in trunk) the standalone install task =\
01:24technomancyihodes: see "1.4.0 or later" here http://github.com/technomancy/leiningen/raw/5b76514ea6eda8bbbb80ab8dec39381b09eee2e7/todo.org
01:25technomancyanyway, headed off for today
01:26technomancybye everyone!
01:26ihodesalright! i'm looking through the todos :) cheers
01:26ihodesand let me know re: adminning
01:27technomancywell I can't do anything about the current box
01:27technomancyjust hope ato is reading his mail and can help speed up the move to the new one
01:29ihodesif you've got a second, got a question: would it make sense to allow the swank task to be run from any directory, and if a project.clj isn't in it, just launch one with the settings in ` ~/.lein/project.clj?
01:34ihodeslike "cljr swank"
02:00ihodesmy god, i can. how did ~/.swank-clojure get there? jesus christ it's hard to keep track of what ELPA or Lein or Cljr or Swank or Slime…whatever is doing to my computer. time to sleep because I decide to reinstall and take notes on what exactly it does.
02:01ihodess/becase/before
02:31scottjIs there a syntax for writing (:use [foo a b] [foo.c d]) like (:use [foo a b c.d]) that I'm missing?
03:16bortrebscottj: unfortunately not.
04:34scottjtechnomancy: lein 1.3.0 looks cool! NEWS and readme doesn't say how to use swank-clojure as a user dependency instead of a dev dependency that I could see.
04:35scottjanyone know how?
05:32BjeringI have a file organization question regarding how to resolve a circular "require", as it is I have this solution (user.clj https://gist.github.com/20eb533a303fa4589302) and (channel.clj https://gist.github.com/e5819960387cf584b32c).
05:32BjeringWhat I feel is that the declaration in the beginning of channel.clj is abit cludgy, is there a better way?
05:34raekcircular dependencies should preferably be refactored into non-circular dependecies
05:35raekI'm curious, does that "forward declaration" of the namespace work?
05:35scottjBjering: I hear ya, it's really annoying
05:35BjeringYes, my code runs and tests pass
05:36LicenserBjering: usually the best way is to remove the stuff that circle depends and move it to a 3rd namespace
05:38raekI've seen some tricks using :load to split a namespace into multiple source files
05:39scottjis this problem a direct result of the compiler requiring names to be declared before used? What's the reasoning for that again?
05:39raekperhaps merging the two namespaces could be an option too
05:40BjeringI guess my OO way of thinking is restricting me here, I have trouble realizing reaking up user.clj into part that depns on channel and part channel depend on is a good design. I am so entrenched thinking that I should keep all functions on a particular datastructure in a single code component.
05:40Bjeringbreaking
05:45raekthere should be threads about this on the google groups
05:45raekthe question pops up pretty regularly
05:45raekhere is one: http://groups.google.com/group/clojure/browse_thread/thread/9ac0a7b24d80af93
05:48raekand another: http://groups.google.com/group/clojure/browse_thread/thread/ff18795390b5960b/c6de04d84dca1626
05:51LicenserWow none of germans biggest IT magazines has published an article on clojure :)
05:52BjeringI am thinking, having the user bring along its method in its map, :write, would break the dependence. Seems a clean way. Ofc if used undiscriminatly could increase RAM footprint, but to me seems clean enough to start with until profiles says otherwise?
05:56raekI think one of the reasons that circular namespace depenedencies are not allowed is because of macros
05:57raeksince they are applied during compile-time
05:58raekand thus their code have to be loaded when a macro is used in the code
06:00raekif the functions are tighly coupled, maybe they belong in the same namespace
06:02raeksometimes, it makes sense to invert the control and make the user call the fns of the different namespaces
06:04raekanother thought: maybe *all* channel related functions could be moved into the channel namespace
06:04raeka channel could be considered a collection of users
06:04raekthere might be other such collections
06:05raekso why should the user code know about the collections it can occur in?
06:05BjeringUser will soon be known by session
06:06Bjeringsession will learn when it was closed by network
06:06Bjeringand then it will tel its user (if it has one)
06:06Bjeringtell
06:06Bjeringand user will tell all its channels
06:06Bjeringso they can write "Jonas left" to all their users
06:06raekdon't let the english language affect to much of the design
06:07raekmaybe "user enters the room" should not be coded as user.enter(room), but rather room.add(user)
06:08raekanyway, gotta go now... good luck!
06:08Bjeringthank you
06:10BjeringBasic question: If I want this to be done to my agent jonas, what should I send him? ((@jonas :write) @jonas "Hello")
06:13Bjeringthis (send jonas #((% :write) % "Hej"))
06:13Bjering:)
06:29noidiis there a list of breaking changes made in Clojure 1.2?
06:29noidi,(byte 255)
06:29clojurebotjava.lang.IllegalArgumentException: Value out of range for byte: 255
06:29noidithat's one at least...
06:29noidiin 1.1 that returns -1
07:20Bjeringbasic question: Using the variable arity parameters with &, I get a list of the arguments, if I wish to pass this on to another function with variable arity and DONT want it in a list, but unpacked, how do I do that?
07:24ChousukeBjering: use apply
07:26BjeringChousuke, right, thank you.
07:50RaynesHah, Joy is one of Manning's MEAP best sellers.
07:54noidiI bought it yesterday, when I noticed the -45% offer
07:57BahmanHi all!
09:07leafw,(clojure.core.stacktrace/print-cause-trace (new java.lang.Exception "buh!"))
09:07clojurebotjava.lang.ClassNotFoundException: clojure.core.stacktrace
09:07leafwhum
09:07leafwisn't clojure.core.stacktrace part of clojure.jar now?
09:07leafwI opened the jar and it is there, and yet I can't execute it neither in my prompt nor in clojurebot
09:08leafw,(clojure.stacktrace/print-cause-trace (new java.lang.Exception "buh!"))
09:08clojurebotjava.lang.Exception: buh! at sandbox$eval503473.invoke (NO_SOURCE_FILE:0) clojure.lang.Compiler.eval (Compiler.java:5419) clojure.lang.Compiler.eval (Compiler.java:5386) clojure.core$eval.invoke (core.clj:2370) hiredman.sandbox$cond_eval.invoke (NO_SOURCE_FILE:111) hiredman.sandbox$eval_in_box_helper.invoke (sandbox.clj:110) hiredman.sandbox$eval_in_box$thunk__1875.invoke (sandbox.clj:124) hiredman.sandbox$wrap_exceptions.
09:08leafwaha
09:08leafwwithout core
09:10leafwsigh, in my prompt that doesn't work either
09:13leafwok, I can get it to work with (use 'clojure.stacktrace)
09:13leafwis there any reason why one can't call it directly? Perhaps it hasn't been AOT?
10:07gfrlogcan clojure.core/iterate be used to create a finite seq?
10:08rhudsonIt generates a lazy sequence, so you can take part of it
10:08gfrlog,(iterate #(if (neg? %) (inc %)) -10)
10:08clojurebotjava.lang.NullPointerException
10:09gfrloghmm
10:09rhudson,(take-while neg? (iterate inc -10))
10:09clojurebot(-10 -9 -8 -7 -6 -5 -4 -3 -2 -1)
10:09gfrlogbut the list also contains 0
10:09rhudson?
10:09gfrlogthe list ends in 0
10:10gfrlogI guess I'm looking for a general way to make sure I get all of the list
10:10rhudson,(take 20 (iterate inc -10))
10:10clojurebot(-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9)
10:10gfrlogyes, that works if you know how many there are
10:10rhudsonHow do you know you've reached the end of the list?
10:10gfrlogthat's the issue
10:11gfrlogI figured if the next function returned nil that would signal the end of the list
10:11gfrlogin the case of #(if (neg? %) (inc %)), it returns nil on input 0
10:11gfrlogwhich apparently throws an NPE instead of terminating the list
10:12rhudson,(inc nil)
10:12clojurebotjava.lang.NullPointerException
10:12gfrlog(take-while #(not (nil? %)) (iterate #(if (neg? %) (inc %)) -10))
10:12gfrlog,(take-while #(not (nil? %)) (iterate #(if (neg? %) (inc %)) -10))
10:12clojurebot(-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0)
10:12gfrlogso I guess that can work
10:13rhudsoniterate will keep applying the function to the previous result for as long as you consume the sequence
10:13gfrlogokay
10:13gfrlogI think the take-while-not-nil function accomplishes what I wanted
10:13rhudson,(take-while #(<= % 0) (iterate inc -10))
10:13clojurebot(-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0)
10:14gfrlogyep
10:14gfrlogI'm not actually working with integers, so the #(<= % 0) wouldn't work generally
10:14gfrlogthanks for the help
10:14rhudsonyou're welcome
10:17rhudsonIf 'false isn't a value in your sequence, you can use identity as the func intstead of #(not (nil? %))
10:20gfrlogoh that's a good idea
10:43fbru02hey guys anyone knows why i get "that's nto a task " when i do lein swank ?
10:47leafw,(doc vector-of)
10:47clojurebot"([t]); Creates a new vector of a single primitive type t, where t is one of :int :long :float :double :byte :short :char or :boolean. The resulting vector complies with the interface of vectors in general, but stores the values unboxed internally."
10:47leafwthat gets close to Vector<T> in C++ STL lib
10:47leafwwill it ever support arrays of any kind? I.e. :^String, or whatever?
10:48Raynesfbru02: That means that you don't have swank-clojure in lib/. Put [swank-clojure "1.2.1"] in your :dev-dependencies in your project.clj.
10:51fbru02Raynes: thanks , I did that, i did lein deps , but still nothing
10:52Raynesfbru02: Is swank-clojure in lib/dev?
10:54fbru02Raynes: now i did it right and it works thanks
11:24limux1972where is the doc of syntax quote ~'
11:25limux1972and the source of it
11:28qbglimux1972: I just responded to you on the list
11:29limux1972thanks
11:30qbgsyntax-quote is also documented at http://clojure.org/reader
11:34limux1972`~foo will get the value of foo, just `~'foo get foo, isn't it?
11:35qbg,'`~foo
11:35clojurebotfoo
11:35qbg,'`~'foo
11:35clojurebot(quote foo)
11:35qbg,`~=
11:35clojurebot#<core$_EQ_ clojure.core$_EQ_@4df262>
11:35qbg,`~'=
11:35clojurebot=
11:36limux1972yes
11:38limux1972is there any way for me to run into the clojure to see how it works
11:38noidilimux1972, `foo will exapand to "foo" qualified with the namespace it is defined in, e.g. bar/foo
11:39noidilimux1972, 'foo will expand to just the symbol foo
11:40qbgThe syntax-quote reader is defined in clojure.lang.LispReader
11:40noidi`~foo expands to the value that the symbol foo refers to, e.g. ,(let [foo 3] `~foo) expands to 3
11:40noidi,(let [foo 3] `~foo)
11:40clojurebot3
11:40limux1972i know what you say
11:41noidiok
11:41qbgBut reading the source of it probably isn't going to be too helpful
11:41noidithere's nothing special about ~'
11:42noidiit's just a way in which ` ' and ~ are used together
11:44limux1972perhaps i will understand it better after reading it's source
11:44limux1972or do some moretest
11:45qbgIt starts at line 683 in LispReader.java for me
11:48limux1972mine is at 680, class of SyntaxQuoteReader
11:51ihodeshey clojurilliacs
11:51ihodesis BigDecimal the way to get arbitrary precision decimals in Clojure?
11:51ihodesor is there another way
11:52qbgYes
11:52technomancyihodes: hey, about your question from last night...
11:52technomancyyeah, it makes sense to let swank run from any dir
11:52technomancyI got a patch to do that with the repl task
11:52technomancybut right now the logic to determine which tasks need a project arg needs fixing
11:52ihodesqbg: yes that BD is the *the* way? thanks!
11:53technomancyactually, once you install swank now it puts a shell script in ~/.lein/bin/swank-clojure, so that's an easier way to do it
11:53ihodestechnomancy: i was looking at that heuristic. right now it's *just* if 'project is in the argulist?
11:53technomancyihodes: right; that's not going to cut it
11:54ihodesyeah i'm all hot'n'bothered over what the hell swank is doing. it's living in .m2 as well as ~/.swank-clojure
11:54technomancythat's from swank-clojure.el
11:54ihodesi figured
11:54technomancybeen deprecated for some time now
11:54ihodesright
11:55ihodesit's rubbish from when I was a total newbie at clojure a few months ago and did the whole emacs-slimeswank setup. i need to clean up.
11:55ihodesand somehow M-x slime starts up a swank instance, which is nice, but I'm wondering if that's swnak-clojure.el as well? it happens to start up clojure 1.2… which is nice, buce also confusing. i started reading through the slime source, but hell if that's fun to do
11:56technomancyyes, M-x slime is swank-clojure.el
11:57ihodesso currently, the supported way to start up and connect to swank is running lein swank in a project's top directory, and then connect to the instance with slime-connect (courtesy of slime.el, not swank-clojure.el)–right? just trying to get it all straight.
11:57technomancycorrect
11:58ihodesso idea: the fn that decides whether or not to pass the project map to a task can first see if we're even in a project's directory, and if we're not, pass an empty project map to the task, leaving it to the task to deal with being run outside of a project?
11:59ihodesor pass a ~/.lein/project.clj map instead
12:00ihodes(forgive me if I'm sounding like an idiot–i haven't had much time to dive into the lein source, just skimmed it last night. if i am, tell me and i'll shut up and re-read it before asking questions.)
12:01dsantiagoHm, I always start Slime with lein swank, then slime-connect in Emacs, but it won't think it's "in Slime" until I do M-x slime, which starts its own repl that I have to shut down etc.
12:02technomancyihodes: actually... I think I just got it
12:03ihodesdsantiago: what do you mean "in Slime"? can you not e.g. compile your current clj buffer and then run it in the running REPL?
12:03ihodestechnomancy: oh how?
12:03mrBlissIf I want a REPL to try some things out, I use M-x cljr-swank to start a swank server with cljr and connect to it with slime. If somebody's interested in this elisp function, I can post it.
12:04ihodesmrBliss: i'm interested :)
12:04technomancydsantiago: that's odd; never seen that before
12:04ihodesmrBliss: though lately cljr swank has stopped starting up swank…no idea why. another thing to troubleshoot.
12:04technomancyihodes: I just need the project-needed? predicate to take a single arity rather than the full arglists
12:04mrBlissworks fine for me (even on Windows!)
12:05mrBlisscygwin + windows command prompt
12:05mrBlisshttp://gist.github.com/542493
12:05mrBlissit assumes cljr is in your path (which probably is the case anyway ;-)
12:06ihodestechnomancy: love it when the solution's simple.
12:06technomancywell that's a slight oversimplification, but you can read the whole story as soon as I commit. =)
12:07ihodesmrBliss: it worked fine for me! must be something I accidentally touched… sigh. thanks for the .el!
12:07rahulkmrDoes vimclojure work with clojure 1.2?
12:21dsantiagoihodes: yes, exactly. It won't recognize Slime key-commands until I M-x slime.
12:21dsantiagoI usually now do M-x slime, then close everything down, and then do lein swank/M-x slime-connect.
12:23dsantiagoJust occurred to me: Should I uninstall swank-clojure from ELPA?
12:24limux1972` is a SyntaxQuoteReader, ~ is a UnquoteReader, ' is a QuoteReader
12:28ihodesi'd try that, but it works for me without swank-clojure
12:28ihodesyou can take a look at my messy emacs init.el file on github, if you want to see what works
12:28ihodeshttp://github.com/ihodes/dotfiles
12:35technomancydsantiago: couldn't hurt
12:46dsantiagoDang, I can't find a command to remove a package anywhere.
12:49rlbIs there already a function that will just feed an inputstream to an output stream until eof?
12:49mrBlissrlb: copy in clojure.java.io
12:50technomancyihodes: if you want to help out with lein sooner rather than later I'd be glad to have help with issue 95
12:50rlbexcellent -- thanks.
12:50technomancyhttp://github.com/technomancy/leiningen/issues#issue/95
12:51technomancyjust needs some strategic try/catch in leiningen.repl/repl-client
12:53ihodeschecking it out now
13:06rlbAre the correct delineators between a generic byte stream and a generic character stream (instance? java.lang.Readable x) and (instance? java.io.InputStream)?
13:25noidiphew... I finally managed to fix all the loads of bit-twiddling code I have that broke when the behavior of (byte x) changed in 1.2
13:25noidiand I am really glad that I had extensive unit tests for the code. The "out of the tar pit" guys are sooo wrong on unit tests not being important in functional languages :)
13:31noidioops, I had to re-check the essay and they weren't against testing after all. I must have confused it with something I've read in the same period when I read Out of the Tar Pit for the first time
13:45rlbAnyone know if providing :encoding nil is the same as not providing an encoding for (reader ...)?
13:49dulanov(defn- ^String encoding [opts]
13:49dulanov (or (:encoding opts) "UTF-8"))
13:50dulanovso, as not provided
13:57no_mindSearching for an example of Velocity templating engine called from clojure but no luck. Any pointers ?
14:05rlbdulanov: thanks - I should have noticed that...
14:09rlbShould (use 'clojure.java.shell) (prn (sh "ls" "-al")) hang when run from the shell via clojure.main?
14:10rlbThe map is printed, but clojure never exits.
14:10rlb(This is with 1.2.0.)
14:12rlbAdding a (System/exit 0) at the end does cause it to exit.
14:39chouserrlb: I think c.j.shell uses thread pools now, so you might need (shutdown-agents) to allow your program to exit.
14:47rlbchouser: ahh, ok. I'm actually working on some additions to sh, which I'd be happy to contribute if they're useful. In particular, I'm adding the ability to pass streams for :in, and the ability to get the result as {:exit <promise> :out <stream> :err <stream>} if you specify :bg.
14:48rlbI'd like to be able to chain invocations (i.e. pipes).
14:48rlb(and to build lazy line sequences)
14:49rlbchouser: shutdown-agents fixes it -- thanks.
14:53chouserthe main reason we've avoided passing streams in and more importantly out is because of the burden on the user to correctly clean up those stream resources.
14:54chouserbrb
14:59rlbchouser: I thought about that. I assume line-seq does something like that. I'd be fine with an sh (or something) that just returned a lazy sequence that cleans up the underlying stream when it hits eof -- preferably with some way to specify the tokenization (i.e. not just lines).
15:00rlb...looking at the work I did a while back, I had also hacked up a "(reader-seq regex-delim reader)".
15:00rlb(perhaps a bad name...)
15:03rlbOverall, I was thinking of something like this:
15:04rlb (sh "tar" "--files-from" "-" :in (seq->stream (filter ... (sh-seq "find" ...))))
15:04rlbroughly.
15:06rlbThough I suppose given the above, you might not want seq->stream, but rather an :in that can handle a sequence of strings.
15:07rlbOh wait, of course, line-seq doesn't do anything about closing the reader.
15:08LauJensenrlb: What was that snippet supposed to do ?
15:10rlbLauJensen: overall, I was just considering the ability to handle streaming the output from shell commands (so you don't require enough RAM to hold all the output), and perhaps the ability to more easily weave shell commands into combinations of the normal lazy sequence operators.
15:11LauJensenYea that would be helpful. Though for tasks of that magnitude you typically find a better way to handle it through java - For instance both tar and gz files can be easily manipulated with java libs
15:11LauJensen(at least that has been my experience)
15:11rlbLauJensen: sure, but I'd rather not have to commit to (re)writing every useful tool in java.
15:11LauJensenOf course not
15:12rlbBut chouser mentioned the problem of handling (cleaning up) all the process streams.
15:13LauJensenHow much of a mess is involved?
15:14rlbI'm not sure -- just thinking about it. I believe the concern is that if sh returns :out and :err as streams, then you have the problem of making sure someone closes them when they're exhausted.
15:14rlbThat's harder if you're chaining sh calls either with each other, or interleaved with normal seq ops.
15:15LauJensenSo perhaps a (with-sh-stream ...) macro would be the right way to go, that way it could tie up any loose ends
15:17rlbLauJensen: I'm not sure that'd work at least externally (or it might make the code awkward), since you might not want to have to grab the intermediate streams. i.e. imagine the equivalent of "foo | bar | baz | bax". There are essentially 8 output streams there (incl stdout and stderr).
15:17rlbI wonder if it would make any sense (or be possible) to have something like line-seq (though perhaps more configurable) that just closed the underlying stream when it's exhausted?
15:17rlbAnd then sh (or whatever) could return those.
15:18LauJensenI dont see how the consumer of an eight components long chain would want to have more than stdout/stderr
15:21@chouserrlb: side-effects (like closing a stream) tied to the consumption of a lazy-seq strikes me as fragile.
15:26LauJensenchouser: why? Its similar to the resultsetseq in contrib.sql ?
15:28@chouseralso similar to c.c.io/read-lines (which didn't make it into c.j.io)
15:29@chouserbut in general one of the things that's safe to do with a lazy-seq, indeed one of its main benefits, is to leave the tail unconsumed.
15:29@chouseruse what you need, abandon the rest.
15:30@chouserto have some of the lazy-seqs in your program leak file handles in those circumstances seems like asking for trouble.
15:30LauJensenYea I understand. So how would you handle this situation, if the 'stream' was too big to keep in memory ?
15:33LauJensen@ chouser
15:35rlbchouser: I understand -- though aside from that concern, lazy process output (whether streams, lines, or other tokens) seems like a natural thing to want. I'd like to be able to use clojure's relevant operators...
15:36@chouserLauJensen: not sure -- part of why I didn't do it already. -)
15:37LauJensenchouser: Do you agree that some like with-stream would make for an akward solution?
15:39@chouserfor single streams, using something like (with-open [r (reader ...)] ... (line-seq r) ...) works well. The use explicitly creates and destorys the resource.
15:39@chouserLauJensen: yeah, when you're wanting to chain pipes together, you'd hate to have to nest or otherwise call out each step individually.
15:41LauJensenchouser: When you chain calls its because you want a certain end result, why care about the steps in between? I guess Im just not seeing the nesting problem. Is it because you're imagining something like (sh "fn" (sh "anotherfn" ...)) ?
15:43rlbchouser: wrt your earlier comment, you could argue that its not really "unsafe" to leave a sh-seq's tail unconsumed any more than it's unsafe to run a program that waits on input the first place. And it could be less safe to run a command that produces enough output to exhaust RAM.
15:43rlbi.e. (sh "cat" "/dev/zero")
15:44@chouserI mean, a natural extension of with-open to sh would be something like (with-sh [out err "ls ..."] ...)
15:45rlb(IST vaguely recall that scsh had some kind of pipe operator with stich-up.)
15:45@chouser...but for chaining that would require (with-sh [out1 err1 ...] ... (with-sh [out2 err2] ... )) which would be to awkward to be used much.
15:46noidichouser, btw, the joy of clojure uses the word seq a lot without explaining what a "seq" means
15:46@chousernoidi: :-(
15:46noidisorry if this has been reported already, I was just reading the e-book I bought yesterday and it caught my attention
15:47@chousernoidi: ah, I forget nobody has access to the latest version.
15:47@chouserwe keep rearranging chapters and sections, which has caused things to be introduced out of order with when their defined.
15:48@chouserI hope we have most of those fixed now, and there should be a new MEAP of the entire book within a week.
15:48rlbchouser: you could always support a with-sh like let (i.e. successive bindings), but it's still awkward perhaps.
15:48noidichouser, okay, cool :)
15:49noidiin yesterday's version the first three mentions of seq are:
15:49noidi1. Chunked seqs and transients can make a huge difference with little or no change to your code.
15:49noidi2. for returns a lazy seq while doseq is for generating side effects
15:49noidi3. You can use into to build any of these types, seq to get a lazy seq to walk through them
15:49noidiwhich might be a bit confusing for newbies :)
15:50rlbI'd originally wanted to be able to interleave sh seqs with other operators. THough I don't know if that's feasible without a seq that eventually closes the underlying resource.
15:50@chouserrlb: a real shell's | operator closes the streams when the related process dies (I think) -- emulating that might make sense for c.j.shell, but it's not what it or Java's libs currently do.
15:52rlbchouser: so just to clarify, it sounds like there's a fundamental objection to having a lazy seq that would leave a reader open until the process has finished generating output or dies. Is that right?
15:54rlbThat's not necessarily a problem -- just tells me that if I really decide I want that, it'll have to be maintained outside clojure proper.
15:58@chouserrlb: I think that's right.
15:59@chouserThere's got to be a better way to handle that problem, to make setting up a chain of such things convenient without changing the fundamental contract of lazy seqs.
16:00@chousermaybe pods. maybe scopes.
16:01rlbchouser: I suppose I would have just thought of sh-sequences as slightly unusual, ones with which you might have to take a bit more care, and the resources they consume could in fact be much lower than the alternative.
16:01rlbchouser: in any case, that's helpful. Thanks.
16:04metagovA fairly general macro I'm using to debug my (->> ...) code: http://gist.github.com/542719
16:04rlbchouser: one other thing to consider if/when working on this is the equivalent of "set -e", i.e. if you have a long pipeline, how do you handle errors?
16:05rlbchouser: you could of course just have an option to sh that tells it to spawn a thread to (waitFor. proc) and throw an exception (or whatever) if the result is non-zero, but there are a lot of possiblities.
16:06metagovSpecifically, I just replace '->>' with 'lazy ->>' in the repl so I can see the intermediate values.
16:15rlbchouser: wait, actually, the big problem is that you'd need a finalizer too. I wasn't thinking about that yet -- not good.
16:17ninjuddmetagov: nice
16:21bortrebrlb: how about something like a shell-monad which handles errors and closing resources and piping junk around
16:21bortrebrlb: I feel like sequences are too lightweight for this sort of thing
16:22metagovninjudd: thanks :-)
16:22metagovI'm not very attached to the name 'lazy' BTW.
16:23hiredmanthere is a set of monadic io stuff in contrib
16:25bortrebcomposing shell calls feels to me like a combination of a "close open junk" monad and the error-handling monad
16:33polypustechnomancy: you around?
16:33LauJensenI hope monads are not in too wide use in Clojure yet?
16:35bortrebLauJensen: they don't seem to be --- don't like them?
16:35LauJensenNot in Clojure
16:35bortrebwhy's that?
16:35polypusi did i lein upgrade and am still getting the same bugs, posted about it to the lein list. is the upgrade all i need to do?
16:36polypuss/i did i/i did a
16:36LauJensenbortreb: Well, they make sense to me in Haskell as its pure functional. Monads provide a way of hiding state to maintain the purity. In Clojure we have specific semantics for handling state explicitly, not hiding it. So I just dont see why you would want monads
16:37qbgParser monads may be useful
16:38LauJensenWhere?
16:38clojurebotwhere is log
16:38LauJensenclojurebot: botsmack
16:38clojurebotOwww!
16:38rhudsonMonads aren't just about state
16:39LauJensengo on
16:39rlbbortreb: not sure -- have to think about it.
16:39rhudsonWikipedia article's actually pretty good: http://en.wikipedia.org/wiki/Monad_(functional_programming)
16:40LauJensenI'll check it out... eventually :)
16:41rhudson-?> is arguably a kind of monad
16:41fbru02rhudson: what's the use of monads in a dynamic language?
16:41qbgfor is basically the list monad
16:42bortrebLauJensen: I see monads not as a crutch for hiding state, but as a way of describing computation.
16:42bortreblet and for are both types of monads :)
16:43fbru02bortreb: i kind of agree, but they more useful in a static type system
16:43rhudsonMonads and type systems aren't closely coupled concepts. It's just that everybody (including me) first heard of them in Haskell
16:45rhudsonBut I think they showed up in Haskell more because you really need *something* to handle side effects in a pure functional lang
16:45LauJensenIm still considering whether or not I should study them deeply. I've worked on more than a few Clojure systems now and Ive never had a challenge that even remotely had me considering monads
16:46rhudsonMe neither. But bortreb's suggestion of a "pipe monad" got me thinking
16:46fbru02how do you explain bind ( (>>=) :: m a -> (a -> m b) -> m b in clojure terms ?
16:46LauJensenfbru02: how do you explain it in english ?
16:46rhudsonI don't :)
16:47fbru02LauJensen: rhudson yeah i mean, without involving types
16:47clojurebotLauJensen is some dane
16:47rhudsonBut as I recall the clojure contrib monad stuff links to a pretty good explanation
16:47fbru02i will check that out
16:47qbgThere is a tutorial on the internet about monads in Clojure
16:47LauJensenhehe
16:48LauJensenThere's a ton of monad tutorial, they all start like this "at first, monads seem strange and foreign to me, but then suddenly, I understood everything and now I can explain it to you..." and then comes a strange and foreign explanation
16:48qbgIsn't the identity bind (fn [x f] (f x))?
16:48fbru02Bind is from the ability to go from a value of type ‘a’ to a value of type ‘b’ while performing m effects; we get the ability to just perform whatever effects needed to produce the ‘a’ and continue before to produce the ‘b’.
16:48clojurebotmonads is http://okmij.org/ftp/Scheme/monad-in-Scheme.html
16:49bortrebholy **** how is the clojurebot doing that?
16:49LauJensenhiredman: Are you working on a conversation module for clojurebot?
16:49rhudsonLauJensen: to be fair, lots of people seem to have your reaction to immutable collections, STM, macros, even s-expressions
16:49LauJensensure - Im not knocking monads, Im just saying I never saw the need for them in Clojure
16:50qbgHearing Haskell users talk about monads give you the impression there are awesome magic, but once you learn about them, you realize they are just a pipeline for computation
16:50bortrebyou need them less I feel because you've already got the most common ones like for built in
16:50qbgWhich is kind of disappointing :)
16:51bortrebthey're only good when you have a bunch of functions that all have the same boilerplate linking code
16:51rhudsonfbru02: there's links from http://clojure.github.com/clojure-contrib/monads-api.html
16:51fbru02rhudson: thanks
16:51qbgYeah, I was talking about those
16:52bortreblike, they take in one thing, and put out another, but then you want to link those functions together in some well defined way -- it can totally be seen as just pipeline stuff
16:52bortrebbut hey, maybe shell calls can be seen in that way?
16:53rhudsonYeah, that was an intriguing idea
16:53bortrebwhat does the RT in clojure.RT actually stand for?
16:53rhudsonruntime?
16:54qbgIt took me a while to realize that...
16:54bortreb:rhudson thank you :)
16:56rhudsonMaybe if they were called "pipelines" instead of "monads" they wouldn't have such an offputting mystique
16:57qbgBut can you clog a monad up?
16:58rhudson"A monad is just a monoid in the category of functors. What's the problem?" <-- That's the problem
16:58bortrebyou cna sort of clog maybe-m up :)
16:58bortrebthank you, math people
16:58rhudsonThat terminology clogs my brain up
16:58bortrebthat really makes it easier to understand!
16:59qbgmonoids are easy to understand
17:00metagovI'm glad I'm not the only one who struggles with monadolgy
17:03LauJensenIts horrible that even in computer science, a name can become a stumpling block
17:03bortrebeverything's easy to understand if you almost already know it -- for someone who's studied category theory a "monoid in the category of functors" makes sense. I've yet to see a truly clear tutorial that takes it from a pipeline perspective, which would be very cool.
17:04metagovAnd if you really want pain, try reading wikipedia on Arrows of which monads are a subset.
17:04metagovReally, just try reading this: http://en.wikipedia.org/wiki/Arrows_in_functional_programming
17:04brxhttp://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/
17:05bortrebagain, it's only pain for those who haven't spent years studing high level math, just as the clojure source is pain for people who haven't studied C.S. for years
17:09TanisWolf_Hey people, anyone know what I am doing wrong? "(alength (.getConstructors (.getClass java.io.File)))" returns 0 not 4
17:09rhudsonI approached Haskell from the prog lang side of the house. The year or two I spent programming it was one of the most stimulating periods of my career. I really got why purity and laziness were so cool, and really appreciated what an ambititous lang it is.
17:09rhudsonI even sort of wrapped my head around monads, for a week or two at a time.
17:09LauJensenNice. rhudson have you tried J or K ?
17:10rhudsonBut learning an unfamiliar branch of math to understand the explanations was a bit much
17:10rhudsonNo I haven't LauJensen. I've seen some code samples of J, which didn't much inspire me.
17:11LauJensenrhudson: Oh ok - learning J was very stimulating for me as well, so if you had tried I would have love to hear a comparison - I did one blogpost on J and another on J + Clojure, which turned out excellent
17:11LauJensen(I still have forsaken trying to call J from Clojure)
17:12rhudsonPart of my considerable appreciation of Clojure is that it has most of what I really liked in Haskell, in a (to me) more tractable and pragmatic package.
17:13rhudsonPlus I'm more of a dynlang kinda guy.
17:14rhudsonI'd be interested in the J blogpost(s).
17:14@chouserTanisWolf_: The Class class has no ctors -- that's what your expression is telling you
17:15@chouserTanisWolf_: try (.getConstructors java.io.File)
17:15TanisWolf_ahh thanks, it was really starting to drive me mad!!!
17:15bortrebwhenever you see .getClass in java the translation for clojure is just not to use it
17:15@chouserthe Class class is easy to trip on
17:16rhudsonI think Java is actually the only JVM language where you can't use the name of a class to reference its class. :(
17:16TanisWolf_doh seems obvious now, thanks people!
17:16LauJensenrhudson: #1: http://bestinclass.dk/index.clj/2009/11/mind-games-ascension.html #2: http://bestinclass.dk/index.clj/2009/11/life1d-in-clojur.html - I see that they're a little dated and the first one has an html flaw which I'll try to work out :)
17:17rhudsonthanks
17:17rhudsonIt's like having to say 1.getValue()
17:18technomancypolypus: hey
17:20polypushi
17:21polypustechnomancy: hi
17:21dnolennice aleph gets websockets support
17:23technomancypolypus: just answered your email actually
17:23polypustechnomancy: ok am looking now
17:26scottjtechnomancy: how do I install swank-clojure as a user dependency so I don't have to put it in all project.clj? I didn't see how in the readme or news
17:27technomancyscottj: just place the jar in ~/.lein/plugins
17:27technomancyit's in the "Configuration" section of the readme
17:29rhudsonRe monads, this is good: "In short, monads are a pair of functions that help you apply extra behavior to existing functions without changing their implementations. They do this by making the inputs and outputs of the functions in the same domain, thus making the adjusted functions composable in any combination. "
17:30polypustechnomancy: ok ty, i'll build it. but do i have to wait until everybody has the fixed version of lein in order to release a jar with a custom shell script in it?
17:31technomancypolypus: no, the fix only needs to be applied on the machine that generates the jar
17:31polypustechnomancy: ok ty good to know
17:31technomancyI hope the 1.3.1 fix is only a few days away though
17:32polypusyou mean till it's on the stable branch?
17:32technomancynot yet, hopefully soon
17:32LauJensenrhudson: I think I fixed the formatting, so you should be safe to read, though theres a problem with the comment box, which is annoying because some of the J guys posted some good stuff
17:32scottjtechnomancy: thanks. for non-plugins, like clojure-refactoring, where would you put it and what would you put in init.clj so it's only used during development?
17:33technomancyscottj: it doesn't have to technically be a leiningen plugin with its own leiningen task to go in ~/.lein/plugins
17:34technomancybut I don't know what you'd put in init.clj for that lib specifically; I haven't used it
17:34scottjwill all jars in plugins get loaded just like they would in dev-dependencies?
17:35technomancythey will be on the classpath just like dev-dependencies
17:35LauJensenA little OT: Any recommendations for the best keyboard out there for development?
17:35technomancyscottj: if they involve hooks you will still need to require them in init.clj
17:36technomancyLauJensen: Model M if you don't have RSI problems. No comparison there.
17:36LauJensenhehe, please...
17:36LauJensenIm currently on a Dinovo Edge, which has been fantastic, but its worn down
17:36technomancyif you do have RSI problems, I recommend the Kinesis advantage or freestyle
17:36LauJensentechnomancy: Thats not the stuff you have strapped on your legs is it?
17:37technomancyLauJensen: that's the freestyle
17:38technomancyit's only USD100; the advantage is 300; almost certainly the best
17:39rhudsonI'd say the MacBook Pro -- keyboard comes with a very useful attachment :)
17:39LauJensenThe advantage looks interesting
17:39technomancythe only other thing that comes close for RSI is http://www.datahand.com/
17:40LauJensenRSI? Thats some kind of sickness isnt it ?
17:40technomancybut if you don't have RSI you want a model M. everything else is weak sauce.
17:40technomancyrepetitive stress injury
17:40LauJensenI dont have that, I just want to be fast
17:40LauJensentechnomancy: model m as in that dinosaur from IBM ?
17:41technomancyI think you mean classic.
17:41LauJensenfirst hit on google
17:41polypusLauJensen: i quit like the new mac keyboards myself, dunno about "the best", but i like the feel
17:42AWizzArdbetter than Model M is a “Das Keyboard”: http://www.daskeyboard.com/
17:42LauJensenpolypus: honestly the mac keyboards are pathetic. Like anything Apple does it appeals to the eyes and not much else
17:42AWizzArdThe Das Ultimate
17:42rhudsonI totally disagree
17:42scottjI wasn't very successful using a mac wireless keyboard in ubuntu, granted I only spent 20 minutes before giving up
17:42rhudsonBut it's a very personal choice
17:42LauJensenAWizzArd: Now that looks interesting, are you on that ?
17:42AWizzArdLauJensen: of course
17:43LauJensenCool
17:43AWizzArdI have one in my office too.
17:43LauJensenAnd its fast?
17:43technomancyyou can get a model M with a trackpoint and no numpad now I think
17:43AWizzArdMechanical gold switches, extremly good quality
17:43LauJensenIm intruiqued
17:43LauJensenAnd I dont even know how to spell that :)
17:43technomancythe mac ones are way better than the old mushy ones
17:43technomancybut still only sorta meh
17:43polypusLau: well, i disagree. i quite like the feel, but true about the eyes
17:43AWizzArdLauJensen: how fast are you? http://speedtest.schnell-schreiben.de/ chose your language and measure your typing speed
17:44technomancythe pre-unibody ones were awful
17:44polypusthere's always stallman's fav: http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard
17:45LauJensenAWizzArd: I'll try - Me vs the Mac girls :)
17:45AWizzArdI just did 550 keys per minute
17:45technomancyif I didn't have RSI issues I would certainly get one of these: http://pckeyboards.stores.yahoo.net/en104wh.html
17:46LauJensen616 chars per minute, I missed 4 chars
17:46LauJensentechnomancy: How did you contract that?
17:47LauJensen(other than typing like a mad man)
17:48scottjLauJensen: wow, qwerty?
17:48LauJensenpolypus: stalllmans look interesting
17:48LauJensenscottj: yea
17:48AWizzArdLauJensen: grats! I often do not mistype any. I am typing with the Neo-Layout.
17:48LauJensenAWizzArd: whats that?
17:48technomancyLauJensen: as far as I can tell I got it from typing with bad posture on non-ergonomic keyboards
17:48AWizzArdA keyboard layout which is particular well suited to write german and english texts, and for programmers
17:49LauJensentechnomancy: ok - so you noticed because you had pains?
17:49technomancyLauJensen: right
17:49LauJensenok
17:49scottjI have a HHK and like it but prefer dedicated func keys and media buttons
17:49LauJensenSorry to hear that
17:49LauJensenAWizzArd: Must check that out
17:49technomancyyou just have to be really sensitive to early-warning signs: tingling in your wrists and such
17:50technomancyI still use my thinkpad keyboard about 50% of the time, but if I don't use my kinesis often enough I start to feel it at the end of the day
17:50LauJensentechnomancy: Yea I have none of that. But I usually prioritize works outs as well, running, lifting weights and so on, as preferably in my lunch breaks as well
17:50AWizzArdLauJensen: the nice thing is that it aligns keys in such a way that your fingers don’t need to travel much. A typical typist will have to move her fingers over 15 miles on an 8 hour typing day on qwerty. With neo it is just 2 miles.
17:50technomancyright, that's supposed to help a lot. /me really should too
17:51technomancyalso my RSI was worse before I switched to dvorak; there's much more hand movement with qwerty
17:51LauJensenAWizzArd: Crazy - You need a special keyb for that ?
17:51LauJensentechnomancy: Yea you're not the first Ive heard say that
17:52AWizzArdLauJensen: no, only a setting in Ubuntu/Windows/Mac.
17:52LauJensenoh
17:52AWizzArdThen it switches the keyboard layout. If you have a qwerty keyboard the keys will lie, because only the „m” sits on the same position.
17:53AWizzArdThat's why a Das Keyboard Ultimate is nice - it shows no keys, it is completely black.
17:53scottjof course you're muscle memory for emacs etc will all be wrong then
17:53technomancyit were a blast
17:53AWizzArdEmacs was a bit tricky - for 5 days.
17:53LauJensenscottj: that will be a problem
17:53AWizzArdIn the past 4 years however it was fine :)
17:54AWizzArdClojure was also strange in the first days.
17:54LauJensenhehe
17:54AWizzArdBut the thing about being a newb is: this is the shortest amount of time one spends in a given status.
17:54AWizzArdMost of the time one is a Pro.
17:55LauJensenyea - The capslock/ctrl swap was annoying for a very short time
17:55LauJensenalthough, still annoying if not on my own system
17:55scottjis dvorak still better than neo if you only write english/program?
17:56scottjwhere better = less finger movement
17:56TanisWolf_Hey people. I'm looking for a method like pick or tryPick in oCaml/F# (http://msdn.microsoft.com/en-us/library/ee340319.aspx) in clojure. basically it keeps evaluating the function until a result is returned
17:57AWizzArdTanisWolf_: check out filter, take-while, iterate, repeatedly
17:57LauJensenGuys - Thanks for all your input on the OT discussion on keyboards, much appreciated!
17:59AWizzArdLauJensen: the very cool thing with a clicking keyboard like the Das is that you sound crazily fast. Even when you type only with 250 keys/min it sounds like 500
18:00LauJensenhaha - that sounds annoying
18:00LauJensenDinovo Edge is very silent, like a laptop keyboard, which I like
18:00AWizzArdit helps to get not only tactile feedback, but also an accoustical
18:00AWizzArdAnyway, there is also a Das Silent.
18:00LauJensenyea I just saw
18:01LauJensen"The silent model (read not silent, but less clicky) is ideal for people..."
18:01ragnardHas anybody tried a TypeMatrix keyboard?
18:01AWizzArdLauJensen: btw, they advertise with "best-in-class" :)
18:01LauJensenAWizzArd: wanna-bes :)
18:03LauJensenthis looks nice: http://www.youtube.com/watch?v=t1XBmmsP2gI&amp;feature=related
18:06LauJensenI must admit Das Keyboard have designed a very nice sound when clicking, not like I remember my first IBM keyboard
18:09AWizzArdLauJensen: I always brought my Das Keyboard into the offices where I worked, and it never bugged people.
18:09LauJensenGood to know
18:22bmhheya #clojure.
18:24LauJensenheya bmh
18:26bmhI implemented linear time median finding, but I think the code could use a bit of cleanup
18:27bmhhttp://github.com/dstu/Mapatorious/blob/master/src/main/clojure/util/select.clj
18:28bmhalso, is there a function that executed filter/remove simultaneously and returns two collections?
18:30rhudsonbmh, group-by will do it if the predicate is boolean
18:32bortrebhow does this definition of first in clojure.core not get stuck in an infinite loop? (def first (fn first [coll] (. clojure.lang.RT (first coll))))
18:32bmhrhudson: I can't believe I overlooked that!
18:34rhudsonbmh, or (juxt filter remove)
18:36trptcolinbortreb: the "first" after clojure.lang.RT gets called in Java-land. something like clojure.lang.RT.first(coll)
18:37trptcolinjust like you can do: (. "foo" (contains "o")) without defining "contains"
18:38rhudsonThe more usual style would be (clojure.lang.RT/first coll)
18:38bortrebtrpcolin: oh I see. thanks. but, why write it that way instead of the more idiomatic way?
18:39bortrebis it faster or something?
18:39rhudsonI think it's an older notation
18:43trptcolinthey look pretty equivalent speed-wise to me
18:44bortrebif it's really just an older thing, wouldn't it be a good idea to submit a patch bringing it up to speed for readability's sake?
18:49trptcolinbortreb: clojure.core has a decent mix of the two notations, but i can't speculate on the reasons - maybe ask on the mailing list?
18:57tomojvec uses both
18:58tomojthen hash-map and hash-set use each respectively
18:58tomojcan't imagine there's any good reason for that..
19:55defnooo! I need to make clojure-koans
20:25bortreb,(cons 4 [1 2 3])
20:25clojurebot(4 1 2 3)
20:25bortreb(.cons [1 2 3] 4)
20:25bortreb,(.cons [1 2 3] 4)
20:25clojurebot[1 2 3 4]
20:25bortrebwhat's up with that?
20:27@chouser.cons is really conj
20:27@chouser.cons isn't a documented interface. I expect its name to change eventually. probably to .conj
20:28bortreboh ok
20:29@chouserregarding interop syntax, a leading dot by itself (. anything) is indeed older and no longer idiomatic, expect perhaps in macros where it can be handy.
20:29bortrebso then, would it be good to change core to reflect that?
20:29@chouserI don't know if rhickey would welcome a patch to fix all of them at once or not
20:29@chouserthey been getting fixed up a little as a time as other changes are mode.
20:29@chousermade
20:30bortrebI've never submitted a patch before -- should I try to do so for this?
20:31@chouserbortreb: if you like. the process is at http://clojure.org/contributing I think
20:32bortrebI think I will, if just to see how it's done. thanks chouser
20:33@chousersure. If you're interested in helping out, I'd recommend getting your CA going as that can take a couple weeks to get processed. Then meanwhile you can start a conversation on the google group to see if rhickey wants such a patch.
20:33bortrebI mailed it about two weeks ago already :)
20:33@chouserah, good for you. :-)
20:34bortrebhowever, it seems that it hasn't gone through... :(
20:34@chouseror halloway -- I think he can ask for tickets and patches now
20:34@chouserbortreb: it probably will, just give it time.
20:34bortrebthat's the google-dev group?
20:34@chouserum, either one. Not sure you can get on the dev list without your CA in or not.
20:35@chouserlast I heard, rhickey said he reads every message to both groups.
20:57trptcolindefn: regarding clojure-koans, join the fun at http://github.com/relevance/functional-koans/tree/clojure !
22:58vIkSiThi all
22:58vIkSiTdoes anyone here use emacs with a remote slime instance?
23:03kencauseyvIkSiT: I have in the past, but not with Clojure, just ask your question
23:03vIkSiTkencausey, ah ok.
23:03vIkSiTmy problem is that the default bindings in slime (Cc Ck) don't work on a remote instance
23:04tomojyou need to do something funky with tramp
23:04vIkSiTwhat happens is that slime tries to look at local files, where as i'm connected through tramp..
23:04tomojhttp://common-lisp.net/project/slime/doc/html/Setting-up-pathname-translations.html
23:04vIkSiTtomoj, ah yes
23:04tomojI haven't figured it out yet, good luck
23:04kencauseyhttp://asymmetrical-view.com/2009/08/20/emacs-slime-remote-repl.html
23:04kencauseyseen that?
23:05vIkSiTtomoj, the problem is - where do i get tramp-mode from?
23:05vIkSiTkencausey, checking..
23:05kencauseyjust googled it, so can't verify it will help
23:05tomojI think you already have tramp, just need the slime-tramp contrib
23:06tomojI don't know, though, how to add contribs if you're using elpa slime/slime-repl :(
23:06vIkSiTkencausey, i can do all of that mentioned on that link.. its just that if i'm working with a big program, i can't go to each defn and CxCe it..
23:06vIkSiTtomoj, exactly. how do i even get slime-tramp?
23:07vIkSiT(thats what i meant btw.. slime-tramp, not tramp-mode .. which i already have)
23:07tomojI guess the best way would be to get rid of elpa slime/slime-repl and figure out how to get clojure working with a real slime install
23:07tomojbut I haven't tried that yet either..
23:07vIkSiTalso - adding a contrib is easy right? just put it into .emacs.d/elpa.. correct dir in there
23:07bortrebwhat happened to lazy-cons?
23:08kencauseyvIkSiT: yeah, sorry after a quick scan myself I realized it doesn't seem to address your issue
23:09tomojbortreb: see http://clojure.org/lazy
23:14ihodestechnomany: if you're around and have a few minutes, i've got a few buffers with lein stuff up, and i have a few newbie questions about hacking on it
23:14ihodestechnomancy: the above ^
23:19trptcolinihodes: i may be able to help, depending on how newbie the questions are :)
23:21ihodestrptcolin: thanks! they're pretty basic, but relating to leiningen. so i'm in the leiningen.core namespace, and want to run the repl. which I can do with (-main "repl"). but i want to run it somewhere where i can test it. I see that the REPL has started, and is listening on XXXXX port, but I don't know how to interact with it there so I can see if I'm catching errors correctly
23:21ihodesany suggestions?
23:22trptcolinoh you mean interacting w/ it through the listening port?
23:22ihodessure!
23:22ihodesyes
23:23trptcolinunfortunately i haven't tried that yet :(
23:23ihodesah, a shame :( i'll wait on technomancy then haha. but thank you!
23:23trptcolinthat feature's actually less than a week old
23:23ihodesah no, not the new feature
23:24ihodesjust interacting with the REPL as you would if you ran lein repl
23:24ihodesbut i'm trying to launch it from swank, which i'm connected to with slime
23:25ihodesso i'm seeing this: user=> Connection opened on local port 4005
23:25ihodes#<ServerSocket ServerSocket[addr=localhost/127.0.0.1,port=0,localport=4005]>
23:25ihodes"REPL started; server listening on localhost:29562." after running (-main "repl) from within the repl in emacs
23:25trptcolinah. can't help you there. my emacs-fu is weak
23:25ihodespretend it's not emacs – i don't think it matters that it's in emacs. what would you do to try to launch it somewhere else, or interact with the listening REPL?
23:34technomancyihodes: C-u M-x telnet to connect to the repl
23:34technomancyihodes: but you'll want to make sure "lein repl" works from the command-line too of course
23:34technomancyboth inside and outside a project
23:37technomancytrptcolin: the repl task still isn't working outside the context of a project
23:38technomancythere's no way eval-without-project is going to have a copy of Clojure available since it never sets a classpath for the subprocess
23:38ihodestechnomancy: i get this when i try to telnet http://cl.ly/24rA
23:38technomancytrptcolin: I'm not convinced it actually needs a subprocess; running a repl inside lein's own classpath might be fine
23:39technomancyihodes: did you do C-u before M-x telnet?
23:39ihodesi did
23:39trptcolinah, crud. so i guess my global $CLASSPATH may have skewed my local results
23:39technomancyso you could set the port?
23:39ihodesyep
23:40technomancyihodes: weird; it works for me
23:40ihodeslet me shut it all down and try again
23:41technomancytrptcolin: when you run a repl inside the context of a project, it needs to be separate from leiningen's classloader
23:41technomancybut for repls outside a project it's not a big deal
23:42trptcolintechnomancy: ok, makes sense i think. i must have something else different w/ my setup though, because lein repl is still working fine for outside a project after blanking my CLASSPATH
23:42ihodestechnomancy: no-go. crap.
23:42technomancytrptcolin: any downsides to running the repl in-process though?
23:43technomancyihodes: if you're working through issue 95, I think that might be easier to do without getting swank involved
23:43ihodesdoesn't work from the command line either - same connections refused.
23:44ihodestechnomancy: fair enough: how, then, should i go about testing? (sorry for all these questions)
23:55trptcolintechnomancy: no downsides that i know of - though so far i've been unable to get output to my shell with (eval server-form)