#clojure log - Oct 07 2010

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

0:14 drewr: _rata__: you'd add an expression to define-clojure-indent in clojure-mode.el like (complex 1)

0:17 actually, you'd just add (define-clojure-indent (complex 1)) in your custom elisp after you've initialized clojure-mode

0:17 don't mess with clojure-mode.el

0:17 laurus: Can anyone here point me to information, or the right lines in the Incanter source code, for creating a JFreeChart theme?

0:19 _rata__: drewr, thanks :)

0:23 laurus: Has anyone found a way to generate plots in Incanter for use in academic publications?

0:43 _rata__: is there anything in clojure like repeat, but that repeats the expression unevaluated?... e.g. (repeat 2 (gensym)) -> two different symbols

0:44 scottj: wasn't there a version of binding in contrib that spanned threads?

0:45 laurus: do you come in every week asking that? if not it's a common complain/request :(

0:45 laurus: scottj, I'm sorry. I figured somebody might show up at some point who does.

0:46 I'm hacking away at it right now, but it's confusing to a total newbie like me

0:46 scottj: it's fine, have you tried the ml?

0:46 laurus: No, I guess I should do that.

0:46 drewr: _rata__: constantly

0:46 scottj: lot more incanterers there

0:46 laurus: OK, I will try there.

0:47 Thanks scottj. Sorry for bugging you and everybody!

0:47 drewr: _rata__: oh, you want unevaluated?

0:47 ,((constantly (gensym))

0:47 ,((constantly (gensym)))

0:48 constantly creates a function that always returns the (evaluated) arg you give it

0:48 but you could wrap that arg in a fn to delay

0:48 _rata__: yeah... then (repeat 2 (constantly (gensym)) returns a seq with two fns

0:49 and the fns would returns both the same symbol

0:51 gensym is just an example... what I really want is to call a function that returns refs, but I don't want the refs to be the same

0:52 laurus: If I have a (doto myinstance ... going on, how do I do a chain of multiple method calls?

0:52 To be specific here, I have (doto plot (.getDomainAxis

0:52 But then I want to call setLabelFont right after that.

0:52 amalloy: ,(repeatedly 2 (rand))

0:53 scottj: laurus: not following exactly, .. and -> don't help?

0:53 amalloy: _rata__: the above is wrong :P. but repeatedly is what you seem to want. (repeatedly 10 rand) would get you ten different random numbers

0:55 laurus: scottj, I want to use the (.. x (y) (z)) form

0:55 But I don't know how to do it inside a (doto form

0:55 _rata__: ok, thank you guys :)

0:55 amalloy: laurus: (doto myvar (.setSize 10) (-> .getSize .getX))?

0:56 drewr: _rata__: what's wrong with #(ref %)?

0:56 amalloy: drewr: (= ref #(ref %))...

0:56 laurus: amalloy, that chains getSize and getX?

0:57 drewr: amalloy: I don't follow; each time you call #(ref ...) you get a new ref

0:57 amalloy: laurus: yeah. try macroexpanding the above

0:57 laurus: I'm actually not familiar with -> yet

0:57 amalloy: drewr: and every time you call red you get a new ref

0:57 s/red/ref

0:57 _rata__: drewr, ref is no problem

0:57 laurus: And what is macroexpanding by the way?

0:57 _rata__: the problem is (repeat 2 (ref nil))

0:58 but (repeatedly 2 #(ref nil)) do it ;)

0:59 drewr: (for [_ (range 2)] (ref nil)) -> (#<Ref@99846fd: nil> #<Ref@6c5c90f6: nil>)

0:59 laurus: I actually don't see that -> defined in my Clojure book

0:59 amalloy: laurus: you can ask the REPL to show you what your form looks like after processing (a single layer of) macros

0:59 laurus: amalloy, oh ok

0:59 amalloy: one sec, i'll gist an example

0:59 laurus: Thanks!

1:00 amalloy: laurus: http://gist.github.com/614574

1:01 laurus: Ok

1:01 I have (doto plot and then a bunch of forms inside that

1:01 amalloy: basically -> and ->> evaluate the first argument, then stitch that into the next form, stitch the result of that to the next form...

1:02 laurus: Ah, perfect

1:02 I want (.getDomainAxis

1:02 amalloy: -> stitches it into the second position, ->> into the last position

1:02 sexpbot: java.lang.Exception: Unable to resolve symbol: stitches in this context

1:02 laurus: And then I want to call setLabelFont on what is returned by getDomainAxis.

1:02 Does that make sense?

1:02 amalloy: yes

1:03 (-> myobj .getDomainAxis (.setLabelFont BLUE))

1:03 laurus: So in this case what did -> stitch?

1:03 amalloy, oh, so I can't put it inside the (doto ..) then? The doto provides the plot reference in the first place

1:03 amalloy: it would transform the above into:

1:03 (.setLabelFont (.getDomainAxis myobj) BLUE)

1:03 yes, you can

1:04 laurus: Oh I see how you're doing it

1:04 It's kind of the reverse of the (.. way

1:04 amalloy: (doto myobj setblah setfoo setbar (-> .getX (.setBaz BLUE)))

1:05 scottj: there's also clojure.walk/macroexpand-all

1:05 laurus: amalloy, check this out: http://paste.lisp.org/display/115291

1:06 amalloy: it's actually exactly the same as the .. way. it just doesn't require that you use . - you can stitch in any arbitrary function. there's really no reason to use .. now that we have ->, as far as i understand

1:06 laurus: Oh, I see

1:06 I'm trying to modify that function, and rename it

1:06 amalloy: okay

1:07 the first point i would make is that (let) includes an implicit do, so you don't really need one

1:07 laurus: Ok :) Good point there

1:08 I'm just confused because (-> myobj .getDomainAxis (.setLabelFont BLUE)) contains an explicit reference to myobj

1:08 Whereas in the doto form you don't need that specific reference

1:09 amalloy: but it doesn't have to. doto will pass that into the ->

1:09 laurus: So just omitting the myobj symbol and leaving the rest the same works?

1:09 amalloy: (doto x (-> .getSize)) is the same as (doto x .getsize)

1:09 laurus: Oh, great

1:09 Sorry I'm so "n00bish"

1:10 This is really a hack, in the worst way, I'm just trying to see if it's possible before I waste a lot of time

1:10 amalloy: heh

1:10 i'm not sure what you're trying to do to this function. avoid creating the let block or something?

1:11 laurus: No, I'm just trying to add more features to the theme

1:11 But they're not all just single method calls, some require chains

1:11 Now I'm getting "java.lang.Exception: Unable to resolve symbol: setLabelFont in this context"

1:11 amalloy: .setLabelFont, with a . :)

1:12 laurus: Oh, whoops, sorry!

1:12 In the .. form you don't need those single .'s, that's my excuse ;)

1:12 amalloy: heh. yeah, i don't use the .. form much myself

1:13 laurus: Ouch, running the thing ended up with a java.lang.ClassCastException

1:13 Who knows were that came from

1:13 I wasn't aware I was casting anything :P

1:15 amalloy: hah. the Joy of Java

1:16 laurus: http://gist.github.com/614588 is an example of what you want to do, and its macroexpansion

1:17 laurus: amalloy, while I'm checking this out, check this out: http://paste.lisp.org/display/115291#2 It's the code I ran to get that error :P

1:18 amalloy: laurus: looks fine, clojure-syntax-wise. i don't know your library, but i'd guess that .setLabelFont wants a Font object rather than a string or something like that

1:18 laurus: amalloy, ah, you got it. That's what it is.

1:18 Thanks for that example by the way, it makes great sense to me now.

1:19 amalloy: cool! you're one step ahead of me, then - it only makes vague, magical sense :)

1:19 laurus: Hah ok :)

1:19 I'll instantiate a Font object then :P

1:19 amalloy: good call

1:20 btw, you could save some code by moving the (Color.) into your let block

1:20 laurus: It's funny how I'm learning all this random Java stuff

1:21 amalloy, thanks. I'm actually going to keep it as close to the original function as possible for now, for reference purposes, since I'm just blindly ripping off liebke's code here

1:22 Well, the function ran, I can't tell if it actually worked or not, but it sure did something

1:22 amalloy, thanks so much!

1:23 amalloy: haha

1:23 laurus: what language(s) are you coming from, ooc? i ask since you mention it's funny learning java stuff

1:23 laurus: amalloy, well, I actually learned PHP, then Java, then Python, and now Clojure

1:24 But I learned Java from a book that was purely theory, no practical stuff like Swing/AWT

1:24 amalloy: heh. climbing right up the abstraction ladder, i see. going the right direction

1:24 laurus: So now I think it's amusing that I'm learning all of this stuff I thought I never would, like Swing, and instantiating Font objects, and weird things like that.

1:24 But I have two options here, learn how to do this, or learn gnuplot.

1:24 amalloy: i learned, like...TI-BASIC, java, c, common lisp, clojure, php

1:25 laurus: I see

1:25 amalloy: and i like your plan better

1:25 laurus: Heh, well

1:25 The PHP doesn't really count anyway

1:25 That was just a 2-3 week thing right at the start :p

1:27 amalloy: i used to luvvvvvvv lava, and then after trying lisp i was like..."wait, really? there's no (map)? not even in any of the libraries?"

1:27 laurus: lava = Java?

1:27 amalloy: hah, yes

1:27 laurus: :)

1:27 Right, Python to me is the big disappointment

1:27 I spent a lot of time on Python

1:27 amalloy: but if i ever invent a JVM language, i'm calling it Lava

1:27 laurus: Hahahaha awesome!

1:28 I like Clojure better than Python

1:28 Fonts are so strange

1:29 amalloy: what don't you like about python? my understanding (having never written any) was that it has first-order functions and most of the stuff you'd expect in clojure, just in an imperative style

1:29 laurus: Well, yes, that's right

1:29 But when you start trying to do the functional stuff, Clojure is so much better.

1:29 amalloy: ain't that the truth

1:29 laurus: I don't think Guido understands or cares about functional programming, at all

1:29 amalloy: one of these days i'll get up the nerve to understand haskell

1:30 laurus: There are a few blog posts he made threatening to remove various functional functions from the language, etc.

1:30 amalloy: haha, silly guido

1:30 laurus: By the way, let me try to find something funny for you

1:30 amalloy: there are so many rhyming jokes you could make on his title

1:30 irrelevant dictator for life?

1:30 laurus: :P

1:30 amalloy, look at this: http://answers.yahoo.com/question/index?qid=20080522182651AAh5Hqs

1:32 amalloy: wait, he says he watched "the video", but the link is not to a video

1:32 laurus: Well, the funny thing is what he said

1:32 amalloy: (i'm really hoping you'll show me something that makes python look ridiculous. my girlfriend is a python fanatic)

1:32 laurus: "Thanks a lot, bro. You've given me a fantastic resource. I watched the video and saw Guido for the first time. He's just as cool as I thought he would be."

1:32 I literally LOLed when I read that.

1:33 amalloy: yeah, i'm afraid i don't know enough about the python culture to find that too funny. i can totally imagine seeing a video of my programming idol and finding him as cool as i thought he'd be

1:33 too young and idealistic, perhaps...

1:36 tomoj: ztellman: so for implementing a custom binary protocol in aleph, do I need to go study netty's guts, or just write the parser mostly in clojure using ChannelBuffer?

1:36 e.g. netty would probably have me write a FrameDecoder

1:36 but it seems like I should just ignore all that and just write simple functions

1:37 _rata__: is there the author of fnparse?

1:40 laurus: amalloy_, are you at all familiar with fonts in Java?

1:41 amalloy_: i was, back in java 1.3. what do you need?

1:41 laurus: Well, I'm trying to use the CMU Serif font that's Unicode

1:41 The problem is that when I run "fc-list :style=Regular" in bash, I don't see it. It's under "style=Roman"

1:42 So I have no idea how to specify that in Java...

1:42 amalloy_: ummmm, well i'm not at all familiar with fc-list in bash

1:42 laurus: It's okay, that's the only way I know to list all my fonts :P

1:44 Any ideas to make it recognize this darn font?

1:45 amalloy_: not really. these two might be helpful: http://tinyurl.com/28taa2k and http://tinyurl.com/2bmg49h

1:47 laurus: Thank you

1:48 The problem is the style is Roman, not Regular

1:50 tomoj: _rata__: he shows up here every once in a while

1:51 _rata__: tomoj, what's his nick?

1:52 tomoj: joshuachoi I think

1:56 slyrus_: _rata__: yes, it's joshuachoi. are you using fnparse?

1:56 _rata__: yeah, and I really don't understand its behaviour right now

1:56 something that seems completely ok gives me an error

1:57 slyrus_: are you using the develop branch?

1:57 _rata__: I'm using a version downloaded from git some time ago

1:57 laurus: amalloy_, have a good night!

1:57 And thanks again!

1:57 slyrus_: sure, you can download it from git, but you probably want to be on the develop branch, not master

1:57 at least that was my experience

1:58 _rata__: how do I download the develop branch? (I'm a git newbie)

1:58 slyrus_: git checkout develop

1:58 _rata__: once I've downloaded the master branch?

1:59 amalloy_: _rata__: you downloaded all the branches. git checkout develop just switches which one is your "current" branch

1:59 slyrus_: I think when you pull from a remote you get all the branches

1:59 _rata__: ok

2:00 slyrus_: but maybe we should take a look at your problem on master before switching to develop. do you have a github/gist of the problematic code?

2:02 _rata__: slyrus_, I can do one

2:04 how do I disregard a change I've made to the code to pull a new revision from git?

2:05 slyrus_: git reset --hard

2:05 will wipe your changes

2:05 git stash can be used to squirrel them away

2:20 _rata__: http://gist.github.com/614646

2:20 it seems that the clojure syntax highlighting doesn't work

2:21 the problematic part is (def expression ...

2:21 slyrus_, http://gist.github.com/614646

2:23 slyrus_: I'm not familiar with the pre-develop (2.0?) fnparse stuff, but I think the problem is that you're matching agnt instead of expression

2:24 I mean agnt instead of (complex ...)

2:24 that (alt agnt (complex ...)) form is going to match agnt there, I think

2:24 lypanov: morning lau

2:25 slyrus_: hmm... no, maybe that's not right

2:25 _rata__: slyrus_, it's going to match agnt for "a, ", but not for "2*b"

2:25 slyrus_: what about for "2"?

2:26 _rata__: "2" is a whole-number

2:26 and it's matched by (invisi-conc whole-number (separator \*))

2:26 slyrus_: yeah, but it's also an alpha-num-string

2:26 _rata__: really "2*" should be match by that

2:27 slyrus_: but first it matches as agnt

2:27 does swapping the order of the (alt agnt (complex ...)) forms change things?

2:28 _rata__: mmmmm... you're right

2:28 let me try that

2:28 slyrus_: I'm not sure it will, and even if it does if that's the right thing to do

2:28 what are you trying to parse?

2:29 _rata__: the Kappa language (www.kappalanguage.org)

2:30 swapping the order didn't help :( I thought it would

2:30 slyrus_: no, I didn't really think it would :)

2:30 so what does 2*b mean in kappa?

2:30 _rata__: 2 agents "b"

2:31 slyrus_: I'm not seeing * in the kappa syntax page

2:31 _rata__: no, sorry! it did help!

2:31 I was testing the wrong form... I tested now the right one and now it works!!!

2:31 thank you so much!

2:32 slyrus_: you're welcome

2:32 _rata__: (btw, can you say in english "I tested now..."?)

2:32 :)

2:32 slyrus_: I tested

2:32 or I have now tested

2:33 _rata__: thanks

2:34 slyrus_: I'd still recommend looking at the develop branch before going much further with fnparse

2:35 _rata__: ok... it's much different from what have you seen in the gist?

2:36 slyrus_: well, the functionality you want is probably now in the "hound" package. take a look at the demos. it's roughly the same in spirit but the details have evolved a bit

2:36 defrule (and defmaker) are the things that you use to define rules (and rule-makers)

2:37 you can also check out my SMILES parser if you want to see a working-ish example of a parser written in it

2:37 _rata__: http://github.com/slyrus/chemiclj/blob/master/src/chemiclj/smiles/read.clj

2:40 _rata__: thanks a lot! :)

2:42 slyrus_: np

2:42 _rata__: the develop branch is fnparse 3.x?

2:43 slyrus_: I think that's correct

2:46 _rata__: oh, but fnparse 3.x has renamed a lot of macros and functions :(

2:46 slyrus_: well, yes, that's why I suggested you start _now_ :)

2:47 konr: Has anybody used GTK with clojure? I'm getting an illegal argument exception with (.init Gtk (make-array String 0)). The argument seems fine, according to repl-utils/show: [10] static init : void (String[])

2:47 _rata__: and the worse thing is that you must require it now instead of use'ing it

2:48 slyrus_: that's a good thing, if you ask me

2:48 _rata__: why?

2:49 hiredman: konr: thats not how you call static methods

2:50 konr: hiredman: oh, of course...

2:50 slyrus_: _rata__: I guess it's just a matter of convention and taste. the h/cat, e.g. makes it clear to me what's going on here.

2:51 and I think you _could_ use it if you wanted to deal with the refer-clojure renaming of things

2:51 _rata__: but to have the code full of "h/" makes it a bit uglier

2:52 slyrus_: that's subjective. I'd recommend trying it and seeing if you like it. I used to think like that but eventually grew to like things like h/+

2:52 instead of alt

2:56 _rata__: I think it will be difficult to get used to... alt was very mnemonic, at least for me

3:12 slyrus_, is there documentation for fnparse 3.x or not yet?

3:12 btw, you've made a smiles parser... are you a chemist?

3:14 bhenry: anybody up?

3:17 kryft: bhenry: Sure, it's 10 am here. ;)

3:17 slyrus_: _rata__: I'm more of a biologist, but I've been dabbling in chemistry

3:17 bhenry: i need to know how to check if a date is within the last 30 days

3:17 kryft: bhenry: Unfortunately I probably won't be able to answer any clojure questions you may have.

3:18 bhenry: haha. it's okay. it's 3:15 am here. i should be going to bed.

3:18 slyrus_: bhenry: perhaps http://github.com/clj-sys/clj-time might help

3:22 _rata__: slyrus_, nice to meet you :) I'm a biochemist (but more of a computational biologist now)

3:23 notsonerdysunny: ~(doc var)

3:23 ->(doc var)

3:23 sexpbot: ⟹ "Special Form: Please see http://clojure.org/special_forms#var"

3:23 slyrus_: _rata__: likewise. besides checmiclj, i've been meaning (and slowly starting to) port my cl-bio library over to clojure one of these days.

3:24 _rata__: what does the cl-bio library do?

3:24 slyrus_: the first step was my "iwashi" library which provides for 2-, 4- and 5-bit arrays in clojure, for more efficiently storing DNA and protein sequences

3:24 cl-bio is an in-progress general purpose computational biology library. think bioperl for common lisp. at least that was the idea.

3:25 some parsers, some data representation, getting stuff from entrez, integration with a DAS client and server, etc...

3:28 _rata__: nice... I friend of mine used biopython a lot, but he's been recently learning scala and loved it, so I don't know what he's using now

3:29 probably he's using nothing, because he's just entered a phd

3:29 :P

3:29 slyrus_: are you a grad student/postdoc/something else?

3:31 _rata__: no, i'm just a bsc in biochemistry, but I'm applying to a scholarship to do a phd

3:34 I'm more from the systems biology branch of computational biology though... I like simulating metabolism or signaling pathways... or rather making tools to simulate/analyse metabolism and signalign pathways models (that's where clojure comes into picture)

3:35 are you a grad student?

3:36 kryft: _rata__: I'm a grad student in machine learning, and I know some people in our (rather large) group have been doing metabolomics.

3:36 _rata__: I'm planning to use clojure for work too. :)

3:37 _rata__: kryft, where do you work?

3:37 kryft: _rata__: http://www.cis.hut.fi/projects/mi

3:37 bhenry: slyrus_: meh. i'd rather not use a library for simple date stuff. http://gist.github.com/614727

3:37 kryft: _rata__: I'm also collaborating with John Shawe-Taylor's group at University College London.

3:38 _rata__: kryft, finland! wow

3:38 slyrus_: _rata__: no, but I was. finished up a couple years ago.

3:38 tomoj: kryft: have you heard of random indexing?

3:39 _rata__: slyrus_, what are you doing now then? postdoc?

3:39 slyrus_: bhenry: date stuff isn't so simple

3:39 _rata__: industry

3:39 bhenry: not all of it, but that gist works well enough.

3:40 kryft: _rata__: Why wow? :) Where are you?

3:40 tomoj: I don't think so - should I? :)

3:41 slyrus_: bhenry: well, you are using a library, you're just using java.util.Date

3:41 personally, I'd rather have a clojure library than rely on the java interop stuff, but to each their own

3:41 _rata__: wow because finland is supposed to have a very good quality of life in general, something I look for in my life :)

3:41 slyrus_: _rata__: a small biotech in california

3:42 _rata__: I'm from chile

3:42 kryft: _rata__: Ah. :D Well I would say that's true. :)

3:42 tomoj: kryft: doubtful

3:43 kryft: tomoj: :D What is it?

3:43 bhenry: slyrus_: while that's true i won't need to mess with my dependencies. plus the java date library hasn't changed much forever despite it's general suckitude.

3:43 tomoj: seems to be mostly used for NLP, was just curious if you'd heard about it since I'm playing with it and you must be smart

3:43 basically instead of doing dimension reduction you just start off using a random projection

3:44 kryft: tomoj: I should warn you that I have a special talent for appearing much smarter than I am. (If I appear stupid, I should be worried.)

3:44 tomoj: well "grad student in machine learning" just caught my ear :)

3:44 kryft: tomoj: Ah, ok. Is random indexing just a term they use in NLP then (instead of random projection)?

3:44 Or is it more specific than random projection.

3:45 tomoj: afaict random indexing is a certain way of applying random projections

3:45 konr: It seems that I cannot reference (e.g. (show class)) final classes, or I get a NoClassDefFoundError. Is there some special syntax I must use?

3:45 kryft: tomoj: Ok. Our group doesn't do nlp, but we do have an nlp group in our lab as well.

3:45 slyrus_: bhenry: fair enough. And in your original question you didn't say "how do I see if a java.util.Date is within 30 days", but rather a less well specified concept of date that could have been anything (milliseconds since the birth of Jimmy Carter, "Christmas Day 1954", etc...)

3:45 kryft: tomoj: Are you a grad student yourself?

3:45 tomoj: read a paper recently about how to build tiny low-power one-pixel cameras which do collective image classification

3:45 scary!

3:46 nope, industry

3:46 slyrus_: tomoj: I think I saw something like that a while back. neat idea!

3:46 kryft: tomoj: Are you playing around with random indexing for work or just for fun?

3:47 tomoj: I use it at work, and thinking about it also for non-work things

3:47 I wonder how neural networks implemented using aleph channels would perform

3:47 kryft: tomoj: Where do you work (doing what)?

3:47 tomoj: seems like it would be simple to do, but... slow?

3:48 _rata__: a lot of scientists here... I'm impressed

3:48 tomoj: startup, web stuff. just content mining really

3:48 kryft: tomoj: Is it your startup or are you just employed there?

3:49 tomoj: just employed, but got in early, so not quite "just" employed

3:49 kryft: _rata__: I'm not surprised that there are a lot of scientists here. :)

3:50 tomoj: Anyway, sounds like a dream job. :) You get a proper salary, but you still get to play with interesting stuff. ;)

