#clojure logs

2011-06-20

02:23tsdhHi
02:23tsdhWhat's the right tool to generate API documentation for clojure projects?
02:25tsdhTill now, I've tried autotdoc-0.7.1 which fails downloading its deps, and com.fxtlabs/autodoc "0.8.0-SNAPSHOT", which fails when running "lein autodoc". I use clojure-1.3 in my project, which might be the reason for the latter.
02:27raekI'm currently using [org.clojars.rayne/autodoc "0.8.0-SNAPSHOT"]
02:27raekit is the only verision I got working
02:28tsdhraek: Thanks, I'll try that.
02:28raektsdh: you might need to clean the lib/ directory manually
02:29raekI think one "bad" version of autodoc adds something that breaks lein
02:29raek(I used clojure 1.2.1 in the project)
02:32tsdhNo, doesn't work (even after cleaning lib/ and lib/dev): java.lang.NoSuchMethodError: clojure.lang.KeywordLookupSite.<init>(ILclojure/lang/Keyword;)V
02:39tsdhIn a project.clj file, how can I specify that I need foolib in version 0.2.0 or newer?
02:40raek"[0.2.0,)", I think
02:40raekhttp://maven.apache.org/plugins/maven-enforcer-plugin/rules/versionRanges.html
02:41tsdhraek: Ah, yeah, I've missed the comma. :-)
03:10Scriptorhi everyone, so as I understand it, internally Clojure uses copy-on-write for some sequences while they're still small
03:10Scriptorbut then converts them to true persistent structures after a certain point, is that right?
03:13raek,(class {:a 1, :b 2})
03:13clojurebotclojure.lang.PersistentArrayMap
03:14raekiirc, ArrayMaps (which search linearly throught an array) are used for 8 or less entries
03:14Scriptorah, nice
03:14Scriptor,(class [1 2 3])
03:14clojurebotclojure.lang.PersistentVector
03:15raekfor persistent vectors the branching factor is 32, which basically means you get copy-on-write for vectors up to 32 elements
03:15Scriptorright, I remember reading about that, it keeps that 32-element array for performance reasons
03:28Scriptorhmm, I wonder why arraycopy is under System
03:40no_mindthere was a function that will let you check the type of a var. Cannot recall its name
03:43raekno_mind: what do you mean by "the type of a var"? it's :tag metadata?
03:43raekor the type of the value it contains?
03:43no_mindnah (type a)
03:44no_mindraek: yes, type of value
03:46raekclass is the more basic form
03:46clojurebotOk.
03:47raekthe type function simply does this (defn type [x] (or (:type (meta x)) (class x)))
03:48raekit was used to emulate types in the time before records
03:51CozeyHello - I am aot-compiling one clj file to be a ring servlet - I'm using cake, and it generates *.class files for clojure dependencies of the project - should this be so? I'd like to keep the dependencies in separate jar files, not bundled in war together with my app.
04:13Cozeyhmm. what's the status of http://dev.clojure.org/jira/browse/CLJ-322 ? - this basically is my problem, but the resolution is still in progress
04:28raekI know Leiningen has a workaround for it.
04:28raekbut it's a shame that issue hasn't been fixed yet
04:41Cozeyand cake ?
04:41Cozeyeh! only lein supports swank-cdt, only lein workarounds this one... should I migrate to it from cake?
04:51TobiasRaederMorning
04:52bsteuberMoin
04:54__name__moin
08:23Bronsa(defmacro my-if [test t f] `(([(fn [] ~t) (fn [] ~f)] ~(#({true 0 false 1} test)))))
08:23Bronsa:D
08:57schaniwhy is (seq? [1 2 3]) false?
08:59stuartsierraa Vector is not a Seq
08:59schaniyet it responds to first and rest
09:00stuartsierrayes
09:00schaniis there a predicate for whether something can be firsted and rested?
09:00stuartsierrait's Seqable.
09:01stuartsierra`seqential?`
09:01schaniah, awesome!
09:02schaniok, then follow up question: why would i care whether something is actually 'seq?', rather than 'sequable?' ?
09:03ebaxtHi, I've been trying to figure out what the idiomatic way to 'change' an element in a vector is when you don't know the index of the element. Is map the only option?
09:05schaniebaxt: i'd find out its index first and then do an assoc
09:06ebaxtschani: ok, thanks.
10:50shtutgartHi. If I'll return random number from macros, it'll be unique for each compilation, right?
10:54manuttershtutgart: what do you mean by "return random numbers from macros"?
10:56shtutgartmanutter: (defmacro rnd [] (rand-int 10)), then (defn foo [] (rnd))
10:57shtutgartnow (foo) should return unique number for each compilation?
10:59raekshtutgart: yes, it will be unique for each place where foo is expanded
11:00raek(defmacro duplicate [expr] [expr expr])
11:01raek(duplicate (foo)) --> [(foo) (foo)] --> [3 4]
11:01shtutgartraek: i guess you mean rnd, not foo
11:02raek...but it is considered bad for a macro to behave as my duplicate
11:02raekshtutgart: sorry, yes. that is what I meant... :)
11:03raek(defmacro good-duplicate [expr] `(let [x# ~expr] [x# x#]))
11:04shtutgartok :) just wanted to make sure i understand everything correctly. So macros is always expanded before compilation and can't be expanded in runtime
11:04shtutgart(except eval)
11:05raekshtutgart: yes.
11:06shtutgartok, thanks!
11:06raek...and the result of a macro is sent for expansion again
11:17ilyakhi *
11:17ilyakWhat's the best way to create a bean class in clojure?
11:18ilyakbean class is something with a bunch of setters and an (atom {}) inside
11:18ilyakfor use with e. g. spring
11:19shtutgartbean fn from clojure.core returns immutable map, so probably you have to write your own function using reflection api
11:21ilyakNo, bean fn is cool
11:21chouserilyak: deftype, as long as you have interfaces to implement
11:21chouseror reify
11:21ilyakThe problem is getting the java object to bean
11:22ilyakchouser: I don't want to write the state-management code myself so I'm looking for an existing solution
11:22ilyakbecause otherwise it's pretty trivial - :gen-class and stuff
11:22ilyakHowever, no point of writing that code if it's already there
11:22chouserusing :gen-class is trivial? whew!
11:24chouserilyak: you want to just list your properties and have something generate your getters and setters that manipulate a map in an atom?
11:24ilyakchouser: Yeah, something like that
11:24ilyakI'd like to specify what setters/getters I want and get them for free
11:25chouserI don't think I've seen anything like that. Might be a fun macro to write, though. :-)
11:36ilyakIf I have a github gist, how would I figure out its parent project?
11:39chouserI didn't know gists had parent projects
11:40manutterI think some do and some don't
11:41manutterI've created "anonymous" gists with no related projects, so I know they don't necessarily have parent projects
11:42edoloughlin[org.apache.geronimo.configs/javamail "2.2.1"] in my project.clj pulls down the whole Geronimo dist. Is there a better way?
12:00naeuhas anyone else noticed slime+swank really struggling to println data structures such as a simple vector?
12:00naeu(dotimes [x 300] (println ["hi" x])) really destroys my machine and freezes emacs
12:00naeuwhereas in a cake repl, it's pretty much instantaneous
12:04Scriptornaeu: works fine for me
12:04naeuScriptor: does it print out instantaneously?
12:04Scriptornaeu: just about
12:04manuttersame here
12:04naeucan you try 1000?
12:04ScriptorI can go up to 3000 without a problem
12:04naeuoh wow
12:04naeui'm jealous!
12:05naeui'm wondering where my bottle neck is
12:05naeuwhich versions of slime and swank are you using?
12:05manutternaeu: is this something you've just noticed, or is it always that way?
12:05Scriptorrunning xp on macbook intel core 2 duos
12:05Scriptor*duo
12:05naeumanutter: it's been this way for a while
12:06naeui have a very beefy machine - macbook pro core 2 i7 2.8GHz
12:06manutterhave you seen technomancy's blog post on the super-simple way to set up swank and emacs?
12:06naeuyeah, but i use cake
12:06Scriptornaeu: do you get the same problem if you do the same in the repl in the shell?
12:06manutterah
12:06naeubut i've tried both lein and cake and see the same results - so its not the build tool that's the issue
12:06naeuScriptor: in the repl, it's instantaneous
12:07naeuit's just in emacs
12:07Scriptordamn, and as far as you know it's the latest swank-clojure?
12:07manutterif I were you I'd still be tempted to clean out my old emacs setup and re-install using the clojure-jack-in stuff
12:08manutterwell, back up the old stuff and THEN clean it out, of course ;)
12:08naeumanutter: clojure-jack-in only works with lein though, and i need cake for my native deps
12:09technomancynaeu: leiningen from git should work with native deps
12:09naeutechnomancy: cool - nice work
12:09naeualthough to be honest, i really don't think it's either lein or cake that's the issue here
12:10technomancysure, just throwing that out there. it hasn't seen a lot of use anyway since native-deps are pretty rare. what's the specific dependency?
12:10naeuprinting via the repl is super fast, just with emacs
12:10technomancyit's fast here with jack-in, otherwise I'd blame a lack of byte-compilation
12:10naeuerm, i meant it's just with emacs that i'm seeing the issue
12:11naeutechnomancy: what does jack-in offer for the slime communication that standard swank<->slime doesn't offer?
12:11naeuor does it just set them up for you?
12:11naeuI'm running swank 1.4.0-SNAPSHOT and the latest slime from technomancy/slime on github with emacs 23.3.1
12:13naeui've tried downgrading to swank 1.3.0 and still see the issue
12:13naeui've tried both terminal and GUI versions of emacs and still see the issue
12:14naeubasically emacs rams up to 100% cpu usage as it churns and churns to print out stuff
12:14technomancynaeu: the main advantage is it's just easier to install and it picks a port for you
12:14naeutechnomancy: that sounds lovely, but i don't think it will resolve my issue
12:14naeuunless there's some config i'm missing?
12:15technomancynaeu: probably not. maybe try another distribution of Emacs? See if it happens in -nw, try compiling 24, etc.
12:15naeutechnomancy: I've tried two separately compiled versions of emacs
12:15naeubut both 23.3
12:16naeuhang on, maybe it's this durendal stuff i'm using?
12:16naeui use durendal to highlight the repl
12:16technomancytry it with emacs -Q too; relaunch and eval-buffer in slime.el
12:17naeuwhat does -Q do?
12:17technomancyoh, that would be my guess.
12:17technomancy-Q skips all dotfiles
12:17naeuah, useful
12:17naeui'm going to try without durendal
12:17naeui didn't think of that
12:17naeuhere's how i plug slime in though, in case this is way off: https://github.com/samaaron/dot-emacs/blob/master/live-config/slime-conf.el
12:18technomancywhaaa
12:18technomancywait, are you saam aaron?
12:19technomancywhoever wrote that doesn't understand what eval-after-load is for
12:19naeutechnomancy: yep, i'm sam
12:19technomancyoh, hi =)
12:19naeuand i don't understand what eval-after-load is :-)
12:19naeuyou're right!
12:19naeuand hi! :-)
12:19technomancyit's basically to set a hook to be eval'd after a given feature is loaded
12:20naeui'm still learning emacs (it's a long slow rocky road)
12:20technomancyso having both eval-after-load 'slime and require 'slime in the same file is redundant
12:20naeuah cool
12:20naeuwhich is idiomatic emacs lisp?
12:20technomancyyou can use it to improve Emacs boot time if there are features you're not going to be using in every Emacs launch
12:21naeuok, so that still doesn't make total sense to me
12:22technomancy"by the way, if you do happen to load slime at some point, here's some stuff you should do once it's loaded"
12:22naeuit seems that i'm usign eval-after-load 'slime to add two callbacks: slime setup and a statement to ignore versions
12:22technomancyit's a lot like add-hook, but it works in terms of require rather than individual defuns
12:22naeui then require slime which i assume loads it?
12:22technomancyyup, so it's not really deferred at all
12:22technomancyalso: setq is safe to do before slime loads anyway
12:22naeuif it's similar to ruby's require which loads once only like a defonce
12:22technomancyyup
12:23technomancyalso you could collapse the two slime-setup clauses
12:23naeuyeah, i see that now
12:23naeucan i combine with a do or does emacs lisp have a different form for combining things?
12:24naeui've basically avoided learning emacs lisp as much as possible as to not confuse learning clojure
12:24technomancyfor slime-setup in particular you can just add combine the two argument lists
12:24technomancydo is progn in elisp/cl
12:24naeubut now i'm pretty confident with clojure i feel i can branch out a little
12:26naeuso would this be a good clean-up: https://gist.github.com/1035929
12:26technomancyjust move the slime-setup to after the require and you shouldn't need eval-after-load
12:27technomancybut yeah, looks better
12:27naeurefresh it again
12:28technomancythumbs up
12:28naeucool, thanks
12:28technomancynp
12:28naeui really would benefit from working closely from someone that groks emacs
12:28naeu:-)
12:28naeuone day maybe
12:28technomancyone thing at a time I guess
12:29naeuabsolutely
12:29naeui feel fairly proficient with it now
12:29naeuwhich is a huge relief given the amount of work i've put into it :-)
12:29technomancyI have the benefit of having learned elisp first, so when I go back it just feels quaint. to someone who knows clojure, picking up elisp afresh would probably seem pretty backwards.
12:30mrBlissbut now slime is loaded immediately, not 'autoloaded'?
12:30naeuok, so it's definitely the durendal stuff that's killing me
12:30naeuhow annoying - i like having a coloured repl
12:31naeutechnomancy: yeah, it definitely seems backwards
12:31naeui was playing around with regexps the other day - horrrrrrrible!
12:31technomancy=(
12:32naeudoes emacs support the notion of contexts for highlighting?
12:32technomancyyou can narrow the buffer down
12:32naeui.e. if i'm in context A and I see regexp R then it means so and so
12:32technomancybut I don't think there are first-class parsing contexts
12:32naeuwhereas if I see regexp R in context B it means something else?
12:32technomancynot really
12:32naeuthat sucks
12:33technomancya friend of mine is working on a framework for building modes with real composable peg parsers
12:33naeuTextMate had that better I think
12:33naeuthat sounds great
12:34technomancyit's only in Emacs 21 that syntax highlighting was even turned on by default; back in the day it was seen as a resource hog.
12:34naeuhaha
12:34naeuwell, it's clearly a resource hog in my repl
12:34technomancy"luxury!"</yorkshiremen>
12:34technomancygood point
12:35offby1you try telling that to today's young people ...
12:35naeu:-)
12:36naeutechnomancy: so have you played with overtone yet?
12:36technomancynot yet, though once lein 1.6 is out I may give it a run. sounds like fun.
12:36naeuhave you done much dsp stuff?
12:37technomancynothing whatsoever
12:37naeuit's been a complete headfuck for me to understand
12:37technomancymy "digital art" explorations have so far been limited to a handful of Processing sketches
12:37naeuhowever, we're pretty much at the stage of working at higher level abstractions now
12:38naeuso the dsp stuff can be done by dsp-boffs and higher level musical structures can be written to trigger the audio
12:39naeuright now overtone is cool for people that know clojure and supercollider
12:39naeuwhich is basically 5 people in the world
12:39naeuwhich is pretty useless
12:39naeuso we're really working to make it much more accessible and usable
12:40naeuthe first audience with be people that know clojure and don't know supercollider
12:40naeuand then we'll move to musicians in general
12:40technomancyheh; sweet
12:40technomancyprocessing seems to have some good ideas re: making programmatic art accessible
12:40naeuprocessing is very nice
12:40technomancyshame about the syntax =)
12:40naeuhaha
12:41naeuthat's the great thing about lisps - syntax is not really an issue
12:41naeuyou can always hof or macro your way out of horrible places
12:41technomancyif you're targetting non-programmers you can skip a lot of the "forget everything you know about programming" stage; I imagine that could save a lot of time
12:42naeui'm also *very* excited to see how much leverage Clojure's concurrency stuff for music structure
12:42ejacksontechnomancy: are you implying that artists don't know anything :P ?
12:42naeui believe it will be particularly useful to coordinate multiple 'band-member's' activities
12:43naeutechnomancy: the big question is "how much programming knowledge is necessary to write music with computers?"
12:43naeuI believe it's probably a fair bit more than we'd like
12:44Scriptornaeu: As in composing regular music?
12:44naeuScriptor: it depends on what you mean by regular :-)
12:45naeui think if you stick to the declarative notation that is the standard Western Common Notation - then probably no programming knowledge is necessary
12:45Scriptorone of the programs that don't require you to directly use a programming language
12:45naeuhowever, that seems soooo limited when we have logic and other interesting notational semantics at our fingertips
12:46naeui want to be able to say "occasionally, if thing is doing something over there, and this other thing is doing that, then do something special"
12:47Scriptorhmm, that's a neat way to look at music
12:47Scriptoralmost like an event-based pattern
12:47naeuScriptor: i see it as a big coordination task
12:47naeuScriptor: absolutely, that's a nice way of thinking about it
12:47Scriptornaeu: well, as far as I know it's layering different sounds up on each other and logic thinking like that is mainly done in the head
12:47naeubut it's also only one way, i want to have multiple ways of expressing my composition
12:48Scriptorso that if you want something special to be done, you have to write it in yourself
12:48ejacksonnaeu: when you can make jazz, you have succeeded !
12:48naeuScriptor: exactly - and wouldn't it be cool if you could improvise those thoughts
12:48naeuif you had a magic music repl to try out your ideas
12:48Scriptornaeu: wait, are we talking about generating music or better ways to write music yourself?
12:48Scriptoroh
12:49Scriptorthere's a live music thing that uses a lisp dialect
12:49naeuScriptor: both - although i'm personally less interested in generating music, rather using software to augment a performer
12:49naeuScriptor: yeah, there's at least two - Common Music and Impromptu
12:50naeuCommon Music is in CL and provides many high order functions for manipulating music concepts but typically generates midi output
12:50naeuImpromptu rocks but is Mac only, relies on Core Audio and isn't open source
12:51naeuOvertone is built with Clojure and uses SuperCollider for audio synthesis and is totally open source
12:52naeuand after spending a good while with Clojure, both Scheme and CL seem a bit backwards
12:53naeuoh yeah, I forgot to mention that Impromptu is written in a Scheme
12:53naeuone thing Impromptu does have is a pauseless GC - which is the only real pain running on the JVM
12:53ScriptorI think Clojure is spoiling me in some ways, CL and Scheme just seem much less appealing
12:54Scriptornaeu: does it use Racket or its own implementation?
12:54naeuScriptor: it's own impl
12:54naeuor at least major parts are bespokely written
12:54ejacksonnaeu: have you seen the pauseless GC stuff that Azul are hawing ?
12:55naeuejackson: yeah, i've read about it whilst drooling
12:55ejacksonme2
12:55ejacksonnaeu: they might spot you a freebie for marketing porpoises
12:55naeuejackson: that would be nice, but i want to make a platform anyone can use for free
12:56naeuI want Overtone to be easy to hack on and easy to make music with
12:56naeucurrently I'm working on making Overtone easy to hack on
12:56ejacksonnaeu: sure, of course, anybody can still hack on it, but a performer can then get the Azul JVM and perform w/o pauses.
12:56naeuejackson: yeah, that's true
12:57ejacksonas i understand you just switch out the JVM be
12:57naeui wonder if anyone has had any success runnign clojure on the Azul JVM
12:57ejacksonanyway, the only instrument I can play is the fool, so I'll just move along.
12:58naeuejackson: we'll have you rocking a REPL somepoint in the future
12:58ejacksonheh.
12:58Scriptornaeu: what's the best way to learn overtone right now?
12:59naeuScriptor: come to Cambridge and hang out with me :-)
12:59naeuhaha
12:59naeuactually that's an excellent question
12:59Scriptorcambridge, MA or England? :p
12:59naeuwith no simple answer, unfortunately
12:59naeuScriptor: the original Cambridge
12:59naeunone of your American name-reuse garbage
13:00naeu:-p
13:00naeuthey could have at least prefixed the name to stop clashes like they did with York and Orleans
13:00ejacksonCherry Flavoured Cambridge (actually I was there just last week, and in Original this week)
13:01Scriptorheh, sounds good, I'll check out the screencast then
13:01naeuyeah, there are a few screencasts out there now
13:01naeuand I'm working on more
13:01naeuhttp://vimeo.com/22798433
13:01naeuhttp://vimeo.com/25190186
13:01naeuhttp://vimeo.com/25102399
13:02naeubut the last two won't be useful if you've already worked on Clojure projects before
13:02Scriptorwhich I haven't, cheers!
13:02naeuoh, then they should be pretty useful then
13:02naeuthe first is how to set up clojure with emacs
13:02naeuthe second is how to work on edge Overtone
13:03naeuyou should also join the mailing list: http://groups.google.com/group/overtone
13:03naeuthat's the best place to have your questions answered
13:04naeuand we're looking for beginner questions right now: "How do I make a simple synth?" "How to I make a basic beat?" etc.
13:04Scriptorawesome, I'll check it out
13:04naeurecently I've been spending a whole heap of time working on the guts
13:04naeuand it's starting to get pretty rock solid now
13:04ScriptorI need to find something solid to start hacking with clojure on
13:05naeuScriptor: well this is something fun and engaging to work with
13:05naeuwhich i think is an excellent plaground for learning a new language
13:05naeuit's so much nicer to say "hey, i made it play c major!" than "hey, I sorted this list!"
13:07Scriptornaeu: should be good, my musical brain cells have been collecting dust for years
13:07pdki knew one guy who went off to columbia U
13:07pdkmade a music programming language there
13:07naeupdk: nice, do you know the name of the lang?
13:07pdkit could go places as a teaching tool
13:07pdknah he just mentioned it in conversation when he came back here to visit for graduation
13:08pdkand this was a project for a compilers course so you might have already eclipsed it :p
13:10pdkare you going to have a console version of this you can interact with in clojure code or is it focusing on gui
13:10pdkyknow what would be neat actually
13:10pdkdrag and drop clojure
13:10pdksince its already a tree format basically
13:10Scriptorlike a visual languag?
13:11pdknot so much a new language but
13:11pdksince it's already putting code in nested structures
13:11pdkpicture dragging () into a scratch area to start
13:11pdkthen dragging and dropping parts of forms into the middle of the () to add to it
13:12pdklike drag () onto scratch, drag print onto scratch and it pops up "enter arguments" and you'd type text or get another scratch area to nest forms into the print
13:12pdkalso is this using midi or does it come with instruments prerecorded
13:13pdkand is the blur on the text from recording it with a camera?
13:14Scriptorquick java-ish question, when you implement the interfaces that make an object work like an array, will that object be able to work on any method that takes arrays for input?
13:15pdkare we talking ArrayList
13:15ScriptorI think
13:15pdkArrayList<type> arrays are distinct from type[] arrays
13:16Scriptorah, got it
13:18dsescleiHello. I'm working on a Clojure REPL applet. In Chrome and Safari, it works the first time it is loaded, but fails if the page is refreshed and won't work again until the browser is restarted. If two tabs are opened to the applet, however, it will work fine when the page is refreshed. I'm guessing this is a problem with caching, but not really sure how to solve it. Does anyone here have an idea?
13:18dsescleiH
13:18dsescleiHere's the applet: http://66.228.47.25/applet.html
13:19naeupdk: initially a console version - and eventually a GUI
13:19naeupdk: there's already a nice block diagram version of scheme used for music programming
13:20naeupdk: and midi is crazy old skool. The new cool is osc - open sound control, and Overtone supports both. Plus it lets you design and build your own synths using Clojure forms.
13:21naeuSo you can use Overtone to drive midi/osc devices as well as using it to build and control your own synthesisers
13:21pdkhow's overtone for cross platform compat
13:22pdkespecially considering the situation with linux sound does it make that a bit less thorny for the programmer
13:22pdkalso do you have an idea in mind for how the gui would work
13:22naeupdk, works out of the box with linux and mac, windows support is there, but a bit cobwebby
13:22pdksomething like dragging little icons that represent the forms you wrote onto musical bars?
13:22naeupdk: we have a lot of ideas, but really could do with some hacking support
13:23naeuwe're thinking of using JavaFX 2.0 when it stops being windows only
13:23pdkis this a team uni project now
13:23naeupdk: is Overtone a team uni project?
13:24pdkclojure music
13:24naeui don't understand the question, sorry
13:24pdkthe project you're doing
13:25naeuOvertone is an open source project initiated by Jeff Rose
13:25naeuI hack on it quite a bit whist at uni (I'm doing a postdoc)
13:26naeuso it's not really a uni project
13:26naeualthough it's mainly hacked on by people at uni
13:26naeubut it doesn't have any specific funding etc.
13:26naeupdk: if you have any cool GUI ideas, you should totally join the mailing list and get involved
13:26naeuhttp://groups.google.com/group/overtone
13:27naeuright, i'm off out now. Take good care everyone
13:36Scriptorare just about all the seq functions implemented using straight clojure, without java interop?
13:37dnolenScriptor: ?
13:40chouserScriptor: most of the higher-level ones, yes. Ones like first, rest, and lazy-seq interact directly with Java classes via interop
13:41Scriptordnolen: just looking at the functions listed on http://clojure.org/sequences#Sequences-The%20Seq%20library-Creating%20a%20seq
13:42Scriptordoes java not have its own partition function?
13:45chouserScriptor: if it did, it couldn't consume/produce Clojure lazy sequences, could it?
13:46Scriptorchouser: right, forgot about that
13:48Scriptoralright, time to implement them all
13:49chouserwhat!?
13:50Scriptor;)
13:51chouserimplement all the seq functions? why?
13:53Scriptora good number at least, for a lisp I'm working on
13:53chouserah
13:54chouserWhy not just use Clojure? (not a rhetorical question)
13:56Scriptorchouser: it has its own nice, sorta, but a deal of it is for fun
13:56chouserit's own "nice"?
13:56Scriptorargh, *niche
13:56Scriptorotherwise, once I figure out my next project I'll be using clojure
13:57chouserheh, ah. I understand "for fun". What about the niche makes Clojure a poor fit?
13:57Scriptornot easy to make it work with a php codebase :D
13:58chouserso if Clojure compiled to PHP ...?
13:59Scriptorchouser: well, this compiles to PHP, but it's not quite Clojure
13:59Scriptorhttp://scriptor.github.com/pharen/ if you're curious
13:59chouserWhat I'm asking is, if Clojure could compile to PHP would the only reason remaining to create your own lisp be "for fun"?
14:00Scriptorchouser: exactly
14:00chouserok!
14:01Scriptordamnit, now I have competition
14:02chousernah, I have no interest in compiling Clojure to PHP.
14:02Scriptorthough I should probably start making it more clojure-like anyway
14:02chouserBut, making Clojure easy to extend to new target platforms, now *that*s interesting.
14:03cemerick…and probably a 5-year target
14:03chousercould be
14:03gfrlogif only clojure ran on the JVM then we could take advantage of that write-once-run-everywhere quality it has
14:03chouserwe're certainly not as for down that path now as I was predicting at, say, Clojure Conj 2010
14:04hiredmanI have this idea of doing functional transforms over forms (like var resolution, etc) and using something like a secd machine for code generation
14:05hiredmanit seems nice, what little code I have
14:24ilyakWhere is the documentation for set!?
14:24hiredman~special forms
14:24clojurebotspecial forms are http://clojure.org/special_forms
14:24hiredmanpossible under java interop as well
14:29Somelauwtry (doc set!)
14:32ilyak(deftype TempDir [temp-dir] Closeable (close [this] (.forceDelete temp-dir)))
14:32ilyakWhat's wrong with this example?
14:32ilyakIn practice it fails with NullPointerException on .close
14:32chouserwhat does your use of it look like?
14:33ilyak(.close (TempDir. (File2/createNewTmpDir "www")))
14:35chouserhm, looks fine to me
14:36ilyakOops
14:36ilyak(TempDir. (File2/createNewTmpDir "www")) is NullPointerException already for some reason
14:37ilyakOh nevermind, it's auto-deref I think
15:00ilyakIt seems that ccw fails to recompile my .clj file
15:01ilyaktherefore (deftyped class doesn't get renewed
15:01ilyakI wonder how would I force ccw to actually recompile everything on save
15:02cemerickilyak: ccw isn't (intended to be) a build tool — though it does build projects in order to support its tooling functionality
15:03chousercemerick, please tell us -- what is the build tool that we should use instead?
15:03cemerickchouser: oh, stop ;-)
15:06cemerickScrew it, I'm goin' back to ant.
15:12pjstadigchouser: make?
15:13pjstadigno, something else that starts with 'm'
15:13pjstadig:)
15:13chousercemerick: Don't you dare! I don't know if I can use maven without you.
15:13cemerickbollocks :-)
15:14ejacksonthere would be a charm in naming a build system such
15:14ilyakcemerick: Well, it has run/console
15:14ilyaktherefore it shoulb be able to compile whatever it takes to present a functional run/console
15:14ilyakshould*
15:15ilyakI totally shouldn't call ant every time I want to run something in console
15:16pjstadigejackson: just as long as its not makjure or clobuild or something
15:16cemerickilyak: I was being quite sarcastic in mentioning ant, BTW
15:16ilyakMy whole project builds using ant+ivy
15:16ilyakso that's what we use
15:17technomancywhy not port ant to C?
15:17technomancycant
15:17ilyakI even had to undust https://github.com/alamar/clojure-ant-tasks
15:18pjstadigtechnomancy: *groan*
15:19ilyakby the way, I wonder why (deftype) causes such trouble
15:19clojurebotdeftype is see datatype
15:19ilyak(defrecord) surely didn't
15:19ilyakMaybe I misconfigured something
15:21dnolenso the relationship DCGs and monads becomes more interesting ... http://www.info.ucl.ac.be/~pvr/edcg.html ...
15:22dnolenalso Prolog seems like the only lang w/ macro systems as simple as Lisp ...
15:28pdkdefrecord still auto implements Object
15:28pdkdeftype starts off implementing nothing
15:41SomelauwI remember I installed clojure-jack-in, but it looks like it is gone.
15:42SomelauwSince the command doesn't work anymore.
15:57SomelauwI'll quit again using emacs and go back to vi.
16:18CozeyHello. I'm using cake and it's project.clj, but I would also like to use some of the maven functionality - like deployment to a remote directory. However, the pom.xml is overwritten by cake, and it's not possible to add a supplementary pom, except for changing a 'global' one. any tips?
16:19carllercheIs there a way to get leiningen to add a classpath only when running tests?
16:21raekcarllerche: dev-dependencies won't be included in generated jars, if that helps
16:22carllercheI'm trying to load different property files
16:36technomancycarllerche: set :dev-resources-path
16:36carllerchetechnomancy: So, the problem I'm having is that I want to set different class paths for development & tests, does lein test ignore :dev-resources-path?
16:37technomancycarllerche: are you trying to distinguish between development and test?
16:38carllerchetechnomancy: yes
16:38carllerchetechnomancy: I would like to get different property files in development & test
16:40technomancywhat exactly is the difference between development and test?
16:40carllerchetechnomancy: Mostly some config stuff.
16:40carllercheSo, I'm probably doing something wrong to be honest
16:40technomancyno, I mean... how do you tell the difference?
16:41carllerchetechnomancy: So, I am confused about that too :P lein test is obviously one way, but running tests through swank won't be able to tell
16:41technomancyyes, exactly what I'm getting at
16:41carllerchetechnomancy: So, what is confusing me is that it seems that clojure.contrib.logging needs a property file to get configured
16:48hugodanyone been able to use tools.logging with slf4j when commons-logging is on the classpath (because a dependency uses it)?
16:49technomancycarllerche: if you're trying to silence logs during tests, I recommend using a fixture and twiddling the level through the log4j api
16:49technomancyif you're using log4j
16:51hugodthe problem being that tools.logging uses commons-logging, rather than slf4j…
16:57ordnungswidrighas anybody already implemented a delegating wrapper for protocols? E.g. I have a instance x which implemenets some protocols Ps. Now I like to reify a new instance x' which implements Ps by delegating to x and which reifiy an addition protocol P2 by delegating the methods defined in P2 to another instance x2
16:58chouseryou don't want to just extend x to P2?
16:59amalloyordnungswidrig: i actually did that for deftypes and reifys this weekend
16:59amalloymight be parts salvageable for protocols?
16:59amalloyhttps://github.com/amalloy/ordered/blob/develop/src/deftype/delegate.clj and https://github.com/amalloy/ordered/blob/develop/src/ordered/map.clj, but likely to move around as i pull the delegating stuff into a more-general library
17:02ordnungswidrigamalloy: nice. it basically the same implementation I have found.
17:03amalloyordnungswidrig: "found"? is this out there already? i guess i wouldn't be surprised; i was doing all this without an internet connection
17:03ordnungswidrigamalloy: I found it out.
17:04ordnungswidrighowerver I do not specifiy the protocol methods but extract if from the protocol
17:06Somelauwwhat datatype do you recommend for a chessboard? I was considering to use a vector of vectors myself.
17:06ordnungswidrigSomelauw: no a bad choice
17:06Somelauwwhy bad?
17:07ordnungswidrigSomelauw: oh, sorry. I meant "not a bad choice" :-)
17:07amalloyi think a T got dropped in NOT
17:07Somelauweither a 't' or a ',' got dropped :P
17:07ordnungswidrigdepending on your problem domain zippers can help for easy navigation
17:07ordnungswidrigs/no/&t/
17:07ordnungswidrig*g*
17:08ordnungswidrigamalloy: to bad that in my case the delegate will return a new instance for every method invocation that leads to a newly reify delegator instance...
17:09ordnungswidrigI suppose reify is costly.
17:09amalloyordnungswidrig: no, reify should be pretty cheap
17:09amalloyjust a constructor call, with one argument for each local you close over
17:09ordnungswidrigamalloy: doesn't it generate a new java class?
17:09amalloyno
17:09Somelauwordnungswidrig: okay, thanks
17:09amalloythe compilation all happens when you load the file
17:11amalloy(let [f (fn [n] (reify IDeref (deref [this] n)))] (map f (range 5))) ;; compiles the reify once, calls its constructor five times, with a different arg each time
17:12amalloy&(map class (let [f (fn [n] (reify clojure.lang.IDeref (deref [this] n)))] (map f (range 5))))
17:12sexpbot⟹ (sandbox10562$eval12633$f$reify__12635 sandbox10562$eval12633$f$reify__12635 sandbox10562$eval12633$f$reify__12635 sandbox10562$eval12633$f$reify__12635 sandbox10562$eval12633$f$reify__12635)
17:12amalloyordnungswidrig: as you can see they all have the exact same class
17:13ordnungswidrigamalloy: I have a different case here: a macro which evaluates to a reify call where the protocol implementation functions will call the macro itself at runtime.
17:13amalloyuh
17:13ordnungswidrigmaybe I'm a little too meta here.
17:13amalloyyou're eval'ing at runtime? then yeah, everything will be expensive
17:14ordnungswidrignot a literal eval but a reify at runtime
17:14amalloyordnungswidrig: i think you're confused. my example above did five reifies, at runtime, and only compiled anything once; if you're not using eval, it's hard for me to imagine how you could do otherwise
17:14amalloydo you have some example code?
17:17manutterSomelauw: you were saying your clojure-jack-in wasn't there after you installed it?
17:17manutterSomelauw: (sry, catching up on my scrollback here...)
17:17amalloychouser: would it be wrong for me to say that it's very hard to compile something at runtime without using eval?
17:18ordnungswidrighttps://gist.github.com/82de4ebfd6a331c029a2
17:18Somelauwmanutter: yes
17:18amalloy(or, a macro that uses eval)
17:18Somelauwmanutter: I remember having installed it.
17:18chouseramalloy: hm. what about 'compile'?
17:18manutterSomelauw: I had a similar issue -- I think it was because I installed clojure-mode.el manually instead of via packages
17:18chouser(doc compile)
17:18clojurebot"([lib]); Compiles the namespace named by the symbol lib into a set of classfiles. The source for the lib must be in a proper classpath-relative directory. The output files will go into the directory specified by *compile-path*, and that directory too must be in the classpath."
17:19chouseramalloy: I think I might agree with the gist of that statement, but maybe quibble over the word "hard" or something.
17:19ordnungswidrigI'm defining a function o using letfn which call reify (via another macro). This function o is used by the functions used in the reification[sic?].
17:19manutterSomelauw: it was an easy fix, (add-to-path 'autoload "~/.emacs.d") (require 'clojure-mode) in my .emacs file
17:19amalloy*chuckle*
17:19Somelauwmanutter: So how should clojure-mode be installed. Using packagage-install?
17:20manutterSomelauw: That's off the top of my head but I think I got the syntax right
17:20chouser"undesirable" or something instead?
17:20manutterSomelauw: I had put clojure-mode.el in my ~/.emacs.d directory of course
17:20amalloychouser: i guess what i meant was "hard to do accidentally"
17:21manutterSomelauw: yeah, I think package-install is the technically correct way to do it
17:21Somelauwmanutter: After I did that, should I reinstall clojure-drop-in?
17:21amalloyordnungswidrig: that all happens at compile-time. each call to make-dispatcher will expand into a new reify body, which will be compiled as the macro is expanded
17:21manutterSomelauw: Once I did that everything worked again
17:21amalloyyou can't expand the macro "at runtime" without eval, so it will be mostly just a constructor invocation
17:21chouseramalloy: ah! yeah, that might be good
17:21ordnungswidrigamalloy: hmm, I think that's correct
17:22manutterSomelauw: I didn't need to do anything else (except open a new emacs)
17:22ordnungswidrigamalloy: but the type reported by "type" changes after every invocation of a delegated method!
17:25Somelauwmanutter: It says: Symbol's function definition is void: add-to-path
17:25amalloySomelauw: probably you want add-to-list
17:26amalloyusually that's like (add-to-list 'load-path "some-directory")
17:27SomelauwAfter doing add-to-list: Symbol's value as variable is void: autoload
17:27manutterSomelauw: Yeah, I'm not fluent in elisp yet, sorry
17:28hiredmanSomelauw: what version of emacs are you using?
17:28Somelauwme neither.
17:28Somelauwemacs 23
17:28manutterSomelauw: try (add-to-list 'load-path "~/.emacs.d")
17:28manutterSomelauw: and if that works give amalloy the credit :)
17:29SomelauwIt doesn't crash, but it doesn't work either.
17:30SomelauwBut should there be a file called clojure-mode in emacs.d?
17:30SomelauwSince I can't find that file either.
17:30SomelauwOr directory
17:31amalloySomelauw: you're looking for clojure-mode.el
17:31amalloytechnomancy: sounds like Somelauw is lost, but i don't really know the details of the "distribution"-like things you do for clojure-mode
17:32SomelauwI think I will need to reinstall it or something.
17:32manutterSomelauw: yeah it sounds like the problem you're having is different than the one I was having
17:32technomancyit should be in ~/.emacs.d/elpa/clojure-mode-1.x.x/
17:32amalloySomelauw: see, when in doubt highlight the expert's nick
17:33manutterOk, you're in capable hands here, I'll take off now :)
17:33Somelauwokay, thanks
17:33SomelauwI will try a reinstall.
17:39SomelauwOkay, I got it to work again.
17:46ordnungswidrigamalloy: I solved the mystery of runtime reification: for every macro-invokation (at the repl) you'll get a different implementation, of coure.
17:46amalloyyep
17:48ordnungswidrigI'm really lost in macro-meta-space
19:54amalloyanyone know why there aren't (or know that there in fact is) transient versions of sorted-set and sorted-map?
20:02TimMcTime for me to look up how the transients are implemented.
20:05TimMctransient takes a c.l.IEditableCollection, conj! take ITransientCollection.
20:10TimMcamalloy: sorted-{map,set} are backed by PersistentTree{Map,Set}, which do not implement IEditableCollection.
20:11amalloyTimMc: yes, i realize that. i'm asking if there's a reason they don't implement it
20:11TimMcjust exploring
20:15TimMcI'd like to know as well.
20:16amalloyTimMc: i suspect it's just a lot of work to write, and rich didn't think it was worth the time
20:18scgilardihttp://groups.google.com/group/clojure/browse_thread/thread/1281d1f7bfc6c5fa has a discussion about it (from long ago)
20:18TimMcamalloy: My guess was that you could bang on a transient and then sort it.
20:19amalloyscgilardi: thanks
20:20amalloyTimMc: not really satisfying. say i have 2M entries in a sorted set; just calling (persistent! (transient s)) would be O(n) for pouring stuff in and out of the non-sorted version
20:20amalloynlogn, really, since sorting would have to happen on the way back out
20:22TimMcHmm.
20:22TimMcDepends on how much hammering you are doing, then.
20:23TimMcIf you will mutate it n^2 times, it might be worth it. :-P
20:23hiredmanobviously we should just sit around and complain about not having pods
20:24amalloy(inc hiredman)
20:24sexpbot⟹ 3
20:36kirhmm
20:36kiractually a decent number of people here
20:37amalloykirroyale: no decent people though
20:37kirroyalewell obviously
20:37kirroyaleI'm in an irc channel
20:37dnolenkirroyale: ha! #clojure is one of the more civilized irc spots.
20:38kirroyaleThen I will most likely be in shock for a while
20:38kirroyaleI usually frequent the less civilized ones
20:38kirroyaleHowever I doubt I'd get any useful answers or even any answers at all there :p
20:49kirroyaleany decent genetic algorithm libraries written in clojure?
20:50TimMcHow much could really be shared between multiple genetic algorithms?
20:50TimMcSO much is specific to the domain.
20:51kirroyaleThat's why a framework for easily defining genetic algorithm domains
20:52TimMchmm
20:52eliantorhi everyone
20:52TimMckirroyale: I suppose a framework would be useful.
20:52kirroyaleI think so :p
20:52clojurebotTitim gan éirí ort.
20:52kirroyaleAnd given clojure is highly extensible anyway as the whole code as data thing goes
20:53kirroyaleseems like clojure/lisp is THE language to do it in
21:04eliantoris it possible to extend a protocol to a specific instance?
21:04amalloyeliantor: no, and i'm not sure why you would?
21:06dnoleneliantor: you can create a single instance that implements a protocol w/ reify though.
21:07amalloydnolen: that uses the protocol's auto-generated interface rather than the protocol itself, right? not that i'm saying that's bad for eliantor, just curious
21:07eliantordnolen: but it would not retain the identity... i mean like ruby singleton methods
21:08dnoleneliantor: what do you mean "it would not retain the identity" ?
21:08amalloyeliantor: no, you cannot modify an object once it is created
21:08dnolenkirroyale: this looks interesting, http://www.cl-user.net/asp/libs/GECO
21:09amalloydnolen: (let [x 10, implementing (reify whatever (method [this] (...use x...)))] (identical? x implementing))
21:09dnolenkirroyale: seems like protocols would be a good way to build a performant genetic algo lib along these lines.
21:10dnolenamalloy: eliantor: the desired behavior is easily preserved by implemnet equals tho right?
21:10amalloydnolen: the desired behavior is a little crazy
21:10eliantori was tring to attach values to something, like metadata... and it seemed to me a way to solve that
21:11dnolenidentical? use seems to me only idiomatic for perf reasons.
21:11eliantorbut i'm just learning :)
21:11dnolenor subtle algorithms.
21:12dnoleneliantor: so you just want to make a singleton?
21:18eliantordnolen: https://gist.github.com/1037018
21:18eliantorsuppose i want to have something like that
21:18eliantorfor a class that don't have metadata
21:19kirroyaleI'll take a look dnolen
21:19eliantoris there a way to do that? i thought that having something like ruby singleton methods, would allow that
21:20dnoleneliantor: yeah you can't add metadata to objects you don't control, even more impossible w/ primitive types.
21:21dnoleneliantor: invokeDynamic or a very fancy reflection powered macro can simplify the object case, but not the primitive case.
21:24eliantordnolen: well the primitive was just an example, it's anyhow impossible to do in a simple way for objects too... i guess.
21:25dnoleneliantor: yes no simple way. it's advantage of the Ruby/Objective-C/Smalltalk model that Clojure simply does not enjoy.
21:28amalloydnolen: since you're here, i wonder if you can help me with achieving some java performance, or figuring out why i'm not
21:28eliantordnolen: would it be heavy to support (performance wise) or is it a design choice?
21:29kirroyalereally do need to learn clojure better
21:29kirroyaleoh well
21:29dnoleneliantor: JVM limitation really - fundamentally early bound design. invokeDynamic is the proper solution.
21:29kirroyaleanyway back to idle
21:30dnolenamalloy: what's up?
21:30amalloydnolen: i'm implementing "ordered maps" that retain insertion order; my current draft is at https://github.com/amalloy/ordered/blob/feature%2Fmulti-map/src/ordered/map.clj
21:31dnoleneliantor: Clojure will probably get invokeDynamic support at some point but it's very JDK 7 centric, and Clojure supports JDK 5.
21:31amalloyi've also implemented ordered sets, layered on top of those in the same way that sets are built on top of maps in clojure.core
21:31amalloywhen i compare my (reflection-free) implementation with the pure-java implementation ninjudd did a while ago at https://github.com/ninjudd/ordered-set/blob/master/src/jvm/clojure/lang/PersistentOrderedSet.java, his is 3-4 times as fast
21:32dnolenamalloy: is this using fn maps + extend-type ?
21:32amalloydnolen: deftype
21:32amalloy(inline)
21:33amalloythe map in my deftype is for automatically delegating methods to an instance field
21:35amalloythe basic algorithm is to keep one map of keys=>[index, value] pairs, and another of index=>[key, value] pairs, so that you can do fast insertions and fast dissocs while still keeping ordering
21:35amalloyin practice i've split the key=>index/value map into two maps, so that i can delegate getter methods to the key=>value map directly
21:36dnolenamalloy: and you observe the perf difference where?
21:38amalloydnolen: conj and into are my test cases: see src/bench/set.clj. my benchmarking is to call, from swank,
21:38amalloy(do (System/gc) (time (dotimes [n 10] (into-stress-test :m (amalloy/ordered-set))))) ; and again with ninjudd's
21:40amalloyfor disj i beat the bejeezus out of him, because i overwrite the vector with nils instead of shrinking it
21:41ninjuddamalloy: you were actually beating the bejeezus out of me across the board until i suggested you change it ;)
21:41dnolenamalloy: can't run your code because of your utils dep I think.
21:42amalloydnolen: dang, sorry, i didn't push that
21:43amalloydnolen: should be on clojars now
21:43amalloythough i think i'm not even using the function from my utils anymore; you could delete the dependency if you want
21:44amalloyoh, that's a lie
21:44ninjuddoh. i misunderstood. i guess mine was faster. too bad. i was hoping to never write another line of Java again
21:48dnolenamalloy: hmm seems like lib is not on clojars yet, and you do use transform-if from yr utils.
21:49amalloydnolen: hm. i pushed, so it should be there. but i'm not actually using transform-if anymore; i'll push something with no deps in a minute
21:53amalloydnolen: updated version on github now, no dependency on amalloy-utils
21:54amalloy(additionally, clojurebot seems to think my push to clojars worked)
21:57dnolenamalloy: in checkout I only have bench/map.clj not bench/set.clj
21:57amalloydnolen: git checkout feature/multi-map