#clojure logs

2011-05-18

00:00KirinDaveThe only real difference in testing strategies is that people who have lots of pure code can do quickcheck-like things.
00:00seancorfield__i typically do both in both types of languages (unit testing and generic programming)
00:02KirinDaveDoing some haskell stuff, I was opened to the joy of quickcheck.
00:02KirinDaveThat stuff is really amazing.
00:05dnolenseancorfield__: you certainly need both. again more indication that static / dynamic arguments are empty.
00:38seancorfield__basically a generator that then maps a test function over its result
00:38seancorfield__is there something equivalent for clojure yet?
00:39seancorfield__ah, i see meikel b created something a while back
00:40bokehCan you send an action to an agent from within a catch clause ?
00:40bokehthis doesn't seem to work for me... won't pretend I know what I'm doing tho
00:42amalloybokeh: i can't see any reason it wouldn't work
00:42amalloyperhaps offer a gist with a wider view of what's going on?
01:28stirfoo4Clojure histogram "how many/what % of users have completed how many problems" => http://paste.lisp.org/display/122080
01:28stirfooyes, I got bored
01:29amalloystirfoo: sweet, thanks
01:30stirfoomight make an interesting additional page some day
01:30stirfoohtml, not ascii
01:30amalloyyeah, and we already have some graphing infrastructure
01:30stirfooah, cool
01:31amalloysome release soon will show you how long your solution is, compared to other people's
01:31amalloy(only if you opt in. we don't want to discourage beginners)
01:31stirfoohow long as in loc?
01:32amalloynon-whitespace characters is what we're graphing on development
01:32stirfooah
01:32amalloy"number of forms" is another interesting metric
01:32stirfooyeah, makes more sense as a lot of solutions will be one-liners
01:32amalloyyeah, loc is a non-starter
01:32amalloyesp since you can just remove all the newlines and get a one-liner :)
01:33stirfooI win!
01:34amalloy*chuckle*
01:52amac_anyone know how to flatten by a single level? ex. such that [[[1][2]]] becomes [[1][2]]
01:53amac_tried looking at the flatten source, and tree-seqs are magic-y
01:53amalloymapcat, apply/concat
01:53amalloyprefer generating a flattened version to begin with, with mapcat or similar
01:54amalloyif you can't do anything about it, ##(apply concat [[[1][2]]])
01:54sexpbot⟹ ([1] [2])
01:54amac_oh man, you rock
01:54amac_yeah, I sadly can't do anything about the input
01:55amac_been racking my head on that for way too long, now I can finally sleep :)
01:58Null-Aso (doall (pcalls f)) is blocking?
01:58Null-Ahow do I get it non blocking
01:58Null-Aagents? anything else
01:58Null-Ajava Threads
01:58amalloyuh. you just want to call a bunch of functions?
01:59amalloyand don't care about the results?
01:59Null-Ayep
01:59amalloy(future (dorun (pcalls f)))?
01:59amalloyi mean, doall would work there in place of dorun, but it's wasteful
02:01Null-Anice
02:01Null-Athat's pretty sweet, I hadn't used futures before
02:02amalloyfuture is just "do this on another thread". if you deref the future, you get the result of the function
02:03Null-Awhy do I even need pcalls then?
02:03Null-AI guess that's my fault
02:04Null-A(future (f))
02:04amalloyright
02:04Null-AI though pcals was for thread stuff
02:04Null-Athought pcalls*
02:04amalloyoh, you only have one function to call?
02:04Null-Ayep
02:04amalloyyeah then you're definitely loony for using pcalls :)
02:04Null-Alol, yep
02:05Null-AIs there a thread pool with futures?
02:05amalloythey share the agent thread pool, iirc
02:05Null-Ak
02:05tomojI just spent at least an hour finding a bug in a java library, the same bug I fixed months ago...
02:05amalloytomoj: should've fixed it better
02:06tomojI should've published the fixed jars to my maven repo or put a private fork in github
02:06tomojthe patch is probably sitting on my old hard drive but I forgot about it
02:07tomojso 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
02:08amalloytomoj: oh, is this encog?
02:08tomojfannj
02:09tomojwow, thanks for telling me about that
02:09tomojGPU would be perfect
02:09amalloyi have a teeny-tiny patch applied in encog somewhere
02:09tomojI'd really like to think there's some brilliant way to do this subproblem in pure clojure that's super fast
03:06seancorfield__is there some documented best practice document for (ns) ?
03:06seancorfield__i'm thinking whether to use :require / :use and also what ppl think about :refer-clojure
03:07amalloyseancorfield__: i don't know of one
03:07amalloy:refer-clojure is good if you're defining symbols with the same name as a clojure.core symbol
03:08amalloywholesale (: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
03:08robonoboseancorfield__: I've often wondered about that too. the ns-syntax itself is still not entirely clear to me.
03:09seancorfield__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
03:09amalloyseancorfield__: clojure itself, ignoring CCW, prints a warning for that
03:09amalloyer
03:09seancorfield__the only way i could persuade CCW there wasn't a problem was to :refer-clojure :exclude [replace reverse]
03:09amalloywow, that's weird
03:10amalloythat shouldn't be necessary, though lemme verify
03:10amalloyyeah, file a CCW bug
03:10seancorfield__i was cleaning up my (ns) declarations today and ran into that....
03:11amalloysome people frown on prefix lists in use/require sections
03:12amalloyeg (:use (foreclojure [users :only [golfer? get-user-id]] [solutions :only [save-solution get-solution]]))
03:12scgilardiseancorfield: 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)
03:12amalloyscgilardi: require/as is one solution; use/only should be fine as well
03:15amalloythough when i use clojure.string i usually (:require [clojure.string :as s])
03:15seancorfield__CCW bug filed
03:15seancorfield__scgilardi: yeah, but even with that :require, CCW complains
03:15amalloyseancorfield__: whoa, even for require/as?
03:16amalloyuse/only i could kinda-sorta understand
03:16seancorfield__originally i had (:require [clojure.string :as s]) and got the error in CCW
03:18seancorfield__i can't repro on Ubuntu / Eclipse Galileo tho'...
03:19seancorfield__i need to do some more digging... i'm not seeing consistent behavior between my two primary envs
03:24seancorfield__does ken wesson ever come to the #clojure channel? i'm somehow guessing now, given his posts / tone on the clojure mailing list
03:25seancorfield__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*
03:25seancorfield__i should probably go to bed instead of complaining...
03:26seancorfield__robonobo: this helped me a lot - http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns
03:26amalloyseancorfield__: no, i've never seen him here
03:27amalloyweird for someone with a usenet fetish
03:27amalloy(not that i object to usenet; i'd rather the clojure google group were on usenet than google google groups)
03:28robonoboseancorfield__: that looks great, thanks
03:29seancorfield__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
03:29amalloyaw
03:30seancorfield__rec.arts.bodyart back in '95... happy days :)
03:30amalloyseancorfield__: i c.l.lisp when i was learning CL. not a friendly place
03:30seancorfield__is there a clojure group?
03:31amalloyand followed rec.games.bridge for a couple years. haven't been there in a while
03:31amalloyno, i don't think so
03:31seancorfield__oh, i gather the common lisp community is not always very welcoming...?
03:31amalloyask ken wesson
03:32seancorfield__heh...
03:32amalloyseancorfield__: it wasn't as bad as people say, but there was some ivory-tower superiority stuff
03:32seancorfield__do you think that's why lisp never went mainstream?
03:32seancorfield__or was it just the (parentheses)?
03:33seancorfield__the clojure stack discussion on the list made me consider that again... will clojure ever be really mainstream or just a very popular niche?
03:34amalloy*shrug*
03:34amalloyi hadn't even been born by the time it was clear common lisp would never get mainstream
03:35seancorfield_True, you are much less old than I :)
03:35robonoboseancorfield__: 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
03:36amalloyrobonobo: tbh it's only harder to learn because everyone starts with a descendant of algol
03:36robonobotrue
03:36amalloyscheme has way fewer concepts to learn than C or java
03:36seancorfield_The language is easy to learn - functional thinking is hard for some tho
03:36robonobobut once you're in that paradigm (like me, i'm in a java school), it's hard to get out of it
03:37robonoboand i guess the same would count the other way around
03:38seancorfield_I think it's easier to pick up oop from a functional background than the other way
03:39robonobowouldn't an imperative language be easier to learn if you've never programmed before?
03:41amalloyrobonobo: it seems that way to me too, but i started with java
03:41amalloyi 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"
03:41seancorfield_If you've never programmed I don't think it matters - kids seem to take well to FP IMO
03:42robonoboi guess it's hard to imagine a different learning path
03:43seancorfield_When I was doing FP originally, C++ didn't exist :)
03:43robonobowhat a grand time that must have been
03:45seancorfield_I learned a lot of very different languages at Uni so it didn't seem odd... OOP was alien then...
03:45seancorfield_I started with C++ in 92 and Java in 97
03:46amalloyi 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
03:47amalloyseancorfield_: did you see someone's tweet about one of the origininal tenets of OOP being immutability?
03:47seancorfield_No I missed that - URL?
03:48amalloyman i don't even remember who retweeted it
03:48amalloyit was a couple weeks ago
03:48seancorfield_I was reading an old oop article today that talked about oop separating state and identity
03:49amalloyis there a way to search only tweets that have gone to me?
03:52seancorfield_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
03:53seancorfield_I'd love to find original oop material suggesting immutability
03:54clgvseancorfield_: Rich Hickey has a list on amazon of "Books that influenced Clojure, in no particular order". maybe you can find a hint in it.
03:54clgvseancorfield_: there it is http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH
03:55seancorfield_I don't remember that list containing much about it but I'll go look again
03:56clgvok if you have already seen it, there is probably not much more to discover. I just remembered it when reading your question.
03:57seancorfield_Hmm nothing leaps out at me... Very little OOP on that list at all...
03:58clgvseancorfield_: well you could try google schoolar with immutable objects or go directly to ACM, IEEE or Springer to search over there
04:01seancorfield_1am... Must sleep... Thanx for the stimulating discussion, as always :)
04:03clgvwell hit the search engines tomorrow ;) good night.
08:16fliebel404: http://clojars.org/core.logic
08:42ilyakHi *
08:47ilyakI have a thing defined as: (defn -setCompilePath [this path]
08:47ilyakWhat type would path have? Object? How do I change it - use type hint?
08:50clgvilyak: what do you really want to do?
08:54ilyakclgv: This is a method of a class, I want it to accept File not whatever it does
08:54markomani forgot how do I filter a vector of assoc? [{:user 1}{:user 2}{:user 1}] and it should return [{:user 1}{:user 1}]
08:55markomanor actually its not a vector but a sequence
08:55clgvilyak: it is a java class and you are doing java interop?
08:57markomanoh, I got it: (filter (fn [p] (= 1 (:user p))) [{:user 1}{:user 2}{:user 1}])
08:58ilyakclgv: Yeah, it is a java class via genclass. I see that I can change method type there. I probably would
08:59clgvilyak: ok, and you want to do different things depending on what "path" is exactly?
09:11cemerickilyak: 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
09:12cemerickSo 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:
09:13cemerick:methods [[setCompilePath [java.io.File] your-return-type] …]
09:24clgvcemerick: ah that was what he might have wanted to know.
09:45clgvhumm 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?
09:48clgv*warn-on-reflection* isn't even set to true in any of my files.
09:50pyrhi
09:51pyrI have to use reify in a way I've never done before
09:51clojurebotllahna: anyway the answer is no. you can use #(some-fn %1 default-arg %2), for example
09:51pyri have an interface whose constructor takes an argument
09:52pyri want to implement the interface, then call the ctor
09:54pyrwhat would be the equivalent of (let [foo (reify Type (some-method [foo bar] (blah)))] (Type. "ctor argument"))
10:01fliebeldnolen: Hah, there you are. I haven't even started, and I'm already running into trouble.
10:02fliebelI'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:04fliebeldnolen: And then there is still this bit, which involves negation: \+member(C,Visited),
10:16dnolenfliebel: 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:17fliebelhttp://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_15.html
10:41stestI'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:41stestfurthermore, is there a preferred way of figuring out what functions/multimethods work on a particular type of data?
10:52jarpiainstest: ##(count (filter #{ \. } "a...b.c..d"))
10:52sexpbot⟹ 6
10:54stestjarpiain: thank you
10:54rlbstest: have you seen http://clojure.org/cheatsheet
10:55rlbIs 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:55stestrlb: I actually did come across that yesterday. thanks though, it should help
11:13rak85hi, guys
11:13rak85i have this structure -> [[1 2] [3 4]]
11:13rak85and i want to transform to {:1 2 :3 4}
11:13rak85any ideas?
11:13rak85i thought in a map followed by a merge
11:14rak85the order is important...
11:14raek,(into {} [[1 2] [3 4]])
11:15clojurebot{1 2, 3 4}
11:15raek...if it is fine to have integer keys, instead of keyword keys
11:15oelewapperke,(while true (+ 1 1))
11:15rak85thanks
11:15oelewapperkewhat does that do ?
11:15clojurebotExecution Timed Out
11:16stestrak85: I could be completely wrong, but doesn't something like zip do that?
11:16raekoelewapperke: it evaluates the expression (+ 1 1) a lot of times
11:16stestthat's python anyway...
11:17oelewapperkeraek: why doesn't it cause a stack overflow ?
11:17raek,(let [xs [[1 2] [3 4]]] (zipmap (map first xs) (map second xs)))
11:17clojurebot{3 4, 1 2}
11:17raek,(let [xs [[1 2] [3 4]]] (zipmap (map (comp keyword str first) xs) (map second xs)))
11:17clojurebot{:3 4, :1 2}
11:18rak85raek: thank you
11:18raek,(let [xs [[1 2] [3 4]]] (into {} (for [[k v] xs] [(keyword (str k)) v])))
11:18clojurebot{:1 2, :3 4}
11:18TimMcoelewapperke: while uses a loop
11:18raekthere are many ways...
11:19raekoelewapperke: you get a stack overflow if a function calls a function that calls a function that calls a function....
11:19raekoelewapperke: loops do not allocate stack frames
11:20manutteror 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:20oelewapperkeonly function calls do
11:20oelewapperke?
11:20raekyes
11:21raekstack overflow referes to the method call stack of the JVM
11:33joly,(#(% %) #(% %))
11:33clojurebotjava.lang.StackOverflowError
11:34clgvlol great
11:38edwShould 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:43cemerickedw: I'd say that's accurate. There are definitely significant changes / features in the wings still.
11:51edwcemerick: Thanks.
11:52pietiaclojurebot,
11:52clojurebot#<ClassCastException java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;>
11:53dnolenfliebel: any progress?
11:53fliebeldnolen: nooo! Well, a little.
11:54fliebeldnolen: http://paste.pocoo.org/show/391274/
11:56fliebeldnolen: 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:57fliebelSome guy solved reverse with append, but that is very inefficient, is it?
11:59dnolenfliebel: what's weird about reverso?
12:00fliebeldnolen: 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:00dnolenfliebel: your path has a cycle right?
12:00fliebeldnolen: yea, that is why I need to make sure we've not been there already with not-membero
12:01dnolenfliebel: the path code is way simpler if you just use a tabled goal.
12:01fliebeloh!
12:01fliebeldo enlighten me :)
12:02dnolenfliebel: look at the section on tabling, https://github.com/clojure/core.logic
12:02dnolenfliebel: there's a cycle there as well.
12:03fliebeldnolen: But how would I use tabling with all the sugar? Or do I need to write classic style again?
12:05dnolenfliebel: (defne ^:tabled travel ...)
12:06fliebel… doesn;t help
12:06dnolenfliebel: I think reverseo needs to use append.
12:07dnolenfliebel: paste.
12:07fliebelokay
12:07fliebeldnolen: Just what you have already, but with ^:tabled http://paste.pocoo.org/show/391274/
12:08fliebelAnyway, why would it fail in the first plaace with not-membero? I get results like (5 2 3 2 1 3 1)
12:09dnolenfliebel: you don't need all that other stuff w/ tabling
12:09dnolenfliebel: you don't need to track visited
12:10fliebeldnolen: Well, then something else is wrong, because when I remove those, I still get double results.
12:10fliebel(5 2 5 4 5 2 1)
12:13dnolenfliebel: is there any reason to not just use the patho in my example?
12:14fliebeldnolen: I don't know. I haven;t really looked at what that does, but I think I could.
12:16fliebeldnolen: That doesn;t give me the path from a to b, does it?
12:17fliebelI'll make it so...
12:24fliebeldnolen: Huh, is tabled a function> I thought it was like exist
12:25dnolenfliebel: exist and tabled both are goals, one sec, I think you're investigation here has surfaced a bug around tabling + defrel, facts.
12:26fliebelweee, I did it again :P
12:26fliebeldnolen: So there is no reason really to do (defn blah [] (exist []))
12:36dnolenfliebel: the correct answer should be (2 3 4 5) right?
12:37fliebeldnolen: Uhm, that is what yours does, mine should give you ([1 3 5] [1 2 5] …) for all paths from 1 to 5.
12:37fliebelI'm almost there I think. I stared with your example now.
12:38dnolenfliebel: 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:39fliebelyea. I guess that is because your yabling considers all of them new values.
12:40fliebelor is this the defrel bug?
12:41dnolenfliebel: 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:41dnolenfliebel: probably a legitimate tabling bug.
12:41fliebeluh, oh
12:43dnolenfliebel: I'll have sit down and think about what's going on here, thx again for surfacing the bugs :)
12:43fliebelyou're welcome. Thanks for fiximg them :)
12:44dnolenfliebel: 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:45fliebeldnolen: hehe, everything you don't really understand breaks down.
12:46dnolenfliebel: too true.
12:46dnolenfliebel: fix and test cased for your graph in the next few days.
12:47fliebeldnolen: awesome, so next weak I can have maze solvers and 'ticket to ride' players and all :)
13:25fliebeldnolen: Is there stuff for defining facts from a seq? You have so little documentation I can't tell for myself.
13:27fliebeldnolen: Oh, you might be able to solve https://4clojure.com/problem/91 your patho :)
13:28dnolenfliebel: no, but that would be useful
13:33dnolenfliebel: issues created, http://dev.clojure.org/jira/browse/LOGIC
13:36fliebeldnolen: Cool, thanks.
13:38fliebeldnolen: 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:38dnolenfliebel: why do you want that?
13:39fliebeldnolen: Well, to use a map, or pair seq to define facts.
13:40dnolenfliebel: I don't think I will change defrel, but I'll will probably add extend-rel that does what you want.
13:40fliebelokay, cool
13:41fliebeldnolen: And, maybe I'm saying stupid things, but what about 'anonymous relations'?
13:41fliebelclojurebot: ( is http://xkcd.com/859/
13:41clojurebotRoger.
13:41dnolenraek: hey do you have a link to your core.logic DCG gist?
13:42dnolenfliebel: ?
13:43fliebeldnolen: weeell, lets saaay… I just want an one-shot relation, get some result, put new data in, get more results.
13:44dnolenfliebel: a paste of what you think this would look like?
13:45mrBliss`I think it'd be better if the "Congratulations, you've solved the problem" on 4clojure.com were green.
13:49fliebeldnolen: http://paste.pocoo.org/show/391344/
13:57amalloymrBliss`: yes, we need to improve the way we display "transient" messages. there's an open issue for it
13:59dnolenfliebel: interesting, I'll think about it.
14:18jweissis 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:21amalloy&(into {} (for [[k v] {4 nil 5 10} :when (not (nil? v))] [k v]))?
14:21sexpbot⟹ {5 10}
14:23amalloyyours is probably clearer, though. i guess i'd write it as ##(into {} (remove (comp nil? val) {4 nil 5 10}))
14:23sexpbot⟹ {5 10}
14:23edw&(map (fn [x] (incr x) '(1 2 3 4 5)))
14:23sexpbotjava.lang.Exception: Unable to resolve symbol: incr in this context
14:23edw&(map (fn [x] (inc x) '(1 2 3 4 5)))
14:23sexpbotjava.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$map
14:23edw&(map (fn [x] (inc x)) '(1 2 3 4 5))
14:23sexpbot⟹ (2 3 4 5 6)
14:24amalloyedw: ##(map inc [1 2 3 4 5])?
14:24sexpbot⟹ (2 3 4 5 6)
14:24robonobo`edw: you can just do
14:24robonobo`&(map inc '(1 2 3 4 5))
14:24sexpbot⟹ (2 3 4 5 6)
14:25edwrobonobo`: Yeah, I was just trying to get sexpbot to spit out a ==> char. Trying to make my Emacs recognize Unicode.
14:25edwAh, wait, guess it's the font...
14:25amalloy&1 might have been easier :P
14:25sexpbot⟹ 1
14:26robonobo`it looks crappy in emacs for me too
14:26edwI'm feeling a bit under the weather: too many Frozequis last night.
14:26amalloy&(int \⟹)
14:26sexpbot⟹ 10233
14:26amalloythat's the unicode character number if you find that helpful
14:27edwHmm. Lemme see what fonts support that on my Mac...
14:30amalloyedw: fork sexpbot and send a pull request with a different character. Raynes loves it when people complain about his arrow character...
14:30amalloyjust, uh, don't tell him it was my idea
14:30RaynesIf somebody comes up with a better unicode character, I'm all for it.
14:31robonobo`why does it have to be unicode?
14:31Raynesedw: Lucida Grande supports that. It's what I'm using.
14:32wastrelsexybot?
14:32Raynesrobonobo`: 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:32amalloyrobonobo`: uh, what else would it be? you prefer big5?
14:32Rayneswastrel: Pronounced aloud, it sounds like 'sexbot'.
14:32edwRaynes: Thanks. Need a monospaced face. We're talking Emacs...
14:32wastrel⟹ is what you're talking about?
14:33wastrelit looks like an em-dash on my terminal
14:33wastrelif i crank the font size up big enough i see itls a ===>
14:34amalloywastrel: that's interesting. it's as tall as an = in my font
14:48TimMcRaynes: ☃ would be much better
14:49RaynesHeh.
14:49TimMcWTF, I just went to http://unicodesnowmanforyou.com/ -- and noticed the snowflakes are pentagonal.
14:49TimMcThat's not Earth chemistry.
14:51technomancyTimMc: unicode is not necessarily earth-centric
14:51technomancythough they did refuse to include the klingon codepoints....
14:51TimMcheh
14:53mrBliss`amalloy_: problem51 on 4clojure is called "Advanced Destructuring" but has as tags "easy destructuring"?
15:20amalloymrBliss`: it's an easy problem, about advanced destructuring. there's not really any *hard* destructuring problems?
15:21mrBliss`amalloy: Why is it called "Advanced Destructuring" instead of just "Destructuring"? (I'm nitpicking here ;-)
15:21amalloyto contrast with Intro to Destructuring. if we just called it Destructuring it would look weird
15:22amalloywhereas the way it is, only nitpicking whiny babies complain :)
15:24mrBliss`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:26TimMcSo, it's an easy problem on the path to learning advanced destructuring?
15:27mrBliss`There are two problems about destructuring, both easy, but the first one is called "Intro to Destructuring" and the second one "Advanced Destructuring".
15:28mrBliss`I was just confused by the tags: "easy destructuring". Anyway, just forget what I said amalloy. 4clojure.com is great fun!
15:35amalloymrBliss`: i'm not actually objecting to your complaints
15:35amalloyplease 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:39mrBliss`amalloy: that's all for now :-) And I wouldn't call it complain, just 'notice'. I'll comment on issue 62.
16:43raekdnolen: https://gist.github.com/954080 and https://gist.github.com/954222
16:48stirfoo(gcd 9 2343)
16:49stirfooOne day, while eating Ho-Hos, Steele and Sussman noticed...
16:49stirfooThat was completely believable until I read the footnote
17:00lawfulfalafelI am trying to get the emacs-starter-kit to work, but for some reason I am stuck
17:00raeklawfulfalafel: how did you install it? did you remove any old .emacs* files?
17:01lawfulfalafelI have no .emacs or .emacs.d folders, this is a new install
17:01lawfulfalafelI ran git clone git://github.com/technomancy/emacs-starter-kit.git ~/.emacs.d
17:01lawfulfalafeland then tried M-x package-list-packages
17:01raekand ~/.emacs (the file) does not exist?
17:02lawfulfalafeland I get [No match]
17:02raekdo you have a menu bar and a toolbar?
17:02lawfulfalafellol
17:02lawfulfalafelno, I still had a .emacs
17:02lawfulfalafelI thought I had removed that
17:02raekif so, then emacs-starter-kit has not loaded :)
17:03raekyou can move it to ~/.emacs.d/<your-username>.el
17:04lawfulfalafelokay I did that, and then I installed clojure-mode, but now I can't get M-x clojure-install to work
17:05lawfulfalafelI am trying to follow this: http://freegeek.in/blog/2009/08/setting-up-emacs-clojure-with-emacs-starter-kit/
17:05raekclojure-install?
17:05raeklawfulfalafel: I would suggest following http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
17:06raeklawfulfalafel: clojure-install is from pre-leiningen times, iirc
17:06lawfulfalafelah
17:08lawfulfalafelis there a good tutorial for making a simple project with lein?
17:08lawfulfalafelI really don't know what I'm doing here
17:08raekthe leingen tutorial
17:08stirfoothe single lein script is pretty sweet for getting up and running, well for getting clojure and friends installed
17:09raeklawfulfalafel: 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:09raeklawfulfalafel: https://github.com/technomancy/leiningen/blob/master/TUTORIAL.md
17:10raekor "lein help tutorial | less"
17:12lawfulfalafelokay for installing lein, it says that you have to "add it your path"
17:13lawfulfalafelthat means I want to put it in a place listed by "echo $PATH", right?
17:13raeklawfulfalafel: yes. either that or add the directory where you keep it to the PATH
17:13amalloylawfulfalafel: ~/bin/lein is a popular place for it
17:14amalloyand having ~/bin on your PATH is useful in general
17:14stirfoome thinks ubuntu adds ~/bin to your path automagically, from a bash script in /etc
17:20stirfoobut it will only add it if ~/bin actually exists
17:26technomancyraek: did you see the latest on M-x clojure-jack-in? I need to update confluence for that
17:29technomancylawfulfalafel: http://technomancy.us/149 <= just simplified things significantly
17:32raektechnomancy: cool! does this mean that clojure-mode contains a version of slime?
17:32amalloystirfoo: what script is that?
17:32technomancyraek: swank-clojure does actually
17:33technomancyjust revamped the swank readme last night
17:33kencauseyamalloy: .profile, .bash_profile or .bashrc generally
17:34kencauseytechnomancy: I commiserate with your 'tracking slime' pain.
17:34amalloykencausey: 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:34stirfoothe skeleton files copied over to a new users home dir looks for ~/bin
17:35kencauseyamalloy: oops
17:35amalloyoh, there it is, in the .profile
17:35kencauseyit seems like whether or not this is in any of the standard scripts is something that goes in and out of style regularly
17:36stirfooI think ubuntu may have carried that over from debian, although it's been a while since I've ran debian
17:38kencauseyThat's likely, as it is in Debian currently anyway
17:52Null-Ais zach tellman here?
17:52Null-Awhat's his irc name
17:54raekNull-A: I think he uses "ztellman"
17:54Null-Ak
17:54Null-Athx
17:54raek$seen ztellman
17:54sexpbotztellman was last seen joining on :#clojure 1 week and 1 day ago.
17:58puredangerso..... I'm trying to proxy a Java object with overridden methods (same arity, different types). how do I proxy just one of them?
18:02amalloypuredanger: 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:02puredangeramalloy: I would do that if I had to - do you just provide one method impl or many?
18:03amalloypuredanger: 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:04amalloyNull-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:04puredangerNull-A: yes, ztellman is very responsive on the mailing lists for aleph, lamina, etc
18:05Null-Ak
18:05Null-Ayah, I can't get his stuff working
18:05puredangerNull-A: I have used Lamina quite a bit but it was a few months ago
18:06Null-AI tried his echo-handler and chat client examples, neither work pure
18:06Null-Ain both cases I can connect, but no echoing happens
18:07Null-Athe twitter example gives an exception
18:07Null-Ajava.lang.IllegalArgumentException: No implementation of method: :queue of protocol: #'lamina.core.channel/ChannelProtocol found for class: aleph.core.channel$splice$reify__2242
18:09puredangerNull-A: sorry I can't help right now... I'd ask on the mailing list for the project
18:09Null-Ak, no worries
19:14jtoyhow 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:15jtoydoh, i see the error now
19:15rmarianskicheck lib/
20:03clj-powered-botcheckout my clj bot :D
20:04clj-powered-boti'm using compojure, hiccup, aleph/lamina, getty http server, websockets
20:04clj-powered-botfutures
20:24clj-powered-bottest
20:25clj-powered-bottest
20:31clj-powered-bottest
20:34brehautclj-powered-bot: perhaps you could use a backchannel to test?
20:35Null-Abrehaut: yah sorry. i'm trying to do that, but its caching my code somehow
20:35Null-Acan't update channel,
20:35Null-Ai see why
20:47amalloyNull-A: you could also join #test
21:30symboleIs there a way to do something akin to (for [[x y] [1 2 3 4]])? That particular example is not valid.
21:30amalloyuh
21:30amalloywhat do you wish it did?
21:31symboleWith every iteration x and y get bound to 1 2, and then 3 4.
21:31amalloy&(for [[x y] (partition 2 [1 2 3 4])] [x y])
21:31sexpbot⟹ ([1 2] [3 4])
21:33symboleI see. Thanks.
21:35amalloypartition is great for grouping together pieces of a list
21:35amalloyif you instead wanted to work with each adjacent pair in the list, you could ##(partition 2 1 [1 2 3 4])
21:35sexpbot⟹ ((1 2) (2 3) (3 4))
21:42symbolepartition worked great.
21:42wastreli'm doing 4clojure
21:43wastrelhow do i get pretty printing and brace matching in my repl?
21:48amalloywastrel: the slime repl has them, and i assume the ccw repl does too. i know cake repl does brace matching, at least
21:49wastreli'm using rlwrap currently
21:49wastrelit has yummy history and vi-mode editing
21:50wastrelnot an emacs user
21:59wastrelhrm brace matching is slightly less important if you write code from the outside in
22:03amalloyit's less important if you have paredit :P
22:04wastrelgoogle says that's emacs jazz
22:04amalloyindeed. though ccw has most of the same features, i thnk
22:05amalloyi wouldn't be surprised if someone had ported it to vim. it's a huge boon for editing lisp
22:06wastreli just found vim-clojure
22:06dnolenthere's also slimv, http://www.vim.org/scripts/script.php?script_id=2531
22:20hugoda short intro to the debugger in swank-clj, so you can see what you are missing http://vimeo.com/23932914
22:22danlarkinthe audio is sooo low
22:22danlarkinI didn't realize it had any at first
22:26wastreli will watch it to learn the errors of my waze
22:39hugodmm, my headphones seem to have a different volume to everyone elses then :(
22:40symboleIs this debugging facility available in SLIME, or only swank-clj in particular?
22:41hugodthis is pretty much SLIME standard, but has not been available before for clojure
22:51wastreldoes this mean i have to learn to read java bytecode?
22:54hugodonly if you want to
23:04amalloythe volume is indeed quite low
23:06hugodI'll redo it tomorrow
23:07amalloynot quite done watching it but i'm jealous already
23:08amalloy"pass exception to program" implies it catches every exception thrown?
23:09dnolenhugod: doesn't work w/ 1.3.0 yet right?
23:09hugodthat is one area to improve - it breaks on uncaught exceptions, plus a few where the catch locations match certain criteria
23:09hugoddnolen: it works - I need to turn off the aot though
23:10hugodand add support for invokePrim
23:10hugoddnolen: are you using alpha7 or master?
23:11dnolenhugod: alpha7
23:27hugoddnolen: just pushed a 0.1.6-SNAPSHOT with aot disabled and with invokePrim support
23:31hugodwithout aot, the startup is very slow
23:38tomoj&(->> (range 100) shuffle (take 8) (map vector (cycle [1 -1])) (into {}))
23:38sexpbot⟹ {1 75, -1 45}
23:38tomojproblem is I want (map vector (shuffle (take 8 ...)) (cycle [1 -1]))
23:39tomojdo I have to lose the ->> or is there some clever trick?
23:42tomoj&(into {} (map vector (->> (range 100) shuffle (take 8)) (cycle [1 -1])))
23:42sexpbot⟹ {32 1, 78 -1, 62 1, 16 -1, 37 1, 85 -1, 6 1, 9 -1}
23:42tomojugly
23:44amalloytomoj: yeah, you can't really stitch into anything but second or last position
23:45brehautyou could use pmoc and a bunch of #(
23:46rmarianski&(->> (range 100) shuffle (take 8) (map #(vector %2 %1) (cycle [1 -1])) (into {}))
23:46sexpbot⟹ {28 1, 96 -1, 90 1, 6 -1, 83 1, 8 -1, 31 1, 68 -1}
23:46tomoj(comp flip vector)?
23:46brehautrmarianski: you can use vec in place of #(vector there i believe
23:47tomojer.. just (flip vector)?
23:47amalloytomoj: surely that would be just (flip vector)
23:47amalloybrehaut: noooooooo
23:47brehautreally?
23:47amalloy&(vector 1 2)
23:47sexpbot⟹ [1 2]
23:47amalloy&(vec 1 2)
23:47sexpbotjava.lang.IllegalArgumentException: Wrong number of args (2) passed to: core$vec
23:47brehautoh yeah
23:47tomojrmarianski: it doesn't really exist
23:47amalloyrmarianski: it doesn't exist in clojure as a builtin
23:47brehautsorry i missed why vector was being used there
23:48rmarianskiamalloy: i only see bit flip, is it in contrib?
23:48amalloyrmarianski: it's a function/name we're stealing from haskell
23:48rmarianskiright ... i see, you mean write one?
23:49amalloyin fact i've already written a more-general flip at https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/reorder.clj
23:50amalloydoes argument reversing (flip is a special case of that), rotating, and arbitrary reordering
23:51rmarianskinice
23:51amalloyso yes, i would just write it with (reorder vector)
23:55hugod&(->> (range 100) shuffle (take 8) (vector (cycle [1 -1])) (reverse) (apply map vector) (into {}))
23:55sexpbot⟹ {97 1, 35 -1, 53 1, 27 -1, 2 1, 59 -1, 76 1, 78 -1}