#clojure log - Dec 04 2009

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

0:01 * technomancy was wanting to clear the memoize cache just yesterday

0:03 technomancy: so how many are at the bay-area clojure meetup tonight?

0:06 alexyk: btw, perl also got a repl, it's called re.pl

0:07 Devel::REPL, if anybody needs a real repl in perl

0:07 now back to clj :)

0:09 technomancy: are you not near Boston, per blog?

0:18 technomancy: alexyk: nope; seattle

0:19 alexyk: technomancy: ah nice, I used to be there, and hope to be back. :)

0:20 technomancy: if I ever start a Seattle Clojure group, I'm going to be very tempted to name in Seajure

0:20 just to emphasize how tired I am of *jure names. =)

0:21 alexyk: technomancy: there's a seafunc already

0:22 soup du jure :)

0:25 piccolino: Can someone help me understand exactly what the "test" is in the docs of if-let?

0:26 somnium: ,(if-let [x (* 2 42)] x)

0:27 ^^ test

0:28 piccolino: The test is (* 2 42)?

0:29 somnium: its a shortcut for (if (... expr ...) (let [x (... expr ...)] ...

0:30 piccolino: Hm, OK, I think I see.

0:30 Thanks.

0:37 So if there's more than one binding?

0:39 somnium: not supported by if-let, though an and-let macro isnt too hard (I have one somewhere)

0:39 piccolino: Ah, OK.

0:39 The doc uses the word "bindings," so I wasn't sure.

0:43 somnium: you can destructure in one binding I guess

0:43 ,(if-let [[x & ys] (range 5)] ys)

0:43 clojurebot: (1 2 3 4)

0:44 technomancy: seafunc hasn't happened since like july =(

0:50 alexyk: technomancy: leiningen sounds very similar to Lenin. That'll be my Russian alias for it. :) Building the New World.

0:50 the working monads

0:51 ha! incanter has a project.clj. Time for lein?

0:53 technomancy: so the very first lime I have to build lein with ant, correct?

0:53 twbray: I've asked Maurice Herlihy about WF, and he promised to read about it!

0:53 liebke: alexyk: that project.clj is a work in progress, we're in the process of adding a javac task to Leiningen, so it can compile Incanter's single Java class. I do use Leiningen for building applications with Incanter, just not for building Incanter itself (yet)

0:54 alexyk: & about Clojure, too.

0:54 liebke: ah ok, so ant then, right? or how will it get all the deps?

0:54 liebke: ant deps

0:54 alexyk: liebke: kinda silly when I have a maven handy, but ok then

0:55 * alexyk finds using ant with a lib/ after having a maven repo really old

0:55 twbray: alexyk: WF isn't really at Herlihy's level, it's an engineering not a CS thing. But anyhow, cool.

0:56 liebke: I just don't want maven to be a requirement for building Incanter

0:56 alexyk: twbray: I think WF is really the best thing in years which happened to concurrency. Working-class concurrency is the future, not theory or HPC. So theoretician should serve the working people of concurrency and analyze it! :)

0:57 twbray: all the solutions exercise the cutting edge. In fact, you ought to write an O'Reilly *book* on WF. :)

0:57 ...with all code, analysis, and essays from the original blogs, before they disappear.

0:58 liebke: so is ML code from FlightCaster already in, or just promised?

0:59 huh, leiningen has no build.xml, just a project.clj...

0:59 liebke: It's in, but more will be coming. Here's a very brief description of what's there now: http://incanter-blog.org/2009/12/03/flightcaster/#comment-132

1:01 alexyk: liebke: brilliant

1:03 liebke: http://cloud.github.com/downloads/liebke/incanter/deps-1.0.zip to /s/w/clojure/incanter/deps-1.0.zip error 403, forbidden.

1:03 ant deps failed

1:03 liebke: crap, thanks

1:08 alexyk: liebke: so which stats degree did you get to understand the ESL book? :) I'd like to do the same, but am in academia and ML courses may be enough...

1:09 liebke: I picked up a master's in statistics, but that might be excessive if you just want to understand EoSL :)

1:10 okay, ant deps should work now, I uploaded the deps file with the wrong name

1:11 alexyk: liebke: I actually have a pause on classical statistics in the form of "who cares," despite many books and a few courses, seem to prefer ML/data-mining which requires software engineering and data engineering. Still remains to be seen what a good balance is. Bishop's book is the best so far.

1:12 ok ant deps is cooking

1:12 liebke: classical statistics is very useful, although I prefer bayesian methods, simulation, and ml approaches

1:12 bishop's book is good

1:13 alexyk: liebke: I'd say EDA is enough, then ML. Need to see classical statistics cast in massive data scenarios to appreciate...

1:15 liebke: haha, well I guess it depends what you're trying to do. Day to day work in science depends on classical statistics

1:19 alexyk: liebke: my science is massive web/twitter data mining... brute-force classifiers will do :)

1:19 * alexyk wishes to meet a statistician well-versed in hadoop, hbase, voldemort, etc.

1:21 alexyk: ok got myself an incanter! :) now need to launch it somehow...

1:21 technomancy: liebke: did you have to use flash to upload to the files section of github, or is there another way?

1:21 alexyk: liebke: can I use my own clojure driver instead of bin/clj? I set various java flags

1:24 liebke: technomancy: I didn't realize that the downloads page on github uses flash. I don't know of another way to do uploads though

1:24 technomancy: bummer

1:24 I wanted to upload some files, but I'm not about to install flash just to do that

1:24 oh well... I have my own server. =)

1:24 liebke: alexyk: sure, you can use any driver you like. bin/clj just sets the classpath to include the dependencies

1:25 alexyk: liebke: how should I try the examples/<something>.clj from the running repl?

1:27 ah ok, it just runs all plots! a wait for <enter> would help :)

1:28 ha, apparently you can drag the plots to scroll!

1:29 technomancy: are you in the RMS school of thought? :)

1:30 no flash evar? :)

1:33 technomancy: my browser hasn't crashed in years, I'm not about to start for a lousy file upload

1:34 flash is such a disaster

1:35 alexyk: technomancy: you can get a second browser just for that :) I use safari for idle pursuits, firefox for delicious-able ones

1:35 technomancy: yeah, but that would involve using the mouse

1:36 alexyk: technomancy: ah! :) are you running the xmonad for window manager?

1:38 technomancy: no, but I should

1:38 I'm using devilspie+metacity. it gets the job done but is not exciting.

2:08 alexyk: somnium: insomnium? :)

2:11 somnium: alexyk: heh

2:12 alexyk: somnium: I wonder why I can only store java.util.Date but not joda-time

2:12 is it due to mongo-java-driver?

2:12 somnium: alexyk: almost got a java-script repl working on app-engine, curious to poke around in the cloud

2:12 hmm

2:13 quite possibly

2:13 alexyk: apparently BSON stores some time of its own: http://www.mongodb.org/display/DOCS/Mongo+Extended+JSON

2:13 somnium: take a look at Bytes.java in the driver

2:13 alexyk: somnium: what's that JS scripting?

2:13 somnium: *maintenance-nightmare*

2:14 clojure generated js-client that posts clojure to the server which evals it

2:14 alexyk: somnium: I'm new to JS and was curious to see to what extend mongo shell supports it, and how it can be used instead of SQL

2:15 somnium: js is its native scripting lang

2:15 you can send js to eval with the java driver

2:16 I didnt put it in congo cuz its too easy to crash a mongod with it ;)

2:17 alexyk: interesting

2:17 so I guess you can get some standard JS setup for these things?

2:17 somnium: but you can do (fetch :foos {:$where "some js expression"})

2:18 not sure what you mean

2:18 cark: alexyk : hello, did you fix your permgen issues yet ?

2:19 alexyk: cark: long time ago. -XX:MaxPermSpace=1g

2:20 cark: hehe ok

2:20 i was thinking you're not using the right tool

2:20 woke up to that actually

2:20 why not put everything in a postgres/mysql database then do your stats on that ?

2:23 somnium: alekyk: you can also store map-reduce js fns in mongo, with the amount of data youre crunching ti might be a good idea

2:23 any kind of aggregation fn

2:23 alexyk: cark: it's already loading mongo... people said js is too slow for map/reduce. clojure is faster :)

2:24 but, I'll see.

2:24 cark: but keeping everything in memory, java is already memory intensive, clojure is even worse in that respect

2:24 there is a point where it must break down

2:24 alexyk: cark: I got RAM to burn

2:24 somnium: the js is calling C code though, with no tcp/ip

2:25 well, it *might* be faster

2:25 alexyk: and am using mongo for large data

2:25 somnium: indeed, worth testing... but would have to learn JS :(

2:25 cark: tsss js is easy !

2:25 alexyk: too many languages

2:25 I already use Scala and Clojure, two crazy ones :)

2:25 in the same project. Plus perl preprocessing

2:26 somnium: js is easy!

2:26 cark: that's our curse as programmers ...there is always some more to learn

2:26 and blessing too =)

2:26 somnium: its easy to generate js with clojure too

2:27 alexyk: somnium: too many dynamic ones, I begrudgingly allowed for Clojure out of curiosity for Lisp and out of respect to the elders :)

2:27 somnium: I rather dislike types except when my code is too slow :p

2:29 I love being able to write ruby-like throwaway scripts and primitive juggling encoders in the same language

2:31 alexyk: somnium: that's why I use Clojure for data mining. Scala has its fun though. Both are better than one. :)

2:32 somnium: clojurebot: tell me about scala

2:32 clojurebot: Unfortunately the standard idiom of consuming an infinite/unbounded resource as a stream can be problematic unless you're really careful -- seen in #scala

2:32 alexyk: somnium: streams and all are vastly improved in scala 2.8. very active development.

2:33 somnium: clojurebot: tell me about scala

2:33 clojurebot: scala is also<reply>"we are completely screwed on ==." -- seen in #scala

2:33 somnium: clojurebot: tell me about scala

2:33 clojurebot: {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}

2:33 somnium: thats the one :p

2:34 alexyk: clojurebot: hold hands and sing kumbaya

2:34 clojurebot: Pardon?

2:34 somnium: heh

2:34 alexyk: looks like it's French, too

2:35 * alexyk not that anything's wrong with it

2:35 somnium: clojurebot: scala |is| hold hands and sing kumbaya

2:37 I took a few stabs at scala, but it didnt grab me like clojure

2:37 maybe its a parens thing

2:38 alexyk: somnium: both have their use

2:39 somnium: what is scala better suited for?

2:39 cark: maybe is it faster due to static typing ?

2:40 somnium: is type-hinted clojure not equivalent?

2:40 cark: all function parameters are boxed in clojure, don't know how it is on the scala side

2:41 alexyk: it should be faster, and the experience of typed development is similar to OCaml or Haskell. Basically it all compiles and then runs right away.

2:41 somnium: type-hinting would still work at runtime, AFAICS

2:41 but I'm not a language guru...

2:41 cark: nope type hints when done properly are a compile time thing

2:42 alexyk: cark: good

2:42 yet in clojure type hints look ass-ugly

2:42 :)

2:42 cark: you can get very good perfs out of clojure inside a function

2:42 alexyk: yeah, my clojure speed is on par with scala's

2:43 it's all bottlenecked by mongo anyways :)

2:43 cark: but you're bounded by io are you not ?

2:43 right

2:43 alexyk: but when they parallelize mongo, it'll be another story

2:43 Clojure agents vs Scala actors shootout will occur

