#clojure log - Mar 22 2011

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

0:07 devn: technomancy: awesome.

0:07 technomancy: not sure if it's possible, but it would be nice to not have lein-search reformat the project.clj on an add

0:08 technomancy: devn: if lein-search gets merged, it will only be for searching

0:08 I'm not to keen on automated changes to project.clj

0:09 devn: technomancy: any reason in particular? ive never been burned by it. if it's only an add that seems reasonable...

0:09 technomancy: devn: you can embed arbitrary code into defproject

0:09 :repositories [[org.clojure ~clojure-version]]

0:10 pretty-printing aside it's just something you have to be very careful with

0:11 devn: fair enough -- ive just been noticing some of the pain associated with finding the version, saving, deps, swank, slime-connect, test

0:11 wish i could cut that down even by a step or two

0:12 scottj: If I want to keep the last n items added to a collection what collection type should I use?

0:12 devn: having something like `gem` would be nice, which granted doesn't give you the ability to automatically add per se -- i mean a gem install foo will get the gem installed i suppose

0:12 technomancy: devn: you can do user-level plugins; you could have a lein-add plugin that just assumes you aren't doing anything fancy in project.clj

0:14 devn: technomancy: yeah i think im noticing some deficiencies in my setup

0:14 not so much in lein, but regardless a lein deps + swank default task might be nice

0:15 scottj: vector

0:17 scottj: frankly it depends

0:17 technomancy: devn: so you add dependencies pretty frequently?

0:18 you know you can chain tasks, right?

0:18 lein clean, deps, swank

0:18 Derander: god I wish you could add deps w/o restarting swank

0:18 technomancy: doesn't compose with durendal, but hey

0:19 devn: technomancy: i didn't know that actually, and frankly it's not so bad -- it's just the waiting for the JVM coupled with the download time, with a slice of reconnecting in emacs

0:19 scottj: you could create an alias that runs lein deps, lein swank, and emacsclient slime -connect

0:20 devn: it would be awfully nice to type lein madison-square-clabango, have it grab deps, start the swank server, and connect my emacs

0:20 scottj: yeah, i guess i don't because technomancy is right -- you don't add deps like a madman for the life of an entire project

0:21 so once that setup time is over i think: hm, that sort of was a pain, i should think about automating that, and then dont think the same thing until the next time

0:21 it's like a fly hitting a window -- after ~3 times it learns there's a window there

0:22 but that doesn't mean it won't hit another window 3 more times

0:22 scottj: your alias wouldn't be project specific

0:24 devn: *nod* -- i understand what you're suggesting and agree i should absolutely do that, but either way it strikes me as kind of a wonky usability issue for most

0:24 either way, im outta here -- have a good night

0:40 dsantiago: What the hell could Virtualbox even be doing to cause a kernel panic?

0:41 LuminousMonkey: The host is panicing?

0:41 dsantiago: Scuse me, wrong window.

0:41 But yes.

0:42 LuminousMonkey: No worries, next time I will correctly spell panicking.

0:44 Error in the VirtualBox kernel modules maybe?

0:45 dsantiago: Yeah, must be it.

1:19 technomancy: devn: you could write durendal-jack-in alternates that do more than just start a swank server

1:19 anyway

1:19 food for thought

2:11 fmw: anyone awake that is using filters in Lucene? I can't get them to work at all, for some reason. Queries with a filter simply don't return any results. I've written a small demonstration project (including dummy data to run the test) here: https://github.com/fmw/clojure-lucene-demo/blob/master/test/clojure_lucene_demo/test/core.clj#L286

2:12 incidentally, I'm also planning on keeping this online as example code for using Lucene from Clojure once its fixed, so feel free to yell at me in case I'm not being idiomatic somewhere as I'm very new to clj still ;)

4:23 TobiasRaeder: Morning

5:16 ejackson: Good morning noble coders

5:21 cemerick: nobility is a rare thing, I'm afraid

5:21 angerman: good morning sir ejackson...

5:22 cemerick: :)

5:22 Raynes: cemerick: Morning.

5:23 cemerick: Once Mick Jagger got knighted, I think the key certification body for nobility lost its caché. :-P

5:23 Raynes: hi :-)

5:24 ejackson: you raise a valid point.

5:24 steve yegge's piece is pretty cool. not surprising, I guess, but cool nevertheless.

5:24 cemerick: Even the Klingon high command lost its cred with that scandal in TNG.

5:24 ejackson: p'tak !

5:25 cemerick: I've forgotten all my Klingon lore at this point.

5:25 *sadface*

5:26 ejackson: you have forgotten even Kahless ? He's supposed to be the Unforgettable.... tsk tsk.

5:26 cemerick: ooo, ooo, Duras!

5:26 :-D

5:27 hircus: cemerick: remember, even Shakespeare is better in the original Klingon :)

5:27 ejackson: LOL !

5:27 cemerick: hircus: that, I did not forget!

5:27 This channel's nerd quotient has never been higher. My apologies. ;-)

5:28 hircus: the recent Java refugees must be confused :p

5:28 raek: tlhIngan Hol bojatlhlaH'a'?

5:28 hircus: damn, I wish Google Translate supports Klingon

5:28 raek: }}:-)

5:29 brehaut: it doesnt?!

5:30 hircus: I remember the days when Red Hat Linux's Rawhide could be installed in Pig Latin and Swedish Bork

5:30 ejackson: Federation Flunkies.

5:31 Well, this has been a great start to the day ! Much obliged, fellow nerds :)

5:32 cemerick: Too bad it had to go with the stereotypical sci-fi direction. Maybe next time, I'll open up with some obscure Truman references for the history nerds.

5:32 * cemerick listens to the crickets ;-)

5:35 ejackson: the trouble with history is that its all local.

5:36 cemerick: One of its most appealing characteristics, IMO.

5:37 hircus: cemerick: as a history nerd myself, I look forward to tomorrow, then

5:37 cemerick: But that's what separates a good historian from the rest -- they can peel the onion back enough so that just about any history is universally relatable.

5:39 ejackson: hircus: a historian looking forward to tomorrow.... ?

5:40 s/a /an /

5:40 sexpbot: <ejackson> hircus: an historian looking forward to tomorrow.... ?

5:42 cemerick: ejackson: "There is no present or future, only the past, happening over and over again, now." – Eugene O'Neill

5:44 ejackson: cemerick: that's tremendous !

5:44 Fossi: is it?

5:45 i'd rather say there is no past and future, only present, but who am i to argue... :]

5:45 cemerick: I doubt O'Neill had it all figured out in any case.

5:46 ejackson: wel.... he does sound a little too irish to be trusted

5:47 (just kidding)

5:47 cemerick: smashing, I managed to stir up a centuries-old blood feud in just a few msgs! ;-)

5:47 Raynes: I wish there was a pill one could take that could force them to get work done.

5:49 ejackson: Raynes: i know that pill. Its called quitting a perfectly good job do try do something insane :)

5:49 cemerick: hehe, I have the feud in my own blood, both sides, annoyingly.

5:50 Raynes: ejackson: Not work in context of employment. Just stuff I need to do.

5:50 Everything I do is insane, but I have to do it in order for it to be insane.

5:50 hircus: those who don't understand history are doomed to repeat it -- my bad paraphrasing of Santayana

5:51 ejackson: Raynes: this _is_ what I mean. the only way to be motivated is to have consequences for inaction. Arrange that if you don't do this work, horrendous things happen to you.

5:52 hircus: ejackson, Raynes: stickK.com does something like that. you can set up punishments for yourself

5:52 like donating to your least favorite cause :p

5:52 Raynes: ejackson: So, essentially, I need to rig up blowguns to air compressors around my chair with trip wires that I'll trigger if I am to move? That sounds like it could work.

5:53 Fossi: nice variation of procrastination

5:53 hircus: NPR has a recent show on it, I believe -- or one of the other podcasts I listen to. one author actually threatened himself with suicide if he did not finished a long-delayed book in 10 days

5:53 ejackson: Raynes: yes... you've seen Saw ? Selfapply that.... :P

5:54 Raynes: That's just sadistic enough to work.

5:54 Let's patent it!

5:55 * angerman would really like to have (cycle [n coll])

5:55 ejackson: its certainly worth a jokey self help (or is that self harm ?) book :)

5:59 angerman: ,(defn shift [n coll] (let [l (count coll)] (take l (drop (mod n l) (cycle coll)))))

5:59 clojurebot: DENIED

5:59 angerman: :/

6:00 that is a really useful fn.

6:02 raek: hrm, (defn roll [queue] (conj (pop queue) (peek queue)))

6:03 angerman: reak, that's just one and only in one direction

6:03 shift takes n \in N

6:03 err Z

6:04 Fossi: angerman: feeling stacky?

6:04 raek: fair enough :)

6:04 angerman: Fossi: more ringy.

6:05 * Fossi wonders whether there's a nice java implementation for rings

6:07 angerman: on a more fundamental level, at least for the datastructure (which is not a mathematical ring), one would probably used a cyclic double linked list with a "current-position" pointer...

6:07 Fossi: yeah

6:07 haven't seen one of those in java so far

6:14 Raynes: Anybody feel like proof-reading a relatively short blog post for me?

6:15 raek: Raynes: o/

6:15 Raynes: raek: \o, is that an offer? :D

6:15 * angerman thinks o/ looks like a raised hand

6:16 Raynes: angerman: That's what it is.

6:16 angerman: while \o/ obviously looks like "help"

6:16 Raynes: It's a high five gesture.

6:16 Fossi: or a rounded lol

6:16 lol looks more like help imho

6:16 Raynes: Fossi: Good observation.

6:16 angerman: Never felt that "high five" thing to have reached Germany...

6:16 Fossi: no, that looks like egyptian ancient dance stuff.

6:17 (depending on font… i guess)

6:17 Fossi: lol always makes me see a bank robbery

6:17 and now you cannot unsee it either mwahahah

6:18 angerman: /o/ \o\ /o/ \ \

6:18 Fossi: ups, that guy lost his head somewhere

