#clojure log - Jul 27 2011

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:31 schemer999: how would a clojure master go about "architecting" a multi-player game like dwarf fortress clone?

0:49 Blackfoot: if i want my macro to return multiple statements, do i need to wrap them in a do?

0:54 technomancy: Blackfoot: a macro can only compile into a single form. if you need a side-effect along with a return value, do is good for that.

1:01 Blackfoot: technomancy: sweet, thanks

1:17 amalloy: i wonder if he knows dwarf fortress is single player

1:19 technomancy: I'll dwarf your fortress.

1:19 amalloy: i've been hanging out in #clojure for a year hoping you would one day say that

1:19 technomancy: I forget, did I meet you at the conj?

1:19 ahriman`: ÷¸

1:20 amalloy: nah, i had just started with clojure

1:20 didn't go

1:20 technomancy: because I was going to say, if you've met me in person you'd know that I dwarf a lot of things.

1:20 amalloy: *ponder*

1:20 technomancy: that is to say, I'm tall.

1:21 amalloy: that was one possible interpretation, but not the most interesting one

1:21 technomancy: you were thinking maybe http://ecx.images-amazon.com/images/I/51R6Y4MMKNL._SL500_AA300_.jpg

1:21 ?

1:22 amalloy: more like http://www.gumgod.com/images/andre_dvd.jpg

1:22 * technomancy prefers rick moranis

1:23 technomancy: mostly due to spaceballs

1:24 amalloy: but! you will damn well meet me at this conj

1:24 bpr: gosh dang it! I find myself typing "lein clein" more often that I'd like ...

1:24 lol

1:25 technomancy: bpr: really? I only use it when I switch branches.

1:25 * amalloy types "cake kill && cake deps" way more often than he'd like

1:25 bpr: well, i'm modifying protocol definitions, and the changes aren't being picked up by the repl (even after a restart)

1:26 technomancy: oh yeah... well I don't use protocols

1:26 bpr: but, I was mainly talking about the type-o "clein"

1:26 lol

1:26 technomancy: hah; I didn't even catch that

1:26 amalloy: technomancy: next new lein feature: autocorrection of tasks?

1:26 bpr: haha

1:27 hiredman: bpr: that doesn't track, if you are defining the protocols at the repl then you can re-def them no problem

1:27 technomancy: bpr: (swap! aliases assoc "clein" "clean") ; in ~/.lein/init.clj

1:27 amalloy: überjar is an alias for uberjar

1:28 bpr: hiredman: i'm not defining them directly at the repl. I'm using clojure-mode to send the definitions

1:28 amalloy: i wish überjar were an alias for jar. i make that mistake all the time: just trying to convince the computer to do X really well by prepending über

1:29 technomancy: amalloy: that's what test! is for

1:29 bpr: but, i have found that for w/e reason I need to clean and restart the repl after that. Otherwise, the clojure compiler will bark at me for not having defined methods in the protocol... I didn't really do a deep look at why

1:30 amalloy: technomancy: shouting is a totally different technique

1:30 bpr: well, s/defined methods/implemented methods/

1:30 amalloy: !?clean

1:30 eipiten: hi

1:31 amalloy: bpr: you've redefined the protocol, but you still have objects around that satisfy the old version

1:31 probably

1:31 bpr: well, that would seem true if a simple repl restart fixed it

1:31 technomancy: amalloy: test! is (comp test clean deps)

1:32 amalloy: sure sure. i'm just saying i like to keep my loud discussions between me and the history-expander

1:33 bpr: so here's what occuring: 1) change protocol Foo, 2) modify my record that implements Foo to track the changes, 3) send the new (defrecord ...) form to the repl, 4) bang!

1:38 amalloy: i wish more workflows involved "bang!". programming would be more exciting to the kids

1:39 technomancy: I think someone is actually working on a test!! plugin for leiningen

1:39 devn: amalloy: (go-go-go!)

1:39 technomancy: which sounds pretty gripping.

1:40 devn: technomancy: time to one up that person!

1:40 test!!!

1:40 technomancy: whoa; let's not get carried away

1:40 amalloy: technomancy: i implemented a handy ?! macro for debugging

1:40 technomancy: amalloy: surely you mean ‽

1:40 devn: (defn -=el1t3=- [x] (+ 1 x))

1:41 amalloy: i have enough unicode just trying to talk in #clojure

1:41 ain't none of that foreign stuff getting in my code

1:41 technomancy: you gotta admit, interrobang is really handy when it comes to naming predicate functions that have side-effects.

1:42 devn: meh, I remember being annoyed by TextMate wanted to use that weird sign for the [Enter] key on OSX.

1:42 s/by/when/

1:42 lazybot: <devn> meh, I remember being annoyed when TextMate wanted to use that weird sign for the [Enter] key on OSX.

1:42 devn: I recently dug around in some APL and then the other day tried J. I prefer J.

1:42 Hunting for UTF is *annoying*.

1:43 If you produce a keyboard for your language, I'm with you.

1:43 technomancy: InsufficientKeyboardException

1:43 devn: :)

1:44 APL is the extreme, and we know not to take it that far. I think in general though we can take it further in the direction of special characters and so on.

1:44 we have ? and !, . would be nice. I really like being able to (defn foo->bar [])

1:44 etc.

1:47 * devn shrugs

1:48 devn: stop. vs stop! vs stop? vs stop!? vs stop->go?, etc.

2:40 thorwil: moin!

2:41 apparently 2 arguments after & in a fn signature doesn't work

2:42 i then tried ... & [a b] and changed the call accordingly

2:43 but that changes the outcome, i.e. is not like making none of the args optional

2:45 from the point of view of the function body, what is the difference between args that appear in the fn signature separately, to args that are in a []?

2:45 amalloy: &((fn [a b] (+ a b)) 1 2)

2:45 lazybot: ⇒ 3

2:45 kumarshantanu: thorwil: what args are you passing?

2:45 amalloy: &((fn [[a b]] (+ a b)) [1 2])

2:45 lazybot: ⇒ 3

2:47 thorwil: kumarshantanu: functions. hiccup defhtmls to be used inside another defhtml

2:48 which works fine as long as i only have one of them as optional arg

2:48 amalloy: the first version takes two arguments; the second takes a single argument, a seq, and pulls it apart into two separate elements

2:48 kumarshantanu: if you want to optionally pass several functions maybe just "& fns" would work

2:49 fns would be a list of additional args passed

2:50 thorwil: I am not familiar with the Hiccup API

2:50 so maybe an example will help

2:50 thorwil: kumarshantanu: that's either what i tried that doesn't compile, or please show me the syntax for signature and call

2:51 hiredman: TCO!!!!!!

2:51 kumarshantanu: (defn foo [arg1] ) -- (foo "whatever")

2:52 (defn foo [arg & more] ..) -- (foo "whatever" "and" "more") -- more becomes '("and" "more")

2:54 (defn foo [arg & [m1 m2 & more]] ...) -- (foo "whetever" [:foo :bar :baz :quux]) -- arg = "whatever", m1 = :foo, m2 = :bar, more = '(:baz :quux)

2:55 thorwil: it's all about de-structuring

2:55 amalloy: thorwil: instead of "i tried x and it doesn't work", an actual example of something you've tried would make it clearer what you're actually trying to do (which i don't think either kumarshantanu or i have figured out)

2:55 thorwil: kumarshantanu: but shouldn't taking apart more in the body be equivalent to doing it right in the signature like i tried?

2:56 kumarshantanu: thorwil: de-structuring in the signature or in the body should work the same way -- feel free to share the code example you are trying

2:59 thorwil: well, the current state is http://paste.pocoo.org/show/447260/

3:00 except for one ) missing at the end

3:01 kumarshantanu: thorwil: which lines have the problem?

3:01 which defhtml?

3:02 thorwil: kumarshantanu: the first, in combination with the call in the last fn

3:02 amalloy: there are three args to article-content* all named "option-foo", but only the last two are optional

3:02 thorwil: as pasted, i get rubbish for option-slug-for-admin and option-aloha-for-admin

3:03 amalloy: that's just bad naming

3:04 should be maybe-linked-title, not option-...

3:04 amalloy: thorwil: you probably don't mean to wrap the last two args (when you call the function) in a [vector]

3:05 but i think you should do a little more studying on what destructuring forms *mean*, rather than trying combination after combination till you find something that works

3:06 kumarshantanu: thorwil: article-content* signature is quite unusual/complex -- it's generally not advisable

3:06 but again, only things after '&' are optional

3:07 if you pass a collection as optional arg, then it will be de-structured correctly

3:07 thorwil: oh dang, calling with no [] works, so i really misunderstood how this works

3:07 amalloy: i think thinking of things after the & as "optional" hinders understanding

3:08 kryft: amalloy: What's a good reference for destructuring forms, btw?

3:08 thorwil: thanks!

3:08 kumarshantanu: I guess it's more apt to say that & means collection

3:08 amalloy: (fn [x & more] ...): "Give me at least one argument. I'll bind the first one to x, and the rest to a (possibly-empty) sequence named more"

3:08 kumarshantanu: now, the rest is de-structuring

3:08 kryft: amalloy: (If you recommend something apart from what I'd find at clojure.org, that is)

3:09 amalloy: kryft: IIRC JoC covers it well

3:09 kumarshantanu: kryft: read up the Clj books

3:10 amalloy: but it's hard to soak in, in the abstract. i was baffled by that section anyway, until i'd tried a number of interesting things myself

3:10 kumarshantanu: and this -- http://blog.jayfields.com/2010/07/clojure-destructuring.html

3:10 kryft: amalloy: Ok, that's what I'm reading, actually. :)

3:10 amalloy: But I didn't come away feeling like I'd really understood them completely.

3:11 amalloy: same here. just try some crazy things, see what happens

3:11 kryft: kumarshantanu: Thanks, that's the kind of thing I had in mind.

3:11 thorwil: kumarshantanu: article-content* is basically a template with slots for optional content and the sig, now that it is correct, is a direct result of that. i'm all ears if you know a more elegant way to the same result ;)

3:12 kryft: JoC implied that destructuring was a bit basic compared to "pattern matching" facilities in other languages that I don't know, and that there's a contrib library for pattern matching in clojure. How lacking is destructuring really?

3:12 amalloy: thorwil: take a map argument

3:13 kumarshantanu: thorwil, it may be more idiomatic if you put the *required* args first, followed by an optional map of keyword to argument

3:13 amalloy: (defn content [basic-stuff {:keys [optional-1 optional-2]}] ...) (content "whatever" {:optional-2 "test"}) ;; now the user can pass option 2 without optiion 1 if he wants

3:13 kumarshantanu: (defn foo [arg1 arg2 & {:keys [p1 p2] :as opt}] ...)

3:14 (foo "arg1" "arg2" :p1 p1-value :p2 p2-value)

3:15 thorwil: i see

3:15 amalloy: kryft: pattern-matching is pretty cool

3:15 kumarshantanu: thorwil: you can use 'opt' to determine that the consumer doesn't pass in an unwanted argument

3:15 thorwil: helpful in the case of typos, you know

3:17 amalloy: i'm not very comfortable with any languages that contain it, but (among other things) it lets you define functions as a set of cases rather than a "mess" of nested ifs

3:18 thorwil: comapring destructuring to pattern matching, isn't the first all about sequence and names, where the second adds the ability to check types and ranges?

3:20 amalloy: thorwil: equality too. you can match the pattern [x x]: two args which are identical

3:37 negaduck: is there smth like assoc-in, but that works on lists that are values of hash-map?

3:37 or on vectors

3:37 amalloy: assoc-in works on vectors

3:38 negaduck: ok. I'll try that

3:49 Pupeno_: Any recommendation of something to read on Clojure to get refreshed? I haven't used Lisp or Clojure in quite a while, so I find myself getting stuck on simple things.

3:49 I mean, for free, online... otherwise I suppose I just need to buy a book.

3:51 _bat: how about this? https://github.com/relevance/labrepl

3:53 tufflax: Pupeno now about the documentation on clojure.org?

3:53 how about

3:53 kryft: amalloy: Sounds fancy.

3:54 Pupeno_: tufflax: the problem with that is that it's not ordered in a way you can read one part after the other and get a good overview of everything. You can easily miss stuff and when I tried to re-learn things, like how to write macros or work with sequences, it was very sparse.

3:57 wink: I agree

3:57 I'm only starting and while the docs are quite good, it certainly would be quicker to be guided a bit

3:58 but.. it works at least :P

3:58 tufflax: I agree that it does not teach how to write macros, but the rest is good. But I found that it gave a very good overview because it was compact.

3:58 Pupeno_: wink: last time I was coding on common lisp and I moved to clojure, so clojure.org was enough to re-adapt... this time I'm coding in leaser languages.

3:58 wink: I'm reading "Expert C Programming" right now, it's awesome

3:59 kumarshantanu: Pupeno_: this? http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Learning_material_available_online

4:00 Pupeno_: Is labrepl running somewhere or running it local is the only way?

4:00 Ah... I didn't expect it to be so much done: http://thinkrelevance.com/blog/2008/09/16/pcl-clojure.html

4:00 :)

4:01 kumarshantanu: Pupeno_: there's also a section called Clojure for Common Lisp Programmers

4:01 Pupeno_: kumarshantanu: I'm not a CL programmer anymore.

4:01 kumarshantanu: ah, okay

4:01 wink: is there a "Clojure for people who hated OCaml"?

4:02 Pupeno_: Now I'm remembering I learned a lot with tech talks.

4:02 kryft: wink: What's awesome about it?

4:03 wink: kryft: it's nicely written, it's funny, it's exact, it's a very good followup after K&R

4:03 kumarshantanu: You can read this Clojure book online -- http://clojure-notes.rubylearning.org/

4:04 wink: just found that one as well. seems I need to get reading even more

4:04 Pupeno_: I presume this is still relevant, right: http://blip.tv/clojure/clojure-data-structures-part-1-714056

4:14 negaduck: I can do the following: (def *map* {:a [1 2] :b [3 4]}) (assoc-in *map* [:b 1] 5) => {:a [1 2], :b [3 5]} Is there a way to add a value to that list rather than to change it's values?

4:17 raek: negaduck: (update-in *map* [:b] conj 5) => {:a [1 2], :b [3 4 5]}

4:17 negaduck: i've just thought about that.

4:17 raek: thanks

4:29 kjeldahlw: Tricky question; I've got a "core" module with a log method in it, that stores *out* in a closure, binding to it when somebody calls log. But when I "use mod.core" from another module "repl.helper", it seems *out* is different from the *out* in repl.helper, so log output disappears. Any idea why, and/or workarounds?

4:46 Funny thing though, when doing a (def my-out *out*) in my mod.core module, it gets bound to a java.io.OutputStreamWriter, but when I check the values of *out* in repl, it's a java.io.PrintWriter

4:51 negaduck: which is faster: (conj vec item) or (cons lst item)? I need to frequently add elements to collection. I guess list should be faster for that.

4:54 Chousuke: lists are faster I guess

4:54 they're simpler

4:54 but of course you don't get random access then

4:55 volton: ,(doc rational?)

4:55 clojurebot: "([n]); "

4:55 volton: ,(source rational?)

4:55 clojurebot: Source not found

4:56 volton: ,(doc rationalize)

4:56 clojurebot: "([num]); returns the rational value of num"

4:56 volton: Why doesn't it show the docstring for rational? ?

5:00 terom: There seems to be a little "bug" in the implementation of 'rational?. The docstring should be before the argument list and not vice versa.

5:02 volton: terom: should I open an issue?

5:03 terom: and there is another problem with it: if (rational? x) is true it is not guaraneed that numerator and denominator work

5:05 kjeldahlw: Hmm, my *out* challenges seems emacs related, works fine in a console window repl.

5:06 terom: volton: I would check if that's already fixed in the latest version before opening an issue.

5:06 volton: terom: what do you think about numerator and denominator?

5:07 terom: volton: I don't have an opinion on that yet. Can you provide an example case where that problem occurs?

5:10 volton: terom: sure, https://gist.github.com/1108979

5:11 terom: Based on docs numerator and denominator work on Ratios, but rational? returns true for integers, Ratios and decimals. One could use ratio? to check if the number is a Ratio.

5:11 volton: (frac-pp 3) fails because numerator does not work for Integer

5:13 terom: Oh I see, then this is not explained very well in THe Joy of Clojure

5:14 TobiasRaeder: Morning

5:16 I got a question about map destructuring considering

5:16 (defn do-stuff

5:16 [request & {:keys [continue] :or {continue (extract-continue-url-from-request request)}]

5:16 ;; do some stuff

5:16 (redirect continue))

5:16 works fine (as in extracts the url from the request)

5:16 when called (do-stuff request)

5:16 but when you call (do-stuff request :continue nil) continue is set to nil and the :or doesn't seem to work

5:16 Clojure 1.2.0 here. Is that the way it is supposed to work?

5:17 terom: TobiasRaeder: please don't paste code here, use gist/pastebin or something

5:17 TobiasRaeder: yeah makes sense, sorry

5:18 https://gist.github.com/1108995

5:19 terom: volton: hmm, could be, but maybe you have missed a point; in JoC it says (p. 67, section 4.2.2) that "you can use rational? to check whether a given number is one and then use rationalize to convert it to one". Your code seems to be doing the opposite.

5:19 volton: terom: I changed the function accordingly, now when I call (frac-pp2 3) I get java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Ratio (NO_SOURCE_FILE:0) https://gist.github.com/1108979

5:20 terom: you are right

5:20 terom: But I think (numerator (rationalize 3)) still does not work. Probably because it's coerced to Integer again...

5:21 volton: terom: that's exactly my problem

5:26 terom: do you think this behavior is correct and is there an elegant way around it?

5:26 terom: volton: I don't have an easy answer for that. There could be a better way, but it seems that you might need to have a special case for integers (maybe using integer?).

5:28 volton: it could be either one, correct or not. Maybe this is something which could be brought up in the mailing list (if it's not discussed there already)...

5:29 volton: terom: I will have a look. The Docstring issue has been fixed on head at least

5:29 terom: It makes sense that numerator and denominator only work for Ratio type, but on the other hand...

5:30 volton: terom: no wait, it hasn't: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L3186

5:31 terom: yes, but this is not the behavior I expect:

5:31 ;(class (rationalize 3))

5:31 ,(class (rationalize 3))

5:31 clojurebot: java.lang.Long

5:39 volton: terom: is that change ok? https://github.com/pcomans/clojure/blob/master/src/clj/clojure/core.clj#L3186

5:41 terom: volton: looks good to me

5:49 TobiasRaeder: I think the :or only kicks in if there is no value for that key in the map. Now there is a value (nil).

5:53 (Meant to say actually that only when the key exists.)

5:53 TobiasRaeder: yeah

5:53 terom: (Argh, I mean when the key does not exist.)

5:54 TobiasRaeder: i figured as much, was expecting an if like behaviour

5:54 what i really wanted to know if it is supposed to be that way

6:00 terom: TobiasRaeder: I don't know if there is another authoritative source besides the, hmm, well, source code itself, but I think it's supposed to be a default value in case of missing key, not if like.

6:00 TobiasRaeder: Okay :)

6:00 terom: Maybe the keyword :or is a bit misleading (and better would be :default or something like that?).

6:01 TobiasRaeder: maybe default yeah

6:01 and :or atleast gave me the feel it would behave like the regular or

6:01 or maybe even

6:01 :missing-keys

6:02 {:keys [continue] :missing-keys {continue (get-stuff-from-reqeust request)}

6:03 terom: Could be. Though I guess :or is so rarely used that it does not pay off to change that...

6:04 TobiasRaeder: atleast i really like it (apart from that)

6:04 but might be true

6:04 volton: terom: https://github.com/clojure/clojure/pull/9

6:06 raek: volton: Clojure does not use the github issue and pull request systems

6:06 (there seems to be no way to turn of pull requests)

6:07 volton: see http://clojure.org/contributing

6:07 and http://clojure.org/patches

6:08 volton: raek: thank you, in this case I will have to do this later

6:20 tufflax: I've not heard much about defrecord and protocols... what is a typical use case in idiomatic clojure code without java interop. Is it a good idea, for example, to make a "Character" protocol and a "Player" record or something in a game. It feels a bit too much like OOP for me to be comfortable with it, but on the other hand records are immutable and so on, right?

6:24 jonasen: I'm trying to use ComboBox from goog.ui and I'm unable to write an

6:24 ns-form which would allow me to drop the namespace part of the

6:24 constructors. i.e., I have to write (goog.ui/ComboBox.) instead of

6:24 (ui/ComboBox.) or just (ComboBox.)

6:25 https://gist.github.com/1109097

6:46 kjeldahlw: Ok, narrowing down my emacs/slime/swank trouble with output. Using a "console" repl ("lein repl"), then a (.print System/out "hello") works fine, but it does not if run in Emacs after clojure-jack-in . Ideas? The funny thing is I believe it worked on my home computer last night (I'm at work now)...

6:46 Sorry, that should have been (.println System/out "hello")

6:47 Same with System/err ...

7:06 terom: jonasen: I'm not that familiar with ClojureScript (which I guess that code is), but if you'll require [goog.ui :as ui] in addition to [goog.ui.ComboBox :as ComboBox] then I guess you should be able to write (ui/ComboBox.)

7:07 (And honestly I don't know anything about that, I'm just mimicking from http://code.google.com/p/jngmisc/source/browse/clojure/geom/convex-hull.cljs this example.)

7:21 jonasen: terom: I've looked at similar code in the twitterbuzz demo but I keep getting 'required "goog.ui" namespace not provided yet' errors. I'll try to compile the convex-hull example and see if I can get that to work. Thanks

7:56 raek: kjeldahlw: in swank, System/out is connected to the terminal of the swank server, not the slime repl

7:57 it probably shows up in a buffer called *swank* or something

7:57 kjeldahlw: you propably want to use *out* rather than System/out

7:57 kjeldahlw: raek: Thanks. See my recent posting to the clojure users list...

7:58 raek: My venture into System/out etc was like a blind man in a maze; just blindly poking around.

8:29 Leonidas: is there some kind of partition-with-overlap?

8:30 dnolen_: ,(doc partition)

8:30 clojurebot: "([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."

8:30 dnolen_: ,(partition 2 1 [1 2 3 4 5])

8:30 clojurebot: ((1 2) (2 3) (3 4) (4 5))

8:31 jcromartie: ,(partition 2 1 [1 2 3 4 5 6])

8:31 clojurebot: ((1 2) (2 3) (3 4) (4 5) (5 6))

8:31 ejackson: dnolen: beat meto the draw again !

8:31 jcromartie: I remember something about placeholders

8:31 ,(partition 2 1 nil [1 2 3 4 5 6])

8:31 clojurebot: ((1 2) (2 3) (3 4) (4 5) (5 6) ...)

8:31 jcromartie: not sure

8:31 Leonidas: oh, ok, that was too simple

8:31 * Leonidas punshes himself to read the docs, not just only look at the examples

8:31 jcromartie: Are there any guidelines on argument ordering for functions?

8:31 dnolen_: ,(partition 3 3 nil [1 2])

8:31 clojurebot: ((1 2))

8:31 jcromartie: like, what goes first?

8:32 dnolen_: ,(partition 3 3 (repeat nil) [1 2])

8:32 clojurebot: ((1 2 nil))

8:32 Leonidas: ,(partition 3 1 (range 10))

8:32 clojurebot: ((0 1 2) (1 2 3) (2 3 4) (3 4 5) (4 5 6) ...)

8:32 Leonidas: most excellent

8:32 ejackson: often the col/seq goes last so you can use the function in HOF and bind the parameters

8:34 jcromartie: ejackson: what do you mean by that?

8:35 like using partial?

8:35 ejackson: zakly

8:35 jcromartie: I see

8:35 I will continue this discussion later

8:36 (commute self metro (hours 2))

8:36 ejackson: ouch

8:36 good luck

8:38 mdrogalis: That's a long trip..

8:54 Leonidas: ,(doc rand-int)

8:54 clojurebot: "([n]); Returns a random integer between 0 (inclusive) and n (exclusive)."

9:14 tsdh: Hi

9:15 Is there some sequence creating function that returns nil if nil was given to it?

9:16 (vec nil) ==> [], but I'd like to have (foobar nil) ==> nil, (foobar 17) ==> (17)

9:16 ejackson: seq

9:17 but you'd have to (seq [17])

9:17 tsdh: ejackson: (seq 17) ==> Exception

9:17 ejackson: (seq [nil]) ==> (nil)

9:18 Maybe I should mention the usecase. I want to be able to do: (or (foobar arg) (some-other-seq))

9:19 mdrogalis: ,(rant-int 5)

9:19 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: rant-int in this context, compiling:(NO_SOURCE_PATH:0)>

9:19 tsdh: So if arg was provided, I want a seq containing it. Else, it should be logical falso.

9:19 ejackson: and foobar returns a seq of a primitive arg, or nil if arg is nil

9:19 mdrogalis: It's kind of frustrating to always have to run java -jar clojure.jar to start a repl. Has anyone come up with a quicker solution?

9:20 ejackson: mdrogalis: leiningen ?

9:20 lein repl

9:20 tsdh: ejackson: Yes, so basically (and arg (vector arg))

9:20 mdrogalis: I thought that was just for use in a single project. You can just use it for.. Anything?

9:20 Scriptor: M-x clojure-jack-in :D

9:21 mdrogalis: ejackson: lein has made Clojure so much more friendly since I started. Such an awesome tool.

9:21 ejackson: tsdh... well then (and arg (vec (list arg))) should do it

9:21 mdrogalis: its groovy stuff indeed.

9:22 tsdh: ejackson: Is there anything better with (vec (list arg)) than (vector arg)?

9:22 ejackson: no

9:22 tsdh: I'd assume the contrary...

9:22 Ok. :-)

9:22 ejackson: sorry, i mislead you

9:27 mdrogalis: So how's the market for Clojure jobs?

9:40 fhd: mdrogalis: Almost nothing here in Germany, all guys from the user group are hobbyists.

9:40 mdrogalis: fhd: That's too bad. :/

9:40 fhd: mdrogalis: Tell me how to convince clever people to learn yet another language and I'll tell you about a clj job :)

9:40 mdrogalis: Haven't found a way to convince my colleagues yet. We have a lot of languages in the mix, so they're reluctant.

9:41 mdrogalis: fhd: I think Lisp for the JVM just kind of says it all. ;)

9:41 fhd: mdrogalis: Yeah, but people who don't get Lisp are usually afraid of it :)

9:41 mdrogalis: fhd: I'm not out of school yet though. Maybe it'll catch on it America.

9:41 fhd: It's okay. We don't need them anyway! Haha.

9:42 fhd: mdrogalis: I used to be like that, before I started to use Emacs and Emacs Lisp intensively

9:42 mdrogalis: But the popularity is skyrocketing ATM, so I guess we'll get more and mor ejobs :)

9:42 ejackson: pish, quit your job to code clojure. that's what i did :)

9:42 mdrogalis: fhd: I'm not really out to convince anyone. If they check it out, they'll see that people like it.

9:42 fhd: mdrogalis: I'm mostly worrying about how to introduce it at my company, because I like my team and don't want to leave

9:43 mdrogalis: fhd: Bloodless overflow. Take the power back!

9:43 fhd: mdrogalis: I have plans… :)

9:44 thorwil: i have a map that resembles {:form-params {"from" "from-val" "to" "to-val"}}. i wonder if there's a better solution to take that apart as argument, than http://paste.pocoo.org/show/447441/ ?

9:50 chouser: thorwil: destructuring nests

9:52 manutter: ,(let [{{:strings [from to]} :form-params} {:form-params {"from" "from-val" "to" "to-val"}}] (str "From is " from ", and to is " to))

9:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.Exception: Unsupported binding form: :strings>

9:52 manutter: ,(let [{{:strs [from to]} :form-params} {:form-params {"from" "from-val" "to" "to-val"}}] (str "From is " from ", and to is " to))

9:52 clojurebot: "From is from-val, and to is to-val"

9:52 manutter: There

9:53 Woo, that means I *am* finally beginning to understand destructuring :)

9:53 thorwil: and here i started to think it doesn't nest :/

9:54 thanks! :)

9:55 chouser: you can't nest anything inside the :keys, :strs, or :syms parts, which may have thrown you off

10:11 tsdh: Does anyone have some simple function that shows an image in a swing frame?

10:20 eipiten: is there someone who can help me with a bit of basic moustache?

10:20 thorwil: eipiten: state your issue as clear as you can and see ;)

10:21 raek: tsdh: (doto (JFrame. "Pretty Picture") (.add (ImageIcon. <image filename or URL>)) (.show) (.pack))

10:21 Fossi: eipiten: don't shave

10:21 easy as that

10:21 tsdh: raek: Thanks.

10:21 Fossi: although for a bit more advanced moustache it involves only shaving in part

10:22 eipiten: I have a hello world set up w/ working routes, but I can't seem to get anything other than plain text responses to work

10:23 so (def handler (app ["hi"] "hi")) works fine but (def handler (app ["hi"] (response "hi"))) or anything like it pukes

10:23 raek: tsdh: it is common to load images from the classpath. if you have an image in your-project-dir/resources/foo/bar.png you can get an URL for it with (io/resource "foo/bar.png")

10:24 (where io = clojure.java.io)

10:24 eipiten: you generally don't write handlers inline in the app form. literal strings are one exception used for debugging

10:24 tsdh: raek: Nope, I have some java lib that generates an ImageIcon without saving it to the fs.

10:25 raek: eipiten: the form to the right oof the path vector shall in the general case evaluate to a handler function

10:26 (defn my-handler [request] (respose "hi")) (def handler-dispatcher (app ["hi"] my-handler))

10:26 Moustache differs from compojure in this way

10:26 but IMHO the Moustache way is more modular

10:27 eipiten: well, I wanted to get my example to the most bare bones I could

10:27 if I call a function, I end up w/ a 500 error, the example I gave throws a 404 and if I pass a map with the values response should return, it throws a 405

10:28 raek: well, the most basic case would be to use "my-handler" as the handler you give to ring

10:28 app is a macro, so the meaning of code literals are different from standard clojure

10:29 eipiten: ah

10:29 raek: eipiten: I really recommend looking at the syntax description: http://moustache.cgrand.net/syntax.html

10:29 eipiten: thanks

10:29 raek: if you are comfortable reading it, it will explain everything

10:29 thorwil: eipiten: also have a look at https://gist.github.com/109955

10:31 raek: eipiten: a small demo web app I made once: https://github.com/raek/lcug-guestbook/blob/master/src/se/raek/lcug/guestbook/controller.clj

10:32 eipiten: I think those examples and the syntax description are just what I need - thanks so much

10:32 Apparently, my Google-fu needs a good bit of work as well :(

10:33 raek: and for everything else, I would like to point to this: http://brehaut.net/blog/2011/ring_introduction

10:33 a great overview by brehaut

10:34 eipiten: That really helped to understand how the stack works, but... perhaps I'm making typos that I'm not catching.

10:34 *helped me

11:02 pdk: (doc juxt)

11:02 clojurebot: "([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

11:07 cemerick: mdrogalis: If you're good, you shouldn't have a problem getting a Clojure job in the U.S.

11:08 mdrogalis: I'll keep that in mind, cemerick :)

11:08 Scriptor: cemerick: how good is good? :p

11:09 technomancy: you have to be Clojure Certified

11:10 * cemerick registers clojurecertified.com :-P

11:10 technomancy: cemerick: only to prevent someone else from actually doing it, right? =)

11:11 cemerick: Scriptor: "smart and gets things done" is a good but unfortunately co-opted characterization

11:11 technomancy: $250 will get you an authentic personalized "Clojure Certified" credential.

11:12 The Enterprise needs to know who to hire, etc.

11:12 technomancy: they seem to be doing all right with montgomery scott and mr. laforge.

11:12 ejackson: cemerick: NCC-1701 ?

11:13 * technomancy can't compete with the likes of them

11:13 cemerick: ejackson: 1701-D, please.

11:13 ejackson: i wanted to keep it open

11:14 cemerick: -A through -C were lemons.

11:14 ejackson: don't want to get into trekkie vs trekker

11:14 :)

11:14 cemerick: BTW, if someone can get emacs to look like LCARS, I'll switch this afternoon. :-P

11:15 pdk: is this certificate in crayon

11:16 technomancy: it's distressing to think that in the 24th century they still haven't figured out tactile feedback for touch-based interfaces.

11:17 real-life lcars would be as useless as an ipad =\

11:17 cemerick: pdk: No, this is a serious endeavor.

11:17 The certificate will be masterfully typeset in Comic Sans.

11:18 Hodapp: technomancy: I'd settle for any kind of feedback at all on some interfaces.

11:18 ejackson: technomancy: imagine the malware, eep.

11:19 * Hodapp looks at pdk

11:19 Hodapp: you...

11:25 pdk: awesome

11:25 is the title gonna be in wordart

11:26 raek: or in "Web 0.1" style? http://thedailywtf.com/Articles/Web_0_0x2e_1.aspx

11:27 Hodapp: pdk: howzacome you never hang out in #zdoom anymore :(

11:27 pdk: maybe i should poke in again

11:27 Hodapp: it's still a big trollfest

11:27 BBG still talks about guns

11:28 pdk: but in a land where folks take themselves seriously as fuck on an irc channel for doom...

11:28 is he still dreaming of being the world's most toked up gunsmith

11:29 Hodapp: idk, something like that

11:30 pdk: and the rest of the gang?

11:30 Hodapp: I can't even remember who was around when you were

11:31 pdk: faint and nxn were certainly using it like their blog then

11:31 Hodapp: they're still around

11:31 just idle there awhile

11:33 pdk: and is bs still serious mode

11:44 Hodapp: pdk: yup

11:44 pdk: some things never change

11:54 Leonidas: clj markov.clj -n 250 < pg11.txt 4.45s user 0.10s system 235% cpu 1.933 total

11:54 can anyone explain to me how I got 235% CPU?

11:54 code is here: https://github.com/Leonidas-from-XIV/sandbox/blob/master/markov.clj

11:54 manutter: multi-core machine?

11:54 Leonidas: yeah, 2 cores + HT

11:55 but I didn't write any parallelization code

11:55 not even pmap or something implicit

11:55 pjstadig: Leonidas: where'd you get the 235% number?

11:55 manutter: I haven't got a clue, so I'll just blame an undetected Higgs boson.

11:55 Leonidas: pjstadig: 'time'

11:56 pjstadig: hmm

11:56 i know load numbers also include I/O, but i'm not sure if that's true with time

11:56 doesn't seem like it

11:57 Leonidas: maybe i should run visualvm on it, but i am surprised how well clojure performs in this case :)

11:58 Hodapp: yaaay, I got Clojure running on my piece-o-crap Eeeeeee PC (albeit off of a flash drive) so I'll be able to play around with it if I'm awake during a red-eye flight

12:45 volton: are there any Clojure contributers around?

12:46 cemerick: Quite the existential question.

12:47 volton: :-D

12:47 cemerick: volton: What are you looking for specifically?

12:47 volton: well I need to get a patch into clojure core: https://github.com/pcomans/clojure/commit/45153721098ae47c1df272514f226dce37a7803b

12:48 technomancy: good luck!

12:48 volton: but I don't feel like signing the CA and sending it to Rich just to swap 3 lines of code ;-)

12:48 technomancy: volton: then what's to stop you from suing when the patch is applied?

12:49 cemerick: volton: just a message to clojure-dev will likely do it — someone will slip something that minor into another unrelated commit.

12:49 volton: technomancy: Threshold of originality

12:49 technomancy: volton: I didn't say it was reasonable, but that's the policy.

12:49 you and I know that it's impossible to copyright a patch like that

12:49 but that's the policy.

12:50 wjlroe: Anybody here know Noir? I want to know how to access the request - the content-type in fact

12:50 dakrone: volton: is there a jira issue for that? I have a CA, I'll poke the patch up there for you if you like

12:50 volton: I'll send a message to clojure-dev, it's a stupid bug and it should get fixed

12:51 fmw: in clojurescript, is there a way to make the provider to produce a function call without adding ".call(null)"? i.e. editor__1963.makeEditable() instead of editor__1963.call(null)

12:51 cemerick: dakrone: I already have a couple of patches that should get into 1.3; I can slip it in there.

12:51 dakrone: cemerick: cool

12:51 volton: cemerick: that would be great

12:51 do I still have to send the message?

12:52 cemerick: volton: no; but if it's not fixed in the next beta release, bug me again

12:52 volton: cemerick: okay I will, thank you

12:57 fmw: s/provider/compiler

12:57 lazybot: <fmw> in clojurescript, is there a way to make the compiler to produce a function call without adding ".call(null)"? i.e. editor__1963.makeEditable() instead of editor__1963.call(null)

12:59 dnolen: fmw: any particular reason you want that?

13:00 fmw: dnolen: calling with .call(null) behaves differently (i.e. breaks it) than calling it normally

13:01 dnolen: http://closure-library.googlecode.com/svn/docs/class_goog_editor_Field.html the .makeEditable function has an optional argument that seems to get triggered somehow with .call(null)

13:01 while .makeEditable() works fine

13:01 dnolen: fmw: don't see how's that possible given what call does.

13:02 fmw: in anycase sounds like a bug with makeEditable.

13:03 fmw: dnolen: yes

13:05 dnolen: fmw: that code looks wrong - should be editor_1963.makeEditable.call(null)

13:05 fmw: dnolen: editor__1963.makeEditable(); works fine, editor__1963.makeEditable.call(null); gives: Uncaught TypeError Object [object DomWindow] has no method 'getOriginalElement'

13:06 dnolen: how do you mean wrong? ethe only difference with what you wrote is the double underscore in editor__1963 (which is what the var is called by the compiler)

13:08 the TypeError basically means it somehow ditches the Field object and tries to call stuff on the iframe (wich is a DomWindow)

13:08 s/wich/which

13:08 lazybot: <fmw> the TypeError basically means it somehow ditches the Field object and tries to call stuff on the iframe (which is a DomWindow)

13:09 dnolen: editor__1963.makeEditable.call(editor_1963)

13:09 fmw: ^

13:09 fmw: dnolen: that works fine

13:09 dnolen: I tried that too, but when I pass editor to the function it still does .call(null, editor__1963)

13:10 I tried that by manually editing the outputted javascript

13:11 dnolen: ah nvm, seems like I can call it like that from cljsc too

13:12 don't know why that didn't work when I tried that before, must've made a typo

13:12 dnolen: thanks for your help!

13:14 it is still broken, though, because you shouldn't be providing the Field instance as an argument but either no argument or a string with the iframe src attribute. but that is a bug in goog.editor, I suppose and at least it works like this

13:21 dnolen: fmw: np

13:24 ibdknox: Is there still interest in a repl that drives the browser instead of rhino? Or has someone already got that working?

13:25 duck1123: What about MozRepl?

13:25 couldn't that be used?

13:26 ibdknox: I think ClojureScript would have to be able to emit itself

13:26 which I don't think it can do yet

13:26 hiredman: thats not true

13:27 ibdknox: which part?

13:27 hiredman: you just need a jvm and js repl somewhere

13:27 jcromartie: quick poll: how many core.clj<n> do you have in Emacs :)

13:27 hiredman: the jvm passes forms into the js repl and reads the result

13:27 technomancy: jcromartie: uniquify, dude

13:27 hiredman: technomancy: word

13:27 jcromartie: oooh?

13:27 ahriman`: jcromartie eclipse is not a choice?

