#clojure log - Mar 26 2011

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

0:00 amalloy: tomoj: my point is that the asymptote here is at N=64, because there are no more bits available

0:01 but in real life i am wrong

0:01 sorta

0:02 tomoj: surely the distinction between log32 and 1 will become apparent before you run out of bits?

0:03 amalloy: tomoj: not really. so it's ten times slower; that's just a constant factor - it will never be *more* than ten times slower than O(1), so it's O(1)

0:04 tomoj: wordplay

0:04 amalloy: s/wordplay/definition of big-O

0:04 tomoj: no that's my point

0:05 that 32 is big enough that 10x is as high as it goes doesn't change the mathematical fact that it's NOT O(1)

0:07 amalloy: http://en.wikipedia.org/wiki/Big_O_notation#Formal_definition - i claim that, because we define the range of x as 0..2^64, f(x) is at most C*g(x), where f is vector access, g is array access, and C is a constant

0:08 tomoj: but the very first thing there breaks

0:08 amalloy: because we're not taking the limit as x goes to infinity?

0:08 tomoj: yeah

0:09 amalloy: perhaps. the formal definition is unclear about what the "subset of the reals" means

0:09 do they mean to imply that O-notation is meaningless for any finite-domain functions? it is, of course, which is why i'm able to get away with this trickery

0:10 tomoj: isn't _anything_ O(1) if you set a maximum for x?

0:10 amalloy: yeah

0:11 i'm just saying, the log32(some 32-bit-number) won't come to a multiple larger than like five, which will be completely swamped by the constant factors involved in the rest of the computation

0:12 tomoj: right "practically constant"

0:13 my objection was to using O-notation willy-nilly for practical considerations

0:14 Caffeine: Oh that's surprising... creating a table of 25M #{} is faster than 25M nil ..

0:16 tomoj: is your table mostly empty?

0:16 Caffeine: They're all empty at first

0:16 tomoj: how full do they get

0:16 amalloy: Caffeine: a "table of foo" meaning what in this context?

0:16 tomoj: it may be more efficient to use maps

0:16 Caffeine: they're stay empty for now

0:17 [] of []

0:17 tomoj: I had a significant speedup switching from vectors to maps for 1800 element 1-d vectors

0:17 (that were mostly sparse)

0:17 Caffeine: [[nil nil nil][nil nil nil][nil nil nil]] would be a table of 9

0:18 tomoj: the problem of how to make sparse and dense play together and convert to dense when it's more efficient still bothers me

0:18 Caffeine: I could probably do it with a map... argh that's driving me crazy, changing the way I think my stuff every couple of hours haha

0:18 amalloy: &(time (let [row (vec (repeat 5e5 nil))] (vec (repeat 5e5 row))))

0:19 sexpbot: java.lang.OutOfMemoryError: Java heap space

0:19 amalloy: hm. made it smaller but not small enough

0:19 tomoj: if they're all empty maps will certainly be more efficient

0:19 amalloy: &(time (let [row (vec (repeat 5e3 nil))] (vec (repeat 5e3 row))))

0:19 tomoj: just {} :D

0:19 sexpbot: java.lang.OutOfMemoryError: Java heap space

0:19 amalloy: &(time (let [row (vec (repeat 5e2 nil))] (vec (repeat 5e2 row))))

