#clojure log - Jun 09 2009

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

0:51 replaca: wow, I just hacked slime to use pretty print and it's *really* nice :-)

0:55 but not very fast -> more motivation to improve performance!

1:06 mrsolo: pp feels slow

1:10 replaca: mrsolo: it is pretty slow -> about 150 lines/sec on my machine

1:10 i'm working on making it faster

1:11 mrsolo: nice.. i use it a lot :-)

3:35 cgrand: ~seen quidnunc

3:35 clojurebot: quidnunc was last seen quiting IRC, 1959 minutes ago

3:40 frodef: I'm learning clojure and trying to figure out the zip/zipper function, but can't seem to get it to work as expected ..

3:41 hiredman: what are you trying to do?

3:41 frodef: If I apply zipper to e.g. (zip/seq-zip [:a :b [:c :d] :e]), it seems to me that the branch? function isn't ever called.

3:42 hiredman: well

3:42 that is a vector

3:42 and you are calling seq-zip

3:42 ,(doc clojure.zip/seq-zip)

3:42 clojurebot: "([root]); Returns a zipper for nested sequences, given a root sequence"

3:42 frodef: ah, so a vector isn't a squence then..?

3:42 hiredman: ,(doc clojure.zip/vec-zip)

3:42 clojurebot: "/;nil; "

3:43 hiredman: frodef: nope

3:43 frodef: thanks

3:43 hiredman: you can turn a vector into a seq easily, and a lot of functions do it implicitly

3:45 frodef: hiredman: maybe even seq-zip? I seem to get the exact same behavior with vector-zip.

3:45 hiredman: frodef: how exactly are you calling it?

3:46 ,(-> [:a [:b :c] :d] clojure.zip/vec-zip)

3:46 clojurebot: java.lang.Exception: No such var: clojure.zip/vec-zip

3:46 hiredman: ,(-> [:a [:b :c] :d] clojure.zipper/vec-zip)

3:46 clojurebot: java.lang.ClassNotFoundException: clojure.zipper

3:46 frodef: (zip/zipper (fn [x] (println "hello world") true) ... ... (zip/vector-zip [:a :b [:c :d] :e]))

3:46 vector-zip, no?

3:47 hiredman: no

3:47 maybe

3:47 yeah, vector-zip

3:47 but you don't call zip/zipper

3:47 frodef: naming could be more consistent.. :)

3:48 hiredman: zipper is if you want to make your own zipper creating function

3:48 vector-zip is pre-made

3:48 ,(-> [:a [:b :c] :d] clojure.zip/vector-zip)

3:48 clojurebot: [[:a [:b :c] :d] nil]

3:48 hiredman: ,(require '[clojure.zip :as zip])

3:48 clojurebot: nil

3:49 frodef: hiredman: I'm just using vector-zip as an easy way to get a zip object to pass to zip/zipper.

3:49 hiredman: ,(-> [:a [:b :c] :d] zip/vector-zip zip/next zip/next)

3:49 clojurebot: [[:b :c] {:l [:a], :pnodes [[:a [:b :c] :d]], :ppath nil, :r (:d)}]

3:49 hiredman: frodef: you don't pass zip objects to zip/zipper

3:49 vector-zip returns a zipper

3:49 ,(-> [:a [:b :c] :d] zip/vector-zip zip/next zip/next zip/node)

3:49 clojurebot: [:b :c]

3:50 frodef: ah, of course..

3:50 I somehow had the idea that zipper was for mapping one zip to another.

3:51 hiredman: thank you for helping.

3:51 hiredman: a zipper is a nifty method for tree traversal and editing

3:53 ,(pl (↕map range $ 3 inc)))

3:53 clojurebot: (1 2 3)

3:53 hiredman: pl uses a zipper to edit s-expressions

