#clojure log - Jan 07 2011

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

0:00 riddochc: Isn't there a promise? fn?

0:00 cky: riddochc: If you look at the definition of promise, there is no way to tell a promise from any other function.

0:02 amalloy: cky: ##(-> (promise) class .getName (.indexOf "promise") neg? not) :P

0:02 sexpbot: ⟹ true

0:03 cky: amalloy: That's so ghetto.

0:03 amalloy: not exactly a sophisticated algorithm

0:10 qbg: Using Clojure to permute a part of this guy's self portrait (http://i.imgur.com/vqTq2.jpg), I was able to make this: http://i.imgur.com/TMZJE.png

0:14 amalloy: qbg: what do you mean, permute a part of his portrait? like, you picked a chunk of his image and rearranged only the pixels in that chunk?

0:14 qbg: Correct

0:14 amalloy: that's pretty cool

0:14 qbg: I've wanted to do this for years, and I finally did

0:16 amalloy: qbg: how old is his project?

0:17 qbg: See this thread on reddit: http://www.reddit.com/r/programming/comments/exkxp/hey_proggit_me_and_my_friend_wanted_to_see_how/

0:57 Licenser: morning

0:57 amalloy: &(let [{x :k :or {x 1]} {:k nil}] x)

0:57 sexpbot: java.lang.Exception: Unmatched delimiter: ]

0:57 amalloy: &(let [{x :k :or {x 1}} {:k nil}] x)

0:57 sexpbot: ⟹ nil

1:05 amalloy: oh jeez. i just looked at the implementation of destructuring in core.clj. that is some wild stuff going on

1:28 chouser: indeed

1:31 devn: chouser: this book is great.

1:33 amalloy: i put up some ugly destructuring examples earlier...

1:35 https://gist.github.com/438897

1:37 &(let [{:keys [foo bar] :or {foo 5}} (list :bar 2)] [foo bar])

1:37 sexpbot: ⟹ [5 2]

1:38 devn: :D

1:38 chouser: devn: I know, right? I'm glad you're enjoying it.

1:39 Raynes: What book?

1:39 devn: Raynes: Less than Words Can Say

1:39 google for it -- it's on a website called sourcetext IIRC, free to read

1:40 amalloy: devn: meh. i mean the code that parses the binding forms

1:40 devn: fantastic book about language

1:40 amalloy: sure sure i was just posting for anyone else's enjoyment

1:40 some of those make me think for a few moments :)

3:04 LauJensen: Morning all

3:10 Berengal_work: LauJensen: I'm looking at clojureql, and I'm missing documentation on how to write a backend. Could you tell me where I should start looking?

3:11 LauJensen: Berengal_work: Start by understanding this https://github.com/LauJensen/clojureql/blob/master/src/clojureql/sql92compiler.clj - There are a few conventions in the AST which might trip you up, so catch up with me here or in #clojureql and I'll be happy to help out

3:13 bobo_: LauJensen: are the functions intentionaly that long, or was it hard to get them shorter? (havent read the code to carefully)

3:14 LauJensen: bobo_: Basically the compile function takes a table object and converts it into a string representation (vector actually, but thats a detail). It makes for an easier read to have all components in a single function. The caveat is, that the table object, might container joins (which is why we have build-joins) and it might be part of union, in which case it has both its own properties and those of the entire union.

3:15 bobo_: I dissagree with the easier read part. But maybe its a matter of taste

3:16 LauJensen: Try reading some of Rings source. Every two lines is split into its own function (roughly), which means you're constantly scrolling up and down and looking in other files to understand the most basic functionality.

3:17 bobo_: ctrl+click and alt+rightarrow

3:17 *leftarrow

3:17 tomoj: LauJensen: scrolling? :P

3:17 LauJensen: tomoj: You get the idea. You cant just read a function and be done with it

3:17 bobo_: When reading a function, i want to know what it does first

3:18 then if it matters to me, i want to know how it does it

3:18 if i first have to understand how, and then get to know what. It is alot harder

3:18 LauJensen: I dont feel the same way

3:18 bobo_: as i said, matter of taste

3:18 LauJensen: bobo_: But when you write the H2 backend, you get to call the shots :)

3:18 bobo_: :-p

3:19 If i had time, i would write a backend. I like the library alot. But time is not something i have =(

3:19 tomoj: bobo_: what are those shortcuts from?

3:20 bobo_: tomoj: netbeans, im not acculy sure if it works in enclojure.

3:20 LauJensen: tomoj: Where is that screencast you promised me?

3:20 bobo_: tomoj: but anyway, my main point was lack of tooling is not a reason to make "ugglier" code.

3:21 tomoj: hopefully less than a lightyear away

3:21 but perhaps nowhere at all :1

3:22 LauJensen: tomoj: perfect. I like the fact that I tell an advocate of trainingwheels that if they can make a convincing screencast I myself will start using trainingwheels, and almost 6 months later, still no such video can be produced :)

3:23 tomoj: aww, don't blame paredit for my failures

3:23 and, 6 months, really? shit

3:24 bobo_: LauJensen: can you make a video showing why you dont need paredit? Ive started liking paredit lately

3:25 LauJensen: Sure I could

3:25 Actually, it makes more sense the other way around, since paredit is an extra tool which complicates editing

3:25 bobo_: paredit is realy realy annoying sometimes. But mostly it makes it easier to edit

3:25 tomoj: yeah, I think we have the burden of proof

3:26 I feel like I should just record my coding sessions so I can go back and actually see how I use paredit, pick out interesting stuff and rerecord

3:26 bobo_: This might sound weird. but i like everything except the enforcing of matching parens

3:26 tomoj: would be nice to record the actual text changes and not a video initially

3:27 LauJensen: tomoj: sounds like a noble idea - I'll check back in 6 months and see if you've made the case for trainingwheels by then

3:27 tomoj: when you don't have matching parens, don't most paredit commands break?

3:33 Berengal_work: Is there a nice way to load an entire project into swank at once?

3:34 tomoj: why?

3:34 clojurebot: why not?

3:34 Berengal_work: Preferably without ruining namespaces

3:35 So the nice describe-foo and jump-to-foo functions work in slime

3:36 tomoj: the describe functions don't seem to work at all for me

3:36 maybe I'm not using them right

3:37 does your project have many entry points?

3:38 and I guess you want to M-. and type in a function to jump to manually?

3:39 AWizzArd: Any compojure users here?

3:39 Or Jetty users that is.

3:39 Berengal_work: Hmm, yes, but slime probably doesn't understand the namespaces enough

3:40 AWizzArd: In Compojure my handlers can return a string or vector or number or map, and those return values are then translated into a http response.

3:40 I however would like to stream a response. Possibly tens of thousands of rows from a sql request.

3:40 tomoj: if the function isn't loaded, I guess C-x C-f and C-s is more work than M-. with manual entry after the hypothetical "load entire project"

3:41 personally never find myself using M-. with manual entry

3:41 AWizzArd: So, I would like to force it to send out the headers, but not yet the body. Instead I would like to grab the (body) output stream S and have my handler function write directly into S.

3:41 Berengal_work: M-. and C-s are about the same in terms of efficiency

3:42 I think the problem with M-. is that it doesn't namespace-qualify the symbol, so if you haven't loaded it unqualified, it won't work anyway

3:42 And loading the entire project unqualified might not work properly