0:19 sexpbot: ⟹ "Elapsed time: 1.174534 msecs" [[nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil ... failed to gist: Broken pipe

0:20 amalloy: &(time (let [row (vec (repeat 5e2 #{}))] (vec (repeat 5e2 row))))

0:20 sexpbot: ⟹ "Elapsed time: 0.895433 msecs" [[#{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} #{} ... failed to gist: Broken pipe

0:20 amalloy: that's weird. it actually is a liittle faster

0:20 Caffeine: oh haha it's trying to display it... I do a (def) to save the display part

0:20 Yeah, that's weird.. I noticed a little lag on 25M nil, nothing at all on #{}

0:21 amalloy: i can't imagine any reason #{} would be faster

0:21 Caffeine: btw, note i'm reusing the row object rather than creating a new one over

0:21 that should enable structural sharing and reduce memory/copying load

0:22 though of course {} is smaller still as tomoj says

0:22 Caffeine: Hmm true

0:22 I think I'll use a {} yeah...

0:23 hoping hashes of (Number Number) are reliable

0:23 amalloy: hah

0:23 Caffeine: (Because it still has to act like a 2D table in the end...)

0:24 amalloy: &(let [i (int 10) L (long 10) m {i i}] (get m L))

0:24 sexpbot: ⟹ nil

0:25 amalloy: Caffeine: be careful of that: the types have to match

0:25 Caffeine: Oh.... these are coordinates (latitude, longitude)

0:26 I guess I should cast them to double to make sure

0:26 amalloy: if any of them aren't already doubles, that's a good plan

0:26 &(.equals (long 1) (int 1))

0:26 sexpbot: ⟹ false

0:27 Caffeine: Yeah, it makes sense since everything is supposed to be an Object in Clojure.. if I remember well it doesn't use primitive types

0:27 they're automagically boxed

0:30 tomoj: whoa ##{(long 1) 2 (int 1) 3}

0:30 sexpbot: ⟹ {1 2, 1 3}

0:30 tomoj: that's fucked up

0:30 amalloy: Caffeine: that's kinda-sorta-almost true

0:30 and a lot less true in 1.3

0:31 (should i start calling it 2.0? how did that discussion turn out?)

0:31 Caffeine: oh, really? I guess it could be much more efficient using primitives ... maybe not.. hmm

0:34 amalloy: 1.2 allows you to work with primitives, but they can't cross function boundaries: all functions cast args and return values to boxed objects

0:35 where "cast" here is used in a totally inappropriate way because i needed a verb

0:38 cemerick: amalloy: "boxed" is a verb too :-)

0:38 amalloy: yeah i know. but i'd gotten past that part of the sentence and my ^H key is broken

0:38 Caffeine: Ahh ok, didn't know that. Saves the object manipulation inside functions

0:38 amalloy: #atrociouslie

0:39 Caffeine: you have to *ask* for that behavior

0:39 tomoj: just noticed someone brought up this "int/long as map key" problem again on the google group a few hours ago

0:40 Caffeine: alright

0:40 must happen very frequently ..

0:40 tomoj: I don't think I can even think about it

0:40 that just disturbs me

0:40 amalloy: haha tomoj call me next time you get drunk, this is great

0:40 tomoj: I don't want to have to care what type numbers are when I'm sticking them into a map

0:42 I can imagine very subtle bugs

0:42 Caffeine: I can even make some :)

0:44 amalloy: Caffeine: "must happen very frequently" is not really true. people complain about chunking all the time because it can have surprising side effects, but i can't find anyone who's had actual issues with it in real life; i think this long/int dichotomy is similar, though not identical

0:46 and it's fixed in 1.3

0:46 "fixed"

0:47 in that the clojure hashmaps now break the j.u.Map interface in a way that is clearly right :)

0:49 tomoj: given a leaf in a tree, crawl upwards/outwards/downwards to find the context of the leaf. this sound like a good fit with zippers?

0:50 amalloy: yes

0:50 also aphids

0:51 tomoj: har har

0:51 * technomancy has a flashback to the first chapter of A Scanner Darkly

0:52 * tomoj wishes he'd read the book

0:53 amalloy: i saw the movie. wasn't a huge fan

0:54 is the book better?

0:54 tomoj: having watched it for the first time on dxm my opinion is probably skewed far in the positive direction

0:55 that substance-d was little red capsules is surely irrelevant!

0:56 technomancy: the book is always better, of course

0:57 except for the Princess Bride; I guess there is some debate there.

0:58 and fight club

0:59 * amalloy muchly prefers the movie for PB. haven't read fight club

0:59 technomancy: ISTR the author of Fight Club saying he prefers the movie.

0:59 amalloy: heh

1:00 technomancy: PKD tends to translate pretty decently to the big screen

2:25 amalloy: #cvs is a deserted wasteland. how will cvs users ever find out they're supposed to use something else?

2:30 tomoj: I heard about "microsoft source safe" recently

2:30 amalloy: tomoj: it's just a fad

2:30 tomoj: apparently if you wanted to edit a file you took out a lock on the file

2:30 amalloy: we'll be back to good old rcs before long, no worries

2:31 tomoj: then no one else could change that file until you checked in

2:31 rcs?

2:31 amalloy: you only heard of this recently, really?

2:31 tomoj: really

2:31 git was really my first

2:31 used svn a few times but only really to check out

2:31 amalloy: well i've never used mss, thank god

2:32 but i have a cvs repo from college hanging around somewhere

2:32 tomoj: at my first job they just used a network share and made .copy .copy2 .copy3 files :D

2:33 amalloy: i did some of that in school

2:33 was fortunate to have a prof who took tools seriously

2:34 tomoj: great way of putting the problem

2:36 amalloy: had one project where it was like, "your team has to do weekly ant builds, persist data using mysql, share source with cvs, using ssh access to the repo on my server, and the final project has to work on my machine"

2:36 oh and javadoc everything

2:36 this was back when ant was cool

2:37 which apparently it still is, but what can you do

2:39 tomoj: anyway rcs is what came before cvs. most cvs features are implemented on top of rcs

2:41 and svn is basically just cvs with different version-numbering schemes and different optimization tradeoffs

2:46 waxrose: >.>

2:53 amalloy: waxrose: eh?

2:55 waxrose: amalloy, Just kind of responding to what you typed @ the team statement

2:56 amalloy: that is...less of a response, more of a "vague eyes looking sideways" thing

2:56 waxrose: Yeah, sorry... I'm a bit vague. :P

3:00 I find this REPL for Android interesting.

3:36 cnataren: technomancy: ping.

4:28 angerman: bindings are thread local right?

5:12 fliebel: Has anyone ever implemented a quad tree in Clojure?

5:25 Dranik: morning!

5:25 how to transform a vector to map?

5:31 morphling: ,(apply hash-map [:a 1 :b 2])

5:31 clojurebot: {:a 1, :b 2}

5:44 fliebel: How can I use version ranges to get the latest Clojure alphas? Can I just do [1.3,) or something like that?

5:52 "[1.3.0-alpha5,)" gets me a snapshot :(

5:53 Dranik: morphling, thanks!

6:34 I'm trying to build an uberjar but my source depends on external jars

6:34 how to add the extrnal jars to the uberjar?

6:38 fliebel: Dranik: Add them to your local maven repo and declare them as dependecies in your project.clj

6:39 Dranik: fliebel, sounds a bit comples, but I'll give it a try

6:39 *complex

6:40 fliebel: Dranik: Well, easier would be to find out if they exist in a maven repo already somewhere, or jst put the source files under your src and let cake or lein-javac take care of compiling them.

6:45 angerman: how can I test if a clojure object is serializable?

6:46 fliebel: angerman: (implements? obj Serializable)?

6:47 angerman: hmm where's implements/

6:53 fliebel: Can anyone advice me on the ref/agent/atom decision? I have some shared state, but I just need to push data on there, so I don't need synchronicity or management. So I'd say an agent is appropriate, but I have a watch fn, and I'll be calling it from a thread pool, so I had the idea that I could run the watcher less by using dosync, and I feel like agents are a bit heavy. For some reason, the spinning of an atom feels inappropriate for this task.

6:53 Dranik: fliebel, thanks, that succeed

6:53 fliebel: :)

6:54 angerman: fliebel: could not find impelements? so far :/

6:54 fliebel: angerman: I'm sure it's there, but not sure I got the name right… let me see...

6:55 angerman: instance?

6:55 angerman: fliebel: hmm.

6:56 ,(instance? {} java.io.Serializable)

6:56 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.lang.Class

6:56 angerman: ,(instance? (class {}) java.io.Serializable)

6:56 clojurebot: false

6:56 angerman: hmm maybe I've got it wrong.

6:56 fliebel: ,(instance? java.io.Serializable {})

6:56 angerman: ,(instance? java.io.Serializable {})

6:56 clojurebot: true

6:56 true

6:56 angerman: ahh.

6:56 fliebel: hah

7:21 * fliebel sucks at figuring out <, >, <= and >=

7:26 opqdonut: yeah, those are the only operators I have problems with

7:26 in prefix notation

7:26 fliebel: Oh, but with prefix notation, I might be able to combine a few of them into one, but that'll hur my brain.

7:27 xkb: is there a standard function for the max of a list?

7:28 angerman: yikes. I needed an AOT

7:28 fliebel: xkb: No, but you can use reduce.

7:28 xkb: fliebel: thanks, that's what I did now.

7:31 fliebel: $findfn [1 4 2 6 2] 6

7:31 sexpbot: []

7:31 fliebel: $findfn max [1 4 2 6 2] 6

7:31 sexpbot: [clojure.core/reduce clojure.core/apply]

8:03 fliebel: Hey, cool, what is this? I made a recursive function that should never end, but it ends almost instantly and produce the expected result.

8:03 arbscht: fliebel: you must have a fast computer ;)

8:04 fliebel: arbscht: Yea, Intel core^2 duo ;)

8:05 check this: https://gist.github.com/888223

8:05 I'd say overlaps? should run forever, but it does not.

8:06 it runs only twice.

8:06 I mean, fine with me, but why? how?

8:10 mduerksen: fliebel: just took a quick look - is it quaranteed that all contains?-queries will always be false? otherwise, the or-statement won't evaluate the recursive call

8:11 fliebel: mduerksen: No, the statement returns true, so something at least returned true.

8:12 user=> (overlaps? {:x 50, :y 50, :height 1, :width 1} {:x 50, :y 10, :height 100, :width 100})

8:12 test

8:12 test

8:12 true

8:12 so what you;re saying is that if it'd return false, it'd never return?

8:13 yea, right :)

8:14 mduerksen: i'm not sure that's what i wanted to say :) just wanted to make you aware that the or-statement only evaluates it's last parameter if all others are falsy

8:15 and that's what seems to happen if i understood you correctly

8:15 fliebel: mduerksen: Yea, forgot about that.

8:16 mduerksen: ah, ok - mission accomplished :)

8:44 fliebel: Writing data structures is hard :(

8:46 angerman: fliebel: very true. And even more saddening is that it's still far from a shippable product once the datastructure is in place.

9:45 TimMc: fliebel: Are you just trying to test for overlapping of axis-aligned rectangles?

9:48 fliebel: If so... https://github.com/timmc/CS4300-HW4/blob/master/src/timmcHW4/core.clj#L43

9:49 fliebel: TimMc: Well, checking if 2 boxes overlap is not hard at all, what is hard is determining which boxes to check.

9:51 TimMc: Ah, this is your solution to the rabit rendering you showed a few days back?

10:17 TimMc: How many boxes do you have to check?

10:17 Yeah, this is the 3D renderer.

10:19 fliebel: TimMc: Don't know… I might get away with checking them all, but I like the exercise. I'm trying to make a quadtree now.

10:19 TimMc: ah

10:19 There's another algorithm for checking a bunch of aarects.

10:19 fliebel: oh, tell me :)

10:20 TimMc: Technically, it's for checking if the projections of polygons onto a line (line segments) have intersections. Let me find it.

10:21 fliebel: TimMc: That's never going to be faster than just checking the 4 points of my squares, is it?

10:21 TimMc: http://stackoverflow.com/questions/3324880/axisaligned-rectangles-intersection

10:22 fliebel: Wait, are these actually squares?

10:24 fliebel: TimMc: Yea, I'm drawing sprites in 2D, not triangles from weird files ;)

10:25 Okay, I admit the sweep and prune looks a lot easier than these trees.

10:41 On second thought, For moving items, I really only need to know their nearest neighbor, and for the ground, I need to make sure items are over transparent pixels.

10:53 TimMc: Code management question! Our next assignment (HW5) builds off the last one. I currently have "HW4" and "timmcHW4" references sprinkled throughout my build files and namespaces. Should I just leave it as that and only change the user-visible references to HW5?

11:31 fliebel: How do I use defrecords from another namespace? Do I use the full class name, or what?

11:32 Raynes: fliebel: IIRC, you import the Java class corresponding to the record.

11:33 fliebel: Raynes: With all the _STAR_ stuff and underscores?

11:34 Raynes: fliebel: No clue. Haven't had to import many records.

11:35 fliebel: Oh, sure, logical… it has a underscore int eh ns and a dash in the class.

11:56 thorwil: enlive question: how do i select an element by a name attribute?

12:04 ah, [(enlive/attr= :name "title")]

12:05 TimMc: $findfn 0 5 7 5

12:05 sexpbot: []

12:05 jlf`: hi all -- i'd like to have stdout redirected to my slime repl. there is emacs' slime-redirect-inferior-output, but i'm launching swank from -main and connecting via slime-connect. anyone know a solution?

12:06 TimMc: I keep writing (defn clamp [min max v] (Math/min max (Math/max min v))) -- I can't believe there isn't already something like this.

12:21 mduerksen: i have a question concerning "ensure". die docs say: "Protects the ref from modification by other transactions. [...] Allows for more concurrency than (ref-set ref @ref)". what does the last sentence mean? that the transaction won't fail if the competing transaction sets the ref to the same value?

12:22 TimMc: mduerksen: Does this help? http://clojuredocs.org/clojure_core/clojure.core/ensure#comment_73

12:23 Caffeine: TimMc: Clojure provides his own min/max, why use Math's?

12:23 (Honest question, not a critique.)

12:24 TimMc: Caffeine: critique would be fine too. :-) Let me take a look.

12:24 Caffeine: haha okay :P

12:24 Fossi: why is it not possible to lein install ring?

12:24 TimMc: Huh. I don't actually know why I did that.

12:25 Caffeine: TimMc: You'll save 10 characters each time you type your clamp defn ^^

12:25 Fossi: lein says: a.io.FileNotFoundException: $MY_HOME_PATH/ring/src (No such file or directory)

12:27 TimMc: Caffeine: Yeah, but now I have to come up with new names for the interval endpoints. :-(

12:28 Caffeine: yup... noticed that.. :S .. I kinda like lisp 2's for that .. haven't really thought of the cons

12:28 mn mx

12:29 or m M :o

12:29 TimMc: minv maxv

12:29 * Caffeine likes cryptic code ... but only when I wrote it

12:29 TimMc: (min maxv (max minv v))

12:30 Caffeine: that's clear enough

12:30 TimMc: I still think there ought to be a clamp function.

12:31 Caffeine: It's clear if you're familiar with the idiom. WHen I first derived it, I kept thinking "max min? min max? this can't be right..."

12:31 Caffeine: Don't know.. I wrote my own in Java too... the search was going to take longer than writing it I guess...

12:44 thorwil: is there something like a non-lazy concat?

12:49 Caffeine: noob question: can't we just force concat to fully evaluate if there isn't one non-lazy version?

12:53 thorwil: well, none of eval, dorun or doall help in my case

13:09 TimMc: thorwil: Why do you want eager concat?

13:12 thorwil: TimMc: i'm fighting with Enlive's "[selector] transformation [selector] transformation" syntax, where the lack of () around each pair is nice until i want to assemble stuff

13:14 krl: any pointers what this error is about?

13:14 lein swank -> java.net.BindException: Cannot assign requested address (NO_SOURCE_FILE:1)

13:16 angerman: krl: looks like you are prevented from binding the swank server to a local address.

13:17 krl: is one already running? do you have enough priviledges to bind an address?

13:18 gfrlog: I really miss clojure's immutable data types when I'm programming in JavaScript. Does anybody know if there is a library of similar types in JavaScript anywhere? Or should I write my own?

13:19 krl: angerman: hmm. 4005 right? does not seem to be bound

13:19 angerman: gfrlog: what do you miss about them?

13:20 krl: I think you can try lein swank 8888

13:20 gfrlog: angerman: writing functional code

13:20 angerman: $ lein swank 8888 and see if that works.

13:21 gfrlog: so you are missing the rich set of datastructures? or explicitly the immuability?

13:21 gfrlog: angerman: I want to be able to take a large data structure, pass a slightly mutated version to a function but still be able to use the old version

13:21 so the immutability and the efficient sharing of structure

13:22 of course having sets and hash maps would be nice too. Prototype has a Hash, but it's not all that good :-/

13:22 angerman: gfrlog: I guess you are on your own then. Maybe take a look at clojurejs(?) ?

13:23 gfrlog: angerman: k, thanks

13:30 thorwil: i'm pretty sure my article is a map with a :title, but (let [article (models/retrieve-article path) title (article :title)] ...) leads to tlog.models.Article cannot be cast to clojure.lang.IFn !?

13:32 krl: thorwil: shouldn't that be (:title article)?

13:33 thorwil: krl: yes, indeed 0.o

13:33 why do i think i saw it the other way round, and what would the reason be?

13:34 mippymoe: Hey guys, I'm given a set of arrays of doubles (all of equal length). I'm trying to figure out a good way to hash them. Any ideas? (for example, given an array, I could sum up all its elements and then mod it by the number of elements in the hash table, but this would be a bad function because addition is commutative)

13:35 hugod: thorwil: maps work either way round, but defrecord doesn't implement IFn

13:36 thorwil: ah! thanks hugod, krl

13:36 KirinDave: mippymoe: They're arrays?

13:36 mippymoe: KirinDave: yep

13:36 KirinDave: mippymoe: Why not just use binary signature as input to a real hash algorithm?

13:36 There are plenty of fast, low overhead algorithms

13:37 mippymoe: KirinDave: I gotta create my own, it's part of a project I'm working on for school

13:37 KirinDave: mippymoe: Oh.

13:37 mippymoe: Hope you're a math major.

13:37 opqdonut: heh

13:37 KirinDave: mippymoe: Designing good hash algorithms is hard work, and only partially in a computer science domain.

13:38 mippymoe: KirinDave: haha well I am fortunately, but actually, it's not a big deal

13:38 KirinDave: mippymoe: In any event, reduction to its binary signature is probably a good move, if only to get out of insanity of double representations.

13:38 mippymoe: KirinDave: its an undergrad course, so the hash can be fa rfrom perfect

13:40 KirinDave: hmm ok

13:40 opqdonut: mippymoe: have a look at string hashing algorithms

13:41 KirinDave: yeah

13:41 opqdonut: you might find some nice ideas there

13:41 KirinDave: Just treat it as a byte string.

13:41 opqdonut: mhmm

13:41 mippymoe: so like concatenate all the doubles in the array?

13:41 and then do some operation on that?

13:42 * fliebel has a function of 30 lines he needs to fix

13:42 opqdonut: wrap the double array into a DoubleBuffer, and turn that into a ByteBuffer

13:43 KirinDave: opqdonut speaks wisdom.

13:44 opqdonut: then go through the bytes and do something like hash=(hash+byte)^17

13:44 or whatever

13:44 mippymoe: thanks guys

13:45 KirinDave: mippymoe: Good luck.

13:45 opqdonut: Is 17 more magic than 11? I usually use 11.

13:45 I guess more hot bits.

13:45 opqdonut: I've seen 17 used quite a bit

13:45 that's all I know :D

13:45 KirinDave: :)

13:46 opqdonut: somewhat related: http://stackoverflow.com/questions/299304/why-does-javas-hashcode-in-string-use-31-as-a-multiplier

13:49 KirinDave: ugh

13:49 SO.

13:49 Will Never Click.

13:49 Woo scala 2.9 is out.

14:01 Caffeine: KirinDave: Why?

14:01 (SO)

14:01 KirinDave: Caffeine: I do not believe in SO's model or mission.

14:02 Caffeine: To bite Heinlein, you don't understand a beach by understanding each grain of sand.

14:02 Caffeine: It often fails, but it also very often help me go on with many tasks.

14:03 opqdonut: it can have interesting trivia/nuggets of information from well-informed people

14:04 KirinDave: It's sorta like straining your local sewer for lost jewelery

14:04 You can find great stuff

14:05 But only after going through a lot of poop.

14:05 opqdonut: I don't browse so, I merely have a look when somebody (eg. google) points me there

14:15 Caffeine: Yeah, I'm not searching it much... I'm posting my problems, and IF someone comes in with something good (which I must admit happens in no more than 1/3 of my threads), yay, else.. hmm.. I eventually answer my own problem.

14:18 sleekyak: hi all; if i'm just jumping back into clojure after 9mos or so, should i start with 1.3alphas or 1.2?

14:25 * devn tips his hat

14:25 devn: sleekyak: i'd say jump in with both feet to the latest 1.3 alpha

15:01 symbole: I'm adding a directory to my classpath using -classpath, and this directory contains x/y/z.clj. I'm trying to require using (require 'x.y.z), however, I get the file not found exception. Does clojure recognize what's being passed to -clsspath?

15:05 raek: symbole: yes, it's supposed to work that way.

15:06 symbole: are you sure that any hyphens in the namespace names are replaced with underscores in the file name?

15:06 e.g. (ns x-y.foo-bar) should be in x_y/foo_bar.clj

15:07 also, note that if you use the -jar option, the -cp/-classpath option is _ignored_

15:07 (silently)

15:07 symbole: I am using the jar option.

15:09 Is this JVM behavior, or clojure?

15:09 raek: JVM

15:10 fliebel: Anyone fancy helping me out finding a bug in a 30 line long function, or thinking about ways to trim it down?

15:11 raek: fliebel: paste?

15:11 symbole: So if I do want to start it from the command line, the alternative is unzip the clojure jar?

15:11 fliebel: raek: Moment...

15:12 raek: symbole: no, you can still do java -cp lib1.jar:lib2.jar:src/:clojure.jar clojure.main

15:12 symbole: have you heard about leiningen or cake?

15:12 Caffeine: symbole: no, I think you can just -cp yourpack.jar:.:anotherpack.jar the-class-to-start no?

15:12 yeah what raek says

15:12 symbole: raek: I have, but I want to make sure I understand how it lower level details work.

15:12 fliebel: https://gist.github.com/888545

15:13 The problem is that quads do net get the proper offset, I think.

15:14 symbole: raek: You said that using the jar method of launching clojure ignored? Isn't that what you're doing?

15:14 Ugh. I meant, ignores -classpath.

15:15 Caffeine: We're not providing -jar option

15:15 so it doesn't ignore -cp

15:15 raek: symbole: what I said only applied to the "-jar" command line option, not using jar files in general

15:15 symbole: Oh, I see.

15:15 raek: -jar is for the case when you only have one jar file, and want to use its default main class

15:16 * Caffeine has packed an app using FatJar... works good with -jar afterwards

15:16 raek: lein uberjar produces those jars too

15:17 Caffeine: I'll have to seriously check that lein thing soon

15:18 symbole: Thanks. That worked.

15:21 david`: I saw someone with a clojure conj shirt on at lunch yesterday

15:22 NameNode: Five inches came and went, as did six. Slowly, his hard-on got

15:22 thicker and longer as his tiny balls began to swell. It was like watching

15:22 a long, thick balloon slowly fill. The pressure was growing more and more

15:22 intense as seven inches neared. His balls were almost an inch and a half

15:22 across now as the pressure swelled and suddenly, released.

15:22 With orgasmic shock, Curt watched himself spray an arc of cum

15:22 across the shower room to the opposite wall, six feet away. Each spasm

15:23 Caffeine: lollll wtf

15:25 dnolen: fliebel: do you have some input that gives the wrong out?

15:26 Clinteger: hahahaha

15:29 fliebel: dnolen: No, it seem rather random, but them , I'm using a random input :D I'll fix the bugs myself, but comments on code organization are appreciated :) (I pane to use Logos for that AI of my game btw)