2:44 the fittest will survive

2:44 cark: mongo is not multithreaded ?

2:45 somnium: talk of changing type hints from #^Foo bar to Foo^bar

2:45 less perl-ugly

2:46 twbray: Am currently struggling to make Clojure WF performance competitive with Scala. Don't see any reason in principle that they shouldn't be more or less competitive.

2:47 alexyk: twbray: Scala has to be slower due to actors copying stuff, but it's faster! :)

2:47 cark: mongo will be multithreaded very soon, 1.3/4, now at 1.2

2:48 twbray: Scala is static and Martin Odersky wrote javac.

2:48 somnium: alexyk: just pray you never have cause to examine the c++ source

2:48 * alexyk nya-nya-nya... :)

2:48 twbray: What's Mongo? link plese

2:48 please

2:48 cark: http://www.mongodb.org/display/DOCS/Home

2:48 alexyk: twbray: it's a cute JSON database: mongodb.org

2:49 twbray: Oh, MongoDB.

2:49 alexyk: after you use it, BDB is old, postgres is stale, etc.

2:49 Oracle is booring :)

2:49 cark: huh

2:49 you're one of those noSQL people !

2:49 alexyk: cark: Twitter teaches you to be one.

2:49 somnium: Im trying to like to learn to like couch too, its just so easy to get stuff done with mongo

2:50 alexyk: all this kind of data, hbase, voldemort -- JVM is made for it

2:50 timothypratley: somnium: Foo^bar sounds great to me! Is that something that's been discussed before or did you just come up with it?

2:50 twbray: Cassandra Couch Voldemort Riak Redis Tokyo etc etc etc

2:50 defn: did someone say xmonad?

2:50 I miss it on OSX so much...

2:50 cark: alexyk : i guess once you go beyond 10GB databases it makes sense, but i never hit that =)

2:50 alexyk: defn: apparently you can get it on X on OSX too, no?

2:50 somnium: timothypratley: I saw Rich talking about it on the logs

2:51 * alexyk didn't try ho'

2:51 alexyk: tho'

2:51 defn: alexyk: yeah but it doesnt play nice the way xmonad plays nice with say, gnome

2:51 so it's sort of useless IMO

2:51 timothypratley: somnium: oh... cool! that's a much nicer syntax

2:51 alexyk: cark: any size. Have a hashmap, map of lists of map, -- dump into mongo, et voila!

2:51 somnium: what does OSX offor over gnome/kde?

2:51 defn: err that's not the point

2:52 cark: alexyk : age old argument, how do you do joins =)

2:52 alexyk: somnium: apples!:)

2:52 defn: the point is that xmonad doesn't support OSX the way it supports gnome

2:52 alexyk: cark: dunno yet. JS queries

2:52 twbray: somnium: Spell-checker, so it tells you "offor" is wrong

2:52 cark: alexyk : you'll be in denormalisation hell

2:52 timothypratley: defn: isn't it gnome that supports xmonad? ;)

2:52 cark: anyways, it sure is great for very big data

2:52 alexyk: cark: real world is not normal either

2:52 somnium: twbray: Ill just blame emacs erc mode

2:53 defn: timothypratley: sort of i suppose :)

2:53 somnium: cark: you can do relational queries wit mongo

2:53 just no transactions

2:54 cark: there is always something missing, ahwell that's the price to pay for scalability

2:54 somnium: its great for read heavy data crunching

2:54 and storing blg comments :p

2:55 s/blg/blog

2:55 cark: i guess that's the grumpy old man in me talking, but i like my relational databases !

2:55 they're _fast_

2:56 defn: as fast as a set

2:57 somnium: cark: you can index on anything in nosql land too

2:58 never learned advanced sql though, maybe Im missing something

2:58 cark: the one thing i don't like is the sql language itself

2:58 well it's powerfull

2:59 but not very easy to generate

2:59 no a very regular language

3:05 defn: the higher level stuff is fun, but i feel like most of the people i meet who are DB people, don't know anything about anything else

3:05 it's an annoying niché that way