6:19 or he's a lot smaller with freakishly long arms

6:19 angerman: interesting. those pictograms seem to be understandable.

6:20 I will though probably never really feel like seeing eyes in ^^

6:23 Fossi: that's only because you aren't used to them

6:24 most people really didn't see a face in :) for a while

6:24 angerman: No. I'm used to ^^

6:24 Fossi: now you can even do stuff like ;§ and people will get the point

6:24 angerman: Friends and family use them so often.

6:24 Fossi: i think (^^) makes it clearer

6:25 * Fossi likes ('-_-) better anyway :D

6:25 Fossi: (^_^) rather

6:25 angerman: Even though I know where they come from. I have a hard time admiring them and really seeing their correlation to eyes.

6:25 (-_-) is ok, so is (O_O) or (O_o) or without parens.

6:53 fmw: anyone interested in some Apache Lucene example code in Clojure? I just wrote some: https://github.com/fmw/clojure-lucene-demo

6:54 keep in mind that I'm quite new to Clojure, so there is probably some non-idiomatic code lurking around in there (feel free to point it out and I'll gladly fix it and learn something)

8:52 carkh: hello

8:54 TimMc: fmw: (. Version LUECENE_30) can be rewritten Version/LUCENE_30 if that's a static field reference.

8:56 fmw: Similarily, (. IndexReader open directory) can be (IndexReader/open directory)

9:04 fmw: TimMc: cheers, I updated that

9:04 looks better indeed

9:19 gfrlog: not finding too much by googling -- anybody know if there are any tools for using clojure with Jena?

9:21 angerman: Jena?

9:22 gfrlog: is a semantic web framework

9:23 guess I'll have to make one then :)

9:23 angerman: I guess you have to live with interop layer

9:24 clgv: gfrlog: it is java, so you just need to know java interop ;)

9:24 gfrlog: yep.

9:34 ,(def person-uri "http://somewhere/JohnSmith")

9:34 angerman: Oh Noes!...

9:34 clojurebot: DENIED

9:35 gfrlog: I get a strange exception from that line at the repl

9:35 angerman: what's the exception?

9:35 gfrlog: well it cleared up after I restarted the repl -- but it was printing out the following and then the def succeeded anyhow:

9:35 java.lang.Exception: Unable to resolve symbol: in this context (NO_SOURCE_FILE:0)

9:36 must have been some rodents gnawing on the bits or something

9:40 angerman: Ok, now I officially fail at proving.

9:40 gfrlog: like math?

9:40 angerman: yes

9:40 gfrlog: what are you trying to prove?

9:41 angerman: I tried to show that the product of two matrices with only real valued eigenvalues can only have real valued eigenvalues as well.

9:42 gfrlog: I did not take well to matrices...

9:42 angerman: gfrlog: well, I should be able to prove stuff correctly, it's my major after all.

9:43 ejackson: angerman: when do complex valued eigenvalues arise ?

9:45 angerman: ejackson: well. I have 8 skew-symmetric matrices.

9:46 skew-symmetric matrices have complex eigenvalues. In 3-space they have 1 vanishing (0) and two complex complementary eigenvalues.

9:46 ejackson: funkiness

9:47 gfrlog: angerman: I thought the only thing mathematicians did was come up with new equations

9:48 angerman: gfrlog: hmm no.

9:48 gfrlog: :)

9:48 ejackson: hehe, maths is meta. the mapping between its mappings and 'reality' are the key.

9:48 angerman: ejackson: no, that's physics

9:48 gfrlog: ejackson: please map transfinite induction to reality

9:48 angerman: ejackson: math does not need reality.

9:49 ejackson: eep. I retreat.

9:49 clgv: :D

9:49 gfrlog: now I need to go read the wikipedia article on transfinite induction

9:50 holy crap epsilon-induction

9:52 you learn something new every time you try to learn something new

9:53 clgv: but only if you learn something new ;)

9:53 gfrlog: oh right

9:57 * TimMc avoids quaternions, for now

9:58 TimMc: If I want to do animated rotations, I think I'll have to learn how to use them, though.

9:58 gfrlog: TimMc: angerman has 8 skew-symmetric matrices. Maybe they could help you rotate something?

9:58 TimMc: Nah, I need like 15 of them.

9:59 gfrlog: dag

9:59 TimMc: :-P

9:59 angerman: 15 for rotation?

9:59 in what space do you want to do rotations?

9:59 _and_ do animations.

9:59 TimMc: Was kidding.

10:00 I'm just going to use Euler angles. (rot Z, rot X, rot Y)

10:01 * angerman was just confused as 3-space has only 6 degrees of freedom.

10:06 TimMc: angerman: Does matrix stuff count as Algebra or Analysis? I once heard that all of math can be divided into those categories.

10:06 clgv: TimMc: algebra most of the time ;)

10:06 TimMc: Or are they simply a tool that is used in both?

10:06 clgv: though matrices are also used in higher dimensional analysis

10:07 * TimMc makes a note to learn what the hell tensors are

10:07 angerman: TimMc: I wouldn't say that you can differentiate them so clearly, but matrices are "just a tool" of linear algebra… which then again is just a subset of algebra.

10:07 TimMc: Tensors are just the natrual extension of matrices.

10:08 clgv: I dont think they are just a tool of linear algebra - in fact they are one of its big subjects/topics ;)

10:08 angerman: clgv: matrices are _just_ a tool. That become pretty obvious if you read material from the 18th centrury.

10:09 matrices are just a way to arrange numbers in a rectangular format.

10:09 nothing more. nothing less.

10:09 these days though people seemingly equate matrices with linear algebra.

10:09 clgv: hm but they also form monoids and groups and there are results on them. seems more than just tools to me ;)

10:09 gfrlog: matrices == linear algebra

10:10 * gfrlog waits for angerman to react

10:10 Fossi: hmm. quaternions. so yummy

10:10 angerman: gfrlog: someone had to follow suit on that statement.

10:11 clgv: groups?

10:11 TimMc: (= matrices linear-algebra) ##true or false?

10:11 gfrlog: I think this is a dispute about the meaning of "tool"

10:11 TimMc: bah, sexpbot wants parens

10:12 gfrlog: ,(= matrices linear-algebra)

10:12 clojurebot: java.lang.Exception: Unable to resolve symbol: matrices in this context

10:12 angerman: gfrlog: matrices are a way to write linear-algebra nicely.

10:12 TimMc: gfrlog: You forgot to require incanter. :-P

10:12 angerman: they are just a shorthand for writing multiple sums.

10:12 gfrlog: angerman: and heck, it's all just sets anyhow

10:13 clgv: angerman: invertible matrices form a group with multiplication afaik

10:13 gfrlog: if a math thing A can be formulated as a particular kind of math thing B, does that mean A doesn't really exist?

10:14 if I can construct set theory using matrices as a primitive, does that mean everything in math is really a matrix?

10:14 angerman: Oh, now this is becoming a flamewar.

10:14 gfrlog: whoops mybad

10:14 TimMc: This strikes me as a Formalism argument.

10:14 clgv: gfrlog: probably most of math doesnt really exists - did you ever spot a real number in the real world? ;)

10:14 gfrlog: clgv: agreed

10:15 TimMc: (What's the opposite of formalism?)

10:15 clgv: chaos

10:15 ejackson: comment threads

10:15 clgv: ejackson: good one :D

10:15 gfrlog: clgv: I once spotted a real number of real numbers

10:15 Chousuke: I think mathematical things are real, just not concrete.

10:15 TimMc: gfrlog: 0?

10:15 angerman: My point is: matrices eshew much of the underlying mathematics by being easily accessible.

10:16 Chousuke: even non-real numbers are real :P

10:16 gfrlog: TimMc: yeah, I thought of that

10:16 * angerman raises Chousuke an 0+1i

10:16 ejackson: i agree with Chousuke abstract is still real

10:16 TimMc: gfrlog: I'm not sure we have real numbers in this universe, actually.

10:16 clgv: "real" was never the question - "existence" was asked for

10:17 gfrlog: TimMc: you argue for physics being discrete?

10:17 TimMc: gfrlog: I'm not sure.

10:17 Chousuke: clgv: how do you define the existence of something abstract?

10:17 TimMc: I know a string theory professor, I should ask his opinion.

10:17 gfrlog: TimMc: I don't disagree

10:17 TimMc: But yes, that's what I'm referring to.

10:18 gfrlog: TimMc: if it is discrete, I believe that means that it is possible to encode every detail of the universe over all of history into a single real number

10:18 TimMc: In the realm of computers we *certainly* don't have the natural numbers even.

10:18 gfrlog: Not just that, an integer.

10:18 gfrlog: TimMc: I disagree

10:18 TimMc: every integer only contains a finite amount of information

10:19 TimMc: yes?

10:19 gfrlog: TimMc: perhaps time is infinite

10:19 TimMc: perhaps space is infinite

10:19 TimMc: Ah, perhaps.

10:19 gfrlog: TimMc: if neither, I imagine that means you're right

10:19 clgv: Chousuke: why do I have to?

10:20 TimMc: gfrlog: Here's a fun one: A *deterministic*, finite, discrete universe will eventually start looping.

10:20 Chousuke: clgv: because without such a definition it's pretty hard to make a case either way :/

10:21 clgv: Chousuke: I didn't draw "abstract" into the discussion ;)

10:21 gfrlog: TimMc: that is a fun one. Probably in practice it'd be a trivial loop

10:21 TimMc: Heat death, *then* loop. Fun times.

10:22 Chousuke: Would that mean that this conversation has already occurred uncountable times? :P

10:23 tomoj: at that point "occur" looks rather suspicious

10:23 gfrlog: Chousuke: either finite or countable I think

10:23 clgv: TimMc: well I read an article that explained that from a thermodynamic argument one can calculate the maximum distance where a parallel universe just like ours exists

10:23 the pity is we might never be able to travel there since we are too slow...

10:24 gfrlog: clgv: we could stay in this universe and have an equivalent experience

10:24 TimMc: clgv: Why would you want to go there?

10:24 ejackson: if you take Kant's perspective then anything which the mind perceives exists. We perceive numbers. They exist, even though we cant put them in our pipes and smoke them.

10:24 tomoj: if the universe is a looping record, why have the phonograph in our ontology at all?

10:24 Fossi: ejackson: damn

10:24 gfrlog: ejackson: what is that definition useful for?

10:24 * Fossi puts down those integers

10:24 ejackson: who said anything about useful ?

10:24 TimMc: tomoj: I... what.

10:25 clgv: "useful philosophy" - oxymoron or not? ;)