15:30 *plan

15:30 raek: fliebel: so a node in the quad tree is either nil, a quad object (which contains four nodes), or some data?

15:30 dnolen: fliebel: cool! the disequality stuff is going a little slower than planned. I have an idea for a better implementation than the one presented in Byrd's thesis.

15:31 fliebel: raek: Yea, so I drill down untill I find a nil, in which case I replace it, or I find another object, in which case I make a new quad and put both in htem.

15:31 dnolen: Cool :) That monkey banana example really got me thinking.

15:34 dnolen: fliebel: heh, yeah it's pretty neat. once the disequality stuff is in I'll start converting more Bratko examples.

15:34 fliebel: dnolen: What is Brakto about?

15:34 devn: fliebel: what'd you find out with structmaps yesterday btw? you end up going with defrecord?

15:35 fliebel: devn: Yea, defrecord, don't know about the CG for sure, but it works.

15:35 * devn nods

15:36 devn: i was thinking maybe a structmap would be worth looking at, but maybe not too...

15:36 dnolen: fliebel: it's just a good introduction on Prolog. It's a good idea to have many examples on solving common problems w/ Logos, even better to have them based on a text that people can easily get their hands on.

15:36 fliebel: true

15:36 * fliebel refactors

15:37 fliebel: Is this cheating for optional arguments? & [pidx parent]

