#clojure log - Jan 22 2012

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

0:00 phil: dnolen: yea i might try to do it when i get bitten by perf problems in vecs and maps :)

0:00 TimMc: alex_baranosky: WORKS_FOR_ME

0:00 * alex_baranosky is trying again

0:00 TimMc: (:private (meta (var foo))) was my test

0:01 alex_baranosky: I'm getting an exception that the var wasn't private

0:01 let me check the repl

0:01 technomancy_: llasram: definitely give me a heads-up if you have issues with the .deb

0:01 I haven't heard of any trouble with ant

0:03 alex_baranosky: TiMc: wth, (:private (meta #'as-validation-error)) => nil

0:03 however:

0:03 TimMc, however: (:tag (meta #'as-validation-error)) => :private

0:04 what version are you using TimMc

0:05 TimMc: pretty weird, there. 1.3.0

0:05 alex_baranosky: do you know what :tag is?

0:05 TimMc: Yeah, it's a return type hint.

0:06 If you do ^Integer instead of :private, it should give you a :tag Integer

0:06 alex_baranosky: ahhhh... my repl is in 1.2.0

0:06 TimMc: s/:private/^:private/

0:06 alex_baranosky: how do I get lein repl to run 1.3.0?

0:07 TimMc: Oh, does ^:keyword not work there? :-/

0:07 alex_baranosky: Create a tmp project.

0:07 alex_baranosky: I think it used to be #^:private

0:07 TimMc: Ouch. Have to use the old syntax for compatibility, I guess.

0:07 alex_baranosky: hmm wonder if this will mess up backwards compatibility for midje?

0:08 we recently discovered a bug when using Midje with 1.2.0 I wonder if this is the source of it

0:08 phil: is there a way to change some element in a deeply nested (immutable) data structure without having to have a reference to the root?

0:09 alex_baranosky: as I somewhat recently started using the ^:private form

0:09 phil: for example if every element stored its parent?

0:09 then went up the parent chain, assocd-in

0:09 ?

0:10 TimMc: If I read you right... no.

0:10 phil: but then when an element changes all children have to update their parent references :/

0:11 i guess thats the problem

0:11 hm... cant this be done with zippers?

0:11 Raynes: Sigh. My biggest problem in live is choosing color schemes for my editor.

0:12 life*

0:12 alex_baranosky: Raynes, you're doing ok then -- I make up much bigger problems for myself

0:12 Raynes: alex_baranosky: Like whether or not to use defn-?

0:12 phil: :D

0:13 is defn- or defn ^:private better now?

0:13 TimMc: alex_baranosky: Eh, it's just one more char.

0:13 phil: Oh, I did misread you -- yes, zippers are great for that.

0:14 and good night.

0:14 phil: TimMc: thx & n8

0:14 Raynes: Solarized is supposed to be the best thing ever, but it colors parentheses red and makes me want to gouge my eyes out. Tomorrow Night, my go-to favorite has a few issues and an active yet entirely unresponsive author.

0:14 My life is so hard.

0:14 alex_baranosky: Raynes, I don't enjoy solarized

0:15 duck1123: if we're talking emacs color schemes. I'm a fan of hober

0:15 alex_baranosky: supposedly it has some kind of color science behind it but...

0:15 phil: Raynes: if youre using vim, try slate... but i guess most people here use emacs

0:15 alex_baranosky: I like tango

0:15 Raynes: phil: I'm using Vim.

0:16 phil: Raynes: oh then slate is a default theme

0:16 alex_baranosky: in Vim I use desert

0:16 Raynes: phil: Mostly, I like solarized and tomorrow night because they're everywhere and thus can go with me. I like jellybeans, but it's just for Vim (so if I used Emacs again, I'd need to write one myself).

0:16 phil: though i dunno how it looks on other systems than mac

0:16 Raynes: Also on a mac.

0:17 phil: macvim?

0:17 Raynes: Of course.

0:17 All else is blasphemy.

0:17 Arafangion: I like the 'billw' scheme in emacs.

0:17 chewbranca: I'm partial to sunburst, I definitely prefer it to solarized

0:17 phil: yep :) try slate, its build it

0:17 its reallt calming imo

0:17 built in*

0:17 Raynes: If by calming you mean eyeball exploding.

0:18 phil: haha :D

0:18 Raynes: It highlights 'with-open' with a white background and red foreground!

0:18 phil: 'doto' too

0:18 alex_baranosky: Raynes, what do you think of desert?

0:19 Raynes: Hideous.

0:19 phil: what do you propose for a dark theme then?

0:19 Raynes: I'm pretty picky.

0:19 phil: solarized? is it dark?

0:19 Raynes: Kind of dark.

0:19 Dark or light though.

0:20 phil: ah i wanted to try out that one

0:20 why dont you like it?

0:21 Raynes: It colors parentheses red and is too low contrast even on the highest contrast setting.

0:21 phil: doesnt vimclojure override paren coloring?

0:22 Raynes: Does it? It certainly doesn't paint them red outside of solarized.

0:22 phil: hm i guess not by default, but theres a rainbow paren mode

0:22 which i wanted to try out but forgot

0:23 Raynes: http://www.vim.org/scripts/script.php?script_id=2140 is pretty fantastic.

0:24 phil: doesnt look bad tbh... while we're talking editors, is there any good paredit-like plugin for vim?

0:25 Raynes: paredit.vim

0:25 phil: :D

0:25 Raynes: https://github.com/emezeske/paredit.vim

0:25 Our good friend emezeske ripped it out of slimv for us.

0:25 He is actually a regular here.

0:25 phil: this is awesome

0:25 thx

0:30 IceD^: hye

0:30 is this code https://gist.github.com/1655774 idiomatic?

0:30 Raynes: phil: Try out jellybeans https://github.com/nanotech/jellybeans.vim

0:31 phil: yea, definately better than slate

0:31 will have to play with color themes tomorrow :)

0:32 Raynes: phil: Ping me when you do. We can talk about them like teenage girls about boys.

0:33 phil: ahaha yea its so exciting :D

0:34 IceD^: im a pretty big noob myself, but maybe take a look at merge-with

0:35 IceD^: I have good lisp background, but never used clojure much

0:35 now clients asked for clojure client lib ;]

0:35 phil: ive started out recently and i like it a lot

0:36 only thing i miss is pattern matchins as in haskell

0:36 matching*

0:37 so i have to resort to if?s etc when a simple pattern would show my intent much better

0:38 IceD^: phil, thnx - merge will be good for me

0:38 phil: np :)

0:38 IceD^: (let [defaults (hash-map ...)] (merge defaults hoptions))

0:40 Raynes: IceD^: Sec. I'm working up an example.

0:41 IceD^: https://refheap.com/paste/377 Only slightly tested.

0:41 This is what I'd do.

0:41 IceD^: Raynes, already there ;]

0:41 Raynes: Well I'm slow.

0:41 Sue me. ;)

0:41 IceD^: ahh yes, {} is syn to (hash-map)

0:42 note to self - at least read intros to new langs

0:42 Raynes: Haha

0:43 phil: isnt #{} hash-map?

0:43 Raynes: No.

0:43 That's a set.

0:43 &(type #{})

0:43 lazybot: ⇒ clojure.lang.PersistentHashSet

0:43 phil: aah

0:43 yes

0:45 IceD^: is it bad if I'll ignore clj-http and will use java api instead?

0:52 Raynes: IceD^: You can if you want to, but it's akin to masochism.

0:53 IceD^: Raynes, I'd like to keep it small and deps-less

0:53 two questions (nab and not-so-nab)

0:53 1. nab - how to I load code into lein repl?

0:54 2. not so nab - how do I support both clojure 1.2 and 1.3

0:54 technomancy_: what's "nab" mean?

0:54 phil: noob

0:55 IceD^: noobish

0:55 technomancy_: huh; never heard that

0:55 IceD^: you should try the lein-multi plugin; it lets you run tests against arbitrary dependency sets

0:55 Raynes: If having a dependency on clj-http is a problem, then sure, you can use the Java APIs. If you don't know Java, you could be in for a hell ride though.

0:56 IceD^: I used to develop in java like 10 years ago

0:56 but that doesn't matter - I have java client lib here and will just copypaste most of the code ;]

0:57 Raynes: There was a guy who wrote a pure-clojure http client. Asshole abandoned it for clj-http. I forget his name…

0:57 *cough*technomancy*cough*

0:57 technomancy_: no such thing as a pure-clojure http client. =P

0:57 Raynes: Close enough.

0:58 technomancy_: it was kinda crap

0:58 Raynes: It worked for me.

0:58 :'(

0:58 technomancy_: but if you absolutely can't pull in apache http-client, you could give it a look

0:58 IceD^: looked of course

0:58 technomancy_: the only reason we wrote it was that leiningen didn't exist yet at that time, so you really wanted to avoid external deps

0:58 IceD^: but all I need is to push request and get response

0:59 https://github.com/iron-io/iron_mq_java/blob/master/src/main/java/io/iron/ironmq/Client.java here is all the code

1:00 Raynes: IceD^: You can just call that code from Clojure. Don't even have to rewrite it.

1:00 IceD^: ofc, it's possible to use it within clojure, but I don't want to force our customers, which using clojure, to face java calls ;]