4:14 j3ff86: is there a function to remove the last element of a seq? or should i just stick with (reverse (rest (reverse

4:15 _ato: ,(doc butlast)

4:16 j3ff86: nice, thanks

4:16 clojurebot: "([coll]); Return a seq of all but the last item in coll, in linear time"

4:17 _ato: there's also

4:17 ,(doc drop-last)

4:17 clojurebot: "([s] [n s]); Return a lazy sequence of all but the last n (default 1) items in coll"

4:17 _ato: which is lazy

4:21 j3ff86: aye

4:22 even better

4:56 arj_: is there a way to see all watches on a ref?

4:57 _ato: ,(.getWatches (ref 0))

4:57 clojurebot: {}

4:58 arj_: thanks

4:59 seems to be missing from clojure.org/api?

4:59 _ato: it may be undocumented on purpose, there's no Clojure wrapper function for .getWatches

5:00 (ie it might disappear in future versions of Clojure)

5:00 clojurebot: clojure is like life: you make trade-offs

5:00 arj_: :)

5:00 watches are really useful, but yeah I saw the experimental warning :)

5:00 j3ff86: I have a question about agents.. say i have a function that i send an agent, like (send agent1 function1 [1 2]). Is it possible to map the sending onto a collection like [[1 2][3 4][5 6]]?

5:02 _ato: you mean like this? (doseq [pair [[1 2][3 4][5 6]]] (send agent1 function1 pair))

5:03 or am I misunderstanding what you mean by "map the sending" ?

5:04 j3ff86: that worked perfectly

5:04 thanks for the 5th or so time!!

5:09 they should add that in the clojure book

5:10 ah nm it is hehe

6:34 moah: <F8>/part

7:58 j3ff86: is there anyway to make sure an agent finishes the function it's sent before proceeding to the next block of code, or would that just defeat the purpose of an agent?

7:59 interferon: say i have a map of string -> array pairs

8:00 is there a function (like map) that will let me apply a transformation to the values of the map, s.t. i get back a map of string -> double pairs where the keys are the same and the double is a function of each array value?

8:00 cgrand: (doc await)

8:00 clojurebot: "([& agents]); Blocks the current thread (indefinitely!) until all actions dispatched thus far, from this thread or agent, to the agent(s) have occurred."

8:00 cgrand: j3ff86: ^^

8:00 j3ff86: thanks

8:04 interferon: anyone>?

8:04 cgrand: interferon: I thought there was one in contrib but I can't find it

8:05 (#(into {} (map (juxt key (comp %1 val)) %2)) inc {1 2 3 4})

8:05 ,(#(into {} (map (juxt key (comp %1 val)) %2)) inc {1 2 3 4})

8:05 clojurebot: {1 3, 3 5}

8:06 cgrand: ,(#(into {} (for [[k v] %2] [k (%1 v)])) inc {1 2 3 4})

8:06 clojurebot: {1 3, 3 5}

8:12 thehcdreamer: hi guys. I'm a bit confused if this is the correct way to call java: (. (java.util.Calendar/getInstance) setTimeInMillis 2519863044747) what I'm trying to do is to call setTimeInMillis with argument 2151... on the Calendar/getInstance. The problem is that it returns nil, which is not what I expected

8:14 cgrand: ,(doto (java.util.Calendar/getInstance) (.setTimeInMillis 2519863044747))

8:14 clojurebot: java.lang.ExceptionInInitializerError

8:15 thehcdreamer: cgrand: it works

8:51 arj_: how exactly does one get a blocking queue with seque?

8:56 chouser: (def q (seque (iterate #(do (Thread/sleep 1000) (inc %)) 0)))

8:56 (doseq [i q] (prn i))

8:58 angerman: two macros to get a little more then (time http://gist.github.com/249022

8:58 arj_: chouser: well I want a queue where if I get an element and there is none it will block until there is one. And a simple way to add items to the queue

8:59 it seems like in the example the adding function is predefined?

8:59 chouser: arj_: thats what I just showed you. :-) the doseq blocks until each next item is available from the queue

8:59 arj_: chouser: aha

8:59 gonna try :)

9:00 ohpauleez: arj_: also have a look at fill-queue in contrib

9:01 chouser: the choice between seque and fill-queue turns mainly on how much control you have over the item-producing code. prefer seque when you can make it work.

9:01 ohpauleez: ah, thanks for the tip chouser

9:02 arj_: lol

9:02 I'm completely lots here :(

9:02 how do I add an item to the queue?

9:03 chouser: that 'iterate' is producing the items to flow into the queue

9:03 arj_: what is your code like that will produce the value?

9:03 values

9:03 arj_: chouser: I want something exactly like any collection

9:03 and acts like any collection

9:04 chouser: collections are immutable

9:04 ohpauleez: http://clojure.org/api#toc513

9:04 chouser: this queue is not

9:04 angerman: wheee. My RandomAccessReader does work.

9:04 ohpauleez: you can also make n-or-q a concurrent BlockingQueue

9:04 arj_: except that when I try to get an element without any items in, it wil block

9:04 ohpauleez: nice work angerman, I looked at the code yesterday

9:04 angerman: Here's the java class that wrappes a buffer around RAF and add's Clojures IObj capabilities to it: http://gist.github.com/249027

9:04 chouser: ohpauleez: that api page is pretty much gone

9:04 angerman: and http://gist.github.com/249025 is more "clojurey"now

9:05 chouser: ohpauleez: broken links to it still, though. :-/

9:05 arj_: ohpauleez: yeah, do you have an example?

9:06 chouser: arj_: collections are usually built up using things like (vec (map ...)). That 'map' would work as an arg to seque.

9:06 angerman: and it's fast. on avg. 2.3 seconds to run through a 160MB file. http://gist.github.com/249031

9:06 ohpauleez: thanks. Though hiredman was right, yesterday, the code was quite bad

9:06 ohpauleez: arj_: not handy

9:06 angerman: I think I was able to improve it a little.

9:07 ohpauleez: I'll take a look at it now

9:07 * angerman is off to get the laundry and then going to take a second shot at the LibSVM parser

9:07 arj_: chouser: yeah that's what I thought

9:07 so

9:07 (def a (seque []))

9:08 chouser: no

9:08 arj_: but (take 1 a) doesn't block

9:08 chouser: that's because it reached the end of the queue

9:08 tell me something about the code that will be filling the queue

9:09 arj_: I just want to create a simple producer/consumer

9:09 chouser: (seque (map inc (range 10))) would work.

9:09 or (seque (filter odd? (range 10)))

9:09 or (seque (line-seq reader))

9:10 arj_: but the values of the producer is not known beforehand

9:10 chouser: but they can be computed?

9:10 arj_: not really. Sorry let me try to explain

9:10 lets say that we have a as before

9:11 then I want to be able to conj into it like e.g. a ref to a []

9:11 and I want trying to do a take 1 to block if there a no items

9:12 chouser: but vectors are immutable, so it's just not going to be identical in structure.

9:12 it's possible to get very close. how is the value you're conj'ing going to be produced? reading from a file? applying a calculation to a previous result?

9:13 arj_: well it can come from multiple sources

9:14 I basically just want to implement a blocking-queue in clojure

9:14 chouser: you want a global stateful queue with bits of code here and there adding to it in a side-effecty way.

9:14 arj_: yes :)

9:15 chouser: you're sure I can't talk you out of that?

9:15 :-)

9:15 ohpauleez: which is not functional, so what your REALLY want is a lazy seq generated by function calls

9:15 arj_: yes

9:15 ohpauleez: those calls will block the queue until they're done, as shown by sleep example chouser made

9:16 chouser: hm, see even fill-queue won't work in that case.

9:17 ohpauleez: right

9:17 you need to reframe the problem

9:17 chouser: I think cgrand wrote a thing that would work.

9:18 arj_: where can I have a look at that?

9:18 chouser: http://clj-me.cgrand.net/2009/11/18/are-pipe-dreams-made-of-promises/

9:18 arj_: thanks :)

9:18 ohpauleez: arj_: also take a look at chouser's reply here: http://groups.google.com/group/clojure/browse_thread/thread/e8533549c290ce74

9:19 arj_: it's clojure 1.1 or head stuff?

9:20 I was actually reading that thread, but it didn't make much sense to me :)

9:20 chouser: arj_: yeah, promise/deliver is in the 'master' branch. Will be in 1.1

9:21 arj_: thanks for the help, I think I need to think about it some more

9:22 chouser: arj_: you're welcome. Don't be discouraged, this stuff is tricky to think about.

9:24 ohpauleez: since someone links the pipe code almost once daily, are we seeing that moved into contrib or core?

9:24 s/almost/at least

9:25 chouser: thread intercommunication is inherently impure, but Clojure tries to avoid side effects. Trying to combine both concepts in a single fn like seque, fill-queue, or pipe definitely stretches the brain.

9:26 ohpauleez: sounds good to me, if cgrand wants to submit it.

9:30 cgrand: pipe was a mere thought experiment but since there is demand I'll contribute it

9:31 ohpauleez: thanks a lot cgrand

9:31 chouser: you know...

9:32 cgrand: I'm not happy with the swap! trick because it retains a reference to a unused item

9:32 chouser: well, either way. I just wonder if it would be better to simply use a BlockingQueue

9:32 tmountain: anybody know if the frest function was removed or renamed at some point?

9:32 chouser: maybe wrap a lazy seq around the takes

9:33 tmountain: nm, fnext...

9:35 cgrand: chouser: I agree

9:36 chouser: also helps demonstrate the non-functional nature of what's going on.

9:39 octe: i'm having a bit of troubling understanding unquote/unquote-splicing

9:39 what does splicing actually mean?

9:39 the-kenny: ,(macroexpand-1 '(let [foo [1 2 3]] `(do ~@foo)))

9:39 clojurebot: (let* [foo [1 2 3]] (clojure.core/seq (clojure.core/concat (clojure.core/list (quote do)) foo)))

9:39 the-kenny: hm.. wrong

9:40 lisppaste8: Chouser pasted "stateful BlockingQueues in Clojure" at http://paste.lisp.org/display/91574

9:40 octe: http://paste.lisp.org/display/91573 in my mind, the macro and function should be the same

9:40 but they aren't

9:40 chouser: arj_: this is probably what (you think) you want: http://paste.lisp.org/display/91574

9:41 ohpauleez: octe: are you coming from Java or Python/Ruby?

9:41 fogus_: ,`[~@[1 2 3]]

9:41 octe: ohpauleez: both i guess

9:41 mostly java

9:41 clojurebot: [1 2 3]

9:41 ohpauleez: simply put, unquoting, unquotes something so it gets eval'd. Splicing will unpack that collection

9:42 so it'll appear like args to a function

9:42 octe: ohpauleez: hmm, then i don't understand why my macro doesn't work the same way as my function in my paste

9:42 ohpauleez: let me look

9:43 ~@more will produce 1 2 3 4. more will be in a vector [1 2 3 4]

9:44 the-kenny: ohpauleez: Try a macroexpand on your function

9:44 You will see the difference

9:44 Uhm.. I mean octe

9:44 ohpauleez: octe: ^^

9:44 it's all good

9:44 octe: ohpauleez: ohhh

9:44 so (interpose " " [~@more])

9:45 ohpauleez: or just (str ~@more)

9:45 nvm, you want spaces

9:46 octe: ohpauleez: yeah, thanks :)

9:46 i understand better now

9:47 ohpauleez: you're totally welcome

9:47 octe: if you want it to remain a list, you can just unquote it

9:47 list/vector

9:48 chouser: [~@more] or just ~more

9:48 the-kenny: unquote-splicing is especially useful for with-* macros

9:49 octe: chouser: [~@more] = vector, ~more = list?

9:50 the-kenny: octe: ~@ of a symbol holding [1 2 3] will return 1 2 3, ~ of the same symbol will give you [1 2 3]

9:50 chouser: octe: yes

9:50 octe: chouser: if i try to pass ~more as arguments to a function, it seems to interpret it as calling a function, not passing the list

9:51 chouser: octe: oh! yes of course. sorry

9:52 so [~@more] or (list ~@more) or ~(cons `list more)

9:52 octe: chouser: why is that, btw?

9:53 chouser: ,(let [more '(1 2 3)] `(interpose " " ~more))

9:53 clojurebot: (clojure.core/interpose " " (1 2 3))

9:53 octe: why is ~more considered a function call and not a list?

9:53 chouser: it is a list, at macroexpand time

9:53 but after that, the resulting form (printed above) get's eval'ed

9:53 octe: oooh

9:53 chouser: when that happens, lists are function calls unless quoted or something.

9:54 octe: so i could do '~more?

9:54 chouser: ,(let [more '(1 2 3)] `(interpose " " ~(cons `list more)))

9:54 clojurebot: (clojure.core/interpose " " (clojure.core/list 1 2 3))

9:54 * the-kenny recommends looking at the expanded code with macroexpand-1... it makes everuthing clear

9:54 chouser: ,(let [more '(1 2 3)] `(interpose " " '~more))

9:54 clojurebot: (clojure.core/interpose " " (quote (1 2 3)))

9:54 the-kenny: s/everu/every/

9:54 chouser: octe: right

9:55 octe: though '~more is not the same as ~(cons `list more) ... the latter will allow the args to your macro to be evaluated, the former will not.

9:55 octe: ah, right

9:55 noticed that

9:56 chouser: so -- depends on which you want.

9:56 djork: so I decided to use keywords for ObjC methods in my c-in-parens... (c (:setFoo x y)) -> "[x setFoo:y]"

9:57 dublindan: hey, what is the difference between -

9:57 ah

9:57 between -> and ->>

9:57 the-kenny: ,(doc ->>)

9:57 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."

9:58 the-kenny: ,(doc ->)

9:58 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc."

9:58 ohpauleez: dublindan: the first one makes it the second arg, the other one puts it in the last position

9:58 the-kenny: second item vs. last item :)

9:58 dublindan: ahhh! Thanks!

9:58 ah one word difference in the description, no wonder i missed it :-/

9:59 err two words, actually

10:13 cemerick: oh, man, the reader does push the content that couldn't be read back onto the provided PushbackReader

10:14 s/does/doesn't

10:15 angerman: ~source take

10:17 ohpauleez: ~source dosync

10:19 the-kenny: Is there a reason why clojurebot sends the url as a notice to the channel?

10:26 chouser: cemerick: really? where does it go?

10:28 cemerick: chouser: gets dropped on the floor

10:29 ,(let [r (-> "{foo" java.io.StringReader. java.io.PushbackReader.)] (try (read r) (catch Exception e)) (.read r))

10:29 clojurebot: cemerick: I don't understand.

10:29 cemerick: feh

10:29 that *should* return \{ IMO

10:29 chouser: oh, if there's a failure?

10:30 cemerick: the semantics of read in the face of a parsing error is undefined, but nevertheless

10:30 yeah

10:30 chouser: hm

10:31 you think it should unread a bunch before throwing

10:31 cemerick: yes, it should push back so the reader is where it was

10:32 chouser: I doubt it has that text anywhere. It could be a very long stream that has to be unread

10:32 cemerick: this may not be germane, given that the next-gen reader will almost certainly operate over seqs

10:32 chouser: Add an extra open paren at the top of the file, and when it gets to the end it would have to unread the entire thing.

10:32 cemerick: ach, yeah, pushbackreader requires a pushback buffer size

10:33 call me an idealist

10:33 chouser: :-)

10:35 rhickey: aargh, now I get a merge conflict when trying to bring master changes into new

10:35 version.protperties

10:35 chouser: rhickey: that's my fault

10:36 cemerick: versioning files are a constant thorn in that way

10:36 chouser: rhickey: I was hoping it would be easy for you to just throw out the changes from that one file

10:36 rhickey: chouser: if I knew git better, I imagine that's pretty easy

10:37 right now this is my first failed merge and I'm at a bit of a loss

10:37 chouser: what command do you run to merge master into new?

10:38 rhickey: I have a pile of modified files (I guess merge usually commits so I don't see this interim state)

10:38 and this error:

10:38 Automatic merge failed; fix conflicts and then commit the result.

10:38 chouser: in new, merge master

10:38 version.properties has >>>>>>>>>>> <<<<<<<<<< cruft in it

10:39 chouser: right

10:39 rhickey: just edit that away?

10:39 chouser: there's got to be a way to tell it to overwrite with one version

10:39 ohpauleez: I don't about git, but in svn and mercurial you can just rm the file and update and you'll grabbed the merged version

10:40 if you don't actually care about that file getting merged correctly

10:40 rhickey: Macintosh:clojure rich$ git checkout -- src/clj/clojure/version.properties

10:40 error: path 'src/clj/clojure/version.properties' is unmerged

10:40 the-kenny: Just fix the conflicts in the file, add the changes and commit it

10:41 rhickey: the-kenny: but is really should be unchanged, editing it back to what it was seems fraught

10:41 chouser: yeah, you want to find an easy command to fully overwrite

10:42 I was hoping checkout would work.

10:42 the-kenny: rhickey: hm.. maybe just checkout the old version?

10:42 rhickey: chouser: or unmerge or something

10:42 the-kenny: ^^

10:42 chouser: rhickey: sorry, I could have researched this ahead of time. I knew it was coming. :-/

10:42 AWizzArd: what is the goal? To come back into the state your code was in before you did the merge?

10:43 chouser: no, just overwrite a conflicting file with a version from before the commit

10:44 karmazilla: From memory: when a merge fails, you're put in a state where you have files with conflicts. Those need fixing, then add everything to index and commit. Then the merge is complete.

10:44 chouser: ok, the rm works.

10:45 ohpauleez: :) good

10:45 in the future, if there is a plugin like hg's "shelve" for git, I recommend it

10:46 let's "shelve" changes you've made not to be merged or committed currently

10:46 chouser: rm src/clj/clojure/version.properties

10:46 git checkout src/clj/clojure/version.properties

10:46 ohpauleez: so you can pull in or push changes without dealing with things that will conflict right away

10:46 karmazilla: ohpauleez: sounds like git stash

10:46 rhickey: Macintosh:clojure rich$ rm src/clj/clojure/version.properties

10:46 Macintosh:clojure rich$ git checkout src/clj/clojure/version.properties

10:46 error: path 'src/clj/clojure/version.properties' is unmerged

10:46 noidi: ohpauleez, git stash

10:47 chouser: rhickey: I just tried that. it worked here. I'll try again.

10:47 Chousuke: rhickey: you need -- I think

10:47 rhickey: Macintosh:clojure rich$ git checkout -- src/clj/clojure/version.properties

10:47 error: path 'src/clj/clojure/version.properties' is unmerged

10:47 Chousuke: rhickey: otherwise it thinks the filename is a branch

10:47 hm

10:47 ohpauleez: chouser: if you're already in a dirty merge, git most likely has stored that state

10:47 Chousuke: rhickey: -f? :/

10:48 chouser: Chousuke: no

10:48 the-kenny: isn't there a command to abort the merge?

10:49 Chousuke: just git reset

10:49 rhickey: git reset --hard ??

10:49 chouser: no

10:50 git checkout new -- src/clj/clojure/version.properties

10:51 drewolson: quick question about leiningen: do i need mvn installed to use it? lein new blah blows up and says that leiningen isn't in my classpath. i'm guessing it's a lack of local mvn repo?

10:52 chouser: rhickey: Did that work? I think you're supposed to do a commit after that, but I'm not 100% sure.

10:52 trying again.

10:53 rhickey: chouser: yes, pushing now, thanks

10:53 any better recipes for the future?

10:53 chouser: so no need to rm first.

10:53 git checkout new -- src/clj/clojure/version.properties

10:54 git commit -a

10:54 rhickey: Ideally a way to merge ignoring that file, so it succeeds directly

10:54 AWizzArd: Does reify not need a name for 'this' anymore?

10:54 chouser: after the merge fail, those two steps will finish it correctly.

10:54 rhickey: AWizzArd: read the new docs

10:55 chouser: I'd like to avoid the failure if possible

10:55 AWizzArd: not trying to be obtuse, but I'd like to know if they are clear :)

10:56 ok, latest new branch has new (final?) format for reify and deftype, also multiple arities in defprotocol no longer in list

10:56 AWizzArd: I started using reify today for the first time and read about it here: http://www.assembla.com/wiki/show/clojure/Datatypes

10:56 rhickey: docs should describe the new formats etc

10:56 AWizzArd: ah, updating that next...

10:56 angerman: ~time

10:56 clojurebot: No entiendo

10:56 angerman: ~source time

10:57 AWizzArd: ok, then I simply read the wrong docs

10:57 I got it working already by simply leaving the this-name parameter out. Thanks.

10:58 Chousuke: rhickey: are the API docs for the new branch on the web somewhere? As web pages, I mean

10:59 rhickey: Chousuke: I know Tom is working on docs for multiple branches, but not yet - use (doc reify) etc

11:00 Chousuke: looks like there is something in the gh-pages branch. hmm

11:01 apparently it's not possible to just open those in a browser. github serves them as plain text. :/

11:02 angerman: hm. maybe i should read about IO Monad or so.

11:04 anyway, my RAF interface seems to work. It's just not completely functional.

11:08 I'd like some advice about the timer and statistics macro http://gist.github.com/249022

11:24 chouser: rhickey: the version.properties file will not cause future merges of master -> new to fail.

11:25 rhickey: chouser: neat - how'd you do that?

11:26 chouser: it's inherent in how git works.

11:26 but there's a catch. a future merge of new->master is likely to set the version string in master to "new"

11:26 rhickey: chouser: ok, makes sense

11:27 thanks for looking into it

11:27 chouser: we shouldn't be storing the branch name in a checked-in file at all.

11:27 rhickey: sure. #git is helpful. :-)

11:29 cemerick: is there a fn somewhere that drains a reader into a string?

11:30 chouser: like slurp but on a reader instead of a file?

11:30 filename

11:30 cemerick: yeah

11:31 seems that should be broken out

11:31 rhickey: slurp, the protocol...

11:31 chouser: mmmm

11:32 cemerick: well, slurp is doing decoding as well -- a reader already has an encoding set.

11:32 But yes, I get your point. :-)

11:32 stuartsierra: chouser: duck-streams/slurp* will do that

11:33 KirinDave: Grr. Every library for clojure that I'm excited to use never works without significant troubleshooting.

11:33 cemerick: stuartsierra: ah, indeed, thanks :-)

11:33 stuartsierra: KirinDave: It's a young language.

11:33 chouser: KirinDave: outside of contrib, I hope?

11:33 KirinDave: chouser: Yes.

11:33 contrib works fine.

11:33 rhickey: stuartsierra: they are younger libraries

11:33 ohpauleez: KirinDave: playing with stat stuff?

11:34 KirinDave: ohpauleez: In this case no. I was trying to use enlive.

11:34 I simply cannot get it to work, though.

11:34 ohpauleez: I'm working on a project that will heavily use it, so please email the list or write a blog post

11:39 KirinDave: cgrand is in here too if you need help

11:49 jonase_: Destructuring an argumentlist (to a protocol method) does not work inside deftype. Is this correct?

11:50 chouser: jonase_: Not yet, I think.

11:50 jonase_: ok

11:50 cp2: is it just me or is github's search broken?

11:54 AWizzArd: Is there a better way to check if a java.lang.Process is still running than calling (.exitValue on-it) and see if it throws IllegalThreadStateException?

11:54 cgrand: KirinDave: need help with enlive?

11:54 the-kenny: cp2: I noticed this earlier this day. "leiningen" didn't show any search results.

11:54 cp2: the-kenny: mhm, seems to be happening with every query i try

11:54 arohner: there is no search but google

11:54 :-)

11:54 stuartsierra: What's up with th name "leiningen" anyway? Makes me think of Lenin.

11:54 cp2: arohner: yeah, but still =P

11:55 arohner: leiningen site:github.com works just fine :-)

11:55 the-kenny: Google is always an option

11:55 AWizzArd: What was the ^ reader macro doing? And btw, is there a replacement for add-classpath?

11:56 arohner: stuartsierra: there's an explanation in the leiningen readme

11:56 cgrand: AWizzArd: ^foo was (meta foo)

11:56 hiredman: http://en.wikipedia.org/wiki/Leiningen_Versus_the_Ants

11:58 stuartsierra: Ok, I get it, but it's still hard to pronounce/spell/remember.

11:58 AWizzArd: hmm, for germans it's very easy to remember I think

11:58 hiredman: yes

11:59 but its cute pun

11:59 arohner: I bet everyone will call it lein, like the executable

11:59 stuartsierra: maybe

11:59 Chousuke: I don't find it particularly difficult :/

11:59 AWizzArd: I would pronounce it pratically identical to the english word "line".

12:00 stuartsierra: If we're going for puns on Ant, I would have preferred "picnic"

12:00 cemerick: yeah, I don't think I'll ever be able to remember anything other than lein

12:00 Chousuke: then again, as a Finn I'm used to 4+ syllable words

12:00 AWizzArd: :)

12:01 Ah, this Carl Stephenson actually was a german, which explains it.

12:01 Why were ^ and add-classpath deprecated? No problem with it, I am just curious.

12:02 stuartsierra: add-classpath because it doesn't work in most environments and was a bad idea to begin with.

12:02 Chousuke: I think ^ was deprecated so that it can replace #^ at some point

12:02 stuartsierra: ^ to clear the way for replacing #^ with ^ eventually

12:03 chouser: clojurebot has been deprecating add-classpath for a long time

12:04 clojurebot: add-classpath?

12:04 clojurebot: classpath is (System/getProperty "java.class.path")

12:04 chouser: clojurebot: add-classpath

12:04 clojurebot: add-classpath is bad, avoid it. I mean it!

12:04 arohner: hah

12:04 AWizzArd: ah oki

12:06 cp2: clojurebot: botsnack

12:06 clojurebot: thanks; that was delicious. (nom nom nom)

12:17 lisppaste8: cemerick pasted "string interpolation supporting arbitrary forms" at http://paste.lisp.org/display/91588

12:17 cemerick: thoughts on above?

12:17 doesn't support nested strings of course *shrug*

12:18 chouser: cemerick: beautiful choice of syntax

12:18 cemerick: chouser: where's my heredocs?!? ;-)

12:19 KirinDave: cgrand: I'm having some trouble with enlive. Do you have a moment?

12:19 chouser: cemerick: seriously, ~() is inspired.

12:19 not sure about ~{}

12:20 cemerick: well, I definitely want a simple value replacement, but ~binding won't cut it

12:20 chouser: why not? too common?

12:20 not sufficiently distinct, visually?

12:20 cp2: leiningen is awesome :)

