#clojure log - Mar 09 2011

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

0:00 waxrose: Yeah

0:00 Yeah

0:08 I'm still going to check out this lisp/bf interpreter just for fun.

0:08 I'm still going to check out this lisp/bf interpreter just for fun.

2:05 amalloy: TimMc: oh hey, you go to the same school as ben englert, apparently

2:05 TimMc: oh hey, you go to the same school as ben englert, apparently

2:06 friend of mine; he did a summer internship at my previous company

2:06 friend of mine; he did a summer internship at my previous company

2:36 does anyone have a dsl/library for state machines? i started writing what turned out to be a pushdown automaton, and i'd like to either use an existing one or put together a generic one of my own for release

2:36 does anyone have a dsl/library for state machines? i started writing what turned out to be a pushdown automaton, and i'd like to either use an existing one or put together a generic one of my own for release

2:41 it also seems like fnparse "ought" to be usable as a state machine but i can't figure out how to squish the two mental-models together

2:41 it also seems like fnparse "ought" to be usable as a state machine but i can't figure out how to squish the two mental-models together

2:48 hiredman: amalloy: I generally use letfn + trampoline

2:48 amalloy: I generally use letfn + trampoline

2:52 amalloy: hiredman: cute

2:52 hiredman: cute

2:54 hiredman: https://github.com/hiredman/chinese-democracy/blob/master/src/chinese/democracy.clj#L28

2:54 https://github.com/hiredman/chinese-democracy/blob/master/src/chinese/democracy.clj#L28

2:57 amalloy: sounds perfect for finite-state; seems like it will involve more low-level fiddling than i'd like for maintaining unbounded state like a stack

2:57 sounds perfect for finite-state; seems like it will involve more low-level fiddling than i'd like for maintaining unbounded state like a stack

3:03 i guess it's hard to get much shorter than #(next-state current-stack), #(next-state (conj current-stack new-value)), and #(next-state (pop current-stack))

3:03 i guess it's hard to get much shorter than #(next-state current-stack), #(next-state (conj current-stack new-value)), and #(next-state (pop current-stack))

3:35 angerman: is there a command to clear the clojure repl in emacs?

3:35 is there a command to clear the clojure repl in emacs?

3:39 amalloy: angerman: clear it how?

3:39 angerman: clear it how?

3:40 longfin: angerman: if you use slime, m-x slime-clear-buffer

3:40 angerman: if you use slime, m-x slime-clear-buffer

3:40 sorry m-x slime-repl-clear-buffer

3:40 sorry m-x slime-repl-clear-buffer

3:41 angerman: longfin: thanks!

3:41 longfin: thanks!

3:41 amalloy: angerman: C-c M-o does the same thing

3:41 angerman: C-c M-o does the same thing

3:41 as long as what you want is to clear the screen rather than "restart" the repl from a clean state; your use of clear was, aha, unclear to me

3:41 as long as what you want is to clear the screen rather than "restart" the repl from a clean state; your use of clear was, aha, unclear to me

3:42 angerman: amalloy: well is there a way to restart the repl without restarting the whole process?

3:42 amalloy: well is there a way to restart the repl without restarting the whole process?

3:42 amalloy: not as far as i'm aware

3:42 not as far as i'm aware

3:44 longfin: m-x slime-list-connections to display connection list,

3:44 m-x slime-list-connections to display connection list,

3:45 amalloy: yeah, i just found that myself, under C-c C-x c

3:45 yeah, i just found that myself, under C-c C-x c

3:45 longfin: then m-x slime-quit-connection-at-point..

3:45 then m-x slime-quit-connection-at-point..

3:45 amalloy: longfin: that won't do anything because the swank server for that connection will still have all the same vars bound

3:45 longfin: that won't do anything because the swank server for that connection will still have all the same vars bound

3:46 longfin: uhm, you're right.

3:46 uhm, you're right.

3:47 amalloy: i need to get the hang of having more than one connection open; it's really a pain for me to work on more than one thing at a time currently :P

3:47 i need to get the hang of having more than one connection open; it's really a pain for me to work on more than one thing at a time currently :P

4:03 raek: angerman: it is often possible to repair the "damage"

4:03 angerman: it is often possible to repair the "damage"

4:04 for example by using ns-unmap and remove-ns

4:04 for example by using ns-unmap and remove-ns

4:12 krumholt: hello. will reset! block until the atom has changed? and is it possible that the order of evaluation will get changed if i do (reset! ...) @done and "done" is a promise i am waiting on?

4:12 hello. will reset! block until the atom has changed? and is it possible that the order of evaluation will get changed if i do (reset! ...) @done and "done" is a promise i am waiting on?

4:13 hiredman: atoms are synchronous

4:13 atoms are synchronous

4:15 raek: krumholt: when reset! returns, the change is done

4:15 krumholt: when reset! returns, the change is done

4:16 but the attempt to reset the atom may have been repeated

4:16 but the attempt to reset the atom may have been repeated

4:16 krumholt: ok thanks maybe there is my problem

4:16 ok thanks maybe there is my problem

4:17 raek: hrm

4:17 hrm

4:17 maybe reset! does not "repeat" after all

4:17 maybe reset! does not "repeat" after all

4:18 reset! results in a call to .set on an AtomicReference

4:18 reset! results in a call to .set on an AtomicReference

4:19 and there is no loop in the source code

4:19 and there is no loop in the source code

4:19 krumholt: ok

4:19 ok

4:19 raek: anyway, reset! is a function, so the argument you send it is only evaluated once

4:19 anyway, reset! is a function, so the argument you send it is only evaluated once

4:20 swap! simply invokes the function you pass it one or more times (still following the usual order of evaluation)

4:20 swap! simply invokes the function you pass it one or more times (still following the usual order of evaluation)

4:54 angerman: hmm. (prn [a b]) ;; => Don't know how to create ISeq from: java.lang.Integer

4:54 hmm. (prn [a b]) ;; => Don't know how to create ISeq from: java.lang.Integer

4:54 ?!

4:54 ?!

4:55 raek: ,(let [a 1, b 2] (prn [a b]))

4:55 ,(let [a 1, b 2] (prn [a b]))

4:55 clojurebot: [1 2]

4:55 [1 2]

4:56 angerman: reak. right now it makes no sense at all to me :/

4:56 reak. right now it makes no sense at all to me :/

4:56 raek: ,(let [[x y] 1] nil)

4:56 ,(let [[x y] 1] nil)

4:56 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

4:56 java.lang.UnsupportedOperationException: nth not supported on this type: Integer

4:56 angerman: ahh. i'm getting a nil...

4:56 ahh. i'm getting a nil...

4:56 raek: angerman: are you really sure that the exception originates from that code?

4:56 angerman: are you really sure that the exception originates from that code?

4:57 angerman: reak, yes, that's what the stacktrace sais.

4:57 reak, yes, that's what the stacktrace sais.

4:57 raek: ,(map inc 1)

4:57 ,(map inc 1)

4:57 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

4:57 java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer

4:57 clgv: ,(1 [a b])

4:57 ,(1 [a b])

4:57 clojurebot: java.lang.Exception: Unable to resolve symbol: a in this context

4:57 java.lang.Exception: Unable to resolve symbol: a in this context

4:58 clgv: ,(1 [2 4])

4:58 ,(1 [2 4])

4:58 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

4:58 java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

4:58 raek: the exception says that you are trying to feed an integer into a function that takes a seq

4:58 the exception says that you are trying to feed an integer into a function that takes a seq

4:58 clgv: oh ok thats different

4:58 oh ok thats different

5:01 angerman: jikes.

5:01 jikes.

5:01 apply is mean

5:01 apply is mean

5:01 __name__: good morning.

5:01 good morning.

5:01 angerman: hard to track down :/

5:01 hard to track down :/

5:02 __name__: you ment to enter #python?

5:02 __name__: you ment to enter #python?

5:02 ;D

5:02 ;D

5:02 waxrose: :P

5:02 :P

5:02 __name__: angerman: I do use Python, yes.

5:02 angerman: I do use Python, yes.

5:37 bartj: , (merge-with + ([:c 5] [:b 2] [:c 3]))

5:37 , (merge-with + ([:c 5] [:b 2] [:c 3]))

5:37 clojurebot: java.lang.IllegalArgumentException: Wrong number of args (2) passed to: PersistentVector

5:37 java.lang.IllegalArgumentException: Wrong number of args (2) passed to: PersistentVector

5:37 bartj: , (merge-with + '([:c 5] [:b 2] [:c 3]))

5:37 , (merge-with + '([:c 5] [:b 2] [:c 3]))

5:37 clojurebot: ([:c 5] [:b 2] [:c 3])

5:37 ([:c 5] [:b 2] [:c 3])

5:37 bartj: why doesn't it give ([:c 8] [:b 2])

5:37 why doesn't it give ([:c 8] [:b 2])

5:42 __name__: , (merge-with + ([:c 5] [:b 2] [:c 3]))

5:42 , (merge-with + ([:c 5] [:b 2] [:c 3]))

5:42 clojurebot: java.lang.IllegalArgumentException: Wrong number of args (2) passed to: PersistentVector

5:42 java.lang.IllegalArgumentException: Wrong number of args (2) passed to: PersistentVector

5:46 Chousuke: you need maps, not vectors. :/

5:46 you need maps, not vectors. :/

6:22 angerman: Catmull Clark and Doo Sabin subdivision with Clojure and jReality: http://dl.dropbox.com/u/281539/jReality-SubD-CC-and-DS-small.mov

6:22 Catmull Clark and Doo Sabin subdivision with Clojure and jReality: http://dl.dropbox.com/u/281539/jReality-SubD-CC-and-DS-small.mov

6:47 pyr: is there any standard document for coding style in lisp (or clojure)

6:47 is there any standard document for coding style in lisp (or clojure)

6:48 i use 2 space indent and let vim do the work mostly but wouldn't want to derive from an existing standard too much if there is such a thing

6:48 i use 2 space indent and let vim do the work mostly but wouldn't want to derive from an existing standard too much if there is such a thing

6:49 * angerman doesn't know, I let clojure-mode do the indentation, and use newlines where it assists reading.

6:49 * angerman doesn't know, I let clojure-mode do the indentation, and use newlines where it assists reading.

6:50 Bronsa: pyr: try this http://ddm.ace.ed.ac.uk/staff/michael/class/moz/cm/doc/contrib/lispstyle.html

6:50 pyr: try this http://ddm.ace.ed.ac.uk/staff/michael/class/moz/cm/doc/contrib/lispstyle.html

6:50 pyr: Bronsa: thanks

6:50 Bronsa: thanks

6:54 Dranik: hi all!

6:54 hi all!

7:04 pyrtsa: whois pyr

7:04 whois pyr

7:04 X)

7:04 X)

7:13 fliebel: morning

7:13 morning

7:21 kilo: trying to install counterclockwise, eclipse says "the repository seems to be empty" - am using tutorial listed in the googlecode page of counterclockwise - http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Eclipse_and_Counterclockwise

7:21 trying to install counterclockwise, eclipse says "the repository seems to be empty" - am using tutorial listed in the googlecode page of counterclockwise - http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Eclipse_and_Counterclockwise

7:21 can anyone help ?

7:21 can anyone help ?

7:22 octe: is there a convienence function for making a java.util.List from a seq?

7:22 is there a convienence function for making a java.util.List from a seq?

7:23 clgv: kilo: I installed mine from that location: http://updatesite.counterclockwise.googlecode.com/hg/

7:23 kilo: I installed mine from that location: http://updatesite.counterclockwise.googlecode.com/hg/

7:24 kilo: clgv: am i doing it right - help-software updates-available software - add site - put the url - ?

7:24 clgv: am i doing it right - help-software updates-available software - add site - put the url - ?

7:25 clgv: kilo: yeah. that's what I did

7:25 kilo: yeah. that's what I did

7:25 kilo: i get " No repository found at http://updatesite.counterclockwise.googlecode.com/hg/"

7:25 i get " No repository found at http://updatesite.counterclockwise.googlecode.com/hg/"

7:25 clgv: I have Eclipse 3.6.1 here

7:25 I have Eclipse 3.6.1 here

7:26 kilo: woops

7:26 woops

