#clojure log - Nov 02 2011

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

0:12 spoon16: how do I make an anonymous function call itself?

0:12 (fn [i] (lazy-seq (cons i (self-call-here (inc i)))))

0:13 napping: you can use recur

0:13 brehaut: ,((fn fn-name [a] (if (odd? a) (fn-name (inc a)) (str a))) 1)

0:13 clojurebot: "2"

0:13 brehaut: or you could bust out the y combinator :P

0:14 napping: ,((fn [i] (if (> i 0) (recur (dec i)) 12)) 10)

0:14 clojurebot: 12

0:14 napping: only good for tail calls, though

0:14 dnolen: core.logic 0.6.5 out the door. now easier to use!

0:14 brehaut: dnolen: congrats :)

0:15 dnolen: not a big change really, stopped overloading anything except ==, and all the useful functions are now in one namespace.

0:15 (ns foo.bar (:refer-clojure :exclude [==]) (:use clojure.core.logic))

0:26 tcj: I've got a matrix (2-d vector) of maps. I want to update maps contained in the cells of the matrix given a sequence of maps and a sequence of x/y coordinates. I'd like to have a function (defn update-matrix [matrix maps coords] ...) that updates the matrix. I'm getting stuck, I think because I'm trying to update the non-persistent collections in clojure. I've tried using transient, but it's...

0:26 ...tricky with nested sequences. Any advice?

0:27 brehaut: wow. thats dense

0:28 tcj: what non persistent collections are you using, and why?

0:28 tcj: brehaut: aren't persistent collections the default in clojure?

0:29 brehaut: tcj: yes; and you said "I think because I'm trying to update the non-persistent collections in clojure"

0:29 tcj: So if I update a map using (assoc), it'll return a new map

0:29 Ahh

0:29 I mis-typed

0:29 I meant "... persistent collections in clojure"

0:30 brehaut: ok, so lets start at the top. you are using a collection of vectors of vectors of maps ?

0:30 s/collection of vectors/vectors/

0:30 tcj: Maybe...

0:31 It's like this [[{} {} {}] [{} {} {}]]

0:31 So a vector of vectors of maps

0:31 spoon16: (defn ^File file… is that a type hint on the return?

0:32 tcj: And I want to update the maps

0:32 brehaut: tcj. ok, _how_ do you want to update the maps?

0:32 tcj: I want to add key/values

0:33 brehaut: to every map ?

0:33 or a particular map

0:33 tcj: Just a particular map

0:34 brehaut: ,(assoc-in [[{} {} {}]] [0 0 :a] 1) ; <- tcj

0:34 clojurebot: [[{:a 1} {} {}]]

0:34 brehaut: (doc assoc-in)

0:34 clojurebot: "([m [k & ks] v]); Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created."

0:35 tcj: Great, I think that'll work

0:35 brehaut: Thanks!

0:36 flognikr: tcj: might also want to check update-in

0:37 depending on how you want to modify the maps.

0:37 (doc update-in)

0:37 clojurebot: "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."

1:41 tolstoy: If I have a bunch of dynamic vars I want to set in sequence, rather than parallel, is it acceptable style to use let instead of binding?

1:44 Hm. Doesn't work. I guess that answers that. ;)

2:09 spoon16: can you annotate a defmulti with documentation or a defmethod?

2:10 tolstoy: spoon16: You mean, to they take doc strings?

2:10 spoon16: yeah, I'm trying to figure out when it's appropriate to use ^{ :doc "hi" }

2:11 tolstoy: Usage: (defmulti name docstring? attr-map? dispatch-fn & options)

2:11 Looks like defmulti takes a doc string. defmethod doesn't seem to according to the API page.

2:14 ibdknox: that makes sense right?

2:14 Raynes: &(doc defmulti)

2:14 lazybot: ⇒ "Macro ([name docstring? attr-map? dispatch-fn & options]); Creates a new multimethod with the associated dispatch function. The docstring and attribute-map are optional. Options are key-value pairs and may be one of: :default the default dispatch value, defaults t... https://gist.github.com/1333013

2:14 spoon16: yeah

2:14 ibdknox: how would you get the docstring of the defmethods?

2:14 Raynes: The docstring comes after the name.

2:14 ibdknox: the only symbol you have is that defined by defmulti

2:15 Raynes: ibdknox: It also kill the point of multimethods in the first place. You don't use them just so you can name things the same -- you use them for things that do generally the same thing but in different ways.

2:15 It'd*

2:15 Excuse me, on my way to English class. ._.

2:15 ibdknox: right

2:16 tolstoy: How come plain old def doesn't take a doc string?

2:16 Raynes: It does in 1.3

2:16 &(doc def)

2:16 lazybot: java.lang.SecurityException: You tripped the alarm! def is bad!

2:16 tolstoy: Oh, really? Hm.

2:16 Raynes: Well, you get the point.

2:16 tolstoy: I get "too many arguments."

2:17 Well, wait. lein repl may not be 1.3.

2:17 ibdknox: it's not

2:17 Raynes: tolstoy: (def x "foo"­ 0)

2:17 Go type that into tryclj.com

2:17 ibdknox: if you're outside of a 1.3 project

2:18 tolstoy: Hm. clj (which announces itself that it's 1.3) doesn't seem to work either.

2:18 Raynes: Dude. tryclj.com.

2:18 I've used this in my own code. It definitely works.

2:18 ibdknox: Raynes: pfft who uses that crappy site? :p

2:18 Raynes: I know, right?

2:18 tolstoy: ,(def "this­ is x" x 23)

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

2:19 Raynes: Bots don't do def.

2:19 ibdknox: tolstoy, you have them out of order

2:19 Raynes: But yes, out of order.

2:19 (def x "foo"­ 0) <--

2:19 tolstoy: Ah. Sheesh.

2:19 ibdknox: always name then docstring

2:19 or at least I can't think of any counter examples

2:19 tolstoy: Well! That's handy.

2:22 (def ^:dynamic *foo* 23)

2:22 That cuts down on the verbosity.

2:55 callen: this kills the crab.

3:07 anyone interested in a dark theme for github? I just finished updating mine.

3:10 aperiodic: callen: how is it apllied?

3:10 *applied

3:10 callen: aperiodic: user styles, most browsers have a plugin for "user styles"

3:10 aperiodic: in the case of google chrome / chromium the plugin, "Stylish"

3:10 aperiodic: you just tell it the domain/url/regex you want to apply it to, then copy and paste the CSS hack I wrote.

3:11 aperiodic: callen: got screens?

3:11 callen: good question, h/o

3:13 aperiodic: uploading a couple, give me a moment.

3:13 aperiodic: I made it because there aren't any remotely decent ones out there. Mine isn't perfect, but suffices.

3:14 aperiodic: user styles is sane, just wanted to make sure it's not some crazy proxy server thing

3:14 callen: aperiodic: lol no.

3:14 aperiodic: I'm not that much of an asshole.

3:15 aperiodic: that's actually one thing i don't like about github

3:15 haha, good to hear

3:15 the rest of the code i look at is light-on-darj

3:15 *dark

3:16 callen: http://imgur.com/a/FAA0r imgur album.

3:16 aperiodic: my whole desktop is light on dark

3:16 aperiodic: I have three monitors of white on black urxvt in xmonad.

3:17 aperiodic: god i wanna run xmonad

3:17 it looks like it's not possible to get good text rendering in X11 on OS X

3:18 i'd like to be mistaken

3:18 callen: aperiodic: nah you're right. I have a macbook pro on my desk sitting unused.

3:18 aperiodic: I only use it when I leave the house.

3:18 I keep it and the code it contains updated, that's the extent of it.

3:20 aperiodic: what do you think?

3:21 aperiodic: might tweak saturation a bit myself, but looks solid

3:22 callen: aperiodic: if you tweak it, post the changes and a screenshot comparing them!

3:22 aperiodic: I'd love to see it. :)

3:22 aperiodic: I just didn't want my retinas scorched by the fucking site.

3:23 aperiodic: callen: for sure

3:23 thanks!

3:24 callen: np, always glad to help.

3:45 aperiodic: callen: you should put the screenshots in the readme of the repo

3:45 callen: then you'll b

3:45 e able to see 'em on gh

4:04 callen: okay.

4:06 aperiodic: done

4:06 https://github.com/bitemyapp/github-dark-theme

4:08 aperiodic: nice!

4:16 leo2007: Is leiningen in ubuntu fixed?

4:21 clgv: leo2007: whats the problem with leiningen in your ubuntu system? it's running smoothly here.

4:21 callen: leo2007: http://victorjcheng.wordpress.com/2011/10/18/fix-for-broken-leiningen-in-ubuntu-11-10/

4:21 clgv: look at the link.

4:21 leo2007: use Google d00d.

4:22 clgv: I wouldnt install leiningen via apt ;)

4:22 callen: I wouldn't either, but all the same.

4:23 clgv: it's still developing faster than ubuntu can keep track I guess....

4:28 leo2007: ok, I'll install it myself.

4:34 R4p70r: Is there a function that return the number of items in a collection where a predicate returns true? like (count (filter f coll)) ?

4:35 opqdonut: no, but that is a reasonably efficient implementation

4:37 R4p70r: opqdonut, I know. Laziness. But I though maybe I could do it in one call. Thanks

4:38 opqdonut: well all you've got to do is say (def count-when (comp count filter)) :)

4:45 R4p70r: opqdonut, Yeah. I'm using this all over the place.

4:50 leo2007: How to use lein to start swank?

5:17 Any idea how to fix this error while starting swank-clojure? http://paste.pound-python.org/show/14579

5:31 clgv: leo2007: reading its manual - since there is obviously a param missing.

5:34 licenser: hmm somewhere I read something about an alternative to swank when it come to clojure/emacs anyone remembers that?

6:40 apexi200sx: has anyone got any experiences to share of moving to clojure from python ( sorry for spamming a bit but there have been shed loads of connects/disconnects to the channel)

6:41 the advantages disadvantages, what productivity benefits there are etc.

6:41 or things to watch out for

7:05 llasram: apexi200sx: I don't know where you are physically, but this is probably about the worst time-of-day to get responses from people in the US :-)

7:07 apexi200sx: llasram: yeah it would seem that if you want to use IRC and you have to wait till the states wakes up :)

7:08 llasram: Are you a java guy who moved to clojure ?

7:10 llasram: apexi200sx: Haha! No. Still learning the Java stuff, actually. Python was my favorite language personally, but am still doing mostly Ruby professionally. Currently trying get my team to bless Clojure as our default language for contexts where Ruby isn't appropriate

7:12 So I don't really have much to say about "moving from" another language to Clojure, since I haven't done more than shift to it for green-field personal projects. No idea what the difficulties will be integrating existing code, getting team members up to speed, etc

7:25 clgv: apexi200sx: I don't know what to answer - I think you have to be more specific.

7:40 fliebel: Anyone remember the name of that visual programming language with these truth tables?

7:41 kephale: apexi200sx: well for one, hooking up to C/C++ is a bit more annoying with Clojure. Clojure's REPL trumps ipython IMO.

7:49 apexi200sx: I don't care about backwards compatibility really. I am just looking around for a new language/environment that may help productivity. Currently my favourite general purpose language is Python, I am just interested in anyone who has been using clojure who has had experience with Python also. The reason behind this is, if say, you asked an (open minded) c++ programmer to use c# who had never seen it before the

7:51 basically what are the killer features. Also, Clojure is not an OOP language. OOP was once touted as a help to programming, how do Clojure programmers feel with losing OOP in place of Clojure's way of doing things

7:51 are there any trade offs, what are the pros cons ? just throwing a few Questions out there for feedback thats all

7:53 algernon: I had a couple of python projects, some large, some small (still have a few of these left at work), but started to move to clojure a few months ago

7:54 loosing "oop" wasn't a big deal. clojure's namespaces, prototypes and whatnot actually make more sense to me

7:54 kephale: fliebel: subtext?

7:54 clgv: apexi200sx: do you have the time to try clojure or read one of the introductory books? you'd get an idea if clojure suits you. interestingly, when using clojure it never felt like "loosing oop".

7:55 * algernon feels far more productive with clojure, than with anything else he worked with in the past (and my clojure knowledge is _very_ limited still..)