3:50 tomoj: As a grad student you only get the latter. ;)

3:50 tomoj: hehe

3:50 _rata__: you're right, it's not surprising, just nice

3:51 tomoj: you don't have those pesky customers bothering you though

3:52 sandGorgon: tomoj, i wanted to do a side project on mining food/restaurant data. Wanted to work with clojure on that - is that something that you could share your thoughts about. I mean, should I use a crawler like nutch or do the mining using something in clojure ?

3:52 tomoj: good question

3:52 we haven't used nutch yet but definitely plan to

3:53 I think it would be silly to rewrite all the stuff in there

3:53 kryft: By the way, how is clojure as a replacement for python for scripting?

3:53 _rata__: slyrus_, what do you do at work? do you code?

3:53 tomoj: my problem is figuring out which version of nutch to use

3:53 raek: sandGorgon: for the html scraping part, check out Envlive

3:53 sandGorgon: raek, thanks for that

3:53 tomoj: you can use nutch and plug in your own clojure components

3:53 slyrus_: _rata__: no, I just code at home :) well..., that's not entirely true, but coding isn't really part of my job description

3:53 tomoj: (though I haven't figured out how to do this yet.. in the worst case you've got gen-class)

3:54 _rata__: slyrus_, what do you do then?

3:55 sandGorgon: tomoj, sounds like integrating nutch is more complicated than easy in clojure. Assuming I want to use clojure, how does one mine data (could be web, twitter, etc.)

3:55 tomoj: maybe it's complicated

3:55 but I think it's worth it

3:56 if you want to do it from scratch there are several http clients available

3:56 but then you have to re-solve a bunch of problems that nutch already solves

3:56 aleph has examples of streaming from twitter

3:56 sandGorgon: tomoj, ah.. ok. I just wanted to throw something together in a week - with maybe a compojure front end

3:57 tomoj: and it comes with asynch http stuff

3:57 sandGorgon: didnt know about aleph and twitter - thanks!

3:58 slyrus_: _rata__: I try to make sure our scientists are doing useful things and that they have the resources they need

3:59 _rata__: slyrus_, ah ok

4:00 slyrus_: anyway, good to see comp bio/bioinfo/machine learning-types hanging around here. i look forward to further discussions on the above topics, but now it's time for bed.

4:00 _rata__: :)

4:00 yeah, right... here's 4 am

4:01 good night slyrus_

4:15 LauJensen: wherever you are

4:31 lenw: Hi all

4:31 how do i get a map that i saved using (spit map file) back into a map ?

4:31 LauJensen: Hi

4:32 (-> (slurp file) read-string) ?

4:32 lenw: thanks LauJensen