15:37 Chousuke: nah

15:38 fliebel: thats good enough for me.

15:43 TimMc: fliebel: I thought each node in the quadtree would have a coll of items and optionally also 4 children.

15:44 dnolen: resurrecting delimited continuations for Clojure, https://github.com/swannodette/delimc

15:45 but now in terms of Scheme's shift/reset

15:45 fliebel: TimMc: Uh, oh, that's not how I understood it. I think you;re supposed to split up the children untill ther is only one point per square.

15:45 TimMc: Ah, you have points, not shapes?

15:46 Raynes: devn: Is clj-shoes what I think it is? :O

15:46 fliebel: TimMc: No, much to complicated for me :P

15:46 arohner: is there a way to force clojure to ignore .class files, and always recompile?

15:47 I'm dealing with a jar that was compiled against an older version of clojure, and I'd rather not recompile it

15:48 raek: well, in a perfect world libs should not contain AOT compiled source at all

15:49 ...or does the lib need AOT?

15:49 arohner: raek: I agree, most of the time. i think this library has a good reason for compiling one ns, but it precompiles all functions it needs in the AOT ns

15:50 and then I'm requiring one of the dependent ns-es, and clojure loads the .class file

15:51 raek: is the AOT essential for the lib (i.e. does it not work without it)? if not, the user of the lib should do the AOT, or the lib author should release one version of the lib for each stable clojure version