12:20 technomancy: hackersnack

12:21 cemerick: yeah. Seems like a lone sigil like that will need a lot of escaping.

12:21 I saw this this morning, and knew I had to finish up my interpolation impl (with blog post, of course!): http://speaking-my-language.blogspot.com/2009/12/string-interpolation-in-scala.html

12:22 Chousuke: cemerick: I think ~[foo] would be neater

12:22 cemerick: Chousuke: that's not bad

12:23 Chousuke: ~{foo} looks like a syntax error :P

12:23 clojurebot: Foo is not Baz.

12:23 cemerick: actually, ~@ might do alright, but that mixes things up with deref

12:23 eh, no, need that trailing brace

12:24 djork: ~() is awesome

12:24 clojurebot: Roger.

12:24 chouser: heh

12:24 djork: so why not ~foo

12:25 cemerick: chouser: that's a much better reason why ~binding won't work -- that's depending on trailing whitespace, when there are plenty of times you don't want whitespace after the val string

12:25 chouser: oh, sure.

12:25 djork: but then you have ~()

12:25 cemerick: e.g. This is ~username's account

12:26 chouser: ~(do 5)

12:26 clojurebot: Pardon?

12:26 cemerick: chouser: yuck

12:26 chouser: :-)

12:26 djork: hmm, yeah

12:27 I suppose there are a lot of tricky areas thanks to the flexibility of Clojure keywords

12:27 er symbols

12:28 AWizzArd: Is there a way to generate a dynamic deftype on the fly? For example when I want to have a var holding a config for a resource, then I don't want to make a deftype and only make one singleton instance holding this config. Currently I simply use {} instead.

12:29 Something like (defvar- *config* (dynamic {:port 10, :name "Some name here", :host "localhost"})) or so.

12:31 angerman: there was a fn that was the inverse of (filter ... I fail to remember the name

12:32 AWizzArd: Could be "singleton" instead of "dynamic". Results in a persistent map which has access speed of deftypes.

12:32 the-kenny: angerman: remove?

12:32 angerman: the-kenny: yes!... thanks!

12:33 is there a fn that tells me the position of a certain element in a list?

12:33 * the-kenny remembers something in c.c.seq-utils

12:34 notallama: inverse of filter? how does that work? filter isn't 1-to-1

12:34 the-kenny: angerman: c.c.seq-utils/position is almost what you want

12:35 AWizzArd: maybe instead of (filter f coll) it can be okay to do (filter (complement f) coll)

12:35 the-kenny: returns a sequence of positions where pred is true

12:35 angerman: yep, I guess calling filter on it

12:35 err first

12:35 AWizzArd: angerman: you can also use find-first which would give you the element itself, not its position

12:35 find-first === (first (filter ...))

12:36 angerman: AWizzArd: but I need the position :)

12:36 AWizzArd: k

12:36 chouser: angerman: it usually works out best to avoid using position numbers in clojure, whenever that's possible.

12:37 angerman: chouser: ok. I'll try to explain.

12:37 I have a list of numbers. (6 2 3 1 4 5)