7:59 fliebel: kephale, I'll have a look, thanks

7:59 moomin: Actually, you can OOP in Clojure very easily. Just create a hash-map with a bunch of functions in it.

8:00 After a while you'll probably decide it wasn't such a great idea, though.

8:00 Once you stop seeing things as "oop" it feels like an object method is just function closed over its first parameter. (which it is)

8:01 kephale: FWIW Carnegie Mellon stopped teaching OOP to incoming CS students

8:03 fliebel: kephale, it was subtext, but it doesnt seem like you can actually use it.

8:03 moomin: Interesting... :) I read a remark by someone much smarter than me (maybe swanodette) that you can't have a sensible type system with objects.

8:04 fliebel: moomin, So what is there to type beyond primitives?

8:05 hoeck1: apexi200sx: I switched from clojure to python because of a new job a year ago, I had no former exposure to python

8:05 apexi200sx: to all, I am interested to hear experiences of not using OOP, as it has been so ingrained for a long time that OOP is the way for code re use and encapsulation and code organisation. I

8:05 hoeck1: apexi200sx: my python scripts now look more like clojure, for example, I try to avoid deep class hierarchies and encapsulated state, avoid complex functions, break/continue/return in loops etc.

8:05 apexi200sx: hoeck1: do you find you are worse off using Python

8:06 do you dream of the day you can go back to Clojure ?

8:06 :)

8:06 fliebel: apexi200sx, Rich Hickey has a few talks whre he explains his vision.

8:06 hoeck1: apexi200sx: I'm missing some convenient things, I *really* miss immutable data structures

8:07 fliebel: hoeck1, There are libraries, they I heard their use is awkward.

8:07 hoeck1: apexi200sx: I hate some of pythons design decisions, for example, that dictictionary access defaults to raising Exceptions for missing keys, clojure is more sound regarding those things

8:08 fliebel: actually, I'm looking forward to port the clojure ones to python :)

8:09 apexi200sx: hoeck1: Not trying to promote python or anything, but this page can be helpful in writing idiomatic python code... http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html

8:10 hoeck1: apexi200sx: I'm currently working on an age-old cgi CRUD application, so our code is pretty functional, though my predecessor did built a lot of imperative OO-spaghetti code

8:10 oh and I miss -> and ->>

8:12 apexi200sx: hoeck1: are you saying that some of the stuff you learned from using Clojure have helped you write code better in other languages like Python even though the language is very different.

8:12 hoeck1 had you programmed in an OOP language before Python and Clojure

8:12 hoeck1: apexi200sx: thanks, I'm actually glad I was forced to learn python, its not a bad language, I don't (currently) see python and clojure competing, for example, I would never use clojure to write shell scripts

8:13 fliebel: hoeck1, http://packages.python.org/pysistence/

8:13 hoeck1: apexi200sx: no real OO language experiences, though I wrote my bachelors thesis project in clojure

8:15 apexi200sx: clojure had a huge influence on me, I would say that my python code is way better now than it would be if I had started using python before being exposed to clojure

8:16 apexi200sx: hoeck1: I assume you have looked at the code of your colleagues who may not have had Clojure exposure. do you find you structure the code differently from them and what do they think of the code you write :)

8:18 hoeck1: apexi200sx: well, about 80% of my work is fixing bugs and adding small features to existing code

8:21 apexi200sx: I'd say that I'm more keen about having nice clean and readable code (according to my standards) than others, but that may be just my age

8:22 apexi200sx: hoeck1: you may be talking more about the skills/care you have/take while programming than the benefits of Clojure knowledge though

8:23 hoeck1: apexi200sx: hard to identify the role that clojure played in that

8:23 kzar: Is there a way to return a lazy sequence of data from inside a with-open block in a way that keeps the file open until the sequence has been realised? (I know one way is to use do-all inside the with-open)

8:24 Well one way to avoid the problem I should say

8:24 wtfcoder: how would you associate behaviour with data in clojure. lets say we have defined a struct with :firstName and :lastName from my understanding we would not make the function part of the object otherwise it depends on state and not pure. where should we place the fn for reuse

8:26 kzar: wtfcoder: Well you would probably have a namespace to deal with people, a person would be a map (just data) and there would be functions to do what you needed to a person map

8:27 apexi200sx: hoeck1: thanks for your comments, appreciated. I think I am going to have to have a go at converting something i created in Python into clojure and see from there

8:27 wtfcoder: kzar, makes sense kind of like a static fn in OO, CustomerClass.fullName(customerStruct)

8:28 so generally with clojure we dont verify that we are operating on a customer, if it has a firstname and lastname it is a customer, walks like a duck etc..

8:29 a more general question, is clojure well suitable to working with asyncronous apis?

8:29 clgv: wtfcoder: you can verify in cases where you want to report errors and such. 'instance? is handy there

8:29 kzar: wtfcoder: Well I can't comment on the static fn bit. The bit about verifying something's a customer - if it has a name and the right attributes that makes it one. I suppose this is applicable http://en.wikipedia.org/wiki/Bundle_theory

8:34 clgv: wtfcoder: clojure has functions that you can pass around as callbacks, so it should be suited for asyncronous apis.

8:38 wtfcoder: after working with node.js for a while i was wondering does clojure too suffer from pryamid symdrome with nested callbacks when working with async apis. I guess those working with clojurescript have more experience on this. Would I still need to use helper libs like async.js or

8:48 leo2007: would knowing Java help one learn clojure?

8:50 archaic: in general should i be derefing atoms/data before saving to file? it seems to work either way

8:52 cemerick: leo2007: It's not necessary, but it helps. You do need to understand how the JVM works in certain ways (e.g. classpath and such).

8:53 leo2007: cemerick: any reference for that? I would like to read-up the minimal required.

8:54 cemerick: leo2007: I came from knowing the JVM very well prior to using Clojure, so I never sought out such materials.

8:55 leo2007: We did try to provide a reasonable grounding and introduction to the necessary basics here: http://oreilly.com/catalog/0636920013754/ (sorry for the self-plug)

9:00 leo2007: cemerick: no worries. what does rough cuts mean? I'd prefer a full-version.

9:00 llasram: cemerick: BTW, got the Rough Cuts edition to check it out for wooing my co-workers to Clojure. Looks pretty good so far!

9:01 clgv: leo2007: Programming Clojure or Pragmatic Clojure are also an option for starters.

9:01 cemerick: leo2007: It's the same concept as Manning's MEAP: pre-publication versions are put out online for you to use/comment on/whatever, and then you get the final version when it's ready.

9:01 llasram: Glad to hear it. The final rev of it will be hitting very shortly, lots and lots of improvements and additions. :-)

9:03 llasram: kzar: you may have figured this out already, `with-open' itself works entirely lexically because it uses `try'. The old clojure.contrib.io has some functions like `read-lines' which will open a reader and keep it open until the entire file is read, but

9:04 I believe they are considered problematic -- they don't seem to have made it into the new libraries, and I know I had problems with too many open files when trying to use them

9:07 Actually, lexically is wrong, isn't it? Dynamically? Hmm. Either way, file closes when you leave the scope `with-open' :-)

9:08 leo2007: clgv and cemerick: thanks.

9:08 llasram: cemerick: When's the official publication date? Will there still be time for comments after the next rev?

9:09 cemerick: llasram: I think the official line from O'Reilly is "by the end of the year"; I have no idea what the production process is like. In any case, the earlier your comments get in, the more likely they are to affect the final result.

9:13 clgv: llasram: using reader + read-lines can replace the old read-lines

9:15 llasram: clgv: Hmm. I can't seem to find a `read-lines' except in old clojure.contrib

9:15 Which one are you talking about?

9:16 clgv: args failure^^ reader + line-seq

9:18 llasram: Ah, right. Except line-seq doesn't automatically close the file, like read-lines did. You still need to arrange for the reader to be closed at some scope, and ensure that your lazy sequence is done using the file before you leave that scope. (As it should be.)

9:20 clgv: no, when using 'reader you'll always have to put it in a 'with-open or close it manually

9:20 kzar: Is there something like select-keys that lets you rename the key? (Or a function I can run after select-keys to rename some of the keys?)

9:21 raek_: yeah, it's not very good to _only_ rely on that the stream is closed when the lazy-seq is fully traversed. (what happends if the whole seq is not consumed, or when an exception is thrown?)

9:22 kzar: rename-keys in clojure.set

9:23 simard: is there a shortcut for this ? (= (type {}) clojure.lang.PersistentArrayMap)

9:23 clgv: simard: ''(doc instance?)

9:23 &(doc instance?)

9:23 lazybot: ⇒ "([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false"

9:24 simard: thank you

9:24 dnolen: simard: in general map? is preferred, unless you're doing something special.

9:24 simard: hum, map? would do

9:24 maybe

9:25 raek_: map? matches everything that implements clojure.lang.IPersistentMap

9:25 clgv: oh hehe, didnt check the type^^ map? for the special case^^

9:25 dnolen: simard: checking for concrete types is bad practice since there are many types. You generally only care if something satisfies an interface / protocol. Not whether it's a particular type.

9:25 simard: hum then that wouldn't do

9:25 any record does that, right ?

9:25 dnolen: simard: for example {} with > 32 keys / values will become PersistentMap, not PersistentArrayMap

9:26 raek_: ,(class {})

9:26 dnolen: simard: map doesn't check type, it checks interface

9:26 clojurebot: clojure.lang.PersistentArrayMap

9:26 raek_: ,(class (zipmap (range 20) (range 20)))

9:26 clojurebot: clojure.lang.PersistentHashMap

9:26 simard: ,(class (zipmap (range 200) (range 200)))

9:26 clojurebot: clojure.lang.PersistentHashMap

9:26 simard: hum

9:27 I see

9:27 raek_: simard: also, you can implement protocols for types other people have defined

9:27 (extend-type clojure.lang.IPersistentMap MyProtocol (my-method ...))

9:28 simard: so what is the function to test if a type implements a given protocol ?

9:28 raek_: IPersistentMap is basically equivalent to "all kinds of clojure maps"

9:28 also, why do you need to check the type?

9:28 dnolen: simard: you can check interfaces with instance?, you can check protocols w/ satisfies?

9:28 kzar: raek_: Thanks

9:29 simard: raek: I want to filter a flattened tree based on the type of object contained in it

9:29 raek: simard: one way is to define the filter function as a protocol method

9:30 (defprotocol Filterable (filter-node [this x])) (extend-type clojure.lang.IPersistentMap Filterable (filter-node [m x] ...))

9:31 you'd then have one extend-type per "case"

9:31 simard: yes, well that function will be part of my 4 alraedy existing defrecords then

9:31 raek: protocols are great for assigning new meaning to existing types

9:31 simard: (I already implement protocols in them for some other reasons)

9:31 I'm simply going to add one more :)

9:38 (-> this :properties :aperture) or (get-in this [:properties :aperture]) ?

9:38 is there a real difference I should care about ?

9:40 raek: simard: IMHO, not really. you might get different error messages if (:properties this) is not a map though...

9:41 wait, maybe not...

9:42 simard: one differece is that the -> approach only works when the keys are keywords (which is the absolutely most common case)

9:43 simard: yes, that I understand, they need to be functions

9:43 that would be the main difference probably..

9:45 raek: both are fine in this case. just pick one and don't spend too much time with this choice :-)

9:45 fdaoud: simard: I remember someone smart on here giving two examples, one with -> and one without, and saying they are both the same and you pick the style you prefer

9:45 clgv: simard: get-in is a better match with update-in

9:46 simard: or assoc-in

9:47 clgv: you can also do (->> this :properties :aperture) then it also works for non-keywords^^

9:47 simard: there are so many functions in that language

9:47 fdaoud: clojure?

9:47 clojurebot: clojure is not scheme

9:47 simard: yes, clojure :)

9:47 fdaoud: yes, 100 functions on 1 data structure :)

9:48 instead of 10 functions on 10 data structures

9:48 thank you Alan Perlis

9:49 clgv: oh wait forget about the ->> thingy. I got it mixed up ;)

9:49 simard: clgv: I was trying to figure it out and about to ask you about it .. :)