3:53 ,(macroexpand '(pl (↕map range $ 3 inc))))

3:53 clojurebot: (do ((flip map) (range 3) inc))

9:57 rhickey: anyone thinking about how to use GWT with Clojure?

9:58 Chouser: I tried to run src/jvm through it once. That didn't turn out so well.

9:59 Since it consumes java sources when producing javascript, I've pretty much just written it off.

9:59 rhickey: c-in-c -> java source -> gwt ...?

10:00 Chouser: seems likely.

10:00 asbjxrn: c-in-c ?

10:01 rhickey: clj-in-clj

10:01 Chouser: clojure's current src/jvm uses a bunch of classes that are off-limits for gwt, but that sort of thing ought to be *easier* to fix via c-in-c than manually fixing up hand-written .java.

10:01 rhickey: clinj?

10:02 Chouser: as in "that clinj's it!"?

10:03 asbjxrn: when most of the clojure compiler is written in clojure (instead of in java as it is now), it'll be easier to add new target languages.

10:03 asbjxrn: Got it.

10:04 Chouser: I suppose you ought to be able to try gwt's "hosted mode" from clojure, but I certainly haven't done that.

10:05 rhickey: ick - how will we generate this:

10:05 private native void setPayload(String val) /*-{

10:05 this.payload = val;

10:05 }-*/;

10:06 Chouser: hehe. that's not so much "c-in-c -> java source -> gwt" as it is just "c-in-c -> gwt source"

10:07 it'd be so much easier if I just loved writing java code.

10:08 rhickey: right - clinj->gwt would be bypassing the advantages they wanted to get in GWT by using Java - refactoring, type checking etc

10:10 Chouser: oh, I didn't mean trying to generate the gwt .js directly -- that stuff is scary. I just meant the gwt-java target might not have all that much in common with the regular java target.

10:11 I don't know if you'd get much benefit out of refactoring support, but that'd give you hosted mode with type checking.

10:11 aravind: rhickey: I looked at it, gwt, but was scared away by all the java in there. my quest for the perfect web framework is still unfulfilled. I started looking for ways to port weblocks into clojure, but that depends on so many cl libraries, it seemed like a daunting task.

10:11 Chouser: still not good debugging support, at least not all the way back to the .clj code.

10:12 rhickey: Chouser: I understand, just meant we only get some of the GWT benefits, but there is lots of desirable tech in there

10:13 aravind: it just upsets me that anyone should have to write any code to generate boiler plate html. GWT seems like its a subset of the ideas in weblocks from what I understood.

10:13 Chouser: yeah, the deployed apps look awfully nice, and I trust Google's support of all the browsers.

10:14 pre-clojure I was completely uninterested in compiling anything to javascript because I just didn't see anything (java included) as being enough better than js to be worth the trouble (debugging generated code, etc.)

10:15 rhickey: aravind: GWT does a huge amount of very practical and important things, abstracting away JS, CSS, browser differences, testability, debugging, communications, minimization, image spriting, browser modularization etc etc

10:16 It was nice to see they actually used it themselves for the wave client

10:18 Chouser: yeah, I was waiting a bit for that -- they weren't using for gmail or their other "office" apps, as far as I could tell.

10:19 aravind: rhickey: yeah, the base of it seems to be that you operate on widgets and provide callbacks that act on these widgets. I feel that even tha is not going far enough. Why should I have to provide those callbacks. Afterall the whole point of a webapp is to display and manipulate data. CL's weblocks takes that widget idea to its fulfillment. It is based on widgets as well, but you define those widgets in CL, and it depends on having getter setter methods

10:21 I guess, I am just mad that I can't have weblocks in clojure :(

10:21 rhickey: aravind: widgets are the smallest part of the problem, IMO

10:22 aravind: I probably don't see the whole picture then.

10:23 asbjxrn: When writing a wrapper for a java api, would you use the enums defined in the API, or translate to keywords? I find keywords feel more clojury myself.

10:25 While performance is not an issue in my current project, for things like the opengl wrappers it could be. Would a keyword lookup be measurable at all?

10:27 Chouser: asbjxrn: if you have to look up a keyword in a map to get the enum value at runtime, that'll cost something. Maybe not enough to matter, but something.

10:27 I sometimes use macros to do that kind of lookup at compile time instead.

10:30 asbjxrn: Yea, in my current case I have the enums in a hashmap, with the enums as they key and the keyword as the value.

10:31 So obviously a hash lookup would be made.

10:32 triddell: rhickey: With GWT, I've used clojure/compojure to focus on the server-side piece initially (which I know may be obvious and wasn't the topic of your earlier discussion on GWT.) Writing basic JSON/REST services with compojure and persisting data in the app engine data store took an amazingly small amount of completely generic clojure code though.

10:32 Chouser: I've got a macro in one project that does a lookup at compile time and throws an exception if nothing is found. This helps catch typos early.

10:33 rhickey: triddell: but you used GWT for the front-end?

10:35 triddell: rhickey: yes... and it was just a proof-of-concept in this case. I mostly was interested in the clojure server-side.

10:36 asbjxrn: chouser, That would be for use within the library itself? In my case I'm getting midi events and translating things like ShortMessage/CONTINUE to :continue so the user of the wrapper would see that as the midi event type. Not sure if a macro is relevant there?

10:37 Chouser: asbjxrn: ah, sure -- that's got to be done at runtime. I was talking about passing in keywords.

10:37 (.fictionalMethod obj (flags :foo :bar))

10:48 rhickey: is there any reason a transaction couldn't be shared by multiple threads?

10:58 rhickey: Chouser: when would it end?

10:59 Chouser: when told to, I suppose.

11:00 rhickey: it would be a big change

11:00 Chouser: Oh, how could it possibly be retried!? nm.

11:01 rhickey: I think it is cleanest to have the transactional thread do all ref interop, but you can spawn threads for calculation

11:01 Chouser: I was thinking of passing around a snapshot view of the ref universe.

11:01 Drakeson`: ,1010b

11:01 clojurebot: Invalid number: 1010b

11:01 Chouser: ,2r1010

11:01 clojurebot: 10

11:01 rhickey: Chouser: the beauty of refs is that there are multiple simultaneous universes

11:02 Drakeson`: thanks

11:31 ctdean: What are people using for simple distributed programming? Wondering if there is a consensus.

11:32 stuartsierra: "simple distributed programming" is an oxymoron

11:33 ctdean: ok, lol. How about small scale distributed systems. on the order of 10 nodes

11:33 I can always roll my own with http, thrift, etc. That's what I've done in the past

11:33 stuartsierra: ctdean: I use Hadoop, which is very good but only suitable for certain tasks.

