2009-12-02
| 00:05 | solussd | can somebody provide a usage example of condp? |
| 00:29 | _ato | ,(condp = 4, 4 :four, 5 :five, :other) |
| 00:29 | clojurebot | :four |
| 00:30 | _ato | ,(condp = 5, 4 :four, 5 :five, :other) |
| 00:30 | clojurebot | :five |
| 00:30 | _ato | ,(condp = 6, 4 :four, 5 :five, :other) |
| 00:30 | clojurebot | :other |
| 00:30 | _ato | oh wait.. he left |
| 00:31 | alexyk | I've run mvn compile on a project with a clojure script reading from a database. It tried to run it, in fact. Does compile execute, or is it a maven-clojure plugin effect? |
| 00:33 | _ato | yes compile will execute stuff at the top-level |
| 00:33 | _ato | best not to have stuff at the top-level that actually does things, wrap it into a main function |
| 00:36 | alexyk | _ato: thx! |
| 00:55 | alexyk | is there an update-in! for transients? |
| 00:57 | cark | if you need update-in for transients, you might be not using them the way they should |
| 01:01 | alexyk | cark: I was scanning a giant stream of tweets and incrementing a hash map for each user_id when his twit is seen. _mts suggested transients and it shaved 1/3 of time. Now I want to build a map for graph, for each user_id adding in_reply_to to the nested map. Apparently you use update-in for updating the nested one, instead of just inc for user_id->count. So I was thinking of using transient on that, too, to save time, if possible, -- is it wrong? |
| 01:01 | alexyk | i.e. where I have assoc! now I'd like update-in! if it exists... |
| 01:02 | cark | ah i understand your problem |
| 01:02 | cark | mhh |
| 01:03 | cark | i guess that's your project =P anyways update-in is easy to write |
| 01:03 | cark | have a look at the source |
| 01:06 | cark | did you try parallelising instead of going the non-functional way ? |
| 01:07 | cark | which is non-functional as well but you know =) |
| 01:10 | alexyk | well I just used the "transient magic" folks added, and want to generalize |
| 01:14 | duncanm | dum de dum |
| 01:17 | tomoj | does anyone know anything about lazy json? |
| 01:19 | hiredman | alexyk: have you tried just using a concurrent hashmap? |
| 01:19 | alexyk | hiredman: where do I get that? |
| 01:20 | hiredman | alexyk: java.util.concurrent maybe |
| 01:20 | hiredman | ~google java concurrent hashmap |
| 01:20 | clojurebot | First, out of 7960 results is: |
| 01:20 | clojurebot | ConcurrentHashMap (Java 2 Platform SE 5.0) |
| 01:20 | clojurebot | http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ConcurrentHashMap.html |
| 01:20 | alexyk | hiredman: ah, a non-clojure one |
| 01:21 | alexyk | worth trying I guess |
| 01:21 | alexyk | especially given I may need to unleash concurrency on it -- but then non-clojure concurrency too, right? |
| 01:22 | hiredman | the argument for immutable datastructures is largely that you don't have to lock them |
| 01:23 | alexyk | well I don't know how to do Java concurrency from Clojure :( |
| 01:23 | hiredman | it's the same thing |
| 01:23 | hiredman | ,(import 'java.util.concurrent.ConcurrentHashMap) |
| 01:23 | clojurebot | java.util.concurrent.ConcurrentHashMap |
| 01:23 | hiredman | (ConcurrentHashMap.) |
| 01:23 | hiredman | ,(ConcurrentHashMap.) |
| 01:23 | clojurebot | #<ConcurrentHashMap {}> |
| 01:24 | alexyk | should I stick it into an atom or something? |
| 01:24 | hiredman | ,(doto (ConcurrentHashMap.) (.put :a 1)) |
| 01:24 | clojurebot | #<ConcurrentHashMap {:a=1}> |
| 01:24 | hiredman | nope |
| 01:24 | hiredman | clojure reference types are for hold immutable values |
| 01:24 | hiredman | a ConcurrentHashMap is not immutable |
| 01:24 | alexyk | will it block on two threads trying to update the same key? |
| 01:24 | alexyk | or, how do I share it across agents? |
| 01:24 | hiredman | alexyk: I imagine so, but I've never really used it |
| 01:25 | hiredman | alexyk: (def m (ConcurrentHashMap.)) |
| 01:25 | hiredman | then each agent just pounds on m |
| 01:25 | hiredman | I would definitely read the javadocs for it |
| 01:25 | alexyk | ah nice, so I don't have to wrap it into an agent. |
| 01:26 | hiredman | although concurrenthashmap is mutable, it is designed to be pounded on concurrently |
| 01:27 | hiredman | java.util.concurrent is full of goodies |
| 01:29 | alexyk | nice |
| 01:30 | hiredman | ,(:a (doto (ConcurrentHashMap.) (.put :a 1))) |
| 01:30 | clojurebot | 1 |
| 01:41 | hiredman | "For example, we could lock Rich Hickey in a basement and put him on a tofu-and-lettuce diet." |
| 01:41 | hiredman | hoho |
| 01:42 | duncanm | hiredman: clojure makes me think that S-Expression syntax might actually have a chance in a mainstream, i disagree with what he said about the syntax |
| 01:43 | duncanm | i.e. Point #2 |
| 01:43 | cark | what's the link of this ? |
| 01:43 | duncanm | http://www.tbray.org/ongoing/When/200x/2009/12/01/Clojure-Theses |
| 01:43 | cark | thanksµ |
| 01:43 | duncanm | hiredman: i wrote a comment, but he needs to moderate it before it shows up |
| 01:44 | hiredman | *shug* |
| 01:45 | duncanm | it's perhaps moot talking about this here, everyone here already bought into the sexpr syntax |
| 01:45 | hiredman | my ideas of what is readable seem to be out of whack with even #clojure |
| 01:45 | duncanm | hiredman: are you talking about syntax-things like different macros? |
| 01:45 | alexyk | the comment on prefix languages filling mind and stack ones not makes sense, I'm still grappling with S-exps |
| 01:45 | hiredman | I have no problem with partials and double parans |
| 01:46 | hiredman | ,(-> 5 range ((partial map inc))) |
| 01:46 | clojurebot | (1 2 3 4 5) |
| 01:46 | hiredman | that sor tof thing |
| 01:46 | duncanm | hiredman: yeah, so i find the -> syntax to be difficult too, cuz i never learned it |
| 01:46 | duncanm | hiredman: but most people are still talking at the (+ 1 1) level |
| 01:46 | alexyk | the question is, are you born homoiconic or you can become one by choice :) |
| 01:46 | duncanm | alexyk: that stack argument is silly too, just read from right to left |
| 01:47 | duncanm | well, from inside out |
| 01:47 | hiredman | alexyk: that is interesting |
| 01:47 | hiredman | I mean, far from hard to read I find it pleasing |
| 01:47 | alexyk | duncanm: exactly, I was thinking, reverse the damn thing and make it suffix |
| 01:47 | alexyk | I wonder what Hebrew and Arabic programmers think |
| 01:47 | hiredman | it tickles some aesthetic region in my brain |
| 01:47 | duncanm | alexyk: no no, the issue about 'memory' has to do with composition - if you use LET judiciously, there's no differece, right? |
| 01:48 | alexyk | since it already must look "suffix" to them |
| 01:48 | alexyk | duncanm: yeah, that's what I like about ocaml. let ... in let ... in let ... x |
| 01:48 | duncanm | alexyk: why can't you write that in Clojure? |
| 01:48 | alexyk | duncanm: I guess I can :) |
| 01:49 | alexyk | I'm just learning |
| 01:49 | alexyk | hiredman: so a partial is true curried? |
| 01:49 | hiredman | I have a parser written in fnparse somewhere that turns expressions like that into valid clojure |
| 01:49 | duncanm | you can write the same thing in clojure, it's just not done because it's not really necessary |
| 01:49 | hiredman | alexyk: just for a single application |
| 01:49 | cark | oh reading this i wonder where i can download the widefinder data |
| 01:50 | cark | i've been reading technomancy's solution on this blog |
| 01:50 | hiredman | cark: it's a big log |
| 01:50 | cark | and i don't underqstand why he use hashmaps |
| 01:50 | cark | right, but where is it? |
| 01:50 | cark | i tried to find it, but nope couldn't find it |
| 01:50 | alexyk | cark: twbray lurks here I believe |
| 01:50 | duncanm | cark: he prolly isn't keen on paying the bandwidth for people to download that log |
| 01:51 | duncanm | it's like 8GB? |
| 01:51 | hiredman | 40 |
| 01:51 | alexyk | I think it's on Tim's box, 45GB |
| 01:51 | alexyk | you have to look serious and he'll get you an account |
| 01:51 | duncanm | cark: and his experiment is only interesting if you have one of those heavy iron machines |
| 01:51 | cark | sure, but the widefinder thing, everybody talks about it, the data must be somewhere ! |
| 01:51 | twbray | cark: See http://wikis.sun.com/display/WideFinder/Infrastructure |
| 01:51 | twbray | Plus I'll send you a pointer to the 100K-line sample if you email me |
| 01:52 | duncanm | hey twbray |
| 01:53 | alexyk | hiredman: what's a "single application"? within a single statement? |
| 01:53 | duncanm | twbray: am i correct to say that you're not actually against TCO, you just like having the loop/recur syntax? cuz we can still keep that even with TCO... ;-) |
| 01:53 | cark | ah right there's no link, need to mail it |
| 01:53 | hiredman | alexyk: huh? |
| 01:53 | hiredman | oh right |
| 01:54 | hiredman | partial |
| 01:54 | alexyk | yeah |
| 01:54 | duncanm | clojurebot: (doc ->) |
| 01:54 | clojurebot | Excuse me? |
| 01:54 | duncanm | oh, how does that work again? |
| 01:54 | twbray | duncanm: TCO, when used as a way to enable iteration without busting the stack, seems misleading, compared to recur |
| 01:54 | duncanm | hiredman: i should learn to use -> |
| 01:55 | hiredman | (partial + 1) can be applied, but ((partiial + 1) 2) cannot |
| 01:55 | duncanm | twbray: huh? but the syntactic structure is the same |
| 01:55 | twbray | duncanm: But I'm in a minority there |
| 01:55 | cark | twbray : ref are not better or worst than agent, these are completely differen, also i don't understand "you can't have send inside a send" |
| 01:55 | cark | i do send inside a send quite a lot ! |
| 01:55 | duncanm | twbray: (loop [i 10] (if (zero? i) 'end (recur (dec i)))) that sorta counts down from 10 |
| 01:55 | duncanm | you like that |
| 01:55 | twbray | cark: Really? I was sure I got an error message on that |
| 01:56 | cark | really =) |
| 01:56 | duncanm | twbray: (let loop ((i 10)) (if (zero? i) 'end (loop (dec i)))) is the equivalent in Scheme, with TCO |
| 01:56 | alexyk | can recur be used in the tail of a defn calling itself in the last line, or only in a loop? |
| 01:56 | duncanm | alexyk: it works with defns too |
| 01:56 | twbray | alexyk: recur has to be in the tail position (compile checks) |
| 01:56 | alexyk | ok |
| 01:57 | alexyk | twbray: right, last line before calling itself :) |
| 01:57 | hiredman | something somewhere is eating my bandwidth |
| 01:57 | duncanm | twbray: so i still don't understand |
| 01:57 | alexyk | hiredman: aliens |
| 01:57 | twbray | alexyk: It's *not* calling itself, it's executing a GOTO and overwriting the "argument" variables |
| 01:58 | hiredman | "If during the function execution any other dispatches are made (directly or indirectly), they will be held until after the state of the Agent has been changed." |
| 01:58 | alexyk | twbray: right, that's what I meant. on the high level it's calling itself, in reality doing a goto. |
| 01:58 | cark | and even then , there is a function to dispatch right away |
| 01:58 | twbray | hiredman: Damn, wonder what it was I saw. I'm *sure* I saw an error message complaining about colliding sends or some such. |
| 01:59 | cark | ,(doc release-pending-sends) |
| 01:59 | clojurebot | "([]); Normally, actions sent directly or indirectly during another action are held until the action completes (changes the agent's state). This function can be used to dispatch any pending sent actions immediately. This has no impact on actions sent during a transaction, which are still held until commit. If no action is occurring, does nothing. Returns the number of actions dispatched." |
| 01:59 | twbray | On tail calls, I said my piece in http://www.tbray.org/ongoing/When/200x/2009/10/27/Recur and the commenters said LOTS more. |
| 01:59 | hiredman | I haven't used agents that much |
| 01:59 | alexyk | twbray: what's your feeling on Clojure vs Scala, in a few words? |
| 01:59 | hiredman | so I am not familiar with modes of failure/exceptions |
| 02:00 | duncanm | twbray: the only thing i wanna add (and perhaps someone said that already) is that loop/recur as a syntax is orthogonal to TCO |
| 02:00 | twbray | alexyk: Am now moving on to Scala. Seems to have too much syntax, but very friendly to Java programmers. |
| 02:00 | cark | twbray : the one thing you need to understand is that there is no opposition btween agents and refs, any non-trivial multi-threaded program will use both |
| 02:00 | _ato | twbray: I agree with you on (recur). I like it. I think it makes it more explicit what's going on, instead of the tail position being somehow magical. It makes it harder to break code relying on TCO when it's explicit |
| 02:01 | hiredman | clojurebot: tell me about scala |
| 02:01 | clojurebot | Unfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala |
| 02:01 | alexyk | twbray: I've done Scala first and now learn Clojure. I like both. :) |
| 02:01 | twbray | cark: My position is that if you can use agents you should because they're much easier to reason about. |
| 02:01 | duncanm | _ato: but the two things are not really related, what if there's TCO *and* recur? |
| 02:01 | cark | but they are orthogonal to refs |
| 02:01 | cark | see agents as a way to fire up a thread, and refs as a way to share data |
| 02:01 | twbray | cark: Yes, but there are lots of places where you could reasonably pick either. |
| 02:02 | cark | well i think you eventually learn when to use either one, their capabilities are very well advertised by ritch |
| 02:02 | cark | and limitations |
| 02:02 | twbray | cark: We know that people find it difficult to think about concurrency. Agents reduce the mental load substantially more. That's very important. |
| 02:03 | twbray | I thought my example showed that. |
| 02:03 | hiredman | cark: agents are not just a way to fire up a thread |
| 02:03 | hiredman | they are a reference type |
| 02:04 | twbray | hiredman is right; there's no guarantee that (send) fires up a thread. |
| 02:04 | _ato | duncanm: if the JVM supported real TCO (eg for mutual recursion) then it'd still be nice to make it explicit. I'm don't feel really strongly about it, I wouldn't complain if Clojure did implement magic TCO, it just seems safer to make it explicit |
| 02:04 | cark | hiredman : sure, they're not just data containers though |
| 02:04 | alexyk | twbray: I think without OO Java people are lost, but for data mining Clojure shines as it's concise. It's for all those business logics mumbo-jumbo you seem to need OO, account and such. And in Scala you can get a Java class directly, while in Clojure I may feel lost; also there's no material .class in the jars, I feel robbed! Overall it's refreshing, and you get more work done faster, IMHO. |
| 02:04 | duncanm | _ato: i can agree to that |
| 02:04 | hiredman | they are a way of giving identity to a set of states over time |
| 02:05 | duncanm | _ato: that's my point exactly - i can appreciate why people like the loop/recur syntax, but that has nothing to do with TCO |
| 02:05 | hiredman | grrr |
| 02:05 | alexyk | twbray: my current grasp is that Clojure is the ML of Java, while Scala is Haskell of it. Or something like that. |
| 02:05 | cark | right, but you need to keep simplified view in your head to think easily, let me tickle you some more, hiredman : a transaction is just a lock |
| 02:05 | hiredman | *snort* |
| 02:05 | twbray | duncanm: If you have recur and trampoline, the number of cases where TCO is really necessary/useful falls to a level that's not interesting. |
| 02:06 | _ato | heh, Scala is the C++ to Java's C |
| 02:06 | _ato | add every feature you could possibly think of |
| 02:06 | alexyk | _ato: I'd say Ada even |
| 02:06 | hiredman | chouser did a nice diagram break down of the reference types |
| 02:06 | twbray | Right, Scala seems very big |
| 02:06 | hiredman | everyting is big next to a lisp |
| 02:06 | twbray | hiredman: Erlang isn't. |
| 02:07 | _ato | it's an interesting language, in the sense it's interesting to try playing with a whole bunch of different ideas, but I wouldn't want to use it for a real project |
| 02:07 | duncanm | twbray: i always thought the resistence to TCO has to do with the change in style: the structure of loop/recur is very different from for/while loops, learning to do that took me some time |
| 02:07 | hiredman | fine! everything except prolog |
| 02:07 | _ato | for the same reason I don't like using C++ for real projects, there's just too much you have to know |
| 02:07 | duncanm | twbray: and that's why i find it so strange that there are people like you, who are comfortable with loop/recur, and still resist TCO |
| 02:07 | twbray | _ato: They're rebuilding the Twitter back-end largely in Scala |
| 02:07 | alexyk | twbray: not really once you dig into it. My current feeling is Clojure and Scala are about the same core size in spirit. You use the sane few things most of the times, FP-wise, plus you get your objects and generics in Scala. |
| 02:07 | alexyk | same, not sane |
| 02:07 | alexyk | :) |
| 02:08 | alexyk | some Scala things are insane, namely implicits |
| 02:08 | _ato | yeah, it's probably fine if you do the same thing many C++ shops do and select a subset of the language that you'll agree to use |
| 02:09 | hiredman | http://clojure.googlegroups.com/web/clojure-conc.png?gda=IlegQ0IAAAB9TgGpbzbMg0BCq3i8IqXn0WHwACj5HnNv70z9VRAgAqHYMl6i8-XQPbzBSKhW_SJV4u3aa4iAIyYQIqbG9naPgh6o8ccLBvP6Chud5KMzIQ |
| 02:09 | twbray | duncanm: recur is simply a direct syntactic expression of what TCO actually does. I think the structure of programs should express their run-time semantics as directly as possible. |
| 02:10 | cark | hiredman: that's a very important diagram, but only tells half the story |
| 02:10 | hiredman | twbray: very understandable as you abstracted farther and farther away from the machine |
| 02:10 | duncanm | twbray: heh, by now we're entering a full-on discussion, so let's not do that - all i wanted to say is, loop/recur is not incompatible with TCO |
| 02:10 | twbray | duncanm: agree |
| 02:11 | hiredman | cark: it is, each reference type associates a series of values/states with an identity |
| 02:11 | duncanm | twbray: (one more little thing), do you think it's a *good thing* that the stack blows up if you write tailcalls in a non-TCO language? |
| 02:11 | hiredman | and each one has semantics for moving from one value to the next |
| 02:11 | hiredman | that diagram describes them |
| 02:12 | twbray | duncanm: Never really thought about it that much. I've done enough OS/compile work to be unsurprised when recursive algorithms fail to work for iterating over large datasets :) |
| 02:13 | twbray | I love recur because it feels like the natural idiom for iterating in an immutable-data environment. |
| 02:13 | _ato | duncanm: do you mean as opposed to something like stackless python where you can keep growing the "stack" until you run out of memory? |
| 02:14 | duncanm | _ato: i dunno how stackless python works |
| 02:14 | _ato | stackless python just allocates the stack on the heap |
| 02:14 | hiredman | people seem to want to use agents as a papered over executor, but they provide more than that |
| 02:14 | _ato | so it can grow |
| 02:14 | _ato | as large as it wants |
| 02:14 | duncanm | my understanding is that Scheme added TCO because they don't want to have any explicit loop constructs in the language |
| 02:15 | duncanm | so they have TCO, and you have to 're-learn' your loops because you need to phrase it as a tailcall |
| 02:15 | cark | hiredman : still i'd put ref not too far away from atoms, the agents waaaaay over there on the other side |
| 02:15 | twbray | duncanm: Same story with Erlang. All looping via tail calls. |
| 02:15 | duncanm | with loop/recur, you've already *learned* how to phrase a loop as a tailcall, you just name it differently |
| 02:15 | duncanm | twbray: so there you go! |
| 02:16 | twbray | duncanm: you name it *accurately* :) |
| 02:16 | hiredman | cark: deck chairs on the titanic |
| 02:16 | duncanm | twbray: okay, i can agree to that too |
| 02:16 | duncanm | twbray: we can have a TCO language *with* loop/recur as a syntax, |
| 02:17 | duncanm | wouldn't that make everyone happy? (except those who haven't learned to phrase loops as tailcalls, yet) |
| 02:17 | _ato | hiredman, cark: so what fits in the "X"? refs in a future? ;-) |
| 02:17 | twbray | Feels a little more natural in Erlang because everything is a process and you're usually sitting there processing a message and calling yourself to receive the next one. The name of the procedure is usually something like foo_loop. |
| 02:18 | duncanm | twbray: and that's *exactly* what Scheme does |
| 02:18 | hiredman | _ato: the X indicates unfilled :P |
| 02:18 | cark | how could we have a coordinated asynchronous thing ? |
| 02:19 | hiredman | I am still hoping someday to get someone in #java to turn in a trampoline of Callables as a solution to a recursive homework problem |
| 02:19 | cark | maybe using an agent to run a transaction =P |
| 02:19 | _ato | maybe coordinated asynchronous means "eventually consistent" |
| 02:20 | duncanm | hiredman: heh, depends on which school they go to, they could get extra points at some places for doing that ;-) |
| 02:20 | hiredman | sure |
| 02:22 | duncanm | syntax-wise, i find languages like Scala and Haskell to be a lot more difficult than Clojure/Lisp |
| 02:22 | hiredman | Haskell at least has the λ calculus going for it |
| 02:22 | duncanm | hiredman: that points-free style has me scratching my head every single time |
| 02:23 | duncanm | hiredman: but you like partials, so maybe you're good with things like that ;-P |
| 02:23 | _ato | yeah, I agree. Haskell's pattern matching stuff is pretty readable, but I'm not a fan of the function compoisition and currying |
| 02:23 | hiredman | :O |
| 02:23 | cark | feels like forth |
| 02:24 | hiredman | all is function composition |
| 02:24 | hiredman | the rest is smoke and mirrors |
| 02:24 | duncanm | _ato: i've been trying to learn more about pattern matching, i suppose it gets to be really handy when coupled with a type system |
| 02:24 | hiredman | I wrote an interpreter for a stack language in sh a few months ago |
| 02:25 | duncanm | _ato: i know PLT Scheme has a pretty involved MATCH macro, someone could probably port it to Clojure |
| 02:25 | hiredman | (turns out you can fake linked lists in sh) |
| 02:25 | hiredman | clojure has at least two match macros already |
| 02:25 | _ato | duncanm: well normal Haskell style using recursion a lot where Clojure uses higher-level functions |
| 02:25 | hiredman | one in contrib |
| 02:25 | alexyk | twbray: did you look at OCaml? it dominated WF until the C++ monstrosity! |
| 02:26 | _ato | that's where Haskell's pattern matching is pretty nice. It's also used for multi-methods |
| 02:26 | _ato | but Clojure's destructuring gets you 80% of the way there anyway |
| 02:26 | duncanm | _ato: i was gonna mention destructuring precisely |
| 02:26 | hiredman | I could never keep interested in haskell, I started looking at it after clojure |
| 02:26 | twbray | alexyk: I'm looking for something with a more mainstream smell, that buys you a concurrency win with a moderate amount of code that's comprehensible by mere mortals. |
| 02:27 | duncanm | twbray: i feel like clojure's popularity now cuz mean that lisp could enter the mainstream |
| 02:27 | duncanm | s/cuz/could/ |
| 02:27 | alexyk | twbray: then Clojure, Scala, or F#. *# you hate, so the race is on! :) |
| 02:27 | cark | duncann: wew that's still a long shot |
| 02:27 | duncanm | i guess java started the first step with GCs, and then Ruby got people comfortable with blocks |
| 02:28 | wavis | duncanm: have you looked at Scala? It has really good pattern matching. |
| 02:28 | twbray | alexyk, duncanm: Don't count Erlang out. |
| 02:28 | wavis | The one thing I miss in clojure, actually. but not much. |
| 02:28 | hiredman | fyi, #scala is different from #clojure |
| 02:28 | duncanm | twbray: i find erlang to be a lot more esoteric than clojure (but i know scheme ;-) |
| 02:28 | alexyk | twbray: you called the strings putrid, not us :) |
| 02:29 | alexyk | hiredman: don't peg it too narrowly, we're all in JVM after all |
| 02:29 | hiredman | alexyk: I just said "different" |
| 02:29 | _ato | heh, yeah. Someone at work the other day was complaining about the closures being added to JDK 7 as complicated. I don't think he realised that the Ruby blocks he was so fond of were just closures wearing a different shirt |
| 02:29 | duncanm | i'm surprised that the DSL crowd hasn't embraced lisp macros more |
| 02:29 | cark | let there be love between jvm brothers =) |
| 02:29 | duncanm | _ato: that's so funny |
| 02:29 | twbray | _ato: Difference is, Ruby blocks aren't bolted onto a widely-deployed 15-year-old design. |
| 02:30 | duncanm | twbray: explain? |
| 02:30 | duncanm | oh oh, java |
| 02:30 | duncanm | twbray: ahh. C# shows that there's a way to go forward |
| 02:30 | _ato | twbray: yeah that is true, but Java already fudges it all over the place with Runnables and such anyway |
| 02:30 | _ato | just less ceremony |
| 02:30 | twbray | Ruby is built from the ground up around the notion of blocks, your typical Rails coal-miner has no idea what a closure is. |
| 02:31 | duncanm | i wrote matz a few years ago asking him the difference between blocks and Procs |
| 02:31 | twbray | duncanm: What "return" does. |
| 02:31 | duncanm | he was very nice and wrote back saying that if he were smarter earlier, he'd just have procs |
| 02:31 | duncanm | twbray: as a smalltalker, i think it's silly that you can't pass 2 lambdas (blocks/procs/whatever) to ruby methods |
| 02:32 | twbray | If you're in the java ecosystem and you want closures, use JRuby or Clojure or Scala. Don't try to bolt them on the side of the java language. |
| 02:32 | twbray | duncanm: In theory, I agree with you. In practice, the single-block idiom hits this huge 80/20 sweet spot and is so easy to understand. |
| 02:32 | hiredman | http://www.oreillynet.com/ruby/blog/2007/10/fun_with_unicode_1.html <-- I always thought the λ alias was cute |
| 02:33 | duncanm | twbray: it's the TCO discussion all over again, i don't understand what *good* the restriction brings to the table |
| 02:33 | twbray | Readability, clarity |
| 02:34 | duncanm | you think having a comma after the } makes it not readable? |
| 02:34 | duncanm | do_something ({|x| x}, {|y| y}) two blocks |
| 02:34 | duncanm | i dunno, i'm not really good with ruby |
| 02:35 | duncanm | i lost interest once i found out i can't pass more than one block ;-) |
| 02:35 | twbray | I think Ruby has a bunch of small design choices that in aggregate make it tremendously seductive to a large number of programmers, more so than many languages that may actually have more flexibility and generality. |
| 02:35 | twbray | Fortunately, Ruby has probably enough flexibility and generality |
| 02:35 | alexyk | twbray: yeah, Ruby is a Hello Kitty of languages |
| 02:35 | duncanm | oh man, not to brag, but my favorite bug of all time is in Ruby 1.8 |
| 02:35 | tomoj | I guess you can do do_something(->{|x| x}, ->{|y| y}) now? |
| 02:36 | twbray | "Why Ruby Is An Acceptable Lisp" http://www.randomhacks.net/articles/2005/12/03/why-ruby-is-an-acceptable-lisp |
| 02:36 | hiredman | ruby doesn't have s-expressions :( |
| 02:37 | tomoj | hear, hear |
| 02:37 | alexyk | can you have a lisp reader for ruby syntax? |
| 02:37 | duncanm | tomoj: how do i write (lambda (x) x) in Ruby? |
| 02:37 | duncanm | alexyk: if you write one |
| 02:37 | twbray | alexyk: Ruby syntax is actually very complex |
| 02:38 | duncanm | alexyk: i was thinking of doing it the other day, we can use the duby stuff from headius |
| 02:38 | duncanm | it's not quite real ruby, but it could be interesting |
| 02:38 | _ato | I guess it's one of those mainstreamness thing. People think closures, S-expressions and macros are "weird", so they go to something that feels "simpler" on the surface, but is not really |
| 02:38 | tomoj | duncanm: well, used to be lambda {|x| x} |
| 02:38 | duncanm | ahh |
| 02:38 | tomoj | now I believe you can do -> {|x| x} |
| 02:39 | duncanm | okay, i got it, here's my magic trick in Ruby 1.8 |
| 02:39 | duncanm | irb(main):001:0> x = 5 => 5 |
| 02:39 | twbray | duncanm: I think duby is very interesting. |
| 02:39 | duncanm | irb(main):004:0> lambda {|x| x}.call(10) |
| 02:39 | duncanm | what's the value of 'x' now? |
| 02:40 | duncanm | irb(main):005:0> x |
| 02:40 | duncanm | => 10 |
| 02:40 | duncanm | tada! |
| 02:40 | duncanm | sadly (fortunately?) they fixed that in ruby 1.9 |
| 02:40 | hiredman | I think headius mentioned refs in duby |
| 02:41 | duncanm | no one finds my magic trick cool? |
| 02:41 | hiredman | 2009:Nov:10:12:49:01 headius : rhickey: btw, I want to try writing a plugin for Duby that adds first-class lang support for clojure refs, collections, and stm |
| 02:41 | hiredman | duncanm: I am very impressed |
| 02:42 | duncanm | hiredman: thanks ;-P |
| 02:42 | hiredman | 20 days ago, so he should be done... |
| 02:42 | _ato | duncanm: I'm afraid I had seen that trick before, but it is nonetheless impressive |
| 02:42 | duncanm | oh, the body of the lambda could be anything, btw |
| 02:44 | tomoj | hmm |
| 02:44 | tomoj | thinking about it now that seems horribly bad to me |
| 02:44 | duncanm | _ato: my other favorite is how loop variables in python remain in scope even outside of the loop |
| 02:44 | tomoj | but I don't remember ever having a problem with it when I coded ruby |
| 02:45 | duncanm | tomoj: the trick is, you wouldn't know if you did! ;-) |
| 02:46 | _ato | duncanm: yeah the python one is not so bad though. it's just got a different scoping model |
| 02:46 | tomoj | duncanm: well, hopefully if it caused a bug, I would have noticed |
| 02:46 | duncanm | _ato: true |
| 02:47 | alexyk | how do you do integral division? |
| 02:47 | tomoj | though I guess I never worked on any ruby projects of any significant size... going in tomorrow to take a first look at the large 0% test coverage codebase I'll be working with :( |
| 02:48 | twbray | ,(quot 10 3) |
| 02:48 | clojurebot | 3 |
| 02:48 | twbray | akexyk: there |
| 02:48 | alexyk | thx! and how is mod different from rem? |
| 02:48 | tomoj | I vaguely remember that (quot x y) is much faster than (int (/ x y)) |
| 02:49 | _ato | ,(mod -1 3) |
| 02:49 | clojurebot | 2 |
| 02:49 | _ato | ,(rem -1 3) |
| 02:49 | clojurebot | -1 |
| 02:49 | alexyk | ah, for negatives |
| 02:49 | duncanm | ,(doc ->) |
| 02:49 | clojurebot | "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc." |
| 02:50 | hiredman | ->> is neat too |
| 02:50 | tomoj | hiredman: you really like them arrows, eh? |
| 02:50 | duncanm | i need some examples and a macro-expander ;-) |
| 02:50 | tomoj | huh, what do we need EBNF for? |
| 02:51 | tomoj | there is barely any syntax at all |
| 02:51 | hiredman | :( |
| 02:51 | duncanm | so let's see |
| 02:51 | hiredman | and who can read an EBNF form |
| 02:51 | esj | syntax ? (func & args) :) |
| 02:51 | duncanm | (-> 5 range ((partial map inc))) |
| 02:51 | duncanm | let's take out the partial first.... |
| 02:51 | hiredman | ,(macroexpand-1 '(-> 1 inc inc)) |
| 02:51 | clojurebot | (clojure.core/-> (clojure.core/-> 1 inc) inc) |
| 02:52 | alexyk | _ato: so there's no update-in! for transient maps? |
| 02:52 | hiredman | ,(macroexpand-1 '(clojure.core/-> 1 inc)) |
| 02:52 | clojurebot | (inc 1) |
| 02:52 | duncanm | hiredman: so (-> x foo bar baz) is (baz (bar (foo x))) |
| 02:52 | hiredman | yes |
| 02:52 | duncanm | okay |
| 02:52 | _ato | alexyk: no, seemingly not. :( have to roll your own. |
| 02:52 | duncanm | it feels a little bit like that (.. x) syntax, okay.... |
| 02:53 | duncanm | i'll have to see if i can rewrite some of my code to do that |
| 02:53 | duncanm | to use that |
| 02:53 | hiredman | (-> x foo (bar baz)) is (bar (foo x) baz) |
| 02:53 | alexyk | _ato: I'm too new to clojure, not to mention transients. |
| 02:53 | duncanm | hiredman: aha, again kinda similar to the dot syntax |
| 02:53 | hiredman | duncanm: -> seems to be recommended as more general than .. |
| 02:53 | _ato | alexyk: well I guess it's because update-in is for nested datastructures and it'd be uncommon to have nested transients |
| 02:54 | duncanm | hiredman: can i use -> in place of the dot syntax? |
| 02:54 | hiredman | dot syntax? |
| 02:54 | vy | For instance, if you'd need to understand what "require" does, first you'll need to read "require" from API, and because of it doesn't say anything useful and points to you "ns", you then continue with reading "ns" API reference. After reading the whole page for 3-4 times, you still don't understand what "ns" does and why you are here while just looking for a simple "require" problem, you feel inclined to press Alt+Tab. |
| 02:54 | _ato | actually, this is a total hack but: (binding [assoc assoc!] (update-in ...)) would probably work :p |
| 02:54 | tomoj | vy: sure, examples would be nice |
| 02:54 | hiredman | _ato: cute |
| 02:54 | duncanm | hiredman: . and .. |
| 02:54 | hiredman | ,(-> "foo" .toUpperCase) |
| 02:55 | clojurebot | "FOO" |
| 02:55 | duncanm | oh! |
| 02:55 | duncanm | interesting |
| 02:55 | alexyk | _ato: thanks! feels right. will try to place that around my nested map after it finishes plain run |
| 02:55 | duncanm | ,(-> "foo" count) |
| 02:55 | clojurebot | 3 |
| 02:55 | duncanm | oh neat |
| 02:55 | tomoj | feels right? |
| 02:55 | hiredman | duncanm: because it just expands to (x y) |
| 02:55 | hiredman | (.toUpperCase "foo") |
| 02:55 | alexyk | tomoj: gotta go by gut for now :) |
| 02:55 | hiredman | it's just a game with symbols |
| 02:55 | duncanm | (-> "foo" .toUpperCase count) |
| 02:55 | duncanm | ,(-> "foo" .toUpperCase count) |
| 02:55 | clojurebot | 3 |
| 02:56 | hiredman | clojurebot: macros? |
| 02:56 | clojurebot | Holy Crap. |
| 02:56 | duncanm | ha, it's awesome that i can mix methods and functions |
| 02:56 | hiredman | clojurebot: macro |are| just a game with symbols |
| 02:56 | clojurebot | c'est bon! |
| 02:56 | duncanm | hiredman: so now i get why this is useful, there are times when i was looking for precisely this macro |
| 02:56 | hiredman | nuts |
| 02:56 | hiredman | clojurebot: forget macro |are| just a game with symbols |
| 02:56 | clojurebot | I forgot macro |are| just a game with symbols |
| 02:56 | hiredman | clojurebot: macros |are| just a game with symbols |
| 02:56 | clojurebot | Ok. |
| 02:57 | duncanm | hiredman: and what's ->> ? |
| 02:57 | hiredman | it drops the arg in the last place instead of the first |
| 02:57 | hiredman | ,(->> range 5 (map inc)) |
| 02:57 | clojurebot | java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn |
| 02:57 | hiredman | er |
| 02:57 | hiredman | ,(->> 5 range (map inc)) |
| 02:57 | clojurebot | (1 2 3 4 5) |
| 02:58 | hiredman | (-> (range 5) (map inc)) => (map inc (range 5)) |
| 02:58 | hiredman | er |
| 02:58 | hiredman | ->> |
| 02:58 | duncanm | hiredman: can we do the same exercise again? (->> x foo bar baz) -> ? |
| 02:59 | hiredman | duncanm: for single arg functions there is no difference |
| 02:59 | duncanm | ah so |
| 02:59 | hiredman | ,(macroexpand-1 '(-> a (b c))) |
| 02:59 | clojurebot | (b a c) |
| 02:59 | hiredman | ,(macroexpand-1 '(->> a (b c))) |
| 02:59 | clojurebot | (b c a) |
| 02:59 | duncanm | okay! |
| 03:00 | duncanm | hiredman: man, this is getting close to 'flip' in Haskell ;-) |
| 03:00 | hiredman | :P |
| 03:00 | hiredman | I asked rich about adding flip |
| 03:00 | duncanm | haha |
| 03:00 | _ato | ->> is often useful for seq as things like map and reduce and filter have the seq in the last position |
| 03:00 | hiredman | he asked me when I ever needed it and I had to admit, I only ever used it for golfing |
| 03:01 | _ato | -> is often useful for colls and java objects, as conj, assoc etc take the coll as the first argument |
| 03:01 | hiredman | ->, ->>, doto, partial, and juxt |
| 03:01 | hiredman | and comp |
| 03:02 | duncanm | these are all macros, right? or are comp/partial/juxt functions? |
| 03:02 | _ato | those three are just functions |
| 03:02 | defn | -> is the only macro |
| 03:02 | defn | ->> rather |
| 03:03 | duncanm | overusing -> and ->> kinda leads to writing a 'new' language, cuz you're introducing new syntax for something really fundemental |
| 03:03 | hiredman | ,(-> 321 Integer/toString ((partial repeat 2)) ((juxt first (comp reverse second))) ((partial apply concat))) |
| 03:03 | clojurebot | (\3 \2 \1 \1 \2 \3) |
| 03:03 | defn | i feel like -> and ->> are sort of bastardizations |
| 03:03 | defn | they're novel |
| 03:04 | _ato | -> is just like foo().bar().baz().boom() in java |
| 03:04 | hiredman | they are takes on the thrush combinator |
| 03:04 | defn | ^ |
| 03:04 | defn | see the homoiconic blog |
| 03:04 | defn | http://github.com/raganwald/homoiconic/blob/master/2008-10-30/thrush.markdown |
| 03:04 | duncanm | _ato: now that i've learned about ->, i can see that .. is kinda redundent |
| 03:04 | defn | .. came after -> IIRC |
| 03:04 | hiredman | they happen to be macros, which is nice, because you can then use .Methods |
| 03:05 | hiredman | defn: are you sure? |
| 03:05 | duncanm | _ato: -> is like a super .., that allows for both methods and functions |
| 03:05 | defn | hiredman: someone told me that once, no proof... |
| 03:05 | _ato | yeah |
| 03:05 | duncanm | _ato: are you on twitter? |
| 03:05 | _ato | I never use .. |
| 03:06 | _ato | @atosborne, but I don't post very often |
| 03:06 | defn | I prefer the -> to .. I suppose |
| 03:06 | defn | but I think it's a matter of taste |
| 03:06 | duncanm | yeah, i use .. quite often, but now that i know ->, i'm definitely switching over |
| 03:06 | hiredman | I use -> at the repl all the time, so my code tends to have a lot of it |
| 03:06 | duncanm | deep inside, hiredman is a haskeller ;-) |
| 03:06 | defn | (.. ) seems more clojure-esque |
| 03:06 | duncanm | next he'll be asking for (1 `+` 1) |
| 03:06 | duncanm | ;-) |
| 03:06 | defn | but again, sort of a style choice |
| 03:07 | hiredman | (-> xml-source keep throwing functions at it until I get what I want) |
| 03:07 | defn | *nod* |
| 03:07 | duncanm | i'd say we should just rename -> to be .. |
| 03:07 | duncanm | or is it ->> ? |
| 03:07 | defn | they behave almost identically |
| 03:07 | defn | i believe |
| 03:07 | duncanm | right |
| 03:08 | hiredman | http://gist.github.com/184831 |
| 03:08 | duncanm | hiredman: heh |
| 03:08 | tomoj | hiredman: is that readable to you? |
| 03:08 | _ato | O.o |
| 03:08 | hiredman | vertical like that, sure |
| 03:08 | defn | -> seems more appropriate for clojure (stuff), whereas (.. ) seems more appropriate for java stuff |
| 03:09 | defn | is that fair? |
| 03:09 | duncanm | defn: but that's arbitrary |
| 03:09 | defn | no, it'd idiomatic |
| 03:09 | defn | it's* |
| 03:09 | tomoj | I can see what it does basically, but it doesn't look good to me :) |
| 03:09 | duncanm | hiredman: would it help if you did a let and named (partial map :content) and (partial map first) ? |
| 03:09 | hiredman | ~ticket search keywords |
| 03:09 | clojurebot | ("#154: (keyword \"a/b\") => ns nil, name a/b; should be ns a, name b" "#154: (keyword \"a/b\") => ns nil, name a/b; should be ns a, name b" "#154: (keyword \"a/b\") => ns nil, name a/b; should be ns a, name b" "#64: GC Issue 61: \t Make Clojure datatype Java Serializable" "#174: Make c.l.Keyword Serializable" "#174: Make c.l.Keyword Serializable" "#6: GC Issue 1:\t:validator as keyword arg for ref/atom/agent" "#122: GC I |
| 03:09 | _ato | the ((partial ...)) stuff is just to get the functionality of ->> but inside -> right? |
| 03:09 | tomoj | flipping out the arrow would make it much worse I suspect, though |
| 03:10 | hiredman | _ato: more or less |
| 03:10 | defn | ,(doc ->>) |
| 03:10 | clojurebot | "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc." |
| 03:10 | tomoj | but the problem is, I guess, that you want to mix -> and ->> style together |
| 03:10 | hiredman | tomoj: turning into a point free function would get rid of a lot of the parens |
| 03:10 | duncanm | defn: i don't see why there needs to be such a strong line to distinguish function calls and method calls |
| 03:10 | _ato | heh, doing that never occurred to me, interesting, but it looks kind of crazy :D |
| 03:10 | defn | duncanm: im not drawing one |
| 03:11 | defn | i just think they sort of belong to separate tasks |
| 03:11 | duncanm | defn: you're saying .. for methods and -> for functions, pretty much |
| 03:11 | hiredman | ,(-> 5 range (->> (map inc))) |
| 03:11 | clojurebot | (1 2 3 4 5) |
| 03:11 | defn | *sort of* |
| 03:11 | defn | duncanm: it's a matter of taste |
| 03:11 | defn | i dont think you should do it any which way |
| 03:11 | defn | but for me i like to sort of discriminate on that criteria yes |
| 03:12 | defn | it seems useful to me |
| 03:12 | _ato | I'd probaby favour (-> foo bar (->> (map :content)) blah) |
| 03:12 | duncanm | defn: for me, simply having .foo is enough |
| 03:12 | defn | duncanm: fair enough |
| 03:12 | hiredman | I like point free using comp, but -> just flows better at the repl |
| 03:12 | duncanm | defn: in fact, i wish i could write (map .toUpperCase ["foo" "bar"]) instead of #(.toUpperCase %) |
| 03:12 | hiredman | and I end up just pasting that code over |
| 03:12 | defn | i like the #() |
| 03:13 | defn | I find that very easy to understand and use |
| 03:13 | duncanm | defn: oh, i like it too, for writing quick little things |
| 03:13 | duncanm | but i think one reason why it's useful is for times like what i had above |
| 03:13 | defn | i like it for everything -- again, it makes sense to me |
| 03:13 | duncanm | defn: there are times when it's useful to name the argument |
| 03:13 | defn | duncanm: we all have a lot of choices to make |
| 03:14 | defn | duncanm: there are many you can make in clojure |
| 03:14 | defn | duncanm: i think we're arguing semantics |
| 03:14 | duncanm | defn: and i say let's remove the extraneous ones ;-) |
| 03:14 | duncanm | i'm not arguing ;-P |
| 03:14 | duncanm | i *just* learned -> not 5 mins ago |
| 03:14 | hiredman | ,(pl (map λx (.toUpperCase x) ["foo" "bar"])) |
| 03:14 | clojurebot | ("FOO" "BAR") |
| 03:14 | duncanm | hiredman: what's pl? |
| 03:15 | hiredman | a little macro I wrote |
| 03:15 | defn | duncanm: i am for the happy medium between duplicate functionality and bare functionality |
| 03:15 | defn | expressivity is important |
| 03:15 | hiredman | (pl stands for pointless) |
| 03:15 | duncanm | heh |
| 03:15 | duncanm | maybe i should spend some time and learn this point-free style |
| 03:16 | duncanm | i suppose it's like learning to write loops in loop/recur/tco compared to for/while |
| 03:16 | hiredman | ,(pl (↕map ["foo" "bar"] λx (.toUpperCase x))) |
| 03:16 | clojurebot | ("FOO" "BAR") |
| 03:16 | defn | hiredman: did you just map UTF-8 lambda x across... |
| 03:16 | duncanm | once you know it, it's very evident |
| 03:16 | defn | wtf |
| 03:16 | duncanm | defn: it's a macro |
| 03:16 | defn | that's crazy |
| 03:16 | defn | and awesome |
| 03:16 | hiredman | it does a lot of rewriting |
| 03:16 | _ato | and pointless :p |
| 03:16 | defn | still novel and awesome |
| 03:16 | defn | :) |
| 03:17 | hiredman | http://github.com/hiredman/odds-and-ends/blob/master/functional.clj |
| 03:17 | _ato | hehe |
| 03:18 | hiredman | ~macros |
| 03:18 | clojurebot | Holy Crap. |
| 03:18 | hiredman | :| |
| 03:18 | tomoj | what is that assert crap |
| 03:18 | hiredman | ~macros |
| 03:18 | clojurebot | macros are just a game with symbols |
| 03:18 | duncanm | http://calculist.blogspot.com/2008/03/when-to-use-point-free-style.html - a guy from school wrote this |
| 03:18 | hiredman | tomoj: tests of the macro expansion |
| 03:19 | duncanm | "The reason why pointful style can be so helpful is it allows us to think about the definition of a computation in terms of particular examples." |
| 03:19 | duncanm | i really agree with that |
| 03:19 | hiredman | is the expanded form equal to some other form |
| 03:19 | tomoj | hiredman: yes, but, did you write your own test framework? |
| 03:20 | hiredman | ,(doc assert) |
| 03:20 | clojurebot | "([x]); Evaluates expr and throws an exception if it does not evaluate to logical true." |
| 03:20 | tomoj | oh :) |
| 03:20 | hiredman | I'm generally not much of a tester, but pl is rather brittle |
| 03:21 | hiredman | *very* brittle after I added the λ |
| 03:22 | duncanm | oh man |
| 03:22 | duncanm | hiredman: you know this stuff, right? |
| 03:22 | duncanm | 4.1 The owl |
| 03:22 | duncanm | ((.)$(.)) |
| 03:22 | duncanm | The owl has type (a -> b -> c) -> a -> (a1 -> b) -> a1 -> |
| 03:22 | duncanm | c, and in pointful style can be written as f a b c d = a b |
| 03:22 | duncanm | (c d). |
| 03:22 | hiredman | nope |
| 03:22 | duncanm | http://www.haskell.org/haskellwiki/Pointfree |
| 03:22 | hiredman | didn't get far enough into haskell |
| 03:23 | duncanm | ((.)$(.)) they should call this the boobies-and-bling-bling combinator ;-P |
| 03:24 | hiredman | that is some type signature though |
| 03:24 | hiredman | huh |
| 03:25 | hiredman | I don't think those signatures match (the pointful definition, and the signature), but I am no haskeller |
| 03:26 | _ato | oh no, don't show hiredman that, he'll get ideas about how to make his code even more impenetrable to the mere mortal! |
| 03:26 | hiredman | haskell type signatures interest me the most about haskell |
| 03:26 | _ato | ;-) |
| 03:26 | duncanm | hiredman: at my school, there was a research project to do Typed Scheme |
| 03:26 | duncanm | hiredman: it lets you write scheme code, and then using a macro, add haskell-like type-signatures |
| 03:26 | hiredman | clojurebot: deft? |
| 03:27 | clojurebot | deft is http://gist.github.com/128259 |
| 03:27 | duncanm | (: add1: Integer -> Integer) (define (add1 x) (+ x 1)) -- something like that |
| 03:28 | hiredman | I gut fustrated chasing a null pointer exception and wrote deft |
| 03:28 | hiredman | got |
| 03:28 | hiredman | duncanm: yeah, I've seen a blog post or two |
| 03:28 | duncanm | heh |
| 03:29 | duncanm | okay, bed time |
| 03:29 | hiredman | clojure would be like #^([Integer] Integer) (defn add1 [x] (+ x 1)) |
| 03:29 | hiredman | or something |
| 03:30 | hiredman | nice that #^ associates with the next form |
| 03:31 | alexyk | how do you :use clojure.contrib.str-utils2 :as s2 in (ns ...)? |
| 03:32 | hiredman | (ns foo.bar (:require [clojure.contrib.str-utils2 :as s2])) |
| 03:32 | alexyk | ah |
| 03:54 | _ato | networks are funny. I can only download from gitorius directly at 7 kb/s. If I proxy through a machine in the US then I can download at 500kb/s |
| 05:05 | cgrand | alexyk: update-in! is ambiguous: do you want only the root map to be transient, the child maps too, or to transientize the child maps as needed (and then you have to do some bookkeeping or to traverse the whole datastructure to call persistent! on each nested transient) |
| 05:05 | cgrand | damn, I'm too slow :-( |
| 05:11 | thehcdreamer | Is there a date library in clojure-contrib or somewhere else? |
| 05:18 | markgunnels | thehcdreamer: Not that I have seen. For all of my stuff, I use joda-time with some wrappers to make it clojuresque. |
| 05:19 | markgunnels | I'd share but my mf'in git server is down. |
| 05:33 | thehcdreamer | markgunnels: thanks. I want to do things like (date/sum [date1] [date2]) or (date/since [date]) |
| 05:33 | thehcdreamer | but I could write my own easily |
| 05:34 | esj | i've just started using Joda-time myself, and I think it could be what you what |
| 05:35 | esj | it has concepts of periods and intervals |
| 05:35 | esj | and is not nearly as capricious as Java Date. |
| 06:42 | tomoj | I think the probability that I'll achieve nirvana while watching a talk by a language's lead developer is directly proportional to my love for that language |
| 07:35 | adityo | ~max people |
| 07:35 | clojurebot | max people is 218 |
| 07:35 | adityo | awesome |
| 07:40 | _ato | speaking of which the mailing list is getting close to 3000 |
| 07:43 | powr-toc | is it possible to configure leiningen to use local dependencies? |
| 07:44 | powr-toc | i.e. jars inside a local lib/ directory that are proprietary and not contained within a repo? |
| 07:45 | liebke | _ato: you're just who I was looking for. Clojars is throwing an sql error when I try to add a new member to the incanter group. Have you seen this before? |
| 07:46 | _ato | powr-toc: install them to your local maven repository (for lein projects: "lein install") |
| 07:47 | _ato | that'll put them in ~/.m2 |
| 07:47 | powr-toc | _ato: I'm not too familiar with maven... Does that require setting up some kind of server? |
| 07:48 | _ato | powr-toc: no. the local repository is ~/.m2/repository. Leiningen uses it to cache all the jars it downloads |
| 07:48 | _ato | liebke: oh dear |
| 07:48 | duncanm | _ato: what time zone are you in? do you ever sleep? |
| 07:49 | liebke | _ato: the error message is: java.lang.Exception: transaction rolled back: column name is not unique |
| 07:49 | _ato | duncanm: Australian Eastern Standard Time (GMT+1100). I occasionally sleep. :-) |
| 07:50 | powr-toc | ok... so by install into ~/.m2/repository, do you mean I just need to copy the jar file in there, or do I need to do something special for the associated meta-data etc? It's a 3rd party plain old java jar. |
| 07:50 | duncanm | _ato: ahh, pretty much the opposite of where i am |
| 07:52 | _ato | liebke: err oops. I put "unique" on the group name column. That was stupid. I'll fix it |
| 07:52 | _ato | powr-toc: hmmm... we should add a command to lein for doing that. |
| 07:53 | _ato | powr-toc: if you copy it into the right place it should work, I think. |
| 07:53 | powr-toc | _ato: yeah, that'd be handy |
| 07:53 | liebke | _ato: great, thanks! Clojars has been extremely useful to me, so thanks for building it :) |
| 07:53 | _ato | powr-toc: try putting it at something like ~/.m2/repository/myjar/myjar/1.0.0/myjar-1.0.0.jar |
| 07:58 | ambient | btw, how would submitting a project that has JNI elements in it to Clojars work? |
| 07:58 | ambient | if I made a lib and included win32 and linux binaries in it |
| 08:00 | ambient | it's just a bit of a hassle to download libraries from github and install them by hand, some alleviation to that process would be appreciated |
| 08:01 | _ato | liebke: should be fixed |
| 08:03 | ambient | does maven include some kind of a packaging system? |
| 08:04 | _ato | ambient: so I'm no expert on JNI, but I've looked at what SqliteJDBC does (Clojars currently uses it even) and it manages to bundle linux, win32 and mac binaries all the same jar |
| 08:04 | ambient | cool, thanks. i have to take a look how it's done then :) |
| 08:04 | _ato | the problem is the JVM can't load native libs directly from inside a jar |
| 08:05 | _ato | so what SqliteJDBC does is checks os.name property |
| 08:05 | _ato | picks the appropriate lib for the current OS |
| 08:05 | _ato | and unpacks it into a temporary file using Class.getResourceAsStream("libsomething.so") and File/createTempFile |
| 08:05 | _ato | it then calls System/load on that temp file and marks it for deletion on exit |
| 08:06 | ambient | cheers. that was helpful |
| 08:07 | _ato | no worries. :) I haven't tried it, but that's the approach I'd take. If we can figure out a method that works well it seems that would make a good Leiningen plugin |
| 08:36 | liebke | _ato: add member is working now, thanks! |
| 09:00 | ordnungswidrig | aloha |
| 09:01 | chouser | ordnungswidrig: good morning |
| 09:02 | rfgpfeiffer | ,(defprotocol foo) |
| 09:02 | ordnungswidrig | me wants functional api without exceptions :-) |
| 09:02 | clojurebot | DENIED |
| 09:03 | chouser | heh. wrap with binding or wrap with try/catch |
| 09:04 | ordnungswidrig | chouser: wrapping is possible but does not match my development model.. I consider brancher either library :-) |
| 09:04 | ordnungswidrig | s/\(branch\)er/\1ing/ |
| 09:05 | chouser | yeah, I was just noting the similarity in that both demand a dynamic-scope wrapper around the calls, either with try or binding. |
| 09:05 | ordnungswidrig | yes, and I don't like either :-) |
| 09:06 | ordnungswidrig | I notice that having such wrapper like a macro "with-db" can be useful. But only as a add-on to a pure function interface. |
| 09:07 | ordnungswidrig | One can use multiple function implementation with different arity for example. |
| 09:08 | chouser | yes, I agree that's usually better. |
| 09:10 | ordnungswidrig | hmm, If I have (defn fromdb ([db query] ...) ([query] ...)) where the second form will call (fromdb db-in-scope query) can I generalize this. |
| 09:11 | ordnungswidrig | I suppose a macro to redefine a function f can do. |
| 09:11 | chouser | sure, with a macro |
| 09:11 | chouser | right |
| 09:11 | chouser | (defmacro defn-with-query [name args & body] ...) |
| 09:12 | ordnungswidrig | chouser: like a (redefn-with-curry-from-scope fromdb db-in-scope) |
| 09:14 | angerman | is there a function that would turn (10 11 9 12 13) into (10 (10+11) (10+11+9) ... (10+11+9+12+13))? |
| 09:15 | chouser | angerman: seq-utils reductions |
| 09:17 | chouser | ,(use '[clojure.contrib.seq-utils :only (reductions)]) |
| 09:17 | clojurebot | nil |
| 09:18 | chouser | ,(reductions + [10 11 9 12 13]) |
| 09:18 | clojurebot | (10 21 30 42 55) |
| 09:18 | angerman | nice |
| 09:22 | ordnungswidrig | do I remember correctly that ouside let bindings will be captured in a defn while bindings with "binding" will not? |
| 09:22 | rfgpfeiffer | rhickey: (defprotocol foo)(isa? (class (reify [foo])) foo) returns false |
| 09:24 | rfgpfeiffer | will this be changed? |
| 09:24 | rfgpfeiffer | it works on interfaces |
| 09:24 | rfgpfeiffer | (isa? (class (Thread/currentThread)) Runnable) is trie |
| 09:26 | chouser | rfgpfeiffer: the interface name is user.foo |
| 09:27 | rfgpfeiffer | it works with user.foo |
| 09:28 | angerman | what would be the appropriet datastructure to use for a sparse vector? |
| 09:31 | ordnungswidrig | angerman: finger tree :-) |
| 09:32 | angerman | hmm... |
| 09:32 | cemerick | is there a bleeding-edge clojure maven repo somewhere? |
| 09:33 | rhickey | protocols are very much not about hierarchy. One should never do isa? with a protocol interface - why? - because not all extenders of a protocol will have a type relationship with it. You can do satisfies? if need be, but the whole point of polymorphism is to free us from having to ask things what they are |
| 09:34 | rhickey | cemerick: http://build.clojure.org/ |
| 09:34 | cemerick | rhickey: that doubles as a maven repo? |
| 09:34 | rhickey | cemerick: somehow |
| 09:34 | cemerick | huh |
| 09:34 | cp2 | mornin rhickey |
| 09:35 | cemerick | maven is totally opaque to me at the moment |
| 09:35 | rhickey | http://groups.google.com/group/clojure/browse_frm/thread/8270d639913c2f01 |
| 09:36 | rhickey | http://build.clojure.org/snapshots |
| 09:36 | rhickey | cp2: hey |
| 09:36 | cemerick | OK, the /snapshots dir definitely looks like a repo |
| 09:37 | cp2 | i havent really been keeping track too much on clojure, anything new/cool happen lately? :D |
| 09:37 | ordnungswidrig | gnah, dumping a complete coudbdb as json to a repl console might kill your emacs. |
| 09:38 | liwp | ordnungswidrig: after things calm down you can clear the slime buffer, which will make things happier again |
| 09:39 | liwp | ordnungswidrig: C-c C-o - slime-repl-clear-output I believe will do the trick |
| 09:39 | chouser | cemerick: ah, thanks for reminding me -- I gotta put that versions string change in so there can be a "new" branch snapshot as well |
| 09:39 | angerman | here's my first shot at a LibSVM model file parser |
| 09:39 | angerman | http://gist.github.com/247236 |
| 09:39 | ordnungswidrig | liwp: C-c C-o doesn't work. Hoever it is written to *inferior-lis* anyways |
| 09:40 | cemerick | chouser: yeah, I saw that thread, and was equally confused |
| 09:40 | chouser | :-) |
| 09:40 | cemerick | I'm rapidly being reminded why I stayed in ant-land for so long |
| 09:40 | chouser | lein is going to get me into maven the way clojure got me into java |
| 09:41 | chouser | heh |
| 09:41 | cemerick | ha |
| 09:41 | cemerick | that's where I've always been, too :-( |
| 09:42 | cemerick | it's all such an amazing about of busywork |
| 09:43 | lpetit | chouser: maven is not so bad. It's just that it sometimes does not seem simple to do simple things with it. But once lein will become more heavy when user stories are added to it (add other remote repos, how to manage licenses, how to do unit tests, and then functional tests, what about generating cross reference docs, etc.), it will get closer to maven. |
| 09:43 | lpetit | lein is a learning process to maven :) |
| 09:43 | chouser | my point exactly. |
| 09:43 | ordnungswidrig | clojure and couchdb go so well togethr: (map :value (:rows (view-get host db design view { :key "item" :limit 10 }))) |
| 09:45 | ordnungswidrig | To throw a idea into the pool on build systems. I like make for it's attempt to be dependencies triggered, say a jarfile depends on some class-files. I like maven for it's high abstraction and not to be file-based. |
| 09:45 | chouser | rhickey: "par" is the only other public branch that's particularly alive, right? |
| 09:46 | ordnungswidrig | I think of a tool which is dependency-based, say, the execution of some test-cases depend on some class-files are avaiable which depend some other classes are loadable by a classloader: either as a class file which is then compiled or as a class which can be loaded from a 3rd party jar. |
| 09:46 | rhickey | chouser: yes |
| 09:47 | ordnungswidrig | So dependency is logical (class A depends on the availability of class B) and not physical, like make (file A.class depends on file B.class) or declarative like maven (project A depends on project B) |
| 09:47 | cemerick | so, will a http://build.clojure.org/releases appear eventually as well, then? |
| 09:49 | chouser | oh dear |
| 09:50 | chouser | shoot. I just pushed private branches to github. |
| 09:50 | ordnungswidrig | chouser: private in a sense of offending or business secrets? |
| 09:50 | chouser | no, not that bad. |
| 09:51 | cemerick | chouser: push -f |
| 09:51 | ordnungswidrig | chouser: or both? :-) |
| 09:51 | chouser | just me mucking around in clojure sources, now on the official github repo. :-/ |
| 09:51 | chouser | cemerick: ? |
| 09:51 | djpowell | how do protocols redefine their interfaces? just by calling .defineClass again? does that have any caveats? |
| 09:52 | cemerick | chouser: you can just back up the ref(s) involved and push -f to bring the remote back to where it was |
| 09:52 | rhickey | http://github.com/guides/remove-a-remote-branch |
| 09:54 | chouser | wow. magical. |
| 09:54 | chouser | thanks guys |
| 09:54 | fliebel | Has anyone ever tried Robocode with Clojure? |
| 09:55 | rhickey | djpowell: they define a new interface, with the same name, in a new classloader. iff the interface has changed (i.e. generated different bytecode), then implementing deftypes/reify and protocol callers will need to be reloaded |
| 09:59 | chouser | Shouldn't (satisfies? ::Foo (reify [Foo]) return true? |
| 09:59 | chouser | at least when you close all the parens? |
| 10:00 | rhickey | (satisfies? P (reify [P])) |
| 10:00 | rhickey | true |
| 10:01 | rhickey | given: (defprotocol P) |
| 10:01 | chouser | right. coulda sworn I tried that. |
| 10:01 | rhickey | not ::P |
| 10:01 | chouser | do we ever use ::Proto anymore? |
| 10:02 | rhickey | did we ever? |
| 10:02 | rhickey | only: ::ADataType |
| 10:02 | chouser | oh, ok. |
| 10:03 | rhickey | I haven't figured out if getting rid of the tag is possible given the latest dynamic type stuff |
| 10:03 | chouser | I *did* try it. but I think that was before a recent bug fix and multiple (defprotocol Foo)s were breaking it. Or something. |
| 10:03 | chouser | anyway, works now, thanks. |
| 10:03 | rhickey | great! |
| 10:04 | rhickey | docs ok for everyone? |
| 10:05 | chouser | indentation of first example in (doc defprotocol) seems broken |
| 10:08 | chouser | name mismatch in the defprotocol interface paragraph |
| 10:08 | chouser | my.ns/Protocol vs my.ns.MyProtocol |
| 10:11 | rhickey | the protocol is my.ns/Protocol, and the interface my.ns.MyProtocol |
| 10:11 | chouser | where is My coming from? |
| 10:12 | rhickey | oh, that :) |
| 10:12 | chouser | :-) |
| 10:12 | rhickey | will fix, thanks |
| 10:16 | chouser | it seems a bit funny for deftype to have fields before protocols, when both are included. |
| 10:16 | chouser | maybe that's just java syntax working on my subconcious |
| 10:20 | cemerick | so, I've set a dependency in a pom to 1.1.0-alpha-SNAPSHOT, but maven is looking for http://build.clojure.org/snapshots/org/clojure/clojure/1.1.0-alpha-SNAPSHOT/clojure-1.1.0-alpha-SNAPSHOT.pom, rather than finding the latest version and getting http://build.clojure.org/snapshots/org/clojure/clojure/1.1.0-alpha-SNAPSHOT/clojure-1.1.0-alpha-2009xxxxxxxx.pom. Thoughts? |
| 10:20 | chouser | rhickey: no mention in deftype that you can use hints to get primitive field types |
| 10:21 | lpetit | ~types |
| 10:21 | clojurebot | Pardon? |
| 10:28 | cemerick | ooh, setting <version> to 1.1.0-alpha-20091110.180127-1 prompted maven to download ..../1.1.0-alpha-SNAPSHOT/clojure-1.1.0-alpha-20091110.180127-1.jar -- but how did it know to use the 1.1.0-alpha-SNAPSHOT directory? |
| 10:30 | lpetit | rhickey: if I want different protocol P implementations for a set of types #{T1, T2, T3} which will share the same fields set definition, what would be the best way to do it ? And what would be the easiest way to "transform" an instance from type T1 to type T2 ? |
| 10:31 | angerman | with what -Xms parametes is the slime clojure repl started by default? |
| 10:36 | angerman | rhickey: what whould be a sane way to handle 45000 x 250 floats in clojure? |
| 10:36 | opqdonut | depends pretty much on the access pattern |
| 10:36 | chouser | angerman: probably a Java array. :-/ |
| 10:37 | opqdonut | yeh, probably |
| 10:37 | chouser | no other containers of primitives in Clojure (yet) |
| 10:37 | angerman | so I somehow need to know the size beforehand :( |
| 10:37 | chouser | angerman: depending on what you're doing with it, there may be a Java lib that abstracts away the ugliness for you a bit. |
| 10:38 | duncanm | what's the overhead of Array vs. ArrayList? |
| 10:38 | chouser | angerman: vectors of primitives are planned I think, but probably not until after clojure-in-clojure. |
| 10:38 | chouser | ArrayList can't do primitives either, can it? |
| 10:38 | duncanm | oh, right right.... |
| 10:39 | chouser | maybe primitives aren't required. |
| 10:41 | angerman | so I somehow need to insert them into an Array. (then I probably could turn that into a matrix from incarnater) |
| 10:41 | chouser | you can't just use an incanter matrix from the beginning? |
| 10:42 | angerman | so I need to do two runs over the data, first one, figuring out the metrics, second one loading the data. |
| 10:42 | angerman | chouser: I haven't found a "set value V at (x,y)" |
| 10:42 | angerman | that's probably the only thing that matlab does nicely. :/ |
| 10:42 | chouser | huh |
| 10:42 | chouser | I don't know incanter at all. |
| 10:44 | angerman | incanter goes like this: I'll make you an array from data: ... though I think there is an (add row/add col) functionallity |
| 10:44 | liebke | angerman: you can call .set on incanter matrices, (.set foo row col val) |
| 10:45 | liebke | it changes the matrix in place |
| 10:45 | angerman | liebke: ok, that seems nice. |
| 10:45 | angerman | liebke: still, i should know the matrix size beforehand, no? |
| 10:45 | liebke | you have access to all the Colt matrix methods |
| 10:46 | liebke | yes, unless you want to construct it with bind-rows, etc |
| 10:46 | angerman | liebke: I'm trying to get a LibSVM binding for clojure. (which if it would work, could be interesting for incanter i think) |
| 10:46 | liebke | yes, that could be interesting |
| 10:48 | angerman | I will persue the non-pure-java road though, as the binaries of libsvm work pretty speedy and it seems to be the same approach R and Matlab use |
| 10:49 | chouser | No interface for Throwables. :-( |
| 10:50 | angerman | ?! |
| 10:51 | chouser | I can't use deftype to make my own Exception type because there's no abstract interface for that 'throw' will take. |
| 10:52 | chouser | someday gen-class may die. But not today. |
| 11:06 | powr-toc | presumable "lein repl" includes the project on the classpath? |
| 11:09 | fliebel | Second try: Has anyone ever tried to make a bot with Robocode with Clojure? |
| 11:15 | liebke | powr-toc: yes, the project is included in the classpath. |
| 11:16 | powr-toc | hmmm maybe I have a namespace issue then |
| 11:17 | liebke | when I say the project is included, I mean your project classes and dependencies |
| 11:18 | powr-toc | yes, that's what I meant too :-) |
| 11:18 | liebke | :) |
| 11:18 | schaf | Hi |
| 11:19 | schaf | how close is clojure 1.1? Is it recommended to use 1.0 when wanting to use clojure in a project or is it better to start with the development version right away? |
| 11:19 | chouser | schaf: based on a recent poll ... :-) |
| 11:20 | chouser | 30% of respondants are using 1.0 -- the rest are using some pre-release snapshot of 1.1 |
| 11:20 | schaf | chouser: based on "1.1 is really close and not many new changes will happen" or "dev is all moving.." |
| 11:21 | powr-toc | how about leiningen? Are people using stable or the git master? |
| 11:21 | tcrayford | have to use the git master for emacs/slime integration |
| 11:21 | powr-toc | tcrayford: ahh cool... that's something I was wanting |
| 11:22 | tcrayford | see http://wiki.github.com/technomancy/leiningen/emacs-integration |
| 11:22 | chouser | there are a couple things in 1.0 and master that will probably be deprecated for 1.1, meaning they will work but we should try to stop using them. |
| 11:23 | powr-toc | tcrayford: that looks pretty sweet |
| 11:23 | chouser | but off the top of my head, I can't think of any code that would work in 1.0 but not in 1.1 |
| 11:23 | tcrayford | I'm still getting my head round figuring lein/emacs/slime out |
| 11:23 | chouser | 1.1 is probably pretty much feature-frozen. Not sure about how soon it might be released though. |
| 11:23 | tcrayford | been a while since I've used any of them (switched to textmate for a bit) |
| 11:25 | rdsr | Hi all, I can't seem to add documentation to a lexically scoped function created with letfn |
| 11:25 | rdsr | this throws an error |
| 11:25 | powr-toc | liebke: Am I missing something, I've run "lein repl" and (all-ns) does not include my namespace as specified by defproject |
| 11:25 | rdsr | (letfn [(fun |
| 11:26 | rdsr | this throws an error (letfn [(fun "documentation" [] 1)] 1) |
| 11:26 | chouser | rdsr: that's not currently supported |
| 11:26 | rdsr | Is this a bug, or am I doing something wrong |
| 11:26 | rdsr | ? |
| 11:26 | rdsr | oh ok thks chouser |
| 11:27 | chouser | rdsr: how would you get at those docs if it were? |
| 11:28 | rdsr | I was thinking more from the point of the person reading the code |
| 11:28 | liebke | powr-toc: yeah, i don't see my namespace when I do (all-ns), but I can load my classes |
| 11:29 | rdsr | Well I guess I can just add a side comment :) |
| 11:29 | chouser | rdsr: sounds good. :-) |
| 11:30 | noidi | aargh... I'm reading the reddit comments of Tim Bray's latest Clojure post and I'm starting to really appreciate the lack of smug Clojure weenies :) |
| 11:31 | powr-toc | liebke: Ok... So you need to do a (require 'myproject) even after a "lein repl"... Is this a feature? |
| 11:31 | liebke | yes |
| 11:31 | liebke | lein repl just makes sure everything is on the classpath, you still need to require/use it |
| 11:32 | powr-toc | liebke: I clearly don't fully understand clojure namespaces, but would it not make more sense to require it automatically? |
| 11:32 | powr-toc | or is it because requiring a namespace can have side-effects? |
| 11:33 | liebke | not necessary, it doesn't know what options you might supply to 'use' |
| 11:35 | powr-toc | makes sense I guess... it's just another thing for me to remember... Presumably it'd be easy to write your own lein task that started a repl with the REPL initialised with require etc... |
| 11:38 | liebke | you can just create a user.clj file that will require anything you need. |
| 11:40 | chouser | ha! this is great http://www.reddit.com/r/programming/comments/aa44a/eleven_theses_on_clojure/c0gl2oy |
| 11:41 | chouser | "Baked in 375 degrees for 30 minutes, placed in an oiled bowl, kneaded for 10 minutes, mixed flour and water" |
| 11:41 | cemerick | chouser: so having a 1.1.0-new-SNAPSHOT just a matter of updating version.properties? |
| 11:42 | chouser | cemerick: for clojure itself, apparently, yes. The consequences for the maven builder or people using maven to consume the builds are all beyond me. |
| 11:43 | powr-toc | liebke: Good idea... how is it I can put user.clj on the lein repl classpath, drop it in src? |
| 11:44 | cemerick | there's the matter of clojure-contrib's branch proliferation, too. |
| 11:45 | cemerick | Seems like if one is following the edge, pushing a build into an internal repo is the way to go for now....especially since I'm totally out of my depth with maven still. |
| 11:45 | leafw_ | is there any reason why test.clj contains the docs first as a comment and then, identical, as a documentation of the namespace? |
| 11:47 | chouser | yes, when the comments at the top of a file match exactly the namespace docstring, Clojure will automatically generate a .. er... no, nevermind. |
| 11:47 | leafw_ | I've seen this in some files of clojure contrib as well |
| 11:47 | chouser | test.clj came from contrib |
| 11:48 | chouser | before namespaces supported docstrings, the contrib libs documented themselves in comments |
| 11:48 | leafw_ | and I wonder how will something like test/junit.clj go for clojure-on-clojure |
| 11:48 | chouser | someone went through and copied those into the namespace docstrings at some point. *shrug* |
| 11:49 | leafw_ | chouser: I understand there is a history to it. What bothers me is that readability is diminished by the duplication--and both versions may differ subtly |
| 11:49 | chouser | well, you asked for the reason. *more shrugging* |
| 11:49 | leafw_ | ok |
| 11:49 | leafw_ | doesn't damage anything anyway |
| 11:51 | chouser | why would junit.clj be an issue for clojure-in-clojure? |
| 11:51 | chouser | you could use it to generate junit-compatible xml results for your ClojureScript project! :-) |
| 11:51 | leafw_ | just being pedantic/idealist, forget it. The short version: clj remains attached to JVM with junit |
| 11:52 | chouser | I'm afraid we'll have more issues with things like throwing Throwables |
| 11:53 | chouser | does .Net have a class named Throwable? Does Objective-C? Javascript? |
| 11:54 | gravity | Is anyone else's swank-clojure HEAD broken? I get 'Cannot open load file" "swank-clojure-autoload"' when trying to execute clojure-slime-config |
| 11:54 | leafw_ | no idea chouser |
| 11:55 | leafw_ | what clj doesn't have at the moment is a dead-easy ClojureInterpreter, like the PythonInterpreter for jython or the org.jruby.Ruby, etc. |
| 11:56 | leafw_ | I had to create my own, and it wasn't entirely clear at the beginning how to do it. |
| 11:56 | leafw_ | for embedding clojure, that is. |
| 11:56 | chouser | huh. you did it though? |
| 11:56 | leafw_ | yeah |
| 11:56 | chouser | in a context where you couldn't have a DynamicClassloader, or... ? |
| 11:57 | leafw_ | in a context where I needed a trivial way to give clojure a string with code and get back the result, run within a specific namespace. |
| 11:58 | chouser | I'm just wondering why you didn't want to use 'eval' |
| 11:59 | leafw_ | if there is an easier way to do it, I'd appreciate comments: http://tinyurl.com/yl3fc62 |
| 12:01 | ohpauleez | leafw_: Why didn't you use eval? And did have a look at how the jsr-223 bindings were done |
| 12:02 | leafw_ | the meat of the evaluation is at line 262 |
| 12:02 | leafw_ | uses Compiler.eval |
| 12:02 | chouser | leafw_: that's pretty cool -- nice for giving a repl in a restricted JVM environment for example. |
| 12:02 | chouser | (binding [*ns* (the-ns 'foo)] (eval (read-string "::bar"))) |
| 12:03 | chouser | oh, you are using eval. huh. |
| 12:03 | leafw_ | ohpauleez: I need help understanding what you asked for. |
| 12:03 | leafw_ | chouser: I needed way to let the user change the namespace too, via normal in-ns etc. |
| 12:03 | ohpauleez | Someone has made jsr-223 (embedded Java scripting) bindings for clojure. |
| 12:03 | ohpauleez | let me dig it up |
| 12:03 | ohpauleez | I haven't looked at it, so I'm not sure how they did it |
| 12:04 | leafw_ | this class I pasted shows up as a JFrame with a "screen" text area and a prompt |
| 12:04 | leafw_ | ohpauleez: ok, I understand. |
| 12:04 | ohpauleez | Yeah, I'm looking at your code now, pretty cool for sure |
| 12:06 | leafw_ | it enables me to type in any clojure code, just as you would from a command line started with clojure.main |
| 12:07 | leafw_ | but if you look at the similar classes for jython, jruby, javascript or beanshell, they are ... infinitely shorter, because those JVM languages have already a "X-Interpreter" class that does it all. |
| 12:08 | technomancy | powr-toc: right now "lein repl" is implemented in the shell script. after 1.0 it will be moved to clojure code so niceties like auto-requiring your :main namespace can happen automatically |
| 12:08 | powr-toc | technomancy: cool |
| 12:09 | technomancy | but I don't use it personally; I stick with swank. so I need other people to tell me what's useful. =) |
| 12:10 | chouser | leafw_: there are easier ways, I think. |
| 12:10 | leafw_ | chouser: this class is a compromise ... had to handle streams from files and from text areas, and had to wait until concluding each task, etc. |
| 12:11 | chouser | leafw_: I think I'm doing something similar here: http://tinyurl.com/y9dpwzq/textjure.clj#LID245 |
| 12:11 | leafw_ | written in clojure, that's not fair :) |
| 12:12 | chouser | :-) |
| 12:12 | chouser | but... why are you writing in Java when you have clojure already? |
| 12:12 | leafw_ | and yes it looks very similar. |
| 12:13 | leafw_ | chouser: because initially I didn't know enough clojure, and it was easier to embed into our build system |
| 12:13 | chouser | ok |
| 12:13 | leafw_ | I see now that I could just have reduced the java side to about 1 single line of code. |
| 12:14 | chouser | there's also some potentially useful pieces in clojure.contrib.repl-ln and even clojure.main |
| 12:14 | leafw_ | I did that for the neuronal identification tool ... just an invoke. |
| 12:18 | powr-toc | technomancy: I think I'll probably use slime, but i can imagine using a raw repl when sshd into a server, so it might be handy then |
| 12:21 | technomancy | "Aquamacs defaults to putting the *scratch* buffer into text-mode, not into lisp-interaction-mode." *facepalm*... wow. |
| 12:21 | technomancy | no wonder people have trouble getting stuff installed. =( |
| 12:21 | leafw_ | chouser: textjure.clj is indeed similar, but I can't see how to bring about the previous prompt entry, and the code history doesn't go to the top window (is this intended? If so, what is the top window for?) |
| 12:21 | alinp | hi guys |
| 12:22 | alinp | how can I swith the current namespace to something like: org.test.mytests |
| 12:22 | bitbckt | Ew. Aquamacs. |
| 12:22 | alinp | ? |
| 12:23 | ohpauleez | alinp: (ns my-new-ns.my-sub-ns) |
| 12:24 | chouser | leafw_: I think there's no command history support yet, and the top window is meant for editing a source file |
| 12:24 | ohpauleez | alinp: for more info http://java.ociweb.com/mark/clojure/article.html#Namespaces |
| 12:24 | alinp | thanks ohpauleez |
| 12:24 | ohpauleez | alinp: np |
| 12:24 | leafw_ | chouser: you have in there some cool macros for handling key bindings |
| 12:24 | chouser | leafw_: yeah -- that's what I was working on when I got distracted by other things |
| 12:25 | chouser | leafw_: the keybindings aren't 100% yet, but I have grand plans. :-P |
| 12:25 | leafw_ | ok |
| 12:25 | powr-toc | technomancy: Though it might be nice if the lein script would use rlwrap if it was installed for lein repl |
| 12:25 | leafw_ | keyword expansion would be great--it's the sort of thing I'm missing most in my interpreter. |
| 12:25 | technomancy | powr-toc: yeah, may add that |
| 12:26 | technomancy | problem is I really hate coding shell scripts |
| 12:26 | powr-toc | technomancy: yeah, me too :-) |
| 12:26 | leafw_ | yours is a cross in usage between my interpreter and the script editor http://pacific.mpi-cbg.de/wiki/index.php/Using_the_Script_Editor |
| 12:27 | leafw_ | a script editor written in clojure, with keyword expansion, history, a prompt, and syntax highlighting, and vi bindings, now that would be something :) |
| 12:28 | chouser | leafw_: that's the plan |
| 12:29 | chouser | and it's only been about a year since I was last making any progress on it. :-P |
| 12:29 | leafw_ | working on such a project can hardly be justified, considering the existence of many good editors. |
| 12:29 | chouser | yes |
| 12:29 | chouser | all of which are insufficient |
| 12:29 | leafw_ | true. |
| 12:29 | chouser | well. barely sufficient, which is perhaps worse. |
| 12:30 | leafw_ | I've already built two, but in java. |
| 12:30 | leafw_ | and both are short. |
| 12:33 | chouser | I really just want a modern emacs that supports vi bindings as first-class citizens. |
| 12:34 | jasapp | chouser: a vi guy? |
| 12:35 | leafw_ | chouser: viper doesn't quite cut it, if that's what you mean |
| 12:36 | ohpauleez | clojure is the first lisp that I'm ok with editing in vim (which I use as my standard editor) |
| 12:36 | ohpauleez | I think the community has done a great job at offering real support across the board |
| 12:36 | leafw_ | ohpauleez: Mikel put a lot of work to make that happen |
| 12:37 | jasapp | I think that's nice |
| 12:37 | ohpauleez | for sure |
| 12:37 | jasapp | I remember being ridiculed mercilessly for not using emacs when hacking common lisp |
| 12:37 | jasapp | the clojure group seems much more friendly |
| 12:38 | chouser | leafw_: right |
| 12:38 | bitbckt | jasapp: Here, you might be gently ribbed. But only in good fun. :-) |
| 12:39 | chouser | yeah, I don't love vim, but I do love the keybindings. |
| 12:39 | jasapp | bitbckt: I gave up years ago, and now I just use emacs :) |
| 12:39 | chouser | vimscript is atrocious, and somehow the multitude of script language bindings don't actually help much. |
| 12:40 | bitbckt | jasapp: See? Isn't that easier? |
| 12:41 | jasapp | bitbckt: 6 years later, but at the time it wasn't so nice |
| 12:41 | bitbckt | Such is life. |
| 12:41 | jasapp | my wife still remembers how I was grumpy for months about switching |
| 12:41 | ohpauleez | haha |
| 12:42 | KirinDave_ | Hah |
| 12:42 | KirinDave_ | Which editor people use is like high school dramas. |
| 12:42 | KirinDave_ | "o/ So freakin' important. These things matter." |
| 12:43 | powr-toc | technomancy: I've sent you a github pull request, that'll use rlwrap if it's installed |
| 12:43 | KirinDave_ | "Nothing will ever be more important than the editor you use right here, right now." |
| 12:43 | hamza | hey guys, is it possible to have a map that retains its insert order while iterating? |
| 12:43 | jasapp | KirinDave_: I agree completely |
| 12:43 | KirinDave_ | I mean, is there anyone who really uses one editor exclusively? |
| 12:43 | bitbckt | KirinDave_: +1 |
| 12:43 | KirinDave_ | I mean, really. |
| 12:43 | KirinDave_ | If you don't know vi+m, good luck when you're admining remote boxes over a slow link or when you go to a really bare-bones install. |
| 12:43 | bitbckt | I find the whole "war" really very amusing. |
| 12:44 | ambalek | it seems like different editors suit different projects |
| 12:44 | KirinDave_ | If you don't know emacs, have fun reinventing your wheel again and again. |
| 12:44 | chouser | KirinDave_: I have *tried* many editors, but I use vim for everything at the moment. |
| 12:44 | KirinDave_ | chouser: I'm talking about exclusive use, in practice. |
| 12:44 | KirinDave_ | chouser: You never use any other editors, ever? :) |
| 12:45 | chouser | hamza: possible, yes, but none of clojure's built-in maps do that. |
| 12:45 | ohpauleez | hamza: not to my knowledge. You could prefix your inserts and use a sorted map |
| 12:45 | cemerick | If I'm grokking things right, clojure's pom isn't at all useful for building it, correct? |
| 12:45 | powr-toc | org-mode keeps me tied to emacs :-) |
| 12:45 | ohpauleez | gah, chouser beat me to it |
| 12:46 | KirinDave_ | powr-toc: There are many replacements to it. :) |
| 12:46 | cemerick | oh, hah, it's autogenerated from ant |
| 12:47 | powr-toc | KirinDave_: Heresy! Nothing could replaceme org-mode! |
| 12:47 | hamza | chouse: thanks.. |
| 12:47 | chouser | cemerick: oh! ah |
| 12:48 | chouser | cemerick: now I see why I didn't have to change it manually. :-) |
| 12:48 | cemerick | chouser: yeah. The current setup seems a little nutty, but makes sense given that ant is the blessed build tool |
| 12:48 | ohpauleez | To anyone's knowledge, has someone attempted a mechanize project for clojure? something like tying together htmlunit and enlive in a clojure way |
| 12:48 | chouser | array-maps keep things in reverse insertion order these days, though that's probably not guaranteed. |
| 12:48 | cemerick | It wouldn't be difficult to make the pom functional on its own, though. |
| 12:48 | powr-toc | KirinDave_: Seriously, what org-mode replacements are there? vimoutliner?? |
| 12:49 | powr-toc | org-babel's clojure support is pretty sweet |
| 12:50 | lisppaste8 | rhickey pasted "cast your vote!" at http://paste.lisp.org/display/91445 |
| 12:52 | bitbckt | rhickey: A. |
| 12:52 | cemerick | rhickey: C |
| 12:53 | cemerick | #clojure is the American Idol of lisp channels :-P |
| 12:53 | bitbckt | hah |
| 12:53 | rhickey | cemerick: i.e. votes equally rigged? |
| 12:54 | cemerick | rhickey: heh, the analogy just keeps on truckin' :-D |
| 12:54 | KirinDave_ | powr-toc: I use OmniFocus. |
| 12:54 | leafw_ | is there any cost for an implicit this, making this a reserved keyword? |
| 12:54 | chouser | A doesn't allow for optional per-method 'this', right? |
| 12:54 | KirinDave_ | I used to use org-mode, but I needed synching that isn't so brittle. |
| 12:54 | cemerick | rhickey: you have your original preference written in a sealed envelope, I presume? |
| 12:54 | wilkes | rhickey: C |
| 12:55 | patrkris | Are Clojure's references inspired by the ones found in Standard ML? Or are they at least comparable to those? |
| 12:55 | rhickey | leafw_: won't be a reserved keyword in any case |
| 12:55 | rhickey | chouser: right, no per method |
| 12:55 | rhickey | cemerick: I could be done already, just surveying the resistance :) |
| 12:56 | powr-toc | KirinDave_: I head that was quite good... but does it have clojure integration? :-) |
| 12:56 | KirinDave_ | powr-toc: I suppose if you want to to make an applescript bridge, yes. |
| 12:57 | chouser | I don't like C. Anymore. :-) |
| 12:59 | bitbckt | Hmm. |
| 12:59 | cemerick | rhickey: ^^ ;-) |
| 13:00 | rhickey | cemerick: for C? what about the recur mismatch? |
| 13:00 | bitbckt | I find C noisy. |
| 13:00 | bitbckt | And though I like A, the recur issue remains. |
| 13:01 | cemerick | rhickey: that's a small price to pay for consistency everywhere else |
| 13:01 | chouser | I'm tempted by B with always required this (so no extra vector nesting) |
| 13:02 | cemerick | I really dislike implicit arguments in general. |
| 13:02 | chouser | naming it at the top of whatever block weakens the argument against implicit a bit |
| 13:03 | rhickey | chouser: always required for reify and implicit this for deftype? |
| 13:03 | chouser | making it required would serve as a reminder and make it easier to have crystal-clear error messages. |
| 13:04 | chouser | rhickey: required for deftype too, if any methods are given. |
| 13:04 | ohpauleez | I too really dislike implicit args, but I think I could like naming it at the top of a block |
| 13:04 | ohpauleez | I can't come up with a case where that doesn't work for me or would cause a serious issue |
| 13:06 | chouser | for the methody things, there is inherent mismatch as demonstrated by recur and outside calls taking different arg counts. That first arg really is special (moreso than say in Python methods), and that mismatch will show up somewhere, it's just a question of where. |
| 13:07 | chouser | do you want it in the 'recur' args? or in the formal method args? If the latter, you can make the difference a bit more explicit by putthing the name at the top |
| 13:09 | chouser | B gives you no false consistency that leaks out around 'recur', and with required 'this's you reduce the [] noise a bit and remind everyone the scope and name of the symbol you're introducing. |
| 13:10 | cemerick | it seems that any degree of implicitness only benefits writers, not readers. Further, making the arg explicit can be used to usefully communicate what's happening to the callee. e.g. _ generally means 'this' isn't used at all, etc |
| 13:10 | rhickey | the simplest case with B + required this is: (reify this ActionListener (actionPerformed [evt] ...)) |
| 13:10 | rhickey | or (reify _ ActionListener (actionPerformed [evt] ...)) |
| 13:11 | hiredman | I don't like implicit args, but if it is such a blight, then by all means, make it go away (implicit) |
| 13:11 | rhickey | unused but required at top seems like baggage |
| 13:12 | chouser | I'm still against implicit, but maybe could go along with elided |
| 13:13 | chouser | extend-class still needs explicit though, becuase those things aren't methods, they're functions. no use in pretending otherwise. |
| 13:13 | cp2 | http://www.jroller.com/scolebourne/entry/closures_in_jdk_7 |
| 13:14 | defn | What is something like "this", called? I am trying to find a wikipedia entry or something to get a little context on the current conversation |
| 13:18 | lisppaste8 | rhickey annotated #91445 "protocol grouping - vote!" at http://paste.lisp.org/display/91445#1 |
| 13:19 | Chousuke | second one gets my vote. easier to handle with paredit :P |
| 13:19 | defn | Without knowing a heck of a lot about the underlying differences, I prefer X |
| 13:19 | hiredman | defn: safe bet, X has always been the coolest letter |
| 13:20 | defn | haha |
| 13:20 | chouser | X |
| 13:21 | chouser | Chousuke: get a better editor. ;-) |
| 13:21 | Chousuke | :P |
| 13:21 | defn | oooo! Them's fightin' words! |
| 13:21 | Chousuke | I would, but I haven't found any yet |
| 13:21 | cemerick | X |
| 13:21 | rhickey | can we please not talk about editors (again) right now? |
| 13:22 | Chousuke | heh. |
| 13:22 | hiredman | X |
| 13:22 | chouser | I thought that's just what people say when anyone complains about lisp syntax. |
| 13:22 | Chousuke | X looks a bit pythonic I guess |
| 13:22 | rhickey | I forgot to mention a benefit of Y is that 'this' at top could be optional, and not in [] when specified |
| 13:22 | cp2 | rhickey: Y |
| 13:23 | chouser | there are a couple pain points with Clojure's tendency to keep nesting levels shallow, (indentation support and macros that have to parse/produce the critters) but the benefits are worthwhile and widespread. |
| 13:24 | rhickey | btw, if anyone has any write-in ballots for these, feel free |
| 13:25 | chouser | I'd rather have [this] only when required than [Proto (method) ...] always |
| 13:26 | cemerick | it looks like no clojure artifacts have been added to the snapshots repo since 11/26 |
| 13:27 | defn | Huh...http://en.wikipedia.org/wiki/Template:Sound_change -- Hadn't ever heard of Lenition, Epenthesis, or Cheshirisation |
| 13:28 | defn | some of those seem like a good way to describe the differences between A,B,C or X,Y. |
| 13:33 | rhickey | defn: huh, don't see it right off |
| 13:36 | tcrayford | test |
| 13:55 | arj_ | a silly question, how do I undef a function in a namespace? |
| 13:56 | arj_ | ah ns-unmap |
| 13:56 | arj_ | :) |
| 13:56 | leafw_ | ,(doc ns-unmap) |
| 13:56 | clojurebot | "([ns sym]); Removes the mappings for the symbol from the namespace." |
| 14:02 | hamza | it seems that assoc adds to the beginning of the map is there a way to get it to add to the end of a map, |
| 14:02 | hamza | ,(assoc (assoc {:a :b} :c :d) :e :f) |
| 14:02 | clojurebot | {:e :f, :c :d, :a :b} |
| 14:02 | hamza | i am trying to get {:a :b :c :d :e :f} |
| 14:03 | Chousuke | maps are unordered |
| 14:03 | hamza | i am trying to calculate a SHA1 hash and i need to keep the order in order to get a correct hash |
| 14:03 | Chousuke | there's sorted-map though. |
| 14:04 | hamza | ,(doc sorted-map) |
| 14:04 | clojurebot | "([& keyvals]); keyval => key val Returns a new sorted map with supplied mappings." |
| 14:04 | hamza | what does it sort based on? |
| 14:04 | hamza | keys? |
| 14:04 | Chousuke | yeah. |
| 14:06 | hamza | isn't it not possible even if i am going to use it once? i won't add or remove anything it has to keep order once.. |
| 14:11 | fliebel | What is the use of using defn- or starting function names with '-'? http://www.fatvat.co.uk/2009/05/clojure-and-robocode.html |
| 14:12 | the-kenny | fliebel: - is the default prefix for :gen-class to generate java-functions, defn- creates private functions |
| 14:20 | alexyk | somnium: ping |
| 14:21 | jasapp | alexyk: congomongo trouble? |
| 14:23 | alexyk | jasapp: I'm just wondering how to serialize joda DateTime |
| 14:24 | jasapp | ahh |
| 14:25 | jasapp | that's funny, I'm working on saving dates right now |
| 14:26 | alexyk | jasapp: well, it eats java.util.Date, apparently |
| 14:26 | jasapp | I'm taking the lazy route, and just converting them to ms |
| 14:26 | jasapp | hmm |
| 14:26 | alexyk | jasapp: my original was even lazier, with string |
| 14:27 | jasapp | nice |
| 14:28 | jasapp | joda takes java.util.Date, or ClojureDBObject takes it? |
| 14:28 | twbray | Wondering how to use FileInputStream.read since it wants a byte[] argument... |
| 14:28 | alexyk | jasapp: the beauty of it you can inspect in shell. congomongo eats Date |
| 14:29 | stuartsierra | twbray: (make-array Byte/TYPE *buffer-size*) |
| 14:29 | twbray | stuartsierra coolio, thanks |
| 14:31 | hamza | how can i force this to evaluate? |
| 14:31 | hamza | ,(str (take 2 (repeat "0")) "asd") |
| 14:31 | clojurebot | "clojure.lang.LazySeq@9c1asd" |
| 14:32 | stuartsierra | hamza (apply str ...) |
| 14:32 | hamza | ,(apply str (take 2 (repeat "0")) "asd") |
| 14:32 | clojurebot | "clojure.lang.LazySeq@9c1asd" |
| 14:33 | KirinDave_ | Uh |
| 14:33 | KirinDave_ | ,(apply str (take 2 (repeat "O"))) |
| 14:33 | clojurebot | "OO" |
| 14:33 | stuartsierra | ,(str (apply str (take 2 (repeat "0"))) "asd") |
| 14:33 | clojurebot | "00asd" |
| 14:33 | hamza | oh ok threat them seperatly.. |
| 14:33 | hamza | then |
| 14:33 | KirinDave_ | Unless you want to explicitly conj them. |
| 14:33 | KirinDave_ | Yes. |
| 14:33 | stuartsierra | yes, for 'apply' only the last argument is treated as a sequential thing |
| 14:35 | twbray | Urgh, turns out my attempt to be clever using NIO's mmap-like interface in the Wide Finder code was entirely self-defeating. The Java platform rocks... except when it doesn't. |
| 14:35 | twbray | FileInputStream.read is like 5* faster. |
| 14:35 | bitbckt | haha |
| 14:39 | gbt | you live and learn. or in my case, live, learn, forget then recur |
| 14:51 | chouser | twbray: I've had some success speeding up regex on large files via mmap. However it's a bit of a cheat because of character encoding. |
| 14:52 | chouser | hamza: did you look at using a vector of pairs instead of trying to find an order-preserving map? |
| 14:59 | alexyk | how do you create a java.util.Date out of a string? |
| 15:00 | rhickey | ,(java.util.Date. " Wed Dec 02 14:59:31 EST 2009") |
| 15:00 | clojurebot | #<Date Wed Dec 02 11:59:31 PST 2009> |
| 15:00 | hamza | chouser: i wrote the order as meta data then when calculating hash iterate using that order if meta data is availible. |
| 15:01 | chouser | mabes: ok. |
| 15:01 | mabes | chouser: ? |
| 15:01 | chouser | mabes: uh. sorry, bad tab completion. |
| 15:01 | chouser | hamza: ok. |
| 15:01 | chouser | :-) |
| 15:01 | alexyk | rhickey: thx! |
| 15:01 | ordnungswidrig | alexyk: you should use DateFormat to parse the Date |
| 15:01 | mabes | lol |
| 15:02 | ordnungswidrig | alexyk: java.text.DateFormat |
| 15:02 | alexyk | ok |
| 15:03 | ordnungswidrig | rhickey: the constructor java.lang.Date(String) is deprecated since 1.1 :-) |
| 15:03 | ordnungswidrig | rhickey: that was really oldschool. |
| 15:03 | hiredman | ordnungswidrig: SimpleDateFormat |
| 15:03 | ordnungswidrig | hiredman: yes, or like that. |
| 15:04 | hiredman | DateFormat is pretty ridiculous |
| 15:04 | hiredman | huh, someone opened a google code issue |
| 15:04 | chouser | heh |
| 15:05 | chouser | oh, I even noticed -- didn't realize I was reading from google code instead of assembla. |
| 15:05 | hamza | guys, how would you turn this in to string? |
| 15:05 | hamza | ,(interleave (repeat \%) (partition 2 "0221caf96a")) |
| 15:05 | clojurebot | (\% (\0 \2) \% (\2 \1) \% (\c \a) \% (\f \9) \% (\6 \a)) |
| 15:06 | hamza | "%02%21%ca..." |
| 15:08 | chouser | ,(apply str (map (fn [[a b]] (str "%" a b)) (partition 2 "0221caf96a"))) |
| 15:08 | clojurebot | "%02%21%ca%f9%6a" |
| 15:08 | hiredman | ,(->> "0221caf96a" (partition 2) (apply concat) (interleave (repeate \%)) (apply str)) |
| 15:08 | clojurebot | java.lang.Exception: Unable to resolve symbol: repeate in this context |
| 15:08 | hiredman | ,(->> "0221caf96a" (partition 2) (apply concat) (interleave (repeat \%)) (apply str)) |
| 15:08 | clojurebot | "%0%2%2%1%c%a%f%9%6%a" |
| 15:09 | hiredman | uh |
| 15:09 | chouser | you want apply concat after interleave |
| 15:10 | chouser | ,(->> "0221caf96a" (partition 2) (interleave (repeat "%")) (apply concat) (apply str)) |
| 15:10 | hiredman | ,(->> "0221caf96a" (partition 2) (interleave (repeat \%)) flatten (apply str)) |
| 15:10 | clojurebot | "%02%21%ca%f9%6a" |
| 15:10 | clojurebot | "%02%21%ca%f9%6a" |
| 15:10 | rhickey | so, one problem I have with plan B before is, when people leave out 'this', and get an error, they'll have no idea what to put where |
| 15:11 | rhickey | those explicit top-level thises kind of float around |
| 15:12 | chouser | 4 top-level args is a lot, I guess. Rivals a fully-loaded defn |
| 15:13 | rhickey | also when you think about it, the proper place for this in deftype is (first) with the fields |
| 15:13 | rhickey | those are the enclosing local bindings |
| 15:14 | chouser | hm |
| 15:14 | chouser | ,(loop [[a b & r] "0221caf96a" c ""] (if a (recur r (str c \% a b)) c)) |
| 15:14 | clojurebot | "%02%21%ca%f9%6a" |
| 15:14 | rhickey | I'm not advocating that |
| 15:16 | chouser | (deftype Foo this [a b c]) can be optional without [], though that strands reify a bit |
| 15:16 | rhickey | but it looks like 2 binding lists in a row |
| 15:17 | alexyk | do folks know why joda DateTime is preferable to java.util.Date, or is it? |
| 15:17 | rhickey | top-level this makes a lot more sense in refiy than in deftype - in reify there is an object in play, deftype is a spec for a set of objects |
| 15:17 | chouser | alexyk: immutable values and apparently handles the subtle complexities of dates with less fail |
| 15:18 | chouser | rhickey: you want implicit this for deftype, don't you. |
| 15:18 | rhickey | yeah |
| 15:18 | rhickey | or explicit arg everywhere |
| 15:19 | rhickey | (reify this ...) is a lot like (fn this ... |
| 15:19 | chouser | top-level for reify is better than, for example, what proxy does now. |
| 15:20 | chouser | because of no closures, deftype will hardly ever be nested at all -- just in do forms from macros. |
| 15:20 | rhickey | I'm really surprised we haven't seen more of the thisfn problem with proxy |
| 15:21 | rhickey | chouser: right |
| 15:21 | chouser | I guess you could 'let' proxy's this if you really needed to. Not sure I've *ever* put a proxy in a proxy though. |
| 15:21 | rhickey | but I want people to be able to nest reify in macros without worry |
| 15:21 | rhickey | chouser: it would come from a proxy-emitting macro |
| 15:21 | chouser | ah |
| 15:22 | rhickey | that was the thisfn problem, thisfn was implcit this in fn, then macros would emit hidden nested fns, and thisfn meant something not apparent |
| 15:23 | rhickey | (refiy ... (foo [] (bar this)) ;bar emitting reify would redefine 'this' |
| 15:24 | chouser | according to the IRC logs, some of my earliest comments here were advocating more arc-like anaphoric macros |
| 15:24 | rhickey | I'm committed to not following proxy here |
| 15:24 | rhickey | anaphora == bad |
| 15:25 | jasapp | why do you say it's bad? |
| 15:26 | chouser | names that show up without declaration and change their value at various scopes implictly can get very confusing very fast. |
| 15:26 | Chousuke | almost like mutable variables :o |
| 15:27 | chouser | and although implicit 'this' on unnested deftypes isn't clearly less bad... |
| 15:28 | jasapp | chouser: I see |
| 15:28 | chouser | *is* clearly less bad |
| 15:29 | michaeljaaka | hi, how to get sequence droping x first elements ? |
| 15:29 | chouser | (doc drop) |
| 15:29 | clojurebot | "([n coll]); Returns a lazy sequence of all but the first n items in coll." |
| 15:29 | michaeljaaka | ok :) |
| 15:31 | michaeljaaka | (doc nthnext) |
| 15:31 | clojurebot | "([coll n]); Returns the nth next of coll, (seq coll) when n is 0." |
| 15:32 | michaeljaaka | what is the difference between drop and nthnext ? |
| 15:33 | Chousuke | drop uses rest? |
| 15:33 | chouser | huh. I guess that's it. drop is fully lazy -- doesn't do anything at all when you first call it. |
| 15:34 | chouser | nthnext eagerly walks and returns nil if the result is empty |
| 15:34 | rhickey | you can pun with *next |
| 15:43 | chouser | hehe. Java 7 using #() as syntax for closures? |
| 15:43 | rhickey | isn't that great? not final though |
| 15:45 | pjb3 | So I have a question about hot-deploying code changes to a running clojure app |
| 15:45 | pjb3 | let's say I have a multi-threaded clojure app running |
| 15:45 | pjb3 | and I'm able to connect to it via some sort of remote repl |
| 15:45 | the-kenny | (slime :p) |
| 15:45 | pjb3 | would it be thread safe to re def a function in that repl? |
| 15:46 | the-kenny | pjb3: I think so. I didn't have any problems |
| 15:46 | pjb3 | yeah, I'm assuming you could |
| 15:47 | pjb3 | I guess the only weirdness you could have is that while another thread is in process, it could execute the old function once and then the new function, right? |
| 15:48 | alexyk | somnium: ping |
| 15:48 | pjb3 | So I guess the question I'm asking is what happens when you re-define a root binding in threads that may be in process already using that binding? |
| 15:48 | the-kenny | pjb3: Yeah, it will execute the old function until it's finished and call the new function next time. That's what I'm experiencing |
| 15:49 | pjb3 | what's the scope of "finished" though? |
| 15:49 | hiredman | the lexical scope of the function |
| 15:50 | hiredman | although, for example, recur will recur to the old function |
| 15:50 | pjb3 | oh, so if you have a function that calls foo, sleeps for 10 seconds, then calls foo again |
| 15:50 | hiredman | recur being an intra function construct |
| 15:50 | pjb3 | and you redefine foo during that 10 seconds |
| 15:50 | pjb3 | the second call to foo will be the old one |
| 15:50 | hiredman | no |
| 15:51 | rhickey | pjb3: currently every use of a defn var, i.e. each call, pulls from the var and will see the latest. In the new branch is code that will provide another flavor of 'direct' linking that would require reload in order to see new version |
| 15:52 | defn | the number of nick hilights I receive in this channel is staggering |
| 15:53 | chouser | heh |
| 15:53 | pjb3 | rhickey: ok, so in general, re-defining a function that could be being used by multiple threads should be safe though? |
| 15:53 | pjb3 | for the purposes of real-time code updating |
| 15:53 | hiredman | (defn foo [] (prn 1)) (future (foo) (Thread/sleep 10000) (foo)) (Thread/sleep 1000) (defn foo [] (prn 2)) |
| 15:54 | rhickey | safe - they would never see a broken reference to a fn or a broken fn definition |
| 15:54 | hiredman | the only issue is if you wanted to update several functions at once |
| 15:54 | hiredman | defrefn |
| 15:54 | pjb3 | hiredman: sure, I could see where that would be a problem |
| 15:55 | hiredman | fortunately sticking fns in refs is easy and painless |
| 15:55 | chouser | ooh, a var-ref-fn |
| 15:58 | rhickey | you could have transactionally updatable sets of functions, but you could only call them in transactions if you wanted to only see consistent sets |
| 15:59 | hiredman | oh |
| 15:59 | hiredman | right |
| 15:59 | hiredman | hmmm |
| 16:00 | akuaku | hi everyone |
| 16:00 | akuaku | I've been playing around with Clojure for some months |
| 16:01 | akuaku | is there some Document/Page with some info on currently planned features |
| 16:01 | akuaku | like this "new" branch? |
| 16:01 | Chousuke | akuaku: on assembla |
| 16:01 | hiredman | ~assembla |
| 16:01 | clojurebot | assembla is http://www.assembla.com/spaces/clojure |
| 16:01 | the-kenny | akuaku: There's assembla |
| 16:02 | the-kenny | akuaku: and the irc-logs from this channel :) |
| 16:02 | akuaku | ah, nice |
| 16:03 | alexyk | rhickey: thanks for the gist http://gist.github.com/247172, very clear demo of styles |
| 16:03 | akuaku | the IRC seems to be the design documents ,-) |
| 16:04 | rhickey | alexyk: yw |
| 16:05 | hiredman | ~logs |
| 16:05 | clojurebot | logs is http://clojure-log.n01se.net/ |
| 16:07 | hamza | doesn't contains? work on vectors? |
| 16:07 | hamza | ,(contains? ["V" "a"] "V") |
| 16:07 | clojurebot | false |
| 16:08 | hamza | why false? |
| 16:09 | Chousuke | ~contains? |
| 16:09 | clojurebot | contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use the java method .contains |
| 16:09 | technomancy | hamza: contains? checks for set membership |
| 16:09 | technomancy | set-like |
| 16:09 | hiredman | did you read the docstring for contains? |
| 16:09 | hiredman | ,(doc contains?) |
| 16:09 | clojurebot | "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'." |
| 16:09 | Chousuke | Seriously, this is probably the #1 FAQ :D |
| 16:10 | hiredman | nah |
| 16:10 | hiredman | really? |
| 16:10 | technomancy | feels like it recently |
| 16:10 | technomancy | possibly even beating out "map is LAZY." |
| 16:18 | alexyk | if I write ocaml-style, let ... in let ... in, it looks like: (let [...] (let [...] ... )) -- I have to keep track of all closing parens. Is there a way not to pile them in the back? |
| 16:19 | hiredman | alexyk: clojure's let is sequential anyway |
| 16:19 | djork | hmm, you know scriptjure is giving me ideas |
| 16:19 | djork | like writing ObjC from Clojure |
| 16:19 | alexyk | ah, should I just have one let? |
| 16:19 | hiredman | so there is really no point to nesting let like that |
| 16:20 | hiredman | alexyk: yes |
| 16:20 | akuaku | ,(let [x 5, x (+ 5 x)] x) |
| 16:20 | clojurebot | 10 |
| 16:20 | alexyk | (let [x blah y f(x) z g(y]) right |
| 16:20 | alexyk | niceee |
| 16:22 | chouser | but not actually f(x) :-) |
| 16:23 | akuaku | all this new stuff from "new" won't be in 1.1, am i right? |
| 16:23 | akuaku | kinda scary seeing a language changing so fast ;-) |
| 16:24 | alexyk | (f x), granted :) |
| 16:24 | chouser | akuaku: not in 1.1: correct. scary: of course not! |
| 16:26 | akuaku | well i am hesitating to try "new", are there some backwards incompatible changes? |
| 16:27 | chouser | akuaku: I can't think of any. But if you've been on 1.0, master has several nice enhancements you can enojoy without the volatility of the features in 'new' |
| 16:32 | chouser | I think the only things that had to change in contrib have been naming conflicts, resolved with less promiscuous :use clauses. |
| 16:32 | akuaku | c.c.test-is is gone ??? |
| 16:33 | chouser | akuaku: it's clojure.test now |
| 16:33 | akuaku | chouser: it's official now, awesome |
| 16:33 | chouser | there are some breaking changes there |
| 16:34 | chouser | 'are' has a new syntax |
| 16:35 | akuaku | i've used it only twice |
| 16:36 | akuaku | it runs! (with 'are' commented out) |
| 16:36 | ohpauleez | djork: re: writing ObjC from in Clojure: It's easier when you have a Clojure in Clojure |
| 16:36 | djork | hmm, what do you mean? |
| 16:36 | ohpauleez | look at PyPy: Because you have a nice framework for accessing all the steps in reading and evaling |
| 16:36 | alexyk | say I have a huge map like, {:a 1 :b 2} and want a fast but lazy way to feed it to a database as submaps, {:a 1} {:b 2}, how can I split it nicely? |
| 16:36 | ohpauleez | and you can use Clojure to change it |
| 16:36 | djork | hmm |
| 16:36 | ohpauleez | you can do what PyPy does |
| 16:37 | ohpauleez | Any language frontend to any language backend |
| 16:37 | ohpauleez | or platform-backend |
| 16:37 | djork | either way, anything that saves me from writing heaps more ObjC |
| 16:37 | akuaku | chouser: you're in the core team, or just using bleeding-edge? |
| 16:37 | hiredman | alexyk: seq on a Map will return a sequence of map entries |
| 16:38 | chouser | I think the core team is rhickey. :-) |
| 16:38 | hiredman | ,(seq {:a 1 :b 2}) |
| 16:38 | clojurebot | ([:a 1] [:b 2]) |
| 16:38 | alexyk | hiredman: yeah, but they're vectors and I need maps. |
| 16:38 | hiredman | alexyk: uh |
| 16:38 | alexyk | and I want the conversion to be fast |
| 16:38 | hiredman | ,(map (partial apply hash-map) {:a 1 :b 2}) |
| 16:38 | clojurebot | ({:a 1} {:b 2}) |
| 16:38 | hiredman | ,(map (partial apply array-map) {:a 1 :b 2}) |
| 16:38 | clojurebot | ({:a 1} {:b 2}) |
| 16:39 | hiredman | etc |
| 16:40 | chouser | ,(use '[clojure.contrib.seq-utils :only (partition-all)]) |
| 16:40 | clojurebot | nil |
| 16:40 | chouser | ,(map #(into {} %) (partition-all 3 {1 2 3 4 5 6 7 8 9 10})) |
| 16:40 | clojurebot | ({1 2, 3 4, 5 6} {7 8, 9 10}) |
| 16:40 | ohpauleez | I would use into like chouser, but I like hiredman's approach. |
| 16:41 | hiredman | it depends what you mean by sub map |
| 16:41 | alexyk | chouser: is your thing faster? :) hiredman: submap is exactly a key-value pair converted to a single-key map |
| 16:41 | hiredman | each entry it to its own map, or partition the map |
| 16:41 | ohpauleez | is there a good reason for partitioning it alexyk? |
| 16:42 | chouser | I have no idea which is faster. |
| 16:42 | alexyk | ohpauleez: feeding to congomongo for storage |
| 16:42 | chouser | I just assumed you want more than one key/val per map. |
| 16:43 | alexyk | hiredman: we're really getting a vector back, correct? |
| 16:43 | chouser | ,(class (first {:a 1})) |
| 16:43 | clojurebot | clojure.lang.MapEntry |
| 16:43 | ohpauleez | I would just make the call treat each key and value separate |
| 16:44 | hiredman | ,(ancestors clojure.lang.MapEntry) |
| 16:44 | clojurebot | #{java.util.concurrent.Callable clojure.lang.ILookup java.lang.Object java.util.RandomAccess clojure.lang.IMeta clojure.lang.APersistentVector java.lang.Runnable clojure.lang.Associative clojure.lang.Sequential java.util.Collection java.util.List clojure.lang.Obj clojure.lang.Indexed clojure.lang.IMapEntry java.io.Serializable clojure.lang.Streamable clojure.lang.AMapEntry java.lang.Iterable clojure.lang.IPersistentStack |
| 16:44 | chouser | heh |
| 16:44 | hiredman | so you are getting a lot of things |
| 16:45 | alexyk | I meant clojurebot prints the result of hiredman's (map ... (seq <map>) as (...), but it's a [...] in fact |
| 16:45 | alexyk | or is it |
| 16:45 | chouser | ,(sort (map #(symbol (.getSimpleName %)) (ancestors clojure.lang.MapEntry))) |
| 16:45 | clojurebot | java.lang.RuntimeException: java.lang.IllegalArgumentException: No matching field found: getSimpleName for class clojure.lang.Keyword |
| 16:46 | hiredman | lousy generics |
| 16:46 | chouser | ,(sort (map #(symbol (.getSimpleName %)) (supers clojure.lang.MapEntry))) |
| 16:46 | clojurebot | (AFn AMapEntry APersistentVector Associative Callable Collection Comparable Counted Entry IFn ILookup IMapEntry IMeta IObj IPersistentCollection IPersistentStack IPersistentVector Indexed Iterable List Obj Object RandomAccess Reversible Runnable Seqable Sequential Serializable Streamable) |
| 16:46 | chouser | It's an Obj *and* and Object. Also, an IObj. |
| 16:47 | hiredman | alexyk: the print output looks like a vector because clojure.lang.MapEntry is a Vector |
| 16:47 | hiredman | but it is also all those other things |
| 16:47 | hiredman | the print representation just comes from Vector |
| 16:49 | alexyk | are these all Java classes in ancestors? I thought Clojure is not OO :) |
| 16:50 | eno | lots are interfaces |
| 16:51 | rhickey | won't it be great when they are all protocols? |
| 16:51 | hamza | ~line-seq |
| 16:51 | clojurebot | I don't understand. |
| 16:51 | hiredman | just dreamy |
| 16:52 | chouser | ,(map count ((juxt filter remove) #(.isInterface %) (supers clojure.lang.MapEntry))) |
| 16:52 | eno | rhickey: where can I find docs/notes on protocol? |
| 16:52 | clojurebot | (24 5) |
| 16:52 | hamza | what was the command to get the url to func definition? |
| 16:52 | rhickey | https://www.assembla.com/wiki/show/clojure/Protocols |
| 16:52 | eno | thx |
| 16:52 | rhickey | https://www.assembla.com/wiki/show/clojure/Datatypes |
| 16:53 | hiredman | ~def + |
| 16:53 | hiredman | ~source add |
| 16:54 | ska2342 | hi, would a link to a new article on Clojure in the German Linux Magazin (available online) be worth a post to the group? (and a shameless self-plug it would be :-) |
| 16:54 | hamza | ~def line-seq |
| 16:54 | hamza | hiredman: thanks.. |
| 16:55 | hiredman | that was new |
| 16:55 | schaf5 | Hi, I want to use slime and swank-clojure from elpa, but when starting I get an error: http://gist.github.com/247640 |
| 16:56 | schaf5 | sorry, closed the client.. |
| 16:57 | schaf5 | did someone look at the swank/slime/clojure problem I posted? |
| 16:58 | schaf5 | I am somewhat lost as to what causes that |
| 16:58 | ska2342 | schaf5: yes, and I try to remember what I did when I saw that last, but I never used ELPA. |
| 16:59 | ska2342 | what is your value of swank-clojure-binary in emacs, do you use it at all? |
| 16:59 | ska2342 | alternatively what is swank-clojure-java-path? |
| 17:02 | schaf5 | ska2342: I think that is the problem, I will look into customize and come back |
| 17:03 | ska2342 | schaf5: better try my username at googles mail if you want to really reach me, I'm not much of a chatter |
| 17:04 | schaf5 | ska2342: thanks :) |
| 17:06 | alexyk | how do you lazily chunk a seq? |
| 17:06 | alexyk | into chunks of size n |
| 17:06 | chouser | ,(parition 3 (range 10)) |
| 17:06 | drewr | ,(partition 5 (range 20)) |
| 17:06 | alexyk | ah, partition-all right? |
| 17:06 | clojurebot | java.lang.Exception: Unable to resolve symbol: parition in this context |
| 17:06 | clojurebot | ((0 1 2 3 4) (5 6 7 8 9) (10 11 12 13 14) (15 16 17 18 19)) |
| 17:06 | schaf5 | ska2342: I have not set swank-clojure-binary |
| 17:06 | chouser | :-( |
| 17:07 | chouser | heh. drewr wins |
| 17:07 | alexyk | chouser: I saw you imported partition-all above |
| 17:07 | drewr | he shoots he scores |
| 17:07 | schaf5 | ska2342: I have set the swank-clojure-classpath to point somewhere where clojure.jar and clojure-contrib.jar reside |
| 17:07 | drewr | alexyk: that allows your seq to not be evenly divisible |
| 17:08 | ska2342 | schaf5: could you send or post your full emacs config concerning swank, slime and clojure-mode? |
| 17:08 | alexyk | drewr: partition-all vs partition? |
| 17:08 | drewr | ,(partition 3 (range 10)) |
| 17:08 | clojurebot | ((0 1 2) (3 4 5) (6 7 8)) |
| 17:08 | drewr | alexyk: yes, see how partition chops off the 9 |
| 17:08 | alexyk | that's bad |
| 17:08 | drewr | ,(partition-all 3 (range 10)) |
| 17:08 | clojurebot | ((0 1 2) (3 4 5) (6 7 8) (9)) |
| 17:09 | alexyk | and that's good :) |
| 17:10 | alexyk | why would anybody need the original partition... |
| 17:10 | ska2342 | schaf5: what is swank-clojure-cmd in Emacs? |
| 17:11 | chouser | alexyk: I think the argument is that partition-all requires the consumer of the seq to handle differently-sized sub-seqs, which can be cumbersome. |
| 17:13 | chouser | ,(map (partial apply rem) (partition-all 2 (range 11))) |
| 17:13 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$rem |
| 17:13 | chouser | ,(map (partial apply rem) (partition 2 (range 11))) |
| 17:13 | clojurebot | (0 2 4 6 8) |
| 17:14 | ska2342 | schaf5: AFAI understand, the auto-install adds clojure to slime-lisp-implementations using swank-clojure-cmd. For me (non ELPA) that slime variable contains the shell script I use to start Clojure, from shell as well as emacs |
| 17:16 | ska2342 | would someone be interested in a link to a new (German) article which was published today in Linux Magazin (and which I wrote, so I don't want to shamelessly post to the group)? |
| 17:16 | schaf5 | http://gist.github.com/247657 |
| 17:16 | schaf5 | here is my config atm |
| 17:17 | schaf5 | ska2342: I did not auto-install because I wanted the 1.1 snapshot |
| 17:17 | chouser | ska2342: perfectly fine here. probably ok on the google group too. Though if you post to reddit I think it gets picked up by the clojure pipe. |
| 17:18 | ska2342 | schaf5: huh? I thought we're talking about an ELPA install here? I will happily sent you my setup via mail if you contact me |
| 17:18 | ska2342 | OK, here goes... criticism welcome http://www.linux-magazin.de/Heft-Abo/Ausgaben/2010/01/Nebenlaeufig |
| 17:20 | chouser | the-kenny: the key is if you want the data in question to participate in equality tests or not. if not, must be metadata. if so, must not be. |
| 17:21 | ska2342 | the-kenny: think of it as kind of orthogonal to the original/payload data. |
| 17:21 | chouser | heh. google translate decided to fix up the word order of the clojure examples. |
| 17:21 | chouser | println user => ( "Hello World") |
| 17:21 | akuaku | ska2342: nice article |
| 17:21 | the-kenny | ska2342: I'll read this, looks cool :) |
| 17:22 | schaf5 | ska2342: I send you a mail |
| 17:22 | the-kenny | chouser, ska2342: hm... tank you, I'll think about that |
| 17:22 | chouser | the-kenny: I know that's hardly a concrete example. I have a friend who bugs me for better examples of metadata fairly regularly |
| 17:23 | ska2342 | schaf5: (or "send" "sent") |
| 17:23 | chouser | the-kenny: twiw, metadata is relatively rarely used in the bulk of the code I've written. |
| 17:23 | chouser | fwiw |
| 17:24 | ska2342 | the-kenny: Perls and Rubys "tainted" feature is often mentioned |
| 17:24 | the-kenny | chouser: Yes, same for my code |
| 17:24 | schaf5 | ska2342: true |
| 17:24 | alexyk | ok I partition into chunks, and need to insert each into a db. E.g., I try: |
| 17:24 | alexyk | (doseq #(mass-insert! :mis %) (partition-all 18 (map (partial apply hash-map) (for [x (range 10) y (range 10)] [x y])))) |
| 17:24 | alexyk | get: java.lang.IllegalArgumentException: doseq requires a vector for its binding (NO_SOURCE_FILE:0) |
| 17:25 | alexyk | should I convert each chunk into a vector or use something other than doseq? |
| 17:26 | akuaku | i've kinda saw metadata as generalized annotations |
| 17:26 | akuaku | mostly used by the compiler |
| 17:26 | alexyk | ah I probably swapped the order |
| 17:26 | ohpauleez | akuaku: metadata is more than that |
| 17:27 | ohpauleez | it allows you to do programatic bookkeeping |
| 17:27 | ohpauleez | and a host of other things |
| 17:27 | alexyk | but it still wants a vector... |
| 17:27 | akuaku | well generalized annotations ;-) |
| 17:27 | ska2342 | schaf5: please try again |
| 17:28 | schaf5 | ska2342: is at googlemail.com right? |
| 17:28 | alexyk | ok got it: (doseq [x (partition-all 18 (map (partial apply hash-map) (for [x (range 10) y (range 10)] [x y])))] (println (count x))); are there other ways to do it? |
| 17:28 | ska2342 | schaf5: true |
| 17:29 | schaf5 | ska2342: I sent it there and got no error return mail |
| 17:32 | alexyk | is there a way to kill the current computation in repl without killing the whole repl? |
| 17:33 | ohpauleez | not that I know of |
| 17:33 | ohpauleez | if you use Jline or something like it, you'll have a history of your REPL though |
| 17:34 | ohpauleez | alexyk: did you do repeat or repeatedly? :) |
| 17:34 | alexyk | ohpauleez: no... I data-mine Twitter :) |
| 17:34 | ohpauleez | ahhh |
| 17:34 | alexyk | and if I invoke a thing which turns out too slow, it keeps chewing on it |
| 17:34 | alexyk | can you serialize a hash-map? |
| 17:35 | hiredman | ,(prn (into (hash-map) {:a 1 :b 2})) |
| 17:35 | clojurebot | {:a 1, :b 2} |
| 17:37 | djork | ,(seq? []) |
| 17:37 | clojurebot | false |
| 17:37 | djork | intriguing |
| 17:37 | akuaku | ,(seq? [1]) |
| 17:37 | clojurebot | false |
| 17:37 | hiredman | vectors are not sequences |
| 17:38 | djork | no, but lists are? |
| 17:38 | djork | ,(seq? '()) |
| 17:38 | clojurebot | true |
| 17:38 | akuaku | ,(sequential? []) |
| 17:38 | clojurebot | true |
| 17:38 | alexyk | I mean serialize into a byte stream |
| 17:38 | djork | I see |
| 17:39 | hiredman | ,(.getBytes (prn-str (into (hash-map) {:a 1 :b 2}))) |
| 17:39 | clojurebot | #<byte[] [B@e046e> |
| 17:40 | akuaku | ,(ancestors (class (hash-map))) |
| 17:40 | clojurebot | #{java.util.concurrent.Callable clojure.lang.IEditableCollection clojure.lang.ILookup java.lang.Object clojure.lang.IMeta java.lang.Runnable clojure.lang.Associative clojure.lang.Obj java.io.Serializable java.lang.Iterable clojure.lang.Counted clojure.lang.IFn :clojure.contrib.generic/any java.util.Map clojure.lang.APersistentMap clojure.lang.Seqable clojure.lang.IObj clojure.lang.IPersistentCollection clojure.lang.AFn cl |
| 17:40 | alexyk | hiredman: so prn serializes into a string... I guess sexps have their use :) |
| 17:40 | chouser | alexyk: clojure-contrib repl-utils add-break-thread! |
| 17:41 | akuaku | alexyk: you can use the java way too |
| 17:41 | alexyk | chouser: I guess it's a function :) |
| 17:42 | akuaku | it implements Serializable |
| 17:42 | alexyk | hiredman: you don't really need the (into (hash-map) ...) there do you? |
| 17:42 | akuaku | small map literals arent hash-maps |
| 17:43 | akuaku | ,(class {1 2}) |
| 17:43 | clojurebot | clojure.lang.PersistentArrayMap |
| 17:43 | alexyk | hiredman: andd it's the same as (into {} ...) is it? |
| 17:43 | alexyk | ah no |
| 17:44 | alexyk | ,(class (into (hash-map) {:a 1 :b 2})) |
| 17:44 | clojurebot | clojure.lang.PersistentArrayMap |
| 17:44 | alexyk | ,(class (into {} {:a 1 :b 2})) |
| 17:44 | clojurebot | clojure.lang.PersistentArrayMap |
| 17:44 | alexyk | so? |
| 17:45 | akuaku | alexyk: does it matter in your app? |
| 17:45 | alexyk | akuaku: I have a huge map, just want to understand why hiredman used (into (hash-map) ...) on a literal |
| 17:46 | alexyk | my map is generated from data though |
| 17:46 | akuaku | alexyk: ArrayMaps get convertet into HashMaps when they get bigger then 8 pairs |
| 17:47 | alexyk | ah ok |
| 17:47 | alexyk | but above (into (hash-map) ...) is doing nothing |
| 17:47 | alexyk | apparently |
| 17:47 | akuaku | ,(class (hash-map)) |
| 17:47 | clojurebot | clojure.lang.PersistentArrayMap |
| 17:48 | hiredman | alexyk: you specified hash-map |
| 17:48 | akuaku | (clojure.lang.PersistentHashMap.) |
| 17:48 | hiredman | so I was specificly making a hash-map |
| 17:48 | akuaku | ,(clojure.lang.PersistentHashMap.) |
| 17:48 | clojurebot | java.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.PersistentHashMap |
| 17:49 | akuaku | ,(clojure.lang.PersistentHashMap/create nil) |
| 17:49 | clojurebot | java.lang.IllegalArgumentException: More than one matching method found: create |
| 17:50 | akuaku | ,(class clojure.lang.PersistentHashMap/EMPTY) |
| 17:50 | clojurebot | clojure.lang.PersistentHashMap |
| 17:50 | chouser | the behavior of array-maps and hash-maps changed a while ago. literals used to follow different rules |
| 17:52 | akuaku | so now the (size <= 8) -> ArrayMap rule is consistent? |
| 17:52 | akuaku | i think i remember that (hash-map) created real hashmaps |
| 17:58 | chouser | ,(class (apply array-map (range 16))) |
| 17:58 | clojurebot | clojure.lang.PersistentArrayMap |
| 17:58 | chouser | ,(class (apply array-map (range 100))) |
| 17:58 | clojurebot | clojure.lang.PersistentArrayMap |
| 17:58 | chouser | ,(class (assoc (apply array-map (range 16)) :x :y)) |
| 17:58 | clojurebot | clojure.lang.PersistentArrayMap |
| 17:59 | chouser | ,(class (assoc (apply array-map (range 32)) :x :y)) |
| 17:59 | clojurebot | clojure.lang.PersistentHashMap |
| 17:59 | _ato | ,(class (assoc (apply array-map (range 31)) :x :y)) |
| 17:59 | clojurebot | java.lang.ArrayIndexOutOfBoundsException: 31 |
| 17:59 | _ato | ,(class (assoc (apply array-map (range 30)) :x :y)) |
| 17:59 | clojurebot | clojure.lang.PersistentHashMap |
| 17:59 | _ato | ,(class (assoc (apply array-map (range 18)) :x :y)) |
| 17:59 | clojurebot | clojure.lang.PersistentHashMap |
| 17:59 | chouser | array-map and hash-map always return their appropriate type. don't rely on the concrete return value of assoc or dissoc, ever. |
| 18:15 | djork | objclj is underway |
| 18:18 | tcrayford | is that clojure on obj-c? |
| 18:20 | mtm | djork: are you going to host that on github? |
| 18:20 | djork | yeah |
| 18:20 | djork | no |
| 18:20 | mtm | sweet |
| 18:21 | mtm | oops |
| 18:21 | djork | it's objc generation from clojure |
| 18:22 | mtm | is this to target iPhone specificaly or OS X in general? or does that even matter? |
| 18:23 | djork | iPhone for now |
| 18:23 | djork | but not specifically |
| 18:23 | djork | just want to gen classes and headers and all that jazz |
| 18:23 | djork | macros for templating |
| 18:23 | mtm | very nice |
| 18:23 | djork | to cut down on the MOUNTAIN of code required for ObjC apps |
| 18:23 | the-kenny | s/like/likes/ |
| 18:24 | hiredman | http://gist.github.com/222974 |
| 18:25 | djork | nice |
| 18:25 | djork | might borrow a bit from that |
| 18:30 | alexyk | I get: java.lang.OutOfMemoryError: PermGen space -- when doing mass-insert! from congomongo. What does it mean? |
| 18:33 | Chousuke | that sounds like a rather nasty error :P |
| 18:33 | mtm | PermGen issues are usually related to classes not getting GCed |
| 18:37 | headius | I heart permgen errors |
| 18:38 | mtm | alexyk: was the jvm is question up for a while? do you get these problems with a freshly started jvm? |
| 18:39 | alexyk | for a while... never saw this in Scala, must be a Java proxy thing? |
| 18:39 | alexyk | you dynamic people :) |
| 18:40 | alexyk | I'm stuffing mongo db via congomongo, which uses mongo-java-driver |
| 18:40 | alexyk | I was doing a mass-insert; need to understand why would that generate a bunch of classes, -- it should "just" stick json into the DB; but perhaps mongo java generates json classes |
| 18:40 | headius | that's weird |
| 18:41 | headius | what's congomongo? |
| 18:41 | mtm | sorry, I'm clueless regarding mongo |
| 18:41 | alexyk | congomongo is clojure wrapper for mongo db by somnium |
| 18:41 | headius | I'd be surprised if an existing library caused this...it's most likely something in clojure or a clojure-based library |
| 18:41 | headius | mmm yeah |
| 18:41 | jasapp | alexyk: pretty anxious? |
| 18:42 | mtm | a brief explanation of PermGen issues: http://my.opera.com/karmazilla/blog/2007/03/13/good-riddance-permgen-outofmemoryerror |
| 18:42 | alexyk | jasapp: not really, just annoyed at how hard it is to handle a billion tweets in any way. BDB is rock-solid but stolid, mongo is new and fast but things are tricky |
| 18:42 | mtm | probably doesn't help you much though |
| 18:43 | jasapp | do you have one of those direct tweet hoses? |
| 18:43 | alexyk | yeah |
| 18:43 | alexyk | one of 'em gardenhoses |
| 18:43 | jasapp | what are you working on, if you don't mind me asking? |
| 18:44 | alexyk | data mining research in academia |
| 18:44 | alexyk | I've processed it in Scala and now try Clojure |
| 18:44 | alexyk | BDB and now Mongo |
| 18:44 | jasapp | what's giving you trouble in mongo? |
| 18:44 | headius | undeploys are a problem on all servers...doesn't seem like that's what's causing this |
| 18:45 | alexyk | although BDB allows for concurrency and I'd like to try unleashing a bunch of readers in clojure on it |
| 18:46 | alexyk | I only saw this when trying mass-insert! from congomongo |
| 18:47 | jasapp | how many tweets is breaking it? |
| 18:47 | headius | sounds like a congomongo bug, perhaps caused by some aspect of clojure (like a loop re-spinning a new class or something) |
| 18:47 | headius | anyway...ttfn |
| 18:47 | headius | good luck :) |
| 18:49 | hiredman | the only variable is the mongo db insert? |
| 18:50 | alexyk | hiredman: yep |
| 18:50 | alexyk | breaks after about 20 chunks of 10000 each, mass-insert! 'ed |
| 18:51 | hiredman | I'd drop a line to the clojure mongo db devs |
| 18:54 | jasapp | alexyk: can you post a contrived example? |
| 18:54 | alexyk | jasapp: without much data it'd be useless |
| 18:55 | hiredman | maybe run some kind of profiler |
| 18:57 | hiredman | http://wiki.caucho.com/Java.lang.OutOfMemoryError:_PermGen_space |
| 19:29 | jimduey | Hi all, first time on #clojure |
| 19:30 | cark | welcome =) |
| 19:34 | hamza | can someone tell me what is wrong with this? |
| 19:34 | hamza | ,(into-array Byte/TYPE [1 2 3 4 5 6 7 8]) |
| 19:34 | clojurebot | java.lang.IllegalArgumentException: argument type mismatch |
| 19:37 | cark | ,(into-array Byte/TYPE (map byte [1 2 3 4 5 6 7 8])) |
| 19:37 | clojurebot | #<byte[] [B@cb1594> |
| 19:37 | hamza | cool thanks.. |
| 19:37 | cark | these are Integer |
| 19:42 | chouser | (byte-array (map byte [1 2 3 4 5 6 7 8])) |
| 19:43 | hamza | if i have a 4 byte array containing a ip is it safe to cast each cell to int and concat them to build a ip? instead of using inetaddress class.. |
| 19:45 | chouser | "safe"? |
| 19:45 | Chousuke | it's probably not safe, but it will probably work if you do it right :P |
| 19:45 | hamza | hehe, i am doing it like so (interleave (map int buff) (repeat ".")) |
| 19:46 | Chousuke | I guess that would work. though are you sure the octets are in the correct order? :P |
| 19:48 | hamza | didn't thought of that buffer is in big endian, i should go back and read endianness :) |
| 19:48 | cark | ,(apply str (interpose \, (map int (into-array Byte/TYPE (map byte [200 201 202 203]))))) |
| 19:48 | clojurebot | "-56,-55,-54,-53" |
| 19:49 | cark | bytes are signed on the jvm |
| 19:49 | Chousuke | oh, right. :P |
| 19:49 | cark | i can't imagine why they did it like that but they sure did |
| 19:51 | cark | i don't have byte-array in my 1.0 clojure =/ |
| 19:51 | hiredman | (into-array Byte/TYPE ...) |
| 20:04 | technomancy | would a defmethod to make print-dup understand java.util.Dates be appropriate for core, or would that just open the floodgates to add Any Old Deprecated Class in? |
| 20:04 | rhickey | technomancy: at some point I gess Clojure should take a stand on Joda time |
| 20:06 | technomancy | isn't there a motion to add a joda-like library to the JDK though? |
| 20:07 | rhickey | technomancy: probably |
| 20:11 | technomancy | would probably be easy to write a compatibility layer between the JDK version and joda though |
| 20:11 | rhickey | technomancy: do you have a pointer to the proposal? |
| 20:11 | technomancy | I feel like now that dependency handling is less painful I'm much less reluctant to pull in joda... I resisted when I first heard of it, but things have changed. |
| 20:11 | technomancy | lemme see |
| 20:12 | defn | OpenJDK is supposedly going to have closures?? |
| 20:12 | technomancy | as of a year ago it was "unlikely to make it into JDK7": https://jsr-310.dev.java.net/servlets/ReadMsg?list=dev&msgNo=1389 |
| 20:12 | technomancy | but I don't know if that changed with the new timeline |
| 20:13 | defn | I read something today that sounded like OpenJDK7 would have closures |
| 20:13 | technomancy | I suppose this is a better link: https://jsr-310.dev.java.net/ |
| 20:15 | defn | technomancy: http://www.javaworld.com/community/?q=node/3719 |
| 20:15 | defn | see also: http://weblogs.java.net/blog/editor/archive/2009/11/19/devoxx-surprise-out-nowhere-closures-jdk-7 |
| 20:15 | cark | but the question is : will it change anything for clojure ? |
| 20:16 | defn | whether it does or not I don't know, but what I do know is that some of the justification behind this decision is that it makes the JVM play nice with other languages |
| 20:16 | defn | if they're serious about making the JVM easier to put clojure on top of, that's good news |
| 20:16 | defn | err easier to put other languages on top of* |
| 20:17 | cp2 | to me it seems as if closures will just be inlined at compile time |
| 20:17 | cp2 | but if they have "real" closures |
| 20:17 | cp2 | thent hats awesome |
| 20:17 | defn | cp2: that's how i understand it as well |
| 20:17 | defn | but at least this is progress |
| 20:17 | cp2 | mhm |
| 20:29 | notallama | a closure is just a first class function with lexical scope, right? i'm never sure, because that seems too simple to bother giving it a special name. |
| 20:42 | hiredman | notallama: a truck is just a big car |
| 20:52 | technomancy | hiredman: 4 of 7 clojure users in Seattle are named kevin |
| 20:52 | technomancy | according to the google map |
| 20:52 | danlarkin | conspiracy? |
| 20:53 | technomancy | clearly |
| 20:53 | cark | 1 out of 1 clojure users are named Sacha in belgium, that's what i call a strong correlation |
| 20:57 | hiredman | technomancy: huh |
| 20:57 | cark | hum there is a tom also |
| 20:58 | cp2 | theres a clojure map? |
| 20:59 | chouser | cp2: (hash-map) |
| 20:59 | chouser | teehee |
| 20:59 | cark | =) |
| 20:59 | cp2 | >:| |
| 21:01 | hiredman | clojurebot: google map? |
| 21:01 | clojurebot | First, out of 105000000 results is: |
| 21:01 | clojurebot | Google Maps |
| 21:01 | clojurebot | http://maps.google.com/ |
| 21:01 | hiredman | :| |
| 21:01 | hiredman | what is the url for the map? |
| 21:01 | chouser | clojurebot: clojure map? |
| 21:01 | clojurebot | clojure is the bestest programming language available. |
| 21:02 | chouser | clojurebot: google clojure map? |
| 21:02 | clojurebot | First, out of 12100 results is: |
| 21:02 | clojurebot | Clojure - data_structures |
| 21:02 | clojurebot | http://clojure.org/data_structures |
| 21:02 | chouser | see, I told you |
| 21:02 | chouser | clojurebot: google google clojure map? |
| 21:02 | clojurebot | First, out of 9630 results is: |
| 21:02 | clojurebot | Proposal: Extend behavior of hash-map - Clojure | Google Groups |
| 21:02 | clojurebot | http://groups.google.com/group/clojure/browse_thread/thread/b94b395074a4ac3d |
| 21:03 | chouser | cp2: http://tinyurl.com/ye8nzvt -- google map of clojure users |
| 21:03 | cp2 | cool stuff |
| 21:04 | cp2 | haha for a second there i thought the greek writing for greece said 'emacs' |
| 21:07 | alexyk | hiredman: ping |
| 21:07 | hiredman | technomancy: that, unfortunately, means we can never meet, because if we did, our quatum wave forms would collapse, and a scottish guy with a japanese sword will yell "THERE CAN BE ONLY ONE!" |
| 21:08 | alexyk | hiredman: PermGen again, can partial do that? (doseq [x (partition-all 10000 (map (partial apply hash-map) (seq reps)))] (.print System/err ".") (mass-insert! :reps x)) |
| 21:09 | hiredman | do what? |
| 21:09 | hiredman | the perm gen |
| 21:09 | hiredman | hmmmmm |
| 21:09 | hiredman | sounds plausable |
| 21:10 | hiredman | (def x (partial apply hash-map)) and replace (partial apply hash-map) with x |
| 21:10 | alexyk | hiredman: and def is outside doseq correct |
| 21:11 | hiredman | yes |
| 21:11 | hiredman | somewhere top level |
| 21:11 | KirinDave_ | Ugh |
| 21:11 | KirinDave_ | I love erlang but I wish I had macros right about now. |
| 21:11 | alexyk | btw clojure doesn't have a (defvar *global* ...) does it? |
| 21:11 | KirinDave_ | alexyk: I forget, how is defvar different from def? |
| 21:12 | alexyk | KirinDave_: that's what I'm implicitly asking :) |
| 21:12 | hiredman | defvar from common lisp? |
| 21:12 | KirinDave_ | Didn't it allow you to pass a default value? |
| 21:12 | alexyk | yeah |
| 21:12 | hiredman | my understanding is defvar in common lisp is for dynamic vars, correct? |
| 21:12 | KirinDave_ | Like, instead of setting, defvar defined a variable and if it wasn't already set, set it? iirc. |
| 21:13 | KirinDave_ | hiredman: Trying to apply deductive logic to common lisp is a dangerously arrogant thing to try. ;) |
| 21:13 | alexyk | well I read 1/3 practical common lisp a while ago and that's about my lisp exposure |
| 21:13 | hiredman | because all clojure vars can be dynamically rebound |
| 21:13 | hiredman | KirinDave_: :P |
| 21:14 | hiredman | clojurebot: what does the hyperspec tell us? |
| 21:14 | clojurebot | what is wrong with you |
| 21:14 | hiredman | clojurebot: if I were to consult the hyperspec, would I discover? |
| 21:14 | clojurebot | hyperspec is not applicable |
| 21:14 | cp2 | clojurebot: make yourself useful and fetch me a sandwich |
| 21:14 | clojurebot | a is b |
| 21:14 | cp2 | :| |
| 21:15 | alexyk | clojurebot: remember scalabot? |
| 21:15 | clojurebot | It's greek to me. |
| 21:15 | alexyk | clojurebot: do you love lambdabot? |
| 21:15 | clojurebot | You will not become skynet |
| 21:16 | arbscht_ | defonce is similar to defvar |
| 21:16 | arbscht_ | def is more like defparameter |
| 21:21 | erikcw | Has lazy-cons been removed from the core? |
| 21:21 | alexyk | hiredman: so I do: (def hashify (partial apply hash-map)), then (map hashify mydata). Should I use defn in hashify or def is fine? |
| 21:24 | alexyk | def works, still I wonder why not defn. |
| 21:24 | chouser | erikcw: yes, lazy-cons has been superceded by lazy-seq |
| 21:25 | hiredman | alexyk: defn creates a fn |
| 21:25 | hiredman | partial creates a fn |
| 21:25 | hiredman | you don't want a fn in a fn |
| 21:25 | hiredman | you just want a fn |
| 21:25 | erikcw | chouser: I'm porting an example. is the api the same? |
| 21:26 | chouser | erikcw: no. full description here: http://clojure.org/lazy |
| 21:26 | alexyk | ah! so fn eats a class as on JVM we can't have fn outside of a class, right |
| 21:26 | hiredman | yes |
| 21:26 | hiredman | the problem is partial generates a new fn each time it is called |
| 21:26 | hiredman | (fn [x] (apply hash-map x)) inline in the map should fix it too |
| 21:27 | hiredman | :( |
| 21:27 | alexyk | and it looked so lovely |
| 21:27 | hiredman | (this is the problem) |
| 21:27 | hiredman | poor first class functions |
| 21:28 | alexyk | so... if it's in the map, with (fn ...), this anonymous fn will not eat a class? or it will be GC'ed? |
| 21:29 | hiredman | it will generate a single class |
| 21:29 | hiredman | hmmmm |
| 21:29 | hiredman | have you tested with the new version yet? |
| 21:30 | hiredman | I am not 100% sure that partial like that would be the problem |
| 21:31 | chouser | calling partial doesn't generate a new class |
| 21:32 | chouser | is that the question? |
| 21:32 | devlinsf | chouser: I thought partial did. Does comp generate a new class? |
| 21:32 | chouser | no |
| 21:33 | hiredman | :D |
| 21:33 | chouser | macros can cause classes to be generated at compile or eval time |
| 21:33 | devlinsf | Hmm... help me out here. I thought each new closure generated a new class |
| 21:33 | chouser | eval can cause classes to be generated |
| 21:33 | devlinsf | Is this wrong? |
| 21:34 | chouser | compiling partial generates 5 classes. calling partial generates an instance of one of them |
| 21:34 | devlinsf | Ah |
| 21:36 | devlinsf | chouser: Why 5? partial only has 4 (documented) arities. Oh is this also in the wrong direction? |
| 21:36 | devlinsf | *or |
| 21:36 | chouser | nope, right direction. partial itself is a fn, so compiles to a class |
| 21:36 | alexyk | hiredman: each cycle takes about an hour, we'll see in about half hour. But I also increased PermSize to 1g just in case. |
| 21:36 | alexyk | if it works, I'll play with isolating partial |
| 21:37 | alexyk | chouser: I do everything in repl now, no compiling |
| 21:37 | TheBusby | Anyone else start using the "emacs starter kit" to get emacs/clojure/slime working? Curious if anyone knew how to disable the 70 character line wrap that's set by default.... |
| 21:37 | chouser | alexyk: I'm not just talking about AOT compiling. |
| 21:37 | hiredman | alexyk: clojure always compiles |
| 21:37 | alexyk | ok |
| 21:37 | alexyk | citi never sleeps, clojure always compiles :) |
| 21:37 | chouser | Each top-level form you enter in the repl gets compiled, so classes are generated at that moment. |
| 21:38 | alexyk | chouser: where do they live? in ram? |
| 21:38 | chouser | alexyk: yes |
| 21:38 | alexyk | chouser: so if partial leads to classes being generated, does it eat into PermGen space? |
| 21:39 | chouser | *compiling* partial generates classes, but you probably did that with ant ...or downloaded a jar and didn't do it at all. |
| 21:39 | hiredman | chouser: but a call to partial creates a new fn |
| 21:39 | chouser | unless you're using eval, all compilation is completed before your code starts getting run. |
| 21:40 | chouser | hiredman: yes, a new instance of an existing class. regular heap, not permgen |
| 21:40 | _ato | TheBusby: try M-x auto-fill-mode |
| 21:41 | _ato | or M-x set-fill-column |
| 21:41 | hiredman | mmmm |
| 21:41 | cemerick | chouser: I'm entirely unsure, but it looks like builds marked as 'new' aren't getting into the snapshots maven repo. |
| 21:42 | cemerick | -> http://build.clojure.org/snapshots/org/clojure/clojure/maven-metadata.xml |
| 21:42 | chouser | cemerick: I was under the impression dynsinger had to do something manual to get 'new' rolling. |
| 21:42 | cemerick | ah-ha |
| 21:43 | chouser | but which he couldn't do until the versions produced by the branches were different |
| 21:43 | KirinDave_ | hiredman: May I recommend a more competent browser? :) |
| 21:43 | cemerick | stranger than that is the timestamp in that file is from today, the last build in http://build.clojure.org/snapshots/org/clojure/clojure/1.1.0-alpha-SNAPSHOT/ is from 11/26, but depending on 1.1.0-alpha-SNAPSHOT retrieves a build from today. :-/ |
| 21:44 | KirinDave_ | hiredman: Although, I gotta say that's a beast of a js job. |
| 21:44 | TheBusby | ato: perfect, thanks! |
| 21:44 | hiredman | KirinDave_: nope |
| 21:45 | KirinDave_ | hiredman: Good point there really aren't any. |
| 21:45 | KirinDave_ | Just shades of suck |
| 21:46 | chouser | ,(apply = (map #(class (partial + %)) (range 10))) |
| 21:46 | clojurebot | true |
| 21:47 | chouser | every time you call partial with 2 args, you get an instance of the same class. |
| 21:47 | chouser | ,(class (partial 1 2)) |
| 21:47 | alexyk | chouser: I have no ant or jars here, only repl, define partial there... in a doseq. Is it still eval'd once? |
| 21:47 | clojurebot | clojure.core$partial__5267$fn__5269 |
| 21:47 | chouser | ,(class (partial 2 3)) |
| 21:47 | clojurebot | clojure.core$partial__5267$fn__5269 |
| 21:48 | chouser | alexyk: you have a clojure.jar with .class files in it? |
| 21:48 | alexyk | chouser: I use a regular clojure.jar |
| 21:49 | chouser | alexyk: when clojure.jar was produced, 'partial' was compiled and it produced 5 .class files that are now sitting in that normal clojure.jar |
| 21:49 | alexyk | ah |
| 21:54 | chouser | they're even named to include the word "partial". You can look inside the .jar and find them. |
| 23:06 | technomancy | TheBusby: even better: (remove-hook 'coding-hook 'local-comment-auto-fill) |
| 23:19 | TheBusby | technomancy: thank you! Any chance you know how to fix saveplace/save-place as well? |
| 23:20 | technomancy | TheBusby: not sure... I only now realized it wasn't working. |
| 23:21 | technomancy | TheBusby: try this: (setq-default save-place t) |
| 23:21 | TheBusby | no luck |
| 23:22 | TheBusby | I believe I'm using head for, git://github.com/technomancy/emacs-starter-kit.git |
| 23:22 | technomancy | hmm; setq-default works for me |
| 23:45 | TheBusby | technomancy: where do you have your saveplace.elc or saveplace.el.gz stored? |
| 23:46 | technomancy | TheBusby: /usr/local/share/emacs/23.1.50/lisp/ |
| 23:48 | TheBusby | you wouldn't be chance know how to get a log, or debug report out of emacs to try and figure out what the problem is would you? |
| 23:48 | technomancy | TheBusby: not unless you're seeing an actual error. |
| 23:48 | TheBusby | I tried reinstalling on a different clean ubuntu-server system and I'm still having the same problem |
| 23:48 | technomancy | could try the #emacs channel |
| 23:49 | TheBusby | okay, thanks ;) |
| 23:51 | TheBusby | er, no luck, evidently when I create a ~/.emacs file with only (require 'saveplace) and (setq-default save-place t) everything works fine |
| 23:51 | TheBusby | it's only when the rest of the ESK is setup does the problem occur |
| 23:52 | TheBusby | evidently there is a problem with how the ESK has save-place write the history to disk... |
| 23:52 | technomancy | TheBusby: you mean ~/.emacs.d/places ? |
| 23:53 | technomancy | you could set the save-place-file var to something else I guess |
| 23:53 | technomancy | but there shouldn't be a problem with that value |
| 23:53 | TheBusby | places isn't being used evidently |
| 23:54 | TheBusby | it's using ~/.emacs-places |
| 23:56 | TheBusby | evidently if I don't use the ESK, it read/writes place info from ~/.emacs-places |
| 23:57 | TheBusby | if I use the ESK, the it'll read from ~/.emacs-places but write to ~/.emacs.d/places |
| 23:57 | technomancy | you can remove the line in starter-kit-misc.el that sets that |