#clojure logs

2009-05-07

00:29lisppaste8eee pasted "ugly transition for 15-puz" at http://paste.lisp.org/display/79806
00:29eeeso here's my ugly function
00:30eeeoh, I missed durka42
00:30eeewondered if there's a better way
00:31eeein imperative language I could add all that apply as I found out they applied
00:33eeethink I know one thing to clean it up
00:43lisppaste8eee annotated #79806 "less ugly?" at http://paste.lisp.org/display/79806#1
01:10eeei'm stuck again
01:10eeesent a function as arg
01:11eeetried to call function and it says wrong number of argumentd
01:11eees
01:11eeebut I see two being called on it, and two being defined
01:11eeeso I probably need some more syntax like hashes somewhere
01:24benatkinanyone know if there's a way to step in between clojure and Java libraries? For example, could I make it so (java.util.Date.) gives me a fixed date instead of the current date?
01:25hiredmanwhy?
01:27benatkinfor testing APIs. say I have a function that generates a formatted calendar, and I can give it a month and year, or leave it blank and it will give me the current month and year. I could write a test and make it always return May 2009, and that way I would know what to expect.
02:08Lau_of_DKMorning guys
03:09hiredman,(+ (mod (/ (.getTime (Date.)) 1000 86.4) 1000) 42)
03:09clojurebot340.39431712962687
09:35nakyssmotd
10:25AWizzArdstuartsierra: hi
10:25stuartsierrahi
10:26AWizzArdDid you notice the private chat window?
10:43lisppaste8stuartsierra pasted "fix for partition-by" at http://paste.lisp.org/display/79828
10:47twismww... how do i check if a val is an instance of a clojure map?
10:47twism,(instance? #^Map {})
10:47clojurebotjava.lang.Exception: Unable to resolve symbol: Map in this context
10:48rhickey,(map? {:a 1})
10:48clojurebottrue
10:48twismthanks rhickey
10:48twismbrain freeze
11:02konatohello stuart
11:04stuartsierrahi
11:05stuhoodheya
11:05konatoi'm the one having difficult with run-tests in emacs
11:06konatoi did post a new message on the clojure group.
11:06konatorev 773 still doesn't help me
11:06konatobut thank you very much for your help
11:07konatoi can still survive since i can tests using REPL in a shell.
11:09konatoI really love your test-is framework
11:09stuartsierraWhich problem are you still having - the wrong number of arguments to "report"?
11:09konatoyes this one
11:11konatoI think it's more related to a component with emacs slime-repl...
11:11konatoBecause, it work in a repl with the shell
11:12stuartsierraI just committed another bug fix to test_is.clj, probably not related.
11:12stuartsierrarev. 774
11:13konatoI'll try it
11:19konatoI'm on rev 774 and still got the error:
11:20konatoStuart, I will put the log on Google
11:21stuartsierraI can't reproduce this, so I'm guessing it's something related to your classpath.
11:24konatoI will continue to look into, specially the classpath
11:24konatoThanks
11:33konatowith vim-clojure how to evaluate a clojure line
11:51konatoHi Stuart, it does work in vim, shell repl but not in emacs.
11:52stuartsierraGot to be the swank-clojure classpath, then. Different versions of contrib.
11:58stuhoodhas contrib hit 1.0 yet?
11:59stuartsierrait hasn't been discussed much
11:59durka42should probably tag something to be distributed with core 1.0, no?
12:02Chousukethe libraries in contrib are in varying states of readiness though.
12:02replaca it keeps coming up here, but it's a little problematic since contrib potentially works with multiple clojure revisions
12:02Chouser_there should still be a branch
12:03stuartsierrain theory, but until core trunk diverges from 1.0, I don't see much need.
12:03Chouserespecially ... right
12:03replacastuartsierra: Hey, as long as you're here, we were noticing some issues in c.c.json.write the other day
12:03stuartsierrahit me
12:04Chouserespecially when clojure post-1.0 gets a feature and something in contrib starts to use it.
12:04replacastuartsierra: where it wasn't writing the right stuff
12:04replacastuartsierra: I'd have to go reproduce it - it was in the middle of a big file
12:04replacastuartsierra: also, it never injects newlines
12:04stuartsierrareplaca: let me know; I'll need an example, at least
12:04stuartsierrareplaca: that's a feature
12:05replacastuartsierra: so I had a 1/4 MB file on a single line
12:05replacawhich seemed odd
12:05stuartsierraI figured, there are loads of JSON pretty-printers, I didn't need to write another one.
12:06replacaI'll go reproduce it, but in the meantime I was wondering if you'd done a compare and contrast with danlarkin's swag at in in clojure-json?
12:06stuartsierrano
12:08replacaok. It seems like he's done a lot of work on "json-compliance" but I haven't looked at the issue too closely myself
12:08stuartsierradanlarkin's supports arbitrary types
12:08stuartsierramine doesn't
12:09replacaOne of my concerns was whether there was a reason to have two or whether we should focus on one
12:09replacaunder the "batteries included" model
12:09replaca(which JSON would seem to be part of nowadays)
12:10replacabut maybe there are good reasons for two that I just don't know
12:10danlarkinstuartsierra: it would be nice if we could bring all the features and "json-compliance" of clojure-json into contrib.json and eliminate the need for clojure-json altogether
12:10stuartsierraI don't really care; I just wanted something fast and simple in contrib.
12:10stuartsierraI tried to follow the spec at www.json.org as closely as possible.
12:11replacaalso, I had suggested implementing pretty printing for JSON with c.c.pprint which should be pretty easy and orthogonal
12:11replacabut I in the middle of rewriting the dispatch right now to make it easier to do things like that
12:11stuartsierraseeing how complex c.c.pprint was made me not want to do it in c.c.json
12:12replacastuartsierra: yeah, the idea is to use the pprint dispatch to print other things and have all that complexity in one place
12:12stuartsierraif you can make that work, go for it.
12:12replacacause good pretty printing is *hard*!
12:14replaca:-) cool, I think what I'll do is do a fork of clojure-json (since it's standalone) and roll in pprint dispatch then we can all discuss
12:14stuartsierraok
12:14replacastuartsierra, danlarkin: thanks
12:14danlarkinsounds good to me
12:15replacaand now back to our regularly scheduled program, "is there a version of contrib for 1.0?"
12:15replacato be followed at 10AM with today's episode of "git vs. hg: my dvcs is better than yours"
12:15kotarakWasn't one rev tagged? 753 or something?
12:21stuartsierranothing in SVN
12:24chrizelhi, I'm doing the "Programming Clojure" example about compile - it uses duck-streams but I'm getting ClassNotFoundException when compiling duck-streams -- what could be the problem?
12:25chrizelcontrib is in classpath, it even seems to make a single class file on every compile but aborts with java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.contrib.duck_streams$file_str__XX
12:28stuartsierraIs the "clojure.compile.path" property set to a directory that is also on the classpath?
12:35chrizelstuartsierra, thank you, clojure-contrib.jar was obviously not compiled with classes
12:37kotarakchrizel: "ant -Dclojure.jar=/path/to/clojure.jar" should compile contrib with AOT compilation.
12:38technomancydear ant: here's a hint: the path to clojure is _always_ ../clojure/clojure.jar
12:38kotaraktechnomancy: is that so?
12:39replacafor small values of always
12:39replacabut it would be nice to get all the packaging stuff working so we could know/figure that out
12:40chrizelkotarak, thx, i've figured it out now at least there is no problem with duck-streams anymore -- makes all sense now
12:41technomancykotarak: it would make a good default value
12:41danlarkinthat's the path on my system :)
12:42durka42i use ../clojure.jar
12:42kotarakreplaca: I have posted a patch which adds Ivy support to contrib, since I use it I have no trouble with small (a few kb) jars containing parts of contrib. I got no feedback however. :/ At least not on the list, some positive feedback came via pm. It seems that maven will become the packaging system for Clojure...
12:43kotarakSo I use: ant -f build+ivy.xml and don't care where the clojure.jar is...
12:45chrizelShouldn't it be possible to find the clojure.jar on the classpath automatically? (Java newbie here...)
12:47stuartsierraif it's there, but Ant has its own classpath
12:48chrizeloh, that's right
12:49replacakotarak: yeah, I've been meaning to get around to looking at that and understanding maven, ivy, etc. But I haven't got there yet...
12:50replacakotarak: soon, I hope, cause this stuff is important
12:50technomancyreplaca: you can take a look at the clojure-pom project on github; it's pretty straightforward: http://github.com/dysinger/clojure-pom
12:50replaca~seen dnolen
12:50clojurebotdnolen was last seen quiting IRC, 1006 minutes ago
12:51technomancyI'm not a fan of writing XML for stuff like this, but if the XML's written for you it works surprisingly well.
12:51replacatechnomancy: cool. I want to look at all this stuff in some depth. I've never done anything with packaging in Java beyond ant
12:52technomancythe ideal solution would be something that could wrap an existing solution like mvn in a syntax that's a little more appealing
12:52stuartsierraAs far as Java goes, Maven or Ivy are about the only games in town. Both are very XML heavy.
12:52technomancyif handling deps becomes straightforward, there's less incentive for contrib to be "the great big bucket-'o-code that everyone depends on"
12:52stuartsierrayes
12:53technomancystuartsierra: luckily generating XML from s-expressions is not in the least bit difficult. =)
12:54stuartsierraYes, but I expect calling the Java APIs directly will be the more flexible route.
12:54dysingerit would be cool to have a project.clj instead of pom.xml
12:54dysingerand have that just be a wrapper for maven
12:54technomancyyeah, that's probably the best long-term solution. generating XML would be a "let's get it working quickly" hack
12:55dysingerthe maven api can be hacked to suck in a pom.xml from memory instead of disk I bet.
12:55technomancyI have a perfect name for a clojure app that generates pom.xml files...
12:55technomancypomegranate
12:55dysingerI did a project called pomegrante with jruby / maven :)
12:55stuartsierraTake it one step further, call it Persephone.
12:55dysingerwhere I was doing the same thing
12:56dysingerbut eventually I got distracted by buildr and then finally when that didn't work I gave up.
12:56dysingermaven + jruby was teh slow and painful
12:57technomancystuartsierra: so that means mvn is Hades?
12:57stuartsierraPersephone was (if I recall) the goddess who was trapped in Hades because she ate a pomegranate there.
13:02technomancyah, gotcha
13:04stuartsierraI thought of calling it "craven".
13:16t345how do you use classes from -contrib on the repl?
13:17replacat345: add contrib to your classpath then (use 'clojure.contrib.duck-streams) or whatever
13:17cp2goose-streams
13:17t345do I need to do (use) ?
13:17t345might explaing why it didn't work
13:18t345looks like clojure.jar's classes are default-use'd
13:18replacat345: yup
13:18replacaonly clojure.core
13:18t345another one
13:18t345is it an error in build.xml that not all contrib libs are compiled into the jar?
13:19t345it's easy to patch, but I didn't want to post a patch that won't be accepted
13:19cp2contrib is not part of clojure
13:19cp2thats why it's 'contrib' =p
13:19t345cp2: into clojure-contrib.jar
13:19cp2oh
13:19t345many dirs are omitted fromt he list in build.xml
13:19replacat345: it is an error, but it doesn't matter too much cause the cljs are all there
13:20t345yeah but a patch would be accepted. I will create one....
13:20replacat345: and clojure will load the cljs as happily as the classes
13:20kotarakant there are things like miglayout which depend on third party things...
13:20kotaraks/ant/and/
13:20t345replaca: pre-compiling still makes sense, doesn't it?
13:20technomancyit'd be great if str-join were in core
13:21technomancyconsidering you need it to do simple things like reverse a string
13:21replacat345: yeah, it improves performance
13:21t345replaca: I will whip up a patch in minute....
13:21t345is Google Code the original repo?
13:21kotarakyes
13:21t345I think so
13:21t345ok
13:21t345git svn clone it is then...
13:22kotarakt345: do you have a contributor aggreement sent in?
13:22t345what?
13:22t345why?
13:22t345this is not FSF or Sun
13:22t345or Apache
13:22t345or eclipse
13:22kotarakDo contribute patches you have to sign a contributor agreement.
13:22kotaraks/Do/To/
13:23t345I will use Scala, then, thanks
13:23kotarakhttp://clojure.org/contributing IIRC.
13:23t345CRAZY
13:23t345might make sense
13:23t345but too much effort
13:24Chousuke:p
13:24technomancybarriers to contribution are no fun
13:24kotarakWas one sheet of paper and an envelope...
13:24t345it's just a simple build.xml diff
13:24rsynnott6apart keeps nagging me about sending in one of those
13:24gnuvincetechnomancy: I imagine tracking down ownership 7 years from now is even less fun.
13:24technomancyIIRC the reason Sun and FSF require one is so that they can use their considerable legal resources to defend the project. but that doesn't even apply here.
13:24rsynnottthey're not that often seen on non-company-controlled projects
13:25t345Signed-Off-By was Ok for my git and kernel patches
13:25t345hmm
13:27t345can't I just send the patch to a dev and he will also sign-it off and it's ok?
13:27t345it's non-substantial plumbing
13:27ChousukeI don't think that works :/
13:27Chousukethe CA thing is a nuisance sometimes
13:27rsynnottah, but then you'd have to assign copyright to HIM
13:27rsynnottsee how this works? :)
13:28technomancyt345: it's not about making sure it is good code, it's about who owns the copyright.
13:28t345copyright for build.xml? come on
13:28technomancy=(
13:28replacat345: or you can just ask a dev to fix it - we don't really need a patch on this one
13:28Chousuket345: go complain to legislators :P
13:28replacaI've had it on my list for a few weeks (since I noticed it) but it hasn't gotten to the top
13:28Chousuket345: copyright even applies to what we write *here*
13:28t345ok then please make sure that everything that's compilable is compiled via build.xml.
13:29t345replaca: I will send you a scret diff and you will not mention who wrote it :D
13:29replacayou got it!
13:29replacagotta run - talk to you all later
13:32ChousukeI suppose it'd be possible to drop the requirement for a CA in the future, but that's up to Rich.
13:33t345where is rich?
13:33gnuvinceNYC
13:33rhickeywhat's the question?
13:33t345hey
13:34kotarakclojurebot: bat light
13:34clojurebotNo entiendo
13:34t345rhickey: is it Ok to submit a trivial build.xml patch without signing the postal mail agreement?
13:34rhickeyt345: no
13:34technomancyaccording to the FSF, anything under ~5 LOC is probably not subject to copyright to begin with
13:35rhickeywhy not send in a CA?
13:35Chousuke"probably" is not very assuring :/
13:35danlarkineverything created in the USA is automatically copyright it's creator, no matter the size or scope
13:35danlarkinthat sentence is copyright me
13:35t345too much hassle for something trivial and non-substantial non-clojure code
13:36kotarakIn Germany you can't give up your copyright. No public domain here...
13:36t345it's much more work to discuss this actually
13:36t345:)
13:36technomancyChousuke: even if it is, if it's trivial to reimplement, then there's no danger of it becoming a legal issue in the future.
13:36rhickeyt345: true, then you can just 'suggest' the change on the group
13:36technomancyI think that's the FSF's reasoning at least; they let me send in trivial patches before my paperwork had gone through.
13:37t345rhickey: with a "this is what I mean" diff? or literal explanation?
13:37technomancydanlarkin: sure, but you'd have a hard time defending your copyright on a five-word sentence.
13:37t345rhickey: I am used to posting patches instead of explaining something which looks like a whishlist
13:38rhickeyt345: sending in a CA is a one-time thing, if you think you'll have multiple patches that's the way to go
13:38danlarkintechnomancy: correct, especially messages posted to a public forum like this, almost any use would be fair use. The point is that legally, I owned the copyright as soon as typed the keys
13:38t345I will do that if I ever need to change a .clj or .java file, promised
13:39rhickeyno one person's convenience is more important than the project having sound stewardship and provenance
13:40Chousuket345: so what library in contrib is not getting compiled by default? :/
13:40t345before we discuss too long
13:40t345at least json.*
13:40t345let me try if that helps at all with my repl classnotfound errors....
13:41technomancydanlarkin: yeah, I think you're right about that, but the end result is the same as it applies to this project.
13:44t345hmm (use 'clojure.contrib.json.read) still yields nil
13:44t345oh wait
13:44Chousukethat's what it should do
13:44kotarakIt's supposed to yield nil
13:44t345ok
13:45t345ok, class is found
13:45t345so the compiling was the problem
13:45t345anyway, it's ok for me and I trust yhat you guys will fix build.xml for all cases where it's missing
13:45t345thanks for talk :D
13:45t345it's appreciated
13:48t345and yes if I ever want to contribute to Clojure-Contrib I will read the agreement and if it's sound will send it in but first have to make some money to pay for the postal service :P
13:50t345hmm, no single reply, I've made you guys ignore me. cool.
13:51technomancyt345: send me your address; I'll send you a stamp. =)
13:51t345:D
13:51t345from the first sentence in ca.pdf I am not sure I even agree or am fine to sign it
13:52t345no time to think about it
14:04Chousukethere are surprisingly many libraries that don't get compiled :/
14:04Chousukeprobably from before there was AOT compilation :
14:35cp2hehe http://gianturl.com/
14:35cp2novel idea
14:35cp2wish i came up with it
14:36technomancywhat's the status on making regexes callable?
14:36technomancyI noticed it's on the todo
14:37rhickeytechnomancy: there are some problems with the idea, it seems like we can have callable regexes or Pattern-compatible regexes, and the latter is more useful
14:37kotarakcp2: http://dickensurl.com/
14:37cp2haha
14:37cp2neat
14:38technomancyrhickey: you mean making it so #"foo" isn't a native Java type?
14:39technomancybut still uses the same syntax?
14:39rhickeytechnomancy: that would be the tradeoff
14:40stuhoodit isn't until you build a language on the JVM that you start noticing all the final classes
14:41stuhoodis that because the implementation is actually native to the JVM implementation?
14:41technomancyit's tempting to think about hacking the JVM to just ignore "final" declarations.
14:41technomancywho needs 'em anyway? =P
14:41Chouserhow useful is a Pattern regex compared to a callable regex that provides all the same methods as Pattern?
14:42technomancyChouser: seems like the only advantage is that there's less overhead
14:42technomancybut maybe I'm missing something
14:42rhickeyChouser: it's very useful in APIs that take Patterns
14:42stuhoodi don't know: this seems ackward: (#"matchme" "matchme")... would it execute a 'find' or a 'match'?
14:43ChouserThe place I've most often wanted to pass in an actual Pattern is to String's .split() method -- but it doesn't take Patterns at all, only regexes in Strings. :-P
14:43Chouserstuhood: that's the next question. :-)
14:43stuhoodChouser: you can do Pattern/split
14:44Chouserstuhood: sure. and thus also could do ClojureRegex/split
14:44stuhoodtrue...
14:44ChouserI think calling a ClojureRegex should be the same as re-seq
14:44stuhoodyea, i don't know how often patterns cross API boundries
14:47rhickeyThe group would be a good place to feel out how many people care that #"regexes" are Patterns
14:47stuhoodrhickey: which APIs have you seen Patterns passed around in?
14:48technomancyas long as there's a convenient way to get the Pattern from a #"regex", it seems like a step forward
14:48ChouserI'd love to see an concise s-expr alternative to regex.
14:48stuhoodwhat is the benefit, aside from becoming callable? that really only eliminates 5 characters from the call
14:50technomancystuhood: yeah, and callable maps "only" eliminate four characters vs using "get", but it's a huge win.
14:50stuhood"huge"...
14:50Chouserit means you can pass around the object rather than a thunk
14:54danlarkinwell I am in favor of the idea... but passing a thunk versus non-thunk is not an issue if the callee can use them the same way
15:02drewrI wonder if scsh has a sexp-based pattern system.
15:03drewrSounds like something it would do.
15:03kotarakdrewr: it has, IIRC
15:19chrizelDoes someone know how to solve Emacs+Slime+clojure-mode problems with stdout in other Java threads? (e.g. when an ActionListener in Swing does println, nothing gets printed in the Emacs window but in an external repl it works without a problem)
15:28tashafawhat ever happened to 'recur'
15:29tashafa,doc recur
15:29clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/doc
15:29tashafa,(find-doc recur)
15:29clojurebotjava.lang.Exception: Unable to resolve symbol: recur in this context
15:29dliebke,(doc recur)
15:29clojurebotjava.lang.Exception: Unable to resolve var: recur in this context
15:29dliebkehmm
15:30replacadliebke: recur is special
15:30dliebkeyeah, but I can run (doc recur) on my system without an exception
15:30stuhoodhttp://clojure.org/special_forms#toc10
15:32replacadliebke: and it tells me it's special :). You'll have to ask hiredman why clojurebot has a prob with it
15:32dliebkeyep, it just says, Please see http://clojure.org/special_forms#recur
15:33replaca,(find-doc "recur")
15:33clojurebot------------------------- clojure.core/loop ([bindings & body]) Macro Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein. Acts as a recur target. ------------------------- clojure.core/trampoline ([f] [f & args]) trampoline can be used to convert algorithms requiring mutual recursion without stack consumption. Calls f with
15:34replacatashafa: find-doc takes a string
15:34hiredman,(doc recur)
15:34clojurebotjava.lang.Exception: Unable to resolve var: recur in this context
15:34hiredman*shrug*
15:39hiredman,(doc if)
15:39clojurebot"([tst & etc]); "
15:39hiredman,(doc if*)
15:39clojurebotjava.lang.Exception: Unable to resolve var: if* in this context
15:39hiredman(if*)
15:39hiredman,(if* nil 1 2)
15:39clojurebot2
15:40cp2hrm?
15:40hiredmanclojurebot's doc lookup doesn't handle special forms
15:40hiredman(I guess)
15:41tashafareplaca: thanks
15:41Chousuke~source if
15:42Chousukeah, right, the lazy seq thing.
15:42hiredmanYeah
15:49replacahiredman: can you do source straight into contrib now?
15:51hiredmanreplaca: I, uh, no
15:51replaca:-)
15:52replacahiredman: `any blockers or just hasn't gotten to the top of the list?
15:53hiredmanno blockers, just got pushed back
15:53replacaok
16:00cemerickhas anyone seen a couchdb wrapper yet?
16:01danlarkincemerick: I have started one
16:01replacadanlarkin: make sure it has lots of pron!
16:02danlarkind'oh, I knew it was missing something
16:03replacadanlarkin: if it's good for Ruby, Clojure should have it too
16:03cemerickdanlarkin: we're thinking of using couchdb. if/when you've got something on github, we'll be happy to bang on it. Which java driver are you wrapping?
16:04danlarkincemerick: no java driver, just using clojure-http-client (which hopefully soon becomes clojure.contrib.http.client)
16:05jwinterthis one? http://github.com/technomancy/clojure-http-client/tree/master
16:06danlarkinjwinter: yes
16:22hiredman~def file
16:22hiredmanis there a function with the same name in multiple contrib namespaces?
16:24kotarakI think, one was renamed to file-str.
16:24kotarakmaybe duck-streams and java-utils?
16:25hiredmanI am just looking for a function with the same name so I can see how it looks when clojurebot encounters it
16:25hiredmanit should just give multiple urls, but I would like to test it
16:27kotarakIsn't there also something in clojure.set? replace or something? I vaguely remember some clash there...
16:27durka42~def next
16:28durka42~defn zip/next
16:28clojurebotI don't understand.
16:28durka42~def zip/next
16:28durka42~def clojure.zip/next
16:29hiredmanwell thats not contrib
16:30durka42true
16:32hiredmanbut anyway, clojurebot does contrib source lookups now
16:32hiredman~def add
17:02hoeckchrizel: regarding your slime-thread-printing problem, its solveable by binding *out* in each thread to the value of *out* slime uses
17:02hoeckchrizel: or use a custom println function
17:02lisppaste8hoeck pasted "slime-println" at http://paste.lisp.org/display/79852
17:03kotarakhoeck: Hi. I pushed the changes to the lazymap repo. Since I had to do some changes you will get a new head when pulling...
17:03benatkin~def import
17:04hoeckkotarak: well, now I know that there is a rebase command :)
17:04kotarakhoeck: :) I'm not sure it helps in this case. ;)
17:08chrizelhoeck, thanks
17:18kotarak,(doc repeatedly)
17:18clojurebot"([f]); Takes a function of no args, presumably with side effects, and returns an infinite lazy sequence of calls to it"
17:26replaca~def pprint
17:26replacahiredman: nice!
17:32replacadef ~conj
17:32replaca~def conj
17:33technomancyo O ( google code doesn't support syntax highlighting on clojure, but github does? )
17:34replacahiredman: there aren't any dups in contrib (from my quick scan) but there are some funcs (in generic.collections) that "override" core funcs
17:34replacahiredman: like conj above
17:35hiredmanright now I have it fallback, if it cannot find a symbol in core, look in contrib
17:36replacahiredman: makes sense - the contrib version might just confuse folks
18:15replacahiredman: another idea: maybe for contrib you should prefix the var with the ns and then we could look at contrib in addition to core and it would be "obvious"
18:16hiredmanpossible
18:17hiredmanI don't want to touch the source lookup stuff anymore unless I set aside time to refactor
18:17replacaeasy for me to say! :-)
18:23eyerisI think I've configured clojure-mode and swank-clojure properly, but I must have made a mistake because I am not getting syntax coloring. Could someone take a look at my .emacs file? (I am super new to emacs) http://pastebin.ca/1415781
18:23eyerisclojure-mode.el is in my .emacs.d. This is emacs 23
18:24ctdeanIf you say M-x font-lock-mode in a .clj buffer, what happens?
18:25eyerisIt says Font-Lock mode disabled
18:25eyerisDoing it again enables.
18:25ctdeancool, at least that is working right
18:26technomancyeyeris: if you're new to Emacs I'd recommend using the Emacs Starter Kit, installing clojure-mode via ELPA, and then using M-x clojure-install
18:26technomancythat should handle all the tricky bits for you
18:27eyerisI tried using clojure-install last night. I thought it worked when I was using emacs-gtk but now I am working remotely, over a text terminal.
18:28technomancyeyeris: clojure-install will set up communication with a clojure subprocess; it doesn't affect things like syntax highlighting
18:28technomancythat's just clojure-mode by itself
18:28eyerisOkay, well then clojure-install won't help me because I want clojure-mode to give me highlighting
18:29eyerisI don't know what this ELPA is.
18:29technomancyeyeris: ELPA is a package manager for elisp
18:30technomancyeyeris: what does M-: major-mode RET show in the minibuffer if you do it from your .clj file?
18:31eyerisfundamental-mode
18:32ctdeanwell, that's not right
18:33ctdeanTry M-x clojure-mode
18:33eyerisI just used the ELPA to install it and now it works.
18:33ctdeangreat!
18:34eyerisIs there a way to make the M-x buffer history persist between executions?
18:35ctdeanDon't know
18:35technomancyeyeris: probably; you could search emacswiki.org
18:36technomancyin general it's not that helpful if you've got Emacs sessions that last weeks
18:43eyerisquit
19:04technomancyhiredman: there's a third clojure user in Seattle now. exciting times.
19:39eeei have, maybe, a weird question: is there a way to make something equal nothing?
19:39eeewhat I mean
19:39eeeis
19:39eee[nil 'a]
19:39eee,[nil 'a]
19:39clojurebot[nil a]
19:39eeeisn't quite right
19:39danlarkinwhoah, another clojure user in Albany... small world!
19:40eeei want to say that under some condition, a variable is nothing
19:40eeethen when you do [nothing a] .... you get [a]
19:41eeesame as if you concat "" to "hello world", you get "hello world"
19:41eee,[,'() 'a]
19:41clojurebot[() a]
19:41danlarkineee: no
19:41technomancyeee: you could use binding on =, but that would break things horribly
19:42ctdean_You want to pass two arguments to a vector and have it the size of the vector be 1?
19:42hiredmaneee: use if
19:42hiredman(if a (conj b a) b)
19:43eeei want to say, "let foo equal (if such and such [adfasdf] else nothing)"
19:43hiredman,(let [a nil b [1]] (if a (conj b a) b))
19:43clojurebot[1]
19:43hiredman,(let [a 2 b [1]] (if a (conj b a) b))
19:43clojurebot[1 2]
19:44hiredmannil is nothing
19:44hiredmanwell
19:44lisppaste8eee pasted "need to check previous state in history" at http://paste.lisp.org/display/79862
19:44hiredmannil has the semantics of "nothing" if you ever want "nothing" to be useful
19:45eeemy problem
19:46eeeis that my history gets previous transitions
19:46eeeadded again
19:46eeeI only want option1, say, if I the history doesn't already have option1
19:47eeei could put the if statements all over the place below the let, too
19:47hiredman(if (-> history (.conatins option1)) ...
19:48eeeahh
19:48eeeactually (first option1)
19:49eeesince option1 is a new history
19:49eeeoption1 and option3 are alternative realities
19:49eeeof the whole new history
19:49eeeafter the transition
19:49hiredman(if (-> history first (.conatins option1)) ...
19:50eee (if (-> history (.conatins first(option1)))
19:50eeenot that?
19:51eeeso in the case statements
19:52eeewhere I have [option1 option3]
19:53eeei'd have [(if ..... option1 ()) [(if ......]
19:53eeeand I'd have the same problem
19:53eeethe possibility of having
19:53eee[nil nil]
19:53eeeor at least
19:53eee[nil aasdfasdf]
19:53eeeso then i'd need to stop out all the nills
19:54eeenils
19:54eeeahhhh filter
19:54eee,(filter #(= nil %1) [nil])
19:54clojurebot(nil)
19:55eee,(filter #(not= nil %1) [nil])
19:55clojurebot()
19:55eeecool
19:55eeeopposite of filter?
19:59eee(doc keep)
19:59clojurebotI don't understand.
20:00durka42i believe #(not= nil %1) is identity
20:00durka42and the opposite of (filter whatever coll) is (filter (complement whatever) coll)
20:00eeei've seen it
20:01eeesomeone has, like 'keep or somthing
20:01durka42maybe something in seq-utils?
20:02durka42apparently not
20:02Chousukeor (remove whatever coll)?
20:02eeethat'd be cool, too
20:03Chousuke,(remove identity [nil 1 2 3 nil])
20:03clojurebot(nil nil)
20:03eee,(remove nil [nil 5 6 nil 7])
20:03clojurebotjava.lang.NullPointerException
20:03Chousukehmm
20:03Chousukeopposite of what I wnated
20:03eee,(remove 'nil [nil 5 6 nil 7])
20:03clojurebotjava.lang.NullPointerException
20:03Chousuke,(remove nil? [nil 1 2 3 nil])
20:03clojurebot(1 2 3)
20:03Chousukeeee: it must be a predicate
20:03eee,(remove nil? [nil 5 6 nil 7])
20:03clojurebot(5 6 7)
20:03eeesweet
20:03Chousuke:)
20:04eee:)
20:05Chousuke,(= 'nil nil); hmm
20:05clojurebottrue
20:06eeei found an old conversation in here where you guys already told me 'compliment'
20:06Chousuke,(symbol "nil") ; this would fool people
20:06clojurebotnil
20:06eeei don't even remember, but google does
20:06eeesorry to rehash
20:06Chousukedon't worry.
20:06ChousukeI forgot complement exists, too
20:07eee,(remove-if #(nil? %1) [nil 5 6 nil 7])
20:07clojurebotjava.lang.Exception: Unable to resolve symbol: remove-if in this context
20:07Chousukeit's just remove :)
20:08Chousukealso #(nil? %1) == nil?
20:11Chousukereminds me... I had to code a bit of perl earlier, and it was quite painful.
20:11ChousukeI haven't used perl before, and I kept trying to do clojurey things
20:12Chousukeperl has map and such but it's... weird.
20:14eee,(remove nil? [nil 5 6 nil 7])
20:14clojurebot(5 6 7)
20:14eeedang turned into a list
20:14Chousukea seq
20:14gnuvince_seq
20:14Chousukeit's lazy
20:14eee,(vector (remove nil? [nil 5 6 nil 7]))
20:14clojurebot[(5 6 7)]
20:14eeedang
20:14gnuvince_vec
20:14Chousuke(into [] (remove nil? [nil 3 4 nil])); not lazy
20:15gnuvince_,(vec (remove nil? [nil 5 6 nil 7]))
20:15clojurebot[5 6 7]
20:15eee,(into [] (remove nil? [nil 5 6 nil 7]))
20:15Chousuke,(into [] (remove nil? [nil 3 4 nil])); I am lazy
20:15clojurebot[3 4]
20:15clojurebot[5 6 7]
20:15ChousukeI think into [] looks nicer than "vec"
20:15ChousukeI wonder if they perform the same too
20:16eeevec is right but vector is wrong
20:16eeewow
20:16Chousukevec is short for apply vector
20:16gnuvince_vec turns a seq into a vector
20:16eeei would agree that into [] is more descriptive
20:16gnuvince_vector takes its arguments and yields a vector
20:17eeeand self documenting etc
20:17Chousuke,(time (dotimes [i 100000] (into [] (take 100 (iterate inc 0))))
20:17clojurebotEOF while reading
20:17Chousuke,(time (dotimes [i 100000] (into [] (take 100 (iterate inc 0)))))
20:17Chousukehmm
20:18clojurebotExecution Timed Out
20:18Chousuketoo much :(
20:18Chousuke,(time (dotimes [i 10000] (into [] (take 100 (iterate inc 0)))))
20:18clojurebot"Elapsed time: 843.441 msecs"
20:18Chousuke,(time (dotimes [i 10000] (vec (take 100 (iterate inc 0)))))
20:18clojurebot"Elapsed time: 651.112 msecs"
20:19durka42it looks like vec punts to java so that isn't so surprising
20:19lisppaste8eee pasted "train wreck transition function" at http://paste.lisp.org/display/79866
20:20eeedoesn't work now
20:20eeeerror
20:20durka42.contains
20:21eeeit's there
20:21Chousukeit says conatins in the code :p
20:21eeeoh
20:21eeei'll search
20:21eeecause that's the error, too
20:21eee!
20:22eeeduh
20:25eeein some environments that people have, can you actually step though the code and also stop where breaks occur like in common lisp?
20:25eeecause I gotta null ptr ex somewhere
20:26eeei wonder ...
20:27eee,(-> [] (.contains 'a)
20:27clojurebotEOF while reading
20:27eee,(-> [] (.contains 'a))
20:27clojurebotfalse
20:28eee,(-> [a] (.contains []))
20:28clojurebotjava.lang.Exception: Unable to resolve symbol: a in this context
20:28eee,(-> ['a] (.contains []))
20:28clojurebotfalse
20:30durka42eee: i don't know about stepping through (maybe a java debugger) but you can easily get stacktraces
20:32eeei gotta run in some other environment I think
20:32eeeclojure-dev ain't got that
20:34RaynesClojure-dev still doesn't have autoidentation :\
20:35eeetrue
20:35eeebut color parens is nice
20:35durka42vimclojure does :)
20:36eeei never got all the vay to setting that up
20:36eeei like vim
20:37eeei use a somewhat old mac with tigre
20:37eeetiger
20:37eeeand a broken "port" configuration
20:37durka42heh
20:37durka42i use vimclojure with macvim
20:37eeeand vim does have the stack trace?
20:38clojurebotGesundheit!
20:38eeeis yours tiger?
20:38durka42em
20:38durka42leopard i think
20:38durka4210.5 is leopard, yes?
20:38durka42you can have stacktraces anywhere
20:38eeeye
20:38eeeso i can't get it
20:38durka42the repl binds *e to the last exception, like *1
20:38eeefrom you
20:39eeenice
20:39eeeguess I'll work on that
20:39durka42also contrib.stacktrace
20:39eeeok
20:40eeeguess i gotta go for a few
20:40eeethanks for the help, as always
20:49eeefound problem
20:50eeeif result was swapped with else
20:50eeeor contains logic backwards
20:50eee:)
21:04eeei just realized how to parallelize this a-star search
21:41Victorrhi, does clojure read some .file in the home directory by default?
21:42VictorrI'm looking for a place to put some handy repl functions...
21:44dliebke_it looks for files on the classpath
21:45Victorrdliebke_, I want clojure to automatically (use) this file
21:45eeethe (use) thing is at the clojure level but
21:46eeethe way I look at it
21:46eeeclojure is a java program
21:46eeeor at least a jvm program
21:46eeea universe inside a universe
21:47eeeso (use) is in the inner universe. but that universe has a classpath
21:47dliebke_you can create a user.clj that will be called automatically when the repl starts up
21:47eeeoh I see
21:47eeeinteresting
21:48Victorrthat is what I need, will it get loaded if it is in the classpath, or do I need to put it somewhere
21:48dliebke_it just needs to be on the classpath
21:48Victorrthanks dliebke_!
21:54Victorrdliebke_, user.clj works when I launch the repl from the command line, but not from slime, would you happen to know how to make it work?
21:54dliebke_unfortunately, I don't use slime. sorry :(
21:55Victorrnp, thanks
22:27memoizewhat's the difference between cons and list* ?
22:27stuhood,(doc list*)
22:27clojurebot"([item & more]); Creates a new list containing the item prepended to more."
22:28stuhood,(doc cons)
22:28clojurebot"([x seq]); Returns a new seq where x is the first element and seq is the rest."
22:28stuhoodlist versus sequence...
22:28memoizeoh!
22:28stuhoodthey both probably implement the same java interfaces, but they have different base classes
22:28memoizetoo subtle for me right now
22:29stuhoodASeq vs PersistentList
22:30memoize(cons 1 [2]) and (list* 1 [2]) return a Cons object, when I use (class) on them
22:34memoizelist* is cons passed to a private function spread; i'm not sure what spread does
22:35durka42~def clojure.core/spread
22:35durka42it looks like it walks the list re-consing it
22:38memoizewhen would i use list* over cons? i'll look at how core uses list*
22:39durka42i think the functions ending in * are generally not intended to be used at all
22:40memoizei'll take that advice and move on, thanks
22:41durka42it seems like core only uses it before things that would avoid are defined
22:41durka42but i don't know my way around core
22:49Victorr,(list* 1 2 [3])
22:49clojurebot(1 2 3)
22:49Victorrmemoize, that is the difference between it and cons
22:49Victorr,(cons 1 2 [3])
22:49clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$cons
22:50Victorrdurka42, I'm not sure about your comment that "functions ending in * are generally not intended to be used at all"
22:50Victorrfor some functions, it means something akin to "act on many" (or at least it does for Scheme)
22:51durka42well, thinks like fn* and if* that are even more special than special forms
22:51durka42in scheme and CL, i agree, but i don't think it's a common naming scheme in clojure
22:51Victorr,(doc if*)
22:51clojurebotjava.lang.Exception: Unable to resolve var: if* in this context
22:52Victorrok, but list* at least seems to follow that rule
22:56hiredmangenerally let* is a special form and let is a macro that uses let*
22:57memoizeVictorr: thanks, i didnt read the functional sigs carefully
23:04Victorrmemoize, glad to be of help. In general, I find that the docs for functions suck
23:06VictorrI wonder if Rich requires a licensing agreement before sending patches for documentation..
23:08memoizeim going through core, grouping functions, distinguishing when to use this or that, giving practical examples
23:08memoizeVictorr: docs be part of the code, so yeah
23:18durka42memoize: that sounds very useful
23:18durka42see also:
23:18durka42~examples
23:18clojurebotexamples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
23:26Victorrmemoize, that looks very good. I think it would be even more useful if it was part of the documentation of functions in the source code. If you want to do that, I would be happy to help
23:27Drakeson`is there a book on clojure that does not assume you already know java?
23:30hiredmanjava is not that hard to pick up, knowing some is good because you will want to wade through javadocs
23:33Drakesonhiredman: I happen to know some lisp, so it is irritating to "think in java". I guess it would be great if there is a book/document that starts by assuming no knowledge of java.
23:34Drakesonmany people don't know java, afterall
23:36hiredmanif thinking in java is not something you want to do, then don't
23:37hiredmanbut learn a little java
23:39DrakesonIs it possible to teach someone clojure as their _first_ programming language?
23:39Drakeson(that's what I want to try to do)
23:39hiredmansure
23:41danlarkinI always thought lisp would make a great first programming language
23:41hiredmanyeah
23:41hiredmanI mean lisp + functional = super simple
23:41danlarkintotally
23:42Drakesondanlarkin: you are not the only one :) scheme had been tought as the first prog lang in MIT for ages.
23:42hiredmanbut clojure has a lot of rather advanced features that, uh, would not go over well with a new programmer
23:42hiredmanall that emphasis on concurrency
23:43Drakesonhiredman: that's simple. You don't go over advanced features when you teach to a new pupil.
23:43durka42yeah you can leave those out for a while
23:43durka42and then, BAM! look at pmap
23:44DrakesonYou can always see how much they can grasp, and slow down or speed up accordingly.
23:45DrakesonNow my question: Is there a Clojure book suited for "programming newbies"?
23:45hiredmanthere is only one clojure book
23:45hiredmanthere will be more in the future
23:45hiredmanbut now there is only one
23:46durka42one book to rule them all
23:46DrakesonI haven't read that, does he really assume Java knowledge? Is the book usable for newbies?
23:46hiredmanmany mountains, one volcano
23:47hiredmanI haven't read it