1:00 Raynes: I mean you can call it from your Clojure code.

1:01 Your Clojure code can basically become a wrapper.

1:01 You can provide a nice little Clojure client that just uses your Java client under the hood preventing a lot of duplication.

1:01 IceD^: I know ;)

1:02 estimated that - there will be more code to wrap than to write from scratch ]:)

1:08 so - I have lein project and lein repl open - how do I (re)load my sources there?

1:20 tavis`: IceD^: haven't read all of this thread but you can't use clj-http for some reason there's always the clj-apache-http wrappers. The project seems abandoned though. Here's an update of it to clj 1.3: https://github.com/tavisrudd/clj-apache-http

1:20 er, 'but *if* you can't'

1:21 clj-http is a lot nicer to use

1:21 IceD^: tavis`, well - main reason why I'd like to avoid any clojure libs - possibility to build for both clojure 1.2 and 1.3

1:22 which is kinda hard with current libs

1:22 technomancy_: nah, it's easy as long as you don't AOT

1:22 IceD^: well

1:22 tavis`: they should work fine with both version

1:22 s

1:22 IceD^: say, clj-http requires clojure 1.3

1:22 bam, I'm doomed

1:23 Raynes: clj-http doesn't require clojure 1.3

1:23 And doesn't intend to anytime soon.

1:23 dakrone would be staked.

1:23 IceD^: well - it requires clojure-1.2

1:23 Raynes: No it doesn't.

1:23 It works fine in both versions.

1:23 IceD^: https://github.com/medSage/clj-http/blob/master/project.clj

1:24 Raynes: That's the wrong repo.

1:24 https://github.com/dakrone/clj-http

1:24 IceD^: :dependencies [[org.clojure/clojure "1.3.0"]

1:24 tavis`: note it use multi-deps

1:24 Raynes: And the version in the project.clj file isn't really relevant -- if it depends on 1.2 and your project depends on 1.3, your version of Clojure will be used.

1:24 IceD^: aha

1:25 (my head hurts ;])

1:25 Raynes: Dependency management is hard.

1:25 tavis`: that really confused me as well at first

1:25 especially when I didn't understand how lein worked

1:26 IceD^: anyway, I completed my network interaction code already using java calls

1:26 how to test it now

1:26 don't suggest to copypaste to repl please

1:26 technomancy_: best to use your editor integration

1:26 IceD^: technomancy_, it's emacs and we had that discussion already

1:26 CL support is more important for me than clj

1:28 technomancy_: hm; you can use C-u M-x inferior-lisp RET lein repl RET

1:28 tavis`: missed that convo but you could always to what technomancy_ does and run multiple instances of emacs

1:28 Raynes: Or just require the namespace from the repl and test away.

1:28 tavis`: CL support in one and clj in the other

1:28 Raynes: But being cocky doesn't help anything.

1:28 IceD^: tavis`, it was like 6 months ago

1:33 tavis`: btw, technomancy_ if the Clojure and CL versions of slime are divergent now would there be anything wrong with extending slime.el with Clojure specific goodies? Or is the plan to not diverge too far?

1:34 IceD^: tavis`, as I'm aware, clojure's swank's using very ancient version of slime (probably patched)

1:34 technomancy_: no, it's not patched; it's verbatim

1:34 tavis`: I don't have much of a plan. I've been preferring defadvice so far since it's easy enough.

1:34 if there were compelling reasons to fork I'd entertain them

1:35 tavis`: upstream was just too hard to track right? CL assumptions breaking things.

1:35 IceD^: anyway, it was pain to support both slime for my pretty CL and clojure's slime for one emacs

1:35 technomancy_: not just CL assumptions; general cowboy coding

1:35 no attempt at stability

1:35 IceD^: but yes, technomancy_ had his point why things are this way

1:35 Raynes: They are allergic to releases.