12:38 replaca: Chosuke: (catching up) I will have doc for multple branches, but not immediately. The github uses the gh-pages branch to generate the API doc (it's the source). Unfortunately, you can have only one gh-pages branch.

12:38 angerman: assuming I'm interested in the tuple (2,3) I'd need the position of 3 in the list without 2. as well as the position of 2 in the list without 3

12:38 hiredman: ,(.indexOf '(6 2 3 1 4 5) 3)

12:38 clojurebot: 2

12:38 hiredman: angerman: :(

12:38 if you using tuples, why not just have a list of tuples?

12:39 angerman: ,(.indexOf (remove #(= 2 %) '(6 2 3 1 4 5) 3)

12:39 clojurebot: EOF while reading

12:39 hiredman: horrible

12:39 twbray: Erjang, a beam interpreter on the JVM: http://wiki.github.com/krestenkrab/erjang

12:39 angerman: hiredman: I'm starting to love it when you say that ...

12:41 hiredman: how would I improve that?

12:41 the-kenny: twbray: I found this project interesting too :)

12:42 rsynnott: Ugh, that's a terrible name :)

12:42 the-kenny: rsynnott: twbray or erjang? :D

12:42 rsynnott: erjang

12:43 * twbray snickers

12:43 the-kenny: (No offense)

12:43 sorry ;)

12:48 arohner: are there any gotchas I should be aware of when redefining deftypes?

12:48 something weird is going on

12:48 I haven't exactly narrowed it down yet, but it seems that if I redefine a deftype at the repl, the keyword accessors break

13:01 technomancy: cp2: NOM!

13:02 cp2: :)

13:06 angerman: can I ask clojure about memory useage of a var?

13:07 the-kenny: angerman: Maybe though java

13:07 *through

13:08 angerman: hmm... well :) I'll have to use the visualjvm thing then

13:08 the-kenny: angerman: But I ask myself every time someone asks this: "Why would I want to know the size of an object?"

13:09 chouser: the-kenny: to know how many I could have before I run out of memory?

13:09 angerman: the-kenny: seeing if it grew or not (e.g. if it's retaining something that the gc doesn't take)

13:09 chouser: or perhap, is representation x better than y based on: speed, memory, etc.

13:09 the-kenny: hm ok.. that's an argument. I never had to deal with so much data :)

13:10 Interesting answer on google: http://wiki.answers.com/Q/What_is_the_size_of_a_Java_object_and_how_can_you_find_it

13:10 "Most Java objects seem to be 32KB and are located under your downloaded programs."

13:10 chouser: angerman: but no, there's no solid fool-proof way on the JVM. It's a JVM question, and the usual (googlable) JVM answers apply.

13:10 the-kenny: gah!

13:12 angerman: can I map over a {} and have the fn be applied to the values?

13:12 the-kenny: angerman: I think there's a function called "values"

13:12 ,(values {:foo 42 :bar 23})

13:12 clojurebot: java.lang.Exception: Unable to resolve symbol: values in this context

13:13 angerman: the-kenny: that wouldn't help

13:13 chouser: ,(vals {:foo 42 :bar 23})

13:13 clojurebot: (42 23)

13:13 angerman: basically I would want to keep the keys and modify the values

13:13 the-kenny: Maybe a construct with zipmap if there isn't a predefined function?

13:14 chouser: ,(let [m {:foo 42 :bar 23}] (zipmap (keys m) (map inc (vals m))))

13:14 clojurebot: {:bar 24, :foo 43}

13:14 the-kenny: chouser: That's what I've meant ;)

13:14 angerman: zipmap is lazy

13:14 ?

13:14 chouser: no

13:15 it returns a map, so it can't be

13:15 angerman: ok

13:16 * the-kenny really needs paredit for the rest of osx

13:17 * angerman would be happy if his <cmd>-<c> wouldn't from time to time make a "snap" sound and "append to clipboard" instead of copy

13:18 angerman: that's the most annoying thing with os x I found. And I haven't figured how to switch it off

13:18 the-kenny: angerman: Are you using launchbar?

13:18 angerman: yep

13:18 the-kenny: I don't think it's a feature of osx, but of launchbar

13:18 angerman: does that cause it?

13:18 the-kenny: Yes, it's a feature of launchbar

13:18 an annoying one ;)

13:19 angerman: clip-merge.

13:19 the-kenny: It's called "ClipMerge"

13:19 angerman: wtf?!

13:19 I like launchbar a lot, but man that feature. It's so pointless. But it's only supposed to happen on double cmd-c

13:20 that though does not really coincide with my experience

13:21 the-kenny: angerman: I think sometimes osx is a bit overactive with the keystrokes..

13:21 (I'm not sure if "overactive" is the right word)

13:23 angerman: the-kenny: thank's so much for pointing out that LaunchBar *feature*

13:23 the-kenny: angerman: You're welcome

13:24 I was searching a long time too... I just started using launchbar with SL and I thought it was a new feature of SL

13:38 jonase_: I've been trying out the 'new branch' with a (deftype Matrix ...) implementation. I've broken my (blockmatrix ...) method and I can't find what's wrong with it. Anyone care to take a look? http://gist.github.com/234535

13:39 cemerick: OK, so I wrote up the string interpolation macro I pasted earlier: http://muckandbrass.com/web/display/~cemerick/2009/12/04/String+Interpolation+in+Clojure

13:51 AWizzArd: ,(time (dotimes [i 1000] (reify [Runnable] (.run []))))

13:51 clojurebot: "Elapsed time: 0.985 msecs"

13:51 AWizzArd: ,(time (dotimes [i 1000000] (reify [Runnable] (.run []))))

13:51 clojurebot: "Elapsed time: 100.537 msecs"

13:51 AWizzArd: impressive :)

13:51 hiredman: does clojurebot run in a client or server jvm?

13:52 hiredman: ~clojurebot

13:52 clojurebot: clojurebot is amazing

13:52 hiredman: I forget

13:52 rlwrap java -server -Djava.security.manager -cp $CLASSPATH:./clojurebot/ clojure.main -i clojurebot/hiredman/clojurebot.clj -r

13:53 rsynnott: Is there a huge difference these days?

13:53 hiredman: these days people run anything from jdk1.5 to openjdk1.7

13:54 (some people still run jdk1.3 but clojure runs on 1.5 and later)

13:55 AWizzArd: rsynnott: I can see big differences

14:04 the-kenny: Oh, I think I just found a beautiful way to map a function to every key in a map.. someone asked that here. c.c.generic.functor/fnmap is perfect for this

14:13 SergeyDidenko: hi. could anyone give advice on this: I use closures to bind some values to a general "handler" to pass it into a function - "(def draw-mark ( #(partial draw %1 %2 %3) mark-size mark-size mark-thickness ) )" . Is there more idiomatic way to do this, instead of 1.anonymous function, 2. partial, 3. call of that function?

14:18 chouser: SergeyDidenko: not quite sure. Maybe (apply draw mark-size mark-size mark-thickness) ?

14:20 SergeyDidenko: chouser: I need to pass it into another function later: see "paint-minus" ""

14:20 (def paint-minus (#(partial minus-painter %) mark-size))

14:20 (draw-mark color-disabled "images/minus-off.png" paint-minus )

14:21 I need to read the doc for apply, I think I misunderstood it.

14:21 hamza: is it possible to define a method that throws exception using gen-interface?

14:23 SergeyDidenko: Apply is almost the same as "(", so probably there is no other way

14:23 chouser: SergeyDidenko: I'm being thrown by #(partial ...) gimme a while to let it sink in.

14:25 SergeyDidenko: chouser, thanks. Another addition to make it clear, I call the paint-minus inside of draw-mark.

14:25 chouser: how is your def-mark different than (def draw-mark (partial draw mark-size mark-size mark-thickness)) ?

14:28 SergeyDidenko: chouser, thanks! That's it. I did not see that partial itself creates a closure

14:31 chouser: ok. I'm still not sure I quite understand, but I'm glad you feel better. :-)

14:33 SergeyDidenko: :)

14:35 chouser: seems like a lot of args to a function. have you considered passing around a map instead?

14:40 SergeyDidenko: chouser, that is a solution to the problem of passing different handlers into wrapper function (note the different set of parameters in handlers):

14:40 (defn wrapper[ handler ]

14:40 (first-stuff)

14:40 (handler)

14:40 (end-stuff))

14:40

14:40 (defn handler1 [size color] (...))

14:40 (defn handler2 [width height fore-color back-color] (...))

14:41 It's not beutiful to pass the different set of parameters into the wrapper function just to pass them back to handlers later

14:42 A good reason to use closures to pass that sets of parameters

14:43 (wrapper (partial handler1 some-size some-color))

14:44 well. may be it's more clear to add this:

14:44 (defn wrapper[ handler ]

14:44 (let [abinding ...]

14:44 (first-stuff)

14:44 (handler abinding)

14:44 (end-stuff)))

14:44

14:44 (defn handler1 [size color abinding] (...))

14:44 (defn handler2 [width height fore-color back-color abinding] (...))

14:45 chouser: SergeyDidenko: please use a pastebin for multi-line code snippets next time

14:45 lisppaste8: url

14:45 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

14:46 SergeyDidenko: ok

14:46 chouser: ok, I think I can see your point.

14:48 lisppaste8: SergeyDidenko pasted "wrapper and handlers" at http://paste.lisp.org/display/91598

14:48 Licenser: good morning everyone

14:48 or good evening or good what-ever-local-time-you-have

14:49 SergeyDidenko: Licenser, good evening

14:52 hiredman: chouser: how do you use zip-filter.xml?

14:52 do I need to actually know the nested tag structure to pull out an element?

14:53 (whatever I do zip-filter seems to return infinite results and makes rlwrap explode)

14:57 Licenser: I was wondering the following. Clojure is great to harnes the power of a multi core CPU due to it's easy ways for working with threads and things alike. Now I wonder is there a equally beatuiful way to work with multiple CPU's or even multiple hosts?

14:57 leafw_: Licenser: checkout terracota

14:58 Licenser: leafw_: thank you but I'm not looking for pottery

14:58 sorry for the bad joke

14:59 * Licenser googles

14:59 Licenser: thanks for the hint ;)

14:59 clojurebot: for is not a loop

15:00 SergeyDidenko: Licenser: map-reduce frameworks?

15:00 Licenser: SergeyDidenko: just generlly the ability to 'run one clojure program on the combined power of more then one JVM'

15:01 rhickey: AWizzArd: dynamic deftype ===> reify

15:02 SergeyDidenko: Licenser, Terracotta then. Though I think there can be pretty big delays because of blocking nature of Terracotta.

15:02 Licenser: *nods*

15:02 stuartsierra: Terracotta is the only transparent solution, not necessarily the best.

15:03 SergeyDidenko: Licenser, CouchDB is similar in some aspects to Clojure STM though it's not very optimal

15:03 stuartsierra: You've got dozens of options for spreading work across multiple machines: RabbitMQ, Hadoop, ...

15:03 SergeyDidenko: Also CouchDB has some limitations - I read it can do only one level of map-reduce

15:04 Licenser: My current thought is, I've this nice server sadly (or fortunately) the Solaris OS implements a very smart taks sceduler that keeps threads on one CPU if possible. So starting 1 JVM I'd mostly only use 1 of the 4 CPU's for short 'bursts' of computation which means performance loss

15:04 AWizzArd: rhickey: oh good, thanks

15:05 leafw_: Licenser: on designing software for a specific through generic hardware, such software goes obsolete fast.

15:06 s/through/though/

15:06 Licenser: so if I could fire off a few JVM's one per CPU and then share work more or less evenly on them it'd give a performance boost for computations. I did some testing with JRuby (I know it's not clojure bot the JVM&OS will behave pretty much the same I'd expect) and I learned that it makes a huge difference if you share work on 4 instances instead of 4 times the threads

15:07 for JRuby you can use DRuby with gives a mostly transperent view on the problem of tasking more the one interpreter instance