10:01 WelcomeBot: Welcome to #clojure, WelcomeBot!

10:03 Welcome to #clojure, rahul!

10:04 Welcome to #clojure, wilkes!

10:04 clgv: that thing is starting to be annoying

10:05 robbe-: s/starting to be//

10:05 clgv: robbe-: add it to iggy list^^

10:05 I hope my client ignores it now

10:12 cemerick: who runs this WelcomeBot?

10:19 TimMc: Did it get killed?

10:21 cemerick: seems like it

10:27 clgv: oh, and I thought my client ignores it completely.

10:28 simard: hum I've added a third protocol to a defrecord, but when I call a function of that protocol on an instance of that record, I get an error: No implementation of method: :extract-apertures of protocol: #'cpcb-server.pcb/Extracteur found for class: cpcb_server.pcb.Pcb-Object [Thrown class java.lang.IllegalArgumentException]

10:28 however, when I create a new defrecord with only that protocol, it works....

10:28 I've killed swank and retried evaluating all over again, still the same error

10:29 any idea ?

10:35 clgv: simard: you also tried "lein clean" inbetween?

10:36 simard: no

10:37 clgv: thank you, that worked

10:37 but, why ?

10:38 clgv: sometimes it seems that the classes for defrecords and deftypes are not rewritten - I always do the clean then^^

10:49 jcromartie: clgv: are those classes actually AOT compiled?

10:49 clgv: as in, into a .class file?

10:50 clgv: jcromartie: good question. both cases. I did not investigate further

10:50 pandeiro: what would be the idiomatic way to randomly resort a vector?

10:51 TimMc: pandeiro: shuffle it, that is?

10:51 pandeiro: yeah

10:51 TimMc: ,(doc shuffle)

10:51 clojurebot: "([coll]); Return a random permutation of coll"

10:51 TimMc: :-)

10:51 pandeiro: ah great, is that avail in clojurescript?

10:51 TimMc: Wouldn't have a clue.

10:52 pandeiro: nope

10:52 i will take a look at the source, thanks for the tip

10:54 gfredericks: does clojurescript have sort-by? (partial sort-by rand) should work I would think

10:55 TimMc: gfredericks: bad bad bad

10:55 pandeiro: why is that bad?

10:56 TimMc: In the best case it will be a shitty sort, in the worst case it will run forever.

10:56 s/sort/randomization/

10:57 pandeiro: TimMc: shuffle is taken straight out of Java so there's no JS equivalent... i think gfredericks' solution wfm

10:57 TimMc: I really doubt it.

10:58 clgv: pandeiro: shuffle can be implemented as randomly drawing two positions and exchange them.

10:58 and you repeat as often as you like. or you iterate through all positions and draw a random position to exchange with

10:59 TimMc: pandeiro: http://sroucheray.org/blog/2009/11/array-sort-should-not-be-used-to-shuffle-an-array/

10:59 pandeiro: clgv: yeah that's how i would've done it in pure JS, thanks

11:00 clgv: pandeiro: if you have no strong mathematical requirements you can safely use one of them

11:01 TimMc: Just don't use sort.

11:02 pandeiro: TimMc, you mean the sort-by?

11:03 TimMc: either

11:03 Did you look at the link? You won't get anything even resembling a random distribution.

11:03 pandeiro: yeah it's not loading unfortunately, but you're right, the dist isnt very random

11:04 got a cached version, checking it out

11:07 fdaoud: TimMc: that's a nice post, thanks for the link

11:08 TimMc: pandeiro: In cljs, you don't have transients, right?

11:08 pandeiro: TimMc: embarrassed to say i dont know

11:09 i'm new to clojure

11:09 TimMc: It probably doesn't, it is very young. But it would be appropriate for the Fisher Yates algorithm.

11:09 pandeiro: but i am trying to implement the fisher-yates algo mentioned in the article now... thanks for the link

11:09 TimMc: It's probably fast enough for your needs.

11:11 gtrak: alex is a madman, you guys see this? http://clojurewest.org/news/2011/11/2/clojurewest-is-launched.html

11:15 zerokarmaleft: dang, he's setting up franchises

11:15 gtrak: stamping them out

11:19 clgv: pandeiro: you could as well use sort() for the shuffle. just assign each element of your array a random number and sort the elements related to the random number ^^

11:32 TimMc: pandeiro, clgv: Sorting indices by fixed random numbers: https://gist.github.com/1333940

11:32 please golf this, somebody

11:33 zippy314: why is there every?, not-every? and not-any? but no any?

11:33 TimMc: zippy314: Bad name choice. See some.

11:33 clgv: TimMc: the Fisher-Yates or Knuth shuffle is simpler and pretty well suited - I would implement that one

11:33 zippy314: TimMc: cool, thanks.

11:34 TimMc: clgv: Agreed, but I've always wanted to try writing the sort-indices-by-random trick.

11:35 clgv: TimMc: ok ;)

11:36 TimMc: looks working to me

11:36 simard: is this still the best way to have default values on records https://gist.github.com/504861 ?

11:38 clgv: simard: probably. I dont know of a core-change to defrecord in 1.3

11:39 raek: anyone know if there is something this neat for Clojure (or Java)? https://developer.mozilla.org/en/JavaScript_typed_arrays

11:40 dnolen: raek: which part, views?

11:40 clgv: raek: there are Buffers in java.nio

11:40 raek: yes

11:41 the java.nio classes are a bit weird... they contain iteration state

11:41 clgv: but they pretty much allow those multiple views

11:43 cemerick: raek: There's also the gvec stuff if you're looking for a nicer way to work with primitives.

11:45 raek: I like how typed arrays makes it simple to access the data of arrays and structs in binary data formats

11:45 dnolen: cemerick: gvec stuff is a bit incomplete, main advantage at this point is just less memory consumption.

11:45 cemerick: sure

11:45 simard: the map->Foo factory function produced by defrecord can help

11:46 simard: https://gist.github.com/504861#comments

11:49 clgv: cemerick: ah, nice 1.3 feature

11:51 cemerick: clgv: Yeah; I probably wouldn't write defrecord+ today. Given the generic map factory fn, you can easily define multiple sets of defaults using the same base record type.

11:52 complecting a record type with its defaults is not necessarily the right path ;-)

11:57 simard: cemerick: I agree for not complecting things, but I'd have to understand you code first :)

11:59 cemerick: simard: In short: it merges a map (or in the second case, a map built from a seq of keys and values) with a map of defaults for a particular record type, providing the result to the map->Foo function that yields a Foo.

12:00 clgv: simard: you could say (def default-A (comp map->A (partial merge {:x 5})))

12:00 simard: hum ok makes sense

12:00 so that map->Foo function, generated by defrecord, is that documented ?

12:01 cemerick: Right, I left clgv's addition as an exercise for the reader ;-)

12:01 simard: can't see anything about it in doc defrecord

12:01 cemerick: simard: mmm, no. http://dev.clojure.org/jira/browse/CLJ-833 Feel free to vote that issue up. :-)

12:01 simard: :)

12:04 cemerick: done

12:06 jaley: somebody help! :) I have '([1 2] [3 4]) and want to add [5 6] to the end, thus '([1 2] [3 4] [5 6]). cons, conj, into... what is it I'm looking for? :s

12:07 simard: (conj [[1 2] [3 4]] [5 6]) ?

12:08 jaley: simard: hmm ok, so I need to convert the list to a vector first?

12:09 clgv: jaley: you can use concat as in ##(concat '([1 2] [3 4]) '([5 6]))

12:09 lazybot: ⇒ ([1 2] [3 4] [5 6])

12:09 simard: default-Aperture

12:09 oops

12:10 jaley: clgv: oh ok, so that way around the vector i'm adding has to be wrapped in a list?

12:10 clgv: jaley: yes, for adding to the end you are using the wrong datatype

12:10 simard: jaley: which is why you should be using vectors all the way in this case

12:11 jaley: clgv: well... it's the return value from a map

12:12 clgv: jaley: maybe you restructure your algorithm so that you dont need to add to the end? otherwise use one of the above solutions

12:13 jaley: clgv: ok yeah that would make the code ugly... intuitively this is a list of [x y] coordinates and i'm just interpolating two points. so I guess I'll just convert to a vector of vectors and use conj

12:13 clgv and simard, thanks for the help

12:43 aartist: First time here. What is good about clojure?

12:44 bluezenix: what isnt?

12:44 ;D gtg

12:45 technomancy: startup time, regexes, and the contains? function

12:45 next question?

12:45 =)

12:45 TimMc: haha

12:45 aartist: I am coming from Perl background. Please englighten me.

12:45 cark: why are you looking into clojure?

12:46 fdaoud: aartist: to be it's A) a great Lisp and B) that runs on the JVM.

12:46 cark: and it's fast

12:46 fdaoud: (of course combined that it has traction and a great community)

12:46 aartist: What it is used for in production? I know for example , that LISP is used in Emacs.

12:47 TimMc: aartist: http://clojure.org/ is the best place I know of to find out.

12:47 technomancy: in particular http://clojure.org/state or http://clojure.org/rationale

12:47 cark: i think people use it mostly on the server side

12:47 TimMc: right

12:47 cemerick: technomancy: regexes? 0.o No interpolation, you mean.

12:47 technomancy: cemerick: and the fact that they're not ifn?

12:48 TimMc: technomancy is trolling a bit

12:48 cemerick: technomancy: would their ifn find or match?

12:48 (TimMc: yeah, I know :-)

12:48 cark: aartist: clojure is nothing like emacs lisp

12:49 TimMc: s/^/aartist: /

12:49 technomancy: cemerick: I don't particularly care as long as I can use it as a predicate