1:36 tavis`: got to run

1:46 IceD^: java -cp `lein classpath` clojure.main test.clj --- any shortcut for this?

1:47 technomancy_: sorta; try "lein help run"

1:47 tl;dr: you need a -main function

1:47 IceD^: gotcha

1:47 thnx

1:48 technomancy_: np

2:10 IceD^: another nab question (can't google it) - got java InputStream - want to read all data from it

2:20 slurp!

3:03 what's actual json lib?

3:04 contrib-1.2?

3:31 https://gist.github.com/1656272 - here we go

3:31 it works, but I don't like one thing in particular - thrown exceptions

3:32 suggest me better way for this usercase (client will call queues etc, not request directly). I do not want to just return empty array, but notify him about problem somehow

4:01 manuel__: hi

4:09 booksearch.ly

4:09 wrong chan sorry

4:18 foobar27: join emacs

5:57 clj_newb: StreamPrintServices supports printing to postscript, but not pdf ... is this right, or am I missing something?

6:13 How do I convert a java [] to a Clojure Vector ?

6:13 I want to convert a Java _array_ to a Clojure _vector_. How do I do this?

6:15 manuel__: i think you can just seq them

6:15 i'm a noob, but let me try

6:16 clj_newb: you're right

6:16 (apply vector ... ) works

6:16 thanks :-)

6:17 manuel__: (seq (make-array Integer/TYPE 4))

6:17 that works

7:11 LauJensen: Fogus made a tool which produced good looking source documentation via some leon plugin, anyone remember the name? Did it reach 1.0 ?

7:17 arbscht: LauJensen: marginalia?

7:17 LauJensen: Thats the one, thanks

8:10 zilti: I persisted a list of byte values using spit and pr-str. Now when re-reading it and do a (byte-array (read-string (slurp filename))) it gives me an error that the data could not be cast...

8:13 manuel__: which version of clojure is 4clojure running?

8:15 Licenser: manuel__ try running (*clojure-version*) ?

8:16 the-kenny: Licenser: clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentArrayMap ;)

8:16 raek: zilti: you might need to do (byte-array (map byte (read-string ....)))

8:16 since the numbers are boxed as longs when you read them

8:17 the-kenny: manuel__: The REPL linked at 4clojure runs 1.3.0 (evaluate *clojure-version*), don't know if the repl is associated with 4clojure, though.

8:18 manuel__: yeah

8:19 i have this: http://paste.lisp.org/display/127212 for this: http://www.4clojure.com/problem/73#prob-title and get: java.security.PrivilegedActionException: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.MapEntry (NO_SOURCE_FILE:0)

8:19 it works fine in my REPL though

8:19 i have a bit of a hard time parsing clojure error messages

8:19 raek: sounds like a bug

8:20 &(conj {:a 1} [:b 2])

8:20 lazybot: ⇒ {:b 2, :a 1}

8:20 raek: manuel__: does (conj {:a 1} [:b 2]) work at 4clojure?

8:22 Licenser: the-kenny then just *clojure-version* ?

8:22 manuel__: it's the case

8:22 hmm let me see

8:22 Licenser: ah I see you got it already ^^

8:23 manuel__: it does

8:23 it's (case (foo) [:x] :x) that's making trouble

8:23 the [:x] part

8:23 btw raek, care to explain your thinking? :}

8:24 raek: afaik, maps use clojure.lang.MapEntrys as its entries

8:24 and clojure.lang.PersistentVector implements that

8:24 manuel__: yeah i was wondering where that map entry was coming from

8:24 raek: ,(class (first {:a 1}))

8:24 clojurebot: clojure.lang.MapEntry

8:24 manuel__: so it's from the [:x]

8:25 raek: but it doens't seem like you are using maps anywhere

8:26 manuel__: this breaks in 4clojure; (case 1 [1] 2)

8:26 am i not getting something?

8:26 raek: could be a bug in the sandbox code

8:27 especially if the problem only shows up at 4clojure

8:27 have you tried that in both 1.2 and 1.3?

8:27 manuel__: yah prolly

8:27 nope will do

8:28 raek: I don't get that exception in neither 1.2 or 1.3

8:59 b6n: ,(every? true? [])

8:59 clojurebot: true

8:59 b6n: is that intended behaviour?

8:59 pandeiro: b6n: i think only nil and false are false in clojure

9:00 raek: b6n: sure, true is the unit element of the and operator

9:01 b6n: ,(every? #(= 10 (count %1)) [])

9:01 clojurebot: true

9:01 raek: you might want to use 'identity' or 'boolean' instead of 'true?', though

9:02 another way of saying p(x) is true for every x is to say there isn't any x such that p(x) is false

9:02 b6n: ok, but that (count ... ) thing really astonishes me

9:03 raek: why? the predicate is never called.

9:03 ,(every? #(= 10 (count %1)) [(range 10) (range 1 11)])

9:03 clojurebot: true

9:04 b6n: because I'm asking 'has every element in the collection the length 10

9:05 raek: the answer is yes, all elements trivially have the length 10 since there are no elements

9:07 this is similar to the problem "what is the sum of all numbers in a collection"

9:07 &(apply + [1 2 3])

9:07 lazybot: ⇒ 6

9:07 raek: &(apply + [1])

9:07 lazybot: ⇒ 1

9:07 raek: &(apply + [])

9:07 lazybot: ⇒ 0

9:07 raek: 'true' is for 'and' what 0 is for +

9:09 b6n: you're right, it's a bit like multiplying with 0

9:09 raek: with 1? :-)

9:10 b6n: at least it was astonishing to see a unit test succeed with no implementation written :-)

9:11 thanks for clarifying this

9:42 augustl: are there any purely functional web frameworks for clojure? Not sure if I like noirs thread local state etc..

9:42 where a page gets a request object passed to it and you return a response object

9:46 pandeiro: augustl: don't have an answer for you but do you know of any such frameworks in other languages? i'd like to see

9:47 raek: augustl: http://brehaut.net/blog/2011/ring_introduction

9:47 augustl: pandeiro: Rack for ruby works that way, for example

9:47 but rack is a bit lower level than what you want your web framework to be ;)

9:48 raek: ring (a library which noir is built on top of) lets you define your web app as a function from a request map to a response map

9:48 pandeiro: ah i was thrown off by the word 'framework'

9:48 raek: or maybe that was what you didn't like...

9:48 augustl: ring is similar to rack, it seems

9:48 raek: the flow of ring, but more utilities, basically :)

9:48 I like defpage etc in noir

9:49 not that hard to write that myself I guess

9:55 frankvilhelmsen: a natural choice on top of ring is fx compojure,

9:55 which has a greater degree of abstraction ontop of http

9:55 I use compojure into production successfully.

9:59 augustl: seems what I want is compojure + hiccup + defpage from noir

10:06 frankvilhelmsen: this is verly similar to sinatra plus haml in the ruby world

10:06 phil__: while talking about backends, is there any erlang-like distributed library, ideally running ontop of native clojure actors?

10:10 jondot: hi all, anyone done interop to WEKA or LingPipe for the purpose of deduping with clj?

10:18 the-kenny: phil__: Maybe die-roboter is something for you

10:20 phil__: the-kenny: thx, ill check it out

10:39 goodieboy: i'm playing with destructuring and wondering if there is a way to specify that I want ALL :keys to be let, like (let [{:keys :all} {:id 1}] (class id))

10:39 and if not... could a macro do something like this?

10:40 msappler: why do you want to do this?

10:41 goodieboy: well, really what I'm after is a way to create bindings from a hash-map. I'd like to create a function/macro that takes a string template, and then a hash map for the variable bindings. Just like clojures string interpolation library, but use hash-maps instead

10:41 (interpoloate "this ~{n}

10:41 oops

10:42 jeremyheiler: use the keys function? &(keys {:foo 1 :bar 2})

10:42 ,(let [k (keys {:id 1})] k)

10:42 clojurebot: (:id)

10:43 goodieboy: jeremyheiler: yeah I tried that, but my macro foo just isn't able to make it work

10:43 jeremyheiler: goodieboy: maybe post your macro then?

10:52 goodieboy: jeremyheiler: Here's a simplified version of what I have that should describe what I'm trying to do: https://gist.github.com/1657499

10:54 jeremyheiler: not sure if you got that last message (gist link) -- bad connection here :(

10:56 jeremyheiler: goodieboy: i got, am looking at it now.

11:12 goodieboy: ok wow, i think i actually got it! https://gist.github.com/1657499

11:17 jeremyheiler: goodieboy: nice!

11:19 goodieboy: jeremyheiler: that only took like, an hour + to do :) hopefully i learned something from that.

11:24 jeremyheiler: goodieboy: that's always good. you got me thinking about a few things, so it was helpful for me too.

11:28 goodieboy: jeremyheiler: great! Yeah I think using macroexpand was the key to see what was actually happening.

11:29 pdk: so

11:29 jeremyheiler: goodieboy: yeah definitely

11:29 pdk: found this old macro

11:29 and looking at it i got no damn clue what it's for

11:29 ;(defmacro dostatic [cls & ms] (cons `do (map #(list* `. cls %) ms)))

11:29 and i probably wrote that :\

11:32 jeremyheiler: pdk: looks like it creats forms like (. foo bar)

11:32 pdk: looking at it now in that case i dunno why i made it so roundabout

11:34 jeremyheiler: well, a sequence of those forms, passing each item in ms into whatever strin cls was.

11:36 Narvius: Hello, I have a question. I use leiningen (1.6.1) for my project, and I have a resource folder called assets (:resources-path "assets" in projec.clj), which in turn contains an images directory. After some searching around I concluded that the easiest way to obtain a list of files within that folder at runtime in an uberjar is to generate a "manifest" file containing a list of all files within that images directory. Is there a way to automat

11:37 So that it generates that manifest file before uberjar is ran.

11:57 TimMc: Narvius: You can add an arbitrary map of strings->strings to the manifest using leiningen's :manifest attribute.

11:59 Narvius: FYI, loading the correct manifest at runtime is tricky. This is how I did it: https://github.com/timmc/lein-jit/blob/master/src/lein_jit/loader.clj#L8

12:00 Narvius: TimMc: Alright, I will look into it. Thanks.

12:05 Okay. Now why does (resource "images") return nil when ran from the uberjar but the correct file URL when ran with lein run? The images folder is in the .jar, I checked.

12:05 clojure.java.io/resource, of curse.

12:05 course*

12:06 TimMc: Narvius: Resource loading is hard. I spent a day or two just making those two little files in that repo I linked.

12:08 Narvius: And there really is no simple way to load something I absolutely for 100% know is in the .jar?

12:09 TimMc: Well, look at the sample i sent.

12:09 You can load anything on the classpath, the trouble is knowing whether it's from *your* jar.

12:10 I may be minsunderstanding your problem.

12:12 Narvius: Hm... I'm starting to wonder whether I'd be better off to load the files from outside the .jar. >.>

12:17 IceD^: https://gist.github.com/1657735 - any comments are welcome

12:17 want it to be idiomatic, but not sure if doing it right

12:26 TimMc: Narvius: Once you get the classpath stuff sorted out, it shouldn't be too bad.

12:30 ericshull: q

12:32 jsnikeris: technomancy: Are *swank-source-path* and *swank-compile-path* intended to be dynamically rebindable?

12:41 alex_baranosky: can one not use a fn defined in a let within a deftype declaration?

12:41 because of the macro expansion I suppose

12:42 Chousuke: I don't see why not :/

12:44 alex_baranosky: Chousuke, only saying it because I'm getting an error here when I try to put 'normalized-metaconstant' into a letfn -- https://github.com/marick/Midje/blob/master/src/midje/ideas/metaconstants.clj#L13

12:44 java.lang.Exception: Unable to resolve symbol: normalized-metaconstant in this context

12:47 Chousuke: hmm :/

12:51 alex_baranosky: Chousuke, I guess I'll lose this battle today.

13:24 kcinvres: g'day

13:31 dnolen: you know Clojure isn't such a bad language for writing mutable code :D

13:31 this is epic gross but https://github.com/clojure/test.benchmark/blob/master/src/main/clojure/alioth/nbody.clj, but hey we'll be right there with Java and Scala soon.

14:32 trptcolin_: is there something in core already to intern a var with all the necessary metadata attached? this little `intern-with-meta` function seems pretty generic (in my case, for bringing a macro in)... https://github.com/trptcolin/reply/commit/d58fb2eb1d4bfffc8cf8e2c3c216caca81969654

14:33 and/or am i missing a simpler way?

14:42 tufflax: Luyt no, i don't think so. Clojure functions can only return one thing.

14:42 ops, i had scrolled up and didn't check the time stamp. I'm very late :p

14:56 kcinvres: I'm new to git (among other things) and I'm trying to figure out how to upload my stuff to github

14:58 I made a website based on noir-blog and now I'm trying to clean it up and put it on github... but I'm not sure if I should just upload the code... or fork the original noir-blog project and then push to that...

14:58 Raynes: kcinvres: I think either way is fine in this case. Forking it might be better for historical sake.

15:02 kcinvres: Raynes: Okay, well I've done a fork. but the code is somewhat different now. I renamed the project, renamed some directories... Every file has changed between 5% and 30%.

15:03 Raynes: kcinvres: That's fine. You can still push it to Github. You can also rename your project to something else (and keep it a fork) in the admin panel.

15:05 kcinvres: Raynes: Okay. If I push on top of the current fork, will the renamed folder replace the old one? or will then both be there?

15:05 Raynes: What you push will replace what is there entirely.

15:05 kcinvres: I obviously want the former.. okay

15:06 Raynes: It will be a clone of what you have.

15:06 In a distributed version control system like git, everybody has a complete copy of the repository.

15:07 kcinvres: okay.. and people don't worry about it because they have all the previous commits

15:08 Raynes: Right.

15:08 You can always hop back to some other point in history.

15:08 Git is like a time machine.

15:15 raek: ...with a non-linear time axis!

15:15 (namely a DAG-shaped)

15:30 gfredericks: Are there any clojurescript libraries for canvas stuff yet?

15:31 brehaut: gfredericks: for some reason i think pinot provides some?

15:31 (not that ive actually used it at all)

15:34 gfredericks: huh; so it does

15:34 brehaut: gfredericks: karma to mostly lazy then :)

