#clojure log - May 18 2011

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

0:00 KirinDave: The only real difference in testing strategies is that people who have lots of pure code can do quickcheck-like things.

0:00 seancorfield__: i typically do both in both types of languages (unit testing and generic programming)

0:02 KirinDave: Doing some haskell stuff, I was opened to the joy of quickcheck.

0:02 That stuff is really amazing.

0:05 dnolen: seancorfield__: you certainly need both. again more indication that static / dynamic arguments are empty.

0:37 * seancorfield__ just finished reading about QuickCheck

0:38 seancorfield__: basically a generator that then maps a test function over its result

0:38 is there something equivalent for clojure yet?

0:39 ah, i see meikel b created something a while back

0:40 bokeh: Can you send an action to an agent from within a catch clause ?

0:40 this doesn't seem to work for me... won't pretend I know what I'm doing tho

0:42 amalloy: bokeh: i can't see any reason it wouldn't work

0:42 perhaps offer a gist with a wider view of what's going on?

1:28 stirfoo: 4Clojure histogram "how many/what % of users have completed how many problems" => http://paste.lisp.org/display/122080

1:28 yes, I got bored

1:29 amalloy: stirfoo: sweet, thanks

1:30 stirfoo: might make an interesting additional page some day

1:30 html, not ascii

1:30 amalloy: yeah, and we already have some graphing infrastructure

1:30 stirfoo: ah, cool

1:31 amalloy: some release soon will show you how long your solution is, compared to other people's

1:31 (only if you opt in. we don't want to discourage beginners)

1:31 stirfoo: how long as in loc?

1:32 amalloy: non-whitespace characters is what we're graphing on development

1:32 stirfoo: ah

1:32 amalloy: "number of forms" is another interesting metric

1:32 stirfoo: yeah, makes more sense as a lot of solutions will be one-liners

1:32 amalloy: yeah, loc is a non-starter

1:32 esp since you can just remove all the newlines and get a one-liner :)

1:33 stirfoo: I win!

1:34 amalloy: *chuckle*

1:52 amac_: anyone know how to flatten by a single level? ex. such that [[[1][2]]] becomes [[1][2]]

1:53 tried looking at the flatten source, and tree-seqs are magic-y

1:53 amalloy: mapcat, apply/concat

1:53 prefer generating a flattened version to begin with, with mapcat or similar

1:54 if you can't do anything about it, ##(apply concat [[[1][2]]])

1:54 sexpbot: ⟹ ([1] [2])

1:54 amac_: oh man, you rock

1:54 yeah, I sadly can't do anything about the input

1:55 been racking my head on that for way too long, now I can finally sleep :)

1:58 Null-A: so (doall (pcalls f)) is blocking?

1:58 how do I get it non blocking

1:58 agents? anything else

1:58 java Threads

1:58 amalloy: uh. you just want to call a bunch of functions?

1:59 and don't care about the results?

1:59 Null-A: yep

1:59 amalloy: (future (dorun (pcalls f)))?

1:59 * Null-A testing

1:59 amalloy: i mean, doall would work there in place of dorun, but it's wasteful

2:01 Null-A: nice

2:01 that's pretty sweet, I hadn't used futures before

2:02 amalloy: future is just "do this on another thread". if you deref the future, you get the result of the function

2:03 Null-A: why do I even need pcalls then?

2:03 I guess that's my fault

2:04 (future (f))

2:04 amalloy: right

2:04 Null-A: I though pcals was for thread stuff

2:04 thought pcalls*

2:04 amalloy: oh, you only have one function to call?

2:04 Null-A: yep

2:04 amalloy: yeah then you're definitely loony for using pcalls :)

2:04 Null-A: lol, yep

2:05 Is there a thread pool with futures?

2:05 amalloy: they share the agent thread pool, iirc

2:05 Null-A: k

2:05 tomoj: I just spent at least an hour finding a bug in a java library, the same bug I fixed months ago...

2:05 amalloy: tomoj: should've fixed it better

2:06 tomoj: I should've published the fixed jars to my maven repo or put a private fork in github

2:06 the patch is probably sitting on my old hard drive but I forgot about it

2:07 so I just rebuilt the dep from latest source again.. I'm amazed it's still broken... you can only get one output from your neural network no matter how many output nodes it has

2:08 amalloy: tomoj: oh, is this encog?

2:08 tomoj: fannj

2:09 wow, thanks for telling me about that

2:09 GPU would be perfect

2:09 amalloy: i have a teeny-tiny patch applied in encog somewhere

2:09 tomoj: I'd really like to think there's some brilliant way to do this subproblem in pure clojure that's super fast

3:06 seancorfield__: is there some documented best practice document for (ns) ?

3:06 i'm thinking whether to use :require / :use and also what ppl think about :refer-clojure

3:07 amalloy: seancorfield__: i don't know of one

3:07 :refer-clojure is good if you're defining symbols with the same name as a clojure.core symbol

3:08 wholesale (:use foo.bar.baz) is discouraged; prefer either (:use [foo.bar.baz :only [fn1 fn1]]) or (:require [foo.bar.baz :as baz]) ; or whatever nickname you want

