#clojure logs

2009-01-30

00:02lisppaste8hiredman annotated #74521 with "generic zipper based s-exp transform" at http://paste.lisp.org/display/74521#2
00:38durka42http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html
00:41cooldude127hiredman: what's with you and the point-free style lately?
00:44hiredmancooldude127: it is fun
00:44cooldude127lol
00:44hiredmanand that transform function is very useful anyway
00:45cooldude127hiredman: yeah looks like it
00:58ayrnieuvery irritating, and not actually an attempt to reinvent OOP: http://gist.github.com/54950
01:32Carkayrnieu what's irritating ?
01:36ayrnieucark - it's very brittle. a straightforward counter-tester immediately failed; while dealing with this I found that I could have an identical 'go' and 'omfgseriously', and only the latter would seem to work; (recur st) seems like it ought to work, but doesn't. And I keep saying "work" and "doesn't work" because I couldn't locate so many failures.
01:37Carkmaybe you need better error reporting
01:37Carkwhen working with agents, most errors are hidden
01:37ayrnieuI still don't know why this works but very similar earlier editions would support (! counter-tester :go) ... no failures, @counter-tester responds, but ... wait for it ... (? counter :status) shows no change.
01:39ayrnieualthough I'm happy that counter-tester responds to :please-stop even while it is sleeping or telling itself to :forever
01:41Carkthat not your trouble but, why do you need the ? function ?
01:42Carkcan't you just read the current state with @ ?
01:42ayrnieuI can in these examples, yes.
01:42Carkis it because you want it encapsulated behind a function call ?
01:43ayrnieuI want something to match the Erlang pattern where process A sends its Pid with a message to process B, so that B can reply to A.
01:43ayrnieurather, the more specific pattern where A sits and waits for B's reply.
01:44Carkyep i see
01:44Carkanyways for your problem i'd sprinkle a good dose of println statements all over the place to see what's hapenning
01:44Carkconcurrency is hard =/
01:46ayrnieuit's easier with enough architecture.
01:46ayrnieufor instance, how can I kill counter-tester without asking it so politely? :-)
01:47Carki don't think there's anything in clojure to do that
01:47ayrnieuhow can a monitoring process know when I do that?
01:47ayrnieuright.
01:48Carkwell you're inventing new constructs there ... if you could find a way to access the underlying thread object ...
01:49Carkor maybe you should start the thread yourself for complete control
02:27karmazillaTrying to run a clj class (compiled, gen-class'ed) I get an exception that the something__init.class could not be located
02:33karmazillanm
02:37lisppaste8ayrnieu annotated #74340 with "WFM. What are you doing?" at http://paste.lisp.org/display/74340#1
03:24zakwilsonHas anybody made a simple Swing REPL that I could add on to an app for debugging?
03:31ayrnieuyou can add clojure.contrib.server-socket:create-repl-server to an app for debugging.
03:33ayrnieuMikeM has a swing repl: http://groups.google.com/group/clojure/browse_thread/thread/64dd96887f23b08c/9b49c17330715693
03:33ayrnieulook here for related files: http://groups.google.com/group/clojure/files
03:35ayrnieuoh, and there's this: http://github.com/Chouser/textjure/blob/4e1ad10474b134214ca959068879647430b9de38/srepl.clj
03:47zakwilsonThanks, ayrnieu.
04:03AWizzArdMoin moin
04:26lisppaste8ayrnieu pasted "mysterious ClassNotFoundException" at http://paste.lisp.org/display/74563
04:27ayrnieu... can anyone explain that? This is for cl-format, which (among other things) is a pretty-printer for clojure, from CL. http://github.com/tomfaulhaber/cl-format/tree/master
04:31ayrnieuah, I see. It should be building a class for ColumnWriter, and is not. I thought the problem was that it didn't put the .clj in the .jar
04:47AWizzArdayrnieu: the ColumnWriter is a class yes? Why do you want to use it?
04:48AWizzArdshouldn't you instead (import it)?
04:48ayrnieuI don't, I just want cl-format to work. Its build.xml assumes that the class has already been compiled.
06:13hoeckwow, I just got the -> macro
06:23opqdonutyou mean the -> type?
06:23opqdonutor a lambda expression \x ->
06:24opqdonutwoops wrong channel
06:24opqdonutthought i was in #haskell, nvm
06:27hoeckopqdonut: i wish i could understand that too :)
06:30lenst,(macroexpand '(-> 1 (+ 2)))
06:30clojurebot(+ 1 2)
06:36zakwilsonI'm getting java.lang.NoClassDefFoundError: clojure/proxy/java/lang/Object$ActionListener when I try to compile a file that proxies ActionListener. I think I've seen this and solved it before, but I don't remember how.
06:48leafwsupose I have three variables, and I want to check that none of them is -1. What is an idiomatic way to do so?
06:49achim_pzakwilson: apart from proxy, compilation works for you?
06:50achim_pleafw: i'd do it that way: (not-any? #{-1} [x y z])
06:50leafwhum, but if you had to do that a couple thousand times ...
06:50leafwdoesn't look proper, even if idiomatic. Thanks in any case.
06:52leafwit does read, though, so clear :)
06:52leafwit's a pleasure to program again. I think I know too much java, and what ugliness java is going to under that short, nice, clear sentence.
06:59achim_pleafw: it's not especially slow. a chain of if-nots is faster, of course
07:03achim_pdoes anybody know of a smooth way of automatizing builds of mixed java/clojure projects?
07:03achim_pworst case scenario: an alternating dependecy chain java <- clojure <- java <- ... - can ant (or some other tool) be scripted to deal with this? i don't know ant at all
07:11leafwachim_p: then learn a bit of ant. The "simple" way to deal with circular dependencies is to call javac on all packages at once, letting java deal with them.
07:12achim_pleafw: yeah, but javac doesn't know how to handle .clj files
07:14leafwachim_p: true. Then you may need to do incremental compilations.
07:14achim_pleafw: is there any tool/framework that supports it?
07:15achim_pi'm looking at the java compiler api, but that doesn't seem to do dependency resolution at all (at first glance)
07:16Lau_of_DKcgrand: Did you fix that bug in core yesterday?
07:22leafwachim_p: I am not aware of any, but I don't use IDEs. Perhaps eclipse or netbeans let you do it.
07:22leafwparticularly the eclipse compiler, I've seen it do much smarter things than javac
07:24achim_pleafw: thanks! i'll have a look. maybe it can be used standalone
07:24Lau_of_DK,(let [s1 [1 2] s2 [1 2]] (identical? (rest s1) (rest s2)))
07:24clojurebotfalse
07:26HolcxjoMy understanding was that identical? is true in very few situations -- why would you want the two to be identical?
07:27Lau_of_DKThe question is (identical? 2 2)
07:27AWizzArdyes
07:27AWizzArdAll instances of primitive datatypes are Singletons.
07:27Holcxjobut (rest [1 2]) isn't 2, is it?
07:27AWizzArdBut in theory you should not rely on that.
07:28AWizzArdHolcxjo: correct
07:28AWizzArdThe rest is the vector that contains the 2.
07:29Lau_of_DK,(rest [1 2])
07:29clojurebot(2)
07:29HolcxjoI guess with a smart enough system one could hope for (let [s1 [1 2], s2 [1 2]] (identical? s1 s2)) to be true.
07:29HolcxjoBut I wouldn't count on it
07:29Lau_of_DKHolcxjo: The problem is, that this bug causes 'partition-by', which Rich himself wrote, to crash
07:30Holcxjolet alone for something to be derived from them to be identical...
07:30AWizzArdHolcxjo: well, it would be possible for the compiler to make them identical.
07:31AWizzArdThe problem is that this code runs on the JVM which was designed for a language that has side effects (Java).
07:31AWizzArdAnd in that case it would not be clear if you would actually want those objects to be the same.
07:32HolcxjoAWizzArd: But these are Clojure object which are immutable -- surely it is safe to make them identical?
07:32AWizzArdIn principle yes, but Rich would have to work for that to work.
07:32HolcxjoAWizzArd: Again, I appreciate that the Clojure will probably not do this optimisation; not really worth it
07:33AWizzArdThe JVM might not provide tools so that this behaviour could be implemented in one evening.
07:34Lau_of_DKI've seen Rich commit about ~8000 lines in a week, so.. its possible
07:34AWizzArdAlthough I think that the javac looks for string literals in source files and makes sure that each occurence of "hallo" references the same object in memory.
07:34AWizzArdLau_of_DK: right *g*
07:34AWizzArdI'm not sure though if Rich is actually a real person. Possible that he is in reality an advanced Clojure program...
07:34Lau_of_DKBut AWizzArd I think this is a change that has already been implemented, and then removed
07:35Lau_of_DK,(doc partition-by)
07:35clojurebotjava.lang.Exception: Unable to resolve var: partition-by in this context
07:35Lau_of_DK(doc partition-by)
07:35clojurebotNo entiendo
07:35cgrandLau_of_DK: it wasn't a bug in core, rich never made any guarantee about identical?
07:35Lau_of_DK(doc contrib/partition-by)
07:35clojurebotExcuse me?
07:35Lau_of_DKcgrand: But he made partition-by which now dies, so that makes it a bug right?
07:36cgranda bug in partition-by
07:36Lau_of_DKThats a matter of definition - But I can agree that its not a bug since there are no guarantees
07:37cgrand identical? must really be used with extra cautiousness
07:38AWizzArdhmm, where does partition-by crash?
07:38AWizzArdLau_of_DK: do you have a test case for me?
07:39Lau_of_DK(partition-by #(> % 5) [1 2 3 4 5 6 7 8 9 10])
07:39cgrandAWizzard: (partition-by identity [1 2]) in contrib < r423
07:41cgrandbut (partition-by identity '(1 2)) worked fine, most people must have been using partition-by on lazy seqs so were not experiencing this bug
07:48Holcxjoclojurebot latest?
07:51cgrandLau_of_DK: making the promise that (let [v [1 2]] (identical? (seq v) (seq v))) and (let [v [1 2]] (identical? (rest v) (rest v))) etc. return true would be fasible but would consume a lot of memory once the seq is realized (one seq object per item in the vector)
07:51Lau_of_DKThats true
07:52Lau_of_DKI dont really need it, I just thought it needed to be discussed, for the current situation I'll work my way around it
07:53cgrandthe current situation being your use of partition-by?
07:54Lau_of_DKYes
07:54cgrandyou don't want to update your copy of contrib?
07:55Lau_of_DKIf its fixed in contrib, updating is not a problem
07:56cgrandI fixed it yesterday when you reported the bug
07:56Lau_of_DKGood man - Thanks alot
08:06Lau_of_DKYou can pass the contents of a file to your function as a stream, using FileInputStream. What are my options if I want a plain string, to be passed as a stream ?
08:10cgrand(-> s (.getBytes "UTF-8") ByteArrayInputStream.) ; you can't use a Reader?
08:13Lau_of_DKIm not sure - Im Java illiterate
08:13leafwLau_of_DK: StringReader http://java.sun.com/j2se/1.5.0/docs/api/java/io/StringReader.html
08:15Lau_of_DKThat looks like the ticket
08:15Lau_of_DKThanks
08:15cgrandif you want to deal with characters use Reader/Writer, Streams are for bytes
08:16Lau_of_DKI need something that line-seq will swallow, ideally a BufferedReader of some sort
08:18Lau_of_DKStringReader -> BufferedReader works like a charm
08:22RaynesLau_of_DK: Does DK stand for Donkey Kong?
08:24AWizzArdor could it be Denmark?
08:25HolcxjoDenmark is quite likely -- ip address is from Aalborg, DK
08:27RaynesIt should stand for donkey kong.
08:27Raynes:<
08:28Lau_of_DKRaynes: Its short for Denmark
08:28RaynesThat sucks.
08:29HolcxjoRaynes: Denmark is quite nice actually
08:30RaynesI don't care. He shouldn't have DK in his name unless it stands for Donkey Kong.
08:30RaynesIt's just not right.
08:31HolcxjoThe spaniards might argue that you should not have "es" in your name unless you are from Spain. :-)
08:33Lau_of_DKHolcxjo: Its been a while since Denmark was 'nice' :)
08:33RaynesLau_of_DK: Is there any Donkey Kong in Denmark?
08:33Lau_of_DKRaynes... Do you want a recommendation for another channel that might be more your style of chatting?
08:34RaynesI'm just joking around. I didn't know off topic chatting was not allowed here, and I didn't realize I was bother anyone.
08:35Raynesbothering*
08:35Lau_of_DKDont worry about it - Normally Rich is pretty strict about off-topic chat. In this case, I just felt like it was a bit pointless :)
08:36RaynesMight I suggest making a channel specifically for off-topic chat. Even #Haskell has it's #Haskell-Blah off topic counterpart.
08:40Lau_of_DKRaynes: Its been discussed, and its been decided due to the low volume we currently have, that its best not to seperate the two.
08:40Lau_of_DKI agree with that actually, its great for newcomers to come in here and get the latest news straight from Rich
08:40Lau_of_DKHe's pretty active
08:42RaynesWhat logic is that? Have a channel set aside just for those who don't want to talk about Clojure, how could that possibly effect the volume of this channel? If people want to talk about Clojure, they will know where to go.
08:42RaynesYou'll have to explain what you mean better, because it just isn't sinking in for me.
08:44RaynesUnless you want more off topic chatter going on in here, and less people who actually talk. If that's the case then I suppose I'm wrong.
08:44RaynesWell anyways, I'm going to shut up with the off-topicness before someone cracks the whip.
08:46lisppaste8red_fish pasted "untitled" at http://paste.lisp.org/display/74571
08:47lisppaste8red_fish pasted "Object in clojure like javascript" at http://paste.lisp.org/display/74572
09:39cooldude127can anyone explain why taking the value of a macro is simply not allowed?
09:39keithbWhat is the best language construct to use when I want to perform a side effect n times? loop seems a little awkward because I have to explicitly state an exit condition with if.
09:39cooldude127what's different than taking the value of a function?
09:40cooldude127keithb: while? maybe a for with a dorun around it?
09:45durka42doseq?
09:46rhickeykeithb: dotimes
09:46rhickey(doc dotimes)
09:46clojurebotbindings => name n Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-1.; arglists ([bindings & body])
09:48keithbThanks, everyone. Rich, dotimes is exactly what I was looking for.
09:54rhickeylibrary page shaping up: http://clojure.org/libraries
10:05durka42i think clojure.org/libraries needs a TOC at the top
10:05durka42i bet it could be auto-generated
10:12red_fishWhat do you think about encapsulation in clojure by objects (hashmap)? http://www.crockford.com/javascript/private.html
10:13red_fishhttp://paste.lisp.org/display/74572
10:13leafwred_fish: isn't that a bean?
10:13leafw,(doc bean)
10:13clojurebot"([x]); Takes a Java object and returns a read-only implementation of the map abstraction based upon its JavaBean properties."
10:14red_fishleafw: I don't know
10:16leafw,(let [b (bean "that")] (:bytes b))
10:16clojurebot#<byte[] [B@7bd86d>
10:16cooldude127no not a bean in the sense of clojure, but it behaves an awful lot like a java bean
10:16red_fishit's a javascript tecnique
10:16red_fishfor private e public methods
10:17leafwyeah I see that the pastebin example is quite different. But that style is like building an object oriented system ... which you can do with defstruct
10:17red_fishthat's the point
10:17cooldude127in clojure, if you have a setter, you're doing it wrong
10:17red_fishhow can I implement encapsulation with defstruct?
10:18leafwred_fish: consider that perhaps you don't need encapsulation, because clojure objects are all immutable.
10:18cooldude127red_fish: what exactly do you need encapsulation for?
10:18leafwred_fish: only if you include java objects in them, with their imperative model baked in, you may want to protect them.
10:18red_fishcooldude127: to master complexity of big programs
10:19cooldude127red_fish: i'm not sure i understand. in clojure, i don't think encapsulation makes sense
10:19red_fishIn computer science encapsulation and information hiding makes sense
10:20red_fishfunctional decomposition doesn't scale to program of 10M sloc
10:20cooldude127we have data, and we have functions that operate on that data. but since everything is immutable, why do we need to hide anything?
10:20red_fishhide details
10:20red_fishconventional interfaces
10:20red_fishblackbox
10:21red_fishI would like to prove the OO is a particular case o functional paradigm
10:21cooldude127red_fish: you can achieve a black box by just creating a set of functions that operate on your data, and only using those functions to manipulate them
10:21red_fishhow can I enforce that?
10:21cooldude127encapsulation isn't necessary if you behave yourself
10:22cooldude127red_fish: why should you have to?
10:22red_fishJust curiosity
10:22Chousukeenforced encapsulation is pointless if you ask me.
10:23Chousukethere's always a way around it
10:23cooldude127it just doesn't make sense to me in a functional context
10:24cooldude127when there is no danger of your details being messed with, who cares who sees them?
10:26Chousukeof course a compiler can "enforce" encapsulation by doing type checking and stuff, but in a dynamic language you just need to trust the user not to do stupid things.
10:26cooldude127Chousuke: dynamic typing is all about trust
10:27Chousukeit's their fault anyway if they go and do things your library does not support.
10:27leafwred_fish: "functional decomposition doesn't scale to program of 10M sloc" -- check your premises. In my experience, only functional style with a very small mutable core enabled success in large projects with several developers.
10:27red_fishIf I don't publish a public interface, your client could write their own functions and you cannot change the implementation details of your data
10:28cooldude127red_fish: you should have already written your public interface
10:28cooldude127your library is the public interface
10:28red_fishthe functions or the data?
10:29cooldude127if they mess with your structures without using your functions, they're asking for it
10:29cooldude127red_fish: the functions are the interface
10:29ChousukeI have no experience of very large projects, but I have to say that I find functional interfaces much easier to cope with than something object-oriented, like the java standard library for example.
10:29Chousukethe java libraries have rather complex dependencies; if you have a functional interface, you can ignore all that.
10:30cooldude127yeah
10:30shoover``publish public functions, which accept and return data and internally control any side effects. clients can do what they want to the data, but they must call your functions to get side effects. verify the data yourself before making side effects
10:30ChousukeI guess it's closest to true encapsulation that you can get :/
10:31Chousukeif you have a function that is known to work, you do not need to know *anything* about how it works, because it has no side-effects :)
10:31red_fishshoover``: you mean I have to you defn- and def-?
10:32cooldude127yeah those would be advised if you don't want something to be public
10:32red_fishcan you explain how would you implement separation of responsability in the snake example?
10:33cooldude127not familiar with the snake example
10:33red_fishhttp://github.com/stuarthalloway/programming-clojure/blob/a3c829f5726c0ab1e565aff86a2e68eca8539a47/examples/snake.clj
10:34red_fishwhere is the public interface?
10:34shoover``red_fish: yes, I've seen examples where state is maintained via refs and agents hidden behind functions. you can define the state with def- to make sure it doesn't leak out
10:34red_fishwhere are the implementationd details?
10:35Chousukered_fish: the public interface is the "game" function
10:35shoover``the clojure standard library is full of examples that hide implementation details. agents and refs themselves, for example. simple function interfaces that hide all kinds of details
10:36Chousukered_fish: that's not so great an example though as it's not a library
10:37red_fishthe snake entity (or object in java) is not encapsulated very well in my opinion
10:37Chousukered_fish: but you can see how the code is divided to the functional parts, then the mutable parts, and then the UI part.
10:37cooldude127red_fish: what's wrong with the snake?
10:38Chousukeit's a functional piece of data; it's not like you can modify it from the outside
10:39red_fishhow can I identify the functions that modify the snake structure?
10:39cooldude127red_fish: nothing modifies a snake
10:39red_fishok
10:39cooldude127red_fish: snakes and everything else are immutable
10:39red_fishthat produce new snake?
10:40Chousukered_fish: you can look for functions that take a snake as an argument.
10:40red_fishprobably I should create a namespace only for snake
10:40cooldude127red_fish: the ones that sound like it: turn, move, etc.
10:40red_fishthat's the problem
10:41red_fishimage 10M sloc
10:41Chousukeah, well, that's just a naming problem.
10:41Chousukeyou can name them snake-turn or something if you want.
10:41red_fishturn what? snake, car, plane...
10:41cooldude127red_fish: ok, separate the namespaces
10:41cooldude127that's hardly an encapsulation problem
10:41Chousukeor make a multimethod :)
10:41cooldude127yeah that
10:42red_fishI wanna make a new game
10:42Chousukewith multimethods the actual work methods could be defined private too, I guess
10:42red_fishif I wanna make a new game and reuse the code of snake, I cannot
10:42cooldude127red_fish: why not?
10:43Chousukered_fish: if you have snakes like the snake in the game, sure you can. :)
10:43Chousukeyour snakes could even have extra attributes, because the snake is just a map
10:43red_fishthe contract between me and the person who wrote the snake stuff is not clear enough in my opinion
10:43cooldude127red_fish: the snake example was not written to be a library
10:43cooldude127it's a silly example for the book on how to write an app with a gui
10:44red_fishok
10:44red_fishI will find a better example
10:44red_fishthx
10:44Chousukeany "contracts" are just documentation issues. :)
10:44cooldude127a library should have a better contract
10:44gnuvinceI gotta say guys, the Clojure community is growing pretty nicely. Nearly 120 users on the IRC channel, the Google group is pretty busy and I had an answer to a question on my blog within an hour.
10:44cooldude127but that doesn't mean we need enforced encapsulation
10:44cooldude127gnuvince: gotta love it
10:44gnuvincecooldude127: definitely
10:45Chousukestatic type checking can be nice though; but you don't OO to get that.
10:45cooldude127for instance haskell
10:45Chousukeyeah. that.
10:45gnuvinceHaskell++
10:45gnuvince:)
10:45cooldude127i wish i could understand haskell well enough to have fun with it
10:46Chousukeor you could write OO with a functional style, anyway.
10:46gnuvinceDidn't Rich talk about having something similar to Qi inside Clojure?
10:46Chousukelike the snake example kind of is.
10:46Chousukethe snake is an object, and the functions that take a snake are its methods :)
10:47cooldude127yeah
10:47gnuvincehttp://clojure-log.n01se.net/date/2008-12-11.html#10:25
10:58AWizzArdAlthough a static type system over Clojure would be a nice thing, it would also result in a different language.
11:07gnuvinceAWizzArd: undoubtly.
11:31zakwilsonRegarding the earlier discussion about encapsulation, I think you're most likely doing something wrong if a Clojure application gets to 10M loc.
11:31Chousukeheheh
11:32red_fishzakwilson: do you mean that big applications of 10M sloc are all wrong or only if they are written in clojure?
11:32Chousukered_fish: I think he means that no application would be 10M loc in clojure
11:33red_fishOpenOffice is 10M sloc, if I read correctly http://en.wikipedia.org/wiki/Source_lines_of_code
11:33Chousukewell, OO.org is not written in clojure :)
11:34red_fishWhat's the difference?
11:34zakwilsonOO is, I think written in C++ and a little Java.
11:34red_fishThe language is not good for that task?
11:35zakwilsonClojure allows significantly more compression of code.
11:35red_fish10 times?
11:35red_fishthan would be 1M of sloc
11:35gnuvincered_fish: If you code in Clojure like you should, it will be extremely unlikely that you would ever reach 10M lines of code.
11:35zakwilson10 times, or more.
11:36kefkaWhat is the "best practices way" of exposing a Clojure function so it can be called from Java?
11:36red_fishCan I write a program in clojure of 100K of sloc or it's madness?
11:36Chousukered_fish: sure you can. but by clojure standards, that is already a very large program :)
11:36gnuvincered_fish: sure; but what we mean is that Clojure has potential for more abstraction than Java, so you should end up with less boilerplate code.
11:37zakwilsonAny repetative code can be abstracted away with a macro.
11:37danm_this conversation seems to be putting the cart in front of the horse, anyway
11:38danm_I think the best well known large lisp application is probably the one from ITA?
11:38kefkaI assume there is a way to do this, right? How do you call a Clojure function from Java?
11:38danm_and I believe they said the one app is around 500k loc
11:38Chousukekefka: there's an example of that on the site I think
11:38red_fishcan I write a new webbroweser in clojure?
11:38Chousukeof course.
11:39cooldude127red_fish: if you're unsatisfied with current web browsers
11:39danm_I'm unsatisfied with them, but I can't figure out why
11:39danm_(haha)
11:39kefkaWhere? I'm under intense time pressure right now.
11:39Chousukeit's not a question of whether you can, but whether you should :)
11:39kefkaChousuke: Where is the example?
11:39kefkaChousuke: Is it in that proxy function in the Java Interop section?
11:39zakwilsonCL doesn't have enforced encapsulation, unless you do it yourself with closures, and I don't think that's ever been cited as an issue by anybody who has used it for large applications.
11:39red_fishnext word processor in clojure :-)
11:40scottjdanm_: emacs has 1M loc
11:40danm_scottj: there you go
11:40zakwilsonAnd CL does nothing to discourage mutation.
11:40danm_crazy
11:40Chousukekefka: hm, no.
11:40danm_scottj: how much of that is elisp?
11:40Chousukekefka: let me see if I can find the example.
11:40Chousukedanm_: probably most of it.
11:41Chousukebut emacs is gigantic
11:41scottjdanm_: there's over a million in lisp, much less than that in C
11:41danm_emacs sure is gigantic
11:41danm_emacs is like golf, easy to get started with, impossible to master
11:42Chousukekefka: ah, it was in the wiki: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Invoking_Clojure_from_Java
11:43Chousukekefka: that's one way; another way is to use gen-class to generate a java class.
11:43Chousukeor proxy, if you just need to subclass something/implement an interface.
11:44zakwilsonIn any case, if you want encapsulation and such, it wouldn't be that much work to build your own object system on top of structmaps.
11:45zakwilsonI think Paul Graham's "On Lisp" has a design for one.
11:45cooldude127zakwilson: but it just seems to make things more complicated for no gain
11:45cooldude127especially in clojure
11:46zakwilsonI agree, cooldude127. red_fish seems to want it though.
11:46cooldude127yeah
11:46cooldude127i'm trying to convince him he doesn't need it
11:47ChousukeI think property-oriented programming (as Yegge would call it, I think) fits clojure. that is, if you need an object, just use a map :)
11:47cooldude127yeah
11:47cooldude127i've been doing a lot of that
11:48zakwilsonYes, though property-oriented programming did include inheritance. It wouldn't be hard to do structmaps with inheritance and the name stored somewhere such that it could be used for method dispatch.
11:49cooldude127zakwilson: inheritance is actually already there
11:49Chousukeor just normal maps I guess.
11:49cooldude127look into hierarchies
11:50zakwilsonOh.
11:51cooldude127zakwilson: they're kinda new
11:53zakwilsonWow... those do exactly what I thought was missing from Clojure's multimethods relative to CL... except for that before/after/around part.
11:53cooldude127zakwilson: lol
11:53zakwilsonI have very occasionally found around methods to be exceedingly useful.
12:05dnolenzakwilson: http://tinyurl.com/dd2ljx, I started a project to see how difficult it be to get basic inheritance, multiple inheritance, and default initial values all based on structs. Also I removed the need to manage tag hierarchies. You only need to use them in multimethod dispatch.
12:06dnolenzakwilson: doesn't wouldn't be too hard to implement before/after/around as long as you don't mind calling a macro instead of the built into multimethod constructs. they are very cool and useful.
12:06dnolendoesn't seem it would be too hard i mean.
12:08zakwilsondnolen: I think the problem with that is where before/after/around are most useful for adding functionality to a library or some such where the original author may not have anticipated the need. (what seems to have been branded as aspect-oriented programming more recently)
12:10dnolenzakwilson: true but it also allows the original to present a better API (that is not forcing users to call super). Sometimes a method really requires some sort of pre-and-post side effect (internal bookkeeping), before/after/around let's you logically keep those methods together.
12:11hiredmanscope is coming
12:12hiredmanhttp://paste.lisp.org/display/73838
12:13hiredman^- scope for :fails :succeeds and :exits
12:14gnuvince,(isa? "" java.lang.String)
12:14clojurebotfalse
12:14gnuvince,(isa? (class "") java.lang.String)
12:14clojurebottrue
12:16dnolenhiredman, cool I saw that earlier, :enters of course would be nice.
12:18shoover``whidden: I have a workaround for the hanging slime repl
12:24lisppaste8shoover pasted "hack so slime repl doesn't hang" at http://paste.lisp.org/display/74588
12:24lisppaste8shoover annotated #74588 with "alternate fix, haven't tested on XP yet" at http://paste.lisp.org/display/74588#1
12:51whiddenshoover: just implementing it now.
12:52whiddenshoover:yeah!!
12:55whiddenShoover: at least on my xp box it works, so it now you can say limiited testing on xp.
12:55shoover``btw, which paste did you test? the .el or the .clj?
12:55whiddenboth
12:55whiddeni switched the read ahead of the write
12:55whiddenin the clj
12:56whiddenand added the println call in the el
12:56whiddenwant me to back out one of the changes?
12:56shoover``did you test them separately? as in, leave el alone, patch connection.clj
12:57whiddennope
12:57whiddeni can quickly do that now, if you like.
12:57shoover``please do (restart emacs, just to make sure). I've only tested the first patch. the second is a hunch
12:58lisppaste8shoover annotated #74588 with "attribution for idea to switch order of stream creation" at http://paste.lisp.org/display/74588#2
12:59whiddenshoover: i backed out the connection.clj change and we have success.
13:10shoover``those fixes both look pretty random, but here's what threw me: if you trace back through versions of Clojure, the hang comes into play when Ref.java stops calling UUID.randomUUID
13:16whiddenshoover: i read the doc... i don't think the order in this case matters, but may in the future.
13:33hiredmanclojurebot: monads?
13:33clojurebotmonads is http://www.bolour.com/papers/monads-through-pictures.html
13:33hiredmanclojurebot: monads is also http://okmij.org/ftp/Scheme/monad-in-Scheme.html
13:33clojurebotc'est bon!
13:33gnuvincehttp://www.lispcast.com/lisp1.html
13:34cgrandgnuvince: I found no way to comment on this blog: http://www.reddit.com/r/programming/comments/7tny8/the_beauty_of_lisp1/
13:35StartsWithKany one here using apache ivy to track external dependenys for there clojure projects?
13:52jbondesonI love people: http://www.3ofcoins.net/2009/01/30/common-lisp-clojure-and-seriousness/
13:52jbondeson(don't know if that was already posted)
13:56Chousukemy idea of a toy language is a bit different from his definition :/
13:57WizardofWestmarcI think a lot of people's is
13:57jbondesonyeah, the whole "If it's not from a committee it's a toy" is hilarious
13:57waltersi'm sure he collects canned food for a nuclear catastrophe too
13:57WizardofWestmarcI read that and went "Perl's a toy language? Really?"
13:58WizardofWestmarcI'm not a Perl fan but come on
13:58jbondesonI also love that anything on a VM is a toy
13:58WizardofWestmarcoh, and Python's a toy too!
13:58ChousukeThough I think if you dig deep enough, he has a point.
13:58knaprwell id love a standalone clojure version. maybe i should writ eone. write iots own VM in asm
13:59technomancythe point is if you are good with adjectives, it's easy to be belittling.
13:59WizardofWestmarcby his definition that's still a toy
13:59jbondesonproblem is it'd be sloooow
13:59knaprwell clojure doesnt have a spec does it?
13:59WizardofWestmarcand yeah, trying to make something faster then the JVM and it's years of optimization research would be hard as hell
13:59Chousukebut he still makes it sound like these non-serious languages are somehow inferior.
13:59gnuvinceBy his definition, Common Lisp is not a serious language, because it depends upon C for its bootstrapping as far as I know
13:59knaprmy point would be, who the hell cares? it gets shit done...
14:00WizardofWestmarcgnuvince: pretty sure CL bootstraps off of itself now
14:00jbondesonwell, yes, I think that once clojure hit's 1.0 there may need to be a published standard.
14:00jbondesonhits even
14:00WizardofWestmarcit was just the first versions were written in C
14:00gnuvinceWizardofWestmarc: not a single .c file in there?
14:00ChousukeWizardofWestmarc: SBCL does at least.
14:00jbondesonummm... cl was around long before c.
14:00Chousukeit needs itself for compilation
14:01WizardofWestmarcit can compile off another CL last I knew, not just prior SBCLs
14:01ChousukeI guess
14:01Chousukemy macports installation just downloaded a binary version of SBCL to compile it :)
14:01WizardofWestmarcright, it certainly CAN use prior versions of itself
14:01zakwilsonCommon Lisp wasn't around before C, but earlier Lisps were.
14:02WizardofWestmarcit just doesn't have to be ONLY sbcl
14:02gnuvinceOh the famous "If rhickey get hit by a bus" argument
14:02ChousukeBut I don't think Clojure needs a formal spec
14:02Chousukejust good documentation
14:03knaprwhat is it called when you attribute human attributes to dead things/machines? soemthing with -morphism...
14:03gnuvinceantropomorphism?
14:03vsthesquaresantropo
14:03durka42anthropo
14:03zakwilsonSBCL can be compiled with SBCL, CMUCL, OpenMCL or CLISP, according to its website.
14:03durka42not too shabby
14:04zakwilsonThough I think I once tried to compile it with CLISP and discovered that it's no longer supported.
14:04knapryes http://en.wikipedia.org/wiki/Anthropomorphism
14:05gnuvince,(mod -3 2)
14:05clojurebot1
14:05jbondesonChousuke: I think a formal spec would be nice, it wouldn't prevent change, it would simply allow for porting to different VMs or specialized compilers
14:05gnuvince,(div -3 2)
14:05clojurebotjava.lang.Exception: Unable to resolve symbol: div in this context
14:05gnuvincehmmm
14:05Chousukejbondeson: hmm.
14:05zakwilsonBut I think the idea that a language that's tied to a specific platform is a toy is silly.
14:05technomancyyeah, I'd be in favour of a formal spec once 1.0 has been out a while
14:05gnuvinceIf there's quot and rem, shouldn't there be div to complement mod?
14:05technomancyas long as it's an automated spec suite
14:05Chousukejbondeson: well, good enough documentation could act as a spec :P
14:05zakwilsonJava is tied to the JVM as well, and for all its faults, I don't think Java is exactly a toy.
14:06Nafaijbondeson: CL was first introduced in 1984, standardized in 1994. C was introduced in 1972.
14:06Chousukejbondeson: just when you talk about a "formal" spec I keep thinking of the CL hyperspec
14:06gnuvinceI like how Perl 6 are doing it: anything that passes the Perl 6 Test Suite is considered Perl 6
14:06Chousukewhich, while great, is not the easiest thing to read.
14:06hiredmanif CL is a serious language, why the hell would you want to be serious?
14:07technomancydefinitely not something like the hyperspec
14:07jbondesonChousuke: It doesn't have to be monolithic, but it should outline the contracts that the low level clojure functionality provides
14:07jbondesonNafai: yeah, i looked that up, I thought CL got started in the 70s
14:07technomancyChousuke: the rubyspec project is self-verifying
14:07zakwilsonI actually think implementation-defined is a Good Thing. Code is less ambiguous than human language.
14:08zakwilsonIt does it the way the official implementation does it, or it's wrong.
14:08technomancyzakwilson: that's why the spec needs to be code as well
14:08hiredmanbecause CL is so popular and is used everywhere because it is so serious
14:08hiredman...
14:08gnuvincezing
14:08Chousukejbondeson: I think the host interaction could be problematic though.
14:08hiredmanoh
14:08hiredmanI think I forgot my sarcasm marker
14:08hiredman?
14:09zakwilsonCL does have a few more users than Clojure.
14:09Chousukefor now :)
14:09hiredmanzakwilson: *snort*
14:09technomancygotta take velocity into account
14:09zakwilsonIn any case, it seems absurd to call either a toy language.
14:10hiredmanis a rock with more moss on it a better rock?
14:10technomancyzakwilson: are you kidding? It's a great way to be able to sidestep what would be an otherwise-serious challenge to the dominance of CL. it's brilliant; you don't have to give real objections.
14:10jbondesonChousuke: that's exactly why you want a spec though. if the host machine can't uphold the contract is it actually a valid implementation of Clojure?
14:11ChousukeI wonder.
14:11ChousukeI mean, clojure leaves out a lot of basic stuff because the host provides it already.
14:12technomancyChousuke: a spec would make it easier to keep Clojure and ClojureScript in sync
14:12ChousukeI suppose.
14:12zakwilsonCobol and Java are obviously among the best languages ever invented since more LOC exist in those than just about anything else ;)
14:12Chousukeif you wanted clojure to be reimplementable you'd have to specify higher level wrappers for the basic functionality.
14:12technomancyzakwilson: and elisp is obviously the best lisp ever. =)
14:12jbondesonYeah, but how many of those java LOCs are generated! =P
14:12hiredmanDuck Languages for Duck Types
14:13zakwilsonJava: so easy, even your IDE can write it.
14:14knaprdo you guys feel clojure is for the future? i mostly think it is really good now. and in the future something like haskell (or perhaps a cleaned up, less verbose, better type-inferenced scala)
14:14gnuvinceknapr: "The best way to predict the future is to invent it"
14:15hiredmanknapr: neither of those is a dynamic lisp functional lisp
14:15gnuvinceI think Clojure has more promise as it's more "practical" right now than Haskell, but I wouldn't be surprised if the influence of Haskell was felt very widely in the future.
14:15hiredmanwhich is what I crave
14:15jbondesonI've said it before, but haskell would need a big corporate sponser to take it to "professional" status.
14:15hiredman~clojuritis
14:15clojurebotExcuse me?
14:15hiredman~clojureitis
14:15clojurebotclojureitis is a condition in which it becomes impossible to program in other languages anymore
14:15zakwilsonI think Clojure is the best general-purpose language for now and the near-future. I don't expect the JVM to be dominant forever, but whatever does end up being very useful in the future will probably be influenced by Clojure.
14:16gnuvincejbondeson: I think it would need more than that. Some people just don't get functional programming (immutable values, first class functions, etc.)
14:16iceyFor the folks who came to Clojure from Ruby & Python, do you feel that Clojure is *currently* more productive than those languages for day-to-day use?
14:17technomancyicey: it depends on the problem. definitely not for very simple things because of the JVM init time and the lack of a package manager.
14:17zakwilsonicey: I've made occasional use of Ruby in the past, and I absolutely feel that Clojure is more productive for building applications.
14:18zakwilsonRuby, on the other hand is much better for small scripts, in large part due to startup time.
14:18gnuvinceicey: I came from Python (but with some baggage from CL and Scheme) and *right now*, it's not, because I am not familiar at all with the Java library
14:18technomancyfor things that are very unixy Ruby is still a better choice for me
14:18gnuvinceas I learn it, I imagine that it'll become easier and faster and be in the same league as Python, definitely,.
14:19zakwilsonCL was my language of choice before Clojure, and I do find Clojure more productive in general. Dealing with the Java library does occasionally make me want to tear out my hair.
14:19iceygnuvince: that's actually the source of my question. I'm a C# & Python guy today, and I keep running into the whole "I don't know Java" problem when working with Clojure.
14:19jbondesongnuvince: Yes, but clojure still has that problem, and possibly moreso due to the lisp-y style. Though, I think any programmer worth his salt should be able to be up and running in a functional language withing a couple of days
14:19iceyor rather, I don't know what's available in Java
14:19hiredmanicey: google + javadoc = win
14:19zakwilsonFortunately, there are a LOT of tutorials out there for doing... just about anything in Java.
14:19zakwilsonSome of them are even good.
14:20gnuvincejbondeson: at least Clojure doesn't separate IO code from pure code and have things like "monomorphism restriction" that could kill 3 newbs in one swift ;)
14:20iceyhiredman: yeah, I need to be better about googling. I find myself reinventing things that probably already have really good libraries.
14:20WizardofWestmarcJava is some of the most documented coding infrastucture available, probably since it's used by everyone and their mother :P
14:20zakwilsonOn the subject of the Java libraries - does anyone else consider classes that exist solely to be arguments to the constructors of other classes to be an antipattern?
14:20gnuvinceicey: I feel that the way to remedy this is to just take on a project and try to push your way through
14:20jbondesongnuvince: hahaha, very true. The 'language' of clojure is much less, shall we say, academic
14:20hiredmanzakwilson: it is the only way for java to have closures right now
14:21zakwilsonhiredman: I'm not sure I get it.
14:21gnuvincejbondeson: I've found that pretty much all dynamically typed languages (save for Perl) usually have much simpler semantics than statically typed languages.
14:21hiredmanzakwilson: you make an anon inner class
14:23iceygnuvince: you're probably right. I just need to find something non-trivial to make ;)
14:23gnuvinceicey: good luck :)
14:23zakwilsonhiredman: I'd probably have to write some non-trivial Java to really get it. Thanks for trying to explain.
14:24hiredmanzakwilson: so java has this syntax for making an anonymous "class" sort of like (fn [] ) makes an anonymous function
14:25hiredmanand the anonymous class inherits it's definition from some other class or interface
14:25sohailhiredman, the closure created by an anonymous class can only use final variables. Which is fine, given clojure's nature :-)
14:25hiredmansohail: *shrug*
14:26zakwilsonRight, I've heard of that, and I can see how it would be useful. What I can't see is why it would be useful for a constructor to take a Foo, which is just a wrapper around three ints, instead of three ints.
14:26jbondesonthis is when conversations get tangled, talking about closures and clojure
14:26hiredmanI am just explaining why someone writing java may have a class that is only used as a parameter
14:26zakwilsonWhen a Foo is NEVER used for anything else.
14:26hiredman*shrug*
14:27zakwilsonSo... you subclass it anonymously and then pass that to a Bar constructor, making the new Bar something like a closure?
14:27hiredmansort of, yes
14:28zakwilsonI think I may still be missing something, but since I don't anticipate ever using Java, I don't think it matters too much.
14:28hiredmanugh, I just don't get it
14:28zakwilsonI get Java well enough to call it from Clojure. That will do for the moment.
14:29hiredmanCLJOS?
14:29jbondesonheh
14:29zakwilsonSomeone's trying to replicate CLOS in Clojure?
14:29jbondesonCLOS was powerful in CL
14:29jbondesonconvoluted, but powerful
14:29dnolenzakwilson: hardly, it's an attempt add some OO features to structmaps
14:30dnolenI started it, it needs a LOT of work
14:30zakwilsonThe thing I miss is before/after/around.
14:30jbondeson:before, :after, and :around were great for stacking methods
14:30technomancyhiredman: I think the name's misleading
14:30jbondesongah
14:31zakwilsonI didn't actually use them very often, but when I did, any other solution would have required half a page of extra code.
14:31hiredmanso the java object system, then another one?
14:31jbondesonafter was perfect for implementing what people now call AOP
14:32technomancyhiredman: then a good one, hopefully. =)
14:32dnolentechnomancy: agreed, it was joke, open to suggestions, clj-object?
14:32zakwilsonjbondeson: I said the same thing a couple hours ago,
14:32technomancydnolen: I'm a fan of names that are unique without using "clj" or clj-related puns... but they are harder to come up with.
14:33hiredmanjbondeson: have you seen (scope ...) ?
14:33dnolentechnomancy: yup.
14:33LordOfTheNoobszakwilson: since, excepting basic types (integers, characters, etc), only objects can be created in java, in order to pass a first-order function with internally bound state you have to create an anonymous object containing the state with the function attached to its definition. Instead of an anonymous function with enclosed state, it is an anonymous object with class variables and an invoke method. ( or so I understand )
14:33technomancydnolen: I like to draw from mythology and history
14:33technomancyor non-clj-related wordplay
14:36jbondesonhiredman: i've never used it, but i assume scope is a form of binding macro?
14:37hiredmanjbondeson: it lets you define actions that happen when you leave the scope
14:38hiredmanI don't really know common lisp, but that sounds sort of like before/after
14:39WizardofWestmarcit does sound sorta similar to after if I'm understanding it (scope) correctly
14:39zakwilsonIt does, except that you can add a before/after/around method to an existing generic function without touching its source or any calls to it.
14:40jbondesonright, you can stack onto methods very easily
14:43zakwilsonSo you can do something like (defmethod dispatch-request (:around dispatch-table) (unless (banned? (get-ip)) (call-next-method)))
14:44zakwilsonAnd I've done exactly that with Hunchentoot.
14:44jbondesonhiredman: where is scope defined? I can't find it in core or contrib.
14:45hiredmanjbondeson: it us an up and coming feature
14:45jbondesonah
14:45hiredmanclojurebot: horizons?
14:45clojurebothorizons is http://gist.github.com/51721
14:45jbondesonit sounded familiar
14:45hiredmanI took a crack at it there
14:45zakwilsonhttp://paste.lisp.org/display/73838
14:45jbondesonthat was what rich was discussing the naming about last week
14:46hiredmanjbondeson: ugh, must has missed that
14:46hiredmanhe was talking about "named" scopes
14:47hiredmanso you could attach to a scope by name, not just the one you happen to be in
14:47jbondesonhuh
14:48jbondesoni'd have to see that in action.
14:48gnuvinceSometimes, I wish rhickey was more of a blogger; I'd love to hear about upcoming features that he's working on (e.g.: LFE)
14:49WizardofWestmarcThe less time he spends blogging, the more time he can spend coding
14:49hiredman_ugh
14:49BigTomLFE?
14:49WizardofWestmarcthough I will say, watching his video presentations is really interesting.
14:50hiredman_BigTom: left fold enumerator
14:50WizardofWestmarchm, missed hearing about that one (LFE)
14:51BigTomhiredman_: thanks (I hope to know what that means soon :-/ )
14:54WizardofWestmarcoh
14:54WizardofWestmarcit's part of the new streams stuff
14:54WizardofWestmarc*duh*
15:00BigTomAnyone used the new watchers with swing?
15:00BigTomMy toy GUI broke :-(
15:02hiredmangui :(
15:04BigTomI'll try and pull the code out, I was using watchers to update the EDT and I can't get the new way to work
15:06jbondesonnow now hiredman, some times guis are necessary!
15:06hiredmanyeah, but I hate at them
15:07jbondesonheh
15:07jbondesonI'm a big Qt fan, never been a fan of other GUI toolkits.
15:07technomancysaves a lot of pain when you can't go modal
15:08WizardofWestmarchaha rryan
15:09gnuvincebut I hate writing guis
15:09gnuvinceboring boiler plate code
15:13WizardofWestmarcfrom the snippits I've seen looks like clojure can hide a lot of it (go go magic macros!)
15:15jbondesonthe thing i hate the most about guis is that you're always solving the same problems over and over again, just with slight twists.
15:15hiredmantextjure just needs to get to the point where it can embed images and rendered html snippets in the repl output
15:16jbondesonhaha
15:17hiredmanI would still use vim though, I think
15:18jbondesonemacs fo' life
15:27BigTomhm
15:28BigTomI'm getting a java.util.concurrent.RejectedExecutionException when I send an action to an Agent (with a watcher), anyone have any pointers?
15:29kotarakBigTom: maybe you can post some code to a pastebin?
15:29kotaraklisppaste8: url
15:29lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
15:29BigTomyeah, this won't be pretty...
15:31lisppaste8BigTom pasted "untitled" at http://paste.lisp.org/display/74605
15:31BigTomthere you go
15:33BigTomIt worked a while back, when I ran it up today the add-watch no longer worked (new Clojure), my attempts to replace it have succeeded
15:35kotarakWhich one of two watcher blocks to I have to comment in? Both?
15:36BigTomThe last one
15:37kotarakI just get tons of null pointer exceptions.....
15:37BigTomHmm, it throws the RejectedExecutionException with or without the watchers
15:39lisppaste8BigTom annotated #74605 with "untitled" at http://paste.lisp.org/display/74605#1
15:39kotarakNot for me. The Swing window opens. But it seems I can do nothing. The a dialog pops up, that I lost....
15:40BigTomHow do I check me clojure version?
15:40gnuvinceBigTom: svn info
15:41kotarakHuh? Is it add-watch or add-watcher?
15:42kotarakadd-watch is highlighted. But add-watcher is in Clojure. Was it renamed?
15:42BigTomit was add-watch, now it is add-watcher
15:42eleftherioscan one call any java library from clojure or there is some other way?
15:42kotarakOh. Ok. Have to update the highlighting.
15:44kotarakeleftherios: (def thing (new java.thing.Class)) (.someMethod thing with-some args here)? http://clojure.org/java_interop, does this help? Or do you have a specific problem?
15:44BigTomI am on v1235
15:45kotarakme too.
15:45kotarakIn your second version, I get a wrong number of arguments for add-watcher.
15:45BigTomyeah, the arity changed too
15:45BigTomthe args and their relationship changed
15:46kotarakOk. So which version should I try? The first one you posted or the second one?
15:46eleftherioskotarak: no, I just couldn't find a FAQ about how one can use the Java libraries :-) Thanks
15:46BigTomI grabbed cells off the mailing list, that works
15:46eleftherioskotarak: no specific problem, just investigating if I should learn more :-)
15:46kotarakeleftherios: than the link should get you going. :)
15:47BigTomThe second definitely used to work with the old watchers
15:47BigTomI wasn't sure if I had broken the other when investigating
15:47kotarakCan you post me the one which gives you the error?
15:47eleftherioskotarak: so in short (from what I gather from the link) one can call anything from the Java library?
15:48eleftherioswith the dot notation
15:48BigTomeleftherios: pretty much
15:49kotarakeleftherios: Yes. java.Class/staticMember, (java.Class/staticMethod), (java.Class.) or (new java.Class) for constructor, (.method thing ...).
15:49BigTom,(Math/sqrt 4)
15:49clojurebot2.0
15:49eleftheriosso one could suggest clojure as a replacement to Java for a large project
15:49kotarak,Math/PI
15:49clojurebot3.141592653589793
15:49eyerisIs the Clojure Google group moderated?
15:49WizardofWestmarconly for first posts afaik
15:49kotarakeyeris: the first post is checked by Rich
15:50kotarakyeah, WizardofWestmarc was faster. :)
15:50eyeriskotarak Thanks. I just wanted to make sure I didn't somehow screw it up :)
15:50WizardofWestmarcwell I cheated and didn't type his name :P
15:50kotarakhehe
15:50kotarakThat's why the first post often shows up twice.
15:51WizardofWestmarc...I never thought of that
15:51kotarakThe first hangs in the "Rich" loop and so many post it again.
15:51kotarakThen both get posted.
15:51WizardofWestmarcdoes the group say on the GG page that the first posts are moderated?
15:51kotarakNo.
15:51kotarakAt least I'm not aware of such a notice.
15:52BigTomkotarak: I am being dragged away, thanks for the assist, I'll work it out and get back to euler.
15:53kotarakBigTom: have fun! :)
15:53BigTomkotarak: cheers
15:55Lau_of_DKHey hey good folk of Clojure
15:59gnuvinceHi Lau
16:09cadscan anyone here recommend the enclojure plugin for netbeans?
16:09cadsor is it at a point where I ought to take a hit and just learn emacs?
16:11WizardofWestmarcI tried it out of curiosity, had a lot of repl problems, but that was a while ago
16:11WizardofWestmarcof course I'm not a netbeans guy so...
16:11kotarakcads: you can also give Vim a try...
16:12cadsemacs has been on my tolearn list forever and a day
16:13cadsbut the only time I have reason to is when I learn a new language, where having to learn emacs at the same time would be frustrating, and I end up using an IDE!
16:13Lau_of_DKcads, emacs is well worth it :)
16:13kotarakcads: it's an editor like any other.... The enclojure or the Eclipse plugin might become some viable alternative.
16:13kotarakI'm working on bringing Vim on par. :)
16:13Lau_of_DKkotarak: please...
16:14Lau_of_DKcads: Emacs is superior to all competetion in every regard. You are welcome to test out 10 editors and get back to me, and tell me that Im right.
16:14cadsthe macro facilities alone
16:15cadsemacs has always radiated power at me
16:15ChouserI've given emacs a good solid try at least twice before, and come crawling back to vim each time.
16:15leafwmacros in vim are trivial. Unfortunatey, vim REPL's are not so good; usually involve screen (like gorilla does)
16:15leafwsame here. ViM forever. I don't have two special fingers to push control+this alt+that for trivial commands.
16:16kotarakleafw: gorilla does not need screen
16:16leafwkotarak: then the other. I always give up on REPLs in vim.
16:16kotarakleafw: with the newest generation in nailgun it should be at least as pleasant an experience as with SLIME.
16:16kotarak(reading all the SLIME post on the group...)
16:17Chousernext time I try emacs, I will not try to learn the "emacs way" do things as I have in the past. I will conform it to my will from the very beginning.
16:17brianhcads: as someone who used vi (many years ago) & now uses Eclipse, learning emacs has been a little... shall we say... painful
16:17Lau_of_DKChouser: I think thats the whole point of Emacs
16:17Lau_of_DKIts bendable in every direction
16:17kotarakI tried eclim today. Eclipse + Vim. Seems to have some problems still....
16:17cadsbrianh, is there an eclipse plugin for clojure?
16:18kotarakcads: clojure-dev
16:18Chouserkotarak: I've used jVi with netbeans -- it's not a terrible start.
16:18cadsnow, I'm usually against using an IDE altogether, especially on my dated hardware, as modern ides are so damn heavy
16:18brianhcads: haven't tried it myself though
16:19cadsnice would be a clojure based IDE like what squeak does
16:19cadswhile managing to be pretty light and quick
16:19kotarakChouser: netbeans has problems on my mac. The create project dialog doesn't fit on my screen because it's too wide!!!!!! Must be trouble with the german version I guess....
16:19brianhwhy stop there. let's take it all the way to the metal! ;)
16:20cadsbrianh, was wondering about how hard that would be
16:20cadsseems a lot of work is saved for the java compiler
16:21brianhcads: easy. just ask Chouser to do it!
16:21cadsbut I was wondering if clojure could be translated to common lisp, or c
16:21cadsbet it wouldn't be anywhere near trivial
16:22kotarakthat's the only true way of editing anyway: http://en.wikipedia.org/wiki/File:IBM_Port-A-Punch.jpg
16:22ChouserI bet it would be possible to AOT-compile Clojure to C++ source with one of those automaitic garbage collector libraries attached.
16:22kotarakboehm gc probably
16:24cadswhile we're at it we'd tack on the jvm so it could still do java stuff :D
16:24brianhkotarak: that picture just made me feel better about emacs. thx!
16:25ayrnieujust be sure to remap Caps Lock to Control.
16:25brianhayrnieu: won't help me
16:26lisppaste8hiredman annotated #74521 with "prefix partial application maker" at http://paste.lisp.org/display/74521#3
16:26cadsemacs feels like it would be very powerful once you learned a few things about organizing and discovering key shortcuts. Once you've put in the time to customize your own working set of commands I'm sure you fall in love with it
16:26brianhayrnieu: i'm trying to use this: http://www.alphagrips.com/
16:28ayrnieucads, I fell in love with Emacs long after I'd learned all that stuff, after I'd learned for years. I was doing transcription with a lot of mark-up and manual complexity, and wrote an Emacs mode for this.
16:28WizardofWestmarccads: emacs and vim are both like that IME.
16:28WizardofWestmarcthough vim is more just learning enough of the shortcuts
16:28hiredmanugh
16:28hiredmanmistpaste
16:29ayrnieu"Ohhhh, *this* is why people like Emacs!" For programming in already programmer-friendly languages, it isn't so impressive.
16:29kotarakvim vs. emacs is like hg vs. git: doesn't matter any is better the notepad/CVS
16:29cadshaven't used vim enough, I'm sure they're both 'turing complete' in the sense that they both can achieve ostensibly the same things, but in emacs it feels like you're in a mini operating system, while vim seems a lot more minimalist
16:29dnolencads: http://refcards.com/docs/gildeas/gnu-emacs/emacs-refcard-a4.pdf, and excellent reference card of emacs shortcuts that's well formatted that I used ot use.
16:29cadsdnolen: thanks! I love cheatsheets
16:29lisppaste8hiredman annotated #74521 with "prefix partial application maker for reals and working this time" at http://paste.lisp.org/display/74521#4
16:30kotarakcads: vim is very consistent in the shortcuts: operator + motion. Always the same just different commands or motions...
16:30dnolencads: np, lots of ugly ones out there, that one is the best IMO.
16:32cadskotarak: on thing i've wondered about is what does switching to the dvorak keyboard do to emacs or vim
16:32hiredmanit makes you re-think your silly choices?
16:32kotarakcads: dunno :) Don't use dvorak. But I figure it is painfull..... I would probably remap all commands into the old positions
16:32cadsI wonder if the workflow would be hurt badly, or whether you could use the old keys still
16:33cadshiredman, what does that code you pasted do?
16:33ayrnieuit doesn't do anything special. People who navigate in vim one-handed have made up special dvorak modes for it. I never did that and use vim on dvorak as-is. It's comfortable.
16:34WizardofWestmarcI could never use dvorak simply because I deal with other people's computers enough I wouldn't get the 100% benefit of it
16:34ayrnieuhljk become jpcv
16:34WizardofWestmarcand going back and forth between full on keyboard layouts? Ungh
16:34hiredmancads: it turns (f � h) into (comp f h) and (?f h) into (partial f h)
16:34cp2yeah WizardofWestmarc
16:34cp2it gets annoying for me
16:34cp2switching between school and home
16:35cooldude127hiredman: what does that second one look like? it's a square for me
16:35hiredmancooldude127: cirlce with a vertical line through it
16:35cooldude127oh
16:35hiredmanI just picked it off some symbol table in wikipedia
16:35cooldude127lol
16:36cadshiredman: in the second case, (partial f h), we take a function f which may take more than one argument, and return a function which takes one fewer arguments, and represents f where the first argument has been fixed at h?
16:36hiredmanyes
16:36cadscan we curry functions?
16:36cooldude127hiredman: my emacs doesn't show all the symbols right
16:36hiredmancooldude127: could be your font
16:37hiredmancads: that is more or less what partial does
16:37hiredmanor uncurry
16:37hiredmanor whatever
16:37brianhhiredman is going to turn clojure into apl here soon :)
16:37kotarakcads: there is partial - (partial + 2) - and there is #() - #(instance? % thing)
16:37cooldude127i've used another font before, not sure why i don't have it. what are you using?
16:38hiredmanuh, right now? I think putty is set for dejavu sans mono
16:38cooldude127hiredman: oh
16:38brianhi think that was the one with all the strange symbols...
16:38cooldude127brianh: i think you're right
16:38hiredmanbrianh: which is why I picked it
16:39hiredmanthe point of my paste is not so much the pl macro, but the transform function
16:39hiredmanwhich is really cool.
16:40brianhhiredman: have you used it before?
16:40hiredmanbrianh: used what?
16:41cooldude127apl i think
16:41brianhapl
16:41hiredmanNo
16:41cadscould we have a function curry such that (f x y z) <=> ((((curry f) x) y) z)? That is, I'm sure we could curry a function so that it takes one argument and creates a function of one argument and so on till it returns a final value, but in other lisps (lisp-2s, I think), the syntax would not be so pretty
16:42kotarakcads: I dont think this is possible. How do you handle (defn foo ([x] ..) ([x y] ...))?
16:42hiredman,(partial (partial (partial (fn [x y z] [z y z]) :a) :b) :c)
16:42clojurebot#<core$partial__3607$fn__3609 clojure.core$partial__3607$fn__3609@d8fb2b>
16:42hiredmanoops
16:42hiredmanone too many partials
16:42hiredman,((partial (partial (fn [x y z] [z y z]) :a) :b) :c)
16:42clojurebot[:c :b :c]
16:42hiredman,((partial (partial (fn [x y z] [x y z]) :a) :b) :c)
16:42clojurebot[:a :b :c]
16:42hiredman:P
16:43hiredmanwrite now there is no way of querying function arity information from an IFn
16:43hiredmanright
16:43cadshmm
16:44cadsI bet we can still wrap it in a higher order function to get a function's curried form
16:45ayrnieuyeah, or the programmer can use partial application directly, more flexibly, and more readably with #(foo %1 a %2)
16:45cadssomething which would take care of how many arguments the function takes and essentially build up a partially applied function
16:45hiredmanyou would have to try the function, and if it throws an exception then use partial
16:45hiredmanvery tedious
16:46hiredman(doesn't mean I am not thinking about it)
16:46ayrnieuyes, the direct, flexible, and readable solution is very tedious if you're haskell-wanking for its own sake.
16:46hiredmanayrnieu: know I think what you are suggesting is fine
16:47hiredmanwriting the solution for what cads and I are talking about would be tedious
16:48hiredmantry/catch ad infinitum
16:48cadshaskell wankage aside, a function in working fully curried form is interesting exercise of the language
16:49hiredmancads: anyway, with my pl macro you can turn you function application into a partial application just by prefixing it's name with the right glyph
16:50ayrnieuno, an interesting exercise would be a memoize function, function combinator utilities, something to make easy hot-code loading, etc.
16:50hiredman((?(?(fn [x y z] [x y z]) :a) :b) :c)
16:50hiredman,(doc memoize)
16:50clojurebot"([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use."
16:50cooldude127yeah i thought we had that
16:50ayrnieufunction combinators, I have wanted in Clojure, and you can see the basic need for them in that the conj function exists.
16:51hiredmanyeah
16:51hiredmanK would be nice
16:51ayrnieuand since they're intentional and not automatic, you don't need any special fn-querying feature.
16:52hiredmanbut K is just sort of a reverse do I guess
16:52ayrnieu(defn flip ([f] #(f %2 %1)) ([f a]) #(f % a)) ([f a b] #(f b a)))
16:54hiredmandamn
16:54hiredmando is a macro
16:54ayrnieuit's a special form, not a macro.
16:55hiredman,((comp first list) :a :b)
16:55clojurebot:a
16:57ayrnieu(let [flibtwist (comb a b c -> b c a)] ...) <- write in a diagram of the odd little thing you want to do in this one case.
16:57ayrnieuoh, that's -rot
16:59ayrnieuwhich differs from #(%1 %3 %4 %2) in that it covers the lower-arity cases, as flip does above.
17:16eyerisI'm new to ant. Could someone explain to me why target -> java -> classpath -> pathelement puts clojure.jar inside braces as ${clojure.jar}?
17:16eyerisI imagine those are variables, but I don't see clojure.jar assigned anywhere in the build.xml file
17:18ayrnieuare you sure that <property name="clojure_jar" location="clojure.jar"/> isn't in the file?
17:19eyerisI'm positive. Although I am getting an error that clojure.lang.Compile isn't in the CP, so that makes sense :)
17:19eyerisI'm just trying to confirm that the <property> tag is what is missing
17:20ayrnieuare you talking about clojure-contrib/build.xml ?
17:21eyerisNo, it's from clojureql's build.xml. I just solved ti.
17:22kotarakeyeris: put in clojure.jar=/path/to/your/clojure.jar in a file called local.properties.
17:23eyeriskotarak Yep :)
17:24eyeriskotarak The latest cql commit fails aot compile.
17:24kotarakeyeris: local.properties is ignored by git, so it is not trashed when you do an update
17:24kotarakYes. I noted.
17:24kotarakWill push a fix.
17:24kotarakStupid mistake.
17:27kotarakeyeris: Uh. No. My mistake again. The broken commit is not yet pushed. The current state compiles. :)
17:32eyerisI get java.lang.IllegalArgumentException: Wrong number of args passed to: core$defmulti (backend.clj:98)
17:32kotarakeyeris: your clone is not up-to-date. The defmulti syntax changed. A fix is in the repo.
17:34eyerisStrange. When I run "git log" I see "Bring defmulti up to date with new syntax"
17:34eyerisand "git pull" says "Already up-to-date."
17:35kotarakHmmm... Maybe a wrong branch?
17:35kotarakOr "old" Clojure?
17:35eyerisI just re-cloned it and I get the same results.
17:35eyerisPerhaps old clojure.
17:35eyerisbrb
17:37arohnerhrm. clojure.main dies when there is an exception in --init, even if you ask for a repl
17:37arohnerI'd like a repl regardless of the exception, so I can use the repl to figure out why it's dying
17:38eyerisThat solved it. Silly mistake on my part.
17:38cadshas anyone written a clojure tutorial that covers lispy programming subjects? Such as how one can use cons lists to represent trees, with a simple function to map over these trees and such? I understand that clojure abstracts over data structures and presents a large library of functions applicable to data structures that export a simple 3 function interface, are there any articles that talk about this?
17:40hiredmanclojurebot: sicp?
17:40clojurebotsicp is http://web.mit.edu/alexmv/6.001/sicp.pdf
17:40hiredmanclojurebot: sicp?
17:40clojurebotsicp is http://web.mit.edu/alexmv/6.001/sicp.pdf
17:41hiredmangrrr
17:41hiredmancads: there is a wiki somewhere with stuff from the first chapter of sicp transliterated into clojure
17:41cadsthat sounds wonderful
17:41hiredmanhttp://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages:Clojure:Chapter_1
17:42cadsI was contemplating whether I should try following along in sicp using clojure
17:42cadsI'm excited about the clojure book coming out
17:42ayrnieuthe Little Schemer, Learn Scheme in Fixnum Days, Practical Common Lisp, etc. Call out to these the way you would leverage Java libraries.
17:43ayrnieuthe clojure book is pretty good. You can buy it on PDF and read the betas today.
17:44dnolencads: sicp is fantastic, I recommend it. I got all the way the metacircular evaluator, cool stuff. that was 5 years ago. Nice to come back to a Lisp.
17:44cadsThe little schemer still stands out in my mind from when I read a sample chapter introducing lisp to me, and the first thing they did was define the halting function and show a proof of why it's uncomputable.
17:45cadsIt was so elegant
17:46arohnergrr. I really wish git could output svn patch files
17:46ayrnieu... and this was in the Little Schemer? This book? http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/0262560992
17:46arohnerI have a patch for clojure in my git working copy, and I can't attach it
17:49cadsayrnieu: I think it was, let me see if I can find it again
17:50cadswhat struck me was how useful it was to use lisp in figuring just as one would use math expressions to derive a formula
17:51eyeriskotarak With the newest clojure and newest cql I get this exception when running this query: http://pastebin.ca/1323161 (sql/query [ID T_FIRSTNAME T_LASTNAME] p9662 (< ID 2000))
17:52kotarakObviously I'm too stupid to use multimethods. :(
17:53eyerisIt looks to me like line 343 changes the type to ::Execute
17:54eyerisI just don't know if that should be ::Select or not
17:54kotarakeyeris: I shouldn't work on software at this time of the day.
17:55kotarakeyeris: Will look into it tomorrow. I understand the problem.
17:55eyerisOkay
17:55eyerisThanks
17:55kotarakI tried to be too clever.
17:55kotarakNever a good idea.
17:56eyeris"��Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
17:56eyerisI love that quote :)
17:57kotarakYes. That's true.
17:57kotarak:)
17:57eyerisTime to clock out.
18:15technomancywhat kind of project?
18:31AWizzArdwhy does (take 0 (lazy-cat [(println 10)] [(println 20)])) print the 10?
18:32AWizzArd,(take 0 (lazy-cat [(print 10)] [(print 20)]))
18:32clojurebot10
18:33AWizzArdis that a bug in my thinking, or in lazy-cats docstring or in lazy-cat?
18:33hiredmanI believe this has come up
18:34AWizzArd,(doc lazy-cat)
18:34clojurebot"([coll] [coll & colls]); Expands to code which yields a lazy sequence of the concatenation of the supplied colls. Each coll expr is not evaluated until it is needed."
18:34hiredmanAWizzArd: http://w01fe.com/blog/2008/12/clojure-and-lazy-seqs/
18:36hiredmanAWizzArd: basically, you are running into the reason why nil punning has to go
18:36AWizzArdwhat is nil punning?
18:36hiredman(if someseq something somethingelse)
18:37hiredmanthe idea that a seq might be nil
18:37AWizzArdso, do you regard this behaviour of lazy-cat as correct or do you see it as a bug?
18:38ayrnieuI regard it as poorly documented, at least.
18:38hiredmanAWizzArd: I think it something that is not correctable with the current behaviour of seqs
18:38hiredmanayrnieu: sure
18:41AWizzArdthanks for the info hiredman
18:42hiredmanAWizzArd: it might be a good idea to ping the group, Chouser, or rhickey about adding something to the docstring
18:44karmazillatechnomancy: a search engine for our maven repository
18:44cadsWow, clojure repl + rlwrap is comfy
18:50karmazillatechnomancy: front-end and searching written in RoR, and indexer/crawler in Clojure
18:51technomancycool
18:52karmazillaone day + two people = one search engine :)
18:52cadsinteresting to hear about ruby/clojure interop. Were you using jruby?
18:53karmazillano.. the two were fairly disconnected and merely talking to the same database
18:54karmazillathey either end up total cowboy hacks, or devoid of features
18:55technomancyyee-haw, pardner.
19:02ayrnieu,(let [completions '(foo bar baz)] [(interpose "\n" completions) (interleave completions (repeat "\n"))])
19:02clojurebot[(foo "\n" bar "\n" baz) (foo "\n" bar "\n" baz "\n")]
19:08hiredman,(doc completetions)
19:08clojurebotjava.lang.Exception: Unable to resolve var: completetions in this context
19:08hiredman,(doc completions)
19:08clojurebotjava.lang.Exception: Unable to resolve var: completions in this context
19:09hiredmanbah
19:09hiredmanI must be going blind
19:11ayrnieuhttp://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started , I just switched it to use (System/getenv "HOME") and interleave
19:14cadswhat are you guys doing/
19:15cadsah, I just followed that guide to create my completions for rlwrap
19:17cadsare there plans to create packaged clojure environments for the likes of debian or redhat?
19:17Chousukemaybe that should wait until 1.0 :)
19:19cadsthe getting started guide was really helpful, now i've got a fun little clj app with completions and history
19:22RaynesI just bought Programming Clojure.
19:22RaynesFirst programming book I've bought in a long time.
19:22lisppaste8sa pasted "as" at http://paste.lisp.org/display/74624
19:23hiredmanhuh
19:23hiredmanmust be a mischan?
19:25ayrnieu#chromium is plausible
19:25hiredmannah
19:25hiredman#chromium is for the browser right?
19:25hiredmanthis is google appengine
19:26ayrnieu#chromium is a python thing and a Google Chrome thing
19:26hiredmanok
20:13technomancy~time
20:13clojurebotmultimethods is what separates the boys from the men.
20:13technomancynice
20:39durka42why does clojure say "no such namespace Blah" when it means "static class member Blah/foo not found"
20:53durka42bit twiddling in clojure seems like quite a jump across abstraction levels
20:53durka42then again, i'm sure java has an enterprise xml-based api for what i'm doing, which is prying apart RGB colors
20:59cadshehe
21:00cadsbleh, java
21:01Chousukedurka42: well, there is the Color class. :)
21:01Chousukenot quite XML though.
21:01ChousukeApparently you can pass it an integer that encodes an RGB value though
21:02durka42that is what i have
21:02durka42apparently bit shifting is wicked slow
21:02cadsI have this clojure file that requires two .class files to be present in the classpath, should I export CLASSPATH first to point to those class files, or what's the correct way?
21:03Chousukedurka42: well, you're probably doing it with boxed integers?
21:03durka42most likely
21:03durka42are there unchecked versions of bit-and and bit-shift-right?
21:03durka42the integer was passed to me by a hopelessly complicated quicktime library
21:04cadsbleh, specifically I'm trying to get this code working: http://groups.google.com/group/clojure/browse_frm/thread/ce795dd1fb646df1
21:04Chousukewhat do you need to get out of them? Color has .get{Red, Green, Blue}
21:04durka42i mean, the javadoc says the parameters are ints, not Integers
21:05durka42maybe autoboxed though, don't know much about that
21:05durka42Chousuke: that would do it, but i don't see any reason why unless it's faster than bit-shift-right
21:05durka42will test
21:05Chousukedurka42: you might want to tell clojure that the integer you get from the quicktime thingy is a native integer and not a boxed one.
21:06durka42how would i do that?
21:06ChousukeI'm not quite sure, but I think it'd be something like (let [color (int (get-stuff-from-qt))] ...)
21:07Chousukealso enable reflection warnings.
21:07durka42no, passed from QT to my proxy class
21:08Chousukeclojure still autoboxes all ints I think.
21:08durka42so, when i have
21:08durka42(proxy [RGBImageFilter] []
21:08durka42 (filterRGB [x y rgb]
21:09durka42is there a way to hint at clojure to not box rgb?
21:09Chousukewell, one way would be (let [rgb (int rgb)] ...) I think
21:09durka42(doc int)
21:09clojurebotCoerce to int; arglists ([x])
21:10Chousukethat's native int, not Integer :)
21:11Chousuke(doc *warn-on-reflection*)
21:11clojurebotWhen set to true, the compiler will emit warnings when reflection is needed to resolve Java method calls or field accesses. Defaults to false.; arglists
21:11Chousukeyay, it's running a new enough version. :p
21:15durka42hmm, reflection in a tight loop
21:15durka42that's not cool
21:16durka42but only once
21:16durka42apparently clojure caches the reflection lookup
21:18durka42thanks Chousuke
21:35cadsChousuke, are you around?
21:42cadsoh man
21:42cadsI think I know what's wrong
21:43cadsis year-old clojure code likely to still work with the latest trunk?
21:43hiredmannope
21:44hiredmandoto change
21:44hiredmanat least
21:44cadsaye
21:45cadsah well, at least I learned a bit about java classpaths
21:46cadsthere must have been heavy restructuring, important sounding stuff like clojure.lang.Num is no longer named that
21:46Chouserbecame Numbers
21:47ChouserA year ago was only shortly after Clojure's initial release. A lot of breaking changes since then, though none terribly deep.
21:48hiredmanI think a year ago was the first time I wondered by the old clojure website, and continued on to somewhere else
21:48cads:)
21:51cadsI'd like to transliterate this to modern clojure: (defn num [x] (. clojure.lang.Num (from x)))
21:51cadsNumbers has to from method, it seems
21:51cadss/to/no
21:52hiredmancads: modern clojure has a num fn you could look at
21:57cadshah, fixing that just gives me the next function that cannot be found :)
21:58cadsaaaah well... I guess I'll play with some code of my own
22:07persihey guys. I'm new to clojure. Is there a way to trace functions like CL TRACE?
22:19hiredmanclojurebot: trace is (in contrib) http://github.com/kevinoneill/clojure-contrib/commit/43e4168fc8772225c7f749ffb363b0e2a8f7b84f
22:19clojurebotAlles klar
22:28newb12345is there a way to disable stm in clojure?
22:29newb12345i need slightly more guarantee of 'progress' (even though i'm willing to use the gc)
22:30hiredmanhuh?
22:32newb12345is there a way to disable stm in clojure?
22:32newb12345i want standard, lock based multithreading primitives
22:32hiredmanI doubt, but you can just java locks
22:32hiredmanjust use
22:32hiredmanbut I am curious as to why
22:32newb12345i don't want rollbacks
22:33newb12345when code hits a certain point, I want to know that it's really hit there
22:33hiredmanstm is used if you run a transaction
22:33newb12345i have to explicitly start a transaction
22:33newb12345to get stm?
22:33newb12345otherwise it's not used?
22:33hiredmanyes
22:33hiredmanwell
22:33newb12345i am an idiotic newb
22:34hiredmanunless you call other code that has stm internally
22:34newb12345do many libraries have stm internally?
22:34hiredmanhmmm
22:35hiredmannewb12345: why do think stm will not work for you?
22:35newb12345i'm at an university
22:35newb12345and the very people around me
22:35newb12345who are doing reresearch on stm
22:35newb12345don't belivee in it
22:35newb12345and do it mainly for hte papers
22:35cadsI've read some stm naysaying papers too
22:36hiredmanany of them do a paper on clojure?
22:36ayrnieunewb, use agents. Dispatches to agents are held until STM commits, and so are not rolled back.
22:36cadswhat strikes me is they have a lot to say about stm being too complex
22:36cadsbut they don't give any alternatives to mutual locks
22:36newb12345i'm okay with deadlocking
22:36newb12345i.e. i just write code taht doesn't deadlock
22:37newb12345what I dislike about stm is that stuff may get randomly rolled back behind my back
22:37hiredmanuh
22:37hiredmanno?
22:38hiredmanif it fails to commit it is rolled back and retried
22:38newb12345yeah, this makes it hard to write real time apps
22:39hiredmanah
22:39hiredmanwell, transactions are supposed to be side effect free
22:39hiredmanwhich most rt apps are not
22:50newb12345are there good web frameworks for clojure
22:50hiredmanthere is compojure, webjure and ring
22:50hiredmanand others?
22:51hiredmanring is the simplest
22:51hiredmanclojurebot: ring
22:51clojurebotring is http://github.com/mmcgrana/ring/tree/master
22:51hiredmanclojurebot: compojure
22:51clojurebotcompojure is http://github.com/weavejester/compojure/tree/master
22:51hiredmanclojurebot: webjure
22:51clojurebotwebjure is http://code.google.com/p/webjure/
23:05cp2can someone explain to me what % does/how it works?
23:08mfredricksoncp2: it is an implied argument in a function literal
23:08mfredricksonthink of #(+ % %) as (fn [x] (+ x x))
23:09cp2yeah, i read that on the /reader page and didnt quite get it, but the anonymous functions section of the concepts article on wikibooks cleared it up
23:09cp2and ye, makes sense now
23:09mfredricksonyou can have multiple implied arguments: #(+ %1 %2) = (fn [x y] ) (+ x y))
23:09cp2ye i get it now
23:10mfredricksonI admit there are a few reader macros (I'm looking at you meta-data!) that I always am surprised by
23:10cp2heh
23:10cp2im just a bit confused in general
23:10cp2functional programming isnt something im used to
23:10cp2im learning...albeit slowly
23:10mfredricksonyup. Lisp can throw a lot at you at once
23:11ayrnieuis there already a (defn thru [f] (fn [s & args] (apply f s args) s)) ? ((thru print) "hello") => "hello"
23:12mfredrickson,(doc partial)
23:12clojurebot"([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & more]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."
23:13ayrnieuthat isn't what I want, if you meant it in answer.
23:14mfredricksonayrnieu: i see. you need something for side-effects, yes?
23:15mfredricksoni didn't see that thru's function returned s
23:15hiredman
23:15ayrnieuI've shown you exactly what I want; I was just asking if it already exists. It's useful for side-effects on agents, yes.
23:16ayrnieuas in: (add-watcher broadcast-message :send (agent *out*) (thru report))
23:20Carknice one
23:20Cark(thru print "hello") would be event better
23:21ayrnieuwell, report takes *out* (or a socket, etc.) as its first argument.
23:23Carkah thus the exta parenthesis i see
23:33cads,(source partial)
23:33clojurebotSource not found
23:33cadsfap.
23:43Cark(defn thru [f & args] (fn [s & more-args] (apply f (concat args [s] more-args)) s))
23:43Cark?
23:43Carkit's getting ugly though
23:44ayrnieuhttp://gist.github.com/55435 is interesting. Sometimes I'll get 2 reports until I broadcast again -- when I get 8. This may not be a problem in a real system.
23:47ayrnieuyou can remove the reset-to-nil line to see that the watchers don't trigger when you broadcast the same message. Again, a real system could stamp the messages.