12:49 75% of my regex uses are (re-find #"foo" ...)

12:50 cemerick: (partial re-find #"foo")?

12:50 cark: actually if you consider that the emacs language and clojure are both lisps, then you might say that lisp is only syntax. What's really interesting about clojure is semantics

12:51 TimMc: (def refinder [re] (partial re-find re))

12:51 defn, rather

12:51 technomancy: cemerick: sure, but it's noise

12:51 cark: immutable data structures, reference data types, that's what make clojure what it is

12:51 TimMc: One more thing to worry about.

12:51 cark: and the jvm bit of course

12:52 cemerick: the jvm bit is incidental for many

12:52 TimMc: aartist: Akamai uses it for some sort of mobile web browsing compression proxy.

12:52 * cemerick still thinks clojure targeting chicken would be a winner

12:52 simard: is the hash of a map unique enough for general identification purpose ?

12:52 fdaoud: when you define a function that takes a collection, [coll] seems to be standard. what is the standard for a map? since "map" is already a function.

12:53 simard: say.. is it as good as md5 ?

12:53 fdaoud: cemerick: yes but also a plus for many others

12:53 cemerick: simard: don't expect it to be stable across clojure or jvm versions

12:53 or, perhaps even clojure/jvm runtimes

12:53 fdaoud: certainly for me, yes

12:54 TimMc: fdaoud: m

12:54 simard: cemerick: I don't need that much, as long as it's the same on the same runtime

12:54 fdaoud: TimMc: really? I was hoping for more than one character.

12:54 cemerick: simard: should be fine then; plan on collisions though, of course

12:54 TimMc: Look, some of us can only afford one character.

12:54 we are the 99%

12:54 aartist: I am still looking for few examples of real-world apps.

12:55 fdaoud: aartist: are you interested in web apps?

12:55 dnolen: cemerick: chicken scheme? why not a Clojure language module for Racket?

12:55 cemerick: fdaoud: there's no harm in shadowing the map fn if (a) you're not using it, or (b) if you're happy enough using clojure.core/map

12:55 TimMc: aartist: Here's a raytracer I wrote for a HW assignment: https://github.com/timmc/CS4300-hw6

12:56 dnolen: aartist: why Clojure - you can do all the crazy Perl stuff and them some.

12:56 cemerick: dnolen: or whatever; chicken is the only scheme I've actually deployed to do real work, I know it compiles to C, and it's got gobs of libraries.

12:56 technomancy: clojurebot: clojure success stories?

12:56 cemerick: Racket or gambit may very well be a better "host"

12:56 clojurebot: Excuse me?

12:57 technomancy: clojurebot: clojure success stories is http://dev.clojure.org/display/community/Clojure+Success+Stories

12:57 clojurebot: 'Sea, mhuise.

12:57 technomancy: aartist: plenty of material there ^^

12:57 aartist: I also like language for learning, but real-world app example will help. I got that you can use Java libs and that's great plus.

12:57 dnolen: aartist: or target JavaScript

12:58 aartist: what kind of real-world app example

12:58 fdaoud: cemerick: thanks for the clarification.

13:00 aartist: dnolen: well, coming from Perl background, is there comparision between these 2?

13:00 dnolen: aartist: between what 2?

13:01 babilen: Is there any library that allows me to parse command line arguments *and* support subcommands? It looks as if I have to hack on tools.cli and incorporate some of leiningen's subcommand logic. But I wanted to ask first

13:01 dnolen: aartist: what do you use Perl for?

13:01 aartist: dnolen: I use Perl for many thing including Web Application, Data Parsing and Transformation.

13:02 dnolen: aartist: well you can do all that with Clojure.

13:02 aartist: Is there CPAN equivalent for Clojure?

13:02 mdeboard: Leiningen

13:02 dnolen: aartist: clojars and Maven

13:02 mdeboard: Clojars

13:02 technomancy: babilen: most of the subcommand stuff in lein is pretty ad-hoc. I'm interested in generalizing it in 2.0 but would welcome input on this

13:03 maybe it could just be delegated to tools.cli

13:03 babilen: technomancy: I've seen it -- I am considering working on subcommand support for tools.cli -- Just started to develop some ideas and then 0.2.0 of it is released :)

13:04 technomancy: I like some aspects of it, but it is pretty ad-hoc. It would be nice to have good support for subcommands in tools.cli -- just wasn't sure if there isn't a suitable library available already.

13:04 aartist: Thank you guys/girls.

13:05 fdaoud: girls?

13:09 seancorfield: very exciting to see a second clojure conference on the calendar (esp. one right in my back yard)

13:10 TimMc: fdaoud: Women? In my channel? It's more likely than you think.

13:15 fdaoud: TimMc: in your channel?

13:16 TimMc: Mine, as in the one I am in.

13:17 Do you know the meme I am referencing?

13:17 fdaoud: No, I don't know what that means.

13:17 all I'm saying is, there aren't (m)any women here.

13:19 TimMc: fdaoud: http://knowyourmeme.com/memes/x-in-my-y

13:19 fdaoud: That may or may not be true, but it's not a welcoming attitude either way.

13:20 fdaoud: TimMc: I understand what you're saying, but you misread me.

13:22 I was not saying it like that.

13:23 kephale: i know of women that come in here regularly that would probably stop coming if they were here and read those comments

13:24 fdaoud: kephale: what comments exactly?

13:25 kephale: the (m) on the any i think, so not comments plural

13:26 suggesting that there aren't many is probably acceptable due to the general demographics of CS/programmers these days

13:26 but you never know, lisps might be more seductive to the ladies

13:27 fdaoud: kephale: ok. so all I'm saying is that there are probably many more men than women here. that is all. I would certainly be glad to know I was wrong about that. How is that offensive?

13:29 kephale: well, just to put it to rest, i think the thing that might be taken offensively is the suggestion that there wouldn't be "any'" women here. what you just said doesn't sound offensive.

13:29 thats all

13:29 fdaoud: kephale: I agree, you're right. I should not have suggested "any".

13:30 kephale: heh, i can't blame you, i slip up as well

13:30 clojurebot: No entiendo

13:30 kephale: clojurebot: do you identify with a gender?

13:30 clojurebot: gender is irrelevant

13:31 fdaoud: kephale: you know what it is? I'm not used to the sheer number of people here. the other channel I frequent has 6-7 people -- so it *is* quite possible that they are all men.

13:31 so, my mistake. apologies.

13:33 TimMc: ~clojurebot

13:33 clojurebot: clojurebot is amazing

13:33 TimMc: ~clojurebot

13:33 clojurebot: clojurebot is a cold unfeeling genderless mechanism

13:33 TimMc: there we go

13:33 kephale: lol

13:33 gfredericks: and likes football.

13:35 fdaoud: ,(repeatedly #(str "sorry for the misunderstanding"))

13:35 clojurebot: ("sorry for the misunderstanding" "sorry for the misunderstanding" "sorry for the misunderstanding" "sorry for the misunderstanding" "sorry for the misunderstanding" ...)

13:35 ibdknox: lol

13:42 jweiss: anyone know how to get emacs to indent comments (eg, putting them at the end of the line and have the next line of the comment align with the first one)

13:42 i read something about the meaning of ; vs ;; vs ;;; vs ;;;; but none seem to indent right

13:44 durr... don't know why previous searches didn't turn this up: http://www.gnu.org/s/libtool/manual/emacs/Comment-Commands.html

13:50 TimMc: fdaoud: Wasn't trying to hammer on you, sorry if it came across that way. Yes, there is undoubtedly a large gender imbalance in CS, but I think it is best left unmentioned most of the time. (Obviously it is fine to discuss in the context of a discussion on trying to make the community more welcoming to women!)

13:51 fdaoud: TimMc: agree with you 100%.

13:52 TimMc: so... how 'bout them sexprs!

13:52 srid: can't gender imbalance in particular professions be naively explained away with difference in motivation (as opposed to ability)? that's what this guy argues for - http://www.psy.fsu.edu/~baumeistertice/goodaboutmen.htm

13:54 nobody takes offense at the former, only at the later.

13:56 TimMc: Yes, I am definitely leaning in that direction recently. I've heard that women are (statistically) more drawn to professions and hobbies that have a social impact, so that programming-for-the-fun-of-it draws fewer women.

13:57 But there's a third factor, which is cultural pressure -- a combination of social gender roles and how communities present themselves.

13:59 Hell, I wouldn't be surprised to learn that there are innate (statistical) differences in ability in various arenas, although I can't imagine they'd be *too* dramatic. Wrong political climate for that research, though.

14:01 chouser: TimMc: yup. I was about to say that just because people find something offensive doesn't prevent it from being true.

14:02 Though if there really were a statistical difference in ability, it would make me sad.

14:02 TimMc: Also, evolution hates us. :-P

14:03 jweiss: chouser: you mean inborn ability or actual

14:03 TimMc: Inborn, presumably.

14:03 chouser: hm, I guess I meant in-born, but either would be sad (though for different reasons)

14:03 jweiss: that would be pretty tough to prove

14:03 TimMc: Actual ability is affected by such silly and transient things as cultural context.

14:03 jweiss: yeah, that's what i was getting at

14:05 i don't know that you can separate ability from interest

14:06 TimMc: Hard to measure.

14:06 chouser: I think interest (perhaps factored with personality) has more impact on actual ability in any intellectual area than just about anything else.

14:06 jweiss: i would agree

14:07 chouser: I factor in personality because I have three kids and various natural approach to failure is *so* different from each other.

14:07 gfredericks: I'm surprised that nobody has yet brought up the point that boys go to jupiter to get more stupider, while girls go to college to get more knowledge.

14:07 chouser: gfredericks: excellent point.

14:08 gfredericks: also something about waffles and spaghetti.

14:08 Raynes: I want spaghetti.

14:10 TimMc: (This would be a good time for me.panzoo/spaghetti to have an update pushed to clojars)

14:12 fdaoud: chouser: that's interesting, do you mean each of your three kids react differently to failure? if so, how so?

14:14 chouser: fdaoud: yes. We have one for whom even small failure is almost overwhelming emotionally. This one is maturing and learning to fight through hard things, but this is very difficult. Their favorite activities are ones where success and failure are more subjective.

14:15 jcromartie: oh boy, boys vs girls?

14:15 TimMc: jcromartie: Welcome to #genderstudies!

14:15 It's my fault, basically.

14:16 chouser: Another also get frustrated with failure (they're all young still) but tends to rapidily re-attack the problem and persist either until success, or they become convinced it's not possible in which case they tend to totally detach.

14:17 jodaro: i have two boys

14:17 one is totally persistent

14:17 and the other gives up really easily

14:17 chouser: The third is still too young for me to reach conclusions, but may be more likely to dissemble than to either attack or avoid failure.

14:17 jodaro: pretty amazing how different they are

14:18 chouser: jodaro: that's been a big surprise for me.

14:18 before I had my own kids, I assumed at least half of what we call personality was "nurture". Now I'd say it's more like 10%

14:18 fdaoud: chouser, jodaro: I'm seeing the same kind of difference here. oldest daughter (4.5 y/o) when something doesn't go her way, stands up and starts whining and crying. youngest daughter (2.5 y/o) just plows forward and finds a way through.

14:18 TimMc: My psych prof said she was both distressed and relieved when she realized that her parenting had very little effect on her kid's personality.

14:18 jodaro: what's most fascinating is how similar they can be to each other, and by extension, to me in some ways

14:19 and how different in other ways

14:19 fdaoud: same with me. older one is way more of a whiner.

14:19 chouser: fdaoud: I think birth order may have a stronger correlation there than gender.

14:19 TimMc: true

14:19 chouser: ditto here

14:19 jweiss: chouser: my kid is very calm and relaxed, people try to give me credit, i assure them my parenting has nothing to do with it

14:19 fdaoud: yes, I think it's normal

14:20 TimMc: I wonder how much of that variation coudl also be due to random formative experiences.

14:20 fdaoud: second-born always had to compete

14:20 first-born had 2 years of "it's all me"

14:20 jodaro: right, same here

14:20 jweiss: i was gonna ask about birth order (since i only have 1) - would assume the first born is accustomed to everything going his way

14:20 jodaro: "its all me and i can do no wrong and everyone loves me the best"

14:20 jweiss: i think thats often the case

14:21 but i do have some friends that have somewhat the opposite situation

14:21 though of course its the usual parenting "science": anecdotal evidence

14:21 TimMc: jodaro: Only child here. I actually have a bit of fear-of-failure perhaps *because* I was used to everything going my way.

14:21 fdaoud: "with 3 kids, often what happens is first-born and baby get all the attention, middle child is ignored. I have 3 kids. I am determined not to do that to little..what's-her-name."

14:21 jodaro: TimMc: i'm an only as well.

14:22 played by myself a lot

14:22 my boys play together all the time

14:22 TimMc: yup

14:22 jodaro: which is great

14:22 ibdknox: I'm a bit unique in that I have a brother, but our age gap is 7 years

14:22 TimMc: bruncle!

14:22 ibdknox: haha

14:22 jodaro: but sometimes i think its at the expense of knowing how to have fun without expecting someone else to help

14:23 ibdknox: I was fiercely independent as a child, never really whined

14:23 my brother on the other hand, ended up with a massive inferiority complex

14:23 fdaoud: some days they play together beautifully, it's so awesome, other days they can't be 2 minutes together without screaming and fighting

14:23 ibdknox: and is prone to give up very quickly

14:23 jodaro: fdaoud: totally.

14:24 TimMc: ibdknox: Oh, you're the older one?

14:24 ibdknox: TimMc: yeah

14:24 jodaro: ibdknox: did you get to/have to babysit a lot?

14:24 chouser: yet first children are the ones who end up as presidents, ceos, etc. [I am not a first child]

14:24 ibdknox: so a bit opposite of the general trend we've discussed

14:25 fdaoud: jodaro: how old are your boys?

14:25 srid: chouser: fdaoud you attribute only 10% to nurture? wait till they grow up and get acculturated to an extent so remarkable that cultural conditioning takes over the stage, so to speak. :)

14:25 jodaro: 8 and 11

14:25 ibdknox: jodaro: yeah, I essentially did a lot of the raising. My parents got divorced when he was about 4

14:25 chouser: srid: Hm, interesting.

14:25 jodaro: 3rd and 6th grade

14:25 fdaoud: srid: ?

14:26 jodaro: speaking of parenting, i had a shitty parenting morning

14:26 wife leaves early for work on some days so its all me

14:26 they pissed me off to no end today

14:26 fdaoud: the boys give you trouble?

14:26 srid: and perhaps that's why some parents are interested in school-at-home

14:27 jodaro: i finally blew up and gave them the old "i do everything for you and still you don't listen!"

14:27 fdaoud: and you thought you'd never say that ;)

14:27 jodaro: no "screen time" tonight

14:27 yeah heh

14:27 they've both been really into a couple games on the ipad

14:27 so that hits em where it hurts

14:27 but

14:28 fdaoud: jodaro: each age has its stage, right? I'm still at the stage where I wish we could have dinner without constantly worrying about the 2-year-old falling off her chair and breaking her face

14:28 jodaro: i can't help but feel like a dick afterwards

14:28 fdaoud: hahah yeah

14:28 they are both way more independent now (usually) with that kind of thing

14:28 it gets easier in some areas and then harder in others

14:28 older one just started middle school

14:28 which is a whole new world

14:29 in that he has to be on top of his shit or else

14:29 fdaoud: yeah, I am fully aware that one thing less to worry about will be replaced by another

14:29 jodaro: but the flip side is that he can walk around the neighborhood by himself, go to a friends house, walk up to the store

14:30 make a snack (and periodically do it without making a huge mess)

14:30 fdaoud: I just hope that my thinking that My Life Will Be Better Once They Sleep Through The Night is correct

14:30 jodaro: fdaoud: i'd say yes.

14:30 fdaoud: jodaro: I think everything else falls apart from the lack of sleep

14:30 jodaro: my older one is a voracious reader

14:31 which helps a lot

14:31 srid: fantasy fiction?

14:31 jodaro: hah of course

14:31 fdaoud: they have less ability (i.e. are clumsy, fall down, get hurt), we have less patience, it's all bad when we don't sleep

14:32 Squee-D: antares_ would you have (resources on/examples of) a complete reactive program using rabbit? I'm looking to shortcut understanding agents and threading to hack an existing example to show off and work back from.

14:32 fdaoud you talking toddlers?

14:33 chouser: fdaoud: yes. The lack of sleep gets better, and that can make a huge difference in all areas of life. :-)

14:33 mtm_: is there an idiomatic way to find out a symbol has been bound in a namespace? I can see if it's been interned, but I don't see an obvious way to see if it's bound.

14:33 chouser: (doc bound?)

14:33 clojurebot: "([& vars]); Returns true if all of the vars provided as arguments have any bound value, root or thread-local. Implies that deref'ing the provided vars will succeed. Returns true if no vars are provided."

14:34 mtm_: :P

14:34 how obvious

14:34 Squee-D: I learned to work with less sleep, and how to powernap.

14:34 * mtm_ slinks away to hack his code

14:34 chouser: :-) It was new in version 1.2

14:34 mtm_: no worries.

14:35 fdaoud: Squee-D: yes, 4.5 and 2.5 y/o

14:35 jodaro: i remember how hard those years were

14:36 but i rememebr how awesome they were too

14:36 Squee-D: fdaoud i decided i don't want to hate it, so i learnt to call it normal. I know NLP is a soft science, but convincing yourself not to get hung up on sleeplessness did help me

14:36 jodaro: enjoy it while it lasts </old man>

14:37 fdaoud: Squee-D: you're right. it's just normal now and the occasional uninterrupted night is A Real Treat.

14:37 Squee-D: my girl 'sleeps through' now. that is i only have to get up 3 times a night most nights, just to reassure her, let her go potty, etc.

14:37 fdaoud totally :D

14:37 fdaoud: my wife and I laugh about when we didn't have kids and we'd get up at 9:58 on saturdays only because there was a show on at 10:00 that we liked to watch while eating our cereal.

14:38 Squee-D: fdaoud I love when she goes to nannas and me and the missus and I are left alone.. but when she comes home i wonder why i needed it. s wierd

14:38 fdaoud: now we're up and at 'em at 6:30

14:38 Squee-D: I'm a latecomer, and my wife and I are both debauched, deviant and hedonists.

14:38 we lauch at absolutely every change in our lives :D

14:39 fdaoud: Squee-D: totally! sometimes they drive us nuts but when they're not here, we miss them

14:39 Squee-D: 6:30.. dude 6:00 am is a sleep in for me :(

14:39 laugh*

14:39 fdaoud: what time do they go to bed?

14:39 Squee-D: used to be 7:pm

14:39 antares_: Squee-D: using langohr, you mean?

14:39 Squee-D: but with daylight savings, hard to get her to sleep before 8:30

14:39 fdaoud: yeah 9:30pm here, so it's just moved over ;)

14:39 Squee-D: antares_ sure

14:40 Oh i wake up for work

14:40 antares_: Squee-D: yes, I want to put together an example. I am working on doc sites for two other projects (one of them is a Clojure library) at the moment so I don't know yet when that may happen.

14:40 fdaoud: Squee-D: I was talking weekends

14:40 Squee-D: fdaoud i sneak out of the house in the morning to miss traffic, means i leave for home earlier too

14:40 fdaoud oh yeah fair, i get to about 6:30 too

14:41 fdaoud: sure in the week we're up early even before we had kids

14:41 but we took it easy on the weekends

14:41 seancorfield: those are early mornings... i'm rarely up before 9am (but then i'm in california!)...

14:41 Squee-D: antares_ is there anything you can feed me from your own usage that wont break disclosure?

14:41 seancorfield i used to be an LD for dance parties and clubs :D

14:42 Its so strange to be "normal", it's like being a wierdo all over again

14:42 but i'm amazed at how awesome having a kid is.

14:42 clojurebot: excusez-moi

14:45 fdaoud: I was sad the day the little one stopped saying "oh gin" and started saying "orange" :_(

14:47 seancorfield: heh, my wife & i made the decision early on to not have kids but we have lots of cats instead (no college fund, you can lock them up if they're naughty, etc :) )

14:47 ,(clojure-version)

14:47 clojurebot: "1.3.0"

14:47 seancorfield: ah, good, the bot got an upgrade

14:47 Squee-D: fdaoud i get in trouble when i try to improve my girls language :D

14:47 seancorfield: ,(doc realized?)

14:47 clojurebot: "([x]); Returns true if a value has been produced for a promise, delay, future or lazy sequence."

14:48 fdaoud: Squee-D: I did everything to prevent it! ;)

14:48 it was so adorable, I didn't want it to end

14:48 Squee-D: yeah my wifes like that :D

14:49 fdaoud: Squee-D: but now I have to be more careful of what I say. apparently my 4-year-old said to the teacher, "which part of 'no' don't you understand?"

14:49 ibdknox: lol

14:49 jodaro: hahah nice one

14:50 tolstoy: Can you include clojure code (clj-http.client, for instance), when running in script mode? (use '[clj-http.client :as http]) gets me some sort of not found error even though I have the lib on the class path.

14:51 Seems like the script can't find clojure code in the jar file.

14:51 Oh, wait.

14:52 Hm. Still broken even when jars are absolute pathed.

14:52 amalloy: tolstoy: i don't think "script mode" is a thing that exists

14:52 ibdknox: woah

14:53 look who it is

14:53 Raynes: You can't run it in skynet mode either, fyi.

14:53 ibdknox: Raynes: damnit.

14:53 tolstoy: clj file.clj

14:53 ibdknox: amalloy: Raynes told me you were in a bridge tournament? How'd it go?

14:53 tolstoy: I guess I probably have the whole terminology off base. I'll start reading and ask again if things don't get cleared up. Sorry!

14:54 Raynes: That's a random Clojure startup script that doesn't have anything to do with Clojure itself officially and will only put Clojure on the classpath. You'll want to use Leiningen or cake.

14:54 amalloy: ibdknox: he was just guessing, actually. non-bridge vacation, for a change

14:55 TallAdam: hi guys - I'm having trouble getting 'eldoc' to work with cocoa-emacs 24. it works fine for .el files, but not for .clj files (in fact, it suggests lisp eldocs for stuff like 'assoc', where there is a definition in both CL and Clojure). Has anyone else had this problem?

14:55 technomancy: at the conj can we round up all the clojure rabbitmq authors in a room and have them duke it out until there's only one standing?

14:55 ibdknox: amalloy: ah, well welcome back :)

14:55 Raynes: amalloy: That was what ninjudd told me.

14:55 But he wasn't sure either.

14:55 amalloy: thanks! good to be back

14:55 Raynes: Said "probably a bridge tournament".

14:55 tolstoy: Raynes: Thanks. I just have a test script to get some stuff right, but I do indeed use leiningen most of the time. I think I just have some path issues.

14:56 Raynes: Definitely path issues.

14:57 TallAdam: anyone? :)

14:58 I have moved off Aquamacs as its too flaky and I'm sick of stuff not working

14:58 antares_: technomancy: not sure if I should wipe out my recent, well maintained RabbitMQ client from github after hearing this ;)