15:35 gfredericks: $inc mostly-lazy

15:35 lazybot: ⇒ 1

15:37 gfredericks: huh...looks like it doesn't use the goog libs though. I figured that would be the simplest approach.

15:50 brehaut: huh, F#'s WebSharper (Web dev stuff with F# -> JavaScript compilation) is now free http://blogs.msdn.com/b/dsyme/archive/2012/01/22/websharper-javascript-html5-mobile-etc.aspx

15:51 dnolen: gfredericks: goog canvas implementation is way broken.

15:56 gfredericks: dnolen: really? That's disappointing. I haven't yet used a library that abstracted over the various browser differences well. I haven't used much though.

16:02 technomancy: jsnikeris: I couldn't say; those were from before I started working with swank.

16:04 jsnikeris: technomancy: gotcha. They don't jive w/ the convention that vars whose names start and end with '*' should be declared ^:dynamic

16:05 technomancy: jsnikeris: yeah, swank code is paleolithic. there are places where it uses refs instead of atoms just because atoms hadn't been implemented yet

16:05 dnolen: gfredericks: the canvas implementation is ok for simple drawing - for more complex procedural drawing / animation I would not use it.

16:06 kcinvres: Okay, so I'm about to push. But my local repository has its own history and the one on github has a few of its own commits. When I push, which will be the canonical history?

16:06 the-kenny: I tried using the canvas stuff from goog once. Horrible, horrible experience.

16:08 gfredericks: Well I didn't expect it would be pleasant to use directly, but at least reliable and functional; i.e., would be good once wrapped in cljs.

16:09 I guess the google docs drawing code must use something else?

16:16 ordnungswidrig: kcinvres: you can only push if your local branch appends to the current head of the remote branch

16:17 koeien: ebian

16:18 whoops

16:18 kcinvres: ordnungswidrig: How would I know if that is the case?

16:19 ordnungswidrig: kcinvres: git log −1 shows the head of the branch you're on

16:20 * gfredericks is a fan of git log --graph

16:21 kcinvres: git log -1 commit cdb2ec347436ab9fd2f5640af34c67e348f58f4e Author: John Newman <johnmn3@gmail.com> Date: Sun Jan 22 16:07:47 2012 -0500 moving to github

16:22 doesn't say master

16:22 though doing a "git branch" says master

16:25 gfredericks: kcinvres: my favorite is git log --graph --all --format=\"%h[%t] %d %an--%s\"

16:26 kcinvres: ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:johnmn3/qftk-site.git' To prevent you from losing history, non-fast-forward ...

16:26 so that's what you're talking about

16:30 google is telling me to do a pull and then another push

16:30 won't that wipe out my current changes?

16:31 jeremyheiler: kcinvres: no, it will merge what it can. then ask you to merge anything that conflicts with you changes.

16:31 gfredericks: kcinvres: not to mention the commit you're currently on will be part of the history, so you can always go back and see what happened when you merged

16:31 kcinvres: most recent file wins?

16:32 gfredericks: e.g., after the merge you could diff your current commit with the new commit and see exactly what the merge changed

16:33 jeremyheiler: kcinvres: git will automatically merge any line of code that it knows you didn't change. then it asks you to manually merge anything that you did change.

16:35 kcinvres: just did a pull and I'm seeing git comments in the code!?

16:35 jeremyheiler: kcinvres: that's the code you need to manually merge yourself.

16:40 kcinvres: thats a lot of code to edit

16:43 ok, so I think I get it : <<< HEAD local stuff ===== remote stuff >>>> 345345345

16:43 So I can just go through and delete all but the local stuff

16:44 jeremyheiler: kcinvres: assuming that you don't want any of the new stuff.

16:45 kcinvres: I don't

16:46 ordnungswidrig: kcinvres: http://learn.github.com/p/intro.html

16:48 kcinvres: in this case git pull -Xours will force your local changes. But use with care

16:48 kcinvres: ordnungswidrig: Okay. Thanks!

16:49 clj_newb: so I'm writing a WYSIWYG editor in clojure; and I'm getting to the point that lag is a bit intolerant for an interative application. What should I read up on for profiling? (I know nothing abot profiling Clojure or Java code; I only know how to use gprof for C++ code.)

16:49 kcinvres: just did it by hand this time. running again to see if it still works

16:50 ordnungswidrig: clj_newb: yourkit.com is a very good profiler.

16:50 kcinvres: no, I broke something

16:50 how do I roll back one?

16:50 clj_newb: ordnungswidrig: there's nothign like clojure_prof ?

16:51 dnolen: clj_newb: VisualVM works, YourKit is nicer. Look at test.benchmark for ideas on speeding up the slow spots.

16:51 ordnungswidrig: kcinvres: git checkout

16:51 clj_newb: let me rephrase my question: is the optimal clojure profiler just to use the best java profiler?

16:51 ordnungswidrig: http://richhickey.github.com/clojure-contrib/profile-api.html

16:51 lazybot: Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/profile-api.html and try to stop linking to rich's repo.

16:51 ordnungswidrig: grr

16:52 jeremyheiler: owned by lazybot lol

16:52 clj_newb: lol; lazybot is almost cute

16:52 dnolen: clj_newb: the JVM profilers are quite nice IME.

16:53 kcinvres: error: you need to resolve your current index first

16:53 ordnungswidrig: clj_newb: it depends. standard java hprof might be sufficient for profiling

16:53 clj_newb: s/java/jvm/

16:59 kcinvres: http://stackoverflow.com/questions/101752/aborting-a-merge-in-git

17:00 kcinvres: k, I fixed the code. Now when I do a "git add ." it says "fatal: unable to stat 'folder/file' : No such file or directory

17:01 Because I deleted the directory that got pulled from github

17:02 ordnungswidrig: I think that works, thanks!

17:03 ordnungswidrig: where did io/delete-file-recursively go in 1.3?

17:03 i mean contrib.io/...

17:04 alex_baranosky: ordnungswidrig, perhaps fs may contain what you need? https://github.com/Raynes/fs/blob/master/src/fs/core.clj

17:08 clj_newb: ordnungswidrig: purely out of courisity; what does your nick stand for? phonetically it sounds like some word in a langauge I do not understand

17:08 ordnungswidrig: alex_baranosky: oh thanks.

17:09 the-kenny: clj_newb: It's German :)

17:09 ordnungswidrig: clj_newb: it means "contraty to regulations" in german.

17:09 clj_newb: law / administration term

17:09 clj_newb: an "ordnungswidrigkeit" is a "minor breach against the law"