15:51 fliebel: yay, I haz a quadtree, now I want to visualize it :(

15:52 raek: but to answer the question: no, I don't think you can turn off loading class files like that

15:53 until the version compability of compiled code issue is solved in some way, source-only is the only real option for libraries

15:56 arohner: raek: I think part of the problem is AOT compiles every function loaded, when this probably just needs to generate one class file

16:00 raek: well, you'd still have the clojure version incompability problem

16:00 but yes, that bug/feature in the clojure.core/compile is a bit odd

16:05 * dnolen is building the official mac os x jdk 7

16:08 devn: Raynes: I'm not sure...

16:08 Raynes: What do you think it is? :D

16:08 danlarkin: dnolen: exciting!

16:08 dnolen: http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port

16:08 * danlarkin is looking forward to jdk7

16:34 Raynes: devn: Shoes!

16:36 devn: Raynes: yes, but since you aren't a ruby guy im asking if you know what shoes is :)

16:37 fliebel: devn: That's some gui stuff by a guy who disappeared, right?

16:37 Raynes: devn: Yes.

16:37 devn: I'm a fan.

16:37 devn: fliebel: yes

16:37 Raynes: devn: To be fair, I'm a fan of any Clojure GUI tools.

16:37 TimMc: _why

16:37 devn: Raynes: ah, cool -- yeah what is in that repo is a little...not shoesey...yet

16:38 fliebel: Raynes: Is your 2035 project going to be like shoes?

16:38 Raynes: fliebel: Heh, no. I've never actually used Shoes. I'm only excited at the prospect of Clojure GUI tools.

16:39 fliebel: Raynes: Oh, you're not a big fan of Swing? :D

16:39 Raynes: Not particularly.

16:39 * fliebel simplified his quadtree so much it doesn't even work

16:40 Raynes: Good work.

16:40 devn: What's in that repo is not much of anything. Yet.

16:41 fliebel: https://github.com/abhijith/clj-shoes

16:47 Raynes: fliebel: I was dead serious though. We are wrapping Swing.

16:53 lucian: is *anyone* a fan of swing, really?

16:55 fliebel: Raynes: I realize, and sympathize with your pains :(

17:02 dnolen: hmm is it possible to avoid reflection w/ proxy?

17:03 ssideris: hello

17:03 I've written this macro: http://pastebin.com/ZvxGcNtQ

17:04 I tried removing the second parameter and changing (actionPerformed [~event] ... to (actionPerformed [event] ...

17:04 but I get an error about qualified names which I don't understand

17:04 shouldn't that work?

17:06 raek: ssideris: syntax-quote will namespace qualify the addActionListener and actionPerformed symbols

17:06 which you don't want in this case...

17:07 if you use .foo instead of (. foo ...), syntax quote will not do that

17:07 for the actionPerformed case, you simply need to write ~'actionPerformed

17:08 (you can do that in the first case too)

17:10 ataggart: dnolen: sometimes you hit reflection in proxy due to the implicit 'this not having a tag

17:11 raek: ,`(proxy [java.awt.event.ActionListener] [] (actionPerformed [foo#] nil))

17:11 clojurebot: (clojure.core/proxy [java.awt.event.ActionListener] [] (sandbox/actionPerformed [foo__5792__auto__] nil))

17:11 ataggart: dnolen: if you provide your own typehinted (binding [^Foo this this]...) it will take care of some reflection cases.

17:11 ssideris: raek: ~'actionPerformed seems to have done the trick, but .~component doesn't seem to make a difference

17:13 raek: ssideris: change `(. ~component addActionListener ...) into `(.addActionListener ~component) or `(. ~component ~'addActionListener ...)

17:13 ssideris: oh that's what you meant

17:13 sorry, i'm just starting with macros :-)

17:13 thanks

17:14 raek: dnolen: you can do it if you build the proxy using get-proxy-class, construct-proxy and init-proxy, something like this: https://gist.github.com/877894

17:14 ssideris: eh, sorry for the broken foo example...

17:15 (in the gist I also made the method call a var rather than a fn)

17:15 dnolen: raek: ataggart: here's what my code looks like.

17:15 https://gist.github.com/888637

17:16 raek: hrm.

17:17 ataggart: wrap the call to compute with (binding [^RecursiveTask this this] ...)

17:17 raek: dnolen: what does the RecursiveTask interface look like?

17:17 binding?

17:17 clojurebot: :|

17:18 dnolen: raek: http://download.oracle.com/javase/7/docs/api/java/util/concurrent/RecursiveTask.html

17:18 raek: binding only works on vars, right?

17:18 ataggart: it'll work

17:18 'this is provided by the proxy code

17:18 dnolen: ataggart: wrap (.compute ...) ?

17:18 ataggart: yarp

17:18 dnolen: lame.

17:19 ataggart: hmm you're doing wierd stuff so I'm not sure where it should go

17:20 dnolen: ataggart: heh, why is it weird? I'll gladly not do it if there's a better way.

17:20 raek: I think the reflection is cause by the fact that the method is protected

17:20 ataggart: I'm guessing RecursiveTask is from java7

17:20 dnolen: ataggart: yes, fork/join

17:20 ataggart: what's the reflection warning say?

17:20 raek: so maybe the reflector skips it

17:21 dnolen: reference to field compute can't be resolved.

17:22 ataggart: dnolen: ok, I'm probably wrong about the 'this being the culprit

17:23 does that warning happen when the recursive-task function is read, or when you run the code inside the comment?

17:23 dnolen: when I compile the whole file

17:23 ataggart: so, not anything to do with the code inside the comment.

17:23 dnolen: when run .compute 1e6 times it takes 1.6s, which seems ridiculously slow for method calls.

17:23 ataggart: no.

17:31 ataggart: dnolen: does the call actually work?

17:31 dnolen: ataggart: yes

17:35 ataggart: dnolen: I'm inclined to agree with raek. I'm not clear on what magic is being used to make a protected method publicly callable.

17:40 Sunil01: Is Clojure better suited for working with Big Data than Haskell?

17:41 sritchie: tbatchelli and I are working on a hadoop configuration tool, using pallet, that will make that pretty easy

17:41 Sunil01: I've been having a wonderful time working with hadoop in clojure, using nathanmarz's cascalog... can't say anything for the haskell side of the debate

17:43 ataggart: dnolen: ok I think I figured it out. While RecursiveTask has a protected compute method, thus typehinting doesn't buy you anything. When the call actually is made, the type is not RecursiveTask, but a proxy class that has a *public* compute method, thus the call works.

17:43 Sunil01: sritchie: Thank you. Were you working with Clojure before this project? Was there a steep learning curve?

17:43 dnolen: ataggart: yes, totally

17:44 sritchie: Sunil01: actually, I wasn't

17:44 working with clojure before

17:44 dnolen: ataggart: I switched to .invoke, 2ms now

17:44 for 1e6

17:44 ataggart: nice

17:44 sritchie: I'd worked my way through http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/0262560992, but that was about it, for lisp

17:45 Sunil01: I have 'The little Lisper' and am working through SICP.

17:45 dnolen: ataggart: raek: thx for the insights.

17:45 Sunil01: What did you use to get started with Clojure?

17:46 ssideris: is there a built-in way to create a proxy for a java interface where the provided methods are implemented and all the rest are just empty?

17:46 sritchie: I'm an emacs user, so I started with leiningen, with swank-clojure to access the REPL with SLIME -- https://github.com/technomancy/leiningen

17:47 what editor do you like?

17:47 Sunil01: sritchie: Thank you for the info. I am a vim and Textmate guy

17:47 sritchie: I use cake now -- https://github.com/ninjudd/cake -- as a couple of guys on my team aren't into emacs, yet, and cake has some nice tools for textmate

17:47 https://github.com/swannodette/textmate-clojure

17:48 here's a fun way to get started right now, if you're interested -- https://github.com/relevance/labrepl

17:48 Sunil01: awesome, thank you.

17:49 sritchie: msg me, or head into the pallet channel if you decide you want to go the hadoop route, I'd be happy to help you get set up

17:49 raek: ssideris: if you leave out a method definition in proxy, it will be implemented by throwing an UnsupportedOperationException

17:49 sritchie: sorry to barrage you with info, but here's the last link you'll want to check out, on cascalog -- http://nathanmarz.com/blog/introducing-cascalog-a-clojure-based-query-language-for-hado.html

17:50 ssideris: raek: yeah, I saw that, but is it a good thing throwing all those exceptions?

17:50 sritchie: Sunil01: good luck

17:50 !

17:50 Sunil01: sritchie: No you are not barraging....thank you for being so helpful.

17:50 sritchie: no problem, everyone in here's been so wonderful, it's nice to see a question I can answer ;)

17:52 raek: ssideris: at least it's something that you always can do. otherwise, what value should the method return? you can't return null if the return type is a primitive...

17:53 that exception is also used in the java collection interfaces for destructive operations on read-only collections

17:53 ssideris: raek: good point didn't think about return values

17:54 raek: ...and also, is it a good thing to just silently ignore the method call?

17:54 ssideris: well, I'm trying to emulate what "adapters" do in Swing

17:55 say you have a MouseListener, the MouseAdapter provides empty implementations of all the methods of the Listener interface for convenience

17:55 raek: in that case it makes more sense...

17:55 ssideris: so that you can override only the relevant ones

17:56 raek: thankfully, we can do something like (add-listeners {:click fn-1, :move fn-2}) in clojure :)

17:56 ssideris: how???

17:56 raek: well, in pure clojure

17:57 ssideris: are you referring to clojure.contrib.swing-utils ?

17:57 raek: since in clojure, you don't have an interface for each possible use of an anonymous function

17:58 ah, no. this was just a java rant :)

17:58 pseudo-code

17:58 ssideris: oh sure

17:58 that's what I'm trying to build more or less

17:59 my code looks like that: http://pastebin.com/e3mMwJ6A

18:00 raek: neat

18:00 ssideris: although I'm a bit concerned about the wasteful creation of object that this might lead to if I start adding on-mouse-clicked etc

18:01 because the MouseAdapter has methods for various mouse-related events

18:01 and the way I'm doing it, it would create one mouse adapter per "on-" handler

18:02 I mean that MouseAdapter can handle mouse clicked, mouse over, mouse out etc

18:03 raek: if you have a proxy like (defn make-mouse-listener [fnmap] (proxy [MouseListener] [] (mouseClicked [e] (when-let [f (:clicked fnmap)] (f e))) (mousePressed [e] (when-let [f (:pressed fnmap)] (f e))) ...))

18:04 you could use the same proxy

18:04 ssideris: yeah, I should reconsider my syntax a bit

18:05 I liked your add-listeners pseudo-code

18:05 raek: then it would be easy to have something like (button "test" {:clicked (fn [_] ...)}), or maybe make a macro to make that prettier

18:06 thinking of it, I would probably separate the adding from the creating of the proxy

18:06 ssideris: sure, but in many many cases it's convenient to have a way to add listeners in-place

18:06 because in some cases the listeners are shared

18:07 raek: you can always add a macro for that later

18:07 ssideris: but in a lot of cases they are unique for a component

18:07 raek: not having a macro that does everything makes testing *a lot* easier

18:08 to quote cgrand: "Syntax is icing, add it later!"

18:08 ssideris: makes sense

18:08 I do Swing for my day job and I hate the verbosity

18:09 so as therapy, I'm trying to make something in clojure that will express the same thing is as few keystrokes as possible

18:09 :-)

18:10 raek: you will most certainly succeed with that :-)