7:26 clgv: Help > Install New Software, I used "Add..." to add the url above

7:26 Help > Install New Software, I used "Add..." to add the url above

7:27 kilo: i'm on 3.4

7:27 i'm on 3.4

7:30 clgv: kilo: I can't tell if that might be a problem...

7:30 kilo: I can't tell if that might be a problem...

7:31 kilo: k

7:31 k

7:32 clgv: I just did a search for updates and it didnt report any failure

7:32 I just did a search for updates and it didnt report any failure

7:36 octe: ,(sort (comparator (fn [x y] (- y x))) '(1 9 5 2 3))

7:36 ,(sort (comparator (fn [x y] (- y x))) '(1 9 5 2 3))

7:36 clojurebot: (1 9 5 2 3)

7:36 (1 9 5 2 3)

7:36 octe: should'nt that work?

7:36 should'nt that work?

7:36 hm

7:36 hm

7:41 morphling: octe: comparator makes a comparator from a predicate

7:41 octe: comparator makes a comparator from a predicate

7:42 TimMc: amalloy_: Thanks for mentioning partially-ordered sets -- I found c.c.graph, which has a function to do something like a topo sort.

7:42 amalloy_: Thanks for mentioning partially-ordered sets -- I found c.c.graph, which has a function to do something like a topo sort.

7:42 spewn: ,(sort (comparator <) '(1 9 5 2 3))

7:42 ,(sort (comparator <) '(1 9 5 2 3))

7:42 clojurebot: (1 2 3 5 9)

7:42 (1 2 3 5 9)

7:43 octe: ah

7:43 ah

7:43 spewn: Why is there need to use a Comparator object, rather than just using the predicate directly?

7:43 Why is there need to use a Comparator object, rather than just using the predicate directly?

7:43 octe: actually, what i want to sort is a seq of java objects which have a date field

7:43 actually, what i want to sort is a seq of java objects which have a date field

7:44 and i want it sorted reverse chronological

7:44 and i want it sorted reverse chronological

7:45 clgv: that works well: ##(sort (fn [x y] (- y x)) '(1 9 5 2 3))

7:45 that works well: ##(sort (fn [x y] (- y x)) '(1 9 5 2 3))

7:45 sexpbot: ⟹ (9 5 3 2 1)

7:45 ⟹ (9 5 3 2 1)

7:46 octe: thanks

7:46 thanks

7:49 spewn: &(doc sort)

7:49 &(doc sort)

7:49 sexpbot: ⟹ "([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."

7:49 ⟹ "([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."

7:49 spewn: clgv: So why does that work?

7:49 clgv: So why does that work?

7:50 TimMc: ,(sort < '(1 9 5 2 3))

7:50 ,(sort < '(1 9 5 2 3))

7:50 clojurebot: (1 2 3 5 9)

7:50 (1 2 3 5 9)

7:50 clgv: spewn: I guess since it probably uses the comparator semantic internally. but to be sure you'd have to look at the source

7:50 spewn: I guess since it probably uses the comparator semantic internally. but to be sure you'd have to look at the source

7:51 $source sort

7:51 $source sort

7:51 sexpbot: sort is http://is.gd/EUo3np

7:51 sort is http://is.gd/EUo3np

7:52 Chousuke: IFn or AFn implements Comparator I think

7:52 IFn or AFn implements Comparator I think

7:52 spewn: Interesting... ##(.compare > 5 6)

7:52 Interesting... ##(.compare > 5 6)

7:52 sexpbot: ⟹ 1

7:52 ⟹ 1

7:52 spewn: Chousuke: That it does.

7:52 Chousuke: That it does.

7:52 * angerman starts to like quasiquoting.

7:52 * angerman starts to like quasiquoting.

7:56 powrtoc: Is there a problem AOTing records in clojure 1.2, if the namespace holding the record has a - in it??

7:56 Is there a problem AOTing records in clojure 1.2, if the namespace holding the record has a - in it??

7:58 I have a record in a namespace called foo-bar.baz (in directory foo_bar.baz), but when I AOT the record gets compiled to foo.Record rather than foo_bar.baz.Record

7:58 I have a record in a namespace called foo-bar.baz (in directory foo_bar.baz), but when I AOT the record gets compiled to foo.Record rather than foo_bar.baz.Record

7:59 clgv: powrtoc: the "-" is ok afaik but the "." could be a problem

7:59 powrtoc: the "-" is ok afaik but the "." could be a problem

8:00 powrtoc: cigv: really? how come?

8:00 cigv: really? how come?

8:00 java packages are traditionally . seperated, as are clojure namespaces

8:00 java packages are traditionally . seperated, as are clojure namespaces

8:01 clgv: oh right. but the directory should be "foor_bar/baz" then, I think

8:01 oh right. but the directory should be "foor_bar/baz" then, I think

8:01 s/foor/foo/

8:01 sexpbot: <clgv> oh right. but the directory should be "foo_bar/baz" then, I think

8:01 clgv: s/foor/foo/

8:01 sexpbot: <clgv> oh right. but the directory should be "foo_bar/baz" then, I think

8:02 powrtoc: clgv, That's what it is

8:02 clgv, That's what it is

8:02 clgv: ok, then misread you

8:02 ok, then misread you

8:02 powrtoc: oh sorry... my mistake, I mistyped it

8:02 oh sorry... my mistake, I mistyped it

8:02 the directories and namespace names are correct AFAIK

8:02 the directories and namespace names are correct AFAIK

8:03 where baz is a file (not a directory)

8:03 where baz is a file (not a directory)

8:03 s/baz/baz.clj/

8:03 s/baz/baz.clj/

8:03 sexpbot: <powrtoc> where baz.clj is a file (not a directory)

8:03 <powrtoc> where baz.clj is a file (not a directory)

8:04 powrtoc: and baz.clj defines my record Bleh ...

8:04 and baz.clj defines my record Bleh ...

8:05 but AOTing the namespace results in a class file identified by foo.Bleh rather than foo_bar.baz.Bleh (or foo-bar.baz.Bleh)

8:05 but AOTing the namespace results in a class file identified by foo.Bleh rather than foo_bar.baz.Bleh (or foo-bar.baz.Bleh)

8:05 clgv: powrtoc: I just checked my project, but I don't have records in this kind of namespace names.

8:05 powrtoc: I just checked my project, but I don't have records in this kind of namespace names.

8:05 powrtoc: I'm pretty confused

8:05 I'm pretty confused

8:10 clgv: did you try without "-" just to check if it's really the cause?

8:10 did you try without "-" just to check if it's really the cause?

8:10 powrtoc: no just trying that now

8:10 no just trying that now

8:10 it's just a PITA to rename namespaces in my project just now

8:10 it's just a PITA to rename namespaces in my project just now

8:11 clgv: you could make a dummy project therefor ;)

8:11 you could make a dummy project therefor ;)

8:11 powrtoc: I am :-) as we speak

8:11 I am :-) as we speak

8:12 Cozey: Hello. So the way to use clojure-contrib 1.3.0 alpha is to use specific clojure contrib modules in :dependencies ?

8:12 Hello. So the way to use clojure-contrib 1.3.0 alpha is to use specific clojure contrib modules in :dependencies ?

8:20 raek: Cozey: yes

8:20 Cozey: yes

8:20 Cozey: so i should build it from git and then mvn install-file them all?

8:20 so i should build it from git and then mvn install-file them all?

8:21 raek: Cozey: no, there are SNAPSHOT versions available

8:21 Cozey: no, there are SNAPSHOT versions available

8:21 Cozey: uhm? in what repository?

8:21 uhm? in what repository?

8:21 raek: well, you can compile it yourself, but the build server has probably already done it

8:21 well, you can compile it yourself, but the build server has probably already done it

8:21 the usual clojure one (leiningen uses it by default)

8:21 the usual clojure one (leiningen uses it by default)

8:22 http://build.clojure.org/snapshots/org/clojure/contrib/

8:22 http://build.clojure.org/snapshots/org/clojure/contrib/

8:22 powrtoc: ok, I can't get records to AOT properly in hyphenated namespaces at all

8:22 ok, I can't get records to AOT properly in hyphenated namespaces at all

8:22 raek: for instance: [org.clojure.contrib/sql "1.3.0-SNAPSHOT"]

8:22 for instance: [org.clojure.contrib/sql "1.3.0-SNAPSHOT"]

8:23 Cozey: raek: thanks! that's what i needed

8:23 raek: thanks! that's what i needed

8:23 powrtoc: just tried with two projects... one with a record in a namespace records.core, the other in a namespace called hyphenated-records.core ... both records are called Foo... in the hyphenated case I can never find a classfile on disk... I'm using leiningen to generate the projects

8:23 just tried with two projects... one with a record in a namespace records.core, the other in a namespace called hyphenated-records.core ... both records are called Foo... in the hyphenated case I can never find a classfile on disk... I'm using leiningen to generate the projects

8:24 the unhyphenated case works as expected

8:24 the unhyphenated case works as expected

8:25 clgv: so you should file a bug report on this.

8:25 so you should file a bug report on this.

8:36 tsdh: Hi. Can anyone tell me why my macro does only work in its own namespace? http://pastebin.com/p84cmExr

8:36 Hi. Can anyone tell me why my macro does only work in its own namespace? http://pastebin.com/p84cmExr

8:38 raek: tsdh: where is *schema-elems* defined?

8:38 tsdh: where is *schema-elems* defined?

8:39 tsdh: In the namespace of the macro, which is funql.core.

8:39 In the namespace of the macro, which is funql.core.

8:40 raek: what happens if you eval funql.core/*schema-elems* in that namespace?

8:40 what happens if you eval funql.core/*schema-elems* in that namespace?

8:40 powrtoc: yup

8:40 yup

8:41 raek: to me it looks like the macro does what it should, but that the var is somehow missing from funql.core

8:41 to me it looks like the macro does what it should, but that the var is somehow missing from funql.core

8:42 tsdh: raek: In both namespaces funql.core and funql.test.core it evals to the empty map. But why do I get the error when evaling the macro in funql.test.core?

8:42 raek: In both namespaces funql.core and funql.test.core it evals to the empty map. But why do I get the error when evaling the macro in funql.test.core?

8:42 raek: (the paste did not contain its def, so that's why I asked about it)

8:42 (the paste did not contain its def, so that's why I asked about it)

8:43 strange

8:43 strange

8:43 and funql.core is used/required in funql.test.core?

8:43 and funql.core is used/required in funql.test.core?

8:44 tsdh: Yeah, :use with :reload.

8:44 Yeah, :use with :reload.

8:45 (ns funql.test.core (:use [funql.core] :reload) ...)

8:45 (ns funql.test.core (:use [funql.core] :reload) ...)

8:48 raek: I cant's see anything in the paste that looks wring

8:48 I cant's see anything in the paste that looks wring

8:48 *wrong

8:48 *wrong

8:49 tsdh: could you post the files as they are?

8:49 tsdh: could you post the files as they are?

8:49 tsdh: raek: Do you have mercurial, then you can clone the project?

8:49 raek: Do you have mercurial, then you can clone the project?

8:51 raek: sure

8:51 sure

8:51 I just wanted to see the ns forms, the place where the macro is used and the place where the "missing" var is defined

8:51 I just wanted to see the ns forms, the place where the macro is used and the place where the "missing" var is defined

8:52 clgv: is there already implemented a function that checks whether a list of sets is pairwise disjoint?

8:52 is there already implemented a function that checks whether a list of sets is pairwise disjoint?

8:52 tsdh: raek: https://anonymous:secret@hg.uni-koblenz.de/horn/funql

8:52 raek: https://anonymous:secret@hg.uni-koblenz.de/horn/funql

8:53 clgv: tsdh: lol. very strong password ;)

8:53 tsdh: lol. very strong password ;)

8:54 tsdh: clgv: Any password for anonymous is strong, isn't it?

8:54 clgv: Any password for anonymous is strong, isn't it?

8:54 clgv: tsdh: it's only funny to read^^

8:54 tsdh: it's only funny to read^^

8:55 tsdh: raek: Now that is strange! I restarted swank, then compiled the code file, then the test file using C-c C-k in emacs/slime, and it worked. But any additional compile fails with the error.

8:55 raek: Now that is strange! I restarted swank, then compiled the code file, then the test file using C-c C-k in emacs/slime, and it worked. But any additional compile fails with the error.

8:55 raek: And "lein test" also fails with that error.

8:55 raek: And "lein test" also fails with that error.

8:56 raek: tsdh: also, I don't think you should have :reload in there

8:56 tsdh: also, I don't think you should have :reload in there

8:56 but I don't see why it should matter for this

8:56 but I don't see why it should matter for this

8:57 tsdh: raek: I used what lein new gave me. I'm clojure newbie. ;-)

8:57 raek: I used what lein new gave me. I'm clojure newbie. ;-)

8:57 raek: hrm, maybe it was :reload-all that was throwned upon...

8:57 hrm, maybe it was :reload-all that was throwned upon...

9:00 tsdh: *schema-elems* is not defined anywhere in funql.core

9:00 tsdh: *schema-elems* is not defined anywhere in funql.core

9:00 so there's your problem

9:00 so there's your problem

9:00 binding only dynamically rebinds the value of an *existing* var

9:00 binding only dynamically rebinds the value of an *existing* var

9:01 tsdh: Ahhrg! It's of course *schema-imports*!! :-)

9:01 Ahhrg! It's of course *schema-imports*!! :-)

9:01 OMG

9:01 OMG

9:01 raek: also note that in your macro, the value of *schema-imports* (in the assoc) is read at macroexpand time

9:01 also note that in your macro, the value of *schema-imports* (in the assoc) is read at macroexpand time

9:02 so *schema-imports* needs to be rebound when the macro is expanded

9:02 so *schema-imports* needs to be rebound when the macro is expanded

9:03 like (binding [*schema-imports* {:foo "bar"}] (defn with-schema-imports [...] ...))

9:03 like (binding [*schema-imports* {:foo "bar"}] (defn with-schema-imports [...] ...))

9:03 ...which looks very weird

9:03 ...which looks very weird

9:03 tsdh: raek: Hm, that's a good point, at least if one wants to use the macro in a nested fashon..

9:03 raek: Hm, that's a good point, at least if one wants to use the macro in a nested fashon..

9:04 raek: I don't know what the code does, but binding is a runtime construct

9:04 I don't know what the code does, but binding is a runtime construct

9:04 in a macro, you might even get away with using a let surrounding the syntax-quoted expression in some times

9:04 in a macro, you might even get away with using a let surrounding the syntax-quoted expression in some times

9:06 tsdh: raek: Wouldn't it be possible to let the macro expand to a (assoc *schema-imports* key val key2 val2), which is then evaluated first at runtime.

9:06 raek: Wouldn't it be possible to let the macro expand to a (assoc *schema-imports* key val key2 val2), which is then evaluated first at runtime.

9:06 raek: yes

9:06 yes

9:07 but since you used the value in the macro, I got the impression that you had the required information at macroexpansion time

9:07 but since you used the value in the macro, I got the impression that you had the required information at macroexpansion time

9:07 and if so, there's no reason to "delay" it to runtime

9:07 and if so, there's no reason to "delay" it to runtime

9:09 but I don't know what the code does and how

9:09 but I don't know what the code does and how

9:10 i.e. I don't know what I am talking about and you should take any advice with a grain/metric tonne of salt

9:10 i.e. I don't know what I am talking about and you should take any advice with a grain/metric tonne of salt

9:12 tsdh: raek: No, you are totally correct. When using the macro in nested fashon, the inner would completely erase the outer binding, which is not what I want. Committed and pushed a better variant.

9:12 raek: No, you are totally correct. When using the macro in nested fashon, the inner would completely erase the outer binding, which is not what I want. Committed and pushed a better variant.

9:18 anonymouse89: is there a way to decompose maps on keyword?

9:18 is there a way to decompose maps on keyword?

9:19 (or key, rather)

9:19 (or key, rather)

9:20 raek: anonymouse89: what do you mean by decompose? destructuring?

9:20 anonymouse89: what do you mean by decompose? destructuring?

9:20 AWizzArd: anonymouse89: {:keys [a b c]}

9:20 anonymouse89: {:keys [a b c]}

9:20 pjstadig: ,(map (fn [[k v]] (str "this is the key" k "this is the value v")) {:a :b :c :d})

9:20 ,(map (fn [[k v]] (str "this is the key" k "this is the value v")) {:a :b :c :d})

9:20 clojurebot: ("this is the key:athis is the value v" "this is the key:cthis is the value v")

9:20 ("this is the key:athis is the value v" "this is the key:cthis is the value v")

9:20 AWizzArd: ,(let [{:keys [a b c]} {:a 10, :c 30}] (prn a b c))

9:20 ,(let [{:keys [a b c]} {:a 10, :c 30}] (prn a b c))

9:20 clojurebot: 10 nil 30

9:20 10 nil 30

9:21 pjstadig: ,(map (fn [[k v]] (str "this is the key " k " this is the value " v)) {:a :b :c :d})

9:21 ,(map (fn [[k v]] (str "this is the key " k " this is the value " v)) {:a :b :c :d})

9:21 clojurebot: ("this is the key :a this is the value :b" "this is the key :c this is the value :d")

9:21 ("this is the key :a this is the value :b" "this is the key :c this is the value :d")

9:21 anonymouse89: raek: right, destructuring

9:21 raek: right, destructuring

9:21 I know about kwargs for fn's. I'm trying to destructure in a let statement

9:21 I know about kwargs for fn's. I'm trying to destructure in a let statement

9:22 like (let [[:a :b] {:a 1 :b 2}] (println a b))

9:22 like (let [[:a :b] {:a 1 :b 2}] (println a b))

9:22 (not valid of course)

9:22 (not valid of course)

9:23 raek: ,(let [{:keys [a b]} {:a 1, :b 2}] (format "a=%d, b=%d" a b))

9:23 ,(let [{:keys [a b]} {:a 1, :b 2}] (format "a=%d, b=%d" a b))

9:23 clojurebot: "a=1, b=2"

9:23 "a=1, b=2"

9:23 pjstadig: yeah just do what AWizzArd said

9:23 yeah just do what AWizzArd said

9:23 anonymouse89: okay, sorry for being silly. Thanks everyone!

9:23 okay, sorry for being silly. Thanks everyone!

9:23 raek: {:keys [a b]} is sugar for {a :a, b :b} (note the order of keywords and symbols)

9:23 {:keys [a b]} is sugar for {a :a, b :b} (note the order of keywords and symbols)

9:24 anonymouse89: raek: that makes much more sense now

9:24 raek: that makes much more sense now

9:24 raek: I thought it was magic

9:24 raek: I thought it was magic

9:24 raek: there's 'strs' and 'syms' also, when the variables should have the same name as a strings or symbols

9:24 there's 'strs' and 'syms' also, when the variables should have the same name as a strings or symbols

9:25 keywords are indeed the far most common useage, but clojure can have nay object as a key (and you can destructure with any object too)

9:25 keywords are indeed the far most common useage, but clojure can have nay object as a key (and you can destructure with any object too)

9:26 ,(let [{a System/out} {System/out 1}] a)

9:26 ,(let [{a System/out} {System/out 1}] a)

9:26 clojurebot: 1

9:26 1

9:30 semperos: just curious, does anyone here have cake working on Windows 7? I've made multiple attempts over time and have yet to be successful

9:30 just curious, does anyone here have cake working on Windows 7? I've made multiple attempts over time and have yet to be successful

9:36 fliebel: raek: Any news on thiudinassus?

9:36 raek: Any news on thiudinassus?

9:40 raek: fliebel: unfortunately not...

9:40 fliebel: unfortunately not...

9:41 fliebel: raek: So still phase one, is it?

9:41 raek: So still phase one, is it?

9:44 raek: yeah :)

9:44 yeah :)

9:44 fliebel: (I just noticed your assoc-once might update all keys up to the first one that fails)

9:44 (I just noticed your assoc-once might update all keys up to the first one that fails)

9:46 raek: but that intermediate map is never returned?

9:46 but that intermediate map is never returned?

9:46 fliebel: uh, right...

9:46 uh, right...

9:54 raek: Why are you using robert.hooke?

9:54 raek: Why are you using robert.hooke?

10:11 powrtoc: hmm.. I'm getting weird NoClassDefFound errors with proxy ... yet reevaluating things work

10:11 any ideas?

10:21 clgv: fliebel: do you know how to use robert.hook/append?

10:24 Cozey: I cannot run hiccup with clojure-contrib 1.3.0 - the as-str was moved from clojure.contrib.java-utils.. anybody?

10:27 oh it was replaced with name

10:33 appamatto: Howdy. I'm confused about the apparent contradiction between immutability and having access to Java objects (which are mutable)

10:34 Are Java objects viewed with suspicion in Clojure code?

10:34 raek: mutable ones, I guess so

10:35 chouser: I would say "handled with care" rather than "viewed with suspicion", but yes.

10:35 appamatto: hmm

10:35 What techniques are available to handle them with care?

10:36 chouser: Fortunately they're handled with care in the Java world as well, so there are a fair number of immutable objects available

10:36 appamatto: I see. So the idiom is to use immutable Java objects as much as possible?

10:36 (as opposed to mutable ones)

10:36 angerman: how do I upcase a character?

10:36 chouser: yes. And when not possible, there are some things you can do.

10:37 you can close over the mutable object so the only access to it is through your own functions

10:37 appamatto: Hmm, do you then do locking on it or some other synchronization?

10:38 powrtoc: Does anyone know why a call to proxy might generate a NoClassDefFoundError... the classpath looks correct

10:38 chouser: appamatto: sure

10:38 appamatto: or use an agent to serialize access (when pods are ready, they'll help here)

10:42 appamatto: chouser, thanks for explaining

10:47 powrtoc: is it possible just to AOT a record with leiningen rather than the whole namespace?

10:52 chouser: powrtoc: doubt it. you could put it in a separate namespace of course.

10:52 powrtoc: hmm probably not worth it

10:55 mefesto: Hey everyone. I'm using ring, moustache and lein-ring. I'm able to serve static files while running locally (lein ring server) but I cannot when deployed as a war file. Is there some middleware out there for this?

10:58 Or, is there a way to let requests that do not match any of the routes defined in moustache to fall-through to the web container?

10:59 pyr: mefesto: can't you do it through the web server ?

11:00 mefesto: i usually catch files that exist on disk in nginx and serve them

11:00 mefesto: and let the rest of the requests go to the application server

11:00 mefesto: pyr: i could but isn't the purpose of using a war is that you have a single thing to deploy?

11:01 pyr: i guess

11:02 mefesto: we have a bunch of other java web apps (spring/hibernate). so there is an existing setup that i'd like to continue to use.

11:02 TimMc: I can't figure out how to use http://richhickey.github.com/clojure-contrib/graph-api.html -- how do I create a graph object?

11:03 pyr: mefesto: makes sense, can't help you with that though

11:09 krumholt_: is there a swank-clojure version that works with clojure 1.3 ?

11:11 fogus`: TimMc: Check this out: https://github.com/richhickey/clojure-contrib/blob/ec6a7579d6b1c0bfa42e3666cfad196cffc966fe/src/main/clojure/clojure/contrib/datalog/softstrat.clj#L30

11:13 fliebel: clgv: Not yet, but it isn't to complicated…

11:13 clgv: fliebel: I handled it with a normal add-hook now ;)

11:15 TimMc: fogus`: THanks, I'll take a look.

11:22 krumholt_: when i try to use swank with clojure 1.3.0-master-SNAPSHOT and i do (require 'swank.swank) i get CompilerException java.lang.ClassNotFoundException: swank/clj_contrib/pprint$fn__643$pretty_pr_code_STAR___644, compiling:(swank/clj_contrib/pprint.clj:34). any ideas?

11:23 AWizzArd: krumholt_: did you try the latest version from http://clojars.org/repo/swank-clojure/swank-clojure/1.3.0-SNAPSHOT/ ?

11:24 krumholt_: AWizzArd, i pulled the latest version from github and built that with lein multi jar

11:27 AWizzArd, I just tried and i get the same error with the jar from clojars

11:33 AWizzArd: krumholt_: then maybe your Clojure version is very fresh?

11:34 Mine is just a few days old and works.

11:34 krumholt_: Maybe your Contrib version is too old.

11:35 krumholt_: i have the new clojure contrib 1.3 and haven't really figured out what parts i need for swank. i think there might be the problem

11:40 zippy314: ,(new String)

11:40 clojurebot: ""

11:41 zippy314: ,(let [q String] (new q))

11:41 clojurebot: java.lang.IllegalArgumentException: Unable to resolve classname: q

11:41 zippy314: why?

11:41 clojurebot: why not?

11:43 fliebel: dnolen: I noticed you implemented the zebra problem in Logos, are there any examples of, for example, sudoku, 8 queens, family stuff, etc… ? I might want to try a few of these. Especially sudoku.

11:45 dnolen: fliebel: someone did sudoku w/ Jim Duey's version. It would be useful to write regular Clojure versions and logos.minikanren versions of those puzzles and compare expressivity and performance.

11:45 zippy314: So my question given the above is how to create a factory where the object to be created by new is variable? What's the idiomatic clojure way of doing that?

11:46 fliebel: dnolen: I will see what i can do. I'm not sure yet if I want to see the other version, or figure it out myself.

11:46 AWizzArd: zippy314: you should reach around functions that create new objects, not classes

11:47 zippy314: if you just have a class c and want to create an instance of it then you will have to use reflection to find a constructor which you would like to call.

11:47 zippy314: AWizzArd: I'm not sure what you mean "reach around"

11:47 AWizzArd: ,(let [c #(String.)] (c))

11:47 clojurebot: ""

11:48 dnolen: fliebel: if you figure them out yourself, I'd be happy to add them to logos as examples for other people to refer to.

11:48 AWizzArd: zippy314: Well, I suppose you want to pass a class in, into some function, because your example seems to illustrate something. In a concrete program we would just write "" vs any of the other constructs, such as (let [c #(String.)] (c))

11:51 zippy314: AWizzArd: what I am working on is a factory function to which I want to pass a class name, and have it instantiate that class and a do stuff with it.

11:52 AWizzArd: zippy314: what arguments would you pass in to the constructor?

11:52 zippy314: AWizzArd: in particular the factory function adds stuff into the initialization parameters of the class, so it doesn't make sense to pass in a new instance. The whole point is that it's a "factory"!

11:53 AWizzArd: zippy314: well, a factory usually produces things of a specific concept. An apple tree produces apples. Your factory will produce what? All kinds of objects?

11:53 zippy314: AWizzArd: well, the idea is that its a factory for any number of polymorphic classes that all accept the same initialization params

11:54 AWizzArd: zippy314: if those classes are known at compile time a macro can help you to generate the factories. Otherwise you will have to do reflection.

11:55 zippy314: AWizzArd: In that example, my factory produces Trees, but it takes as a parameter Apple, Cherry, Oak, for the specific tree type, and passes in as a parameter, generic parameters liek "organic" "heirloom", etc.

11:56 AWizzArd: hmm I see, I can use a macro.

11:57 AWizzArd: Yes, a macro which can generate #(YourClass. ^YourHint1 arg1, ^YourHint2 arg2) and even name them.

11:58 A macro which runs through a loop and generates a bunch of defns for example which then instantiate your objects.

12:05 jkkramer: TimMc: there's also https://github.com/jkk/loom if you weren't aware of it

12:07 zippy314: AWizzArd: this seems to work: ,(defmacro znew [klass] `(new ~klass "fish")

12:07 angerman: jkkramer: interesting.

12:07 zippy314: ,(znew String)

12:07 clojurebot: java.lang.Exception: Unable to resolve symbol: znew in this context

12:07 TimMc: jkkramer: Thanks!

12:08 AWizzArd: zippy314: Yes, this is the basic step and perhaps already perfectly fine for your purposes.

12:08 angerman: hmm… maybe I could have based my mesh system on that graph lib. ahh well.

12:09 AWizzArd: zippy314: aternatively the znew macro can accept a name too and generate a `(defn ~yourname [arg#] (new ~class arg#)) or something like that, and automatically typehint arg#, so that no reflection is needed.

12:10 dnolen: fliebel: Jim Duey's version solves Zebra in abou 550ms, logos.minikanren in about 5ms. In some basic experiments it seems like many problems that can be solved with Clojure list comprehensions or map/filter/reduce are only about 8-10X slower. I'm interested in closing that gap.

12:10 zippy314: AWizzArd: I have to read about typehints, I haven't done that yet. Thanks!

12:11 AWizzArd: zippy314: if you won't generate too many instances it is not required here. But if your znew sits in a tight loop that creates 80k objects, then you want to typehint it.

12:11 fliebel: dnolen: I am about to start the Sudoku in Logos. I haven't even started to consider how to do it in plain Clojure.

12:11 zippy314: AWizzArd: ok, got it.

12:12 fliebel: dnolen: So Logos is certainly more optimized for programmers. Now we only need to optimize for computers as well :)

12:12 dnolen: fliebel: good luck. fingers crossed you don't run into any issues w/ conde. I'm still plugging away at that, but I really need a whole free day to sort it out, so perhaps sometime this coming weekend.

12:13 fliebel: dnolen: I'm feeling the same about it. The difference is that you understand what goes wrong, and I don't :(

12:14 dnolen: fliebel: wouldn't go that far. I'm realizing there are quite a few subtleties that I don't really understand ... yet.

12:17 zippy314: Macro question: this code works:

12:17 fliebel: dnolen: Has any-o f the syntax sugar landed yet?

12:17 zippy314: (defmacro name-hash-factory

12:17 "create a ref to a hash of named classes"

12:17 [klass names]

12:17 `(zipmap ~names (repeatedly (count ~names) #(new ~klass))))

12:17 (oops)

12:17 fliebel: zippy314: ah! you crossed the three-line paste alarm!

12:17 dnolen: fliebel: do you mean did I add any-o ?

12:17 technomancy: is it too github-centric to assume people are going to want a README.md file in new projects?

12:18 zippy314: (blush)

12:18 fliebel: dnolen: No, the I meant "any of", like destructuring.

12:18 zippy314: Here it is without the comment line:

12:18 (defmacro name-hash-factory

12:18 [klass names]

12:18 `(zipmap ~names (repeatedly (count ~names) #(new ~klass))))

12:18 That was only three lines!

12:18 TimMc: zippy314: Use gists on github, preferably.

12:18 Or don't use linebreaks.

12:18 fliebel: technomancy: The md part maybe, but readme is fine. I've seen github people use textile and plaintext as well.

12:19 dnolen: fliebel: no that's gotta wait for this conde stuff to get sorted out. Then I'll tackle the pattern matching stuff.

12:19 technomancy: fliebel: I'm just wondering since the first thing I do in every project I create is mv README README.md, and the skeletal README is in markdown anyway.

12:19 zippy314: ok. In any case that code works where the second parameter is a vector of names. If I want to collect all the remaining parameters as a vector using: &, it fails.

12:19 I.e this doesn't work: (defmacro name-hash-factory [klass & names] `(zipmap ~names (repeatedly (count ~names) #(new ~klass))))

12:20 why?

12:20 clojurebot: why not?

12:20 fliebel: dnolen: Okay, I was thinking it would make it really concise to express a sudoku grid.

12:20 dnolen: fliebel: yeah it would, you might want to wait until next week :)

12:20 AWizzArd: zippy314: you could try '~names

12:21 (zipmap (10 20 30) [:a :b :c]) <== 10 is not a function

12:21 fliebel: dnolen: Or do both, to compare the speed and lines of code.

12:21 zippy314: repeatedly takes a function.

12:22 AWizzArd: fliebel: he passed in a function

12:22 zippy314: AWizzArd: what does the ' do in front of the ~ ?

12:22 fliebel: AWizzArd: Oh, I'm misreading again I think :(

12:23 AWizzArd: zippy314: it quotes it, alternatively you can write (quote ~names)

12:24 zippy314: when you call (name-hash-factory String "a" "b" "c") then names will be ("a" "b" "c"). And as zipmap is a function the evaluation rule will have Clojure trying to call the function "a" with the args "b" and "c"

12:24 zippy314: AWizzArd: But isn't that just (quote (unquote names)) ? Why can't you just have names?

12:24 AWizzArd: zippy314: call (macroexpand-1 '(name-hash-factory String "a" "b" "c"))

12:25 zippy314: AWizzArd: I forgot macroexpand. That helps Thanks!

12:25 AWizzArd: (count ("a" "b" "c")) ==> Exception

12:25 (count '("a" "b" "c")) ==> 3

12:25 fliebel: dnolen: Can Logos express negation? As in 'x is not y'

12:26 dnolen: fliebel: someone did a Prolog in Ruby a few years ago, and at that time solving Zebra took 25000 milliseconds. logos.minikanren aims to be more usable than that.

12:26 fliebel: dnolen: Okay, I admit I have been readin abotu Prolog a bit :$

12:27 dnolen: fliebel: no, though I'll probably add disequality constraints. There are some papers on XSB that I should look into to get some ideas about how to do negation properly in Prolog.

12:28 or a Prolog like lang rather.

12:29 fliebel: dnolen: With disequality I could revive the decimal arithmetic.

12:29 dnolen: fliebel: ah interesting. it's really just a constraint that says something can never unify w/ something else.

12:32 fliebel: dnolen: adder-o uses 1>o to really check if something is 1> by checking the first bit, but the first bit would equal 0-9 for decimal, so I need a way to say 'not 1 and not 0', or I'd end up saying 'not 2, not 3 , not 4 etc…'

12:34 dnolen: fliebel: yeah it would be something like, (=/= x 1) (=/= x 0)

12:36 fliebel: I encourage you to dig into William Byrd's thesis at this point. It explains the whole machinery for miniKanren in 30 pages or so and it's good reading (more straightforward than TRS).

12:37 fliebel: dnolen: Does logos have underscore as an unbound value, or do I use (lvar) for that?

12:37 dnolen: Interesting...

12:37 krumholt_: did something about def change in 1.3 ?

12:38 dnolen: fliebel: doesn't have _ as unbound, but easy to achieve with clojure.contrib.macro-utils/symbol-macrolet

12:39 fliebel: zebra.clj in the logos project shows this.

12:39 fliebel: ah, I remember seeing that I think.

12:44 krumholt: ,(clojure-version)

12:44 clojurebot: "1.2.0"

12:44 fliebel: &(clojure-version)

12:44 sexpbot: ⟹ "1.2.0"

12:45 krumholt: can someone confirm that in clojure 1.3.0 the following will not create a macro (try (defmacro foo [a] `~a) 1)\

12:47 dnolen: krumholt: works fine for me. 1.3.0-alpha5

12:47 krumholt: dnolen, did you try (foo 1)

12:47 dnolen: krumholt: yup and macroexpand

12:48 krumholt: and (meta #'foo)

12:48 it all works.

12:48 krumholt: dnolen, i doesn't work for me

12:49 dnolen: krumholt: are you using a plain repl?

12:49 krumholt: yes

12:50 dnolen: krumholt: and alpha5 ?

12:50 krumholt: i am not sure. i just built from github

12:51 dnolen: krumholt: that's probably it.

12:55 krumholt: dnolen, i'll try it with alpha5

12:56 dnolen, just have to built it first

12:58 dnolen, thanks works fine in alpha5

13:00 amalloy: zippy314: for what it's worth, you don't have to name locals "klass" or "clazz" like you would in java. you can just call them class if you like

13:00 zippy314: amalloy: Thanks! I'm in the habit of that from ruby...

13:04 amalloy: clojure lets you shadow anything, even special forms (but don't shadow those; there are weird side effects)

13:04 but class is just a regular function, not a keyword, so the issue doesn't arise

13:04 TimMc: Not to be confused with actual side effects.

13:16 waxrose: Hello every body.

13:18 amalloy: TimMc: i am always confused with actual side effects. they're just so confusing

13:20 krumholt: is there a place to read up on changes from 1.2 to 1.3? i seem to be missing the doc function :)

13:21 amalloy: octe: (fn [x y] (- y x)) is just (comp - -)

13:38 * fliebel breaks his head over properties that a block of valid sudoku numbers possess that can be expressed real fast using unification

13:41 ejackson: ok fliebel, I'll fess up.... I wrote some blog posts on this some time back. Check out boss-level.com. You will find such a set of properties for sudoku there :)

13:43 fliebel: ejackson: hmmm, I'm not sure I want to see the complete solution just yet...

13:44 ejackson: i wouldn't call my obscurantist ramblings a 'solution' :P

13:46 fliebel: ejackson: Do you know how sets work with logos?

13:47 ejackson: nope - i did this pre logos, so using Jim Duey's miniKanren

13:47 fliebel: ejackson: The long way to figure out if a set is valid would be using member-o, but I think it would be quicker to use sets.

13:48 ejackson: i used member-o (or mem-o can't recall)

13:49 dnolen: fliebel: ejackson: one issue is that Prolog doesn't really have data structures beyond lists, they work well with relational programs.

13:50 I don't see how you could use sets relationally (maybe there's a way).

13:50 fliebel: dnolen: (== [1 2 3 4] #{1 2 3 4})

13:50 __name__: (&doc ==)

13:50 uhm

13:50 &(doc ==)

13:50 sexpbot: ⟹ "([x] [x y] [x y & more]); Returns non-nil if nums all have the same value, otherwise false"

13:51 dnolen: thus William Byrd talks about Purely Relational Data Structures, are there data structure optimized for relational use.

13:51 fliebel: __name__: This is another ==

13:51 * __name__ takes notes.

13:51 fliebel: dnolen: I thought you implemented unification with sets?

13:52 dnolen: fliebel: member-o - if you think about the computational cost, it's not good, you have to potentially traverse the whole list to determine membership. You don't have to do that with proper sets.

13:52 fliebel: I did, but how can you define member-o in terms of sets? (I'm not saying you can't, but I haven't seen how)

13:53 fliebel: dnolen: I don't need to, I just want to know if a list/vector is equal to #{1 2 3 4 5 6 7 8 9}

13:54 but (== [1 2 3 4] irc://irc.freenode.net:6667/#%7B1 2 3 4}) does not work.

13:54 The reason I mentioned member-o, is because it seems to be the only way to tell.

13:54 (i can think of)

13:55 dnolen: fliebel: you can't unify lists/vectors w/ sets. you can unify sets w/ logic vars in it with other sets.

13:56 and I'm not totally convinced I should even allow that - it's really slow.

13:57 fliebel: dnolen: Okay, so append-o is the way to go for validating a row of sudoku?

13:57 dnolen: fliebel: I'm saying I don't really know :) I'm just telling you what little I do know :)

13:59 fliebel: dnolen: Okay, I'll think some more, I don't like that using append-o would be quadratic time… I think

14:00 dnolen: fliebel: I think it makes sense to look at a Prolog solution, they've thought about these issues a lot more than I have.

14:01 fliebel: I see… truth is that prolog has fd_all_different

14:02 and prolog has inequality, which allows you to just say that everything is inequivalent.

14:03 dnolen: fliebel: ah, fd I think there stands for finite domain. constraint logic programming again.

14:03 fliebel: ejackson: could probably accomplish with disequality constraints.

14:03 too much to do.

14:04 ejackson: you and me boh

14:13 joelr: good day! assuming you did not define a java class, how do you refer to the .class of what clojure will generate?

14:14 i'm trying to replicate this bit of java:

14:14 public class ReutersIndexerFinished {

14:14 private transient static Log log = LogFactory.getLog(ReutersIndexer.class);

14:14 ReutersIndexerFinished.class bit

14:18 amalloy: joelr: just use clojure.contrib.logging. it automatically constructs and uses a logger for each namespace

14:18 joelr: amalloy: thanks!

14:19 amalloy: any examples of using that?

14:19 amalloy: the ".class of what clojure will generate" suggests some misunderstandings, too. clojure generates a class file for each *function*, not each namespace

14:19 joelr: <- newbie :-(

14:19 chouser: s/not/and also for/

14:19 amalloy: chouser: really?

14:20 fogus`: Track the progress of 1.3/2.0 http://dev.clojure.org/jira/secure/Dashboard.jspa?selectPageId=10014

14:20 chouser: amalloy: an *__init class

14:21 amalloy: joelr: https://github.com/Raynes/sexpbot/blob/master/src/sexpbot/plugins/log.clj is an example i happen to have on hand, but perhaps not a canonical one. it not only logs, but also provides functions for adjusting log levels for other namespaces

14:21 joelr: amalloy: thanks

14:22 amalloy: the get-logger function it's using is at https://github.com/Raynes/sexpbot/blob/master/src/sexpbot/utilities.clj#L83

14:22 chouser: fair enough

14:24 fliebel: dnolen: What does rember-o do? I have the faint feeling I need it.

14:26 dnolen: fliebel: returns different answers for a list with a particular item removed.

14:27 fliebel: dnolen: (rember-o 2 [1 2 3 4] out) (== out [1 3 4])?

14:31 dnolen: fliebel: answer is actually ((1 3 4) (1 2 3 4), TRS explains why.

14:32 fliebel: I don't rember reading that… Or wait, maybe I do...

14:35 * fliebel grabs TRS

14:41 fliebel: dnolen: They cover a few pages for ungrounded values, is it in there? Screening the page, I don't see why it would return (1 2 3 4) as well for a fully grounded list.

14:42 dnolen: fliebel: it's definitely in there - they need to explain why it keeps going.

14:43 fliebel: okay, reading closely now.

14:46 mattmitchell: anyone using netbeans + enclojure with a leiningen project?

14:53 brehaut: morning everyone

14:56 amalloy: 'lo brehaut

14:56 waxrosecabal: brehaut, morning/afternoon :D

14:56 brehaut: waxrosecabal: its always morning in UGT

14:56 amalloy: it's probably also always morning in NZ. you guys are weird

14:57 waxrosecabal: It's 2pm here. :)

14:57 amalloy: $google irc ugt universal greeting time

14:57 sexpbot: First out of 19 results is: UGT

14:57 brehaut: amalloy: its always the future

14:57 sexpbot: http://www.total-knowledge.com/~ilya/mips/ugt.html

14:57 amalloy: waxrosecabal: ^

14:57 brehaut: UGT?

14:57 clojurebot: ugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html

14:57 brehaut: thats the easy way :P

14:57 waxrosecabal: brehaut, XD

14:58 joelr: how do you translate file.getName().endsWith(".txt") to clojure? is it (.. file getName (.endsWith "txt")) ?

14:58 waxrosecabal: amalloy, It's always night time in my room. >.<

14:59 amalloy: joelr: close: you're mixing .. and ->

14:59 joelr: amalloy: oh...

14:59 amalloy: you could write (.. file getName (endsWith "txt"))

14:59 waxrosecabal: I should take my laptop outside so I can get a taste of the outside world.

14:59 joelr: amalloy: should i use -> instead?

14:59 amalloy: i prefer (-> file .getName (.endsWith "txt")) personally

14:59 because, among other things, it lets you add operations that aren't interop calls

15:00 joelr: amalloy: where can i read up on the difference?

15:00 amalloy: thanks

15:00 amalloy: &(macroexpand-all '(-> file .getName (.endsWith "txt")))

15:00 sexpbot: ⟹ (. (. file getName) endsWith "txt")

15:00 amalloy: &(macroexpand-all '(.. file getName (endsWith "txt")))

15:00 sexpbot: ⟹ (. (. file getName) (endsWith "txt"))

15:00 amalloy: er

15:00 i'm pretty sure that first macroexpansion isn't right

15:01 joelr: :D

15:01 amalloy: oh, i guess it's fine. i don't really know how the . special form works anyway :P

15:01 joelr: ok

15:01 fliebel: dnolen: They don't explain it very direct, but I think I can see how it just continues and concludes there is nothing else to replace, and returns the full list.

15:05 dnolen: fliebel: yeah, some of the finer points are implicit, makes the book good for multiple reads I suppose.

15:06 fliebel: -,- I've got other books waiting ;)

15:12 ouch, there got to be a better way than exist'ing 81 variables to get the cols, rows, and blocks

15:13 amalloy: fliebel: macros!

15:13 (don't know how they're relevant here but they solve everything)

15:14 fliebel: amalloy: You're right, do the list magic in clojure space, and blit it onto the unifications.

15:14 But defining all the list magic by cons and recursion is more interesting.

15:14 dnolen: fliebel: whatever you end up with, try to make it shorter than these, http://www.haskell.org/haskellwiki/Sudoku ;)

15:16 fliebel: dnolen: It's at least shorter than some of them. Although I'm not sure if that first block is just a snippet or a full solver.

15:17 Oh, if it says import sudoku, I guess it's not.

15:18 dnolen: Do you know if there is a place to find more miniKanren sequence stuff than is currently in logos/logic?

15:19 Stuff like cycle, take-nth and partition

15:21 dnolen: fliebel: not really, and I don't know enough of about Prolog to know how to define those or if they're even useful.

15:22 fliebel: hopefully you're realizing that I'm only like 1/4 step ahead of you on most of this stuff.

15:23 fliebel: ehm, no, I'm not. You're my miniKanren guru :P

15:24 dnolen: I think I can implement take and drop by means of rest-o, and go from there to implement take-nth, and maybe others.

15:25 But implementing clojure/core is going to make my sudoku quite long ;)

15:38 I can't do this stuff around this hour :(

15:41 mabes: hrm.. *command-line-args* doesn't appear to handle arguments in quotes as a single arg like most langs do.. e.g. foo "bar stuff" => ["foo" "bar" "stuff"]

15:41 fogus`: fliebel: Fun fun! https://gist.github.com/862962

15:42 fliebel: fogus`: Easy, easy, I just saw my first lines of prolog today.

15:46 fogus`: Oh, I actually understand it! :) I'm jealous at the ease at which they do I −1 :(

15:46 dnolen: fliebel: that's not relational tho. You can accomplish the same thing in miniKanren with project.

15:47 fliebel: dnolen: project?

15:48 dnolen: fliebel: it gets the value of logic var so you have a real value in a scope.

15:49 fliebel: dnolen: where do I get it?

15:49 dnolen: fliebel: it's in logos.nonrel

15:49 fliebel: what is nonrel abaout?

15:49 dnolen: non-relational operators

15:50 fliebel: neat

15:50 choffstein: Hey all. Does anybody here use enlive and can help me figuring out how to insert an image generated dynamically into my site?

15:51 I can't figure out how to use my templates to insert an image

15:53 dnolen: fliebel: actually you don't even need project I think, one day soon you'll be able to do this, https://gist.github.com/862975

15:53 clojurebot: #<RuntimeException java.lang.RuntimeException: java.lang.Exception: 503>

15:54 fliebel: dnolen: With that scheme pairs? yuk! but otherwise, great!

15:54 dnolen: fliebel: heh not scheme pairs, that just syntax sugar for unifying to LConsSeq

16:23 joelr: assuming i have a line-seq (from a file), is there a quick one-liner to join the lines in the file using space as a separator?

16:26 got it! (require '[clojure.string :as str])

16:26 and str/join

16:26 choffstein: If I have a Java object with a method that expects an input it will write to, but can I use it from clojure? e.g. I want to call ByteArrayInputStream's read method

16:26 clojurebot: ant clean and rebuild contrib

16:27 mattmitchell: what's the BEST clojure editor? I'm lost.

16:29 amalloy: emacs

16:32 raek: choffstein: one way could be to send it an http://download.oracle.com/javase/7/docs/api/java/io/PipedOutputStream.html

16:32 choffstein: Thanks raek

16:32 raek: how do you want to access the data?

16:33 another approach could be to proxy InputStream and make it conj the bytes onto a vector wrapped in an atom

16:36 nice, my ListModel proxy that watches a vector wrapped in an atom works!

16:53 zakwilson: clojure.xml/parse is throwing SAXParseException on a file containing "&#x0D" because it evidently doesn't like that. A bit of googling suggests that this character may not be allowed in XML. Regardless, it's in a file I want to parse. What, other than a search and replace can I do to parse the file?

16:56 waxrosecabal: amalloy, Are you using Emacs 24?

16:56 amalloy: 23

16:57 zakwilson: &#x0D; maybe?

16:57 zakwilson: amalloy: I left the semicolon out of what I typed. It's present in the file.

16:58 waxrosecabal: amalloy, Are you using anything else besides slime for clojure?

16:59 amalloy: waxrosecabal: not really. slime/swank, clojure-mode, and paredit-mode

17:00 mattmitchell: amalloy: thanks. good to know.

17:09 TimMc: waxrosecabal: pushed

17:09 Ash: WAX

17:10 waxrosecabal: TimMc, Cool.... I'm about to push an automated script I just made to build Emacs 24 (rather the trunk)... if you are interested

17:10 TimMc: Nah, I'll stick with 23.

17:10 * waxrosecabal lives on the edge.

17:10 TimMc: I'm too new at Emacs to go fiddling with it.

17:11 waxrosecabal: Vim user?

17:11 TimMc: nano :-P

17:11 waxrosecabal: nice :D

17:11 TimMc: Actually, gedit for everyday editing.

17:11 waxrosecabal: Didn't consider Vim plugins for Clojure?

17:11 I hear they are pretty decent.

17:12 fliebel: If I have a non-executable list inside a macro, what is the right way to make it a real list, instead of a function call?

17:12 TimMc: waxrosecabal: I was unfamiliar with both, so I chose the one with more parens.

17:12 Chousuke: fliebel: what do you mean?

17:12 spewn: fliebel: Quote it?

17:12 TimMc: fliebel: (list ...)

17:12 Chousuke: fliebel: if you want code from a macro to generate a list, then either generate (quote yourlisthere) or what TimMc said

17:12 waxrosecabal: lol

17:13 fliebel: Chousuke: (defmacro blah [] `(some stuff ~(range 10))) < crude example

17:13 Chousuke: fliebel: some stuff = list

17:14 with ~@ instead of ~ in range

17:14 fliebel: Chousuke: Problem is that range tells me that it can;t use an integer as a function.

17:14 Chousuke: fliebel: yeah because you'll be generting code that looks like (some stuff (1 2 3 4)) ...

17:14 you need the splicing unquote

17:15 or you can use quote if you have only literals

17:15 fliebel: ah, and then splice it into a list? (list ~@(range 10))

17:15 Chousuke: yeah

17:16 then the generated code would be (list 1 2 3 ...) which evaluates to what you want

17:18 fliebel: dnolen: Guess what, StackOverflowError

17:18 waxrosecabal: TimMc, Well if you ever become adventurous this is think link to it. It builds Emacs trunk onto an external drive but can be modified of course. https://github.com/waxrosecabal/install_scripts/blob/master/build_emacs.sh

17:18 amalloy: TimMc: i think my client barfed on me; i tried to say "TimMc: i wrote a blog post about why gedit is a sin and you should use emacs or vim, if you're looking to be made fun of"

17:19 TimMc: waxrosecabal: I'm upgrade-shy.

17:19 waxrosecabal: You must be an OpenBSD user.

17:19 lol

17:19 TimMc: amalloy: THen you'll love this: I used to use Textpad 4 under Wine once I switched to Linux.

17:19 amalloy: nice

17:20 i used textpad when i was learning java

17:20 TimMc: It's actually a damn good editor.

17:20 amalloy: i was like "omg this is so much better than notepad"

17:20 and it was

17:20 TimMc: It's true!

17:20 And yet very bare-bones -- it didn't try to be an IDE.

17:20 amalloy: textpad is roughly like gedit

17:20 notepad is like...some kind of braindead version of either

17:21 waxrosecabal: Why not just use mousepad or even leafpad?

17:21 TimMc: Regex, LRU tabs, macros, external commands, basic syntax highlighting -- what more did I need? :-)

17:21 amalloy: And yet notepad has some of the best Unicode support you'll see anywhere.

17:21 *MRU tabs

17:22 __name__: TimMc: What makes its Unicode support better?

17:23 TimMc: Oh, I've just heard it is one of the most conforming applications to the Unicode standards.

17:23 dnolen: fliebel: for your sudoku solver?

17:23 TimMc: This was when I worked at Basis Technology, which does i18n and low-level linguistics processing.

17:24 waxrosecabal: Maybe since I've been a GNU/Linux user for 10+ years, I never did like notepad.

17:24 fliebel: dnolen: yea

17:24 TimMc: waxrosecabal: Notepad is shitty. It's the most basic thing you can have and still call an editor. That's all it was intended to be, though.

17:24 I don't think anyone *likes* it.

17:25 __name__: Masochists?

17:25 amalloy: raymond chen has an article somewhere about how notepad always puts the BOM in for UTF-8 documents even if you only use single-byte characters

17:25 waxrosecabal: TimMc, I find that every time I used notepad then transfered a file over to my Linux.... the file would be infested with "M^"

17:25 dnolen: fliebel: yeah, honestly I'd relax on logos until I'm 100% sure that I have a correctly functioning base. Or you could starting reading Byrd's paper and help me out ;)

17:25 amalloy: waxrosecabal: that's not really anything to do with notepad

17:26 windows uses \r\n as line terminators; unix uses \n

17:26 waxrosecabal: amalloy, Hmm

17:26 amalloy: you can configure decent editors (eg textpad) to use either

17:26 waxrosecabal: I don't really know much about Windows so it would always piss me off.

17:26 fliebel: dnolen: Hum, both seem a good idea :) I'll think about it.

17:26 amalloy: *laugh*

17:26 waxrosecabal: lol

17:26 TimMc: amalloy: Oh yeah, the BOM was annoying.

17:27 My code got BOMbed more than once.

17:27 __name__: Storing metainfo inline is evil :(

17:27 We just need file meta info … profit!

17:33 duncanm: i'm using SLIME, and i have a few agents in the REPL

17:33 joelr: what is the 1.2 replacement for duck-streams' reader?

17:33 duncanm: what happens if one of the agents calls 'println'?

17:33 where does it go?

17:34 i made call Toolkit.getDefaultToolkit.beep, so i know the function is running, but i can't see any output

17:34 joelr: found it

17:35 duncanm: ahhh

17:35 http://stackoverflow.com/questions/5132225/how-to-capture-stdout-log-output-of-an-agent-in-slime

17:37 raek: i usually eval (alter-var-root #'*out* (constantly *out*)) in the emacs slime repl

17:37 duncanm: raek: have you tried elein?

17:39 dnolen: fliebel: I could use the help. Ultimately I want to see if a Clojure type checker can be built.

17:41 raek: duncanm: haven't tried it. is it similar to durendal?

17:41 fliebel: dnolen: It'd be fun, but also demanding and time consuming :) A type checker?

17:42 dnolen: fliebel: logic programming makes such things less demanding and time consuming.

17:43 duncanm: raek: haven't heard from durendal either

17:44 dnolen: fliebel: Qi has a pretty interesting take on types based on sequent calculus. Would be fun to give a shot that.

17:45 fliebel: dnolen: I don't know Qi, but I believe you. *googles sequent calculus)

17:45 oh, to late to understand that type of stuff :(

17:48 dnolen: Yup, I think I ran into the same issue again… https://gist.github.com/863180 a full board runs fine.

17:49 dnolen: fliebel: noted.

17:53 ossareh: anyone in SF going to the clojure meetup tomorrow at backtype?

18:05 amalloy: ossareh: you can see who's attending from the meetup page

18:05 i don't see george jahad on that list, but he told me he's going as well

18:06 rata_: should I send a fn to an agent from a fn send to an agent?

18:06 *sent

18:06 TimMc: rata_: I don't think that's unusual.

18:06 rata_: there's no problem with retries and send?

18:08 TimMc: rata_: I believe that transactions are send-aware.

18:08 rata_: TimMc: so should I put the send in a dosync?

18:08 TimMc: err

18:08 I don't really know.

18:09 brehaut: rata_: you only need to put send in a dosync if its related to atransaction on STM refs

18:09 TimMc: Forget what I said about transactions...

18:09 patrkris: rata_: depends on whether you need to do send an action to an agent, when the transaction completes

18:09 brehaut: aside from that, i dont think there is any problem with sending an action to one agent from another

18:09 TimMc: Agent actions don't get retries, do they?

18:10 That's just transactions?

18:10 raek: correct

18:10 patrkris: no, they're only sent when the transaction commits succesfully

18:10 raek: also, sends from an agent action are held until the action completes successfully

18:11 TimMc: raek: Ah, that's right.

18:11 rata_: oh ok, thanks you all =)

18:11 raek: ,(doc release-pending-sends)

18:11 clojurebot: "([]); Normally, actions sent directly or indirectly during another action are held until the action completes (changes the agent's state). This function can be used to dispatch any pending sent acti...

18:14 rata_: I forgot to say I'm sending an action to the same agent executing the action, but probably that doesn't change anything

18:15 tsdh: Hi

18:16 TimMc: rata_: Correct.

18:16 tsdh: Is there a way to free the memoization cache of some memoized function explicitly?

18:16 TimMc: tsdh: What for, to regain memory?

18:17 brehaut: tdsh: not with the default implementation

18:18 tsdh: the implementation in The Joy of Clojure provides that feature (the cache is attached as metadata to the fn)

18:18 and you might find something in https://gist.github.com/747395 that is useful

18:18 tsdh: TimMc: I use memoize to circumvent expensive calculations that were done before. However, the calculations can produce a by-product, and when you want to have that, then the calculation has to be performed.

18:18 TimMc: A side effect?

18:19 Sounds like a bad idea.

18:19 amalloy: tsdh: don't do it that way

18:19 TimMc: tsdh: You'll make amalloy cry!

18:19 (me too, for that matter)

18:19 amalloy: (defn expensive-function [args] (do stuff with args)) (defn cached-function [] (memoize expensive-function))

18:19 tsdh: TimMc: Yes. I calculate reachable vertices in graphs. A not too cheap side effect is the calculation of shortest paths.

18:20 amalloy: then whenever you want a new cache you can call cached-function and throw away your old cached version

18:20 tsdh: amalloy: Hm, that doesn't sound bad...

18:21 TimMc: tsdh: Wait, are you actually using side effects, or do you just produce several results?

18:21 amalloy: ie, (cached-function) will return a new version of expensive-function with an empty cache; keep that around for as long as you want

18:23 tsdh: Well, I think I should think about my design a bit. ;-)

18:23 Thanks for the hints.

18:26 One other thing. Can I create a dynamic binding without def-ing it before?

18:28 amalloy: tsdh: kinda-sorta. see ##(doc with-local-vars)

18:28 sexpbot: ⟹ "Macro ([name-vals-vec & body]); varbinding=> symbol init-expr Executes the exprs in a context in which the symbols are bound to vars with per-thread bindings to the init-exprs. The symbols refer to the var objects themselves, and must be accessed with var-get and var-set"

18:29 amalloy: and also (declare foo) is basically like (def foo) without a value; creates a global var with no initial binding

18:29 tsdh: amalloy: Great

18:51 TimMc: Leiningen puts out reflection warnings for dependencies when I compile (with :warn-on-reflection) -- can anybody think of a situation where this would be desirable?

18:54 powrtoc: TimMc, what having reflective calls??

18:56 TimMc: powrtoc: I don't understand your question.

18:57 powrtoc: TimMc, I didn't understand yours... are you asking when is having reflective calls desirable?

18:57 as opposed to type-hinted ones?

18:57 mesh: I want to make a function that translates [0 1 0 1] to [1 3], and [0 1 1] to [2 3] (so the indexes of the 1's), is this possible without writing the loop myself?

18:57 TimMc: No, I'm asking about the desired scope of Leiningen's :warn-on-reflection option.

18:58 hiredman: ,(doc indexed)

18:58 clojurebot: Excuse me?

18:58 TimMc: WHen enabled, it should clearly emit reflection warnings for the main source code. The question is, should it also emit warnings for reflection encountered in :dependencies.

18:58 hiredman: ,(doc keep-indexed)

18:58 clojurebot: "([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects."

18:59 powrtoc: TimMc, ahh..... yes I think they might make sense... as a reflective call in a dependency is still a potential performance problem

19:01 technomancy: TimMc: if there is a way to do that I'm all ears

19:02 TimMc: technomancy: It currently does that, as far as I can tell.

19:03 powrtoc: hmm... I have some problems with AOT/lein... when I build an uberjar featuring a proxy call, it bombs out with a NoClassDefFoundError for the proxied class

19:03 I don't really understand it... I thought proxies were a runtime class

19:03 amalloy: &(keep-indexed #(and (= 1 %2) %1) [0 1 1] )

19:03 sexpbot: ⟹ (false 1 2)

19:03 technomancy: TimMc: I mean if there's a way to get it turned on just for your project, I'm not aware of it

19:04 TimMc: technomancy: Ah, got it.

19:04 amalloy: &(keep-indexed #(when (= 1 %2) %1) [0 1 1] )

19:04 sexpbot: ⟹ (1 2)

19:04 amalloy: mesh: ^ fleshes out hiredman's suggestion

19:04 powrtoc: but I need to gen-class the namespace so I can start it with a simple java -jar foo.jar

19:04 TimMc: Oh right! Because the compiler goes back and forth and every which way when compiling, and leiningen can't turn warn-on-reflection on and off in the process.

19:05 mesh: hiredman: amalloy: I think I have found something on the net about an indexed and index-filter function

19:05 powrtoc: I'm not sure if this is an AOT issue or a leiningen issue

19:11 technomancy: powrtoc: depending on your needs you could look at using a shell-wrapper to launch; see leiningen's tutorial

19:14 powrtoc: technomancy, Yeah I saw that... and not AOTing does solve the issue... but a shell wrapper forces the other end to use leiningen... and adds another moving part...

19:14 technomancy, is this a known issue with AOT and proxy??

19:14 technomancy: yeah, it's a half-way solution

19:14 I haven't heard of it, but I don't do much aot. are you on the latest lein?

19:14 powrtoc: 1.4.0

19:15 technomancy: worth upgrading to 1.4.2, but I don't know if that'll fix it

19:15 powrtoc: updating now

19:16 it looks like for some reason calls to proxy, even (proxy [Object] [] (toString [] "foo")) in an AOT'd namespace fail when built with lein

19:17 technomancy: if you can repro on the latest git, please open an issue

19:17 powrtoc: I'm not sure if lein is stripping out the funny looking proxy classes from the build, or if it's a clojure thing

19:18 but at runtime clojure definitely expects to see a class on the classpath, and it aint there

19:18 amalloy: are you sure there are no stale class files from previous AOT runs causing conflicts?

19:18 that usually winds up being the issue when someone has an AOT problem in #clojure

19:20 powrtoc: amalloy, yeah, I clean each time

19:20 and I think uberjar cleans automatically

19:20 (by default anyway)

19:23 technomancy: there was a brief period where leinigen removed non-project .class files, but this broke protocol usage since AOT semantics for protocols are different from everything else in clojure

19:25 powrtoc: technomancy, amalloy: Here's the error and reproducible test case https://gist.github.com/863309

19:26 amalloy: ooo i got a highlight on a leiningen bug. it's almost as if someone in #clojure thinks i know anything about leiningen (really i just ping technomancy when someone has an issue)

19:26 powrtoc: technomancy, yeah, I saw that mentioned somewhere... but now that doesn't happen right?

19:27 hmmm 1.4.2 seems to have fixed it...

19:27 need to try it again on my real project

19:27 to be sure

19:28 yeah, that proxy class now exists... but 1.4.0 didn't generate it!

19:30 technomancy: yeah, the fix was released soon after 1.4.0

19:30 luckily upgrading is really easy.

19:31 powrtoc: technomancy, yeah you've done a reaalllyy nice job with the upgrade process etc..

19:32 technomancy: actually that wasn't me.

19:32 was another seajure dude.

19:32 powrtoc: well you did a really fine thing in merging the patch! :-)

19:34 tufflax: What does "(?i)" mean in this regex: (re-seq #"(?i)[fq].." "foo bar BAZ QUX quux") => ("foo" "QUX" "quu")

19:34 amalloy: tufflax: turn on case insensititivity

19:35 tufflax: ok, thank you

19:35 amalloy: (also: disable counting of I and T characters cause they're so damn fun to type, apparently)

19:35 powrtoc: leiningen is probably my favourite of all build tools on any platform... it's nice and simple, fosters a good workflow, and works

19:36 my only real problem with it is more a problem of managing dependencies and transative dependencies with clojars

19:36 TimMc: amalloy: Classic banananana error.

19:36 hiredman: powrtoc: and very easy to extend and hack on

19:36 amalloy: heh, indeed

19:37 it's a good thing i didn't need to spell dakry too

19:37 powrtoc: hiredman, yeah that too!

19:37 hiredman: I had a project that needed to generate a file in the META-INF directory in the gernated jar, so I just put a few lines in the project.clj that hooked the lein jar task

19:38 powrtoc: technomancy, ok it works on my real project too! Thanks for your help... I didn't realise 1.4.2 was out

19:38 uberjars r us!

19:38 technomancy: 1.5.0 right around the corner; watch out

19:39 powrtoc: technomancy, yeah, I saw the post

19:40 does anyone here use either aleph or cljque?

19:41 TimMc: technomancy: warn-on-reflection fix for repl will land on 1.5.0?

19:43 technomancy: TimMc: yeah; if you'd like to confirm it by running from git that'd be great.

19:43 powrtoc: Basically I've written a stomp broker using raw netty... and I know to do so I've recreated a small part of aleph (and possibly cljque), but it was just easier to use netty early on as it's well documented compared to aleph etc...

19:45 anyway, I was originally thinking I'd like to port it to aleph... but then I saw aleph was built around lamina but that cljque is a competing project/concept.... and cljque's RX inspiration makes me think it's a superior approach overall... what's the communities opinion>

19:45 ?

19:51 hiredman: cljque has a horrible name

19:56 technomancy: "cudgel-k-you", like it's a threat.

19:58 hiredman: but I ma not super fond of aleph, I haven't used either, but I think I would lean towards cljque style if not cljque

20:02 powrtoc: hiredman, yeah it really does

20:04 hiredman, well I've recently done a lot of research into RX which is freakin' awesome (the best thing out of microsoft in years) and I'd love to see something like that gain traction with the clojure community

20:04 I'm really just wondering which camp is the best to invest some time into

20:05 problem is that my server might actually be deployed in production at some point... so picking something really experimental might be a bad idea

20:06 brehaut: powrtoc: http://dev.clojure.org/display/design/Channels

20:06 WRT to the longer term

20:07 danlarkin: In the same way that commute allows for "more concurrency" than alter, does alter allow for more than ref-set?

20:07 hiredman: brehaut: it's wiki, doesn't mean rich has commited to anything

20:07 amalloy: danlarkin: ref-set barely allows for any concurrency

20:07 danlarkin: but why less than alter?

20:08 amalloy: i mean, it "allows for more", maybe, because the STM will let multiple threads set a ref if none of them read from it

20:08 powrtoc: brehaut, thanks for that... I've been trying to find that link again... note rich hickeys first comment... "no one should do anything without fully understanding RX"

20:09 that's my concern with aleph

20:09 danlarkin: I understand why commute > alter -- because you're telling the stm that operations are commutative, but alter makes no such guarantee

20:09 amalloy: but if you are reading from a ref, then writing to it based on that value, it seems horrible and evil to use ref-set

20:09 and if you actually did read from it earlier in the transaction with @ref, i don't think you'd even gain anything from doing it that way

20:09 hiredman: commute is an optimization, when in doubt use alter

20:10 technomancy: I'd be surprised if ref-set allowed for reordering behind the scenes.

20:10 without mentioning it at least.

20:11 danlarkin: ok, now part two of my thinking,

20:12 lets say I have a transaction similar to this, (dosync (delete :dan) (add :dan2))

20:12 easy enough to do that with two alters

20:13 assuming delete and add modify the same ref

20:13 but! how to represent that with one single alter

20:13 hiredman: I don't follow

20:14 danlarkin: well delete dissocs and add assocs, let's say

20:14 hiredman: (alter (ref ...) (fn [...] (-> ... (conj :dan2) (disj :dan))))

20:15 * amalloy doesn't type fast enough to get code samples in, apparently

20:15 danlarkin: ah

20:15 yes

20:15 that's indeed what it would be

20:16 Hm

20:16 I think I'm still confused about how alter can allow for more concurrency than ref-set

20:18 amalloy: danlarkin: you are coming at this from the wrong perspective. "allow more concurrency" is not really relevant here: the issue is that alter can be based on a pure function, while using ref-set puts concurrency code all over your program

20:19 technomancy: danlarkin: deref + ref-set introduces a window for a race condition

20:20 danlarkin: why is ref-setting a ref to 5 different than (alter r (fn [r] 5))

20:20 amalloy: danlarkin: it's not. they're both evil

20:21 technomancy: right; there's only a race if you're ref-setting to a value based upon an earlier read.

20:21 hiredman: a read outside of the transaction

20:21 danlarkin: technomancy: not if you're doing it inside a transaction, which would be the only valid way to do that

20:21 technomancy: right; if you do it inside the transaction, it could result in a retry, not an invalid value.

20:22 it's not _that_ racy.

20:22 danlarkin: I just don't see how it's any different than alter

20:23 amalloy: danlarkin: (dosync (let [x @foo] (ref-set foo (inc x)))) vs (dosync (alter x inc)). why would you ever do it the first way?

20:23 er, alter foo inc, whatever

20:23 danlarkin: oh, you wouldn't for sure

20:23 but, they're equivalent, right?

20:24 amalloy: from the computer's point of view? probably

20:24 danlarkin: in every single way, except for how the code reads

20:24 amalloy: but the code reads worse in so many different ways

20:24 danlarkin: I'm totally with you on that

20:25 amalloy: okay. so your question is "does one of these constructs have better performance"?

20:25 danlarkin: basically

20:25 amalloy: afaik, no

20:26 technomancy: there's a slightly larger window in which a retry could be triggered

20:27 danlarkin: technomancy: how, though

20:27 amalloy: technomancy: i'm not sure about that...the retry will happen at the end of the dosync, not the end of the alter, right?

20:27 * amalloy has a much better understanding of atoms than refs

20:28 technomancy: I guess it's probably only practically larger if there's something going on between the deref and the set

20:29 amalloy: I think it can retry as soon as it knows something is awry

21:06 TimMc: technomancy: How do I get lein 1.5.0 shell script? (I've checked out the repo.)

21:07 technomancy: TimMc: it's in bin/lein

21:07 TimMc: That script complains about missing deps.

21:08 ./bin/lein deps does too.

21:09 technomancy: right; you should be able to use your existing leiningen to get deps for it; see "Building" in the readme.

21:10 if you have suggestions for a way to make that clearer I would like to hear it; for some reason it trips up a lot of people, but I am not sure what is confusing about it.

21:10 TimMc: Oh! Ha, OK.

21:12 I see it in the Building section now.

21:13 tufflax: Coordinated change (as in refs are but atoms are not coordinated) does that mean that I am able to change several refs at the same time atomically? Have I understood this correctly?

21:13 brehaut: tufflax: yes

21:13 tufflax: ok, good :)

21:13 thank you

21:15 TimMc: tufflax: Just note that refs you only read from may be written to by another transaction.

21:15 (though you will see a consistent state *during* a given transaction)

21:17 technomancy: I can confirm that lein master fixes the REPL warn-on-reflection problem. In fact, it also seems to turn warn-on-reflection *on* properly in the REPL, which it didn't before.

21:35 tufflax: I'm a little bit confused by vars. Just, for the sake of argument say that I would like a counter of something, so I do (def counter 0). That creates a var right? But I can't use set-var! on it because that changes the root-binding. Should I use atoms or agents instead for that kind of thing? I'm not sure I have understood what vars should be used for exactly.

21:36 brehaut: tufflax: you shouldnt really use vars as changable refs, an atom would be a much better choice in the context of a counter

21:36 tufflax: ok

21:36 brehaut: vars have more of a role in the defining namespaces and such than as a 'variable' for your program (this is a terrible explaination. hopefully someone smarter can correct me)

21:37 hiredman: vars provide storage for things in a namespace

21:37 tufflax: hehe i think im beginning to understand... i read something like that in the doc for (binding ...)

21:38 mec: As I understand it vars are for thread local changes. So if you only have one thread you could use vars, multiple threads use atoms

21:38 hiredman: vars happen to provide dynamic thread-local rebinding

21:38 but as of 1.3 not all vars do

21:38 tufflax: But in the example i had with a counter, even if i have a single thread, a var seem like a bad idea.

21:38 ...mec

21:38 hiredman: right

21:39 outside of developement vars should be treated as immutable

21:40 tufflax: yeah ok, i think i have a pretty clear understanding now, thank you

21:43 TimMc: $findfn :foo true

21:43 sexpbot: [clojure.core/keyword? clojure.core/== clojure.core/distinct? clojure.core/boolean clojure.core/< clojure.core/= clojure.core/> clojure.core/>= clojure.core/<= clojure.core/ifn?]

21:45 mec: https://gist.github.com/a5a7b994cdb3774e1843 these perform identically so is one more idiomatic, or even a builtin i've overlooked?

21:52 tufflax: I though '!' in names are used to signify impurity/side effects, so how come 'send', for example, is not 'send!'?

21:53 brehaut: mec: summation is much more simply (defn summation [f n] (apply + (map f (range n))))

21:54 amalloy: brehaut: i think he's just using summation as an example of his accumulate HOF

21:54 mec: yup

21:54 brehaut: ok sure

21:55 excuse me while i grab this by the wrong end

21:55 TimMc: tufflax: I think ! is used to distinguish between pure and impure versions of the same algorithm.

21:55 ...or when side effects are not otherwise obvious from the name.

21:55 brehaut: mec: it smells to me like a wonky way of writing hylomorphism

21:56 but hylomorphism is not idiomatic clojure

21:56 tufflax: TimMc but 'send' doesn't seem more obvious than 'swap!' :P

21:56 clojurebot: :negative/num-1 + :positive/num-1 = :zero/zero

21:57 brehaut: mec: where hylomorphism is an unfold into a fold, but we dont have an off the shelf unfold in clojure that i am aware of

21:57 amalloy: mec: i don't 100% follow how accumulate works, but i don't think it's necessary for me to. i (a) hate acc3, (b) would wrote acc1 myself, (c) think acc2 is the best

21:58 i'm not sure why you've hardcoded <= though. it seems to limit usefulness for no particular reason

22:00 mec: I don't think i've ever heard that term before

22:00 amalloy: mec: it's what crazy haskellers/mathematicians say instead of unfold

22:00 brehaut: amalloy: its not just unfold!

22:00 mec: what is unfold? :D

22:01 amalloy: mec: unfold is the opposite of reduce

22:01 https://gist.github.com/805583

22:02 disclaimer: whenever i say something ending in "orphism", brehaut is the one who is actually right

22:02 brehaut: map is a catamorphism, right?

22:03 brehaut: i believe so

22:03 * amalloy gives himself a pat on the back

22:04 brehaut: wait sorry, no catamorphism is fold

22:04 anamorphism is unfold

22:06 * TimMc just wrote (partial map assoc) in his code and is feeling good

22:06 mec: amalloy: i agree that acc2 looks the best but would probably write 1 anyway

22:06 tufflax: If unold is the opposite of reduce, is fold and reduce the same thing? Also, I at first thought unfold was the same as unsplice (as in picking things out of a collection); I think I've heard it used that way before.

22:06 amalloy: yes, reduce and fold are synonymous

22:07 well. there's foldr and foldl, which refer to whether you do (+ (+ (+ 1 2) 3) 4) or (+1 (+ 2 (+ 3 4)))

22:07 and i can never remember which is which, but clojure uses the one that lets you consume the sequence lazily

22:08 brehaut: the lazy one is left

22:08 which i think is the former

22:08 amalloy: certainly the former is what clojure does

22:09 &(reduce (partial list '+) [1 2 3 4])

22:09 sexpbot: ⟹ (+ (+ (+ 1 2) 3) 4)

22:09 tufflax: Is there some way to unsplice, so that I could do something like (+ (unsplice [1 2 3]))? There is not, right?

22:09 amalloy: tufflax: certainly there is, because you haven't defined what unsplice means

22:10 oh, do you just mean ##(apply + [1 2 3])?

22:10 sexpbot: ⟹ 6

22:10 tufflax: yes, but without apply

22:10 amalloy: tufflax: you can do that inside of a macro, but in general it's a language construct that would lead to chaos if you could do it everywhere

22:10 tufflax: hehe ok

22:10 amalloy: &(let [nums [1 2 3]] `(+ ~@nums))

22:10 sexpbot: ⟹ (clojure.core/+ 1 2 3)

22:11 brehaut: amalloy, tufflax: http://www.comlab.ox.ac.uk/jeremy.gibbons/publications/origami.pdf more about folds and unfolds than you care to know ;)

22:12 it is of course written in mathskell

22:12 and that result is that its all greek to me

22:12 amalloy: brehaut: feh. i wrote fold and unfold; i neither need nor desire further information

22:12 tufflax: By the way, speaking of macros: No book I've read (Joy of Clojure or Programming Clojure) goes very deep into macros. Where can I learn more? I was thinking of reading "Let over lambda" or "on lisp" although they use CL. Do you think that the ideas in them apply to clojure?

22:13 mec: im not sure i understand unfold

22:13 zippy314: looking for some defmacro love. Here's a gist: https://gist.github.com/863513 the final call, i.e. using the macro returns: Can't use qualified name as parameter: my.namespace/this why?

22:13 brehaut: mec: unfold generates a sequence

22:13 mec: first rule of macros, never use macros

22:13 amalloy: tufflax: absolutely yes

22:13 On Lisp goes heavy into macros

22:14 tufflax: ok, hopefully I can extract the information without knowing CL

22:15 brehaut: tufflax: the main difference in how they are used is that clojure uses macros as a light coating on the top of functions, whereas CL tends to be a bit more aggressive in its application

22:15 tufflax: ok, im not sure I understand what you mean though :)

22:16 amalloy: OL it spends a some time covering constructs that just aren't useful/necessary in clojure

22:16 wow that sentence is littered with wasted articles

22:17 brehaut: in clojure, build your solution in terms of functions and data, and then at the end (maybe) add macros to make it a easier to use the API, rather than making the API out of macros

22:17 amalloy: vs everything i write which is littered with wasted words

22:18 amalloy: brehaut: that is of course sound advice, but you also imply that you shouldn't write macros for new syntactic constructs

22:18 brehaut: amalloy: why would you, when you can just sugar domonad!

22:18 * brehaut jests

22:18 amalloy: *sob*

22:20 brehaut: but yes you are right, new syntax is ok

22:20 amalloy: brehaut: wrong again, new syntax is AWESOME!!!1

22:20 brehaut: you sure your not a C# developer?

22:21 amalloy: no grey area for you, is there

22:21 brehaut: none at all

22:24 waxrose: Morning every one. ( UGT ^_^ )

22:26 phenom_: does the STM still work this way: http://groups.google.com/group/clojure/browse_thread/thread/f6241aedb41d82df

22:27 cky: &(sort "foobar")

22:27 sexpbot: ⟹ (\a \b \f \o \o \r)

22:32 mec: is there anything unfold can do that iterate cant?

22:32 tufflax: brehaut: http://pastebin.com/KcKAmC5S When you say that macros in Clojure is a light coating is sounds a little bit like the aphorisms there. But who am I to judge? :P

22:33 amalloy: mec: no; as you can see i implemented unfold on top of iterate

22:33 but neither is there anything map can do that lazy-seq can't do :P

22:33 brehaut: tufflax: well there you go :)

22:33 mec: ah true

22:36 phenom_: if I de-ref a ref in a dosync and another transaction changes it, my transaction will restart correct ?

22:37 amalloy: no, that's what ensure is for

22:40 zippy314: still looking for some defmacro/protocol love. Here's a gist: https://gist.github.com/863513 the final call at line 5, i.e. using the macro returns: Can't use qualified name as parameter: my.namespace/this why?

22:41 amalloy: zippy314: change them to ~'this

22:42 &`[x 'x ~'x '~'x]

22:42 sexpbot: ⟹ [clojure.core/x (quote clojure.core/x) x (quote x)]

22:42 clojurebot: http://groups.google.com/group/clojure/browse_thread/thread/bba604cee3b232d9/28837d55525306d8?lnk=gst&q=recursive+macroexpand#28837d55525306d8

22:42 amalloy: wow, surprisingly relevant, clojurebot

22:49 phenom_: amalloy: im getting confused, can you explain this: http://pastie.org/1654199 ?

22:50 zippy314: amalloy: thanks.

22:53 amalloy: phenom_: the second transaction has successfully set the ref, but the first transaction is using the value it got when it first derefed

22:54 the transaction always sees a consistent snapshot, but if you don't write to a ref you don't prevent it from being modified in the real world

22:54 tomoj: so why does the first transaction not print "End"?

22:54 phenom_: it's retried !

22:54 and i don understand why !!?!?

22:55 am I crazy ?

22:55 amalloy: phenom_: you're not; the issue is probably that i don't actually know half the stuff i claim to know

22:55 tomoj: I can't reproduce your output

22:55 phenom_: executing the same line again (the "do") prints it properly

22:56 tomoj: oh, nevermind, reproduced

22:56 phenom_: I can reproduce it consistently even after jvm restarts

22:56 tomoj: retry the do command and it'll work as expected

22:57 amalloy: wait phenom_

22:57 tomoj: adding an ensure seems to just make the ref-set transaction block

22:57 phenom_: same here

22:58 amalloy: .start is asynchronous; maybe you want to add a Thread/sleep between .start and dosycn

22:58 mec: It's deffinitly starting before the ref-set because its printing 1 first

22:58 amalloy: i mean, you're testing something with a race condition here

22:58 phenom_: mec: exactly

22:58 ossareh: is there some way to make lein log what is happening? I'm doing a lein uberjar and it is stopping.

22:58 just hanging.

22:59 amalloy: phenom_: except that sometimes you say it works as expected. that sounds to me like a race condition

22:59 phenom_: the first run always is incorrect, every other run after that works

23:00 mec: This is working as I understand it should, you dont need a transaction to read, but then you're reading a snapshot and it wont retry, but in a transaction a read will retry

23:01 phenom_: amalloy: and the thread sleep doesn't matter (just checked)

23:01 so ... a read *within* a transaction will retry if the variable was modified outside the specific transaction ?

23:04 mec: correct

23:05 rata_: is it ok to have an agent inside an atom? I always forget what mutable things I'm able to nest

23:05 phenom_: i think the literature is a little vague on this ... atleast the joy of clojure isn't specific on this in their write-skew section

23:06 amalloy: rata_: you *can* nest anything you want

23:06 phenom_: mec: so then what is the point of ensure?

23:06 amalloy: in practice having an agent wrapped with an atom sounds like a hanging offense

23:07 mec: i've never heard of it before, but it appears to be a lock for the ref, so no other transaction can use it until you're done

23:07 rata_: amalloy: why?

23:07 amalloy: rata_: that was going to be my next question :P

23:08 rata_: amalloy: your question is why I'm doing it?

23:08 amalloy: yeah

23:10 rata_: I have a http server running simulations, each simulation goes into a map which is in an atom

23:10 an each simulation is an agent that runs that simulation

23:11 amalloy: ^

23:12 amalloy: interesting

23:13 i dunno, seems reasonable to me

23:15 rata_: good

23:15 agents are so cool

23:26 tomoj: rata_: http requests trigger simulation starts?

23:26 rata_: tomoj: yes

23:26 tomoj: and then requests can get status by checking the agents?

23:27 rata_: yes

23:32 tomoj: neat

23:33 amalloy: rata_: incidentally i still think an atom around an agent is bad news. you have a *map* of agents within an atom, which seems less likely to be disastrous

23:34 but exceptions abound for every rule, and i could well be wrong about (atom (agent foo))

23:35 rata_: amalloy: it's (atom {1 (agent foo), 2 (agent bar), ...})

23:35 where 1 and 2 are simulation ids

23:35 amalloy: right

23:35 rata_: does anyone have used protovis btw?

23:35 mmmmm bad english

23:36 whatever

23:36 have anyone used protovis?

Logging service provided by n01se.net