#clojure logs

2010-04-17

00:00technomancyan excellent policy
00:00slyphon:D
00:00technomancythough unsustainable in the long term
00:00slyphonzeppo is our encoder client, groucho is our storage management system
00:00slyphontrue
00:00technomancymy policy is characters from literature
00:00slyphonthen i have to switch to stooges, i guess...
00:00technomancyI just haven't thought of a project awesome enough to merit the name Orestes.
00:00slyphonhaha
00:01technomancynor Gabriel Syme, for that matter.
00:01slyphonthe funny thing is harpo is going to be our encoding job dispatch service, and his main role is going to be talking to zeppo
00:01slyphonyou know, if you can't entertain yourself
00:02slyphonahh
00:02slyphonhow about "Harold Bloom"?
00:02ajazzhello! as i understand compojure is more about C controller. what do people usually use for M model and V view?
00:03slyphondammit
00:03slyphoni was just about to send him a link to something
00:04slyphonbastard
00:04technomancyoh man, if you haven't read the Man who was Thursday... what a trip.
00:04slyphontechnomancy: omg! "Yossarian"!
00:05slyphontechnomancy: yeah, i'll check it out
00:06technomancycharacters from literature still under copyright is iffy
00:06slyphonajazz: here's some stuff i collected: http://delicious.com/slyphon/compojure
00:06sexpbot"slyphon's compojure Bookmarks on Delicious"
00:07slyphoni think sexpbot is just trying to defend against goatse.cx
00:07slyphontechnomancy: yeah, true
00:07slyphontechnomancy: i still remember when the twisted python guys got a cease-and-desist for using "twisted.sister"
00:07technomancyhah
00:07slyphoni was like "really? shouldn't they be glad someone remembers who the fuck they are?"
00:08ajazzhi, I've had problem with internet connection and I think I missed ansver on my question
00:08slyphonajazz: see above
00:08slyphonajazz: http://delicious.com/slyphon/compojure
00:08sexpbot"slyphon's compojure Bookmarks on Delicious"
00:08slyphonsexpbot: yes! thank you!
00:09ajazzthanks
00:11slyphonsure
00:12slyphondid 1.2 get released?
00:12slyphonor did someone just reformat stuff on clojure.org?
00:12slyphonoh, nvm, i'm retarded
00:12technomancymmm... just ordered the Orson Welles production of the Man who was Thursday
00:13confoundsheh
00:13technomancyshould have done that years ago
00:13slyphontechnomancy: is that the one that's set in germany
00:13technomancythe book is set in England and France
00:13slyphonahh, right right
00:13technomancyI'd be surprised if the radio production changed that
00:13slyphonthey make a movie out of it?
00:14technomancyoh man... gives me a thrill to think of the idea.
00:14slyphon:)
00:14slyphonwhy is there no def- ?
00:14technomancynot yet, but I have a friend who says if his startup Makes it Big that he will fund one. =)
00:14slyphonhahaha!
00:14slyphonnice :D
00:16slyphonman, i forgot what a nice platform linux can be for hacking in
00:18remleduffslyphon: Any rhyme or reason to when you use () vs [] in your ns macro?
00:19slyphoni started changing things over to using [] for the top level stuff, then () for the sub-names
00:19slyphonjust found it easier to read
00:19slyphonbut it's much less consistent than i'd like it to be
00:20remleduffI've been using () around :use/:require and [] everywhere else
00:20slyphonyeah, that's probably what i'll go back to doing
00:25slyphonwhat's an efficient way of creating a string with 25 "-"s in it?
00:26slyphonin ruby you just do "-" * 25
00:26hiredman,(apply str (take 25 (repeat \-)))
00:26clojurebot"-------------------------"
00:26slyphonah
00:26hiredman,(apply str (repeat 25 \-))
00:26clojurebot"-------------------------"
00:26slyphoni had ,(apply str (take 25 (repeatedly (fn [] "-"))))
00:26hiredman(nth (iterate str -) 25)
00:27slyphon,(apply str (take 25 (repeatedly (fn [] "-"))))
00:27clojurebot"-------------------------"
00:27technomancyheh
00:27hiredmanhmmm
00:27hiredmanthat iterate won't work
00:27hiredmannuts
00:27slyphon:)
00:27hiredman,reductions
00:27clojurebot#<seq_utils$reductions__730 clojure.contrib.seq_utils$reductions__730@193b8f>
00:27hiredmanthat won't work either
00:27hiredmanhmmm
00:28hiredman,(nth (reductions str (repeat \-)) 25)
00:28clojurebot"--------------------------"
00:33hiredman,(int \-)
00:33clojurebot45
00:33lrenn,(apply str (replicate 25 "-"))
00:33clojurebot"-------------------------"
00:33hiredmanrepeat is shorter than replicate
00:35arbscht,(clojure.contrib.str-utils2/repeat \- 25)
00:35clojurebot"-------------------------"
00:47technomancyremleduff: http://www.assembla.com/spaces/clojure/tickets/299-clojure-main--e-disables-stdin
00:47sexpbot"#299 - clojure.main -e disables stdin (Test) | Clojure | Assembla"
00:47technomancycross your fingers
00:48remleduffSweet~
00:48technomancycourse sometimes it takes a while for simple patches like this to get applied. =(
00:49technomancybut I'm optimistic now that Stuart H got commit access things might improve
00:50hiredmanembrace the power of community
00:52technomancyso I'm realizing always putting the dev-deps in lib is a bad idea for leiningen
00:52technomancythey sneak into the uberjar for one
00:52technomancybut also: the system classpath needs to include the dev-deps but not the main deps
00:52technomancyand the project classpath needs both
00:53technomancyso I'm thinking of keeping dev-dep jars in lib/dev/
00:53technomancythoughts?
00:56slyphonnot a bad idea
00:57slyphoni used to do that with my scala code
00:57lancepantzi haven't really investigated, but how are they treated differently currently?
00:57technomancylancepantz: they don't get pulled in by other projects that depend on your project
00:57technomancyand they should get left out of the uberjar
00:58lancepantzah
00:59remleduffWhat about .lib for dev libs?
01:00slyphonick
01:00slyphonhidden dirs ftl
01:00technomancyinclined against it
01:00technomancyslyphon: so it works OK in scala-land?
01:00slyphonyeah, sure
01:01slyphonwell
01:01slyphoni mean, as long as you recurse
01:01slyphoni used to do all my startup stuff in rake
01:01slyphonso building the classpaths was pretty easy
01:01slyphonhell $(find lib -name '*.jar') would do the trick :)
01:02technomancywe recurse already when building the project classpath, when you want both
01:02technomancyand the root classpath only wants the ones inside lib/dev
01:02technomancythe downside (and this has been true all along) is that you can't override it in project.clj
01:02technomancysince it must be known at JVM boot-time
01:02slyphonoh
01:02slyphonlein repl should include ./test
01:03slyphonimho
01:03technomancyslyphon: it will now
01:03technomancythanks to remleduff!
01:03slyphonnice!
01:04technomancywell, once this clojure patch gets applied
01:05remleduffAre you going to keep lein repl in the shell file or switch it to eval-in-project?
01:06technomancyeval-in-project, definitely
01:06technomancyit's already coded in the repl-fix branch
01:06technomancyjust needs a little more work
01:06technomancybeen waiting for this bug to be fixed for quite some time now
01:07remleduffExcellent :)
01:07technomancylots of people get confused by lein repl being a shell task
01:07technomancysince it doesn't use the project classpath
01:10slyphonhah
01:10slyphonpimpmyemacs.com is available
01:31defnIf only I could get xzibit to be the face of the site...
01:34lancepantzheh, if only there was an emac plugin for emacs
01:34lancepantz*s
01:35defni want to do a television called "Pimp My Ride (with Emacs)"
01:35defnEmacs in the headrests, customizable elisp steering wheel, etc.
01:35lancepantzhaha
01:38technomancymmm... feels good to get back to hacking lein again
02:06defnyay
04:15lancepantzconsidering anyone is here
04:15lancepantzanyone know how to get around this: Can't refer to qualified var that doesn't exist
04:20defnlancepantz: context would be helpful, although i dont know for sure if i can help, it might help someone else
04:21lancepantzgood point
04:21remleduff,(foo/bar)
04:21clojurebotjava.lang.Exception: No such namespace: foo
04:23lancepantzi have a macro in ns foo that that has a defn inside of it, when i call it from another ns, where i want the function to be defined, i get that error
04:25defnand you're (use)'ing the foo namespace in your other ns?
04:26defneither in the ns macro or via a (use 'foo)?
04:26defnmake sure you don't have circular dependencies: foo uses bar, and bar uses foo, for example
04:27lancepantzi don't think so, let me put it on a gist
04:27defnalso know that (foo/bar), means you need to be requiring foo in bar, not using it
04:27defnlancepantz: again, no guarantees -- im just thinking out loud here
04:27lancepantzyeah, appreciate it
04:29remleduffCan you gist a small example?
04:30lancepantzhttp://gist.github.com/369404
04:32lancepantzthe macro in utils works if i put it in the profile ns
04:35remleduffDoes it work if you unquote "update" (~update)
04:36lancepantzactual: clojure.lang.Compiler$CompilerException: java.lang.Exception: Unable to resolve symbol: update in this context
04:36lancepantzcrap, i have to run
04:55remledufflancepantz: My last guess, is that you need: ~'update
06:48zmila,(doc amap)
06:48clojurebot"([a idx ret expr]); Maps an expression across an array a, using an index named idx, and return value named ret, initialized to a clone of a, then setting each element of ret to the evaluation of expr, returning the new array ret."
07:36defnmorning all
07:37djpowellhi
07:39lancepantz_hi
07:40lancepantz_well i think i got that ns stuff figured out
07:40lancepantz_took me about 10 hours :)
07:44defn:)
07:44defnlancepantz: what was the problem?
07:49lancepantz_the macro was expanding into the namespace of the project it was dined in
07:49clojurebotBarking spiders!
07:50lancepantz_instead of the one calling
07:50lancepantz_so for now i'm going to have it use eval, which should work
07:50lancepantz_but i might need to give further fault to what i'm trying to do
07:50lancepantz_make sure its the right way
07:51lancepantz_give further thought that is
07:51lancepantz_that's 18 hours straight of clojure
07:51lancepantz_i think i can call it a night with that
08:00defnlancepantz: oh right!
08:01defnlancepantz: perhaps you don't want to use defn?
08:03defnlancepantz: err maybe gensym (defn update#...) ? does am i crazy?
08:03defns/does//
08:06defnlancepantz: actually, i think i may have an idea... would leveraging metadata (:namespace, for isntance) be useful?
08:06defnlancepantz: er :ns
08:20lancepantz_that's good idea defn
08:20lancepantz_i'll give it a shot in the morning
08:22lancepantz_spent all night reading graph theory papers.... again
08:26defnlancepantz: fun :)
08:33defnlancepantz: we'll have time to relax when we're dead
08:47kzarI'm trying to get my new project working. When I do (use 'controls.server) it tries to open controls/server.clj which isn't found because I've structured things like controls/src/server.clj . Should I put everything inside controls/ or is there a setting I should change?
08:52djpowellyour folder structure needs to match everything up to the last component of the package name, and the filename has to match the last component of the package name.
08:52djpowelland then you need to make sure that the root folder is on your classpath
08:54cemerickrhickey: ping
08:54rhickeycemerick: pong
08:56cemerickrhickey: morning :-) A simple case of compilation failure FYI: http://paste.lisp.org/display/97911
08:57cemerickfunny, I thought the duplicate key check was only on literals
08:58cemerickhrm, nope, createWithCheck right there in hash-map
09:02rhickeycemerick: thanks, will fix
09:03cemerickrhickey: thanks :-)
09:05cemerickso the alternative if you might have duplicate keys is (into {} (map vec (partition 2 [:a 5 :a 6]))))
09:05cemerick?
09:06rhickeycemerick: yup
09:34defnkzar: for your folder structure your project.clj should show the name of the project as "controls"
09:34defnkzar: are you using leiningen?
09:36kzardefn: Yea I'm using Leiningen, arbscht in #compojure helped me a bit. I had structured things wrong. I had done controls/src/server.clj but I needed to do src/controls/server.clj . Although to me it seems counterintuitive way to lay things out
09:37tcrayfordis there an easy way to find all parts of a tree that match a certain predicate?
09:37kzardefn: (I say that because then I've got something like controls/project.clj and controls/src/controls/server.clj, seems a bit redundant)
09:37rhickeyhow does one build contrib without running the tests?
09:38rhickeywhen test fail no jar is produced
09:39tcrayfordI'm currently using http://paste.lisp.org/display/97914 for finding all map lookups inside a tree, but it feels pretty inelegant
09:41rhickeyis there a way to get maven to show you possible targets/tasks?
09:55Norritrhickey, you could use -Dmaven.test.skip=true to ignore the tests
09:55rhickeyNorrit: thanks
09:56Norrityou're welcome
10:21rfgDoes the latest version of slime work with clojure 1.2 yet?
10:21YamNadYes.
10:24cYmenBonjour.
10:24cYmenI'm trying to get started on clojure but the installation instructions for vimclojure talk about clojars, leining, build environments or whatever and I can't figure out where to start.
10:26cYmenWhat I have done: Download and unzip clojure and clojure-contrib and tried out the repl.
10:26cYmenI also copied the usual vim plugin parts of vimclojure where they belong and that seems to work.
10:29tcrayfordfor lein, go to its github site and download/install it according to the instructions there
10:33cYmentcrayford: well it doesn't really say lein it says leining/gradle/maven/ivy
10:33cYmenso I don't know which to get..
10:36tcrayfordgo for lein
10:36tcrayfordits the standard these days
10:36cemerickrhickey: maven doesn't have targets or tasks -- there's a default lifecycle, which has a fixed set of phases (clean, compile, package, install, deploy, verify, test, etc)
10:37tcrayfordhttp://www.assembla.com/wiki/show/clojure/Getting_Started_with_Vim might help you
10:37sexpbot"Getting Started with Vim | Clojure | Assembla"
10:37cemerickrhickey: 5 minute read on the above: http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
10:37sexpbot"Maven - Introduction to the Build Lifecycle"
10:38tcrayfordthough it doesn't really cover using the advanced features of vimclojure
10:38tcrayfordhttp://www.assembla.com/wiki/show/clojure/Getting_Started_with_Leiningen covers lein
10:38sexpbot"Getting Started with Leiningen | Clojure | Assembla"
10:38cYmensexpbot: Are you talking to me?
10:39cemerickcYmen: no, it parrots the titles of all pasted urls :-/
10:40cYmenah, how pleasant :)
10:42cYmenwell..now I have leiningen
10:42cYmenHow do I add something to my "development dependencies" as the vimclojure readme wants it...
10:43tcrayfordyou have to create a project and put things in project.clj in the root of said project
10:44cYmenI don't know. Getting to the repl is dead simple...
10:44cYmenAnd setting up vim for any kind of lispy development has never been pretty..
10:45cYmenBut a standard build process would be nice
10:45tcrayfordlein is that standard build process
10:45tcrayfordjust about
10:45cYmenok
10:46tcrayfordlabrepl is pretty awesome if you're learning clojure
10:48cemerickThere's a lot of tooling denominations in clojure-land. Each group has its own way.
10:49cYmenYeah, but somebody needs to write an "Idiots guide to clojure development in vim."
10:49cYmenIs there something like that somewhere?
10:50cemerickcYmen: this is the best there is, AFAIK: http://www.assembla.com/wiki/show/clojure/Getting_Started
10:50sexpbot"Getting Started | Clojure | Assembla"
10:50tcrayfordthe easy way is probably just to use a repl and plain old vim
10:51tcrayfordlein only really comes into play when you're doing projects/want more functionality than repl/vim gets you
10:51cemerickI'm always astonished that anyone uses vim for lisp-related development.
10:51tcrayfordI can understand it
10:51tcrayfordwhen you're entrenched in vim, going to emacs feels very difficult
10:52cemerickyeah, inertia is a big factor in any case
10:53cemerickprobably the biggest, actually
10:53tcrayfordyeah
10:53cemerickthe actual productivity differences for straight editing of code is probably effectively nil
10:53tcrayfordI think I'm slightly faster in vim for straight text editing
10:54tcrayfordbut when you put paredit into play...
10:55cemerickwell, I don't use emacs either :-)
10:55tcrayfordwhat do you use?
10:55cemericknetbeans and enclojure
10:55tcrayfordfair nuff
10:56cemerickthough I've been eyeing the progress of other IDE plugins as well
10:56tcrayfordI'd miss refactoring support :/
10:56cemerickrefactoring support?
10:56tcrayfordI wrote a refactoring tool for clojure/emacs/slime
10:57cemerickanything more than orchestrated grep? :-)
10:57tcrayfordyeah
10:57tcrayfordI can thread/unthread expressions (using both ->> and ->), add map destructuring to functions automatically
10:57mefestohey everyone. noob here. just wondering what is meant behind putting an asterik at the end of a function's name?
10:58cemerickmefesto: that generally indicates a subordinate fn to the primary non-asterisk'ed fn
10:58tcrayfordand extract method works well enough
10:58cemericktcrayford: linky?
10:58cemerickit all sounds great, and just a little scary
10:59tcrayfordits not that sound yet
10:59tcrayfordas in, you want to have tests on code you're running through it
10:59mefestocemerick: so typically only used by the non-asterik'ed fn?
10:59tcrayfordhttp://github.com/tcrayford/clojure-refactoring
10:59cemerickmefesto: generally, yeah. You also often see asterisk'ed fns backing up a non-asterisk'ed macro of the same name that adds some sugar, etc.
11:00tcrayfordthe backend is all in clojure, so you could probably write a frontend to it for anything else (assuming you have a running clojure connection) pretty easily
11:00mefestocemerick: ok i understand, thanks :)
11:01tcrayfordI've been meaning to play around with clojure's namespacing functions so I can do proper function renaming and inlining (neither of those are implemented at all yet)
11:02cemerickwere there ever any successful refactoring systems for CL or scheme?
11:02tcrayfordI don't know
11:02tcrayfordnot sure anybody ever tried it
11:02tcrayfordits super easy with the whole code=data thing
11:03cemerickIt'd take quite a bit of convincing for me to use a refactoring tool in a dynamically-typed lang.
11:03tcrayfordaye
11:04cemerick*if* we could get everyone to use require and properly namespace their fn usage, then I might trust renames. :-)
11:04tcrayfordsmalltalk's one for example
11:04tcrayfordyeah I'm still iffy about actually implementing renames
11:05tcrayfordthe current stuff is all local to one function
11:07technomancyrefactoring in clojure is a *lot* easier than stuff like Ruby
11:07tcrayfordc
11:07tcrayford*confirm
11:07technomancysince just loading a file can tell you all about what vars mean what
11:08technomancyfor top-level vars at least
11:08tcrayfordyep
11:08tcrayfordI need to get onto doing renames using the ns functions soon
11:08technomancytcrayford: actually what we need to do is get slime xref working
11:08technomancythat would make renames super-easy
11:08tcrayfordtechnomancy: xref?
11:09technomancycross references. "given this function, tell me everyone who calls it"
11:09tcrayfordaye
11:09tcrayfordI was about to write something similar for refactoring-mode
11:10tcrayfordcan I use slime with slime?
11:10technomancywell all the elisp for it already exists
11:10technomancyyou'd just have to port the CL implementation to Clojure
11:10tcrayfordright
11:10technomancy"just"
11:11tcrayfordis there a common lisp implementation I should be looking at for that?
11:14technomancyhttp://github.com/nablaone/slime/blob/master/swank-backend.lisp#L907
11:15tcrayfordcheers
11:17technomancythat would be super-slick to have
11:18tcrayfordaye
11:21cemerickrhickey: defrecord/type names should be CamelCase, yes?
11:21rhickeycemerick: yes
11:22tcrayfordtechnomancy:If I'm right, this should go under src/swank/commands/basic?
11:22cemerickjust checking
11:22tcrayfordtechnomancy: seeing as there's already some basic xref (who specializes) stuff in there
11:22cemerickthere'll be pitchforks raised for that ;-)
11:22rhickeycemerick: and not Camel-Case
11:22cemerickheh
11:23cemerickI'd hope not!
11:23cemerickheh, Read-JSON-From
11:23cemerickwell, it's changeable. Surely no one's extended it elsewhere at this point. :-)
11:24cemerickbig improvement there since 1.1 contrib
11:26djpowelloops - I posted a patch to contrib' assemba space, rather than clojure - I guess I just have to close the issue, and raise a new one
11:26technomancytcrayford: sure
11:31tcrayfordtechnomancy: this might be a while, got to get to grips with how swank-clojure is organised first
11:38tcrayfordtechnomancy: the real problem (as I see it), is that who-calls (etc) all take function names, where for clojure you want namespace qualified function names
11:39tcrayfordotherwise you might be find all the calls to 'join' (for example), which might refer to somebody's string utils, somebody's sql lib etc etc etc
11:44mefestoi noticed that add-classpath is deprecated. is it meant to force users to call (clojure.lang.RT/addURL) instead?
11:48rhickeymefesto: dynamically modifying the classpath is not something that can be made to work portably in all execution environments, i.e. it shouldn't be in your code.
11:50tcrayfordwhat does #'sym expand out into?
11:52tcrayfordnvm, it's var
11:55mefestorhickey: ok. i just wanted something that would support a quick write/reload cycle while in development mode but wouldn't be used when deployed.
11:58tcrayfordanybody know why this won't evaluate?
11:58tcrayford(defn does-namespace-refer-to-var? [variable namespace]
11:58tcrayford (some #(= (second %) (var variable)) (ns-map namespace)))
11:58tcrayforderror is: "Unable to resolve var: variable in this context"
12:02BorkdudeWhen syntax-quoting something with locals, how do keep them from resolving to fully qualifying names
12:02tcrayford~'
12:02clojurebotI don't understand.
12:03tcrayford,`(~'defn [a] 1)
12:03clojurebot(defn [sandbox/a] 1)
12:03Borkdudeah tnx
12:03tcrayford,`(~'defn [~'a] 1)
12:03clojurebot(defn [a] 1)
12:16tcrayfordtechnomancy: also swank might have to add contrib as a dependancy (it doesn't have it atm)
12:19technomancytcrayford: what for?
12:20tcrayfordsource
12:20tcrayfordin repl-utils
12:20technomancyit's already able to find where a var is defined using M-.
12:20technomancycould probably piggy-back off that mechanism
12:20tcrayfordwould be easier with source though
12:21technomancywell do whatever's easiest for a first run
12:21technomancythen we can iterate on a more self-contained approach once it works
12:22tcrayfordyep
12:44bpsmI'm seeing intermittent crashes when mvn runs test-complex-numbers.
12:45bpsmRace condition in protocols?
12:45bpsmhttp://groups.google.com/group/clojure/msg/7b667f653513b769
13:05rfgYay, finally got 1.2 to work with slime.
13:23rfgAnd now it has stopped working again...
13:28rfgSymbol's function definition is void: swank-clojure-reset-implementation?
13:53Raynes(clojure.contrib.io/slurp* "http://groups.google.com/group/clojure/browse_thread/thread/5007718945a3046f&quot;) <- Any idea why this throws a "Server returned HTTP response code: 403 for URL:"?
13:53RaynesThe link works.
13:56vegaiRaynes: also wget does the same
13:56RaynesThat's odd.
13:56RaynesFirefox says it's okay.
13:56Raynes:(
13:56vegaiperhaps it's some authentication scheme that the dumb clients can't do
13:56RaynesMaybe so.
13:57RaynesIt certainly takes away most of the point of having a title-scraping bot in here though. :|
13:57RaynesIt would be most useful against groups links.
13:59vegaihave you tried setting your user-agent to look like a browser?
14:02RaynesI'm not sure how I would do that.
14:02vegaime neither ;) but that might work
14:02RaynesHehe.
14:18@chouserdid direct binding show up in 1.1, or since then?
14:18@chousersorry, "direct linking"
14:20@chouserlooks like it was in 1.1
15:11caljuniorI'm doing the Vladimir Konrad's tutorial on creating a GUI with Netbeans and using it with Clojure. But when I try to import the Java class (MainFrame.class in this case) I get a class not found exception. CLojure is looking for MainFrame__init.class.
15:11caljuniorThe tutorial is here: http://www.dearm.co.uk/cgan/
15:11sexpbot"Clojure, GUI and NetBeans"
15:11caljuniorIs excellent.
15:12texodusHas the api for deftype/defprotocol changed recently?
15:13texodusjust updated clojure-1.2.0-master-SNAPSHOT from clojars and factory function for deftype doesnt seem to exist anymore ...
15:13hoecktexodus: yes, use the constructor instead
15:13texoduswhat constructor?
15:13hoecktexodus: (deftype Foo [a b] ...) -> (Foo. a b)
15:13texodus(deftype Foo [x y]) -> (Foo. 1 2) ?
15:14texodusah
15:14hoeckFoo. is the constructor
15:14caljuniorsexpbot: that's how I found the tutorial. I followed it to a tee.
15:14hoeckshould be documented in deftypes docstring
15:16texodus'tis
15:16texodusthanks
15:16hoeckcaljunior: sexpbot is a bot and only prints the title of posted links :)
15:17joshua-choiSo you use (Foo. 1 2) instead of (Foo now)?
15:17hoeckyes
15:17caljuniorhoeck: doh!
15:17hoeckand there is now deftype and defrecord
15:18joshua-choidefrecord is just deftype with IPersistentMap, right?
15:18hoeckright
15:18hoeckcaljunior: and you did (import 'gui.MainFrame) ??
15:18texodusah
15:18texodusclever
15:18texodusthats helpful
15:19caljuniorhoeck: I did.
15:19caljuniormore familiar with clojure than java
15:19tcrayfordis there any decent way to find out if a namespace actually USES another function it refers to?
15:20caljuniorhoeck: correction. I didn't. Misread your suggestion.
15:21hoeckcaljunior: you did use or require?
15:21caljuniorhoeck: seems to make a difference. Now I get a different NoClassDefFoundError. This is progress.
15:21tcrayfordCurrently I've been looking up the source code of each var in the namespace to find if it calls said function, but that requires disk access, and is slow
15:23caljuniorhoeck: with (use 'gui.MainFrame) and (require 'gui.MainFrame) I get java.io.FileNotFoundException: Could not locate gui/MainFrame__init.class
15:23hoeckcaljunior: use and require are for clojure namespaces
15:23caljuniorwhich is correct because i/MainFrame__init.class doesn't exist. just MainFrame.class
15:23hoeckcaljunior: import is for java classes
15:24hoeckso it should be (import 'gui.MainFrame)
15:25hoeckwhen you do (use 'gui.MainFrame), clojure actually looks for a gui/MainFrame.clj or a gui/MainFrame__init.class (which resembles a compiled clojure namespace)
15:26hoecktcrayford: mhh, you could read the bytecode of each function and try to find calls to other functions, but that sounds not like "decent" to me :/
15:27caljuniorin principle, can I use swank-clojure-project, set the project root to the directory of the Netbeans project add a lib directory with clojure.jar and swank-clojure.jar and (import 'gui.MainFrame) ?
15:27caljuniorI tried and failed.
15:27tcrayfordyeah it sounds indecent
15:27tcrayfordproblem with the current method is "Elapsed time: 129922.729 msecs"
15:28tcrayfordfor a resolving of one var across all namespaces
15:29tcrayfordand that's with an ssd
15:32hoeckcaljunior: where does netbeans keep the compiled classes?
15:32hoeckcaljunior: in classes/ ?
15:34hoecktcrayford: thats really long
15:34tcrayfordhoeck: especially if its meant to be used in an ide/refactoring tool
15:35hoecktcrayford: how do find out wether some code calls a function?
15:35hiredmanyou look for calls to IFn.invoke
15:35tcrayfordthat's roughly the question I'm trying to answer, yes
15:36tcrayfordhiredman: how?
15:36hiredmanwhatever your prefered method of bytecode inspection
15:36hiredmanassuming compiled code
15:37tcrayfordI don't think all of this is (not AOT compiled anyway)
15:37hiredmanalthough, that will also find stuff like (:foo {:foo 1})
15:38tcrayfordhiredman: not just any function, one particular function
15:38hiredmanthen you just look for the head of lists
15:38Chousukeso what, you need to find all references to a var?
15:38tcrayfordthat's the aim
15:38caljuniorhoeck: I did ln -s build/classes/gui/ . as per the tutorial. This created MainFrame.class MainFrame$1.class and MainFrame$2.class.
15:38hoeckbut what about (let [head first] (head [1 2])) ?
15:39hiredmanthere is a namspace walker in contrib
15:39hiredmanyou might also like at my clojure-dependeny-grapher on github
15:39hiredmanlook
15:40hiredmanthere is a branch that uses the namespace walker stuff
15:40Chousuketcrayford: It seems to me that to do this the right way you need a code analysis tool that is more advanced than the clojure compiler :P
15:40hoeckcaljunior: but that tutorial says you should "." add the the classpath
15:40hoeckcaljunior: and it looks like swank-clojure-project puts only lib, src, test and classes onto the classpath
15:41hoeckcaljunior: so try to link or copy build/ to classes/
15:41tcrayfordChouske: its looking that way at the moment
15:42caljuniorthat's true. it was a separate track I was pursuing though.
15:42caljunior"link or copy build/ to classes/" trying now
15:43hiredmanI think it certainly is not trivial, but an 80% solution would not be that difficult
15:43tcrayfordaye
15:43hiredmanonce it's usable you have all the time in the world for people to submit little bug fixes here and there as they use it
15:43tcrayforddoing it from source code on disk is horribly slow though
15:44caljuniorgui-project
15:44caljuniordoh!
15:44Chousukeor you could start working on the compiler for clojure-in-clojure with the explicit aim of making it useful for refactoring tools as well ;-)
15:44hiredmantcrayford: you are going to have to load the code from disk no matter what
15:45tcrayfordaye
15:45hiredmanChousuke: !
15:45tcrayfordwhat is the ns-walker in contrib called?
15:45hiredmanI don't recall
15:46hiredmanhttp://github.com/hiredman/clojure-dependency-grapher/blob/find-namespaces/dep.clj
15:47tcrayfordfind-namespaces it is
15:49hiredman♥ ->
15:50tcrayfordI guess a point could be restricting it to namespaces outside of clojure core and contrib (for the moment)
15:52hiredmanI think it would be restricted to namespaces in the directory tree you set it loose on
15:52tcrayfordyep
15:52tcrayfordwhich, given this is running from swank (and hopefully, lein), should be doable
15:54caljuniorhoeck: no joy. but (import 'gui.MainFrame) in clojure instance booted from Netbeans project directory seems to be working now. Now I get another exception: java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group but that's my problem. Thanks.
15:55companion_cubehi there, i would like to write an irc bot in clojure (so original), and wondered if an irc lib was available...
15:56hiredmanthe are several java irc libs and maybe two clojure libs
15:56hiredmanthe java libs tend to be well tested and mature, the clojure libs maybe less so
15:57hiredmanthe only lib I've used is the java pircbot
15:57hiredmanvery simple
15:57companion_cubeother question : is it easy in clojure to load/reload/unload code ? for example, if i want to have "plugins" to be loaded or unload dynamically ?
15:58hiredmanbut most (java) people seem to prefer jerklib
16:01hoeckcaljunior: you can also use this to examine the current classpath: (->> (System/getProperty "java.class.path") (.split (re-pattern (System/getProperty "path.separator"))) (map println) dorun)
16:02caljuniorhoeck: I usually do: (System/getProperty "java.class.path") but yours prints more nicely.
16:03hoeckcaljunior: ah, okay, then nevermind :)
16:03companion_cubein fact, i should better read some existing code before :/
16:03caljuniorthe classpath contains the default swank-clojure stuff.
16:03companion_cubeis sexpbot/clojurebot code available ?
16:05tcrayfordoops
16:05tcrayfordwas using ns-map instead of ns-interns
16:05tcrayfordnow takes ~1s
16:05tcrayford7s if you include all namespaces
16:22ordnungswidrighi
16:22ordnungswidrigdoes anyone know of a comparision of clojure couchdb client libraries?
16:24AWizzArd~seen rhickey
16:25clojurebotrhickey was last seen in #clojure, 276 minutes ago saying: mefesto: dynamically modifying the classpath is not something that can be made to work portably in all execution environments, i.e. it shouldn't be in your code.
16:26tcrayford~seen technomancy
16:26clojurebottechnomancy was last seen in #clojure, 245 minutes ago saying: then we can iterate on a more self-contained approach once it works
16:28AWizzArdhiredman: does clojurebot ignore his own comments? Or could it go into an endless loop if I ask if it has seen me, and it then says that the last thing I said was this seen command, which would then trigger it to do it over and over again?
16:30hiredmanAWizzArd: how would that put it in an endless loop?
16:30arohner~seen tcrayford
16:30clojurebottcrayford was last seen in #clojure, 3 minutes ago saying: ~seen technomancy
16:30hiredmanclojurebot's responses are not prefixed with a ~ or clojurebot, so they are obviously not addressed to clojurebot
16:30arohnerempirical proof :-)
16:30AWizzArdk ;)
16:31cp2not to mention outgoing PRIVMSG commands arent sent back to your client
16:31cp2the client in this case being clojurebot
16:31cp2er, that is, clojurebot doesnt receive its own messages
16:32hiredmanpircbot may actually loop it's own privmsgs back through the onMessage handler, I don't recall
16:32cp2last i knew it didnt, could be wrong though
16:33cp2,(println "~seen foo")
16:33clojurebot~seen foo
16:33hiredmanI didn't actually answer AWizzArd's question
16:33AWizzArdit’s answered enough, thanks
16:34hiredmanclojurebot may ignore things it says, I don't recall
16:41_schulte_seems like it'd be dangerous if it didn't ignore itself, e.g. ((fn [a] `(~a '~a)) '(fn [a] `(~a '~a)))
16:54ordnungswidrigif ns foo.bar has (ns (:use foo.bar.baz)) wont (ns (:require foo.bar :as x)) expose the var from foo.bar.baz in ns x ?
16:54ordnungswidrigsuch that x/qux is foo.bar.baz/qux
17:00cYmenhm...I think running lein deps in the labrepl directory is installing a new version of clojure
17:00tcrayfordit will be, yes
17:01tcrayfordinto that directory
17:01cYmeninside it?
17:01tcrayfordyep
17:01cYmennot somewhere global?
17:01tcrayfordinside the lib folder
17:01cYmenhmhm
17:01tcrayfordin labrepl
17:03tcrayfordthat way your dependancies are separated for each project
17:28cYmen"Clojure is impure, in that it doesn't force your program to be referentially transparent, " what does this mean?
17:28opqdonutthe value of a variable (or reference, rather) can change
17:29opqdonutmostly because of java
17:29opqdonut(let [a (HashMap.)] (.put a 1 2))
17:30opqdonutthat actually mutates the structure that a points to
17:30cYmenok
17:30cYmenthanks
17:51erikcw1can anyone point me to an example somewhere that uses fixtures from the test-is lib? I'm having trouble figuring out setup/tear down...
17:51hiredmanfixtures get passed the test as a function
17:52hiredmanso something like (defn my-fix [f] (binding [somevar false] (f)))
17:53erikcw1so where do I put use-fixtures?
17:53hiredmanat the top of the file with all the tests
17:54hiredman(use-fixtures :each my-fix)
17:54hiredman,(doc clojure.test/use-fixtures)
17:54clojurebot"; Wrap test runs in a fixture function to perform setup and teardown. Using a fixture-type of :each wraps every test individually, while:once wraps the whole run in a single function."
18:03RaynesSorry about the abundance of joins and quits there. One of those bugs that you think you've fixed 5 times before you actually fix it, and by then you've already annoyed everyone.
18:16unlinkWould anyone be interested in collaborating on an interface to Interactive Brokers' TWS API?
18:20hiredmanwhatever happened to reify's volatile fields?
18:36cemerickhiredman: that's all moved to deftype I think
18:37hiredman,(macroexpand-1 '(fn [a] a))
18:37clojurebot(fn* ([a] a))
18:38hiredmanthat list in there is annoying
18:39hiredmanmakes a naive approach of examining macroexpands for function calls difficult
18:39tcrayfordI hadn't thought of checking macroexpands for function calls
18:39tcrayford:/
18:40tcrayfordthough my current way will just show up the original macro
18:40cemerickhiredman: that's just the way it is to support multiple arities, no?
18:40hiredmanuser> (desugar '(defn plus [a b] (+ a b)))
18:40hiredman(def plus (fn* (. [a b] invoke (. + invoke a b))))
18:40hiredmanuser>
18:40hiredmanright
18:40hiredmanI know why it is there, but that does not make it less annoying
18:41licoresse.
18:42tcrayford~seen technomancy
18:42clojurebottechnomancy was last seen in #clojure, 380 minutes ago saying: then we can iterate on a more self-contained approach once it works
19:00cemerickrhickey: thanks for that patch for 302; that's a good initial step
19:01cemerickactually, might be enough for 95% of cases
19:10hiredmanuser> (deconstruct '(defn plus [a b] (+ a b)))
19:10hiredman(. clojure.lang.Var intern (. clojure.lang.Namespace findOrCreate (. clojure.lang.Symbol create "user")) (. clojure.lang.Symbol create "plus") (fn* ([a b] (. + invoke a b))))
19:10hiredmanuser>
19:12tcrayforduser> (who-calls 'potential-ns)
19:12tcrayford(#'swank.commands.completion/potential-ns #'swank.commands.completion/potential-completions)
19:13tcrayford(alias man doc)
19:13hiredmandoc is a macro, so that won't work
19:13tcrayford:(
19:13hiredmanyou need to be more subtle about it
19:13hiredmanyou can still do it
19:14tcrayford(defmacro man [& args] `(doc ~@args))
19:14tcrayforduser> (defmacro man [& args] `(doc ~@args))
19:14tcrayford#'user/man
19:14tcrayforduser> (man defn)
19:14tcrayford-------------------------
19:14tcrayfordclojure.core/defn
19:14tcrayford([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?])
19:14tcrayfordMacro
19:15tcrayford Same as (def name (fn [params* ] exprs*)) or (def
19:15tcrayford name (fn ([params* ] exprs*)+)) with any doc-string or attrs added
19:15tcrayford to the var metadata
19:15tcrayfordnil
19:23tcrayfordhttp://gist.github.com/369890
19:24tcrayfordthere's actually some bugs in there that I've just thought of :/
19:26tcrayfordaside from the one I already noted
19:26tcrayford:/
20:10defnhello all
20:25Raynesohai
20:26YamNadHaha hi :)
20:46gerryxiaohello
20:46gerryxiaowhat's definterface
20:47gerryxiao,(doc definterface)
20:47clojurebotExcuse me?
20:47gerryxiao,(doc defprotocol)
20:47clojurebotGabh mo leithscéal?
20:48gerryxiao,*clojure-version*
20:48clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}
22:11cemerickanyone have a clue about this exception coming out of clojure.core.protocols?: http://gist.github.com/369953
22:13hiredmancemerick: there was a commit about InternalReduce yesterdayish, do you have the latest?
22:15cemerickhiredman: yeah, I just saw that. Digging now :-)
22:20cemerickhiredman: yup, that was it -- was running clojure-1.2.0-master-20100416.220115-33.jar which broke, mvn -U got today's build (reverting the change, whatever it was), and all's green now :-)
23:09cheezeyumm... when i do something like (take 2 "asdf"), it requires a lazyseq rather than a string..? how do i change it to a string :\
23:25jomofo,(take 2 "asdf")
23:25clojurebot(\a \s)
23:26jomofocheezey: what do you mean by "requires"?
23:28cheezeyjomofo: i meant "it gives" sorry
23:30woobyhi everyone
23:34nteonevening wooby