14:58 technomancy: antares_: depends. is it the best? =)

14:59 ibdknox: mine is totally the best. *goes to create a new repo*

14:59 :p

14:59 technomancy: ibdknox: zero bugs!

14:59 antares_: technomancy: to me of course it is :)

14:59 ibdknox: technomancy: absolutely none. Who else can claim that

14:59 technomancy: antares_: maybe some kind of "Here's what makes it different" in the readme would help?

14:59 tolstoy: technomancy: That would be awesome! RabbitMQ needs some help….

15:00 gfredericks: I'm getting an "attempting to call unbound fn" error when my java calls my clojure class, but I can't see why any NS wouldn't be loaded...

15:00 is there some other cause for that error?

15:00 antares_: technomancy: one nice thing about https://github.com/michaelklishin/langohr is that it has 3 years of experience using & now maintaining Ruby amqp gem mixed with 2 years of experience with the Java driver

15:00 amalloy: gfredericks: you have to load the namespaces manually

15:00 gfredericks: amalloy: I added a (require 'the-ns-my-class-is-defined-in) to the beginning of the method

15:01 antares_: technomancy: and the README mentions that, for sure. We are working on the doc site now before releasing 1.0. Unfortunately, travis-ci.org eats most of my spare time these days.

15:01 gfredericks: amalloy: the var causing the error is only called indirectly; are you suggesting I need to require every single ns in my project manually?

15:01 technomancy: antares_: that's cool; I hadn't read the readme actually, sorry.

15:02 antares_: technomancy: I do not actively "market" it yet because there is next to no documentation, so that's expected that you never heard of it ;)

15:02 technomancy: some of the other ones give a "we wrote this because we didn't realize any other ones existed" impression

15:02 amalloy: gfredericks: you should only need to require the top one, which requires the others

15:02 gfredericks: amalloy: it's weird because this has generally been working; I thought I was familiar with this setup.

15:03 antares_: technomancy: sure, that's why when we started using Clojure very actively first thing I did was writing Langohr.

15:04 gfredericks: also I'm supposed to demo this stuff in 3 minutes and it looks like it's not going to work :(

15:04 amalloy: ouch. maybe there's some general RT.startLoadingStuff()?

15:04 i'm not familiar with it myself

15:04 technomancy: antares_: any reason in particular you're not targeting 1.2 compatibility?

15:04 antares_: technomancy: so, if RabbitMQ clients question does come up and the Conj, feel free to mention Langohr. I won't be at the conj so someone has to do it for me :)

15:05 technomancy: no, no real reason. I won't mind working on 1.2 compatibility in the future.

15:05 technomancy: ok, just curious

15:05 antares_: I guess instead of numerics everything should work on 1.2

15:05 technomancy: would you mind if I submitted a patch to use a RABBITMQ_URL environment variable by default if it's set?

15:06 antares_: technomancy: sure. You would need to add URI parsing for that, I was going to do that, too.

15:06 simard: I'm looking for an into function that would return a map even if the first argument is nil.. say.. (into (:a {:a 1}) {:b 2}) => {:a 1, :b 2} AND (into (:a {:b 1}) {:b 2}) => {:b 2}

15:06 technomancy: yeah, it's pretty easy. I'll put together a pull request

15:06 antares_: technomancy: amqp gem supports both options & amqp:// URIs, I feel langohr should, too

15:06 technomancy: I just added the same thing to java.jdbc

15:06 antares_: technomancy: thanks!

15:07 technomancy: after lunch maybe

15:07 * technomancy &

15:07 lazybot: java.lang.RuntimeException: EOF while reading

15:10 seancorfield: technomancy: i applied your patch for jdbc-22 which was defaulting the driver class name based on the subprotocol but i don't remember a patch for accepting a full URI?

15:11 oh, my bad, you have submitted a patch... sorry

15:12 jira hadn't notified me of the follow-ups since you'd said to hold off on the patch

15:13 antares_: seancorfield: hi. A quick java.jdbc question: what's the best way to convert a result set row into a map? (I know they can be used as maps but I need to serialize it)

15:13 cgray: in clojurescript, does a javascript object become a clojure map? (i.e., can i get the property bar in object foo by saying (foo :bar)?)

15:14 seancorfield: antares_: they are maps now (in 0.1.0)

15:14 i removed the dependency on struct recently

15:15 antares_: seancorfield: ah, that's why they can be used as maps. Thank you! and thanks for picking up clj-time maintenance.

15:15 seancorfield: technomancy: that patch has a lot of changes in it... :)

15:15 antares_: heh, another library i needed at world singles so it made sense to take it over from mark et al

15:22 amalloy: simard: merge

15:22 &(merge nil {:a 1 :b 2})

15:22 lazybot: ⇒ {:b 2, :a 1}

15:22 amalloy: &(merge {:b 5} {:a 1 :b 2})

15:22 lazybot: ⇒ {:a 1, :b 2}

15:22 simard: amalloy: thank you

15:29 seancorfield: technomancy: patch applied... once it passes the matrix test i'll cut 0.1.1

15:47 ibdknox: Hey folks, I am officially releasing 0.2.0 of Korma today: http://news.ycombinator.com/item?id=3188609

15:48 Project website here: http://sqlkorma.com

15:51 jcrossley3: technomancy: do i have any degree of control over the contents of the pom.xml leiningen creates?

15:51 seancorfield: 0.1.1 of clojure.java.jdbc is heading to maven central - thanx technomancy

15:52 amalloy: jcrossley3: an unhelpful aside: you can influence the pom.xml by changing what your dependencies are :P

15:53 jcrossley3: amalloy: yes, unthanks for that, indeed. :)

