#clojure log - Dec 20 2010

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

0:00 tonyl: not that i know of

0:01 mister_roboto1: ok thanks

0:03 lopex: there's positions in seq-utils

0:05 amalloy: &(count (take-while (complement #{:b}) [:a :b :c]))

0:05 sexpbot: ⟹ 1

0:06 amalloy: mister_roboto1: ^^ won't work for maps, but for seqs and vectors...

0:07 mister_roboto1: thx, lopex and amalloy. i think i like that positions function better :)

0:21 &(count (take-while (complement #{:x}) [:a :b :c]))

0:21 sexpbot: ⟹ 3

0:21 amalloy: well, that too :P

0:22 mister_roboto1: hehe

4:44 bartj: what is the best way to rename keys in a hash-map

4:44 instead of doing a dissoc and then an assoc

4:45 raek: bartj: clojure.set/rename-keys

4:48 bartj: raek, cool, thanks!

5:21 octe: 12

7:39 naeu: I'm trying to plot an array of floats on a graph in Incanter

7:39 is this a sane idea?

7:44 edoloughlin: Can someone tell me what's the difference between 'x' and '(val x)'?

7:45 AWizzArd: edoloughlin: val is a Clojure fn which is pretty much just doing this: http://download.oracle.com/javase/6/docs/api/java/util/Map.Entry.html#getValue%28%29

7:45 cemerick: &(val (first {:a :b}))

7:45 sexpbot: ⟹ :b

7:46 raek: ,(first {:a 1})

7:46 clojurebot: [:a 1]

7:46 raek: ,(val (first {:a 1}))

7:46 clojurebot: 1

7:46 AWizzArd: edoloughlin: raeks example returned [:a 1] which looks like a Vector. But this is not a vector.

7:47 Clojure just prints it visually in the same way. But those examples above return a MapEntry object.

7:47 raek: ,(class (conj (first {:a 1}) :x))

7:47 cemerick: AWizzArd: of course it's a vector

7:47 clojurebot: clojure.lang.PersistentVector

7:47 raek: a special kind of vector that only has two slots

7:47 but you get an ordinary vector if you "change" it

7:48 naeu: I don't see why not. (seq some-vector) gives you an ordinary clojure sequence of values

7:49 chances are that you don't even have to call seq

7:49 edoloughlin: Thanks all. Saw it in some sample code and was just confused by it in context.

7:50 raek: the most common way of getting a map entry is when viewing a map as a sequence, I think

7:50 AWizzArd: ,(class (first {:a 1}))

7:50 clojurebot: clojure.lang.MapEntry

7:50 raek: find can also be used

7:50 naeu: raek: it doesn't work if i don't call seq, and now i have it seems to be churning all the cpu ;-) I got it to work by just taking enough vals to see the patterns I was looking for though

7:50 cemerick: &(vector? (first {:a 1}))

7:50 sexpbot: ⟹ true

7:50 raek: ,(find {:a nil} :a)

7:50 clojurebot: [:a nil]

7:50 raek: ,(find {:a nil} :b)

7:50 clojurebot: nil

7:50 AWizzArd: ,(instance? clojure.lang.PersistentVector (first {:a 1}))

7:50 cemerick: &(-> {:a 1} class supers)

7:50 clojurebot: false

7:50 sexpbot: ⟹ #{java.io.Serializable java.lang.Object java.util.concurrent.Callable clojure.lang.AFn clojure.lang.APersistentMap clojure.lang.Seqable clojure.lang.MapEquivalence clojure.lang.IObj java.util.Map clojure.lang.IPersistentMap java.lang.Runnable clojure.lang.ILookup clo... http://gist.github.com/748347

7:51 cemerick: whoops

7:51 &(-> {:a 1} first class supers)

7:51 sexpbot: ⟹ #{java.util.RandomAccess java.util.Map$Entry java.io.Serializable java.lang.Object java.util.concurrent.Callable clojure.lang.AFn clojure.lang.IMapEntry java.util.Collection clojure.lang.Seqable clojure.lang.IPersistentStack clojure.lang.Sequential clojure.lang.APers... http://gist.github.com/748348

7:52 raek: naeu: is it a very large array?

7:52 naeu: raek: jup :-)

7:52 raek: it plotted eventually though

7:53 raek: you could always do something like (take 100 the-array)

7:54 naeu: raek: that's what i ended up doing :-)

7:54 raek: I now have a beautiful plot of a saw-wave

7:57 AWizzArd: So, a MapEntry is not a PersistentVector.

7:57 I could have been more precise.

7:58 For me: Vector = clojure.lang.PersistentVector.

7:58 cemerick: AWizzArd: Shouldn't be. There are lots of IPersistentVector impls.

7:59 raek: heh, I guess my idea was: x is a vector <=> (vector? x)

7:59 i.e. instance of IPersistentVector

7:59 AWizzArd: Okay, this makes more sense, I agree.

8:17 raek: what is your favorite way of representing a closed set of "typed" values that can contain different number of sub-values depending on the type?

8:17 something like haskell's 'data'

8:17 [:unary value-a] [:binary value-a value-b]?

8:18 {:type :unary, :a value-a} {:type :binary, :a value-a, :b value-b}?

8:18 [:unary [value-a]] [:binary [value-a value-b]]?

8:27 Licenser: morning

8:28 chouser: raek: ^{:type ::unary} [value-a], ^{:type ::binary} [value-a value-b] ?

8:28 raek: a good option

8:28 chouser: raek: (defrecord Unary [a]) (defrecord Binary [a b])

8:29 raek: even better

8:30 that avoids the problem of not being able to put metadata on e.g. numbers

8:30 chouser: yes, but is a wrapper in that case, as is the metadata-on-vector

8:33 raek: another question: do protocol method implementations that are introduced with exend become real java methods?

8:35 chouser: no

8:36 raek: I guess what I am wondering is: should I care about whether I put the methods in a extend or in the defrecords?

8:36 chouser: raek: http://kotka.de/blog/2010/08/Static_vs_Dynamic.html

8:37 raek: *reading*

8:41 chouser: thanks for the input. it feels so obvious now... :)

8:42 chouser: :-)

8:42 * raek gently slaps his forehead

10:39 AWizzArd: I have a namespace N1 in which I define a macro A and a macro B which expands into A. Now I am in namespace N2 and required N1. I call n1/B in my N2 file and get an error "Can't refer to qualified var that doesn't exist". In the expansion A shows up not being qualified as n1/A, but simply as A. Is there an idomatic way to solve this?

10:41 chouser: can you paste the macro, example usage, and expansion?

10:41 or at least the macro

10:41 opqdonut: yeah, that sounds like your definition is off

10:41 dsop: is there a better way than doing (if-let [f body] f (something else)) so a shortcut (my-if body (something-else)) ?

10:41 opqdonut: dsop: (or (body) (something-else))

10:42 dsop: ah yeah, for sure

10:42 thanks

10:45 charliekilo: AWizzArd: Wonder if I has to do with ` vs. ' ... as far as I remember, ` expands to fully qualified var, while ' does not ... but thats my guess and chouser is a lot more qualified to answer that one.

10:46 chouser: charliekilo: you're likely right, but ' instead of ` is a rookie mistake and since AWizzArd is asking, I'm wondering if it's something more subtle

10:48 AWizzArd: It was something else. It was the reset *warn-on-reflection* thing we talked about the other day.

10:48 chouser: AWizzArd: you solved it?

10:49 AWizzArd: Emacs was hiding the namespaces for me, so at a first glance I thought it was about NS qualification. But now I macroexpand-1'ed it and saw that the *old-wor* was not properly introduced. So yes, solved.

11:01 (do (def wor# *warn-on-reflection*) (set! *warn-on-reflection* false) (defrecord ...) (set! *warn-on-reflection* wor#) (ns-unmap *ns* 'wor#))

11:24 Maybe it is possible to type-hint this warning about .contains away. Though currently I don't see where the implementation is coming from. In core_deftype.clj I find no .contains call.

11:30 jcromartie: leiningen has some problems for me on cygwin

11:30 I'm running 1.4.0 and doing a self-install right now

11:30 but this is what I get: https://gist.github.com/5622148f4ca0c0b2e36f

11:34 hmmm

11:34 part of what lein tries to run ... -Dleiningen.original.pwd=C:\Documents and Settings\ ...

11:34 unquoted

11:36 ah, looks to be fixed in https://github.com/technomancy/leiningen/blob/master/bin/lein

11:47 raek: I'm writing a function called 'available?' that checks whether a sequence is at least 'n' elements long (without forcing more than n elements). have I overlooked something like this in core?

11:49 fliebel: raek: (= 3 (count (take 3 seq)))

11:49 AWizzArd: (def available? #(= %2 (count (take %2 %1))))

11:50 Clinteger: what editor do you guys use for clojure? :<

11:50 fliebel: But I don't know anything in core, which is what you asked.

11:50 raek: fliebel: AWizzArd: thanks

11:50 fliebel: (also, yay, I wasn't to slow this time)

11:51 raek: Clinteger: emacs

11:51 fliebel: Clinteger: vim

11:51 raek: I was about to implement it with a manual loop

11:51 Clinteger: fliebel do you have rainbow parens? D:

11:51 AWizzArd: raek: that would be probably most efficient.

11:51 raek: but piggybacking on take seems more simple

11:51 fliebel: yes

11:52 AWizzArd: raek: if you need a highspeed available? then loop is good.

11:52 raek: well, the manual loop isn't exactly hard to read

11:52 a cond with zero? pos? and neg?...

11:52 it will be called a lot (I'm making a class file parser)

11:53 fliebel: AWizzArd: Why is the loop faster, and is this still the case with 1.3?

11:55 AWizzArd: fliebel: take constructs a new seq and thus more garbage. A loop would not need to collect the elments, just count.

11:58 * fogus` wants to start a blog named "Big Lessons"

12:01 AWizzArd: I just compared those: (time (available? x 999888)) => "Elapsed time: 222.466157 msecs" for the count+take version vs. (time (foo x 999888)) ==> "Elapsed time: 44.764726 msecs" for the loop

12:01 ohpauleez: just about all the people you dunk on while playing rec basketball

12:26 amalloy: Clinteger: having a problem with rainbow parens or something?

12:31 Clinteger: amalloy it seems kinda buggy, i think thats all lol

12:33 amalloy: Clinteger: well, you'll never get it figured out if "buggy" is the best you can do. and the source is simple enough; i changed the colors to fit my color scheme, and made it work on []{} as well as just ()

12:33 Clinteger: amalloy no it just doesn't seem to always work o.O

12:33 but when it does its fine

13:16 fliebel: What would be the functional equivalent of an ORM?

13:19 ohpauleez: fliebel: ClojureQL

13:20 fliebel: You typically only use relational functions, and call representations of data

13:20 relational algebra functions*

13:21 but I don't know of any special name, since mapping data is always happening (I tend to use vectors and hashmaps to represent most things)

14:14 amalloy: i'm having some trouble with (i think) nested backticks. my goal is to take some code from the user, insert a defmacro in front of it that they can use in that context, and then eval it. https://gist.github.com/3738c7ddac879aa790b1 is a simplified version of what i'm trying to do

14:17 this may not be the best way to accomplish my goal, but i don't understand how (macroexpand '(blah)) can expand to (+ 5 10), and (blah) in the same context result in an error