10:25 TimMc: :-)

10:25 gfrlog: ejackson: I just did; unfortunately I'll have to follow that up with leaving the conversation. academics call.

10:26 ejackson: good luck.

10:26 gfrlog: ejackson: thx

10:26 * gfrlog trips on the way out

10:26 tomoj: TimMc: what's the difference between a universe that keeps repeating and one that just "plays" once?

10:27 clgv: hmm on a second thought: a parallel universe that is exactly like ours - couldnt be exactly like ours if you could just go there ^^

10:27 TimMc: tomoj: It wouldn't loop back from the start.

10:27 tufflax: tomoj: You just said it?

10:28 TimMc: It would just eventually hit a loop, like the hailstone numbers.

10:30 tomoj: tufflax: I meant to suggest that the distinction is meaningless

10:31 tufflax: I thought meaningless subjects was what we were going for :)

10:31 * angerman is sorry for what he started.

10:32 * ejackson hopes so !

10:32 TimMc: proofs -> matrices -> tools vs. objects -> philosophy of math -> all downhill from there

10:38 tomoj: for a bit I thought maybe I was attacking a straw man, but gfrlog's "either finite or countable" suggests otherwise - "how many times has the universe looped?" sounds like "how many times has god heard the record play?"

10:39 TimMc: heh

10:39 OK, change of topic:

10:40 Using α, β, & γ as variable names in a barycentric coordinate computation: Awesome or awesome?

10:41 (Or will this screw someone over who tries to use my code?)

10:41 angerman: TimMc: unless he screws with the file-encoding, no I don't think so

10:42 tomoj: my slime can't handle it :(

10:42 ejackson: TimMc: although it might drive you nuts rather quickly.

10:42 TimMc: If someone on a CP-1252 encoding system (Windows) uses my source jar file, they might get a surprise?

10:43 They're just local bindings, not exposed in the API.

10:43 raek: no, Clojure source files are always UTF-8

10:43 tomoj: which as it turns out is quite annoying - when exploring production data, non-slime-compatible characters are hidden landmines

10:43 raek: but slime uses ISO 8859-1 for the socket

10:43 TimMc: Haha, that's terrible.

10:43 raek: (you can configure that)

10:44 tomoj: glad to hear it, dunno why I haven't tried to fix it yet...

10:44 raek: fortunately, slime and swank are coding-aware, and does the translation correctly (as long as you configure swank and slime for the same coding)

10:44 TimMc: slime-net-coding-system ?

10:44 raek: yes

10:45 foxupa: hi

10:45 chouser: TimMc: the other problem is people trying to edit your code having difficulty typing those chars

10:45 TimMc: That's the one that has bugged me the most with my non-ascii variable names

10:45 raek: and then something like lein swank localhost 4001 :encoding '"UTF-8"'

10:48 foxupa: so i was wondering if there is a way to do basic continuation passing style lazy seqs?

10:51 tomoj: hmm, β at least seems to work after just changing slime-net-coding-system, no encoding opt passed to lein swank

10:52 raek: tomoj: if you do (seq "β"), what do you get?

10:52 \β ?

10:52 tomoj: (\β)

10:52 raek: great!

10:53 tomoj: I'm in your debt

10:53 clgv: ,(seq "β")

10:53 clojurebot: (\β)

10:54 raek: My work here (as the encoding nazi) is done.

10:54 TimMc: Thank you, encoding nazi!

10:54 Fossi: ,(seq "þ")

10:54 clojurebot: (\þ)

10:54 Fossi: hmmm

10:54 TimMc: :-þ

10:54 clgv: political incorrect vocabular here... tsk tsk :P

10:55 raek: :-ƿ

10:55 tomoj: I'd never before considered the literal meaning of "politically incorrect" which seems to apply :)

11:01 chouser: foxupa: like a sequence monad? or something else?

11:02 foxupa: chouser, the problem i'm trying to solve is as follows: I have a graph and want to compute the set of automorphisms of that graph

11:02 this involves essentially recursively descending down a tree of possible permutations and at the bottom of the tree checking if the permutation is a valid automorphism

11:03 but the problem is that for big graphs

11:03 there could be a very large number of automorphisms

11:03 so what i want is a lazy seq

11:03 so that the first element of the seq is the first leaf of the tree

11:03 the second element is the second leaf of the tree

11:03 etc

11:04 in scheme i know how to do this with continuations

11:04 however i don't know anything about monads, and i want to learn how they work, but at this time i'd rather just find hte most straightforward solution to get the job done

11:04 chouser: manually building a lazy seq using lazy-seq is structurally very similar to CPS

11:04 raek: foxupa: are you familiar with writing functions that produce lazy-seqs?

11:05 foxupa: well i'm browsing through the book Programming Clojure

11:05 but I just wanted to know that it is possible with lazy seq's right?

11:05 is there some kind of "yield" function or something I can just call in my tree walk?

11:06 raek: foxupa: you return a (lazy-seq ...) expression. the contained body will not be evaluated until when it is needed

11:07 chouser: foxupa: take a look at the replace-symbol example in that book, chapter 5

11:07 raek: when the body is evaluated, it most often returns something like (cons some-element (recursive-call))

11:07 so you get something like (cons some-element (lazy-seq ...))

11:07 tomoj: you already have a tree of permutations sitting there?

11:07 chouser: I personally think there is another book with a better example of lazy-seq, but Halloway's replace-symbol will do. :-)

11:07 foxupa: no the tree is being generated recursively (depth first search at this time)

11:08 raek, that method makes sense for the typical linear recursion pattern, but my difficulty is in walking back up the tree

11:08 (I'm looking up the replace symbol example now)

11:08 raek: hrm.

11:08 chouser: foxupa: ah, I see what you're saying.

11:09 perhaps some clever combination with the trampoline function would do it.

11:09 raek: (general lazy-seq example https://gist.github.com/480608)

11:09 chouser: or tree-seq with filter

11:09 actually, that sounds better.

11:10 foxupa: chouser, yes, I was looking into using trampoline, but that's why I was just wondering if this type of problem has been solved... in scheme continuations solved this perfectly but clojure doesn't have first class continuations as far as i can tell

11:10 chouser: foxupa: tree-seq will walk a tree depth-first, returning *all* nodes. filter that for your leaves and you'll be done

11:10 foxupa: actually chouser, the tree-seq seems the correct approach

11:11 chouser: foxupa: clojure does not have continuations because it maintains method-call compatibility with Java, which does not support continuations.

11:13 foxupa: chouser, wait, the problem is that many of the leaves are not valid (and you won't know which ones till you get to the leaf), so i'd like to have the lazy-seq only return the valid ones, but actually on secontd thought combining tree-seq with filter seems correct

11:13 actually maybe not

11:13 i'll play with some simple examples and get back to you guys on whether it works

11:19 also another general clojure-software-engineering question: sometimes I define a utility function within another function itself, but I'm not sure how to test this utility function from a separate test file that has my other tests... what is the best practice regarding this?

11:26 jkkramer: foxupa: if you want to test it, you'll have to def it at the top level. you could make it private with defn- (note trailing dash). there are tricks to access private vars from other namespaces, but not lexically-scoped locals

11:29 foxupa: jkkramer, I figured that would be the case... so is it generally better to hoist the util-function to top level and test or just do intensive testing of the entire function that it is in or is this always a case-by-case type of decision? (I'm trying to build better software-eng habits)

11:30 jkkramer: foxupa: case-by-case is how i decide. if the utility function is used in more than one place, probably good to test it on its own. if it's just one aspect of a larger, black-box-like function, maybe it's not needed

11:31 fliebel: goody morny :)

11:43 __name__: GOod morning fliebel

11:44 fliebel: I suppose no-one has written a kick-ass GUI lib while I was sleeping?

11:48 semperos: I have a collection of maps

11:49 I want to filter that collection

11:50 keeping only those maps that have key-value pairs that I pass in

11:51 so something like ({:a "foo", :b "bar", :z "hello"} {:c "baz" :d "etc" :z "hello"})

11:51 and filter to find the map that contains at least {:a "foo" :z "hello"}

11:52 how do I tackle this (cleanly)?

11:54 carkh: ,(select-keys {:a "foo", :b "bar", :z "hello"} (keys {:c "baz" :d "etc" :z "hello"}))

11:54 clojurebot: {:z "hello"}

11:54 carkh: ?

11:55 if the value needs to be the same, that's only one function calla way

11:55 semperos: ok

11:55 I'm actually dealing with records, so I know the keys are there

11:56 carkh: so your example is not quite good enough !

11:56 =)

11:56 semperos: :)

11:56 it's a bit confusing, but the function allows an arbitrary number of key-value pairs to check against

11:56 and returns the first for which all match

11:57 that's the intent, anyway

11:58 raek: semperos: one way could be to use clojure.set/index

11:59 (that approach is not lazy, though)

11:59 semperos: due to the nature of my domain, lazy isn't required (nor really possible)

11:59 raek: wait.

11:59 tomoj: docs on index utterly confuse me

11:59 semperos: me too :)

11:59 * semperos looks for example

11:59 raek: clojure.set/superset?

11:59 clojurebot: clojure is like life: you make trade-offs

12:00 semperos: hehe

12:00 fewer than elsewhere, clojurebot

