2010-02-15
| 00:01 | arkrost | Hi! Can anyone show me code example with using with-bindings* macro? |
| 00:09 | arkrost | Is anuone here? |
| 00:09 | arkrost | *anyone |
| 00:37 | qbg | Okay |
| 00:38 | qbg | ,(let [f (fn [] *warn-on-reflection*)] (with-bindings* {#'*warn-on-reflection* true} f)) |
| 00:38 | clojurebot | true |
| 01:39 | qed | 'lo 'lo |
| 03:08 | LauJensen | Morning gents |
| 03:09 | Raynes | Morning. |
| 03:12 | Raynes | LauJensen: What are you up to this morning? |
| 03:13 | LauJensen | So far I'm ready for morning coffee, you? :) |
| 03:15 | Raynes | LauJensen: I've been awake since 1:00pm yesterday, and it's 2:17AM at the moment, and I don't intend to sleep anytime soon. |
| 03:15 | Raynes | I'm trying to learn Factor, even though my attention span is nil. |
| 03:15 | Raynes | So, I'm good. |
| 03:15 | Raynes | And it's snowing. I think. |
| 03:16 | Raynes | Yeah. It's snowing. |
| 03:16 | Raynes | Actually, it might be finished snowing. |
| 03:16 | Raynes | Tends to not last long in Alabama. |
| 03:24 | LauJensen | Normally we would say the same here, but it has been subzero C for months now |
| 03:30 | sunkencity | Why do I need to make an inline function like #(.equals %1 %2) when using map rather than just .equals? |
| 03:30 | LauJensen | because its a java-fn |
| 03:32 | sunkencity | ok. so java functions always need their own parens? |
| 03:33 | Chousuke | it's a method. Methods don't implement the needed interfaces |
| 03:33 | sunkencity | ok. now I get it. tnx |
| 03:33 | Chousuke | basically you're creating a function that calls a method on its parameters |
| 03:36 | sunkencity | Is there some nice syntactic sugar to guard against nullpointers like (.equals nil nil), should I use maybe monad maybe or is there something simpler? |
| 03:36 | Chousuke | no syntactic sugar, but you can use (or foo default) |
| 03:37 | Chousuke | or other solutions, depending on what you need. :P |
| 03:37 | sunkencity | but then I get an exception |
| 03:38 | Chousuke | you need to check for nils if whatever you pass them to is not expecting them :/ |
| 03:39 | sunkencity | I've programmed too much ruby, I prefer nil to be an object :) |
| 03:40 | LauJensen | (map #(.fn %1 %2) (filter identify sequence)) |
| 03:40 | Chousuke | identity :P |
| 03:41 | Chousuke | also note -?> and -?>> in contrib which short-circuit on nil |
| 03:56 | TheBusby | what are -?> and -?>> under in contrib (google really hates those...) |
| 03:56 | TheBusby | ? |
| 03:58 | LauJensen | ~source -?> |
| 03:59 | LauJensen | There u go TheBusby |
| 04:05 | TheBusby | LauJensen: Thanks, |
| 05:22 | zab | Hi. I'm trying to get a dev environment set up for running Clojure in App Engine. I followed this: http://www.hackers-with-attitude.com/2009/08/intertactive-programming-with-clojure.html but I cannot get the App Engine decorator described to work. |
| 05:22 | zab | Does anyone know what this mean? java.lang.IllegalAccessError: class clojure.proxy.com.google.appengine.tools.development.ApiProxyLocalImpl cannot access its superclass com.google.appengine.tools.development.Ap |
| 05:22 | zab | iProxyLocalImpl (start.clj:44) at clojure.lang.Compiler.analyzeSeq(Compiler.java:4503) |
| 06:28 | tomoj | #clojure has not been active enough this morning to satiate my desire to procrastinate :( |
| 08:16 | powr-toc | is there a function like select-keys that does the opposite and returns all the keys not in the supplied seq? |
| 08:17 | powr-toc | I mean one that returns a map of all the keys (to values) that are not in the supplied seq |
| 08:19 | ulfster | you can use the set-function |
| 08:20 | chouser | powr-toc: dissoc, I think. |
| 08:25 | ulfster | ,(clojure.set/difference (set (keys {:a 1 :b 2})) (set (keys {:b 3}))) |
| 08:25 | clojurebot | #{:a} |
| 08:25 | chouser | ,(dissoc {:a 1 :b 2} :b) |
| 08:25 | clojurebot | {:a 1} |
| 08:25 | powr-toc | chouser: dissoc's exactly what I want |
| 08:39 | chouser | cgrand: yes, I don't see why we shouldn't lobby for a 'swap' that returns the old value. |
| 08:39 | chouser | as long as you're using pure functions with 'swap!', you can always calculate the new value from the old for yourself, but the reverse is not true. |
| 08:41 | cgrand | chouser: or that returns both values |
| 08:41 | chouser | yes |
| 08:41 | rhickey | cgrand: what's the use case? (I just arrived) |
| 08:42 | cgrand | chouser: what was your latest use case? |
| 08:42 | chouser | my use case is a map of request-id's to callbacks |
| 08:43 | rhickey | please explain |
| 08:43 | chouser | the requests can arrive on any thread. Usually each id will arrive only once, but if one arrives twice I want to be absolutely sure I only call the callback once |
| 08:44 | chouser | the map is already in an atom. |
| 08:44 | rhickey | another use case for cells |
| 08:45 | rhickey | cells can serialize activity, atoms only data |
| 08:51 | chouser | When a cell holds a transient, you send it mutating fns? And it has hooks to call both transient and persistent! as needed? |
| 08:52 | rhickey | chouser: could be mutating or not, yes, calls transient/persistent, which become protocols |
| 08:52 | chouser | but "send" is the wrong word because it's synchronous -- closer to 'alter'? |
| 08:52 | rhickey | yes, more like alter |
| 08:53 | chouser | do I have to indicate when I alter whether the call is mutating or not so it knows which of the transient/persistent hooks it needs to use? |
| 08:54 | rhickey | no, the fn will always be applied to the transient component |
| 08:55 | rhickey | if there is no transient component, it will be created |
| 08:55 | chouser | the fns are serialized via locks |
| 08:55 | rhickey | depends - the access control policy is actually independent |
| 08:55 | rhickey | e.g. the single threaded policy uses no locks |
| 08:57 | chouser | I have this other (ab)use of atoms that I'm trying to think if cells could replace. |
| 08:57 | bosie | i don't understeand how iterate nows when to stop the infinite loop ? like here: https://gist.github.com/27254bbcf1555202882e |
| 08:57 | chouser | still not sure -- my thinking is so fuzzy. :-/ |
| 08:58 | chouser | bosie: 'iterate' and 'map' are lazy, so no work is done until something that's using the seq returned by 'index' asks for the first or next item. |
| 08:58 | chouser | bosie: and then only one step is done until something asks for the next item after that. And so on... |
| 08:59 | bosie | meaning (println) asks for more and never stops asking? |
| 08:59 | chouser | yes. oh, but 'map' in that case is given two seqs. It stops asking when either of the seqs runs out of items. |
| 09:00 | bosie | ok |
| 09:00 | bosie | thanks chouser |
| 09:02 | chouser | huh. Perhaps I should be using refs instead of atoms for this other case. |
| 09:02 | chouser | yeah, that's it. hmph. |
| 09:03 | chouser | actually, both cases. |
| 09:05 | rhickey | in general, if you feel you are trying to build a higher-level construct out of atoms, you might want to look at one of the other ref types |
| 09:05 | rhickey | except when you are trying to build a queue, then j.u.c. |
| 09:07 | chouser | I think I passed over refs initially because I need to call this potentially inpure callback. But if I just have my transaction return a flag indicating if it should be called or not, I can do the actual call outside the transaction. |
| 09:12 | bosie | rhickey: does the green '2010 funding progress' mean you have almost met your goal of being able to work on it full time? |
| 09:12 | rhickey | bosie: almost, yes |
| 09:13 | AWizzArd | If it continues to go well we can fund 1-2 more full time devs :) |
| 09:14 | bosie | let's hope so, don't want to learn a language which will become obsolete in half a year ;) |
| 09:15 | AWizzArd | bosie: highly unlikely. |
| 09:16 | AWizzArd | Clojure already has very many users, and even if it would not continue to develop from now on (which is unlikely) it already is a greta platform for development and offers a rich feature set. |
| 09:19 | chouser | not just many users, demonstrably sufficient users with sufficient committment to fund a year's worth of development. |
| 09:19 | chouser | That arguably puts Clojure's ongoing development on a better footing most open-source projects. |
| 09:21 | bosie | chouser: iff it pulls in the same amount (more due to inflation) next year though |
| 09:21 | chouser | bosie: sure, but the people donating this time did so with the understanding they were only covering one year. |
| 09:23 | chouser | And what's more likely, that a significant number of people will pull their funding or than some corporate sponser (I'm thinking Red Hat or Ubuntu's Canonical) falls on hard times and disbands? |
| 09:23 | chouser | My point isn't which is more likely, actually, but that it's not obvious to me that one is on substantially better ground than the other. |
| 09:24 | bosie | that's true about the corporate sponsors |
| 09:47 | underdev | hi! im working my way through programming clojure |
| 09:47 | bosie | underdev: me too |
| 09:47 | underdev | a simple operation isn't working as described |
| 09:47 | underdev | (def inventors {"Lisp" "McCarthy" "Clojure" "Hicky"}) |
| 09:47 | underdev | duh |
| 09:48 | bosie | works fine here |
| 09:48 | underdev | i was using the value and not the key |
| 09:48 | underdev | nm :) |
| 09:54 | chouser | is it any less efficient or correct to deref a ref a couple times in a dosync rather than deref once and store in a local? |
| 09:57 | Chousuke | chouser: I think it might be a bit race-prone to deref a ref multiple times :/ |
| 09:58 | rhickey | chouser: I think it is good practice to deref as few times as possible |
| 10:00 | Chousuke | will the result a deref change if some other transaction modifies the ref and commits in the mean time? |
| 10:01 | rhickey | hrm, JavaOne topic areas include Java and "scripting languages", but not alternative languages - https://www28.cplan.com/cfp_prod/CFPLogin.jsp?wId=268225 |
| 10:01 | rhickey | Chousuke: no! |
| 10:01 | Chousuke | right. |
| 10:01 | rhickey | that's the (I)solated of ACI_ |
| 10:02 | rhickey | are Clojure and Scala scripting languages? |
| 10:02 | Chousuke | so it's safe to do multiple derefs, but you need ensure if you want to restart in case something else commits a modification to the ensured ref? Am I getting this right? |
| 10:03 | rpdillon | Re: few times as possible - potential error, or just good style? |
| 10:03 | rhickey | Chousuke: if you aren't changing a ref but your transaction being correct relies upon it not changing, you must ensure it |
| 10:04 | rhickey | that doesn't mean you will see it change in-transaction |
| 10:06 | Chousuke | I'm finding it somewhat difficult for some reason to keep the semantics of in-transaction deref and ensure in my head :P |
| 10:09 | rhickey | Chousuke: start with the snapshot model of a transaction - your transaction will see the world as-of a point in time. Don't lose that while you incorporate that ensure is about the state of the world when your transaction commits - ensured refs won't be different than what you saw |
| 10:09 | Chousuke | right |
| 10:10 | rhickey | and rely on the STM's ACI to completely free you from thinking about actions of other threads - if they cause conflicts you will retry |
| 10:11 | rhickey | that's why I'm concerned about http://java.ociweb.com/mark/stm/article.html - too much emphasis on implementation and too little on semantics, the latter being much simpler |
| 10:12 | cemerick | does anyone do *any* scripting with either clojure or scala? |
| 10:13 | underdev | why would you script with jvm langs? Esp when there is tcl. |
| 10:13 | underdev | ;) |
| 10:14 | cemerick | I tend to think that, if you're scripting, especially around jvm-based apps, you're doing it wrong. |
| 10:14 | _fogus_ | rhickey: Which is also why Chouser and I want to focus on the latter. IMO the semantics are much more important |
| 10:14 | Chousuke | Hmm. So you're supposed to make a decision based on a snapshot, and if your decision is based on things that are no longer true when you finish, you get to retry. And commute is a way of saying "I don't actually care what the state of this thing is, do X to it" |
| 10:14 | rhickey | _fogus_: yes, please |
| 10:15 | rhickey | Chousuke: the best way to think about it is - should some promise not be possible to make, your transaction didn't happen. Thus you only need to concern yourself with the semantics of successful transactions |
| 10:16 | _fogus_ | cemerick: "you're doing it wrong"... care to elaborate? |
| 10:18 | cemerick | _fogus_: scripts are generally fragile and platform-dependent. If you have the opportunity, eliminating/minimizing "scripting" as a deployment/administration methodology is almost always for the better. |
| 10:19 | Chousuke | cemerick: hmmh, that's a pessimistic view of scripting :P |
| 10:19 | _fogus_ | cemerick: I would follow with, if your scripts are platform dependent, then you're doing it wrong. |
| 10:19 | Chousuke | cemerick: most OSes are full of scripts that work just fine :) |
| 10:19 | _fogus_ | naturally platform independence is not 100% achievable, but it could be minimized |
| 10:20 | underdev | by tcl |
| 10:20 | underdev | sorry, i'll stop |
| 10:21 | underdev | i must admit, after listening to all those theoretical talks on functional langs, most of my tcl code looks stupid to me now. |
| 10:21 | cemerick | eh, I dread ever having to write or modify a script, of any sort. The time spent is almost always in dealing with absurd minutiae that I always feel like I shouldn't have to bother with. |
| 10:21 | chouser | I wonder if there's sufficient meaning in the word "script" to support any discussion like this. |
| 10:21 | _fogus_ | chouser: +1 |
| 10:24 | underdev | ousterhout and wall have written interesting things about that |
| 10:24 | rhickey | chouser: and yet, there is something to Oracle's consistent use of the qualifier, I think |
| 10:24 | underdev | level of abstraction, mostly |
| 10:24 | underdev | i think |
| 10:25 | underdev | but where you draw the line is definitely up for debate |
| 10:25 | rhickey | Java + scripting languages is less of a threat to Java than Java +/vs alternative general purpose JVM langs |
| 10:25 | cemerick | rhickey: insofar as their entire product line is keyed toward java as the chosen "application development language", they have to have the qualifier |
| 10:25 | cemerick | or, what you just said :-/ |
| 10:26 | chouser | So the relevent question is what exactly *Oracle* means by a scripting language. |
| 10:26 | rhickey | they explicitly list Python, Ruby and JavaFX |
| 10:27 | chouser | do they mean "slow"? :-) |
| 10:27 | _fogus_ | I see a topic category, "The Java Frontier". That sounds like alt langs to me |
| 10:28 | underdev | that article about why i love everything you hate about java was interesting |
| 10:28 | rhickey | _fogus_: yeah, the wild west |
| 10:28 | underdev | reminds me of what is said about c++ and other "system languages" |
| 10:28 | chouser | underdev: did you see the response as well? |
| 10:29 | underdev | i don't know to which you refer. |
| 10:29 | chouser | http://romanroe.blogspot.com/2010/02/why-i-hate-everything-you-love-about.html |
| 10:29 | _fogus_ | rhickey: Question is, are you more like Wyatt Earp or Billy the Kid? ;-) |
| 10:30 | rhickey | e.g. people thinking - add closures to Java and why do you need Scala? |
| 10:31 | underdev | saved in diigo as unread, it's awfully long |
| 10:31 | underdev | looks very interesting though |
| 10:31 | _fogus_ | underdev: Well, it's definitely longer than 140 chars, but worth the time. :-) |
| 10:31 | underdev | lol |
| 10:32 | _fogus_ | rhickey: Push-back from whom? |
| 10:32 | rhickey | _fogus_: Oracle |
| 10:32 | _fogus_ | ahhhh |
| 10:32 | underdev | here's where the rubber meets the road. I was a SCPJ, wrote a huge system in java for a call center. Someone mentioned perl to me. I rewrote in under 1000 lines of code. NEVER LOOKED BACK. |
| 10:32 | rhickey | Clojure, being so different, is off the radar I think |
| 10:33 | cemerick | Scala's objectives seem entirely at odds with Oracle's. Intriguing / confusing type system experiments don't sell anything. |
| 10:33 | _fogus_ | It would be interesting to see how Oracle might present such an argument, especially given that there is a general view (be it wrong or not) that "normal" Java developers could never understand closures |
| 10:34 | rhickey | _fogus_: then they'll certainly never understand Scala |
| 10:34 | noidi | regarding long blog posts, this really helps to read them :) http://lab.arc90.com/experiments/readability/ |
| 10:35 | cemerick | The morts don't want closures, they want more and better tools, and that's where the money is. |
| 10:35 | _fogus_ | rhickey: Maybe that is the approach. Present Scala as indecipherable |
| 10:35 | rhickey | I just hink the Sun folks were incredibly open-minded and now I expect less of that. As the owner of Java and JavaFX I expect Oracle to consider Scala and Groovy(++) as threats and or dilution of their story |
| 10:36 | underdev | i for one, love reading in depth pieces. Just can't do it at an arbitrary time. |
| 10:36 | rhickey | I'm not trying to argue against Scala (Clojure is in the same or worse boat, but never had pretensions of replacing Java in the mainstream) |
| 10:36 | _fogus_ | rhickey: I for one understand your stance on Scala and did not presume anything of the sort |
| 10:36 | rhickey | But the wording of things like the call for papers *might* have been carefully considered. I mean, leaving Clojure and Scala guessing as to which track they might fit? |
| 10:38 | _fogus_ | Frontier is definitely a loaded term |
| 10:38 | chouser | I wonder if Python and Ruby are less threatening because the JVM versions are seen as secondary, or because of their speed, or dynamism, or ... what? |
| 10:38 | chouser | secondary to each's C implementation I mean |
| 10:38 | rhickey | chouser: well, it was interesting to see then listed as Python and Rucy, not Jython and JRuby |
| 10:38 | rhickey | er, Ruby |
| 10:38 | chouser | hm. |
| 10:38 | cemerick | chouser: they're not less threatening, there's more money to be had in them. |
| 10:39 | bosie | rhickey: in which time zone are you ? |
| 10:39 | rhickey | bosie: NY |
| 10:40 | chouser | cemerick: more money to be had by Oracle? how? |
| 10:41 | rhickey | of course, this could all be unwarranted speculation. After all, last year the keepers of the lingo changed every reference to the JVM in every talk to the "JVM Machine" |
| 10:41 | chouser | heh |
| 10:41 | Chousuke | :/ |
| 10:41 | rhickey | making us all seem like idiots from the department of redundancy department |
| 10:41 | ohpauleez | haha |
| 10:41 | ohpauleez | really? that's so funny |
| 10:42 | noidi | maybe this year it'll be the Java JVM Machine to leverage the brand ;) |
| 10:42 | chouser | amazing. I went to college near a town that had a building labeled "The City of Gas City City Hall" |
| 10:42 | Chousuke | redundancy in terminology isn't that uncommon but why would they change it like that. |
| 10:43 | cemerick | chouser: (a) even if people aren't using jython or jruby, oracle's got a pile of other tech they'd like to sell to people using those languages, so they want to be language-agnostic enough to support that pitch, (b) if people do use jython or jruby, they benefit from those folks needing more iron, (c) insofar as people who use jython and jruby use netbeans, they'll be more likely to buy oracle kit in general. |
| 10:43 | cemerick | all of those are only made possible by a certain critical mass in the size of those language's communities, of course. |
| 10:43 | _fogus_ | chouser: That sounds like Buffalo buffalo buffalo... |
| 10:45 | chouser | cemerick: so all Clojure needs to be included is critical mass? |
| 10:45 | cemerick | chouser: if there were suddenly X clojure programmers that represented Y dollars in spending authority / recommendations, I guarantee you that Oracle would list it next to python and ruby. |
| 10:45 | chouser | :-) fair enough |
| 10:46 | cemerick | The great thing about oracle is that their objectives and motivations are rarely hard to figure out. Far less capricious than Sun, certainly. |
| 10:47 | rhickey | cemerick: I think it is a completely different game - Python and Ruby devs represent potential new clients not in the fold. Clojure will come from the other side, as they discover existing clients already using it, esp in analytics to start. |
| 10:49 | chouser | did you expect a Clojure to find a niche in analytics as it has. I for whan have been completely surprised. |
| 10:50 | cemerick | Yeah, very different userbases. The shared independent variable is purchase authority, tho. |
| 10:50 | rhickey | OT - has anyone ever used the xvid quicktime plugin for OS X? There's a talk I want to watch in this format, but the plugin is old and alpha |
| 10:50 | rhickey | cemerick: true |
| 10:51 | Chousuke | rhickey: Install Perian |
| 10:52 | rhickey | chouser: I never foresaw what has happened with Clojure at all :/ |
| 10:53 | drewr | rhickey: http://www.videolan.org/ |
| 10:53 | cemerick | rhickey: irritated at what it's being used for, or that you didn't see it coming? |
| 10:53 | rhickey | cemerick: I'm not irritated at all, just bemused |
| 10:55 | eyeris | Is there a std contains function? Similar to python's in operator? |
| 10:55 | eyeris | e.g. (contains 1 [1 2 3]) -> true |
| 10:55 | stuartsierra | eyeris: idiom is (some #{1} [1 2 3]) |
| 10:56 | stuartsierra | Works in O(n) time. |
| 10:56 | chouser | eyeris: any reason you can't use a set instead of a vector for that collection? |
| 10:56 | eyeris | I can. |
| 10:56 | chouser | I mean, don't convert to a set just for the contains op, but if you're mainly using it for that kind of lookup, well that's exactly what sets are for. |
| 10:57 | chouser | you can do (#{1 2 3} 2) in nearly constant time. |
| 10:58 | eyeris | I am just categorizing a database record and I want to avoid (or (= (:code row) 2112) (= (:code row) 2660) ...) for 6-7 more code values |
| 10:58 | eyeris | So I would have to convert the field to a set, but the set of values is static, so it would be just fine to use a set on that side. |
| 10:59 | chouser | so a constant set of values. Yeah, a literal set should work perfectly. |
| 11:00 | chouser | (if (-> row :code #{2112 2660 ...}) ...) |
| 11:00 | chouser | or whatever |
| 11:01 | rhickey | drewr: works - thanks! |
| 11:02 | rrc7cz | has anyone else seen the seq returned by iterator-seq not stopping correctly? In other words, calling .next when .hasNext is false? |
| 11:02 | Chousuke | chouser: I think that borders on abuse of -> :P |
| 11:03 | noidi | howcome? |
| 11:03 | chouser | could be. I only lurched that direction to avoid (( |
| 11:03 | eyeris | I went with: (some (set (:code case-row)) #{2260 2310 2320}) |
| 11:03 | chouser | (#{2112 2660 ...} (:code row)) ...oh, nm. |
| 11:03 | chouser | eyeris: that's still O(n). |
| 11:04 | eyeris | Oh? |
| 11:04 | chouser | "some" is O(n). Perhaps: (get #{2260 2310 2320} (:code case-row)) |
| 11:04 | noidi | I think chouser's first version reads nicely; "if the row's code is in [set], do something" |
| 11:04 | eyeris | I see |
| 11:05 | Chousuke | noidi: (<set> item) is the clojure idiom, and -> kind of obscures that |
| 11:06 | Chousuke | I tend to read -> as a "pipeline" so the set doesn't quite fit |
| 11:07 | chouser | ->> is the pipeline op :-) |
| 11:07 | noidi | IMHO that's no more unclear than (-> foobar :looking :up :values :in :nested :maps) |
| 11:08 | Chousuke | Well, I can't tell you to think otherwise, but I disagree :P |
| 11:08 | noidi | hehe |
| 11:09 | Chousuke | But I think people are perhaps overusing -> sometimes |
| 11:10 | noidi | now that I think of it, I would've placed the set first, too |
| 11:11 | hiredman | pffft |
| 11:12 | Chousuke | Maybe it's some subconscious trauma from when I found a monster from clojurebot's code that was something like (-> foo ((partial map quux)) ((partial filter blah)) ((?!?? ??F?S?D?F)) :foo :bar .toUpperCase) |
| 11:12 | hiredman | :P |
| 11:12 | Chousuke | except with more partials and functions. |
| 11:12 | noidi | because the check against the set doesn't "modify" the value, like I imagine a pipeline to do |
| 11:13 | hiredman | Chousuke: that could be any line in any file of clojurebot, could you be more specific :P |
| 11:14 | Chousuke | sadly I've forgotten which file it was in :/ |
| 11:14 | Chousuke | My brain has blocked the specifics; they're too gruesome |
| 12:03 | ordnungswidrig | I still fight binding and bound-fn... |
| 12:03 | ordnungswidrig | i there a decent example in the web out there? |
| 12:04 | eyeris | What don't you understand about them? |
| 12:04 | ordnungswidrig | eyeris: "it doesn't work". |
| 12:05 | eyeris | I've never used bound-fn because I have to stick to 1.0, but it seems like the difference is that binding lets you establish new bindings in the middle of a function where you need both bindings, at different times. |
| 12:05 | eyeris | ordnungswidrig: do you have a paste? |
| 12:06 | ordnungswidrig | eyeris: paste is a little difficult - i try to extract the exact problem. A little context first: |
| 12:07 | ordnungswidrig | I define a compojure handler and at this time some configuration is avaiable, say db settings. The compojure handler uses another libs with-xxx macro which expands to a (binding [conn …] …) form. The problem is that this handler is executed in a different thread and doesn't have the binding. |
| 12:09 | eyeris | So your issue is then not with the binding macro but instead with the outer bindings |
| 12:10 | eyeris | You basically have two choices. You can def conn globally or you can pass it to the handler that spawns the new thread. |
| 12:11 | eyeris | There may be another option, but I'd have to see the code. |
| 12:12 | hiredman | man, passing values to functions? that's crazy |
| 12:13 | ordnungswidrig | pasie |
| 12:13 | ordnungswidrig | lisppaste8: url? |
| 12:13 | hiredman | lisppaste8 seems to have been dead for a while now |
| 12:14 | eyeris | patebin.ca (my fav) has been dog slow for months too |
| 12:16 | ordnungswidrig | http://paste.lisp.org/display/94993 |
| 12:17 | hiredman | bleh |
| 12:17 | Chousuke | ordnungswidrig: I don't think that's how you use binding :/ |
| 12:17 | hiredman | using with-foo like that over the global routs seems horrible |
| 12:18 | ordnungswidrig | hiredman: I tried all kind of location |
| 12:18 | Chousuke | ordnungswidrig: if you changed "binding" to let that would work :P |
| 12:18 | eyeris | Damnit Chousuke, you beat me to it! |
| 12:18 | eyeris | I had that half-typed out :) |
| 12:18 | Chousuke | but of course you would be unable to affect teh value of *foo* afterwards |
| 12:20 | ordnungswidrig | Chousuke: actually the library which defines with-foo is under my control. Isn't it best practice to provide a macro like that to keep around a db connection? |
| 12:20 | Chousuke | ordnungswidrig: the problem with that is that the route is defined to use the value *foo*, and the value of *foo* _is_ "FOO" when the route is defined, but not after the definition. |
| 12:20 | ordnungswidrig | db connection as an example. |
| 12:20 | ordnungswidrig | Chousuke: I see. |
| 12:21 | Chousuke | oh wait, it extends to start-server as well. never mind |
| 12:21 | ordnungswidrig | Chousuke: internally compojure generates and throws around a lot of (fn []) |
| 12:21 | Chousuke | there you hit the thread-locality of var binding :) |
| 12:21 | hiredman | ordnungswidrig: just because the only way to fit a knife between someone's ribs is to turn it so the blade is horizontal doesn't mean you should go around stabing people |
| 12:21 | ordnungswidrig | yes, I extended it over start-server intentionally. |
| 12:21 | Chousuke | if start-server starts the server in another thread, the dynamic binding is no longer effective there |
| 12:22 | hiredman | (just because that is the only place binding works, it doesn't mean you should use a binding there) |
| 12:22 | hiredman | you should just pass whatever it is around |
| 12:22 | cemerick | huh, interesting that private vars can be rebound without a #' |
| 12:23 | ordnungswidrig | hiredman: that is an option. But this means tha I cannot make use of something with a with-xxx macro then in a threaded context? |
| 12:23 | hiredman | ordnungswidrig: there are various things like bound-fn, etc, but I think passing it around is the best solution |
| 12:24 | ordnungswidrig | hiredman: so even when I bind within the handler it would not see the binding due to running in a different thread?! |
| 12:26 | Chousuke | ordnungswidrig: it doesn't matter where in code the binding happens. If you bind within a different *thread* then other threads will not see the change |
| 12:26 | Chousuke | where you put the binding in code only influences that indirectly :P |
| 12:27 | hiredman | ordnungswidrig: I have no idea, I am discussing a particular threading/execution model of a particular environment (compojure), I am saying the application of functions to arguments is a good model and should be promoted over models that make use of implicit arguments passed via binding |
| 12:27 | Chousuke | ie. you might pass around a function that does dynamic binding to a helper which executes it in multiple threads, thus creating multiple dynamic bindings |
| 12:27 | ordnungswidrig | hiredman: I'm totally on your side. |
| 12:28 | Chousuke | ordnungswidrig: is test-server a function? |
| 12:28 | ordnungswidrig | bound-fn will expose the complete environment to the body, right? |
| 12:28 | ordnungswidrig | Chousuke: a java instance |
| 12:28 | Chousuke | meh |
| 12:28 | ordnungswidrig | org.mortbay.jetty.Server |
| 12:29 | Chousuke | if it were a function you could have done (start-server (bound-fn* test-server)) :) |
| 12:30 | ordnungswidrig | http://paste.lisp.org/display/94993#1 |
| 12:30 | Chousuke | ordnungswidrig: you can use bound-fn* instead of bound-fn there. |
| 12:31 | ordnungswidrig | I guess the usage of bound-fn in this case is fine. Or do you see any side effects? |
| 12:31 | ordnungswidrig | Chousuke: bound-fn*? |
| 12:31 | Chousuke | ordnungswidrig: just (bound-fn* handler) |
| 12:31 | Chousuke | it takes a function and returns another which sets up the proper dynamic environment prior to calling the original function |
| 12:31 | ordnungswidrig | Chousuke: ok, I'll try in my "real" application |
| 12:32 | Chousuke | bound-fn is a convenience macro for (bound-fn* (fn [args] (blah args))) |
| 12:33 | ordnungswidrig | silly me. I actually tried (boundfn [] (with-foo (…)) |
| 12:33 | Chousuke | heheh |
| 12:43 | ordnungswidrig | …and finally it works |
| 12:43 | ordnungswidrig | thanks guys |
| 13:15 | triyo | anyone try congomongo (clojure mongodb driver) with clojure-1.2-master (intrim)? Getting clojure.lang.RestFn.<init>(I)V [Thrown class java.lang.NoSuchMethodError] with swank-clojure. |
| 13:15 | triyo | however if I run with "lein repl" then it works. But here *clojure-verion* -> 1.1-master |
| 13:19 | triyo | guess congomongo 0.1.1 doesn'r work with clojure {:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"} yet. |
| 13:20 | triyo | which prob makes sense. |
| 13:22 | triyo | I see the relevant "new" branch under congomongo. |
| 14:06 | LauJensen | Does anyone have an idea of how the Oracle acquisition will affect clojure-land ? |
| 14:06 | rsynnott | well, Java is unlikely to go away... |
| 14:12 | drewr | LauJensen: that was being discussed earlier |
| 14:12 | drewr | check out the logs for today |
| 14:13 | LauJensen | thanks |
| 14:13 | LauJensen | ~log |
| 14:13 | clojurebot | see logs |
| 14:13 | LauJensen | ~logs |
| 14:13 | clojurebot | logs is http://clojure-log.n01se.net/ |
| 14:14 | Intertricity | I know this is a simple question but- would clojure be a good alternative to C# for developing a game server? |
| 14:14 | Intertricity | or even stackless python |
| 14:16 | rsynnott | Intertricity: probably, yes, depending on the type of game |
| 14:16 | Chousuke | Well, If python is fast enough for you, Clojure probably is too, and the concurrency features might be attractive for a server. |
| 14:16 | AWizzArd | Clojure would be a good choice for this. |
| 14:16 | Intertricity | rsynnott, say a virtual world that served up models, stored user uploaded modelers, etc. |
| 14:16 | rsynnott | Stackless python more or less exists for that reason; most development is done by that Icelandic company that runs Eve Online |
| 14:16 | rsynnott | but yep, clojure's concurrency model would seem to be quite suitable |
| 14:16 | Intertricity | *models |
| 14:17 | Intertricity | yeah I was thinking about stackless python, but I wanted to play with a lisp |
| 14:17 | Intertricity | but I wanted to know if I'd be digging myself a hole or not, using it for something it wouldn't have been suited for or not |
| 14:17 | Intertricity | I wonder if clojure would be faster than stackless :P |
| 14:18 | rsynnott | probably depends on how you use it |
| 14:18 | rsynnott | all else being equal, it probably should be; better garbage collection and all that |
| 14:19 | LauJensen | Does the licensing around the JVM guarantee that there will always be a free JVM around ? |
| 14:19 | Chousuke | LauJensen: there's a GPL'd version of the JVM available, so yes. |
| 14:19 | Chousuke | you can't un-GPL it :/ |
| 14:19 | Intertricity | rsynnott, thanks for the help ^^ |
| 14:20 | chouser | also, clojure may not always depend on a JVM |
| 14:20 | LauJensen | chouser: I know, but in a certain regard we do depend on libraries |
| 14:20 | Chousuke | though Oracle may cut of support for it... Which would rather foolish of them :) |
| 14:20 | Chousuke | +be |
| 14:20 | rsynnott | LauJensen: I believe so, yes |
| 14:21 | rsynnott | Chousuke: oracle have a history of maintaining open source stuff, as long as it's dual-licensed with a commercial license and a highly restrictive open-source one (such as the GPL) |
| 14:21 | rsynnott | Sleepycat BDB is the obvious example |
| 14:22 | Chousuke | "highly restrictive" :P |
| 14:22 | Chousuke | I guess it is, relatively speaking |
| 14:23 | hiredman | someone at the seattle meatup suggested we might see a split, jrocket as the "enterprise" jvm and openjdk as the free one, which I think matches up with this comment: http://www.theserverside.com/news/thread.tss?thread_id=59317#332147 |
| 14:24 | rsynnott | Chousuke: in that it requires release of modifications, and is effectively transmissible |
| 14:24 | Chousuke | I suppose Oracle might even open up the JVM development process more than Sun did. |
| 14:24 | rsynnott | (if one bit of GPL touches your product, it ends up GPLd) |
| 14:24 | rsynnott | hopefully, a clisp-like situation does not arise :) |
| 14:25 | rsynnott | (clisp's FAQ claims that applications which use a part of clisp which is not part of the Common Lisp standard, such as the FFI, are themselves subject to the GPL) |
| 14:25 | rsynnott | though it's uncertain whether this is actually, whne it comes down to it, true |
| 14:26 | Chousuke | well, one could consider it a GPL library |
| 14:26 | Chousuke | linking against a GPL'd library means your program needs to be GPL as well, as far as I know |
| 14:26 | rsynnott | yep |
| 14:27 | Chousuke | Also don't macros cause more problems with the GPL, as you're basically including the library's code in your own product. |
| 14:27 | Chousuke | At least I've seen a (L)GPL exception specifically adressing this |
| 14:27 | rsynnott | Chousuke: LLGPL? |
| 14:28 | hiredman | LOLGPL |
| 14:28 | Chousuke | :P |
| 14:28 | rsynnott | AFAIR it more addresses the issues brought up by the LGPL for languages which don't use proper dynamic linking |
| 14:28 | hiredman | *snort* |
| 14:29 | rsynnott | (you're allowed distribute an LLGPL library as part of your common lisp system without infection, but not an LGPL one) |
| 14:29 | hiredman | blaming legal issues on technology and the reverse is very silly |
| 14:30 | rsynnott | LGPL certainly feels like it was designed in the context of C-like languages on UNIX-adjacent things |
| 14:37 | LauJensen | I'm speaking at http://opensourcedays.org/2010/ - Be there or be square |
| 14:38 | tomoj | "We could not calculate directions between Austin, TX and Copenhagen, Denmark." |
| 14:38 | tomoj | sorry |
| 14:41 | LauJensen | (just kidding, I know you'll find a way here) |
| 14:44 | tomoj | highly doubtful :( |
| 14:52 | texodus | the EPL and GPL are incompatible, correct? |
| 14:53 | texodus | so there's no way to license a clojure project that depends on contrib and a GPL licensed lib? |
| 14:54 | rhickey | EPL doesn't limit licenses with which it is combined, but GPL does |
| 14:54 | chouser | It's GPL not LGPL? |
| 14:54 | texodus | yes ... LGPL would be compatible though, yes? |
| 14:55 | chouser | I would think so. |
| 14:55 | chouser | Lots of Java GPL libs have a "class path exception" or something which may make a difference. |
| 14:57 | texodus | class path exception? So, if I add it to my classpath but don't modify the source, I can license my code under whatever (assuming the library in question has this clause)? |
| 14:58 | chouser | You'd have to check the actual clause, but that's my vague understanding. |
| 14:58 | texodus | interesting |
| 14:59 | texodus | thanks |
| 15:03 | chouser | if I want to insert the value of a reference object into a syntax-quote, I guess I can't use ~@my-ref |
| 15:03 | Chousuke | heh |
| 15:04 | chouser | hm. that should have been a pop quiz |
| 15:05 | Chousuke | What kind of macro do you have that needs refs? :| |
| 15:06 | chouser | I broke clojure.contrib.trace/dotrace, and now I'm trying to fix it |
| 15:06 | chouser | well, did fix it. |
| 15:07 | chouser | so it was vars not refs |
| 15:26 | Licenser | hmm what deos this: http://gist.github.com/304958 tell me? |
| 15:27 | ordnungswidrig | Licenser: macro-expansion time? |
| 15:27 | Licenser | no run time |
| 15:27 | ordnungswidrig | Licenser: does the inferior-lisp buffer tell you something or the other slime buffers? |
| 15:28 | chouser | (.foo nil) |
| 15:28 | chouser | ,(.foo nil) |
| 15:28 | clojurebot | java.lang.NullPointerException |
| 15:28 | ordnungswidrig | ,(nil nil) |
| 15:28 | clojurebot | java.lang.IllegalArgumentException: Can't call nil |
| 15:28 | chouser | ,(let [x nil] (x)) |
| 15:28 | clojurebot | java.lang.NullPointerException |
| 15:29 | Licenser | ordnungswidrig: not really |
| 15:29 | ordnungswidrig | Licenser: I remember having the same "stackless" NPE the other day. |
| 15:29 | ordnungswidrig | Licenser: do you have other SLDB buffer open? |
| 15:30 | chouser | oh, there's no "cause"? |
| 15:30 | Licenser__ | problem is that I just get' nullpointer exceptiopj' nothing helpful at all no where no message even |
| 15:31 | rhickey | naming time. Need names for cells, their access policy thingies, their 'alter' equivalent, the peek op |
| 15:31 | rhickey | ideas procs, ??, >>, << |
| 15:31 | hiredman | couldn't the peek op just be deref? |
| 15:32 | rhickey | no, still have deref |
| 15:32 | chouser | deref can trigger hooks, peek cannot? |
| 15:32 | rhickey | peek is used to look at part of the transient |
| 15:33 | rhickey | e.g. to get the count of a transient collection being built |
| 15:33 | bosie | anyone in here has the peepcode clojure screencast? |
| 15:33 | rhickey | also TBD - should procs have different arg order from other refs? (>> op aproc) vs (alter aref op) |
| 15:34 | rhickey | eases procifying |
| 15:34 | Licenser | any ideas how to get more information out fo clojure what went wrong? |
| 15:35 | bosie | or anyone know about phil hagelberg and/or the quality he normally delivers? :) |
| 15:35 | chouser | would peek be useful for anything other than transients? |
| 15:36 | rhickey | chouser: ideally one wouldn't know if a true transient was held, and would want to use a proc correctly in any case |
| 15:37 | rhickey | also, without it you must deref which might cause value to be produced |
| 15:37 | chouser | but doesn't peek start to get into implementation details? more than just deref/alter do. |
| 15:37 | chouser | I mean, if the cell isn't holding a transient, what would peek return? |
| 15:38 | rhickey | peek takes an accessor fn, it is not a deref of the entire thing |
| 15:38 | rhickey | so peek returns what that fn returns, e.g. count |
| 15:38 | rhickey | (<< count aproc) |
| 15:38 | chouser | oh, (peek a-cell count) ? |
| 15:38 | chouser | ok |
| 15:38 | rhickey | at not point are transients released to outside world in this model |
| 15:38 | rhickey | no point |
| 15:39 | chouser | ok. But count operates on the transient directly? |
| 15:39 | rhickey | there are some open qs about how much a transient might/not conform to the value's api. |
| 15:39 | chouser | ok |
| 15:39 | rhickey | e.g. String and StringBuilder |
| 15:40 | Chousuke | hm, I really want alphanumeric names for those functions, but I can't think of anything suitable :/ |
| 15:40 | rhickey | chouser: yes, peek/<< acts on transient |
| 15:41 | Chousuke | all good names are so overloaded. |
| 15:41 | lpetit | I had the "mental image" for "cell" in place. I don't understand why "proc" ? |
| 15:41 | rhickey | I'm not sure I will put it in the first pass, but think peek is unavoidable |
| 15:41 | rhickey | lpetit: proc(ess) |
| 15:41 | Chousuke | or too long :P |
| 15:41 | rhickey | lpetit: still might end up cell, thus this discussion |
| 15:41 | chouser | proc isn't too pad. proc-hook for the access policy thingies? |
| 15:42 | chouser | proc-peek |
| 15:42 | chouser | ...aaaand proc-alter. There, done! :-) |
| 15:42 | rhickey | In my first go-round, cells had locks. Now they have access policies that might or might not involve locks, so cell/lock doesn't quite work |
| 15:42 | chouser | oh, access policy != hook |
| 15:42 | Chousuke | proc-apply if the op goes first. :/ |
| 15:42 | lpetit | so what exactly will an access policy look like ? |
| 15:43 | Chousuke | but that's a bit long for something you would be doing continuously. |
| 15:43 | rhickey | (make-single-hreaded-proc-access-policy) |
| 15:43 | Chousuke | or perhaps you can do (proc-apply (comp foo bar) x) |
| 15:43 | rhickey | (make-multi-threaded-proc-access-policy) |
| 15:44 | rhickey | (make-proc apolicy aval) |
| 15:44 | lpetit | I like "jail". Not overloaded, easy to remember metaphore. |
| 15:45 | rhickey | jails are punitive |
| 15:45 | lpetit | well, "not overloaded" ... |
| 15:46 | abrooks | Rather than worrying about overloaded terms I think language designers should just create their own vocabulary for off-the-beaten-path functions/interfaces/etc.: qwub, blurf, voop... |
| 15:46 | abrooks | Provide a glossary and Bob's your uncle! |
| 15:46 | Chousuke | ! |
| 15:46 | Chousuke | don't make all my example code executable all of a sudden! |
| 15:47 | rhickey | one possible name for the access policy is 'sentry' |
| 15:47 | abrooks | Hehe! |
| 15:47 | rhickey | then cell+sentry still works |
| 15:47 | lpetit | "jail is punitive": yeah, all the point of clojure is to punish "he who uses mutable states" :-) |
| 15:47 | hiredman | cellar |
| 15:48 | lpetit | just kidding |
| 15:48 | Licenser | hmm how can it happen that there is no backtrace? |
| 15:48 | ordnungswidrig1 | in unix speak there is chroot |
| 15:48 | rhickey | lpetit: kidding aside, I wonder if that is really Clojure's point. Clojure is more about making the state model correct and safe, never has been about avoiding it |
| 15:49 | lpetit | rhickey: yes, I regretted the kidding words at the exact second I hit Enter |
| 15:49 | chouser | I think if you wanted to punish the use of state you would invent something more like a monad. |
| 15:49 | rhickey | chouser: exactly |
| 15:49 | lpetit | chouser : rofl |
| 15:50 | abrooks | chouser: I thought C++ had automatic punishment for using state... |
| 15:50 | lpetit | ok, so indeed, the notion of punishing is to be avoided |
| 15:50 | Chousuke | I think process fits pretty well as a name, especially if there are to be policies as well. |
| 15:50 | chouser | C++ includes punishment for being a programmer. |
| 15:50 | rhickey | also, these things are decidedly multi-threading oriented, whereas monads... |
| 15:50 | Chousuke | I doubt anyone will confuse it with OS processes :/ |
| 15:50 | chouser | Chousuke: yes, I agree. |
| 15:51 | lpetit | fridge ? :-p |
| 15:51 | rhickey | a key feature of cells will be supporting multiple effectors of a single process |
| 15:51 | chouser | as long as no proc-policy will support actual simultaneous updates to the value(s)... |
| 15:52 | rhickey | what is a simultaneous update? |
| 15:52 | hiredman | cord |
| 15:53 | Chousuke | rhickey: a coordination failure? :) |
| 15:54 | chouser | an object with multiple mutable fields? |
| 15:55 | chouser | my point being if the operations on the cell aren't completely serialized, the calling it a "process" starts to feel wrong. |
| 15:56 | rhickey | chouser: it can get grey esp when you consider the use of a j.u.c.collection as the transient |
| 15:57 | rhickey | as much serialization as is needed for consistency is used, but not necessarily totally serial |
| 15:58 | rhickey | nesting is also an interesting question. Right now, the sentries act as factories for cells and sentries are passed to the transient fn, so the transient could created nested cells controlled by the same sentry |
| 15:58 | hiredman | cord: a line made of twisted fibers or threads; "the bundle was tied with a cord" |
| 15:59 | rhickey | hiredman: but a single-threaded cord doesn't quite fit |
| 16:00 | hiredman | but it's not single threaded, as you said "as much serialization as is needed" |
| 16:00 | rhickey | chouser: but yes, in general the cells ensure serialized access, although multiple threads can participate in the creation of the 'next' value |
| 16:00 | rhickey | hiredman: there will be single threaded sentries |
| 16:01 | neotyk | where I can read about cell/fridge/proc/... ? |
| 16:01 | chouser | neotyk: IRC logs. :-] |
| 16:01 | neotyk | can't scroll that far :-o |
| 16:02 | neotyk | clojurebot: where is log |
| 16:02 | clojurebot | 'Sea, mhuise. |
| 16:02 | hiredman | clojurebot: logs? |
| 16:02 | clojurebot | logs is http://clojure-log.n01se.net/ |
| 16:02 | neotyk | hiredman: thanks |
| 16:02 | Chousuke | rhickey: so are these things going to completely replace transients as they exist now? |
| 16:02 | rhickey | as far as >>/<<, I want something that makes cell-ification of existing functional code easy and relatively transparent |
| 16:02 | rhickey | Chousuke: yes |
| 16:04 | rhickey | so, we I something short, and need some feedback on arg order |
| 16:04 | arohner | rhickey: my only opinion on naming is to use words rather than symbols. I greatly prefer a word over << or >>. Or if the symbols are present, make them optional, like deref/@ |
| 16:04 | rhickey | arohner: ok, needs to be short and to get out of the way |
| 16:05 | arohner | rhickey: sure. I don't know enough about the feature you're working on to propose a good name. :-) |
| 16:05 | lpetit | if you follow the cell/sentry metaphor, what would be the word for peek ? |
| 16:05 | rhickey | you'll have code like (assoc m k v) (count m) becoming => (cell-alter assoc m k v) (cell-peek count m) |
| 16:05 | Chousuke | you can peek into a cell I suppose |
| 16:05 | chouser | to look into the cell without changing it in any way |
| 16:06 | Chousuke | "observe" is perhaps too long :/ |
| 16:06 | rhickey | peek already defined for stacks |
| 16:06 | jasapp | I'm out of the loop, are transients not working well in their current state? |
| 16:06 | jasapp | or rather, what's the reason for the change? |
| 16:06 | rhickey | jasapp: they can be better, and will be soon |
| 16:06 | lpetit | and also, you don't do it by yourself, you ask the sentry to get some data about the cell's content for you |
| 16:07 | jasapp | gotcha |
| 16:07 | rhickey | lpetit: but the sentry is embedded in the cell, not an argument to these |
| 16:07 | Chousuke | "query" might be good but I don't think you can take that name :P |
| 16:07 | rhickey | lpetit: but true, internally these requests go through the sentry |
| 16:07 | chouser | I like cell-alter. I think if a synonym of >> was provided, people would eventually settle on cell-alter anyway. |
| 16:07 | lpetit | rhickey: yes I was just thinking about the metaphore |
| 16:08 | rhickey | chouser: really? would be an interesting experiment :) |
| 16:08 | lpetit | look-for |
| 16:08 | chouser | though maybe "alter" isn't so good considerting the (good, I think) different arg order. |
| 16:08 | lpetit | what is the verb you english natives use when a you tell your dog to go find and get back the bone/wood ? |
| 16:08 | chouser | "fetch" |
| 16:08 | rhickey | chouser: one key reason not to use alter or any variant thereof is the semantics here are different. alter takes a pure fn of val-to-val |
| 16:09 | rhickey | cells can take arbitrary side-effecting fns, and will ensure once-only semantics |
| 16:09 | Chousuke | I think cell-apply might be okay then |
| 16:09 | lpetit | so could fetch be the name for "peek" ? |
| 16:10 | Chousuke | though hm, it would be subtly different from plain apply :( |
| 16:10 | opqdonut | can somebody give me a one-line description of cells? |
| 16:10 | chouser | opqdonut: probably not. I'll see if I can get you a log link |
| 16:12 | opqdonut | how long ago would that be? |
| 16:12 | lpetit | opqdonut: a controlled place (cell) in which one will be able to mutate things at will in order to finally produce a new (immutable) value. Access to the cell will have controlled semantics (one thread at a time, ...) ... but that's certainly incomplete / partially wrong |
| 16:12 | chouser | opqdonut: http://clojure-log.n01se.net/date/2010-01-22.html#09:22a |
| 16:12 | Licenser | gar |
| 16:13 | rhickey | a cell is a new reference type that arbitrates the possibly multi-step/multi-threaded process of producing a new value |
| 16:13 | lpetit | cell-alter -> "shape" ? "mould" ? "mold" ? |
| 16:13 | rhickey | because it is process aware, it can leverage transients |
| 16:14 | rhickey | what about cell-> and cell-< ? |
| 16:14 | neotyk | hiredman: |
| 16:14 | rhickey | (cell-> assoc m k v) (cell-< count m) |
| 16:14 | hiredman | neotyk: |
| 16:14 | Chousuke | if you're going to do that, I suggest cell>> and cell<< |
| 16:14 | lpetit | neotyk, hiredman: |
| 16:14 | Chousuke | the -< looks kind of ugly :/ |
| 16:14 | chouser | so... cell-> is for chaning the value *in* a cell, and cell-< is for getting the value out? seems ... backwards |
| 16:15 | chouser | <<cell and cell>> ? |
| 16:15 | stuartsierra | What's wrong with put/get? |
| 16:15 | chouser | er |
| 16:15 | chouser | sorry, I meant: <<cell and >>cell for apply and peek |
| 16:15 | rhickey | stuartsierra: without prefixes? |
| 16:16 | chouser | wrong again. <<cell for peek and >>cell for apply |
| 16:16 | rhickey | chouser: I don't see it |
| 16:16 | rhickey | ah |
| 16:16 | chouser | sorry. reduces the weight of my argument if I can't even get it right. :-P |
| 16:17 | chouser | those will look like bit-shift to many |
| 16:17 | rhickey | chouser: true |
| 16:17 | stuartsierra | get-cell, put-cell, whatever, just something English |
| 16:17 | opqdonut | lpetit: ah yes, I see |
| 16:17 | opqdonut | kinda like haskell's ST |
| 16:17 | ordnungswidrig1 | in/out |
| 16:17 | stuartsierra | But I'm way behind on this whole cells conversation anyway |
| 16:18 | lpetit | opqdonut: please also refer to rich's more precise def he just wrote above |
| 16:19 | opqdonut | what about transients? |
| 16:19 | Chousuke | opqdonut: they will be replaced |
| 16:20 | opqdonut | ok |
| 16:20 | opqdonut | so we'll have vars, refs, atoms and cells or will some of those be subsumed? |
| 16:20 | kotarak | transients? replaced? |
| 16:20 | rhickey | I would almost go for 'in' if the arg order was same as other references (in acell assoc k v) |
| 16:21 | rhickey | kotarak: transients will be used only inside cells |
| 16:21 | rhickey | kotarak: but such use will be automatic, safer, potentially multithreaded etc |
| 16:21 | kotarak | Ah. Something new. Clojure sure is moving fast. I'm loosing track..... :/ |
| 16:22 | opqdonut | indeed |
| 16:22 | rhickey | my biggest concern with these names is the conversion of proper functional code. The transient story was very good here, and cells should strive to be as good |
| 16:22 | rhickey | transients -> add transient/persistent! and some !s |
| 16:23 | rhickey | if the cells story is add cell-this/cell-that to every call, and possibly change arg order... |
| 16:23 | rhickey | bleh |
| 16:24 | qed | is it possible to install the jvm, ant or maven, in a user's $HOME dir without root? |
| 16:24 | opqdonut | the jvm, sure |
| 16:24 | opqdonut | just extract the archive |
| 16:24 | opqdonut | you have to use the JAVA_HOME environment variable or whatever it was though |
| 16:25 | chouser | rhickey: the arg order story is important. is that part of why puncutation feels better to you than a name like the other ref types? |
| 16:25 | lpetit | qed: sure |
| 16:25 | rhickey | chouser: I guess |
| 16:25 | qed | ah, cool -- any suggestions for a skinny jvm? |
| 16:25 | stuartsierra | qed: It's like installing any package locally: unpack, compile, modify some environment variables like $PATH and $JAVA_HOME |
| 16:25 | qed | er rather, recommendations |
| 16:25 | stuartsierra | qed: There's no such thing as a skinny JVM. |
| 16:25 | rhickey | chouser: but I'd be amenable to a good short name |
| 16:25 | qed | stuartsierra: had to ask :) |
| 16:26 | jkkramer | so using cells would be something like (>> conj v i) instead of (conj! v i) ? |
| 16:26 | chouser | plain punctuation seems too "universal" to have meaning only with a specific reference type. |
| 16:26 | stuartsierra | qed: Some are lighter than Sun's, but they lack the same level of features & optimizations. |
| 16:26 | rhickey | jkkramer: right |
| 16:26 | chouser | (>>cell conj v i) |
| 16:26 | chouser | eh. :-/ |
| 16:27 | Chousuke | (in-cell conj v i) |
| 16:28 | rhickey | chouser: no, v is the cell |
| 16:28 | chouser | yes. what did I say? |
| 16:29 | Chousuke | so (in-cell v conj i)? :P |
| 16:29 | chouser | oh, I meant (defn >>cell [v i] ...) |
| 16:29 | rhickey | heh, you're right, I saw >>cell as 2 words :) |
| 16:29 | chouser | but I agree it's confusing. hence "eh. :-/" |
| 16:29 | kotarak | (conj-cell v i) |
| 16:29 | hiredman | you could just use ! |
| 16:29 | hiredman | (! conj v i) |
| 16:30 | rhickey | hiredman: if we go pure non-words, >> and << will win out |
| 16:30 | rhickey | so we're looking for words |
| 16:30 | Chousuke | hiredman: But that won't actually destroy anything visible to you. |
| 16:30 | LauJensen | I wonder how much harder it is to dive into Clojure today, with the heavy use of -> ->> -?> -?>> and so on |
| 16:30 | ordnungswidrig | >> is very c++ for me. (which I do not consider a good thing) |
| 16:30 | rhickey | note that mt-cells will have all of their calls inside an (inside [cell1 cell2...] ...) block |
| 16:31 | ordnungswidrig | LauJensen: as a relative clojure newbie I find it confusing. |
| 16:31 | qed | blast -- C-s is broken in emacs inside a screen session -- was just working.. hmm |
| 16:31 | LauJensen | ordnungswidrig: What I figured, we're slowly becoming the lispy perl version |
| 16:31 | rhickey | LauJensen: that's the fault of -?> and -?>> - ick |
| 16:31 | ordnungswidrig | people complain about lisp having all that parenthesis. |
| 16:32 | lpetit | ordnungswidrig: is it he who is named 'ordnungswidrig' which says -> is confusing ? :-p |
| 16:32 | LauJensen | rhickey: I just saw ! proposed as an fn right? It doesnt get more obscure than that |
| 16:32 | ordnungswidrig | people will complain about clojure having all kinds of parenthesis: () [] {} <> |
| 16:32 | Chousuke | rhickey: Will calls to a cell return a new cell object to be used in later calls? Or are you going to allow imperative style mods? |
| 16:32 | lpetit | woops |
| 16:33 | rhickey | Chousuke: imperative style will be supported just like for all reference types |
| 16:33 | lpetit | but -?> is not very visible at first when coming to clojure |
| 16:33 | rhickey | cell-do ? |
| 16:33 | rhickey | do-cell ? |
| 16:33 | qed | how about (.oO cell conj v i) ;) |
| 16:33 | ordnungswidrig | there are sill parenthesis left for cell in/out: «»〔〕‹›⎡⎦ |
| 16:33 | lpetit | it's not the cell you're altering |
| 16:34 | kotarak | in-cell! |
| 16:34 | opqdonut | insel :) |
| 16:34 | ordnungswidrig | ic |
| 16:34 | kotarak | freitag! |
| 16:34 | jkkramer | (cell-call conj v i), (cellify conj v i) |
| 16:34 | kotarak | cell! |
| 16:34 | qed | (chamber conj v i) |
| 16:34 | rhickey | (inside [c] (in-cell! assoc c k v)), not quite right |
| 16:35 | qed | (dungeon conj v i) |
| 16:35 | ordnungswidrig | within |
| 16:35 | Chousuke | (prison-break! cell conj i) :P |
| 16:35 | qed | haha |
| 16:35 | rhickey | ordnungswidrig: in and within better with different arg order |
| 16:35 | qed | (cytoplasm conj v i) |
| 16:35 | stuartsierra | cellish |
| 16:36 | qed | (cellize |
| 16:36 | LauJensen | rhickey: I might need to look at the log, but isnt there a way to simply use the same names as on transients, like assoc!, and then have that fn test what its been used on ? |
| 16:36 | kotarak | (inside [c] (cellic assoc) c k v) |
| 16:36 | rhickey | LauJensen: no |
| 16:37 | jkkramer | (inside [c foobar] (foobar assoc k v)) |
| 16:37 | ordnungswidrig | rhickey: I said the other day clojure would not be developer by voting. I never would have thought I was developed my collective irc brainstorming ;-) |
| 16:37 | ordnungswidrig | jkkramer: making it customizable? |
| 16:37 | jkkramer | oops, (foobar assoc c k v) |
| 16:38 | rhickey | ordnungswidrig: I like to get input on names, the design has taken me weeks |
| 16:38 | Chousuke | using the cell itself as a function might be interesting |
| 16:38 | Chousuke | but that's different from the other ref types :/ |
| 16:38 | qed | rhickey: whether you actually want a name or not please ask -- it's always fun to talk about these sorts of things. you do all the work, and we name it! ;) |
| 16:38 | rhickey | pass/fetch ? |
| 16:39 | rhickey | (pass assoc mcell k v) |
| 16:39 | rhickey | (fetch count mcell) |
| 16:39 | ordnungswidrig | qed: hehe. It's like other getting a baby and making fun naming suggestions |
| 16:39 | Chousuke | that sounds okay |
| 16:39 | chouser | that's not bad |
| 16:39 | Chousuke | pass is perhaps not optimal but better than anything so far :) |
| 16:40 | rhickey | Chousuke: pass has a lot of matching connotations |
| 16:40 | qed | "give" "take" ? |
| 16:40 | lpetit | (inside [c] (pass assoc c k v) (fetch count c)) |
| 16:40 | rhickey | lpetit: right |
| 16:40 | lpetit | qed: no, "take" conveys the meaning of removing smthing |
| 16:40 | rhickey | single-threaded code won't have inside |
| 16:41 | lpetit | rhickey: oh |
| 16:41 | qed | lpetit: give/grab? |
| 16:41 | kotarak | lift/retrieve |
| 16:41 | qed | kotarak: not so hot on retrieve, but i like lift |
| 16:42 | stuartsierra | entomb/exhume |
| 16:42 | qed | grab/grope? heh |
| 16:42 | rhickey | I don't understand lift |
| 16:42 | qed | err give/grope rather |
| 16:42 | Chousuke | qed: that sounds monadic :P |
| 16:43 | chouser | a very earthy language with words like slurp, spit, and grope |
| 16:43 | qed | rhickey: i liked lift in the second position, as in grab, fetch, exhume, etc. |
| 16:43 | stuartsierra | CLU used up/down, albeit for different purpose |
| 16:43 | Chousuke | cells kind of remind me of the "container" explanation of monads. |
| 16:43 | ordnungswidrig | have peek and poke already been mentioned? |
| 16:43 | stuartsierra | already used |
| 16:44 | stuartsierra | or they imply stacks |
| 16:44 | chouser | 'peek' is already for stacks and queues |
| 16:44 | stuartsierra | peep/prod? |
| 16:44 | qed | chouser: wait til 'fondle' is added |
| 16:44 | rhickey | ok, please make serious counterproposals to cell/sentry/pass/fetch/inside |
| 16:44 | stuartsierra | those are fine |
| 16:44 | lpetit | wrap/unwrap .. ? |
| 16:44 | opqdonut | hmm, why isn't http://clojure.org/transients linked to the menu on the left side? |
| 16:45 | chouser | inside is dynamic scope, not liexical? |
| 16:45 | opqdonut | because they're somewhat experimental? |
| 16:45 | rhickey | chouser: yes |
| 16:45 | opqdonut | anyway, I wasn't even aware of them before this discussion... :( |
| 16:45 | chouser | then perhaps with-cells instead? |
| 16:45 | rhickey | within-cells? |
| 16:45 | chouser | yes |
| 16:46 | rhickey | cell/sentry/pass/fetch/within-cells |
| 16:47 | chouser | with << and >> as synonmys to see what wins out? |
| 16:47 | rhickey | chouser: nah |
| 16:47 | opqdonut | about transients: is (do (conj! v 0) (conj! v 1)) an error, undefined behaviour, or something else? |
| 16:47 | qed | i dont love pass/fetch, but that's just me |
| 16:47 | lpetit | cell/sentry/feed/fetch/within-cells |
| 16:48 | rhickey | qed: how do you get something to someone in a cell? |
| 16:48 | lpetit | opqdonut: an error |
| 16:48 | qed | you give it to them |
| 16:48 | opqdonut | run-time? |
| 16:48 | clojurebot | what time \is it? is TIME TO GIT BUSY! |
| 16:48 | rhickey | qed: but there's a sentry |
| 16:48 | chouser | opqdonut: incorrect code. I guess you could say "undefined" in that no exception is thrown and behvior depends on other things. |
| 16:48 | qed | toss? |
| 16:49 | opqdonut | chouser: that's kinda bad, as that's an easy error to make |
| 16:49 | rhickey | in-cells? |
| 16:49 | clojurebot | namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it |
| 16:49 | opqdonut | but I see the implementation angle, too :) |
| 16:50 | qed | rhickey: as opposed to within-cells? |
| 16:50 | rhickey | a sentry has to let you pass, you pass things to people |
| 16:50 | rhickey | qed: right |
| 16:50 | lpetit | rhickey: are we really in the cell or just in the corridor ? |
| 16:50 | chouser | isn't a collection of multiple cells a jail? in-jail |
| 16:50 | rhickey | lpetit: really, it turns the cells into a temporary cell-block |
| 16:51 | chouser | in-prison |
| 16:51 | lpetit | ok, must leave, cu guys |
| 16:51 | chouser | sorry. being silly again. "in-cells" is ok, better than "inside" |
| 16:51 | kotarak | panopticum |
| 16:51 | rhickey | things pass through cell membranes, if you take the biology metaphor |
| 16:52 | rhickey | cell/sentry/pass/fetch/in-cells |
| 16:52 | qed | rhickey: a sentry lets you pass, but you are accessing a cell |
| 16:52 | kotarak | diffuse |
| 16:52 | qed | access? |
| 16:52 | Chousuke | reach? |
| 16:52 | chouser | I like the arg-order with "pass", where the direct object is the fn and the indirect object the cell |
| 16:53 | Chousuke | that's closer to fetch I guess :/ |
| 16:53 | rhickey | chouser: right |
| 16:53 | qed | access/visit? |
| 16:53 | kotarak | osmose |
| 16:53 | chouser | fetch. fetch what? (fetch count ...) |
| 16:53 | Chousuke | send would be excellent but it's taken... :P |
| 16:53 | kotarak | reverse-osmose |
| 16:54 | rhickey | Chousuke: send not better than pass IMO |
| 16:54 | qed | cell/sentry/access/visit/in-cells |
| 16:54 | rhickey | let's try to keep the S/N ratio high, please :) |
| 16:55 | rhickey | looking now only for things better than fetch, perhaps touching on the smuggling out nature of these reads |
| 16:55 | rhickey | biab |
| 16:57 | kotarak | run |
| 16:57 | qed | no good |
| 16:57 | kotarak | bootleg |
| 16:58 | kotarak | qed: why is run no good? |
| 16:58 | qed | it means too many different things |
| 16:58 | kotarak | call |
| 16:58 | qed | synonyms of smuggle are not ideal *(at least from your osx dictionary ;) |
| 16:58 | kotarak | (call count cell) |
| 17:00 | qed | smuggle means both to import or export, or to 'convey or introduce cladestinely' -- in that sense i dont think it suggests what is going on. are we smuggling in, or smuggling out? |
| 17:00 | jkkramer | peer? |
| 17:00 | qed | spy? |
| 17:00 | ordnungswidrig | beam? |
| 17:01 | kotarak | qed: I would suspect smuggling out |
| 17:01 | qed | kotarak: not a heroin mule, eh? |
| 17:01 | qed | how about "scout"? |
| 17:01 | qed | i like that a lot |
| 17:05 | Chousuke | spy would be fun :P |
| 17:12 | technomancy | why aren't namespaces Named? |
| 17:12 | chouser | hardly anything is named. just symbols and keywords I think. :-/ |
| 17:12 | technomancy | I see |
| 17:12 | chouser | I wish Vars and namespaces were |
| 17:13 | kotarak | ns-name is also a symbol, no? Not a string. |
| 17:13 | stuartsierra | kotarak: correct |
| 17:13 | hiredman | vars may or may not be named, so making them Named was felt to be odd |
| 17:13 | kotarak | chouser: not every var has a name. eg. Compile/LINE or so. |
| 17:14 | chouser | not every symbol has a namespace, but 'namespace' still works |
| 17:14 | technomancy | hiredman: ah, good point. but can you have anonymous namespaces? |
| 17:14 | hiredman | technomancy: I would say no, but I haven't looked at Namespace.java |
| 17:14 | kotarak | (doc create-namespace) |
| 17:14 | clojurebot | Excuse me? |
| 17:14 | kotarak | (doc create-ns) |
| 17:14 | clojurebot | "([sym]); Create a new namespace named by the symbol if one doesn't already exist, returns it or the already-existing namespace of the same name." |
| 17:15 | hiredman | chouser: true |
| 17:15 | technomancy | kotarak: looks pretty named to me. =) |
| 17:15 | kotarak | technomancy: but with a symbol not a string |
| 17:16 | hiredman | ,(doc ns-name) |
| 17:16 | clojurebot | "([ns]); Returns the name of the namespace, a symbol." |
| 17:16 | hiredman | hmm |
| 17:16 | technomancy | no reason why namedness shouldn't be transitive in that case |
| 17:16 | kotarak | technomancy: or why namespaces should be named by a symbol instead of a string... |
| 17:17 | hiredman | kotarak: or namespaces could be named by a symbol and return that symbol's name |
| 17:18 | technomancy | it's pretty nit-picky, but it would be convenient |
| 17:18 | lpetit | rhickey: on the "beast" theme - powerful thing but to be used with care : cage/tamer/[feed|nurture|fill]/[inspect|control]/within-cages |
| 17:19 | kotarak | refer-clojure does not support :as? pff... |
| 17:20 | hiredman | kotarak: as is alias, refer is use |
| 17:20 | kotarak | hiredman: use supports :as. |
| 17:20 | jkkramer | there's rename |
| 17:21 | jkkramer | (ns foo.bar (:refer-clojure :rename {print core-print})) |
| 17:22 | kotarak | jkkramer: (ns foo (:refer-clojure :exclude (...)) (:alias core clojure.core)) works |
| 17:24 | hiredman | why does use support :as? |
| 17:25 | kotarak | dunno, but it's useful. |
| 17:25 | hiredman | how? |
| 17:25 | clojurebot | with style and grace |
| 17:25 | rhickey | I'm back, any brilliant alternatives to fetch? |
| 17:26 | kotarak | (ns foo (:use [bar :only (defbar) :as b])) |
| 17:26 | brennanc | I'm trying to get slime working with clojure. I get the REPL but the modeline says "*inferior-lisp*" and it doesn't do the function parameter hinting like I've seen in the slime screencasts) |
| 17:26 | hiredman | kotarak: and what does that do? |
| 17:26 | kotarak | hiredman: It "uses" defbar and defines an alias b. |
| 17:27 | brennanc | the modeline in the screencast I am watching shows "*slime-repl clojure*" so it looks like I'm not doing something right |
| 17:30 | technomancy | brennanc: inferior-lisp just means you have a CLI repl running in a subprocess; it doesn't mean you're using slime at all. |
| 17:31 | brennanc | I did M-x slime and it seemed to do something |
| 17:31 | brennanc | I get the user=> prompt |
| 17:31 | brennanc | what am I doing wrong? |
| 17:32 | brennanc | I followed the instructions on http://riddell.us/tutorial/slime_swank/slime_swank.html |
| 17:32 | technomancy | brennanc: those instructions are really out of date; try the instructions in the swank-clojure readme |
| 17:32 | jkkramer | rhickey: report? view? |
| 17:32 | technomancy | that page just won't die. =\ |
| 17:32 | ska2342 | brennanc: sorry for being late, what problem do you have? |
| 17:33 | brennanc | no kidding, I had the same problem with common lisp and none of the stuff I googled working. lol |
| 17:33 | kotarak | rhickey: call |
| 17:33 | brennanc | I'll check out the readme, thanks |
| 17:33 | jkkramer | "spy" was also mentioned |
| 17:33 | kotarak | and scout |
| 17:33 | technomancy | brennanc: swank-clojure is actually really easy to install, it's just that there's an abundance of bad instructions out there. |
| 17:36 | brennanc | hmm seems like it fails on the Contrib compiling |
| 17:36 | brennanc | Buildfile: build.xml does not exist! |
| 17:36 | brennanc | Build failed |
| 17:37 | brennanc | but I already have all the clojure stuff good to go |
| 17:37 | technomancy | brennanc: you don't need to compile contrib |
| 17:37 | technomancy | pretty much ever |
| 17:37 | brennanc | following the docs in swank-clojure README |
| 17:38 | brennanc | I ran M-x clojure-install and then it downloaded clojure and then looks like it failed on the build |
| 17:38 | xp_prg | I require mentorship |
| 17:38 | brennanc | if I can just set it up with my current clojure environment that would be much better but I don't see anything that tells me how to do that |
| 17:38 | technomancy | brennanc: http://github.com/technomancy/swank-clojure is the correct source |
| 17:38 | technomancy | jochu's fork is abandoned. =\ |
| 17:39 | dysinger | clojurebot: is hiredman around? |
| 17:39 | clojurebot | Titim gan éirí ort. |
| 17:39 | abrenk | technomancy: I just wonderd why in src/leiningen/jar.clj: :path (format "meta-inf/maven/%s/%s/pom.xml" it is not META-INF? |
| 17:42 | hiredman | dysinger: in and out |
| 17:42 | ska2342 | Can anybody tell me why *print-meta* is only observed by pr and prn but not by print and println? It took me quite a while to find out why my examples didn't work. |
| 17:44 | ska2342 | is it the distinction between "print ... for human consumption" and "print in a way ... can be read by the reader"? |
| 17:45 | guridosul | any special reason why "alter" names the function parameters as "fun" while others I've seen so far (map, apply...) names it as "f"? |
| 17:46 | guridosul | user=> (doc alter) ------------------------- clojure.core/alter ([ref fun & args]) |
| 17:46 | guridosul | user=> (doc map) ------------------------- clojure.core/map ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) |
| 17:47 | brehaut | hi all |
| 17:49 | brennanc | technomancy: I followed he instructions on the link you gave me but when I run M-x slime it still gives me inferior-lisp |
| 17:49 | hoeck | ska2342: exactly |
| 17:50 | hoeck | brennanc: have you tried m-x slime-repl? |
| 17:50 | ska2342 | hoeck: it might deserve some honorable mentioon in the docs, but anyway... :-) |
| 17:50 | brennanc | it can't find it |
| 17:50 | brennanc | "no match" |
| 17:51 | brennanc | package-list-packages says that slime-repl is installed |
| 17:53 | hoeck | brennanc: I have (slime-setup '(slime-fancy slime-repl)) in my .emacs.d |
| 17:53 | dysinger | hiredman: yo |
| 17:53 | dysinger | around? |
| 17:54 | hoeck | brennanc: at some point, slime devs decided to make the slime-repl optional |
| 17:54 | brennanc | I'm deleting everything and going to try again, maybe some old config is messing something up |
| 17:54 | hoeck | brennanc: try m-x slime-interactive-eval, and then type some clojure code |
| 17:55 | brennanc | should I install slime and slime-repl before installing the swank-clojure package? |
| 17:58 | brennanc | I'm getting an error: swank-clojure.el:48:1:Error: Cannot open load file: clojure-mode |
| 17:58 | brennanc | but when I look in the package list it says it is installed |
| 18:00 | brennanc | theres also this error when I type M-x slime |
| 18:00 | brennanc | Debugger entered: (("Error in timer" slime-attempt-connection (#<process inferior-lisp> nil 2) (file-error "make client process failed" "Co$ |
| 18:00 | brennanc | byte-code("\303\304\305^H \nF\"\207" [fun args data debug nil "Error in timer"] 6) |
| 18:00 | hoeck | brennanc: that means emacs cannot find the clojure-mode.el file |
| 18:01 | hoeck | brennanc: wich in turn means that something with the package-manager wrent wrong |
| 18:01 | brennanc | where are the docs to install all this manually, the ELPA route is buggy and doesn't seem to work |
| 18:06 | hoeck | brennanc: there is http://github.com/technomancy/swank-clojure/blob/master/README.md, "installing from source" |
| 18:11 | hiredman | dysinger: yes |
| 18:26 | icey | I'm messing around with Compojure, and I'm doing something wrong that I can't seem to figure out. I'm doing: (alter session assoc :name username) |
| 18:26 | icey | I'm getting clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.Ref |
| 18:26 | icey | as a result |
| 18:27 | hiredman | icey: I don't think session is a ref |
| 18:27 | hiredman | you have to use some special session-assoc function |
| 18:28 | icey | ahh, i was wondering about that. I saw some funky thing about that but was hoping I could do it the old-fashioned way that all the documentation out there currently uses |
| 18:32 | brennanc | swank-clojure seems to work in emacs 22 on my mac, but not emacs 23 on gentoo linux |
| 18:32 | icey | hiredman: thanks, that looks like what it was |
| 18:32 | brennanc | can't figure out why |
| 18:32 | qbg | brennanc: Doesn't work how? |
| 18:33 | brennanc | when I run M-x slime it gives the following errors: |
| 18:33 | brennanc | Debugger entered: (("Error in timer" slime-attempt-connection (#<process inferior-lisp> nil 2) (file-error "make client process failed" "Co$ |
| 18:33 | brennanc | byte-code("\303\304\305^H \nF\"\207" [fun args data debug nil "Error in timer"] 6) |
| 18:33 | brennanc | slime-timer-call(slime-attempt-connection #<process inferior-lisp> nil 2) |
| 18:33 | brennanc | apply(slime-timer-call (slime-attempt-connection #<process inferior-lisp> nil 2)) |
| 18:33 | brennanc | byte-code("\301^H\302H^H\303H\"\207" [timer apply 5 6] 4) |
| 18:33 | brennanc | timer-event-handler([t 19321 55542 468739 0.3 slime-timer-call (slime-attempt-connection #<process inferior-lisp> nil 2) nil]) |
| 18:33 | brennanc | I don't see that on OS X |
| 18:35 | qbg | That doesn't look like a swank-clojure error to me |
| 18:36 | qbg | You can run Clojure normally, correct? |
| 18:36 | hiredman | brennanc: is the jvm being started? |
| 18:37 | brennanc | where does swank-clojure install clojure to? I deleted my install because I was trying to start fresh because nothing else was working |
| 18:37 | brennanc | are there other steps I need to do before or after that aren't document in swank-clojure |
| 18:37 | brennanc | am I missing something else? |
| 18:38 | qbg | Take a look in ~/.swank-clojure |
| 18:38 | brennanc | qbg: I see the jars and can bring up the repl from the command line with java -cp ... clojure.main |
| 18:39 | qbg | Post your .emacs somewhere |
| 18:39 | japowl | I'm wrapping some javalibs that return HashMaps, and I want them converted to clojure hash-maps. Right now I do (#(zipmap (map keyword (.keySet %)) (.values %)) javaHashMap) which works fine, but I wonder if theres a more ideomatic way or even some contrib lib I might be missing? |
| 18:40 | brennanc | http://brennancheung.com/.emacs |
| 18:41 | qbg | What does (swank-clojure-cmd) evaluate to? |
| 18:42 | tomoj | ,(let [hm (doto (java.util.HashMap.) (.put :foo "bar"))] (into {} hm)) |
| 18:42 | clojurebot | {:foo "bar"} |
| 18:42 | tomoj | japowl: ^ |
| 18:42 | hiredman | brennanc: in ps output can you see the jvm that swank launches? |
| 18:42 | brennanc | qbg: java.lang.Exception: Unable to resolve symbol: swank-clojure-cmd in this context (NO_SOURCE_FILE:7) |
| 18:42 | qbg | Inside emacs |
| 18:43 | brennanc | hiredman: ps output? |
| 18:43 | brennanc | hiredman: I don't see anything about JVM messages when I try to run slime from emacs |
| 18:43 | hiredman | brennanc: ps auxwww |
| 18:43 | japowl | tomoj: hahaha, thanks! man, I was so sure I had tried exactly that |
| 18:44 | hiredman | brennanc: right, so it sounds like it launches the jvm but fails to connect and a timeout happens and you get an error |
| 18:44 | tomoj | of course, |
| 18:44 | tomoj | ,(class (let [hm (doto (java.util.HashMap.) (.put :foo "bar"))] (into {} hm))) |
| 18:44 | clojurebot | clojure.lang.PersistentArrayMap |
| 18:44 | hiredman | but I won't to check and see if it is actually starting the jvm |
| 18:44 | tomoj | but I didn't figure you really cared whether it was a hash-map |
| 18:44 | hiredman | want to |
| 18:44 | brennanc | looks like it is launching the sun-jdk-1.6 |
| 18:45 | brennanc | let me paste it online |
| 18:46 | brennanc | http://brennancheung.com/temp.txt |
| 18:46 | japowl | tomoj: no that's exactly what I wanted, but didn't the obvious ways to work and ended up with the hideous zipmap-version. |
| 18:46 | hiredman | brennanc: can you see the java process listening on a port? |
| 18:46 | hiredman | socket, whatever |
| 18:47 | brennanc | not sure, how can I check? |
| 18:47 | hiredman | does linux have a sockstat command? |
| 18:48 | brennanc | doesn't look like it, not that I can find |
| 18:49 | brennanc | I don't see anything under netstat |
| 18:49 | brennanc | I can get the inferior-lisp and it does let me run some things, but it isn't the full clojure environment |
| 18:50 | brennanc | what's this timer it is mentioning? |
| 18:51 | brennanc | I added it to http://brennancheung.com/temp.txt so you can see the full error easier |
| 18:52 | hiredman | I imagine there is same time out if the elisp part of swank doesn't connect to the clojure part of swank in X seconds it throws a wobly |
| 18:53 | qbg | If you start swank-clojure separately, can you connect to it? |
| 18:55 | hiredman | I wonder why it doesn't show up in net/sock/etcstat |
| 18:55 | qbg | Well, it looks like it is never getting to the point of launching the swank server |
| 18:56 | brennanc | I can type clojure and it runs it, so it is doing something |
| 18:57 | brennanc | so I'm not sure what exactly I'm running |
| 18:58 | brennanc | what is the difference between the jochu and technomancy versions? |
| 18:58 | brennanc | are the the same? |
| 18:58 | qbg | Use technomancy's |
| 18:58 | hiredman | jochu's is way old |
| 18:59 | brennanc | what about these instructions? |
| 18:59 | brennanc | http://lifeofaprogrammergeek.blogspot.com/2009/03/learning-clojure-and-emacs.html |
| 19:00 | hiredman | oh |
| 19:00 | hiredman | those were old in 2008 |
| 19:00 | hiredman | dunno how those could be instructions for 2009, let alone 2010 |
| 19:01 | hiredman | clojure used to be in svn at google code, and kevinoneill had a git mirror on github, but clojure long ago moved to github |
| 19:02 | hiredman | clojurebot: github? |
| 19:02 | clojurebot | http://github.com/richhickey/clojure/tree/master |
| 19:02 | hiredman | ^- |
| 19:02 | qbg | You could take a look at these instructions: http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/ |
| 19:02 | hiredman | http://github.com/technomancy/swank-clojure <-- or the ones here |
| 19:03 | Raynes | java.lang.String cannot be cast to clojure.lang.IFn |
| 19:03 | Raynes | Oh boy, and only 200 lines of code to dig through to find the source. |
| 19:03 | qbg | Raynes: This is why you have stack traces |
| 19:03 | Raynes | qbg: Yeah, they aren't helpful here. |
| 19:04 | qbg | Lazy sequences getting in the way? |
| 19:04 | Raynes | No, they're just completely gibberish. |
| 19:05 | brennanc | I've been through both sets of those instructions before I even started asking around here. no luck |
| 19:05 | boojum | ,(apply str (rest (str :foo))) |
| 19:05 | clojurebot | "foo" |
| 19:06 | hiredman | ,(name :foo) |
| 19:06 | clojurebot | "foo" |
| 19:06 | boojum | hiredman, thanks! |
| 19:14 | brennanc | I put together a screenshot of the problem I am having getting swank-clojure up and running. maybe someone will be able to spot the problem easier because something might have been lost in translation earlier. |
| 19:14 | brennanc | http://brennancheung.com/swank.gif |
| 19:14 | brennanc | you can see some of the stuff runs but stuff like C-c I doesn't bring up the inspector |
| 19:14 | qbg | Try M-x slime-connect |
| 19:15 | qbg | The port swank is running on is weird |
| 19:15 | brennanc | connection refused if I try the defaults |
| 19:15 | brennanc | make client process failed: Connection refused, :name, SLIME Lisp, :buffer, nil, :host, 127.0.0.1, :service, 4005 |
| 19:15 | qbg | Choose 59226 as the port |
| 19:16 | brennanc | qbg: same |
| 19:17 | brennanc | how can I start the server component by itself? |
| 19:18 | qbg | If you run swank.swank, it should bring up the connection |
| 19:18 | qbg | Of course you are going to need to set the classpath correctly |
| 19:19 | brennanc | is that a java class or M-x command? |
| 19:19 | qbg | java class |
| 19:19 | qbg | Just edit the first line of your http://brennancheung.com/temp.txt |
| 19:19 | qbg | Remove the "clojure.main --repl" and replace with "swank.swank" |
| 19:20 | qbg | Or if you have Leiningen, just configure a project to support lein swank |
| 19:21 | brennanc | class not found |
| 19:21 | qbg | swank-clojure is on the classpath? |
| 19:21 | brennanc | when I open up the swank-clojure.jar I don't see a single .class or .java file in there |
| 19:22 | qbg | Weird |
| 19:22 | brennanc | yes, it's in the classpath |
| 19:23 | brennanc | is there some custom class-loader that loads the .clj files, because otherwise I don't see any way adding the swank.jar would do anything |
| 19:23 | brennanc | there's no java class files in there |
| 19:24 | hiredman | qbg: are you sure swank.swank is a java class? |
| 19:24 | qbg | I can launch swank.swank |
| 19:25 | hiredman | *shrug* |
| 19:25 | qbg | If you could try building swank-clojure yourself as an uberjar |
| 19:25 | qbg | Then just run the jar |
| 19:26 | qbg | Well, I have to go |
| 19:30 | Raynes | I just fixed that bug I mentioned earlier by accident. I still don't know what was wrong. >:| |
| 19:34 | Raynes | "Java is one of the most popular up-and-rising languages that is currently out there." |
| 19:34 | jeld | hello, I seem to be having problem with duck-streams, are they renamed in the current version? |
| 19:36 | Raynes | jeld: It's io now. |
| 19:37 | Raynes | It would be nice to have a new contrib 1.2.0 master build up there, since it's pointless to write code using the old names now. |
| 19:38 | jeld | Raynes: thanks |
| 19:47 | brennanc | hmm, anybody else running swank-clojure on gentoo? |
| 19:48 | brennanc | I've tried it on both os x and centos and they seem to install/run fine, but gentoo doesn't seem to work |
| 20:43 | abrenk | brennanc: I'm runnig gentoo. Everythings fine. |
| 20:43 | brennanc | abrenk: are you running the sun-jdk or the virtual/jdk? |
| 20:44 | abrenk | brennanc: sun-jdk-1.6 |
| 20:44 | brennanc | hmm, weird, I can't figure out what the problem is |
| 20:44 | brennanc | the error message doesn't seem to make much sense |
| 20:44 | abrenk | I've installed using ELPA and didn't have any problems. |
| 20:44 | brennanc | yup, same here |
| 20:44 | brennanc | http://brennancheung.com/swank.gif |
| 20:44 | brennanc | that's the error I'm getting |
| 20:45 | brennanc | I get a repl, and it's kinda slime but a lot of the other features don't work |
| 20:46 | abrenk | The error looks strange. |
| 20:47 | brennanc | agreed, don't know where to start looking with it |
| 20:49 | abrenk | My REPLs buffer is called *slime-repl clojure*. The *inferior-lisp* one's missing some features. |
| 20:50 | abrenk | I mostly work using "lein swank" and "M-x slime-connect". Have you tried that? |
| 20:51 | abrenk | I fear I can't really tell you more than the other guys already did... |
| 20:51 | abrenk | ...just wanted to mention that I'm also running gentoo. |
| 21:10 | fusss | is there a clojure library for "SOAP"? something that consumes a WSDL and makes calls in a functional/OOP manner? |
| 21:11 | fusss | java has a boatload of them, and I am sure you boys and girls have found a way to use them in a lispy manner. dish. spill the beans. pass the joint. etc. |
| 21:11 | Raynes | fusss: I was looking for one earlier. |
| 21:12 | Raynes | Nothing to be found, as far as I can tell. |
| 21:12 | Raynes | And I'm not about to try to use Axis. |
| 21:12 | Raynes | So, I gave up on that. |
| 21:12 | fusss | there is one for Common Lisp and it's broken |
| 21:12 | Raynes | Like much of everything for Common Lisp /subjective |
| 21:12 | Raynes | :D |
| 21:12 | fusss | I could try the Schemers but I don't they even know what SOAP is |
| 21:13 | fusss | dont _think_ |
| 21:13 | fusss | oh well, back to work then |
| 21:14 | fusss | would love to try clj ASAP, as soon as I have time to grok the java underpinnings |
| 21:15 | tomoj | is SOAP ever a good thing? |
| 21:15 | tomoj | I'm genuinely curious |
| 21:16 | tomoj | in my mind it's always just been some mysterious old shit that I didn't want to touch |
| 21:16 | tomoj | but I imagine I am mistaken |
| 21:28 | icey | is there a good compojure example site out there somewhere? (github or elsewhere?) |
| 21:31 | fanatico | icey: LauJensen has a few good examples http://www.bestinclass.dk/index.php/tag/compojure/. |
| 21:32 | icey | fanatico: yeah, it seems like all his examples are the most recent. they don't seem to do things in the "compojure" way though - they avoid using sessions and for whatever reason the way he's using static files isn't working form e |
| 21:33 | icey | (but thank you :D) |
| 21:34 | fanatico | the reddit example doesn't, but the first two do, if I remember correctly. |
| 21:34 | fanatico | np |
| 21:34 | icey | ahh maybe I didn't look through enough of them |
| 21:35 | fanatico | beating the arc challenge is another good example http://www.bestinclass.dk/index.php/2009/12/beating-the-arc-challenge-in-clojure/ |
| 21:42 | icey | that's a good one too |
| 21:43 | tomoj | I think we need more |
| 21:43 | tomoj | someone was talking about this before |
| 21:43 | tomoj | I wonder what a good example app would be |
| 21:43 | tomoj | NOT a blog :P |
| 21:43 | icey | it would be really nice to have a canonical example out there that showed how to do basic stuff like sessions, static files, etc |
| 21:43 | icey | twitter clones work surprisingly well for example apps |
| 21:44 | tomoj | static files annoyed the hell out of me |
| 21:44 | icey | i've been dicking around with static files for the past 2 hours |
| 21:44 | tomoj | https://gist.github.com/1d20d755c9cb5f24f630 |
| 21:44 | tomoj | that's what I ended up using, didn't like it |
| 21:44 | icey | until I realized that for some godforsaken reason it was looking in /Users/icey/Public instead of /Users/icey/prj/mycompojureapp/public |
| 21:45 | tomoj | you also need good mimetypes |
| 21:45 | tomoj | the with-mimetypes middleware helps |
| 21:45 | tomoj | what I did was put my static files in mycompojureapp/resources/ |
| 21:45 | tomoj | er, mycompojureapp/resources/public/ |
| 21:46 | tomoj | lein-swank automatically puts resources/ on the classpath |
| 21:46 | icey | ahhh |
| 21:46 | icey | gonna try that right now :D |
| 21:46 | tomoj | and then you can grab the file reference with the clojure classloader |
| 21:46 | tomoj | but I wonder if there is a nicer way |
| 21:46 | tomoj | if they're really static files, like images or something, they should probably be served by the web server, not compojure |
| 21:46 | tomoj | in my case I wanted to grab html files to transform with enlive |
| 22:20 | jeld | what is wrong with this statement? (use 'clojure.contrib.http.agent :only '(http-agent string)) |
| 22:23 | jeld | somehow this doesn't work and (require 'clojure.contrib.http.agent) (refer 'clojure.contrib.http.agent :only '(http-agent string)) works... :( |
| 22:24 | _mst | I think you want: (use '[clojure.contrib.http.agent :only [http-agent string]]) |
| 22:29 | jeld | _mst: thanks, that was somehow non-obvious |
| 22:32 | jeld | another question, (println (string (http-agent "http://www.google.com/"))) from REPL returns immediately, but from a script it takes prints almost immediately, but then takes some 30-45 seconds to exit. Any idea why? |
| 22:33 | _mst | I'd guess that it's using agents behind the scenes |
| 22:33 | jeld | and as far as I can tell it is the call to http-agent that makes script slow to exit |
| 22:33 | _mst | if you add (shutdown-agents) to the end of your script does that sort it out? |
| 22:33 | jeld | heh |
| 22:33 | jeld | cool |
| 22:40 | Raynes | Guess it's time for me to learn about databases. |
| 23:19 | BrandonW | is it safe to assume that any time a keyword exists immediately after an open paren, that it will function similar to the ns macro, where indentation would be similar to a function call? |
| 23:19 | BrandonW | for example: http://github.com/technomancy/leiningen/blob/master/src/leiningen/compile.clj |
| 23:20 | Raynes | : echo-cmd ( -- ) command-line get " " join print ; ! I R l33t concatenative purrrrrrrsun |
| 23:20 | BrandonW | the (:use [clojure.contrib...] [clojure.contrib...] -- each vector is indented the same amount, as if they were arguments to a :use function |
| 23:21 | BrandonW | that seems to me like it is idiomatic clojure, but i am not sure... perhaps it could be used in a different manner where you would not wants the tokens after the keyword to be indented in that way? |
| 23:35 | BrandonW | ah, breaks down when you use a keyword as a function into a collection that you define ad-hoc across multiple lines |
| 23:36 | BrandonW | no nevermind, it doesn't |