3:44 By the way, (->> (all-ns) (remove #(re-matches #"user" %)) (map (comp require symbol str)))

3:44 *(str %)

3:46 tomoj: won't (all-ns) only return ns's you don't need to require anyway?

3:52 Berengal_work: what do you mean about namespace-qualification? you're in ns foo, you want to jump to bar/bar, and you type `M-. bar`?

3:53 bad example since that jumps to the namespace

3:54 `M-. bar/bar` seems to work fine

4:03 Berengal_work: tomoj: It seems I'm confused

4:04 tomoj: probably me

4:05 Berengal_work: No, things didn't work as I expected, so obviously I've got the wrong idea about something

5:27 Gigaroby: guys is there a function to add a element in a point of a sequence ? like (add-to [1 2 3] 1 "a") -> [1

5:27 -> [1 "a" 2 3]

5:28 raek: not for doing it in constant time

5:29 Gigaroby: I work on small seq's does not matter

5:29 so I assume it does not exist ...

5:30 raek: it is still possible to do

5:30 (concat (take n s) x (drop n s))

5:30 Gigaroby: yep

5:30 raek: ...where x is a collection of one

5:30 Gigaroby: thanks

5:31 raek: with vectors you can reuse everything up to the new element

5:32 Gigaroby: ah

5:32 nothing

5:32 all this

5:32 was about

5:32 inserting

5:32 an element

5:32 at the end of a seq

5:32 but if I use a vector

5:33 elements are add

5:33 only at the end

5:33 raek: (into (subvec v 0 n) (list* elem (subvec v n)))

5:33 yes

5:33 ,(conj [1 2 3] :a)

5:33 clojurebot: [1 2 3 :a]

5:34 Gigaroby: yes in this program I just need to put and remove elements from the top

5:34 like a stack

5:34 raek: (let [v [1 2 3], n 1, elem "a"] (into (subvec v 0 n) (list* elem (subvec v n))))

5:34 ,(let [v [1 2 3], n 1, elem "a"] (into (subvec v 0 n) (list* elem (subvec v n))))

5:34 clojurebot: [1 "a" 2 3]

5:35 raek: then you can use 'conj' and 'pop' for pushing and popping

5:35 Gigaroby: yep

5:35 infact

5:35 thanks a lot

5:35 raek: they work both for lists and vectors

5:35 (although the work on opposite "ends")

5:35 Gigaroby: yep

6:10 ordnungswidrig: is there a common alias for partial? For complicated point free expressions the symbol "partial" is rather noisy. I, tend to use "§" but I'd like to see what others think

6:14 hoeck: ordnungswidrig: thats the reason that I'm barely using partial

6:14 AWizzArd: ordnungswidrig: I already suggested to use exactly that same symbol in 2008.

6:14 US keyboards can't produce it :)

6:16 ordnungswidrig: *g*

6:16 bbl

6:30 one could use a "ascii graphic" symbol like ->, say ! or <>

6:34 mids:

6:35 ordnungswidrig: mids: this would depend on the seasons (and on the geographic) location ;-) on australia at the same time you'd have to use ☼

6:35 mids: :D

6:47 kjeldahlw: Does anybody know if interacting with SQL-Server through clojureclr is supported yet, and if there are any examples?

6:57 AWizzArd: Hi rhickey.

7:02 LauJensen: kjeldahlw: You cant just use ClojureQL?

7:03 zoldar: hello, I'm trying to play around with a lightwieght networking framework (SpiderMonkey) written in Java. The problem is, that the serialization mechanism requires defining message classes with members. From what I see, gen-class allows only defining single state member object. Is there any way to explicitly define other class members?

7:06 a_strange_guy: zoldar: do the classes have to extend a specific superclass?

7:06 zoldar: yes, but superclass does not contain these members

7:07 a_strange_guy: bleh

7:07 if you wouldn't have hadt to extend a class but an interface instead

7:07 then you could use deftype

7:08 zoldar: hmm

7:08 a_strange_guy: (deftype Foo [a b c])

7:08 zoldar: actually, there's alternative interface for extension

7:08 a_strange_guy: then use it

7:09 with deftype you can create a class with named field and implement interfaces

7:09 zoldar: thanks, I'll try that

7:11 why gen-class prevents creating class members? only because of concurrency concerns?

7:13 a_strange_guy: genclass only creates a a wrapper class

7:14 everything is delegated to the fns in the namespace

7:18 zoldar: thanks for clarification - one more question - per default, does deftype declare members as final ?

7:20 a_strange_guy: maybe

7:20 but you can make them utable by annotating the fieldnames with ^:unsynchronized-mutable

7:20 ^mutable

7:28 zoldar: ok, I'm screwed anyway, because there's no interface for message, message listener has one. Oh well...

7:29 fbru02: hey guys , lost my memory, what is a best way to zip values in two lists or vectors?

7:29 i don't want a map so zipmap is not great

7:29 raek: (map vector coll-a coll-b)

7:30 fbru02: raek: thanks !

7:52 jowag: clojure.contrib.http.agent uses await internally, so (result (http-agent "some-url" ...)) may block indefinetly if underlying agent failed. Is there some workaround around this or I shouldn't use contrib.http at all?

8:40 zoldar: I'm trying to implement a java interface using deftype - here's my code: http://clojure.pastebin.com/JYV4hTzs , the interface definition itself: http://clojure.pastebin.com/cvrzGnqY . When I try to compile the clojure code, an exception is thrown: error: java.lang.IllegalArgumentException: Can't define method not in interfaces: messageReceived. I've tried adding type hinding for methods and arguments but it still doesn't work. What am I miss

8:40 ing?

8:40 clojurebot: optimizing is http://clojure.org/java_interop#optimization

8:40 zoldar: *hinting

8:45 chouser: Since there's only one method for each name, you shouldn't hint the args to deftype.

8:48 zoldar: try removing your messageReceived doc string

8:49 zoldar: ah

8:50 thanks, that was it

8:51 fogus`: LauJensen: Cake should work.

8:55 LauJensen: fogus`: okay thanks

8:56 For a moment, I was afraid that the cake was a lie

8:57 fogus`: Does it now work for you?

8:57 kjeldahlw: LauJensen: Regarding ClojureQL, does SQL-Server have a JDBC interface available (usually)? I'm not in control of the server...

8:57 LauJensen: fogus`: marginalia itself worked, I havent tried with cake - I asked because otherwise I might have contributed the task

8:58 kjeldahlw: looks like it http://lmgtfy.com/?q=sql-server+jdbc+driver&l=1

8:58 fogus`: LauJensen: I haven't messed with Cake too much, but Justin added the task, so think it's good to go.

8:59 LauJensen: fogus`: should be as simple as adding a tasks.clj with (deftask mag #{} (run-marginalia ...))

9:00 kjeldahlw: LauJensen: If it's a separate download, it will not help in my case, but thanks anyway. I'll prod the server and see what it has available. I know ODBC is enabled, so maybe, just maybe... :-)

9:00 fogus`: LauJensen: Well then we're set

9:13 shortlord: I am trying to install vimclojure, but am stuck after installing the nailgun server using leiningen. How can I start it so that vimclojure connects successfully? all the documentation about vimclojure seems to be outdated, including both of the screencasts + website of the author

9:19 jjido: Anyone knows of Clojure-related jobs in the UK?

9:21 mids: jjido: http://jobsearch.monster.co.uk/Search.aspx?q=clojure&cy=uk&lid=193

9:23 jjido: mids: right, thanks. Is there a more specialised site?

9:25 tonyl: i just saw this yesterday http://functionaljobs.com/jobs/ but it has not open yet

9:26 maybe looking at companies that use clojure and see if they have jobs available

9:27 chouser: I use Clojure at work, and we're hiring, but there's no guarantee you'd actually be using Clojure if you were hired. We have lots of Ruby and PHP as well. But it's a great place to work, regardless.

9:28 http://sentryds.com/

9:31 jjido: Thanks Chris, Tony

9:35 chouser: jjido: oh sorry, didn't notice you said UK. That might not work. :-/

9:55 cemerick: jjido: you might want to ask ejackson when he's around; he's in Cambridge IIRC

9:55 jjido: cemerick: thanks for the tip!

9:56 cemerick: :-)

10:13 raek: philosophical question: are zippers and monads related on some level?

10:13 ordnungswidrig: raek: I'd say yes. however the exact details must be worked out :)

10:15 raek: the idea of composing pure functions that represent mutations rings a bell... :)

10:17 chouser: zippers don't usually capture or manipulate functions

10:19 or use user-provided functions in any way other than when defining zippers on new types

10:19 biab

10:52 hugod: fogus`: I added some initial maven support for marginalia https://github.com/talios/clojure-maven-plugin/issues#issue/28

10:52 running marginalia on pallet produced a >500K file

10:54 fogus`: hugod: Whoa! Thanks. :-)

10:54 hugod: It produces big files by default at the moment because the gen'd file contains all of the js deps

10:55 hugod: ok

10:55 fogus`: That stands to change

10:56 hugod: BTW, Marginalia v0.3.0 is a bit better

10:58 hugod: fogus`: it would simplify maven integration a little if parse-project-file were called at the top level rather than within uberdoc!

11:05 fogus`: hugod: I'm happy to help Maven integration. What do you mean by "top level" main- ?

11:08 hugod: fogus`: run-marginalia would be sufficient - the current directory is different when invoked under maven, and the maven mojo contains code to specify the output path

11:08 fogus`: hugod: OK. Can do

11:10 I'll push that out later today.

11:12 hugod: thanks

11:13 fogus`: hugod: No, thank you. :-)

11:22 mduerksen: is it just me or does noone need a data type for a symmetric relation?

11:46 lpetit: ninjudd: ping

11:46 oh, and hello, btw

12:09 fbru02: lpetit: hello !

12:10 lpetit: hello, fbru02

12:14 anyone using classlojure ?

12:19 AWizzArd: rhickey: I have a case where I would like to express (extend MyProtocolA MyProtocolB {:foo .. :bar ...}). But currently at the place of MyProtocolA I need a class or interface.

12:19 Are there good reasons for not allowing protocols in that position?

12:20 I can code around this. I just stumbled over this issue, but it is no show-stopper for me.

12:22 lpetit: AWizzArd: it's more being able to extend protocols to interfaces which seems weird :)

12:24 AWizzArd: My macro generates Records that all implement ProtoB. I want all records that implement ProtoB be able to call methods of ProtoA too. In my case I can simply have my macro just let the records it generates also implement ProtoA. I just thought that a generic extension of A with B would be nicer.

12:27 hiredman: I don't think that is likely, one of the design points of protocols was to keep a flat space

12:28 lpetit: AWizzArd: "Records implement ProtoB" is java-like "parlance". The right way to speak about it (if I'm not wrong) is "ProtoB is extended to Record Foo"

12:28 AWizzArd: lpetit: ok

12:29 Islon: does anyone knows a easy way to add 2 maps? (add-map {:a 1 :b 3} {:a 3 :b 6}) -> {:a 4 :b 9}

12:29 AWizzArd: I wonder if there was a reason for (currently) not allowing to extend protos with other protos.

12:29 lpetit: AWizzArd: what does "I want all records .. be able to call methods of ProtoA too" ? I don't understand.

12:29 s/?/mean ?/

12:30 s/\?/mean \?/

12:30 sexpbot: <lpetit> s/mean ?/mean mean ?/

12:30 lpetit: :)

12:30 mrBliss: ,(merge-with + {:a 1 :b 3} {:a 3 :b 6}) ;; Islon

12:30 clojurebot: {:a 4, :b 9}

12:30 Islon: mrBliss: thanks!

12:31 AWizzArd: lpetit: I have an instance of my record (ProtoB). I can call (foob my-rec).

12:31 I want to be able to also (fooa my-rec)

12:32 lpetit: AWizzArd: my current understanding. Protocols define contract for abstract data types. So you can only extend them to real datatypes. That's why that's being able to extend protocols to host's (java) interfaces which seems weird to me then :)

12:33 AWizzArd: I want all records that extend B to also extend A. But not all records/classes that extend A require to extend B too.

12:33 I now solve this by having my macro generate records that extend both, A and B.

12:33 lpetit: AWizzArd: I'd do the same

12:34 AWizzArd: But if I could just (extend ProtoA ProtoB {...}) then my macro would only need to extend ProtoB as it did for days, until I just discovered that it requires to extend ProtoA too.

12:34 I thought that when one can extend interfaces, then it should in principle be okay for other Protos too.

12:35 KirinDave: Argh

12:35 The worst part about working with Scala is that Scala programmers seem to hate convenience.

12:35 lpetit: AWizzArd: well, we'll have to wait for Rich's answer to get the final word :)

12:35 KirinDave: Clojure; has a shell-out library standard. Because it comes up, and the java way is repetitive and tedious.

12:35 Scala; "Just call Runtime"

12:36 lpetit: KirinDave: so you have generalized this example into a definitive opinion 'bout "Scala programmers" and "Scala" in the large ?

12:37 KirinDave: lpetit: This is a great example of why I love clojure contrib.

12:37 lpetit: But yes. I have. isthereaproblem.com?

12:38 lpetit: notforme.net

12:38 KirinDave: lpetit: I like Scala a lot. It's fun and interesting. Until you do something you've done a thousand times before with not a whit of help from the language and ask, "Wait... why isn't this part of the stdlib?"

12:38 It comes up a lot more than it does for Clojure or Groovy or JRuby.

12:40 lpetit: KirinDave: Interesting. So it's not just about this one example you gave. Thx.

12:42 KirinDave: lpetit: it's a recurring theme. Wanna see what I am talking about? Lift is another good example. Premiere scala web framework, right? Go to getting_started

12:42 Try not to tear your face off after the first paragraph. It's difficult, but resist

12:43 Even better, know that there actually _is_ a link to a much slower, more measured tutorial to lift ON THAT PAGE. Also know that almost no one finds it because it's difficult to find. :\

12:46 lpetit: KirinDave: simply lift, at the end, is that it ? :-)

12:47 KirinDave: lpetit: Yeah, but their link styles make it hard to find.

12:47 And it's not simply Lift

12:47 lpetit: KirinDave: indeed, we're far from an hello world example.

12:47 KirinDave: That's the same damn tutorial in a pdf

12:47 It's Exploring Lift, the second link.

12:47 lpetit: !

12:48 apgwoz: i was playing code golf this morning with recursive quick sort. if you don't worry about StackOverflow errors and use the naive solution, how small can you get it?

12:49 * fogus`away tore his face off

12:50 apgwoz: https://gist.github.com/769825






12:51 KirinDave: fogus`: Face. Off. Faceoff. http://fayr.am/3unw

12:54 Berengal: Why does clojure-mode color (rename) differently from (forget)?

12:54 apgwoz: KirinDave: I once tried to write hello world using lift, and i came to the conclusion that it's a humongous pile of overengineering.

12:55 fogus`: https://gist.github.com/769828

12:55 amalloy: Berengal: it has a list somewhere of library functions

12:55 apgwoz: KirinDave: but, you should check out nathan hamblen's unfiltered: https://github.com/n8han/unfiltered

12:55 Berengal: amalloy: But rename isn't in the standard library...

12:55 Well, at least not in clojure.core

12:56 fogus`: apgwoz: Slight modification :-)

12:56 amalloy: Berengal: clojure.set

12:56 apgwoz: fogus`: yeah, for some reason i didn't even think of using filter/remove d'oh

12:57 fogus`: apgwoz: It's definitely not efficient, BUT I love that code because it draws a picture of what qsort does

12:57 Berengal: amalloy: Okay, but why color it differently than other functions, like (comp)

12:57 amalloy: https://github.com/technomancy/clojure-mode/blob/master/clojure-mode.el#L481

12:57 Berengal: that, i don't know. i think it's silly personally

12:58 apgwoz: fogus`: yeah, the purpose wasn't efficiency. someone sent me qsort in erlang, and asked what it looked like in clojure.

12:58 Berengal: amalloy: I'd much rather it colored functions that were in scope...

12:59 amalloy: Berengal: that's kinda hard,even if you let clojure-mode depend on swank/slime

12:59 but feel free to do it yourself

13:00 lpetit: fogus: answer sent via github msg

13:00 Berengal: amalloy: When my annoyance threshold is reached :)

13:01 amalloy: Berengal: technomancy took over clojure-mode from jochu, and i've sorta read it over myself, but i don't think either of us really knows how it works

13:04 Berengal: amalloy: I barely know how to concatenate strings in elisp, so it might take me a while

13:04 amalloy: yeah, same here

13:04 lpetit: argh

13:04 fogus`: ^^^

13:04 amalloy: Berengal: if you figure out how indentation works, let me know. there's a change i'd like to make, and one joshua__ wants too

13:06 Berengal: amalloy: The one where sometimes it indents one tab, other times it aligns the tail of the form?

13:06 amalloy: Berengal: eh? i'm not familiar with that behavior

13:07 i have a bone to pick with the indentation of ((juxt + -) 10<RET>5)

13:08 hiredman: amalloy: the fuxt just produces takes a single arg

13:08 juxt

13:08 geez

13:08 the fn juxt produces …

13:08 amalloy: hiredman: ##((juxt + -) 10 5)

13:08 sexpbot: ⟹ [15 5]

13:09 lpetit: ,(doc juxt)

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

13:09 hiredman: ah well

13:09 amalloy: but even if you were right, clojure-mode doesn't know that; it just doesn't want to indent (( as a function

13:09 hiredman: amalloy: you forget I find sexpbot annoying and have it on ignore

13:09 amalloy: hiredman: heh, so i did

13:09 Berengal: amalloy: (for [x y]<RET>(println x<RET>y<RET>z))

13:10 amalloy: ,((juxt + -) 10 5)

13:10 clojurebot: [15 5]

13:10 hiredman: do you have back tracking indenting turned on?

13:10 (cause you really should)

13:10 amalloy: Berengal: that indents fine for me

13:11 hiredman: i'm not sure. i remember discussing it once but i don't know how to check if it's on

13:11 lpetit: hiredman: can you tell me more about back tracking indenting ?

13:11 Berengal: amalloy: It's fine, but it's inconsistent as far as I can see.

13:11 hiredman: lpetit: it indents things better

13:11 *shrug*

13:11 amalloy: Berengal: ?? looks perfectly consistent

13:11 lpetit: hiredman: so helpful ;)

13:12 hiredman: I've had it on forever now, I don't remember what it's like without it

13:12 amalloy: you mean that for indents by one indent instead of lining up with [x y]?

13:12 hiredman: I seem to recall protocols and letfns not indenting correctly

13:12 lpetit: hiredman: oh, it's backtracking for getting more context before choosing an indenting strategy ?

13:12 s/indenting/indentation/

13:12 sexpbot: <lpetit> hiredman: oh, it's backtracking for getting more context before choosing an indentation strategy ?

13:12 Berengal: amalloy: yes, while println aligns the arguments

13:13 amalloy: Berengal: there's a list of special-case indents, used mostly for "control-flow" type functions

13:13 hiredman: for has a binding form, and most (if not all) indent like that

13:13 let,with-open,binding,for,etc

13:14 Berengal: It annoys me a bit that I can't get my own macros to indent like that

13:16 Perhaps I could get it to cycle indents...

13:17 hiredman: Berengal: clojure-mode does special case indenting macros that start with with-

13:17 amalloy: Berengal: untested, but (put 'mymacro 'clojure-indent-function 1) should work

13:17 or at least be a step in the right direction

13:17 Berengal: hiredman: I think I've noticed that

13:17 amalloy: Not portable between different environments, unfortunately

13:18 amalloy: no, and you're unlikely to find a strategy that is, sadly

13:18 Berengal: Would having tab cycle between indent-one (binding style) and allign (funcall style) befine?

13:18 raek: ordnungswidrig: thanks for the link! reading it now.

13:18 Berengal: align*

13:19 lpetit: Berengal: would ease the pain for sure

13:19 amalloy: Berengal: i doubt it. there are a lot of other things that perform indent logic

13:19 <RET> does a reindent, M-q reindents the whole defn...

13:19 Berengal: amalloy: This is only for regular list forms

13:20 amalloy: You could keep the current logic for finding the first indent in the cycle

13:21 amalloy: Berengal: my point is, if you do some magic with tab's indenting, a RET will screw you up

13:21 lpetit: amalloy, Berengal: in emacs with clojure-mode, if you call reindent on a line, does it also reindent correctly the following lines as necessary ?

13:21 amalloy: it's probably possible to do in the long run, maybe even correctly, but i'd rather spare myself the grey hairs

13:21 lpetit: yes

13:22 lpetit: though if the following lines were indented in a "non-standard" way, it reindents them to standard

13:22 which i don't love, but i can live with

13:22 lpetit: amalloy: oh so that's far from perfect. IMHO it should just shift the following lines to make them follow the new column of the current line

13:23 tomsw: Evening all. Is there a better way to do this: (take-while identity (iterate #(.getParentElement %) n))?

13:23 all I want to do is get a finite list of ancestor elements

13:23 amalloy: tomsw: that's a function a lot of people have written a lot of times. it's not in clojure.core, but it might be in contrib somewhere

13:24 lpetit: i agree. feel free to make it one of the places where CCW is better than emacs :)

13:24 ordnungswidrig: i'm looking for a simple persistent work queue in clojure. any ideas?

13:24 lpetit: amalloy: totally on my todo list, already :-)

13:24 tomsw: amalloy: reassuring to know I'm in company

13:24 ordnungswidrig: or shall I go with rabbitmq or like that

13:25 mduerksen: tomsw: in case you have to do it yourself: take (keep ... instead of (take-while identity

13:25 amalloy: mduerksen: that's a very different behavior, isn't it?

13:25 mduerksen: amalloy: i just realized :(

13:26 tomsw: forget what i said :)

13:27 tomsw: mduerksen: no worries, I made exactly the same mistake about 10 mins ago

13:28 fogus`: lpetit: Thanks for the link. I will look at the code this weekend.

13:29 lpetit: you know you've done too much clojure .... when you type (cake repl) in your bash terminal :)

13:29 amalloy: lpetit: (join #hadoop) :)

13:30 lpetit: fogus: impl. details are a moving target (eg regexeps), but grammar shape currently pretty stable (heh, paredit.clj is based on it, so it must be ;) )

13:30 ordnungswidrig: lpetit: there is a lisp shell IIRC

13:30 lpetit: http://clisp.sourceforge.net/clash.html

13:31 lpetit: ordnungswidrig: no thanks :)

