#clojure logs

2008-10-27

00:51sohailhow are you guys doing multi-file projects in clojure? there is no asdf equivalent is there?
01:11danlarkinyou can leverage namespaces and :uses
01:12danlarkinor you can use #c
01:12danlarkinsorry
01:12danlarkin#'clojure/load-file
01:34larrytheliquidhow do you specify public vs non-public symbols in namespaces?
02:05bradbevhi all. I'm a Java & Clojure newbie. I'd like to have a thread sleep & from another thread send a wake up event. What is the usual way to do this? I've looked at wait & notifyall, but can't figure out how to obtain the monitor for the thread correctly, so feel like that might not be the correct way.
02:07danlarkinbradbev: a common pattern is have one function adding things to a list and another polling that list, which can block on an empty list
02:08bradbevdanlarkin: OK, so use a Java lib for the blocking list?
02:08danlarkinno, clojure lists,
02:09bradbevhow do I get the thread to block in the case of the empty list?
02:09danlarkinTBH I haven't started much into the concurrency aspects of clojure yet, but I think you can use refs to accomplish it with a regular old list
02:10bradbevthat does sound along the lines of what I want to do. But I can't find the magic to actually do it :)
02:10danlarkinlast week someone was asking about the best way to keep around a set of jdbc connection objects
02:10danlarkinto do connection pooling
02:11danlarkinand his first thought was to mark the ones currently in use as "dirty" or something
02:11danlarkinand then pull a clean one from that list, mark it as dirty, do work, mark it as clean, etc
02:11danlarkinbut rich suggested he just use the method I described to you
02:11bradbevah
02:12danlarkinalthough he was much more eloquent and descriptive
02:12danlarkinthan I was
02:12bradbevI guess I could try to find the logs that detailed that :)
02:12bradbevI get the concept, just the Clojure implementation is eluding me
02:12danlarkinyes, I'm sorry I can't remember the exact day
02:12danlarkinI believe it was this past week sometime though
02:12bradbevno probs
02:12danlarkinsearching for jdbc should turn it up
02:15danlarkinfound it
02:15danlarkinhttp://clojure-log.n01se.net/date/2008-10-23.html
02:15bradbevthanks, I'm looking now
02:15danlarkin11:14
02:15bradbevoh, awesome!
02:15bradbevthanks much
02:18danlarkinsorry... perhaps you can't use a regular old list
02:19bradbevLinkedBlockingQueue would do it
02:21bradbevunfortunately it's not quite the behavior I'd like. :( I really want the equivalent to WaitForSingleObject/SetEvent
02:25danlarkinhow does the behavior differ?
02:26bradbevso the code I'm writing is an emulation of some C code I've seen, just to see how different it is. There is a fixed vector of refs that represent work units. Worker threads look at the vector & pick the best work unit for them to do.
02:27bradbevWhen there are no work units pending in the vector, the worker threads should block until a new job is put into the vector.
02:27bradbeveven though it is not idiomatic, I explicitly want my data structures this way
02:28danlarkinI see
02:30danlarkinso a queue isn't what you want
02:30bradbevnope, fraid not :)
02:30danlarkinperhaps my original suggestion then? a list of "work", and any pushing/popping to that list you do inside a dosync?
02:31danlarkinI think dosync is correct... as I said I haven't learned the concurrency features much yet
02:31bradbevyup, that would do the same job. But for right now, I want to emulate the existing C code in terms of implementation as much as possible
02:32danlarkinso that would match, wouldn't it?
02:33bradbevnope. Having a blocking queue is a different mechanism for doing the same job. Right now I want to do the work just by having a vector, which is how the C code works
02:35danlarkinso is there a mechanism for making sure two workers aren't working on the same task?
02:36bradbevyes, in the C code a CAS (compare & exchange) operation is done in place on the vector. In Clojure, it is a Ref that I modify. I have the code doing the right thing now, except the threads busy loop when there are no jobs.
02:36bradbevsorry, the CAS is done on a single element of the vector
02:37danlarkinah
02:37Lau_of_DKMorning gents
02:38albinogood morning
02:38hoeckgood morning
02:38danlarkinmorning! 2:38 to be exact... what am I doing up!
02:40danlarkinbradbev: I'm stumped, then :-[
02:40bradbevdanlarkin: thanks, though
02:41danlarkinbradbev: haha no problem, sorry I brought you full circle back to your current implementation
02:41bradbevno probs :)
02:41danlarkinand I'm off to bed, night all
02:41bradbevnight
02:45PupenoGood morning.
02:45PupenoHi there Lau_of_DK!
02:46Lau_of_DKHey man
02:47PupenoLau_of_DK: How are you doing?
02:48Lau_of_DKIm doing good! Last day at work through 3 years, so Im excited. Secondly, Im wrapping my mind around Qt, I REALLY want to see Clojure/Qt intertwined!
02:48PupenoLau_of_DK: leaving your job?
02:48Lau_of_DKYes sir
02:48PupenoLau_of_DK: got a new one?
02:49Lau_of_DKYes sir, I'll be selling Linux/OpenSource solutions to danish businesses
02:50PupenoLau_of_DK: Congratulations then!
02:50PupenoLau_of_DK: Hope you enjoy your new job!
02:50Lau_of_DKThanks alot, I will!
02:51bradbevfor anybody following my previous issue, the way to obtain a monitor on a Java object from Clojure is (locking ...)
02:51bradbevit seems very silly to need to lock the object just so you can wait on it or notify other monitors to wake up
02:59PupenoLau_of_DK: I'm still thinking of writing about it, but Enclojure is a Clojure application (or library rather) that uses the Swing GUI designer.
03:00Lau_of_DKWriting 'it' ?
03:01Pupenoabout it, on my blog.
03:01Lau_of_DKQt ?
03:02Lau_of_DKThe reasons for Qt are much more than the just the ease of UI design. Its a powerful platform, well coding, works on Mac OSX, Windows, Linux, LiMo and WMobile. It would really bring some power to Clojure
03:02PupenoNo, mixing Clojure and the Swing Visual Editor.
03:03Lau_of_DKAh ok - Looking forward to it
03:05PupenoLau_of_DK: well, what I as saying is that it is not terra-incognita, Enclojure is already doing it.
03:05PupenoAnyway, I have to go to work now.
09:49cemerickI'm getting some very strange stack traces these days, with line numbers corresponding to whitespace, lines that are in the middle of an ns form, etc....
09:50rhickeycemerick: anything specific I could chase down, only on use/required files ?
09:51cemerickrhickey: I couldn't speculate on a domain at the moment -- lots of :use going on, and everything's mediated through gen-classed classes.
09:51cemerickIf I can narrow it down, I'll definitely post it.
10:01tayssirHi! Possibly dumb question -- I want to find out the namespaces of symbols. In the "user" namespace, when I type (namespace '+), I get nil... Does that mean + doesn't belong to a namespace?
10:02rhickeywhen you say 'blah you are giving the symbol named "blah" directly, to resolve a symbol you can syntax-qoute `+
10:03tayssirAh, thanks!
10:03tayssirGotta unlearn Common Lisp... ;)
10:06tayssirInteresting, symbols which represent names of special forms (quote, def, etc) don't seem to be associated with namespaces.
11:16scottj_How do you change the current directory within the clojure repl?
11:17jaoin slime?
11:17scottj_As in, the directory it looks at when you do (load-file "foo.clj")
11:17scottj_yeah
11:17jao,cd
11:21scottj_(swank.commands.basic/set-default-directory "/bar")
11:22jaoscottj_, didn't ,cd work for you?
11:22scottj_yeah, but I want to include it in my source code
11:23jdzscottj_: why would you want to do *that*?
11:23scottj_because I don't want to set the current directory everytime I load emacs, and it can be different I think based on what file you have open when slime starts
11:39ChouserIs there a better way to make a map whose keys are from the items from a seq and whose values are all 1?
11:40Chouser(into {} (for [i s] {i 1}))
11:44gnuvince_looks fine to me
11:45cemerickrhickey: disregard my missive re: line number from earlier. My bad.
11:49jdzscottj_: i always start slime in directory where i'm gonna work...
11:54vyI'd expect to see a generic CONCAT method instead of STR. Is there any?
11:55Chouservy: to build a seq or a string?
11:55vyA sequence.
11:56Chouser(concat [1 2 3] '(4 5 6))
11:57vyWhy does STRINGs treated different than SEQUENCEs?
11:58Chouserwell, they're different concrete objects. You can treat them similarly in a lot of cases: (concat [1 2 3] "456")
12:57duck1123does anyone have a working example of how to use the sql package to connect to a MySQL server?
13:06drewrduck1123: Which sql package? clojure-contrib?
13:09duck1123yeah
13:09duck1123I actually just got it connecting, but now I'm getting a different error
13:10duck1123Operation not allowed after ResultSet closed
13:10duck1123I'm trying to select a record and return it
13:11drewrLet's see code.
13:12duck1123lisppaste8: url
13:12lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
13:13lisppaste8duck1123 pasted "select a user and return the result" at http://paste.lisp.org/display/69305
13:16lisppaste8duck1123 annotated #69305 with "grabbed wrong version" at http://paste.lisp.org/display/69305#1
13:27duck1123ok, it appears I can print the value from inside the macro, but I don't know how to return it.
13:39duck1123is there a way to create a copy of a value?
13:39Chouserwhen values are immutable, that doesn't make much sense. You have a mutable value?
13:40duck1123no, I have a value that I can't access except for within the macro
13:40Chouserhm. I guess I'd need to see the code.
13:40duck1123it seems like I can do whatever I want with the results of with-results, except for return it or assign it to a var
13:41duck1123 http://paste.lisp.org/display/69305#1
13:44ChouserAh, I think it's because statement and result-set are closed when you leave the with-results block.
13:44ChouserYou could try copying the resultset-seq into a vector: (vec user)
13:44duck1123that's basically what I was thinking, let me try
13:45duck1123that works, thanks
14:06cemerickrhickey: ArraySeq.count is broken: (count (rest (to-array (range 10)))) => 10
14:07cemerickThe fix is simple (drop the usage of oa.length in ArraySeq.count), but I'll post a patch if you like.
14:07cemerickI presume that's an optimization, though -- maybe there's a more fundamental bug in how the index is being mishandled?
14:08cemericks/the index/the oa reference
14:11rhickeycemerick: fixed
14:12cemerickrhickey: thanks
15:27gnuvince_Chouser: lovely code btw (seq-xor)
15:31Chouseroh, thanks.
15:32ChouserIt seems a bit odd, I often end up choosing "for" over "map" because then I can return a literal data structure. (for [i s] {i 1}) vs. (map #(hash-map % 1) s)
15:33Chouserwhat I mean is, it seems like an odd reason.
15:34lisppaste8rhickey pasted "seq-xor, no counting" at http://paste.lisp.org/display/69309
15:34rhickeysorry, the counting bothered me
15:35achim_pChouser: indeed, very nice!
15:35achim_pthat's a really cool thing about clojure - efficient high-level data structures are built right in. algorithms often look like textbook pseudocode (plus parens ;)
15:38achim_pChouser: a minor itch: you should really check for odd count, not for count = 1. symmetric set difference defined for more than one set really only makes sense if defined like this ...
15:38Chouserrhickey: your latest behaves a bit differently when there are repeats within one of the seqs.
15:39Chouserachim_p: hm, good point. I didn't read the original poster's code carefully enough to see what he was actually doing there.
15:40Chouserbut with that behavior, counting makes even less sense.
15:42Chousergah, I'm losing my ability to identify the Right Way to right code in imperative languages. It all looks so bad, no matter what.
15:42Chousers/to right/to write/
15:43gnuvince_Chouser: been there :)
15:43gnuvince_You should see my Python code
15:43gnuvince_Super ugly
15:43gnuvince_bunch of generator expressions wrapped inside a couple functions from itertools
15:44danlarkin*shudder*
15:46ChouserI wonder how long it would take for me to port our entire C++ app to Clojure and re-train the development staff.
15:48gnuvince_Chouser: :)
15:48gnuvince_I was thinking the same thing with regards to a PHP daemon that was written a couple years ago.
15:49achim_phow expensive are conj/disj on the hashed structures?
15:49gnuvince_The daemon highlights a nice PHP flaw: resource ids are not reused. So after a few weeks, it reached 2^32-1 and the program crashes.
15:49Chousergnuvince_: yikes.
15:49gnuvince_Yeah
15:49Chouserachim_p: constant time! everything's constant time.
15:50Chouserwell, O(log-base-32) which comes close.
15:50gnuvince_and since this is a network application, I figured that Clojure would probably be good for it.
15:50achim_pChouser: yeah, in knew lookup was, but wasn't sure about "writes". thanks!
15:50achim_p"i knew"
15:51Chouserachim_p: Hm, well I think it's the same. Certainly slower, but the same big-O category.
15:52Chouserconj/disj have to copy one path through the tree rather than just navigate one path.
15:59achim_pyes, of course, that makes sense.
16:02scottj_Any compojure users here? Are you using session and cookies for users?
16:16gnuvince_So I've been golfing the seq-xor thing down to 86 characters :)
16:16gnuvince_damn you codegolf.com!
16:18Chouseryou're removing all the spaces you can?
16:18gnuvince_pretty much :)
16:18gnuvince_Haven't found a more concise way than you presented.
16:26jaohmm. so there's no 'retry' in the STM transaction API, is there?
16:28Chouserjao: as in to manually force a retry? I don't think so.
16:28jaoChouser, so, if i need some condition to be met, how can i wait on it? (say, a container non-empty, or something)
16:30Chouserif you want blocking behavior, try using some java.util.concurrent construct.
16:31jaobut then i'm outside the nice STM world, no?
16:32Chouseryes, you're right. Is that a problem? I guess I'd need to know more about your specific context.
16:33jaowell, no specific context, really. just that other STM systems i've seem provide this manual retry, and a typical use case is the one i mentioned.
16:33jaos/seem/seen
16:33Chouserthere are examples of using java concurrent classes in boot.clj. I think for the most part they and clojure's STM are covering different bases.
16:35Chouserif you want to manage the mutation of data objects, use STM (refs, agents, etc.). If you want to manage thread blocking, work queues, etc., Java provides nice APIs already.
16:35jaoi'd rather do all my programming on the clojure side. but oh well.
16:35Chouseryou can certainly block on something and then enter a dosync.
16:36jaoblocking implies some kind of lock and, therefore, the kind of pitfalls STM circumvents
16:37ChouserJava provides a lot of features in a lot of categories that Clojure doesn't try to mask or replace: Strings, most of regex, a lot of Math, a lot thread control, etc.
16:38Chouserjao: well, I'm not deeply experienced in Clojure's STM. There may be a case to be made for manual retries. You should post an use case or something to the google group.
16:39jaook
16:40Chousukejao: I don't think all locking is bad. what STM is for keeping your data consistent without complex locking, but if you have to block and wait for an event, using a lock for that seems natural to me.
16:40Chousuke+is
16:45jaowell, if i can obtain the same behaviour without locking, i'm happier
17:16GrahackHi folks, somebody running clojure on gij ?
17:19Grahackjava -cp clojure.jar clojure.lang.Repl works but gij -cp clojure.jar clojure.lang.Repl fails with a java.lang.NoClassDefFoundError: clojure.lang.Symbol
17:32rapidoi wonder: is clojure an 'lispy' array language in disguise?
17:32Chouserwhat's an array language?
17:32HunAPL?
17:32rapidoJ?
17:32rapidok?
17:32Hunyes - are we playing jeopardy?
17:33rapidothe sequence protocol is the crux
17:33rapidohowever, clojure's sequence is an immutable array
17:34rapidodon't know if APL arrays are immutable
17:34rapidobut i believe they are
17:35Chouserclojure sequences can be views of arrays, hash-maps, sets, lines of a file, just about anything.
17:36rapidoChouser: not anything, if not immutable
17:36rapidopreferably
17:37Chouserclojure seqs can be views of anything, though they can only mutate in part you haven't gotten to yet.
17:37rapidoChouser: what about views of views of ....: a big stack of views?
17:38Chouseryou can nest data structures, but if you ask for a seq of a seq, you just get the same object again.
17:39rapidowhat happens if you lazily concatenate sequences (n times)?
17:39rapidoyou build a stack of n 'views'
17:40Chouserhm, sure.
17:41rapido eventually that will show in the big O
17:43rapidoanyway, i think that clojure has a relationship with array languages
17:44rapidoidiomatic clojure code (using seq protocols) tends to lean towards an array language solution
17:47gnuvincerapido: I find that this kind of programming yields the nicest code, whether it be Clojure or Python or Smalltalk or Haskell.
17:48gnuvinceIt's so natural: take this list of things, do this to them, then take out the items that don't match this criteria, combine the remaining elements in this way and here's the result
17:48Hunmap/reduce :)
17:49rapidognuvince: if the problem fits the array approach, yes.
17:50rapidobut surely there problems that aren't feasible to solve, array wise?
17:50gnuvinceSurely.
17:50rapidopolymorphism
17:50rapido?
17:50gnuvinceHow do you mean?
17:51Chouserclojure has multimethods and a flexible taxonomy system.
17:51rapidoChouser: i know clojure has multimethods, that's my point
17:51rapidoapl hasn't
17:51gnuvinceAPL is also a lot older :)
17:52gnuvinceClojure builds upon a lot more litterature and experience.
17:52Chouserso maybe Clojure isn't an array language? I'm not sure what you're driving at.
17:52rapidomay be multimethods and the seq protocol could be a killer combination :)
17:52Chouserah. :-)
17:52Chouserplus STM
17:53Chouserplus easy Java interop
17:53rapidoimmutability rather
17:54rapidoSTM is a efficient compromise between mutability and immutability
17:54rapidoChouser: but yeah, i like the java interop - i'm a practical guy
17:55ChouserSTM is a nod to practicality too, I think, vs. a more "pure" immutable system.
17:58rapido impertinent remark: i think the current clojure implementation (in java code) is bit messy.
17:59rapidois bit <- is a bit
17:59Chouserrapido: :-) I've heard others express that.
17:59rapidobut i see why
17:59Chousermessy in real structure, or messy textually?
17:59rapidogetting to lisp as quickly as possible
18:00rapidobootstrapping ..... macros, ah yeah!
18:00rapidostructurally it is ok. but i don't like code that is commented out
18:00lisppaste8rhickey annotated #69309 with "seq-xor fixed for seqs w/dupes" at http://paste.lisp.org/display/69309#1
18:01rapidoso textually, yes
18:01Chouserrapido: yeah, that fits with other comments I've heard. Good thing that doesn't really matter. :-)
18:01Chouserrhickey: heh. nice.
18:03rapidorhickey: nicely compressed by the master :)
18:03wwmorganrhickey: are the global vars like *print-meta* officially supported? I wonder because I can't find any documentation for them.
18:04rhickeythanks Chouser for pointing out the dupe problem, once I started thinking sets I forgot it was spec'ed for seqs
18:04rhickeywwmorgan: *print-meta* is, and yes, not yet doc'ed
18:06wwmorganwould it be helpful if I documented them?
18:07rhickeywwmorgan: patch welcome if you've got a CA (don't have the list at hand)
18:07Lau_of_DKrhickey, Qt is really making some good stuff atm, and with QtJambi it runs on the JVM also - Are you considering taking some steps to make it easier to integrate QtJambi and Clojure?
18:07wwmorganI'll send one in
18:08rhickeyLau_of_DK: not in particular - it's just another Java lib
18:09Lau_of_DKrhickey, but Qt is a cross-platform lib that runs on Mac, Windows, Linux, Windows Mobile, LiMo, which makes UI design so easy, including Webkit and Multimedia libs... It would really bring some power to Clojure imo
18:10rhickeyLau_of_DK: I have nothing against QT, but there are lots of Java libs for lots of purposes - what's Clojure's role in supporting them other than the host interop? If the community wants to build enhanced bridge libs that's fine by me, but not a language issue
18:11Lau_of_DKOk youre right, I understand the seperation.
18:15rapidorhickey: i'm attracted to clojure's seq protocol.
18:15rapidoclojure may be not about lisp.
18:15rhickeyrapido: as far as Clojure's Java code - well, I'm not apologetic. That's what Java code in which there was a lot of experimentation looks like after a couple of years. It's easy now to imagine it cleaned up, and I may do that if I get time. What matters for me is the structure, esp. the class hierarchy, which is fine IMO
18:15rhickeyrapido: or maybe Lisp is about sequences in some sense
18:16rapidoit's about the right abstractions: concurrency is becoming more and more important
18:17rhickeyAlso there's a way to look at Lisp as programming directly with recursive data structures, in which case Clojure is even more a Lisp, given its recursive vectors sets and maps
18:17Chousukemaybe lisp should've been seqp, but that doesn't really sound cool.
18:17rapidolol!
18:20jaorhickey, what's the rationale for not having 'retry' (and perhaps 'orelse') in Clojure's STM? what substitutes it?
18:21rhickeyjao: I don't want to mix flow control and transactions
18:22rhickeyI don't want transactions to block, would prefer people use queues etc
18:23jaorhickey, i see. but say a transaction can only succeed (logically) if some collection has data... it'd be nice to be able to express that inside the STM; otherwise one has to use blocking primitives, i.e., dreadful locks... or am i missing something?
18:25jao(rhickey, ah sorry, didn't see your mentioning queues etc)
18:25rhickeythere are models for STM that are oriented towards implementing the facilities of j.u.concurrent with STM - I don't believe in that - use j.u.concurrent - the queues etc require no locking
18:25jaoi see. thanks.
18:25rhickeyonce you know you have work to do, do it in a transaction
18:25jaoaha
18:26rapidorhickey: your java code resembles my style: it works just to achieve a higher goal.
18:26rapidobut you are very gutsy to put it out like that! :)
18:27rapidorhickey: i see that your code is about making your concepts work
18:27rhickeywhat I put out was something that substantially works - I've seen plenty of prettier code that didn't
18:28rhickeyI admit it's not ready for people to jump into the compiler code, but the interfaces are nice
18:28rhickeyjust need some JavaDoc
18:28rapidorhickey: the most beautiful java code, imho, is the lucene implementation
18:29rhickeybut it's a matter of first things first - first thing is the Clojure side
18:29rapidorhickey: i understand that - i see that the java codes jumps to clojure with maximum stride
18:31rapidoenough about java - more about clojure!
18:32kotarakIs there some interest to make the Repl a "real" class? So it would be easy to provide customised Repls, eg. running via a socket connection. I made a simple patch, but I most likely don't grok the details.
18:34Chousukeon line 436 in boot.clj there's a comment that states that "at this point all the support for syntax quote exists". I find it pretty confusing that it just magically starts working and there's only a comment to note that. I guess it's because syntax-quote is defined somewhere else, but in terms of the macros and functions defined in boot.clj?
18:35rhickeyChousuke: yes, syntax-quote is a reader facility, defined in Java, but it emits Clojure that requires some of Clojure to exist to run
18:35Chousukeokay
18:36lisppaste8kotarak pasted "modified Repl" at http://paste.lisp.org/display/69317
19:02kotarakHow can I make an empty array? (to-array [])?
19:06danlarkinkotarak: looks like that's one way
19:07kotarakObviously I needed (make-array String 0).
19:08lisppaste8kotarak pasted "simple-minded socket repl using previous patch" at http://paste.lisp.org/display/69318
21:14gnuvinceHow would you transpose a sequence in Clojure?
21:14Chouser(doc transpose)
21:15Chouserjust kidding. What do you mean by transpose?
21:16gnuvince(transpose [[1 2] [3 4]]) => [[1 3] [2 4]]
21:16gnuvinceas long as you got the individual subvectors, you can do (map vector xs ys zs)
21:17gnuvinceBut that's not terrible when you got 20 rows
21:17Chouserand you could use apply on that. But I think there's a func...
21:18Chouserhm, maybe not. I was thinking interleave, but that's not right.
21:37Jedi_Stannisis there a function to find if something is in a collection? ie: (in? 2 '(1 2 3)) -> true, (in? 4 '(1 2 3)) -> false?
21:39ChouserJedi_Stannis: "contains?" works on the keys of a collection and is very fast.
21:40Jedi_Stanniswhat is I want it on the values like in my example?
21:40Chouser(contains? #{1 2 3} 2)
21:41ChouserIf you want it on the values, the only possible way to find it is to walk through the whole collection looking for it.
21:41Jedi_StannisI wrote a function to do that, just seemed like something that would be built in... sometimes I miss things in the api
21:41Chouserthat's slow, but you can do it like this: (some #{2} '(1 2 3))
21:42Chouserit's not among the standard functions because it's discouraged. If you're going to be looking for things by value, why not use a set (hash-set or sorted-set)?
21:42Chouserthen you can use "contains?" like above, or even more simply just: (#{1 2 3} 2)
21:42Jedi_Stannishmm, ok, I hadn't thought about that
21:42Jedi_Stannisill look into it for what im working on, thanks
21:43Chousernp
21:43Jedi_Stannisill be back if I have more problems
21:43Chouserok
21:53overthinkI have a question if someone has a minute... How would you best write a function that picks k random numbers from [1..n] with no repeats (think picking lotto numbers)?
22:04rhickeyoverthink: you could use a set and disj anything you pick as you go
22:08overthinkhm, that's an idea I hadn't considered
22:09overthinkI was trying to build a set up by looping, picking random numbers, and counting the keys
22:10overthink(I'm new to clojure, and functional programming in general)
23:29bradbevI'm finding Clojure's debugging via Slime a bit poor. I'd like to use JSWAT, but I'm on OS X 10.4 (Tiger) & can't get a recent version of Jswat to work. And I can't install JDK 6.0. Anybody else have this problem?
23:38pjb3Is it possible in clojure to have keyword arguments with default values?
23:38pjb3I think it is, or at least something close to it, anyone have a link to an example of that?
23:40Chouseryou can destructure the args into a map
23:41pjb3Chouser: Is there documentation on how that works somewhere?
23:42Chouserhttp://clojure.org/special_forms#toc4
23:47lisppaste8Chouser pasted "keyword args with defaults" at http://paste.lisp.org/display/69329
23:52pjb3Chouser: thx, I'm trying to figure out how it works, what is the :keys part?
23:52pjb3oh, nevermind, I see that in the docs now
23:53pjb3so :keys [a b c] is the same as a :a b :b c :c
23:54pjb3thats : c without the space, stupid emoticons
23:54Chouseryes