3:08 robonobo: seancorfield__: I've often wondered about that too. the ns-syntax itself is still not entirely clear to me.

3:09 seancorfield__: i was a bit surprised using CCW that it flags an error on (:use [clojure.string :only [lower-case]]) because replace and reverse clash with clojure.core

3:09 amalloy: seancorfield__: clojure itself, ignoring CCW, prints a warning for that

3:09 er

3:09 seancorfield__: the only way i could persuade CCW there wasn't a problem was to :refer-clojure :exclude [replace reverse]

3:09 amalloy: wow, that's weird

3:10 that shouldn't be necessary, though lemme verify

3:10 yeah, file a CCW bug

3:10 seancorfield__: i was cleaning up my (ns) declarations today and ran into that....

3:11 amalloy: some people frown on prefix lists in use/require sections

3:12 eg (:use (foreclojure [users :only [golfer? get-user-id]] [solutions :only [save-solution get-solution]]))

3:12 scgilardi: seancorfield: there's a note in the ns doc string for clojure.string that recommends using it with (:require [clojure.string :as str]) rather than (:use clojure.string) (presumably because of that conflict)

3:12 amalloy: scgilardi: require/as is one solution; use/only should be fine as well

3:15 though when i use clojure.string i usually (:require [clojure.string :as s])

3:15 seancorfield__: CCW bug filed

3:15 scgilardi: yeah, but even with that :require, CCW complains

3:15 amalloy: seancorfield__: whoa, even for require/as?

3:16 use/only i could kinda-sorta understand

3:16 seancorfield__: originally i had (:require [clojure.string :as s]) and got the error in CCW

3:18 i can't repro on Ubuntu / Eclipse Galileo tho'...

3:19 i need to do some more digging... i'm not seeing consistent behavior between my two primary envs

3:24 does ken wesson ever come to the #clojure channel? i'm somehow guessing now, given his posts / tone on the clojure mailing list

3:25 he won't post manning book errata to the manning forum, now he won't post comments to github because that requires a github account... *grumble*

3:25 i should probably go to bed instead of complaining...

3:26 robonobo: this helped me a lot - http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns

3:26 amalloy: seancorfield__: no, i've never seen him here

3:27 weird for someone with a usenet fetish

3:27 (not that i object to usenet; i'd rather the clojure google group were on usenet than google google groups)

3:28 robonobo: seancorfield__: that looks great, thanks

3:29 seancorfield__: ah, usenet... i gave up on that when spammers started invading my favorite groups... but i still have a soft spot for it: that's how i met my wife

3:29 amalloy: aw

3:30 seancorfield__: rec.arts.bodyart back in '95... happy days :)

3:30 amalloy: seancorfield__: i c.l.lisp when i was learning CL. not a friendly place

3:30 seancorfield__: is there a clojure group?

3:31 amalloy: and followed rec.games.bridge for a couple years. haven't been there in a while

3:31 no, i don't think so

3:31 seancorfield__: oh, i gather the common lisp community is not always very welcoming...?

3:31 amalloy: ask ken wesson

3:32 seancorfield__: heh...

3:32 amalloy: seancorfield__: it wasn't as bad as people say, but there was some ivory-tower superiority stuff

3:32 seancorfield__: do you think that's why lisp never went mainstream?

3:32 or was it just the (parentheses)?

3:33 the clojure stack discussion on the list made me consider that again... will clojure ever be really mainstream or just a very popular niche?

3:34 amalloy: *shrug*

3:34 i hadn't even been born by the time it was clear common lisp would never get mainstream

3:35 seancorfield_: True, you are much less old than I :)

3:35 robonobo: seancorfield__: considering you can plug it into any java (or in the future .NET) project, it'll be adopted more, but it's still a lisp, a language that is comparatively hard to learn

3:36 amalloy: robonobo: tbh it's only harder to learn because everyone starts with a descendant of algol

3:36 robonobo: true

3:36 amalloy: scheme has way fewer concepts to learn than C or java

3:36 seancorfield_: The language is easy to learn - functional thinking is hard for some tho

3:36 robonobo: but once you're in that paradigm (like me, i'm in a java school), it's hard to get out of it

3:37 and i guess the same would count the other way around

3:38 seancorfield_: I think it's easier to pick up oop from a functional background than the other way

3:39 robonobo: wouldn't an imperative language be easier to learn if you've never programmed before?

3:41 amalloy: robonobo: it seems that way to me too, but i started with java

3:41 i don't see any reason that "do this, then do this, then do that" is easier than "define this as a combination of this and that"

3:41 seancorfield_: If you've never programmed I don't think it matters - kids seem to take well to FP IMO

3:42 robonobo: i guess it's hard to imagine a different learning path

3:43 seancorfield_: When I was doing FP originally, C++ didn't exist :)

3:43 robonobo: what a grand time that must have been

3:45 seancorfield_: I learned a lot of very different languages at Uni so it didn't seem odd... OOP was alien then...

3:45 I started with C++ in 92 and Java in 97

3:46 amalloy: i think we can agree OOP isn't any more "natural" than other paradigms. and it seems to me that imperative is easier to learn than functional, but only because i started that way. i'm pretty sure there's no actual truth to the comparison