13:32 tomsw: mduerksen: but identity isn't really the opposite of nil?

13:32 raek: ordnungswidrig: there's always clojure.lang.PersistentQueue

13:32 ordnungswidrig: lpetit: or, hmm, build sime macros and use the repl as your shell!

13:32 raek: or, what did you mean by "persistent" in this case

13:32 ?

13:33 ordnungswidrig: persisting over jvm restart :-)

13:33 mduerksen: tomsw: no, as predicate it isn't when value's can also have the value false

13:33 ordnungswidrig: I need a simple work queue that persists even when the jvm restart.

13:34 raek: ah, then ignore that suggestion... :-)

13:35 ordnungswidrig: raek: I did :-)

13:53 hiredman: clojurebot: pidgin | was | developed by mayans

13:53 clojurebot: Ik begrijp

14:05 Hoornet: clojurebot: help

14:05 clojurebot: http://www.khanacademy.org/

14:09 bendlas: hey folks

14:10 quick question: would be

14:10 ,(contains? (transient {:a 0}) :a)

14:10 clojurebot: false

14:10 bendlas: considered a bug?

14:11 lpetit: bendlas: no

14:12 bendlas: so there is no way to distinguish non - containment from a nil value?

14:12 on a transient?

14:13 Guest79031: how can get from a hash with a lot of hashes inside it the value of a given key?