13:27 ohwow_: hello

13:27 ahriman`: only emacs?

13:28 jcromartie: heh, any editor, fine :)

13:28 ahriman`: 0!

13:28 Scriptor: 0 :p

13:28 ahriman`: core sucks :P

13:28 scottj: does ccw have any refactorings?

13:30 duck1123: Is there any sort of script where I can connect to my swank session and eval forms from the command line?

13:30 scottj: ibdknox: have you seen swank-js? if there were a clojurescript function that could take some forms and output the translation as a string you could send that over swank-js to your browser.

13:30 duck1123: I'm looking to have a script force a namespace to reload

13:31 scottj: I have a function that takes scriptjure and sends it via mozrepl to the browser using C-x C-S-e

13:31 technomancy: duck1123: you need a socket repl for that. easy to do with netcat though.

13:32 ibdknox: scottj: I assume swank-js is tied to emacs?

13:32 scottj: ideally, it'd be editor agnostic (especially since I use VIM) :D

13:33 I'm looking through the compiler, and it seems it would be fairly easy to catch all the emitted stuff

13:33 then I was just going to send it over a websocket to the server

13:34 err

13:34 to the browser, rather

13:34 jcromartie: technomancy: thanks... all set up now :)

13:36 scottj: ibdknox: I think there are a lot of people that want that.

13:37 ibdknox: let's see if my assumptions hold up then :) I'll report progress my progress. Hopefully by tonight we can all send alerts from our repls :D

13:37 scottj: I'd hope though that the repl were improved over the stock one in that it didn't exit when an exception is thrown

13:37 ibdknox: scottj: haha, baby steps :)

13:38 amalloy: technomancy: man, uniquify. that one goes straight to .emacs

13:39 technomancy: amalloy: the infuriating thing about it is that it's not on by default.

13:41 duck1123: since he's not going to suggest it, I will for him. Get the emacs-starter-kit

13:41 so many good defaults

13:44 Hodapp: Sigh, banned from #java.

13:45 amalloy: hahaha, good old ##java

13:45 i've been banned from #git at least once. never figured out why

13:45 Hodapp: tjsnell called me an idiot and then couldn't back it up.

13:47 ahriman`: can anyone invite me to #java?