17:10 tavis`: is there a way to force a non-dynamic var to be dynamic in 1.3 - specifically #'clojure.core/read-line?

17:10 clj_newb: ordnungswidrig: ah; german does make sense, it sounds angry

17:11 the-kenny: :D

17:11 hiredman: tavis`: it's a compile setting, so if you alter-meta! and set :dynamic to true before the code that calls read-line is compiled it will be compiled as a dynamic var

17:13 tavis`: so alter-meta! before pulling in the ns that needs to do that

17:13 thanks

17:13 hiredman: well, it will only be accessed dynamically by code that is compiled after you change the metadata

17:13 tavis`: right

17:14 kcinvres: uuugh.. still non-fast-forward errors :(

17:14 hiredman: ok

17:15 tavis`: hiredman: an if I have a macro that does a binding of read-line it's the ns that uses the macro rather than the ns that defines the macro that I need to worry about, right?

17:16 hiredman: I don't follow

17:17 if namespace A calls read-line, if you change the metdata on #'read-line before A gets compiled you will be able to effect the function that gets called using binding, if not, you won't

17:17 tavis`: I've got a macro swank.core/with-readline-support: (w-r-s [& body])

17:18 it's the ns that uses that macro that I have to compile after alter-meta! rather than swank.core, I assume

17:18 hiredman: it is the namespace you want the dynamic binding to effect

17:19 tavis`: ok, thanks.

17:26 kcinvres: OMG, I'm so confused

17:26 no git won't commit

17:28 *now

17:28 tavis`: hiredman: no luck

17:32 kcinvres: I do a git reset --hard, then delete the files I don't want, then git add ., then git commit -m "update"

17:32 clj_newb: in Java, am I allowed to assume that \a \b ... \z forms an consecutive increasing sequence; and \A ... \Z forms another consecutive increasing sequence?

17:32 kcinvres: and then it says "no changes to commit

17:32 clj_newb: i.e. I want to see if a char is one of \a ... \z or \A .. \Z

17:33 jeremyheiler: clj_newb: yes

17:33 kcinvres: ugh

17:33 Your branch is ahead of 'origin/master' by 1 commit.

17:33 clj_newb: jeremyheiler: what standard that Java conform to that allows me to make this assumption?

17:34 jeremyheiler: ,(< (int \a) (int \b))

17:34 clojurebot: true

17:34 jeremyheiler: ,(< (int \e) (int \d))

17:34 clojurebot: false

17:34 jeremyheiler: convert the char to an int

17:35 clj_newb: in java, you can do comparasons on char primitives like: if('a' < 'b')

17:35 but converting to ints work as well.

17:36 dnolen: ,(compare \a \b)

17:36 clojurebot: -1

17:36 clj_newb: ,(< \a \b)

17:36 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.Number>

17:36 clj_newb: ahh, compare

17:40 Found my bug: file had unicode characters; font only supposed ascii characters; weird out of bound cases now resolved. :-)

17:43 kcinvres: ugh, finally

17:43 https://github.com/johnmn3/qftk-site

17:43 looks like .gitignore got ignored though, cause I had to do a git push github master --force

17:49 clj_newb: clojure.org/libraries has a link to a "parsec like" library for cojure. The link is broken.

17:50 lazybot: please fix it

17:56 romain_p: Hi everyone, I have a question about the thread macro (->): given that "gather-words" returns a list of words, what is wrong with this: (-> "http://www.fang.ece.ufl.edu/reject.html" slurp gather-words frequencies #(sort-by second %))

17:57 (the error I get is java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.IPersistentVector (NO_SOURCE_FILE:17))

17:58 dnolen: romain_p: -> is pure syntax transformation, it will screw up on the fn literal.

17:58 clojurebot: 'Sea, mhuise.

17:58 romain_p: and the original, working code was (sort-by second (frequencies (gather-words (slurp "http://www.fang.ece.ufl.edu/reject.html"))))

17:58 dnolen: (macroexpand '(-> a #())))

17:58 ,(macroexpand '(-> a #())))

17:58 romain_p: dnolen: I am a beginner, and this is chinese for me, could you explain ?

17:58 clojurebot: (fn* a [] ())

17:58 dnolen: romain_p: ^ notice that looks weird

17:58 romain_p: yup :)

17:59 dnolen: #(sort-by second %) is just not going to work inside ->

17:59 romain_p: OK, so should I declare it outside or is there an idiom I could use?

17:59 trptcolin_: if you wrap another set of parens it might :) kind of yucky though...

18:00 (-> "http://www.fang.ece.ufl.edu/reject.html" slurp gather-words frequencies (#(sort-by second %)))

18:00 threading is all fun and games until you want to switch from -> to ->>

18:00 romain_p: trptcolin_: it does work, but I agree with the yuckiness part too :)

18:07 brehaut: trptcolin_: its easy to switch from -> to ->>; its the other way thats dumb

18:08 trptcolin_: i guess i haven't ever had multiple ->>'s chained together, come to think of it...

18:09 brehaut: ,(-> 1 (+ 1) (->> (* 3)))

18:09 clojurebot: 6

18:11 brehaut: (numbers are a terrible example of that)

18:15 trptcolin_: :) well, + and * anyway, since argument order doesn't matter. for some reason i didn't think of nesting - that's a good idea.

18:15 TimMc: brehaut: I think there might be a few implementations of -%> floating around, e.g. (-%> 5 (+ 5 %) (nth % (range)))...

18:16 brehaut: TimMc: huh thats cool

18:16 trptcolin_: :) that's kind of sweet

18:16 TimMc: Some people add ,,, where the arg would go anyway; might as well make it real.

18:16 dgrnbrg: has anyone ever used fleet? Can you explain what it means when I use the fleet-ns macro that "foo.bar.fleet" produces 3 functions: foo, foo-bar, and foo-bar-fleet? What is the purpose of each function?

18:21 TimMc: dgrnbrg: What is fleet?

18:23 brehaut: TimMc: its a templating engine i believe

18:23 Somelauw: I prefer letting over ->

18:24 brehaut: TimMc: sort of a rails templating thing for clojure?

18:24 TimMc: dgrnbrg: You may wish to macroexpand the call to see what it produces, if the docstring is mysterious.

18:27 dgrnbrg: TimMc, it is indeed a templating engine

18:27 I have read the docs, and the source, but I'm having trouble following along with the call chain

18:27 and seeing where exactly they actually def the new functions

18:28 the fleet-ns macro takes a directory as an input, inteprets the files as templates, and then defines the templates in a new namespace

18:29 brehaut: dgrnbrg: im curious; why did you choose fleet over enlive or hiccup?

18:29 dgrnbrg: I want to template verilog code

18:30 Fleet seemed to be pretty removed from html-ville

18:30 brehaut: right

18:30 dgrnbrg: I also want to template vhdl

18:30 they all have really different syntaxes

18:30 I want something like gsp/jsp or StringTemplate in groovy

18:31 the fact that fleet lets me write templates as resource files is just gravy, and i apparently may be reimplementing that part myself

18:32 brehaut: cl-format to the rescue ;)

18:33 dgrnbrg: wat's that?

18:33 brehaut: magic

18:33 clojure.pprint/cl-format

18:33 its common lisps format ported to clojure

18:33 with all the crazy that entails

18:34 (it wasnt a serious suggestion)

18:34 dgrnbrg: what makes it crazy?

18:35 brehaut: its quite an involved, yet terse, formatting language

18:35 dgrnbrg: if all i need is string interpolation

18:36 brehaut: then plain old format is probably a better choice

18:36 dgrnbrg: I just want more convenience when templating

18:36 i may need loops or other, more complicated constructs

18:38 dnolen: dgrnbrg: if you like StringTemplate you can use that from Clojure no?

18:41 dgrnbrg: dnolen, I could, but it seems cleaner to use the clojure lib

18:41 especially for parameterizing templates with maps whose strings are clojure keywords

18:47 trptcolin_: didn't the stock clojure repl used to dump stacktraces? i can only seem to get it to print a 1-line exception summary. (i know i can (pst) to get it to print if i really want to)

18:53 dnolen: trptcolin_: pretty sure it never did.

18:53 TimMc: amalloy_: Do you happen to know of an implementation of -%>, that threading macro that allows you to explicitly select where the threaded arg goes?

18:55 trptcolin_: dnolen: yeah, that's what i'm seeing. even going back to 1.1.0 jar... trying to remember why i think stacktraces are so annoying to read when they don't come up by default in-repl.

18:58 clj_newb: are map/reduce, loop/recur the main constructors for replacing for loops; is there anything else I should be aware of?

