#clojure logs

2008-12-06

01:20drewolsonwhich is more idiomatic: (into [1 2 3] [4 5 6]) or (vec (concat [1 2 3] [4 5 6]))
01:22drewolsondon't think this sent before, but sorry if it's a repeat question. which is more idiomatic:
01:22drewolson(vec (concat [1 2 3] [4 5 6])) or (into [1 2 3] [4 5 6])
10:14kib2hi, anyone knows how to save a uft-8 text file with contrib.duck-streams ?
10:19emacsenif ORM is not the right way to handle databases, what is?
10:25kib2new SLIME slides : http://common-lisp.net/%7Etrittweiler/slime-talk-2008.pdf
10:26dhayaemacsen: http://groups.google.com/group/clojure/msg/79022b44684a9b38
10:27emacsenthat doesn't answer my question- only affirms my initial statement
10:32dhaya"having very few data structures and very many general functions to manipulate".. i thought that answers your question. sorry if did not :)
10:41Chouseremacsen: I think what I want is a DSL for building queries that are returned as seqs of hash-maps.
10:41emacsenChouser, yeah...
10:45Chouserno?
10:59duck1123 do I have to do anything special to compile my namespace?
11:00duck1123I'm getting a "Could not initialize class ..." error
11:01StartsWithKduck1123: can you provide full paste of error?
11:03lisppaste8duck1123 pasted "First attempt at compiling a ns" at http://paste.lisp.org/display/71696
11:04duck1123I'm not trying to generate classes yet, I'm just trying to compile
11:04duck1123or can I only compile if I'm using gen-class
11:05duck1123I have a "classes/" folder on the classpath, and this namespace is properly loaded
11:09Chouserduck1123: you don't need :gen-class
11:09duck1123actually, now that I've reloaded my repl, I'm getting a different error, so that's probably the cause of my problem
11:10duck1123I'm now getting an j.l.ExceptionInInitializerError need to find out why
11:13duck1123hmm... that must've been because it created a few class files, but not all of them. I removed the class files and it went away
11:13Chouserduck1123: If it helps diagnosis, I think that without :gen-clss you will not get a Java class named the same as your namespace.
11:17duck1123ok, When I try to do this in a straight repl, it works fine. It's just my repl-via-slime that's acting funky
11:18duck1123I moved a bunch of stuff around. (trying to get compojure to work with Tomcat) so that may be the problem.
11:19StartsWithKany old gen-class functions like gen and load?
11:19StartsWithKevals in macros?
11:19StartsWithKthat made trouble for me with compiler
11:21duck1123I haven't gotten into any of that. This has been my first foray into compilation or class generation
11:21duck1123I wanted to get standard compilation down before I tried using gen-class
11:50mattreplhrmm, how does declare a method has a return type of void using gen-class' :methods?
11:51mattreplah, the class type looks like it works. i.e., Void, not Void/TYPE
11:52ChouserI think 'void' should work. lowercase.
11:58mattreplyup, it does
12:25mattreplhow about referencing the super, for example to get at the superclass' implementation of a method
12:38Chousermattrepl: you need to call a super's method that has exactly the same signature as one you've overridden?
12:39gnuvince_Good morning
12:39gnuvince_(or afternoon I guess...)
12:39mattreplChouser: yeah, (. this SuperClass/foo arg) seems to work
12:40Chouserreally!? good to know.
12:40mattreplfinishing testing, but it does something at least. =)
12:41gnuvince_Chouser: I don't know if you caught this message yesterday: map depends on every? for when you supply more than three collections, so using map inside every? to allow for an arbitrary number of args would probably not work
12:42Chousergnuvince_: I saw that, thanks.
12:42gnuvince_OK
12:43Chouserbut it only uses the single-collection form of 'every?', which wouldn't need to call 'map' so it actually might work ok.
12:44gnuvince_You would need to (declare map) before every however.
12:44gnuvince_Else the compiler won't let it pass.
12:44Chousertrue
12:45gnuvince_What's the policy for submitting patches to contrib?
12:45Chouseryou need to have a CA submitted.
12:45gnuvince_CA?
12:46ChouserContributor Agreement: http://clojure.org/contributing
12:46ChouserThen you can post patches to the Google Group and whoever maintains the code you're patching can work with you to get it in.
12:47ChouserI think you could also petition rhickey for commit privs at that point, but I don't know of a formal process for that.
12:47dudleyfclojurebot: CA?
12:47clojurebotCA is Contributor Agreement: http://clojure.org/contributing
13:03mattreplChouser: scratch that, looks like it just recurses instead of calling super
13:04mattreplI really didn't want to dig into bytecode today...
13:18thearthurI need an output queue, whats the best clojure structure for this?
13:18thearthuri will be adding data to it in small chunks and pulling it out in big chunks
13:19thearthurwould a vector work for this?
13:19thearthurcan you efficiently add to both ends of it and take subvectors?
13:25Chouserthearthur: do you want blocking on an empty queue?
13:26Chouserif so, you'll need something from java.util.concurrent, a BlockingQueue of some sort.
13:26ChouserIf not, you may like clojure.lang.PersistentQueue
13:27Chouservectors only grow or shrink efficiently on the right-hand end.
13:27thearthurChouser, a blocking queue would be nice
13:27thearthurbut i think I cna do with out it using agents
13:28Chouserok. Currently Clojure doesn't wrap or provide any thread-blocking tools, but using the Java classes directly is pretty convenient.
13:28thearthuris persistentqueue on clojure.org?
13:29Chouserno, it's below the radar.
13:30ChouserRich didn't want people using it and doing busy polling or anything I guess.
13:30Chouserclojure.lang.PersistentQueue/EMPTY is an empty one
13:31larrytheliquidhm, i updated to clojure trunk yesterday and now im getting back nil for metadata on symbols (though collections work fine), anyone else experiencing this?
13:31Chouserthen you can conj onto one end, and use peek/pop to consume on the other
13:32Chouserlarrytheliquid: like (doc map) doesn't work?
13:32larrytheliquid(doc map) works, but ^clojure.core/map and ^map do not
13:32clojurebotNo entiendo
13:33larrytheliquidnor does (meta clojure.core/map) or (meta map)
13:33Chouserlarrytheliquid: functions have never had metadata
13:34Chouser^#'map gives you all the metadata on the var
13:34larrytheliquidahh right, quoting to get the symbol instead of the function, my mistake
13:35larrytheliquiderr var
13:35larrytheliquidChouser: thx
13:39Chousernp
13:51duck1123is it generally to use gen-class to actually create the class, or just proxy it?
13:52duck1123I'm getting the feeling that Compojure won't work under Tomcat without extensive re-write
14:02RSchulzDon't overlook (proxy ...)
14:02RSchulzWhat is it about Tomcat that seems problematic?
14:02RSchulzAnd is it not true of other servlet container?
14:03duck1123can a proxied class be read by java outside clojure?
14:04Lau_of_DKGood evening gents
14:05RSchulzIt doesn't produce a .class file, if that's what you mean.
14:06RSchulzHowdy, Lau. How're things with the Danes?
14:07AWizzArdHi Lau
14:07Chousukeduck1123: The actual proxy class is anonymous, but you should be able to pass the instance to java using a reference typed as teh implemented class or interface.
14:08duck1123Compojure currently initializes the servlet container and proxies up a servlet for use. If I want to run a webapp with an external container (tomcat) I'm thinking I'm going to need to use gen-class to actually get the .class file
14:08danlucraftwhy is (first []) nil but (first '()) an exception?
14:08RSchulzduck1123: That's probably true. The servlet container parts are obviously handled by Tomcat itself.
14:08RSchulzPerhaps if you know enough about how it works inside, you could get it use existing (in-core) classes instead of .class files.
14:09Chousukedanlucraft: it isn't?
14:09Chousukedanlucraft: works just fine
14:09Chousukedanlucraft: are you using the release version?
14:09RSchulzBut I don't think there's a portable way to do that, and you'd be stuck with Tomcat or have to replicate that work for ever servlet container you wanted to support.
14:09duck1123ok, that's what I was thinking. Compojure is compact and elegant, and completely unsuited to what I need.
14:09danlucraftChousuke: no, svn.
14:10RSchulzI don't get an exception from (first '())
14:10Chousuke:/
14:10Chousukeanyway user=> (first '()) -> nil
14:10danlucraftnot lying :) http://pastie.org/332764
14:11danlucrafthmmm, old revision. let me pull
14:12RSchulzduck1123: What is your need / use case?
14:12danlucraftOK works now. I pulled the revision recommended in the new PragProg book, which was from nov sometime.
14:13Chousukethe git clone for clojure is falling behind :/
14:13duck1123RSchulz: just to have a servlet environment that I can compile into a war
14:13RSchulzWhat's the Clojure aspect, then?
14:13RSchulzI guess AOT is the answer, right?
14:14RSchulzAOT compilation, that is.
14:14duck1123RSchulz: well, I have an app that I'm writing in clojure. I was yusing compojure, but I want/need to run it on tomcat, but I think I need to change some things first
14:15duck1123That's what I am thinking. Hopefully I can re-use some of these libraries though
14:16RSchulzI'd start with the simples thing, which is AOT compilation. I'm not sure how you get a static class that implements the appropriate Servlet type, but I'm sure it's possible and practical.
14:17danlucraftChousuke, RSchulz: thanks for your help.
14:22holmakThere is a length function for vectors _somewhere_, right? I can't find it anywhere.
14:22duck1123(doc count)
14:22clojurebotReturns the number of items in the collection. (count nil) returns 0. Also works on strings, arrays, and Java Collections and Maps; arglists ([coll])
14:22holmakAha, I tried length and size. Thanks.
14:23RSchulzholmak: Always keep (find-doc) in mind. It does RE pattern matching against documentation strings, so with a bit of guessing, you can usually find what you're looking for, assuming it exists...
14:24holmakI tried searching through the online API section for "length" and "size", but the doc string sneakily avoids using those words.
14:25holmakNot to say that its inaccurate, I just didn't think of the right word to search for.
14:25RSchulzYeah, it's hardly foolproof, but still very useful.
14:25mon_keyneed used-fors
14:26RSchulzEh?
14:26mon_keystandard librarian technique
14:26duck1123I've run into the same thing with distinct vs. uniq and rem vs mod
14:26mon_key'length' - use 'count'
14:26RSchulzYeah. Actually, it's still an open problem how to really, truly deeply facilitate software reuse.
14:26mon_key'count' - used-for 'length'
14:27mon_keysee iso z39.50
14:27duck1123clj-doc is also pretty handy for looking up functions
14:27mattreplanyone see a reason why genclass methods should not support "super" as a keyword like Java?
14:29RSchulzWhat super keyword is that? gen-class supports :extends and :implements.
14:30RSchulzYou mean to invoke superclass methods?
14:30mattreplif in an implementation you need to refer to the superclass' implementation
14:30mattreplyeah, invokespecial
14:30RSchulzThere's something for that w.r.t. calling superclass constructors.
14:31RSchulzI think elsewhere you have to know the specific superclass you extended and refer to that class/method specifically.
14:33mattreplI tried that, but it was calling the subclass' implementation still.
14:34RSchulzInteresting. That could be a bug. You might want to send message with an example to the mailing list / group.
14:34RSchulzOr, if not a bug, an oversight in the design.
14:35mattreplweird.. I'm looking at bytecode from the Clojure compiler and it is using invokespecial... must be operator error, gonna go over my code again, something is causing it to recurse
14:37duck1123is there an easy tool for examining compiled .class files?
14:38RSchulzAll I know of is javap...
14:38RSchulzI don't do that sort of thing much, obviously.
14:38RSchulzThere's JAD, right?
14:38duck1123I think I remember Eclipse doing that, but I don't have it set up anymore
14:40RSchulz$100 shareware: http://www.freedownloadscenter.com/Programming/Java/ClassSpy.html
14:41RSchulzIt better fix your code for you, for that price!
14:42RSchulzHere's a list of such tools: http://schmidt.devlib.org/java/class-file-optimizers.html
14:44mattreplRSchulz: the syntax you believe should work is (. this a.b.SuperClass/foo arg)?
14:44RSchulzDo I believe that? I never knew I believed that!
14:44RSchulzIt looks plausible, anyway.
14:45mattreplhehe, perhaps wrong word choice, was referring to your comment 10 min ago or so. didn't know if you had tried it before and it worked
14:46RSchulzNo, I'm just thinking out load... On the keyboard.
14:46duck1123RSchulz: I think JAD did what I need
14:47RSchulzCool. Is that where you saw the invokespecial (an opcode I've seen, but don't understand. Don't understand _either_.)
14:48RSchulzduck1123: What OS do you use?
14:48duck1123Debian
14:49Lau_of_DKHi RSchulz - All is well in the empire of Denmark
14:49RSchulzEmpire?? I thought you folks had moved on from your imperial era!
14:50Lau_of_DKNei - We shall in no way depart from our dominion of the peasants
14:50RSchulzduck1123: So far I've one one Mac-specific and one Windows-specific JAR file inspector.
14:50RSchulzOK, then Lau. I'll be sure to behave especially obsequiously toward you!
14:51duck1123RSchulz: I'm installing Netbeans to see if that'll do the trick
14:51RSchulzduck1123: There does appear to be an Eclipse plug-in. I hate Eclipse, though. I use IDEA and I suspect it has a suitable tool, but I'm not specifically aware of it.
14:51Lau_of_DKRSchulz: much appreciated
14:51RSchulzWhile you're at it with NetBeans, keep an eye out for the next release of Enclojure (expected within a week). The current one has some problems and isn't recommended.
14:52duck1123I used to be a big fan of Eclipse because it integrated nicely with Oxygen
14:52duck1123but now I'm strictly an emacs guy
14:53RSchulzI use <oXygen/>, though not much recently. I didn't know it had specific Eclipse tie-ins.
14:53RSchulzWell, Emacs is commendable, but I know Vi / Vim too well to change.
14:53duck1123and I have a feeling that I'm probably the only one here that actually likes xml
14:53duck1123XSLT was my first lisp
14:54RSchulzI (and I think many) have mixed feelings about XML. It's ugly as hell and a bit hard to work with, but too useful and ubiquitous to ignore.
14:54mon_key:) like lisp
14:54RSchulzLisp: The only language you'll ever need.
14:54Lau_of_DKRSchulz: I think only Assembler can bear that title truthfully
14:55duck1123I wrote my entire application in a mix of XML, XHTML, XPL, XSLT, XQuery, and XForms
14:55RSchulzOK. I won't argue with that, but then ... what are you doing here??
14:55RSchulzduck1123: So... You're a masochist?
14:55Lau_of_DKRSchulz: Just trying to bring you guys up to speed, you can thank me at the after party
14:56RSchulzThat would be the party after Denmark invades North & South America, East & South Asia, Africa and the rest of Europe??
14:57julian_morrisonHi all, made a start on my first Clojure wrapper lib http://github.com/JulianMorrison/neo4j-clojure/tree/master
14:58RSchulzAh, Neo. Everything old is new again...
14:58julian_morrisonheh
14:58RSchulzjulian_morrison: The close paren snuck into the URL for the Neo4J link on your github page.
14:59julian_morrisongah
14:59julian_morrisonI'll fix that next upload.
15:00Chouserproxy does create a .class file, if you compile, but not one with a name you should rely on.
15:00duck1123Chouser: I need to specify the class name in my web.xml file, so that won't work
15:01Chouserright, :gen-class is what you'll need then
15:01rhickeyChouser: there is now proxy-name, undocumented as yet, but probably will be
15:01RSchulzChouser, duck1123: You guys might want to petition Rich for a change that would make proxy useful in this sort of situation.
15:01RSchulzI think he'd probably be amenable to something like that.
15:02duck1123RSchulz: It's going to be a pain to get this working, but I think I'll be better off with gen-class in the long run
15:02julian_morrisonI know one change I'd petition for: make seq a multimethod
15:03julian_morrisonthe language is positively littered with (xyzzy-seq)
15:04RSchulzrhickey: What is the baseline overhead associated with multimethod dispatch?
15:04julian_morrisonor failing that, define a multimethod to-seq and call it as a last-chance fallback
15:05duck1123can you add new methods to a multimethod from outside the namespace?
15:05mattreplrhickey: is there currently a way to invoke a superclass' instance method from a subclass in a genclass method? the equivalent to "super.inheritedMethod()" in Java
15:05Chouserduck1123: yes
15:05duck1123ok
15:05RSchulzduck1123: I think namespaces and multimethod dispatch are orthogonal, so the answer should be "yes"
15:06rhickeyjulian_morrison: many of those seqs are on stateful things, so the explicit seq step is important to avoid aliasing, e.g. iterator-seq - things like iterators can't be considered implicitly seq-able as two independent seqs on the same iterator is a mistake
15:07julian_morrisonrhickey, I'm not against explicit (seq (xyzzy))
15:07julian_morrisonrhickey, I'm against ten thousand bitty little (xyzzy-seq (xyzzy))
15:08rhickeyof the 9 I find from (find-doc "-seq"), 7 are that way
15:09julian_morrisonor at least a single multimethod (seq-once-only (xyzzy))
15:09rhickeyjulian_morrison: the point is, seq is explicitly called, often more than once, for these things that's not safe
15:10rhickeymaybe seq-on-mutable
15:11stuarthallowayrhickey: I need a name for the .. operator, so I have something to call it in the book. I like "threaded member access", what do you think?
15:11julian_morrisonthere is already (cache-seq)
15:11rhickeybut I'm not spending time there as I think the right thing for those things is left-fold-enumerating
15:12RSchulzrhickey: But those considerations, while valid, are independent on the desire to have an "open" (seq ...) that programmers can extend, assuming they understand when it is and is not appropriate to do so.
15:12Chouserstuarthalloway: you've just going ignore all my advice to drop the .. operator?
15:12rhickeystuarthalloway: OK
15:12Chouser;-)
15:12stuarthallowayChouser: glad to have this conversation with Rich here to guard my back! :-)
15:13rhickeyChouser: he is, on my advice :)
15:13Chouserok, so how is .. better than -> ?
15:13julian_morrison.. is bad?
15:13rhickey.. is easy to explain to Java programmers - just stitch the calls together with dots
15:13stuarthallowayand it is more specific
15:13Chouser(-> foo .bar .baz) looks awefully pretty to me.
15:14julian_morrisonI propose a name "put-dots-between" operator
15:14Chouserto mean the same as foo.bar.baz()
15:14rhickeyChouser: that's fine - you are no longer a beginner
15:14stuarthallowayso just as you might sometimes use a vector specific function to say "I have a vector" instead of "I have a seq", you might use .. to say "I have some Java" instead of just "I have some Clojure"
15:15stuarthalloway...which I believe is still valid (but not required!) even for non-beginners
15:15stuarthallowaylet the archives show that Chouser wants to scare beginners :-)
15:15Chouserbut you put a dot before every single method call, fairly screaming "this is java".
15:16duck1123I think I've only actually used -> once
15:16julian_morrison-> makes it easier for a haskelly person to understand
15:16rhickeyRSchulz: there is an open type-based seq - it's called IPersistentCollection
15:16stuarthallowayChouser: no, could say (-> foo (.java) (.moreJava) (.moreJava) (hahClojure))
15:17stuarthallowayI am certainly not questioning a coding standard of "always ->", just saying it might not be for everybody
15:18rhickeyImagine being in front of a room full of Java programmers - .. is much simpler to explain than ->
15:18duck1123when using gen-class, I have to remove the class files before I can call compile again, right?
15:18mon_keyI'm out of my element but... what about `>.'
15:18RSchulzrhickey: I see. So duck1123 could proxy that? Possibly with a function or macro to syntactically sugar any patterned cases he has?
15:18ChouserThat's exactly why -> is better -- it doesn't get you stuck in a java hole.
15:18rhickeyRSchulz: I missed that part of the conversation
15:19RSchulzThe original request was for (seq ...) as a multimethod. I assumed that was so it would be open.
15:19ChouserBut having made my case, I'm certainly not going to try to stand against both you guys! :-)
15:19aperotteThere might be something that I'm missing, but I can't get the basic :gen-class example to compile
15:19RSchulzAnd now Chouser must clean up the shards...
15:21aperotteI get a java.io.IOException :(
15:21RSchulzWhat is the "pronunciation" of ->?
15:22duck1123"that way"
15:22RSchulzAny other suggestions??
15:22julian_morrisonjust checking my understanding of (require) is right... if I (require 'abc') and there is on a classpath a dir "abc" containing file "abc.clj" which begins (ns abc ... then this will all work?
15:23julian_morrisonRSchulz: "chain"
15:23duck1123julian_morrison: it should be (require 'abc)
15:23julian_morrisonduck1123: you're right, that was a typo
15:23RSchulzSomehow the description of -> in the documentation does not convey to me what it does. It wasn't until I saw the use in the Zipper code that I realized what it did.
15:24duck1123also, post AOT, it'll just look for a file abc.clj the name isn't doubled anymore
15:24julian_morrisonRSchulz: (-> a b c d) is (d (c (b a))) right?
15:24duck1123'foo.bar.abc becomes foo/bar/abc.clj
15:24RSchulzI think so. But it may be more general than that. I'm really not the person to be asking!
15:24julian_morrisonduck1123: post AOT?
15:25duck1123there were some breaking changes a while back
15:25duck1123mostly, you just have to move your files
15:25mon_key.. can also be harder to build regexes for when refactoring in some IDEs
15:25julian_morrisonsomeone needs to update (doc require)
15:26mon_keye.g. \\(\(\.\.\)
15:26RSchulzmon_key: What are you thinking about? I don't think refactoring can usually be specified in terms of REs. Regular Tree Expressions, maybe, but not conventional sequential REs.
15:28mon_keyelsip to sub in/out a change with replace-regexp
15:29mon_keyyou windup having to escape the hell out of the `path' just to catch the .'s
15:29Chouserjulian_morrison: you're right, that's exactly what -> does.
15:29RSchulzWell, like I said, REs are not a good tool for source code (or syntax tree) manipulation.
15:30aperotteCan someone tell me if my approach is correct? I copied the code for the :gen-class example into a hello.clj file and put it in "one of the cp folders"/clojure/examples/hello.clj then opened a repl and typed (compile 'clojure.examples.hello).
15:30mon_keyyou're prob. right
15:30RSchulzChouser: You know, -> is really elegant, but its doc string just does not do it justice. If you didn't know what it did, you'd just never think it would be something you'd want to use.
15:30duck1123I had a hell of a time refactoring this morning. I was using really short namespaces, so I had a bunch of fully qualified calls all over the place
15:31RSchulzduck1123, mon_key: You guys should pass on your experiences to Peter Wolf (he's on the list). He's writing an IDEA plug-in for Clojure, and I think he wants to support refactoring (which is a classic strength of IDEA).
15:31RSchulzHe should know what kind of use cases to address and what priority to assign, and real-world experience would help him with that, I think.
15:32aperotteI get a IOException saying "No such file or directory (hello.clj:1)
15:32duck1123is your classes folder on the clsspath
15:32julian_morrisonduck1123: the moral is - pick what you need and then "use" it. Redundancy is effort waiting to happen.
15:33duck1123I *just* got hit with that
15:34aperottehmm ... classes folder is not on the classpath
15:34RSchulzStu's books includes the recommendation "Don't just require, Use!". But there are times that doesn't work.
15:35RSchulz(use 'clojure.zip) will fail 'cause it redefines two core functions.
15:35duck1123aperotte: if you're putting your classes folder somewhere else, do: (set! *compile-path* "WEB-INF/classes") or similar
15:35RSchulzThe cover script I wrote for invoking Clojure from the CLI includes a +cp=classpath-addition option, which may be repeated, of course.
15:35aperotteduck1123: ok, I'll give it a try, thanks
15:35RSchulzOf course, that's no good for dynamic situations or non-CLI situations.
15:36duck1123I don't like using use too much because I have a lot of functions named the same with similar paths
15:37RSchulzWell, I guess that's unavoidable. It's one of the virtues of class-centered programming...
15:37ChouserRSchulz: I dislike the unqualified use of 'use'. 'use' with :only or :as is ok, but otherwise I really recommend 'require', perhaps with :as
15:37duck1123I've been doing things like: (:require net.mycyclopedia.model [view :as model-view]). previously, it was just model.view/foo
15:37RSchulzI can't disagree with that. Mostly 'cause I don't have enough experience with the down-sides of unrestricted (use ...).
15:38ChouserOf course we've already seen what respect my advice is getting today. :-D
15:38RSchulzOh, now, you win some, you lose some.
15:39rhickeynamespace separator is / specifically so alias/name is easy
15:39duck1123can you alias a whole section of a namespace, or can it only be the last segment?
15:39rhickeye.g. require :as is good
15:39RSchulzYes. Aliasing is very nice. I miss not being able to assign type name aliases in Java. The more so since generics were introduced.
15:40duck1123I want to alias net.mycyclopedia.model to just model, so I can go back to model.view/foo
15:41Chouserduck1123: your alias can have dots in it
15:42Chouser(alias 'model.view 'net.mycyclopedia.model.view)
15:43mon_keylol just caught a funny "Imagine being in front of a room full of Java programmers - .. is much simpler to explain than ->" Not unlike explaining to a room full of lispers just cons it
15:43mon_key:)
15:44duck1123but I would have to alias every thing. I have things like model.user model.entry model.statements view.user, etc. right?
15:44RSchulzThere's a Weird Rick Hickovic parody there: "Just Cons It!"
15:44Chouseryes. could write a macro to do it for you.
15:45duck1123hmm... not a bad idea... see not *all* of your ideas are being ignored today :)
15:47duck1123rhickey: I never got an answer from you the other day. Do you need the CA's mailed to you, or can I scan it and email?
15:48rhickeyduck1123: please mail
15:50rhickeyChouser: do you have test case handy for reduction seq consumption?
15:50lisppaste8Chouser pasted "reduction tests" at http://paste.lisp.org/display/71709
15:51rhickeyChouser: thanks
15:57stuarthallowayChouser, RSchulz: I got pulled away for a few, but (contrary to my own book) I agree with Chouser about require and use
15:58stuarthallowaythe advice about "just use" is appropriate for getting started
15:59stuarthallowayand later in the book I need to make a different recommendation
16:00stuarthallowayin the next beta, all the book examples that refer to contrib will do use/only
16:21aperotteduck1123: I put the classes folder on my classpath and still no luck with the compilation
16:25duck1123aperotte: what's it saying now
16:25aperotteduck1123: same, java.io.IOException: No such file or directory (hello.clj:1)
16:26duck1123aperotte: did it actually create the class files?
16:26RSchulzWhere's the current / latest definition of (reduction ...)?
16:26duck1123and can you require that ns?
16:28aperotteduck1123: it didn't create the class files (ie I didn't find them anywhere on my classpath or in the classes folder)
16:28aperotteduck1123: do I need to put my clojure/examples/hello.clj in the classes folder?
16:28duck1123aperotte: it needs to be on the classpath
16:29mon_keyaperotte: what OS are you using?
16:29duck1123is the namespace 'clojure.examples.hello
16:29aperottemon_key: ubuntu hardy
16:30aperotteduck1123: yup, I copied straight from the website
16:31duck1123aperotte: and you are able to (require 'clojure.examples.hello)
16:32aperotteduck1123: yes, that worked fine
16:32ChouserRSchulz: Here's my latest valid version of 'reduction' http://groups.google.com/group/clojure/msg/1c98053f10ea3e55
16:32ChouserDunno if that's what rhickey's going to use or not.
16:33Chousers/that's/either of those are/
16:33RSchulzThanks.
16:34aperotteduck1123: the odd thing is that if I intentionally put an error in the hello.clj file, the call to compile catches it, but with the correct code it throws an IOException
16:35mon_keypermissions?
16:36duck1123aperotte: I'm not sure then
16:36aperottemon_key: I don't think so, everything's in my home directory
16:36mon_keyaperotte: no maybe cuz ubnt sudo?
16:37aperottemon_key: I'm not sure I understand what you mean
16:37AWizzArd(defn pipe [& functions] (apply comp (reverse functions)))
16:38aperotteduck1123: :( thanks for the help
16:38mon_keythe class has to get written right? Does the process compiling have permissions to write to the dir on your path? Ubnt can be tricky that way... Just a thought.
16:40aperottemon_key: oh ok, yeah, it should have permissions. All of the classpath folders and the clojure folder are in my home directory and shouldn't need sudo to write
16:41AWizzArdpartner of (rem ..) is?
16:42Chousukequot?
16:42mon_keystimpy
16:42AWizzArdChousuke: thx
16:42Chousukemon_key: no, stinpy.
16:42mon_keysee...
16:45lisppaste8rhickey annotated #71709 with "recursive reduction with delay" at http://paste.lisp.org/display/71709#1
16:48lisppaste8rhickey annotated #71709 with "reduction" at http://paste.lisp.org/display/71709#2
16:51rhickeyChouser: that works, yes?
16:53mon_keyaperotte: are you using the OpenJDK?
16:53Chouserah, interesting. I was aware of delay, but it's not really in my toolbox yet.
16:55mon_keyaperotte: reason i ask is I was having similar probs. on SUSE until switching over to Sun...
16:55aperottemon_key: nope, I'm using sun's jdk
16:55aperottemon_key: jdk 6 update 11
16:56mmcgrananamespaces can't :use each other, right?
16:57duck1123is there an easy way to compile every source file on my classpath, or do I have to do them one by one?
16:58mon_key:) Good luck with that then... have you inspected (System/getProperties) checked for trailing /'s in the classpath? Made sure your colon's are semis?
16:58mon_keyaperotte: sorry should say colon's *areN'T* semis?
16:59Chouserrhickey: looks good to me.
16:59aperottemon_key: I didn't know about (System/getProperties) let me take a look
17:00Chouserduck1123: if you compile x and x requires y, y will also be compiled.
17:00mon_keyaperotte: hehehe Got that From Stu Halloway's beta .pdf - helping me alot
17:01Chouseraperotte: has anyone asked you to paste the whole stack trace?
17:02aperotteChouser: nope, but the only thing that prints after I call compile is java.io.IOException: No such file or directory (hello.clj:1)
17:02aperottemon_key: where can I get that pdf?
17:02Chouseraperotte: (.printStackTrace *e) and paste the results, if you don't mind.
17:03duck1123Chouser: Are you sure about that? I compiled a ns, and only that ns got compiled
17:03Chouserit certainly used to be true. let me check again.
17:03duck1123unless that's something's changed since I last built
17:05aperotteChouser: http://paste.lisp.org/display/71712
17:05Chouserduck1123: it compiled a :require'd lib for me just now.
17:05mon_keyaperotte: give the man $20 buck he deserves it: http://www.pragprog.com/titles/shcloj/programming-clojure
17:05aperottemon_key: ohh, you're talking about the book. I've been meaning to get that
17:06Chouserduck1123: compile used to return a set of the namespaces compiled. It doesn't seem to do that now, but it still compiled my dependencies.
17:08Chouseraperotte: did you say you were copying some example?
17:09aperotteChouser: yes the example from the new compilation webpage on the clojure site, it's the first thing under "gen-class Examples"
17:10Chouserthat stack trace looks to me like it's finding your hello.clj, but then failing during the 'ns' call.
17:11aperottethe only thing I have on line 1 is (ns clojure.examples.hello (:gen-class))
17:11Chouserah, createNewFile -- double check your directory names, esp. for *classes*
17:13Lau_of_DKCan somebody bring me up to speed on TCO? In saying 'jvm does not do TCO' what is the implications?
17:14AWizzArdLau: recursive function calls
17:15ChouserIf Clojure had TCO, ((fn foo [] (foo))) would be an infinite loop. Instead it overflows the heap.
17:15duck1123Chouser: I must have an old version. I get the set of namespaces
17:15AWizzArdLau_of_DK: the problems come when several functions call each other recursively.
17:16duck1123mine's from 11/26
17:16Chouser4 versions on that date.
17:16Lau_of_DKOk, thanks AWizzArd and Chouser
17:16aperotteChouser: the classes directory I should be pointing to in the classpath is clojure/target/classes no?
17:17Chouser18 versions since that day.
17:19Chouseraperotte: *compile-path* defaults to "classes", which means ./classes/
17:20Chouseraperotte: so unless you've changed that value, you should make sure you have a writable subdirectory named "classes" in your current working directory when you start clojure.
17:20RSchulzThe gist of a "tail call" is one in which none of the local state (local variables) of the function need to be used again. That means the code can just jump back to the beginning of the function and reuse the current stack frame. In a generically recursive call, a new stack frame is required.
17:20aperotteChouser: ahh, ok let me try again
17:20Chouseralso make sure you have "./classes" in your classpath.
17:20RSchulzTail-call optimization means detecting (or being told) the tail-call status of a recursive invocation and skipping the new stack frame creation.
17:21RSchulzJava does not accommodate this (as Lisps often do), so it's up to the language and / or the programmer to bridge the gap.
17:26mon_keyLau xah lee (love him or leave him) has a nice discussion on TCO
17:26mon_key
17:26mon_key
17:26mon_key
17:26mon_key
17:26mon_key
17:26mon_key
17:26mon_key
17:26Chousukehmm
17:26mon_key
17:26mon_key
17:26mon_key
17:26mon_keysorry about that. http://xahlee.org/UnixResource_dir/writ/tailrecursion.html
17:26Chousukethat discussion must be between zen masters.
17:28aperotteChouser: woohooooo! compilation successful
17:29aperotteChouser: I was confused about the location of the classes folder and its inclusion in the classpath
17:30aperotteChouser, duck1123, mon_key: thank you!
17:30RSchulzIt's always easy to rail against "jargon," but every profession has its argot and it's necessary. Otherwise, we'd communicate in some kind of low-level, perfectly unambiguous "Newspeak..."
17:31mon_keyRSchulz: That particular `Xah' has positive ramifications for Clojure, trampolines, recur, etc.
17:32RSchulzOK. I'm still reading it, but I tend to be pretty skeptical of missives about language and vocabulary per se.
17:33RSchulzOf course, I'm refraining from commenting on the many ungrammatical uses of English in this particular individual's writings...
17:33RSchulzIt would be very rude to even allude to them.
17:33RSchulzWait...
17:37mon_keyRschulz: ... I just got that :)
17:42RSchulzSo... He wants to expunge jargon. To that end he proposes replacing "tail recursion" with "linear recursion."
17:43RSchulzWoo-Hoo! Clarity and logic triump!
17:43Chouserconstant-space recursion
17:43RSchulz(If not my spelling and / or typing.)
17:44RSchulzAnd as we progress towards a complete and unambiguous noun phrase, we see why humans need arbitrary labels for their complex thoughts.
17:45RSchulzIt's the same deal with "patterns." The point is that they capture complex concepts with simple titles that (naturally) do not fully express those concepts. Nothing less than the full exposition of the concept could do that!
17:47Chousukereplacing tail recursion with another term would just create more confusion than it'd do away with :/
17:48Chousukeit's wrong to complain about established meanings of terms, or to say they are incorrect. If they are established meanings, they are by definition correct :P
17:48aperottewhen using swank, if I use the keybinding C-x C-e on a call to (ns ...), the repl doesn't switch namespaces, is that the case for everyone?
17:48mon_keyRschulz: It is interesting to consider Xah's linguistic cultural heritage in lieu "The full exposition of the concept" - e.g. Eastern idiomatic languages
17:49RSchulzI can't speak to that, as someone who only speaks English. (In my defense, I did study German for three years in high school and Mandarin for two years in college.)
17:49mon_keyaperotte: it is the case for my current setup
17:50RSchulzHowever, I'm not sure the particular language one speaks constitutes an argument or counter-argument for a particular technical argot.
17:50aperottemon_key: thanks, just wanted to make sure it wasn't just me
17:50mon_keyaperotte: I think i found a kludge this afternoon. Still working on it.
17:51RSchulzAfter all, Xah ("he?" "she?") did argue for replacing "tail recursion" with "linear recursion." This is an almost meaningless distinction, given the fact that the concept is far too complex to be captured in any two words, especially if one is fixed as "recursion."
17:52aperottemon_key: great! I would offer to help, but my emacs skill level would probably make me more of a hindrance than help
17:53mon_keymon_key: :) it's not my kludge. I'm `borrowing' - i'll paste it over once i know.
17:54RSchulzChousuke: I just noticed your last two posts. I agree fully.
17:56mon_keyRShulz: I think he is advocating for, "optimized implementation of linear recursion" - Not advocating this position. Just thougth it had relevance to Clojure stylee.
17:58RSchulzmon_key: Use RS<tab>, then you don't have to type my whole name, risking misspellings...
17:58aperottemon_key: I haven't tried copying his setup but bill clementson posted about his setup at http://bc.tech.coop/blog/081205.html ... I'm going to give it a try sometime. Gotta go, but thanks again for the help
17:58RSchulz(My dad taught me to be proud of my name...)
18:02RSchulzAnd, as if by coordinated effort, the same misspelling appears on the mailing list...
18:02Lau_of_DKDid you guys know, that there's actually a plugin for ERC, which automatically makes a lisp-paste if you paste to much raw code to the channel? :)
18:02mon_keyRSchulz: Sorry :( (...my name...) He teach you about named-entity recognition? I need all the help i can get on that one :P
18:03ChousukeLau_of_DK: :P
18:03RSchulzNo. He just tought be to be proud of being a Schulz. It's just a name, but it's our name...
18:03ChousukeI think it's probably the most generic german name there is.
18:05Lau_of_DKI dont know googlegroups very well, but is it possible to add some filtering possibilities which automatically filter out spam and french ?
18:07rottcoddLau_of_DK: there is lisppaste.el
18:08RSchulzGeneric!? How dare you! ... Where I come from most of 'em are Schultz.
18:09RSchulzI understand it means "protector" and is also etymologically related to the first S in the infamous SS...
18:09RSchulzWhat can I do? What can I say? I'm a Schulz... In name, at least.
18:09Lau_of_DKhiredman: Can we modify clojurebot so that it automatically does a dictionary lookup on RSchulz's sentenses?
18:10mon_keydictserv.el :)
18:10RSchulzGack! Try Google. You'll get tens of thousands. I'm borderline logorrheic...
18:11Lau_of_DKhaha
18:11Lau_of_DKI gotta hit the sack, Have a good weekend all
18:12RSchulzCiao, Lau.
18:16duck1123when doing gen-class, do I need to specify what exceptions my fns throw?
18:16duck1123and if so, how would I do that
19:19RSchulzOK. I'm officially no longer going to read any of Xah Lee's articles. He is clearly obsessed with words to the ultimate detriment of useful communcation. I don't believe there is enough substance, if any, in his polemics to make them worth the time it takes to read them.
19:20AWizzArdXah believes like Wolfram, that Mathematica is the best programming language available.
19:21RSchulz! Why didn't someone tell me that before I spent any time at all reading his stuff?
19:21AWizzArdDamn, and he writes so much. Well, that is the tricky part.. people who haven't seen him before may be tricked into thinking at first that he is doing serious posts.
19:22RSchulzThat can't last long. Volume / quantity does not equal quality. Most people know that.
19:24ChousukeI tend not to take seriously people who write a lot but don't bother to pay attention to grammar or their typing :/
19:25AWizzArdIt depends.. if RSchulz is writing something long I would probably be interested. But Xah.. no thanks.
19:26ChousukeWell, RSchulz does not seem to be making crude grammar errors all the time.
19:26RSchulzWell, I went through this with Lau (privately). I don't tend to just write stuff. I respond, but don't just fire off my random thoughts.
19:26RSchulzI think the world is better that way.
19:27AWizzArd;-)
19:30ChousukeI'll agree that English isn't the easiest language to learn, but if I were to write something I simply couldn't publish rants full of typos or grammar errors. I'm too much of a perfectionist :/
19:31RSchulzThere's an aphorism: "Better to remain silent and be thought a fool than to speak and remove all doubt."
19:31Chousukeheh.
19:32RSchulzWhich, of course, is somewhat at odds with "There's no such thing as a dumb question."
19:32RSchulzWe just like to keep our options for judging people open.
19:34ChousukeA question is never dumb if it stems from genuine desire to learn I suppose.
19:34RSchulzYes. That's the point.
19:35RSchulzBut one does expose oneself to ridicule if the question is posed in a setting where it discloses fundamental ignorance.
19:35RSchulzYou've just got to be able not to care if anyone knows you're a rank newbie.
19:35RSchulzI know I don't. Not usually...
19:40ChousukeOccasionally I've helped people trying to learn to program. Many are capable of understanding, but there have been some who even after careful explaining are unable to understand how a simple loop works.
19:41RSchulzI've occasionally thought about how I'd try to teach programming. I took to it so effortlessly that it's hard to imagine someone not immediately grasping the basics.
19:42AWizzArdCan one have only one of #{:when :while} for each binding form inside a (for ...)?
19:43AWizzArd(for [x (range 20) :when (> x 8) :while (zero? (rem x 2))] x) doesn't work. When I remove the :when or the :while block it works.
19:44duck1123It's odd, but I am able to decompile many different class files, but not the ones generated by clojure
19:44RSchulzI'm not sure. They seem compatible. One determines the termination while the other determines when the body expr is evaluated. But the wording of the doc suggests one or the other.
19:44RSchulzHave you tried using both?
19:45RSchulzduck1123: What are you using to decompile?
19:45RSchulzIt may make assumptions about the source of the bytecodes that don't apply to Clojure.
19:45RSchulzClearly, Clojure's bytecodes are acceptable to the JVM, or we'd get some low-leve exception from the bytecode verifier.
19:46duck1123I've tried jad and netbeans
19:46AWizzArdI tried using both, just copy my (for [x (range 20) :when (> x 8) :while (zero? (rem x 2))] x) example into a repl. But (for [x (range 20) :when (> x 8)] x) works, as well as (for [x (range 20) :while (zero? (rem x 2))] x)
19:46duck1123Tomcat seems to be rejecting my class file, that's the only reason I'm bothering to look into this
19:47RSchulzduck1123: What exception / error are you getting from Tomcat?
19:48AWizzArdduck1123: I have a similar problem, with Jetty+Rife.
19:48RSchulzAWizzArd: "unsupproted binding expression."
19:48AWizzArdRSchulz: yes.
19:48AWizzArdBut both work when they are alone.
19:48RSchulzIt could be a bug / oversight or it could be intentional. I'd send a message to the list asking what the deal is.
19:48AWizzArdYes oki, I will ask the list.
19:49duck1123RSchulz: I'm not getting any exceptions or errors. When I enable the lines in my web.xml, it removes my servlet
19:49RSchulzduck1123: Is it possible that the class in question does not implement the proper interface and / or extend the proper base class?
19:49duck1123I just updated my clojure, let's see if that helps
19:49sean_____Hello all. Has anyone tried to edit the wiki page lately?
19:50RSchulzWhich of Tomcat's log files did you check? it makes two or three, and I've never quite figured out what goes into each of them.
19:50RSchulzsean_____: Do you mean the WikiBooks page(s)?
19:51sean_____RSchulz: Yep. I'm trying to make some edits because it's pretty out of date, but when I click the section edit link, it seems to think I want to delete most of the content
19:52duck1123RSchulz: apparently the wrong one. I'm seeing an error I need to investigate
19:52RSchulzThe only thing I know is that according to Meikel B., they've instituted a policy that restricts update / requires review.
19:53sean_____Whatever they've done seems to make it impossible to make minor edits (i.e. anything less than a rewrite)
19:53sean_____which makes a wiki useless :P
19:54RSchulzYeah, it's perverse. I don't know anything about it, but you can check out the thread on the mailing list / Google Group Subject: "Bureaucracy has reached Wikibooks"
19:54Chousukesean_____: I split up the wikibook
19:54Chousukesean_____: make sure to edit the appropriate pages, *and* make sure you edit the draft version
19:55ChousukeI can't "approve" the split version so it's not shown by default
19:55sean_____Chousuke: How do I do that? When I click "edit" next to the relevant section, it gives me a "Draft" with all the content deleted.
19:56Chousukesean_____: view the draft version and find the subpage you want to edit, and edit the section there.
19:57Chousukehttp://en.wikibooks.org/w/index.php?title=Clojure_Programming&amp;oldid=1343699 this is the split up book with links to the subpages.
19:58Chousukeor actually, this link http://en.wikibooks.org/w/index.php?title=Clojure_Programming&amp;stable=0 ... should result in the same page though :P
19:58Chousukesomeone needs to approve the change ;(
19:58sean_____Chousuke: *That* is what I needed. Thank you!
19:58ChousukeI hate the new "stable version" stuff too
19:59Chousukeapparently the draft version is shown by default if you're logged in though.
20:00sean_____I didn't want to bother logging in. I'm accustomed to making minor edits without that (admittedly small) hassle. I'm just correcting all the little mistakes I find while setting up clojure :).
20:00RSchulzWho acts as editor for these revisions? Is it even someone affiliated with Clojure??
20:00ChousukeI don't know.
20:00Chousukeprobably not.
20:00RSchulzIt sounds a bit crazy...
20:01RSchulzHa! Now I know AWizzArd's real name!
20:01RSchulz...Presumably...
20:07Chousukeyou /whois'd him? :/
20:07RSchulzAh. Actually, it's been there in the WHOIS output all along.
20:07RSchulzNo. I correlated his question here with a posting on the list.
20:07RSchulzThat just seems so much more clever...
20:08ChousukeYes. Why do things the easy way...
20:08RSchulzExactly!
20:08Chousukebut: oh crap
20:08Chousukeit's already 3 AM here ;(
20:08RSchulz"Oh, laddy! You've got a lot to learn if you want people to think of you as a miracle worker!" --Scotty to Geordi
20:08ChousukeI should've been sleeping hours ago.
20:09RSchulzDefinitely. I'm an early riser. I'm up at 5:30 AM.
20:13ChouserAWizzArd: you can have :when and :while in the same 'for' as long as they're on different expressions
20:13AWizzArdyes
20:13AWizzArdBut I mean for the same binding
20:14Chouserthat's not currently support
20:14Chouserworks for doseq, though.
20:15AWizzArdCan you show how to do it for (for [x (range 1 20) :when (> x 8) :while (< 0 (rem x 13))] x) ?
20:16AWizzArdWhere does one place the :when and :while inside doseq?
20:17RSchulzIsn't (doseq ...) syntactically the same as (for ...)?
20:18AWizzArdindeed
20:18AWizzArd(doseq [x (range 1 20) :when (> x 8) :while (< 0 (rem x 13))] (prn x))
20:22Chouseryou can cheat even with 'for'
20:22Chouser(for [i (range 9) :when (odd? i) x [i] :while (< i 5)] i)
20:28RSchulzIsn't '(1 3) simpler?
20:39AWizzArdbtw, isn't there this type unsigned long in java?
20:40AWizzArd(class 4000000000) ==> BigInteger
20:42RSchulzJava has no unsigned types, other than byte (implicitly unsigned).
20:44AWizzArdokay anyway, then it should be long at least, no?
20:44RSchulz"It?"
20:47RSchulzyou mean 4,000,000,000? By asking for a class, you force Clojure to produce an reference type, and it doesn't bother with java.lang.Long.
20:48AWizzArdalthough for 2 billion it returns an Int
20:51RSchulzApparently it just converts longs and Longs to BigInteger.
20:51RSchulzThere may be a reason for it, but I don't know what that might be.
21:06ChouserRSchulz: oh, good point! next time I'll write '(1 3)
21:28lsmithDoes the :gen-class option in (ns actually work for anyone?
21:28Chouseryes
21:29lsmithsvn? or the archive on sourceforge?
21:29Chousersvn
21:29lsmithalright.
21:29Chouserthe latest "release" doesn't have :gen-class for the ns macro
21:30lsmithIt does, but it doesn't behave
21:31Chouserah, yes. you might actually be able to just about any function name in 'ns' but most won't behave
21:31ChouserI'd recommend checking (doc ns) before trying to use any particular option.
22:12spaceman_stuhey guys. newbie emacs question: what's the best way to kill my slime process if I start an infinite loop?
22:33rottcoddspaceman_stu: does slime-interrupt work?
22:34spaceman_stuI haven't tried taht. Sounds like it's what I'm looking for though. Thanks
22:42rottcoddslime-interrupt doesn't seem to work for clojure, slime-restart-inferior-lisp is another way to go
22:53holmakyah
22:54holmakDisregard that, had focus in the wrong window. Sorry.
23:56arohnerdoes anyone remember the name of the paper that rhickey likes to link, "out of the turing tar pit" or something like that?
23:56arohnerI finally have time to read it, and I can't remember the name well enough to google for it
23:56gnuvince_I think I have it...
23:58gnuvince_arohner: sorry, I must have deleted it
23:59arohnerI think I found it, but the link appears broken
23:59arohner"out of the tar pit"