13:47 rlubke: Gave up on the channel a while back.


13:51 Scriptor: hey, I've been basically told linked lists is overengineering in #php

13:54 Hodapp: lol

13:57 amalloy: Scriptor: you should try doing functional programming in php

13:57 it's funny times

13:58 i guess you probably have, though, come to think of it

13:58 * Hodapp looks at amalloy

14:04 ohwow_: Hello guys, I wonder if you could recommend me a book on Clojure. I am familiar with Scheme and functional programming, however I know nothing about Java and its infrastructure (JVM, Ant/Maven, Eclipse, etc).

14:05 seancorfield: I'm not sure that any of the Clojure books go into much detail on the Java side of things?

14:06 cemerick: We are trying to provide a gentle intro, though we assume either Ruby or Python experience.

14:06 kumarshantanu: ohwow_: Oh Wow! (I mean, you are lucky to have been away from Java! Pun intended)

14:06 seancorfield: The two I'd recommend are in progress: Clojure in Action by Amit Rathore; Clojure Programming by Chas Emerick et al.

14:06 ohwow_: kumarshantanu: I had been punched in the balls by C#, tho

14:06 I see

14:06 what about that "The Joy of Clojure"?

14:06 seancorfield: CiA is due in August I think. cemerick when is Clojure Programming due?