18:59 dgrnbrg: clj_newb, the for macro is really useful

19:00 clj_newb: dgrnbrg: it does look interesting

19:01 * clj_newb peeks at (source for) .... crap

19:05 dgrnbrg: clj_newb, it is a little DSL that's like python's syntax

19:06 so (for [a [1 2 3] b [:a :b :c]] [a b]) gives [1 :a] [1 :b] [1 :c] [2 :a] ...

19:06 brehaut: clj_newb: lazy seqs and loop/recur are the primary _low level_ building blocks of loop replacement.

19:07 dgrnbrg: clj_newb, you give it some seqs, the names of the given element of that seq, and some filters, and then you get to write the expression that yields the value for the result seq

19:08 brehaut: clj_newb: you infrequently operate with either directly. map, reduce, filter, keep, take etc (ie, the seq functions) are the primary 'loop replacement'

19:09 clj_newb: http://clojuredocs.org/quickref/Clojure%20Core have a look at Collection / Sequences > Sequences

19:26 trptcolin_: so i have this workaround for http://dev.clojure.org/jira/browse/CLJ-909 (configuring LineNumberingPushbackReader's buffer size), but there are places in the clojure reader (LispReader) that depend on "instanceof LineNumberingPushbackReader".

19:27 ... and the instanceof checks break line-numbering for stack traces. anyone have ideas for further hackery short of getting that patch in?

19:30 i should've said, those instanceof checks break line-numbering for traces *when you replace LineNumberingPushbackReader with something else*

19:38 wjlroe: Can the order of the keys in a PersistentHashMap be relied upon?

19:39 brehaut: no

19:39 although joy of clojure claims that array-map does have that property though you have to be careful that the array map stays an array map

19:43 given PersistentArrayMap.cons will return a PersistentHashMap when it reaches a certain size, i dont believe its easy to keep with an array-map

19:45 wjlroe: I have been getting weird behaviour where the order of the keys in a map is as I wanted (comes from a sql query), but when it gets to a certain number of keys - the order changes, to a different, consistent ordering)

19:45 brehaut: wjlroe: thats the difference between array-map and hash-map

19:46 they both implement the IPersistentMap interface, and the back type for clojures maps

19:46 array maps are used for small maps, and hash maps when they grow too large

19:46 wjlroe: for a given set of keys and insertion order hash map is consistent but its not goign to maintain insertion order

19:47 wjlroe: what I found is when these maps have over 10 keys - the order is strange

19:47 brehaut: i think the order should be 16

19:47 https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentArrayMap.java#L32

19:48 wjlroe: like i said, hash map _does not maintain insertion order_

19:48 wjlroe: well it's defo smaller than that

19:48 yeah

19:48 not very useful when that's what you get from a sql query (Korma) - a vector of hash maps

19:50 brehaut: ,(for [n (range 20)] [n (class (reduce conj (array-map) (map (juxt identity identity) (range n))))])

19:50 clojurebot: ([0 clojure.lang.PersistentArrayMap] [1 clojure.lang.PersistentArrayMap] [2 clojure.lang.PersistentArrayMap] [3 clojure.lang.PersistentArrayMap] [4 clojure.lang.PersistentArrayMap] ...)

19:50 brehaut: rats

19:50 (for [n (range 14 18)] [n (class (reduce conj (array-map) (map (juxt identity identity) (range n))))])

19:50 jeremyheiler: wjlroe: do your hash maps represent rows in the database? if so, why does order matter?

19:50 brehaut: ,(for [n (range 14 18)] [n (class (reduce conj (array-map) (map (juxt identity identity) (range n))))])

19:50 clojurebot: ([14 clojure.lang.PersistentHashMap] [15 clojure.lang.PersistentHashMap] [16 clojure.lang.PersistentHashMap] [17 clojure.lang.PersistentHashMap])

19:51 wjlroe: jeremyheiler: yup - order matters because the keys in the map relate to the columns in the select query - those fields are ordered in the query and should be in that order in the data that results

19:53 brehaut: wjlroe: why a map and not an ordered collection?

19:53 (eg a vector)

19:53 jeremyheiler: wjlore: it's easy enough to get around that by maintingin a vector or list of your keys, and iterate over them when you need to pull the values out of the map.

19:53 wjlroe: jeremyheiler: define the same info twice. not very dry

19:54 brehaut: so yeah that would work - vectors of vectors, which I would have to transform from the results of a query and reorder the keys on the way

19:56 jeremyheiler: wjlore: don't you have to define the keys (selected columns) in order for a select query to work anyway?

19:57 why not just use same vector/list of keys?

19:57 wjlroe: the problem is, because the SQL library - Korma - returns PersistentHashMaps - I'm gong to have to mess around with that to make it useful, I shouldn't have to do that - it should come out in a sane format that doesn't require re-ordering

19:58 jeremyheiler: the list of columns relates to the tables/subqueries - the list of keys relates to the data returned, they aren't quite the same so would have to define this twice

19:58 brehaut: huh? i was sure korma returned a vector (or some seq) of maps

19:58 wjlroe: so the select has a field - :table.column - and then I'd need to fix the returned map by ordering the columsn again [:column :another]

19:59 it does - exactly

19:59 maps are the problem

19:59 * brehaut boggles

19:59 wjlroe: it returns a vector of maps - which turn out to be PersistentHashMaps - which doesn't preserve the order of the fields requested in the query

20:00 which is borken

20:01 brehaut: fields arent inheriently ordered

20:02 wjlroe: I don't know what you mean by that - they are in every other language and library I've used sql with.

20:02 brehaut: ,(map {:a 1 :b 2 :c 3 :d 4} [:b :c :d]) ; anyway, trivial to select an ordered subset of the row

20:02 clojurebot: (2 3 4)

20:03 wjlroe: if I just wanted the values - yes

20:04 brehaut: well then, select-keys is also not hard to use

20:05 wjlroe: doesn't work

20:06 returns the out-of-order map

20:06 very bizare

20:06 brehaut: maps have no order

20:06 wjlroe: unless they are array maps

20:06 brehaut: which you cant rely on

20:07 the interface is what you should be programming to

20:07 and the interface has no garuntees on order

20:07 wjlroe: back to python then

20:07 brehaut: anyway, it sounds like you are doing something pretty bizarre

20:09 wjlroe: this just means I'm going to have to write a separate function per table/query instead of using the one and being able to rely on a sane data structure

20:10 I realise hash maps aren't ordered, but it would be nice if there was something reliable which was a map with ordered keys that was sane

20:10 brehaut: lets assume thats true. Why‽

20:11 wjlroe: why what?

20:11 amro: it's a nice plus, but I wouldn't call unordered maps insane

20:11 wjlroe: unordered maps aren't insane. not having ordered maps is not very useful

20:11 brehaut: why do you want the keys and values of the records in a query result to be ordered

20:11 let me rephrase my question

20:12 what is the problem you are trying to solve

20:13 i agree that ordered maps are useful, but i cant see why they would be in the particular case of SQL query results

20:13 amro: I'll second that

20:13 wjlroe: I have defined a query - get me these fields from this database - then I wanna display that. Fine. Problem is what I asked for from the database is mangled by the data structure. So I have to monkey with the data to re-order things to match the query I wrote. Perhaps this is a part of SQL that just doesn't match concepts in Clojure - but most times when you write a query in a DSL - the fields come

20:13 back ordered as you would want

20:14 really all I need is to tell Korma to return results in a different way

20:15 brehaut: ,((fn repr-record [{:keys [a b]}] (prn-str "a record:" a b)) {:c "abc" :b 23 :a "hello, world"})

20:15 clojurebot: "\"a record:\" \"hello, world\" 23\n"

20:16 brehaut: or you could (and i dont think this is a particular controversial idea) refer to named values by name

20:17 wjlroe: sure

20:17 I have a function that prints results - regardless of what fields etc are there - I will have to complicate that rather to take this into account

20:28 Does anyone know, when you've run clojure-jack-in from Emacs - how, in your code, you can print to the repl?

20:29 although it was better to call (swank.core/break) to find out what was going on

20:29 so never mind

20:33 benares_98: ,(doc dosync)

20:33 clojurebot: "([& exprs]); Runs the exprs (in an implicit do) in a transaction that encompasses exprs and any nested calls. Starts a transaction if none is already running on this thread. Any uncaught exception will abort the transaction and flow out of dosync. The exprs may be run more than once, but any effects on Refs will be atomic."

20:33 benares_98: can anyone tell me what the & means?

20:35 gfredericks: it means that the function/macro takes varargs