3:47 seancorfield_: did you see someone's tweet about one of the origininal tenets of OOP being immutability?

3:47 seancorfield_: No I missed that - URL?

3:48 amalloy: man i don't even remember who retweeted it

3:48 it was a couple weeks ago

3:48 seancorfield_: I was reading an old oop article today that talked about oop separating state and identity

3:49 amalloy: is there a way to search only tweets that have gone to me?

3:52 seancorfield_: I googled but can only find recent suggestions that people write immutable objects - and that is inspired by the rise of FP according to what I can find

3:53 I'd love to find original oop material suggesting immutability

3:54 clgv: seancorfield_: Rich Hickey has a list on amazon of "Books that influenced Clojure, in no particular order". maybe you can find a hint in it.

3:54 seancorfield_: there it is http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH

3:55 seancorfield_: I don't remember that list containing much about it but I'll go look again

3:56 clgv: ok if you have already seen it, there is probably not much more to discover. I just remembered it when reading your question.

3:57 seancorfield_: Hmm nothing leaps out at me... Very little OOP on that list at all...

3:58 clgv: seancorfield_: well you could try google schoolar with immutable objects or go directly to ACM, IEEE or Springer to search over there

4:01 seancorfield_: 1am... Must sleep... Thanx for the stimulating discussion, as always :)

4:03 clgv: well hit the search engines tomorrow ;) good night.

8:16 fliebel: 404: http://clojars.org/core.logic

8:42 ilyak: Hi *