15:53 in fact, i'd prefer to manage those deps in project.clj, but would still require certain elements in the pom for other maven plugins.

15:54 just wondered if there was any merging capability

15:55 Squee-D: is there an obvious link between noir and korma? sites look a bit the same

15:55 brehaut: Squee-D: same creator?

15:55 * ibdknox chuckles

15:55 Squee-D: no dude, i said OBVIOUS

15:56 * Squee-D burns with shame

15:56 ibdknox: haha

15:57 brehaut: and what do you mean 'look a bit the same' ones gill sans, the other is helvetica!

15:57 ibdknox: yeah dude

15:57 totally different

15:57 I actually intentionally made them mostly the same

15:57 Squee-D: dunno how i missed that

15:57 ibdknox: that layout seemed to work well for this kind of stuff

15:57 obvious code examples, a little text

15:58 Squee-D: yeah im pinching it

15:59 i love the curry colors

15:59 needs a favicon

15:59 ibdknox: figured I'd do warm this time

15:59 oh damn

15:59 forgot that

16:05 chouser: ibdknox: why {:email [like "*foo"]} instead of (like :email "*foo")?

16:05 ibdknox: you can do either :)

16:06 chouser: ah, ok.

16:07 multiple where's are anded?

16:07 ibdknox: yessir

16:07 Bronsa: cool

16:07 hiredman: ibdknox: looks interesting

16:08 ibdknox: hiredman: :)

16:08 Squee-D: Looks like a very elegant dsl

16:08 I'm a fan of Arel in ruby.

16:08 chouser: ibdknox: why . instead of / for :account.name ?

16:09 Squee-D: how long does the first index of repo1 usually take?

16:09 My internet connection isnt hot (im in NZ) but its been going for 5 minutes now

16:09 ibdknox: chouser: I wanted to keep those closer to SQL, though there's no strong reasoning either way for me

16:10 brehaut: Squee-D: what part of NZ?

16:10 Squee-D: akl

16:10 chouser: ibdknox: fair enough

16:11 Squee-D: brehaut sorry i said that assuming you were local. Auckland

16:11 brehaut: Squee-D: i am; im in the tron

16:11 Squee-D: the hell is a clojurian doing in hamilton?

16:12 brehaut: what the hell kind of question is that :P

16:12 technomancy: jcrossley3: there's not much in there yet, but I wouldn't rule it out as a future feature

16:12 Squee-D: i didnt think there were enough brain cells in the whole town

16:12 chouser: ibdknox: looks interesting. Hope I have a chance to try it out.

16:12 Squee-D: do perhaps borrow them from aucklanders that are passing through?

16:12 :P

16:13 brehaut: ive never heard of an aucklander going south of the bombays

16:13 ibdknox: chouser: if you do, I'd love to hear feedback.. I'm sure there are issues in there still

16:13 Squee-D: brehaut well no point is there? really..

16:14 What i really meant, is, how do you remain gainfully employed?

16:14 technomancy: seancorfield: thanks for cutting that release; lookin' good.

16:15 brehaut: Squee-D: i build websites for a design firm in chch

16:15 Squee-D: oh aye. with which tech platforms, typically?

16:16 technomancy: ibdknox: korma looks great, except for the indentation of -> forms in the samples. =P

16:16 ibdknox: technomancy: blame vimclojure :p

16:16 brehaut: Squee-D: Python/Django

16:16 Squee-D: oh thats right i remember you bitching about python yesterday

16:16 ;)

16:16 brehaut: hah

16:17 PPaul: hello guys. i'm having problems with my multimethod https://gist.github.com/1334752

16:17 brehaut: i prefer 'offering unwanted critique'

16:17 PPaul: i can't use (swank.core/break) in it for some reason

16:17 Squee-D: i'm principal here: http://www.vworkapp.com/

16:21 technomancy: ndimiduk: what are the haps?

16:21 Squee-D: ok so lein search is hung on getting the index. can i get it manually somehow?

16:22 ndimiduk: @technomancy heya!

16:22 jodaro: Squee-D: your main office is right near me in sf

16:22 well

16:22 a few blocks

16:22 Squee-D: main office :D Thats how we look more american in America

16:23 jodaro: oh sorry

16:23 Squee-D: All good

16:23 jodaro: i meant us office.

16:23 thought i read "hq" somewhere

16:23 Squee-D: yes, thats how we advertise it :D

16:23 PPaul: anyone can help me with my multi method?

16:23 https://gist.github.com/1334752

16:23 jodaro: just says north american office

16:23 Squee-D: the substance of the team is in NZ tho.

16:23 jodaro: my bad

16:24 how american of me!

16:24 Squee-D: :D

16:24 zerokarmaleft: but now we know the truth...muahaha

16:24 PPaul: how do i reinitalize a defmulti? (for developing)

16:24 Squee-D: its ok, you're allowed ot be that way, until the country sinks into an econimic rut so deep it makes the great depressions look good.

16:24 jodaro: yeah

16:24 Squee-D: depression*

16:25 jodaro: then i'll be on the first plane to NZ

16:25 jcromartie: hm, interesting... Korma looks similar to ClojureQL

16:25 but... nicer

16:25 :)

16:26 brehaut: jcromartie: my hope is less magical :)

16:26 Squee-D: lein repl says i should install rlwrap for optimum experience, no such clojure project.. is this some Java thing?

16:26 jcromartie: brehaut: are you ibdknox too?

16:26 simard: is it possible that in this: (binding [*my-var* (some-stuff)] [(more stuff) *my-var*]), (more stuff) doesn't get to see the new value of *my-var* ?

16:26 jcromartie: or are you saying you have hopes as a user

16:26 technomancy: Squee-D: rlwrap is a C program

16:27 brehaut: jcromartie: lol. no

16:27 Squee-D: oh so probably in brew :D

16:27 technomancy: yup

16:27 Squee-D: ta

16:27 ibdknox: jcromartie: I'm the only real ibdknox ;)

16:28 Squee-D: I don't fear magic. so long as magic is implemented idiomattically..

16:29 "rational magic"

16:30 brehaut: Squee-D: well, clojureql is a relational algebra -> sql compiler. its a bit more idealised than sql and doesnt really have a 1:1 mapping. hence, it can seem a bit magical and surprising

16:31 ibdknox: yeah I replied to a comment talking about clojureql

16:31 my problem is that I think it's the wrong abstraction and that as a result it produces pretty inefficient sql

16:32 technomancy: korma doesn't do schema manipulation yet, does it?

16:32 ibdknox: technomancy: not yet

16:32 technomancy: planned?

16:32 tolstoy: Have any of you had problems with memory leaks when you create and discard a lot of java.nio.ByteBuffers?

16:32 ibdknox: I think it should probably happen, but I'm SQL'd out for the moment

16:32 lol

16:33 technomancy: hah; understandable

16:33 the lack of that was one of my main pain points in my experimental port of clojars to postgres.

16:33 ibdknox: technomancy: yeah, I don't think it'll be too bad to add in

16:33 Squee-D: imho, Korma is clearly better than clojureql for two specific, undeniable reasons. 1. the website, 2. the name

16:33 brehaut: science

16:34 ibdknox: I mean, you can't argue with science

16:34 Squee-D: it works, bitches.

16:35 http://xkcd.com/54/

16:37 jcromartie: technomancy: do you mean like migrations?

16:37 technomancy: jcromartie: yeah

16:41 PPaul: how do i reset my defmulti?

16:41 or multimethod?

16:43 Squee-D: PPaul i'd tell you, but I can't

16:43 PPaul: hmmm

16:43 brehaut: PPaul: ns-unmap

16:43 PPaul: great!

16:44 hmmm

16:45 i tried that with my namespace, and with my multimethod, i get errors in both cases

16:45 brehaut: are you quoting syms?

16:45 PPaul: no

16:45 brehaut: eg (ns-unmap 'user 'mymulti)

16:45 PPaul: i did that, though

16:45 i'll try again

16:46 brehaut: well, use whatever namespace your multi is defined in, if its not user, dont specify user

16:46 PPaul: oh, i need to pass the ns and multimethod...

16:46 technomancy: I think migrations would be worse than general SQL operations simply because individual databases vary a lot more in that regard.

16:46 brehaut: technomancy: for some reason i recall seancorfield talking about supporting migrations in future clojure.jdbc release?

16:47 ibdknox: I would love not to have to write that from scratch

16:47 technomancy: huh... well the two of them should definitely coordinate on that

16:47 ibdknox: lol

16:47 technomancy: there is also lobos, but I haven't looked at that

16:47 brehaut: i could be miles of base on that ;)

16:48 technomancy: brehaut: is that a kiwi idiom? =)

16:48 ibdknox: lol

16:48 brehaut: s/of/off/ ; geez

16:48 technomancy: heh... for some reason it made me think of Ace of Base.

16:48 brehaut: and for that im truly sorry

16:48 ibdknox: technomancy: doesn't everything?

16:48 lol

16:48 ejackson: ibdknox: I like your korma stuff :)

16:49 technomancy: tried to think if the lead singer was named Miles or something

16:49 ibdknox: ejackson: :)

16:49 ejackson: I've been working quietly on something similar, atop clojureQL to deal with the joins, ala has-many, belongs-to etc: https://github.com/ejackson/relation

16:49 PPaul: thanks a lot

16:49 ejackson: its not ready for public consumption, but it'd be interesting to compare notes

16:51 brehaut: theres always someone on HN with 'whats wrong with writing raw SQL like a real man. you kids and your toys should get off my lawn' on threads about libs like korma

16:51 ejackson: the main idea is to maintain a hierarchy (using clojure's hierarchy functions) of the relationship between the tables, so that you can do longwinded and complicated joins and it figure out the correct SQL

16:51 ibdknox: brehaut: yeah, I always think that's funny

16:51 I've written tons of raw sql

16:51 it blows

16:52 brehaut: yes

16:52 and i understand that thats a technical term

16:53 ejackson: its a term the technical have to deal with frequently, that's for sure :)

16:53 scottj: brehaut: I was about to post your exact quote for fun but searched first and saw jwr's already there :)

16:53 brehaut: lol

16:53 thats what i was referring too ;)