4:32 i knew it was something simple

4:32 bytecolor: spit, slurp? those are actual core functions?

4:33 LauJensen: bytecolor: yup

4:33 tomoj: hey, it's a lisp-1

4:33 lenw: bytecolor: yes

4:33 LauJensen: ,(doc spit)

4:33 tomoj: names are scarce

4:33 bytecolor: ahaha, ok

4:33 LauJensen: -> (doc slurp)

4:33 sexpbot: java.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/slurp)

4:33 LauJensen: eh?

4:33 $mail raynes -> (doc slurp) ?

4:33 sexpbot: Message saved.

4:33 LauJensen: $mail hiredman where's clojurebot ?

4:33 sexpbot: Message saved.

4:34 bytecolor: so how is clojure for accessing an OpenGL context portably?

4:35 LauJensen: bytecolor: portably?

4:35 tomoj: ,(slurp nil)

4:35 err

4:35 -> (slurp nil)

4:35 sexpbot: java.lang.SecurityException: Code did not pass sandbox guidelines: (#'clojure.core/slurp)

4:35 tomoj: tough censor

4:35 LauJensen: tomoj: keep up man, I just did the same sequence 2 minutes ago :)

4:36 tomoj: well

4:36 LauJensen: oh wait, I should keep up, I thought you were running doc as well, sorry :)

4:36 tomoj: I was testing whether it was something weird about the way doc works that caused the security violation

4:36 LauJensen: Yea dont mind me, keep going

4:36 tomoj: I remember that sandbox tries hard not to let you get ahold of vars that point to bad functions

4:37 I broke it twice, both times by finding ways to weasel my way through to a var

4:37 *read-eval*, naturally

4:37 I wonder if it will ever be secure

4:37 LauJensen: hehe

4:37 tomoj: Are there still holes?

4:38 tomoj: dunno, that's the question

4:38 the holes I found have been filled

4:38 bytecolor: for simplicity, say I'd like to render a spinning cube using OpenGL, but I'd like it to run on a mac, linux, and window.

4:38 tomoj: so now it's a game of wasting time

4:38 maybe there really are no more holes, and any work trying to find one would be wasted

4:38 LauJensen: bytecolor: Well, OpenGL does need native dependencies, but Penumbra gets you almost all the way

4:38 tomoj: or maybe there are, and you'd have to work a long time to find one

4:39 defn: If you know how to do cat /dev/urandom > /dev/audio on OSX I'd be interested.

4:39 tomoj: penumbra, hmm

4:39 LauJensen: tomoj: But few Clojurians use their powers for evil and the PHP crowd is no threat. I think the bot is safe

4:39 tomoj: right

4:39 but for the sandbox

4:39 LauJensen: defn: why ?

4:39 defn: LauJensen: curiosity.

4:39 tomoj: it would be best for those using the sandbox if it were abused

4:40 I mean, if people tried to abuse it to test how easily it can be abused

4:40 though..

4:40 hmm

4:41 bytecolor: from what I know of clojure, it's heading in the "right" direction; it runs on most anything and its philosophy is drawn from Lisp. That to me is the holy grail of programming.

4:41 tomoj: I was thinking like maybe you do automatic judging of problems with clojure solutions

4:41 hoeck: tomoj: does the sandbox handle (loop) ?

4:41 tomoj: you need to know those solutions won't be evil

4:41 defn: lots of ifs

4:41 tomoj: hmm?

4:41 defn: just the way you described that is utopian

4:41 it wont be that easy

4:41 tomoj: -> (loop [a 10] (if (pos? a) (recur (dec a)) a))

4:41 sexpbot: ⟹ 0

4:42 esj: Morning alls

4:42 LauJensen: bytecolor: http://ideolalia.com/16342460 - consume this blog, in its entirety

4:42 tomoj: If you invented a system which read code and determined if it was malicious or not, you'd make billions

4:42 bytecolor: aye, thanks LauJensen

4:42 LauJensen: You still wouldnt make as much as facebook, but you'd have money

4:43 tomoj: well..

4:43 you just need a good jail, right?

4:43 LauJensen: tomoj: No, Im talking about understanding, not containing

4:43 defn: tomoj: Licenser's sandbox is pretty well done AFAIK.

4:43 tomoj: yeah

4:43 it works by just crippling your access to clojure

4:43 defn: I know there are several out there. His is the only one I've tried

4:43 hiredman: LauJensen: thats called a "interpreter"

4:43 defn: tomoj: well..if it works..

4:43 tomoj: yeah

4:44 LauJensen: hiredman: But it needs some kind of heuristics awareness of what the code is doing

4:44 tomoj: can you set up a jvm so that it can only read from stdin, not from any file?

4:45 bytecolor: caveat: as long as I dont have to write code in Java, IMO that is the most horrible undertaking any programmer could be subjected to.

4:45 hiredman: http://github.com/hiredman/Arkham

4:45 defn: it needs to intuit /goals/

4:45 tomoj: I suppose you could run it as nobody?

4:45 hiredman: ~sandbox

4:45 clojurebot: sandbox is http://calumleslie.blogspot.com/2008/06/simple-jvm-sandboxing.html

4:47 tomoj: hiredman: sounds interesting

4:47 eval->evil is cute

4:48 defn: george jahad has the root of the elegant solution

4:48 test chunks as you go inside the same stack frame

4:48 hiredman: also "Arkham" as the name of a sandbox, how cute is that?

4:48 defn: be able to step around

4:50 hiredman: a sandbox like arkham can be used for other things too, like http://gist.github.com/550864

4:50 defn: hiredman: interesting

4:51 LauJensen: nice

4:51 tomoj: reminds me of http://www.youtube.com/watch?v=Du_RTMmofWM

4:51 defn: tomoj: You are awesome for posting that.

4:52 tomoj: those were the days

4:52 it was so goddamn easy back then to make a fucking blog

4:52 defn: It's still cool, man.

4:52 We're evolving.

4:52 Things are happening.

4:52 tomoj: now it's "look at all this shit I have to do, man I need to write some macros"

4:52 well.. yeah

4:53 aleph is lookin pretty sweet

4:53 defn: heh -- yeah it only gets harder, but then it gets easier

4:53 sawtooth

4:53 tools catch up, i think.

4:53 hiredman: pffft, macros, you want a blog post write some monads or arrows

4:53 defn: epic troll

4:53 tomoj: hmm

4:53 I meant a blog engine

4:54 defn: i dont see how it was easy to make a blog engine

4:54 the metaprogramming that went into rails was pretty novel and cool

4:54 kryft: tomoj: Heh, I've never seen that and I don't really know Ruby, but it's still funny.

4:54 hiredman: well you'll obviously need a monad to thread the nosql connection through your function calls

4:54 tomoj: as in "look at all the things I'm not doing"

4:55 hiredman: for your blog engine

4:55 * defn chuckles

4:55 tomoj: defn: huh?

4:55 defn: hiredman -- it just sounds really buzzy

4:55 hiredman: if you use a dynamo inspired store you'll need to keep track of all those vclocks

4:55 tomoj: defn: you didn't see the "make a blog engine in XX minutes" stuff?

4:56 hiredman: that's a monad

4:56 tomoj: huh, the client's responsible?

4:56 defn: "monad to a thread" "nosql connection" "blog engine"

4:56 tomoj: I have been teetering over hbase vs cassandra

4:56 defn: it just sounds like a parody of web 2.0

4:56 er 2.5 i guess

4:56 hiredman: tomoj: for anything really based on the dynamo paper they are

4:56 AWizzArd: hiredman: the chinese scientist Li improved monads, and will soon publish his lib "Limonade".

4:57 tomoj: I wonder if the GORA for cassandra (if it exists?) for nutch works well

4:57 then we need thrift bindings

4:57 java ones OK or do we have to write a thrift-clj?

4:57 anyone used the java generated bindings from clojure before?

4:58 hiredman: you have to have vclocks to establish causal relationships in a coordinated distributed system like that

4:58 tomoj: right

4:58 riak too eh

4:58 * hiredman was thinking specificly about riak

4:58 tomoj: so like, the ruby cassandra library has to deal with vclocks

4:58 hiredman: mm

4:58 is cassandra dynamo based?

4:58 tomoj: yeah

4:59 hiredman: huh

5:00 tomoj: "this ticket is a dead end for counting, and the primary use case for classic vector clocks of merging non-conflicting updates to different fields w/in a value is already handled by cassandra breaking a row into columns."

5:00 hmm

5:00 hiredman: right

5:01 Cassandra departs from the Dynamo paper by omitting vector clocks and moving from partition-based consistent hashing to key ranges, while adding functionality like order-preserving partitioners and range queries.

5:01 https://wiki.basho.com/display/RIAK/Riak+Compared+to+Cassandra

5:01 tomoj: https://issues.apache.org/jira/browse/CASSANDRA-1501

5:01 I see

5:01 so perhaps "dynamo-inspired"

5:01 bytecolor: are :keywords global in clojure? :foo evaluates to :foo no matter where it's used? This to me is a vast improvement over C/C++'s #define or enum

5:02 tomoj: weak refs are involved, I think, but I don't know what those are :(

5:03 Chousuke: They are global.

5:05 kryft: Chousuke: Hehe, I was just wondering whether there are any go players here.

5:06 Chousuke: I haven't played in a long time though :/

5:06 defn: im going to start working on a ML project involving Go pretty soon

5:07 kryft: defn: Cool. A guy in our lab has been working on Go (he plays it as well). Do you play go?

5:07 defn: kryft: im afraid the answer there is /i am terrible./

5:07 hence the ML project!

5:08 If I'm bad at it -- I'll build a bot.

5:08 kryft: defn: I'm terrible too; that's the fate of amateurs!

5:08 defn: kryft: yeah I've had the experience a lot in life where I had "beginner's luck"

5:08 but with Go, forgetaboutit

5:08 kryft: defn: (Well, unless maybe you become a really strong amateur. My teacher seems to be rapidly approaching professional strength.)

5:09 defn: I wonder how much time Go players spend in comparison to WoW players.

5:09 I have a poor, poor friend of mine who plays WoW.

5:09 Chousuke: :P

5:09 kryft: defn: Is that project just for fun, or are you doing actual research? (Not that you couldn't do that for fun, but well, you know what I mean.)

5:10 defn: for fun -- im messing around with AI4R in Ruby with a friend -- there was talk about rewriting it and building a website to sort of bring back the spirit of AI

5:10 Chousuke: There are a handful of pretty strong players where I live. But not quite pro level

5:10 defn: make it accessible to more people

5:10 kryft: defn: Heh, I would say most of them spend far less time. :) Go requires much more effort.

5:11 Chousuke: I was referring to Antti Törmänen.

5:11 defn: there's so much cool stuff to do with ML

5:11 but it's not accessible

5:11 and it's not genius-level stuff

5:11 if people build friendly libraries this stuff is awesome for amateurs to jump into

5:12 Chousuke: kryft: I suppose he's the strongest in Finland atm :P

5:12 defn: little building blocks that add a bit of brain to your application -- what's not to like?

5:13 kryft: Chousuke: Yes, and he has beaten a professional in an even game at least once. :) Of course he's not professional-level yet, but he intends to get there, and something about him tells me that he's going to succeed.

5:15 defn: I wonder how much better computer game AI could be if programmers applied state-of-the-art research and actually devoted a couple of cores to AI.

5:15 defn: With multi-core CPUs being the norm, especially in high-powered gaming rigs, that shouldn't be a problem.

5:16 Chousuke: Hmh

5:18 kryft: defn: I know very little about computer game AI and state-of-the-art AI research, but something tells me the two rarely meet. :)

5:20 LauJensen: kryft: hopefully, since state of the art AI research has produced nothing more than whats commonly referred to as the AI winter and a very formidable Chess opponent

5:20 kryft: LauJensen: Ok. :)

5:24 LauJensen: Would you say that computer game AI wouldn't be easy to improve by making it a priority?

5:25 LauJensen: I have no idea, but if somebody would pay me I'd gladly find out :)

5:25 kryft: LauJensen: :D I'll keep that in mind if I ever find myself with a lot of extra money. ;)

5:26 LauJensen: sounds good :)

5:27 bytecolor: so how do I make clojure a first-class citizen of my OS? I've compiled clojure with Ant, and I can execute a repl.