8:47 I have a thing defined as: (defn -setCompilePath [this path]

8:47 What type would path have? Object? How do I change it - use type hint?

8:50 clgv: ilyak: what do you really want to do?

8:54 ilyak: clgv: This is a method of a class, I want it to accept File not whatever it does

8:54 markoman: i forgot how do I filter a vector of assoc? [{:user 1}{:user 2}{:user 1}] and it should return [{:user 1}{:user 1}]

8:55 or actually its not a vector but a sequence

8:55 clgv: ilyak: it is a java class and you are doing java interop?

8:57 markoman: oh, I got it: (filter (fn [p] (= 1 (:user p))) [{:user 1}{:user 2}{:user 1}])

8:58 ilyak: clgv: Yeah, it is a java class via genclass. I see that I can change method type there. I probably would

8:59 clgv: ilyak: ok, and you want to do different things depending on what "path" is exactly?

9:11 cemerick: ilyak: the function you define in the gen-classed namespace has no impact on the signatures of the methods of the generated Java class. Those are obtained either from (a) the specified interfaces or concrete superclass, or (b) the signatures specified in your :gen-class' :methods slot: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/gen-class

9:12 So if setCompilePath is a *new* method that you're not inheriting from a class or implementing from an interface, you would add to your :gen-class spec:

9:13 :methods [[setCompilePath [java.io.File] your-return-type] …]

9:24 clgv: cemerick: ah that was what he might have wanted to know.

9:45 humm strange. suddenly I get a lot of reflection warnings from incanter/core, /charts and such. I didnt do a "lein deps" and I do not find any change that might cause this. any hints?

9:48 *warn-on-reflection* isn't even set to true in any of my files.

9:50 pyr: hi

9:51 I have to use reify in a way I've never done before

9:51 clojurebot: llahna: anyway the answer is no. you can use #(some-fn %1 default-arg %2), for example

9:51 pyr: i have an interface whose constructor takes an argument

9:52 i want to implement the interface, then call the ctor

9:54 what would be the equivalent of (let [foo (reify Type (some-method [foo bar] (blah)))] (Type. "ctor argument"))

10:01 fliebel: dnolen: Hah, there you are. I haven't even started, and I'm already running into trouble.

10:02 I'm trying to write this in Logos: reverse([X|Y],Z,W) :- reverse(Y,[X|Z],W). reverse([],X,X). but I'm having trouble with the [X|Z] bit.

10:04 dnolen: And then there is still this bit, which involves negation: \+member(C,Visited),

10:16 dnolen: fliebel: paste yr code, I gotta run but I'll check it out when I get back. first thing won't be hard to do, the second thing can be done w/ disequality constraints I think.

10:17 fliebel: http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_15.html

10:41 stest: I'm feeling a bit foolish. In python, it is pretty trivial to say x.count('.') to find the number of periods in x. Is there something similar in Clojure?

10:41 furthermore, is there a preferred way of figuring out what functions/multimethods work on a particular type of data?

10:52 jarpiain: stest: ##(count (filter #{ \. } "a...b.c..d"))

10:52 sexpbot: ⟹ 6

10:54 stest: jarpiain: thank you

10:54 rlb: stest: have you seen http://clojure.org/cheatsheet

10:55 Is is possible to do something like :as with import? i.e. if you have java.io.File and some.other.File and would like shorter aliases?

10:55 stest: rlb: I actually did come across that yesterday. thanks though, it should help

11:13 rak85: hi, guys

11:13 i have this structure -> [[1 2] [3 4]]

11:13 and i want to transform to {:1 2 :3 4}

11:13 any ideas?

11:13 i thought in a map followed by a merge

11:14 the order is important...

11:14 raek: ,(into {} [[1 2] [3 4]])

11:15 clojurebot: {1 2, 3 4}

11:15 raek: ...if it is fine to have integer keys, instead of keyword keys

11:15 oelewapperke: ,(while true (+ 1 1))

11:15 rak85: thanks

11:15 oelewapperke: what does that do ?

11:15 clojurebot: Execution Timed Out

11:16 stest: rak85: I could be completely wrong, but doesn't something like zip do that?

11:16 raek: oelewapperke: it evaluates the expression (+ 1 1) a lot of times

11:16 stest: that's python anyway...

11:17 oelewapperke: raek: why doesn't it cause a stack overflow ?

11:17 raek: ,(let [xs [[1 2] [3 4]]] (zipmap (map first xs) (map second xs)))

11:17 clojurebot: {3 4, 1 2}

11:17 raek: ,(let [xs [[1 2] [3 4]]] (zipmap (map (comp keyword str first) xs) (map second xs)))

11:17 clojurebot: {:3 4, :1 2}

11:18 rak85: raek: thank you

11:18 raek: ,(let [xs [[1 2] [3 4]]] (into {} (for [[k v] xs] [(keyword (str k)) v])))

11:18 clojurebot: {:1 2, :3 4}

11:18 TimMc: oelewapperke: while uses a loop

11:18 raek: there are many ways...

11:19 oelewapperke: you get a stack overflow if a function calls a function that calls a function that calls a function....

11:19 oelewapperke: loops do not allocate stack frames

11:20 manutter: or to put it another way, it throws away the "2" every time it calculates "+ 1 1", so there's no buildup of data values

11:20 oelewapperke: only function calls do

11:20 ?

11:20 raek: yes

11:21 stack overflow referes to the method call stack of the JVM

11:33 joly: ,(#(% %) #(% %))

11:33 clojurebot: java.lang.StackOverflowError

11:34 clgv: lol great

11:38 edw: Should I take 1.3's alpha-ness at face value, meaning is it still not feature-complete? I've been basically pretending it doesn't exist until it ceases to be a moving target.

11:43 cemerick: edw: I'd say that's accurate. There are definitely significant changes / features in the wings still.

11:51 edw: cemerick: Thanks.

11:52 pietia: clojurebot,

11:52 clojurebot: #<ClassCastException java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;>

11:53 dnolen: fliebel: any progress?

11:53 fliebel: dnolen: nooo! Well, a little.

11:54 dnolen: http://paste.pocoo.org/show/391274/

11:56 dnolen: So, the reverse is just… weird, but should be simple. I solved the negation by using disequality in member, but travel still continues endlessly.

11:57 Some guy solved reverse with append, but that is very inefficient, is it?

11:59 dnolen: fliebel: what's weird about reverso?

12:00 fliebel: dnolen: Nothing, I guess, it just doesn't work yet. right now it looks like (3 2 1 . _.0) so I guess my terminal condition is wrong.

12:00 dnolen: fliebel: your path has a cycle right?

12:00 fliebel: dnolen: yea, that is why I need to make sure we've not been there already with not-membero

12:01 dnolen: fliebel: the path code is way simpler if you just use a tabled goal.

12:01 fliebel: oh!

12:01 do enlighten me :)

12:02 dnolen: fliebel: look at the section on tabling, https://github.com/clojure/core.logic

12:02 fliebel: there's a cycle there as well.

12:03 fliebel: dnolen: But how would I use tabling with all the sugar? Or do I need to write classic style again?

12:05 dnolen: fliebel: (defne ^:tabled travel ...)

12:06 fliebel: … doesn;t help

12:06 dnolen: fliebel: I think reverseo needs to use append.

12:07 fliebel: paste.

12:07 fliebel: okay

12:07 dnolen: Just what you have already, but with ^:tabled http://paste.pocoo.org/show/391274/

12:08 Anyway, why would it fail in the first plaace with not-membero? I get results like (5 2 3 2 1 3 1)

12:09 dnolen: fliebel: you don't need all that other stuff w/ tabling

12:09 fliebel: you don't need to track visited

12:10 fliebel: dnolen: Well, then something else is wrong, because when I remove those, I still get double results.

12:10 (5 2 5 4 5 2 1)

12:13 dnolen: fliebel: is there any reason to not just use the patho in my example?

12:14 fliebel: dnolen: I don't know. I haven;t really looked at what that does, but I think I could.

12:16 dnolen: That doesn;t give me the path from a to b, does it?

12:17 I'll make it so...

12:24 dnolen: Huh, is tabled a function> I thought it was like exist

12:25 dnolen: fliebel: exist and tabled both are goals, one sec, I think you're investigation here has surfaced a bug around tabling + defrel, facts.

12:26 fliebel: weee, I did it again :P

12:26 dnolen: So there is no reason really to do (defn blah [] (exist []))

12:36 dnolen: fliebel: the correct answer should be (2 3 4 5) right?

12:37 fliebel: dnolen: Uhm, that is what yours does, mine should give you ([1 3 5] [1 2 5] …) for all paths from 1 to 5.

12:37 I'm almost there I think. I stared with your example now.

12:38 dnolen: fliebel: sure you want to actually document the paths, oddly when I try to run your graph it doesn't seem to terminate ... are you seeing htis?

12:39 fliebel: yea. I guess that is because your yabling considers all of them new values.

12:40 or is this the defrel bug?

12:41 dnolen: fliebel: no there's no bug w/ defrel/fact I don't think, the code works on my simplistic graph, but falls down on yours.

12:41 fliebel: probably a legitimate tabling bug.

12:41 fliebel: uh, oh

12:43 dnolen: fliebel: I'll have sit down and think about what's going on here, thx again for surfacing the bugs :)