16:57 jkkramer: ibdknox: does korma handle many-to-many relationships?

16:58 ibdknox: jkkramer: not explicitly, though you can do the joins yourself. The next version will to it as just another relationship

17:01 jkkramer: ibdknox: gotcha. seems you'll need a special syntax, or support for forward declarations, given clojure's top-to-bottom compilation

17:01 ibdknox: jkkramer: hm? queries are just a map with parts added to them

17:01 jkkramer: you can add the parts however and whenever you want

17:02 jkkramer: ibdknox: i mean as part of of the defentity: (defentity foo (has-many ??)) (defentity bar (has-many foo))

17:02 ibdknox: ah

17:02 indeed

17:02 there are a few reasons why I didn't do has-manys this go around

17:03 Squee-D: you can declare a symbol for later definition no?

17:04 * Squee-D is a cl00b

17:04 technomancy: Squee-D: yep, declare

17:04 brehaut: surprisingly enough, with the declare macro

17:04 Squee-D: so would that be so bad?

17:05 i get that the beuty of a dsl is that you design it so the dev doesnt have to think it, but thats not so bad

17:05 jkkramer: Squee-D: depending on how defentity is implemented, it may depend on the value of the related entity's var

17:05 Squee-D: oic because its a macro not a fn?

17:06 because the fn wouldnt run till it runs.. right?

17:06 i mean that's what i was basing my ignorance on :P

17:07 ejackson: ibdknox: you must really not have liked clojureQL to go to the effort to replace it !

17:07 seancorfield: brehaut: don't think it was me talking about migrations... at least, not as part of c.j.jdbc

17:07 jkkramer: i haven't looked at the implementation, so not sure

17:07 brehaut: seancorfield: aight, sorry about that then

17:08 seancorfield: at world singles, we write migrations in sql and apply them as part of our build so maybe that was the connection?

17:08 brehaut: seancorfield: it could well have been

17:08 ibdknox: ejackson: I don't like the abstraction, it's a cool idea, but it doesn't map correctly for me. It also generates queries that I would *never* write

17:08 ejackson: it would be great to use lobos to figure out the schema to generate the has-manys and the belongs-tos. Fever dreams.

17:09 jkkramer: ibdknox: I'm not enamored with clojuresql's abstractions either. looking forward to seeing how korma develops

17:09 ejackson: ibdknox: yeah, I've had at least a few odd queries come out of it, that's for sure.

17:09 seancorfield: ibdknox: is there stuff that c.j.jdbc could do for you to make korma easier to develop / use?

17:10 ibdknox: seancorfield: I'm somewhat confused by returning things

17:10 seancorfield: I was going to talk to you about it tomorrow

17:11 seancorfield: sure!

17:11 in amongst all the emacs goodness :)

17:11 dnolen: oof, ibdknox kora site is down

17:11 ibdknox: haha indeed

17:12 dnolen: korma i mean.

17:12 ibdknox: dnolen: try again?

17:12 dnolen: ibdknox: nice

17:13 ibdknox: I think it might be time to get off this micro instance :p

17:13 brehaut: ibdknox: what web server are you running?

17:13 ibdknox: jetty

17:14 brehaut: no gateway server?

17:14 technomancy: ibdknox: for a static site?

17:14 ibdknox: ah sorry

17:14 nginx in front of it

17:14 I didn't set it up to cache though, which was dumb

17:14 brehaut: you should be able to handle HN with a static sight and nginx on a wrist watch

17:14 ibdknox: yeah, easily

17:14 brehaut: ah, thats a mistake

17:14 site

17:15 i suck at english. sorry

17:15 ibdknox: me too, it's ok

17:15 :)

17:26 ejackson: what's all this ->R thing on twitter right now ? I seem to have missed the origin.

17:26 amalloy: ejackson: clojure 1.3

17:27 defrecord creates constructor functions now

17:27 ejackson: oh nice

17:27 thanks

17:34 cemerick: ejackson: yeah, few know about it, unfortunately

17:34 ejackson: where is it tucked away ?

17:37 searching ->R and record constructor in google, jira and github have not helped me *sniff*

17:37 cemerick: ejackson: ->Foo and map->Foo are two factory functions implicitly defined by defrecord and deftype

17:38 very undocumented

17:38 ejackson: aaaaaaah, the R is a placeholder :)

17:38 facepalm

17:38 ibdknox: oooo map->Foo?

17:38 cemerick: ejackson: or, relatively undocumented: http://dev.clojure.org/display/design/defrecord+improvements

17:39 ejackson: thanks cemerick

17:39 ibdknox: finally

17:39 cemerick: ibdknox: you didn't know about this either?

17:39 ibdknox: cemerick: not at all

17:39 and I've wanted it

17:39 cemerick: ibdknox, ejackson: vote it up / comment: http://dev.clojure.org/jira/browse/CLJ-833

17:40 As soon as I saw "self-documenting" in conjunction with that feature, I knew this would happen. :-/

17:40 ejackson: I''m not a registered voice yet.... any day now :)

17:40 ibdknox: cemerick: done

17:41 cemerick: ejackson: you can sign up for jira and watch/vote without having a CA in IIRC

17:41 ejackson: right you are, ok, I'm going to shut up now, its seems to be the only way to avoid saying stupid things.

17:43 brehaut: self-documenting \n noun | selvz ˈdäkyəməntING | The developer knows what a piece of code means at the time he or she wrote it.

17:43 ibdknox: (inc brehaut)

17:43 lazybot: ⇒ 6

17:43 cemerick: brehaut: fess up, you used a tool for that ;-)

17:44 brehaut: cemerick: i copied and pasted a bunch of stuff from the builtin dictionary on the mac ;)

17:44 ibdknox: WOAH now, you're using computers to help you do things?

17:44 (dec brehaut)

17:44 lazybot: ⇒ 5

17:44 cemerick: lol

17:44 brehaut: lol

17:44 cemerick: brehaut: right, one of my favorite tools. So sad it only works in cocoa apps.

17:45 brehaut: yeah :(

17:45 in this particular case i used the dashboard widget

17:46 cemerick: I gave up on the dashboard years ago.

17:47 brehaut: i mostly have too. mine is just full of sticky notes and the dictionary :P

18:11 srid: korma.db has no sqlite yet?

18:11 ibdknox: I didn't write a little helper for it, but it works just fine if you supply the normal jdbc map

18:12 srid: ok, its only a macro. and i can retain my existing db map

18:13 ibdknox: yeah (postgres) and all those are just helpers for those maps

18:14 srid: in the examples, `db` is not used anywhere.

18:14 with clojureql, I use `open-global`. for korma?

18:14 ibdknox: the text explains that defdb sets it as the default connection

18:15 you can then tell entities to use specific ones

18:15 srid: ah, defdb

18:15 ibdknox: since it's a pool, there's no need to handle individual connections

18:15 srid: ibdknox: in my project, db's :subname is a function. to be invoked later, when the path to sqlite file will be know.

18:15 defdb won't work with this data, would it?

18:16 ibdknox: it's a delay

18:16 srid: {:subname #(get-sqlite-path %)} ;; something like that

18:17 ibdknox: no I guess

18:17 not

18:17 you can always just create it later and set it:

18:17 srid: using defdb? ok

18:17 ibdknox: or creating a connection and using: http://sqlkorma.com/api/0.2.0/korma.db-api.html#korma.db/default-spec

18:18 (defualt-spec (delay-pool my-spec))

18:18 that's all defdb does basically

18:19 lancepantz: does anyone know if there is a maven repo that snapshot builds from http://build.clojure.org/ are pushed to?

18:19 mabes: ibdknox: do you use korma to manage DB migrations or another tool (e.g. lobos)?

18:20 ibdknox: mabes: I haven't done any migration stuff yet at all with Korma

18:20 lancepantz: i'm trying to use [org.clojure/data.priority-map "0.0.2-SNAPSHOT"] as a dependency, but neither lein nor cake resolve it

18:20 ibdknox: mabes: since we used to be built on django, we're still using python to handle schema changes

18:20 that's likely to be something coming in the future though

18:20 mabes: ibdknox: ah, makes sense

18:21 ibdknox: I haven't needed migrations in clojure yet either, but last time I took a survey lobos seemed the best: https://github.com/budu/lobos

18:21 brehaut: ibdknox: south in particular?

18:21 ibdknox: brehaut: yep

18:22 lancepantz: we have a project we are working on for migrations at work https://github.com/flatland/sqleton

18:22 ibdknox: mabes: yeah, I wonder if I can just make these two work together seamlessly and call it a day :)

18:22 lancepantz: i'm very opposed to sql dsls, so it will always be straight sql for the migrations

18:22 ibdknox: lancepantz: or that :)

18:23 lancepantz: out of curiosity, why?

18:23 lancepantz: it's not really usable yet, aside from some connection utils we use

18:23 Raynes is supposed to help out with it this week

18:23 ibdknox: i just feel like if you're writing sql, you should know sql

18:23 that's something that you can't fuck up in production

18:23 ibdknox: sure

18:24 lancepantz: if you don't know sql, you should either not be writing migrations, or learning sql

18:24 considering you need it that is

18:24 i do like the composability that things like clojureql provide

18:24 ibdknox: so would you use a DSL outside of migrations?

18:24 Raynes: lancepantz: Speaking of that, we *really* need to talk about sqleton tomorrow. Like, definitely.

18:24 lancepantz: but even then, i get pissed off wheneve i have to use clojureql, it's full of strange compiler bugs

18:25 that you would never be able to debug if you did not indeed know sql

18:25 Raynes: sure

18:25 ibdknox: i don't like it, but i do :)

18:25 mabes: lancepantz: the argument (granted, largely hypothetical) for DSLs is to act as a translation layer between different SQL variants

18:25 lancepantz: being the gist

18:25 ibdknox: lol

18:25 mm

18:26 lancepantz: like i said, i dig the composability

18:26 we already started using clojureql before my hate for it grew

18:26 in a new project, i would not use

18:26 ibdknox: lancepantz: well, should you feel the need for something again, check out korma :)

18:27 brehaut: lancepantz: thats the established path ;)

18:27 lancepantz: ibdknox: did you write it?

18:27 ibdknox: lancepantz: yessir

18:27 lancepantz: i saw the post to the list, i'll take a look at it tonight

18:27 you did noir as well, correct?

18:27 ibdknox: yep

18:28 lancepantz: good work, you clearly know what you are doing, dont take my hate the wrong way :)

18:28 ibdknox: haha not at all, I think people fall on different sides of this one for good reason :)

18:28 lancepantz: i'm also a huge fan of readyforzero, so maybe i should just start a fan club

18:28 ibdknox: lol

18:28 srid: (defentity apps (has-one users {:fk :owner_id})) ;; here "owner_id" is a column in apps table referring to "id" in the users table. but it does't work.

18:29 ibdknox: srid: belongs-to

18:29 lancepantz: anyways, any of the core guys around?

18:29 srid: ibdknox: ah, right.

18:29 lancepantz: or anyone that's familiar with build.clojure.org

18:30 srid: ibdknox: just curious - does noir support running on netty? my project uses aleph/websockets that require netty

18:30 ibdknox: yes

18:30 it'll run anywhere a ring handler works

18:30 srid: https://gist.github.com/1257857

18:31 srid: ibdknox: not all parts of noir work in that example. for example, does code reloading work? i noticed that you are using aleph's http server

18:32 ibdknox: srid: yes they do.

18:32 the only part of noir that is dependent on jetty is start/stop/restart

18:33 lancepantz: ring handlers are abstractions on top of the servlet spec though right? which netty does not support

18:34 ibdknox: ring maps are independent of that, I think they used to be more coupled to servlets

18:34 but if you look at the spec now

18:34 there isn't a single key for servlets in it

18:34 brehaut: lancepantz: its an abstraction on HTTP, that happens to have implementations for servlet s

18:34 lancepantz: alright, just wanted to be sure

18:34 ibdknox: also, wrap-ring-handler does the magic necessary to work on netty's channel abstraction

18:35 lancepantz: very cool

18:35 yeah, the last time i looked it proxied the servlet class and overrode the service method

18:39 srid: (select foo (with bar baz moo) ...) ;; this doesn't work "No relationshiop defined for table: moo" - but the relationship is indirect/associative