20:35 jimduey: It means that the dosync form takes a variable number of expressions. The value 'exprs' is a list of those expressions.

20:35 benares_98: thansk

20:35 *thanks

20:35 gfredericks: it parallels the syntax for actually implementing a vararg function

20:35 and destructuring more generally

20:40 _carlos_: hi!

20:48 dnolen: wjlroe: clojure has sorted-maps, sounds like sqlkorma is missing a feature you like.

20:48 wjlroe: dnolen: if that's the case, then yeah

20:50 _carlos_: in clojure in action book: in concurrency chapter, page 157, just above commute explanation, I cite: "it doesn’t matter in what order you add users. If two threads were both trying to add a user to our system, you wouldn’t care in what order they’re added. Such an operation is said to be commutative". I don't understand why it is commutative, because at the time commute would be called for that example, (inc current-number)

20:50 outdated version of the id

20:50 sorry for the long paste

20:51 brehaut: dnolen: sorted-map isnt an ordered-map though

20:51 _carlos_: btw, the page number printed in the pdf itself is 133

20:52 dnolen: brehaut: by that do you mean preserving insertion order?

20:52 brehaut: dnolen: yes exactly

20:54 wjlroe: I've solved my problem now, just would have been nice if Korma could just output data in vectors maybe so the order can be assumed. I'll ask about it

20:54 (vectors of vectors - or first elem is field names)

20:54 dnolen: brehaut: ah ok. though I think in wjlroe's case he doesn't really care how it's done, as long as he can iterate over the fields in the same order he specified in the query ;)

20:54 wjlroe: YES

20:54 :)

20:54 brehaut: dnolen: yeah, i understand that requirement. i just think its wrong ;)

20:55 wjlroe: I'll just have to stick a sticky note to my screen that says "Don't assume the order of anything. Write more code to be sure"

20:57 jimduey: wjlroe: you might use juxt to accomplish what you want easily.

20:58 brehaut: jimduey: huh. thats a cunning alternative to map

20:58 jimduey: ((juxt :a :d :c) {:a 3 :b 5 :c 8 :d 1})

20:59 wjlroe: That is clever

20:59 brehaut: jimduey, (map {:a 3 :b 5 :c 8 :d 1} [:a :d :c])

21:00 cemerick: is https://github.com/Chouser/clojure-jna/ the state-of-the-art of Clojure->native goodness?

21:00 jimduey: yep. I get to use juxt so rarely that I like to use it when I can to keep in practice

21:00 brehaut: lol :)

21:01 dnolen: brehaut: but juxt is so much cooler man.

21:01 brehaut: dnolen: no argument there :)

21:01 wjlroe: (if (resolve 'swank.core.connection/*current-connection*)) <- for some reason that is true, even when swank.core.connection is not defined - i.e. in production - what mistake did I make?

21:02 clj_newb: is there a way to generate the charsacters from \a to \z

21:02 something like say \a .. \z, except in clojure

21:02 dnolen: ,(int \a)

21:03 clojurebot: 97

21:03 dnolen: ,(int \z))

21:03 clojurebot: 122

21:03 dnolen: ,(map char (range (int \a) (int \z)))

21:03 clojurebot: (\a \b \c \d \e ...)

21:03 clj_newb: dnolen: thanks

21:04 brehaut: i think raynes has a generic range lib somewhere too

21:04 dnolen: ,(map (juxt identity char) (range (int \a) (int \z)))

21:04 clojurebot: ([97 \a] [98 \b] [99 \c] [100 \d] [101 \e] ...)

21:04 clj_newb: ,(println (int \1) (int \9) (int \0))

21:04 wjlroe: I was going to ask - can you define multimethods for different sorts of ranges - so one acts on characters

21:04 clojurebot: 49 57 48

21:05 Raynes: https://github.com/Raynes/morphin

21:05 wjlroe: nice

21:06 chewbranca: range is exlusive though, you'll have to do something like (inc (int \z)) if you want z as well. Is there a better way to do that?

21:06 clj_newb: without the use of flatten, is there a way to change ( [k1 v1] [k2 v2] ... [k_n v_n]) into { k1 v1, k2 v2, ... , k_n v_n } ?

21:06 Raynes: &(into {} '([:a 1] [:b 2]))

21:06 lazybot: ⇒ {:a 1, :b 2}

21:06 wjlroe: (into {} [[k v]])

21:06 too slow :(

21:07 clj_newb: wjlroe , Raynes : thanks

21:08 wjlroe: I used to be so confused by the Ruby way to do that.

21:12 clj_newb: clojure is so awesome it enlightens its users about other langauges

21:14 wjlroe: well - except Java - there is no enlightenment there

21:15 clj_newb: I used to believe Java was utter crap. Now, I know that Java is a great VM + set of libraries, and all it has ever lacked was a decent programming language.

21:15 dnolen: wjlroe: heh not true, Java Concurrency In Practice is a pretty sweet book.

21:16 wjlroe: dnolen: oh well there is that

21:44 jeremyheiler: yeah, the stuff doug lea (et al) has done with the concurrent lib is pretty awesome

22:00 brehaut: ive managed to forget (again) where the clj-http repo is hosted

22:01 jeremyheiler: here? https://github.com/medSage/clj-http

22:01 scottj: brehaut: g site:github.com clj-http

22:02 brehaut: looks like the right lib. not the repo i previously used

22:02 johnmn3: .

22:02 duck1123: https://github.com/dakrone/clj-http

22:02 scottj: https://github.com/dakrone/clj-http

22:02 jeremyheiler: brehaut: yea, it's got almost 5x as many forks as watchers

22:02 lol

22:02 brehaut: duck1123, scottj: thanks!

22:02 johnmn3: g'day

22:18 looking for a fun clojure project to hack on... any ideas?

22:20 Raynes: Anything by that Raynes fellow. I hear he's pretty awesome.

22:22 dnolen: johnmn3: the core projects here - https://github.com/clojure

22:24 johnmn3: mmm. I'm a novice... Any low hanging fruit?

22:24 brehaut: johnmn3: a number of the contrib core projects probably have them yeah

22:27 johnmn3: you could contribute questions to 4clojure

22:27 johnmn3: this is the canonical contrib list: http://dev.clojure.org/display/doc/Clojure+Contrib ?

22:27 4clojure.. I should try using that too

22:28 dnolen: johnmn3: what type of thing would you like to work on?

22:28 johnmn3: I just did the QFTK/noir heroku thing... had a blog article on it recently

22:29 based on the noir-blog example

22:29 Though I've dabbled more in desktop apps in the past

22:32 dnolen: johnmn3: too many interesting web related stuff going on these days, noir, korma, ring, compojure, aleph, clojurescript

22:32 johnmn3: the desktop stuff that I'm aware of is mostly around tooling

22:33 brehaut: dnolen: a core.match based webforms library could be a great little project

22:34 dnolen: brehaut: that would be neat! there's a fairly gnarly fundamental issue I'm contemplating - so I'm not encourage people yet.

22:34 brehaut: dnolen: oh yeah?

22:34 dnolen: when core.match hits beta I'll push it more

22:34 brehaut: that'd be great!

22:35 dnolen: brehaut: pattern matching w/o type constriants is pretty tricky.

22:35 brehaut: core.match works in clojurescript too right?

22:35 dnolen: brehaut: yes

22:35 brehaut: ah true

22:35 dnolen: staticly typed FP languages have it easy, they constrain the types in "column"

22:35 core.match imposes no such restrictions

22:35 brehaut: so it should be possible (once aforementioned gnarl is sorted) to have a great form processing library that works on client and server trivially

22:36 dnolen: brehaut: yep

22:36 brehaut: what do you mean by 'column' ?

22:36 dnolen: brehaut: in FP langs patterns form a pattern matrix

22:37 johnmn3: are we talking about form validation?

22:37 brehaut: johnmn3: yes

22:37 johnmn3: mm

22:37 big push for non-turing protocols recently

22:38 I'd imagine match/logic can go a ways in constraining that..?

22:38 dnolen: brehaut: somef 1, somef "foo", not allowed in static typed langs as a valid pattern

22:39 brehaut: dnolen: are right. i understand you now. youd have to have something like data Foo = SomeI Int | SomeS String, and pattern matching is trivial then

22:39 dnolen: brehaut: precisely, you need to define the sum type ahead of time

22:39 brehaut: dnolen: whereas you need to infer it based on the provide rules ?

22:41 dnolen: brehaut: the problem actually arises out of how aggressively we try to optimization pattern matching

22:41 brehaut: i guess you also can never tell if you have a partial pattern too

22:41 dnolen: brehaut: we prefer that we never a run a test again.

22:42 brehaut: huh thats going to be complicated

22:43 dnolen: brehaut: sort of ... the designer of the pattern extension has to specify if their pattern can be compared w other patterns.

22:43 brehaut: interesting

22:43 dnolen: if it can't core.match creates a backtrack point

22:43 but we'd rather not do that, cuz then we're not better than case by case

22:43 johnmn3: hmm, never saw this pass my reader: https://github.com/daveray/upshot

22:43 "A Seesaw style Clojure API for JavaFX"

22:44 dnolen: brehaut: it is pretty interesting. I'm considering disallowing arbitrary guards for example.

22:45 brehaut: arbitrary fn expressions for guards I mean. since fn comparison is undecideable.

22:45 brehaut: that makes sense

22:46 thats an interesting tradeoff there

22:46 dnolen: brehaut: it's a classic tension between, easy to use / optimizeable

22:46 brehaut: you'd have to create a backtracking point for every fn guard right?

22:46 dnolen: brehaut: yep

22:47 so I'm taking my time, I don't want to go beta without these things sorted out

22:47 brehaut: yeah fair enough

22:47 dnolen: and anything we decide needs to flow smoothly into predicate dispatch

22:48 brehaut: predicate dispatch if theres no backtracking becomes an extremely quick alternative to multimethods right?

22:49 dnolen: brehaut: yes

22:52 brehaut: dnolan: thanks for explaining this stuff.

23:10 clj_newb: I'm not sure how to expression this in words, but I will my best. Whoever decided to add Keywords to Clojure is a frickin genius. I find myself using them all over the place.

23:11 I wonder how one manages to invent stuff that previously never existed? (For example, if all humans had only one eye, how would one realize "hmm, having depth info would be imporatnt")

23:11 jeremyheiler: clj_newb: ruby has symbols, which is equivalent to clojure keywords.

23:12 clj_newb: ah; great artists steal

23:13 jeremyheiler: clj_newb: but yes, i've wished for a similar concept in java proper.

23:13 johnmn3: ibdknox: thanks for noir-blog! I used it here: http://qftk.herokuapp.com/view/the-book

23:13 clj_newb: jeremyheiler: what is this Java you speak of?

23:13 jeremyheiler: *shurgs*

23:13 *shrugs**

23:13 ibdknox: johnmn3: you're welcome :)

23:13 clj_newb: I've found that due to proxy and defrecord, I have not writen a _single_ line of Java code

23:14 whenever the interop between Java/Clojure needs to change; I just kill more of the existing Java libraries and write more clojure code

23:14 Clojure is like a virus eating through the Java sources.

23:14 jeremyheiler: haha

23:15 im currently thinking about how to kill javamail

23:15 (at least the smtp part of it)

23:15 TimMc: clj_newb: In many Scheme languages, symbols do the same task as Clojure's symbols + keywords.

23:15 Xorlev: noir + GSP would be wonderful.

23:15 TimMc: It's nice to have the uses separated.

23:16 ibdknox: GSP?

23:17 Xorlev: what's GSP? :)

23:17 I assume not an international airport

23:19 Noir + the German Space Program

23:19 Xorlev: Like JSP, but with Groovy instead :)

23:19 ibdknox: ah

23:19 Xorlev: I love Clojure and Noir, but composing pages with functions bothers me (exception: HAML)

23:20 ibdknox: Xorlev: there are alternatives to hiccup

23:20 mustache, enlive, stringtemplate

23:20 metajack: autodoc and marginalia do a good job for API reference type docs, but what are people using for overview and tutorial type docs?

23:21 Xorlev: Ooh

23:21 ibdknox: metajack: github wiki's are the only standard I've seen. For a branded site you'd end up writing your own stuff though

23:21 metajack: I used markdown for noir's docs and a little DSL I wrote for Korma's

23:22 metajack: ibdknox: I was specifically thinking about Noirs docs actually :)

23:22 ibdknox: Xorlev: so you don't just have to stick with that if you prefer something else :) There are definitely cases where that's necessary

23:22 metajack: the source is on my github :)

