2010-08-21
| 00:00 | bortreb | looking at my problem more, it's actually when I call .start rather than .run where the thread fails to print to thr repl |
| 00:00 | ninjudd | hiredman: it &env the variables defined at macro expansion time? |
| 00:00 | ninjudd | bortreb: try (let [temp *out*] (.start (Thread. (fn [] (binding [*out* temp] (println "hi")))))) |
| 00:02 | bortreb | ninjudd: nope --- it still prints to the swank terminal with binding |
| 00:02 | ninjudd | s/it/is/ |
| 00:02 | dsantiago | I 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:03 | wooby | ninjudd: http://j.mp/cF4mNm, the trick is bound-fn |
| 00:04 | ninjudd | bortreb: hmm, i'm testing with cake.. i can spin up swank and see if the behavior is any different |
| 00:04 | wooby | bortreb rather |
| 00:06 | ninjudd | bortreb: hmm, i just tested with swank. if i don't bind, it prints in the terminal. if i do, it prints in emacs |
| 00:07 | bortreb | wooby: 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:07 | phaer | clojure.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:07 | ninjudd | wooby: awesome. i didn't know about bound-fn |
| 00:09 | wooby | bortreb: because your *out* binding isn't copied to the function's thread, which is different |
| 00:09 | wooby | ninjudd: np :) |
| 00:10 | ninjudd | wooby: strange that binding worked for me but not bortreb |
| 00:10 | ninjudd | either way though, bound-fn is way simpler |
| 00:11 | wooby | i think the function may or may not run in the same thread context |
| 00:11 | ninjudd | i think it never does |
| 00:11 | wooby | i'm out folks, happy computing |
| 00:12 | bortreb | thanks |
| 00:13 | ninjudd | (println (Thread/currentThread)) |
| 00:13 | ninjudd | (.start (Thread. (bound-fn [] (println (Thread/currentThread))))) |
| 00:13 | ninjudd | always return different threads for me |
| 00:14 | ninjudd | wooby: thanks, later |
| 00:15 | ninjudd | has anyone heard anything about clojars being down? |
| 00:21 | slyrus | hiredman: 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:21 | slyrus | ,(into-array [1 2 3]) |
| 00:21 | clojurebot | #<Integer[] [Ljava.lang.Integer;@cf5d90> |
| 00:22 | slyrus | and 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:08 | technomancy | http://downforeveryoneorjustme.com/clojars.org <= It's not just you! http://clojars.org looks down from here. |
| 01:08 | technomancy | =( |
| 01:09 | technomancy | time to get some mirrors going |
| 01:09 | technomancy | I have access to the new clojars server, but I have no idea what the transition timeline looks like =\ |
| 01:10 | technomancy | if anyone who's good with sysadmin-y things could help out, please join http://groups.google.com/group/clojars-maintainers |
| 01:12 | ihodes | in my grogginess, I applied for membership. how good with sysadmin-y things…? |
| 01:13 | ihodes | technomancy: 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:13 | technomancy | honestly 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:14 | technomancy | the implementation of defmacro? hmm... |
| 01:14 | technomancy | I 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:15 | ihodes | that'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:16 | technomancy | I'm sure there's plenty still to learn about how to use it before you dive into how it works. |
| 01:16 | ihodes | as 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:17 | ihodes | there 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:17 | ihodes | forgive the awful spelling. this keyboard has had OJ spilled on it, and letters get missed… :( |
| 01:18 | ihodes | especially e's. |
| 01:18 | technomancy | hrm; well you could switch to dvorak and then be missing your . key |
| 01:18 | technomancy | looking forward to some lein patches from you. =) |
| 01:21 | technomancy | have you seen the 1.4 TODOs? |
| 01:21 | technomancy | I will try to post soon about more 1.4 low-hanging fruit |
| 01:21 | ihodes | i'm looking at them now :) |
| 01:21 | technomancy | though there will be a 1.3.1 first |
| 01:22 | ihodes | ah not 1.4 nevermind -- don't see that |
| 01:22 | technomancy | the main thing missing there is a good heuristic for determing when to pass the project map into a task |
| 01:22 | technomancy | since now for install and repl some arities take the project arg and some don't; slighly tricky to figure a good heuristic |
| 01:23 | technomancy | currently someone fixed the repl task but broke (in trunk) the standalone install task =\ |
| 01:24 | technomancy | ihodes: see "1.4.0 or later" here http://github.com/technomancy/leiningen/raw/5b76514ea6eda8bbbb80ab8dec39381b09eee2e7/todo.org |
| 01:25 | technomancy | anyway, headed off for today |
| 01:26 | technomancy | bye everyone! |
| 01:26 | ihodes | alright! i'm looking through the todos :) cheers |
| 01:26 | ihodes | and let me know re: adminning |
| 01:27 | technomancy | well I can't do anything about the current box |
| 01:27 | technomancy | just hope ato is reading his mail and can help speed up the move to the new one |
| 01:29 | ihodes | if 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:34 | ihodes | like "cljr swank" |
| 02:00 | ihodes | my 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:01 | ihodes | s/becase/before |
| 02:31 | scottj | Is there a syntax for writing (:use [foo a b] [foo.c d]) like (:use [foo a b c.d]) that I'm missing? |
| 03:16 | bortreb | scottj: unfortunately not. |
| 04:34 | scottj | technomancy: 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:35 | scottj | anyone know how? |
| 05:32 | Bjering | I 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:32 | Bjering | What I feel is that the declaration in the beginning of channel.clj is abit cludgy, is there a better way? |
| 05:34 | raek | circular dependencies should preferably be refactored into non-circular dependecies |
| 05:35 | raek | I'm curious, does that "forward declaration" of the namespace work? |
| 05:35 | scottj | Bjering: I hear ya, it's really annoying |
| 05:35 | Bjering | Yes, my code runs and tests pass |
| 05:36 | Licenser | Bjering: usually the best way is to remove the stuff that circle depends and move it to a 3rd namespace |
| 05:38 | raek | I've seen some tricks using :load to split a namespace into multiple source files |
| 05:39 | scottj | is this problem a direct result of the compiler requiring names to be declared before used? What's the reasoning for that again? |
| 05:39 | raek | perhaps merging the two namespaces could be an option too |
| 05:40 | Bjering | I 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:40 | Bjering | breaking |
| 05:45 | raek | there should be threads about this on the google groups |
| 05:45 | raek | the question pops up pretty regularly |
| 05:45 | raek | here is one: http://groups.google.com/group/clojure/browse_thread/thread/9ac0a7b24d80af93 |
| 05:48 | raek | and another: http://groups.google.com/group/clojure/browse_thread/thread/ff18795390b5960b/c6de04d84dca1626 |
| 05:51 | Licenser | Wow none of germans biggest IT magazines has published an article on clojure :) |
| 05:52 | Bjering | I 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:56 | raek | I think one of the reasons that circular namespace depenedencies are not allowed is because of macros |
| 05:57 | raek | since they are applied during compile-time |
| 05:58 | raek | and thus their code have to be loaded when a macro is used in the code |
| 06:00 | raek | if the functions are tighly coupled, maybe they belong in the same namespace |
| 06:02 | raek | sometimes, it makes sense to invert the control and make the user call the fns of the different namespaces |
| 06:04 | raek | another thought: maybe *all* channel related functions could be moved into the channel namespace |
| 06:04 | raek | a channel could be considered a collection of users |
| 06:04 | raek | there might be other such collections |
| 06:05 | raek | so why should the user code know about the collections it can occur in? |
| 06:05 | Bjering | User will soon be known by session |
| 06:06 | Bjering | session will learn when it was closed by network |
| 06:06 | Bjering | and then it will tel its user (if it has one) |
| 06:06 | Bjering | tell |
| 06:06 | Bjering | and user will tell all its channels |
| 06:06 | Bjering | so they can write "Jonas left" to all their users |
| 06:06 | raek | don't let the english language affect to much of the design |
| 06:07 | raek | maybe "user enters the room" should not be coded as user.enter(room), but rather room.add(user) |
| 06:08 | raek | anyway, gotta go now... good luck! |
| 06:08 | Bjering | thank you |
| 06:10 | Bjering | Basic question: If I want this to be done to my agent jonas, what should I send him? ((@jonas :write) @jonas "Hello") |
| 06:13 | Bjering | this (send jonas #((% :write) % "Hej")) |
| 06:13 | Bjering | :) |
| 06:29 | noidi | is there a list of breaking changes made in Clojure 1.2? |
| 06:29 | noidi | ,(byte 255) |
| 06:29 | clojurebot | java.lang.IllegalArgumentException: Value out of range for byte: 255 |
| 06:29 | noidi | that's one at least... |
| 06:29 | noidi | in 1.1 that returns -1 |
| 07:20 | Bjering | basic 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:24 | Chousuke | Bjering: use apply |
| 07:26 | Bjering | Chousuke, right, thank you. |
| 07:50 | Raynes | Hah, Joy is one of Manning's MEAP best sellers. |
| 07:54 | noidi | I bought it yesterday, when I noticed the -45% offer |
| 07:57 | Bahman | Hi all! |
| 09:07 | leafw | ,(clojure.core.stacktrace/print-cause-trace (new java.lang.Exception "buh!")) |
| 09:07 | clojurebot | java.lang.ClassNotFoundException: clojure.core.stacktrace |
| 09:07 | leafw | hum |
| 09:07 | leafw | isn't clojure.core.stacktrace part of clojure.jar now? |
| 09:07 | leafw | I opened the jar and it is there, and yet I can't execute it neither in my prompt nor in clojurebot |
| 09:08 | leafw | ,(clojure.stacktrace/print-cause-trace (new java.lang.Exception "buh!")) |
| 09:08 | clojurebot | java.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:08 | leafw | aha |
| 09:08 | leafw | without core |
| 09:10 | leafw | sigh, in my prompt that doesn't work either |
| 09:13 | leafw | ok, I can get it to work with (use 'clojure.stacktrace) |
| 09:13 | leafw | is there any reason why one can't call it directly? Perhaps it hasn't been AOT? |
| 10:07 | gfrlog | can clojure.core/iterate be used to create a finite seq? |
| 10:08 | rhudson | It generates a lazy sequence, so you can take part of it |
| 10:08 | gfrlog | ,(iterate #(if (neg? %) (inc %)) -10) |
| 10:08 | clojurebot | java.lang.NullPointerException |
| 10:09 | gfrlog | hmm |
| 10:09 | rhudson | ,(take-while neg? (iterate inc -10)) |
| 10:09 | clojurebot | (-10 -9 -8 -7 -6 -5 -4 -3 -2 -1) |
| 10:09 | gfrlog | but the list also contains 0 |
| 10:09 | rhudson | ? |
| 10:09 | gfrlog | the list ends in 0 |
| 10:10 | gfrlog | I guess I'm looking for a general way to make sure I get all of the list |
| 10:10 | rhudson | ,(take 20 (iterate inc -10)) |
| 10:10 | clojurebot | (-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9) |
| 10:10 | gfrlog | yes, that works if you know how many there are |
| 10:10 | rhudson | How do you know you've reached the end of the list? |
| 10:10 | gfrlog | that's the issue |
| 10:11 | gfrlog | I figured if the next function returned nil that would signal the end of the list |
| 10:11 | gfrlog | in the case of #(if (neg? %) (inc %)), it returns nil on input 0 |
| 10:11 | gfrlog | which apparently throws an NPE instead of terminating the list |
| 10:12 | rhudson | ,(inc nil) |
| 10:12 | clojurebot | java.lang.NullPointerException |
| 10:12 | gfrlog | (take-while #(not (nil? %)) (iterate #(if (neg? %) (inc %)) -10)) |
| 10:12 | gfrlog | ,(take-while #(not (nil? %)) (iterate #(if (neg? %) (inc %)) -10)) |
| 10:12 | clojurebot | (-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0) |
| 10:12 | gfrlog | so I guess that can work |
| 10:13 | rhudson | iterate will keep applying the function to the previous result for as long as you consume the sequence |
| 10:13 | gfrlog | okay |
| 10:13 | gfrlog | I think the take-while-not-nil function accomplishes what I wanted |
| 10:13 | rhudson | ,(take-while #(<= % 0) (iterate inc -10)) |
| 10:13 | clojurebot | (-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0) |
| 10:14 | gfrlog | yep |
| 10:14 | gfrlog | I'm not actually working with integers, so the #(<= % 0) wouldn't work generally |
| 10:14 | gfrlog | thanks for the help |
| 10:14 | rhudson | you're welcome |
| 10:17 | rhudson | If 'false isn't a value in your sequence, you can use identity as the func intstead of #(not (nil? %)) |
| 10:20 | gfrlog | oh that's a good idea |
| 10:43 | fbru02 | hey guys anyone knows why i get "that's nto a task " when i do lein swank ? |
| 10:47 | leafw | ,(doc vector-of) |
| 10:47 | clojurebot | "([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:47 | leafw | that gets close to Vector<T> in C++ STL lib |
| 10:47 | leafw | will it ever support arrays of any kind? I.e. :^String, or whatever? |
| 10:48 | Raynes | fbru02: 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:51 | fbru02 | Raynes: thanks , I did that, i did lein deps , but still nothing |
| 10:52 | Raynes | fbru02: Is swank-clojure in lib/dev? |
| 10:54 | fbru02 | Raynes: now i did it right and it works thanks |
| 11:24 | limux1972 | where is the doc of syntax quote ~' |
| 11:25 | limux1972 | and the source of it |
| 11:28 | qbg | limux1972: I just responded to you on the list |
| 11:29 | limux1972 | thanks |
| 11:30 | qbg | syntax-quote is also documented at http://clojure.org/reader |
| 11:34 | limux1972 | `~foo will get the value of foo, just `~'foo get foo, isn't it? |
| 11:35 | qbg | ,'`~foo |
| 11:35 | clojurebot | foo |
| 11:35 | qbg | ,'`~'foo |
| 11:35 | clojurebot | (quote foo) |
| 11:35 | qbg | ,`~= |
| 11:35 | clojurebot | #<core$_EQ_ clojure.core$_EQ_@4df262> |
| 11:35 | qbg | ,`~'= |
| 11:35 | clojurebot | = |
| 11:36 | limux1972 | yes |
| 11:38 | limux1972 | is there any way for me to run into the clojure to see how it works |
| 11:38 | noidi | limux1972, `foo will exapand to "foo" qualified with the namespace it is defined in, e.g. bar/foo |
| 11:39 | noidi | limux1972, 'foo will expand to just the symbol foo |
| 11:40 | qbg | The syntax-quote reader is defined in clojure.lang.LispReader |
| 11:40 | noidi | `~foo expands to the value that the symbol foo refers to, e.g. ,(let [foo 3] `~foo) expands to 3 |
| 11:40 | noidi | ,(let [foo 3] `~foo) |
| 11:40 | clojurebot | 3 |
| 11:40 | limux1972 | i know what you say |
| 11:41 | noidi | ok |
| 11:41 | qbg | But reading the source of it probably isn't going to be too helpful |
| 11:41 | noidi | there's nothing special about ~' |
| 11:42 | noidi | it's just a way in which ` ' and ~ are used together |
| 11:44 | limux1972 | perhaps i will understand it better after reading it's source |
| 11:44 | limux1972 | or do some moretest |
| 11:45 | qbg | It starts at line 683 in LispReader.java for me |
| 11:48 | limux1972 | mine is at 680, class of SyntaxQuoteReader |
| 11:51 | ihodes | hey clojurilliacs |
| 11:51 | ihodes | is BigDecimal the way to get arbitrary precision decimals in Clojure? |
| 11:51 | ihodes | or is there another way |
| 11:52 | qbg | Yes |
| 11:52 | technomancy | ihodes: hey, about your question from last night... |
| 11:52 | technomancy | yeah, it makes sense to let swank run from any dir |
| 11:52 | technomancy | I got a patch to do that with the repl task |
| 11:52 | technomancy | but right now the logic to determine which tasks need a project arg needs fixing |
| 11:52 | ihodes | qbg: yes that BD is the *the* way? thanks! |
| 11:53 | technomancy | actually, 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:53 | ihodes | technomancy: i was looking at that heuristic. right now it's *just* if 'project is in the argulist? |
| 11:53 | technomancy | ihodes: right; that's not going to cut it |
| 11:54 | ihodes | yeah i'm all hot'n'bothered over what the hell swank is doing. it's living in .m2 as well as ~/.swank-clojure |
| 11:54 | technomancy | that's from swank-clojure.el |
| 11:54 | ihodes | i figured |
| 11:54 | technomancy | been deprecated for some time now |
| 11:54 | ihodes | right |
| 11:55 | ihodes | it'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:55 | ihodes | and 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:56 | technomancy | yes, M-x slime is swank-clojure.el |
| 11:57 | ihodes | so 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:57 | technomancy | correct |
| 11:58 | ihodes | so 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:59 | ihodes | or pass a ~/.lein/project.clj map instead |
| 12:00 | ihodes | (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:01 | dsantiago | Hm, 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:02 | technomancy | ihodes: actually... I think I just got it |
| 12:03 | ihodes | dsantiago: 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:03 | ihodes | technomancy: oh how? |
| 12:03 | mrBliss | If 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:04 | ihodes | mrBliss: i'm interested :) |
| 12:04 | technomancy | dsantiago: that's odd; never seen that before |
| 12:04 | ihodes | mrBliss: though lately cljr swank has stopped starting up swank…no idea why. another thing to troubleshoot. |
| 12:04 | technomancy | ihodes: I just need the project-needed? predicate to take a single arity rather than the full arglists |
| 12:04 | mrBliss | works fine for me (even on Windows!) |
| 12:05 | mrBliss | cygwin + windows command prompt |
| 12:05 | mrBliss | http://gist.github.com/542493 |
| 12:05 | mrBliss | it assumes cljr is in your path (which probably is the case anyway ;-) |
| 12:06 | ihodes | technomancy: love it when the solution's simple. |
| 12:06 | technomancy | well that's a slight oversimplification, but you can read the whole story as soon as I commit. =) |
| 12:07 | ihodes | mrBliss: it worked fine for me! must be something I accidentally touched… sigh. thanks for the .el! |
| 12:07 | rahulkmr | Does vimclojure work with clojure 1.2? |
| 12:21 | dsantiago | ihodes: yes, exactly. It won't recognize Slime key-commands until I M-x slime. |
| 12:21 | dsantiago | I usually now do M-x slime, then close everything down, and then do lein swank/M-x slime-connect. |
| 12:23 | dsantiago | Just occurred to me: Should I uninstall swank-clojure from ELPA? |
| 12:24 | limux1972 | ` is a SyntaxQuoteReader, ~ is a UnquoteReader, ' is a QuoteReader |
| 12:28 | ihodes | i'd try that, but it works for me without swank-clojure |
| 12:28 | ihodes | you can take a look at my messy emacs init.el file on github, if you want to see what works |
| 12:28 | ihodes | http://github.com/ihodes/dotfiles |
| 12:35 | technomancy | dsantiago: couldn't hurt |
| 12:46 | dsantiago | Dang, I can't find a command to remove a package anywhere. |
| 12:49 | rlb | Is there already a function that will just feed an inputstream to an output stream until eof? |
| 12:49 | mrBliss | rlb: copy in clojure.java.io |
| 12:50 | technomancy | ihodes: if you want to help out with lein sooner rather than later I'd be glad to have help with issue 95 |
| 12:50 | rlb | excellent -- thanks. |
| 12:50 | technomancy | http://github.com/technomancy/leiningen/issues#issue/95 |
| 12:51 | technomancy | just needs some strategic try/catch in leiningen.repl/repl-client |
| 12:53 | ihodes | checking it out now |
| 13:06 | rlb | Are the correct delineators between a generic byte stream and a generic character stream (instance? java.lang.Readable x) and (instance? java.io.InputStream)? |
| 13:25 | noidi | phew... 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:25 | noidi | and 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:31 | noidi | oops, 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:45 | rlb | Anyone know if providing :encoding nil is the same as not providing an encoding for (reader ...)? |
| 13:49 | dulanov | (defn- ^String encoding [opts] |
| 13:49 | dulanov | (or (:encoding opts) "UTF-8")) |
| 13:50 | dulanov | so, as not provided |
| 13:57 | no_mind | Searching for an example of Velocity templating engine called from clojure but no luck. Any pointers ? |
| 14:05 | rlb | dulanov: thanks - I should have noticed that... |
| 14:09 | rlb | Should (use 'clojure.java.shell) (prn (sh "ls" "-al")) hang when run from the shell via clojure.main? |
| 14:10 | rlb | The map is printed, but clojure never exits. |
| 14:10 | rlb | (This is with 1.2.0.) |
| 14:12 | rlb | Adding a (System/exit 0) at the end does cause it to exit. |
| 14:39 | chouser | rlb: I think c.j.shell uses thread pools now, so you might need (shutdown-agents) to allow your program to exit. |
| 14:47 | rlb | chouser: 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:48 | rlb | I'd like to be able to chain invocations (i.e. pipes). |
| 14:48 | rlb | (and to build lazy line sequences) |
| 14:49 | rlb | chouser: shutdown-agents fixes it -- thanks. |
| 14:53 | chouser | the 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:54 | chouser | brb |
| 14:59 | rlb | chouser: 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:00 | rlb | ...looking at the work I did a while back, I had also hacked up a "(reader-seq regex-delim reader)". |
| 15:00 | rlb | (perhaps a bad name...) |
| 15:03 | rlb | Overall, I was thinking of something like this: |
| 15:04 | rlb | (sh "tar" "--files-from" "-" :in (seq->stream (filter ... (sh-seq "find" ...)))) |
| 15:04 | rlb | roughly. |
| 15:06 | rlb | Though I suppose given the above, you might not want seq->stream, but rather an :in that can handle a sequence of strings. |
| 15:07 | rlb | Oh wait, of course, line-seq doesn't do anything about closing the reader. |
| 15:08 | LauJensen | rlb: What was that snippet supposed to do ? |
| 15:10 | rlb | LauJensen: 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:11 | LauJensen | Yea 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:11 | LauJensen | (at least that has been my experience) |
| 15:11 | rlb | LauJensen: sure, but I'd rather not have to commit to (re)writing every useful tool in java. |
| 15:11 | LauJensen | Of course not |
| 15:12 | rlb | But chouser mentioned the problem of handling (cleaning up) all the process streams. |
| 15:13 | LauJensen | How much of a mess is involved? |
| 15:14 | rlb | I'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:14 | rlb | That's harder if you're chaining sh calls either with each other, or interleaved with normal seq ops. |
| 15:15 | LauJensen | So perhaps a (with-sh-stream ...) macro would be the right way to go, that way it could tie up any loose ends |
| 15:17 | rlb | LauJensen: 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:17 | rlb | I 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:17 | rlb | And then sh (or whatever) could return those. |
| 15:18 | LauJensen | I dont see how the consumer of an eight components long chain would want to have more than stdout/stderr |
| 15:21 | @chouser | rlb: side-effects (like closing a stream) tied to the consumption of a lazy-seq strikes me as fragile. |
| 15:26 | LauJensen | chouser: why? Its similar to the resultsetseq in contrib.sql ? |
| 15:28 | @chouser | also similar to c.c.io/read-lines (which didn't make it into c.j.io) |
| 15:29 | @chouser | but 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 | @chouser | use what you need, abandon the rest. |
| 15:30 | @chouser | to have some of the lazy-seqs in your program leak file handles in those circumstances seems like asking for trouble. |
| 15:30 | LauJensen | Yea I understand. So how would you handle this situation, if the 'stream' was too big to keep in memory ? |
| 15:33 | LauJensen | @ chouser |
| 15:35 | rlb | chouser: 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 | @chouser | LauJensen: not sure -- part of why I didn't do it already. -) |
| 15:37 | LauJensen | chouser: Do you agree that some like with-stream would make for an akward solution? |
| 15:39 | @chouser | for single streams, using something like (with-open [r (reader ...)] ... (line-seq r) ...) works well. The use explicitly creates and destorys the resource. |
| 15:39 | @chouser | LauJensen: yeah, when you're wanting to chain pipes together, you'd hate to have to nest or otherwise call out each step individually. |
| 15:41 | LauJensen | chouser: 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:43 | rlb | chouser: 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:43 | rlb | i.e. (sh "cat" "/dev/zero") |
| 15:44 | @chouser | I mean, a natural extension of with-open to sh would be something like (with-sh [out err "ls ..."] ...) |
| 15:45 | rlb | (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:46 | noidi | chouser, btw, the joy of clojure uses the word seq a lot without explaining what a "seq" means |
| 15:46 | @chouser | noidi: :-( |
| 15:46 | noidi | sorry if this has been reported already, I was just reading the e-book I bought yesterday and it caught my attention |
| 15:47 | @chouser | noidi: ah, I forget nobody has access to the latest version. |
| 15:47 | @chouser | we keep rearranging chapters and sections, which has caused things to be introduced out of order with when their defined. |
| 15:48 | @chouser | I hope we have most of those fixed now, and there should be a new MEAP of the entire book within a week. |
| 15:48 | rlb | chouser: you could always support a with-sh like let (i.e. successive bindings), but it's still awkward perhaps. |
| 15:48 | noidi | chouser, okay, cool :) |
| 15:49 | noidi | in yesterday's version the first three mentions of seq are: |
| 15:49 | noidi | 1. Chunked seqs and transients can make a huge difference with little or no change to your code. |
| 15:49 | noidi | 2. for returns a lazy seq while doseq is for generating side effects |
| 15:49 | noidi | 3. You can use into to build any of these types, seq to get a lazy seq to walk through them |
| 15:49 | noidi | which might be a bit confusing for newbies :) |
| 15:50 | rlb | I'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 | @chouser | rlb: 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:52 | rlb | chouser: 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:54 | rlb | That'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 | @chouser | rlb: I think that's right. |
| 15:59 | @chouser | There'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 | @chouser | maybe pods. maybe scopes. |
| 16:01 | rlb | chouser: 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:01 | rlb | chouser: in any case, that's helpful. Thanks. |
| 16:04 | metagov | A fairly general macro I'm using to debug my (->> ...) code: http://gist.github.com/542719 |
| 16:04 | rlb | chouser: 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:05 | rlb | chouser: 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:06 | metagov | Specifically, I just replace '->>' with 'lazy ->>' in the repl so I can see the intermediate values. |
| 16:15 | rlb | chouser: wait, actually, the big problem is that you'd need a finalizer too. I wasn't thinking about that yet -- not good. |
| 16:17 | ninjudd | metagov: nice |
| 16:21 | bortreb | rlb: how about something like a shell-monad which handles errors and closing resources and piping junk around |
| 16:21 | bortreb | rlb: I feel like sequences are too lightweight for this sort of thing |
| 16:22 | metagov | ninjudd: thanks :-) |
| 16:22 | metagov | I'm not very attached to the name 'lazy' BTW. |
| 16:23 | hiredman | there is a set of monadic io stuff in contrib |
| 16:25 | bortreb | composing shell calls feels to me like a combination of a "close open junk" monad and the error-handling monad |
| 16:33 | polypus | technomancy: you around? |
| 16:33 | LauJensen | I hope monads are not in too wide use in Clojure yet? |
| 16:35 | bortreb | LauJensen: they don't seem to be --- don't like them? |
| 16:35 | LauJensen | Not in Clojure |
| 16:35 | bortreb | why's that? |
| 16:35 | polypus | i 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:36 | polypus | s/i did i/i did a |
| 16:36 | LauJensen | bortreb: 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:37 | qbg | Parser monads may be useful |
| 16:38 | LauJensen | Where? |
| 16:38 | clojurebot | where is log |
| 16:38 | LauJensen | clojurebot: botsmack |
| 16:38 | clojurebot | Owww! |
| 16:38 | rhudson | Monads aren't just about state |
| 16:39 | LauJensen | go on |
| 16:39 | rlb | bortreb: not sure -- have to think about it. |
| 16:39 | rhudson | Wikipedia article's actually pretty good: http://en.wikipedia.org/wiki/Monad_(functional_programming) |
| 16:40 | LauJensen | I'll check it out... eventually :) |
| 16:41 | rhudson | -?> is arguably a kind of monad |
| 16:41 | fbru02 | rhudson: what's the use of monads in a dynamic language? |
| 16:41 | qbg | for is basically the list monad |
| 16:42 | bortreb | LauJensen: I see monads not as a crutch for hiding state, but as a way of describing computation. |
| 16:42 | bortreb | let and for are both types of monads :) |
| 16:43 | fbru02 | bortreb: i kind of agree, but they more useful in a static type system |
| 16:43 | rhudson | Monads and type systems aren't closely coupled concepts. It's just that everybody (including me) first heard of them in Haskell |
| 16:45 | rhudson | But I think they showed up in Haskell more because you really need *something* to handle side effects in a pure functional lang |
| 16:45 | LauJensen | Im 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:46 | rhudson | Me neither. But bortreb's suggestion of a "pipe monad" got me thinking |
| 16:46 | fbru02 | how do you explain bind ( (>>=) :: m a -> (a -> m b) -> m b in clojure terms ? |
| 16:46 | LauJensen | fbru02: how do you explain it in english ? |
| 16:46 | rhudson | I don't :) |
| 16:47 | fbru02 | LauJensen: rhudson yeah i mean, without involving types |
| 16:47 | clojurebot | LauJensen is some dane |
| 16:47 | rhudson | But as I recall the clojure contrib monad stuff links to a pretty good explanation |
| 16:47 | fbru02 | i will check that out |
| 16:47 | qbg | There is a tutorial on the internet about monads in Clojure |
| 16:47 | LauJensen | hehe |
| 16:48 | LauJensen | There'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:48 | qbg | Isn't the identity bind (fn [x f] (f x))? |
| 16:48 | fbru02 | Bind 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:48 | clojurebot | monads is http://okmij.org/ftp/Scheme/monad-in-Scheme.html |
| 16:49 | bortreb | holy **** how is the clojurebot doing that? |
| 16:49 | LauJensen | hiredman: Are you working on a conversation module for clojurebot? |
| 16:49 | rhudson | LauJensen: to be fair, lots of people seem to have your reaction to immutable collections, STM, macros, even s-expressions |
| 16:49 | LauJensen | sure - Im not knocking monads, Im just saying I never saw the need for them in Clojure |
| 16:50 | qbg | Hearing 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:50 | bortreb | you need them less I feel because you've already got the most common ones like for built in |
| 16:50 | qbg | Which is kind of disappointing :) |
| 16:51 | bortreb | they're only good when you have a bunch of functions that all have the same boilerplate linking code |
| 16:51 | rhudson | fbru02: there's links from http://clojure.github.com/clojure-contrib/monads-api.html |
| 16:51 | fbru02 | rhudson: thanks |
| 16:51 | qbg | Yeah, I was talking about those |
| 16:52 | bortreb | like, 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:52 | bortreb | but hey, maybe shell calls can be seen in that way? |
| 16:53 | rhudson | Yeah, that was an intriguing idea |
| 16:53 | bortreb | what does the RT in clojure.RT actually stand for? |
| 16:53 | rhudson | runtime? |
| 16:54 | qbg | It took me a while to realize that... |
| 16:54 | bortreb | :rhudson thank you :) |
| 16:56 | rhudson | Maybe if they were called "pipelines" instead of "monads" they wouldn't have such an offputting mystique |
| 16:57 | qbg | But can you clog a monad up? |
| 16:58 | rhudson | "A monad is just a monoid in the category of functors. What's the problem?" <-- That's the problem |
| 16:58 | bortreb | you cna sort of clog maybe-m up :) |
| 16:58 | bortreb | thank you, math people |
| 16:58 | rhudson | That terminology clogs my brain up |
| 16:58 | bortreb | that really makes it easier to understand! |
| 16:59 | qbg | monoids are easy to understand |
| 17:00 | metagov | I'm glad I'm not the only one who struggles with monadolgy |
| 17:03 | LauJensen | Its horrible that even in computer science, a name can become a stumpling block |
| 17:03 | bortreb | everything'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:04 | metagov | And if you really want pain, try reading wikipedia on Arrows of which monads are a subset. |
| 17:04 | metagov | Really, just try reading this: http://en.wikipedia.org/wiki/Arrows_in_functional_programming |
| 17:04 | brx | http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/ |
| 17:05 | bortreb | again, 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:09 | TanisWolf_ | Hey people, anyone know what I am doing wrong? "(alength (.getConstructors (.getClass java.io.File)))" returns 0 not 4 |
| 17:09 | rhudson | I 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:09 | rhudson | I even sort of wrapped my head around monads, for a week or two at a time. |
| 17:09 | LauJensen | Nice. rhudson have you tried J or K ? |
| 17:10 | rhudson | But learning an unfamiliar branch of math to understand the explanations was a bit much |
| 17:10 | rhudson | No I haven't LauJensen. I've seen some code samples of J, which didn't much inspire me. |
| 17:11 | LauJensen | rhudson: 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:11 | LauJensen | (I still have forsaken trying to call J from Clojure) |
| 17:12 | rhudson | Part 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:13 | rhudson | Plus I'm more of a dynlang kinda guy. |
| 17:14 | rhudson | I'd be interested in the J blogpost(s). |
| 17:14 | @chouser | TanisWolf_: The Class class has no ctors -- that's what your expression is telling you |
| 17:15 | @chouser | TanisWolf_: try (.getConstructors java.io.File) |
| 17:15 | TanisWolf_ | ahh thanks, it was really starting to drive me mad!!! |
| 17:15 | bortreb | whenever you see .getClass in java the translation for clojure is just not to use it |
| 17:15 | @chouser | the Class class is easy to trip on |
| 17:16 | rhudson | I think Java is actually the only JVM language where you can't use the name of a class to reference its class. :( |
| 17:16 | TanisWolf_ | doh seems obvious now, thanks people! |
| 17:16 | LauJensen | rhudson: #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:17 | rhudson | thanks |
| 17:17 | rhudson | It's like having to say 1.getValue() |
| 17:18 | technomancy | polypus: hey |
| 17:20 | polypus | hi |
| 17:21 | polypus | technomancy: hi |
| 17:21 | dnolen | nice aleph gets websockets support |
| 17:23 | technomancy | polypus: just answered your email actually |
| 17:23 | polypus | technomancy: ok am looking now |
| 17:26 | scottj | technomancy: 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:27 | technomancy | scottj: just place the jar in ~/.lein/plugins |
| 17:27 | technomancy | it's in the "Configuration" section of the readme |
| 17:29 | rhudson | Re 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:30 | polypus | technomancy: 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:31 | technomancy | polypus: no, the fix only needs to be applied on the machine that generates the jar |
| 17:31 | polypus | technomancy: ok ty good to know |
| 17:31 | technomancy | I hope the 1.3.1 fix is only a few days away though |
| 17:32 | polypus | you mean till it's on the stable branch? |
| 17:32 | technomancy | not yet, hopefully soon |
| 17:32 | LauJensen | rhudson: 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:32 | scottj | technomancy: 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:33 | technomancy | scottj: it doesn't have to technically be a leiningen plugin with its own leiningen task to go in ~/.lein/plugins |
| 17:34 | technomancy | but I don't know what you'd put in init.clj for that lib specifically; I haven't used it |
| 17:34 | scottj | will all jars in plugins get loaded just like they would in dev-dependencies? |
| 17:35 | technomancy | they will be on the classpath just like dev-dependencies |
| 17:35 | LauJensen | A little OT: Any recommendations for the best keyboard out there for development? |
| 17:35 | technomancy | scottj: if they involve hooks you will still need to require them in init.clj |
| 17:36 | technomancy | LauJensen: Model M if you don't have RSI problems. No comparison there. |
| 17:36 | LauJensen | hehe, please... |
| 17:36 | LauJensen | Im currently on a Dinovo Edge, which has been fantastic, but its worn down |
| 17:36 | technomancy | if you do have RSI problems, I recommend the Kinesis advantage or freestyle |
| 17:36 | LauJensen | technomancy: Thats not the stuff you have strapped on your legs is it? |
| 17:37 | technomancy | LauJensen: that's the freestyle |
| 17:38 | technomancy | it's only USD100; the advantage is 300; almost certainly the best |
| 17:39 | rhudson | I'd say the MacBook Pro -- keyboard comes with a very useful attachment :) |
| 17:39 | LauJensen | The advantage looks interesting |
| 17:39 | technomancy | the only other thing that comes close for RSI is http://www.datahand.com/ |
| 17:40 | LauJensen | RSI? Thats some kind of sickness isnt it ? |
| 17:40 | technomancy | but if you don't have RSI you want a model M. everything else is weak sauce. |
| 17:40 | technomancy | repetitive stress injury |
| 17:40 | LauJensen | I dont have that, I just want to be fast |
| 17:40 | LauJensen | technomancy: model m as in that dinosaur from IBM ? |
| 17:41 | technomancy | I think you mean classic. |
| 17:41 | LauJensen | first hit on google |
| 17:41 | polypus | LauJensen: i quit like the new mac keyboards myself, dunno about "the best", but i like the feel |
| 17:42 | AWizzArd | better than Model M is a “Das Keyboard”: http://www.daskeyboard.com/ |
| 17:42 | LauJensen | polypus: honestly the mac keyboards are pathetic. Like anything Apple does it appeals to the eyes and not much else |
| 17:42 | AWizzArd | The Das Ultimate |
| 17:42 | rhudson | I totally disagree |
| 17:42 | scottj | I wasn't very successful using a mac wireless keyboard in ubuntu, granted I only spent 20 minutes before giving up |
| 17:42 | rhudson | But it's a very personal choice |
| 17:42 | LauJensen | AWizzArd: Now that looks interesting, are you on that ? |
| 17:42 | AWizzArd | LauJensen: of course |
| 17:43 | LauJensen | Cool |
| 17:43 | AWizzArd | I have one in my office too. |
| 17:43 | LauJensen | And its fast? |
| 17:43 | technomancy | you can get a model M with a trackpoint and no numpad now I think |
| 17:43 | AWizzArd | Mechanical gold switches, extremly good quality |
| 17:43 | LauJensen | Im intruiqued |
| 17:43 | LauJensen | And I dont even know how to spell that :) |
| 17:43 | technomancy | the mac ones are way better than the old mushy ones |
| 17:43 | technomancy | but still only sorta meh |
| 17:43 | polypus | Lau: well, i disagree. i quite like the feel, but true about the eyes |
| 17:43 | AWizzArd | LauJensen: how fast are you? http://speedtest.schnell-schreiben.de/ chose your language and measure your typing speed |
| 17:44 | technomancy | the pre-unibody ones were awful |
| 17:44 | polypus | there's always stallman's fav: http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard |
| 17:45 | LauJensen | AWizzArd: I'll try - Me vs the Mac girls :) |
| 17:45 | AWizzArd | I just did 550 keys per minute |
| 17:45 | technomancy | if I didn't have RSI issues I would certainly get one of these: http://pckeyboards.stores.yahoo.net/en104wh.html |
| 17:46 | LauJensen | 616 chars per minute, I missed 4 chars |
| 17:46 | LauJensen | technomancy: How did you contract that? |
| 17:47 | LauJensen | (other than typing like a mad man) |
| 17:48 | scottj | LauJensen: wow, qwerty? |
| 17:48 | LauJensen | polypus: stalllmans look interesting |
| 17:48 | LauJensen | scottj: yea |
| 17:48 | AWizzArd | LauJensen: grats! I often do not mistype any. I am typing with the Neo-Layout. |
| 17:48 | LauJensen | AWizzArd: whats that? |
| 17:48 | technomancy | LauJensen: as far as I can tell I got it from typing with bad posture on non-ergonomic keyboards |
| 17:48 | AWizzArd | A keyboard layout which is particular well suited to write german and english texts, and for programmers |
| 17:49 | LauJensen | technomancy: ok - so you noticed because you had pains? |
| 17:49 | technomancy | LauJensen: right |
| 17:49 | LauJensen | ok |
| 17:49 | scottj | I have a HHK and like it but prefer dedicated func keys and media buttons |
| 17:49 | LauJensen | Sorry to hear that |
| 17:49 | LauJensen | AWizzArd: Must check that out |
| 17:49 | technomancy | you just have to be really sensitive to early-warning signs: tingling in your wrists and such |
| 17:50 | technomancy | I 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:50 | LauJensen | technomancy: 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:50 | AWizzArd | LauJensen: 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:50 | technomancy | right, that's supposed to help a lot. /me really should too |
| 17:51 | technomancy | also my RSI was worse before I switched to dvorak; there's much more hand movement with qwerty |
| 17:51 | LauJensen | AWizzArd: Crazy - You need a special keyb for that ? |
| 17:51 | LauJensen | technomancy: Yea you're not the first Ive heard say that |
| 17:52 | AWizzArd | LauJensen: no, only a setting in Ubuntu/Windows/Mac. |
| 17:52 | LauJensen | oh |
| 17:52 | AWizzArd | Then 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:53 | AWizzArd | That's why a Das Keyboard Ultimate is nice - it shows no keys, it is completely black. |
| 17:53 | scottj | of course you're muscle memory for emacs etc will all be wrong then |
| 17:53 | technomancy | it were a blast |
| 17:53 | AWizzArd | Emacs was a bit tricky - for 5 days. |
| 17:53 | LauJensen | scottj: that will be a problem |
| 17:53 | AWizzArd | In the past 4 years however it was fine :) |
| 17:54 | AWizzArd | Clojure was also strange in the first days. |
| 17:54 | LauJensen | hehe |
| 17:54 | AWizzArd | But the thing about being a newb is: this is the shortest amount of time one spends in a given status. |
| 17:54 | AWizzArd | Most of the time one is a Pro. |
| 17:55 | LauJensen | yea - The capslock/ctrl swap was annoying for a very short time |
| 17:55 | LauJensen | although, still annoying if not on my own system |
| 17:55 | scottj | is dvorak still better than neo if you only write english/program? |
| 17:56 | scottj | where better = less finger movement |
| 17:56 | TanisWolf_ | 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:57 | AWizzArd | TanisWolf_: check out filter, take-while, iterate, repeatedly |
| 17:57 | LauJensen | Guys - Thanks for all your input on the OT discussion on keyboards, much appreciated! |
| 17:59 | AWizzArd | LauJensen: 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:00 | LauJensen | haha - that sounds annoying |
| 18:00 | LauJensen | Dinovo Edge is very silent, like a laptop keyboard, which I like |
| 18:00 | AWizzArd | it helps to get not only tactile feedback, but also an accoustical |
| 18:00 | AWizzArd | Anyway, there is also a Das Silent. |
| 18:00 | LauJensen | yea I just saw |
| 18:01 | LauJensen | "The silent model (read not silent, but less clicky) is ideal for people..." |
| 18:01 | ragnard | Has anybody tried a TypeMatrix keyboard? |
| 18:01 | AWizzArd | LauJensen: btw, they advertise with "best-in-class" :) |
| 18:01 | LauJensen | AWizzArd: wanna-bes :) |
| 18:03 | LauJensen | this looks nice: http://www.youtube.com/watch?v=t1XBmmsP2gI&feature=related |
| 18:06 | LauJensen | I must admit Das Keyboard have designed a very nice sound when clicking, not like I remember my first IBM keyboard |
| 18:09 | AWizzArd | LauJensen: I always brought my Das Keyboard into the offices where I worked, and it never bugged people. |
| 18:09 | LauJensen | Good to know |
| 18:22 | bmh | heya #clojure. |
| 18:24 | LauJensen | heya bmh |
| 18:26 | bmh | I implemented linear time median finding, but I think the code could use a bit of cleanup |
| 18:27 | bmh | http://github.com/dstu/Mapatorious/blob/master/src/main/clojure/util/select.clj |
| 18:28 | bmh | also, is there a function that executed filter/remove simultaneously and returns two collections? |
| 18:30 | rhudson | bmh, group-by will do it if the predicate is boolean |
| 18:32 | bortreb | how 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:32 | bmh | rhudson: I can't believe I overlooked that! |
| 18:34 | rhudson | bmh, or (juxt filter remove) |
| 18:36 | trptcolin | bortreb: the "first" after clojure.lang.RT gets called in Java-land. something like clojure.lang.RT.first(coll) |
| 18:37 | trptcolin | just like you can do: (. "foo" (contains "o")) without defining "contains" |
| 18:38 | rhudson | The more usual style would be (clojure.lang.RT/first coll) |
| 18:38 | bortreb | trpcolin: oh I see. thanks. but, why write it that way instead of the more idiomatic way? |
| 18:39 | bortreb | is it faster or something? |
| 18:39 | rhudson | I think it's an older notation |
| 18:43 | trptcolin | they look pretty equivalent speed-wise to me |
| 18:44 | bortreb | if 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:49 | trptcolin | bortreb: 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:57 | tomoj | vec uses both |
| 18:58 | tomoj | then hash-map and hash-set use each respectively |
| 18:58 | tomoj | can't imagine there's any good reason for that.. |
| 19:55 | defn | ooo! I need to make clojure-koans |
| 20:25 | bortreb | ,(cons 4 [1 2 3]) |
| 20:25 | clojurebot | (4 1 2 3) |
| 20:25 | bortreb | (.cons [1 2 3] 4) |
| 20:25 | bortreb | ,(.cons [1 2 3] 4) |
| 20:25 | clojurebot | [1 2 3 4] |
| 20:25 | bortreb | what'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:28 | bortreb | oh ok |
| 20:29 | @chouser | regarding 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:29 | bortreb | so then, would it be good to change core to reflect that? |
| 20:29 | @chouser | I don't know if rhickey would welcome a patch to fix all of them at once or not |
| 20:29 | @chouser | they been getting fixed up a little as a time as other changes are mode. |
| 20:29 | @chouser | made |
| 20:30 | bortreb | I've never submitted a patch before -- should I try to do so for this? |
| 20:31 | @chouser | bortreb: if you like. the process is at http://clojure.org/contributing I think |
| 20:32 | bortreb | I think I will, if just to see how it's done. thanks chouser |
| 20:33 | @chouser | sure. 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:33 | bortreb | I mailed it about two weeks ago already :) |
| 20:33 | @chouser | ah, good for you. :-) |
| 20:34 | bortreb | however, it seems that it hasn't gone through... :( |
| 20:34 | @chouser | or halloway -- I think he can ask for tickets and patches now |
| 20:34 | @chouser | bortreb: it probably will, just give it time. |
| 20:34 | bortreb | that's the google-dev group? |
| 20:34 | @chouser | um, either one. Not sure you can get on the dev list without your CA in or not. |
| 20:35 | @chouser | last I heard, rhickey said he reads every message to both groups. |
| 20:57 | trptcolin | defn: regarding clojure-koans, join the fun at http://github.com/relevance/functional-koans/tree/clojure ! |
| 22:58 | vIkSiT | hi all |
| 22:58 | vIkSiT | does anyone here use emacs with a remote slime instance? |
| 23:03 | kencausey | vIkSiT: I have in the past, but not with Clojure, just ask your question |
| 23:03 | vIkSiT | kencausey, ah ok. |
| 23:03 | vIkSiT | my problem is that the default bindings in slime (Cc Ck) don't work on a remote instance |
| 23:04 | tomoj | you need to do something funky with tramp |
| 23:04 | vIkSiT | what happens is that slime tries to look at local files, where as i'm connected through tramp.. |
| 23:04 | tomoj | http://common-lisp.net/project/slime/doc/html/Setting-up-pathname-translations.html |
| 23:04 | vIkSiT | tomoj, ah yes |
| 23:04 | tomoj | I haven't figured it out yet, good luck |
| 23:04 | kencausey | http://asymmetrical-view.com/2009/08/20/emacs-slime-remote-repl.html |
| 23:04 | kencausey | seen that? |
| 23:05 | vIkSiT | tomoj, the problem is - where do i get tramp-mode from? |
| 23:05 | vIkSiT | kencausey, checking.. |
| 23:05 | kencausey | just googled it, so can't verify it will help |
| 23:05 | tomoj | I think you already have tramp, just need the slime-tramp contrib |
| 23:06 | tomoj | I don't know, though, how to add contribs if you're using elpa slime/slime-repl :( |
| 23:06 | vIkSiT | kencausey, 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:06 | vIkSiT | tomoj, exactly. how do i even get slime-tramp? |
| 23:07 | vIkSiT | (thats what i meant btw.. slime-tramp, not tramp-mode .. which i already have) |
| 23:07 | tomoj | I 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:07 | tomoj | but I haven't tried that yet either.. |
| 23:07 | vIkSiT | also - adding a contrib is easy right? just put it into .emacs.d/elpa.. correct dir in there |
| 23:07 | bortreb | what happened to lazy-cons? |
| 23:08 | kencausey | vIkSiT: yeah, sorry after a quick scan myself I realized it doesn't seem to address your issue |
| 23:09 | tomoj | bortreb: see http://clojure.org/lazy |
| 23:14 | ihodes | technomany: 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:14 | ihodes | technomancy: the above ^ |
| 23:19 | trptcolin | ihodes: i may be able to help, depending on how newbie the questions are :) |
| 23:21 | ihodes | trptcolin: 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:21 | ihodes | any suggestions? |
| 23:22 | trptcolin | oh you mean interacting w/ it through the listening port? |
| 23:22 | ihodes | sure! |
| 23:22 | ihodes | yes |
| 23:23 | trptcolin | unfortunately i haven't tried that yet :( |
| 23:23 | ihodes | ah, a shame :( i'll wait on technomancy then haha. but thank you! |
| 23:23 | trptcolin | that feature's actually less than a week old |
| 23:23 | ihodes | ah no, not the new feature |
| 23:24 | ihodes | just interacting with the REPL as you would if you ran lein repl |
| 23:24 | ihodes | but i'm trying to launch it from swank, which i'm connected to with slime |
| 23:25 | ihodes | so i'm seeing this: user=> Connection opened on local port 4005 |
| 23:25 | ihodes | #<ServerSocket ServerSocket[addr=localhost/127.0.0.1,port=0,localport=4005]> |
| 23:25 | ihodes | "REPL started; server listening on localhost:29562." after running (-main "repl) from within the repl in emacs |
| 23:25 | trptcolin | ah. can't help you there. my emacs-fu is weak |
| 23:25 | ihodes | pretend 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:34 | technomancy | ihodes: C-u M-x telnet to connect to the repl |
| 23:34 | technomancy | ihodes: but you'll want to make sure "lein repl" works from the command-line too of course |
| 23:34 | technomancy | both inside and outside a project |
| 23:37 | technomancy | trptcolin: the repl task still isn't working outside the context of a project |
| 23:38 | technomancy | there'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:38 | ihodes | technomancy: i get this when i try to telnet http://cl.ly/24rA |
| 23:38 | technomancy | trptcolin: I'm not convinced it actually needs a subprocess; running a repl inside lein's own classpath might be fine |
| 23:39 | technomancy | ihodes: did you do C-u before M-x telnet? |
| 23:39 | ihodes | i did |
| 23:39 | trptcolin | ah, crud. so i guess my global $CLASSPATH may have skewed my local results |
| 23:39 | technomancy | so you could set the port? |
| 23:39 | ihodes | yep |
| 23:40 | technomancy | ihodes: weird; it works for me |
| 23:40 | ihodes | let me shut it all down and try again |
| 23:41 | technomancy | trptcolin: when you run a repl inside the context of a project, it needs to be separate from leiningen's classloader |
| 23:41 | technomancy | but for repls outside a project it's not a big deal |
| 23:42 | trptcolin | technomancy: 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:42 | ihodes | technomancy: no-go. crap. |
| 23:42 | technomancy | trptcolin: any downsides to running the repl in-process though? |
| 23:43 | technomancy | ihodes: if you're working through issue 95, I think that might be easier to do without getting swank involved |
| 23:43 | ihodes | doesn't work from the command line either - same connections refused. |
| 23:44 | ihodes | technomancy: fair enough: how, then, should i go about testing? (sorry for all these questions) |
| 23:55 | trptcolin | technomancy: no downsides that i know of - though so far i've been unable to get output to my shell with (eval server-form) |