15:08 SergeyDidenko: Licenser, I would try Terracotta then. It's not like you have a few JVMs in different parts of the world, they are very close in your case

15:08 Licenser: And before someone says it this is not going to be a attempt to complain about clojure and say how cool ruby is - it is just that I made this epxerience with ruby

15:08 SergeyDidenko: *nods

15:08 *

15:08 then I'll give that a try

15:09 chouser: hiredman: you can use 'descendents' if you don't want to be explicit about each level of the hierarchy

15:09 SergeyDidenko: Licenser, it's pretty raw yet. See my mail discussion with Paul Stadig "Clojure & Terracotta - TIM"

15:09 Licenser: Thanks for the advice, I'll dig in that too

15:10 AWizzArd: à propos hardware, cores and speed... here is a talk, about self improving AI from the Stanford University. It's one hour, but you can just go minute 20 and listen a few minutes. http://www.youtube.com/watch?v=omsuTsOmvsc&fmt=18

15:10 SergeyDidenko: Licenser, I had no time yet to try to fix it on Windows, but it worked on Linux

15:10 Licenser: for me it's purely scientific at the moment I just want to see what toos I've at hand

15:10 SergeyDidenko: I don't care for windows :P I'll run Solaris

15:10 SergeyDidenko: Licensor, I mean Solaris is not Linux too

15:11 Licenser: yes but it's closer to linux then windows, a lot closer

15:25 hiredman: http://github.com/hiredman/odds-and-ends/blob/master/newegg.clj <3 clojure and tagsoup

15:42 akuaku: clojurebot: paste

15:42 clojurebot: lisppaste8, url

15:42 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

15:43 chouser: ugh. glad that's over.

15:44 The API links on clojure.org should all be working again, point to the new api doc pages.

15:44 let me know if you notice any that are broken.

15:47 arohner: wow, where did clojure.inspector, clojure.stacktrace, come from? apparently I haven't been paying attention

15:47 cemerick: been there for a *long* time

15:49 lisppaste8: akuaku pasted "should that be allowed?" at http://paste.lisp.org/display/91611

15:51 akuaku: been playing with Protoclos, and ive noticed that you could make a minimal protocol which could be the basis for a larger protocol

15:52 this only works when extending the protocol interface however, doesnt work on the protocol itself

15:52 just wanted to ask if this is stupid/dangerous

15:53 drewr: what does larger mean?

15:53 could it just be a different protocol?

15:53 akuaku: yes

15:54 but the idea is to provide base implementations

15:54 and another protocol to make a richer interface

15:54 like traits in scala

15:54 chouser: rhickey: you are summoned

15:54 * chouser doesn't know if that works

15:55 drewr: I'm not familiar with traits, but if you're wanting protocol inheritance, that's not going to happen

15:55 akuaku: it works, but is a hack

15:55 seems bad to use the java interface

15:55 Chousuke: akuaku: I think that works just accidentally :/

15:56 akuaku: the question is if that should work

15:56 or should be forbidden

15:56 Chousuke: it would require special logic to forbid though.

15:57 somnium: perhaps declaring it as *evil* would suffice?

15:57 Chousuke: yes. :)

16:00 I guess the problem is not all things implementing protocol P will work with bar

16:01 akuaku: i was just thinking how one would express "everything that satisfies Sequable also satifies Reversable by default"

16:01 in a clojure-in-clojure setting

16:01 Chousuke: akuaku: I think you would just provide a mixin map of default implementation

16:01 and pass it to extend

16:01 implementations*

16:02 chouser: akuaku: from my (as yet weak and fragile) understanding, it's considered fragile to say such things

16:02 also, fragile fragile

16:02 akuaku: because you're making assumptions about concrete things that may be defined later.

16:03 Chousuke: I guess could have something like (def reversible-on-seq-mixin {:reverse (fn [o] (seq-stuff o))})

16:03 lisppaste8: hamza pasted "exception" at http://paste.lisp.org/display/91612

16:03 hamza: guys, is it possible to define a interface for this with a signiture that says it throws a exception..

16:06 akuaku: it feels

16:06 wrong to me, but currently reverse depends on the collection to be an ISeq

16:07 so it is kind of similar

16:07 hamza: ~def gen-interface

16:12 duper: Any other LISP dialects I don't know about?

16:13 the-kenny: duper: http://www.lrde.epita.fr/~didier/software/smilisp.php

16:26 MikeDev: Okay. Question. How does one use request?

16:27 chouser: what's "request"?

16:27 MikeDev: one moment

16:27 the-kenny: the function from clojure-http-client?

16:27 MikeDev: compojure.http.request

16:28 but clojure-http-client might work for me too

16:28 i just need to be able to req foreign URLs

16:29 compojure's request is annoying in that u would have to split up the host and URI

16:29 the-kenny: MikeDev: If you just want to get the data from an url without special adjustments, you can just use slurp* fro m c.c.duck-streams

16:29 MikeDev: but if I could get it to work, i'd be happy

16:29 michaeljaaka: ,( + 2 4 )

16:29 clojurebot: 6

16:29 michaeljaaka: (doc filter)

16:29 clojurebot: "([pred coll]); "

16:30 michaeljaaka: ,(doc filter)

16:30 clojurebot: "([pred coll]); "

16:30 alexyk: so I saw that there's a talk of making type hints more beautiful, like Type^var or var^Type -- I'd *love* that, and so other 5 million people!

16:30 michaeljaaka: how to get doc of filter?

16:30 (doc filter)

16:30 clojurebot: "([pred coll]); "

16:30 MikeDev: c.c.duck-streams?

16:30 the-kenny: michaeljaaka: There isn't

16:30 MikeDev: is that an abbrev?

16:30 the-kenny: MikeDev: clojure.contrib.duck-streams

16:30 michaeljaaka: (doc +)

16:30 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0."

16:30 MikeDev: yeah okay

16:30 * MikeDev is a total newbie

16:31 michaeljaaka: (doc map)

16:31 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

16:31 the-kenny: MikeDev: You're welcome :)

16:31 michaeljaaka: There isn't any doc for filter in my repl either. I assume there isn't any

16:31 chouser: michaeljaaka: huh! filter seems to have no docs

16:31 * MikeDev bows before the-kenny and kisses his ring

16:31 michaeljaaka: ok, thx

16:32 MikeDev: o is that your library

16:32 I dont know that I wanna use contrib, but will check it out

16:32 the-kenny: MikeDev: clojure.contrib is a library made by many people.. but there's no code from me there ;)

16:32 MikeDev: contrib is very very helpful

16:32 michaeljaaka: (doc remove)

16:32 clojurebot: "([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns false. pred must be free of side-effects."

16:33 the-kenny: It's like boost for C++ :)

16:39 alexyk: how do you flush stdout and stderr?

16:39 arohner: chouser: I have docs for filter. I'm on (or near) head of new

16:40 the-kenny: alexyk: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/flush

16:40 ,(flush)

16:40 clojurebot: nil

16:41 alexyk: the-kenny: and what if I want to flush System/err?

16:41 without making it *out*

16:41 the-kenny: alexyk: Take a look at the source of flush. Just call the java method .flush on your stream

16:42 alexyk: the-kenny: ok

16:43 MikeDev: slurp doesnt seem easier than request

16:43 the-kenny: MikeDev: Why?

16:43 (slurp* is the thing you want, as it works with urls)

16:44 (take 3 (slurp* "http://google.de"))

16:44 ,(take 3 (slurp* "http://google.de"))

16:44 clojurebot: java.lang.Exception: Unable to resolve symbol: slurp* in this context

16:44 MikeDev: :use clojure.contrib.duck-streams

16:44 (:use clojure.contrib.duck-streams)

16:45 the-kenny: MikeDev: It's just use in a function call

16:45 ,(use clojure.contrib.duck-streams)

16:45 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.duck-streams

16:45 MikeDev: (use clojure.contrib.duck-streams)

16:45 the-kenny: ,(use 'clojure.contrib.duck-streams)

16:45 clojurebot: nil

16:45 the-kenny: ,(take 3 (slurp* "http://google.de"))

16:45 clojurebot: java.security.AccessControlException: access denied (java.net.SocketPermission google.de:80 connect,resolve)

16:45 the-kenny: Heh, that was clear

16:45 MikeDev: o i thought i needed some filereader

16:46 the-kenny: slurp* chooses internally the right reader for your type of url/file/anything else

16:52 MikeDev: sweet

16:52 that was exhausting

16:52 I've been trying to figure that out for hours now

16:53 * MikeDev needs to lie down for a minute or two

16:56 angerman: finally I think I got clojure to crunch away on huge files.

16:57 still the api, is not so nice... :(

16:59 MikeDev: Hey, I'm trying to do this:

17:00 http://pastie.org/728219

17:00 and it gives me

17:00 Chousuke: you have an extra '

17:00 MikeDev: java.lang.Exception: lib names inside prefix lists must not contain periods (exercises.clj:0)

17:01 but it works on the cmd line

17:01 the-kenny: MikeDev: Just do (:use compojure clojure.contrib.duck-streams)

17:01 Chousuke: MikeDev: the use function is not the ns :use

17:01 the-kenny: (In one (:use), I'm not sure if it's valud with two :use)

17:01 Chousuke: MikeDev: the :use arguments don't need to be quoted

17:01 MikeDev: k

17:04 somnium: in the ns macro (ns foo (use c.c.bar) (import j.u.Klass)) executes fine. is there a reason for the keyword convention?

17:05 (it just seems to conguse people)

17:05 s/conguse/confuse

17:05 polypus: don't you mean conjuse people

17:05 somnium: thats it

17:06 the-kenny: Is there a good emacs-package to refactor clojure code?

17:06 somnium: (still struggling with a dvorak experiment)

17:07 MikeDev: how to do regexps in clojure?

17:08 jasapp: ,(doc re-find)

17:08 clojurebot: "([m] [re s]); Returns the next regex match, if any, of string to pattern, using java.util.regex.Matcher.find(). Uses re-groups to return the groups."

17:08 the-kenny: MikeDev: #"yourregex" will return a java.regex.pattern

17:08 s/p/P/

17:10 ataggart: can anyone confirm a branch of contrib that compiles using the "new" branch of clojure?

17:11 somnium: the contrib new branch?

17:11 ataggart: tried and failed

17:11 [java] Caused by: java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V

17:11 lots of those

17:11 the-kenny: ataggart: You have to do a "ant clean" before you build contrib

17:12 ataggart: k

17:12 the-kenny: clojurebot: RestFn

17:12 clojurebot: It's greek to me.

17:12 the-kenny: ~clojure.lang.RestFn

17:12 clojurebot: ant clean and rebuild contrib

17:12 the-kenny: :)

17:17 ataggart: [java] Caused by: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol

17:17 [java] at clojure.core$ns_resolve__5000.invoke(core.clj:2849)

17:19 MikeDev: ,(doc re)

17:19 clojurebot: Titim gan éirí ort.

17:19 MikeDev: i dont need to find

17:19 alexyk: anybody else supports prettier type hints? is there a plan for them?

17:19 MikeDev: i just need to know yes/no

17:19 as in $Blah =~

17:20 the-kenny: MikeDev: re-match or something like this

17:20 ,(doc re-match)

17:20 clojurebot: Huh?

17:20 the-kenny: ,(doc re-matches)

17:20 clojurebot: "([re s]); Returns the match, if any, of string to pattern, using java.util.regex.Matcher.matches(). Uses re-groups to return the groups."

17:20 the-kenny: MikeDev: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/re-matcher

17:20 hiredman: alexyk: deprecating ^ as a reader macro fro (meta ...) is on the list for 1.1, and it needs to be done before ^ can be safely repurposed

17:21 alexyk: ah ok, so at least the train is in motion

17:21 the-kenny: How can I access "this" in a proxy-method?

17:21 MikeDev: i wish it would say what it returns if FAIL

17:22 nil?

17:22 j3ff86: say i have 2 agents, and im doing (await agent1) (await agent2), why would (map await (list agent1 agent2)) not work correctly?

17:22 the-kenny: MikeDev: Just try it in a repl :)