12:00 jkkramer: ,(filter #(every? (fn [[k v]] (= (% k) v)) {:a "foo" :z "hello"}) [{:a "foo", :b "bar", :z "hello"} {:c "baz" :d "etc" :z "hello"}])

12:00 clojurebot: ({:a "foo", :b "bar", :z "hello"})

12:00 raek: index partitions a set of maps. you give it the key you want to index on, and it will return a map from values of those keys to sets of the maps those values for the keys

12:01 eh, not very easy to explain

12:01 semperos: jkkramer: lookin good

12:01 jkkramer: semperos: add a 'first' to that if you just want the first match, of course

12:01 semperos: right

12:01 raek: ,(filter (clojure.set/superset? % {:a "foo" :z "hello"}) [{:a "foo", :b "bar", :z "hello"} {:c "baz" :d "etc" :z "hello"}])

12:01 clojurebot: java.lang.Exception: Unable to resolve symbol: % in this context

12:01 * fliebel is designing wrappers around swing and java stuff for a game

12:01 raek: ,(filter #(clojure.set/superset? % {:a "foo" :z "hello"}) [{:a "foo", :b "bar", :z "hello"} {:c "baz" :d "etc" :z "hello"}])

12:01 clojurebot: ()

12:01 semperos: I was using a for to go through all the key-vals in the map and then filtering

12:02 which gave me a seq of seqs

12:02 so I had to do a nasty flatten-distinct-first combo

12:02 jkkramer: that's quite nice, thank you

12:02 raek: ah, no. superset is for sets... *duh*

12:03 fliebel: raek: A set is to a map as a keyword is to a symbol :P

12:04 amalloy: *brain melts trying to puzzle that one out*

12:04 raek: (defn contains-mapping? [m k expected] (if-let [[_ actual] (find m k)] (= actual expected) false))

12:05 fliebel: amalloy: Well, they are both hashes, but the keys of a set refer to themselves, while the keys in a map refer to their values.

12:05 amalloy: ah

12:06 raek: (defn contains-mappings? [m & key-vals] (every? #(apply contains-mapping? m %) (partition 2 key-vals)))

12:06 semperos: since I'm dealing with records, only change to jkkramer's code is (= (k %) v)) inside the second anon fn

12:06 thanks again, everyone

12:07 amalloy: semperos: fwiw that's equivalent to (comp #{v} k)

12:08 er, except mine's a function and yours is a result

12:08 semperos: :)

12:08 concept understood

12:09 devn: amalloy: i really like your utils repo -- i hadn't considered doing that

12:09 jkkramer: semperos: another caveat is that nil vals always match

12:09 amalloy: jkkramer: and for me, nils and falses never do

12:09 yours can be fixed with (= (k % (Object.)) v), mine can't :P

12:09 devn: i'm glad!

12:10 how'd you find it?

12:11 devn: someone posted it on twitter or disclojure i think?

12:11 semperos: jkkramer: understood; as I'm filtering against required record fields, that's ok

12:12 amalloy: yeah, i think it hit disclojure as well as planet-clojure

12:12 feel free to use mine, of course, though the intent was that you go out and make your own as well

12:13 devn: and suggested it was a cool idea -- it's like dotfiles

12:13 sorry some lag here

12:13 amalloy: heh

12:13 no worries

12:13 devn: but yeah, the idea of dotfiles is great because it's kind of a condensory

12:14 fliebel: devn: Doesn't clojure actually support something like it? user.clj or something like that. no dot though :(

12:14 devn: it forces you to generalize and abstract to the fullest extent possible

12:14 * amalloy immediately looks for excuses to use the word condensory in conversation

12:14 devn: fliebel: yes, but I don't know how common it is to use

12:14 either way i like the idea of having something on github to distribute

12:14 amalloy: fliebel: and it's not portable

12:14 devn: ^^

12:14 amalloy: if your program depends on something in user.clj nobody else can use it

12:15 * fliebel immediately lookign up condensory

12:15 devn: amalloy: condensory is good when dealing with literature, language and stuff

12:15 or at least that's where i use it

12:15 fliebel: amalloy: Yea, I figure that to. I thought a git hook could help here :D

12:15 devn: take a big paragraph and boil it down to its smallest parts inside your condensory

12:15 that sort of thing :)

12:15 amalloy: fliebel: augh i just had breakfast, don't make me throw up

12:16 fliebel: condesnory is not even in any dictionary I know of :(

12:16 (with that spelling, yeh)

12:16 amalloy: fliebel: what about condensory?

12:16 fliebel: nope

12:16 jkkramer: condensery

12:17 fliebel: I'm pretty sure my right click does not make such mistakes.

12:17 amalloy: haha

12:17 $dict condensery

12:17 sexpbot: amalloy: noun: A place in which condensed milk is manufactured

12:17 amalloy: $dict condensory

12:17 sexpbot: amalloy: Word not found.

12:19 * fliebel will never know the meaning of condensory

12:19 amalloy: fliebel: it's easy to make up a meaning from the roots, though. "having the effect of condensing"

12:19 which i like rather better than the thing about milk

12:33 Raynes: devn: I see you forked cake-search. Don't know if you know this, but I already added clojars stuff to cake proper.

12:44 devn: Raynes: yeah i was confused :D

12:44 Raynes: i was looking for the cake search functionality last night and didn't find it

12:45 wow i didn't know condensory was such a fancy word

12:46 i heard it w/r/t a minimalist poet a long time ago, she called her workspace a condensory because she would take big ideas and slowly boil them down to their smallest parts

12:46 ^ fliebel amalloy

12:56 Raynes: devn: src/tasks/clojars.clj iirc

12:59 devn: Raynes: gotcha, thanks

12:59 fliebel: devn: cool

13:00 Raynes: What did you mean the other day by "fun in a want-to-kill-yourself way"?

13:05 devn: fliebel: also: http://www.lorineniedecker.org/ is the poet -- can't believe i found that, but some of it is quite good

13:05 choffstein: hey all! I have a quick question -- I basically want to serve a zip file I create dynamically from my web host. Ideally I would pass into it a map with keys as file names and values as the file data. Returned would be the data for a zip file. Ruby has a library called Zippy that does this. Any idea what java library or clojure library might do this?

13:07 fliebel: choffstein: Probably a subclass of OutputStream. I know there is GZIPOutPutStream or something like that, but that does not do folders.

13:08 choffstein: Yeah. I found that as well... Was hoping there was just a plug-and-play solution :)

13:08 Ruby has spoiled me :D

13:09 Anyone know how to use the mail or mymail commands if i "Have a message"?

13:09 amalloy: choffstein: /msg sexpbot mail

13:09 cemerick: choffstein: sorry, is the zip file prepared when you deploy the app?

13:09 clojurebot: unzip-with is http://paste.lisp.org/display/76458,1/raw

13:10 choffstein: cemerick: no. Basically, I have a map with file names and the data. So let's say my app takes a bunch of images, works on them in memory, and wants to send them back.

13:11 Nothing is written to disk. Everything is in memory.

13:11 amalloy: cemerick: it sounds to me like no; his user picks N files from some list and says "zip em up for me", and he wants to serve a single zip file in reponse

13:11 cemerick: aaaah

13:11 choffstein: yeah, exactly.

13:11 But most of the Java examples have you reading from a file on disk. I just have the raw bits in memory.

13:12 fliebel: choffstein: You could use a stringWriter to get around that.

13:12 amalloy: choffstein: ByteArrayInputStream maybe?

13:12 cemerick: choffstein: simple with ZipOutputStream

13:12 choffstein: Haha. Hurrah! Answers!

13:12 cemerick: and the options fly :-P

13:13 Not sure how a StringWriter would help tho…

13:13 amalloy: now let's all try to be offline when, in a few hours, he finds none of the solutions are satisfactory

13:13 choffstein: ZipOutputStream with ZipEntrys, perhaps?

13:14 or at least pretend to idle ;)

13:14 cemerick: choffstein: only way to do it AFAIK

13:14 fliebel: cemerick: Oh, well, I don't know what they're called, but you know, stuff that takes a string and torns it into something that looks like it could be fron a disk.

13:14 cemerick: (with-open [zout (ZipOutputStream. (ByteArrayOutputStream.))]

13:15 fliebel: I was not able to quickly see how to fill a zipentry with content.

13:15 cemerick: (doseq [e entries](..putNextEntry ...make new zip entry...)

13:15 amalloy: fliebel: stringreader

13:15 cemerick: (.write zout ...entry data...)

13:15 anyway

13:15 amalloy: but i don't think he has a string either

13:15 cemerick: fliebel: it's just a marker that the ZOS lays down in the file it's building. You write the entry's content to the ZOS itself.

13:16 it's a bit of a screwy interface.

13:16 fliebel: ah… so you just add a zipentry and use write.

13:16 cemerick: yup

13:16 choffstein: that is a horrible interface

13:16 jesus.

13:17 cemerick: If you have a bunch of data that won't fit in memory, that's the sort of API you end up with.

13:17 amalloy: it's much more convenient than hadoop

13:17 cemerick: *everything* is more convenient than hadoop

13:18 fliebel: Could be fun, having one thread write data to the stream, and have another add entries to it :)

13:36 devn: hmm...sandbar is nice

13:37 choffstein: i'm going to smash my head against this keyboard

13:39 sometimes java feels like a sick joke

13:40 technomancy: choffstein: that's why they call it "wrap the crap"

13:41 choffstein: what does with-open return?

13:41 cemerick: the value of the last expression in its body

13:42 choffstein: hmmm...yep, definitely not what I want then :D

13:42 pdk: doesn't with-open have an implicit do

13:42 or the try form at least

13:42 choffstein: implicit try with finally

13:43 cemerick: in the code you posted above, how would I go about ripping out the bytes of the zip data I wrote?

13:43 pdk: that's one thing that always bugs me

13:44 for some reason special forms are too special to have builtin docstrings

13:44 they're all just "please see [clojure special forms article]"

13:44 cemerick: choffstein: that stuff was totally off the top of my head :-)

13:44 choffstein: cemerick: well, it is close to working ;)

13:44 pdk: cause they are the unique snowflakes of forms

13:44 cemerick: but, what do you mean by "rip out the bytes of zip data"?

13:45 pdk: 'course, forms like let would dump 1500 words in your lap.