5:27 notsonerdysunny: how can i set clojure.core/*assert* to false?

5:29 bytecolor: what do you mean by "first-class citizen " .. if you are meaning it in the sbcl/slime way .. use lein and slime to set it up.. there are enough tutorials on the web to help you make that happen

5:29 LauJensen: notsonerdysunny: (set! clojure.core/*assert* false)

5:32 notsonerdysunny: LauJensen: Thanks ... I set it .. But I had read that :pre and :post specified in a function definition are only run if the *assert* is true .. but it does not seem to be the case ... am I missing something

5:32 LauJensen: Did you recompile the functions after setting it to false?

5:32 bytecolor: notsonerdysunny: well, ultimately, like to be able to experiment in another dir. I should probably learn more Java, but to me Java is nothing more than a vehicle, a stepping stone.

5:32 notsonerdysunny: no .. oh .. I need to recompile .. I didn't know that

5:33 bytecolor: just google for leiningen and slime it will walk you through .. you don't need java

5:33 bytecolor: cool, slime + clojure sounds good ;)

6:12 esj: kryft: LauJensen: the state of AI, as far as I understand, is that its been renamed ML (machine learning, much sexier) and is very much focussed on batch problems rather than online (live) problems. This is sort of thing you saw for the Netflix prize. There have been great advances in statistics (ML with a proper mathematical basis) especially numerical stats, even online problems. However they are massively computationally

6:12 demanding and beyond what a game could support yet. The other issues is that stats doesn't sound sexy. Of course, I may be biased :)

6:13 LauJensen: So they gave up on AI and picked up statistics instead... :)

6:13 esj: no, the got into ML and stalled a bit

6:14 and the stats guys caught up

6:30 opqdonut: ok, I'm going crazy with defprotocol

6:30 notsonerdysunny: is there a way to programatically check if a given symbol represents a macro?

6:30 opqdonut: in namespace a I have (defprotocol W ..) (defn ^a.W make-W [args] (reify ...)

6:31 and I get a ClassNotFoundException

6:31 notsonerdysunny: something like (is-macro? for)

6:31 opqdonut: if I hint make-W with just ^W, using make-W in another namespace fails with 'Exception in thread "main" java.lang.IllegalArgumentException: Unable to resolve classname: {:on-interface a.W ...}"

6:32 oh, and, (:import a.W) is not working

6:32 carkh: i thought you could only type hint the return value of a function on static functions ?

6:32 for the import i do it this way : (:import [a W])

6:33 opqdonut: that should be the same thing

6:33 carkh: but you need to require the a namespace first too

6:33 unless it's already loaded of course

6:33 opqdonut: yes, I'm doing that anyway

6:34 I'm actually useing it

6:34 carkh: ah well i had some problems in 1.2 with that

6:34 opqdonut: yeah, same thing with the [a W] import, java.lang.ClassNotFoundException

6:34 so I should try require?

6:34 kryft: esj: I'm a machine learning researcher; that's why I've been wondering about the state of computer game AI. :)

6:34 carkh: if you use it, W is a var

6:35 and importing you get W the interface

6:35 and it seems like W the var takes precedence

6:35 i really don't like this, but that's the way it is

6:35 esj: kryft: I'm a recently ex-MCMC researcher :) hehehe.

6:35 opqdonut: carkh: oh, that's awful...

6:36 carkh: well, that's how i understodd it, i might be wrong

6:36 that's only from experimentation

6:36 esj: kryft: but we can still be friends :P

6:36 carkh: and for 1.2

6:37 if you want to test it all, you might want to restart the jvm, so thazt you get clean state for your namespaces

6:38 kryft: esj: I'm sorry to hear you broke up. ;)

6:38 esj: Did you graduate or something?

6:39 esj: kryft: yeah, I eventually had to pay for all the fun I was having.

6:40 opqdonut: ah

6:40 now I get it

6:40 carkh: tell us =P

6:40 opqdonut: the namespace had a hyphen. The interface that implements protocol name-space.W is name_space.W

6:40 kryft: esj: Oh, you were at Cambridge. :) I was at MLSS in 2009.

6:41 esj: kryft: don't give away my secrets!

6:41 kryft: esj: I'm in Finland myself, but I'm collaborating with John Shawe-Taylor's at UCL, so I spend quite a bit of time there.

6:41 JST's group, even

6:42 esj: he's good.

6:43 kryft: esj: Yeah, I'm happy to have the opportunity. :)

6:44 esj: I'd like to do slightly more theoretical and mathematical machine learning, so I think working with him might help.

6:44 I just started my PhD in January.

6:44 esj: kryft: you're really lucky for the chance - enjoy !

6:48 notsonerdysunny: how does one run some thing in the repl with it trying to print out the value?

6:50 esj: notsonerdysunny: without it printing the value ?

6:51 notsonerdysunny: yes

6:52 esj .. I guess I badly messed up my previous sentence ..

6:52 esj: are you trying to avoid forcing the execution of something lazy ?

6:52 notsonerdysunny: esj yes

6:53 carkh: (let [_ (my-form-returning-lazy-stuff)] nil)

6:55 notsonerdysunny: carkh: but I have no access to the return value now..

6:55 carkh: what do you want to do with it ?

6:56 the repl prints it, if you want to get tjhat value and do stuff to it, then include the stuff you want to do in your form

6:57 you could (do (def a (filter odd? (range 100))) nil)

6:57 then work with a

6:57 notsonerdysunny: carkh: that does the trick

6:57 thanks

6:58 kryft: esj: By the way, did you use clojure for MCMC etc? If so, what was your experience?

6:58 esj: carkh: i think you just invented imperative functional programming. yikes :)

6:58 carkh: haha don't forget to attribute it to me !

6:59 esj: kryft: actually, I've done some clojure MCMC and the experience was great.

7:01 kryft: you should check out this blog: http://aria42.com/blog/ He's doing MCMC in clojure.

7:02 kryft: this particular post: http://aria42.com/blog/?p=48 rightly caused quite a splash :)

7:03 kryft: esj: Cool, thanks. :)

7:03 esj: What kind of performance did you get?

7:08 esj: kryft: excellent. It's a huge step up from Matlab / R

7:09 kryft: esj: Great. I got the impression that it should be possible to get performance close to java (and hence close to C) using clojure; did you manage that?

7:10 esj: hard to say, I've never tried it in java/C so have no benchmark. To be honest, I didn't really try that hard.

7:11 kryft: esj: Still, it says something that you didn't have to try that hard or compare with java/C. :)

7:11 esj: If it's good enough for MCMC, it should be good for anything I do

7:12 esj: i would agree with that.

7:16 kryft: esj: Where/why did that particular post cause a splash?

7:19 esj: Not sure. I think because he tackled a problem that can be understood outside the specialist field. Its a dramatic display.

7:20 kryft: Ah, right. And apparently quite elegantly, if it's only 300 lines of code. (Of course I'm sure you can simulate the universe in 300 lines of clojure.)

7:21 tobiasraeder: hi :)

7:22 esj: howdy tobiasraeder

7:23 kryft: Greetings.

7:23 raek: tobiasraeder: how did things with the interop thingy go, btw?

7:24 kryft: raek: Apparently not too well!

10:37 chouser: notsonerdysunny: did you figure out 'is-macro?'?

10:53 Bahman: Hi all!

10:53 ohpauleez: Hi

11:02 shanmuha: hi, I am trying to get tomorrow's date as a string in clojure

11:04 esj: shanmuha: maybe not the simplest solution but i'd use clj-time

11:05 chouser: ,(let [d (java.util.Date.)] (.setDate d (inc (.getDate d))) (str d))

11:05 clojurebot: "Fri Oct 08 08:07:25 PDT 2010"

11:05 chouser: but beware, java.util.Date is a bit nasty

11:05 * esj bows to chouser's better approach...

11:05 shanmuha: I tried (. sdf format (doto (java.util.Calendar/getInstance) (.setTime (new java.util.Date)) (.add java.util.Calendar/DAY_OF_YEAR 1) (. getTime))) which gives a nasty exception

11:06 (def sdf (new java.text.SimpleDateFormat "yyyy-MM-dd HH:mm:ss"))

11:07 chouser: shanmuha: you were close

11:07 (.format sdf (.getTime (doto (java.util.Calendar/getInstance) (.setTime (new java.util.Date)) (.add java.util.Calendar/DAY_OF_YEAR 1))))

11:08 shanmuha: chouser: thanks! trying it out

11:08 chouser: doto returns the object you give it first, so was still returning a Calendar even though you had .getTime at the end of the doto

11:09 shanmuha: chouser: ah! got it! many thanks!!!

11:09 chouser: But I don't know that Calandar is any more reliable than the pure Date solution I gave first

11:09 I hear good things about jodaTime

11:09 Dawgmatix: whats the state of the art of using clojure from emacs - swank-clojure?

11:09 shanmuha: chouser: should not be a problem... its not a missile guidance system (yet) ;)

11:09 chouser: :-)

11:10 Dawgmatix: also does swank clojure work with the clojure debugging tools shown recently or was that using some other repl ?

11:12 shanmuha: chouser: thanks for suggesting joda-time..seems to be an excellent replacement

11:16 esj: shanmuha: clj-time is a clojure wrapper for joda-time

11:18 shanmuha: esj: thanks!

11:19 when I was trying to write my get tomorrow function, got confused between doto and ->

11:19 don't they do the same things?

11:20 when applying methods on a java object?

11:20 chouser: not at all

11:20 -> takes each expression and threads it into the next

11:20 sexpbot: java.lang.Exception: Unable to resolve symbol: takes in this context

11:21 chouser: doto takes the result of the first expression and puts it into all the others, and finally returns it

11:21 ,(-> 5 (+ 3) (/ 2))

11:21 clojurebot: 4

11:21 chouser: ,(doto 5 (+ 3) (/ 2))

11:21 clojurebot: 5

11:22 chouser: doto is only useful if the first arg is something mutable or the expressions to apply to it have side-effects

11:24 shanmuha: chouser: thanks for the illustration..I think I understand now... but when invoking methods on a java object, would threading mean that you invoke each method successively on the first arg?

11:25 kumarshantanu: shanmuha: chouser is a fan of thrush ;-)

11:26 chouser: no, -> still means the return value of each method call would become the target of the next

11:26 gravity: shanmuha: I think you have it backwards. doto invokes each successive form on the original arg, which is why it's useful for mutable objects.

11:26 chouser: -> is not thrush

11:26 sexpbot: java.lang.Exception: Unable to resolve symbol: is in this context

11:26 gravity: As chouser says

11:30 * kumarshantanu stands corrected (though noted several posts in the past calling -> a thrush cousin)

11:31 abrenk: Dawgmatix: I've using CDT together with a swank server started using the clojure-maven-plugin - works as expected.

11:32 shanmuha: chouser: your last statement made me understand!! thanks!!

11:32 chouser: kumarshantanu: yes, many people have stated it. A widely-held misconception. :-)

11:32 Dawgmatix: thanks abrenk!

11:32 chouser: kumarshantanu: allow me to direct you to my co-author: http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/

11:33 shanmuha: -> operates on the result of prior operation where as doto is always on the first.

11:33 sexpbot: java.lang.Exception: Unable to resolve symbol: operates in this context

11:34 kumarshantanu: chouser: something to note -- the link you mention on your post http://debasishg.blogspot.com/2010/04/thrush-in-clojure.html (seems to call -> one of the thrush operators)

11:35 chouser: toward the end of his post (just FYI)

11:36 chouser: maybe you can attach a sidenote somewhere "the linked post is calling -> a thrush, I am not responsible for it" ;-)

11:36 chouser: heh, I'll check.

11:36 shanmuha: thanks a lot people!, you were really helpful..

12:08 astoddard: I have a best practice question. I am writing an analysis program and have some initial state (data tables as maps) that can be instantiated from different files on disk. And I am wondering about the best representation.

12:09 My first thought was to declare some vars and set them in an init function but that isn't allowed at the root level.

12:09 carkh: (def my-table (atom nil))

12:10 chouser: for initial state it's probably ok to re-def the vars

12:10 carkh: then (reset! my-table (load-table "mytable.data"))

12:10 chouser: or that

12:12 carkh: or make it a ref so you can make concurrent updates in a safe fashion later when you'll want to multithread

12:14 crazy how the scope of a program can change with little things ... I made this callshop program around 10 years ago, there used to be only a couple hundreds telephone rpefixes to manage

12:14 now a price list has 100 thousand prefixes

12:14 that's suddenly a whole different problem

12:15 actually more 13k prefixes, but still =/

12:15 chouser: yep

12:17 astoddard: Thanks for the suggestions. As this is initial data that is fixed for a given analysis I would probably rebind it if splitting multiple analyses onto multiple threads.

12:17 carkh: so why am i saying this : you want to think a little bit at how your program might evolve (while not overdoing it)

12:18 what if a single analysis is sunddenly so big (10 years in the future) that paralelise your single analysis on those 128 processor you'll have then ?

12:19 that you want to ***

12:22 this program i was talking about is bit rotting hard these days, it was done in delphi for windows 95 ... maintenance is getting a nightmare, and i'm trying to avoid that for the future. I guess the jvm is here to stay, but will clojure survive and still be maintained 10 years from now

12:22 astoddard: Sure. But none of those 128 threads should be _changing_ the initial data given to this analysis, even if the computation is parallelized. Must understanding of refs is they coordinate state change.

12:22 carkh: astoddard: yes i think you're safe then

12:50 dnolen: so with-private-fns never made it into clojure.test ?

12:51 AWizzArd: dnolen: what does this macro (?) do? Aren't closures private fns?

12:52 dnolen: AWizzard: a ns may have private fns that you also want to include in your tests

12:54 AWizzArd: dnolen: ah, *those* private fns you mean, I understand now. Yes, sounds useful.

12:55 But one could write such a macro within 10-50 minutes. The nice thing about Lisp: nearly every update that you want to see you can implement yourself, without the need to wait for the benovolent dictator to include it :)

12:56 ohpauleez: do namespaces have the same rules as packages in Java? ie: Can you abuse them to get access to private functions?

12:57 if so, you could just do some ns bashing and pull them out.

12:57 dnolen: Also, take a look at lazytest, you may find what you're looking for there

12:58 Raynes: You can access private functions if you know their name: #'some.namespace/private-fn

12:58 dnolen: ohpauleez: it possible to get them out, testing private fns seems like a common enough scenario to want that macro to be in clojure.test

13:19 bhenry: is there something like a map-if? (map-if pred func seq)

13:26 alpheus: That's filter, isn't it?

13:31 AWizzArd: well, nearly

13:32 map applies func

13:32 filter only pred

13:32 but reduce is it, bhenry

13:32 map and filter are special cases of reduce

13:33 bhenry: i'm not sure how to use reduce to get that

13:33 reduce won't give me back a list

13:33 ohpauleez: yeah, i would just apply map to a filter

13:33 bhenry: i want back a list of the same length, but only apply f when pred is true

13:34 ohpauleez: (map #(...) (filter #(....) [coll]))

13:34 bhenry: right now i'm using (map #(if some-test (do-this %) %) sequence)

13:34 Chousuke: that works.

13:34 technomancy: bhenry: there's also for with a :when clause

13:34 AWizzArd: bhenry: (reduce (fn [result element] (if (pred element) (conj result element) result)) [] input)

13:35 carkh: (map #(if (pred %) (f %) %) the-list)

13:35 technomancy: for is a lot nicer than map+filter, especially if you have to construct custom fns for both

13:35 Chousuke: using reduce is overkll :P

13:35 AWizzArd: ,(reduce (fn [result element] (if (< element 10) (conj result element) result)) [] (range 20))

13:35 clojurebot: [0 1 2 3 4 5 6 7 8 9]

13:35 AWizzArd: ,(reduce (fn [result element] (if (< element 10) (conj result (* 3 element)) result)) [] (range 20))

13:35 clojurebot: [0 3 6 9 12 15 18 21 24 27]

13:35 Chousuke: (not to mention inefficient)

13:35 AWizzArd: This is filter + reduce

13:35 uhm, filter + map

13:35 and more efficient than both

13:36 bhenry: AWizzard, that doesn't leave me a list of the same length

13:36 AWizzArd: Chousuke: reduce is more efficient, it traverses the input only once

13:36 ohpauleez: I'm going to go with technomancy on this, I would use for and :while

13:36 AWizzArd: bhenry: no

13:36 ohpauleez: I retract my map filter :)

13:36 Chousuke: AWizzArd: so do map and filter. you forget they're lazy.

13:36 AWizzArd: as you see, it returns result without modification if pred is not met

13:36 carkh: mine is easier and shorter

13:37 AWizzArd: Chousuke: they both are doing only what reduce is doing, it is just a special case

13:37 ohpauleez: this is a great game of golf

13:37 :)

13:37 Chousuke: AWizzArd: but they're lazy, which is a perfomance advantage :P

13:37 (not always, though. it depends.)

13:37 AWizzArd: Chousuke: and what would happen if one would use lazy-cat inside the reduce?

13:37 somnium: unless you're eager for performance

13:38 Chousuke: AWizzArd: it would still be strict.

13:38 AWizzArd: since it would actually realise the source seq

13:38 carkh: and it would blow the stack on big seqs

13:38 Chousuke: technically map and filter are special cases of reduce

13:38 AWizzArd: carkh: how?

13:38 Chousuke: but in practice there's a huge difference :P

13:38 carkh: thunk calling thunk calling thunk

13:39 AWizzArd: the question is if bhenry needs it lazy

13:39 carkh: realising the first element would blow the stack ...afterwards you'd be fine axcept the stack is already blown

13:39 Chousuke: well he probably doesn't

13:39 AWizzArd: if he wants all elements then lazy is just another performance hit, on top of eager map+filter

13:39 Chousuke: but lazy = better

13:40 AWizzArd: no, there is an infinite set of cases where lazy performs worse

13:40 Chousuke: yeah, and does that apply here?

13:40 no.

13:41 Your solution was technically fine, but it's overly complicated.

13:41 carkh: let's all agree that lazy is better except when it's worse !

13:41 somnium: here here!

13:43 Chousuke: Also it forces the entire seq to exist in memory all at once, which is probably unnecessary.

13:44 AWizzArd: Chousuke: I agree on map and filter both having their advantages. Though this is part due to clojures implementation of reduce. Compare with Haskells folding.

13:45 Chousuke: reduce is foldl', right?

13:45 ohpauleez: I think Clojure is rolling in folding, but don't quote me on that

13:45 popped up in here and in the mailing list not too long ago

13:46 AWizzArd: Chousuke: yes

13:46 oh btw, did someone suggest 'for'?

13:46 Chousuke: IIRC foldl (lazy reduce) has some issues with unexpected memory use.

13:46 AWizzArd: potentially

13:47 ohpauleez: AWizzArd: yeah, technomancy did, I support for

13:47 AWizzArd: lazy is not always "better"

13:47 ohpauleez: in the past few minutes?

13:47 Chousuke: Clojure has only lazy sequences though.

13:47 And delays

13:47 AWizzArd: I meant as a reply to bhenrys request

13:47 dnolen: AWizzard: I think the issues with foldl in Haskell are common enough that books like Real World Haskell suggest using only foldl'

13:47 ohpauleez: yeah, at the beginning of all of this conversation

13:47 Chousuke: Haskell has lazy everything

13:48 (unless explicitly strict)

13:48 ohpauleez: AWizzArd: ^

13:48 carkh: ,(let [apply-if (fn [pred func] (fn [val] (if (pred val) (func val) val)))] (map (apply-if odd? inc) (range 10)))

13:48 clojurebot: (0 2 2 4 4 6 6 8 8 10)

13:49 AWizzArd: ohpauleez: good, I missed that. for is of course very nice for this, I agree.

13:49 ohpauleez: totally

13:50 somnium: its cases like that where it would be so nice to have currying

13:50 AWizzArd: somnium: what case?

13:51 somnium: carkh's example

13:51 carkh: (let [a (partial + 2)] (a 2))

13:51 ,(let [a (partial + 2)] (a 2))

13:51 clojurebot: 4

13:52 carkh: how would you rewrite that apply-if using currying ?

13:52 somnium: carkh: you would write (defn foo [p f x] (if (p x) (f x) x))

13:52 carkh: and then (foo somep somef)

13:54 carkh: nice

13:54 stuartsierra: ~seen rhickey

13:54 clojurebot: rhickey was last seen quiting IRC, 9545 minutes ago

13:54 carkh: ,(let [apply-if (fn [pred func val] (if (pred val) (func val) val))] (map (partial apply-if odd? inc) (range 10)))

13:54 clojurebot: (0 2 2 4 4 6 6 8 8 10)

13:54 carkh: very nice indeed

13:55 AWizzArd: hmm, maybe I am just blind right now, but I don't see where currying would be applied here

13:56 carkh: look my last example

13:56 it's way more general than the first

13:56 apply-if is going into my personal standard library =P

14:01 AWizzArd: carkh: with currying support your map would be (map (apply-if odd? inc) (range 10))

14:01 carkh: well partial is the only way i can do currying in clojure so i guess i'm stuck with it

14:02 AWizzArd: carkh: yes, or use the reader macro #()

14:02 ,(let [apply-if #(if (%1 %3) (%2 %3) %3)] (map #(apply-if odd? inc %) (range 10)))

14:02 clojurebot: (0 2 2 4 4 6 6 8 8 10)

14:03 carkh: not as easy to read but yes, true

14:03 AWizzArd: yes, the fn is really prefferable here, especially with the good names that you used

14:03 carkh: i often find myself trying to nest #() forms

14:04 ossareh: I far prefer the explicit syntax of (fn [x] (forms))

14:04 AWizzArd: carkh: that would be possible if there were a currying reader macro $()

14:04 ossareh: #() looks so weird.

14:04 AWizzArd: ,(map #(+ 4 %) (range 5)) ; here I prefer the #()

14:04 clojurebot: (4 5 6 7 8)

14:04 carkh: ah a currying reader macro would be very usefull

14:04 AWizzArd: carkh: not *sooo* useful. And Rich is against it. I discussed this with him in late 2008.

14:05 carkh: but i don't see how clojure being all dynamic could do currying without some explicit request in the code

14:05 AWizzArd: It would be very similar to #() but could not offer much more, and even miss some points.

14:05 carkh: the problem lies not so much in dynamism, but in the fact that Clojure offers fns that take any number of args.

14:05 somnium: I wrote a version of fn that creates curried versions, but it would need support from on high not to feel bolted on, (and get curried versions of map, reduce, etc)

14:05 AWizzArd: In Haskell for example it is known at compile time how many args each fn must take.

14:06 carkh: right

14:06 AWizzArd: The compiler can fill up the %1 %2 things automatically for us.

14:06 But you can't have "map"

14:06 somnium: or clojure fns take one arg and its always a list

14:07 Chousuke: I don't think you can implement currying efficiently in Clojure :/

14:07 AWizzArd: In the end it is just syntactic sugar. The current #() is nearly as concise as currying. It can not be nested, but it can do things that currying can't.

14:08 ossareh: isn't currying achieved with partial?

14:08 AWizzArd: ossareh: technically yes

14:08 nickik: its not the same

14:09 AWizzArd: but currying is about not writing out "partial"

14:09 (map (+ 5) (range 5))

14:09 somnium: you can take (fn [x y z] ...) and create (fn [x] (fn ([y] (fn [z])) ([y z] ...)

14:10 nickik: i like to use partial often because it looks less wierd #(+ % 5) (partial + 5)

14:10 could have been a shorter word ...

14:13 AWizzArd: nickik: (def § partial) ;)

14:14 nickik: im somethimes tempted to do something like that but I just think its wired for other people to read

14:14 AWizzArd: This is especially nice since non-german keyboard layouts might not even support the § char :)

14:14 somnium: heh

14:15 nickik: you do you make it?

14:15 jarpiain_: http://gist.github.com/615573 <-- a currying macro

14:16 AWizzArd: nickik: noo, I use #() or maybe in very few cases partial.

14:17 Guys, in how many cases (20%, 40%, 60%, 80%) do the elements in your collections (vector, list, set) all have exclusively the same type and are not nil?

14:18 chouser: same (abstract) type but maybe nil -- 95%

14:19 same (abstract) type and never nil -- 80%

14:19 AWizzArd: I also would tend to say 80%

14:20 bhenry: carkh: i really think map-if is a better name than apply-if since the regular apply works on the whole list and returns one thing, but map works on each part of the list. it makes sense that map-if would do the f to each item but only when pred is true

14:20 abedra: ~seen stuarthalloway

14:20 clojurebot: stuarthalloway was last seen quiting IRC, 8707 minutes ago

14:21 carkh: apply-if really maps a single value, in haskell map-if would be a good name, not sure about clojure

14:32 freakazoid: Really, clojurebot, 8707 minutes?

14:39 AWizzArd: freakazoid: yes

14:39 freakazoid: Not a very human-friendly number

14:40 AWizzArd: ,(map #(/ % 60.0) [9560 8710])

14:40 clojurebot: (159.33333333333334 145.16666666666666)

14:40 freakazoid: What command do I use to replace the source code of that rendering function?

14:40 Or is clojurebot not programmable from IRC?

14:46 chouser: ,((fn [i] (mapcat list (loop [o [] i i [f & fs] (reverse (reductions * [1 60 24 7]))] (if f (recur (conj o (int (/ i f))) (rem i f) fs) o)) [:weeks :days :hours :minutes])) 8707)

14:46 clojurebot: (0 :weeks 6 :days 1 :hours 7 :minutes)

14:46 chouser: hm. there's probably a better way

14:53 freakazoid: Nice.

14:53 I think it's OK to round.

14:54 for something that long you don't need minutes.

14:54 haircut time.

15:09 cburroughs: Does anyone know what is up with the latest version of the incanter autodocs: http://liebke.github.com/incanter/charts-api.html ?

15:11 Dawgmatix: is elpa the right place to install swank-clojure from?

15:14 replaca_: chouser: you are insane!

15:15 * chouser beams

15:15 replaca_: :)

15:16 replaca: cburroughs: I make the autodocs and incanter's not building for me :(

15:16 cburroughs: I'm waiting for some info from liebke on what's up with that

15:17 I'll try to get it fixed up RSN...

15:19 cburroughs: Thanks

15:24 kanak: Hi, I'm trying to start a swank server using "lein swank" but i keep getting a "that's not a task" error. I'm using version 1.3.1. Am i doing anything wrong?

15:24 mrBliss: kanak: try lein deps

15:25 kanak: try lein deps

15:27 kanak: mrBliss: I cloned the incanter repo, and I'm did a lein deps inside it. It looks like it installed successfully ("Copying 37 files"...). Now when i do "lein swank" it still says "That's not a task. Use "lein help" instead."

15:27 mrBliss: kanak: is swank-clojure listed in the dev-dependencies in the project.cj file?

15:28 kanak: mrBliss: swank-clojure "1.3.0-SNAPSHOT" is listed in the vector corresponding to :dependencies

15:29 mrBliss: try putting swank-clojure "1.2.1" under :dev-dependencies

15:31 duncanm: hmm, if i use a clojure lib, do i still need to :import again if i want to use a defrecord from that lib?

15:31 mrBliss: duncanm: I believe so

15:32 duncanm: ah

15:35 kanak: mrBliss: That did the trick. Thank you so much :).

15:36 mrBliss: kanak: my pleasure

15:37 duncanm: mrBliss: defrecord doesn't generate a type predicate, does it?

15:38 kanak: mrBliss: What is the "workflow" when starting a new project (using emacs)? Can i create a new project and start a swank repl for it all within emacs?

15:38 mrBliss: duncanm: nope, but you can use instance?

15:38 kanak: http://github.com/mrBliss/dotfiles/blob/master/.emacs.d/clojure.el look at lines 79 and 131

15:42 kanak: mrBliss: thank you for sharing your dotfiles :). This looks really handy.

15:43 mrBliss: kanak: I'm currently composing a more modular and well-documented clojure.el that could be a starting point for newcomers

15:48 klang: mrBliss: some of what you have in your .emacs file is also maintained here, I think; http://github.com/vu3rdd/swank-clojure-extra

15:49 mrBliss: klang: thanks for the link!

15:51 Dawgmatix: slime is connecting for me with swank-clojure (i get the message may this repl serve you well) but i get no prompt

15:51 do i have to do something special for that?

15:51 klang: mrBliss: swank-clojure-project is not maintained in connection with swank-clojure anymore, but in the above "break off

15:52 mrBliss: another fun addition, if you do not want to scare people with parenthesis :-) http://gist.github.com/560327

15:53 Dawgmatix: have you tried running the labrepl?

15:53 mrBliss: klang: I have it already :-)

15:53 Dawgmatix: no i havent tried labrepl :)

15:53 klang: mrBliss: heh!

15:54 Dawgmatix: it will serve you well. It has a good simple (7 lines) description on how to get emacs up and running.

15:54 ordnungswidrig: hi, I remember having read about cake in automatically running tests

15:55 does anybody know if I'm right?

15:55 mrBliss: Dawgmatix: have you got the latest version of slime and slime-repl from ELPA and are you using GNU Emacs?

15:55 lancepantz: ordnungswidrig: cake autotest

15:55 Dawgmatix: i am using slime from cvs

15:55 klang: Dawgmatix: I would suggest .. yes, ELPA ..

15:55 Dawgmatix: because slime from elpa just foobared when i tried to install it

15:55 klang: for any specific reason?

15:55 Dawgmatix: let me try it again

15:56 and get back to you with the error

15:56 i remember the time when you stuck 4 lines of slime in a .emacs and it just worked !

15:57 klang: You don't need that much, if you use ELPA, I think ..

15:59 Dawgmatix: "lime-repl.el:122:39:Error: No setf-method known for slime-connection-output-buffer"

15:59 klang: ..but then again, I have softlinked ~/.emacs.d/elpa/swank-clojure-1.1.0swank-clojure.el to swank-clojure-extra/swank-clojure-extra.el

15:59 Dawgmatix: thats the error elpa gives

16:00 klang: Dawgmatix: how much of a clean slate are you using?

16:01 Dawgmatix: ive installed lein. i can get that to create a swank server. now i am trying to get emacs going

16:01 (i normally use slime for sbcl, but ive commented those things out in my .emacs) so effectively i think i am on a clean slate

16:02 is there a repository for the clojure version of slime?

16:03 klang: Try moving your elpa directory a bit and reinstall everyghing ..

16:03 ordnungswidrig: lancepantz: ah, thanks

16:03 Dawgmatix: ive tried to nuke the elpa directory already and start afresh, same results

16:03 moogatronic: is the wiki up to date with the order to install emacs->slime / etc ?

16:03 I wish i had my computer with me at work here to try it. =)

16:05 klang: .. I'll try to make a clean install on another machine

16:05 Dawgmatix: thanks klang!

16:10 klang - the elpa slime works inspite of throwing an error during installation !

16:10 klang: Dawgmatix: sudo apt-get install emacs23 git git-core sun-java6-jdk ant will take a few minutes .. (I did say new machine)

16:11 Dawgmatix: i guess the error is in some non essential part of slime

16:11 klang: Dawgmatix: are you up an running?

16:11 Dawgmatix: yes

16:11 thank you for your help !

16:11 klang: No problem

16:16 oguz: is there a model checking tool for clojure? does jpf work?

16:16 ordnungswidrig: what's wrong?

16:16 ,(letfn (d [x] (* 2 x)) (d 4))

16:16 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol

16:17 MayDaniel: letfn requires a vector for its bindings.

16:17 ordnungswidrig: MayDaniel: thanks

16:21 installing clojure-test-mode from elpa complains about clojure-mode-1.7.1/clojure-mode.el already to exist

16:24 dnolen: ordnungswidri: the stock package.el is broken, technomancy has a patched copy

16:24 ordnungswidrig: github?

16:24 clojurebot: http://github.com/richhickey/clojure/tree/master

16:24 dnolen: ordnungswidrig: yeah

16:24 shoover__: clojurebot: no, that's old!

16:24 clojurebot: Huh?

16:24 dnolen: ordnungswidrig: http://github.com/technomancy/package.el

16:25 nickik: whats the idiomatic way to update a value in a vector and return the hole vector.

16:26 seancorfield: how exactly do you use / install technomancy's package.el

16:27 tomoj: one option is to install the regular one, then replace it in ~/.emacs.d/elpa/package.el with technomancy's

16:27 seancorfield: ah, i looked all over for the installed package.el but i don't think i checked in there

16:28 what about package-maint.el ?

16:29 joly: nickik: ,(assoc [0 1 2 3 4] 2 'a)

16:29 AWizzArd: Hallo Ord

16:29 tomoj: seancorfield: dunno what that is

16:29 freakazoid: it says it's for maintaining repositories.

16:29 kryft: Halloed be your names.

16:29 tomoj: where's it come from?

16:30 freakazoid: it's in the distro I believe

16:30 same repo

16:32 ordnungswidrig: dnolen: no better:Bad url: :clojure-test-mode-1.4.el

16:34 seancorfield: cool, well, that got me further with emacs... i still don't think i'll give up eclipse tho'... :)

16:34 nickik: @joly thx only used assoc with maps. is there a simular thing where i can provide a function instead of a value? Like update in for maps

16:34 lpetit: :)

16:35 dnolen: ordnungswidrig: will have to defer to technomancy

16:35 nickik: on my laptop eclipse was just to slow

16:35 * lpetit is fighting his ccw clojure grammar on a vicious bug with accentuated characters ...

16:36 nickik: is ccs written in clojure=

16:36 mrBliss: ordnungswidrig: try using clojure-mode from the github repo. clojure-test-mode is integrated in that version clojure-mode

16:36 nickik: *ccw

16:36 @mrBlisss what does clojure-test-mode do? i alwas use (run-tests)

16:37 mrBliss: adds C-c C-, binding to run the tests, highlights the failed tests,

16:37 joly: nickik: not sure about providing a function to apply to the entry

16:38 mrBliss: jump between test and implementation with C-c t

16:38 ordnungswidrig: mrBliss: ok

16:38 mrBliss: which is the best version? jochu or techno?

16:38 mrBliss: ordnungswidrig: technomancy's

16:39 nickik: @mrBliss ah nice a have to test that. It comes with clojure-mode?

16:39 mrBliss: http://github.com/technomancy/clojure-mode I was wrong, use both files (not test.clj)

16:40 lpetit: nickik: more and more, yes

16:41 ordnungswidrig: "vi .emacs" I just can drop this habit

16:41 lpetit: nickik: for example, all paredit.clj stuff, all actions, ClojoureProjectNature.clj ...

16:43 chouser: lpetit: I installed eclipse yesterday, and ccw.

16:43 lpetit: chouser: are you sick ? ;-)

16:43 chouser: yes, but I don't think it's related.

16:43 :-)

16:44 nickik: hehehe

16:44 chouser: so I was enjoying hopping about through Java code with <F3> and wondered if that was supposed to work in .clj files as well and I was just doing something wrong, or is that not implemented yet.

16:45 lpetit: chouser: should work. But only for files which are already loaded in a Clojure VM

16:45 chouser: ok, I may have skipped that

16:45 lpetit: chouser: no static analysis, only dynamic

16:45 chouser: ok

16:45 lpetit: documentation hover is also on its way in a separate branch

16:47 chouser: don't miss the namespace browser

16:48 chouser: what about finding java method definitions from places they're called in clojure code

16:48 ?

16:48 lpetit: chouser: its embedded search engine (ok, just regex matching :) ), its documentation hover, and file opening on double click

16:49 chouser: you mean like Ctrl+Space . It's working, but a bit slow. type "(.hash" and then Ctrl+space for example

16:49 chouser: defintely will need more work before twitting about it :)

16:51 chouser: oh, that sounds cool too. I meant like having the cursor on (PersistentHashMap/create ...) and pressing <F3> to jump to the definition

16:51 lpetit: chouser: heyh, days have only 24 hours :-). It's already on the todo list, though.

16:52 chouser: not asking you to do it, just asking if it's done. :-)

16:54 hm, I'm doing something wrong no doubt.

16:54 lpetit: chouser: also don't miss all the "paredit-like" features. Structural selection via Shift+Alt+[UP|LEFT|RIGHT], "raise over" via Alt+R, "split" via Alt+S, switch between "default mode" and "strict mode" (Alt+D) => In strict mode, try to "wrap around" by just doing a selection (preferably via structural selection commands ;-) ) and then hitting the kind of "wrapper" you want : ( { or [ (soon to come: # as a dead letter so that you can als

16:54 chouser: may I help ?

16:55 chouser: lpetit: nah, I'll but you some other time.

16:55 lpetit: chouser: you're on Mac, Linux or Windows ?

16:55 chouser: yeah, I was playing with the paredit features, the ones I could find and/or understand anyhow.

16:55 freakazoid: are we talking abotu clojure-mode?

16:55 lpetit: chouser: if you trigger the internal eclipse documentation from the editor (F1 or Ctrl+F1 I guess...), you'll have the full list

16:56 freakazoid: I just recently got swank and clojure-mode working but I haven't had much chance to play with them yet.

16:56 mrBliss: lpetit: can you add * to the list of "wrappers", so we can "earmuff" our vars?

16:56 freakazoid: Oh. Eclipse.

16:56 lpetit: mrBliss: :)

16:56 nickik: is there a better way to select (in emacs) then Strg + Space [up right ....] with paredit

16:57 chouser: lpetit: it's great stuff. I especially appreciate that you're writing what you can of it in Clojure.

16:57 lpetit: chouser: it's the only clojure I write, since I'm still not able to write clojure at work.

16:57 freakazoid: I usually use ctrl-space ctrl-(up or down)

16:57 chouser: my dream is to have something at least as "good" (for me) as vim, plus extendable via Clojure. Maybe it's here already and I just need to learn it.

16:58 moogatronic: lpetit: do you know of a sane way to "theme" eclipse?

16:58 lpetit: chouser: but that's not just about writing it in clojure. When it makes sense, it's also not dependent on eclipse. Like all the paredit.clj stuff.

16:58 freakazoid: but I don't use paredit

16:58 lpetit: moogatronic: no :-( :-( :-

16:58 moogatronic: ccw is nice btw

16:59 once the hour shifts to dark, eclipse and the glaring white starts to injure my eyes. =)

16:59 chouser: lpetit: yeah, awesome.

16:59 lpetit: chouser: thinking about this more and more. Have been involved with aav's clojure.osgi project recently. It now provides "a story" for using clojure from within OSGi. Once cemerick has finished a first workable version of nREPL integration for ccw, we'll be able to have "Eclipse embedded REPL"

17:00 ordnungswidrig: moogatronic: if you're on a mac I recommend "flux". This sets your monitor settings to lower k according to sunset and sunrise

17:00 lpetit: moogatronic: you're a poet. If you're also good at graphical design, then please submit a logo for ccw :-)

17:00 freakazoid: or get a macbook :)

17:01 moogatronic: lpetit: I'm no graphical designer. =) My wife is doing PhD in HCId, maybe I can have her get a minion to do it.

17:02 ordnungswidrj: i do use f.lux, its nice, and helps a bit. I just think that code looks more beautiful with a black background.

17:02 nickik: the problem with the normal selection is that you can and up taking to many parens and then you have a messed up parens. The only way to clean it up is to go out of paredit-mode.

17:02 lpetit: chouser: and cgrand is "pressing" me to do this. He also wants to hack Eclipse from a REPL :-). But everytime he comes to me with this demand, I answer back "when will incremental parsing in parsley be finished", and I have one more month free :)

17:02 duncanm: is there a sample implementation of IPersistentMap somewhere that I use for my own deftype?

17:02 nickik: i would really like to have a paren-save way of selecting

17:03 chouser: lpetit: heh

17:03 lpetit: nickik: ?

17:03 ordnungswidrig: nickik: you know: copy paste is evil. it's even more evil in lisp

17:04 lpetit: nickik: can you explain with words understandable to non emacs users ? I would like to understand if the problem your raising will also be reported for ccw, sooner or later ?

17:04 nickik: i think is ok if you have found a snipped of code you want in seprat function for more reuse

17:04 ordnungswidrig: nickik: with paredit you do not copy and paste you wrap, raise, splice and join :-)

17:05 lpetit: it's about extending the selection according to the structure of the code, eclipse (IMHO) used alt-up for that, intellij uses ctrl-w

17:05 lpetit: ordnungswidrig: is it possible to wrap siblings in emacs paredit ? e.g. you have "foo" "bar" (bar 0) and you want to wrap the 3 within [] ?

17:06 nickik: @ordnungwiedrig yes but what do you do if you have a (fn .... ) that you want to cut out of there and put it in a sepret (defn .....)

17:06 lpetit: ordnungswidrig: oh, I have this in ccw. It's Shift+Alt+Up. (extend selection to parent)

17:06 ordnungswidrig: lpetit: imho not

17:06 it's whas nickik is asking for in emacs

17:07 nickik: kill-sexp

17:07 lpetit: ordnungswidrig: Ah. I've go my killer feature to demonstrate in the conj then to hard core emac users :-P

17:08 ordnungswidrig: enter eclipse and the strict mode of structural edition (aka paredit) : Use Shift+Alt+RIGHT_ARROW to select the three, then just hit the [ key => wrapped.

17:08 ordnungswidrig: lpetit: hehe, paredit uses don't need that :) And if yes, the write an emacs function :-)

17:09 lpetit: ordnungswidrig: it's like everything. Don't say they do not need that. Say they've learned to live without :-)

17:09 ordnungswidrig: lpetit: pareditusers do [ CTRL-RIGHT CTRL-RIGHT CTRL-RIGHT

17:09 CTRL-RIGHT extends the current brace/paren/... (a) b c -> (a b) c -> (a b c)

17:10 duncanm: la la la

17:10 lpetit: ordnungswidrig: yes, I remember, that's called "slurp" or something like that, or forward-wtf :). I didn't like it. One more command to learn, while with the combination of structural selection + wrap you could do this.

17:11 nickik: the CTRL thing comes in handy very often

17:11 lpetit: Though I may add it, when there's an already existing (a), indeed.

17:11 hmm

17:12 nickik: @lpetit you can look at the paredit functions here http://www.emacswiki.org/emacs/PareditCheatsheet

17:13 tomoj: there's some hidden stuff I think

17:13 nickik: @ordnungswidrig the kill-sex is like M - C - k

17:13 lpetit: nickik: already on my desktop since several months :)

17:13 but thanks

17:13 dnolen: lpetit: what? you don't like slurp and barf?

17:14 lpetit: dnolen: I've learned to not use them, since I've not implemented then yet :)

17:14 s/use/like/

17:14 sexpbot: <lpetit> dnolen: I've learned to not like them, since I've not implemented then yet :)

17:14 dnolen: lpetit: I was mostly joking about the naming convention. silly lispers.

17:15 lpetit: Maybe functions like slurp and barf are an indicator that people liking them will stay on emacs and not use Eclipse anyway :-p

17:15 nickik: @lpetit i can use 3/4 of it without thinking atm

17:15 lpetit: dnolen : :)

17:16 Well, all this didn't help me solve my grammar problem :-O

17:16 ordnungswidrig: if find the paredit way more natural for lisp and the emacs/intellij more natural for java

17:16 dnolen: the commands that I could not live w/o in paredit is - raise and splice

17:17 ordnungswidrig: btw. I like most that a closing paren/brace/curly removes a linebreak

17:17 jjido: does anyone have a Textmate bundle that works?

17:17 lpetit: ordnungswidrig: but Intellij plugin could integrate paredit.clj sooner or later, since I've written it with no dependency but clojure, clojurecontrib, and parsley (which only has a dependency on clojure)

17:17 dnolen: doing what raise does manually is particularly lame.

17:17 lpetit: dnolen: they're in ccw already

17:17 dnolen: lpetit: nice!

17:17 lpetit: alt+R (Raise), alt +S

17:17 dnolen: jjido: aria42 and I have a fork that people seem to like

17:18 jjido: caveats, requires ruby and installing cake

17:18 ordnungswidrig: dnolen: raise, yes, nice

17:18 jjido: ruby's by default

17:18 dnolen: jjido: are you on os x?

17:18 lpetit: dnolen: hmmm, is what you cal "splice" what I call "split" ?

17:19 dnolen: jjido: duh textmate of course

17:19 lpetit: oh no

17:19 dnolen: jjido: sorry cold head

17:19 lpetit: I don't have splice

17:19 chouser: splice might be join

17:19 lpetit: just raise

17:19 jjido: dnolen: yes

17:19 ordnungswidrig: and ) also "jumps to the right place"

17:19 dnolen: jjido: http://github.com/swannodette/textmate-clojure

17:19 lpetit: already there too

17:19 and it also takes care of removing extra spaces

17:19 ordnungswidrig: ^^

17:20 jjido: dnolen: looks like the one I have :(

17:20 dnolen: jjido: does it not work for you?

17:22 jjido: dnolen: maybe I need a reinstall

17:23 doesn't compile, doesn't load docs

17:23 dnolen: jjido: there's a mailing list here, http://groups.google.com/group/textmate-clojure

17:23 jjido: I only have syntax highlighting

17:23 dnolen: jjido: if you could go into detail about your issues that would helpful.

17:24 jjido: ok

17:25 is there a vector version of (map)?

17:27 nickik: @mrBliss or somebody else to invoke the test you should be able to hit "C-c C-" but how? Ctrl + c then what?

17:28 ordnungswidrig: ctrl-c ctrl-,

17:28 freakazoid: jjido: I'd think map would just take vectors.

17:28 doesn't it just use the sequence interface and make another sequence of the same type?

17:29 ordnungswidrig: nickik: then M-n jumps to the next error

17:29 nickik: ctrl-' display the error message for that particular error

17:29 AWizzArd: ordnungswidrig: are you catching keyboard events in Swing? ;)

17:30 ordnungswidrig: AWizzArd: emacs, if in doubt, use emacs :)

17:30 nickik: @ordnungswidrig i tought the , was to seperate :)

17:31 ordnungswidrig: nickik: hehe

17:34 ,(if-let [[a b] []] [a b])

17:34 clojurebot: [nil nil]

17:34 ordnungswidrig: hmm, how can I bind with if-let only if the destructuring matches?

17:35 somnium: ordnungswidrig: I think you need a pattern-matching lib

17:35 ordnungswidrig: besides (if (= 2 (count x)) (let [[a b] x) …))

17:35 somnium: oh now

17:35 jjido: freakazoid: it does take vectors but returns a lazy list

17:35 ordnungswidrig: no

17:35 jjido: ,(map count ["Joe" "James" "Dick"])

17:35 clojurebot: (3 5 4)

17:36 somnium: ordnungswidrig: there a few available

17:36 ordnungswidrig: somnium: in my case, I got with function dispatch on arity :-)

17:38 s/got/go/

17:38 sexpbot: <ordnungswidrig> somnium: in my case, I go with function dispatch on arity :-)

17:40 ordnungswidrig: goodnight to all

17:41 duncanm: i'm trying to use deftype, but i keep on getting this 'no single method' error

17:51 nickik: damn if you not used to TDD you alwas want to change the test if its not passing :)

18:06 ohpauleez: jjido: use into

18:06 jjido: ohpauleez: always forget about that one :)

18:07 ohpauleez: ,(into [] (map count ["Joe" "James" "Dick"]))

18:07 clojurebot: [3 5 4]

18:07 ohpauleez: jjido: I always forget about using it to mash vectors together

18:07 ,(into [1 2 3] [ 4 5 6])

18:07 clojurebot: [1 2 3 4 5 6]

18:08 jjido: the code you showed will be slow on a 1,000,000 items vector no?

18:08 ohpauleez: jjido: Just be careful, it's going to have to realize that entire lazy list

18:08 you just beat me too it

18:09 jjido: ohpauleez: I want a vector out so I need to realise it anyway

18:09 ohpauleez: in this case, you may want to try using loop, recur, and transients

18:09 I'm not sure which one will be faster

18:09 jjido: ok

18:09 I will optimise later

18:10 ohpauleez: jjido: ping me if you need an example of that

18:10 ztellman: tomoj: sorry, I wasn't around for your question earlier

18:10 ohpauleez: jjido: it's always a good plan to optimize later

18:10 ztellman: you can do either; either write your frame decoder and insert into the standard TCP pipeline

18:10 (check out aleph.object for an example of that)

18:10 jjido: ohpauleez: yeah :)

18:11 ztellman: or just use simple functions

18:12 peepz: is there a clojure tutorial that takes me through creating a small simple program?

18:16 ossareh: peepz: programming clojure is a good book - the first few chapters are very much like that.

18:16 you can buy it from pragmatic programmers in ebook form, pretty cheap.

18:17 technomancy: ~peepcode

18:17 clojurebot: peepcode is a commercial screencast series; see the Clojure one at http://peepcode.com/products/functional-programming-with-clojure by technomancy

18:17 freakazoid: wow, the ebook is actually cheaper than the paper book

18:18 ossareh: freakazoid: stands to reason, no?

18:18 freakazoid: You'd think, but it's not so with Amazon.

18:18 If I start buying ebooks I'm gonna have to buy something to read them on.

18:19 ossareh: <3 my kindle

18:20 peepz: i bought it from peepcode..

18:21 _rata_: hi

18:21 raek: ah, just noticed that screencast was by technomancy...

18:21 you have done many great things, technomancy

18:22 * ossareh hands Phil a beer

18:22 * technomancy blushes; aw, it's nothing, etc.

18:22 ossareh: srsly though, between clojure itself, lein and the sys-clj stuff - my life is awesome.

18:23 freakazoid: what do you use clojure for, ossareh?

18:23 ossareh: freakazoid: www.rahfeedback.com

18:24 right now our web app is built in clj, though over time more will be built that way

18:24 freakazoid: ossareh: The site itself looks cool, but I can't help but get a "the officey" vibe from the product

18:25 probably due to my meeting allergy

18:25 ossareh: freakazoid: that is kinda the point to some degree - that is who we are targetting. The droves of office employees who have shitty lives - we want to make it better for them.

18:26 freakazoid: Get them new jobs :)

18:26 http://lh3.ggpht.com/Nitro2k/SBnIWtz79KI/AAAAAAAABOI/4_XhUq8hSkI/s800/hold-a-meeting.jpg

18:26 But if it makes meetings more productive, that'd be great

18:26 ossareh: :)

18:27 freakazoid: ossareh: is this a company you're starting or a company you got hired at and you managed to sneak Clojure in?

18:27 ossareh: freakazoid: I'm a co-founder.

18:27 clojure walked in - head held high.

18:28 freakazoid: cool

18:28 like erlang and my company :)

18:28 ossareh: freakazoid: my last startup embraced erlang a whole lot

18:29 unfortunately we were acquired by people that wanted to control our codez and now they're in a crappy repository somewhere where they'll never see the light of day

18:30 freakazoid: I'm not particularly concerned about that happening to our Erlang code - the stuff I've learned from working on it is far more valuable to me than the code itself.

18:30 Heck, that's true of *all* our code.

18:30 I'd welcome the chance to reimplement it.

18:33 ossareh: freakazoid: for 99% of code I've seen created I agree - however the stuff we developed at heysan should have been OSS'ed - it was a high performance implementation of all the major IM protocols. There was were a few bridges into it - one of them permitted use with JEP0100

18:33 freakazoid: nice

18:33 ossareh: s/JEP/XEP/

18:33 sexpbot: <ossareh> freakazoid: for 99% of code I've seen created I agree - however the stuff we developed at heysan should have been OSS'ed - it was a high performance implementation of all the major IM protocols. There was were a few bridges into it - one of them permitted use with XEP0100

18:34 freakazoid: I primarily care about XMPP

18:35 and I'm not even happy with that.

18:35 Ultimately I think a p2p system using a dht for rendezvous and key fingerprints as identifiers is the way to go

18:36 not federations where your identifier is owned by some third party who happens to operate a server

18:39 _rata_: is there something like (doseq [x xs, y ys] ...) but that takes the first x with the first y, then the second x with the second y, and so forth?... something like map but from the "do" family... or should I do (doall (map ...))?

18:41 ossareh: ,(doc doseq)

18:41 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

18:42 raek: _rata_: to me, it sounds like (dorun (map f xs ys)) is the best option...

18:44 _rata_: yeah, dorun is better

18:44 thanks raek

19:13 AWizzArd: Could one of you please time this in your Clojure? (def baos (ByteArrayOutputStream. 100000000)) (time (dotimes [i 80000000] (.write ^ByteArrayOutputStream baos 0))) (.reset baos)

19:13 (import 'java.io.ByteArrayOutputStream)

19:17 lpetit: AWizzArd: "Elapsed time: 2116.265056 msecs"

19:17 AWizzArd: client vm?

19:18 Mine is a bit faster, but not much, I've got 1692 msecs. Does this mean that our computers can only write 40-50 MB/sec into RAM?

19:18 jjido: ,(read-string "(last (range 10000))")

19:18 clojurebot: (last (range 10000))

19:20 lpetit: ,(macroexpand-1 '(dotimes [i 10] i))

19:20 clojurebot: (clojure.core/let [n__3820__auto__ (clojure.core/int 10)] (clojure.core/loop [i (clojure.core/int 0)] (clojure.core/when (clojure.core/< i n__3820__auto__) i (recur (clojure.core/unchecked-inc i)))))

19:21 jjido: anyway... I know to do println, can you also readln?

19:22 lpetit: AWizzArd: don't know. One byte at a time, maybe ...

19:22 jjido: ,(doc read-line)

19:22 clojurebot: "([]); Reads the next line from stream that is the current value of *in* ."

19:25 AWizzArd: lpetit: when I read that a quad Magny Cours has a RAM bandwidth of 48 GB/s then our lousy 0,044 GB/s seem a bit too small.

19:26 anyway, thanks for testing this

19:27 lpetit: AWizzArd: but you can cache and write(byte b[], int off, int len) !

19:28 same for read

19:28 AWizzArd: lpetit: i more or less thought that the BAOS *is* like caching.

19:28 bendlas: hi people

19:28 AWizzArd: It just is an in-memory array to which I can write my bytes

19:28 Hallo bendlas

19:28 freakazoid: hi bendlas

19:29 bendlas: ,(case nil nil :x)

19:29 clojurebot: java.lang.NullPointerException

19:29 bendlas: what's up with that?

19:29 lpetit: AWizzArd: using write(byte b[] ...) will internally use System.arraycopy(original, 0, copy, 0,

19:29 Math.min(original.length, newLength));

19:30 bendlas: Why can't I define a nil case?

19:31 AWizzArd: lpetit: I don't want to write zeros. How would I fill b in the first place?

19:32 lpetit: AWizzArd: found !

19:32 bendlas: do i really have to write


19:32 dnolen: bendlas: I think that's because the value of nil is determined at run time? case deals with constants

19:33 bendlas: I think someone has mentioned this before ...

19:33 tomoj: the value of nil is detrmined at runtime???

19:33 bendlas: (or (and x (case x ..)) :nil-case)

19:33 tomoj: I thought the value of nil was always nil

19:33 bendlas: ?

19:33 AWizzArd: lpetit: what did you find? :)

19:33 lpetit: oh no

19:33 bendlas: every time?

19:33 freakazoid: no, it's just not known to the compiler

19:34 AWizzArd: I would think that writing to a baos byte by byte should be roughly as efficient as writing to a byte-array byte by byte.

19:34 tomoj: to java, it's null, isn't it?

19:34 bendlas: tomoj: it is

19:34 tomoj: so case is trying to hash null or something?

19:34 AWizzArd: Tomorrow I will have to try that in pure Java and compare.

19:34 bendlas: might be

19:35 otoh ,({nil 5} nil)

19:35 works

19:35 tomoj: hmm

19:35 bendlas: ,({nil 5} nil)

19:35 clojurebot: 5

19:35 tomoj: ,(hash nil)

19:35 clojurebot: 0

19:35 dnolen: bendlas: http://www.glenmccl.com/tip_026.htm

19:36 tomoj: NilExprs are LiteralExprs.. hmm

19:36 dnolen: so maybe an artifact of Java silliness ?

19:37 tomoj: (.getClass nil) is the problem

19:38 lpetit: AWizzArd: import java.io.ByteArrayOutputStream;

19:38 public class TestBAOS {

19:38 public static void main(String[] args) {

19:38 ByteArrayOutputStream baos = new ByteArrayOutputStream(100000000);

19:38 long start = System.currentTimeMillis();

19:38 for (int i = 0; i < 80000000; i++) {

19:38 baos.write(0);

19:38 }

19:38 long stop = System.currentTimeMillis();

19:38 System.out.println("Time elapsed (ms):" + (stop - start));

19:38 baos.reset();

19:38 }

19:38 }

19:38 woops

19:38 sorry

19:38 bendlas: ok, then easy

19:38 ,(class nil)

19:38 clojurebot: nil

19:41 tomoj: but I can't tell why it's doing that

19:42 the code isn't actually (.getClass nil), it's in Compiler.java

19:43 lpetit: AWizzArd: still there ?

19:48 cburroughs: According to http://groups.google.com/group/clojure/browse_thread/thread/de68fbae18bec572/022a828bf0bd3cf7#022a828bf0bd3cf7 at one point wrapping compojure routes in var would cause changes to be reflected in a running server, but that doesn't seem to work for me.

19:48 Ex: (run-jetty (var app-routes) {:port 8085 :join? false}), recompile file in emacs, no changes

19:49 ossareh: cburroughs: this catches me out *all the time*

19:49 cburroughs: though if you have it setup correctly it does work

19:50 cburroughs: care to drop your file into a gist/pastebin ?

19:52 * cburroughs is embarrassed

19:52 cburroughs: Works fine if you look at the right port.

19:52 Probably best not to start a jetty on a half dozen reports and *then* try to get things to get the var reload work.

19:54 Thanks ossareh

19:54 AWizzArd: lpetit: yes

19:54 oh

19:55 ossareh: cburroughs: ;)

19:55 AWizzArd: clojurebot: help record

19:55 clojurebot: macro help is http://clojure-log.n01se.net/macro.html

19:56 peepz: user=> (load-file /home/admin/clojure-files/script.clj)

19:56 Couldn't read input.

19:56 why doesnt that work?

19:58 lancepantz: peepz: make your path a string

19:59 peepz: ok

19:59 worked

20:01 jjido: is there a good e-book about Clojure? I don't like to sit in front of a video

20:03 raek: jjido: Joy of Clojure (by chouser and fogus) and Programming Clojure (by stuarthalloway) are available as e-books

20:04 Clojure in Action and Practical Clojure are probably available as e-books too

20:06 jjido: raek: thanks, you recommend all these?

20:07 raek: I have read Programming Clojure and most of Joy of Clojure

20:08 coldhead: "available"

20:08 freakazoid: Is a Kindle at all worthwhile if you never buy a Kindle book?

20:08 raek: they are both great books

20:08 freakazoid: or in fact any DRM-crippled media?

20:09 lancepantz: there was a thread on HN about technical pdf on ereaders

20:09 it was pretty unanimous that the ipad is much better than the kindle

20:09 iirc because of the ability to zoom in on charts, etc

20:09 jjido: freakazoid: you can read technical papers and non-DRM ebooks

20:10 cheaper than an iPad ;)

20:10 freakazoid: Well, the ipad is itself crippled

20:10 not interested

20:10 ossareh: lancepantz: not for reading in sunlight*

20:10 freakazoid: way too expensive for the privilege of buying from Apple's store.

20:10 lancepantz: what's that?

20:11 :)

20:11 ossareh: freakazoid: I love my kindle - but I'd not recommend one unless you find yourself lugging books around as the norm

20:11 raek: jjido: I'd recommend reading the samples from the books to get an overview of them

20:11 freakazoid: that's why I got one for my dad

20:11 ossareh: I certainly do not think the kindle has nailed reading computing texts

20:12 freakazoid: I just have difficulty with the concept of "buying" hardware that's essentially the equivalent of a cable box

20:12 something that's actually owned by someone else and only usable with their service

20:13 jjido: easily freaked freakazoid?

20:13 freakazoid: you'd think I'd have avoided buying a CDMA cellphone. Maybe I should just get over it.

20:14 it's less of an issue when I want the service in the first place

20:14 but I don't want Amazon's Kindle "service"

20:16 ossareh: freakazoid: yeah, I completely agree with that - I take it a step further and don't buy anything at all unless there is a clear need for it :)

20:16 I can vouch that as far as a reading experience goes it is really a great device - but don't read code on it.

20:16 freakazoid: ossareh: That's how I am lately

20:17 paying alimony helps me stick to that discipline

20:17 technomancy: freakazoid: I read only non-DRM'd content on my kindle and I love it

20:17 it's great if you like classic literature

20:17 pragprogs and oreilly are also really good about non-abusive ebooks

20:17 freakazoid: TOR had a great thing going for a while

20:17 ossareh: yeah, I have programming clojure on the kindle

20:18 freakazoid: yeah, oreilly and pragprogs might be enough reason for me to buy a reader

20:18 ossareh: for a while I was reading oreilly books online using the browser on kindle

20:18 technomancy: the kindle service and the kindle hardware are very distinct

20:18 freakazoid: but I won't buy one that isn't awesome with PDFs

20:18 my *cellphone* is awesome with PDFs

20:18 but the screen is tiny

20:18 technomancy: it's not the size; it's the non-e-inkness of cell phones that make them bad readers

20:18 freakazoid: "awesome" being "much better than kindle"

20:19 people don't seem to complain too much about reading on ipad

20:19 and it's quite non-e-inky

20:19 technomancy: well... people who buy ipads generally avoid saying things that might imply they wasted their money

20:19 even if they are true things

20:19 ossareh: freakazoid: as a result of the reality distortion emitter built into the housing

20:22 the ipad is worth every cent if only for angry birds :D

20:22 and canabalt

20:26 _rata_: what happened to clojure.contrib.seq-utils in clojure 1.3.x? got integrated completely into clojure.core?

20:27 freakazoid: technomancy: yeah, I think Apple fans suffer from stockholm syndrome.

20:27 I'm a mac user

20:27 just not an iphone user

20:28 lancepantz: i think thats true of everything though

20:28 people have this inherit fanboyism

20:28 freakazoid: I'll badmouth anything.

20:28 lancepantz: functional vs oo, kindle vs ipad, etc

20:28 nintendo vs sega

20:28 _rata_: I can't find the indexed fn nor the clojure.contrib.seq-utils namespace

20:29 freakazoid: I'm a fan of the right tool for the job.

20:29 And not letting the perfect be the enemy of the good enough.

20:33 lancepantz: i was surprised to find out there was a rivalry between surfers and boogieboarders

20:33 had always thought there was a pretty laid back mentality in each

20:33 but no

20:36 konr: Do you add something on top of Emacs' syntax coloring? I find it a little poor, comparing to vi's (emacs on the left, vi on the right: http://img541.imageshack.us/img541/3438/emacsvsvi.jpg)

20:37 lancepantz: knor: yeah, i made my own color scheme

20:42 coldhead: surfers can be terribly territorial

20:42 which seems strange with the fluid nature of water

20:44 lancepantz: yep

21:10 miltondsilva: http://paste.lisp.org/+2GZB

21:11 somebody can explain what's happening in that code (the one in the paste)

21:12 ups, forgot to say how it fails... it throws a nullpointer

21:16 dnolen: miltondsilva: you're assuming .write returns something.

21:16 namely the outputstream

21:17 cemerick: ~max

21:17 clojurebot: max people is 315

21:17 cemerick: nutty

21:17 lancepantz: miltondsilva: the -> is equivalent to (.flush (.write (.getOutputStream con) 1))

21:17 not what you have below

21:18 miltondsilva: ohh...

21:18 amalloy: ,(doc doto)

21:18 clojurebot: "([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"

21:18 amalloy: miltondsilva: ^^

21:18 miltondsilva: yep

21:18 thanks :)

21:28 * scorfield wonders if anyone else here is at the Clojure / jClouds meetup in Mountain View?

21:31 * hugod is there in spirit

22:16 duncanm: la la la

22:18 freakazoid: scorfield_: where in MV is the meetup? I live in MV

22:19 wish I'd known about it

22:19 duncanm: is it possible to use defrecord's impl. of IPersistentMap as a base and add additional overrides?

22:19 freakazoid: I suppose that would require, like, subscribing to a mailing list or something

22:19 scorfield_: freakazoid: linkedin, stierlin court (2025)

22:20 at the end of amphitheater pkwy

22:20 freakazoid: Oh, I didn't realize linkedin was in MV

22:20 scorfield_: the aleph talk just finished... pallet up next

22:20 freakazoid: I can't go tonight

22:20 wife is expecting me home soon

22:22 coldhead: that woman has been holding you back for too long

22:23 freakazoid: haha

22:37 nollidj: i want to make an array of hashmaps with make-array. what is the type name i need to give to make-array?

22:46 amalloy: nollidj: clojure hashmaps, or java hashmaps?

22:49 actually, it doesn't really matter. you can always find out from the REPL

22:49 ,(class (make-array (class {}) 10))

22:49 clojurebot: [Lclojure.lang.PersistentArrayMap;

23:27 freakazoid: damn, lotrepl is written with gwt

23:28 anyone written an ajax clojure repl in clojure?

23:54 nollidj: what is it exactly that makes (:keyword map-thing) work in cases where (map-thing :keyword) doesn't work?

23:55 in my case, map-thing is a record

23:56 tomoj: records don't automatically implement IFn

23:58 https://gist.github.com/a0ed93a09f9fef44379e

23:59 nollidj: i figured. what makes (:keyword map-thing) work? is that interpreted by the reader as (get map-thing :keyword)?

Logging service provided by n01se.net