19:19 dnolen: huh, anybody familiar w/ the ForkJoin stuff know what advantage the RecursiveTask has over the standard ForkJoinTask?

19:34 livingston: if you use a namespace that has a record in it you don't get access to that record by default? you have to then separately import the record too to get it's constructor?

19:35 I basically need to do this: http://tech.puredanger.com/2010/06/30/using-records-from-a-different-namespace-in-clojure/

19:46 dnolen: fork/join is sick, https://gist.github.com/888733

19:47 livingston: dnolen: you mean in a good or a bad way?

19:49 dnolen: livingston: good

20:29 ossareh: how dependable will ##(< (.hashCode [2011 1]) (.hashCode [2012 2])) be?

20:29 sexpbot: ⟹ true

20:29 ossareh: I just through a bunch of vectors into a #{} like that and they were in the correct order, I was expecting to have to use (sorted-set-by).

20:30 s/through/threw/

20:30 sexpbot: <ossareh> I just threw a bunch of vectors into a #{} like that and they were in the correct order, I was expecting to have to use (sorted-set-by).

20:38 dnolen: using fork/join to make Logos parallel should be fun

20:43 tomoj: ossareh: you want lexicographic?

20:48 [] hashes to 1, nonempty v hashes to (+ (* 31 (.hashCode (pop v))) (.hashCode (peek v)))