18:39 ibdknox: one level only for now.

18:39 srid: foo -> baz -> moo

18:40 ibdknox: any workaround?

18:40 ibdknox: srid: join?

18:42 srid: (fields ...) cannot be renamed? just found a conflict

18:43 trial and error - (fields [:foo :foo2])

18:43 ibdknox: srid: all of that is in the docs

18:58 lancepantz: technomancy: are you around?

18:58 amalloy: lancepantz: fun fact: you can say "technomancy: ping?" and lazybot will /msg you next time technomancy does something

18:58 lancepantz: hah

19:12 srid: technomancy: ping?

19:13 amalloy: does it work when priv msg'ing lazybot?

19:13 amalloy: yes

19:13 that's Stalker Mode

19:18 brandel: anyone here doing health informatics by any chance?

19:18 thirddog: Clojure newbie here: have tried detailed instructions at http://dev.clojure.org/display/doc/Getting+Started+with+Emacs for setting up clojure/emacs on winxp and getting nowhere ... can anyone help?

19:20 brandel: it might help thirddog if you state which bit you're stuck on

19:20 tolstoy: thirddog: Don't know about windows, but I had much better luck with: https://github.com/technomancy/swank-clojure

19:20 thirddog: have set up as per instructions, but clojure-jack-in gives Exception in thread \"Main Thread\" java.lang.RuntimeException: java.lang.IllegalArgumentException: Cannot open <#<io$fn__7428$G__7382__7435 clojure.java.io$fn__7428$G__7382__7435@20d4d01>> as an OutputStream. (NO_SOURCE_FILE:0)

19:20 tolstoy: thirddog: With the instructions on that page (though I use .emacs, not .emacs.d/init.el).

19:20 ibdknox: seancorfield has some post somewhere talking about getting emacs + clojure on windows

19:21 thirddog: also, lein swank-clojure starts repl, but slime-connect from emacs says it has conncted but gives no prompt

19:21 tolstoy: I had better luck doing "lein swank" in a terminal, then "M-x slime-connect".

19:21 thirddog: my .emacs.d/init.el contains only code to install required packages, all else is in starter kit

19:22 tolstoy: thirddog: You also have to install slime-repl.el

19:25 thirddog: woo hoo! got a repl from emacs! at least slime-connect works now ... thx tolstoy

19:26 tolstoy: no prob.

19:27 technomancy: ohai ppl

19:28 ibdknox: OMG it's technomancy!!

19:28 * ibdknox screams

19:28 technomancy: how are you gentlemen

19:28 thirddog: strangely, clojure-jack-in has also changed ... now shows "error in process filter: opening input file: no such file or directory <winxp user home>/.emacs.d/swank/slime-cdf283b4.el

19:29 the <xp user home> direcory is wrong through, it's showing as C:/Documents and Settings<username> instead of c:/Documents and Settings/<username> ... wtf?

19:30 technomancy: thirddog: windows home handling is not what you would call coherent

19:30 thirddog: reeeaaalllllly ... no kidding

19:30 technomancy: lancepantz: what's up?

19:31 thirddog: looks like I'll be using slime-connect instead of clojure-jack-in then ... still, all seems to work according to the instructions online so not sure where my problem lies

19:31 technomancy: always up for a patch if you figure out what's going on

19:32 thirddog: not an emacs lisp person but I'll see what I can find .. maybe good practice for clojure :-)

19:34 lancepantz: technomancy: dude, i am having a hell of time getting lein to resolve data.priority map, as in: https://gist.github.com/7ab2b9a1c1b19efe6770

19:35 technomancy: meanwhile, it's definitely there... https://oss.sonatype.org/content/repositories/snapshots/org/clojure/data.priority-map/0.0.2-SNAPSHOT/

19:37 technomancy: curious

19:38 * technomancy wonders if you're required to listen to The Clash while using clache.

19:39 technomancy: lancepantz: it's resolving fine here. what lein version?

19:39 lancepantz: really? as i gisted it? i'm on lein 1.5.2

19:40 technomancy: lemme see if I can repro on 1.5.2

19:40 lancepantz: technomancy: thanks man :)

19:40 technomancy: still works here.

19:40 something spooky going on

19:40 lancepantz: hmm

19:41 technomancy: two days late for hallow'een no less

19:41 lancepantz: alright, well thanks for check for me man

19:41 *ing

19:41 technomancy: if you can repro on the latest feel free to open an issue

19:41 you're on a mac?

19:41 lancepantz: technomancy: will do

19:41 and yes

19:41 should that matter?

19:42 technomancy: nah, "write once, run anywhere", remember?

19:42 =)

19:42 (I have no idea, just good to have more data)

19:42 lancepantz: gotcha,

19:42 TimMc: That defproject gets deps just fine on lein 1.6.1

19:42 lancepantz: i'm trying on amalloy's box now

19:42 TimMc: on Ubuntu 11.04 x64

19:43 lancepantz: works on amalloy's box too

19:43 so i've isolated it to me :)

19:44 TimMc: What platform are you on?

19:45 lancepantz: os x

19:46 ibdknox: worked on OS X Lion for me just now

19:46 lancepantz: k, all else has failed, time to blow away my m2

19:46 ibdknox: with latest lein

19:47 TimMc: lancepantz: That's what I always try first. >_<

19:47 ibdknox: lol

19:47 apply the hammer.

19:47 lancepantz: it worked!

19:47 TimMc: haha

19:47 lancepantz: hahaha

19:47 ibdknox: haha it's like me doing lein clean all the time :p

19:48 lancepantz: well, thanks for the help dudes

19:50 technomancy: ouch

19:50 I wonder what could cause that

19:50 TimMc: Maven.

19:50 ibdknox: haha

19:50 fact.

19:52 amalloy: ibdknox: outside of this room, most people would answer "Java"

19:53 ibdknox: amalloy: haha, a year ago, I would have ;)

21:04 leo2007: does swank-clojure support java7?

21:04 Iam getting this error: http://paste.pound-python.org/show/14579

21:36 wiseen: Is there a way to (reset! atom nil) and get the current atom value not the nil value assigned ?

21:38 hugod: wiseen: I believe you have to use loop and compare-and-set!

21:38 wiseen: I'm thinking about looping while dereferencing and attempting compare-and-swap

21:38 hugod, :)

21:41 leo2007: damn, I was on the 1.3.x and the build have bugs. Switching to the master branch fixes all the errors.

21:41 wiseen: OK tnx, just wanted to make sure I'm not missing anything, tough it might be nice to have something more low-level like clear! because this is fairly low-level like reset!

21:42 *tho

21:43 leo2007: Does C-c C-m in slime macroexpand clojure macros?

21:43 I am getting "Evaluation aborted on java.lang.Exception: unknow swank function swank/swank-expand-1."

21:44 llasram: leo2007: It's supposed to, yeah

21:44 (Meaning, when working normally -- works for me)

21:46 leo2007: I tried to expand (when 1 2) but failed.

21:46 callen: leo2007: swank version?

21:46 leo2007: how'd you bring the session up?

21:46 leo2007: callen: swank-clojure-1.4.0-SNAPSHOT.jar

21:47 callen: I run the swank-clojure script which is this http://paste.pound-python.org/show/14636

21:47 callen: I just want to bring up the repl and follow through Joy of Clojure.

21:48 llasram: leo2007: Which version of SLIME? I gather you aren't using clojure-jack-in ?

21:48 leo2007: llasram: no, I am using upstream slime.

21:50 llasram: Ok. In that case I'm not sure there are many people other than technomancy who can help you out, and he started bundling SLIME specifically to avoid these incompatibilities introduced upstream

21:50 (assuming that's the problem)

21:51 leo2007: llasram: I slightly modified swank-clojure to work with upstream slime: http://paste.pound-python.org/show/0cDo11do4hnDSxtSEiT9

21:51 do you see any problems with that change? Sorry I am not yet familiar with clojure.

21:52 llasram: Er. I've poked around the swank-clojure source code a bit, but haven't really hacked on it. I'm afraid I have no idea if those changes are right, esp in the context of upstream SLIME changes. Sorry :-/

21:57 leo2007: llasram: no worries. Packaging an old version of slime.el is annoying because that one version ruins all my slime setups for Common Lisp and scheme.

22:15 mefesto: technomancy: ping

22:26 * hugod wishes there was a with-open variant that invoked a close function from a Closable protocol

22:48 goodieboy: I'm attempting to understand macros better, and can't figure out why this doesn't work... anyone wanna give me a hint? https://gist.github.com/1335646

22:48 I get "Unable to resolve symbol: phrase in this context"

22:50 brehaut: goodieboy: because phrase isnt defined in your '(query… )' expression

22:50 wait, no

22:51 goodieboy: (macroexpand '(query (phrase "test"))) expands to (clojure.core/apply (phrase "test"))

22:52 goodieboy: at which point apply it is evaluated, and phrase is not a bound symbol at that point

22:53 goodieboy: brehaut: hmm ok, so even though the let is setting it up, it's too late?

22:53 amalloy: goodieboy: the let is not helping

22:53 brehaut: goodieboy: let is lexicaly scoped; its not going to effect anything provided outside its scope

22:53 amalloy: because it is being evaluated inside of the query macro, not inside of the code produced by the query macro

22:54 goodieboy: ... thinking

22:54 brehaut: goodieboy: how about you explain what you want that macro to do?

22:54 goodieboy: ok i think i understand

22:54 ok sure

22:55 I was hoping it would call phrase, which is a function that wraps its argument in quotes. So (query (phrase "test")) => "\"test\""

22:56 really ... just experimenting to see if I could call let-ed anonymous functions

22:56 amalloy: goodieboy: i would clarify your intent as: "i want this macro to introduce a function named phrase for use in the body". fair?

22:57 goodieboy: yes exactly

22:57 amalloy: in that case, the code you produce has to have a let in it

22:57 goodieboy: you mean, the code that is calling the macro?

22:58 amalloy: no

22:58 you wrote (let [...] `(...))

22:59 goodieboy: yes

22:59 amalloy: that is creating a variable at *compile time* for the internal use of query, and not putting it in the code that query expands to

22:59 goodieboy: ahh i see

22:59 amalloy: if you want to return code with a let in it, you need to write `(let [...] (...))

23:00 goodieboy: got it, but then... I get the "can't let qualified name..." error

23:00 amalloy: right

23:00 &`(let [x 1] x)

23:00 lazybot: ⇒ (clojure.core/let [clojure.core/x 1] clojure.core/x)

23:01 amalloy: &`(let [x# 1] x#)

23:01 lazybot: ⇒ (clojure.core/let [x__8715__auto__ 1] x__8715__auto__)

23:01 amalloy: &`(let [~'x 1] ~'x)

23:01 lazybot: ⇒ (clojure.core/let [x 1] x)

23:01 goodieboy: hmm

23:01 oh ok

23:05 brehaut: goodieboy: next thing: why call apply if you are splicing together an sexp ?

23:05 amalloy: ~' doesn't do any magic if you understand what's going on, but it also probably wouldn't hurt you to think of it as magic for a while if you have other things to learn

23:06 goodieboy: brehaut: yes i'm starting to see that now

23:06 clojurebot: two things are more than one thing

23:06 goodieboy: yow, my brain is hurting

23:07 brehaut: goodieboy: also, you can use destructuring for your macros argument. id replace [& form] with [[f & body]] and then ditch first and rest.

23:07 goodieboy: amalloy: i *think* i get it, will understand more after playing with it a bit

23:07 amalloy: clojurebot: thanks for the tip

23:07 goodieboy: brehaut: right ok

23:07 clojurebot: thanks for your suggestion, but as usual it is irrelevant

23:07 goodieboy: hehe

23:08 brehaut: goodieboy: i presume that you are wanting to split up the form for some additional reason, otherwise you could just use [form] and ~form

23:09 brandel: is anyone working on a clojurescript book atm by any chance?

23:10 goodieboy: brehaut: yes, at some point... the query macro could take as many different types of query sexps as needed. But that's a long way off :)

23:41 Raynes: brehaut: ping?

23:41 brehaut: Raynes: pong

Logging service provided by n01se.net