14:18 chouser: the auto-gensym is probably causing problems

14:18 they're only the same when used within the exact same back-tick

14:19 Raynes: chouser: Ooh. That's bit me in the ass with fury before.

14:20 amalloy: chouser: but they are, right? both use-foo are within the outer `, and not the inner one. are you talking about foo# instead?

14:20 chouser: you have foo# and x# in the outer one, and then again in the inner one

14:20 Raynes: chouser: Oh, by the way. Is there any particular reason that you opted for using a finite state machine to demonstrate mutual recursion rather than the classic odd? even? example? In JoC, of course.

14:21 chouser: Raynes: I think you'd have to ask fogus on that one

14:21 amalloy: chouser: right. but i'm unquoting them to try and make them resolve properly, and it /seems/ to be working, since my first example with the macroexpand resolves them right

14:21 chouser: amalloy: hm...

14:22 amalloy: fascinating. you appear to be correct on that.

14:23 amalloy: chouser: i try to only provide you with interesting problems :)

14:23 ohpauleez: Raynes: Did you want me to push the new clj-github to clojars on my account, or did you want to push to yours

14:23 chouser: amalloy: :-)

14:23 Raynes: ohpauleez: Oh! I totally forgot to push the new version. Sorry. I'll do that immediately.

14:24 ohpauleez: awesome, thanks man, I'm using it in a new project now

14:24 ping me when it's up there :)

14:24 Raynes: Sure thing.

14:24 chouser: amalloy: your second example just has an extra (eval ` ) that you don't need

