#clojure logs

2008-11-21

01:58PupenoGood morning.
02:00PupenoIs there any docs on writing macros? I would have expected the macros section in the reference was about it.
02:07H4nsPupeno: pcl has a section on macros, and on lisp covers them in depth.
02:07H4nsPupeno: a reference is not meant to be used to learn
02:07H4nsPupeno: (in the sense that a tutorial or user manual is)
02:18H4nsdang!
02:18H4nsPupeno: apologies, i was in the wrong channel context :)
02:19H4nsPupeno: i'd still say that my recommendations are kind of helpful, but certainly to a lesser extent
02:24PupenoH4ns: ok, thanks.
04:05leafwaway txu txu
05:58Pupeno-GHello.
05:59Pupeno-GI have a Java method with the signature: blah(String�a, String�e, long�i, boolean�o); am I calling it wrong by calling it like (.blah ClassName "a" "e" (* 1000 (.currentTimeMillis System)) false)?
06:01tWipyou left out part of the signature
06:01tWipis it public and static or something else?
06:02Pupeno-GtWip: public, non-static.
06:03tWipthen you can't call it on the class
06:03Pupeno-Gvoid.
06:03tWipyou need an instance
06:03Pupeno-GSorry, just wrote it wrong here, I am using an instance.
06:03tWipthen I believe that should be correct usage
06:03hiredmanhmm
06:03hiredmanmaybe wrap the time in (long ...)
06:04tWipand static calls I'd prefer (System/currentTimeMillis)
06:04Pupeno-Ghiredman: that was it, thanks!
06:04Pupeno-GtWip: thanks.
06:04hiredmanworking code first, pretty code after
06:43Pupeno-GHow do I use generics from Clojure, in the sense of how do I do this: new HashSet<String>(), from Clojure? (new HashSet ???)?
06:44ChousukeI'm not aware of any way to do that.
06:45Chousukejust use a non-specialised HashSet?
06:45Chousukeit's just a compile-time thing anyway
06:45Pupeno-GChousuke: I'm not really working with HashSet, that was just an example. Anyway, thanks.
07:21askentaskhow about lisp and static typing? how hard is it to implement static typing on a lisp? and i mean haskell-like static typing, not java-esque
07:25philscottedPupeno-G: Dynamically typed languages have no real need for generics (parametric polymorphism).
07:26philscottedaskentask: I suspect some would say that if you have static typing, you no longer have a lisp.
07:47askentaskhehe, but i dont build it into the language, i just have a clojure-rpogram that typechecks. and anyway there optional static typing for common lisp.
07:47askentaskalso i dont really get the advantage of dynamic typing except for less typing. what are the non-superficial advantages of dynamic typing?
07:48tWipMany lisp compilers do type analysis for efficiency
07:55philscottedaskentask: There are some things you just can't do without dynamic typing. A human being can make type-correctness guarantees that a static type checker cannot.
07:55askentaskbut i want to do it for saftey
07:56philscottedtWip: Yes, but I wouldn't call that static typing.
07:59philscottedaskentask: Also, you can have statically typed languages where you don't have to write all your types out by hand, so dynamic typing is not about less (keyboard) typing in that sense.
07:59askentaskphil: yes in haskell but in other langs, java c++ its a lot about it
08:00askentaskbut ok i sees the point about humans being able to typecheck where a static typechecker cannot
08:01philscottedaskentask: Right, but I consider those to be pretty impoverished languages, and not really worth comparing to.
08:01tWipstatic typing requires the whole program to some extent
08:01tWipand is not compatible with the lispy repl coding approach
08:01askentaskbut as programsize grows id like help on that verification by a program. mostly it is the simple stuff i need to get fixed. like if forget to change something somewher eand it says "1" + 4, those are the things a static system would fo better than me
08:02askentasktWip: i find the ghci haskell repl to be quite good(ebven if it doesnt allow the whole ghc)
08:02tWipnever really developed anything in ghci repl
08:02tWipbut I develop in a lisp repl all the time
08:03philscottedtWip: Right. Redefining functions on the fly, for instance. You can't do that with ghci.
08:05tWipespecially good with server software that has a long startup
08:15philscottedaskentask: In practice, I haven't found those sort of type errors to dominate, and I certainly haven't found them to be a big deal. Besides, with a decent Lisp allow interactive testing and allow you to rebind functions at the toplevel and have the effects propagate properly (unlike Python, say),
08:15philscottedWhoops, pressed return too soon.
08:16philscottedIn practice, I haven't found those sort of type errors to dominate, and I certainly haven't found them to be a big deal. Besides, with a decent lisp you can interactively test your functions to iron out those sorts of errors, and when you can rebind functions at the toplevel and have the effects propagate properly (unlike Python, say) you can get rid of those errors pretty quickly.
08:17philscottedIn the end, I find the advantages of a dynamic language to be far greater. And in something like Common Lisp, the combination of a debugger and condition system may allow you to correct any missed errors on the fly and continue running the program as if nothing had ever happened.
08:18Pupeno-GIt seems I can import a.b.C.D in Clojure where C is a class and D is a subclass (public static), while in Java I can; can anybody confirm?
08:18rhickeythe name of that nested class is a.b.C$D
08:19rhickeyyou can (import '(a.b C$D))
08:22Pupeno-GI meant "can't", but I think my question was clear anyway.
08:22Pupeno-Grhickey: I see, but then everytime I mention the class I have to do C$D; would it be possible to mimic Java's behavior here?
08:23rhickeyPupeno-G: No, dots have too many meanings already
08:23askentaskphilscotted: how do you mean propagate properly? or i know what you mean by that but when doesnt it in python?
08:23Pupeno-Grhickey: ok then.
08:24philscottedIn Python, when I redefine a class at the toplevel, existing instances of that class are unaffected. This is really annoying for interactive testing and debugging.
08:25askentaski like also like in haskell i can do: :type f and it tells me specifially what it does rather than jus the variable name. if i do in clojure: (defn update [coll index newlist]...) i want to do :type update and get: [[a]] -> Int -> [a] -> [[a]]
08:26askentaski see about servers yes, so instead of restarting the program you can change things at runtime, that wouldbe a great advantage yes
08:26philscottedaskentask: Not sure how Clojure behaves on this one. But CLOS will call change-class on all instances when you redefine classes.
08:26rhickeyaskentask: except collections can be heterogeneous
08:26askentaskphil: ah ok
08:26duck1123is it possible to alias a nested class?
08:26philscottedaskentask: Yes, static typing can be really nice for automatic documentation.
08:27rhickeyphilscotted: it comes at a cost in expressivity
08:27Pupeno-GI have just realized I hate Haskell.
08:28philscottedrhickey: Yes, of course. But I've already mentioned some of the disadvantages of static typing.
08:28blackdognot to mention the code explosion, I just find it easier to deal with less code
08:29rhickeyduck1123: there's no class aliases at this time
08:29Pupeno-GNow I am always afraid a collection will come with one item of an unexpected type and I can't do anything about it. I didn't use to be afraid. I'll take it to my psychoanalyst.
08:31duck1123I used to argue for static typing all the time. Now I feel the opposite.
08:32askentasklol
08:32askentaskwhat have i done?
08:32askentaskbringing this up
08:32askentaskwhen i write in static langs i msiss dynamic typing, when i write in dynamic langs i misss static typing
08:32Pupeno-Gduck1123: I change polarization about 6 or 7 times a year :S
08:35gnuvinceaskentask: welcome to the club
08:36duck1123PHP4 soured me on dynamic typing for quite a while, Ruby brought me back
08:36Pupeno-GI'd like clojure-mode to change between different possible tab levels when tab is pressed again, like the python mode (for semantic purposes) or that cool javascript mode (for extra coolness and because Javascript is a mess).
08:37duck1123I hate that about js2-mode
08:38duck1123it would be okay if I had to modify the tab to change it, but I tend to hit tab randomly on lines to make sure they're indented properly
08:38gnuvinceYou just need to remember not to try and code like you have a dynamically typed language when you're using a statically typed language and vice-versa
08:39philscottedOcaml's static duck typing is another matter though. Here, an object is automatically typed by an implicit interface which includes precisely those functions which are actually *required*. It allows for a lot more flexibility, heterogenous collections (without the headache of defining variant types). However, it's part of the OO extensions (which I tend to avoid anyway), is restricted to single-dispatch. Oh, and it's Ocaml.
08:39H4nsPupeno-G: with lisp, there usually is one (1) correct indentation for every line.
08:39Pupeno-Gduck1123: the first tab should leave it where it is if it's a valid tab.
08:39Pupeno-GH4ns: maybe I have weird indenting habits.
08:39Pupeno-Glisppaste8: url
08:39lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
08:39H4nsPupeno-G: yes. change them.
08:40duck1123you guys should see the formatting of some of my old XQuery
08:42lisppaste8Pupeno pasted "Which indentation do you prefer, the first or the second?" at http://paste.lisp.org/display/70818
08:42Pupeno-GH4ns: can you answer that paste?
08:43H4nsPupeno-G: certainly - i would prefer the first, but i always stick to what the editor does for me. that is the only way to get consistent indentation. reasonable editors provide you with hooks to control your indentation.
08:43Pupeno-GH4ns: but clojure-mode gives you the second, and it doesn't have any way to know you want the first.
08:43duck1123I tend to fiddle with my code to get it to look the way I want
08:44Pupeno-Gduck1123: but then your random tabs break it, where tab-switches-indentation-unless-it-is-in-a-correct-spot doesn't do it.
08:44H4nsPupeno-G: you can certainly customize clojure-mode so that it indents correctly.
08:45Pupeno-GH4ns: if you mean modifing it for each library out there, then, no thanks.
08:45lisppaste8duck1123 annotated #70818 with "another way to indent" at http://paste.lisp.org/display/70818#1
08:46Pupeno-Gduck1123: I sometimes do that, but I end wasting too much vertical screen.
08:46Pupeno-Gduck1123: while not adding clarity.
08:46H4nsPupeno-G: usually, you can customize lisp mode with a simple regular expression - for example, one that makes a 2 space indent for forms containing with- or without-
08:46H4nsPupeno-G: it could even be in place, but be defeated by your namespace prefix.
08:47Pupeno-GH4ns: true, but that's going to fail sometime, while the tab-cycling doesn't.
08:47duck1123I do whatever it takes to make it look as close to what I want to see as possible without changing the default
08:47H4ns*shrug*
08:54askentaskcan parameters be caleld anyhting without clashing with builtin names?
08:56tWip (defn foo [defn] (+ defn 1))
08:56tWipseems to work
08:56rhickeyaskentask: other than for special ops
08:57philscottedSee http://clojure.org/evaluation
08:57Pupeno-GIt would be nice if the "No matching method found"-error would list the argument types used in the call, not only the name of the method.
08:57philscottedrhickey: And if the symbol is bound to a class, according to your docs.
08:57rhickeyphilscotted: right
08:58askentaskhmmim rewriting my clojure-oo-system. used refs from the start but yesterday someone said just pass along the updates without refs might be better. I want it o to fit in with clojure-style programming. and i want something a bit more elaborate than defstruct.
09:04askentaskhmm im wondering should i have refs in the class or refs or soemthinc classes get assigned to later. i must separate the definition of a class from the creation.
09:05rhickeyaskentask: If you really want to do an object system for Clojure, you need to totally understand this: http://clojure.org/state
09:10philscottedrhickey: Actually, just testing out that evaluation order stuff. If I do (import '(java.io PrintStream)) and then "(defn foo [PrintStream] PrintStream)" shouldn't foo return the java class rather than its argument?
09:12rhickeyphilscotted: no, argument will hide it when used as a value like that
09:13rhickeybut (new PrintStream ...) would still work
09:16Chousukeaskentask: if you find yourself using a lot of refs in your object system, you're probably doing it wrong.
09:18lisppaste8cemerick pasted "rhickey: no tagging on auto" at http://paste.lisp.org/display/70821
09:18cemerickhrm, that title didn't come out right...
09:20Chousercemerick: you could re-def vector-color to something of a different type.
09:20cemerickChouser: ...at which point the :tag could be updated, no?
09:20Chouserlater, I mean, and cause an auto-hinted vector-stroke-color to do something other than what you meant.
09:21cemerickI guess that makes binding more complicated.
09:22Chouserthe :tag would be used when compiling vector-stroke-color -- I'm not sure you'd want a change to :tag later to go through and recompile all code that referd to that var.
09:23Lau_of_DKAfternoon gents
09:23rhickeycemerick: you can hint vector-color itself
09:23cemerickChouser: ah, right
09:24cemerickrhickey: yeah, I know. I just hadn't yet thought through the ramifications of auto-tagging vars
09:24rhickeyauto-tagging is the enemy of heterogeneity
09:25rhickeynow, if I add defconstant...
09:27cemerick...and all the shades in between. I often know that some var will always be bound to an object of a particular type, but I do need to rebind it as necessary. defconstanttype :-P
09:27rhickeycemerick: just tag it then, there are all kinds of issues about what type to assign - most-derived, least-derived, which of n interfaces etc
09:28cemerickYeah, I wasn't actually suggesting a new def-form.
09:30rhickeycemerick: have you tried AOT gen-class yet?
09:31cemerickrhickey: No, not yet. I'm buried from a number of directions. I think wwmorgan may have, but I'm not sure.
09:31cemerickI may get to take a look at it over the holiday. I've been watching the developments, though, everything looks to be falling into place.
09:40Pupeno-Gdo you same examples or samples when refering to programs provided as examples?
09:40Pupeno-Gor samples.
09:44ChouserPupeno-G: that's a question about English? "examples" usually.
09:44Pupeno-GChouser: yes, english; I never cease to be puzzled by that language.
09:45Pupeno-Gsorry for the off-topic, but we were quiet anyway.
09:45Chousernp
09:46askentaski have this confusion. so i need to define general methods for a class that can then be called by each instance. so i need some from of "self". so should each instance carry a dict with {:my-personall-attributes some-values :general-class-spec spec} where personal-attributes correspond to something n general-class-epc
09:48askentaskmeh i need some better teaches, did high school suck for you guys too? we do so much pointless stuff but i have noone to discuss or go to for programming. seriously i have to memorize 80 different fookin birds for a biology class but when i want to learn programming i cant get any help
09:51Pupeno-Gaskentask: if you want to really learn programming, go through SICP, at least, the lectures.
09:51Chouseraskentask: I sympathize. But at least in my experience, one is generally encouraged if not forced to specialize as you get older. It may be hard to think of it this way, but right now you have an opportunity to learn about birds, history, etc. that may be hard to come by later.
09:53ChouserWe had no programming courses at my high-school, or anyone around that could help in that area. Books were it. (No internet then either, at least for me.)
09:53duck1123can the path to slurp be relative to the classpath, or must it be absolute?
09:53Chouserduck1123: slurp doesn't honor classpath
09:54askentaskpoor you, wikipedia is at least a great help on grasping basic concepts
09:54Pupeno-GI had C, Basic and Assembler in high school, but by the time I've got there, I got mostly recruited as teacher helper; so they didn't help me much, but I've got a chance to help others.
09:55rzezeski+1 on SICP, still going thru them, very informative. I already have a CS degree and it is teaching me a lot
09:55Pupeno-Grzezeski: indeed! if it wasn't for SICP, I wouldn't have my current job.
09:56duck1123so, what would be the best way to find a file in my project if I don't know where the code will be sitting?
09:57rzezeskiI taught myself VB in high school, then I learned C++ senior year of HS and throughout College, then started using Java late College and now in my career.
09:57duck1123I started with Atari Basic in 3rd grade
09:57rzezeskiWe studied FP briefly in our AI and Programming Languages class, but about a year ago I finally came back to it by checking out Haskell again
09:58Chouserduck1123: I've used: (.getResourceAsStream (clojure.lang.RT/baseLoader) file)
09:58Chousukeaskentask: your instances could contain a reference to the class object, a map of attributes, and maybe some metadata. the class object then could contain a map of functions defined for that class.
09:58rzezeskiSICP is teaching me loads though, awesome that you can get such a great resource for free!
09:59ChousukeHowever, I don't see a reason to make anything that complicated. Though it might be good practice if you want to try and understand the concepts.
10:00askentaskwhich is?
10:01ChousukeIf I needed something OO with clojure I'd probably just use maps of attributes and values and call them objects :P
10:02Chousukeor I could use java I guess :/
10:03philscottedrzezeski: SICP really makes me embarrassed about the quality of teaching at my university. Not sure if that is just a rare jewel of MIT, or whether they have consistently good teaching material.
10:04rzezeskiI think it's MIT
10:04Pupeno-Gphilscotted: do you know that they ditched Scheme for Python to teach that class? I think it might have been a rare jewel (possible much more rare outside MIT).
10:04rzezeskipersonally though, if I had the choice (and the grades) I'd prefer CMU
10:05philscottedPupeno-G: Ugh. At least they didn't ditch Scheme for Java. The uni where I did my undergrad had an amazing course on OO, taught using Smalltalk. They've now ditched it for Java.
10:14philscottedSpeaking of Scheme and Java, does anyone know what Guy Steele was talking about when he suggested Java brings C++ programmers half-way to Lisp?
10:15Chouserphilscotted: I know very little, but a couple things come to mind: reflection, heterogeneous collections, garbage collection
10:17philscottedChouser: Right. I suspect, then, I would very much disagree with his metric. I'm not even sure Java is halfway to Smalltalk.
10:20askentaskhmm i cant by the problem that i have a hard time doing this without defs. i could if letting the class-specification being a ref that all instances refer to. instance being a map to :spec and :instance-attributes
10:24philscottedIf we get indexed HTML documentation for Clojure functions, it might be cool to have a :see-also tag on function and macro symbols, pointing to the web page (or general URI resource).
10:25philscottedUsers could then add their own see-also tags which can be used by developer tools.
10:25philscottedrhickey: By the way, I really like the documentation strings and metadata system.
10:31duck1123I would like to see people using markdown or something similar in documentation strings
10:31cemerickoh noes, not markdown! :-P
10:34duck1123I'm curious, why not? I don't really have strong feelings for it, but I know some other languages use it or similar in their documentation.
10:37philscottedOnly just looked at it, but my first worry would be that the syntax for emphasis in markdown conflicts with the Lisp convention of surrounding special variables with *.
10:38philscottedI think if we want structured, semantic-rich documentation, we should use an s-expression format.
10:38askentaskif you need a graph datastructure, how would you create one? here is where Clojure clashes with my brain. in Python I could make a class for Node, Edge etc and specify their behaviour. but what would you use n Clojure?
10:39cemerickduck1123: the syntax requires rote memorization. For the small amount of formatting that docs generally require, it's a whole lot easier to just use html
10:40cemerickphilscotted: Given that clojure is jvm-centric, I think conforming to the javadoc conventions and then somehow injecting docstrings into the javadoc tool would be ideal, especially given AOT compilation being a good vehicle to provide public APIs.
10:40Chouseraskentask: you need a graph not just a tree?
10:41philscottedaskentask: A pure functional way to do a graph would be to have a set of vertices and a map from this set to the set of edges.
10:42Chouser{:a #{:b :c} :b #{c} :c #{}}
10:43duck1123cemerick: I would love to see clojure code produce actual javadoc documentation.
10:43duck1123I hate the format of javadocs, but there are plenty of tools to make it better
10:43cemerickduck1123: I think it'll happen, but we'll probably have to generate java source containing the docstrings in order to run javadoc over them.
10:43philscottedcemerick: But it would be good to use sexpr to represent the javadoc documentation, and then have clojure manipulate it for consumption by the javadoc tools.
10:44cemerickphilscotted: how would you represent javadoc docs using sexprs? It's fundamentally HTML, with type/method/field references here and there.
10:46Chouserclojure docs are already represented in clojure data structures (namespaces of vars with map metadata), so consuming that and spewing whatever javadoc needs seems like it should be straightforward.
10:46philscottedcemerick: There are loads of ways you could do it. Are there not standard tools to convert javadoc comments to XML? There are standard tools to convert from and between XML and sexpr. So we probably wouldn't need to do anything.
10:46cemerickYeah, it's just a matter of wiring things up. Generating source code kinda sucks, though. :-/
10:47philscottedChouser: At the moment though, the docs are just strings. There is no explicit documentation for individual function arguments, for instance.
10:47cemerickphilscotted: javadoc comments are strings that are interpreted by the javadoc tool to produce HTML. I'm sure there's tools out there to emit XML instead (and pdf's, etc), but they all work with Java source files.
10:48cemerickphilscotted: That's what the standard javadoc annotations are for (@param, etc)
10:48Chouserbut we don't want @param in .clj files though
10:49cemerickChouser: something like them needs to go somewhere.
10:49cemerickespecially if we want actual javadoc output
10:50philscottedChouser: No, but the metadata could contain :arg-doc which maps to another map between the argument symbols and documentation for each one.
10:50duck1123on the subject of javadoc, is the javadoc for clojure posted anywhere?
10:51philscottedChouser: Not that any of this is particularly important. But if semantically rich documentation gets added to Clojure, I hope it is in the form of Clojure data structures.
10:51cemerickI don't think we'd want to start scattering documentation fragments in multiple places.
10:52cemerickphilscotted: I'm still wondering what that "richness" gets you
10:52philscottedcemerick: Ah right. javadoc won't consume anything other than java source?
10:52cemerickphilscotted: exactly
10:52cemerickit's hardwired into the compiler
10:52gnuvinceIs "taxonomy" a synonym of "hierarchy"?
10:52cemerickI looked into it in some detail about a year ago to see if I could generate unified javadoc from java and scala sources.
10:53duck1123gnuvince: more a taxonomy is a hierarchy i think
10:53philscottedcemerick: For instance, when writing a form, Slime could spit out the documentation for each function argument as I type it, by inspecting the metadata.
10:55philscottedcemerick: Generally, I want the possibility of doing such things.
10:55cemerickphilscotted: Yes, that might be cool, but getting there with sexprs makes all of the common use-cases more complicated. To start, every fn would need two forms of docs -- a docstring, as well as a metadata map with an :arg-doc entry
10:56cemerickJust grepping the docstring for pairs of @param annotations seems a lot better on all fronts.
10:56ChouserI'm with philscotted on this one
10:57philscottedcemerick: Docstrings are already optional. I think using plain text and preprocessors which have to do the parsing is failing to take advantage of lisp.
10:57Chouserimagine (defn foo "does foo things to a and b" :a "tastes like apple" :b "looks like a bee" [a b] (+ a b))
10:57Chouserhm, messed that up, didn't I
10:57Chouseroh, no, that's right.
10:58cemerickChouser: and :a and :b get slotted into foo's metadata's :arg-doc map?
10:58Chouseror maybe 'a or just a instead of :a
10:58Chousercemerick: right
10:58Chouserjust like a plain string gets put in :doc
10:59Chouserdefn's looking for a vector or a list that begins with a vector for the function args and body. So anything else can have new meaning -- plain string is :doc, plain symbol followed by string could be an :arg-doc
11:00ChouserI think I like the plain symbols, because then keywords could be used for other things. perhaps :returns "the result of doing foo things"
11:00cemerickwell, it's syntactically it looks fine. Certainly makes the java source generation for javadoc more complicated, but that's a one-time job I suppose.
11:02duck1123you would also be able to read them with meta, and perhaps eventually doc
11:02Chouserbut if we wanted to generate anything other than javadoc, not having to parse out the @params would make the job much easier.
11:03askentaskMy neighbours daughters friend is getting married to a friend of Bill Gates, she is 28, he is 63.
11:03cemerickthere is only one doc format, and its name is javadoc ;-)
11:03askentaskMy neighbours daughters friend is getting married to a friend of Bill Gates, she is 28, he is 63. in gothenburg, sweden
11:03askentaskhaha
11:03askentasklol in it for the money?
11:03Chouserit's interesting that for pure functions the main doc string might go away. once you've described the arguments and the :return value, what else is there?
11:03Chousukedoc could be made a bit more general I think. currently it seems to assume the things documented are functions or macros :/
11:04duck1123:side-effects true
11:05askentask(defn def-method [for-class f]
11:05askentask (let [spec (get for-class :spec)]
11:05askentask (dosync (alter spec assoc :methods f)))
11:05Chouserduck1123: does 'do' have side-effects?
11:05askentask java.lang.Exception: Unable to resolve symbol: for-class in this context
11:05askentaskclojure
11:06askentaskhow?
11:06Chousukeaskentask: you can only have one method per class?
11:06duck1123:side-effects 'arguments ?
11:06Chouserduck1123: :-)
11:06Chouseraskentask: works for me
11:07philscottedWould a :side-effects tag be useful for sanity checking transactional code at compile time?
11:07Chouserhow would you mark java methods?
11:08Chousukemaybe a :pure-function tag instead
11:08Chousuketo tag functions that have no side-effects. Might help the compiler too :)
11:09philscottedChousuke: Maybe. It's worth remembering though that anything which consumes a function cannot guarantee absence of side-effects.
11:09Chousukehmm, true.
11:10Chousuketribool logic: yes, no, and maybe :P
11:15albinowhy can't the function passed be marked for side-effect freeness too?
11:15albinoD does this with their pure keyword
11:16Chouseragain: what about java methods?
11:16Chouserwould you assume they're all impure except for those listed in some sort of global pureness set?
11:18philscottedChouser: Everything could be assumed impure unless stated otherwise, I guess. I'm not sure this system could ever be used for static guarantees in things like transactional code, but it could be used to emit warnings.
11:20philscottedalbino: What would that allow us?
11:20duck1123what about :lazy false
11:21philscottedalbino: D is statically typed, remember.
11:21Chouserduck1123: that's interesting. In a lot of cases boolean is probably sufficient.
11:22wabashQuick question: does Clojure have unicode strings baked in?
11:22Chouserwabash: yes
11:23Chouserwabash: Clojure strings are Java Strings
11:23wabashOh, yeah. I should have realized that. D'oh!
11:23gnuvinceWow, there are songs about Rich on reddit
11:23wabashI will write a song about Rich someday, too.
11:24wabashgnuvince Where did you see them? On the programming subreddit?
11:24gnuvincehttp://www.reddit.com/r/programming/comments/7epv2/rich_hickeys_clojure_talk_at_the_jvm_language/
11:24wabashOh, they are not original songs, only remakes with new lyrics...
11:25albinophilscotted: I figured the same concept would apply. Marking a function side-effect free means it could be passed to any other function which was also marked side-effect free
11:25wabashOnce I have a strong enough mastery of clojure to appreciate it, I'll write an original song about clojure or something.
11:29philscottedalbino: Yeah, but suppose you want to pass a side-effecting function to list. List is side-effect free, and has no intention of invoking its arguments, so we would still want this to work.
11:32duck1123philscotted: are you saying evaluate the function and pass it to list, or pass the functions symbol to list
11:33duck1123if it's the first, then list is no longer side-effect free because the false bubbles up
11:33philscottedduck: I'm saying to pass the function to list. Suppose the function is foo and it is side-effecting. (list foo) has no side-effects.
11:33duck1123if it's the latter, then it's not really a function, it's data
11:36philscottedduck1123: More concretely: (defn foo [bar] (bar)) defines a function which takes a function and will have side effects iff bar has side effects. But (defn foo [bar] (list bar)) is pure whatever.
11:36askentaskcan i let inside a reduce?
11:36Chouseraskentask: you can 'let' anywhere that expects an expression.
11:36askentaskah yes
11:37duck1123 you need 3 states
11:37duck1123foo1 is maybe, foo2 is false
11:40danlarkinhaha this thread is a goof, http://www.reddit.com/r/programming/comments/7epv2/rich_hickeys_clojure_talk_at_the_jvm_language/c06gob8
11:40duck1123(defn foo1 :side-effects (some (map #(:side-effects (meta %)) '(bar))) [bar] (bar))
11:41duck1123I'm sure I screwed that up, but you get the idea
11:42philscottedduck1123: Right. So rather than having a simple boolean, we could capture the conditional in some actual code. I'm not sure how much benefit any of this will actually give. It might just end up being overhead.
11:44hiredmanugh
11:45duck1123presumably, it would be much easier to identify the arguments that can change the side-effect status :side-effects (maybe [bar])
11:49philscottedduck1123: I suspect it would be easy to get carried away. My intuition is that you could pick an arbitrary predicate of the arguments, and find *some* function for which that predicate expresses the dependence between the pureness of the arguments and the pureness of the main function, meaning that no simple system would be sufficient.
11:55duck1123philscotted: I agree some functions might be difficult to pin down, but a lot of functions (those that don't take IFn's as an arg) would be relatively simple to say true or false. (defn + :side-effects false ...)
11:55philscottedduck1123: Agreed.
11:57philscottedIs Rich looking for any volunteers to proof read his documentation?
11:57askentaskcan i bind to vars defined in the same let? like (let [[x & xs] coll test (something-with x)]...
11:57Chouseraskentask: yes, let bindings happen in order
11:57philscottedThere are quite a lot of typos.
11:58Chouserphilscotted: he'd probably be happy to get a list of corrections to be made
11:58Chouserphilscotted: in .clj files or just on the web site?
11:59philscottedChouser: The website. I'm happy to go through the documentation there again looking for them.
11:59ChouserI can't speak for him of course, but generally when people have noted mistakes he's responded positively.
12:00drewrHe'd probably love to have corrections for stuff like that.
12:01drewrI haven't ever seen him respond unfavorably to genuine efforts to improve the project.
12:01philscottedWell for my purposes, I want Clojure to look as awesome as possible, and it would be great if the website was completely free of typos for that.
12:01drewrHe's even kind to the cargo-cult lispers that come in complaining about stuff.
12:03duck1123Chouser: in response to your earlier question, doall would be considered side-effect free. That status can be tainted by the sub-forms it contains, but it itself doesn't produce any side-effects, nor does it accept any unevaluated IFn's that could change that.
12:03duck1123doseq, being a macro, would have to be a maybe
12:06Lau_of_DKEvenings gents
12:07duck1123evening Lau_of_DK
12:18brillYeah, hej Lau_of_DK
12:19brillNow english is my second language - and I know what a cargo-cult is. But what is a cargo-cult lisper? I just had to ask...
12:19duck1123http://en.wikipedia.org/wiki/Cargo_cult_programming
12:20Hunthe stuff why we still call a cdr a cdr and so on
12:20Lau_of_DKduck1123: based on that description, would you say cargo code is solely for python programmers?
12:23brillduck1123: Ah. I get it now.
12:24ChousukeLau_of_DK: nothing about that is specific to any D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[C[D[Dlanguage :/
12:24Chousukeoops.
12:26Lau_of_DKhehe
12:26Lau_of_DKChousuke: it was just another crack at the Python crowd )
12:26Lau_of_DK:)
12:28gnuvinceAnybody here is a French speaker?
12:40duck1123is there an easy way to convert a inputStream into a string in Clojure
12:40duck1123all of the java methods are way too complicated
12:41duck1123I just need to read this file, and I need it as a string
12:42Chouser(apply str (line-seq (java.io.BufferedReader. (java.io.InputStreamReader. stream))))
12:42Chouserjava's io api is so ugly
12:43Chousershoot, that loses newlines.
12:44danlarkinisn't there slurp or something?
12:44technomancyduck1123: that drove me crazy in JRuby
12:44Lau_of_DKclojure/slurp
12:44Lau_of_DK([f])
12:44Lau_of_DK Reads the file named by f into a string and returns it.
12:44Lau_of_DK
12:44Chouserslurp works on filenames
12:44Chousernot streams
12:44Lau_of_DKMr. Duck said 'read this file'
12:45danlarkinah :-/
12:45hiredmanChouser: you interleave \newline
12:45hiredmanthen str
12:46hiredmanwhich, uh, may get you an extra newline at the end
12:46Chouser(apply str (map char (take-while pos? (repeatedly #(.read stream)))))
12:46duck1123 I technically don't even need newlines
12:46duck1123in this case at least
12:48technomancyit looks like the sourceforge bug tracker is not being used. where do bugs get filed?
12:48Chousertechnomancy: post to the google group
12:48technomancyah, ok.
12:49technomancyI noticed the zip file expands in-place instead of creating a new subdirectory. This can't be intentional, can it?
12:50Chousertechnomancy: which zip file?
12:50Chouseroh, the release .zip file?
12:50technomancyChouser: the "download clojure" zip file
12:51technomancyyeah
12:51Chouserhm, that's more common with .zip than it is with .tar, but you could still mention it on the google group.
12:51mmcgranaorthogonal to your point about the zip file, I'd suggest you use Clojure head from svn
12:52technomancymmcgrana: was about to ask that. =)
12:52Chouserat this stage of the game, many (most) people use SVN directly. But that may be changing in the next few months, so it may be good to start refining how the .zip files are built.
12:52technomancyChouser: I'll mention it then.
12:54dudleyfJDK 7 should have better IO APIs
12:54Chouserif you ask me, JDK 5 should have better IO APIs.
12:55Chouser:-D
12:55mmcgranalol
12:55dudleyf;-)
12:55dudleyfI think there's a patch for 1.6 VMs
12:56technomancyhas there been talk of getting a "real" bug tracker, or does the google group work pretty well?
12:57dudleyftechnomancy: So far, Rich has like a 6 hour turnaround on bugs posted to the group
12:57Chousertechnomancy: so far it's hard to keep a bug alive long enough for a tracker to be useful. They tend to be fixed within a day or two, if not hours or minutes.
12:57technomancythat's awesome.
12:57ChouserI think once 1.0 is out, bugs may have to be tracked against multiple releases and a bug-tracker would become worth its overhead.
12:58technomancysure; things get a little more complicated. also once the book is out the volume may increase.
12:59abrooksChouser: Yes, but only a bug-tracker written in Clojure...
12:59technomancydefinitely. =)
12:59danlarkinit'll be time for two lists
13:00Chouservery little of the clojure development system is written in clojure so far: no editor, no web forum, no chat system or IRC bot, no bug tracker...
13:00ChouserThe closest we have is a netbeans plugin for clojure that includes some clojure code along with the java.
13:01danlarkinno need to reinvent the wheel for a lot of that stuff IMO
13:01technomancyyeah, slime is awesome. and it's written in lisp, which is close enough. =)
13:02Hunnow we hava a is-a vs has-a vs might-be-close with lisp, elisp, common lisp and clojure again
13:02Hunwhatmeworry? :)
13:03Hunelisp is pretty crappy.... it's okay for smaller scripting tasks, but you really don't want to know how it works
13:04hiredmanChouser: I have a xmpp repl bot, which could get on irc using an xmpp to irc gateway
13:04hiredmandunno if it still works
13:04technomancyHun: they're working on that; the lexbind branch is slated for merging after the next release
13:04duck1123we really need something like fsbot in here
13:04hiredmanfsbot?
13:04duck1123the bot of #emacs
13:04technomancyfsbot is awesome
13:04tWipwritten in elisp, I presume
13:05duck1123yeah, erbot
13:05Huntechnomancy: the last release took 7 years...
13:05duck1123I tried setting up one yesterday, but couldn't get it to work
13:05technomancyHun: the next one is planned for January; been in feature freeze since July
13:05technomancyHun: I think they learned from their mistakes, just like Debian. =)
13:07technomancybrb
13:09hiredmanso a lisp info bot
13:10duck1123basically, we need one for clojure though
13:10Chouserwhat would it do?
13:10hiredmandoc function
13:10hiredmanof course
13:10duck1123we should be able to say (doc foo) and have it spit out the doc
13:11Chouseroh. I can already do that at the repl without bothering everyone else on the channel.
13:11hiredmanbut what if you want to bother someone on the channel?
13:11Chouseroh! good point.
13:11hiredmanyou could teach it answers to faqs
13:11duck1123 it comes in handy in #emacs
13:11Hunlike slapping freshly joined people with standard documentation
13:11Hunalso in #lisp
13:11Chouserbot: (bother 'hiredman)
13:12duck1123clojurebot: no you can't see the version number from the repl
13:13hiredmanclojurebot: the lastest verion is x, the recomended version is y
13:14Chouserclojurebot: try (.getMethod (identity MyClass) ...) instead of (.getMethod MyClass ...)
13:14hiredmanso we are all talking to something that isn't here
13:15duck1123one of the nice things about fsbot is it learns, you can give it new information as they come up in chat
13:15abrooksheh
13:15tWipwell isn't this channel logged publicly? when the clojurebot is done, it can read the logs for learning material :)
13:15Chouserhiredman: he'll be able to read the logs to get up to speed.
13:15Chouseronce he's written.
13:15ChousertWip: exactly.
13:16tWipthough one could say that people can read the logs as well
13:16danlarkinwow clojurebot has a lot of features for not yet existing
13:16technomancysounds like a good learning project
13:16tWipimaginary software often is the best kind of software
13:17Chouserhow do you retreive a stored question from the bot?
13:17technomancytWip: yeah, windows Longhorn was soooo much better than Vista. =)
13:17Pupeno#<core$keys__494 clojure.core$keys__494@1829c6b>
13:17PupenoDoes macroexpand-1 always return things like that?
13:17technomancyChouser: in #emacs, you can do ,term to look up a term, and ,df function-name to look up docs for functions
13:18ChouserPupeno: no, it should return an s-expression of code.
13:19ChousukePupeno: are you sure your macro isn't accidentally returning some value instead of a code form?
13:24hiredmancan you override constructors with proxy?
13:25PupenoI was just forgetting to quote the expression to macroexpand, agh, I haven't written macros in ages.
13:25PupenoHow do you get a form evaluated inside a back-quoted expression?
13:27philrhickey: I'm still trying to grok your "On State and Identity" article. Am I right in thinking the "state/identity" distinction is the same as the "reference/meaning" "extensional/intensional" distinction?
13:28Chouserhiredman: essentially, yes. You don't get to provide your own constructor, but you can pass the super's constructors whatever values you want.
13:28ChouserPupeno: ~ or ~@
13:29rhickeyphil: it's really more basic than that, urging separation of identity/reference from value/representation
13:29hiredmanhmmm
13:29hiredmanwell that did nae work
13:30rhickeyhiredman: proxy has same ctor as superclass, is flow-through to super
13:31PupenoChouser: that was I was trying... I didn't realize I had another ~ inside and that was causing the error.
13:31ChouserPupeno: ah, ok
13:32philrhickey: Okay, yes. I perhaps need to rephrase. I'm wondering if the points you are making can be nicely explained in those terms. For instance, something I might do in a program is say (the list of) Jill's friends is the (list of) Jack's friends. The problem in most imperative languages is that lists are mutable, so if Jack drops one of her friends, it will affect Jill. What's happened here is we've stated that "Jack's frie
13:32philnds" is intensionally the same as "Jill's friends", so any change to one affects the other.
13:33hiredmanhmm
13:33philWhat we wanted to say was that Jack's friends and Jill's friends happen to refer to the same list, which *never* changes. At some point in the future, Jack may acquire a *different* list of friends, but this cannot affect Jill.
13:35Chouserhiredman: frequently when using proxy I end up with a fn that acts a bit like a constructor and may provide instance data. It then calls proxy (with appropriate constructor args) and my methods close over the instance data.
13:36hiredmanoh
13:36hiredmanneat
13:37Chouseroh, good, I was afraid that didn't make any sense.
13:38PupenoAny better/shorter way to write (symbol (format "%s-bleh" 'blah))?
13:38rhickeyphil: yes, but also that Jill may retain a persisting reference to Jack, names aside, and ask for his current list of friends at any time, so there's the list itself and the association of the list with an identity
13:39Hun(defn foo-postfix [name] (symbol (format "%s-bleh" name))) (foo-postfix "blah")
13:39ChousukeI think the "today" example in the article is a really good one.
13:40wwmorganPupeno: (symbol (str 'blah "-bleh"))
13:42hiredmanahem
13:42philChousuke: I didn't quite get that. I consider "today" to be
13:42Chousukeeven if tomorrow "today" will be 22-11-2008 that doesn't mean 21-11-2008 has changed. it just lost its association with the identity "today".
13:43Chousuke21-11-2008 is itself an identity though. but a much more stable one than "today"
13:43philI consider "today" to be merely an indexical, like "me" or "you", its meaning determined by context. Perhaps my understanding has been coloured by other subjects, which is why I was after an explanation in terms I was more familiar with.
13:44Huni think of them as chomsky-0. context-sensitive identifiers
13:44Hunargh
13:44Chousukephil: How about this: when you do @ref, you determine the value of the ref in a given context, and work with that.
13:44Hunchomsky-1
13:45Chousukephil: in other contexts, @ref may be different, but that will not affect you
13:46Chousukeor: someone knocks you out for days, and when you wake up, you still might think "today" is 21-11-2008 and do decisions based on that.
13:47Chousukeno external entity has access to your brain to overwrite the association "today == 21-11-2008"
13:47philChousuke: I'll think on it a bit more. I'm hoping for something quite formal to capture the idea.
14:09technomancyI'm curious as to the motivation behind leaving out an implicit progn in if
14:09technomancysorry, implicit do.
14:09technomancyis it just so that the true and false branches are parallel?
14:10technomancyoh, or to discourage side-effects... that would make sense
14:10kotaraktechnomancy: How do you decide, when the if branch is finished?
14:11technomancykotarak: when it runs out of arguments? I don't understand the question.
14:12kotaraktechnomancy: If I understand you correctly, you ask why in (if (...) (do (a) (b))) the do is necessary?
14:13technomancykotarak: well in other lisps the third argument to "if" is considered a "rest" arg, and it's wrapped in an implicit do.
14:13tWipreally?
14:13kotaraktechnomancy: ok. So in (if (..) (a) (b)) is b in the else branch or not?
14:13tWipI don't think that's true for CL at least
14:14tWipor elisp or scheme
14:14technomancyso (if cond true-form false-form1 false-form2) becomes (if cond true-form (do false-form1 false-form2))
14:14technomancykotarak: the do only wraps the last arg
14:14technomancytWip: (if nil 2 3 4 5) ;; <= returns 5
14:14tWipok. I stand corrected then.
14:15HuntWip: it is in cl
14:15tWipDidn't know that. I've always just progn
14:15technomancytWip: the best part about IRCing from emacs is that you can check these things as you type them. =)
14:15tWip+used
14:15technomancybut since clojure explicitly discourages side-effects, it makes sense to require an explicit do
14:17kotarakAnd from a stylistic point of view: Why should the else branch be treated differently?
14:17tWipok scheme doesn't allow that
14:18hiredman(meta ...) works on symbols, yes?
14:18hiredmanah
14:19hiredmanfind-var is what I need
14:20technomancykotarak: because you can only have one rest argument. but that's an implementation excuse.
14:23technomancymaybe this is obvious to people who've used Java before, but what do you do with a fresh checkout of the closure source?
14:23tWipant
14:23tWipor mvn install
14:23technomancycool, thanks.
14:23tWipboth build systems are supported (build.xml is for ant, pom.xml is for maven)
14:23technomancythat *definitely* belongs in the readme
14:23tWipagreed
14:24hiredmantechnomancy: in clojurebot
14:25technomancyhiredman: or clojurebot could just say, "read the readme"
14:25technomancy=)
14:25technomancyare you guys pretty happy with SVN, or are there plans to move to a distributed system?
14:26technomancynot being able to fix the readme myself feels very strange after using git for so long. =)
14:26tWipyou could send a patch to the group
14:26duck1123technomancy: there is a git mirror on github
14:27Pupenotechnomancy: git-svn is your friend ;)
14:27Pupenotechnomancy: and... what duck1123 said.
14:28technomancyduck1123: will check that out.
14:28duck1123https://github.com/kevinoneill/clojure/tree
14:28technomancytWip: yeah, it's just more manual than I'm used to. not a big deal though.
14:30technomancyfolks would certainly be more likely to submit patches for smaller things if the barrier to contribution were lower.
14:30craigmcdHey guys...anyone have any examples of how you would do what used to be gen-and-save-class?
14:32craigmcdi.e, using the new AOT class generation.
14:33ChouserAOT/gen-class syntax: http://paste.lisp.org/display/70665
14:33Chouserthe "announcement" starts here: http://clojure-log.n01se.net/date/2008-11-18.html#14:19
14:34craigmcdthanks
14:36lisppaste8asken pasted "OO-system, comments?" at http://paste.lisp.org/display/70846
14:37askentaskhttp://paste.lisp.org/display/70846
14:37askentask^^ askentaskens -not-so-cute- OO-system for clojure
14:37askentasklol bold claim, it sucks :(
14:37askentaskbut comments would be appreciated
14:38tWipwhy is the code in add-method quoted?
14:38askentaskbecause i ti is evaled when called, didnt know how else to store it
14:39askentaski will add the obvious possibility of passing aguments to methods and more stuff
14:39askentaskuh the example is a bit messy , ill annottate
14:39tWipI may be missing something, but why not just use defmulti?
14:41askentaskbecause im trying to learn more about programming languages rathet than do something directly useful
14:41lisppaste8asken annotated #70846 with "OO-example" at http://paste.lisp.org/display/70846#1
14:42tWipare keywords replaced with accessors in method code?
14:44askentaskyes
14:44tWipso you can't use keywords for other things
14:45askentaskeach instance has a spec-map and a attribute-map. when doing (call instance method-name) the method in spec will be fetched and the keywords replaced by the corresponding values
14:45askentaskother?
14:45askentaski guess it will be a problem if you had a method that ocntained another method-call
14:45askentaskno wait
14:45askentaskit should work
14:45tWipI mean that you can't use keywords for their normal use then
14:46askentaskit only replaces for keywords that arw attributes
14:46askentaskif there is a name-clash there could be a problem
14:46askentaskbut otherwise should work
14:49Chousukehmmh
14:49hiredman(doc str)
14:50Chousukeaskentask: #(add-method with (first %) (second %)) methods) in spec-class is suspect
14:50Chousukeaskentask: you're not dereferencing the ref
14:51Chousukewhich means you're not passing add-method the instance, but a ref.
14:52Chousukeso (get instance :spec) tries to get :spec from the ref, not its value.
14:53Chousukeand it returns nil, thus an NPE is thrown
14:54hiredman(doc str)
14:54askentaskChousuke: uh yes that is not finished
14:54askentaskspec-clas
14:55hiredmanok
14:55Chousukeredef'ing things is ugly too :)
14:55hiredmanthird time is the charm
14:55hiredman(doc str)
14:55clojurebotWith no args, returns the empty string. With one arg x, returns x.toString(). (str nil) returns the empty string. With more than one arg, returns the concatenation of the str values of the args.
14:55technomancyhiredman: that was quick.
14:56Chouserhiredman: that's via xmpp?
14:56hiredmanno
14:56hiredmanI grabbed pircbot
14:56Chouserexcellent
14:56hiredmanit just does doc lookup for stuff in the clojure namespace right now
14:57hiredmannot clojure.core :(
14:57technomancyhiredman: is it easy to make it store and lookup definitions?
14:57technomancyclojurebot: clojure
14:57hiredmanoh, that doesn't work
14:58hiredmanright now it just looks for (doc x)
14:58lisppaste8Chousuke annotated #70846 with "using -> (untested)" at http://paste.lisp.org/display/70846#2
14:58Chousukewhoops
14:58Chousukeforgot some extra stuff in the annotation
14:58Chousukebut with -> it looks almost nice
14:58hiredmanmakes a symbol out of x, resolves it to a var in the clojure ns, grabs the metadata and returns the :doc bit
14:59technomancycool.
14:59technomancydefinitions should be easy to add.
14:59technomancyat least, until you start to think about persistence
14:59tWip(doc this-should-not-exist)
14:59lisppaste8hiredman pasted "clojurebot" at http://paste.lisp.org/display/70849
15:00drewrhttp://clojure-log.n01se.net/date/2008-05-23.html#17:33 :-)
15:00tWipit could warn about not finding something, or even doing some levenshtein/fuzzy matching
15:00tWipbut nice work getting that up so quickly :)
15:00hiredmanthank you
15:00hiredmanit could just slurp and spit forms into a file
15:01hiredmanI guess
15:01hiredmanack
15:01hiredmanI missed a ( in that paste
15:02hiredmanany more bits are missing, what I get for doing everything in the repl
15:05hiredman(doc this-should-not-exist)
15:06hiredman(doc this-should-not-exist)
15:06askentaskChousuke: yes -> makes it nicer-lookign, thanks!
15:06hiredmanwell, it was fun, but I just broke it again
15:08hiredmanfixed, it also resposne to privmsgs
15:09askentaskis it concurrent :)
15:09hiredmanuh
15:09hiredmanI know nothing about the internals of pircbot
15:10Chousukeaskentask: actually using -> won't work because your add-method function is evil and doesn't return the rect instance
15:11askentasklol i noticed
15:12Chousukeyou can either use doto or fix it to return the rect
15:12Chousukethough why does add-method take the instance as a parameter at all? it adds a method to the class, doesn't it?
15:13askentaskyes
15:13askentaskhow else would it now which one?
15:14Chousukeyou pass it the class name as a parameter perhaps.
15:14Chousukeor the class itself
15:15Chousukeas it is now, your define-class defines an instance
15:15Chousuke...
15:15Chousukeaskentask: why does your connection always break when I'm talking to you? :(
15:15hiredmanwell
15:16hiredmancall the instances prototype objects :P
15:17Chousuke:p
15:18askentaskok
15:20askentaski should separate the add-method from def-attribute as well. there should be first one way to specify a class then one wya to initialize them. i feeel like im messing things up
15:20askentasklike it is all intertwined and i dont know how to separate it
15:25Chousukemaps make fine classes too: (def cat {:meow #(println "Meow") :sleep #(println "Generic cat sleep!")}) (def fuzzy (assoc cat :name "fuzzy" :sleep #(println "Seeing fuzzy dreams"))), ((:meow fuzzy)) (doseq [c [cat fuzzy]] ((:sleep c)))
15:27askentaskwhat is mod again?
15:27Chousukemod?
15:27Chouserrem
15:27Chouserthink "quotiant and remainder" qout rem
15:28askentaskah yes
15:33abrooksThe neurons that were wired when I was a young boy programming in BASIC on my C=64 still interprets REM as a comment (REMark). I guess DOS batch also reinforced that.
15:36abrooksI do wish that "rem" was "mod".
15:38Chouser(def mod rem)
15:38danlei`abrooks: well, if you're coming from the c64, we should rename poke too =)
15:38hiredmanclojurebot: svn?
15:38abrooksActually, I'm realizing that there's room for both rem and mod and that mod's missing. rem should have the sign of the dividend and mod should have the sign of the divisor.
15:38danlei`s/poke/peek
15:38abrooks(def poke set!)
15:38danlei`=)
15:45askentaskif im using (reduce + (for [x...)) it is then evaled lazily right? so it is not traversing the lsit twice(but perhaps stilla bit slower )?
15:47Chouserreduce kills laziness, but 'for' will only generate each number for it one time.
15:48gnuvince~help ~markovnick
15:50craigmcdChouser: thanks for the hint on the new gen-class. But why does this work fine: (.main my.Hello (into-array ["Bizarro"])), while this syntax doesn't: (my.Hello/main (into-array ["Bizarro"]))
15:50askentaskLucky Sevens
15:50askentaskWrite a program to compute the sum of all the integers between 1 and 1011 both divisible by seven and, when the decimal digits are reversed, are still divisible by seven.
15:50askentask1 and 10 raised to 11 that is
15:51askentaski wrote a nice short program that takes forever so i guess the problem is to find some pattern or do soem clever huge-integer-summing.
15:51askentaskanyone know such stuff?
15:53Chousercraigmcd: foo/bar syntax is only for when foo is a namespace or when foo is a class and bar is a static member (method or field)
15:53craigmcdBut my.Hello is a class and main is a static member
15:53Chouseroh, main is static.
15:53Chousersorry, just catching up here. :-)
15:54craigmcdYeah, it's almost as if the "/" syntax for static methods isn't working on generated classes
15:54Chouserhm... are you calling gen-class yourself, or using :genclass?
15:54hiredmanclojurebot: svn?
15:54craigmcdusing ":genclass"
15:55hiredmanclojurebot: svn?
15:55clojurebotsvn co https://clojure.svn.sourceforge.net/svnroot/clojure clojure
15:55hiredmanthanks
15:55craigmcdand I can call this main method using "java.." from the command line and it works. and I checked the class with slime inspector, and main is really static
15:57Chouserok, I don't really understand -- it should work. But here's what little I know...
15:58Chouser(.foo bar) expands to (. bar foo) without exception. But (foo/bar) has to figure out if foo is a class or not (at read time). If foo is a class, then it also becomes (. foo bar), otherwise it's resolved as a var in the foo namespace.
15:59Chouserso it's acting as those it doesn't know at read time that there's a class named my.Hello
15:59craigmcdhmm.. interesting. thanks
16:00Chouser"as though"
16:00Chouserbut if my.Hello wasn't findable in your classpath, neither form would work. So I dunno.
16:01ChouserMaybe bring it up on the google group so people smarter than I can poke at it.
16:01craigmcdYeah, I think I'll post that one...thanks.
16:06duck1123clojurebot: group?
16:10Lau_of_DK...
16:11Lau_of_DKAre there wrapper for JQuery/JSon yet, so you can stay out of the javascript stuff?
16:13tWipisn't Chouser's clojurescript doing that in a way
16:13tWiptranslating clojure forms to javascript, as far as I can tell
16:13Lau_of_DKIm not sure... thats why Im asking :)
16:14Chousukewhat are you trying to do?
16:14powr-tochey
16:14Chousukewrite javascript in clojure?
16:14Chousukeor interact with something that sends you json?
16:14Lau_of_DKSpecifically to use JSon or JQuery from Clojure
16:15Chouserclojurescript's currently targetted at converting clojure code forms to js code. The datastructures on the JS side are still Persistent and require a chunk of runtime support code.
16:15tWipjson and jquery are totally different things
16:15Lau_of_DKYes, but I can use either and still be happy
16:15tWipjquery is a full javascript library/framework and json is a serialization format
16:15Chouserif you want javascript Object and Array instances from clojure Map and Vector instances, you don't want clojurescript.
16:15tWipyou can easily wrap one of the Java libs that handle JSON parse/read
16:16Chousersomebody's got a pure clojure json encoder though. I'll see if I can find it.
16:16tWippossibly with some added code to handle translation from Java Collections to native Clojure structures
16:17jgracindo we have a group-by or categorize-by function anywhere? Takes pred and a collection to categorize.
16:17Chouserjgracin: clojure.contrib.lazy-seq I think
16:17ChouserLau_of_DK: http://github.com/danlarkin/clojure-json/tree/master
16:17Lau_of_DKjgracin: http://paste.lisp.org/display/64190
16:18Lau_of_DKThanks Mr. Houser
16:18Chouserjgracin: sorry, clojure.contrib.seq-utils
16:18jgracinChouser: thanks!
16:18danlarkinHeyooooo
16:18Chouser...which is the same as Lau_of_DK posted. Thanks, Lau_of_DK!
16:19jgracinLau_of_DK: thanks
16:20danlarkinJSON encoder only right now, soon a decoder too, though! *crosses fingers*
16:20Lau_of_DKhehe
16:20Chouserdanlarkin: sorry I called you 'somebody'
16:20Lau_of_DKdanlarkin: you wouldnt happend to have any sample sites running?
16:21danlarkinChouser: haha it's okay, I forgive you
16:21danlarkinLau_of_DK: sample sites running?
16:21Lau_of_DKdanlarkin: something that uses your wrapper
16:23danlarkinoh, no, I do not. Though someone (I forget who, I'll try to find it in the logs) a few weeks ago was saying he did
16:24danlarkinit's pretty easy to use, though, (org.danlarkin.json/encode-to-str sexprs)
16:25danlarkinah ha, it was blackdog
16:25Lau_of_DKBlackdog has done some advanced stuff on the webfront, hes the guy to informed me about JSon in the first place
16:37askentaskChousuke: lets say i create a function spec-class that take [classname parent methods] where methods is a vector of vectors with name-functionlist pairs. how would i use -> then? i tired adding a for-comprehension but i get wrong nbr of args to for.
16:38askentaskwait it wked with map
16:38Chousukeaskentask: -> is just a macro
16:39Chouser'for' is also just a macro
16:39Chousukeaskentask: (-> :X (:a :b)) == (:a :X :b)
16:40Chousukeaskentask: further (-> :X (:a :b) (:c :d)) == (-> (:a :X :b) (:c :d)) == (:c (:a :X :b) :d)
16:40askentaskeate ISeq from: spec_class__2930$fn__2932
16:40askentask: Don't know how to create ISe
16:42Chousukeyou need to show the code if you paste error messages :/
16:42Chousukeespecially cryptic ones like that. :P
16:44askentaskit compiles but fails when called
16:44askentaskyes
16:44askentaskit seems lippsaste is dow
16:44askentaskhttp://hpaste.org/12262
16:45Chousukeaskentask: you're using -> wrong in the spec-class fn
16:46askentaskhmm perhaps that shouldnt work buti dont really know how to get what i want
16:46Chousukeaskentask: -> puts its first argument as the second item in the following form.
16:46Chousukeyou
16:47Lau_of_DK(boys, did you al checkout Netbeans Svn / Enclojure plugins)
16:47Chousukeaskentask: you're actually doing (map (define-class-no-ref classname parent) #(add-method (first %) (second %)) methods)) there
16:48Chousukeaskentask: in the previous form, -> just exploits the fact that the rectangle is the second parameter
16:48Chousukeand that the methods return the rectangle
16:49hiredmanclojurebot: group? is http://groups.google.com/group/clojure
16:49hiredmanclojurebot: group?
16:49clojurebotclojurebot: group? is http://groups.google.com/group/clojure
16:50hiredmanuh
16:50hiredmanclose but no cigar
16:51Chousukefor example, the first form reduces to (def rect (def-attribute (def-attribute (add-method (add-method (define-class-no-ref :rect nil) :area '(* :width :length)) :square? '(= :width :length)) :width 10) :length 20)))
16:51technomancyhiredman: can you put up the source to clojurebot?
16:51hiredmansure
16:51hiredmanit is rather shameful
16:52technomancywell this is my first day with clojure, so you can be sure I won't judge.
16:52technomancycan you toss it on github or something?
16:52Chousukeaskentask: do you see how -> works now? :)
16:52hiredmanuh, well, uh, I guess
16:52hiredmanI'd have to figure out git
16:53technomancyhiredman: or whatever SCM you prefer; heh
16:53tWipI'm intrigued by git as well... currently using google code hosting for webjure
16:53tWipand SVN on that
16:53hiredmantechnomancy: for now how about a plain http link?
16:54technomancyhiredman: that works for now.
16:54technomancysince I probably won't have much to contribute at this point
16:54technomancytWip: you should give it a shot; it can dramatically lower the barrier to contribution.
16:54hiredmanhttp://www.thelastcitadel.com/lab/clojurebot.clj
16:55technomancytWip: or any DSCM really, but git seems to have the most momentum
16:55tWipI did use darcs for some code, but didn't like it
16:55hiredmanbits missing to actually run, because I started off monkeying around in the repl
16:55Chousukegit and mercurial are both nice.
16:55Chousukemercurial is slower than git, but works better on windows :)
16:55hiredmanI use bzr
16:55technomancynothing wrong with bzr
16:56technomancy*for projects without tons and tons of history, at least
16:56hiredmanheh
16:56Chousukegit is probably the fastest VCS around :P
16:56technomancyhiredman: they're trying to move Emacs to bzr, but it takes ages to do anything with it. =\
16:57technomancybzr log takes several minutes.
16:58Chousuke:/
16:58hiredmananyway, clojurebot is still one file, a hair less then 100 lines
16:58rottcoddChouser: the symbol-macrolet spec is here http://www.lispworks.com/documentation/HyperSpec/Body/s_symbol.htm
16:58technomancyChousuke: well it *does* go back further than I've been alive. but still...
16:58Chousuketechnomancy: :)
16:58hiredmanthe github paste thing
16:59askentask(defn spec-class [classname parent methods]
16:59Chousuketechnomancy: git log should be fast. it's designed to work well with browsing the entire history (it's slower if you need the history of one file)
17:00askentask (let [inst (define-class-no-ref classname parent)]
17:00askentask (map #(add-method inst (first %) (second %)) methods)))
17:00askentaskwtf
17:00askentasksorry
17:00askentaskthat works , but not correctly :P
17:00technomancyChousuke: it may not be the fairest comparison, true
17:00Chousukewonder if there's an emacs git repo anywhere.
17:01askentaskit creates 2 different instances rather than one
17:01askentaskone for each method
17:01Chouserrottcodd: ok, thanks.
17:02technomancyChousuke: git://git.sv.gnu.org/emacs.git
17:02hiredmanclojurebot: group? is http://groups.google.com/group/clojure
17:02hiredmanclojurebot: group?
17:02technomancybut it takes like 30m since there's so much history to pull
17:02hiredmanugh, something, somewhere is swallowing exceptions
17:04ChousukeI wonder how huge that repo is.
17:05technomancy172 MB
17:05technomancyif you can get it from someone locally it would be less cruel to their server; heh.
17:05Chousukestill, a clone will probably be faster than most SVN repos I've had to check out :(
17:05Chousukeespecially on google code
17:06technomancyChousuke: for most projects, yes. but emacs' history is insaaaaane.
17:06Chousukewell, yeah
17:06technomancyoh... you can do a shallow clone if you don't care about history
17:06technomancygit clone --depth=100 [...]
17:06Chousukenah, I want all of it.
17:06technomancygoing to do some code archeology? =)
17:07Chousukeperhaps :P
17:07Chousuke hm
17:08Chousukenot very speedy. only ~100kB/s :/
17:10ChousukeWell, at least I don't have to do a CVS -> git import
17:10Chousukethat would take weeks
17:21Chouserno docs yet, and some functionality turned off for security reasons, but if anyone wants to try it: http://clojurescript.n01se.net/
17:23hiredmanclojurebot: mutable state is bad
17:23clojurebotOk.
17:23mmcgranacool! congrats on getting this up
17:23hiredmanclojurebot: mutable state?
17:23hiredmanweird
17:24Chouserjavascript interop example: (set! (-> document .body .style .background) "red")
17:25mmcgrananice
17:28hiredmanclojurebot: mutable state is bad
17:28clojurebotYou don't have to tell me twice.
17:28hiredmanclojurebot: mutable state?
17:28clojurebotmutable state is bad
17:29Chouserhiredman: nice. will such facts survive power disruption?
17:29hiredmannot yet
17:29hiredmanright now they go into a ref
17:29Chouservery good.
17:31technomancyclojurebot: svn?
17:31clojurebotsvn co https://clojure.svn.sourceforge.net/svnroot/clojure clojure
17:31hiredmanclojurebot: clojurescript is Chouser's baby
17:31clojurebotOk.
17:31Chouserclojurebot: baby?
17:31clojurebotExcuse me?
17:31Chouserclojurebot: clojurescript?
17:31clojurebotclojurescript is Chouser's baby
17:31hiredmanclojurebot: clojurescript?
17:31clojurebotclojurescript is Chouser's baby
17:31technomancyclojurebot: botsnack is delicious.
17:31clojurebotYou don't have to tell me twice.
17:32technomancyclojurebot: botsnack
17:32clojurebotbotsnack is delicious.
17:32technomancyclojurebot: botsnack is delicious. (nom nom nom)
17:32clojurebotRoger.
17:33technomancyeventually he'll need to have some terms that don't get echoed with the "foo is" prefix
17:33hiredmanyeah
17:34technomancyso someone can say: clojurebot: botsnack, and he'll say: thanks! (nom nom nom)
17:34technomancybut... priorities. =)
17:35hiredmanI can add a deal where if the definition is prefixed with <reply> he drops the is, like an infobot
17:35technomancysomething like that, yeah.
17:36technomancyshould put it in a bzr repo so others can help. =)
17:37sohailtechnomancy, out of curiosity, why bzr vs git? (I use bzr personally)
17:37technomancysohail: I use git too, but hiredman said he used bzr
17:38Lau_of_DKTheres a wiki which compares next to all known version control systems, proprietary and free
17:39Lau_of_DKclojurebot: Produce link to above mentioned wiki
17:39clojurebotExcuse me?
17:39Lau_of_DKclojurebot: OBEY
17:39clojurebotExcuse me?
17:49Chousukehttp://keithp.com/blogs/Repository_Formats_Matter/ this was a rather interesting read.
17:52Chousukeheh
17:52Chousuketried git log on the emacs repo
17:52Chousukeit was instant
17:53tWipisn't git Linus' brainchild?
17:53Chousukefirst commit message: "entered into RCS" by Jim Blandy at Date: Thu Apr 18 00:48:29 1985 +0000
17:53technomancyChousuke: there's some fun stuff way back there. =)
17:53Chousukeyeah
17:54hiredmanjesus
17:54drewrtWip: Yes.
17:54ChousukeI didn't expect the log command to be that fast though.
17:54Chousukeit took no time at all
17:54tWipit's funny how quickly it overtook cvs/svn/others in the hacker mindset
17:55tWipLinus' google tech talk on the subject is epic. He really lets SVN people have it.
17:55ChousuketWip: well, one of the largest and most influential open source projects switched to it. :P
17:55technomancytWip: for me github sealed the deal
17:56technomancyit makes it trivial to start helping out with a project
17:56Chousukemaybe people also noticed that DVCS systems can do everything a centralised one can. usually better, too.
17:56tWipso github is sourceforge for git?
17:56tWipthe page seems clearer, I dislike the "new" sourceforge
17:56technomancytWip: depends on your opinion of sourceforge. =)
17:57ChousukeI also like the fact that setting up a repository is rather trivial.
17:57Lau_of_DKtWip: yes
17:57Chousukejust git init in a directory and then give someone ssh access to it :P
17:57Chousukekotarak: more or less, yeah
17:57technomancytWip: it's just focused on code (rather than issues, mailing lists, etc.) but it does that really really well.
17:57Chousukekotarak: they all have different stregths though.
17:57kotarakyes
17:58hiredmanclojurebot: hg is <reply>kotarak prefers hg
17:58clojurebotRoger.
17:58technomancytWip: makes it really easy to track what's going on in all the projects you're interested in; has great visualizations for how branches are interacting, etc.
17:58hiredmanclojurebot: hg?
17:58clojurebotkotarak prefers hg
17:58Chousukegit is fast and efficient; hg and bzr are easier to use and more portable.
17:58kotarakhg is also fast
17:58Chousukenot as fast as git though
17:58kotarakfast enough for me, at least
17:58Lau_of_DKclojurebot: bye is <reply>/part #clojure
17:58clojurebotRoger.
17:59Lau_of_DKclojurebot: bye?
17:59clojurebot/part #clojure
17:59hiredmanclojurebot doesn't do "also" yet
17:59Lau_of_DK:|
17:59hiredmanLau_of_DK: cute
17:59Lau_of_DKThanks
17:59kotarakhttp://changelog.complete.org/archives/698-if-version-control-systems-were-airlines
18:00technomancykotarak: that page is hilarious
18:00kotaraktechnomancy: I think I was laughing ten minutes
18:00technomancyI love the SVN merging room where everyone is given a brick and only one person comes out.
18:01technomancyI still haven't hacked on any projects that use hg though.
18:02technomancyI'm afraid to build Mozilla, and don't have much to do with the Sun world.
18:03kotarakpatch queues are simply awesome...
18:03kotarakCan't live without 'em anymore.
18:03tWipto be totally honest, I never really cared much about version control
18:04tWipof course, you'd have to be crazy not to use some, but mostly I'm working on code alone
18:05rzezeskieven if you are working on it alone, it's nice to see your iterations, or to roll back to a working copy
18:05kotarakI'm also working alone. But I also often experiment.
18:05kotarakWith vc it's much easier to get back to a sane state. :)
18:05tWipoh I see that, experimenting with SVN means you don't commit :)
18:06Lau_of_DKChousuke: Thank you for that link, it was an interesting read indeed
18:06tWipbranching/merging is still too painful for real work
18:06Lau_of_DK(rhymes incl free of charge)
18:06kotarakExperimenting with hg and mq is a breeze.
18:06rzezeskiyou can experiment while commiting in SVN, it's called a feature branch
18:06rzezeskisure it's not as easy as the latest and greatest VC's, but it's not impossible, just a little more annoying
18:07tWipyes but "not impossible" isn't a ringing endorsement
18:07technomancymercurial has a bisect tool, right?
18:07lisppaste8Chouser pasted "clojurescript js interop" at http://paste.lisp.org/display/70859
18:07rzezeskiOh I'm not saying it is, if you have the choice you should certainly pick whatever you are most comfortable with, but in the workplace you don't always have that choice
18:07technomancytWip: reminds me of the Vista reviews. "It's not so bad."
18:07Chousersorry to paste and run -- dinner time.
18:08rzezeskiI have to work with SVN, and personally I don't mind it especially since I used to have to work with CVS
18:08Lau_of_DKChouser: thats awesome man
18:08Lau_of_DKNice work
18:08tWipwe use SVN at work also
18:09ChousukeI have my own "feature branch" of clojure :p
18:09Chousukecurrently it just contains one commit that uncomments the add-.clj-files ant directive
18:10tWipis everyone using ant btw?
18:10tWipbecause I use Maven 2
18:10technomancyjust because I've read horror stories about ant's executable XML and greenspun's tenth law
18:10rzezeskiI prefer Maven, but Maven too has many flaws
18:10technomancybut I've heard my fair share of maven horror stories too
18:10Chousukebut at least I don't have to edit it every time the master branch changes. git rebase master applies all changes, then applies my uncomment patch
18:11tWipwell the more convoluted Maven plugin configs are pretty horrific also
18:11kotaraktechnomancy: yes, hg has bisect
18:11tWipthat's not the word I want, is it
18:11rzezeskiI converted a fairly large project using Ant over to Maven and it was NOT an easy task
18:11Chousukeit's so easy to handle branching in git that you start doing them for the most trivial of things
18:11rzezeskiDon't even try to use the release plugin or deployment plugins
18:12hiredmanugh
18:12tWipwell Maven has dependency management, which is good
18:12technomancyseems like a build system should be written in clojure if you can ship it as bytecode to solve the chicken-and-egg problem
18:12tWipfor some value of "good"
18:12Chousuketechnomancy: a clojure build system would be nice. :)
18:12hiredmanI hate that all the java build systems grab deps from all over the none universe while you are trying to build
18:12rzezeskiyes that's probably is biggest selling point, until you get a bunch of transitive dependencies in your EAR and you wonder how the f they got there
18:12tWiphiredman: how is that different to say perl?
18:13tWipor python, or ruby? don't they do the same thing
18:13tWipor ASDF-INSTALL for that matter
18:13technomancywith ruby you get all your deps from the same server at least.
18:13hiredmannow that you mention it, I am not a huge fan of ruby gems
18:14hiredmanbut gems, at least you issue an install command to go get them
18:14tWipI quite like the maven style (when it works)
18:14hiredmana lot of maven/ant deals just go grab them when you type "ant"
18:14tWipJust add deps to your project definition and they are available
18:15rzezeskiMaven is great if your project sticks to the main plugins and strictly follows Maven conventions
18:15rzezeskiotherwise it can be just as bad, if not worse, than Ant
18:15tWipthe downside is that a poorly made dependency (like say a wrong or missing scope) can grab 10 megabytes of useless stuff to your build
18:16rzezeskiMaven...great idea...ok implementation
18:16tWiphaving sometimes forgotten to add a scope=test and seen a tenfold increase in the build artifact size :P
18:16tWipI think there is a dep manager for ant called Ivy iirc
18:17rzezeskiyou can use Maven as a dep manager for Ant
18:17technomancythe great thing about being part of such a young language community is that you can have a say in how such a build system would work. =)
18:17tWipI'd say 1) no XML
18:17tWipbut your mileage may vary
18:17technomancytWip: of course no XML
18:17technomancyshould be a given. =)
18:19tWipmaybe that system should include a CPAN style or cliki.net style common place to find relevant libs
18:19tWipbut I fear reinventing the wheel
18:20danlarkinlike pypi
18:21technomancytWip: IMHO a package manager is inevitable
18:22tWipmight be
18:25technomancyI don't think it should be part of the build system though.
18:26tWipbut problems like source control, unit testing or build issues are never as interesting as the problems themselves :)
18:26technomancytrue
18:26tWipso it may take considerable time to get those
18:27tWipbut what's the rush... better to do it right, than to do it fast
18:32technomancywell, it's pretty easy to look at other package managers to see what they do wrong
18:32tWipyes, and then you are the fodder for the next generation of package managers
18:33tWipit's hard to get right, but for most uses "almost right" may suffice
18:34tWipevery build system and package manager has had their fair share of weak points
18:36technomancybut most of the weak points of the package managers I've used are just, "we haven't gotten to that point yet" kind of problems.
18:39tWipinteresting talks, have to sleep now as I have a 3 hour drive in the morning
18:39technomancylater.
18:39tWipbye
18:46powr-tochow are lazy-cons sequences garbage collected? Presumably it's when the reference to the lazy-seq is lost?
18:50hiredman(doc defmethod)
18:50clojurebotCreates and installs a new method of multimethod associated with dispatch-value.
18:51danlarkinhiredman: HEYOooooo
18:51hiredmanthat wasn't very useful though
18:51danlarkinpowr-toc: right, if there's no reference to data the jvm will clean it up according to its GC scheme
19:00mmcgranaSo I'm playing around with my html doc generator right now and I've come across a few things in the Clojure source: let me know if anyone has any thoughts on this stuff:
19:00mmcgrana- clojure.core/! is still in there
19:01mmcgrana- several of the *named-vars* don't have docstrings, e.g. *file* and *err*
19:01hiredmanclojurebot: defmethod docstrings is <reply>defmethods don't get docstrings :(
19:01clojurebotRoger.
19:02mmcgrana- in clojure.contrib.seq-utils, I think flatten and seperate could use (remove f... instead of (filter (complement f) ....
19:02mmcgrana- again in seq-utils, group-by and partitioin-by seem to have their arg vectors in the wrong spot relative to the docstring
19:04mmcgranamaybe i should just make some patches and post them to the group
19:05danlarkinmmcgrana: that would be productive
19:07mmcgranai still have to send a CA in, so it will be a few days of turnaround. clearly no hurry on this stuff though.
19:32hiredmanwoa
19:33hiredmanso, I am compiling some clj that uses (rand-int ...) and it is generating a lot of class files
19:34Chouserone class file per fn
19:34Chouserat least
19:34hiredmanuh
19:34hiredmanmuch more
19:34hiredmanok
19:35hiredmanso I get and exception like: java.lang.RuntimeException: java.lang.ClassNotFoundException: hiredman.clojurebot$random_response__706 (NO_SOURCE_FILE:0)
19:35hiredmanevertime I run (compile ...)
19:36hiredmandifferent everytime, and everytime in generates more class files in ~/classes
19:36mmcgranainner, anonymous functions maybe, like #(+ % 2) ?
19:36hiredmanuh
19:36hiredmanthere are over 600 of them right now
19:37hiredmanclojurebot$random_response__97.class
19:37hiredmanetc
19:37hiredmanlisppaste8: url
19:37lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
19:38lisppaste8hiredman pasted "random-response" at http://paste.lisp.org/display/70864
19:38Chousersince the classes are given unique names, running compile will make more class files each time you run
19:38ChouserIf you want a minimal set of class files, clear out your classes dir and do one compile.
19:39hiredmanChouser: the compile always ends with a class not found exception
19:40Chousermake sure you have ./classes in your classpath, and that the dir exists before you start java
19:40hiredmanaht may be it, maybe ./classes is not in my cp
19:42hiredmanoops
19:43hiredmanthat was the wrong repl to close
19:43Chouserheh
19:44hiredmanugh
19:49technomancyis this true?
19:50Chouseryou mean automatically?
19:50ChouserI shouldn't answer, I don't know. I use rlwrap
19:50technomancyright; like you have to manually add it to your CLI invocation
19:50Chouserthat seems likely
19:50technomancythat... is terrible.
19:50technomancybut I forgot about rlwrap
19:51technomancyis that just a limitation of java then? no good way to take advantage of system-level libraries?
19:53Chousersorry, I don't really know. I thought jline was a java lib, in which case it would be a matter of adding it to your classpath and clojure's repl knowing to look for it.
19:53Chousuketechnomancy: you need to explicitly call jline for it to work
19:53powr-toctechnomancy: no it's not a limitation of java... as chooser says, it just needs to be on the classpath
19:54Chousukeclojure never even knows jline is there.
19:54technomancyit just seems strange that apt-get doesn't place it on the classpath automatically
19:54technomancy(the classpath is basically just java's load path, right?)
19:54ChousukeAs far as I know, jline just wraps some classes and filters input before it reaches clojure.
19:54powr-toctechnomancy: well, with java, that's usually a bad thing
19:55Chousuketechnomancy: you can add it to $CLASSPATH :)
19:55powr-toc$CLASSPATH is evil though
19:56Chousukewell, it works :P
19:56technomancyjust seems like it's busywork. what's the point of a package manager if it can't install libraries in the right place for you?
19:56powr-tocI mean it's fine for toying about, but it'll bite you in the ass later if you're not careful
19:56Chousuketechnomancy: it does install them in the right place.
19:57technomancyChousuke: in my mind the right place is somewhere where clojure can use it.
19:57Chousuketechnomancy: that can be anywhere.
19:57Chousuketechnomancy: besides, clojure doesn't use jline.
19:57Chousukethe wrapper script does.
19:58technomancyok... obviously I am missing some big piece of the puzzle, so I'll just stay quiet until I know what I'm talking about.
19:58powr-toctechnomancy: just start clojure with: java -cp /path/to/clojure.jar:/path/to/jline.jar clojure.lang.Repl
19:58powr-toc
19:58Chousuketechnomancy: in the wrapper script, it's just one additional element in the classpath specification.
19:58Chousuketechnomancy: in general, you don't want system wide libraries automatically in your classpath
19:58technomancyChousuke: that's what I don't understand.
19:59technomancyit works great for every other language.
19:59powr-toctechnomancy: if the package manager were to set your classpath system wide for you, you'd likely end up with horrendous version conflicts... between different programs
20:00Chousuketechnomancy: java is different :)
20:00technomancyoh, is there no way to state dependencies on specific versions then?
20:00Chousuketechnomancy: avoids a whole lot of problems by being explicit.
20:01Chousuketechnomancy: you specify the appropriate versions in your classpath and there is no problem.
20:01powr-toctechnomancy: jar files in and of themselves; don't know what they depend on.
20:03technomancyto me it all just sounds like, "make the user do the work the computer normally does". but... I'm just getting used to it, maybe once I start using it things will make sense.
20:03Chousertechnomancy: your instincts are rational. I had a similar conversation several months ago.
20:04Chousuketechnomancy: it's still possible to have a system-wide classpath
20:04technomancyI'll just try to keep my dependencies on Java code to a minimum. Sounds like a headache.
20:04Chousuketechnomancy: but as said before, that might break things.
20:04Chousertechnomancy: I was arguing with Rich (which is a bad sign in itself) and ended up dropping it not because I was convinced java is right but because I trusted the people that had the opposing opinion.
20:05Chousuketechnomancy: that helps. or you can be lazy and wrap all the deps in a single .jar :/
20:05technomancyChouser: yeah, my first day trying clojure/java is not a good time for me to get in an argument about this kind of thing.
20:05ChouserI'm still not fully convinced -- it seems odd to me every time I write an app and have to adjust my clojure command-line to set up the dependencies on .jar's I've already apt install'ed.
20:06technomancyChousuke: then when a security update gets published, it's my fault if stuff doesn't get updated. =\
20:06ChousukeI think java's way of doing things is the only sane way if you want to maintain the "write once, run anywhere" illusion :p
20:06powr-toctechnomancy: java 7 is supposedly going to introduce superpackages with jsr 294
20:06Chouserbut it's not so terrible to work around, and having just built my first stand-alone jar with all the deps bundled inside, I'm wodering if I'm getting closer to the 'goodness'.
20:07technomancyworse still, the users will think to themselves: "I've run an apt-get upgrade to pull in the new versions, so I shouldn't be vulnerable", but the bundled versions don't get touched.
20:07Chousuketechnomancy: the bundled versions are inside your own .jar. you need to make a new release.
20:08powr-tocChouser: I can't speak for clojure so much, but in Java I tend to throw all my apps jars into a single directory, and use a shell script to pull all *.jar's in and build the classpath string dynamically
20:08technomancyChousuke: right, but that's the kind of problem a package manager is designed to avoid.
20:08Chousuketechnomancy: or you can make your software so that it sets it classpath properly.
20:08powr-tocthen you just manage whats in the directory
20:08Chousukeits*
20:08technomancyI can never be as timely in my releases as Ubuntu
20:08Chousuketechnomancy: so that it refers to the system-installed libraries
20:08Chousukeor you can count on the distributor to do it for you :D
20:09technomancybut the locations of those libraries will be different on every OS, so the distributor *has* to do it
20:09ChouserChousuke: but even setting the class path from inside your app is discouraged, which means if you want to do it right you've got to do it in shell script or something.
20:10Chousuketechnomancy: that's what ./configure solves for most apps... I wonder if there's some similar mechanism for java.
20:10Chousukelibs certainly aren't all in the same place accross all systems.
20:10Chousukeacross*
20:11powr-tocChousuke: there are systems for that kinda thing... maven etc... but they're not really worth the hassle unless you REALLY need them
20:11powr-tocand they're more for build time resolution
20:11Chousukewell, yeah
20:11ChousukeI guess it's as if java does "linking" at startup time I guess.
20:12powr-tocChousuke: that's exactly what it does
20:13ChousukeActually, it seems to me compiled apps don't have a real advantage. You still need to specify the lib paths correctly at compile time.
20:14Chousukecompile-time-linked apps*
20:15powr-tocChousuke: they can be relative though, and in java classes can be loaded in at runtime... and not necessarily from the filesystem... I'd imagine clojure makes use of this to provide compilation from the repl etc...
20:15Chousukehmm, yeah
20:15Chousukeevery function is compiled into its own class and loaded.
20:16Chousukein the end, the java system is much more complex, but also much more flexible :/
20:17powr-tocChousuke: there isn't really a notion of compile-time-linked (assuming you mean statically linked) in java... it's linked at runtime...
20:19Chousukethat's what I thought; earlier I meant "traditional" apps, like ones coded in C.
20:19powr-tocChousuke: yeah... I just re-read what you'd written... and got that sense :-)
20:37sohailwell it's official
20:37sohailvisual studio is stupid
20:39technomancy... and?
20:40quuxmanhi. I just downloaded clojure and I'm having a lot of trouble getting it to run with jline
20:40quuxmanit runs by itself just fine, but when I try to run it with jline.ConsoleRunner I get: ClassNotFoundException: clojure.lang.Repl
20:42Chousukehmm :/
20:42Chousukeruns without jline?
20:42quuxmanChousuke: yeah, with the exact same command classpath, or with none at all
20:42danlarkinquuxman: had somebody in here the other day with the same problem, I'll tell you the same thing I told him: try rlwrap, works for me :)
20:43ChousukeI don't use either
20:43ChousukeI just use SLIME :P
20:44quuxmandanlarkin: Thanks. Guess that'll have to do for now... no tab completion though.
20:44Chousukequuxman: there's info for that on the wiki
20:44quuxmanChousuke: with rlwrap? How does that work?
20:44Chousukewell readline can do tab completion
20:45quuxmanI'm just curious how it communicates with clojure
20:45Chousukeso you just need to generate a list of completions for it to use
20:45Chousukeit doesn't
20:45Chousukeit just blindly tabcompletes what you have in the completion file.
20:45quuxmanChousuke: oh, that's lame ;)
20:45Chousukeif you want something better, use emacs and SLIME :p
20:45quuxmanI'm a vim guy
20:46Chousukeyeah, so was I
20:46danlarkinrlwrap works with completions well enough for my REPLing, but I'm mostly in emacs/SLIME too
20:47Chousukeemacs is a good enough vi for me ;P
20:47Chousukehas a few glitches though, but works.
20:47ChousukeI use the editor in some half-vi half-emacs way nowadays
20:48quuxmanChousuke: I may actually check out viper and vimpulse.el when I have some time... or is it really easy to set up?
20:48Chousukequuxman: it wasn't that hard.
20:49Chousukeviper comes with emacs and vimpulse.el is just one file to download. and has instructions
20:49quuxmanChousuke: ok cool. Ack, I don't even have emacs installed :-P
20:50Chousukesometimes enabling other modes throws me out of viper mode, but you can always get back to it with M-x viper-mode
20:50cooldude127Chousuke: can't get much easier to setup than that lol
20:50ChouserChousuke: C-z often seems to do it
20:51Chousukequuxman: I dunno if it works for you, but I tolerated emacs just for SLIME. viper is a bonus.
20:51ChousukeChouser: manually running clojure-mode does it too :/
20:51Chousukeuntil I added a hook to run viper-mode whenever clojure-mode is run :P
20:52ChouserChousuke: sorry, I meant C-z often gets me back into viper mode if the new buffer kicked me out
20:52Chousukefor me that just minimises emacs.
20:52Chouserha! ok.
20:52ChousukeI suppose viper does that on level 3
20:52ChouserI'm on level 3
20:53Chousuke... hmm
20:54Chousukeoh, well. having to type the occasional M-x viper-mode is not too bad :P
20:55ChousukeIt's sad but emacs really beats vim to the ground in flexibility.
20:55Chouserit's ok. you can let your editor run you instead of the other way around.
20:56Chouserif it want's you to type M-x viper-mode every so often, you'd better just comply.
20:56Chouser:-)
20:56ChousukeI may figure out how to fix that some time.
20:56ChousukeI'm still an emacs newbie so I may be doing something wrong.
20:58quuxmanwhere would I find my site-lisp directory?
20:58quuxman(to put vimpulse.el)
20:59quuxmanah: /usr/share/emacs/site-lisp
20:59danleiquuxman: you can put it everywhere you want and (add-to-list 'load-path "/path/to/files")
20:59danlei +/
21:00ChousukeI'm going to get some sleep now though. Good night.
21:00quuxmanw00t... rectangular edit actually works with vimpulse. First vim clone I've used that actually bothers with such a crucial feature
21:00quuxmanthough the undu is fucked
21:01quuxmanredo does not do what I expect
21:01ChousukeI think there was something about redo in the instructions.
21:01ChouserI think you do use . to keep undoing further. u again to switch directions
21:01danleiit's more like in the original vi
21:01quuxmanChousuke: oh interesting
21:02quuxmaner, Chouser. Damn your nicks are too similar
21:02Chouseryeah, I know.
21:03Chousukewell, not as bad as drewr and drewc at least!
21:04quuxmanI'll laugh if I ever alias vim=emacs
21:04ChousukeI see drewr-` has grown a tail!
21:08quuxmanhow do I get rid of the menu at the top?
21:08quuxman(in emacs)
21:09quuxmanah: M-x menu-bar-mode
21:10quuxmannow it's just a question of how I get clojure running in emacs
21:10Chousukethe instructions in the wiki should work
21:10Chousukebut you'll need a more recent version of clojure
21:10Chousukepreferably SVN HEAD :p
21:11Chousukethe download version is quite ancient.
21:12Chousukeanyway, I'm off
21:21quuxmanwow, this is kind of like the best of both worlds... most vim commands work _and_ a lot of emacs commands
21:22quuxmanmost importantly M-x foo
21:22rzezeskidoes it really feel like Vim? I'm trying to relearn Emacs right now and it just doesn't feel right to my fingers
21:22clojurebotGoliath Online
21:22danleidon't be surprised. emacs is the lord
21:23quuxmanhow do I disable the annoying start message?
21:23danlei(setq inhibit-splash-screen t)
21:23quuxmandanlei: thanks :)
21:25danleibtw: i just let emacs run all the time. (emacsclient & (start-server))
21:27quuxmananybody have a cute little clojure program I can fool around with to get my feet wet? Preferrably a simple graphics program
21:27danleithere is one at the home page, under java interop, iirc
21:29danleiah, no under "hosted on the jvm"
21:29danleiand there is always the ant simulation
21:31quuxmanwhere do I find the ant simulation?
21:32danleia sec
21:33danleihttp://clojure.blip.tv/file/812787?filename=Richhickey-ClojureConcurrency252.flv and the program should be linked there
21:34danleitheres also a never version under files at the google group page, i guess
21:35danlei*newer
21:35quuxmancool, I just ran the little temperature converter program
21:36quuxmanworks fine aside from the god-awful fonts swing is using
21:36danleihm
21:36danleiyou're under linux?
21:36quuxmanubuntu
21:36quuxmanbut I'm not about to jump in to a mire of font configuration fun
21:36danlei(javax.swing.UIManager/setLookAndFeel "com.sun.java.swing.plaf.gtk.GTKLookAndFeel") maybe helps
21:43danleiclojurebot: help
21:46clojurebotclojurebot got moved to svn head, so now, of course, nothing works
21:48quuxmanwhat does this line do: (def frame (doto (new JFrame) (.add panel) .pack .show)) ; ?
21:49danleiyou mean the doto?
21:49Chouserit calls add, pack and show methods of the new JFrame
21:49Chouserthen stores that JFrame in frame
21:49quuxmanok. But the program never uses frame
21:49danleiwell
21:49danlei.show
21:49quuxmanoh I see
21:50quuxmanso it shows a window as a side affect and runs the rest of the program
21:51danleidoto just makes the object implicit in the method calls
21:51danleiwithout it,
21:51danleiyou'd have to evaluate (.show frame), for example
21:52quuxmanpresumably if you were just calling one method you could say: ((nej JFrame).add panel) ; ?
21:53quuxmanor does it not work like that
21:53danlei(.add (JFrame.) panel)
21:53danleibasically, yes
21:53danlei(.add (new JFrame) panel)
21:53quuxmanhow is .add in scope? What if another object had an add method
21:53danleiwell, jframe is an argument to .add, so its clear
21:54quuxmancrazy
21:54danleifoo.bar -> (.bar foo)
21:54danlarkin.method is reader syntax
21:54danlarkinhttp://clojure.org/java_interop
22:14hiredman(doc defmethod)
22:14clojurebotCreates and installs a new method of multimethod associated with dispatch-value.
22:14arohneroh that's cool
22:14hiredmanclojurebot: botsnack
22:14clojurebotbotsnack is delicious. (nom nom nom)
22:14danlei(+ 1 2)
22:14hiredmanheh
22:14danlei:)
22:14hiredmanjust doc string lookups
22:15hiredmanfrom clojure.core
22:15danlei(doc conj)
22:15clojurebotconj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type.
22:15danleinice
22:15danleithe format is a little messed up, though
22:16danleiclojurebot: botsnack
22:16clojurebotbotsnack is delicious. (nom nom nom)
22:16hiredmanyeah, well, yes
22:16danleiis the source online?
22:16hiredmanuh
22:16hiredmansort of
22:16hiredmanI was just going to get around to that in a better way
22:17danleisure
22:19hiredmanhttp://gist.github.com/27733
22:20danleihiredman: thanks
22:21hiredmannp
22:21danlarkin(doc test
22:21clojurebotI don't understand.
22:21danlarkin(doc coll?
22:21clojurebotI don't understand.
22:21danlarkintouch�, clojurebot
22:22hiredman(doc coll?)
22:22clojurebotReturns true if x implements IPersistentCollection
22:23danlarkinI wanted to see if it'd respond to a (doc without a closing paren
22:26danlarkinclojurebot: svn
22:26clojurebotsvn co https://clojure.svn.sourceforge.net/svnroot/clojure clojure
22:27rzezeskiclojurebot: a/s/l?
22:27clojurebotExcuse me?
22:27rzezeski:)
22:27danleiclojurebot: lisp?
22:27clojurebotI don't understand.
22:27danleiclojurebot: lisp is great
22:27clojurebotRoger.
22:27danleiclojurebot: lisp?
22:27clojurebotlisp is great
22:28danleiclojurebot: botsnack
22:28clojurebotbotsnack is delicious. (nom nom nom)
22:29danlarkinclojurebot: clojurebot is wacky!
22:29clojurebotYou don't have to tell me twice.
22:29danlarkinclojurebot: clojurebot
22:29clojurebotclojurebot is wacky!
22:51hiredmanugh
22:54quuxmancan clojurebot run clojure?
22:54quuxman> (+ 1 2)
22:57hiredmannot at this point
22:57hiredmanI am leary of allowing other people to run code on my computer
22:58hiredmanin the future it may run some subset
23:04Chouserhiredman: wise. But java does have sandbox features that might be useful.
23:09rzezeskisomeone help a git n00b please...I want to checkout (clone?) swank-clojure...I tried "git clone http://github.com/jochu/swank-clojure&quot; but that said something about update-server-info...
23:11danleigit clone git://github.com/jochu/swank-clojure.git
23:12danleiworks for me
23:12rzezeskithat seemed to do the trick, thx
23:16danleiis _ inside a lambda list something special, or is it "just" used by convention?
23:16Chouserconvention
23:17danleithanks
23:32hiredmanclojurebot: where are you is <reply> http://gist.github.com/27733
23:32clojurebotYou don't have to tell me twice.
23:33hiredmanclojurebot: where are you?
23:33clojurebot http://gist.github.com/27733
23:36spaceman_stuthanks for pasting the code for the bot hiredman. Interesting to look over
23:39hiredmanI think I got an automated dingo that will update that page from my personal bzr repo
23:39Chouseranyone have an idea for converting hex stored in a string to an int?
23:40danlarkinhiredman: what's the purpose of the <reply> part?
23:40danlarkinChouser: java doesn't have anything built in to do that?
23:40Chouserbeats me, that's why I'm asking.
23:41hiredmanclojurebot: clojurebot?
23:41clojurebotclojurebot is wacky!
23:41hiredmanwithout the reply
23:41hiredmanwith the <reply>
23:41arbscht(Integer/parseInt "A" 16)
23:41hiredmanclojurebot: where are you?
23:41clojurebot http://gist.github.com/27733
23:42Chouserarbscht: fantastic, thanks
23:42hiredman<reply> lest you specify a response without it having to be in the format "A is B"
23:43arbschtlike that?
23:43danlarkinah ha, I see
23:56arohneris it possible to create a macro that emits a call to binding?
23:57arohnerevery time I try, the symbols are evaluated
23:57arohnerand emitting (binding [(quote foo) (bar)]) doesn't work