13:45 pdk: well MAYBE

13:46 though if you think about it you could just say something like "let takes a vector with pairs of symbol names and their bindings then a body wrapped in an implicit do with the symbol names bound"

13:46 the other docs are already extremely terse so they'd fit in!

13:47 jkkramer: ,(clojure-version)

13:47 clojurebot: "1.2.0"

13:48 jkkramer: pdk: 1.3 has better docs for let and friends

13:50 pdk: i like the "and friends"

13:50 i'm picturing an edutainment cartoon series

13:50 jkkramer: :)

13:56 choffstein: can't ... figure out ... gzip library. too .... dense. ack...

14:01 or maybe i'm too dense?

14:02 ANyone mind taking a peek at https://gist.github.com/881685

14:02 I am confused as to why my zip file work work. To be used like (multiple-file-return {"ABC" "File data" "XYZ" "Other file data"})

14:05 amalloy: choffstein: fwiw (.toString b) == (str b)

14:05 choffstein: ...word

14:06 much appreciated :D

14:06 amalloy: code looks reasonable to me, probably because i've never had to use ZOS

14:07 choffstein: well, any other things you would change?

14:07 i'm just trying to get better with clojure code in general. anything "ugly" about it?

14:07 amalloy: i prefer (Foo.) to (new Foo), but it's a matter of taste

14:09 more importantly you might look into map destructuring: ##(let [m {1 2 3 4}] (doseq [[k v] m] (println (+ k v))))

14:09 sexpbot: ⟹ 3 7 nil

14:09 choffstein: Yeah. I've noticed other people like that too

14:09 oh, very cool. thanks!

14:09 amalloy: other than that i'd say it's pretty idiomatic

14:09 choffstein: destructuring ... yes, I remember that from my SML days 5 years ago :D

14:11 mids: maybe put the entire let in a separate function, right now you are doing 2 different things in one; building an http response and zipping files

14:13 choffstein: ah, right.

14:13 amalloy: oh, didn't even notice that let at the top :P. (apply str (interpose " " foo)) is (clojure.string/join " " foo)

14:14 choffstein: ah, thanks.

14:15 gfrlog: I can't pass a java.util.Iterator to (seq)?

14:15 choffstein: slowly getting there...

14:16 amalloy: gfrlog: iterators aren't seqs

14:16 choffstein: gist now re-written :D

14:16 amalloy: because to use them you have to mutate them

14:16 but ##(doc iterator-seq), if for some reason you can't just call seq on the original Iterable

14:16 sexpbot: ⟹ "([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly."

14:18 gfrlog: amalloy: thanks

14:19 amalloy: I didn't think that iterators WERE seqs, but it seemed natural that calling (seq it) would return a seq

14:19 amalloy: gfrlog: i don't exactly disagree, but i also don't mind that it's made "hard" to get a seq from an iterator, since that causes side effects

14:20 whereas seq on most anything else doesn't

14:20 gfrlog: amalloy: agreed

14:25 choffstein: arrrggghhhhh!

14:25 * choffstein jumps out of window

14:25 choffstein: can't even type correctly. *the window

14:25 gfrlog: making corrections after jumping out a window

14:26 * gfrlog jumps out of widow

14:31 fdaoud: chouser fogus congrats on completing The Joy of Clojure!

14:33 Lulu58e4: fdaoud:seconded; will have to re-read full version

14:36 leeda: Hi, can I ask questions about leiningen here?

14:36 gfrlog: leeda: yes

14:37 leeda: I just installed both Clojure and lein yesterday on my Mac (OS 10.7) and for some reason, lein is really slow. Even `lein help` takes a couple seconds. What am I doing wrong?

14:38 gfrlog: huh. I've always just put up with that.

14:38 leeda: Oh... so it's normal?

14:38 0m7.511s

14:39 gfrlog: I can't imagine anybody else putting up with that, so I wouldn't be surprised if somebody is about to swoop in and suggest something like nailgun or something to do with emacs.

14:39 but it's definitely normal for me

14:39 amalloy: cake uses something vaguely like nailgun already

14:39 hiredman: the jvm takes time to boot

14:40 gfrlog: nobody has written a clojure-to-bash compiler yet?

14:40 leeda: Hm ok.

14:40 amalloy: $ time cake help &>/dev/null ## real 0m0.129s

14:40 sexpbot: amalloy: The time is now 2011-03-22T18:38:12Z

14:40 amalloy: haha whoops. didn't mean to ask sexpbot for the time, there :P

14:40 leeda: amalloy: Yeah, cake is fast.

14:40 pdk: it's basically just attributable to jvm start time

14:40 cake has something to let it run with a persistent jvm to negate that

14:40 leeda: amalloy: I wanted to use the "ring" task for lein, can I use it with cake too?

14:41 This is what I'm talking about: https://github.com/weavejester/lein-ring

14:41 hiredman: lein has interactive mode, which starts up and you give it commands and you don't need to wait to boot the jvm everytime

14:42 Raynes: leeda: Leiningen plugins aren't compatible with cake plugins.

14:42 leeda: Raynes: ok, thanks.

14:43 I guess I'll just live with it for now. I'm too excited by Clojure to let that stop me...

14:51 technomancy: leeda: it's faster if you use a client JVM, but that can be hard to do on macosecks. try the interactive task and the swank task.

14:56 leeda: technomancy: could you explain briefly what swank is and how I would use it? I don't use SLIME...

15:00 technomancy: leeda: oh sorry; if you don't use slime then swank isn't useful.

15:01 leeda: technomancy: ah, ok, thanks anyway though.

15:18 tsdh: Is there a numerical equality function that doesn't care about type, so that I can compare a Double with a ratio?

15:18 TimMc: ,(== 5/2 2.5)

15:18 clojurebot: true

15:18 tsdh: Ah, great.

15:19 TimMc: tsdh: ##(= 5/2 2.5) works too, though

15:19 sexpbot: ⟹ true

15:19 tsdh: TimMc: What's ##?

15:19 TimMc: tsdh: sexpbot command flag

15:20 tsdh: Ok.

15:20 Raynes: Embedded evaluation trigger, to be specific. :>

15:20 TimMc: Yeah, that.

15:20 Raynes: amalloy and I use very long technical names whenever possible.

15:21 amalloy: embedded evaluation trigger? don't blame that shit on *me*: i implemented it but i refuse to call it something that long

15:21 TimMc: amalloy: Bat signal?

15:21 gfrlog: "crunch crunch"

15:21 TimMc: tsdh: You'll usually want to use a rounding function for comparing doubles. Here's what I do: https://github.com/timmc/CS4300-HW4/blob/master/test/timmcHW4/test/utils.clj

15:21 Raynes: amalloy: Is abbreviating it to EET a good compromise?

15:22 Also, don't undermine me in front of company.

15:23 tsdh: TimMc: Thanks. But in my case, I just found out that the "rounding error" is about 10000. :-)

15:23 TimMc: haha

15:23 close enough for theoretical physics work

15:30 tsdh: Haha, yeah. The problem was that I stuffed my numbers accidentially into a set, and thus duplicates vanished.