14:26 amalloy: chouser: i need use-foo to have a gensymmed name

14:26 chouser: doesn't it/

14:26 ?

14:27 amalloy: not if i take out the outer ` :P

14:28 Raynes: ohpauleez: Pushed.

14:28 amalloy: ie, i can't change it to (let [foo 10] (defmacro use-foo))

14:28 ohpauleez: Raynes: You're the man now dog

14:28 thanks!

14:29 chouser: ah

14:29 right-o

14:30 ohpauleez: Does anyone know the process stu uses for signing off on tickets?

14:30 besides the process seen at /patches

14:30 chouser: amalloy: note that foo# gets its unique name generated at read time, so if you do this in a function or macro and call it from multiple places, they'll all use the same name for use-foo

14:31 amalloy: chouser: aw man, really?

14:31 in that case you're right - the eval ` is meaningless

14:32 chouser: just use a manual gensym in your function instead

14:33 amalloy: chouser: so like...(let [name (gensym)] (eval `(defmacro ~name))), right?

14:33 chouser: yes

14:35 amalloy: chouser: interestingly, this seems to have fixed the problem

14:35 Raynes: amalloy: You're defining macros in macros?

14:36 chouser: hm

14:37 amalloy: chouser: gist updated (for convenience: https://gist.github.com/3738c7ddac879aa790b1)

14:37 chouser: the exception you were getting suggests an attempt to call a macro as a function

14:39 amalloy: hm

14:39 chouser: the problem was the let, fixed by changing it to a do

14:39 a let is compiled as a single top-level form

14:39 amalloy: chouser: buh?

14:40 chouser: so use-foo# was not yet a var when (use-foo# 5) was compiled

14:40 so it was compiled as a function call

14:40 hm. I think.

14:40 and then fun as a function call, causing the error.

14:40 s/fun/run/

14:40 sexpbot: <chouser> and then run as a runction call, causing the error.

14:40 Raynes: chouser: Do you buy that braininess at some store? I'd like to see about purchasing some for myself.

14:41 chouser: a runction call. exactly.

14:41 amalloy: lol

14:41 pdk: we're takin lessons from scooby doo here

14:41 chouser: anyway, 'do' is special-cased in the compiler

14:41 each form in a do is compiled and run in turn, as if each were a separate top-level form

14:42 so that by the time (~fname 5) is compiled, Clojure knows it's a macro call

14:42 (let [] (defmacro foo []) (foo)) ; same error

14:42 amalloy: crazy

14:42 chouser: ooc is that the case even when the do/let aren't at the top level?

14:43 chouser: no

14:49 Raynes: Let's all give amalloy a round of applause for making a very strong-willed attempt to fix ##(for [x ["a" "b" "c"]] (.length x)) :>

14:49 sexpbot: java.lang.IllegalStateException: Var clojail.core/tester is unbound.

14:49 Raynes: I'm rooting for you, my friend.

14:50 amalloy has ambitions to create his very own organization dedicated to fixing my bugs and cleaning my messes up.

14:51 amalloy: lol

15:22 fogus`: Raynes: Because the even? odd? example is uninspiring. :-)

15:48 clizzin_: i have a situation where i'd like a function foo to return a lazy seq over the lines of a file, which another function will then read from. the problem is that it seems the reader is being closed after foo exist. i'm using with-open within foo to open the file and create the lazy seq over the lines. how can i achieve the behaviour i'm looking for?

15:52 amalloy: clizzin_: do you care about retaining laziness?

15:52 mduerksen: clizzin: with-open ensures that the file is closed properly after its body is evaluated. you would have to process the files contents inside the with-open, or you can't use with-open, but then you will have to take care of the "cleaning" yourself

15:53 alpheus: Or open/close on successive accesses.

15:54 clizzin_: amalloy: yes

15:54 amalloy: then mduerksen and alpheus have the answers for you: either manage the file yourself, or put the with-open in a context that includes both the reading and the processing

15:55 clizzin_: mduerksen: i see. is there a standard solution to this, or is it just wrapping it in a try with a finally to close the reader?

15:56 alpheus: i thought that if i close a reader and then reopen it, it would read from the beginning again. is that not the case?

15:56 amalloy: clizzin_: fyi, your foo function already exists: ##(doc line-seq)

15:56 sexpbot: ⟹ "([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."

15:58 clizzin_: amalloy: yeah, i actually wanted to do some additional processing on the lines into a custom record format as they were read from the file, hence my use of "foo." but you're right, the behaviour is just like line-seq.

15:59 alpheus: clizzin: yes, you'd have to manage your own state with regard to previously read offset etc. I can't give you specifics because I don't know clojure well enought.

15:59 amalloy: clizzin_: the solution that "feels" most natural to me is to modify foo to accept a continuation function argument: (defn foo [file process] (with-open [stream file] (process (line-seq stream))))

16:00 that way you're still within the dynamic scope of foo, so the file is still open

16:00 clizzin_: amalloy: that actually makes the most sense. nice one. thank you!

16:00 amalloy: but that may be a clojure monstrosity, a hold-over from my C days. i'm not sure

16:01 clizzin_: thank you also, alpheus and mduerksen

16:02 amalloy: well, i'll write it, and we'll see if it results in something monstrous...

16:03 amalloy: clizzin_: you'll have to realize the sequence at some point, so you'll need to make sure that all happens within the with-open's dynamic scope

16:03 otherwise you're just delaying the problem

16:18 alpheus: Didn't the need for laziness disappear with the continuation function argument solution?

16:19 clizzin_: alpheus: no, because the process function is still consuming the sequence lazily.

16:21 alpheus: I don't see how. How much of the stream does "process" consume when invoked?

16:23 amalloy: alpheus: if it consumes the sequence lazily, none

16:24 for example, (defn process [lines] (map #(str "line: " %) lines))

16:26 would be no good: it returns a lazy seq, and when you force the first element, you find that lines can't be read because the file is closed

16:26 alpheus: I was just about to type that.

16:27 * amalloy is in your brain, stealing your keystrokes

16:27 brehaut: (inc lpetit)

16:27 sexpbot: ⟹ 1

16:28 jcromartie: I like the bit in the try block, it's like a mini-dsl for only this function https://gist.github.com/e79f096508ef51b20459

16:29 lpetit: hello. Maybe I'll look like a moron, but what does (inc lpetit) mean, really ? :)

16:29 brehaut: lpetit: sexpbot's karma tracker

16:30 jcromartie: (repeatedly #(inc jcromartie))

16:30 :(

16:30 brehaut: (inc jcromartie)

16:30 sexpbot: ⟹ 1

16:30 brehaut: jcromartie: thats inspite of me nearly sneezing coffee over my new computer

16:30 lpetit: brehaut: than

16:30 arhg

16:30 jcromartie: I want a reader macro for a special kind of left and right paren that are :( and :) respectively.

16:31 lpetit: brehaut: my karma's thanking you. What did I do to deserve it ?

16:31 jcromartie: sexpricons

16:31 brehaut: lpetit: for services toward rational discussion on the mailing list

16:31 amalloy: jcromartie: oh my god what a name

16:31 jcromartie: sounds like a B-movie race of alien sex robots

16:32 lpetit: brehaut: oh, ok. It's hard to both, at the same time, try to be adult and concise, without being just "more noise" :)

16:32 brehaut: lpetit: yeah :(

16:32 chewbran1a: anyone seen this error before? "Anonymous modules have no name to be referenced by" http://pastie.org/1393291

16:32 bah

16:32 sorry wrong window

16:33 amalloy: jcromartie: add a v to the emoticon and they look kinda like unicorns...sexpricorns?

16:33 lpetit: chewbran1a: yeah, I wish clojure already had modules :)

16:33 chewbran1a: lpetit: haha

16:34 lpetit: amalloy slowly leaning towards adult content ... ;)

16:34 * amalloy points defensively at jcromartie

16:35 jcromartie: CURSE YOU SQL SERVER TEXT TYPE!

16:36 lpetit: bed time in France, cu later guys

16:36 brehaut: lpetit: later

16:41 alpheus: I'm going on a 53 hour train ride. I want to read some Clojure source on the way. Any recommendations?

16:44 amalloy: alpheus: sexpbot?

16:44 Raynes: amalloy: I think he wants to read some good Clojure source code.

16:44 brehaut: alpheus: have you read enlive ?

16:44 Raynes: Not that sexpbot wouldn't keep him busy for 53 hours.

16:45 amalloy: alpheus: and sexpbot has a brand-new quick-start guide to go with the source: http://is.gd/j6an1

16:45 alpheus: enlive, no, but I respect it. good idea

16:46 brehaut: alpheus: i learnt a bunch from the code. it covers a huge range of the language in a very small space

16:46 alpheus: im planning to dig into logos over the holidays

16:47 alpheus: https://github.com/swannodette/logos its a miniKanren implementation; an embeded logical language basically

16:48 Raynes: alpheus: With 53 hours of train ride, you should have plenty of time to traverse the code of several projects.

16:49 brehaut: alpheus: may i also suggest ring? its got lots of bite sized pieces

16:49 jcromartie: is there already an indent-level macro?

16:51 alpheus: I like all those suggestions. I wanted to have a bunch of code loaded on my laptop before I lost net access.

16:51 bobo_: Raynes: has i understood try-clojure and clojail correct, al the security stuff and so on is in clojail? so if i want to make my own try-clojure i can just use clojail? nothing "important" in try-clojure?

16:52 Raynes: bobo_: Right. try-clojure is mostly a wrapper around clojail.

16:52 bobo_: awesome!

16:52 Raynes: bobo_: tryclojure adds a little stuff to allow def safely, however.

16:52 You looking to make your own try-clojure? :p

16:52 brehaut: alpheus: also for mind expanding but not strictly useful, grab the monads lib in clojure.contrib and a bunch of texts from the web ;)

16:52 bobo_: i want 2 terminals in the same window =)

16:52 so i can write test in one and code in one

16:53 and i noticed you used hiccup, so... il start from scratch :-p

16:54 as everything i do, il probably get boored before im done but still

16:54 Raynes: :p

16:54 jcromartie: here is my contribution to the Clojure community, an indentation level macro that rebinds println

16:54 https://gist.github.com/749062

16:55 finally, I can sleep

16:55 no, I can die

16:56 amalloy: jcromartie: ((fnil inc 0) *indent*) might be cleaner? i dunno

16:57 jcromartie: I just realized something silly

16:57 there, updated https://gist.github.com/gists/749062/edit

16:57 the first (with-indent ...) should start indenting

16:57 not start at zero

16:58 amalloy: jcromartie: that's what my little fnil friend does

16:58 jcromartie: right, but I just bind *indent* to 0 at the root

16:58 that's all it needs

16:59 amalloy: that's true

16:59 jcromartie: should work across threads too

17:12 durr, nobody needs an edit link... https://gist.github.com/749062

17:33 alpheus: Raynes: you're in the "most forked this month" on github

17:34 Raynes: alpheus: Really? :o

17:34 * Raynes looks

17:34 alpheus: at least in the Clojure language category

17:35 Raynes: Neato.

17:35 amalloy: We're in the "Most Forked This Month" category! :D

17:36 amalloy: !

17:36 linky?

17:36 brehaut: amalloy: https://github.com/languages/Clojure

17:36 Raynes: https://github.com/languages/clojure

17:37 kotarak: People fork *richhickey*/clojure-contrib? o.O

17:38 brehaut: kotarak: but only this month, this week and today clojure/clojure-contrib is ahead

17:38 amalloy: kotarak: google still turns that up first

17:38 ohpauleez: Scala is the 17th most popular language on github, clojure... the 18th

17:39 brehaut: ls

17:40 * brehaut cant tell the difference between irc and a term

17:40 Raynes: brehaut: I've tried to join channels by using /cd

17:41 brehaut: Raynes: hah awesome

17:48 raek: ,(clojure-version)

17:48 clojurebot: "1.2.0"

17:48 raek: &(clojure-version)

17:48 sexpbot: ⟹ "1.2.0"

17:52 Clinteger: hmph. writing clojure on windows is a pita :|

17:53 kotarak: Clinteger: I don't notice much difference to my mac setup: everything works fine on Windows too.

17:54 Clinteger: kotarak what editor do you use?

17:54 kotarak: Vim

18:07 Raynes: Clinteger: Emacs and Vim both work fine in Windows.

18:07 I mean, last time I used them on Windows.

18:07 Quite a while ago.

18:07 There is always Eclipse+Counterclockwise.

18:08 I hear the Intellij support is pretty good as well.

18:24 Clinteger: Raynes emacs forkbombs me :(

18:24 Raynes: Clinteger: Install Ubuntu. :>

19:13 zemariamm: Hello everyone

19:29 jweiss: shouldn't surrounding for or map with doall force the evaluation of all the items?

19:30 whether they're consumed by something lower in the stack or not?

19:30 qbg: It should

19:31 zemariamm: has anyone successfully used compojure on appengine ?

19:32 ossareh: 'lo

19:34 technomancy: your emacs starter kit rocks out, though the clojure function fnil falls foul of the pretty-lambdas hook. I'm unfamiliar with elisp, is there a quick fix for that?

20:02 dsop: is there a short way for (((foo :bar) :baz) :blub) ?

20:05 qbg: ,(doc get-in)

20:05 clojurebot: "([m ks] [m ks not-found]); Returns the value in a nested associative structure, where ks is a sequence of ke(ys. Returns nil if the key is not present, or the not-found value if supplied."

20:06 hiredman: (-> foo :bar :baz :blub)

20:06 dsop: qbg: thx

20:10 KirinDave: hiredman: Call me crazy, but I like yours better.

20:10 I am a sucker for thrush, tho.

20:11 qbg: -> is more general, but get-in may convey the intent better

20:18 brehaut: dsop: if you need to pass it in to another fn, you might find (comp :blub :baz :bar) useful too

20:21 dsop: brehaut: hmm interesting that I can comp those

20:21 I'm quite new to lisp and clojure so it's kind of hart to find the right fn everytime.

20:21 brehaut: dsop: its the exact same trick as hiredman's -> namely that keywords implement the function interface

20:24 dsop: have a play with fn? and ifn? in a repl

20:24 ,(fn? :keyword)

20:24 dsop: brehaut: i figure it's the best way to do use this, so (:foo map) is better than (map :foo) as (nil :foo) will cause an illegal argument

20:24 clojurebot: false

20:24 dsop: brehaut: yeah, palying around in slime with it :)

20:24 brehaut: ,(ifn? :keyword)

20:24 clojurebot: true

20:24 brehaut: dsop i believe the answer to that depends on the usage of the map

20:25 dsop: if its being used as a record, then (:key map) is prefered

20:26 dsop: and thats usually the case if you have keyword keys

20:28 dsop: yes I mainly use json-parse and therefore maps that are records

20:30 brehaut: dsop: sure. keyword first then :)

20:31 dsop: at some point you should also check out the clojure.zip namespace

20:33 dsop: its a generic library for walking tree shaped things

20:34 dsop: I've seen this while I searched for what zip is in haskell

20:34 brehaut: zip in haskell is different; it takes two lists and returns a list of pairs

20:34 the clojure equivalent is map

20:34 dsop: exactly, I searched for that

20:34 but yeah

20:56 krumholt: hi

23:38 Derander: What is the function that returns a function that is the result of applying both functions?

23:38 brehaut: Derander: juxt ?

23:38 Derander: yes!

23:45 hiredman: ,(doc case)

23:45 clojurebot: "([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are ...

23:45 amalloy: &(doc case)

23:45 sexpbot: ⟹ "Macro ([e & clauses]); Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-constant1 ... test-constantN) result-expr The test-constants are not evaluated. They must be compile-time literals, and need no... http://gist.github.com/749506

23:46 amalloy: oh haha, sorry hiredman, didn't notice it was you looking up case. i was just giving whoever it was a gist

23:47 Raynes: I just wrote a subsubsection on case.

23:47 hiredman: *shrug*

23:47 Raynes: But that's still a secret.

23:47 * Raynes runs off leaving everyone scratching their heads.

Logging service provided by n01se.net