#clojure logs

2008-11-19

00:59arohnerhow do I pass a java static method to map?
01:00arohner(map Integer/parseInt my_seq) does not work
01:00abrooksarohner: IIRC, I had to add a fn/#() wrapper.
01:01arohnerthere's memfn, but that appears to only work on instance methods
01:02abrooksI used something like this before: (map #(Integer/parseInt %) ["2" "3" "4"])
01:03abrooksI do consider it a bug to have to wrap it though.
01:03arohneryeah, that's what i came up with, and I assumed there was a better way
01:04abrooksNot that I recall.
01:04arohnerthanks
01:57wlrarohner: Class/staticmethod is a macro not a function. Macros (I believe) only get expanded in the operator position of a sexp. Wrapping puts it into operator position.
02:47skritAnybody get tab completion working with clojure+slime? I get "Symbol's function definition is void: slime-fuzzy-complete-symbol"
03:21PupenoGood morning.
03:28blarfhow can i change co C-c C-l only loads the current file into the itnerpreter and doesnt switch the current window to the interpreter as well?
03:41blarfand is it possible to make error-messages clickable in emacs, i mena it must be because it is in other modes?
03:43Pupenoblarf: won't C-c C-k do that?
03:48blarfundefined, not using slime, just clojure-.mode
03:51Pupenoblarf: oh! sorry.
04:08blarfahhh clojure is such a nice lisp. i havent used scheme or common lisp THAT much but clojure is so nice to work with. and while haskell is very cool clojure is a lot more practical.
04:15Pupenoblarf: 100% agreed!
04:40blarfi have an if-else where i want to conj to a vector if but when else i dont want to do antyhing
04:40blarfwait when!
04:40blarfniot if!
04:42blarfor not
04:48blarfif i reduce with "when " does every elem has to conj something?
04:48blarfthat cant make much sense hmm. i get nullpointerexception when using reduce+when, could it be becaus eof the when-not cases?
04:49blarfyes it seems so.
04:49blarfbecause it works with another cond
04:50blarfso lets say i want to accumulate + filter, how would i do that? take element if cond and increase the last elem else nothing
04:50blarfis what iw ant to do
05:02lisppaste8blarf pasted "gen-valid-indexes" at http://paste.lisp.org/display/70707
05:02Chousukeblarf: hm, if I understand you correctly you might just be able to do (if condition (conj foo bar) foo), right?
05:02blarf^^
05:02blarfi have a big loop-recur that works, im just looking for a more elegant version
05:07blarfwait if i do distinct on yourt solution it might work
05:07Chousukeso wait, you want to filter out nils in the coll?
05:10blarfit is a tic-tac-toe board so it will be given something like: [0 0 1 0 0 9 0 1 9] where 0s are available moves and 1 and 9 are taken
05:10blarfi want to get back available moves, so in this case: [0 1 3 4 6]
05:14Chousukethe indexes for all that are zero?
05:14Chousuke(map first (filter #(= 0 (second %)) (partition 2 (interleave (iterate inc 0) coll)))))
05:15Chousukeyou need to read that starting from the end. :)
05:19Chousukeblarf: did you get my solution?
05:19blarfi was disconnected did you post anything?
05:19blarfi have a solution just annoyin g i cant find a more elegant one
05:19Chousukeokay
05:19ChousukeI got an oneliner :)
05:19lisppaste8Chousuke annotated #70707 with "one-liner" at http://paste.lisp.org/display/70707#1
05:22Chousuke= 0 can be replaced with zero? too. looks nice that way
05:22Chousukenicer*
05:24Chousukebut it seems you were trying to use reduce for something it's not suitable for.
05:24Chousukeyou generally want to use it when you need to reduce a collection into a single item
05:30blarfyes you are right
05:48blarfwhat vecrsion control system do you use? git? i have neevr used one for real, i just use git, cvs, darcs etc to pull libs and stuff.
05:48blarfcan i integrate git with emacs somehow?
05:48blarfi should go --> git
05:56tWipIf you plan to support all platforms then subversion is a safe bet
05:57tWipI don't know if git is well supported on windows/mac yet
05:57tWipand by support I mean if you have developers using those platforms
06:28Chousukeno problem with git on mac
06:28Chousukewindows support is still a bit problematic
06:35ChousukeI have to say that after getting used to git working with SVN just annoys me :/
06:35tWipI better not start using git then... can't escape SVN at work ;)
06:36Chousukefortunately git can act as a rather nice SVN client
06:37Chousukethe initial checkout with git svn is horribly slow (it checks out every possible revision from the SVN repo) but after that it's pretty much like any git repo.
06:39tWipsweet
07:00blarfanyone know of a good java-lib for opening and playing mp3s and other audio files?
07:40blarfi have a weird profiling problem (kudos btw to how easy it is to time executon-time)). i have 2 gen-all-valids funcs, one loop-recur by me which executes in 240ms and retuns the answer immediately. then i have Chousukes more elegant version that ha a much shorter execution-time according to (time) but the answer isnt delivered immediately. how could that be?
07:41blarfalso, would it be easy to write a more general profiler? that could return the results eparately for several functions? i might do one in that case
07:41rhickeyblarf: you can use Java profilers, which are abundant and quite good
07:41blarfif i do (time (f1 (f2 y))), then time times the total right? or could my problem above be because of 2 functions in one? where one is equal and the other isnt
07:42rhickeytime is for the entire expression, but if it returns something lazy, not all the work has been done
07:57blarfi see
08:07blackdog_ what's the function that does a let if a key is in a hash - been looking for 5 mins now, know it's here somewhere :)
08:08rhickeyblackdog_: unclear to me what you mean, a let can't be done by a function - do you mean destructuring of maps in let?
08:09blackdog_it's like an if-let but on a key, if key is in collection assign the value
08:09rhickeyblackdog_: otherwise what?
08:09blackdog_nil i think
08:10blackdog_sorry rhichey don't want to bother you with stupid stuff i'll keep looking, I've used it befire
08:14blackdog_duh, when-let i thought it was special for hashes
08:14blackdog_sorry for noise
08:22duck1123blarf: if you're still looking for git+emacs, look for a package called Magit. It's very nice
08:22Chouserrhickey: can we break doto soon?
08:24rhickeyChouser: I saw you'd asked about that - I guess we should, but I'm getting tired of getting beaten up for breaking things...
08:24Chouserrhickey: hehe. ok, I just wanted to remind you of the thread.
08:25Chouserrhickey: I'm ok with using my own doto->
08:25rhickeyChouser: is there a patch?
08:26Chouserthere's a macro at the top of the thread.
08:26ChouserI'd be happy to prepare a real patch if that helps.
08:26duck1123If you're going to break things, it's better to break them early rather than doing it down the road
08:27blackdog_yea, anything goes pre 1 IMO better to get it right
08:27ChouserI'm sorry I didn't remember we wanted to break doto when we broke the binding macros.
08:29gnuvinceGood day
08:29duck1123all told, it took me about 1/2 hour to adapt to all of the breaking changes, and that was only because I was doing it over SSH.
08:30tWipagreed, fixing this sooner rather than later is good
08:30blackdog_yea, the last changes weren't too arduous
08:30tWipand I don't mind migrating code if the changes are good
08:32duck1123does anyone know if anything needs to be done to adapt to the new changes to swank-clojure? I saw there were a lot of changes today, but haven't pulled yet
08:33mehrheitduck1123: if you are using the latest clojure svn, probably not
08:34mehrheitduck1123: afaik the configuration hasn't changed
08:35duck1123It's high time I clean up my clojure-elisp code anyway
08:40mehrheitrhickey: would it be sensible for isa? to return true for sets, where child is a subset of parent?
08:41mehrheitthat would allow to define methods based on a struct's/map's keys with a dispatch-fn of (comp set keys)
08:44Chousukeblarf: you can time my lazy version with (time (doall (my-function)))
08:45Chouserrhickey: http://clojure.googlegroups.com/web/better-doto.patch -- in case that helps at all
08:50Chousukeblarf: it seems your looping version is much faster :)
08:52Chousukeand my version runs out of java heap space with a million items. Laziness has its drawbacks. :P
08:57blarfif i have a function that returns a function, how can ir eturn the respresentation of the function?
08:58Chousukeblarf: so how much did you miss this time? :P
08:58Chousukeyou really need a better connection
08:58Chousukeblarf: I did some testing, and your looping version is much faster. Mine also seems to use all of java's heap space with a million items.
08:59ChousukeI guess that's the price to pay for elegance ;(
08:59duck1123why don't we have a link to the logs in the topic?
09:01rhickeymehrheit: I don't think a subset isa set
09:04Chousukeit'd allow some neat duck typing -style dispatching though. :/
09:06blarfChosuke: i see, thanks
09:07Kerris0hmm I should d/l the latest Clojure book update-release
09:07Kerris0wonder what's been added
09:08rhickeyChouser: thanks - does that patch fix all uses of doto in the core libs, if any?
09:09Chousukeguess you could define a vector of sets and then just use something like #(find-first (map #(subset? val %) sets)) as your dispatch function
09:10MarkVolkmannI thought I knew how to use (find-doc ...), but I can't get it to work this morning. Can someone show me an example of the syntax for using it?
09:10rhickeyMarkVolkmann: it just takes a string, which can be a regex
09:12MarkVolkmannHow can I find all the methods that end in a question mark? (find-doc "?$") and (find-doc "\?$") don't work.
09:12Chousuke".*\?$" ?
09:13Chousukehm, apparently escaping ? doesn't work.
09:14blarf(find-doc "coll") does
09:14blarfnah icould get \? to work
09:15MarkVolkmann(find-doc "\?") gives "Unsupported escape character: \?" using the latest version from svn this morning.
09:16Chousukegm
09:16Chousukeyou need to double the escape \
09:16Chousuke(find-doc ".*\\?$") works
09:17Chousukedoesn't even need the .* after all, apparently
09:17blarfif i have: user=> f
09:17blarfuser.fn__2578@c38157
09:17blarfhow cna i get the list-representation of f?
09:17Chousukeblarf: you can't
09:17blarfso id have to store a rep together with it then
09:18Chouserrhickey: no. inspector uses doto. I'll fix it.
09:26blarfjust wondering, i thought lisp meant having access to the AST but that is only through macros? i mean storing a list or string representation of a function isnt too bad but justn being able to do (list-rep f) would be cool. (im doing simple genetic programming)
09:27Chousukethere's no AST :p the code is the AST.
09:27blarfaha
09:28mehrheitblarf: you can define a macro, which, in addition to defining a function, saves it's representation into the functions metadata field
09:28mehrheits/funtions/function's
09:29Chousukehmm
09:29ignashi
09:29mehrheitrhickey: ok, how about a way to specify an optional replacement for isa? for separate multimethods, like one can specify dispatch functions?
09:30blarfthere is no haskell-like "data" right? what do you do when youd normally need a "data" or a class? like it is sometimes easier to graps if you have : data fun = fun { f, rep} rather than {f f-ref, r f-rep}
09:30mehrheitwould that be too much freedom?
09:30rhickeymehrheit: the problem there is caching, we discussed before
09:30blarfmehrheit: ok how do i egt that rep later then?
09:31mehrheitrhickey: oh, it must be more complicated than i thought
09:31mehrheitblarf: with meta
09:32blarfCaused by: java.lang.Exception: Can't take value of a macro: #'user/sq
09:32blarf(meta sq)
09:32ignasi am trying to use clbuild slime + clojure-swank but keep getting resource not on classpath errors, is there some know way to fix this problem?
09:32mehrheitignas: isn't clbuild for common-lisp?
09:33Chousukeblarf: mehrheit meant defining a macro that defines functions and saves their form in metadata.
09:33ignasmehrheit: yes, but it also can download cvs slime
09:33ignasI have tried doing (load "/swank.clj") but it fails when trying to find swank/core/core.clj
09:33ignaseven though i have added that to the classpath :/
09:33ignas(that's without any emacs or slime involved)
09:33blarfChou: ah i see
09:34mehrheitignas: are you using swank-clojure from git?
09:34ignasyep
09:35mehrheitthen you should use the latest clojure from svn
09:35ignashmm, now i see one of the possible causes, it is trying to load "swank/core/core.clj"
09:35ignaswhile there is "swank/core.clj" in there
09:35ignasok
09:36ignasgoing to get an svn clojure
09:38blarfthere is no haskell-like "data" right? what do you do when youd normally need a "data" or a class? hash-maps for everything?
09:38mattreplstruct-maps, but those are just optimized hash-maps that carry minimal semantics to the user
09:40ignasmehrheit: thanks, that helped
09:44blarfclojure/struct-map
09:44blarf([s & inits])
09:44blarfi dont get how to call it
09:45Chouserblarf: http://en.wikibooks.org/w/index.php?title=Clojure_Programming#Structures
09:49Chouserrhickey: http://clojure.googlegroups.com/web/better-doto-and-inspector.patch
09:50Chouserand what's cool is, if I had done an "ant clean", I would have had a compile-time error about the incorrect usage in inspector.clj
09:52drewrPretty interesting: http://is.gd/87Fr/click-moon-weinreb/
09:52drewrI don't understand most of it though.
09:58Chousukehm
09:58blarfanyone good with emacs and emacs-modes? how do i add another coloring to certain keywords? i found where to add more keywords but what if i want another color than the defualt(purple) for osme of them?
09:59Chousukewhat's wrong with the following: (def x 1) (with-meta x (assoc ^x :x 1)) ?
09:59ChousukeI get an exception
10:01cooldude127Chousuke: ^x is nill
10:01cooldude127*nil
10:01cooldude127and even so, i don't think numbers can have meta data
10:01rhickeyand with-meta only works with symbols and collections
10:07blarfhow can i list [ ?
10:08cooldude127blarf: what do you mean?
10:16blarfcooldude: ill post
10:17cooldude127k
10:19rhickeyChouser: patch applied - thanks!
10:20blarfhttp://paste.lisp.org/display/70716#1
10:21Chouserrhickey: great, thanks. shall I write up a notice for the group?
10:22cooldude127blarf: what's rand-func?
10:22blarf^^ trying to create a macro that returns a struct that has the function as one field and its rperesentation as another
10:23blarfit will be more general later but i start simple
10:23Chousukewhy a struct?
10:24Chousukea map will do.
10:24Chousukestruct-maps are just maps anyway
10:24cooldude127blarf: the error is cuz you're trying to do (list (fn ...
10:24cooldude127maybe
10:24blarfwell it doest have to be, what is better?
10:25cooldude127idk i'm quite confused
10:29cooldude127blarf: something like this maybe?
10:29cooldude127(defmacro fnrep [& rest] `[(fn ~@rest) '(fn ~@rest)])
10:30cooldude127does a vector with the first being a function, and the second being the code to create the function
10:30cooldude127could probably use a map too
10:33ChousukeFunctions allow you to attach arbitrary metadata to them, so you can do something like (defmacro defn-with-form [name & form] `(defn ~name {:form '~`(defn ~name ~@form)} ~@form))
10:33rhickeyChouser: I put a note up on the group
10:33Chousukethen access that with (defmacro get-form [fn] `(:form (meta (var ~fn))))
10:34cooldude127Chousuke: that's much cooler in my opinion
10:34Chouserrhickey: ok, I saw that. thanks again. You can send any whiners my well -- I'll do my best to console them.
10:34Chousukethat has the problem that it doesn't work with overloading function, or doctrings.
10:34Chousers/well/way/
10:34cooldude127you could write it too tho
10:34Chousukeyou'll need to make the macro somewhat more complex to support them :P
10:35Chousukemeh
10:36Chousukeblarf: you *really* need to get a new connection.
10:36abrooksdrewr: Heh -- SiCortex (where I work) is mentioned in the Cliff Click article you posted.
10:38drewrabrooks: Totally missed that!
10:38abrooks;-)
10:39abrooksdrewr: It's an interesting article. We've got some ex-Symbolics guys here.
10:40drewrI got to experience Weinreb in person at OOPSLA. Interesting guy.
10:41abrooksdrewr: The whole discussion was very interesting. Those sorts of details are where we live here at SiCortex. Azul and SiCortex have different target markets but we share a lot of similar design issues.
10:41abrooksdrewr: Cool.
10:41drewrIt's fascinating stuff.
10:42blarfwhat does ~@ do ? is that one or two symbols btw? what is gensym again?
10:45Chousukeblarf: ~@ splices a seq into another
10:45mattreplblarf: gensym is guaranteed to return a unique symbol
10:47Chousukeblarf: so for example if foo = (1 2 3), then `(1 ~@foo 3) = (1 1 2 3 3)
11:02blarfif i have an expensive function (f x) on three places and replace it with a let y (f x) , will that be faster or will clojure optimize away such things anyway?
11:03cooldude127blarf: i believe that will be faster
11:03rhickeyblarf: let will be faster
11:03mehrheitblarf: clojure can't optimize such things away, since it can't know if functions are pure
11:03rhickeyright
11:03cooldude127mehrheit: you said what i was about to
11:03cooldude127haskell could optimize that tho
11:27cemerickwow, 92 people in the channel
11:27rzezeskithere were 100 a day or two ago
11:27rzezeskifor a brief moment
11:28blarfcan i only use @ in macros?
11:28blarfabrooks: what kind of software do you write?
11:28blarfanyone here work with imagesearch/facerecognition or machine learning?
11:28cemerickThat's amazing. We were idling @ 35 or so over the summer.
11:33Chousukeblarf: ~@ only works in syntax-quoted forms, but you don't have to use those in macros :)
11:43abrooksblarf: Uh, all kinds. :) For work currently: kernel code / drivers, in-house automation/infrastructure, system management software for the product, etc.. My background is intelligent systems. I've written image recognition and machine based music transcription programs.
11:55blarfabrooks: very cool, im getting into machine learning and image recog, but have to finish high school first :)
12:03blarfis webjure or compojure the main web framework?
12:04Chouserblarf: I've not yet used either. compojure seems to have the momentum at the momeny, but I wouldn't write off webjure yet.
12:04Chouserat the moment
12:06blackdoghow is clojurescript Chouser ?
12:07Chouserblackdog: I've got it fixed up for post-AOT, but have been distracted by other things.
12:08Chousernext step is a browser repl, which is pretty close to working.
12:08blackdogit's a lot of work, i'm not suprised, but you were making great progress
12:08blackdogcool
12:11Chouserblackdog: thanks for expressing interest. Even that little bit is motivating. :-)
12:13blackdog:) i keep thinking it'd be more useful to use clojurescript as a json renderer on the client rather than the web frameworks which seem a bit dated
12:14blarfwow, this is pretty neat: http://pacific.mpi-cbg.de/wiki/index.php/Clojure_Scripting
12:15blarfthanks whoever did that exactly what i was looking for to get started
12:20blarfclojurescript is what, like javascript?
12:20blarfi mean, meant to be able to extend the browser?
12:20Chouserblarf: clojurescript is a subset of clojure that can be compiled to javascript
12:21Chouserso yes, it could be used for ajax, to write firefox add-ons, etc.
12:21Chousukebasically clojure without java compatibility stuff?
12:21Chousukeor is there something else missing as well?
12:22blarfwow, thats very cool
12:22Chouserwell it uses the same sorts of forms to interop with js that clojure uses for java.
12:22blackdogand it integrates nicely with your favorite ajax framwork, jquery etc
12:22Chousukeheh
12:23Chousukesounds really interesting.
12:23ChouserI mostly need to write up a couple examples, get it hosted somewhere other than on my home server, and then announce it.
12:24Chousukejavascript is quite important nowadays too. Is clojure trying to take over the world?
12:24Chouserit's complete enough to be useful, though I'd still like to add Refs, SortedSet, SortedMap, and a few other classes like that.
12:25ChouserChousuke: I don't want to have to use any other language, do you. ;-)
12:25Chousukeheh
12:26Chousukeis clojurescript AOT compiled to javascript?
12:26Chousukeor at runtime? or both?
12:26blackdogaot to javascript
12:27Chouserit's just a couple of functions -- pass in clojure forms and they return javascript strings
12:30blarfisnt javascript kind of scheme with curly brackets?
12:31Chouserblarf: yeah, having closures made some forms much easier to compile compared to what Rich had to do to get Java to work.
12:34cooldude127what's so great about javascript? idk i just don't really see the appeal
12:35cooldude127maybe i've done too much in the browser, idk
12:35Chousercooldude127: if you don't need javascript, then clojurescript won't be interesting to you.
12:35cooldude127oh i know
12:35cooldude127i'm wondering about just plain javascript
12:35ChouserBut if you have to write code in a context where javascript is available but java is not, perhaps clojurescript could help.
12:36Chouseroh, I see.
12:36cooldude127i was getting somewhat off topic
12:36ChousukeChouser: you might just be able to use the google thing that compiles java to javascript :P
12:37ChouserChousuke: yeah, I looked at that. gwt. I couldn't get it to do what I needed.
12:37Chouserpart of the problem is that it compiles java source, not .class files, to js.
12:38blackdogChouser, i see clojurescript is in rhickey long range plans on his todo
12:39blackdogwhat size did you get the runtime downto?
12:42Chouserblackdog: haven't made any progress on that since last we talked.
12:42blackdogit was good anyway as far as i remember
12:43Chouseron the order of 20KB
12:43Chouseras I add more Clojure classes that could increase, but there's also some tricks that could be used to reduce the size if it doesn't hurt runtime performance too much.
13:04blarfi have contrib in c:/clojure/contrib/, how can i link to it from user.clj?
13:07Chouserblarf: add c:/clojure/contrib/src to your java classpath, then use 'require' or 'use' in your .clj
13:37AWizzArdMoin Kota
13:37kotarakHi wizz
13:41duck1123I would like to see ClojureScript + MozRepl, have you tried that yet?
13:44AWizzArdWhat are good reasons in your opinion to not do commercial projects in Clojure? Let's say about 15k to 25k LOC.
13:45Chouserduck1123: interesting. But no, I haven't look into MozRepl
13:45PupenoHello.
13:45AWizzArdI mean, right now, starting next week. Not in general.
13:47ChouserAWizzArd: biggest think i can think of is relative derth of resources on best practices for design of large scale systems in Clojure.
13:48Chouseryou might get some milage out of looking into CLOS resources, and of course asking questions on the group, but you won't find bookshelves full of material like you do for Java.
13:49albinoIsn't language change an obstacle to?
13:49AWizzArdSo you mean people could not understand how to do bigger projects in mostly functional programming style?
13:50albinoDon't know if rhickey has made any claims about when the language will stop changing
13:50Chouseralbino: I don't think that's a big deal. Breaking changes are rare (excluding the last couple weeks).
13:50AWizzArdwell yes, this kind of instability is not so nice, but you are far better off when you have 15k LOC that work with Clojure 1.1 and just need to apply fixes for Clojure 1.5 instead of having nothing and need to write everything from scratch.
13:51Chouserand the recent breaking changes have been fairly superficial -- move around a couple files, do some search/replace and you're back up and running.
13:52AWizzArdI could not see what coming changes for the time ahead are needed/wanted that would break running code.
13:52ChouserAWizzArd: right. I mean, I could read through a few OO patterns books and be pretty confidant about the Accept Way to model any particular problem space in Java.
13:52ChouserAWizzArd: but in Clojure, I feel less confident, and am not sure how to learn what I need to without just doing it and seeing what works and what doesn't.
13:53AWizzArdOne problem that I see is that some bosses could be scared about if they can easily get more devs.
13:53ChouserThis is a fine approach (and even fun and exciting) for 1K or 2K LOC projects, but if you bump that up an order of magnitude, you don't want to have to redesign core subsystems half-way through.
13:54ChouserAWizzArd: yeah, but I'd say those bosses are largely incorrect. Every codebase I've ever worked on has internal APIs and features that make them each almost their own language.
13:54AWizzArdSo, while you see this as one counter-argument, would you still consider writing commercial apps in a team of 5 devs? Or do you personally think that any company should wait 1-5 years?
13:54AWizzArdChouser: agreed
13:54ChouserNo reason a new programmer who already knows Java or Lisp or even Ruby couldn't be brought up to speed on a Clojure codebase quickly enough.
13:55blackdogor javascript
13:55Chouserblackdog: :-P
13:56blackdogknowing javascript helped me understand clojure more than anything else
13:56duck1123does it make sense to measure lisp code length in LOC?
13:56Chouseroh, I see. Yea, I agree.
13:56Chouserduck1123: it doesn't make sense to measure any code in LOC.
13:56Chouserexcept in the vaguest of terms.
13:58AWizzArdduck1123: you could measure the size (in bytes) of the compiled .class files. This factors out the coding style of the lisp family
13:58AWizzArdThe tons of leading whitespace I mean.
13:58AWizzArdthe compiler can be seen as some kind of compression tool for source code
13:59abrooksduck1123: New software metric: NoP (Number of Parens)
13:59AWizzArdthe more the better :-)
13:59cooldude127lol
14:00Chousukeyou could cheat by writing all your code using vectors and providing an eval for that. :/
14:01AWizzArdSo Chouser, would you do commercial development with Clojure today, even though you see some potential objections? In a team of, say, 5 devs? Or would you prefer to wait 2 or 5 years before this becomes a real option?
14:05blackdogAWizzArd, you're LOC in clojure will drop by at least half compared with java imo, so you need only 2 devs, which may be good in the current climate :)
14:06AWizzArdblackdog: I am comparing with an existing Lisp project
14:06blackdogoh ok
14:13duck1123I always feel most productive when at the end of a session my LOC goes down
14:15AWizzArdYou could easily accomplish this by deleting your source files.
14:15duck1123I meant with no loss of functionality
14:16AWizzArdYou could reformat your code so that it fits into one line
14:16abrooksJoin separate statments with semi-colons?
14:16abrooksAWizzArd: :)
14:18duck1123I would like to see a study about the amount of time the average programmer spends formatting their code to their liking
14:19AWizzArdprobably small today, as the IDE can do this automatically for you
14:19ChouserAWizzArd: I think I would go ahead, even today. The one non-clojure project I'm involved with right now has a large C++ code base and no JVM in site.
14:20duck1123I've noticed I spend a lot of time trying to decide where I want to insert line breaks for the best asthetic effect
14:20duck1123but perhaps I'm just a bit too OCD in areas like that
14:21ChouserI'd love to move that to Clojure eventually, but the existing code base plus different deployment profile required by a JVM raises the bar a bit.
14:21Chouserfor a new project or one already using JVM, I can't think of enough reasons to wait to outweigh the benefits of using Clojure now.
14:22ChouserAWizzArd: I don't know that I count as an unbiased observer, though. :-)
14:23AWizzArd*g*
14:24duck1123wasn't there a page that showed how to call clojure code from java??
14:24duck1123I can't seem to find it anymore
14:24duck1123nvm, found it
14:25Chouserone key thought is that on a new project you have to decide very early how you're going to handle multi-threading: ignore it (assume you app will forever be essentially singel threaded), do it the classic way (deciding on your locking strategy, document how thread-safe each methoed is, etc.) or do it the Clojure way.
14:29ChouserTime from reporting of weird Boolean bug until the bug was fixed: 1 hour 9 minutes.
14:29rhickeyChouser: includes lunch
14:29AWizzArdnice
14:31blarfbad codes codebase grow exponentially, good coers codebase nlogn-ish?
14:31blarfcoders
14:32rhickeyTo Chouser's arguments pro-Clojure I'd add that while there isn't a body of advice on large projects in Clojure, Clojure was born of experience and frustration with difficulties found in large c++/c#/java projects, esp. as regards mutable state, independent of and in conjunction with concurrency
14:33rhickeylarge application-specific class libraries of dubious abstractions
14:33AWizzArdthis last point, about mutable state is also true for nearly all languages
14:33rhickeysquirreling away generic data in useless specific objects
14:33AWizzArdlike Ruby, CL or Delphi
14:34rhickeyAWizzArd: true, my experience is the former but they all have pretty much the same model
14:34AWizzArdClojure, Erlang and Haskell are one of the true exceptions here I guess
14:34AWizzArdare some of the ...
14:35blarfrhickey: would it be easy to write a matlab-interface? im mostly using python+scipy and i dont know of a java-lib/package with all those neat numerical capabilities. however matlab have loads of code for image processing while python "only" has a lot
14:35rhickey Haskell encourages specific types too
14:35AWizzArdWhat about efficiency? rhickey mentioned in his videos that typical operations on Clojure datastructures are slower (of course, they are doing more work under the hood). Somewhere there will be the break even point from being able to use many cores so easily.
14:35Lau_of_DKGood evening gents
14:36blarfrhickey: would it be easy to write a matlab-interface? im mostly using python+scipy and i dont know of a java-lib/package with all those neat numerical capabilities. however matlab have loads of code for image processing while python "only" has quite a lot.
14:36rhickeyblarf: didn't you just ask that a second ago?
14:36blarfyes sorry, doduble post
14:37rhickeyI don't know anything about matlab, being a Mathematica user
14:37cooldude127i use matlab
14:37blarffor audio processing stuff(you dt hat right?)? mathematica is way to expensive for me
14:37cooldude127with emacs :)
14:38albinorhickey: Are you planning on making a guarentee at some version release of clojure on language change? I'm just curious
14:38blarfis that possible?
14:38rhickeyalbino: yes, your money back if not satisfied :)
14:38albinorhickey: sweet!
14:39rhickeyseriously, there will be releases and branches and all that good stuff for independently managing features vs fixes, which right now come together
14:40rhickeythis will entail some release management help for me, people willing to backport fixes etc
14:41rhickeyI'm pretty sensitive about things that make me less productive though
14:41albinoyeah, appoint the ether for that kind of stuff
14:42Chousukebetter break clojure as much as you can now while it's still feasible ;/
14:43danleiis there a way to map a method inside a doto?
14:43danleilike: (map add [button text-area ..., (map #(add %) ...
14:44danleior some other way, so that i don't have to type (add button) (add text-area) (add foo)* over and over
14:46Lau_of_DKYou can consider writing a macro for setting up repetitive UI work ?
14:47abrooksrhickey: I think the release management / backporting will go much more smoothly with Mercurial/git. I suppose I still owe you some sort of summary of what that would look like.
14:47hiredmanI have a j-add macro that just .add()s the rest to the first
14:47hiredmanlisppaste8: url
14:47lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
14:48Chouserabrooks: it wouldn't be very hard to let rich manage HEAD in svn, and have a "master" git repo with all the release versions to support backports etc.
14:48lisppaste8hiredman pasted "j-add" at http://paste.lisp.org/display/70729
14:48albinoabrooks: svn can still do tags and branches :)
14:48abrooksChouser: I've considered that but that only works when there's one branch or if there's an official committer for each svn branch.
14:49drewralbino: Yeah, it can *create* branches. Pretty much useless after that. :-)
14:49abrooksalbino: Uh... No. It PRETENDS to do tags and branches. Don't get me started on Subversion... ;-)
14:49Chouserabrooks: yes, rich would be the official commiter for the only svn branch.
14:49abrooksdrewr: Right.
14:49albinoare you guys just speaking in respect to merges?
14:50danleihiredman: thanks
14:50hiredmanI think this is the first macro I wrote
14:50abrooksOh, sure, one can create a preponderance of branches in Subversion. Good luck merging them back together again in any real-world sort of manner.
14:51abrooksalbino: Merging is so weak in Subversion as to be mostly useless. Cherry-picking and rebasing are entirely missing.
14:51rzezeskiYou can merge them back, it's just harder to do so if you create massive changes and don't keep the branch in sync with the head
14:51Chousukemight prefer mercurial over git for clojure though. For better windows support.
14:51ChousukeI'm fine with it as long as it's not SVN or CVS ;(
14:51Chouserabrooks: the benefit of my recommendation is that rich could continue to ignore the VCS discussions that he finds unproductive, and the people actually doing the merges could use a sufficiently powerful tool (like git)
14:52rzezeskiCVS is definitely a nightmare, the fact that SVN doesn't treat branches or tags specially I think is a good step away from CVS
14:52danleibesides the macro, there is no way of just kinda mapping them, right?
14:52abrooksChouser: I know. I had considerations along those lines. git-svn goes a long way.
14:52Chousukedanlei: mapping what? .adds?
14:52danleimapping a method inside a doto, yes
14:52hiredmandanlei: I think I did something like it with reduce
14:53Chouserdanlei: (doseq [i [(Button.) (Label.) ...]] (.add parent i))
14:53Chouser...or some such.
14:53danleiChouser: mh, ok. thank you
14:53Chousukedoes that work inside a doto?
14:53Chouserno
14:54danleiits just calling .add on parent, so no doto required
14:54hiredmanlike (reduce #(do (.add %1 %2) %1) (concat [parent] [stuffs to add]))
14:54Chousukedanlei: (doto thingy (.something) ((fn [obj] (doall (map (.add obj %) things-to-add)))) ?
14:54Chousukeoops.
14:54Chousukemissing a #
14:55ChousukeI hope I counted the parens right, too :p
14:55danleihm
14:55Chousukethat should work with the new-style doto I think
14:57danleiok, thanks all. i guess i'll just stick with something like hiredmans macro
15:00AWizzArdWhat about efficiency? rhickey mentioned in his videos that typical operations on Clojure datastructures are slower (of course, they are doing more work under the hood). Somewhere there will be the break even point from being able to use many cores so easily. But how fast will code run on dual cores of today?
15:01ChouserAWizzArd: are you comparing to Java or something else?
15:01hiredman"faster then Ruby"
15:02AWizzArdChouser: Java or sbcl
15:02hiredmanthan
15:02danleisounds a little like "it's still fast enough for our neurons" ;)
15:03ChouserAWizzArd: Anytime you *must* have Java speed, you can write it in Java and still integrate cleanly with Clojure. So from the decision of an up-front decision, you've got coverage.
15:03blarfcan i filter in nly one sec?
15:03ChouserAWizzArd: in practice, I suspect that will hardly ever happen (depending on your problem space)
15:03Chousukeblarf: you might want to rephrase that question.
15:04Chousukefilter in only one second? sequence?
15:04ChouserAWizzArd: most modern apps aren't bound so much by slow data structres as poor algorithm choices. Clojure will help you choose good algorithms or swap in better ones as needed.
15:04AWizzArdChouser: for this commercial project this will probably not be a problem. I am thinking about my Genetic Programming lib. It runs fast in sbcl and is trivially and pretty much perfectly parallelizable, even with mutable state.
15:05ChouserAWizzArd: in some cases where you've got the "best" algorithm, but your implementation is still slow, using Java primitive types and/or Java (mutable) collections from within Clojure code will probably suffice.
15:06Chouseroh, and type hints should go in that list as well.
15:08AWizzArdthis is difficult to do in GP.. well, I will see how it performs
15:08AWizzArdWhen putting code into eval, will it be interpreted or compiled first and then run?
15:08danleiis there some kind of tutorial/overview about delivering? i have absolutely no experience with java. let's say i've just a small gui app, only one file. how would i get something double-clickable out of it?
15:09ChouserAWizzArd: there is no Clojure interpreter
15:10AWizzArdthen I will probably have to write my own eval
15:10danleisorry, if the question sounds rather stupid. a pointer to something i should read would be enough
15:10Chouserwhy?
15:10hiredmandanlei: you need to learn about jar files
15:10AWizzArdbecause compilation is not an option for most things in GP
15:11AWizzArdit will slow down the fitness function by some orders of magnitude
15:11Chouserdanlei: there's a thread on the google group
15:11hiredmanoh, yeah
15:12danleihm, ok. i'll search that thread and read some tutorial about .jar files, then i'll ask again, if there are problems. thanks
15:12hiredmansomeone (not me) made this: http://rpdillon.googlepages.com/creatingexecutablejarswithclojure
15:12danleihiredman: thank you
15:13ChouserAWizzArd: the fitness function is run very few times, I guess?
15:15AWizzArdChouser: nope, very often
15:15AWizzArdonly for complex problems it makes sense to compile the code
15:16ChouserAWizzArd: but compilation is probabl an O(n) one-time hit, and then you get all the benefits of JIT to make it run fast. Are you sure it won't be slower to interpret it each time it's run?
15:17AWizzArdMy system gets a problem description and some tools for manipulating the domain. It then will write computers programs alone, without human interaction and see how good they perform. Then the programs rewrite themselves to solve their problem better and better.
15:17AWizzArdI am very sure that for many problems it is very much faster to not compile the generated programs first before measuring their fitness.
15:19cemerickAWizzArd: I've done some GP stuff in clojure. the compiler is your friend :-)
15:20AWizzArdI will have to see how it will perform, compared against my system that runs on sbcl
15:20cemerickI suppose if you have a very simple problem domain, strictly evaluating the programs *might* break even.
15:20AWizzArdI suppose Clojure will be a bit slower
15:20cemerickdoesn't sbcl compile everything as well?
15:20danleicemerick: by default: yes
15:20AWizzArdcemerick: when you enter something in the repl yes
15:21cemerickoh, in sbcl you explicitly eval forms to force interpretation?
15:21AWizzArdbut eval has not a direct call to (compile ..)
15:21AWizzArdcemerick: of course
15:21AWizzArdif I would use compile instead the runtime will be 60x worse
15:22cemerickI've no experience to back this up, but I'd suspect that indicates a slow compiler in sbcl, not any virtue of interpretation.
15:22cemerick(experience w/ sbcl, that is)
15:22AWizzArdno, in GP one uses an interpreter in pretty much every language
15:22AWizzArdonly for a few problems a compiler is used
15:23AWizzArdif you want to do GP in a non-Lisp you do this by (in some sense) writing your own little lisp interpreter
15:23cemerickin the domains I've used GP in, the runtime of the programs themselves outstrips *any* compilation time by a wide margin. I guess it comes down to one's domain.
15:24AWizzArdhow do you think can one write a Python program for example, which writes Python programs, runs them, and let's them rewrite themself?
15:24AWizzArdcemerick: did you use GP or GA?
15:24cemerickGP
15:24AWizzArdin Lisp?
15:24cemerickMostly, yeah.
15:24PupenoAny recommendation on how to debug SQL statements when using contrib?
15:24Pupenocontrib-sql I mean.
15:25AWizzArdcemerick: so you were doing (compile ...) in your fitness function?
15:26cemerickAbsolutely. Like I said, the runtime of the programs being generated was significant, so compilation time was an easy choice.
15:26AWizzArdwell, then you must have had very specific requirements
15:27AWizzArdthis is really not common at all in GP
15:28AWizzArdfor example, if you want to generate chess playing programs, then it would make sense to compile them first
15:28cemerickIt's always been a hobby for me, so I suppose I don't know what the norms are among "serious" practitioners.
15:28AWizzArdas each of them will probably run for many minutes or even hours
15:28AWizzArdbut then again you would need hardware for several trillion dollars to get acceptable results
15:29cemerickyeah, all of the GP I've ever worked on produced programs that ran for many minutes, and often hours.
15:29AWizzArdright, then compile makes sense
15:29cemericklol -- or, just a lot of patience :-)
15:29cemericklike I said, it's a hobby
15:29AWizzArdI see
15:30cemerickAWizzArd: what is the typical runtime in your domain per individual?
15:30blarfok so anyone think they can beat an optimal tic-tac-toe-player? (well byd efinition it is impossible but anyway)
15:31Chousukeblarf: do I get to start? :p
15:32AWizzArdcemerick: it depends very much on the problem domain. If you want to solve a difficult problem then it means your search space is huge. Only problems for which generated programs can run within fractions of a second can be solved with todays hardware.
15:32AWizzArdIf you have programs that run for minutes then GP won't find a good solution. Or better said: it will find solutions only for very trivial problems.
15:32AWizzArdOr it would find great solutions after some hundred million years of runtime.
15:33Chousercompilation should take linear time based the "size" of the code being compiled, on the order of 1 or 2 milliseconds
15:34Chouserif each function is going to run any longer than that (either individually or over several trials) when interpreted, the compiled version should win.
15:35AWizzArdChouser: in a few days I can do some comparisons for you and tell you the facts.
15:35ChouserAWizzArd: ok, great.
15:36blarfwell: warning, the program is quite ugly in its present form, bloated and a functions i can probably refactor away
15:37AWizzArdChouser: and keep in mind that programs a GP system generates are usually most extremly different from what humans would write. The compiler will have to do much more work.
15:37blarfhttp://en.wikipedia.org/wiki/Tictactoe, actually step 4 in stragey might not be fully implemented, im just doing option 2(maybe thats even bad) but anyway it plays really well.
15:37AWizzArdif your problem is in a binary domain there will be thousands of (or true true)'s in your code, or something similar
15:37AWizzArdhuge chunks of ands ors and nots that do nothing at all
15:38AWizzArdthe compiled code often won't run faster, and it adds compilation overhead
15:39lisppaste8blarf pasted "tictactoe" at http://paste.lisp.org/display/70735
15:40AWizzArdSo the Clojure (eval ...) will call the compiler, is that correct?
15:42ChouserAWizzArd: yes
15:42blarffunny i was starting on some simple GP
15:42blarfChousuke ^^
15:44rhickeystep debugging very sweet in JSwat, moves between files etc just fine on compiled .cljs
15:44hiredmanwhere can I get a pre-AOT clojure.contrib?
15:44AWizzArdChouser: I will write my own interpreter then, it will be just 30-50 LOC
15:44rhickeywish it could generically display collections :(
15:44AWizzArdit is typical anyway for GP to not use Lisps eval but write ones own fast-eval instead
15:44Wodinrhickey: Hi. I'm having a problem with current versions of Clojure that goes away when I revert r1047 and 1048. See http://paste.lisp.org/display/70670 for details. Is it a bug?
15:45AWizzArdone, that is not doing as much work as eval, by just working on a few cases in the cond
15:45hiredman(. dcm getString tag) does not look right
15:46Wodinhiredman: Why not? :) It worked in the September release of Clojure (and several releases since then) but stopped again at r1047.
15:46rhickeyWodin: I saw, will look into it, it's a problem in that the compiled code has things flagged as bridge which shouldn't be, but if I allow bridge methods then other users complain because the compiler starts using bridges in the wrong contexts
15:47hiredmanWodin: maybe I am wrong
15:47Wodinrhickey: OK thanks. Not urgent. Just wondering :)
15:47Chouserhiredman: that's just a less-frequenly used format for (.getString dcm tag)
15:47hiredmanok
15:47rhickeyWodin: I haven't found a recipe that works for all cases that have come up
15:48Wodinrhickey: *nod*
15:48rhickeyi.e the change at 1047 was because someone else broke when bridges were allowed
15:48Wodinrhickey: I see
15:49Chouserrhickey: I assume you can't start with non-bridge and failing to find any fall back to bridged methods?
15:49rhickeybasically javac is producing junk as far as these modifiers go
15:49Wodinheh
15:49rhickeyso it messes up reflection, when you are trying to tell which methods are 'real' methods and which were generated by the compiler for generics
15:51rhickeymethods present in the declaration of the concrete class shouldn't be flagged as volatile/bridge but are in some cases, I think when base is abstract+generic
15:52rhickeyI asked about it here and got a collective shrug: http://groups.google.com/group/jvm-languages/browse_frm/thread/a64c755db0a91c1c#
15:52Wodinrhickey: So is it a bug in javac then? Is there a way to fix it when compiling the java code that I'm trying to call?
15:53rhickeyWodin: I doubt you have control over that
15:56WodinBased on that thread it looks like the JVM's reflection is broken. I suppose normal Java programs just don't need this level of control or something?
15:59rhickeyI guess the javac guys have code that disentangles this, but it's not exposed for the rest of us
16:00WodinWell, if that's the case, then at least there must be an answer :)
16:01rhickeyAs some people in the thread mentioned, you can figure it out from looking at the bytecode of the class, but Clojure doesn't do that, nor would I want to. Reflection should work for this simplest of jobs - telling you the declared methods.
16:03WodinSounds reasonable.
16:03WodinDid you ever ask on the javac compiler-dev list?
16:03rhickeyno, I didn't have time for that
16:04WodinOK
16:04rhickeyI have my own bugs to worry about :)
16:04Wodin:)
16:04rhickeyplus I have to deal with what's out there
16:04rhickeyIf they fix it in 7 that doesn't help me
16:06cemerickrhickey: I was going to say, there's *lots* of 1.6 compilers out there, churning out classfiles :-(
16:06WodinYes, but I suppose there's a small chance that they do it without looking at byte code or something. I know far too little about all of this, though, so that's quite possibly a stupid thought.
16:06rhickeyright, and I'm not arguing against someone following up with Sun
16:07rhickeyI figured the jruby/jython guys would know, given their proximity
16:19cemerickdo jruby/jython produce bytecode these days?
16:23walterscemerick: i think both have hybrid models
16:23walterscemerick: i.e. some AST interpretation and some bytecode
16:28albinocemerick: the jython guys are working on an AOT compiler
16:35Chouserdoes Clojure run on JVM 1.4?
16:36hiredmanI do not believe so
16:36WodinChouser: I've only ever seen mention of 1.5 and 1.6.
16:36Chouserok, thanks.
16:36hiredmanit would be cool
16:37kib2hi
16:39Lau_of_DKyo
16:54cemerickChouser: it did run well on 1.4 some months ago. I haven't checked it since then.
16:56hiredman!
16:56hiredmancemerick: special build?
16:57hiredmanwait
16:57hiredmanI may have been trying 1.2
16:57cemerickNo, right out of svn.
16:57cemerickThis was a while ago, though. Maybe April-ish?
17:18MarkVolkmannWhat does this syntax mean? #'name
17:18wwmorgan(var name)
17:19Chousernormally 'name' evaluates to the current value stored in the var named 'name'. #'name or (var name) evaluates to the Var object itself.
18:42Chouserare we not naming files with _ 'foo.bar.bing_bang.clj' for namespaces with - 'foo.bar.bing-bang'?
18:47Chouseruser=> (compile 'clojure.contrib.seq-utils)
18:47Chouserjava.lang.Exception: Namespace name must match file, had: clojure.contrib.seq-utils and clojure/contrib/seq_utils.clj (NO_SOURCE_FILE:0)
19:11Chouserah, looks like that was introduced with new :genclass at rev 1110
19:11ChouserI assume it's unintended?
19:53MarkVolkmannWhat's the shortest way to write an anonymous function that takes one argument and returns it?
19:53Chouseridentity
19:53MarkVolkmannThis works. (fn [x] x)
19:53MarkVolkmannCan I do something more like this? #(%1) This doesn't work.
19:53Chouser#(do %)
19:54MarkVolkmann% is short for %1?
19:54MarkVolkmannOr is it short for the whole list of arguments?
19:54Chouser#(%1) takes one argument and tries to invoke it and return the result
19:54Chouser% is short for %1
19:56_Jordan_Hi folks, can anyone tell me why I'm retarded and don't understand the difference between lists and vectors? Here's a stripped-down version of a function I'm writing that's confusing me greatly: http://gist.github.com/26862
20:01Chouser_Jordan_: for what it's worth, you've confused me now too.
20:02_Jordan_Chouser: ruh-roh!
20:02duck1123same here
20:05Chousersort is doing something naughty
20:05Chouser(let [x [3 2 1]] (sort x) x) -> [1 2 3] !!!
20:06_Jordan_odd, that's rather... side-effecty, right?
20:06Chouseryeah, that's really not supposed to happen.
20:06Chousukeooh
20:06mmcgranao noes
20:06ChouserBut I think I see it.
20:07Chousersort uses java's Arrays.sort, which mutates, and it looks like for a vector the vector's internal array is the one used.
20:08duck1123perhaps the value needs to be cloned then
20:09duck1123sort is already a killer of laziness
20:11_Jordan_hmm, so what would an idiomatic way to sort a vector be? Admittedly I just saw the sort function and used it :\
20:11Chouser_Jordan_: no, you're using it correctly. you found a bug.
20:11Chousukea rather nasty one too :P
20:12duck1123gumdrop for _Jordan_
20:12_Jordan_lol
20:12ChousertoArray() on almost all collections creates a new array
20:12Chouserbut on LazilyPersistentVector, toArray() returns the internal array.
20:15Chouserrhickey: are you fixing this as we speak, or should I write it up?
20:24Chouser_Jordan_: Here you go: http://groups.google.com/group/clojure/browse_thread/thread/41521728ed6fb946
20:26_Jordan_Chouser: thanks!
20:58cooldude127that is some fantastic turnaround
20:58cooldude127nice to see how quickly bugs in clojure get fixed
20:59cooldude127that's a good opinion for a language designer ;)
21:00arohnerI asked this question last night, but now that rhickey's around... :-)
21:00arohnerwhat is the best way to call a java static function using map?
21:01arohnerthe best way I've found is (map #(Integer/parseInt %) my_seq)
21:01arohnerand that doesn't look optimal
21:01rhickeyarohner: why not?
21:01cooldude127cuz it feels like it should just be (map Integer/parseInt my_seq)
21:02arohnerbecause if I had a clojure function that took one argument, I would call it like (map foo my_seq)
21:02arohnerand (map Integer/parseInt my_seq) does not work
21:02cooldude127aka static methods should be just like functions
21:02rhickeywell, Java methods are not first-class functions
21:02cooldude127AHHHHH
21:02cooldude127but i really really want them to be!
21:02cooldude127;)
21:04rhickeynot that there couldn't be sugar for that
21:04cooldude127yeah let's have sugar for that!
21:04jtoyj/j #vermonster
21:47mmcgranaIs there any way to get the absolute path of a file from within the code in that file? *file* seems to give me a relative path.
21:50lisppaste8hiredman annotated #70729 with "j-add function" at http://paste.lisp.org/display/70729#1
22:27_Jordan_If I have a function that's "returning multiple values" (e.g. returning a vector designed to be destructured), is there a naming convention or something for that? e.g. (defn +foo ...) ?
22:29Chouser_Jordan_: nope, not that I know of.
22:30_Jordan_Chouser: alrighty, thanks. (Side question: should I avoid such functions?)
22:35danlarkin_Jordan_: instead of a vector designed to be destructured could you return a hash-map instead?
22:36Chouser_Jordan_: no, I think a vector is fine.
22:36_Jordan_danlarkin: Sure. I just thought the destructuring thing was kinda neat :)
22:37Chouseryou can destructure a hash-map too, which might make sense if you think you might want to return more things later
22:40drewci think i'd rather see a hash map for >2 values.
22:42drewcand i'd rather see true multiple return values ala CL:VALUES for <2 ... but we can't win them all.
22:42drewc:)
22:43Chouserdrewc: you saw the thread with macros for using thread-locals to simulate multiple return values?
22:44drewcChouser: i didn't! got a url or a search term that will point to it?
22:44drewcChouser: nm, i think i found it.
22:45Chouserdrewc: did you? I can dig it up if not.
22:45Chouserwe need abrooks' overexpojure
22:47drewcChouser: i've found a thread that has a link to a lisppaste with a VALUES implementation.. if there is another/more i'm all eyes.
22:48Chousernot sure, but I think this is all I saw: http://paste.lisp.org/display/68919
22:49drewcyup, that's the one i found :)
22:49drewcthanks for the pointer.
22:53hiredmanhow do I terminate a sequence made with lazy-cons?
22:54hiredmanhmmm
22:54Chouseryou're building the seq with lazy-cons?
22:54hiredmannm
22:55hiredmanI was returning an infinite seq of nil, instead of nil
23:00Chouserso anyone else noticed that you can't compile namespaces with a '-' in their name since 1110
23:02mmcgranais it because of "-" vs"_" in the folder/file names?
23:02Chouserappears to be, yes.
23:02mmcgranaseems like i'm able to do it, but I've been using _
23:03mmcgranaactually i'm comfused too about what should be used - i thought at some point we had to use _ because of something internal to java, but maybe that was changed but is now broken?
23:04Chouserpre 1110 I'm pretty sure we were supposed to use - for namespaces and _ in file names
23:05mmcgranayeah that's I've been using through 1107
23:06Chouserthere are still namespaces in clojure.contrib with - in the ns and _ in the filename.
23:06Chouser...that can't be compiled now
23:07mmcgranao hm which ones?
23:10Chouser(compile 'clojure.contrib.str-utils)
23:15mmcgranai haven't been using compilation like this personally, but when i load up the repl with core and contrib in the classpath and use the above compile command, it seems to work, i can use str-join etc.
23:17Chouseryes, they work fine still without AOT
23:19mmcgranais it that you can't then use the compiled files? sorry if i'm sounding dense just trying to understand this myself and help out.
23:20Chouserwhen I run that compile command above, I get: java.lang.Exception: Namespace name must match file, had: clojure.contrib.str-utils and clojure/contrib/str_utils.clj
23:21albinoare dashes allowed in java namespaces?
23:21_Jordan_don't think so
23:22albinoI've never seen it before if they are
23:22Chouserno, it would parse as minus in Java source
23:22albinooh, right
23:25ChouserI assume the desired solution is for dashes in namespaces to be mapped to underscores in class names.
23:26mmcgranamakes sense
23:33mmcgranao ok i get the error now after upgrading to head - could it have cropped up between 1107 and 1115?
23:33mmcgranaChouser: sorry about the confusion - i took post 1100 to literally
23:35mmcgranaok im doing binary search now...
23:39Chouser1110
23:39Chousernot 1100
23:39mmcgranaa right
23:40Chouserline 4501 of Compiler.java
23:45ChouserI should probably just give up on it. I imagine rhickey will be able to fix it in 5 minutes sometime tomorrow morning.
23:46_Jordan_Hmm, is there a way to get a list/vector to destructure in the context of a function argument? e.g. so (min [3 2 5]) returns 2?
23:46mmcgranalike (apply min [3 2 5]) ?
23:47_Jordan_why yes :P thanks
23:47_Jordan_(sorry, lisp noob)
23:47mmcgrananp
23:47mmcgraname too
23:52Chouserah, got it
23:54mmcgranawhat's the deal?
23:55Chousernot sure I've got it 100%, but it's a step in the right direction to have line 4501 read:
23:56Chouserif(!nssym.toString().replace('-','_').equals(classname))
23:57Chouserns: foo.bar-baz path: foo/bar_baz.clj classname: foo.bar_baz
23:57Chouserso the nssym and the classname should not in fact be equal when there's a dash involved.
23:58Chouser...but I'm not quite sure it's loading right.
23:59mmcgranaright. it would make sense to me if clojure namespaces only used dashes and java classes and file paths only used _. if you can use one or the other in a given case then the semantics might get messy