14:13 in an arbitrary level

14:13 is there any way to do that?

14:13 bendlas: Guest79031: get-in

14:13 ordnungswidrig: ,(keys (transient {:a 0}))

14:13 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.PersistentArrayMap$TransientArrayMap

14:13 raek: Guest79031: sounds like 'get-in'

14:13 bendlas: ,(doc get-in)

14:13 ordnungswidrig: aha

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

14:14 lpetit: bendlas: nope

14:14 only a few commands can operate on transients

14:14 raek: ,(get-in {:a {:b {:c 1}}} [:a :b :c])

14:14 clojurebot: 1

14:14 lpetit: s/commands/functions/

14:14 sexpbot: <lpetit> only a few functions can operate on transients

14:15 ordnungswidrig: Guest79031: -> is your friend as well

14:15 ,(-> {:a {:b {:c 1}}} :a :b :c )

14:15 clojurebot: 1

14:15 bendlas: lpetit: so what about dropping in those \! and wrapping it in #(persistent! ... (transient %))

14:15 Guest79031: get-in it's not working for me with this hash -> {10 {:users #{"adm" "gerente"}, :name "req-1"}}

14:16 i'm trying to get the :name value

14:16 bendlas: isn't that how transients should work?

14:16 markskilbeck: ordnungswidrig: so elegant.