20:48 of course relying on that would be pretty evil

20:49 ossareh: tomoj: nope, that is a year and week number in the vector. Checked the APersistentVector .java and and it's hashcode delegates to the values within it. Since they're numbers, they'll sort correctly

20:49 s/it's/its/

20:49 sexpbot: <ossareh> tomoj: nope, that is a year and week number in the vector. Checked the APersistentVector .java and and its hashcode delegates to the values within it. Since they're numbers, they'll sort correctly

20:53 danbell: "IllegalArgumentException: Key must be integer" could only possibly refer to a vector being called as a function somewhere, right?

20:54 tomoj: ossareh: hmm

20:55 dudly: evenin'

20:57 So, I have this text file with somewhat unstructured data.

20:57 say:

20:57 1. Did you do your laundry? Yes 2. did you take out the trash? No 3.Did you bring in the milk? yeS

20:57 There are any number of new lines or spaces or tabs after the respective "Yes" and "No"s

20:59 I'd like to generate a map of yes and no corresponding to the number. So I can look up by :1 :2 :3 etc.

20:59 brehaut: dudly: why would you use keywords for numbers? why not integers?

20:59 dudly: brehaut: hmm, I could use numbers as keys.

21:00 tomoj: ossareh: ##(< (.hashCode [2010 50]) (.hashCode [2011 1]))

21:00 sexpbot: ⟹ false

21:01 dudly: then I could do math with them etc, true... anyway, whats the shortest path to my solution? Indexing? and how would I get the index of a clause?

21:01 re-find and friends are only validating that the string exists, not returning location... what I really need is the tail of the string returned

21:02 ossareh: tomoj: fair play.

21:02 dudly: I'd like to be able to lazily pull in the string until there is an entire match of the clause, then hand me the rest of the string so I can extract the Yes or No

21:03 tomoj: I'm glad, because even if it had worked you shouldn't have used it :)

21:04 brehaut: ,(into {} (map (fn [[_ k v]][(Integer/parseInt k) v]) (re-seq #"(\d)+.[^?]+\?\s*(Yes|No)"

21:04 "1.aba c?\n\nYes2. dfgdfgdfgdfgs fdg sdf\n\nsdg? No")))

21:04 clojurebot: EOF while reading

21:04 brehaut: bah

21:04 sritchie: hey all, I'm blanking on an idiomatic way to get a subset of a map

