2010-06-21
| 00:01 | mae | 8. Also compilation (javac implementation in clojure) is the only thing we need to consider for above mentioned points 2, 2a, and 3. |
| 00:04 | arbscht | I'll bite. why is this a good idea? |
| 00:04 | mae | Sigh, I guess succinctly all I'm really trying to say is, how can we streamline the JVM so we can use pure streamlined clojure, and we can choose which webservers such as jetty we want to embed. but what do we really need in the jvm platform? Can we not port existing webservers written in common lisp such as CL-HTTP and abandon all the Java multiple-applications-on-one-webserver-instance-failure; instead of jetty we can port CL-HTTP for example. |
| 00:05 | mae | Wow that was terribly jumbled |
| 00:05 | mae | arbscht: thanks for playing; ok so here is the deal. Why don't we take the one good thing about the Sun JVM (The HotSpot VM) and abandon all the Java Community Process baggage? |
| 00:05 | mae | If that makes sense |
| 00:06 | arbscht | is that really the only good thing about it? |
| 00:06 | clojurebot | @ has nothing to do with whether sth is evaluated or not |
| 00:08 | arbscht | and how much of a real problem is it implementing on top of an existing platform? especially with cinc... |
| 00:11 | arbscht | hrm, it's beer o'clock, bbl. happy clojuring! :) |
| 00:17 | technomancy | mae: rich is already working on Clojure-in-Clojure |
| 00:18 | technomancy | mae: but supporting Common Lisp is never going to happen |
| 01:35 | tomoj | ,(keyword "'") |
| 01:35 | clojurebot | :' |
| 01:35 | tomoj | ,(keyword ",") |
| 01:35 | clojurebot | :, |
| 01:35 | tomoj | :/ |
| 01:36 | tomoj | ,(keyword "foo bar") |
| 01:36 | clojurebot | :foo bar |
| 01:36 | tomoj | I suppose this means you need to be pretty careful about what you pass to keyword if you plan to read it back later |
| 01:57 | tomoj | the fact that zipper locs are vectors seems to make it so that c.c.zip-filter.xml/xml-> can't be chainable :( |
| 01:57 | tomoj | as in, you can't do xml-> on a seq of locs |
| 01:58 | tomoj | guess you can just map xml-> over it |
| 02:22 | serp_ | ,(map + {:x 1 :y 2} {:x 3 y: 4}) |
| 02:22 | clojurebot | Invalid token: y: |
| 02:22 | serp_ | ,(map + {:x 1 :y 2} {:x 3 :y 4}) |
| 02:22 | clojurebot | java.lang.ClassCastException: clojure.lang.MapEntry cannot be cast to java.lang.Number |
| 02:23 | serp_ | is there a way to do that? the result I want is {:x 4 :y 6} |
| 02:25 | hoeck | ,(merge-with + {:x 1 :y 2} {:x 3 :y 4}) |
| 02:25 | clojurebot | {:x 4, :y 6} |
| 02:26 | serp_ | nice! |
| 02:30 | Blackfoot | is there a ref? function? returns true for any of agent, atom, ref? |
| 02:34 | zmila | just yesterday i read about (merge-with ) in the "Practical Clojure" book :) |
| 03:54 | LauJensen | Morning guys |
| 03:54 | DarthShrine | Hi LauJensen |
| 03:58 | TheBusby | morning |
| 04:18 | miltondsilva | hi, I'm having a bit of trouble sending a clojure map over a network.. is there someplace where I can see some examples? |
| 04:31 | TheBusby | miltondsilva: Not exactly what you're looking for, but this shows one serialization mechanism: http://www.bestinclass.dk/index.clj/2010/01/hadoop-feeding-reddit-to-hadoop.html |
| 04:48 | miltondsilva | TheBusby thanks |
| 05:07 | Licenser | aloa |
| 05:09 | Licenser | miltondsilva: how are you trying to do it? |
| 05:10 | Licenser | woha this is lagg sorry I dc'ed in the middle I hope your question was answered yet? |
| 05:10 | miltondsilva | Licenser: Yes, thank you |
| 05:11 | Licenser | okay that is good |
| 05:24 | Licenser | coookies |
| 06:40 | LauJensen | serializing Clojure data = prn :) |
| 07:49 | bartj | trying to understand regex functions in clojure |
| 07:49 | bartj | why does this return "foo bar" twice? |
| 07:50 | bartj | , (re-find #"(f(oo bar))" "foo bar") |
| 07:50 | clojurebot | ["foo bar" "foo bar" "oo bar"] |
| 07:50 | bartj | my understanding is that since there are only two groupings, |
| 07:50 | bartj | the returned vector must contain only two elements - "foo bar" and "oo bar" |
| 07:51 | raek | group zero is the whole expression |
| 07:51 | raek | ,(re-find #"f(oo) bar" "foo bar"= |
| 07:51 | clojurebot | EOF while reading |
| 07:52 | raek | ,(re-find #"f(oo) bar" "foo bar") |
| 07:52 | clojurebot | ["foo bar" "oo"] |
| 07:52 | raek | if you have n groups, there will be n+1 elements in the resulting vector of re-find |
| 07:58 | bartj | raek; but, the first one is always useless |
| 07:58 | bartj | I can't think of why it is always included? |
| 07:59 | raek | this is due to some old convention, I think |
| 07:59 | raek | I haven't used it either |
| 07:59 | cemerick | bartj: all regex libraries provide the entire match as group 0 |
| 08:00 | cemerick | it's not useless if you need the whole match |
| 08:00 | bartj | hmm, ok |
| 08:00 | raek | I often do a (if-let [[_ a b] (re-find #"...(...)...(...)..." s)] (do-something a b)) |
| 08:00 | raek | useful for parsing |
| 08:02 | bartj | is there a better way to remove the first match than: |
| 08:02 | bartj | , (pop (into [] (reverse (re-find #"(f(oo bar))" "foo bar")))) |
| 08:02 | clojurebot | ["oo bar" "foo bar"] |
| 08:03 | serp_ | ,(re-find #".+" "a") |
| 08:03 | clojurebot | "a" |
| 08:03 | serp_ | ,(re-find #".+" "") |
| 08:03 | clojurebot | nil |
| 08:04 | bartj | raek: yeah, that is definitely better! |
| 08:11 | raek | bartj: then you might like this: http://gist.github.com/446760 |
| 08:14 | bartj | raek: if-let would not work, if I did not know the number of matches that are returned by re-find |
| 08:15 | raek | re-find returns the number of groups plus one things |
| 08:15 | raek | it only looks at the first match |
| 08:15 | raek | re-seq gives the sequence of all matches |
| 08:17 | raek | for example, #"the (\w*)" might find more than one match |
| 08:19 | raek | but if tou don't know the number of groups, I guess you could just use (rest (re-find ...)) |
| 08:19 | raek | to get a seq of the groups |
| 08:21 | bartj | ok, thanks a lot! |
| 08:29 | Licenser | bartj: next? |
| 08:29 | Licenser | $(next (re-find #"(f(oo bar))" "foo bar")) |
| 08:29 | sexpbot | => ("foo bar" "oo bar") |
| 08:32 | bartj | Licenser: yes, thanks |
| 08:32 | Licenser | sorry it was late and redundant :P |
| 08:32 | Licenser | but next and rest gracefully handle no matches too |
| 08:32 | Licenser | $(next (re-find #"(f(oo bar))" "gooble gobble")) |
| 08:32 | sexpbot | => nil |
| 08:32 | Licenser | $(rest (re-find #"(f(oo bar))" "gooble gobble")) |
| 08:32 | sexpbot | => () |
| 08:32 | Licenser | depending on what is more fitting for you |
| 08:34 | Licenser | if you use if-let next might be better, if you always want a list rest is your friend |
| 08:40 | bartj | Licenser: free advise must not be prefixed with a sorry :) |
| 08:40 | Licenser | bartj: wait, who saied it is free? I have already send out the invoice! |
| 08:40 | Licenser | The advice costs you one happy<tm> |
| 08:41 | bartj | ok, does format take a sequence? |
| 08:41 | bartj | , (format "%s::%s" "abc" "xyz") |
| 08:41 | clojurebot | "abc::xyz" |
| 08:41 | bartj | I have abc and xyz as elements of a sequence |
| 08:42 | raek | no, but you can always use (apply format my-seq) |
| 08:42 | raek | ,(apply format "%s::%s" ["abc" "xyz"]) |
| 08:42 | clojurebot | "abc::xyz" |
| 08:42 | raek | everything between the function and the argument list gets appended to the front of the arg list |
| 08:43 | raek | (apply f a b c [x y z]) => (apply [a b c x y z]) |
| 08:43 | raek | can be very convenient |
| 08:44 | bartj | cool! have been using apply only to sum, concat,etc. till now |
| 08:49 | Licenser | apply is a very powerful tool |
| 08:50 | rhickey | can anyone figure out what this has to do with Clojure? : http://service-architecture.blogspot.com/2010/06/rest-has-put-enterprise-it-back-five.html?utm_source=feedburner |
| 08:54 | mmarczyk | rhickey: I was wondering if the CA I mailed off a week ago or so might have reached you by now? if yes, I'd apply for clojure-dev membership and maybe you could bump up my Assembla status |
| 08:55 | bartj | rhickey: It says all the cool kids are playing with Clojure and hence, there is now a vacuum in enterprise IT |
| 08:55 | rhickey | I just did a bunch, if your names not here, you'll be in the next batch: http://clojure.org/contributing |
| 08:56 | bartj | Quote from the article - " With all of the cool, and smart, kids off playing with REST and Clojure and the like we've got an intellectual vacuum in enterprise IT that is being "filled" by the vendors in the only way that vendors know how." |
| 08:56 | mmarczyk | rhickey: ok, thanks |
| 08:57 | mmarczyk | as for the article, I read it as a statement of "Clojure hasn't managed to save enterprise IT before seeing reasonable adoption in the enterprise IT" |
| 08:58 | mmarczyk | a terrible shortcoming I should say, makes one wonder if your work makes sense at all... :-P |
| 08:59 | mmarczyk | it's also saying the same with s/Clojure/REST/g, I've no opinion on that though ;-) |
| 09:06 | Licenser | greetins rhickey :)how are you today? |
| 09:09 | rhickey | Licenser: fine |
| 09:10 | Licenser | glad to hear :) and to your article I don't see anything to do with clojure yet really, nor do I agree with it. |
| 09:12 | LauJensen | Hehe, fun article, good find rhickey :) |
| 09:14 | LauJensen | Seems to be an emotional rant, so I imagine that the author just doesnt like Clojure and included it therefore |
| 09:14 | rhickey | best ignored |
| 09:15 | mmarczyk | right |
| 09:15 | Licenser | rhickey: clojure is a easy target in that earea, it is so young that - of cause - the big enterprise impact is close to zero |
| 09:15 | Licenser | If he had written Ruby a lot of people would have cried 'not true we use ruby in enterprisy stuff' |
| 09:15 | Licenser | same for python or other high roller dynamic languages |
| 09:16 | Licenser | I'm not even sure if clojure was around 5 years ago |
| 09:18 | _exterm | hello everybody. |
| 09:18 | mmarczyk | however well-respected JVM people -- Cliff Click and Alex Buckley, say -- already mention Clojure in their far-from-Clojure-specific talks / blog posts and give careful consideration to its design, so in this way it's making quite a splash |
| 09:18 | Licenser | hi _exterm |
| 09:18 | _exterm | Where or how can I change the clojure version leiningen uses for compilation with lein jar ? |
| 09:19 | mmarczyk | the enterprise is hardly going to jump the Java ship, as well it shouldn't, they probably should be a bit slow... but hopefully they pay attention |
| 09:19 | _exterm | any leiningen experts here? :-) |
| 09:19 | Licenser | mmarczyk: of cause it is but clojure is in a early stage, we see it right now with the primitive discussion. While I greatly enjoy this it is not what huge highly reliable systems are build on |
| 09:20 | mmarczyk | that would be what I meant by saying that enterprise should be a bit slow :-) |
| 09:20 | mmarczyk | _exterm: project.clj |
| 09:20 | mmarczyk | _exterm: whatever Clojure version you put there is going to be used, I guess |
| 09:20 | LauJensen | Licenser: There are already hugely reliable systems, mission critical systems, which are backed by Clojure |
| 09:21 | LauJensen | But change doesnt come overnight as most companies are entrenched - A financial crisis helps a little though |
| 09:21 | mmarczyk | _exterm: (if you believe something else happens, please double check, than complain about it as a bug) |
| 09:21 | _exterm | mmarczyk: in dev_dependencies? |
| 09:21 | mmarczyk | _exterm: no, in :dependencies |
| 09:22 | mmarczyk | _exterm: lein new foo gives you a skeleton with Clojure 1.1 included in project.clj, have a look |
| 09:22 | Licenser | LauJensen: I expect them in startups - of cause, so I'd be really surprised to see them in the big companies |
| 09:22 | LauJensen | Dont be, they're already there |
| 09:22 | _exterm | To elaborate, I got the latest version of swank-clojure and I want to compile it with a clojure compiler that I have modified |
| 09:22 | Licenser | Then I'm surprised, but just to be annoying who are they? Where do I need to apply :P |
| 09:22 | _exterm | mmarczyk: OK, I'll investigate the result of lein new. |
| 09:22 | mmarczyk | _exterm: swank-clojure doesn't require compilation |
| 09:23 | mmarczyk | _exterm: no aot'ed namespace, iirc |
| 09:23 | _exterm | mmarczyk: hmm |
| 09:24 | mmarczyk | just use it with your project, it'll be loaded (and compiled in the process of being loaded) by whichever version of Clojure your project uses |
| 09:24 | mmarczyk | swank-clojure.jar contains .clj files, not compiled classes |
| 09:24 | Licenser | lein-search might be a nice dev dependency too ^^ |
| 09:26 | mmarczyk | Licenser: what's that? I think I read about something by that name, but can't recall what it was about... |
| 09:26 | Licenser | mmarczyk: that is something that makes the managing dependencies a little easyer on you :) at least as long as they are on clojars |
| 09:26 | Licenser | you can search for versions, update when there are new versions add and remove .jars from clojars |
| 09:29 | kib2 | Hi guys; is there any need for a syntax-highlighter in Clojure ? If so, I could try to port mine. |
| 09:30 | lpetit | kib2: can you be more precise ? |
| 09:30 | mmarczyk | Licenser: ah, interesting -- I'll have to look into it |
| 09:30 | Licenser | and if you've a problem with it feel free to bug me :P |
| 09:30 | Licenser | this is all in the sake of self-advertisement ;) |
| 09:31 | kib2 | lpetit: For example http://prism-pastebin.heroku.com/57 |
| 09:31 | kib2 | lpetit: Frenchie ? |
| 09:31 | LauJensen | lpetit: While you're working, could you please ask etate for some help on picking colors for CCW? |
| 09:32 | lpetit | LauJensen: etate ? |
| 09:33 | LauJensen | lpetit: Yea, he does great color-themes for coding, and frankly the excess of pink in CCW is quite hard on the eyes :) |
| 09:33 | lpetit | LauJensen: why not. But I you feel like you can do it yourself, you can already go to the preference pages of ccw and try alternative colors. |
| 09:34 | lpetit | Laujensen: I'm open for suggestions in this area |
| 09:35 | Licenser | kib I've written clj-highlight which does syntax highlighting for clojure in clojure and is pretty extendable I think |
| 09:35 | lpetit | kib2: is this syntax highlighting, or lexical highlighting ? :-p |
| 09:36 | kib2 | lpetit: syntax one, but adding some lexical stuff shouldn't be too hard (in fact it is for ie Ruby herodoc strings). |
| 09:37 | kib2 | Licenser: I wasn't aware of your project. Where can I give it a try ? |
| 09:37 | Licenser | github, one second I look for the link |
| 09:37 | lpetit | kib2: sorry, but I see syntax coloring as subsuming lexical coloring, and that some times lexical coloring is called syntax coloring |
| 09:37 | Licenser | http://github.com/Licenser/clj-highlight |
| 09:37 | Licenser | kib2: started it while talking to the coderay maintainer |
| 09:37 | kib2 | Licenser: thanks |
| 09:38 | Licenser | try-clojure.org uses it for code highlighting |
| 09:38 | lpetit | Licenser: used a hand-made lexer or parser ? |
| 09:38 | chouser | It sure would be handy to have a way to mix method implementations into reify. |
| 09:38 | lpetit | Licenser: or uses the reader ? |
| 09:38 | Licenser | yes it's all hand written |
| 09:39 | djpowell | I thought reductions was lazy? |
| 09:39 | Licenser | it isn't made specifically for clojure, thus using the reader would be 'cheating' |
| 09:39 | djpowell | ,(first (reductions max (map (fn [x] (println ".") x) [2 4 7 8 3 5 1]))) |
| 09:39 | clojurebot | 2 |
| 09:39 | clojurebot | . . . . . . . |
| 09:40 | chouser | djpowell: probably chunked |
| 09:40 | djpowell | ah |
| 09:40 | djpowell | of course |
| 09:41 | djpowell | hmm - I could do with seq1 really, as I'm only using reductions to avoid having to process more of the list than necessary in my get-best-item-but-stop-trying-if-we-reach-the-optimal-metric function |
| 09:42 | Licenser | djpowell: you should think about renaming it .P |
| 09:42 | djpowell | ha |
| 09:42 | Licenser | if the function name is longer then the body you've done something wrong |
| 09:42 | chouser | Licenser: I'm pretty sure there are people who would disagree with that. |
| 09:43 | Licenser | chouser: there are usually people who disagree with me, but they are wrong most of the time :P |
| 09:44 | djpowell | that wasn't really the function name guys! |
| 09:44 | Licenser | yea sure I'd say that to |
| 09:44 | Licenser | ets rename + to take-two-or-more-numbers-then-add-them-togehter-if-there-is-only-one-nuber-return-it-if-there-is-no-number-return-zero |
| 09:44 | chouser | we don't have a seq-iterator fn, do we? |
| 09:45 | Licenser | we have a function that takes a iterator and makes a seq from it yes |
| 09:45 | chouser | just iterator-seq ? |
| 09:45 | Licenser | somewhere idden I found it once |
| 09:45 | chouser | I want the other way 'round |
| 09:45 | Licenser | meh meh meh |
| 09:45 | Licenser | but it would be a nice function I guess |
| 09:45 | chouser | only for interop |
| 09:46 | cemerick | chouser: I think many people have written it at least once. |
| 09:46 | spariev | hi all, I need some help with macros - http://gist.github.com/446863 |
| 09:46 | chouser | cemerick: I suppose so. but it's not in contrib or something? |
| 09:46 | cemerick | chouser: doesn't look like it |
| 09:47 | cemerick | seems like a good item for core, really |
| 09:47 | chouser | actually, I'd rather it be a protocol. heh. it being java.util.Iterator, I suppose. |
| 09:47 | chouser | oh well. |
| 09:47 | LauJensen | spariev: (execute-query `items..) => `(execute-query ~items).. depending a little on what items should be |
| 09:47 | chouser | oh, it's mutable. gah. |
| 09:48 | Chousuke | probably ~'items in this case |
| 09:48 | Chousuke | but that's not very good style /: |
| 09:48 | Chousuke | constructing the query from a string isn't very good style either ;P |
| 09:48 | LauJensen | Chousuke: I agree, he should use ClojureQL instead |
| 09:50 | spariev | LauJensen: I'm still waiting for newest & latest ClojureQL ) |
| 09:50 | rhickey | chouser: the thing you have isn't Iterable? |
| 09:50 | chouser | the thing I have is a reify I'm writing. :-( |
| 09:50 | LauJensen | spariev: Well, the master branch is still very good, but the next evolution will be much better :) |
| 09:50 | chouser | oh. actually it's what 'for' returns |
| 09:51 | chouser | which ought to work fine. hm... |
| 09:51 | spariev | well, I'll better rewrite second macros into somethng simples, multulevel quotes are too complex |
| 09:51 | spariev | simpler* |
| 09:51 | rhickey | ,(.iterator (for [x (range 3)] x)) |
| 09:51 | clojurebot | #<SeqIterator clojure.lang.SeqIterator@1fabfb3> |
| 09:52 | chouser | rhickey: yes, prefect question! Thanks! |
| 09:52 | LauJensen | spariev: Even still, it seems like you're reinventing something thats been around for a while. Both contrib.sql and clojureql allow for somekind of wrapper around a query. We use run |
| 09:52 | Licenser | it surprises me every time how briliantly simple things in clojure can be :) |
| 09:55 | _exterm | mmarczyk: thanks, I've got it working now. |
| 09:59 | spariev | laujensen: I've got a few handwritten queries that are too complex for the current version of ClojureQL, so I have to resort to building queries with str |
| 09:59 | spariev | and my macros are basically wrappers around c.c.sql/with-query-results |
| 10:00 | LauJensen | spariev: so use the 'raw' query type, and you can still get all the other benefits |
| 10:00 | LauJensen | (raw "SELECT * table1") == (query table1 *) |
| 10:00 | LauJensen | I have to duck out now, but I hope you work it out :) |
| 10:01 | spariev | Laujensen: thanks for the help |
| 10:25 | hoeck | concat isn't lazy anymore, can anybody confirm this? |
| 10:25 | hoeck | ,(let [x (apply concat (repeatedly #(do (print "X") [1 2 3])))]) |
| 10:25 | clojurebot | XXXX |
| 10:25 | hoeck | this should only start printing the "X" when I start to request the first value of seq x |
| 10:26 | hoeck | or am I wrong? |
| 10:26 | LauJensen | hoeck: Im wondering if its because its chunked, and therefore loads the first 32 or so items |
| 10:26 | sclv | Is there some handy function for turning a clojure map into a typical java map for marshalling purposes, etc., or do I need to roll my own? |
| 10:27 | raek | there is a lazy-cay, so my guess is that concat isn't lazy |
| 10:27 | raek | but I don't know any reasons for this |
| 10:27 | hoeck | LauJensen: thats ok, but shouldn't it wait to evaluate the sequence until I am requesting the first element? |
| 10:28 | LauJensen | $(let [x (apply concat (repeatedly #(do (print "X") (repeat 60 1))))]) |
| 10:28 | sexpbot | => XXXX nil |
| 10:28 | hoeck | after requesting the first element, I' fully aware that there will be some chunked precalculations |
| 10:29 | chouser | concat is definitely still lazy |
| 10:29 | Raynes | $(type (concat [3] [4])) |
| 10:29 | sexpbot | => clojure.lang.LazySeq |
| 10:29 | Raynes | Lazy. |
| 10:29 | LauJensen | chouser: So what about those 4 xs ? |
| 10:30 | cgrand | hoeck: side effect of apply, applys has no guaratees towards laziness |
| 10:30 | cgrand | ,(let [x (apply concat (repeatedly #(lazy-seq (do (print "X") [1 2 3]))))]) |
| 10:30 | clojurebot | nil |
| 10:30 | hoeck | I mean technically its a lazy seq, but its behaviour is not fully lazy, its like the old lazyness, where the first element was always computed eagerly |
| 10:30 | chouser | ,(take 1 (apply concat (repeatedly #(do (print 'X) '(1))))) |
| 10:30 | clojurebot | (1) |
| 10:30 | clojurebot | XXXX |
| 10:30 | Raynes | Huh. |
| 10:31 | chouser | if concat were eager, that would never return, right? |
| 10:31 | Raynes | Since when does clojurebot distribute results over more than one message? |
| 10:31 | cgrand | ,(take 1 (apply concat (repeatedly #(lazy-seq (print 'X) '(1))))) |
| 10:31 | clojurebot | (1) |
| 10:31 | cgrand | no X? |
| 10:32 | cgrand | ,(flush) |
| 10:32 | clojurebot | nil |
| 10:33 | hoeck | my problem was actually a long seq computation with a blocking queue as the source and a mapcat: (->> (repreatedly #(.take q)) (filter ..) (mapcat ..) (filter)) |
| 10:34 | hoeck | and I expected the mapcat to just work like a normal lazy map, though mapcat docs do not state any lazyness |
| 10:35 | hoeck | my workaround is to have my own totally lazy concat definition |
| 10:35 | hoeck | and I was just wondering if that is the right mapcat/concat behaviour or a bug |
| 10:40 | r0man | Hi there, when I (compile 'burningswell.servlet) I end up with classes of all namespaces that I'm depending on. All of clojure, clojure-contrib, the ring dependencies etc. are compiled into my "classes" folder. Is this the supposed behaviour? Did this change in clojure 1.2? How can I compile only this namespace? |
| 10:42 | cgrand | hoeck: does the function passed to mapcat return a lazy seq? |
| 10:43 | hoeck | cgrand: its a #(repeatedly (.take q)) |
| 10:43 | hoeck | where each take on the BlockingQueue q returns a vector |
| 10:45 | cgrand | hoeck: in (->> (repreatedly #(.take q)) (filter ..) (mapcat XX) (filter)), you mean that XX is #(repeatedly (.take q))? |
| 10:46 | hoeck | cgrand: sorry, didn't understand that |
| 10:47 | cgrand | you said that your code was something like that (->> (repreatedly #(.take q)) (filter ..) (mapcat XX) (filter ..)), right? |
| 10:47 | hoeck | right |
| 10:49 | cgrand | hoeck: I'm interested in what the XX function returns |
| 10:51 | hoeck | (.take q) returns a vector hashmaps |
| 10:51 | hoeck | and XX returns a specific key of such a hashmap |
| 10:51 | hoeck | where the value is again a vector of vectors |
| 10:53 | cgrand | if XX could return a lazy seq, I think it would solve your laziness problem |
| 10:54 | AWizzArd | Can Java programs make use of Clojure-Protocolls? |
| 10:54 | hoeck | the problem is, that the whole sequence expression was blocking, although I did not request the first element, I just tried to return it |
| 10:55 | hoeck | the problem boiled down to (apply concat a-lazy-seq-of-seqs) always evaluates at least the first seq |
| 10:56 | raek | r0man: I think this is a known issue... I can't find the ticket |
| 10:56 | chouser | AWizzArd: yes, defprotocol generates an interface with the name you'd expect, no munging. |
| 10:57 | r0man | raek: so it's clojure 1.2 specific? |
| 10:58 | raek | http://www.assembla.com/spaces/clojure/tickets/322-enhance-aot-compilation-process-to-emit-classfiles-only-for-explicitly-specified-namespaces |
| 10:58 | raek | no, it's not, I think |
| 10:58 | rhickey | user=> (defn foo [] (loop [x 1 y 2.0 z 42N] (recur 42 42 42))) |
| 10:58 | rhickey | NO_SOURCE_FILE:26 recur arg for primitive local: y is not matching primitive, had: long, needed: double |
| 10:58 | rhickey | Auto-boxing loop arg: y |
| 10:59 | Licenser | rhickey: that is awsome, the changes of loop! |
| 10:59 | cgrand | hoeck: I agree with the pb being with (apply concat a-lazy-seq-of-seqs), my argument is that changing that to (apply concat a-lazy-seq-of-lazy-seqs) make it go away |
| 11:00 | cgrand | ,(let [x (apply concat (repeatedly #(lazy-seq (print "X") [1 2 3])))]) : hoeck |
| 11:00 | clojurebot | nil |
| 11:01 | hoeck | cgrand: that might just be it, thanks, I'm trying it |
| 11:05 | cgrand | rhickey: great commit! |
| 11:06 | r0man | raek: If I remember correctly, I didn't had this problem some months ago with an earlier version. I'm developing a web application on Google App Engine, and just noticed this problem because App Engine was complaining that I reached the max. number of files I can have in my project. Since then I switched clojure versions, build system and other libraries. Maybe I have to look into my dependencies or the build system |
| 11:06 | r0man | to get rid of those class files. Thx anyway ... |
| 11:08 | raek | I have had this problem in 1.1.0, IIRC |
| 11:08 | raek | I have only recently started to use 1.2.0 |
| 11:10 | Chousuke | the prim thread must be one of the longest on the Clojure group so far. :P |
| 11:12 | cemerick | raek: I've got half of a fix over here. It's a fairly simple thing in the end. |
| 11:13 | cemerick | If I can clean it up this week, I'm hoping to convince rhickey to let it into 1.2. |
| 11:15 | r0man | cemerick: that would be wonderful ... |
| 11:17 | raek | cemerick: ah, great! |
| 11:18 | djpowell | re seq-iterator - don't seq's implement Iterable - ie, implement a .iterator() method? |
| 11:19 | djpowell | well, ASeqs do |
| 11:23 | chouser | djpowell: yeah, I was being dumb. |
| 11:29 | AWizzArd | Do (keys map) or (vals map) cons much? Or do they use an already existing structure and thus run in O(1) and MemoryO(1)? :) |
| 11:32 | Licenser | AWizzArd: since they return them unsorted I guess they will run in O(1) but that it is a guess |
| 11:32 | arohner | is anyone successfully using lein with nexus? |
| 11:32 | Licenser | I think they'll just 'Walk' the leaves or nodes of the tree |
| 11:33 | HerrBlume | how do i create a java byte array? |
| 11:33 | AWizzArd | ,(byte-array [(byte 10) (byte 20)]) |
| 11:33 | clojurebot | #<byte[] [B@45d9be> |
| 11:33 | HerrBlume | ah, thank you |
| 11:33 | AWizzArd | ,(vec (byte-array [(byte 10) (byte 20)])) |
| 11:33 | clojurebot | [10 20] |
| 11:33 | AWizzArd | as literal numbers are not bytes you need to make them bytes first |
| 11:34 | AWizzArd | ,(byte-array (map byte [1 2 3])) |
| 11:34 | clojurebot | #<byte[] [B@106a66b> |
| 11:34 | AWizzArd | ,(doc vals) |
| 11:34 | clojurebot | "([map]); Returns a sequence of the map's values." |
| 11:34 | AWizzArd | Licenser: it mentions a seq, not a lazy one. |
| 11:34 | HerrBlume | ,(byte-array 1024) |
| 11:34 | clojurebot | #<byte[] [B@1926cb6> |
| 11:34 | HerrBlume | ,(byte-array 102400000000000000000000000000000000000) |
| 11:34 | clojurebot | java.lang.ExceptionInInitializerError |
| 11:34 | HerrBlume | kk |
| 11:35 | AWizzArd | Aber aber, HerrBlume, was versuchst du da nur ;) |
| 11:35 | Licenser | hmmm |
| 11:35 | HerrBlume | sry |
| 11:36 | AWizzArd | Licenser: a walker over the existing structure would be nice, as this could be done with basically no extra memory usage |
| 11:36 | AWizzArd | which is nicely when doing this with a 47 GB hashmap |
| 11:36 | AWizzArd | -ly |
| 11:37 | Licenser | http://github.com/richhickey/clojure/blob/equal/src/jvm/clojure/lang/APersistentMap.java#L104 |
| 11:46 | HerrBlume | hm, is there an easy way to parse an xmlstring? |
| 11:46 | chouser | HerrBlume: I think there is an example of that at the bottom of clojure.contrib.lazy-xml |
| 11:49 | HerrBlume | ah, ok |
| 11:50 | HerrBlume | ,(clojure.xml/parse (java.io.StringBufferInputStream. "<foo/>")) |
| 11:50 | clojurebot | {:tag :foo, :attrs nil, :content nil} |
| 11:52 | HerrBlume | this is cool |
| 11:58 | Licenser | HerrBlume: watch out that you don't have w3c DTD's in the xml otherwise the parser goes nuts :P |
| 12:03 | HerrBlume | Licenser: what are w3c DTD's? |
| 12:04 | HerrBlume | ah docuemnt type declarations, ok |
| 12:04 | HerrBlume | <!doctype blah> |
| 12:05 | riddochc | So, am I remembering correctly that stuart halloway and rich hickey are working together these days? Or was it someone else? I can't seem to find the announcement in my mail archives. |
| 12:08 | riddochc | nm, it's halloway. |
| 12:20 | dnolen | any tried to use ring with httpcore? |
| 12:21 | dnolen | s/any/anyone |
| 12:21 | riddochc | dnolen: I haven't yet, but it's on my list. |
| 12:22 | dnolen | I'm running into address already bound exception which doesn't make much sense. |
| 12:25 | riddochc | dnolen: As in, the server can't listen on the port? That happens to me when something else is already listening on the port. |
| 12:26 | riddochc | I once had some weird issue where linux was taking a surprisingly long time to allow another program to listen on the same port after the first stopped. |
| 12:28 | riddochc | Specifically, it was with socat. I had a command like "socat tcp-l:20001 SSL:someserver:portnum,verify=0" |
| 12:28 | nDuff | there are some flags which can be set on the LISTEN socket to make it be released more readily |
| 12:29 | riddochc | If I killed socat and restarted it, it didn't want to listen on the port. I had to do "socat tcp-l:20001,reuseaddr ..." to make it work. |
| 12:31 | dnolen | riddochc: it doesn't matter what I set the port to |
| 12:31 | riddochc | Yeah, this is relevant: http://stackoverflow.com/questions/775638/using-so-reuseaddr-what-happens-to-previously-open-socket |
| 12:31 | dnolen | same exception |
| 12:32 | rhickey | riddochc: you are all set on the CA list: http://clojure.org/contributing |
| 12:32 | riddochc | rhickey: Great, thanks! |
| 12:34 | riddochc | rhickey: Google says my clojure-dev membership is pending. Want me to cancel & retry, or can you add me there? |
| 13:04 | jkkramer | rhickey: getting an exception on the equal branch with clojure.contrib.string/partition: (require 'clojure.contrib.string) (clojure.contrib.string/partition #"[a-z]+" "abc123def") |
| 13:04 | jkkramer | => clojure.lang.Numbers.add(II)I [Thrown class java.lang.NoSuchMethodError] |
| 13:08 | ajazz | hello, could somebody explain it (http://pastebin.com/xBHUZ6Fr) for me? |
| 13:10 | riddochc | ajazz: http://clojure.org/data_structures describes how IPersistentList and IPersistentVector are different. |
| 13:12 | ajazz | yeh, thanks, but when I pass vector to function and call conj I get element added at the begin of the vector |
| 13:15 | jkkramer | ajazz: the destructuring makes the tail a seq, not a vector |
| 13:15 | jkkramer | ,(let [[h & t] [1 2 3 4 5]] t) |
| 13:15 | clojurebot | (2 3 4 5) |
| 13:17 | ajazz | ,(type (let [[h & t] '(1 2 3 4 5)] t)) |
| 13:17 | clojurebot | clojure.lang.PersistentList |
| 13:18 | ajazz | "conj puts the item at the front of the list." |
| 13:21 | jkkramer | ajazz: for lists and seqs, yes |
| 13:21 | jkkramer | ,(conj [1 2 3] 4) |
| 13:21 | clojurebot | [1 2 3 4] |
| 13:21 | jkkramer | ,(conj (seq [1 2 3]) 4) |
| 13:21 | clojurebot | (4 1 2 3) |
| 13:21 | ajazz | jkkramer: ok, when I call type on t it returns PersistentList |
| 13:21 | ajazz | I expect t will behave like list |
| 13:22 | rhickey | jkkramer: works, here, did you rebuild contrib? |
| 13:23 | jkkramer | rhickey: using the latest contrib build from build.clojure.org |
| 13:23 | jkkramer | rhickey: will try building locally... |
| 13:26 | ajazz | , ((fn [s] (let [[h & t] s] (do (print (type t)) (conj t h)))) '(1 2 3)) |
| 13:26 | clojurebot | (1 2 3) |
| 13:26 | clojurebot | clojure.lang.PersistentList |
| 13:33 | jkkramer | rhickey: rebuilt contrib, still getting the exception. here's the exact steps I'm following: http://gist.github.com/447181 |
| 13:33 | ajazz | jkkramer: ok, I got it, thanks for help |
| 13:34 | jkkramer | ajazz: np |
| 13:38 | rhickey | jkkramer: you need to mvn clean, then build against the version of clojure you built from the equals branch: |
| 13:38 | rhickey | mvn package -Dclojure.jar=/Users/rich/dev/clojure/clojure.jar |
| 13:38 | rhickey | seems like you are building contrib against a Clojure snapshot jar |
| 13:40 | jkkramer | rhickey: you're right, sorry for false report |
| 13:48 | mmarczyk | rhickey: would it be possible for the ^:static functions to generate Object-taking overloads so that the same arities+bodies may be used with boxed numbers? |
| 13:49 | dnolen | mmarczyk: I thought that was already the case. some-static-fn -> #'some-static-fn is boxed |
| 13:50 | mmarczyk | dnolen: ah, of course, thanks |
| 13:54 | rhickey | mmarczyk: still thinking about type overloading - the set would be long/double/Object, but you don't always want the same bodies |
| 13:54 | mmarczyk | rhickey: that's true |
| 13:55 | mmarczyk | rhickey: I've been trying to squeeze a non-promoting (obviously!) primitive version and a promoting boxed version together... I suppose that's semantic abuse, but I don't even know what the would be supposed to look like |
| 13:55 | mmarczyk | ...what that would... |
| 13:57 | rhickey | mmarczyk: yes, semantic abuse |
| 13:57 | mmarczyk | rhickey: by the way, might the ^:static machinery make it possible to use Clojure namespaces directly as classes in Java code? my.ns.foo(); |
| 13:58 | rhickey | mmarczyk: not the intent, no |
| 13:59 | mmarczyk | ah, ok. no real reason to ask though... just curious |
| 14:01 | AWizzArd | How interchangable are primitves vs their Wrappers? |
| 14:02 | AWizzArd | For example, when I declare a fn to take an ^int but call it with an Integer |
| 14:02 | AWizzArd | Or vice versa |
| 14:09 | mmarczyk | rhickey: I think I broke latest equal, http://gist.github.com/447233 |
| 14:10 | mmarczyk | AWizzArd: in general, the primitive will be boxed for you when needed... I think I've just hit something funky with locals' behaviour on equal in this area, though |
| 14:10 | mmarczyk | rhickey: that's with *warn-on-reflection* set to true |
| 14:11 | mmarczyk | rhickey: ah, wait, scratch that... with *warn-on-reflection* false it's still broken (hangs), with true it's more spectacular |
| 14:16 | chouser | I'd rather have a way for libs to turn that on/off for themselves without effecting other libs they use or are used by. |
| 14:16 | mmarczyk | AWizzArd: most of it is not aot'd, though, so if you (set! *warn-on-reflection* true), I think you'll get warnings when you require (if indeed there are any) |
| 14:16 | mmarczyk | (someone please correct me if I'm wrong) |
| 14:16 | mmarczyk | oh, and (inc chouser) |
| 14:19 | AWizzArd | Yes, this would be a nice default during the development of a contrib. There are still several areas that would like to get type hints :) |
| 14:21 | chouser | why? performance? |
| 14:24 | cemerick | There's not a lot of interop in contrib as it is. |
| 14:36 | LauJensen | In the styleguide its stated that we should consider a macro, if all of the information is available at compile time to improve performance, but Im guessing that advice will change with the merging of prim ? |
| 14:51 | AWizzArd | Is it possible to make a Protocoll for specific classes? Such as (foo Integer 1 2) (foo MyRecord 3 4) (Foo String 5 "abc") etc? |
| 14:52 | AWizzArd | first arg is the class, not an instance of it |
| 14:54 | AWizzArd | Or is this something that can be done with :static fns? |
| 14:55 | chouser | How is that not just a regular function? |
| 14:55 | chouser | oh, you want to dispatch based on the instance of the first arg (not its type)? |
| 14:56 | AWizzArd | The first arg would be of type Class |
| 14:56 | AWizzArd | And I want to dispatch on that. |
| 14:56 | AWizzArd | Multimethods come to mind, but what about Protocols? |
| 14:58 | the-kenny | AWizzArd: I don't think so.. Maybe you can extend java.lang.Class, but that wouldn't enable you to dispatch on specific instances |
| 14:58 | utgo | is there a more convenient way to write nested operations like this? (s/replace (s/replace str "\n" "") #"\s+" " ")) |
| 14:59 | chouser | utgo: the -> macro |
| 14:59 | utgo | chouser: ah thanks |
| 15:26 | OForero | hi |
| 15:26 | OForero | I was wondering if somebody knows if incanter.chrono is still alive? |
| 15:27 | OForero | would this be the best choice for a date library in Clojure? |
| 15:29 | OForero | or is clj-time a better option? |
| 15:29 | hugod | OForero: my choice http://github.com/clj-sys/clj-time |
| 15:32 | OForero | ok ... I'll go with that |
| 15:32 | OForero | chrono is difficult to get ... I guess is not really maintained |
| 15:40 | fogus_ | Anyone interested in separate Errors for pre- and post-conditions? (besides me that is) http://github.com/fogus/clojure/commit/87eb4124947297c86e30e0747931a16e21634575 |
| 16:01 | chouser | ,[(identical? 127 127) (identical? 128 128)] |
| 16:01 | clojurebot | [true false] |
| 16:06 | chouser | ,(letfn [(id? [x] (identical? x (+ 0 x)))] (for [s (partition-by id? (range -200 201))] [(id? (first s)) (first s) '.. (last s)])) |
| 16:06 | clojurebot | ([false -200 .. -129] [true -128 .. 127] [false 128 .. 200]) |
| 16:10 | rustemsuniev | chouser : 127 and 128 it's java Integer class implementation, caching values below 128 in the stack. |
| 16:11 | chouser | huh! I assumed Clojure was doing that. |
| 16:12 | rustemsuniev | java already does, maybe Clojure adds smth I don't know :) |
| 16:14 | chouser | ,(identical? (Integer/valueOf 10) 10) |
| 16:14 | clojurebot | true |
| 16:14 | chouser | looks like it's just Java. |
| 16:15 | serp_ | ,[(= 128 128) (== 128 128)] |
| 16:15 | clojurebot | [true true] |
| 16:15 | ihodes | surprising result, there, serp_ ;) |
| 16:15 | serp_ | I don't know the different between = and == |
| 16:16 | serp_ | perhaps it's not surprising |
| 16:16 | ihodes | == is for identity |
| 16:16 | chouser | no |
| 16:16 | ihodes | = is for value |
| 16:16 | chouser | == is for numbers |
| 16:16 | chouser | ,(== {} {}) |
| 16:16 | clojurebot | java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.Number |
| 16:16 | ihodes | aha-so don't listen to me ;) |
| 16:17 | ihodes | ,(equal? 128 128) |
| 16:17 | clojurebot | java.lang.Exception: Unable to resolve symbol: equal? in this context |
| 16:17 | serp_ | how can (identical? 1 1) work? 1 is not an object, is it? |
| 16:17 | chouser | though the exact meaning of = and == may be different in some of the working branches. |
| 16:18 | chouser | serp_: it is. literals numbers are boxed (instances of a subclass of Object) |
| 16:20 | serp_ | ok |
| 16:20 | serp_ | isn't it slow to box all integers? |
| 16:20 | chouser | yes |
| 16:20 | chouser | :-) |
| 16:20 | AWizzArd | Type-hinting the first arg of a Protocol method is not needed, right? Because when I say (extend String PMyProto {:foo [s a b c] ...}) then s will automatically be a String. |
| 16:20 | chouser | serp_: locals can be primitive, and there's work in some other branches to make the wider use of primitives possible. |
| 16:21 | serp_ | ok neat |
| 16:21 | chouser | AWizzArd: if you use extend-type or extend-protocol, that's true. With just extend, the hinting is not done for you. |
| 16:22 | AWizzArd | ah ok, thx |
| 16:23 | AWizzArd | Though the documentation on clojure.org says that extend-type expands into extend... |
| 16:32 | LauJensen | serp_: For now, macros can help you to let distributed code work on primitives |
| 16:33 | serp_ | how is that? |
| 16:34 | LauJensen | serp_: When you distribute some code into several fns, the primitives gets boxed when they're passed around. Macros still let you have your code divided into separate entities, but they dont box since they expand before the compiler starts |
| 16:34 | LauJensen | There's a huge abusive example on my blog :) |
| 16:37 | serp_ | mhm I see |
| 16:37 | serp_ | could you link me to your blog, please? |
| 16:37 | chouser | ...because locals can be primitive |
| 16:38 | chouser | so you can have a macro expand into code inside a function and have it use the existing primitive locals you have there. |
| 16:38 | LauJensen | serp_: http://bestinclass.dk/index.clj/2010/03/functional-fluid-dynamics-in-clojure.html |
| 16:38 | LauJensen | yea it works how chouser just explained it - Though Im hoping the prim branch will simplify this |
| 16:39 | serp_ | got it |
| 16:55 | cemerick | I like the blue and yellow clojure logo variant http://twitter.com/sclojug/ |
| 16:57 | raek | a stockholm clojure group... nice |
| 16:57 | raek | anyone from Linköping here? |
| 16:58 | serp_ | o/ |
| 16:59 | raek | serp_: :) |
| 17:01 | cemerick | Q for those UI folk in earshot: http://twitter.com/cemerick/status/16720988108 |
| 17:09 | AWizzArd | When I open a FileOutputStream and wrap that in a BufferedOutputStream and wrap that one in a DataOutputStream, do I then only need to .close that last one to free the resource? |
| 17:09 | qbg | LauJensen: You should revisit functional fluid dynamics once this prim business stabilizes. |
| 17:11 | raek | AWizzArd: yes, I think so |
| 17:12 | raek | closing the DataOutputStream should close the wrapped stuff too |
| 17:13 | raek | dunno what happens if you only close the FileOutputStream, though |
| 17:13 | raek | maybe there will be data left in the buffer of the BufferedOutputStream that will not get flushed |
| 17:14 | raek | but closing the outermost wrapper is enough |
| 17:14 | AWizzArd | k |
| 17:17 | raek | from FilterInputStream (DataInputStream super class) javadoc: Closes this input stream and releases any system resources associated with the stream. This method simply performs in.close(). |
| 17:18 | qbg | Fleeting question: Is there something like Factor's with-destructors in contribs? |
| 17:20 | LauJensen | qbg: Naah, its trivial. An interesting thing would be to port it to OpenCL, put it on the GPU and extend it to 3D - But ehm, Im waiting for a slow day :) |
| 17:21 | AWizzArd | raek: this "any system resources" is the important hint, thx |
| 17:22 | qbg | The fluid example in Penumbra would be more cool if it ran at more than 2 fps on my machine |
| 17:22 | raek | (-> sock (.getOutputStream) (OutputStreamWriter. out-encoding) (BufferedWriter.) (PrintWriter. true)) |
| 17:22 | raek | you gotta love that |
| 17:23 | LauJensen | qbg: thats actually a direct port from blogpost. It goes 2 fps on linux systems, because linux queues the un-rendered frames (ie diffusion and advection), its a bug, and its the reason Zach is porting to OpenCL instead of OpenGL |
| 17:23 | qbg | It looked familiar... |
| 17:23 | raek | ...but it makes sense to keep separate conserns separate, so maybe it's not that bad anyway |
| 17:23 | LauJensen | It should go about 800x600 @ 50fps |
| 17:29 | herdrick | weird. does is google not picking up all the logs for this channel? |
| 17:30 | LauJensen | Google sees them |
| 17:30 | herdrick | because i had a convo with liebke: here a little while back about a function in incanter |
| 17:30 | herdrick | that was giving me an NPE |
| 17:30 | LauJensen | clojure-log.n01se.net |
| 17:30 | herdrick | LauJensen: yeah, that's where i was searchign with google |
| 17:30 | herdrick | no sign of that conversation |
| 17:31 | LauJensen | aha |
| 17:34 | herdrick | LauJensen: it's here: http://clojure-log.n01se.net/date/2010-06-15.html |
| 17:34 | chouser | google tends to index today's conversation every hour or two, but then has a gap of a week or two before it picks up the older logs. |
| 17:34 | herdrick | chouser: ok, thanks |
| 17:36 | herdrick | shoot, looks like no progress on that problem (getting a NPE from .viewSorted in Incanter/Colt) |
| 17:36 | herdrick | bummer for me |
| 17:39 | chouser | brb. don't say anything important. |
| 17:37 | dnolen | ,(conj [1, 2] 3) |
| 17:37 | clojurebot | [1 2 3] |
| 17:37 | ldp | thanks :) |
| 17:46 | herdrick | so, is there another way to sort a matrix? other than .viewSorted , that is |
| 17:46 | herdrick | (in incanter) |
| 17:46 | herdrick | natch |
| 18:05 | djpowell | the loop autoboxing seems pretty cool. has anyone raised any objections to it for any reason? |
| 18:13 | qbg | djpowell: Not as far as I know |
| 18:14 | qbg | There seems to be at least one bug with it though |
| 18:34 | herdrick | ,(* 92193901239012390312 9219123903129039) |
| 18:34 | clojurebot | java.lang.ExceptionInInitializerError |
| 18:34 | herdrick | (* 9219 921) |
| 18:34 | clojurebot | *suffusion of yellow* |
| 18:34 | herdrick | ,(* 9219 921) |
| 18:34 | clojurebot | 8490699 |
| 18:34 | herdrick | uh, |
| 18:34 | herdrick | does this: |
| 18:35 | herdrick | http://github.com/richhickey/clojure/commit/6ab3e4cd672092823a04c944210a23c29142785d#diff-0 |
| 18:35 | herdrick | mean what i think? |
| 18:35 | herdrick | oh no |
| 18:35 | herdrick | ,999999999999999999999999999999999999999 |
| 18:35 | clojurebot | 999999999999999999999999999999999999999 |
| 18:35 | herdrick | oh, maybe not |
| 18:37 | herdrick | hey - does the above commit mean that Clojure isn't allowing automatic arbitrary-precision arithmetic? |
| 18:38 | herdrick | ,(+ 1 java.lang.Long/MAX_VALUE) |
| 18:38 | clojurebot | 9223372036854775808 |
| 18:38 | dnolen | herdrick: testing on clojurebot won't get you very far, it's not up to date |
| 18:38 | herdrick | ,(* 2 java.lang.Long/MAX_VALUE) |
| 18:38 | clojurebot | 18446744073709551614 |
| 18:39 | herdrick | oh, i thought it was |
| 18:39 | herdrick | in any case i probably shouldn' |
| 18:39 | herdrick | shouldn't scatter that stuff all over the logs |
| 18:39 | dnolen | herdrick: with the latest changes automatic arbitrary-precision continue to be possible. it just a matter of what it will look like. |
| 18:39 | herdrick | look like? |
| 18:39 | dnolen | +', or + for autopromotion |
| 18:40 | herdrick | so you've got to prepend N on larger integers? |
| 18:40 | dnolen | herdrick: not if you use the autopromoting fns |
| 18:41 | herdrick | dnolen: ok, so what is + going to be bound to? |
| 18:41 | herdrick | nchecked-add ? |
| 18:42 | herdrick | sorry, unchecked-add |
| 18:42 | herdrick | ? |
| 18:42 | dnolen | herdrick: unchecked-add is not safe |
| 18:42 | herdrick | ok, i suppose i'm asking, "what will + be bound to" |
| 18:42 | herdrick | ? |
| 18:43 | herdrick | will it work with arbitrary precision? |
| 18:44 | dnolen | herdrick: it might, or +' might, no word yet. |
| 18:44 | dnolen | probably + tho, there's more community support for that it seems. |
| 18:44 | herdrick | oh man, let me cast a strong vote in favor of THAT |
| 18:44 | dnolen | the primitive version will throw on overflow |
| 18:45 | herdrick | sure, that's a great optimization, as long as it's something like +' |
| 18:45 | herdrick | and not + |
| 18:46 | tomoj | so the fac speedup example would use +' ? |
| 18:47 | tomoj | in THAT case |
| 18:49 | herdrick | ..."primitive" version indeed... |
| 19:13 | arohner | anyone here using the nexus maven server with lein? |
| 19:44 | herdrick | question: (.getCanonicalPath (new java.io.File ".")) |
| 19:44 | herdrick | is showing my lein project home dir |
| 19:45 | herdrick | using (System/setProperty "user.dir" "/foo/bar") isn't changing that, for me |
| 19:45 | herdrick | anyone know how to get the default path to something else? |
| 19:49 | dnolen | herdrick: you can't change it |
| 19:49 | herdrick | dnolen: thanks. that's odd. |
| 19:49 | dnolen | that's Java for you. |
| 19:50 | herdrick | huh - the docs seem to say you can, by changing that property |
| 19:50 | herdrick | "By default the classes in the java.io package always resolve relative pathnames against the current user directory. This directory is named by the system property user.dir, and is typically the directory in which the Java virtual machine was invoked." |
| 19:50 | herdrick | kind of ambiguous though |
| 19:50 | technomancy | the JDK is missing all kinds of obvious functionality like that |
| 19:51 | herdrick | huh - ok |
| 19:55 | dnolen | you can get the most advanced runtime optimization but you can't change the working directory. |
| 20:22 | islon | how do you update lein to the newest version? |
| 20:25 | dnolen | islon: I would replace your lein script with 1.2-RC, wipe out ~/.m2, lein self-update |
| 20:32 | islon | dnolen, self-update is not a task. Use "help" to list all tasks. |
| 20:33 | mmarczyk | that's self-install |
| 20:33 | mmarczyk | self-install is also not a task, but it's handled by the shell script |
| 20:35 | mmarczyk | actually I think it should work without wiping ~/.m2, though, with the script replaced and self-install performed... if it doesn't, something is amiss |
| 20:35 | islon | where's the script for rc2? |
| 20:35 | mmarczyk | http://github.com/technomancy/leiningen |
| 20:35 | technomancy | yeah, don't clear out ~/.m2; that's unnecessary. |
| 20:36 | mmarczyk | here's the repo... you can pull it out of it |
| 20:36 | mmarczyk | um, select the tag for the version you want first, I guess |
| 20:38 | islon | i downloaded lein dev version and executed self-install and it downloaded leiningen-1.2.0-RC1-standalone.jar |
| 20:40 | mmarczyk | technomancy: how about having defproject munge ::foo style keywords (and perhaps :foo/bar style too) into unquoted symbols? -- that's in the way of brainstorming a fix for #49... |
| 20:42 | mmarczyk | islon: the lein script you used to self-install should now be able to launch lein tasks for you |
| 20:43 | islon | mmarczyk, yes, it does, after i installed 1.20 rc1 i executed lein upgrade and it downgraded itself to 1.1.0... strange |
| 20:44 | mmarczyk | islon: um, what did you do that for? |
| 20:44 | technomancy | islon: "lein upgrade" gets you the latest stable release |
| 20:44 | technomancy | right now that is 1.1.0. |
| 20:44 | mmarczyk | anyway, upgrade is only meant for stable releases; when 1.2 is released, that's what it'll get you |
| 20:45 | islon | ok, thanks for the info i'll "unupgrade" it =) |
| 20:45 | technomancy | mmarczyk: not sure how that works with #49. Just calling eval where version strings are expected would solve it for that particular case. |
| 20:47 | mmarczyk | technomancy: sure, but I was thinking what to do so that e.g. a Var to hold the group id for some dependencies becomes a possibility, for ease of switching between various people's artifacts on Clojars, say |
| 20:49 | technomancy | oh, I see. yeah, if you want to expand it to more than just version numbers it becomes trickier. |
| 20:51 | mmarczyk | or actually |
| 20:52 | mmarczyk | technomancy: the idea suddenly strikes me to use unquote |
| 20:56 | Raynes | technomancy: Is leiningen supposed to upgrade even when there isn't anything to upgrade to? |
| 20:57 | technomancy | Raynes: to do that you'd have to reimplement version comparison logic in bash... would rather not. |
| 20:58 | technomancy | I mean it'd be easy to just not upgrade if they were equal, but there's no way it could prevent downgrading. |
| 20:58 | Raynes | technomancy: To do what? Last time I did 'lein upgrade' just to see what would happen, it installed the same version I already had, which is the current version. |
| 20:58 | Raynes | >_> |
| 20:58 | Raynes | Oh. |
| 20:58 | Raynes | I thought you were saying the opposite. |
| 21:00 | alexyk | Raynes: so hows your Haskell lately? |
| 21:00 | Raynes | alexyk: I've mostly forgotten everything./ |
| 21:00 | alexyk | Raynes: dynamism does that to you |
| 21:00 | Raynes | Meh, just don't have time for it. |
| 21:01 | alexyk | so I rewrote the clojure project in Haskell, and instead of a 32 GB JVM, it exploded to 50 GB+ and hit a bug in Haskell's runtime. |
| 21:01 | alexyk | also had to strictify everything like crazy. |
| 21:02 | alexyk | OTOH, OCaml beats both hands down so far. |
| 21:02 | lancepantz | alexyk: your graph project? |
| 21:02 | alexyk | I'm going to have a functional shootout for large scale Twitter data mining. Haskell, OCaml, Clojure, and Scala. lancepantz: yep. |
| 21:03 | alexyk | lancepantz: btw, clojure-protobuf is on par with the best binary serialization in Haskell. |
| 21:03 | alexyk | lancepantz: you can claim it's the fastest for clojure overall |
| 21:03 | lancepantz | wow, i'll tell justin |
| 21:03 | alexyk | yeah, this was the thing which made repeated banging on clojure possible |
| 21:04 | ninjudd | alexyk: that's awesome |
| 21:04 | ninjudd | glad to hear it |
| 21:05 | technomancy | mmarczyk: I'm not sure how unquote would work, but if you have a solution that'd be awesome. without such a solution I'm inclined to apply the version-string-only strategy of eval. |
| 21:05 | alexyk | lancepantz: ninjudd: but Haskell is not very fast on large data anyhow; lazyness makes it gigabytes of thunks inside maps of maps. Clojure's "map is lazy" is kindergarden against that kind of GC-overwhelming lazynes -- La-zy-ness. |
| 21:05 | alexyk | ninjudd: did you see Apache Avro or Thrift with Cassandra? |
| 21:05 | alexyk | those things look yummy |
| 21:06 | alexyk | Scala has an Avro client |
| 21:06 | mmarczyk | technomancy: I thought about having all forms of the shape ~foo to be copied verbatim into defproject's output |
| 21:06 | mmarczyk | technomancy: then you could say ~my-version-string |
| 21:06 | ninjudd | alexy: i debated whether to do thrift or protobuf when i started |
| 21:07 | alexyk | ninjudd: I guess thrift can be useful separately |
| 21:07 | mmarczyk | technomancy: and my-version-string appear in the macro expansion & be evaluated... if this sounds vaguely reasonable, I'll just write a patch to do it |
| 21:08 | ninjudd | settled on protobuf because it was slightly faster in the benchmark and seemed simpler to implement |
| 21:08 | technomancy | mmarczyk: I don't think macros really work that way, but maybe I'm misunderstanding you. |
| 21:08 | technomancy | if you can get something to work that'd be awesome. |
| 21:08 | technomancy | gotta take off for now though. |
| 21:09 | mmarczyk | technomancy: ok, I'll just write the patch then, we'll see how good this looks in practice |
| 21:09 | mmarczyk | see you. |
| 21:09 | alexyk | ninjudd: yeah, it's great. I contacted the Haskell guy who did protobufs but he says it's easier to implement the map as a repeated message on the wire; same was uttered by the scala folk. But I prefer it in extensions. |
| 21:10 | ninjudd | the nice thing about the extensions is that others can use them as plain old repeated messages |
| 21:10 | ninjudd | it is just a hint |
| 21:11 | ninjudd | perhaps i shouldn't make the extensions go in the clojure namespace though, so others can implement them if they want |
| 21:11 | alexyk | ninjudd: yeah, but they resist saying it requires to map to a Haskell map which is not standard -- you can have several types of maps, so easier to make teh recipient decode from the wire in program's logic. |
| 21:12 | alexyk | Again I didn't see actual usage. I adore the map extension and would like to see it everywhere. |
| 21:21 | scottj | How come (let [a (lazy-cat [1] a)]) doesn't work but (def a (lazy-cat [1] a)) does? |
| 21:24 | qbg | Because let doesn't make recursive bindings |
| 21:25 | qbg | That is, a is not in scope in the binding |
| 21:25 | scottj | qbg: is there a let form that does? |
| 21:25 | qbg | If clojure had letrec, that would work |
| 21:25 | qbg | But it only has letfn, which isn't what you want |
| 21:26 | qbg | There is a macro in contribs that will do what you want, though |
| 21:27 | qbg | ,(doc clojure.contrib.seq-utils/rec-cat) |
| 21:27 | clojurebot | "([binding-name & exprs]); Similar to lazy-cat but binds the resulting sequence to the supplied binding-name, allowing for recursive expressions." |
| 21:27 | scottj | qbg: nice thanks |
| 21:38 | yacin | ,((partial #(fn [x y] (+ x y)) 3) 5) |
| 21:38 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--10366$fn |
| 21:38 | yacin | i'm not understanding why this doesn't work |
| 21:38 | yacin | but |
| 21:38 | yacin | ,((partial + 1) 4) |
| 21:38 | clojurebot | 5 |
| 21:38 | yacin | works fine |
| 21:39 | wooby | yacin: # and (fn.. are for 2 things |
| 21:39 | qbg | ,((partial #(+ %1 %2) 3) 5) |
| 21:39 | clojurebot | 8 |
| 21:39 | wooby | ,((partial (fn [x y] (+ x y)) 3) 5) |
| 21:40 | clojurebot | 8 |
| 21:40 | Raynes | $((partial (fn [x y] (+ x y)) 3) 5) |
| 21:40 | sexpbot | => 8 |
| 21:40 | yacin | oh wow |
| 21:40 | yacin | hahaha |
| 21:40 | yacin | what a stupid typo |
| 21:40 | yacin | jeez |
| 21:40 | yacin | sorry for wasting your time wooby :P |
| 21:40 | yacin | and others |
| 21:40 | qbg | No problem |
| 21:41 | wooby | yacin: no worries, happy to help :) |
| 21:44 | mae | clojure pwns |
| 21:44 | mae | but i don't know java very well |
| 21:44 | mae | trying javafaces as an exploratory learning process... wish me luck |
| 22:01 | mmarczyk | technomancy: wrote the patch for lein #49 and commented on the issue |