11:35 drewr: stuartsierra: Curious, do you use straight HDFS or an abstraction on top of it?

11:36 stuartsierra: HDFS

11:36 drewr: I've been experimenting and I'm about to load a butt-ton of data into it.

11:37 I think hbase is too immature for me.

11:37 stuhood: i'd definitely recommend trying pig/hive/cascading first, before you work directly with the hadoop api

11:38 drewr: I've wrapped the bare api with clojure and it's still pretty nasty.

11:46 Drakeson`: what does this mean: No matching method found: toString for class java.lang.Integer

11:46 duck1123: is it possible to define a method for a multi-method from within a different namspace?

11:46 Drakeson`: trying to: (.toString 9 2)

11:47 drewr: Drakeson`: It means there is no method named toString on Integer that takes an Integer as an argument.

11:47 duck1123: i think it's because that's like calling 9.toString(2)

11:47 drewr: ,(.toString 9)

11:47 clojurebot: "9"

11:47 ctdean: ,(str 9)

11:47 clojurebot: "9"

11:48 drewr: ,(str 9 2)

11:48 clojurebot: "92"

11:48 Drakeson`: is 9.toString(2) different than toString(9,2) ?

11:48 drewr: What are you trying to accomplish?

11:48 (Yes, to answer your q.)

11:49 duck1123: ,(map #(.toString %) '(9 2))

11:49 clojurebot: ("9" "2")

11:49 Drakeson`: How does one call http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Integer.html#toString%28int,%20int%29 in clojure?

11:50 replaca: ,(Integer/toString 9 2)

11:50 clojurebot: "1001"

11:50 drewr: Ah, static method.

11:50 replaca: yup

11:51 drewr: Couldn't figure out where he was going with that.

11:52 ctdean: I was just reading about the clojure meetup after javaone. The author mentioned Swarmli. anyone know what that is?

11:52 drewr: ctdean: http://olabini.com/blog/2009/06/the-clojure-meetup-and-general-geekiness/

11:53 Drakeson`: replaca: thanks.

11:54 is there any circumstance that someMethod(x,y) is equivalent to x.someMethod(y), in java? (like python)

11:54 stuartsierra: no

11:55 drewr: ctdean: It hasn't shown up on IRC before, FWICT. http://www.google.com/cse?cx=004621955734675372103%3A0oxuogeollc&ie=UTF-8&q=swarmli&sa=Search

11:55 duck1123: it would be possible, but the author would have too write it that way

11:55 Drakeson`: stuartsierra: thanks.

11:56 ctdean: drewr: yep, thanks. just wondering about it

11:59 integrity: is there any clojure goodness wrapping java reflection api for dealing with java classes?

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

12:02 Chouser: integrity: http://paste.lisp.org/display/67182

12:02 something like that?

12:07 replaca: ctdean: the right name is Swarmiji

12:08 ctdean: replaca: aha! thanks

12:08 replaca: ctdean: it's a project being done by Amit Rathore and Tim Dysinger and Technomancy (Phil Hegelberger (sp?)) are working with him to make it open source

12:09 ctdean: it might be what you're looking for - very easy to distribute compute jobs through function-like interface, monitor them and retrieve results

12:09 no implicit data model (like map-reduce)

12:10 drewr: I remember that now from Amit's blog.

12:12 http://www.google.com/cse?cx=004621955734675372103%3A0oxuogeollc&ie=UTF-8&q=swarmiji&sa=Search

12:12 stuartsierra: For my presentation tonight: where would you put Vars in the mutable-types diagram? (coordinated/independent and asynchronous/synchronous)

12:13 This one: http://tinyurl.com/mllzc4

12:14 rhickey: stuartsierra: var bindings are not shared, you'd need another dimension for that

12:14 stuartsierra: that's what I thought

12:15 rhickey: synchronous/unshared, implying no coordination needed

12:15 stuartsierra: ok, thanks

12:15 * rhickey will see you later

12:15 stuartsierra: cool

12:20 duck1123: ok, I think I'm missing something. How do I test the type of a struct-map. I thought it would be isa?, but I can't seem to get it to work.

12:20 stuartsierra: duck1123: struct-maps aren't types. You can add a key or metadata to indicate a type.

12:22 duck1123: stuartsierra: that sucks. I was hoping that info would've been stored somewhere

12:57 cemerick: oh, my -- slurp doesn't accept an encoding, and uses a FileReader (!!!!!)

12:58 stuartsierra: c.c.duck-streams/slurp* uses a *default-encoding*

12:58 cemerick: using default encoding ==> fail

12:58 stuartsierra: I mean *default-encoding* is a var that you can rebind.

12:59 cemerick: right -- but having slurp sit there as it is is *really* bad.

12:59 Chouser: what encoding is worth mentioning besides utf-8?

13:00 * Chouser wonders if he should duck now.

13:00 stuartsierra: A ton of stuff is still ISO-8859-*

13:00 mrsolo: yes my copy of clojure book is here

13:00 man it smells bad

13:00 cemerick: besides that....I'll introduce you to a couple of my Japanese friends and the old cobol system integrators that need to work with ebcdic

13:05 technomancy: (doc as-str)

13:05 clojurebot: "clojure.contrib.java-utils/as-str;[[x]]; Returns the name or string representation of x"

13:15 rhickey: Did anyone see the LWN article on Clojure?

13:16 stuartsierra: no!

13:16 rhickey: http://lwn.net/Articles/335966/

13:16 I'm not a subscriber

13:16 stuartsierra: Bah, me neither.

13:17 Chouser: two more days

13:18 "Vala supports modern language features as the following... Foreach"

13:20 Chousuke: :P

13:20 * Chousuke is a subscriber

13:20 Chousuke: http://lwn.net/SubscriberLink/335966/6e9d1e30bb6a0b16/ here

13:21 LWN's subscriberlink feature is really neat.

13:21 Hun: yeah, it gives you an actually working link.

13:21 Chousuke: They just trust their subscribers not to rip off their content.

13:21 stuartsierra: nice

13:23 Chousuke: no artificial DRM or anything. :)

13:23 Hun: if i can read it, i can rip it off.

13:23 so drm would be useless

13:24 Chousuke: yeah

13:25 They actually allow you to post subscriber links on mailing lists etc. as well. They only ask you not to do that with every article. :)

13:27 cemerick: rhickey: hope you don't mind the random bug report on slurp. Encoding issues are just near and dear to my heart.

13:32 mrsolo: hmm httpagent barfs when i tried to compile

13:32 stuartsierra: mrsolo: it"s not finished yet

13:33 mrsolo: ok

13:36 stuartsierra: not sure why it's doing that, tho

13:37 oh, found it

13:38 fixed, thanks

13:38 mrsolo: nice

13:39 technomancy: usually when people have unfinished libs they don't put them straight into contrib. =)

13:39 stuartsierra: Eh, it works (now), wanted to let people see it.

13:40 technomancy: yeah, it just contributes to the "contrib is just a bucket of code; anything goes" notion.

13:40 mrsolo: hmm

13:41 stuartsierra: Yeah, I kind of like that notion.

13:41 mrsolo: at least compiles i hope...

13:41 duncanm: any SLIME users around?

13:41 stuartsierra: yes

13:41 technomancy: duncanm: sure

13:41 stuartsierra: technomancy: I suppose we could branch contrib, make a formal release.

13:42 mrsolo: i like that noting those to be of more *cough* quality release

13:42 duncanm: technomancy: i'm using an app that has a custom Clojure REPL built-in to it - i'd like to be able to connect to that app using Swank, are there any guides out there for doing that?

13:42 technomancy: stuartsierra: I think that's a good idea, provided it's a quality release and works with clojure 1.0.

13:43 duncanm: you should be able to load swank and start a listener from within the app, but I don't know of any docs explaining how to do that.

13:43 duck1123: contrib probably won't get good releases until it's broken up. (like apache commons)

13:44 stuartsierra: Well, still needs some clean-up, maybe leave out a few less-developed libs.

13:44 duck1123: duncanm: I run a swank server from within my compojure app

13:44 I've posted instructions on how to get it running to the compojure ml

13:46 duncanm: duck1123: is there a URL?

13:46 duck1123: one sec

13:46 stuartsierra: technomancy: I don't have time to lead the charge right now; maybe in a few weeks.

13:47 technomancy: stuartsierra: any specific area you'd like help with?

13:48 stuartsierra: General organization, naming, apis.

13:49 duck1123: duncanm: It's not thee greatest, an I think I should be using an agent to do it right, but since it was only supposed to protect against re-evaluation of my source, I wasn't too concerned.

13:49 duncanm: http://groups.google.com/group/compojure/browse_thread/thread/a4708c9bdb780cbc/2f63267744aa8731

13:57 replaca: stuartsierra, technomancy: also maybe new code should be developed outside contrib (say on github or whereever) and added to contrib once it's reached a certain level of maturity. That way, folks can see it and comment participate while it's under development, but they can count on the things in contrib to some extent

13:57 technomancy: replaca: I quite agree.

13:57 stuartsierra: replaca: I'd rather just separate contrib into "stable" and "sandbox" areas.

13:57 replaca: stuartsierra: why?

13:58 stuartsierra: One less thing to keep track of.

13:58 replaca: stuartsierra: shouldn't you have your own sandbox for stuff under development?

13:58 duck1123: or a clojure.extras, where any code that has a dependency other than clojure's dependencies would go

13:58 stuartsierra: why? Lots of open-source repos have a sandbox.

13:59 Back in the day, before github, nobody had their own repository.

13:59 technomancy: I don't understand why the sandbox should be centralized. Seems like a throwback to ye olde days.

13:59 replaca: stuartsierra: yeah, that was back in the day

13:59 Chousuke: technomancy: it'd get a lot more attention that way

14:00 stuartsierra: Basically, I've already got a github acct. that I use for work.

14:00 clojurebot: github is git://github.com/kevinoneill/clojure.git

14:00 duck1123: "when I was your age, we had to connect to the server just to see what we changed."

14:00 technomancy: Chousuke: once it achieves some level of stability/quality and needs attention, it can be promoted.

14:00 my random experiments have little if anything to do with yours

14:01 Chousuke: technomancy: the sandbox could be a good place for new additions to contrib that haven't seen much real use yet.

14:01 stuartsierra: yes

14:01 replaca: I'm with technomancy on this one. contrib is (currently) at least a very visible part of the system

14:01 Chousuke: then eventually things would migrate to the actual contrib namespace

14:02 technomancy: look, a sandbox => http://github.com/languages/Clojure/updated

14:02 =)

14:02 Chousuke: the thing is, when you import a clojure.contrib.sandbox.foo, you will know it's somewhat experimental, but that it will appear in contrib someday

14:03 Like this, the sandbox wouldn't be free-for-all. That's what github is for :)

14:03 replaca: I wonder if we should decide what will appear in contrib while it's still experimental

14:03 technomancy: Chousuke: I agree it's better than keeping experimental libs in contrib itself, no question there.

14:03 * technomancy checks the "recently updated clojure projects" page in github on a regular basis. have found a lot of interesting stuff there.

14:04 replaca: Chousuke: it would only be a free for all for committers!

14:04 technomancy: yeah, that's a big issue; it creates stratification between those blessed with commit rights and the rest of the rabble.

14:04 replaca: but I can't object to that too much as long as it's clearly separated

14:04 Chousuke: Maybe putting your lib into .sandbox could be taken as a "promise" that you will make it into something workable

14:04 replaca: technomancy: again, I'm with you

14:05 Chousuke: yeah, but why?

14:05 there are plenty of ways to share code that's "not ready for prime time"

14:05 duck1123: the bottom line is contrib should always at the very least compile

14:06 replaca: duck1123: no, stuff should work

14:06 Chousuke: replaca: that's not what .sandbox would be for. It'd be more like "I think this is fine, but it needs more usage testing"

14:06 stuartsierra: yes

14:06 replaca: duck1123: otherwise newbies (or just regular users) get frustrated

14:06 mrsolo: the entire contrib is pretty small right now i don't mind to take all of it

14:06 not sure this will stay this way

14:06 Chousuke: replaca: and .sanbox would be a convenient "incoming" box for contrib; people would see new libraries appear in it and possibly test them.

14:06 replaca: Chousuke: that's really different than "experimental"

14:07 * technomancy is not a fan of the idea that there's an aristocratic class of contrib committers

14:07 mrsolo: also yes for us newbies there is no quality measurent of 'oh this is dead..not to use this etc'

14:07 replaca: or "just beginning development"

14:07 mrsolo: but i don't like committe either.. will get politicial sooner or later but hey it should at least compile :-)

14:07 Chousuke: replaca: if you're just starting with the lib, then I think it should stay outside contrib completely

14:09 replaca: I agree with both Chousuke and technomancy

14:09 I'm not opposed to a sandbox for things that are "almost ready"

14:09 Chousuke: regarding the committer issue, I don't think there's a way around that.

14:10 since you can't allow just anyone to put stuff in contrib. people need at least a CA :/

14:10 mrsolo: ability to comment toward libray on wiki page will be nice

14:10 duncanm: duck1123: and which files/jars do I need to have in the classpath?

14:10 replaca: Chousuke: agreed but that doesn't mean that committers should treat contrib completely as their private source code control

14:11 Chousuke: true.

14:11 Chouser: last time I asked about where to put work in progress, everyone told me contrib was fine -- gotta put it somewhere...

14:11 replaca: Chousuke: so committers should treat their "status" with some delicacy

14:11 Chousuke: SVN makes this more of an issue than it should be ;P

14:12 replaca: Chousuke: well, with git we could have "private" branches to play with

14:12 that would be nice just for evolving stuff that's alredy in

14:12 duck1123: duncanm: you need to have the swank-clojure lib on your classpath

14:12 replaca: *already

14:12 Chousuke: with *any* DVCS everyone has their own repo, so "committers" wouldn't be tempted to just check in their work in the contrib repo when they think it's ready.

14:13 replaca: (sorry, didn't mean to be git-specific :-))

14:13 Chousuke: I personally don't mind, I'm a fan of git. :)

14:13 but there are some mercurial-people around I think :P

14:13 replaca: in any case, gotta run. see you all later

14:38 cemerick: duncanm: FWIW, we use enclojure's REPL library extensively, and it works very well. I know you're using slime, but I thought I'd toss that out there.

14:46 duncanm: cemerick: i'm using fiji, and fiji has its own repl implementation

14:46 cemerick: so are you saying enclojure is yet another implementation of a REPL?

14:46 cemerick: i want to use SLIME because i'm typing everything else in emacs ;-P

14:47 Hun: you could also use comint-run with a wrapper script if connecting to slime is too hard

14:47 though comint is far less cool

14:48 duncanm: so i first need to build a jar file for swank

14:48 i don't see a build script in the github page

14:48 technomancy: you can just jar up the swank-clojure dir; it doesn't need AOT

14:48 cemerick: duncanm: enclojure adds clojure support to NetBeans, and yes, it provides its own REPL impl.

14:49 I just thought I'd mention it in case you weren't tied to emacs :-)

14:53 duck1123: duncam: I have a fork of swank that uses maven to produce a jar

14:54 I haven't pushed it out yet, but I could if you're interested

15:05 I'm experiencing an issue where I've modified a library (clj-record) that uses a macro to define functions in the current namespace. I'm trying to modify one of the defn's so it wraps the return value with metadata. If I start it up, I don't get any metadata, but when I re-eval the macro call, I get the metadata attached. Any idea what's going on?

15:07 duncanm: technomancy: to jar up swank-clojure, i should just take the swank directory as the base, right?

15:10 duck1123: duncanm: yes

15:12 technomancy: duncanm: no, I think you need the project root as the base

15:13 since swank/core.clj provides the namespace swank.core

15:16 duncanm: duck1123: where is IGNORE-PROTOCOL-VERSION from?

15:17 duck1123_: swank.swank

15:17 duncanm: hmm

15:18 how do i view the classpath again?

15:18 duck1123_: http://gist.github.com/126735

15:20 technomancy: ,(System/getProperty "java.class.path")

15:20 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)

15:20 technomancy: oh snap!

15:21 duncanm: sigh, it returns a string?

15:21 technomancy: there's something in contrib for getting it more sanely

15:22 duncanm: i don't think i have access to contrib with this REPL

15:22 hmm, so swank is in the classpath

15:22 (.contains cp "swank") => true

15:23 so now i need to load it in?

15:23 do i use LOAD?

15:24 stuartsierra: duncanm: maybe require

15:24 duncanm: aha

15:24 duck1123_: duncanm: if you use the gist I just posted, you can (net.mycyclopedia.swank/init)

15:26 duncanm: Caused by: java.lang.Exception: Unable to resolve symbol: with-bindings in this context

15:26 but i did (require '(clojure.main))

15:27 duck1123: then you would have to use clojure.main/with-bindings

15:28 duncanm: wait, so i need to fully-qualified all the names?

15:28 aha

15:28 now my problem is, on Windows, there's no /dev/null

15:28 duck1123: clojure.main isn't automatically refered, that's why I use it the way I do

15:29 duncanm: i tried that NS form, but it didn't work

15:31 aha

15:31 duck1123: I suppose you could replace "/dev/null" with the location of a file. (nil might work, but I haven't tried that)

15:33 duncanm: duck1123: according to Google, "NUL" works

15:33 so nice, i got it working now

15:33 * duck1123 claps

15:33 duncanm: the only nitpick is that my slime versions are mismatched

15:33 stuartsierra: Apache Commons IO defines a NullWriter

15:34 duck1123: I have that same problem, I haven't figured out how to get around that one yet

15:52 wrt my macro question, I cleaned then re-built and now it's working

16:02 duncanm: this is very nice, having the REPL to my app be available inside emacs

16:02 duck1123: do you have any code for tearing down the swank connection?

16:03 duck1123: duncanm: I just kill " *cl-connection*"

16:04 any other way will kill your app

16:04 dnolen: slime-kill-repl works as well

16:05 duncanm: duck1123: i mean, doing it from the app-side, in Java, say

16:05 so right now, i made it pop up a dialog, but it's not actually tied to anything

16:06 duck1123: duncanm: no, I couldn't find anything to do that.

16:32 cemerick: hrm, can't use #^chars to type hint character arrays...though #^"[C" does work.

16:35 stuartsierra: Yes, chars isn't a type

16:35 opqdonut: gah, i didn't know about the #^" type of type hints

16:36 hiredman: stuartsierra: but most primitives have something like "bytes" you can use to hint an array

16:36 Chouser: I keep trying to forget, and generally succeeding.

16:36 opqdonut: hiredman: actually, there is no bytes

16:36 at least in 1.0

16:36 cemerick: yeah, #^chars really should be included, as well as #^bytes

16:36 hiredman: I was pretty sure there is a bytes

16:36 cemerick: I think these nicer array hints were added alongside the unchecked math stuff, so those omissions make sense.

16:36 mrsolo: memoize rocks :-)

16:38 hiredman: ,#^bytes (into-array Byte/TYPE (map byte (range 10)))

16:38 clojurebot: #<byte[] [B@14b1dbf>

16:38 Chouser: chars and bytes both work for me in 1.0

16:38 ,(expression-info '(let [x #^bytes (make-array Byte/TYPE 0)] x))

16:38 clojurebot: {:class [B, :primitive? false}

16:38 Chouser: ,(expression-info '(let [x #^chars (make-array Byte/TYPE 0)] x))

16:38 clojurebot: {:class [C, :primitive? false}

16:39 hiredman: ~def c.l.Compiler

16:39 Chouser: cemerick: what makes you think #^chars isn't working?

16:39 hiredman: http://code.google.com/p/clojure/source/browse/trunk/src/jvm/clojure/lang/Compiler.java?r=1382#880

16:40 cemerick: Chouser: I was trying to eliminate reflection on a particular call, and it didn't immediately work with #^chars, but eventually I got it to work with the string variant. I'll double-check.

16:47 jonafan: what do you guys think about grand central dispatch

16:49 hiredman: jonafan: I think it is mac only

16:50 jonafan: not really, it's just a thread pool with closure support in objective c

16:51 hiredman: I think SEDA(http://www.eecs.harvard.edu/~mdw/proj/seda/) is similar

16:51 technomancy: in practice nobody uses objective C on free platforms though.

16:52 hiredman: and SEDA is old news, there was a usenix paper in '03 comparing seda queue&event architecture to using threads

16:53 jonafan: okay but it could be easily implemented in any language

16:53 hiredman: (using threads directly)

16:53 technomancy: if someone went back in time to assassinate bjarne stroustrup, things could be different, but given the current state of things I find it difficult to care.

16:54 hiredman: http://www.usenix.org/events/hotos03/tech/full_papers/vonbehren/vonbehren_html/index.html

16:54 "Why Events Are A Bad Idea (for high-concurrency servers)"

16:55 jonafan: so, not impressed?

16:56 Chouser: If I had to write high-level apps in Objective C, I imagine I'd be *very* excited about it.

16:56 Or even in C++, a similar solution would be better than none.

16:57 But Java by itself already gives you most of those features, doesn't it, if only at a per-process level: blocking queues, thread pools, etc.

16:58 jonafan: so you're saying that apple is playing catch up as far as these features are concerned

16:58 dnolen: jonafan: I do some Objective-C/Cocoa programming, i think it's great for that.

16:58 hiredman: I think apple is making a lot of hype for something not very hype worthy

16:58 technomancy: jonafan: it's more that it's totally irrelevant to me. I care about as much as I care about new advances in yachting technology.

16:58 dnolen: it's good to see other solutions to lockless concurrent programming

16:58 Chouser: you slap some Clojure closures on that and you've pretty much arrived. Then sprinkle on the agent abstraction, refs, transactions, etc...

16:59 hiredman: I mean, it's neat, but it is not the completely revolutionary game changer that apple declares everything to be

16:59 jonafan: i agree with hiredman

16:59 dnolen: hiredman: no, the marketing speak is ridiculous of course

16:59 jonafan: i honestly don't think it solves much and it's certainly not new

16:59 hiredman: I wonder if apple has filed for any patents on GCD

16:59 jonafan: and the terming is nuts

16:59 Chouser: hiredman: it *may* be hype-worthy to the extent that they've re-written all the main Mac apps to use this and actually take advantage of their multicore machines.

16:59 dnolen: hiredman: but bringing lockless concurrency to Cocoa programming is good stuff.

17:00 Chouser: it's only lockless if you don't have to coordinate changes on multiple pieces of state at the same time, right?

17:00 drewr: Multicore Finder is interesting to me.

17:00 hiredman: is it actually lockless concurrency?

17:00 I doubt it

17:00 dnolen: Chouser: private queues handle shared datastructures.

17:00 Chouser: I'd like to see them write ants

17:01 hiredman: it is more about parallism then concurrency

17:01 dnolen: if i understand all the blocks on private queue get execute as a atomic op

17:01 Chouser: hiredman: of course there are locks inside, but the idea is apps don't have to explicitly deal with locks. Like clojure.

17:01 dnolen: could be wrong though, that's what the paper sounded like.

17:01 Chouser: dnolen: yeah, but think of the clojure ants example. One queue per ant? or one per cell?

17:02 jonafan: man, i trolled. sorry guys

17:02 Chouser: can't be one per ant, as they're all changing cell state.

17:02 dnolen: jonafan: no, I was interested in this as well, I brought it up earlier.

17:02 concurrency is a huge interest to Clojurians :)

17:03 jonafan: i figured you would be good people to ask

17:03 dnolen: Chouser: I agree, implementing ants on it would be a great case study to see how good it is.

17:03 Chouser: so one queue per cell -- an ant queues it's "update" action on a queue for that cell ... but it needs to check nearby state.

17:03 hiredman: then main issue is it is still C so you still have direct references to mutable data

17:04 dnolen: hiredman: blocks provide an interesting solution to that, can functional programming be achieved in C by dealing with blocks

17:04 blocks copy the stack

17:04 hiredman: oh

17:04 but if what is on the stack is a point

17:04 er

17:05 dnolen: i think there are issues of course, you can act at a distance, but I wonder how cheap blocks are.

17:05 if they are cheap, it could be interesting.

17:06 i am no C expert, but here's a description of how blocks will work

17:06 http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-August/002670.html

17:09 hiredman: I've been watching http://www.youtube.com/view_play_list?p=9D558D49CA734A02 to improve my C

17:09 Chouser: closures with mutable locals variables.

17:09 * Chouser shakes his head.

17:09 hiredman: yeah

17:09 seems like apple is in need of a blessed functional language for their stack

17:10 Objective-F?

17:10 danlarkin: that sounds like a profanity

17:10 dnolen: Chouser: the closure looks like it supports const locals as well.

17:14 Chouser: my vague impression of Objective C's runtime model is that it would play nicely with a Clojure-for-OC

17:15 hiredman: slightly offtopic, toward the end of the those youtube videos, he switches from C to scheme and they use kawa

17:15 dnolen: Chouser: the only real missing bit it seems to me is there is no concept of final, doesn't Clojure get quite a perf boost from everything being final?

17:15 clojurebot: Who??

17:18 technomancy: is it just me, or are java users really bad at IRC?

17:19 hiredman: uh

17:19 danlarkin: there is already a lisp dialect for the objc runtime, Nu... might be worth checking out

17:21 mrsolo: hmm is there a more sophisticated version of memoize that works with limited space?

17:58 Drakeson: ,(bit-or 3 5)

17:58 clojurebot: 7

17:58 Drakeson: ,(bit-or 3)

17:58 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$fn

17:59 Drakeson: clojurebot: how am I supposed to do (reduce bit-or some-coll) then?

17:59 clojurebot: 0

17:59 Drakeson: botspank

18:00 Cark: ,(reduce bit-or 0 '(1 3 5))

18:00 clojurebot: 7

18:00 Cark: hum

18:02 Drakeson: Cark: thanks. I meant to be a bit sarcastic to get someone to fix (bit-or single-arg)

18:03 Cark: i don't know if that would be a good idea though

18:03 usually when using bit arithmetic, you want good performances

18:04 and it is well known that it's faster to use (+ 3 (+ 1 4)) than (+ 3 1 4)

18:04 for some reason =P

18:04 so i guess this would translate to bit arithmetic

18:05 durka421: ,(meta (var bit-or))

18:05 clojurebot: {:ns #<Namespace clojure.core>, :name bit-or, :file "clojure/core.clj", :line 776, :arglists ([x y]), :inline #<core$fn__4129 clojure.core$fn__4129@1272e52>, :doc "Bitwise or"}

18:05 durka421: ,(meta (var +))

18:05 clojurebot: {:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 549, :arglists ([] [x] [x y] [x y & more]), :inline-arities #{2}, :inline #<core$fn__3946 clojure.core$fn__3946@1b9ab6c>, :doc "Returns the sum of nums. (+) returns 0."}

18:05 replaca: Cark: it is also known that that behavior of + is a bug and will be improved at some point

18:06 Cark: right

18:07 though i wonder how to do this without sequences, and moreover without loosing the neat lazy parameters we have now

18:08 then again, i'm no language designer ...

18:30 Drakeson: ,(cl-format nil "~e" 1/10)

18:30 clojurebot: java.lang.Exception: Unable to resolve symbol: cl-format in this context

18:30 Drakeson: ,(clojure-contrib.pprint/cl-format nil "~e" 1/10)

18:30 clojurebot: java.lang.ClassNotFoundException: clojure-contrib.pprint

18:31 Drakeson: (requir 'clojure.contrib.pprint)

18:31 ,(require 'clojure.contrib.pprint)

18:31 clojurebot: nil

18:31 Drakeson: ,(clojure-contrib.pprint/cl-format nil "~e" 1/10)

18:31 clojurebot: java.lang.ClassNotFoundException: clojure-contrib.pprint

18:32 Drakeson: ,(progn (require 'clojure.contrib.pprint) (clojure-contrib.pprint/cl-format nil "~e" 1/10))

18:32 clojurebot: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure-contrib.pprint

18:32 Drakeson: ,(progn (require 'clojure.contrib.pprint) (clojure.contrib.pprint/cl-format nil "~e" 1/10))

18:32 clojurebot: java.lang.Exception: Unable to resolve symbol: progn in this context

18:32 Drakeson: ,(clojure.contrib.pprint/cl-format nil "~e" 1/10)

18:32 clojurebot: "1./1E+3"

18:32 durka42: i think we call progn "do" ... but clojurebot will execute multiple statements anyway

18:33 Drakeson: ,(clojure.contrib.pprint/cl-format nil "~e" 1/10)

18:33 clojurebot: "1./1E+3"

18:33 Drakeson: is this correct ^^^^^^

18:33 durka42: looks strange to me...

18:35 Drakeson: ,(map #(clojure.contrib.pprint/cl-format nil "~e" %) (list 1/10 1/5 1/2 11/13 1/1 13/11))

18:35 clojurebot: ("1./1E+3" "1./5E+2" "1./2E+2" "1.1/13E+4" "1.0E+0" "1.3/11E+4")

18:36 durka42: ,(clojure.contrib.pprint/cl-format nil "~e" (.doubleValue 1/10))

18:36 clojurebot: "1.0E-1"

18:37 Drakeson: so this is a bug, right?

18:40 hiredman: looks like it

18:45 mrsolo: is there something simliar to range that work with something other than integer?

18:46 hiredman: ,(map char (map (partial + 96) (range 1 26)))

18:46 clojurebot: (\a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y)

18:48 mrsolo: hmm don't see it something like (frange start stop step-function)

18:49 so (frange jan may next-month) gets you (jan feb ... may) etc

18:50 hiredman: iterate

18:51 or even just use a map

18:51 mrsolo: iterate will do i think

18:53 hiredman: ,(map [:jan :feb :march :april: :may :june :july :august :sept :oct :nov :dec] (map #(mod % 12) (range 15)))

18:53 clojurebot: Invalid token: :april:

18:53 hiredman: ,(map [:jan :feb :march :april :may :june :july :august :sept :oct :nov :dec] (map #(mod % 12) (range 15)))

18:53 clojurebot: (:jan :feb :march :april :may :june :july :august :sept :oct :nov :dec :jan :feb :march)

18:54 mrsolo: month is just a example... specifally that i want to do is to get X sample points out of date-time range

19:33 replaca: Drakeson: looks like cl-format ~e isn't handling rationals right. That's the problem you're thinking about, right?

20:05 I don't think anyon'es looking at this anymore, but I just looked at the cl-format code and ~e for rationals is on the list. I'll push it up.

Logging service provided by n01se.net