21:04 brehaut: ,(into {} (map (fn [[_ k v]][(Integer/parseInt k) v]) (re-seq #"(\d)+.[^?]+\?\s*(Yes|No)" "1.aba c?\n\nYes2. dfgdfgdfgdfgs fdg sdf\n\nsdg? No")))

21:04 clojurebot: {1 "Yes", 2 "No"}

21:05 dudly: wtf

21:05 brehaut: dudly: thats what you wanted right?

21:05 dudly: yup

21:05 sritchie: haha, you just freaked him out

21:05 dudly: I'm going to have cut and paste this into a text file to study for a moment

21:05 brehaut: sorry about regexp, also its not case insensitive because i forget those details

21:05 tomoj: sritchie: given what?

21:06 ossareh: tomoj: true dat. /me slaps his wrists for being tempted by dodgy solutions

21:06 sritchie: so, if I have {:tag :sometag, :phase thephase, :somekey someval}, I want to be able to apply a function and get a new map with {:tag :sometag, :phase thephase}

21:06 tomoj: given what?

21:06 sritchie: (f orig-map keys)

21:07 tomoj: ah

21:07 they keys you want to keep?

21:07 sritchie: yes

21:07 tomoj: $findfn {:foo :bar :baz :bing} [:foo] {:foo :bar}

21:07 sexpbot: [clojure.core/select-keys]

21:07 sritchie: woah, that's pretty cool

21:08 $findfn [1 2 3] [2] [1 2 3 1 2 3]

21:08 sexpbot: []

21:08 sritchie: bummer

21:09 if only if would output code for functions not written yet!

21:09 tomoj: thanks a lot

21:09 tomoj: heh

21:09 dudly: Oh, I see how that works. that's neat

21:09 regexes are confusing though

21:09 brehaut: dudly: add (?i) to the start and it'll be case insensitive

21:10 dudly: brehaut: like #"(?i)(\d)+.[^?]+\?\s*(Yes|No)" ?

21:10 brehaut: dudly its any number of digits (captured) one or more thing that isnt a questionmark, any amount of whitespace, ayes or no

21:10 i think so yes

21:10 ,(re-matches #"(?i)foo" "FOO")

21:10 clojurebot: "FOO"

21:11 brehaut: (re-matches #"foo" "FOO")

21:11 ,(re-matches #"foo" "FOO")

21:11 clojurebot: nil

21:12 dudly: brehaut: so the question mark is being used?

21:12 brehaut: its am agical java regexp option thing

21:13 dudly: what if the line was "4. gave the kids lunch money? (not too much: yes"

21:13 * much):

21:13 brehaut: then you have a problem

21:14 dudly: use (fn [[_ k v]][(Integer/parseInt k) (-> v .toLowerCase first (= \y))]) as your map function; you'll get a bool back as the value

21:15 or if you want to get #clojure points (comp (juxt #(Integer/parseInt %) #(-> % .toLowerCase first (= \y))]) rest)

21:15 wait no i want the not-juxt

21:16 tomoj: I have at least a fraction of a point for #{\y}

21:16 brehaut: tomoj: absolutely

21:16 tomoj: er, no

21:17 the whole point is to get a bool :)

21:17 brehaut: oh

21:17 hah

21:17 dudly: theres a closing ]

21:17 brehaut: dudly: that was a typo in anotherwise broken expression

21:18 dudly: does it do the same thing as the (fn.. above?

21:19 brehaut: no because i used juxt in the wrong place

21:21 dudly: I could partition the line into lines that start with #period

21:22 but sometimes this document has headings prior to a given number, like sections

21:23 not often.. I could customize it, I could even get the index of each character, but I'm worried people will change the document before they submit it.

21:23 it's basically a checklist in my organization that people submit

21:24 I mean, if people accidently add a space near the top of the document, it will change the indexes of all the yeses and nos

21:30 ah, one more constraint.. there is always at least one \newline before and after the yes or no

21:31 and the whole clause is always part of one line.. so I can partition the whole document base on lines...

21:32 brehaut: dudly: sorry i dont have time to do any more for you sorry

21:33 dudly: you've done enough already, brehaut. I'm smarter now.

21:33 brehaut: dudly: cool :)

21:34 tomoj: I feel like the why stack needs to be popped

21:34 a few times

21:34 * dudly drops a dollar brehaut's tip jar

21:38 flying_sheep: what is the correct way to return an unchanged data structure passed as a parameter to a function?

21:38 brehaut: ,(identity 1)

21:39 clojurebot: 1

21:39 tomoj: why aren't seqs stacks?

21:39 flying_sheep: thanks brehaut :)

21:40 brehaut: flying_sheep: if i understood you properly, otherwise (fn [x] x)

21:41 flying_sheep: yup, identity is what I needed

21:52 devn: hm

21:52 anyone else here a daily reader of the clojure google group list?

21:52 I'm somewhat perturbed by the /lengthy/ discussion following "Jesus, how the heck to do anything?"

21:53 dudly: somebody feeding a troll?

21:53 devn: Some of the Java bashing and so on is getting a bit counter-productive

21:53 It's subtle but it would discourage me if I had used Java in any serious capacity in the past and didn't yet "despise it"

21:54 It's emotional, I guess... That's what bothers me so much about it.

21:55 dudly: it's cultural though... deeply ingrained

21:55 devn: There is no room for emotional discussions. The majority of the things that happen on the list are incredibly objective, but when some of those same topics veer off towards the emotional, they turn into "reasons you shouldn't join this community"

21:55 there is plenty of room for opinions, but they ought to be objective

21:55 ;)

21:56 dudly: yea, I haven't read the list in many months

21:56 devn: dudly: im back on it now -- i screwed up and chose the digest

21:57 i like reading the threads -- so many great things hidden 28 messages deep in some of those threads

21:57 dudly: yea, I just have a few feeds on my feed reader and poignant mail list topics float up usually.

21:57 yea, I do miss those nuggets

21:59 planet clojure, clojure pipe, disclojure, and clojure reddit are on my feed's clojure folder

21:59 lotta dups but hits most of the pertinent news

22:01 devn: i havent ever read clojure pipe, link me?

22:01 i usually just hit disclojure and planet clojure because there are dupes between those two as it is

22:02 dudly: http://pipes.yahoo.com/pipes/pipe.run?_id=4cc8ebb9ae0b852d6ab7d94956ce2638&_render=rss

22:02 yea, it's probably redundant

22:03 devn: speaking of yahoo pipes

22:03 what an incredibly cool idea that they never chose to monetize

22:03 dudly: hmm

22:04 devn: or rather, they could have done a much better job of marketing it to the general public

22:05 it's such a cool tool and IIRC they were the first to make a GUI like Yahoo Pipes for muxing data together like that

22:05 dudly: yea, I expected more to be built on top of it

22:05 maybe the should have built more semantic web smartness into it.

22:06 devn: it was built at a time when no one gave a damn about the semantic web

22:06 only now do you see people even reasonably interested in paying to RDFify their entire site and so on

22:08 anyways...

22:08 dudly: imagine a website frontend, built on top of yahoo pipes, pulling in semantic web components other websites

22:34 devn: the underlying tools exist

22:53 dudly: what other functions go with partition and group-by, that let you mess with the order of things

22:54 or better put, that let you arrange the categorization of things

22:54 no_mind: using enlive, I want to define a snippet for input type="text" only. How do I do it ? Examples on net handle generic [[:input]] only.

22:56 devn: dudly: filter, remove, conj, concat, distinct, partition-all, partition-by, split-at, shuffle, sort-by, reverse

22:56 and some more

22:57 dudly: that'll do, thanks.. something in there will be it

23:05 tomoj: no_mind: use attr=

23:05 like [[:input (attr= :type "text")]] I believe

23:39 sritchie: hey all, here's a really simple one... how can I convert a series of 2-vectors into a hash-map?

23:42 ,(apply hash-map (flatten [[:key "word!"] [:another "test!"]]))

23:42 clojurebot: {:key "word!", :another "test!"}

23:42 sritchie: that works, just wondering if there's a more idiomatic way

23:50 hugod: ,(into {} [[:a 1][:b 2]])

23:50 clojurebot: {:a 1, :b 2}

23:50 no_mind: how can I iterate over a map ? I want to print the keys and corresponding values

23:53 sritchie: hugod: cool, thanks

23:54 no_mind: ,(for [[k v] {:a 1, :b 2}] (println "key: " k ", val: " v))

23:54 ,(for [[k v] {:a 1, :b 2}] (println "key: " k ", val: " v))

23:54 clojurebot: key: :a , val: 1

23:54 key: :b , val: 2

23:54 (nil nil)

23:55 sritchie: ,(doseq [[k v] {:a 1, :b 2}] (println "key: " k ", val: " v))

23:55 clojurebot: key: :a , val: 1

23:55 key: :b , val: 2

23:55 sritchie: no_mind: that's better

Logging service provided by n01se.net