#clojure logs

2009-06-09

00:51replacawow, I just hacked slime to use pretty print and it's *really* nice :-)
00:55replacabut not very fast -> more motivation to improve performance!
01:06mrsolopp feels slow
01:10replacamrsolo: it is pretty slow -> about 150 lines/sec on my machine
01:10replacai'm working on making it faster
01:11mrsolonice.. i use it a lot :-)
03:35cgrand~seen quidnunc
03:35clojurebotquidnunc was last seen quiting IRC, 1959 minutes ago
03:40frodefI'm learning clojure and trying to figure out the zip/zipper function, but can't seem to get it to work as expected ..
03:41hiredmanwhat are you trying to do?
03:41frodefIf 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.
03:42hiredmanwell
03:42hiredmanthat is a vector
03:42hiredmanand you are calling seq-zip
03:42hiredman,(doc clojure.zip/seq-zip)
03:42clojurebot"([root]); Returns a zipper for nested sequences, given a root sequence"
03:42frodefah, so a vector isn't a squence then..?
03:42hiredman,(doc clojure.zip/vec-zip)
03:42clojurebot"/;nil; "
03:43hiredmanfrodef: nope
03:43frodefthanks
03:43hiredmanyou can turn a vector into a seq easily, and a lot of functions do it implicitly
03:45frodefhiredman: maybe even seq-zip? I seem to get the exact same behavior with vector-zip.
03:45hiredmanfrodef: how exactly are you calling it?
03:46hiredman,(-> [:a [:b :c] :d] clojure.zip/vec-zip)
03:46clojurebotjava.lang.Exception: No such var: clojure.zip/vec-zip
03:46hiredman,(-> [:a [:b :c] :d] clojure.zipper/vec-zip)
03:46clojurebotjava.lang.ClassNotFoundException: clojure.zipper
03:46frodef(zip/zipper (fn [x] (println "hello world") true) ... ... (zip/vector-zip [:a :b [:c :d] :e]))
03:46frodefvector-zip, no?
03:47hiredmanno
03:47hiredmanmaybe
03:47hiredmanyeah, vector-zip
03:47hiredmanbut you don't call zip/zipper
03:47frodefnaming could be more consistent.. :)
03:48hiredmanzipper is if you want to make your own zipper creating function
03:48hiredmanvector-zip is pre-made
03:48hiredman,(-> [:a [:b :c] :d] clojure.zip/vector-zip)
03:48clojurebot[[:a [:b :c] :d] nil]
03:48hiredman,(require '[clojure.zip :as zip])
03:48clojurebotnil
03:49frodefhiredman: I'm just using vector-zip as an easy way to get a zip object to pass to zip/zipper.
03:49hiredman,(-> [:a [:b :c] :d] zip/vector-zip zip/next zip/next)
03:49clojurebot[[:b :c] {:l [:a], :pnodes [[:a [:b :c] :d]], :ppath nil, :r (:d)}]
03:49hiredmanfrodef: you don't pass zip objects to zip/zipper
03:49hiredmanvector-zip returns a zipper
03:49hiredman,(-> [:a [:b :c] :d] zip/vector-zip zip/next zip/next zip/node)
03:49clojurebot[:b :c]
03:50frodefah, of course..
03:50frodefI somehow had the idea that zipper was for mapping one zip to another.
03:51frodefhiredman: thank you for helping.
03:51hiredmana zipper is a nifty method for tree traversal and editing
03:53hiredman,(pl (↕map range $ 3 inc)))
03:53clojurebot(1 2 3)
03:53hiredmanpl uses a zipper to edit s-expressions
03:53hiredman,(macroexpand '(pl (↕map range $ 3 inc))))
03:53clojurebot(do ((flip map) (range 3) inc))
09:57rhickeyanyone thinking about how to use GWT with Clojure?
09:58ChouserI tried to run src/jvm through it once. That didn't turn out so well.
09:59ChouserSince it consumes java sources when producing javascript, I've pretty much just written it off.
09:59rhickeyc-in-c -> java source -> gwt ...?
10:00Chouserseems likely.
10:00asbjxrnc-in-c ?
10:01rhickeyclj-in-clj
10:01Chouserclojure'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:01rhickeyclinj?
10:02Chouseras in "that clinj's it!"?
10:03Chouserasbjxrn: 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:03asbjxrnGot it.
10:04ChouserI suppose you ought to be able to try gwt's "hosted mode" from clojure, but I certainly haven't done that.
10:05rhickeyick - how will we generate this:
10:05rhickeyprivate native void setPayload(String val) /*-{
10:05rhickey this.payload = val;
10:05rhickey}-*/;
10:06Chouserhehe. that's not so much "c-in-c -> java source -> gwt" as it is just "c-in-c -> gwt source"
10:07Chouserit'd be so much easier if I just loved writing java code.
10:08rhickeyright - clinj->gwt would be bypassing the advantages they wanted to get in GWT by using Java - refactoring, type checking etc
10:10Chouseroh, 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:11ChouserI don't know if you'd get much benefit out of refactoring support, but that'd give you hosted mode with type checking.
10:11aravindrhickey: 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:11Chouserstill not good debugging support, at least not all the way back to the .clj code.
10:12rhickeyChouser: I understand, just meant we only get some of the GWT benefits, but there is lots of desirable tech in there
10:13aravindit 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:13Chouseryeah, the deployed apps look awfully nice, and I trust Google's support of all the browsers.
10:14Chouserpre-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:15rhickeyaravind: 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:16rhickeyIt was nice to see they actually used it themselves for the wave client
10:18Chouseryeah, 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:19aravindrhickey: 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:21aravindI guess, I am just mad that I can't have weblocks in clojure :(
10:21rhickeyaravind: widgets are the smallest part of the problem, IMO
10:22aravindI probably don't see the whole picture then.
10:23asbjxrnWhen 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:25asbjxrnWhile 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:27Chouserasbjxrn: 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:27ChouserI sometimes use macros to do that kind of lookup at compile time instead.
10:30asbjxrnYea, in my current case I have the enums in a hashmap, with the enums as they key and the keyword as the value.
10:31asbjxrnSo obviously a hash lookup would be made.
10:32triddellrhickey: 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:32ChouserI'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:33rhickeytriddell: but you used GWT for the front-end?
10:35triddellrhickey: yes... and it was just a proof-of-concept in this case. I mostly was interested in the clojure server-side.
10:36asbjxrnchouser, 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:37Chouserasbjxrn: ah, sure -- that's got to be done at runtime. I was talking about passing in keywords.
10:37Chouser(.fictionalMethod obj (flags :foo :bar))
10:48Chouserrhickey: is there any reason a transaction couldn't be shared by multiple threads?
10:58rhickeyChouser: when would it end?
10:59Chouserwhen told to, I suppose.
11:00rhickeyit would be a big change
11:00ChouserOh, how could it possibly be retried!? nm.
11:01rhickeyI think it is cleanest to have the transactional thread do all ref interop, but you can spawn threads for calculation
11:01ChouserI was thinking of passing around a snapshot view of the ref universe.
11:01Drakeson`,1010b
11:01clojurebotInvalid number: 1010b
11:01Chouser,2r1010
11:01clojurebot10
11:01rhickeyChouser: the beauty of refs is that there are multiple simultaneous universes
11:02Drakeson`thanks
11:31ctdeanWhat are people using for simple distributed programming? Wondering if there is a consensus.
11:32stuartsierra"simple distributed programming" is an oxymoron
11:33ctdeanok, lol. How about small scale distributed systems. on the order of 10 nodes
11:33ctdeanI can always roll my own with http, thrift, etc. That's what I've done in the past
11:33stuartsierractdean: I use Hadoop, which is very good but only suitable for certain tasks.
11:35drewrstuartsierra: Curious, do you use straight HDFS or an abstraction on top of it?
11:36stuartsierraHDFS
11:36drewrI've been experimenting and I'm about to load a butt-ton of data into it.
11:37drewrI think hbase is too immature for me.
11:37stuhoodi'd definitely recommend trying pig/hive/cascading first, before you work directly with the hadoop api
11:38drewrI've wrapped the bare api with clojure and it's still pretty nasty.
11:46Drakeson`what does this mean: No matching method found: toString for class java.lang.Integer
11:46duck1123is it possible to define a method for a multi-method from within a different namspace?
11:46Drakeson`trying to: (.toString 9 2)
11:47drewrDrakeson`: It means there is no method named toString on Integer that takes an Integer as an argument.
11:47duck1123i think it's because that's like calling 9.toString(2)
11:47drewr,(.toString 9)
11:47clojurebot"9"
11:47ctdean,(str 9)
11:47clojurebot"9"
11:48drewr,(str 9 2)
11:48clojurebot"92"
11:48Drakeson`is 9.toString(2) different than toString(9,2) ?
11:48drewrWhat are you trying to accomplish?
11:48drewr(Yes, to answer your q.)
11:49duck1123,(map #(.toString %) '(9 2))
11:49clojurebot("9" "2")
11:49Drakeson`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:50replaca,(Integer/toString 9 2)
11:50clojurebot"1001"
11:50drewrAh, static method.
11:50replacayup
11:51drewrCouldn't figure out where he was going with that.
11:52ctdeanI was just reading about the clojure meetup after javaone. The author mentioned Swarmli. anyone know what that is?
11:52drewrctdean: http://olabini.com/blog/2009/06/the-clojure-meetup-and-general-geekiness/
11:53Drakeson`replaca: thanks.
11:54Drakeson`is there any circumstance that someMethod(x,y) is equivalent to x.someMethod(y), in java? (like python)
11:54stuartsierrano
11:55drewrctdean: 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:55duck1123it would be possible, but the author would have too write it that way
11:55Drakeson`stuartsierra: thanks.
11:56ctdeandrewr: yep, thanks. just wondering about it
11:59integrityis there any clojure goodness wrapping java reflection api for dealing with java classes?
11:59clojurebotclojure is like life: you make trade-offs
12:02Chouserintegrity: http://paste.lisp.org/display/67182
12:02Chousersomething like that?
12:07replacactdean: the right name is Swarmiji
12:08ctdeanreplaca: aha! thanks
12:08replacactdean: 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:09replacactdean: it might be what you're looking for - very easy to distribute compute jobs through function-like interface, monitor them and retrieve results
12:09replacano implicit data model (like map-reduce)
12:10drewrI remember that now from Amit's blog.
12:12drewrhttp://www.google.com/cse?cx=004621955734675372103%3A0oxuogeollc&ie=UTF-8&q=swarmiji&sa=Search
12:12stuartsierraFor my presentation tonight: where would you put Vars in the mutable-types diagram? (coordinated/independent and asynchronous/synchronous)
12:13stuartsierraThis one: http://tinyurl.com/mllzc4
12:14rhickeystuartsierra: var bindings are not shared, you'd need another dimension for that
12:14stuartsierrathat's what I thought
12:15rhickeysynchronous/unshared, implying no coordination needed
12:15stuartsierraok, thanks
12:15stuartsierracool
12:20duck1123ok, 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:20stuartsierraduck1123: struct-maps aren't types. You can add a key or metadata to indicate a type.
12:22duck1123stuartsierra: that sucks. I was hoping that info would've been stored somewhere
12:57cemerickoh, my -- slurp doesn't accept an encoding, and uses a FileReader (!!!!!)
12:58stuartsierrac.c.duck-streams/slurp* uses a *default-encoding*
12:58cemerickusing default encoding ==> fail
12:58stuartsierraI mean *default-encoding* is a var that you can rebind.
12:59cemerickright -- but having slurp sit there as it is is *really* bad.
12:59Chouserwhat encoding is worth mentioning besides utf-8?
13:00stuartsierraA ton of stuff is still ISO-8859-*
13:00mrsoloyes my copy of clojure book is here
13:00mrsoloman it smells bad
13:00cemerickbesides 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:05technomancy(doc as-str)
13:05clojurebot"clojure.contrib.java-utils/as-str;[[x]]; Returns the name or string representation of x"
13:15rhickeyDid anyone see the LWN article on Clojure?
13:16stuartsierrano!
13:16rhickeyhttp://lwn.net/Articles/335966/
13:16rhickeyI'm not a subscriber
13:16stuartsierraBah, me neither.
13:17Chousertwo more days
13:18Chouser"Vala supports modern language features as the following... Foreach"
13:20Chousuke:P
13:20Chousukehttp://lwn.net/SubscriberLink/335966/6e9d1e30bb6a0b16/ here
13:21ChousukeLWN's subscriberlink feature is really neat.
13:21Hunyeah, it gives you an actually working link.
13:21ChousukeThey just trust their subscribers not to rip off their content.
13:21stuartsierranice
13:23Chousukeno artificial DRM or anything. :)
13:23Hunif i can read it, i can rip it off.
13:23Hunso drm would be useless
13:24Chousukeyeah
13:25ChousukeThey 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:27cemerickrhickey: hope you don't mind the random bug report on slurp. Encoding issues are just near and dear to my heart.
13:32mrsolohmm httpagent barfs when i tried to compile
13:32stuartsierramrsolo: it"s not finished yet
13:33mrsolook
13:36stuartsierranot sure why it's doing that, tho
13:37stuartsierraoh, found it
13:38stuartsierrafixed, thanks
13:38mrsolonice
13:39technomancyusually when people have unfinished libs they don't put them straight into contrib. =)
13:39stuartsierraEh, it works (now), wanted to let people see it.
13:40technomancyyeah, it just contributes to the "contrib is just a bucket of code; anything goes" notion.
13:40mrsolohmm
13:41stuartsierraYeah, I kind of like that notion.
13:41mrsoloat least compiles i hope...
13:41duncanmany SLIME users around?
13:41stuartsierrayes
13:41technomancyduncanm: sure
13:41stuartsierratechnomancy: I suppose we could branch contrib, make a formal release.
13:42mrsoloi like that noting those to be of more *cough* quality release
13:42duncanmtechnomancy: 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:42technomancystuartsierra: I think that's a good idea, provided it's a quality release and works with clojure 1.0.
13:43technomancyduncanm: 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:43duck1123contrib probably won't get good releases until it's broken up. (like apache commons)
13:44stuartsierraWell, still needs some clean-up, maybe leave out a few less-developed libs.
13:44duck1123duncanm: I run a swank server from within my compojure app
13:44duck1123I've posted instructions on how to get it running to the compojure ml
13:46duncanmduck1123: is there a URL?
13:46duck1123one sec
13:46stuartsierratechnomancy: I don't have time to lead the charge right now; maybe in a few weeks.
13:47technomancystuartsierra: any specific area you'd like help with?
13:48stuartsierraGeneral organization, naming, apis.
13:49duck1123duncanm: 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:49duck1123duncanm: http://groups.google.com/group/compojure/browse_thread/thread/a4708c9bdb780cbc/2f63267744aa8731
13:57replacastuartsierra, 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:57technomancyreplaca: I quite agree.
13:57stuartsierrareplaca: I'd rather just separate contrib into "stable" and "sandbox" areas.
13:57replacastuartsierra: why?
13:58stuartsierraOne less thing to keep track of.
13:58replacastuartsierra: shouldn't you have your own sandbox for stuff under development?
13:58duck1123or a clojure.extras, where any code that has a dependency other than clojure's dependencies would go
13:58stuartsierrawhy? Lots of open-source repos have a sandbox.
13:59stuartsierraBack in the day, before github, nobody had their own repository.
13:59technomancyI don't understand why the sandbox should be centralized. Seems like a throwback to ye olde days.
13:59replacastuartsierra: yeah, that was back in the day
13:59Chousuketechnomancy: it'd get a lot more attention that way
14:00stuartsierraBasically, I've already got a github acct. that I use for work.
14:00clojurebotgithub is git://github.com/kevinoneill/clojure.git
14:00duck1123"when I was your age, we had to connect to the server just to see what we changed."
14:00technomancyChousuke: once it achieves some level of stability/quality and needs attention, it can be promoted.
14:00technomancymy random experiments have little if anything to do with yours
14:01Chousuketechnomancy: the sandbox could be a good place for new additions to contrib that haven't seen much real use yet.
14:01stuartsierrayes
14:01replacaI'm with technomancy on this one. contrib is (currently) at least a very visible part of the system
14:01Chousukethen eventually things would migrate to the actual contrib namespace
14:02technomancylook, a sandbox => http://github.com/languages/Clojure/updated
14:02technomancy=)
14:02Chousukethe 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:03ChousukeLike this, the sandbox wouldn't be free-for-all. That's what github is for :)
14:03replacaI wonder if we should decide what will appear in contrib while it's still experimental
14:03technomancyChousuke: I agree it's better than keeping experimental libs in contrib itself, no question there.
14:04replacaChousuke: it would only be a free for all for committers!
14:04technomancyyeah, that's a big issue; it creates stratification between those blessed with commit rights and the rest of the rabble.
14:04replacabut I can't object to that too much as long as it's clearly separated
14:04ChousukeMaybe putting your lib into .sandbox could be taken as a "promise" that you will make it into something workable
14:04replacatechnomancy: again, I'm with you
14:05replacaChousuke: yeah, but why?
14:05replacathere are plenty of ways to share code that's "not ready for prime time"
14:05duck1123the bottom line is contrib should always at the very least compile
14:06replacaduck1123: no, stuff should work
14:06Chousukereplaca: 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:06stuartsierrayes
14:06replacaduck1123: otherwise newbies (or just regular users) get frustrated
14:06mrsolothe entire contrib is pretty small right now i don't mind to take all of it
14:06mrsolonot sure this will stay this way
14:06Chousukereplaca: and .sanbox would be a convenient "incoming" box for contrib; people would see new libraries appear in it and possibly test them.
14:06replacaChousuke: that's really different than "experimental"
14:07mrsoloalso yes for us newbies there is no quality measurent of 'oh this is dead..not to use this etc'
14:07replacaor "just beginning development"
14:07mrsolobut i don't like committe either.. will get politicial sooner or later but hey it should at least compile :-)
14:07Chousukereplaca: if you're just starting with the lib, then I think it should stay outside contrib completely
14:09replacaI agree with both Chousuke and technomancy
14:09replacaI'm not opposed to a sandbox for things that are "almost ready"
14:09Chousukeregarding the committer issue, I don't think there's a way around that.
14:10Chousukesince you can't allow just anyone to put stuff in contrib. people need at least a CA :/
14:10mrsoloability to comment toward libray on wiki page will be nice
14:10duncanmduck1123: and which files/jars do I need to have in the classpath?
14:10replacaChousuke: agreed but that doesn't mean that committers should treat contrib completely as their private source code control
14:11Chousuketrue.
14:11Chouserlast time I asked about where to put work in progress, everyone told me contrib was fine -- gotta put it somewhere...
14:11replacaChousuke: so committers should treat their "status" with some delicacy
14:11ChousukeSVN makes this more of an issue than it should be ;P
14:12replacaChousuke: well, with git we could have "private" branches to play with
14:12replacathat would be nice just for evolving stuff that's alredy in
14:12duck1123duncanm: you need to have the swank-clojure lib on your classpath
14:12replaca*already
14:12Chousukewith *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:13replaca(sorry, didn't mean to be git-specific :-))
14:13ChousukeI personally don't mind, I'm a fan of git. :)
14:13Chousukebut there are some mercurial-people around I think :P
14:13replacain any case, gotta run. see you all later
14:38cemerickduncanm: 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:46duncanmcemerick: i'm using fiji, and fiji has its own repl implementation
14:46duncanmcemerick: so are you saying enclojure is yet another implementation of a REPL?
14:46duncanmcemerick: i want to use SLIME because i'm typing everything else in emacs ;-P
14:47Hunyou could also use comint-run with a wrapper script if connecting to slime is too hard
14:47Hunthough comint is far less cool
14:48duncanmso i first need to build a jar file for swank
14:48duncanmi don't see a build script in the github page
14:48technomancyyou can just jar up the swank-clojure dir; it doesn't need AOT
14:48cemerickduncanm: enclojure adds clojure support to NetBeans, and yes, it provides its own REPL impl.
14:49cemerickI just thought I'd mention it in case you weren't tied to emacs :-)
14:53duck1123duncam: I have a fork of swank that uses maven to produce a jar
14:54duck1123I haven't pushed it out yet, but I could if you're interested
15:05duck1123I'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:07duncanmtechnomancy: to jar up swank-clojure, i should just take the swank directory as the base, right?
15:10duck1123duncanm: yes
15:12technomancyduncanm: no, I think you need the project root as the base
15:13technomancysince swank/core.clj provides the namespace swank.core
15:16duncanmduck1123: where is IGNORE-PROTOCOL-VERSION from?
15:17duck1123_swank.swank
15:17duncanmhmm
15:18duncanmhow do i view the classpath again?
15:18duck1123_http://gist.github.com/126735
15:20technomancy,(System/getProperty "java.class.path")
15:20clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)
15:20technomancyoh snap!
15:21duncanmsigh, it returns a string?
15:21technomancythere's something in contrib for getting it more sanely
15:22duncanmi don't think i have access to contrib with this REPL
15:22duncanmhmm, so swank is in the classpath
15:22duncanm(.contains cp "swank") => true
15:23duncanmso now i need to load it in?
15:23duncanmdo i use LOAD?
15:24stuartsierraduncanm: maybe require
15:24duncanmaha
15:24duck1123_duncanm: if you use the gist I just posted, you can (net.mycyclopedia.swank/init)
15:26duncanmCaused by: java.lang.Exception: Unable to resolve symbol: with-bindings in this context
15:26duncanmbut i did (require '(clojure.main))
15:27duck1123then you would have to use clojure.main/with-bindings
15:28duncanmwait, so i need to fully-qualified all the names?
15:28duncanmaha
15:28duncanmnow my problem is, on Windows, there's no /dev/null
15:28duck1123clojure.main isn't automatically refered, that's why I use it the way I do
15:29duncanmi tried that NS form, but it didn't work
15:31duncanmaha
15:31duck1123I suppose you could replace "/dev/null" with the location of a file. (nil might work, but I haven't tried that)
15:33duncanmduck1123: according to Google, "NUL" works
15:33duncanmso nice, i got it working now
15:33duncanmthe only nitpick is that my slime versions are mismatched
15:33stuartsierraApache Commons IO defines a NullWriter
15:34duck1123I have that same problem, I haven't figured out how to get around that one yet
15:52duck1123wrt my macro question, I cleaned then re-built and now it's working
16:02duncanmthis is very nice, having the REPL to my app be available inside emacs
16:02duncanmduck1123: do you have any code for tearing down the swank connection?
16:03duck1123duncanm: I just kill " *cl-connection*"
16:04duck1123any other way will kill your app
16:04dnolenslime-kill-repl works as well
16:05duncanmduck1123: i mean, doing it from the app-side, in Java, say
16:05duncanmso right now, i made it pop up a dialog, but it's not actually tied to anything
16:06duck1123duncanm: no, I couldn't find anything to do that.
16:32cemerickhrm, can't use #^chars to type hint character arrays...though #^"[C" does work.
16:35stuartsierraYes, chars isn't a type
16:35opqdonutgah, i didn't know about the #^" type of type hints
16:36hiredmanstuartsierra: but most primitives have something like "bytes" you can use to hint an array
16:36ChouserI keep trying to forget, and generally succeeding.
16:36opqdonuthiredman: actually, there is no bytes
16:36opqdonutat least in 1.0
16:36cemerickyeah, #^chars really should be included, as well as #^bytes
16:36hiredmanI was pretty sure there is a bytes
16:36cemerickI think these nicer array hints were added alongside the unchecked math stuff, so those omissions make sense.
16:36mrsolomemoize rocks :-)
16:38hiredman,#^bytes (into-array Byte/TYPE (map byte (range 10)))
16:38clojurebot#<byte[] [B@14b1dbf>
16:38Chouserchars and bytes both work for me in 1.0
16:38Chouser,(expression-info '(let [x #^bytes (make-array Byte/TYPE 0)] x))
16:38clojurebot{:class [B, :primitive? false}
16:38Chouser,(expression-info '(let [x #^chars (make-array Byte/TYPE 0)] x))
16:38clojurebot{:class [C, :primitive? false}
16:39hiredman~def c.l.Compiler
16:39Chousercemerick: what makes you think #^chars isn't working?
16:39hiredmanhttp://code.google.com/p/clojure/source/browse/trunk/src/jvm/clojure/lang/Compiler.java?r=1382#880
16:40cemerickChouser: 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:47jonafanwhat do you guys think about grand central dispatch
16:49hiredmanjonafan: I think it is mac only
16:50jonafannot really, it's just a thread pool with closure support in objective c
16:51hiredmanI think SEDA(http://www.eecs.harvard.edu/~mdw/proj/seda/) is similar
16:51technomancyin practice nobody uses objective C on free platforms though.
16:52hiredmanand SEDA is old news, there was a usenix paper in '03 comparing seda queue&event architecture to using threads
16:53jonafanokay but it could be easily implemented in any language
16:53hiredman(using threads directly)
16:53technomancyif 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:54hiredmanhttp://www.usenix.org/events/hotos03/tech/full_papers/vonbehren/vonbehren_html/index.html
16:54hiredman"Why Events Are A Bad Idea (for high-concurrency servers)"
16:55jonafanso, not impressed?
16:56ChouserIf I had to write high-level apps in Objective C, I imagine I'd be *very* excited about it.
16:56ChouserOr even in C++, a similar solution would be better than none.
16:57ChouserBut 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:58jonafanso you're saying that apple is playing catch up as far as these features are concerned
16:58dnolenjonafan: I do some Objective-C/Cocoa programming, i think it's great for that.
16:58hiredmanI think apple is making a lot of hype for something not very hype worthy
16:58technomancyjonafan: 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:58dnolenit's good to see other solutions to lockless concurrent programming
16:58Chouseryou slap some Clojure closures on that and you've pretty much arrived. Then sprinkle on the agent abstraction, refs, transactions, etc...
16:59hiredmanI mean, it's neat, but it is not the completely revolutionary game changer that apple declares everything to be
16:59jonafani agree with hiredman
16:59dnolenhiredman: no, the marketing speak is ridiculous of course
16:59jonafani honestly don't think it solves much and it's certainly not new
16:59hiredmanI wonder if apple has filed for any patents on GCD
16:59jonafanand the terming is nuts
16:59Chouserhiredman: 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:59dnolenhiredman: but bringing lockless concurrency to Cocoa programming is good stuff.
17:00Chouserit's only lockless if you don't have to coordinate changes on multiple pieces of state at the same time, right?
17:00drewrMulticore Finder is interesting to me.
17:00hiredmanis it actually lockless concurrency?
17:00hiredmanI doubt it
17:00dnolenChouser: private queues handle shared datastructures.
17:00ChouserI'd like to see them write ants
17:01hiredmanit is more about parallism then concurrency
17:01dnolenif i understand all the blocks on private queue get execute as a atomic op
17:01Chouserhiredman: of course there are locks inside, but the idea is apps don't have to explicitly deal with locks. Like clojure.
17:01dnolencould be wrong though, that's what the paper sounded like.
17:01Chouserdnolen: yeah, but think of the clojure ants example. One queue per ant? or one per cell?
17:02jonafanman, i trolled. sorry guys
17:02Chousercan't be one per ant, as they're all changing cell state.
17:02dnolenjonafan: no, I was interested in this as well, I brought it up earlier.
17:02dnolenconcurrency is a huge interest to Clojurians :)
17:03jonafani figured you would be good people to ask
17:03dnolenChouser: I agree, implementing ants on it would be a great case study to see how good it is.
17:03Chouserso 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:03hiredmanthen main issue is it is still C so you still have direct references to mutable data
17:04dnolenhiredman: blocks provide an interesting solution to that, can functional programming be achieved in C by dealing with blocks
17:04dnolenblocks copy the stack
17:04hiredmanoh
17:04hiredmanbut if what is on the stack is a point
17:04hiredmaner
17:05dnoleni think there are issues of course, you can act at a distance, but I wonder how cheap blocks are.
17:05dnolenif they are cheap, it could be interesting.
17:06dnoleni am no C expert, but here's a description of how blocks will work
17:06dnolenhttp://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-August/002670.html
17:09hiredmanI've been watching http://www.youtube.com/view_play_list?p=9D558D49CA734A02 to improve my C
17:09Chouserclosures with mutable locals variables.
17:09hiredmanyeah
17:09hiredmanseems like apple is in need of a blessed functional language for their stack
17:10hiredmanObjective-F?
17:10danlarkinthat sounds like a profanity
17:10dnolenChouser: the closure looks like it supports const locals as well.
17:14Chousermy vague impression of Objective C's runtime model is that it would play nicely with a Clojure-for-OC
17:15hiredmanslightly offtopic, toward the end of the those youtube videos, he switches from C to scheme and they use kawa
17:15dnolenChouser: 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:15clojurebotWho??
17:18technomancyis it just me, or are java users really bad at IRC?
17:19hiredmanuh
17:19danlarkinthere is already a lisp dialect for the objc runtime, Nu... might be worth checking out
17:21mrsolohmm is there a more sophisticated version of memoize that works with limited space?
17:58Drakeson,(bit-or 3 5)
17:58clojurebot7
17:58Drakeson,(bit-or 3)
17:58clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$fn
17:59Drakesonclojurebot: how am I supposed to do (reduce bit-or some-coll) then?
17:59clojurebot0
17:59Drakesonbotspank
18:00Cark,(reduce bit-or 0 '(1 3 5))
18:00clojurebot7
18:00Carkhum
18:02DrakesonCark: thanks. I meant to be a bit sarcastic to get someone to fix (bit-or single-arg)
18:03Carki don't know if that would be a good idea though
18:03Carkusually when using bit arithmetic, you want good performances
18:04Carkand it is well known that it's faster to use (+ 3 (+ 1 4)) than (+ 3 1 4)
18:04Carkfor some reason =P
18:04Carkso i guess this would translate to bit arithmetic
18:05durka421,(meta (var bit-or))
18:05clojurebot{: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:05durka421,(meta (var +))
18:05clojurebot{: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:05replacaCark: it is also known that that behavior of + is a bug and will be improved at some point
18:06Carkright
18:07Carkthough i wonder how to do this without sequences, and moreover without loosing the neat lazy parameters we have now
18:08Carkthen again, i'm no language designer ...
18:30Drakeson,(cl-format nil "~e" 1/10)
18:30clojurebotjava.lang.Exception: Unable to resolve symbol: cl-format in this context
18:30Drakeson,(clojure-contrib.pprint/cl-format nil "~e" 1/10)
18:30clojurebotjava.lang.ClassNotFoundException: clojure-contrib.pprint
18:31Drakeson(requir 'clojure.contrib.pprint)
18:31Drakeson,(require 'clojure.contrib.pprint)
18:31clojurebotnil
18:31Drakeson,(clojure-contrib.pprint/cl-format nil "~e" 1/10)
18:31clojurebotjava.lang.ClassNotFoundException: clojure-contrib.pprint
18:32Drakeson,(progn (require 'clojure.contrib.pprint) (clojure-contrib.pprint/cl-format nil "~e" 1/10))
18:32clojurebotjava.lang.RuntimeException: java.lang.ClassNotFoundException: clojure-contrib.pprint
18:32Drakeson,(progn (require 'clojure.contrib.pprint) (clojure.contrib.pprint/cl-format nil "~e" 1/10))
18:32clojurebotjava.lang.Exception: Unable to resolve symbol: progn in this context
18:32Drakeson,(clojure.contrib.pprint/cl-format nil "~e" 1/10)
18:32clojurebot"1./1E+3"
18:32durka42i think we call progn "do" ... but clojurebot will execute multiple statements anyway
18:33Drakeson,(clojure.contrib.pprint/cl-format nil "~e" 1/10)
18:33clojurebot"1./1E+3"
18:33Drakesonis this correct ^^^^^^
18:33durka42looks strange to me...
18:35Drakeson,(map #(clojure.contrib.pprint/cl-format nil "~e" %) (list 1/10 1/5 1/2 11/13 1/1 13/11))
18:35clojurebot("1./1E+3" "1./5E+2" "1./2E+2" "1.1/13E+4" "1.0E+0" "1.3/11E+4")
18:36durka42,(clojure.contrib.pprint/cl-format nil "~e" (.doubleValue 1/10))
18:36clojurebot"1.0E-1"
18:37Drakesonso this is a bug, right?
18:40hiredmanlooks like it
18:45mrsolo is there something simliar to range that work with something other than integer?
18:46hiredman,(map char (map (partial + 96) (range 1 26)))
18:46clojurebot(\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:48mrsolo hmm don't see it something like (frange start stop step-function)
18:49mrsolo so (frange jan may next-month) gets you (jan feb ... may) etc
18:50hiredmaniterate
18:51hiredmanor even just use a map
18:51mrsoloiterate will do i think
18:53hiredman,(map [:jan :feb :march :april: :may :june :july :august :sept :oct :nov :dec] (map #(mod % 12) (range 15)))
18:53clojurebotInvalid token: :april:
18:53hiredman,(map [:jan :feb :march :april :may :june :july :august :sept :oct :nov :dec] (map #(mod % 12) (range 15)))
18:53clojurebot(:jan :feb :march :april :may :june :july :august :sept :oct :nov :dec :jan :feb :march)
18:54mrsolomonth is just a example... specifally that i want to do is to get X sample points out of date-time range
19:33replacaDrakeson: looks like cl-format ~e isn't handling rationals right. That's the problem you're thinking about, right?
20:05replacaI 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.