14:07 JoC is more about the "why" of Clojure/FP so it sounds like you've got that covered?

14:07 cemerick: seancorfield: I'm going to say "Fall", because I have no specific info beyond that. Don't ask. :-(

14:07 ohwow_: FWIW: http://oreilly.com/catalog/0636920013754/

14:07 ohwow_: o i c

14:07 seancorfield: LOL, writing a book is an... interesting... endeavor... I don't envy you :)

14:08 cemerick: We need to get a new rough cuts pushed out.

14:08 kumarshantanu: ohwow_: you can avoid Ant, Maven and Eclipse, but some Java will behelpful

14:08 ohwow_: What does `rough cuts' mean?

14:08 ibdknox: it's a beta version of the book ;)

14:08 cemerick: It's like Manning's MEAP, but for O'Reilly.

14:08 seancorfield: available in various drafts as it is written

14:08 ohwow_: hm

14:08 i see, thanks

14:09 seancorfield: and Packt's RAW (Read As it's Written)

14:09 cemerick: Hasn't Clojure in Action been planned for release for something like 6 months now? I thought Amit was basically done with it at the conj…?

14:09 seancorfield: i love the MEAP system - and i'm enjoying Clojure Programming rough cut too

14:09 ohwow_: What about this one: http://www.amazon.com/gp/product/1430272317?ie=UTF8&tag=aleottshompag-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=1430272317

14:09 seancorfield: cemerick: it's "done" now but there were quite a few revisions even recently

14:10 pdk: is rough cuts worth it if you've already read joy of clojure and some others

14:10 i heard about it through brian carper's blog

14:10 seancorfield: last update to Clojure in Action MEAP was february... hmm, thought I'd had an update since then

14:10 pdk: i bought Clojure Programming even tho' I have Clojure in Action and Joy of Clojure :)

14:11 i think they all offer something different

14:11 pdk: and has it covered stuff they don't have

14:11 cemerick: seancorfield: The next rough cuts push will contain massive improvements, FWIW.

14:12 ibdknox: cemerick: in what way?

14:12 seancorfield: and there's going to be an updated Programming Clojure too?

14:12 technomancy: seancorfield: second edition is in the works

14:12 seancorfield: i'll buy that once an early version's available

14:12 kumarshantanu: ohwow_: there's a title called "Big Java" that probably quickly covers the Java background

14:12 cemerick: ibdknox: In every possible way :-) Trying to maintain a changelog more detailed than "Macros chapter expanded", etc proved to be impossible.

14:13 ibdknox: hahaha

14:13 cemerick: awesome :)

14:13 seancorfield: the changelog was longer than the book? :)

14:13 amalloy: cemerick: "macros chapter expanded". i love it

14:13 cemerick: glad someone caught it :-D

14:13 ibdknox: seancorfield: did you get anyone willing to talk about clojurescript for the next bay area meetup?

14:14 seancorfield: geek humor... :)

14:14 ibdknox: no one from the project lives close enough so i'm not sure what we'll end up covering

14:14 i think we'll cover noir at the next meeting (since the author is local)

14:15 ibdknox: haha, that's me ;)

14:15 seancorfield: ah, didn't recognize the nick

14:15 ibdknox: if I can get my browser repl working soon, I might have some fun stuff to cover in CLJS too

14:15 hiredman: man, posts to the dev mailist have gotten awful formal all of a sudden

14:15 seancorfield: (and i have the memory of goldfish when it comes to names)

14:16 cemerick: hiredman: if so, it wouldn't be the worst shift in the world

14:16 hiredman: cemerick: sure, but pretty bad regardless

14:16 jcromartie: http://my.safaribooksonline.com/book/-/9781449312657 <- step 1: add clojure.jar to your project

14:17 hiredman: writing a series of bullet points is great, but headings and subheadings with paragraphs is tldr

14:17 cemerick: eh, I missed that

14:17 chouser: our little project is growing up *sniff*

14:17 * chouser wipes away a tear

14:17 hiredman: ugh

14:17 a wall of text in no way is an indication of maturity or quality

14:18 it is an indication of an idea that is hard to explain or too complicated

14:18 cemerick: I assume chouser means the escalation of "social" problems on the list.

14:19 She can'na hold togetha, capt'in.

14:19 hiredman: well, I think the blog posts as email have been limited to the clojure list, or did some of those end up clojure-dev?

14:19 cemerick: nah, dev is very sane.

14:19 Very limited membership, too.

14:21 hiredman: ah, you mean the "beefing" msg in dev

14:21 chouser: I actually liked the 'dir' message. I wish I had thought of the "orthogonality doesn't apply" argument when they killed my "show" msg

14:21 hiredman: yes

14:21 chouser: s/msg/fn/

14:21 hiredman: I dunno

14:21 cemerick: *shrug* shoulda gone into a wiki page, but I won't fault him for that

14:21 hiredman: I cannot bring myself to read deeper than the headers

14:22 * hiredman is still annoyed about the lack of :around as a repl option

14:24 volton: Is there a reason why the Clojure Github repo is so quiet at the moment?

14:24 pjstadig: ClojureScript

14:24 volton: The last commit is over a month old

14:24 seancorfield: volton: because the team have been working on clojurescript instead

14:24 and the 1.3 release is drawing near so it's pretty much just bug fixes i guess

14:25 hiredman: I think clojure hasn't grown a proper development cycle yet

14:25 so master just kind of halts when there is a freeze before a release

14:25 volton: so it does not mean that the clojure project is loosing speed?

14:26 seancorfield: volton: the vast majority of clojure users are still on 1.2 - i wouldn't worry about 1.3 development slowing down :)

14:26 kumarshantanu: Is anybody aware of the CinC schedule? Will that coincide with 1.3 relese?

14:26 hiredman: there is no schedule

14:26 cinc is not a priority

14:27 definitely not for the 1.3 release

14:27 1.3 is in beta already, no way a change that big will land

14:27 cemerick: ClojureScript *is* cinc, just not targeting the JVM.

14:27 seancorfield: as a language gets more traction, stability becomes much more important so we should expect slower forward motion

14:27 hiredman: cemerick: bleh

14:27 pjstadig: cemerick: i wouldn't go that far...but it is a step in that direction

14:28 hiredman: clojurescript is not cinc

14:28 it is still hosted on jvm, using java code to generate javascript

14:28 seancorfield: I disagree

14:29 seancorfield: hiredman: who with? you're disagreeing with cemerick already :)

14:29 hiredman: given the way clojure is used as a maven dependency most of the time it becomes very easy to specify the version you want

14:29 seancorfield: well you are both wrong

14:29 cemerick: There will *always* be some hosty bits, but look at the pieces of ClojureScript that are implemented in itself. Insofar as cinc is ill-defined to begin with, cljs is an instance of it.

14:29 seancorfield: i meant that larger shops adopting clojure would feel more comfortable with stability in the project rather than rapid rate of change

14:30 from a business point of view, not just a project / dev p.o.v.

14:30 volton: seancorfield: you are right and since clojure/core is so small a lot of progress will be made in contrib I guess

14:30 cemerick: volton: we have a winner :-)

14:30 seancorfield: volton: the new contrib libraries are certainly seeing quite a bit of activity

14:30 pjstadig: well...there are still plenty of changes that could/need to happen in clojure

14:30 hiredman: cemerick: there doesn't have to be hosty bits

14:30 pjstadig: and the compiler

14:30 chouser: I'd argue that cljs is *not* cinc, though it may be a big step in that direction.

14:31 oh, sorry -- catching up now and seeing that isn't a profound statement after all :-)

14:31 pjstadig: chouser: i was impressed :)

14:31 hiredman: definterface + deftype is almost all you need, there are still issues with how you would do clojure.lang.RT

14:31 cemerick: chouser: You're ruining my strawman! :-P

14:31 chouser: heh, sorry.

14:32 kumarshantanu: I guess ideally CinC would be something I can take to another VM/runtime, re-write the hosty bits and run Clojure as usual

14:32 chouser: clojure leans heavily on java. clojurescript leans heavily on clojure.

14:32 kumarshantanu: I think that's right.

14:32 hiredman: clojurescript also has a lot of differences from clojure

14:33 cemerick: I'm not sure that's ever going to be realistic for large programs. Every nontrivial application will use interop, and that will never be portable across hosts.

14:33 seancorfield: i suspect the "re-write the hosty bits" will always be a fairly large piece of work tho' due to the high-level nature of clojure

14:33 chouser: cljs is a step in that direction in that the amount you'd have to rewrite to change cljs to target, say ruby, is much smaller than to get clojure to target ruby.

14:33 hiredman: cemerick: but for example requiring macros to be in a seperate file and included specially

14:33 seancorfield: if you can transform to something fairly low-level easily, the bytecode gen is easier

14:34 hiredman: seancorfield: I disagree

14:34 seancorfield: of course :)

14:34 cemerick: hiredman: what, assuming identical semantics of libraries on different hosts?

14:34 hiredman: seancorfield: if you had a decent compiler, you would just swap out bytecode gen for javascript source gen

14:35 run the compiler through the compiler on the jvm

14:35 get out a compiler targeting js that runs on js

14:35 seancorfield: clojure -> java bytecode is a big jump; clojurescript -> javascript less so

14:35 kitia: hi, does doall force a pmap to be realized?

14:35 hiredman: cemerick: no, but macro expansion is a core part of clojure, and clojurescript deals with macros differently

14:35 cemerick: kitia: yes

14:35 seancorfield: fwiw, my background is compiler development, stretching back into the 80's...

14:36 cemerick: hiredman: didn't realize you were talking about cljs specifically

14:36 seancorfield: hey, so cinc bootstrapped via direct clj -> java source translation! :-P

14:37 hiredman: the big issue with the clojure compiler is a. rewriting in clojure in a functional style b. clean seperation of analysis from code gen

14:37 cemerick: old school

14:38 spei: I have a piece of code that seems to blow up for no real reason: (doall (pmap (fn [l] (for [gcat (range 0.25 0.76 0.05) at (range 0.25 0.76 0.05) gc (range 0.25 0.76 0.05)] [[l gcat at gc] (repeatedly 1000 #(generate-seq l gcat at gc))])) length))

14:38 seancorfield: it's all about the size of the bootstrao process / layer and how to narrow the gap between what the compiler produces and whatever the native "language" of the platform is (but i'm just stating the obvious at this point and it's not really a very interesting discussion)

14:39 s/bootstrao/bootstrap/

14:39 lazybot: <seancorfield> it's all about the size of the bootstrap process / layer and how to narrow the gap between what the compiler produces and whatever the native "language" of the platform is (but i'm just stating the obvious at this point and it's not really a very interesting discussion)

14:39 Scriptylvania: spei: that's kinda unreadable in irc, please use a pastebin

14:40 cemerick: Indeed; can we get back to why Clojure is stagnating?

14:40 spei: sorry, whats a pastebin?

14:40 cemerick: spei: gist.github.com :-)

14:40 or whatever

14:40 spei: oh ok

14:40 thanks

14:41 cemerick: spei: and try to describe the problem better than "blows up" ;-)

14:42 jcromartie: cemerick: who says Clojure is stagnating?

14:42 chouser: doesn't everyone?

14:42 cemerick: jcromartie: No one. It's not. I was trolling, sadly.

14:42 * Hodapp glares at cemerick

14:43 hiredman: seancorfield: but if your core.clj starts off if a bunch of definterfaces for things like IFn, then fn is a macro that emits deftypes that use those interfaces

14:43 off with

14:43 kumarshantanu: a message from the infamous thread "Fess up, who's unhapy with ClojureScript" caught my attention -- which says, at some point of time a proper language spec would be nice_to_have -- Clojure_core, Clojure_java (delta), Clojure_script (delta)

14:44 chouser: cljs is much closer to what hiredman just described than clojure is.

14:44 hiredman: right

14:44 chouser: so that's a clear step in the right direction

14:44 spei: i believe the code is up on gist at git://gist.github.com/1110068.git

14:44 chouser: in the cinc direction

14:44 cemerick: kumarshantanu: You'd have to come up with a really good argument for why a spec would be beneficial.

14:44 Hodapp: I reckon I should learn me some Javascript sometime.

14:44 hiredman: I mention definterface instead of defprotocol because definterface is even lower level and makes the compiler less complex

14:45 cemerick: spei: you mean https://gist.github.com/1110068

14:45 spei: cemerick, yea, that one

14:45 kumarshantanu: cemerick: for a proper definition, I guess -- perhaps a reference manual instead of a spec

14:45 cemerick: spei: a REPL interaction that demonstrates the problem would be helpful, too

14:46 spei: ah. so many things to write

14:46 cemerick: kumarshantanu: right, but what would you do with that "proper definition" and would it be worth the cost?

14:48 kumarshantanu: cemerick: I can look it up when coding on Clojure_java vs Clojure_script vs Clojure_something_new -- some sort of canonical reference, even though skeletal

14:49 spei: cemerick: i added a comment that might describe the problem, but i lost the error that i saw in repl

14:51 hiredman: kumarshantanu: there is a clojurescript wikipage somewhere that is essentially the delta

14:51 cemerick: kumarshantanu: Sounds like a reasonable piece of documentation, but nothing like a spec.

14:51 and what hiredman said. :-)

14:52 hiredman: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure <-- the one place Clojure/core used a github wiki instead of confluence

14:52 cemerick: (BTW, it's Clojure & ClojureScript; I don't know what Clojure_java and Clojure_script are)</pedantry>

14:52 kumarshantanu: spec is probably he wrong term, yes

14:52 hiredman: although, some of this is just wrong

14:52 ClojureScript has the same evaluation rules as Clojure

14:53 not true

14:53 kumarshantanu: hiredman: the delta is a moving target right now

14:53 hiredman: *shrug*

14:54 grumpytoad: heh... cemerick why dont you just paste his code into your own repl? what kind of a community is this ?

14:55 cemerick: :-P

14:57 pjstadig: hiredman: but if they'd used confluence then we'd have known about it before the big reveal

15:00 amalloy: spei: i'm unconvinced. print-set shouldn't even work, because map isn't being passed enough args

15:00 spei: that would be odd considering the code does work

15:01 amalloy: spei: it looks like you haven't pasted it all, because the parens don't match either

15:01 spei: oh. i cut off the code at the wrong place. sorry i'm gonna repost

15:02 i think the code should work now...?

15:02 amalloy: anyway, (doseq [a x] (doseq [b a] ...)) should probably be replaced with (doseq [a x, b a] ...)

15:02 the former *might* lead to holding the head of your lazy sequence and the latter not

15:02 cemerick: pjstadig: nah, that's roles are for

15:03 amalloy: but probably that's not the issue

15:05 spei: i would hope not

15:06 amalloy: well, to fix the former, the compiler has to be smart. to fix the latter, only doseq has to be a little careful

15:06 my understanding is that the compiler *is* smart enough

15:06 dnolen: CinC is cool, but actually useful to noone. ClojureScript and Clojure are useful *now*, thus CinC will always get the shaft as far I can tell.

15:07 spei: amalloy: well, it has been working in smaller test cases

15:08 amalloy: okay...?

15:09 volton: Is it okay to use slurp do retrieve a URL? I know that it will held in memory

15:09 spei: but in the case that I have up on gist, it fails

15:10 amalloy: i don't see what point you're making. if it runs out of memory, of course it works for small inputs

15:10 and my suggestion was one thing that might cause it to manage memory better

15:10 as well as being nicer-looking code

15:13 spei: i made the suggested change and I'm running it now

15:14 ipostelnik: what's the recommended json library now? clojure.contrib.json? clj-json?

15:16 * dnolen grins as work progresses on Meranget pattern matcher in Clojure...

15:18 hiredman: 0 google hits on Meranget

15:19 dnolen: hiredman: Maranget, sorry, http://moscova.inria.fr/~maranget/papers/ml05e-maranget.pdf

15:20 cemerick: ipostelnik: c.c.json is now data.json: https://github.com/clojure/data.json

15:21 hiredman: ipostelnik: but you should be using chesire

15:21 ~google chesire json

15:21 clojurebot: First, out of 2340 results is:

15:21 cheshire -- Marginalia

15:21 http://dakrone.github.com/cheshire/

15:23 dnolen: w/ any luck, pattern matcher might see a release before the Conj (fingers crossed)

15:27 hiredman: I spent most of my evening trying to write async iteratees, that paper is a bit much

15:31 ohwow_: so

15:31 I was trying to install clojure-mode in emacs

15:31 dnolen: hiredman: the Maranget paper? It's actually the most readable thing I've come across in a while. The algorithm is completely laid out.

15:31 ohwow_: i have emacs-starter-kit and i did `M-x package-install <ENTER> clojure-mode' (I added marmelade repo priorly)

15:32 so I got an error: turn-on-idle-highlight: Symbol's function definition is void: idle-highlight-mode

15:32 actually I am not sure if it's an error

15:32 hiredman: dnolen: well more power to you

15:32 dnolen: hiredman: more power to Clojure, we'll have a bit of Haskell in that pattern matcher.

15:33 volton: Is there a way to get a repl with contrib using clojure as inferior-lisp in emacs?

15:36 scottj: volton: change inferior-lisp-program to a command that includes contrib on the classpath

15:37 volton: scottj: right now it is lein repl

15:41 guess I will have to move to swank + slime

15:42 ohwow_: Hm, so I mannaged to install labrepl and slime-clojure. How can I open the SLIME repl in emacs?

15:42 scottj: volton: lein repl outside a project will run the system wide one, either find a way to always have lein repl load contrib or find a way to have it run lein repl for your specific project that has contrib

15:42 amalloy: volton: you *could* do it with inferior-lisp in the way that scottj recommends, but swank/slime is pretty sweet so do that

15:42 scottj: volton: perhaps C-x d go to project dir, then invoke inferior-lisp

15:43 ohwow_: if swank is already running somewhere, M-x slime-connect

15:44 ohwow_: scottj: that doesnt open a new buffer with repl for me :(

15:44 scottj: with latest clojure-mode/swank-clojure I think M-x clojure-jack-in is recommended way

15:44 ohwow_: I'd suspect the predicate to if didn't return true

15:45 ohwow_: hm

15:46 scottj: read https://github.com/technomancy/swank-clojure README.md before attempting to use slime

15:46 ohwow_: `clojure-jack-in' opens a new buffer called *swank* with this in it: Process swank finished

15:46 That's not a task. Use "lein help" to list all tasks.

15:48 volton: scottj: that was a great idea, thank you

15:49 ohwow_: hhm

15:50 hiredman: ohwow_: lein plugin install swank-clojure someversion

15:50 ohwow_: and make sure you don't have old versions of swank-clojure on your classpath

15:52 ohwow_: uh

15:52 i was using labrepl version

15:52 but w/e

15:53 hiredman: ohwow_: I would be surprised if labrepl was kept up to date swank wise

15:54 ohwow_: tru

16:04 Hm, so are macros/functions 'javadoc' and 'source' obsolete or whatnot?

16:04 technomancy: source is irrelevant with swank since M-. is so much nicer

16:04 ohwow_: Oh, I think those are for labrepl only

16:05 chouser: javadoc and source are both clojure.repl functions

16:05 amalloy: technomancy: i use source pretty often

16:05 ohwow_: strange

16:05 then why are they giving exceptions when i try to evaluate them in slime?

16:06 kjeldahl_: ohwow_: (use 'clojure.repl)

16:06 amalloy: ohwow_: lazybot also has source and javadoc plugins

16:06 $javadoc Integer intValue

16:06 lazybot: http://download.oracle.com/javase/6/docs/api/java/lang/Integer.html#intValue()

16:08 ohwow_: oh cool

16:08 tsdh: Why is my second message dialog not shown in the KeyListener proxy? http://pastebin.com/5yFpdbqu

16:09 ohwow_: kjeldahl_: is there any way to automatically do that every time i run slime?

16:09 amalloy: you can /msg him and then you can ask him as many "silly" questions as you want without cluttering the channel

16:09 * tsdh is back in some minutes...

16:09 ohwow_: sorry :(

16:10 amalloy: ohwow_: no, you're not donig anything wrongf

16:10 kjeldahl_: ohwow_: WIth slime, not sure. But if you use the standard "clojure-jack-in" method, you can have your repl initialized with it using the leiningen ":repl-init" feature.

16:10 amalloy: just sometimes people feel like they shouldn't "overuse" lazybot, so i'm pointing out he'll talk in private

16:11 ohwow_: amalloy: Oh, I thought you were talking about me asking kjeldahl_

16:11 kjeldahl_: I thought clojure-jack-in uses slime under the hood?

16:11 kjeldahl_: ohwow_: Friendly warning, I'm still "fuzzy" about all the nuances exactly what is provided by slime, swank etc... Just telling you what I've managed to get working.

16:11 hiredman: slime is a communication protocol

16:12 swank-clojure exports clojure.main/repl over slime to emacs

16:12 kjeldahl_: hiredman: You're sure about that? Didn't work for me either, had to ":repl-init" it... :-)

16:13 hiredman: To get a simple "(doc first)" working.

16:13 hiredman: kjeldahl_: ah, yes

16:13 my mistake, of course swank-clojure doesn't use the clojure repl, it was written before the standard repl code existed

16:14 and 1.3 moves a lot of stuff around, so it is not available unless you pull it in, kind of a drag

16:15 kjeldahl_: hiredman: Yeah, I'll bet it will scare off a lot of newbies.. The simplest examples do not even work..

16:16 hiredman: what version of swank-clojure are you using? there seem to be a few 1.3 related fixes in git, dunno if they fix any issues

16:17 kjeldahl_: 1.3.2 - the latest version suggested on leiningen's github page.

16:18 hiredman: technomancy has us all using the 1.4-SNAPSHOT at work I think

16:19 kjeldahl_: Oh, can't even find that on the github page.

16:20 hiredman: it may a simple change to switch swank-clojure to the main clojure repl code

16:20 technomancy: 1.4.0 just has cdt; you can use 1.3.2

16:23 * tsdh is back

16:31 tsdh: Ah, got it. An exception is thrown and it seems proxy swallows it...

16:40 ohwow_: Are there are any papers/articles regarding Clojure `namespaces' vs Racket module system?

16:41 technomancy: clojurebot: namespaces?

16:41 clojurebot: namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

16:41 technomancy: clojurebot: ns form?

16:41 clojurebot: the ns form is more complicated than it should be, but it's better-documented at http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns

16:41 technomancy: ohwow_: you probably want that link?

16:41 nothing to do with racket of course, but it's a good description

16:42 ohwow_: thanks :)

16:57 jsnikeris: Anyone know why clojure.contrib.java-utils/delete-file-recursively is deprecated?


17:02 jsnikeris: hmm, looks like it's also found in clojure.contrib.io, and it's not deprecated there

17:06 imade: hello

17:06 jsnikeris: hi

17:07 imade: I have a quetion about 4clojure problem 22

17:07 Count a Sequence is name of the problem

17:07 why is #(reduce + (for [_ %] 1)) an invalid solution?

17:08 hiredman: ,(count (range 10))

17:08 clojurebot: 10

17:08 imade: it says You tripped the alarm! count is bad!

17:08 cannot use function count

17:09 hiredman: ,(#(reduce + (for [_ %] 1))) (range 10))

17:09 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox$eval1433$fn>

17:09 imade: but my solution doesnt use count

17:09 hiredman: ,(#(reduce + (for [_ %] 1)) (range 10))

17:09 clojurebot: 10

17:09 hiredman: for may internally or something

17:09 imade: hmm

17:09 hiredman: ,(macroexpand '(for [_ (range 10)] 1))

17:09 clojurebot: (let* [iter__4217__auto__ (clojure.core/fn iter__1528 [s__1529] (clojure.core/lazy-seq (clojure.core/loop [s__1529 s__1529] (clojure.core/when-let [s__1529 (clojure.core/seq s__1529)] (if (clojure.core/chunked-seq? s__1529) (clojure.core/let [c__4215__auto__ (clojure.core/chunk-first s__1529) size__4216__auto__ (clojure.core/int #) b__1531 ...] (if (clojure.core/loop # #) (clojure.core/chunk-cons ...

17:10 Chousuke: ew :P

17:10 hiredman: try with a map instead

17:11 imade: ,((fn [coll] (reduce + (map #(identity 1) coll))) (range 10))

17:11 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval1556$fn--1557$fn>

17:12 hiredman: try maping (constantly 1) instead

17:13 imade: ,((fn [coll] (reduce + (map #(constantly 1) coll))) (range 10))

17:13 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval1586$fn--1587$fn>

17:14 hiredman:

17:14 you're doing it wrong, stop

17:15 ibdknox: #(reduce + (map (fn [x] 1) %))

17:17 imade: ,(#(reduce + (map (fn [x] 1) %)) (range 10))

17:17 clojurebot: 10

17:17 imade: k, lets see if 4clojure eats that

17:18 it did, thanks

17:18 maybe even replace (fn [x] 1) with (fn [_] 1), more idiomatic perhaps?

17:19 hiredman: (constantly 1)

17:21 pmbauer: If they're playing 4clojure golf ...

17:21 imade: ,(#(reduce + (map (constantly 1) %)) (range 10))

17:21 clojurebot: 10

17:27 imade: k thanks for the inputs, learned a new fn constantly, didn't know it before

17:31 amalloy: imade: you'll have a similar problem if you try to use destructuring on the "implement nth" problem

17:39 neotyk: Good morning everyone!

17:39 imade: amalloy: you mean the previous problem, "nth emement"

17:39 ?

17:39 on top of the morning to you

17:39 amalloy: imade: *shrug* i don't know the ordering. but yes, it sounds like i meant the previous one

17:41 imade: k, I'll try that later with destructuring, I used first and drop there

17:41 #(first (drop %2 %1))

17:43 k I really need to go sleep now, ~6h of bed time is kinda extreme for me, good night

17:48 thearthur: I added a patch to issue CLJS-6, and in the patch submission procedures it mentions taging it for testing, how do I do that in jira?

17:51 is clojurescript covered under the same CA as Clojure proper?

17:52 dnolen: thearthur: yes

17:52 thearthur: are people adding patches to jira to work on it or are they sending pull requests from github?

17:53 hiredman: thearthur: patches in jira

17:53 raek: patches to jira, no pull requests

17:53 seancorfield: quick Q: ns-vars is in old contrib ns-utils but doesn't yet seem to be in any new contrib?

17:54 thearthur: could someone look at CLJS-6 and tell me if i'v added the patch correctly?

17:54 seancorfield: what's the preferred way to get a list of all the public vars in a namespace?

17:55 hiredman: ,(take 10 (ns-publics 'clojure.core))

17:55 clojurebot: ([sorted-map #'clojure.core/sorted-map] [read-line #'clojure.core/read-line] [re-pattern #'clojure.core/re-pattern] [keyword? #'clojure.core/keyword?] [unchecked-inc-int #'clojure.core/unchecked-inc-int] ...)

17:56 seancorfield: thearthur: hey! bay area clojure group, yes?

17:56 hiredman: thanx. i was hoping there was something in core!

17:56 thearthur: seancorfield: yep thats me

17:56 hiredman: there is, it's called ns-publics

17:57 technomancy: vals + ns-publics, rather

17:57 seancorfield: thearthur: did you get your signed CA on file with Rich?

17:57 thearthur: yes, at the conj last year. im on the list on clojure.com

18:09 seancorfield: hiredman: i'd looked on ClojureDocs but it didn't pop out at me (the search isn't as smart as it could be); i should have used the Atlas because just ns turned up ns-publics - thanx again for the quick answer on that

18:12 hiredman: http://clojure.org/namespaces

18:12 dakrone: seancorfield: yea, unfortunately searches with hyphens on clojuredocs are broken until the search is rewritten

18:14 seancorfield: hiredman: i don't find the information on clojure.org to be organized in a way that lends itself to easy searching / exploring which is why i use clojuredocs.org and clojureatlas.com

18:14 dakrone: good to know, thanx

18:15 ibdknox: seancorfield: yeah clojure.org needs some usability help

18:18 hiredman: well, pick the people you know who know the most about clojure, did they learn from clojuredocs.org or clojureatlas.com?

18:19 what is the measure of the usefulness of docs?

18:21 scottj: there was a recent project that replaced the core defn with a version that added type asserts based on parameter names, anyone know the name?

18:21 hiredman: you mean type hints?

18:21 there was something on the mailing list for type hints, nothing about asserts

18:22 scottj: I think asserts

18:35 found it (porbably the one you were thinking of too) https://github.com/MHOOO/sanity

18:37 hiredman: ah does both, type hints and asserts

20:21 apl29: is anyone running cocoa emacs + clojure-mode + swank-clojure on lion, using clojure-jack-in?

20:22 hiredman: yes

20:22 apl29: i simply can't get it to work. slime-connect sometimes (!) does the trick.

20:23 did you install everything manually or via marmalade?

20:23 hiredman: what version of swank-clojure are you using?

20:23 mtm: what do you see in the *swank* buffer? I had a path issues early on...

20:23 hiredman: and are you using a project dev-dep or a plugin?

20:24 apl29: plugin -- v1.3.2

20:25 mtm: yep, had path issues early on, but they went away after specifying PATH via getenv... (possibly a mac-specific bug!?)

20:25 hiredman: and what doesn't work about it?

20:25 apl29: it stops.

20:25 hiredman: stops?

20:26 danlarkin: stops!

20:26 apl29: *swank* buffer stops at "starting swank server..."

20:26 i apologize for the somewhat unhelpful "it stops."

20:27 :)

20:28 hiredman: and how long do you wait for it to start?

20:28 does ps show a java process running?

20:28 apl29: hiredman: i'll check.

20:29 hiredman: sufficiently long, i assume. it's been doing nothing for 10, 15 minutes.

20:29 hiredman: the path thing is most likely due to osx not launching processes with the env setup from .profile

20:29 amalloy: oh mine always works flawlessly after 20 minutes...

20:30 apl29: that's what everyone's talking about when they mention "agile development."

20:41 i'll be damned. now it's working. getting clojure-mode from github did the trick.

20:41 for whatever reason.

20:41 thanks, everyone.

21:12 amalloy: technomancy: i hate the agent threadpool. i can't even create a future without that guy refusing to let my program quit

21:12 (and i only want to create a future so i can call a quick clojure.java.shell/sh

22:58 technomancy: amalloy: there's always runtime/exec if you want to shell out without that jerk interfering

22:59 amalloy: technomancy: yeah, i suppose so

23:00 technomancy: I just ported lein over to that

23:00 amalloy: was that the only thing you were using the agent threadpool for?

23:01 technomancy: the only ridiculous thing is you have to hook up stdio streams yourself

23:06 I wrote a bit of ruby today, and I have to admit it felt really good to just unix the problem away.

23:07 jcromartie: technomancy: indeed

23:08 most_interesting: I don't always code imperative OO with strong Unix flavor, but when I do, it's Ruby.

23:08 jcromartie: OK can someone look at this little API for me? https://gist.github.com/1110894

23:08 eipiten: the most interesting Russian man in the world?

23:09 jcromartie: I'm using it for model objects in a strictly in-memory app right now

23:09 amalloy: jcromartie: well, you defined the first two functions out of order

23:09 jcromartie: yes :P

23:09 thanks

23:09 I shuffled things around

23:10 amalloy: (.getTime (Date.)) is (System/currentTimeMillis), isn't it?

23:10 jcromartie: ah

23:10 yes millis

23:11 amalloy: and you're updating-in with conj but saying append - if the :revisions key is nil (rather than []), you'll be adding to the front

23:11 Bronsa: [A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[A[Ainteresting Russian man in the world?

23:11 05:09:36 jcromartie: I'm using it for model objects in a strictly in-memory app right now

23:11 05:09:50 amalloy: jcromartie: well, you defined the first two functions out of order

23:11 05:09:54 jcromartie: yes :P

23:11 05:09:54 jcromartie: thanks

23:11 05:09:58 jcromartie: I shuffled things around

23:11 05:10:45 amalloy: (.getTime (Date.)) is (System/currentTimeMillis), isn't it?

23:11 05:10:56 jcromartie: ah

23:11 jcromartie: amalloy: order doesn't matter

23:11 amalloy: that's what the history function is for

23:11 Bronsa: shit im sorry

23:11 jcromartie: heh

23:12 amalloy: it's cool, i like an instant replay for my best suggestions

23:12 jcromartie: i think the ! is an overstatement. it's not modifying anything, and the only global state it depends on is the system clock

23:13 just call it timestamped

23:13 jcromartie: I think that qualifies it for being unsafe in a transaction

23:13 which is the criteria for ! that I just read

23:13 in the Clojure library coding guidelines

23:13 amalloy: uhhhh

23:14 i disagree. what could go wrong? trying it twice will have exactly the same consequences as waiting till the right time and then doing it once

23:14 jcromartie: yeah, I suppose so

23:15 amalloy: i don't quite understand what (history x) is doing, but if you're going to be sorting by time a lot, seems like you could stand to use a sorted-map as the backing store

23:15 jcromartie: I don't know what the usage for history will be like yet

23:16 but I know I will use it

23:16 ... just not how much

23:16 amalloy: anyway, i'm out of opinions/suggestions now

23:17 jcromartie: wait sorted-map?

23:17 or sorted-set?

23:17 what's faster for appending? because it will do a lot more appending than reading/sorting

23:17 amalloy: they're the same

23:18 store it however you want. a map of timestamp to revision, or a set of revisions sorted by timestamp

23:18 but the latter seems complicated for no particular gain

23:24 jcromartie: amalloy: hmm, timestamp-as-key makes sense

23:25 dnolen: hot damn, http://www.amazon.com/Programming-Artificial-Intelligence-International-Computer/dp/0321417461

23:25 covers CLP, looking forward to this one.

23:35 jcromartie: what is CLP?

23:46 joegallo: Carnegie Library of Pittsburgh

23:46 zakwilson: Trying to use Jiraph, I get a NPE thrown from masai.tokyo.DB.open(tokyo.clj:57) when trying to use (with-graph).

23:47 joegallo: or, perhaps, constraint logic programming

23:48 * jcromartie reminds himself with a comment that Compojure middleware are applied LIFO... or rather Last Wrapped, First Applied-to-request

23:49 zakwilson: On a different subject, who wants a Clojure wrapper for the Paypal API?

23:49 amalloy: jcromartie: that's only non-obvious if you're used to writing your wrappers with arrows

23:50 (wrap-params (wrap-content-type myapp)) is pretty clear about wrapping order

23:51 jcromartie: yes

23:51 I use -> of course :)

23:52 amalloy: i'm just saying, if you find it hard to read, don't write it that way :P

23:52 jcromartie: it's easy enough with a note

23:52 grant__: quick question about clojurescript: it seems to me that cljs loses one of the most important features of clj - sending functions to a repl for instant testing and tweaking. Is there any way to gain that?

23:55 ibdknox_: grant__: I'm working on it right now :)

23:55 might be done tonight

23:55 grant__: wow

23:55 how are you accomplishing that?

23:56 ibdknox_: using the cljs compiler to emit js, capturing it, sending it over a websocket to a browser and having it execute it

23:57 I have the first half of that done

23:57 now I'm working on the client side :)

23:58 grant__: ah, cool

23:58 i didnt think of it at first, but i suppose that state could be maintained without much work on your part by just selectively evaling stuff

23:58 ibdknox_: yep :)

23:59 I won't say it's "easy"

23:59 grant__: hehe

23:59 ibdknox_: but I've gotten pretty far in only a few hours

Logging service provided by n01se.net