23:22 metajack: in the noir repo?

23:22 Xorlev: Maybe I'll write a few more Noir webservices then

23:22 ibdknox: metajack: https://github.com/ibdknox/webnoir

23:23 metajack: and korma's docs are here: https://github.com/ibdknox/sqlkorma

23:23 Xorlev: All the cool kids are ;)

23:23 metajack: Ah, i was looking for the special github web branch in the noir repo.

23:23 ibdknox: Korma's docs are way cooler than Noir's

23:23 https://github.com/ibdknox/sqlkorma/blob/master/src/sqlkorma/views/docs.clj

23:24 Xorlev: ibdknox: We have one internally, but we're somewhat hesitant to start writing production webservices in Clojure given about half of our team knows FP and half doesn't.

23:25 ibdknox: Xorlev: yeah not an uncommon problem

23:25 my goal is to keep making stuff until it's a detriment not to switch ;)

23:25 johnmn3: I think I hung tryclj

23:25 ibdknox: johnmn3: loads for me

23:26 johnmn3: ah, we're back

23:26 the evaluation was hanging

23:26 Xorlev: ibdknox: I like that approach. Someone else in my office tries to push it too but I think he's also realized that writing more stuff in Clojure will eventually just force us to move there.

23:27 In general, our goal is to improve cross compilation and polyglot systems so that using the right JVM language for the right task is a no-brainer.

23:27 ibdknox: haha I meant making stuff for others, but yes, it's a good guerrilla tactic

23:27 johnmn3: send it a bad (iterate ... form and it seems to hang up for a while

23:27 ibdknox: johnmn3: it waits for a timeout

23:27 can't remember what he set it to

23:28 I have some exciting CLJS stuff that I should be showing soon

23:28 metajack: ibdknox: I like that you separated the code from the docs. Very nice. Perhaps I will try and use orgmode to do something similar.

23:29 ibdknox: metajack: it was very useful doing it that way

23:29 made it much easier

23:31 johnmn3: ibdknox: care to indulge?

23:32 ibdknox: johnmn3: I've been working on some projects that have complex interactions between visual elements and have many states

23:33 johnmn3: I've been working on a solution for that and I think I might've gotten there last night :)

23:33 johnmn3: hmm. using goog libs?

23:33 ibdknox: interestingly it's pretty much framework agnostic

23:34 it will work with whatever

23:34 though I also got fed up with the goog libs

23:34 and have a nice jQuery lib I'll release soonish too

23:35 johnmn3: nice

23:35 ibdknox: it's much easier to work with

23:35 and provides a nicer base

23:35 though I'm sure someone will disagree with me :)

23:38 johnmn3: will it work with pinot?

23:38 ibdknox: johnmn3: it will be the new pinot :) What's there now was just random throwing together of things that I wanted to explore or needed. This will be much more thought out and present a more full solution

23:39 johnmn3: nice

23:40 I wanted to try converting the navigation bar on my qftk site to cljs

23:40 that's probably trivial though

23:41 ibdknox: I will say that as I've pieced things together, I've started to like CLJS a lot more

23:42 it's definitely not for everything though

23:43 johnmn3: I still think it'd be rad to be able to do compilation in the browser

23:43 lifting the whole language into the browser

23:43 just for dev purposes

23:44 Then I could develop on the website with just my browser. Though I know I could just point a webified repl to a clojure process on the server

23:45 ibdknox: doing the latter isn't difficult :)

23:45 johnmn3: still, with an in-browser compiler, we could do things like inspect/manipulate live javascript on random pages, right?

23:46 And perhaps do interesting distributed computing things

23:48 ibdknox: you don't need it for the latter :) Check this out: http://nakkaya.com/2009/10/04/fractals-in-clojure-buddhabrot-fractal/

23:51 johnmn3: rad

23:52 * johnmn3 is also watching web-rtc (http://www.webrtc.org/). Excited about the application-data api, for general p2p apps on html5

23:53 johnmn3: or app-data... forgot what it was called. Not implemented yet, but provides for p2p in the browser

23:54 the audio/video part is implemented in the chrome canary build

23:55 dnolen: ibdknox: this sounds like exciting stuff!

23:56 ibdknox: dnolen: statemachines and some neat helpers around them ftw :)

23:59 I've been a bit quiet lately and will be so for the next month I suspect, but I'll have lots of stuff to debut and talk about at ClojureWest :)

Logging service provided by n01se.net