12:43 fliebel: you're welcome. Thanks for fiximg them :)

12:44 dnolen: fliebel: I've actually need to really dig into the tabling stuff anyway, I only understand it up to a point since that bit is really based on William Byrd's version. Maybe I'll see how to implement stratified negation while I'm at it.

12:45 fliebel: dnolen: hehe, everything you don't really understand breaks down.

12:46 dnolen: fliebel: too true.

12:46 fliebel: fix and test cased for your graph in the next few days.

12:47 fliebel: dnolen: awesome, so next weak I can have maze solvers and 'ticket to ride' players and all :)

13:25 dnolen: Is there stuff for defining facts from a seq? You have so little documentation I can't tell for myself.

13:27 dnolen: Oh, you might be able to solve https://4clojure.com/problem/91 your patho :)

13:28 dnolen: fliebel: no, but that would be useful

13:33 fliebel: issues created, http://dev.clojure.org/jira/browse/LOGIC

13:36 fliebel: dnolen: Cool, thanks.

13:38 dnolen: Syntax suggestion: Make defrel take an optional map that is the initial value for the atom. ( you just store these things in an atom, right?

13:38 dnolen: fliebel: why do you want that?

13:39 fliebel: dnolen: Well, to use a map, or pair seq to define facts.

13:40 * fliebel created an unresolved tension http://xkcd.com/859/

13:40 dnolen: fliebel: I don't think I will change defrel, but I'll will probably add extend-rel that does what you want.

13:40 fliebel: okay, cool

13:41 dnolen: And, maybe I'm saying stupid things, but what about 'anonymous relations'?

13:41 clojurebot: ( is http://xkcd.com/859/

13:41 clojurebot: Roger.

13:41 dnolen: raek: hey do you have a link to your core.logic DCG gist?

13:42 fliebel: ?

13:43 fliebel: dnolen: weeell, lets saaay… I just want an one-shot relation, get some result, put new data in, get more results.

13:44 dnolen: fliebel: a paste of what you think this would look like?

13:45 mrBliss`: I think it'd be better if the "Congratulations, you've solved the problem" on 4clojure.com were green.

13:49 fliebel: dnolen: http://paste.pocoo.org/show/391344/

13:57 amalloy: mrBliss`: yes, we need to improve the way we display "transient" messages. there's an open issue for it

13:59 dnolen: fliebel: interesting, I'll think about it.

14:18 jweiss: is there a better way to remove keys from a map whose values match a certain pred (for instance, nil? ): (into {} (remove #(nil? (val %)) m))

14:21 amalloy: &(into {} (for [[k v] {4 nil 5 10} :when (not (nil? v))] [k v]))?

14:21 sexpbot: ⟹ {5 10}

14:23 amalloy: yours is probably clearer, though. i guess i'd write it as ##(into {} (remove (comp nil? val) {4 nil 5 10}))

14:23 sexpbot: ⟹ {5 10}

14:23 edw: &(map (fn [x] (incr x) '(1 2 3 4 5)))

14:23 sexpbot: java.lang.Exception: Unable to resolve symbol: incr in this context

14:23 edw: &(map (fn [x] (inc x) '(1 2 3 4 5)))

14:23 sexpbot: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$map

14:23 edw: &(map (fn [x] (inc x)) '(1 2 3 4 5))

14:23 sexpbot: ⟹ (2 3 4 5 6)

14:24 amalloy: edw: ##(map inc [1 2 3 4 5])?

14:24 sexpbot: ⟹ (2 3 4 5 6)

14:24 robonobo`: edw: you can just do

14:24 &(map inc '(1 2 3 4 5))

14:24 sexpbot: ⟹ (2 3 4 5 6)

14:25 edw: robonobo`: Yeah, I was just trying to get sexpbot to spit out a ==> char. Trying to make my Emacs recognize Unicode.

14:25 Ah, wait, guess it's the font...

14:25 amalloy: &1 might have been easier :P

14:25 sexpbot: ⟹ 1

14:26 robonobo`: it looks crappy in emacs for me too

14:26 edw: I'm feeling a bit under the weather: too many Frozequis last night.

14:26 amalloy: &(int \⟹)

14:26 sexpbot: ⟹ 10233

14:26 amalloy: that's the unicode character number if you find that helpful

14:27 edw: Hmm. Lemme see what fonts support that on my Mac...

14:30 amalloy: edw: fork sexpbot and send a pull request with a different character. Raynes loves it when people complain about his arrow character...

14:30 just, uh, don't tell him it was my idea

14:30 Raynes: If somebody comes up with a better unicode character, I'm all for it.

14:31 robonobo`: why does it have to be unicode?

14:31 Raynes: edw: Lucida Grande supports that. It's what I'm using.

14:32 wastrel: sexybot?

14:32 Raynes: robonobo`: Because sexpbot is in a lot of channels and I don't want his evaluation to accidentally set of someone else's bot. This makes it easier to prevent chains.

14:32 amalloy: robonobo`: uh, what else would it be? you prefer big5?

14:32 Raynes: wastrel: Pronounced aloud, it sounds like 'sexbot'.

14:32 edw: Raynes: Thanks. Need a monospaced face. We're talking Emacs...

14:32 wastrel: ⟹ is what you're talking about?

14:33 it looks like an em-dash on my terminal

14:33 if i crank the font size up big enough i see itls a ===>

14:34 amalloy: wastrel: that's interesting. it's as tall as an = in my font

14:48 TimMc: Raynes: ☃ would be much better

14:49 Raynes: Heh.

14:49 TimMc: WTF, I just went to http://unicodesnowmanforyou.com/ -- and noticed the snowflakes are pentagonal.

14:49 That's not Earth chemistry.

14:51 technomancy: TimMc: unicode is not necessarily earth-centric

14:51 though they did refuse to include the klingon codepoints....

14:51 TimMc: heh

14:53 mrBliss`: amalloy_: problem51 on 4clojure is called "Advanced Destructuring" but has as tags "easy destructuring"?

15:20 amalloy: mrBliss`: it's an easy problem, about advanced destructuring. there's not really any *hard* destructuring problems?

15:21 mrBliss`: amalloy: Why is it called "Advanced Destructuring" instead of just "Destructuring"? (I'm nitpicking here ;-)

15:21 amalloy: to contrast with Intro to Destructuring. if we just called it Destructuring it would look weird

15:22 whereas the way it is, only nitpicking whiny babies complain :)

15:24 mrBliss`: amalloy: ok. I wouldn't have spoken up if the tags were comma-separated. I just read it as "easy destructuring" instead of "easy, destructuring".

15:26 TimMc: So, it's an easy problem on the path to learning advanced destructuring?

15:27 mrBliss`: There are two problems about destructuring, both easy, but the first one is called "Intro to Destructuring" and the second one "Advanced Destructuring".

15:28 I was just confused by the tags: "easy destructuring". Anyway, just forget what I said amalloy. 4clojure.com is great fun!

15:35 amalloy: mrBliss`: i'm not actually objecting to your complaints

15:35 please do continue to complain, though it'd be better for everyone if you did so in the form of issues at https://github.com/dbyrne/4clojure/issues?

15:39 mrBliss`: amalloy: that's all for now :-) And I wouldn't call it complain, just 'notice'. I'll comment on issue 62.

16:43 raek: dnolen: https://gist.github.com/954080 and https://gist.github.com/954222

16:48 stirfoo: (gcd 9 2343)

16:49 One day, while eating Ho-Hos, Steele and Sussman noticed...

16:49 That was completely believable until I read the footnote

17:00 lawfulfalafel: I am trying to get the emacs-starter-kit to work, but for some reason I am stuck

17:00 raek: lawfulfalafel: how did you install it? did you remove any old .emacs* files?

17:01 lawfulfalafel: I have no .emacs or .emacs.d folders, this is a new install

17:01 I ran git clone git://github.com/technomancy/emacs-starter-kit.git ~/.emacs.d

17:01 and then tried M-x package-list-packages

17:01 raek: and ~/.emacs (the file) does not exist?

17:02 lawfulfalafel: and I get [No match]

17:02 raek: do you have a menu bar and a toolbar?

17:02 lawfulfalafel: lol

17:02 no, I still had a .emacs

17:02 I thought I had removed that

17:02 raek: if so, then emacs-starter-kit has not loaded :)

17:03 you can move it to ~/.emacs.d/<your-username>.el

17:04 lawfulfalafel: okay I did that, and then I installed clojure-mode, but now I can't get M-x clojure-install to work

17:05 I am trying to follow this: http://freegeek.in/blog/2009/08/setting-up-emacs-clojure-with-emacs-starter-kit/

17:05 raek: clojure-install?

17:05 lawfulfalafel: I would suggest following http://dev.clojure.org/display/doc/Getting+Started+with+Emacs

17:06 lawfulfalafel: clojure-install is from pre-leiningen times, iirc

17:06 lawfulfalafel: ah

17:08 is there a good tutorial for making a simple project with lein?

17:08 I really don't know what I'm doing here

17:08 raek: the leingen tutorial

17:08 stirfoo: the single lein script is pretty sweet for getting up and running, well for getting clojure and friends installed

17:09 raek: lawfulfalafel: if you just want a clojure repl in emacs, you can run "lein repl" outside a project by customizing the inferior-lisp-program variable

17:09 lawfulfalafel: https://github.com/technomancy/leiningen/blob/master/TUTORIAL.md

17:10 or "lein help tutorial | less"

17:12 lawfulfalafel: okay for installing lein, it says that you have to "add it your path"

17:13 that means I want to put it in a place listed by "echo $PATH", right?

17:13 raek: lawfulfalafel: yes. either that or add the directory where you keep it to the PATH

17:13 amalloy: lawfulfalafel: ~/bin/lein is a popular place for it

17:14 and having ~/bin on your PATH is useful in general

17:14 stirfoo: me thinks ubuntu adds ~/bin to your path automagically, from a bash script in /etc

17:20 but it will only add it if ~/bin actually exists

17:26 technomancy: raek: did you see the latest on M-x clojure-jack-in? I need to update confluence for that

17:26 * kencausey suspects he will soon be missing 'durendal-jack-in'

17:29 technomancy: lawfulfalafel: http://technomancy.us/149 <= just simplified things significantly

17:32 raek: technomancy: cool! does this mean that clojure-mode contains a version of slime?

17:32 amalloy: stirfoo: what script is that?

17:32 technomancy: raek: swank-clojure does actually

17:33 just revamped the swank readme last night

17:33 kencausey: amalloy: .profile, .bash_profile or .bashrc generally

17:34 technomancy: I commiserate with your 'tracking slime' pain.

17:34 amalloy: kencausey: yes, i know how i can set it up myself. stirfoo was saying ubuntu does it automatically from some script in /etc. that's never been my experience and i can't find the code that would do it, so i'm wondering where he found it

17:34 stirfoo: the skeleton files copied over to a new users home dir looks for ~/bin

17:35 kencausey: amalloy: oops

17:35 amalloy: oh, there it is, in the .profile

17:35 kencausey: it seems like whether or not this is in any of the standard scripts is something that goes in and out of style regularly

17:36 stirfoo: I think ubuntu may have carried that over from debian, although it's been a while since I've ran debian

17:38 kencausey: That's likely, as it is in Debian currently anyway

17:52 Null-A: is zach tellman here?

17:52 what's his irc name

17:54 raek: Null-A: I think he uses "ztellman"

17:54 Null-A: k

17:54 thx

17:54 raek: $seen ztellman

17:54 sexpbot: ztellman was last seen joining on :#clojure 1 week and 1 day ago.

17:58 puredanger: so..... I'm trying to proxy a Java object with overridden methods (same arity, different types). how do I proxy just one of them?

18:02 amalloy: puredanger: i don't think you can do that. you probably have to proxy all of them and then re-call if the type you get isn't the one you want to intercept?

18:02 puredanger: amalloy: I would do that if I had to - do you just provide one method impl or many?

18:03 amalloy: puredanger: i dunno, i don't really need to do any of them myself. i think one method impl with no type-hinting, that does some checking and then maybe calls (proxy-super) with the "wrong" types

18:04 Null-A: yeah, ztellman doesn't spend much time here. he probably notices github messages and i'm pretty sure there are usergroups for his main projects like aleph

18:04 puredanger: Null-A: yes, ztellman is very responsive on the mailing lists for aleph, lamina, etc

18:05 Null-A: k

18:05 yah, I can't get his stuff working

18:05 puredanger: Null-A: I have used Lamina quite a bit but it was a few months ago

18:06 Null-A: I tried his echo-handler and chat client examples, neither work pure

18:06 in both cases I can connect, but no echoing happens

18:07 the twitter example gives an exception

18:07 java.lang.IllegalArgumentException: No implementation of method: :queue of protocol: #'lamina.core.channel/ChannelProtocol found for class: aleph.core.channel$splice$reify__2242

18:09 puredanger: Null-A: sorry I can't help right now... I'd ask on the mailing list for the project

18:09 Null-A: k, no worries

19:14 jtoy: how can I tell if the lein file is including the correct files? I get this error: Caused by: java.io.FileNotFoundException: Could not locate clojure/contrib/sql__init.class or clojure/contrib/sql.clj on classpath: which makes me think clojure-contrib is not being included

19:15 doh, i see the error now

19:15 rmarianski: check lib/

20:03 clj-powered-bot: checkout my clj bot :D

20:04 i'm using compojure, hiccup, aleph/lamina, getty http server, websockets

20:04 futures

20:24 test

20:25 test

20:31 test

20:34 brehaut: clj-powered-bot: perhaps you could use a backchannel to test?

20:35 Null-A: brehaut: yah sorry. i'm trying to do that, but its caching my code somehow

20:35 can't update channel,

20:35 i see why

20:47 amalloy: Null-A: you could also join #test

21:30 symbole: Is there a way to do something akin to (for [[x y] [1 2 3 4]])? That particular example is not valid.

21:30 amalloy: uh

21:30 what do you wish it did?

21:31 symbole: With every iteration x and y get bound to 1 2, and then 3 4.

21:31 amalloy: &(for [[x y] (partition 2 [1 2 3 4])] [x y])

21:31 sexpbot: ⟹ ([1 2] [3 4])

21:33 symbole: I see. Thanks.

21:35 amalloy: partition is great for grouping together pieces of a list

21:35 if you instead wanted to work with each adjacent pair in the list, you could ##(partition 2 1 [1 2 3 4])

21:35 sexpbot: ⟹ ((1 2) (2 3) (3 4))

21:42 symbole: partition worked great.

21:42 wastrel: i'm doing 4clojure

21:43 how do i get pretty printing and brace matching in my repl?

21:48 amalloy: wastrel: the slime repl has them, and i assume the ccw repl does too. i know cake repl does brace matching, at least

21:49 wastrel: i'm using rlwrap currently

21:49 it has yummy history and vi-mode editing

21:50 not an emacs user

21:59 hrm brace matching is slightly less important if you write code from the outside in

22:03 amalloy: it's less important if you have paredit :P

22:03 * tomoj grabs pitchfork

22:04 wastrel: google says that's emacs jazz

22:04 amalloy: indeed. though ccw has most of the same features, i thnk

22:05 i wouldn't be surprised if someone had ported it to vim. it's a huge boon for editing lisp

22:06 wastrel: i just found vim-clojure

22:06 dnolen: there's also slimv, http://www.vim.org/scripts/script.php?script_id=2531

22:20 hugod: a short intro to the debugger in swank-clj, so you can see what you are missing http://vimeo.com/23932914

22:22 danlarkin: the audio is sooo low

22:22 I didn't realize it had any at first

22:26 wastrel: i will watch it to learn the errors of my waze

22:39 hugod: mm, my headphones seem to have a different volume to everyone elses then :(

22:40 symbole: Is this debugging facility available in SLIME, or only swank-clj in particular?

22:41 hugod: this is pretty much SLIME standard, but has not been available before for clojure

22:51 wastrel: does this mean i have to learn to read java bytecode?

22:54 hugod: only if you want to

23:04 amalloy: the volume is indeed quite low

23:06 hugod: I'll redo it tomorrow

23:07 amalloy: not quite done watching it but i'm jealous already

23:08 "pass exception to program" implies it catches every exception thrown?

23:09 dnolen: hugod: doesn't work w/ 1.3.0 yet right?

23:09 hugod: that is one area to improve - it breaks on uncaught exceptions, plus a few where the catch locations match certain criteria

23:09 dnolen: it works - I need to turn off the aot though

23:10 and add support for invokePrim

23:10 dnolen: are you using alpha7 or master?

23:11 dnolen: hugod: alpha7

23:27 hugod: dnolen: just pushed a 0.1.6-SNAPSHOT with aot disabled and with invokePrim support

23:31 without aot, the startup is very slow

23:38 tomoj: &(->> (range 100) shuffle (take 8) (map vector (cycle [1 -1])) (into {}))

23:38 sexpbot: ⟹ {1 75, -1 45}

23:38 tomoj: problem is I want (map vector (shuffle (take 8 ...)) (cycle [1 -1]))

23:39 do I have to lose the ->> or is there some clever trick?

23:42 &(into {} (map vector (->> (range 100) shuffle (take 8)) (cycle [1 -1])))

23:42 sexpbot: ⟹ {32 1, 78 -1, 62 1, 16 -1, 37 1, 85 -1, 6 1, 9 -1}

23:42 tomoj: ugly

23:44 amalloy: tomoj: yeah, you can't really stitch into anything but second or last position

23:45 brehaut: you could use pmoc and a bunch of #(

23:46 rmarianski: &(->> (range 100) shuffle (take 8) (map #(vector %2 %1) (cycle [1 -1])) (into {}))

23:46 sexpbot: ⟹ {28 1, 96 -1, 90 1, 6 -1, 83 1, 8 -1, 31 1, 68 -1}

23:46 tomoj: (comp flip vector)?

23:46 brehaut: rmarianski: you can use vec in place of #(vector there i believe

23:47 tomoj: er.. just (flip vector)?

23:47 amalloy: tomoj: surely that would be just (flip vector)

23:47 brehaut: noooooooo

23:47 brehaut: really?

23:47 amalloy: &(vector 1 2)

23:47 sexpbot: ⟹ [1 2]

23:47 amalloy: &(vec 1 2)

23:47 sexpbot: java.lang.IllegalArgumentException: Wrong number of args (2) passed to: core$vec

23:47 * rmarianski didn't know about flip

23:47 brehaut: oh yeah

23:47 tomoj: rmarianski: it doesn't really exist

23:47 amalloy: rmarianski: it doesn't exist in clojure as a builtin

23:47 brehaut: sorry i missed why vector was being used there

23:48 rmarianski: amalloy: i only see bit flip, is it in contrib?

23:48 amalloy: rmarianski: it's a function/name we're stealing from haskell

23:48 rmarianski: right ... i see, you mean write one?

23:49 amalloy: in fact i've already written a more-general flip at https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/reorder.clj

23:50 does argument reversing (flip is a special case of that), rotating, and arbitrary reordering

23:51 rmarianski: nice

23:51 amalloy: so yes, i would just write it with (reorder vector)

23:55 hugod: &(->> (range 100) shuffle (take 8) (vector (cycle [1 -1])) (reverse) (apply map vector) (into {}))

23:55 sexpbot: ⟹ {97 1, 35 -1, 53 1, 27 -1, 2 1, 59 -1, 76 1, 78 -1}

Logging service provided by n01se.net