#clojure logs

2008-06-16

08:18asbjxrnGot a macro question: I've got a map of symbols/values and would like to turn it into a binding of those symbols/values. (and have a body being executed within the binding.)
08:19asbjxrnI haven't managed to come up with a suitable combination of quotes, tildes and @...
08:19asbjxrn(actually, when I think about it, it doesn't have to be a macro....)
08:20rhickey_right, see Var.pushThreadBindings/popThreadBidings as used by binding and with-local-vars
08:21rhickey_maybe with-local-vars is what you need
08:23asbjxrnWhat I want is variables that look "normal" to a user, but which differs between threads/agents.
08:24rhickey_that's what vars are
08:24asbjxrnRight,
08:25asbjxrnHmm. So maybe I don't have to do anything special at all...
08:27meredyddasbjxrn: I might be missing something here...but why don't you just wrap (let)?
08:27asbjxrnNo, I think I might have to. What I have is swing frames/panels and I want each to have a separate set of variables local to each frame.
08:28rhickey_asbjxrn: how would you name them?
08:29asbjxrnI have a "env" map that is in a closure around the Jpanel. In that env map I have a :vars value which I thought to have as a map of symbols.
08:30rhickey_but if you are going to write code using those symbols, they're not runtime names, so why not pick names for def-ed vars?
08:30asbjxrnThen in the "paint" function of the panel, I was going to do a (foreach symbol in (env :vars) do binding symbol value.....) then call the render.
08:31asbjxrnThe thing is I let the user define what happens in the render function and I'd like the user to create/use variables in there..
08:31asbjxrnMaybe an example is easier.... just a moment....
08:31asbjxrn(This is kinda processing-inspired)
08:36lisppaste8asbjxrn pasted "processing lite" at http://paste.lisp.org/display/62316
08:37asbjxrnThere are som examples at the end there.
08:40rhickey_ok, so where are you stuck?
08:41asbjxrnsorry, phone...
08:44asbjxrnOk, so far I have some variables already, if you see in the make-panel function I set up mouse position etc. before I do the render.
08:46asbjxrnThe next trick is to let the user add variables himself. To do that the binding of those variables have to be dynamic somehow. If I could just loop through the symbols in (@env :vars) I could just define a function that adds it into that map.
08:46asbjxrnI'm sorry, it's quite a bit of code, I don't really have a small test case for this...
08:47rhickey_do you know CL?
08:47asbjxrnSomewhat.
08:47rhickey_would symbol-macrolet let you do what you want?
08:47asbjxrnThat one I have never used, let me read a bit...
08:51asbjxrnHmm, I don't know. I think the binding part that I already use (see the paint function in make-panel) works well, what I'm struggling with is to map that over all the entries in the map, not just the predefined ones.
08:53rhickey_right, but for Clojure to resolve the unadorned symbols as references to particular vars, they need to be def-ed,
08:53rhickey_but you are writing a DSL via macros, where you want to extend the namespace and resolution rules
08:54asbjxrnYes, so I would need a function for the user to setup the vars, that function could def it, bind it for immediate use and add it to the map.
08:54rhickey_maybe, but the def has to be visible when Clojure compiles the body
08:55rhickey_what would typically happen if you had symbol-macrolet would be the macro would have x turn into (get env 'x)
08:55asbjxrnYes, I had this working with a whole evaluator and stuff. Was a lot of work when I had to start doing my own doseqs, ifs etc. I kinda ripped that out and the only missing thing now is the vars....
08:56asbjxrnOk.
08:58asbjxrnBut I guess clojure doesn't have symbol-macrolet?
08:58rhickey_right, you don't need a whole evaluator, just a runtime name environment
08:58rhickey_no, no symbol-macrolet yet :(
08:58asbjxrnThe "yet" is a good sign :)
08:59rhickey_yes, of all the tricky CL macro stuff, symbol-macrolet is the one I want most
09:01asbjxrnI guess I could just tell the user ( me :) that I have to use normal variables.
09:01rhickey_for now, or try with-local-vars
09:03asbjxrnThey have to be persistent between renders.
09:03asbjxrnNot sure how swing threads work and how that would work with with-local-vars?
09:07rhickey_so, with-local-vars wouldn't help (don't persist), but the thing to take away from that is that vars are ordinary objects, you can create and store in your own map. Then maybe your macro has to look for 'your' vars and emit binding code
09:08rhickey_that binding code would use Var.push/popTreadBindings, not 'binding'
09:09asbjxrnAh, now I get your first reply, I could make something using the Var.push/pop... Sorry for being slowl
09:10asbjxrnFeels a bit dirty, like using non-exported functions in CL.
09:10rhickey_np, the mechanism behind vars isn't really documented, but 'binding' and 'with-local-vars' provide examples
09:12rhickey_well, the problem is properly exporting them means pairing push and pop, since otherwise it's broken, and that means a macro, and those 2 are those macros. I guess I could provide push-thread-bindings but that doesn't add too much value
09:12rhickey_other than to document it is ok
09:13asbjxrnDon't worry for my sake.
09:14la_merrhickey_: Browsing around the google groups, I saw you mention a couple times that you were planning some higher-level content talking about data design in clojure (i.e. fully utilizing the freedom afforded by clojure's dispatch mechanisms, etc). Is that stuff out there somewhere, or is it still on the drawing board?
09:15rhickey_la_mer: still to come. I think I might get to that material first when I resume my lunch talks with my think-tank group as we get past the basics
09:18la_merrhickey_: is there some analogous content you know of off the top of your head that uses other languages (maybe scheme)? Clojure obviously has some unique features, but I'm thinking that maybe there's some "practical" (i.e. non-research-oriented) material that touches on some similar concepts.
09:24rhickey_not exactly sure which aspects, but as a general thesis, this is a good paper: http://web.mac.com/ben_moseley/frp/paper-v1_01.pdf
09:25rhickey_note that Clojure doesn't adopt the in-memory relational part (but does offer some facilities), but I think is on the right track in providing guidance in how to think about these things
09:27rhickey_but in terms of how to do the whole thing, STM + Agents + persistent data structures, I don't think there is anything because I think Clojure is the first language to propose this as the standard mechanism
09:27la_merrhickey_: That looks very promising, thanks. A good springboard into related material via citeseer, etc.
10:46yrbDoes seperating the gui out into an agent to try and hide the mutable state sound like a good idea?
10:48yrbtomhickey: The clojure site is looking good :)
10:48tomhickeyyrb: thanks
10:56asbjxrnyrb, I thought so, and Rick used it in his ants demo, didn'so it can't be all bad?
10:57asbjxrndidn'so -> didn't he, so
11:08yrbHrmmm, Well he more used an agent to manage the render. The gui didn't really have much state as such
11:10asbjxrnAh, you want to hide the state of the gui in the agent. That is what I kinda (try to) do, but I just have a toy thingy.
11:12yrbI suppose a immutable representation of the gui behind a ref would be the best
11:12yrband have agents render from that
11:13asbjxrnWhat I do is to put a panel in a closure which contains various state, and the panel itself, and set the angent to be a ref to that closure.
11:15asbjxrnSo the only way to get to the state or even the panel itself is through the agent, which is a ref.
11:15Chouser_asbjxrn: I'm just barely following this, but if you'll indulge me ... how does your closure change its state? or does it?
11:17asbjxrnWell, I have very little state to be honest. It is changed through actions(?) sent to the agents and could also be changed in the render function when the panel do a repaint.
11:17yrbhow do you do your callbacks?
11:19asbjxrnWell, this is where the toy example comes in I guess. I just have a panel that I draw in. It is a proxy, and I have defined mouselisteners etc.
11:19Chouser_asbjxrn: I'm sorry, what I meant was that when I have a closure that has state, its usually by using (let ...), but then I can't change those values.
11:20Chouser_asbjxrn: do you use let and some refs? can't be thread-binding since different threads could handle that agent, right?
11:20asbjxrnAh, the closure is a ref of a map.
11:20Chouser_ah, ok.
11:22lisppaste8asbjxrn annotated #62316 with "refs, agents and gui" at http://paste.lisp.org/display/62316#1
11:22asbjxrnI pasted it just now. http://paste.lisp.org/display/62316, if you can wait a little bit I'll
11:22asbjxrnOops.
11:23asbjxrnVery raw, I'm in the process of at least adding some minor comments.
11:23Chouser_It's fascinating that when someone says "state" it either has to never change or be using one of a very short list of mechanisms for change.
11:24asbjxrnI don't mean that at all.
11:25Chouser_is "defn-" defined somewhere?
11:25asbjxrnThe comments at the bottom shows how it is to be used, the draw/once/on-click sends actions(?) to the agent to change how the panel is updated.
11:25asbjxrnI think so. It a defn that is not exported(?) from the namespace
11:26Chouser_oh! cool.
11:26Chouser_indeed. boot.clj
11:26Chouser_Maybe I should be reading the svn diffs -- apparently reading boot.clj once weeks ago isn't enough. :-)
11:28asbjxrnI wish I had the time you apparently have :)
11:28asbjxrnI haven't even looked at the parallell and native-number stuff.
11:29Chouser_oh. neither have I.
11:29Chouser_asbjxrn: that's a fascinating thing you've built there.
11:30yrbasbjxrn: Cool, thanks for that :)
11:31asbjxrnIt's not that fantastic. It's actually just a result of me not being able to get processing to work with clojure, so I started writing something like it instead. It's just a learning project.
11:33asbjxrnThe state in this example is mostly the list of commands to be executed in the render function. And the mouseclick/move stuff.
11:36Chouser_so does anyone here understand how "commute allows for more concurrency" than alter or ref-set?
11:40Chouser_it seems to me that either way, if one transaction conflicts with another, the loser has to go back to the beginning to get fresh state to do its calculations.
11:44asbjxrnI think it means that it won't do that.
11:44asbjxrnThus: the fun should be commutative.
11:45asbjxrnHmm. No. doesn't make sense that way either.
11:49asbjxrnIt would make sense that way if commute was atomic, so you could be sure that nothing gets inbetween the call to fun and the assignment.
11:49asbjxrnI think.
11:54asbjxrnFrom the google group Rick says: "It also supports explicit
11:54asbjxrncommute, further reducing retries for commutative writes"
11:55blackdognoobie question, in (def *accountInfo*) are the stars just convention for a global variable?
11:55asbjxrnWhich I take to mean that the transaction won't be restarted. It might be a good question for the group, though.
11:55blackdogor is it more significant
11:56asbjxrnIt's a common lisp convention. I haven't seen anyone use it in clojure. Where did you see it?
11:57blackdogcan't remember now, probably from rich's code
11:57blackdogi've never looked at CL so it can't be from there :)
11:57Chouser_yeah, it's convention for globals. Clojure provides *warn-on-reflection*, *command-line-args* and maybe others
11:58Chouser_but the compiler doesn't do anything differently just because of the *
11:58blackdogok, thanks all
11:58blackdogok
11:58jteoalways thought it was a CL convention
12:03Chouser_asbjxrn: I think you're right. at least as long as the fun passed to commute only looks at the ref passed to it, there's no reason the whole transaction would have to be restarted.
12:08rsynnottjteo: I suspect it has been borrowed
12:08rsynnott(it's certainly a CL convention)
12:08rsynnottquite a good one, really
13:24meredyddIs there an idiomatic way of creating modules with a particular "public" API?
13:26meredyddSo, I'm writing a chunk of my application in a namespace, and I really only want the rest of the world to interact by calling a few functions.
13:27Chouser_yes, you can mark items in the namespace as private
13:27Chouser_specifically, you add a :private key to their meta-data with a value of true
13:27meredyddIck. And I have to do that for every fn?
13:28Chouser_yes. There's a variant of defn named defn- that does it for you
13:28meredyddIs there a shortcut?
13:28Chouser_...just learned about that today.
13:28meredyddTadaaa. Thank-you muchly :)
13:28Chouser_:-)
13:31Chouser_Huh. That's been there since March 10th.
14:36drewrHow can I convert a lazy seq of seqs into one lazy seq of the elements of each seq?
14:36Chouser_concat
14:37Lau_of_DKChouser, isnt he asking about flatning it ?
14:37drewrI guess I can chain CONCATs together.
14:37drewrLau_of_DK: Yes.
14:37Lau_of_DKdrewr, so you need lazy-flat ?
14:37drewrActually, chaining won't work because it's all one seq.
14:38Chouser_(apply concat [[1 2 3] [4 5 6]])
14:38drewrAh, I think that'll work.
14:39Chouser_And it's fully lazy: (take 5 (apply concat [[1 2 3] (iterate inc 10)])) => (1 2 3 10 11)
14:39drewrThat's awesome.
14:39Chouser_:-)
14:44drewrNow I have a lazy stream of messages from our database of *millions* of rows.
14:44Chouser_very nice.
14:44drewrI run a LIMIT query getting a batch at a time.
14:44drewrAnd splice them all together in a lazy seq.
14:45Chouser_oh, VERY nice.
14:45drewrThis is turning out to be a decent SQL lib.
14:45Lau_of_DKChouser, did you decide wether or not (def) was threadsafe?
14:46drewrLau_of_DK: Use VAR-SET in a BINDING.
14:46Lau_of_DKFor concurrency I think I'll use Refs, but I was just asking out of interest because Chouser investigated the inner workings of (def) quite heavily last time we spoke :)
14:47drewrAh.
14:47Lau_of_DK(yes, I know the poor man needs a real hobby)
14:47Chouser_Lau_of_DK: rhickey says yes: http://clojure-log.n01se.net/date/2008-06-15.html
14:48Lau_of_DKk, thanks
14:48Chouser_drewr: how hard would it be to have the use of the last (minus n) item of batch 1 cause the fetching (in the background) from the db of batch 2?
14:49Chouser_or would that even be desirable?
14:49drewrChouser_: Interesting idea. I'm not sure if it would be necessary or not.
14:50drewrIn theory your batches should be small enough to be really fast queries, but big enough to chew on without hitting the database every 500ms.
14:50Chouser_yeah. I was just thinking the an attempt to use the first item would block waiting for the db server to respond, right? and that maybe that could be avoided.
14:51Chouser_anyway, what you've got is very cool.
14:51drewrYes, there would be some blocking depending on how fast the query returns.
14:51Chouser_mind sharing the code so I can pass it along to some friends later this week?
14:51drewrYeah, I'll share it once I clean it up.
14:53Chouser_great, thanks.
14:54drewrI bet I could queue up a batch in a Ref, and then in a transaction grab the batch, empty the Ref, and be populating it with the next batch in another thread.
14:58la_merLooks like clojure doesn't work out of the box on ikvm...
14:59Chouser_hm... interesting idea.
14:59Chouser_how does it break?
15:00la_merThe compiler pukes looking for a matching method for append on a printwriter.
15:00la_mer(this is while compiling boot.clj)
15:03jamii_Is there no prepend function for vectors?
15:04Chouser_jamii_: If you want fast prepend, lists might work better for you.
15:05jamii_I need fast prepend, append and indexing. I guess I'll have to go with a pair of vectors.
15:12la_merlooks like an ikvm bug -- it seems to be providing doubles for all possible methods (maybe?), so clojure can't resolve a match
15:38la_merNot sure what's going on here...this throws a ClassCastException: (map #(%) [1 2])
15:43Chouser_it's trying to run 1 and then 2
15:46Chouser_did you mean for the function to a sort of no-op? you might try (map identity [1 2])
15:48la_merI'm just messing around with the shorthand function syntax....isn't #(%) the same as (fn f [v] v)?
15:49Chouser_no, it's the same as (fn [v] (v))
15:51la_merah, didn't read the docs closely enough
15:51Chouser_yeah, that's a subtle bit that several of us have tripped on.
15:52la_mer#(...) => (fn [args] ...) is how I read it
15:52Chouser_makes sense, though, or most of the time you'd end up writing #((foo %1 %2)) or something
15:53la_merSure.
15:53la_merIt's a little too bad that % was chosen instead of _, but that's bikeshed territory, I suppose.
16:04la_merClojure *does* seem to work via ikvm / ikvmc, but you need to use v0.36 of ikvm -- v0.34 does not work
16:04Chouser_really!? that's pretty cool.
16:05la_merWell, I get a Repl prompt :-)
16:05la_merIs there an automated test suite somewhere. I see a Test.clj file, but there's nothing there.
16:05Chouser_boot.clj. :-)
16:05la_merUh-huh. :-D
16:06la_merThat's a *little* scary.
16:07Chouser_I think someone was working on a test suite.
16:08Chouser_http://clojure-log.n01se.net/date/2008-05-20.html
16:14Lau_of_DKAnybody worked out how to execute a .clj that accepts args?
16:14blackdogi have script somewhere
16:14Chouser_java -cp clojure.jar clojure.lang.Repl a.clj -- some args
16:15Lau_of_DKok - and then I access these as standard java-args ?
16:15la_merIs Rich's ant colony code up somewhere?
16:15Lau_of_DKla_mer, its in the google groups files
16:15Chouser_Lau_of_DK: there's a global *command-line-args*
16:15la_merLau_of_DK: thanks
16:16Lau_of_DKChouser, sweet
16:20la_merAside from ikvm's lack of support for awt, ants.clj seems to work in .NET
16:22Lau_of_DKThis might be a silly question, but whats the use of ikvm? Why put Java in .Net ?
16:22Chouser_so you can run Clojure on .Net!
16:22Lau_of_DKAnd use .Net libs instead of Javas?
16:23la_merWe use it to offer .NET versions of our libraries.
16:23Lau_of_DKk
16:24la_merYou can use .NET libs from a Java app cross-compiled using ikvm, although you need to generate stubs from the relevant .NET assemblies so javac can have something to work with.
16:24la_merUsing .NET assemblies should be a *lot* easier with clojure, since compilation happens at runtime.
16:25la_merMany of our larger customers deploy to .NET exclusively, so having some confidence that clojure is ikvm-friendly is pretty important.
16:25Lau_of_DKSure - And .Net is home to me, so in that regard im positive, but Im sure Rich has a reason to sit Clojure on the JVM instead of .Net ?
16:26blackdogi think he started out by being able to compile to both, but went for java in the end
16:26la_merI think he's provided his reasoning on that choice before, elsewhere.
16:26la_merblackdog: yeah, that's right.
16:26la_merMany people seem to consider the jvm as being a friendlier host for "alternative" languages. I don't know the details.
16:26Lau_of_DKla_mer, how difficult is it to run clojre on .Net instead of Java?
16:27blackdogla_mer, if you read the blog of charles nutter, he has lot's of opinions on that
16:27la_merLau_of_DK: Just grab ikvm 0.36, and compile clojure.jar down to an exe (or DLL, if you were to embed it into another app).
16:28Lau_of_DKand then just run clojure.jar.exe myclj.clj ?
16:28la_merLau_of_DK: I don't have my command line open anymore, but it's as simple as "ikvmc -target:exe -out:clojure.exe -main:clojure.lang.Repl clojure.jar"
16:28Lau_of_DKThats too easy - This is some serious cross-platforming
16:28la_merblackdog: Yeah, I know...I only follow him occasionally, mostly because JRuby is uninteresting to me. :-)
16:29la_merLau_of_DK: Yes, essentially -- although you'd want to make clojure.lang.Script your main method in that case
16:29la_merand, FWIW, I've not messed around with touching .NET bits from clojure, so there may be hidden dragons there.
16:31Lau_of_DKI cant tell if .Net is "better" than Java, but I think if nothing else, the libraries are insanely easy to dive into
16:41Lau_of_DKhttp://java.sun.com/javase/6/docs/api/javax/swing/ImageIcon.html#ImageIcon()
16:41Lau_of_DKGuys, shouldnt this work
16:41Lau_of_DK(import '(javax.swing.ImageIcon))
16:42Lau_of_DK(let [image-holder (ImageIcon.)]) ?
16:42blackdogleave a space afer swing
16:42Lau_of_DKshoot me
16:42Lau_of_DK:)
16:49Lau_of_DKYou guys had any problems with "No matching cstor" ?
16:50blackdogmake sure you have the right type passed to the function
16:50blackdogcan't find the constructor for the type you've given it
16:51Lau_of_DKSo you mean something #^String ?
16:51Lau_of_DKImageIcon(String filename)
16:51Lau_of_DK Creates an ImageIcon from the specified file.
16:52blackdogyou don't need to give it a type hint i don't think
16:52Lau_of_DKHow would you initialize that?
16:52blackdogoh
16:52blackdogso you eant to do
16:52blackdog(ImageIcon. "path to my file")
16:52Lau_of_DKAnd thats what I have now
16:52blackdogsure it's a filename and not a file?
16:52Lau_of_DKyes sir
16:53blackdogi mean File class not string
16:53Lau_of_DKImageIcon(Image image)
16:53Lau_of_DK Creates an ImageIcon from an image object.
16:53blackdogok, that looks fine to me :/
16:53Lau_of_DKDoes it work the type of automatically?
16:54blackdogyes
16:56Lau_of_DK (let [image-holder (ImageIcon. "fia.JPG" "Fia picture")
16:56Lau_of_DK icon-label (JLabel. "fia" image-holder)
16:56Lau_of_DK ok-button (JButton.)]
16:57Lau_of_DKThis is whats causing the problem, I have a suspicion that its the icon-label that not getting it
16:57blackdogthis works for me
16:57blackdoguser=> (import '(javax.swing ImageIcon))
16:57blackdognil
16:57blackdoguser=> (ImageIcon.)
16:57blackdogjavax.swing.ImageIcon@7f1e1bbf
16:57blackdoguser=> (ImageIcon. "my string")
16:57blackdogmy string
16:57blackdoguser=>
16:57blackdogno description
16:58blackdogactually adding desc doesn't have it throw an err either
16:58Lau_of_DKuser> (ImageIcon. "fia.JPG" "fiaPicture")
16:58Lau_of_DKfiaPicture
16:58Lau_of_DKuser> (JLabel. "fia" (ImageIcon. "fia.JPG" "fiaPicture"))
16:58Lau_of_DK; Evaluation aborted.
16:59Lau_of_DKI dont think the JLabel is understanding that param2 is an Image
16:59Chouser_ah, that's probably it.
16:59Lau_of_DKAnyway I can enlighten it ?
16:59Chouser_You might need a type hint there.
16:59Lau_of_DK#^ImageIcon ?
16:59Chouser_try it
17:00rhickeyLau_of_DK: evaluation aborted is the only message?
17:00Lau_of_DKI've never used those before
17:00Lau_of_DKicon-label (JLabel. "fia" (#^ImageIcon image-holder))
17:00Lau_of_DKThat gives me an ImageIcon cast error, cannot be converted to IFn
17:00rhickeya call to new is its own type hint
17:01Lau_of_DKrhickey, no I get the usual 20 lines of Java trace
17:01Chouser_(JLabel. (ImageIcon. "fia.JPG" "fiaPicture"))
17:01rhickeyLau_of_DK: don't ignore it, especially the first line
17:02Chouser_Lau_of_DK: you mean to be calling JLabel(String�text, Icon�icon, int�horizontalAlignment) ?
17:02Lau_of_DKrhickey, first line "No matching cstor found, IllegalArgumentException, 0: ...Reflector.invokeConstructor
17:02Lau_of_DKChouser, yea thats the one
17:02rhickeyright - have you got the right ctor args?
17:02Chouser_well, then you need a 3rd arg that's an int.
17:02Lau_of_DKChouser, the last one you posted worked, but loads no image
17:03Lau_of_DKrhickey, Im sure what you mean by ctor arg
17:03rhickeyconstructor argument
17:04Lau_of_DKNo I didnt. But thanks Chouser it was the last int that did the trick
17:04Lau_of_DKI gotta hit the sack - Thanks blackdog, Chouser and rhickey for helping out
17:06Chouser_rhickey: did you see that la_mer got Clojure working on .Net via ikvm?
17:06rhickeyChouser: yes, very cool
17:07la_merit would be nice if clojure could be made to work around whatever problems ikvm 0.34 has -- that's the last version that can target .NET 1.1.
17:08la_merrhickey: don't worry, I'm not looking at you for that -- I might try my hand at it :-)
17:08rhickeyla_mer: to which version of Java does IKVM 0.34 correspond?
17:09la_merrhickey: 0.34 uses the 1.5 versions of openjdk, I believe.
17:09rhickeyok, so it should be possible
17:10la_merThat's only relevant when you're using ikvm as a runtime, though -- ikvmc will take any java classfiles and deliver a DLL/exe
17:10la_merI think 0.34's problem is that it's reflection api is slightly broken, FYI.
17:10la_mers/it's/its
17:11rhickeyah
17:11la_merThat's why I don't expect anyone else to give a damn :-)
21:57drewrIs there a Clojure or Java operator for comparing the order of strings? I.e., (< "0830" "1000")...
22:04drewrHm, perhaps that's what compareTo is for.
22:12slavamost of the time, you don't want lexicographic order on strings
22:16drewrCan I cast to an int?
22:19Chouseryou can get an int by calling (.hashCode "1000")
22:19Chouser...but it's probably not the int you want for sorting. ;-)
22:20Chouser(Integer. "500") => 500
22:21drewrForgot Integer had a ctor for that.