14:17 raek: ,(get-in {10 {:users #{"adm" "gerente"}, :name "req-1"}} [10 :name])

14:17 clojurebot: "req-1"

14:17 Guest79031: hmm...i see...but i don't know a priori how's that structure

14:17 raek: -> is a good replecement for get-in when all the keys are keywords (as they are functions)

14:18 ordnungswidrig: Guest79031: sorry, this works only for keyword keys

14:19 raek: Guest79031: what do you have, and what do you want to obtain?

14:20 bendlas: ordnungswidrig: about (-> {} transient keys), I get that you can't have seqs on transients

14:20 cemerick: ,(get-in {10 {:users #{"adm" "gerente"} :name "req-1"}} [10 :name])

14:20 clojurebot: "req-1"

14:20 bendlas: wouldn't go well with lazyness

14:20 cemerick: Guest79031: ^^

14:21 ordnungswidrig: bendlas: -> was thought as an alternative for get-in

14:22 bendlas: ordnungswidrig: I use it mostly to reduce nesting

14:22 and destructuring let for get-in stuff

14:23 ordnungswidrig: bendlas: desctrucuring is nice

14:24 bendlas: yes, I like that it's a distinct concern from cond - stuff in clojure

14:24 Raynes: Are there plans to move the getting started pages from assembla to confluence?

14:26 cemerick: Raynes: there's an open invite for people to move stuff over. Presumably, those responsible for each environment would take the lead on that.

14:26 s/an/was

14:26 sexpbot: <cemerick> Raynes: there's was open invite for people to move stuff over. Presumably, those responsible for each environment would take the lead on that.

14:26 Raynes: Hell, I'll do it.

14:26 I really hate linking to things that are outdated.

14:26 Well, not outdated, but you get the point.

14:29 cemerick: Raynes: FYI: http://groups.google.com/group/clojure-dev/browse_thread/thread/53ea0d2aa36b19fb

14:29 so, make sure there's redirects in place @ assembla

14:32 fogus`: hugod: Better? https://github.com/fogus/marginalia/commit/19b665e42ddfa29b8d8ca79e4b3e67313f278ef1

14:33 Raynes: cemerick: Indeed. /me pings stuart for an injection of clojure-dev into his confluence account.

14:33 hugod: fogus`: yes - should be able to use uberdoc! now :)

14:34 fogus`: hugod: Thank you for pulling that Maven support together. Can't wait to try it out.

14:34 clojurebot: clojure-maven-plugin is http://github.com/talios/clojure-maven-plugin

14:34 Raynes: clojurebot: Thank you. I'm sure he desperately needed to know that.

14:34 clojurebot: Cool story bro.

14:37 fogus`: hugod: BTW, I bumped the version number to 0.3.2

14:38 eyeris: Is clojure-clr's clojure.compile.exe supposed to create a .exe file? All I get is a .dll file, but I've read posts on the mailing lists that imply that it should create a launcher .exe

14:38 Raynes: cemerick: I suddenly have mvn. Magically, even. I remember conceding to the gigantic download and deciding to wait until I really, really needed it to download it over this lowly connection.

14:39 But the Maven gods hath smiled upon me and I have it now.

14:40 Maven really does have a mind of it's own, huh? Should I be frightened? Do I need to sacrifice animals to keep it happy?

14:40 cemerick: Raynes: whoa. Surely this is a sign of the end times upon us?

14:40 ;-)

14:40 Raynes: (:

14:40 hugod: fogus`: I'll update the mojo

14:41 cemerick: Raynes: re: mind of its own: generally, the aim is to avoid thinking about things you really don't care about anyway.

14:43 ordnungswidrig: cemerick: if the project is large enough maven forces me to think about thins i really don't care about

14:44 cemerick: I disagree.

14:44 Unsurprisingly.

14:44 * cemerick opts out of any maven debates

14:45 Raynes: Whoa. Can you even disagree with that? I'm not sure that statement was even eligible for disagreement. :o

14:46 The only thing keeping me going is the assumption that, with my simple needs, I shouldn't have to do much XML tweaking if clojail ends up in contrib.

14:47 XML is like a phobia for me. Like with arachnophobia.

14:47 I'm sure it'll pass.

14:58 chouser: cemerick: oh, you're around. I should be talking to you.

15:00 cemerick: chouser: hi :-) about?

15:00 * cemerick is only notationally around, really

15:00 chouser: releasing finger tree

15:01 stuartsierra: chouser: tell people to listen to me

15:01 chouser: Everyone should listen to stuartsierra. He knows what he's talking about, even if I don't.

15:01 cemerick: stuartsierra: is/will there be a an opportunity for a quorum on various issues?

15:02 stuartsierra: Just build issues, or general issues?

15:02 cemerick: if so, I should be able to bribe chouser appropriately ;-)

15:02 I'll take what I can get.

15:04 chouser: so, what *are* we talking about?

15:05 mattmitchell: could someone recommend an activerecord-like lib?

15:05 gtrak: yes

15:05 bendlas: mattmitchell: clojureql

15:05 mattmitchell: bendlas: great thanks

15:26 shortlord: how can I thread integers through nested maps using "->"? I have defined a map placements with integers as keys, (placements 8) works, (-> placements 8) fails:

15:26 java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0)

15:27 hiredman: do you know what -> does?

15:27 Raynes: I don't think so.

15:27 amalloy: shortlord: ((comp m1 m2 m3 m4) 8)?

15:27 or (-> 8 m1 m2 m3 m4) if you're in love with ->

15:29 hiredman: my suggestion is a meditation on the macroexpansion of ->

15:32 shortlord: well, I looked at this example here http://clojuredocs.org/clojure_core/clojure.core/-%3E where it was used to pull something out of deeply nested maps, but I guess I have misunderstood it then

15:34 raek: shortlord: -> happens to work similarly to get-in when the keys are keywords

15:34 as keywords work as functions

15:34 but integers do not

15:34 amalloy: shortlord: yeah my example is not what you want; i mis-guessed your goal when your example had only one integer and one map

15:34 raek: (:a m) is the same as (get m :a)

15:35 (-> m :a :b :c) becomes (:c (:b (:a m)))

15:35 Raynes: shortlord: (-> 1 (+ 2) (* 3)) = (* (+ 1 2) 3)

15:36 raek: for keys 1, 2 and 3, you'd want (get-in m [1 2 3]) which could be written as (-> m (get 1) (get 2) (get 3))

15:36 Raynes: raek: A major part of the macro chapter in my book is implementing -> with and without syntax quote. I figured I could kill two birds with one stone, since I'm not only teaching macros but I'm also teaching -> :>

15:36 * Raynes is proud of it.

15:37 afekz: could anyone suggest a direction for me to explore doing the following idiomatically: selecting records from two different data sources and attempting to match each entry one against the other, where there is no unique ID field and a consolidated field may match twice (but I want to pick up duplicates)...

15:37 amalloy: Raynes: without syntax-quote is tricksy

15:37 Raynes: amalloy: I dids it.

15:37 afekz: (it's the matching part I'm asking about, really... the queries/etc are fine)

15:37 Raynes: It wasn't that bad.

15:38 shortlord: ok, thx for all the help, I guess I have understand what -> does now :)

15:43 alpheus: -> makes me feel like I'm reading Lisp backward

15:43 raek: -> makes me feel like I'm reading Forth forward

15:43 Raynes: raek: o.

15:43 o/

15:44 You'd think after several months of using a blank keyboard, I'd make typos much less often.

15:44 amalloy: Raynes: i've been using a keyboard i can't see for like five months and i still can't type for shit

15:44 gtrak: does that help productivity?

15:45 cemerick: Raynes: I think they make keyboards that have the letters printed on the keys. I've got one, they're cool.

15:45 Raynes: gtrak: No, but it helps to annoy people who aren't touch typists.

15:45 And that's plenty reason for me to use it.

15:45 And wooby gave it to me, so it's extra extra special. <3

15:45 Crowb4r: It also makes using an alt. layout easier because you have a blank slate.

15:46 such as Dvorak, or something else.

15:46 amalloy: Crowb4r: that's only relevant if you're a sissy who looks at the keys

15:46 Crowb4r: for instance I use US layout, Coder-Dvorak and Russian.

15:46 amalloy: my keyboard is under my desk, invisible

15:47 Raynes: amalloy: Under the desk? Do you type with your feet?

15:47 gtrak: how is using dvorak on a blank keyboard any easier?

15:47 Raynes: gtrak: Because looking at the keys don't confuse you, I suppose. And it isn't just plain weird to switch the keys around.

15:47 amalloy: Raynes: hanging from the bottom surface of the desk

15:48 gtrak: yea, i guess there's an efficiency gain there in the context-switching of your mind :-)

15:48 Raynes: I'm in love with das keyboards now, but I've gotta say, these things aren't meant to be cleaned. I took the keys off to clean it before realizing that not all of the keys are the same. ._.

15:48 amalloy: hahaha

15:48 Raynes: I'm still not entirely certain I've got them back on right, but I'm pretty sure.

15:48 Three hours worth of work, anyway.

15:49 I don't know what Alan did with this keyboard over the years, but there was enough hair under these keys to make a wig. I couldn't get it all out with a vacuum cleaner.

15:54 linusericsson: is there a clojure wrapper for Central Authentication Service (the Yale single sign-on protocol)?

15:56 amalloy: does anyone think it makes sense for (-> blah ()) to expand to (blah) instead of (nil blah)?

15:57 hiredman: it's really (cons (first ()) (cons blah (rest ())))

15:58 amalloy: hiredman: i know that's what the implementation looks like, but it could special-case () since (nil blah) is guaranteed to be wrong

15:58 raek: Raynes: I had to try to implement -> without ` too: https://gist.github.com/770086

15:58 amalloy: whereas (blah) is occasionally useful if the previous form results in a thunk

15:59 hiredman: (-> blah (apply nil))

15:59 amalloy: hiredman: i suppose that's an option, yeah

16:01 Raynes: raek: I stuck very, very close to the original implementation of ->.

16:04 raek: hrm, better to check for seq? rather than symbol? ...

16:05 is -> found in many lisps?

16:05 * Crowb4r should really write that asterisk clojure lib

16:13 shortlord: given a ref and a function in the same namespace, that needs to alter that ref. is it better style to pass the ref as an argument or simply alter it, because it's in scope anyway?

16:14 the function is not pure anyway, so I guess it does not make it a bad style not to pass the ref as an argument, right?

16:15 amalloy: shortlord: you'll have less pain refactoring/improving later if you pass it in

16:15 cause eventually you'll discover some solution that's better than having a global ref

16:16 lpetit: "I’ve noticed that it seems that people are doing a lot of data intensive work like Clojure because it just focuses on that problem of manipulating data, which I think is great. You can certainly write services of any kind in Clojure if you like"

16:16 amalloy: or you'll want to reuse this library for more than one thing at a time, or...

16:17 lpetit: ^^ How would you qualify this apparently genuine attempt to narrow the usability of clojure to some niche ?

16:17 What would be the exact term ? It's not FUD, even more subtle than that.

16:18 shortlord: amalloy: ok, I'll pass it as an argument then, thx :)

16:19 cemerick: lpetit: I don't think saying X is good for Y necessarily implies that X isn't good for Z.

16:20 lpetit: "it just focuses"

16:20 for more context : http://www.infoq.com/interviews/wampler-scala

16:21 cemerick: I haven't watched the vid, but I think you're reading more than you should into "just".

16:21 "just" isn't, e.g. "merely"

16:21 lpetit: would be like answering a question on scala: "yeah, scala is really good at writing concurrent programs, for which task it seems tailored to".

16:22 cemerick: See, that doesn't sound negative to me in any way. :-)

16:23 hiredman: cemerick: just is often used as a sort of passive aggressive pejorative

16:23 lpetit: maybe. I try to see this from the eyes of somebody who has almost never learned 'bout clojure. And I might get the impression that Clojure is not general purpose, but has a bias towards data manipulation, as if it were some kind of dsl for an ETL.

16:23 cemerick: hiredman: yeah, but given the latter part of the statement that lpetit quoted ("you can certainly…")…?

16:25 hiredman: it's somewhat amusing given how many people mused about "a dynamic language like clojure on the frontend and a static lanague like scala on the backend"

16:25 when most people are really doing ruby on the frontend and clojure on the backend

16:27 cemerick: …due more to staffing concerns than anything else, I presume.

16:27 lpetit: anyway

16:27 hiredman: I like to think it's because writing scala is horrible

16:28 cemerick: I was meaning the ruby:clojure pair, vs. full-stack clojure.

16:56 Berengal: What should I name a function that takes a map, a function, a vector of keys in the map and a vector of new keys and produces a map with the keys in the first vector replaced by the keys in the second, their values being mapped to the return values of the function called with the values of the first keys?

16:58 (foo {:a 1 :b 2 :c 3} [:b :c] [:sum :diff] (fn [b c] [(+ c b) (- c b)])) => {:a 1 :sum 5 :diff 1}

16:59 tonyl: replace-keys ?

16:59 qbg: The fn returns a vector? That seems strange

17:02 Berengal: Eh, I'm not sure if this is the best function either...

17:02 Would it feel more natural to add the extra keys, then remove the now-superfluous keys?

17:03 fbru02_: hey guys i have more an architecture question anyone up to it?

17:03 Berengal: qbg: The vector is for multiple return values

17:04 qbg: Berengal: My point it that it would seem better to me to map the function over the values, not apply it to the values

17:04 I suspect you are trying to do something really strange

17:04 Berengal: qbg: It takes them all as input at once. A simple map won't do

17:05 And well, sort of strange

17:05 qbg: This function feels a bit *too* specific

17:06 Berengal: qbg: Actually, it's pretty general. It can be used to both add and remove keys

17:07 I'm experimenting with relations

17:08 fbru02_: ok here it goes anyway, i have a java system , that we want to break up , make it less monlothic, and we have new development we are doing in clojure. How should all these parts speak ?

17:09 qbg: Interfaces?

17:09 Berengal: Interfaces are good

17:10 tonyl: fbru02_: there are a lot of variables that go into making that decision

17:10 specially what you mean by system and parts

17:11 fbru02_: tonyl: let's suppose we have total control over the source code of these parts

17:13 Berengal: Are you using clojure as a glue language?

17:13 tonyl: fbru02_: then I would go by what qbg and Berengal say, interfaces and datastructures. datastructures to be shared among the parts and interfaces/protocols to manage what to do with those datastructures and how to share them

17:14 fbru02_: tonyl: Berengal I wasn't following your conversation guys, i will go back and read it , but yes that was my hunch, using clojure as glue

17:16 Berengal: fbru02_: What I'd do is not let the java parts interact directly. Instead, let them provide a decent interface to clojure, and let clojure worry about the interoperability between the different parts

17:16 But obviously I don't know the details

17:16 fbru02_: Berengal: makes sense

17:17 qbg: fbru02_: Is Clojure conceptually running the system or is Java?

17:17 fbru02_: what transport/data protocol should i use ? clojure sexps ?

17:17 qbg: right now Java

17:18 qbg: fbru02_: Even after you do new development in Clojure?

17:19 fbru02_: qbg: at first yes, code base is still huge...

17:21 qbg: How do you see Clojure being used as glue then? Is there some configuration component you will be (re)writing in Clojure?

17:23 fbru02_: qbg: this new component that we will write in clojure , will need some parts of the Java legacy code , I see us coding some sort of wrapper api for this part of the legacy code

17:23 do i mae sense at all?

17:25 TakeV: Is it possible to do Android programming with Clojure? I know Android doesn't use the JVM, but it does use Java.

17:26 qbg: What I'd try to do then is in Java create the interface(s) that the Clojure code will fulfill and then use the tools in Clojure to create class(es) that implement the interface(s)

17:27 emn3m: join #starcraft2

17:27 oops

17:27 Raynes: TakeV: http://dev.clojure.org/display/design/Android+Support

17:27 emn3m: sorry

17:28 technomancy: emn3m: construct additional pylons

17:28 wdouglas: lol

17:28 fbru02_: qbg: how about out of process components, how should i expose an api from one clojure system to another ?

17:28 TakeV: Raynes: Awesome, thank you.

17:28 emn3m: technomancy: it's lack of overlords that usually is my problem

17:28 Raynes: technomancy: o/

17:29 technomancy: \o?

17:30 Raynes: Returning a high five whilst scratching one's head?

17:30 Berengal: ,(binding [+ -] [(+ 3 2) (let [f +] (f 3 2))]) ; Someone explain this?

17:30 clojurebot: [5 1]

17:32 raek: Berengal: the arithmetic functions are treated specially by the compiler and cannot be rebound

17:32 Berengal: :(

17:32 qbg: raek: Actually they are just inlined

17:33 tomoj: ,(binding [+ -] [(+ 3 2) (+ 3 2 1)])

17:33 clojurebot: [5 0]

17:33 raek: ah

17:33 tomoj: heh

17:33 qbg: For special cases as tomoj points out

17:34 Berengal: Seems that could blow someone's toe off...

17:34 qbg: ,(binding [+ -] (#'+ 3 2))

17:34 clojurebot: 1

17:35 hiredman: with 1.3 unless a var is explicitly dynamic you won't be able to rebind it, and I doubt + will be dynamic

17:35 qbg: Berengal: I'd think (binding [+ -] ...) would have a much greater chance of blowing someone's toe off

17:36 Berengal: hiredman: True, I forgot about that

17:36 Raynes: Berengal: If you accidentally use binding and rebind something as common as +, you've got more problems than Clojure allowing you to blow toes off.

17:36 qbg: You may want to checkout with-redefs

17:36 In 1.3

17:37 Berengal: qbg: Well, I'm trying to build an AST, and I was hoping I could just do it with functions instead of having to either introduce new ones or write a huge macro stack for the entire DSL

17:39 Also, I'm way to tired to be thinking about implementation details now it seems...

17:39 qbg: Berengal: So you want (+ 1 2) => (ast-+ 1 2) or something like that?

17:39 (by => I mean evaluate)

17:39 Berengal: Yepp

17:40 qbg: Here is an idea:

17:40 Create a new namespace excluding clojure.core

17:40 * lpetit just happens to think that parts of his code heavily use binding to do scoped memoization on otherwise non optimized (in number of same calls) code ...

17:40 qbg: Then write a small macro to intern a new fn in the namespace for everyone in clojure.core that does what you want

17:41 lpetit: to simulate referential transparency, withing increasing the used heap forever, so to speak

17:41 qbg: Then if you evaluate your code in that namespace, it should do what you want

17:42 Berengal: qbg: So, write a macro that sneakily evaluates the body in that different namespace, is that what you're saying?

17:43 qbg: Or a fn to do (binding [*ns* (find-ns '<your ns>)] (eval <code>))

17:43 If the loss of lexical scope is okay

17:44 lpetit: Berengal: yep, exclude clojure.core, require it as e.g. "c" or "core" or "clojure" instead. "require" or "use" your namespace fulll of DSL helper functions. And let your favorite IDE do its magic only offering you, and your users, the minimalist DSL-oriented completion assistance :)

17:44 that is, if you can isolate DSL code in its own dedicated namespaces

17:44 linusericsson: Is there a way to take in a lot of arguments in a compojure POST-route whichout explicitly name every variable? Like an & argv?

17:45 Berengal: qbg: I'm not sure if it is

17:47 http://clojure.pastebin.com/n9g8XyCQ <- here's a small example of what I'm trying to do

17:48 I still need to figure out if I can do it without wrapping the whole thing in a macro...

17:49 qbg: So join, restrict, etc. are not functions/macros?

17:49 Berengal: I hope they'll be functions

17:51 From relations to relations that is

17:51 qbg: You want to perform this transformation so your math in join, transform-attributes, etc. works correctly?

17:51 Berengal: Yep

17:52 Maybe it could work if I made some specific ones macros...

17:52 qbg: Are you against having join, restrict, etc. be macros that will expand to a use of a functional version of themselves?

17:53 Berengal: Not as such, but it would be nice to be able to parameterize e.g. the restriction

17:54 So you could do (fn [& restrictions] (apply restrict some-relation restrictions))

17:55 That would require either a new restriction-builder macro, or more likely, a more bothersome explicit-ast approach

17:55 qbg: You could have (restrict some-relation restrictions ...) -> (restrict-fn some-relation (transform restrictions) ...)

17:57 Or you shadow math and provide versions of the operators that work lists in the way you want in addition to how they normally work

17:57 ClojureQL does stuff like that I think

17:59 Berengal: Hmmm... is it possible to extend + to work for new types?

18:00 qbg: You'll have to shadow + to do that

18:00 amalloy: Berengal: clojure.contrib.generic-arithmetic, i think?

18:00 qbg: #'clojure.core/+ doesn't let you do that for perf reasons

18:01 Berengal: amalloy: Would users of my code have to know about that?

18:01 amalloy: *shrug*

18:02 qbg: Berengal: They would probably have to use/require both libs

18:04 fbru02_: qbg: and all , can you help on how would you do an api (for a clojure program talking to another one)

18:05 I still got that pending from our conversation

18:06 lpetit: Berengal: after having considered everything, why not just have the functions of your dsl be aliased to a very short alias (one char) ?

18:07 Berengal: not that bad - http://clojure.pastebin.com/V0akxiE3

18:09 Berengal: lpetit: Could work

18:10 I still haven't completely let go of the idea of wrapping the entire thing in one macro...

18:10 lpetit: think edition : could even have an IDE feeling = "d/" and wooops code suggestions for dsl specific operators

18:11 amalloy: fbru02_: do you mean api for direct function calls, or a protocol for data transfer across processes/networks?

18:11 fbru02_: amalloy: i would love to have the second

18:12 amalloy: fbru02_: https://github.com/ztellman/gloss maybe?

18:12 fbru02_: amalloy: let me take a look :) thanks !

18:12 Berengal: The trouble with a wrapping macro is that you couldn't translate something like (?-> (table :foo) (restrict (< (:id :foo) 10))) to (restrict (< (:id :foo) 10) (table :foo)) without some issues

18:12 cemerick: anyone here a Java 2D font wizard?

18:23 lpetit: cemerick: question answered ;)

18:23 cemerick: lpetit: yeah, I knew that was a longshot :-)

18:24 lpetit: cemerick: yay, now (ns ^{:doc "The core Clojure language."

18:24 :author "Rich Hickey"}

18:24 clojure.core) is not a problem to findDeclaringNamespace anymore.

18:25 cemerick: you lifted c-m-p's approach, I assume?

18:25 lpetit: c-m-p ?

18:25 cemerick: The contextual side of the house is tougher, of course.

18:25 clojure-maven-plugin

18:25 lpetit: (defn find-namespace

18:25 [tree] (spy (sym-name (form (first (call-args (some #(call-of % "ns") (code-children tree))))))))

18:26 cemerick: ^^

18:26 oops , need to remove the spy

18:27 cemerick: lpetit: I've got a big backlog of ccw tweaks to push through. I don't think I'm going to get to it before the end of the month, tho. What are your release plans like for 0.2.0?

18:27 lpetit: c-m-v approach is for findMaybeLibNamespace (yes I'm good at finding horribly long java method names)

18:28 cemerick: aligned with pure open source philosophy = when I feel it's ready :-p

18:28 cemerick: heh, OK

18:28 well, hopefully I can get them in under the wire

18:29 lpetit: yes. public branch repl-ui is kept up to date

18:29 cemerick: backlog wrt to repl view ?

18:30 cemerick: lpetit: REPLView and some nREPL bugs

18:33 lpetit: cemerick: great, so our works will be complementary. Still need to work on porting actions to handlers (so much code reduction!), and at least 2 big remaining stuff from editor to repl : code completion, visual matching brackets, and same default/strict switching command/status-bar-reporting

18:33 yeah, it's 3 big stuff, not 2

18:34 cemerick: There's that pile of feedback from Lee et al. that came through in November, too, which I've not touched.

18:34 lpetit: Once I've got those 3 big stuff checked in, I'll release a new RC. Hopefully before the end of January ! !

18:34 cemerick: Things have been very busy since early December.

18:34 lpetit: sure

18:35 but now things are fitting into place again for me, I'm rather confident that I'll find a pace

18:39 * lpetit feels the pain for the parts of ccw still written in java, when he needs to restart its target platform in debugging mode

18:58 devn: lpetit: your grammar for clojure has been nice for me to look over while working with ANTLR -- thanks for that.

19:00 lpetit: devn: you're welcome. But currently I'm only maintaining it, and my attention is on the grammar for clojure written for parsley, FWIW

19:43 claj: I cannot get somnium.congomongo to work as expected on OS X, java seems to bound for my local IP, 192.168...

19:43 and if i explicitly tells (mongo! :host "") that wont work correctly either :(

20:59 tufflax: In Vimclojure, which key indents a block of code properly if selected in viual mode?

21:00 visual*

21:07 chouser: =

21:07 amalloy: :wqemacs :)

21:07 * chouser rolls his eyes

21:09 tufflax: :) thanks

21:43 Leonidas: can I have a macro match on both an atom and a list and unpack the latter in head & tail?

21:44 http://paste.pocoo.org/show/316937/ doesn't quite work, because of the same arity. but when I remove the first rule, it tries to unpack an atom which isn't the most useful thing to do

21:45 amalloy: Leonidas: why a macro at all?

21:45 Leonidas: amalloy: this is an exercise, the expansions are just placeholders for now.

21:45 later there will be Real Code(TM) :)

21:46 * Leonidas is aware of Macro Club

21:47 amalloy: (let [x (atom 1) [head & tail] (if (instance? IDeref x) [x] x)] (use head and tail))

21:47 or go the other route and test for (coll? x)

21:48 Leonidas: amalloy: hmm, ok, so I cannot "pattern match" it.

21:49 amalloy: Leonidas: no, not with destructuring. i think there are some pattern-matching-related libraries for clojure...maybe qbg knows?

21:50 Leonidas: amalloy: the funny thing is, I am actually trying to port a scheme macro using syntax-rules to Clojure. qbg's syntax-rules should be able to do that :)

22:51 ikeji: (assoc {} :a 1)

22:53 ,(assoc {} :a 1)

22:53 clojurebot: {:a 1}

22:53 ikeji: (conj {} [:a 1])

22:54 ,(conj {} [:a 1])

22:54 clojurebot: {:a 1}

22:54 ikeji: ,(conj {} :a 1)

22:54 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword

22:55 amalloy: ikeji: you can /msg the bots

23:31 qbg: I need to work on an alpha2 release of syntax-rules

Logging service provided by n01se.net