15:31 gfrlog: ,{[#{:tom}] #{['tim]}}

15:31 clojurebot: {[#{:tom}] #{[tim]}}

15:35 * fliebel invented a wheel

15:35 amalloy: gfrlog: testing that you can have complex objects as map keys?

15:36 gfrlog: amalloy: I have no defense for my utterances

15:36 at least not that one

15:36 sometimes I get a simple pleasure from ridiculous things

15:37 amalloy: gfrlog: (comp #{'tom} :name) is a simple pleasure of mine

15:41 gfrlog: amalloy: I find that delightfully difficult to untangle

15:42 amalloy: gfrlog: "return something truthy iff :name is 'tom"

15:42 that is, it's equivalent to #(= (:name %) 'tom)

15:42 gfrlog: very good

15:43 I like (apply partial (repeat partial))

15:43 but I doubt there's any practical application for it

15:43 fliebel: &(let [  2]  )

15:43 sexpbot: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector

15:43 gfrlog: fliebel: trying to let some whitespace?

15:43 fliebel: gfrlog: yea :D

15:43 works locally :)

15:44 tsdh: Isn't there a standard `abs' function?

15:44 fliebel: ,(let [  2]  )

15:44 clojurebot: java.lang.IllegalArgumentException: let requires an even number of forms in binding vector

15:44 amalloy: clojure.math/abs, probably

15:45 gfrlog: ,(map clojure.math/abs (range -5 5))

15:45 clojurebot: java.lang.ClassNotFoundException: clojure.math

15:45 amalloy: &(require '[clojure.math :as math])

15:45 sexpbot: java.io.FileNotFoundException: Could not locate clojure/math__init.class or clojure/math.clj on classpath:

15:45 amalloy: feh

15:45 fliebel: &' 

15:45 sexpbot: java.lang.Exception: EOF while reading

15:45 gfrlog: my repl doesn't know about it ethire

15:46 pjstadig: ,java.lang.Math

15:46 clojurebot: java.lang.Math

15:46 pjstadig: ,(java.lang.Math/abs -3)

15:46 clojurebot: 3

15:46 tsdh: amalloy: Is that contrib? Or why is clojure.math not listed on the API page?

15:46 fliebel: haha, ever tried a zero-width space in a monospaced font?

15:46 gfrlog: (map java.lang.Math/abs (range -5 5))

15:46 amalloy: oh, i thought Math only worked with doubles

15:46 gfrlog: ,(map java.lang.Math/abs (range -5 5))

15:46 clojurebot: java.lang.Exception: Unable to find static field: abs in class java.lang.Math

15:47 fliebel: gfrlog: You can;t use a method like that

15:47 pjstadig: ,(map (memfn java.lang.Math/abs) (range -5 5))

15:47 clojurebot: java.lang.IllegalArgumentException: No matching method found: abs for class java.lang.Integer

15:47 gfrlog: ,(map #(java.lang.Math/abs %) (range -5 5))

15:47 clojurebot: (5 4 3 2 1 0 1 2 3 4)

15:47 pjstadig: oh right it's static

15:47 gfrlog: I won

15:47 tsdh: :-)

15:47 Thank you.

15:47 * pjstadig conceeds

15:48 * pjstadig or maybe concedes

15:48 pjstadig: meh

15:48 Raynes: To whom it may concern: amalloy and I have decided to call our 'team' something and created a Github organization for our shared projects. Alas, sexpbot and clojail have been moved. https://github.com/cognitivedissonance

15:48 fliebel: the later

15:48 Raynes: cool

15:48 gfrlog: Raynes: I don't think cognitive is a verb, and I've certainly never heard of the word "issonance"

15:49 tsdh: Ok, next question. Is there something like partial, that returns a partial function where the *last* arg[s] are fixed?

15:49 Raynes: gfrlog: en.wikipedia.org/wiki/Cognitive_dissonance

15:50 amalloy: Raynes: pretty sure gfrlog is messing with you

15:50 gfrlog: Raynes: this makes me uncomfortable

15:50 fliebel: tsdh: Some evil mind constructed macroes for that kind of stuff, yes.

15:50 Raynes: amalloy: Subtle, but effective. I had no idea.

15:50 I'm so ashamed.

15:50 gfrlog: I've never once said anything constructive

15:50 tsdh: That's basically a cosmetic question, but I think it's more intuitive do define my floating-point-= with args [x y tolerance] instead of having tolerance first.

15:51 fliebel: tsdh: Noo! Do it the other way around, that way you can compare multiple ars at once

15:51 amalloy: fliebel: why would you use a macro for this?

15:51 fliebel: amalloy: I don't know… What else is this fnutils thing doing?

15:51 pjstadig: you could do (def shortened #(tolerance %1 %2 x))

15:52 or similarly (def shortened (fn [x y] (tolerance x y z)))

15:52 so forth

15:52 amalloy: (fn [f last-arg] (fn [& args] (apply f (concat args [last-arg]))))

15:53 fliebel: But isn't this much nicer? (floating-point-= tolerance x y & zs)

15:53 tsdh: Hm, I guess, you are right.

15:55 phenom_: when creating a map, is it possible for one value to depending on the value of an eearlier entry at creation time?

15:55 amalloy: phenom_: you probably want to use reduce?

15:56 fliebel: More like iterate… *lingual meltdown*

15:56 phenom_: {:key "key:val" :key2 (.split (get :key) ":")}

15:57 ^^ amalloy, something like that?

15:57 gfrlog: phenom_: certainly that right there is not allowed

15:57 phenom_: :P

15:57 fliebel: $doc iterate

15:57 gfrlog: phenom_: it's hard to say anything other than "no" without knowing why you're trying to do that

15:58 amalloy: phenom_: absolutely not, in a "literal" map

15:58 Raynes: &(doc iterate)

15:58 sexpbot: ⟹ "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

15:58 Raynes: Fixed that for you.

16:06 tsdh: Oh my god, macros are evil!

16:06 gfrlog: heck yes

16:06 gigamonkey: tsdh: why?

16:07 gfrlog: it is never a good idea to solve a problem requiring a macro with a macro

16:07 scottj: surely there's a better way to have a collection that doesn't grow beyond a limit than this http://paste.lisp.org/display/120786 right?

16:07 tsdh: After adding my fp-= function and adding that as a param to a defcomparisontest (my macro) using (partial fp-= 0.000001), I got an error at file position 1 that PersistintList cannot be cast to Named.

16:08 The reason for the error was that in the macro's expansion code, there was a (println "Comparing with" ~(name equality-fn))...

16:09 amalloy: tsdh: macros are not evil. they're power tools, to be used with caution

16:09 tsdh: That obviously works only for named functions, but the error is not really helpful.

16:10 amalloy: Yes, sure. But they have a high potential to lead to obscure errors.

16:10 gigamonkey: tsdh: I'm not a Clojure expert but that seems like it would be true in non-macro code to. I.e. if you pass a function to something that expects a name, boom!

16:10 tsdh: ,(name #(let [a 1] a))

16:10 clojurebot: java.lang.ClassCastException: sandbox$eval5580$fn__5581 cannot be cast to clojure.lang.Named

16:10 tsdh: See?

16:10 ;-)

16:11 amalloy: gigamonkey: the issue is that it's harder to find an error when the macro *can't expand* as opposed to "expands into something wrong"

16:11 tsdh: amalloy: Yes, exactly.

16:11 amalloy: tsdh: that seems like a pretty helpful error message to me though

16:12 "you tried to treat a [list|function] as a Named, and it isn't"

16:12 ¿que problema es?

16:12 gigamonkey: amalloy: but macro expansion code is just code, right? It can even be debugged separately from its use in the macro.

16:12 tsdh: amalloy: When you had it at least once. So from now on I'll remember that errors in line 1 probably result from a macro erroring during expansion.

16:12 gigamonkey: (I'm assuming that's the case; rather, I'm assuming Clojure macros are more like Common Lisp's than Schemes.)

16:13 amalloy: gigamonkey: you're correct

16:13 but in practice, largely due to lukewarm debugger support, it's harder

16:13 tsdh: that's the wrong lesson to take away

16:14 the right lesson (imo) is to look at the stacktrace. is there a macroexpansion in there somewhere?

16:14 if so, the problem is with a maco expansion

16:14 tsdh: amalloy: There was no stack trace at all.

16:14 And because of...

16:14 ,(class #(let [a 1] a))

16:14 clojurebot: sandbox$eval5584$fn__5585

16:15 tsdh: I didn't think of an anonymous function being a persistent listp

16:15 amalloy: tsdh: what, of course there's a stacktrace. i get a stacktrace when i reproduce your broken code. what are you doing that causes no stacktrace to exist?

16:15 tsdh: and anonymous functions *aren't* lists, but the macro isn't being passed a function; it's being passed a list! when the compiler, after expansion, evaluates that list, it will result in a function, but the macroexpansion phase doesn't know that

16:16 tsdh: Hm, you are right. lein test produces a stack trace, but slime doesn't in this case...

16:17 amalloy: tsdh: i'm using slime. have you done anything weird that would hide stack traces?

16:17 tsdh: amalloy: No, I usually get them. But not with that error and just C-c C-k to recompile the current file.

16:19 amalloy: ah

16:19 good point

16:20 technomancy: how hard would it be to fix that? you get a nice useful stacktrace if you C-c C-c the problematic form, but C-c C-k on the file just gives you the top-level message

16:23 did github just go down?

16:24 TimMc: seems up for me

16:24 amalloy: hey, so it is

16:24 for ~45s i was getting 500 errors

16:24 technomancy: I'm not sure; the C-c C-k compiler errors are pretty useless

16:24 would love to see that improved

16:25 amalloy: technomancy: can you point me in the right direction? last time i tried to browse the swank-clojure repo (is that even the right one?) i crashed github :P

16:25 tsdh: amalloy: Oh, now I managed to handle sexpbot's mail. I swear to open new threads instead of changing subjects (which I did at least in conformance with the relevant RfC).

16:26 Raynes: You had trouble retrieving messages?

16:26 amalloy: Raynes: i think he means google groups, not sexpbot

16:26 tsdh: Raynes: amalloy's message was the first message I ever got. :-)

16:26 technomancy: amalloy: I'm pretty clueless when it comes to swank's internals =\

16:27 amalloy: aw. okay

16:27 * Raynes thought the message sexpbot sends was clear about how to retrieve mail.

16:27 Raynes: I'll have to review that.

16:27 tsdh: Raynes: You should see my IRC log. It's full of /mail RET, /mymail RET. ;-)

16:28 Raynes: Yeah, I couldn't include the prefix in the docstring because prefixes are user-defined. The message should be clarified a bit.

16:28 tsdh: Raynes: Reminds me of "a novice's first session with mighty ed" at http://www.gnu.org/fun/jokes/ed.msg.html.

16:29 amalloy: Raynes: instead of "the mail command", what about "/msg me the message "mail"

16:29 Raynes: amalloy: That'll work. Editing now.

16:31 amalloy: tsdh: i see you were talking about both sexpbot and google groups. that'll teach me to forget whether i use $mail or google

16:32 tsdh: I use Gmane.

16:32 jhartman: http://clojure.org/ says clojure35 gives 35% off Joy of Clojure (print or ebook), but the coupon doesn't seem to work for the print edition. Anyone had any luck?

16:32 Raynes: $reload

16:32 sexpbot: Reloaded successfully.

16:33 amalloy: technomancy: is your swank-clojure repo at least the right repo to be forking?

16:34 technomancy: amalloy: it is

16:34 amalloy: thanks. i'll see if i can find something that looks relevant and kick it

16:35 technomancy: that'd be great

16:38 hiredman: f/win 14

16:43 phenom_: also guys, is there a mven repo with the latest clojure 1,3 build? or atleast the alpha 6 build?

16:51 fliebel: phenom_: yes… You should look at the default repos of lein or cake to know what they are though.

16:52 TimMc: Oh man my code is so slow... I need to look into type hinting, parallelism, and transients.

16:52 fliebel: TimMc: The alternative for doing stuff faster is doing less stuff ;)

16:53 TimMc: fliebel: I need to render about 30,000 triangles no matter what.

16:54 *still need to

16:54 fliebel: TimMc: Well, why not squares? :P

16:54 TimMc: Actually, I should *first* look at using BufferedImage instead of using Graphics directly.

16:54 fliebel: When all you have is a .tri file...

16:55 fliebel: TimMc: Everything looks like a hammer? But, yea, using graphics that do less work internally couts as doing less work, in my opinion.

16:55 leeda: Can anyone figure out what `w` is supposed to be here? (defmethod print-dup ObjectId [x w] (.write w (str "#=" `(object-id ~(.toString x)))))

16:55 amalloy: leeda: output stream

16:56 TimMc: fliebel: It looks fairly nice for a first go, though: http://i.imgur.com/1o0Ix.png

16:56 leeda: amalloy: Thanks. How do I make an output stream?

16:56 amalloy: leeda: you shouldn't need to

16:56 leeda: amalloy: (.. System out)?

16:56 amalloy: oh

16:56 amalloy: ie, you shouldn't have to call this directly

16:56 fliebel: TimMc: Awesome! Is that this weird thing called ray tracing?

16:56 leeda: amalloy: oh ok

16:56 TimMc: fliebel: Nope, this is directional flat shading.

16:57 amalloy: &(binding [*print-readably* true] (pr-str *ns*))

16:57 sexpbot: ⟹ "#<Namespace sandbox18840>"

16:57 fliebel: TimMc: I'd have to google that...

16:57 amalloy: &(binding [*print-readably* true] (pr *ns*))

16:57 sexpbot: ⟹ #<Namespace sandbox18840>nil

16:57 amalloy: gr

16:57 TimMc: fliebel: http://www.ccs.neu.edu/course/cs4300/HW4/HW4.html

16:58 amalloy: &(binding [*print-dup* true] (pr-str *ns*))

16:58 sexpbot: ⟹ "#=(find-ns sandbox18840)"

16:58 amalloy: leeda: ^

16:58 fliebel: lol @ "practice re-using code without copy and paste"

16:59 TimMc: Or just flat shading, I guess. Parallel light source, each triangle is shaded according to how close its normal vector is to the light vector.

17:00 leeda: amalloy: thanks

17:01 amalloy: leeda: heh, thank you! i hadn't thought about using ` to write the print-dup function call

17:01 TimMc: Yeah, that was new to me too.

17:02 fliebel: Flat shading is the third part.

17:02 leeda: heh, it's from here: https://github.com/somnium/congomongo/blob/master/src/somnium/congomongo.clj

17:02 fliebel: TimMc: I'm reading it :)

17:06 TimMc: So this is computer science? What year? What university?

17:11 TimMc: Wait, they allow you to write Clojure?

17:13 amalloy: fliebel: since TimMc appears to be afk: he gets to pick a language. i don't know TimMc personally but a friend of mine who goes to his school thought TimMc had graduated already so he's probably ~senior

17:13 TimMc: just came back

17:13 amalloy: Correct.

17:13 fliebel: Northeastern University. The prof said we can pick our implementation language.

17:14 I'm using it for two different classes this year.

17:14 brehaut: TimMc, and you didnt choose befunge?!

17:14 TimMc: I wanted to complete the assignment!

17:14 brehaut: hah

17:15 TimMc: The other prof has expressly forbidden LOLCODE, incidentally.

17:15 fliebel: TimMc: But… You have already graduated? So… huh? I mean, I would understand if you did this stuff forfun… and I admit I don;t understand this bechlor master system all to well.

17:15 TimMc: No, senior.

17:15 brehaut: TimMc: i wonder if this is from the same department as the aftermarket stickers on the coffee grinders at my uni that said 'do not put your hand in the grinder!'

17:16 fliebel: *google senior*

17:16 amalloy: fliebel: highest undergraduate year

17:16 fliebel: ah! ( http://en.wikipedia.org/wiki/Senior_(education) )

17:16 TimMc: fliebel: I've transferred schools several times, so I'm old for a senior.

17:17 I'll be getting my bachelor's degree in May. A master's degree is an additional couple years of education focused on one subject.

17:18 fliebel: TimMc: Can you write compilers and stuff without doing the master stuff?

17:18 TimMc: yeah

17:18 * fliebel wonders if he should go to university

17:19 amalloy: fliebel: compilers are roughly senior-level stuff

17:19 TimMc: amalloy: Metacircular evaluators, on the other hand, were taught to the honors freshmen. :-)

17:19 * fliebel doesn't believe rendering tri files can be nearly as hard as writing a compiler

17:20 brehaut: fliebel: my university had us write a simple computer and bytecode interpreter as a second year project as part of (not the whole of) one course

17:20 TimMc: fliebel: The course I'm taking has a bunch of sophomores and juniors in it.

17:20 amalloy: fliebel: it all depends on how complicated a language you want to deal with

17:20 a lisp compiler can be written with little effort; a java compiler, not so much

17:20 TimMc: Because of transferring, I'm taking required courses in a semi-random order.

17:20 fliebel: amalloy: One that can compile itself :)

17:20 brehaut: fliebel: a basic compiler for an imperative language can be done with 1 pass and a recursive decent parser

17:21 fliebel: original c fits that description btw

17:21 amalloy: brehaut: original?

17:21 fliebel: TimMc: That'd be my style, minus the required and the transfering.

17:22 brehaut: amalloy: i dont know if c + standardisations and small extensions is still one pass

17:22 fliebel: Well, you know, once you have macroes, everything is just layers of macroes to assemly :)

17:22 TimMc: amalloy: I thought I was going to be done last year, so I told people I was a senior then. -.-

17:22 hiredman: also depends what your target is, generating asm vs. generating bytecode vs. some other language

17:23 amalloy: brehaut: i'm uncertain that a single "original" c exists. ansi and k&r both sorta fit the bill

17:23 and something probably existed before that

17:23 brehaut: amalloy: k+r then :P its pre-coffee time down here

17:23 hiredman: compilers and interpreters are about bridging the grap between source and target, if there is little gap then the compiler is very simple

17:24 amalloy: (def lisp-compiler identity)

17:25 brehaut: amalloy: that holds for any language

17:26 fliebel: brehaut: nope, Python: SyntaxError: invalid syntax

17:26 amalloy: which, that something existed first? of course, but i meant "something that was publicly available and used"

17:27 brehaut: amalloy: i mean its obviously the identity function compile and anything from a compiled representation to that same representation

17:27 amalloy: brehaut: hm. no offense, but that's barely a sentence. go back to your coffee?

17:28 brehaut: wow you are right

17:28 bbs

17:28 fliebel: It's post bed-time here, so don;t expect anything useful out of me either.

17:38 brehaut: fliebel: probably the simplest way you could get started writing a compiler is to write an interpreter first; you build up a tree of things (eg, expressions, different statements, functions etc) that know how to execute themselves (largely by executing their children). Once you have the that you tell the top level one (such as the main function) to execute it self

17:40 hiredman: which you can do very simply using protocols or multimethods

17:47 fliebel: brehaut(gone), hiredman: Thanks.

17:48 With explanations like this, I really wonder if I would find cs very easy, very hard, both or just interesting.

17:49 brehaut: perhaps all of the above?

17:49 hiredman: I have no idea how this stuff is taught in a cs curriculum

17:52 amalloy: http://www.cs.ucsb.edu/~chris/teaching/cs160/lectures.html is fairly complete-looking slides and project listings for a compilers class

17:52 brehaut: fliebel: the value i got from a formal CS education is that i was made to learn about things i would have (for one reason or another) avoided if it was optional

17:53 fliebel: another obvious candidate is to get the lecture videos and and inline copy of SICP; theres big sections on program evaluation

17:54 hiredman: the emphasis on parsing is just a huge *bleh*

17:54 opqdonut: agreed

17:54 intermediate representations and optimizations are the interesting part

17:55 and it's easy to play with them, just take a parser generator and llvm

17:55 brehaut: hiredman: i want to agree, but so many people seem to have CS degrees and think parsing is something that you need to be a rocket surgeon to do.

17:55 hiredman: brehaut: complete opposite

17:55 brehaut: hiredman: exactly!

17:56 hiredman: it is so boring and tedious

17:58 which is why lisp is perfect for teaching this stuff, the parser is dead simple

17:58 brehaut: (defmulti myparser first) ?

17:59 hiredman: the problem is the myth that since code is data lisp code "is the ast"

17:59 opqdonut: indeed

17:59 fliebel: hiredman: It's pretty close though, no?

18:00 * fliebel hides

18:00 hiredman: it depends on the transforms you want to perform, and what kind of data you need to drive those

18:01 fliebel: brehaut: re videos: I'd miss another major reason to do university: peers.

18:01 hiredman: clojure's compiler is very simple, depends on hotspot for optimising

18:01 so clojure doesn't really have an ast step between the code and bytecode

18:02 JohnShaft: Hi. Newbie question here. I am trying to install clojure within emacs. I have swank-clojure and slime installed. When I try to run slime it asks me if I want to download clojure and it complains that it cannot download the clojure jar files. Tried on Mac and PC same deal. Any help would be greatly appreciated

18:03 hiredman: JohnShaft: generally you'll want to use the clojure from the project you are working on

18:03 and the way you start swank-clojure for a project depends on the build tool it uses

18:04 fliebel: Well, thanks for all the university/compiler discussion.

18:04 * fliebel goes to bed

18:05 hiredman: clojurebot: lein

18:05 clojurebot: lein is http://github.com/technomancy/leiningen

18:05 hiredman: JohnShaft: ^-

18:06 sdeobald: Hey dudes. Is anyone awake who can speak to the present utility of ClojureScript?

18:06 JohnShaft: Hiredman: Thanks. I think I am in a bit over my head. I am new to Emacs and Clojure so not really sure what a clojure project consist of ( or even how to make one ). I have been trying to follow some of the online tutorials which claim it is easy to install clojure via slime. But looks like maybe the repo the script is looking for is outdated?

18:07 hiredman: JohnShaft: never do anything a blog post tells you

18:07 I have yet to see one that wasn't outdated

18:07 e.g. they are all from over a year ago

18:07 JohnShaft: you may just downloaded swank clojure and run it yourself, then use slime-connect to connect to it

18:08 phenom_: anyone know of a pure clojure mongodb driver ?

18:08 hiredman: whatever you do I recommend against using the clojure installed by slime or whatever

18:08 JohnShaft: Hiredman: Ok, thanks for the tips. Looks like I have some more reading up to do. I will also check out leiningen

18:09 lancepantz: JohnShaft: do you have ruby installed?

18:09 JohnShaft: lancepantz: No I do not

18:09 lancepantz: k, nevermind then

18:09 dakrone: sdeobald: are you just trying to convert clojure to javascript, or trying to use ClojureScript in particular?

18:10 sdeobald: dakrone: the first one, if it's at all suitable to the task.

18:10 ...which I can't really glean from github.

18:11 dakrone: sdeobald: I would recommend checking out https://github.com/zkim/cljs

18:12 (check out the demo, it's pretty neat)

18:12 sdeobald: dakrone, thanks. Have you ever used this in a production app?

18:13 dakrone: sdeobald: no, but the author is a friend of mine, he's very responsive if you have feature requests or bug reports

18:13 raek: JohnShaft: the swank-clojure readme contains most of what you need to know https://github.com/technomancy/swank-clojure

18:13 sdeobald: dakrone: Cool. Is he doing work with it? Or is it just a toy project for now?

18:14 dakrone: sdeobald: he does work with it

18:14 sdeobald: Badass.

18:15 technomancy: swank's been 1.3.0-SNAPSHOT for ages... should probably cut a stable

18:18 lancepantz: technomancy: +1

18:33 raek: hrm. I recall having problems with exceptions and that version, but now I am unable to reproduce it

18:33 (inc technomancy)

18:34 technomancy: raek: there were some rough spots with a 1.3 fix breaking 1.2-compat and vice versa

18:37 * raek lein plugin uninstall swank-clojure "1.2.1" && lein plugin install swank-clojure "1.3.0-SNAPSHOT"

18:59 foxupa: hi, I've noticed that the clojure function contains? doesn't work with lists

18:59 which is confusing as I thought a list was a collection

18:59 technomancy: clojurebot: contains?

18:59 clojurebot: contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use the java method .contains

18:59 technomancy: foxupa: probably the #1 faq about clojure

19:00 it's unnecessarily confusing =(

19:01 foxupa: well it makes sense that a map is like a function taking keys to values, and a set is a function testing membership, but how does "vector" fit in that explaination?

19:01 technomancy: vectors are functions of their indices

19:02 ,(contains? [:a :b :c] 2)

19:02 clojurebot: true

19:02 foxupa: ok... i guess it makes sense now, though I have to say the following is a very easy way for a clojure programmer to slip up:

19:02 (contains? [4 5 6] 2) = true

19:03 i guess it just seems very counterintuitive to have labeled it contains? rather than contains-key?

19:03 technomancy: yes, contains? should have been called contains-key?.

19:03 foxupa: exactly, lol

19:03 hiredman: why wouldn't a clojure programmer know what contains? from core.clj does?

19:03 pdk: ,(type 9.0)

19:03 clojurebot: java.lang.Double

19:03 hiredman: most likely it would be a way for a non-clojure programmer to slip up

19:03 technomancy: foxupa: everyone makes mistakes, even language designers.

19:04 foxupa: yeah, is there a webpage listing any of these other common points of confusion?

19:04 technomancy: well 90% of the other top questions are about slime

19:04 so I guess the swank-clojure readme? =)

19:05 Lulu58e2: lol

19:05 technomancy: probably the other most common misunderstanding is about transients; you can read about that here: http://technomancy.us/132

19:05 foxupa: yeah I never figured out how to get slime + clojure to work together, so I just use CCW w/ eclipse and use the Emacs keybindings plugin for eclipse

19:06 technomancy: (or just ignore transients since you don't need them.)

19:08 Lulu58e2: Very alliterative

19:24 TimMc: technomancy: Oh hey, I never knew about the "performance characteristics" aspect of persistent data structures.

19:28 technomancy: And Wikipedia still hasn't.

19:29 technomancy: I'm not entirely sure Rich didn't make it up.

19:30 but it seems a bit disingenuous to have persistent data structures whose perf degrades over time.

19:37 amalloy: technomancy: degrades over time? is there a link i'm missing?

19:37 oh, the thing about transients above. sorry, didn't connect the dots

19:38 hiredman: possibly not in the context of persistent datastructures, but they could have been presented as "mutable datastructures that allow you to access old versions"

19:39 then the disingenuous bit is a feature

19:39 amalloy: hah

19:41 foxupa: does anyone have any recommendations for a clojure program or library that can render directed graphs?

19:42 brehaut: foxupa: have a look for loom

19:43 foxupa: https://github.com/jkk/loom

20:57 foxupa: hi all, I was wondering if there is some way to get clojure.contrib.shell-out's sh function to spin off a new process

20:57 I tired passing in "&" as my last argument but that didn't work

21:01 amalloy: foxupa: clojure.java.shell

21:01 i mean, i think it does start a new process but may immediately join() it

21:02 foxupa: (clojure.java.shell/sh "gedit" "&") just starts up a gedit session for a file called &

21:03 it says it starts a new sub-process

21:03 amalloy: foxupa: & is part of bash's syntax

21:03 foxupa: ah

21:03 amalloy: c.j.sh just does an exec of the first arg and passes the rest

21:03 foxupa: is there some standard way to do it invariant of the specific shell syntax?

21:03 amalloy: you can do "bash" "-c" "gedit" "&" or similar

21:04 i have an example of this somewhere in sexpbot, one sec while i find it

21:05 https://github.com/cognitivedissonance/sexpbot/blob/master/src/sexpbot/plugins/utils.clj#L195

21:07 devn: I think my eyes are going

21:07 I need like 14-16pt font to feel comfortable anymore

21:07 __name__: Do you have glasses?

21:07 devn: yes

21:08 I'm far-sighted

21:08 __name__: Could it be that they do not correct your vision anymore?

21:08 devn: Nah, just had a checkup

21:08 * __name__ nods.

21:08 devn: I just feel like I don't have the same ability to grep the screen that I used to

21:09 amalloy: devn: you are probably still better off than i. uncorrectable vision problems lead me to use 1280x960 on my 27"

21:10 devn: im 20/200 uncorrected

21:10 lazy eye

21:10 amalloy: and corrected?

21:10 devn: 20/80 i believe

21:10 that's an old number so not sure how accurate it is

21:10 amalloy: fair enough. that's close to me, last i checked (also long ago)

21:11 devn: amalloy: *shrug* i wouldn't complain about my vision

21:11 lazy eyes are kind of cool -- lots of famous artists with them, jean-paul sartre, etc. :)

21:22 amalloy: do you ever pair with anyone?

21:25 amalloy: devn: there aren't a lot of people nearby who like to pair. one coworker does though, and we use my computer

21:28 TimMc: We were forced to pair-program in Fundies class. :-)

21:29 At least one prof was pretty good about matching people up by skill level so that the pairs were balanced, which is pretty important.

21:35 amalloy: srsly

21:40 TimMc: It was much less fun being paired randomly -- for both people. :-(

21:44 no_mind: I am looking for some use cases on clojure protocols. I cant figure out under what conditions I should go for a protocol/defrecord instead of a map ?

21:50 phenom_: so who's used yourkit's profiler before ?

21:52 no_mind: you want a protocol went you went to define a set of methods that logically should be grouped together, ideally to work over an abstract data strcture or logical application/domain model

21:52 *when you want

21:52 devn: amalloy: if you want to pair id like to find some people to remote with

21:52 i dont have anyone in my area to code with and i think pairing is the best way to learn more no matter your skill level

21:53 osmosis is awfully effective

21:56 amalloy: PM me if that's something you'd be interested in -- i need to take off now but if you feel like getting together on the internet to hack on something fun im interested

21:56 ciao

22:10 amalloy: no_mind: or when you would like to use multimethods but performance is a huge issue

22:10 TimMc: technomancy: Have you used your collaborative editing Emacs plugin for pair programming?

22:33 ,whoami

22:33 clojurebot: java.lang.Exception: Unable to resolve symbol: whoami in this context

22:33 TimMc: and ##(whichisthis)

22:33 sexpbot: java.lang.Exception: Unable to resolve symbol: whichisthis in this context

22:33 TimMc: OK, got it.

22:33 amalloy: &alsothis

22:33 sexpbot: java.lang.Exception: Unable to resolve symbol: alsothis in this context

22:34 TimMc: ,(#(% %) #(% %)) ##(#(% %) #(% %)) It's a proper botrace this time!

22:34 sexpbot: java.lang.StackOverflowError

22:34 clojurebot: java.lang.StackOverflowError

22:34 TimMc: Oh man, too close to call.

22:34 amalloy: har har

22:37 scottj: if you have (def a '(1 2 3)) and then run (def a (take 2 a)) does the 3 part get GCed or is it held bc take is lazy? if I'd done(def a (doall (take 2 a))) would it have been gced?

22:39 amalloy: scottj: i don't think it can get GCed

22:39 i think doall would make it happen

22:42 scottj: ok, I'm wondering if there's a better way to do a collection that doesn't grow beyond a certain size than using vectors since i don't need random access. currently with vectors I have this http://paste.lisp.org/display/120786 but there must be a simpler way

22:46 amalloy: scottj: i'm not clear on the point. it couldn't be lazy anyway

22:47 so you might as well just make it either a vector or a list

22:48 apply subvec and/or take as needed

22:49 but if you wanted to "do it up right" you could do a lot worse than steal from ken wesson's Bag deftype on the mailing list

22:50 scottj: what's a bag?

22:50 amalloy: unordered list, or a set with duplicates, depending how you think of it

22:51 scottj: something would have to be added right to track how old the items are so you could remove the oldest item in the bag when something new is added right?

22:52 amalloy: uhh, only if you wanted LRU behavior

22:52 but my point wasn't that you should use Bag

22:52 use his code as an example to define your own typew

22:52 clojurebot: code-review is <rhickey> yikes

22:55 no_mind: I have a requirement where user can define a record type/entity (not necessarily clojure defrecord) and add attributes to the record. Then the system should autogenerate the CRUD forms for the record. What will be the most suitable data type to represent a record type/entity ?

23:00 amalloy: no_mind: something wrong with a hash-map?

23:03 technomancy: TimMc: we've found it to be less hassle to pair over SSH with tmux

23:03 no_mind: stick with regular maps as long as you can; they're least-hassle

23:12 no_mind: amalloy, nothing wrong or right here, just wanted to have oinion of more experienced clojure devs

23:52 technomancy: leiningen 1.5.0: http://j.mp/lein-news

Logging service provided by n01se.net