17:23 j3ff86: Generally said: Because map is *lazy*

17:23 somnium: http://java.ociweb.com/mark/clojure/article.html

17:23 ataggart: map is lazy

17:23 I win!

17:23 somnium: ^^ is a good free guide to the api

17:23 j3ff86: ah ok

17:24 ataggart: note for anyone that cars, master branch of contrib compiles fine with "new" branch of clojure, once running ant clean.

17:24 j3ff86: is there a none lazy way to do map?

17:25 the-kenny: j3ff86: (doall (map ...))

17:25 j3ff86: thanks

17:26 ataggart: or dorun

17:26 j3ff86: which is better?

17:28 alexyk: how do I import << from http://muckandbrass.com/web/display/~cemerick/2009/12/04/String+Interpolation+in+Clojure into another namespace?

17:28 ataggart: it did for a while, didn't it?

17:29 MikeDev: ([m] [#"http://.*" "httpS://www.google.com"])

17:29 ,([m] [#"http://.*" "httpS://www.google.com"])

17:29 clojurebot: java.lang.Exception: Unable to resolve symbol: m in this context

17:29 MikeDev: ,([re-matches] [#"http://.*" "httpS://www.google.com"])

17:29 clojurebot: java.lang.IllegalArgumentException: Key must be integer

17:30 MikeDev: ,([re-find] [#"http://.*" "httpS://www.google.com"])

17:30 clojurebot: java.lang.IllegalArgumentException: Key must be integer

17:30 MikeDev: ,(re-find [#"http://.*" "httpS://www.google.com"])

17:30 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.util.regex.Matcher

17:30 * the-kenny just started getting RejectedExecutionExceptions for slime-furry-expand with the latest java-update for osx ;(

17:30 the-kenny: :(

17:30 ataggart: why do you have brackets around the fn name?

17:30 mike

17:30 MikeDev: because i'm retarded

17:30 hiredman: yeah

17:30 the-kenny: MikeDev: If you going to try much things, you should do it local on your own pc

17:30 MikeDev: ok

17:31 eaier here because repl doesnt do backarrow or uparrow

17:31 alexyk: can one launch a clojurebot on a private channel for clojure hacking from internet cafes?

17:31 hiredman: clojurebot repsonds to private messages

17:31 the-kenny: MikeDev: Run it with rlwrap or use emacs or a plugin for another ide :)

17:32 hiredman: and clojurebot is on xmpp clojurebot@thelastcitadel.com

17:32 huh

17:33 alexyk: hiredman: lovely. now we can say. "get a room with clojurebot, will ya?"

17:33 hiredman: clojurebot isn't on xmpp right now

17:33 alexyk: what's xmpp?

17:33 hiredman: jabber

17:33 alexyk: ah...

17:33 arohner: isn't there a WeakReference wrapper floating around somewhere, or did I imagine that?

17:34 alexyk: MikeDev: IDEA hs a lovely La Cojure plugin, and is free now:)

17:34 angerman: hiredman: I did incorporate your suggestions from yesterday. http://gist.github.com/249422 does it look better now?

17:34 MikeDev: msging closurebot works well, and yes it gives nil when none found

17:35 btw I kinda know ML

17:35 alexyk: so back to import, I want to import cemerick's << which he did as defmacro in his ns. How do I import that? '<< ?

17:36 hiredman: angerman: what is with the (in-ns 'clojure.contrib.duck-streams)

17:36 MikeDev: When I have problems, I will swear at closurebot in pm

17:36 will be cathartic

17:36 angerman: hiredman: for me, that's the place where I expect it mentally. Apart from that nothing.

17:37 hiredman: so you are monkey patching this function into that namespace?

17:37 angerman: yes. Because I set out to find that functionality there. But didn't.

17:38 Though I know that that should be changed.

17:38 somnium: alexyk: loading the file and (use 'commons.clojure.strint) doesnt work?

17:39 alexyk: somnium: nope

17:39 the-kenny: hm... looks like lein-swank is bugged :(

17:40 somnium: alexyk: what doesnt work?

17:40 angerman: hiredman: I added support for the Obj Interface to the BufferedRandomAccessReader too. So it could hold metadata.

17:41 alexyk: somnium: my IDEA loaded it into repl with: (load-file "/Users/alexyk/twitter/mongol/draft/strint.clj") => #'commons.clojure.strint/<<

17:41 now if I do the use above, I get: java.io.FileNotFoundException: Could not locate commons/clojure/strint__init.class or commons/clojure/strint.clj on classpath: (NO_SOURCE_FILE:0)

17:42 somnium: you need to add the file to your classpath

17:42 alexyk: well I'm in darn repl already! can I rename it within repl? :)

17:43 somnium: in netbeans you would drop it in a library, something similar in idea?

17:43 MikeDev: i like fugde repl

17:43 technomancy: the-kenny: it needs to be updated to use eval-in-project from the latest... I plan on fixing that tonight.

17:43 the-kenny: technomancy: Ah, nice :)

17:44 I'll just stick to lein repl manually invoking (swank.swank/start-repl) now

17:44 alexyk: somnium: my question is, this works: (commons.clojure.strint/<< "There's ~(seq (range n 90 -1)) bottles of beer on the wall...")

17:44 I simply wonder whether I can yank a name into the current namespace in repl, in general

17:44 or in other scripts

17:45 somnium: ah, becuz its not on classpath, but try (alias '<< 'commons.../<<)

17:45 alexyk: i.e. rename without reimporting -- I guess I can do defmacro << {something using f.q.d.n./<<} -- oh I see

17:47 somnium: (alias '<< 'commons.clojure.strint/<<)

17:47 java.lang.NullPointerException: Expecting Symbol + Namespace (NO_SOURCE_FILE:0)

17:53 * angerman likes jvisualvm

17:58 somnium: alexyk: (defmacro << [& blah] `(commons.../<< ~@blah))

17:59 after this I give up

18:01 ataggart: is emacs a nonstarter if one is not a touch-typist?

18:01 somnium: ataggart: you can enable the toolbar

18:03 angerman: somnium: 8-)

18:03 ataggart: if you *want* a mouse driven env. emacs is probably not for you.

18:04 ataggart: angerman: it's not so much want as not being a touch-typist.

18:05 I'll try it regardless. Again. I think this will be my 5th attempt at getting emacs.

18:05 angerman: ataggart: in my opinion, you have to want to use the keyboard way more to utilize emacs or vim effectivly.

18:05 technomancy: ataggart: if I didn't know Emacs and didn't know touch-typing, I would prioritize learning touch-typing over learning Emacs

18:06 and I really like Emacs

18:06 ataggart: fair enough

18:07 * angerman waits for this job to finish and... ~4min to go.

18:09 angerman: computing the average weights of a LibSVM Model file with 45000 features on 250 samples took "Elapsed time: 1063192.462 msecs" hmmm.

18:10 if I add agents in the mix and up the mem for the stack, that could go faster I think

18:11 at least, that's what I think the graph tells me

18:11 http://skitch.com/angerman/nk8hb/java-visualvm

18:12 Licenser: angerman: I'd give out the blind guess that the profiling took a good bit of the performance for tiself

18:12 ohpauleez: angerman: yeah, user agents, arrays, and ints/floats where you can

18:13 angerman: Licenser: sure. But I think it's a memory problem too

18:13 Licenser: 50M does not seem too much to me

18:14 angerman: Licenser: no, I mean the memory that the JVM is allowed to use

18:14 Licenser: ah okay sorry

18:14 angerman: maybe I'm reading that graph wong

18:14 Licenser: well you could just give it more memory

18:15 no clue it seems to spend a lot of time in the GC, giving it more memroy might really help

18:15 angerman: but it looks like the jvm is caped at ~80M Heap space or so. So the GC goes nuts.

18:15 Licenser: java 1.5 or 1.6

18:15 angerman: 1.6 os x

18:15 (_not yet_ having installed the latest update from yesterday or so)

18:15 Licenser: hmm hmm odd

18:15 kylesmith: Is there a function like read-string that reads everything (not just the first item)? Or, is there a function that will return how many characters were consumed from read-string?

18:15 Licenser: do you start the jvm with any parameters?

18:16 angerman: and it's just driving one CPU hot. So at least a second agent should help

18:16 Licenser: no. lein swank, and then call from emacs

18:16 Licenser: hmm it might pass arguments to the JVM

18:16 angerman: yep, but I know where to look for performance gains now :)

18:17 Licenser: java 1.6 is supposed to smartly guess what are the best settings for you so you don't have the effect you see - at least that is what I understood when reading up on it

18:17 _ato: kylesmith: the only way I can think of is to use a StringReader: (java.io.PushbackReader. (java.io.StringReader. "(foo)(bar)"))

18:17 angerman: and it finally works, I can work with clojure and files of a few hundret megs without running into out of mem exceptions.

18:17 MikeDev: does anyone have an example of if/else in code?

18:17 _ato: and then keep calling read on it until you run into EOF

18:17 or

18:17 actually

18:18 alternatively, just wrap whatever you're reading in parens

18:18 Licenser: make a lazy read seq!

18:18 _ato: ,(read-str (str "(" "(read)(things)(reading)" ")"))

18:18 clojurebot: java.lang.Exception: Unable to resolve symbol: read-str in this context

18:18 _ato: ,(read-string (str "(" "(read)(things)(reading)" ")"))

18:18 clojurebot: ((read) (things) (reading))

18:18 angerman: Licenser: well if I only had to read a sequencelly and only apply a simple function to it... yes that could have worked

18:18 kylesmith: ato: that might work. let me see..

18:18 angerman: anyway.

18:18 -> bed

18:18 Licenser: night angerman

18:19 _ato: ,(if (= 1 1) :yes :no)

18:19 clojurebot: :yes

18:19 hiredman: MikeDev: http://github.com/richhickey/clojure/blob/master/src/clj/clojure/core.clj#L61

18:19 _ato: ,(if (= 1 2) :yes :no)

18:19 clojurebot: :no

18:23 MikeDev: yep, k

18:23 arohner: lisppaste8: url

18:23 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

18:23 MikeDev: aw sweet

19:42 j3ff86: is there a version of the split-at function that always splits in the middle of a function?

19:43 i mean collection

19:44 i wrote my own but just wondering if theres something simpler

19:44 ataggart: nope

19:44 there's also the question of where the middle is in an odd sized coll

19:44 j3ff86: yeah

19:45 thats what my function does

19:45 cases for odd and even sized collections

19:45 ataggart: (split-at (/ (count coll) 2) coll)

19:47 I've been playing with emacs for all of an hour and my left hand is killing me

19:48 clearly the designers of the macbook keyboard thought ctrl would not be an oft used key

19:48 tomoj: my mac has cap lock = ctrl

19:49 ataggart: hmm I'll give that a shot

19:50 tomoj: there's a setting for it somewhere in system preferences

19:50 ataggart: yep

19:50 easy

19:51 Chousuke: I actually made cmd control for emacs

19:51 and caps lock is meta

19:51 it works pretty well

19:51 j3ff86: i hate laptops with the fn and ctrl keys switched

19:52 ataggart: can I just tell emacs to use different keys for C- and M- ?

19:52 Chousuke: ataggart: yes

19:52 ataggart: that's what I do. I have caps lock mapped to control normally.

19:52 ataggart: which control is used more M or C?

19:53 hiredman: (you could just use vim)

19:53 Chousuke: ataggart: C

19:54 ataggart: chousuke: thx

19:54 the-kenny: Yes C. M is almost only used for M-x some-command

19:55 ataggart: hiredman: my main motiviation for even bothering is because so many seem to be using emacs-related stuff.

19:55 the-kenny: ataggart: Emacs is the nonplusultra lisp-editor

19:56 ataggart: if technomancy et al. can use it for remote pair programming, it seems useful enough to learn

20:26 interferon: is there an aggregator of clojure blogs, something like Planet Lisp or Planet Gnome?

20:26 tbatchelli: not exaclty and aggregator, but there is disclojure.org

20:32 metvop: anyone know how to get Waterfront IDE to find contrib? Using windows and have clojure-contrib jar sitting sitting on the C:\ drive.. I'm playing around with this thing and it's nice and lightweight. If only I can get it to find contrib. I have the same problem with Clojurebox, but not looking to delve into that right now..

20:41 interferon: is there any way to make clojure's error traces less opaque? will clj-trace do that?

20:47 alexyk: liebke: incanter may be called ClojuR :)

20:48 liebke: hehe, true but I think there are enough *jure names already :)

20:51 alexyk: liebke: so I see you get R datasets and refer to R analogs. Perhaps a thorough translation table would be useful for those who know R?

20:51 is the dataframe in incanter a map with first pair being column names and next the rows?

20:51 liebke: I have thought about it

20:51 yes

20:52 alexyk: liebke: did you see plyr in R?

20:52 liebke: I've looked at it a bit, cool stuff

20:53 alexyk: liebke: yeah... apparently group-by can be used similarly

20:54 there's also ggodi from R, perhaps we can hook it up as well

20:54 basically we need to steal everything off http://had.co.nz/ :)

20:55 * alexyk ponders rewriting incanter in Scala... :)

20:56 * alexyk not yet :)

20:57 alexyk: one-liners with S-exps really shine here

20:57 liebke: alexyk: why don't you port plyr to Incanter instead :)

21:08 michaeljaaka: hi

21:08 why I get output onto screen instead into file

21:08 http://gist.github.com/249509

21:08 anyone can help?!

21:09 cark: first there are missing parenthesis around your map fomr

21:09 but it's completely wrong anyways

21:09 michaeljaaka: well I just removed it just to try another option

21:09 with paenthiesis won't work too

21:09 cark: right

21:11 try binding *out* to your stream

21:11 then jèust use println as you would to output to screen

21:12 hamza: http://nakkaya.com/2009/11/01/clojure-persistence-for-java-programmers/ check this out, it explains what you are trying to do..

21:13 cark: something like this : (with-open [w (writer "c:\\a.a")] (binding [*out* w]) (println "coucou1"))

21:15 alexyk: liebke: I have to produce some data-mining graphs ASAP to prove I'm doing work, not just playing with Clojure and incanter. So that's the first order of the day! :)

21:15 cark: or better : (with-out-writer (writer "c:/a.txt") (println "coucou"))

21:15 michaeljaaka: hmmm

21:15 this works ok

21:15 liebke: alexyk: hehe

21:15 michaeljaaka: but when repleacing println "xx"

21:15 with

21:15 (map println seq)

21:16 then stops to work

21:16 cark: ,(doc map)

21:16 clojurebot: "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."

21:16 cark: map returns a lazy sequence

21:17 michaeljaaka: ok

21:17 alexyk: liebke: I guess the weird R row names are lost in translation?

21:17 michaeljaaka: so how to write sequence?

21:17 doseq ?

21:17 or what?

21:17 liebke: yeah, no R row names yet

21:17 cark: (doseq [i [1 2 3]] (println i))

21:17 michaeljaaka: ok :)

21:18 going to try

21:19 alexyk: liebke: can be an optional :row-names=>[names] pair in the dataframe map, or go as last element into each row

21:19 thus providing compatibility

21:19 michaeljaaka: wowoowowm works, thanks cark

21:19 cark: michaeljaaka : map is usefull when you want the result of your operation, there is no result with println

21:20 actually there is a nil but not very usefull =)

21:20 michaeljaaka: cark: now I'm going to replace dorun map with doseq

21:20 liebke: alexyk: yeah, I would just add :row-names to the dataset map

21:20 michaeljaaka: in many places

21:21 cark: =)

21:23 hum there should be a do-map function

21:23 or something like it

21:25 hiredman: (comp vec map)

21:25 cark: ^what if you're not interested in the result ?

21:25 or maybe do-each would be a better name

21:25 hiredman: uh

21:25 cark: (do-each println [1 2 3 4])

21:25 hiredman: doseq

21:26 (doseq [i [1 2 3 4]] (println i))

21:26 cark: right but there is just that bit more syntax with doseq

21:26 alexyk: liebke: how do you produce doc/api/index.html with all doc strings?

21:26 hiredman: (comp (constantly nil) vec map)

21:27 cark: inefficient !

21:27 liebke: alexyk: look at the bin/generate_docs.clj script

21:27 michaeljaaka: do-map is ok

21:28 alexyk: liebke: perhaps you can git mv src/incanter src/main/clojure/incanter for default maven compatibility, tests, and future src/main/scala? :)

21:28 michaeljaaka: is more idomatic to map

21:28 cark: michaeljaaka : if you have many places where you do use doseq, it means you're using lots of side effects

21:28 liebke: hehe, the future build tool for Incanter will be Leiningen, not Maven :)

21:29 cark: michaeljaaka : i usually build lists or vectors then only doseq at the end

21:29 michaeljaaka: cark: yes I do

21:29 alexyk: then a pom.xml is easily added and it's mavenized => 1-click import into IDEA. Well, not to worry, pom.xml will drop in there, src is configurable... :)

21:29 michaeljaaka: hmmm, maybe I could, but I'm just beginer

21:30 cark: michaeljaaka : so it's a good time to learn good practices ! makes for easier to test programs

21:30 alexyk: I found, after painfully learning maven for Scala, that it really begins to pay for itself with more JVM languages.

21:30 liebke: Leiningen can generate a pom.xml using 'lein pom'

21:30 alexyk: If you're in Scala, you can use SBT, and in Clojure Leiningen, but if you have both and also Java, Maven starts to sit pretty.

21:31 liebke: true

21:35 slyrus: liebke: I read that as lein porn and was waiting for some good screenshots...

21:35 liebke: :)

21:38 * alexyk reads lein as lenin

21:39 slyrus: so is anybody working on a persistent datalog for clojure?

22:27 polypus: i'm trying out clojure mode in emacs and C-c v which is supposed to eval buffer is evaling the buffer as elisp

22:27 not as clojure. but some of the other key bindings are working right

22:27 cark: c-c c-l

22:28 polypus: thx that works. any idea why evaling straight from the buffer doesn't?

22:29 cark: sorry i don't know that

22:29 people are using slime which has it

22:29 clojuremode is good enough for me =)

22:30 polypus: i'm just trying out slime for the first time now

22:31 isn't slime just a repl into another process? can you eval buffers with slime?

22:31 _ato: polypus: C-c C-k will eval the buffer

22:31 cark: yes you can, thoi don't remember how

22:32 -i

22:32 _ato: or well that compiles it

22:32 duper: hi, I just discovered clojure.. any other popular LISP dialects with sizable freenode channels I should know about?

22:32 _ato: there's an M-x slime-eval-buffer

22:32 duper: or Scheme

22:34 _ato: polypus: C-h b will give you a list of all the key bindings bindings. You may like to bind some yourself, eg I bind swank-clojure-project to C-c C-o and slime-quit-lisp to C-c C-q

22:35 so you could bind C-c v to slime-eval-buffer if you want

22:35 notallama: i like to idle in #haskell sometimes. it's not a lisp, but it will work if you add parens like it was. :p

22:35 polypus: _ato: thx, seems like the M-x slime-eval-buffer is the fastest. and thx 4 other tips

22:38 cark: c-c c-k to compile and load

22:38 _ato: duper: elisp is probably one of the more popular lisp dialects so #emacs :-P

22:41 DeusExPikachu: so I checked the IRC logs for why clojure is not on the computer language shootout and found no satisfactory answer. At best I have a link https://alioth.debian.org/forum/message.php?msg_id=181551 of someone thinking clojure is just another lisp. I think the biggest reason to include it is to brag about the conciseness and its use of immutable and persistent datastructures. Thoughts?

22:42 JAS415: the code you have write to win benchmark games ends up being ugly

22:44 _ato: DeusExPikachu: well the answer is probably just that nobody has bothered entering it

22:48 hamza: java bencmarks are pretty much usesless they are over before hotspot gets a chance to optimize your code.

22:48 then there is the startup time, compared to c and what not

22:49 DeusExPikachu: hamza, http://shootout.alioth.debian.org/u32q/help.php#dynamic they tried adding a steady state version

22:50 alexyk: is there a way to add a jar to a repl without restarting? it's important for me as repl stores huge datasets I need to visualize with incanter, but it was started before I've become incanter-aware!

22:52 hamza: c'mon, run a 1000 times and average startup out

22:52 hamza: DeusExPikachu: btw check this out, it is a long discussion about bencmarks in java http://blogs.azulsystems.com/cliff/2009/09/java-vs-c-performance-again.html

22:53 _ato: alexyk: (add-classpath "file:///some/file.jar") but beware it's not reliable (eg loading JDBC drivers with add-classpath will not work)

22:53 alexyk: _ato: I hope incanter is safer than jdbc... let's see

22:54 DeusExPikachu: hamza, that's a good discussion, but regardless of whether the test is "flawed" I feel like we should just post it anyways, I'm reading the stuart book, maybe as an exercise I'll write them and submit them but theirs quite a few and to be convincing it might be best if all of them were submitted in short succession

23:24 alexyk: liebke: incanter fails to build unless X window system is available

23:25 liebke: alexyk: hmm... can you email the error to liebke@gmail.com?

23:25 alexyk: ok, 1 min

23:28 done

23:30 compiling from there with ssh X forwarding enabled works and launches X on my mac. bizarro!

23:31 just defining DISPLAY=:0 was not enough, it had to be real

23:32 liebke: can I specify X11 DISPLAY from within REPL somehow?

23:32 liebke: strange... I didn't realize the build would be dependent on X. It looks like it's Processing

23:32 alexyk: how do we setenv from repl?

23:32 yep

23:32 liebke: from the repl? Not that I know

23:36 alexyk: liebke: you may want to define the final claspath into a variable in bin/clj, not to copy it in the final if branches

23:36 liebke: good idea

23:46 alexyk: how do you inspect classpath from repl?

23:58 _ato: ,(System/getProperty "java.class.path")

23:58 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)

23:58 _ato: that probably won't show stuff that's been added with add-classpath though

23:59 ~def add-classpath

Logging service provided by n01se.net