#clojure logs

2010-03-27

00:04brian__Hi, I have a very basic question about leiningen, if I have a random jar file, x.jar to put it in the classpath, do i just drop it into the project dir's lib directory and put [x.jar] under dependencies in the project.clj file?
00:05slyphonbrian__: no, you need to import it into your local maven repo
00:05slyphonlemme see if i can find the command-line
00:05brian__ok
00:06somniumbrian__: if you put it in lib and use lein-swank or swank-clojure-project it gets added automatically regardless of project.clj
00:06slyphoncrap
00:07slyphonthe only problem is if you call 'lein clean'
00:07slyphoncrap
00:07brian__Im not using swank
00:07slyphonmy shell history must've gotten clobbered at some point :(
00:08brian__atleast not knowingly
00:15technomancybrian__: if it's a one-off, dropping it in lib/ is fine
00:15technomancybrian__: but if it's a more serious project you want to get the jar into clojars or somethnig
00:18brian__the jar is not mine, ie not what I'm working on
00:18technomancyif you add it to project.clj and then run lein deps it will show you the proper invocation needed to get it into ~/.m2 if you want to go that route
00:18technomancybut that doesn't help if you're collaborating with others
00:18technomancybrian__: you can upload to clojars as long as you use a custom groupId
00:19technomancythat way when the official author gets around to uploading it, your version won't conflict
00:19brian__man, thats heavy
00:19brian__its not a public project
00:20technomancybrian__: is it secret code?
00:20defnUnknown location: error: java.lang.NoClassDefFoundError: Could not initialize class incanter.core__init (analyze.clj:1)
00:20brian__not the jar, but the project is not public
00:20defnany ideas?
00:20technomancyslyphon: there's a nice article on infoq about clojars that does a good job of explaining this stuff
00:21technomancyliebke: ping
00:21slyphontechnomancy: ?
00:21slyphontechnomancy: misfire?
00:21technomancyslyphon: http://www.infoq.com/news/2009/11/clojars-leiningen-clojure
00:21liebketechnomancy: hey
00:21technomancyslyphon: oh, I thought you meant the shallow end of the dependencies pool, never mind
00:21slyphonhahahaha
00:22slyphontechnomancy: well, thanks anyway :)
00:22technomancybrian__: you might like to read that article anyway
00:22technomancyliebke: I had a question about the way you use multi-module builds in incanter if you've got a moment
00:22slyphontechnomancy: i was just deciding to not try and write-the-code-that-writes-the-code-that-does-the-thing
00:22liebkesure
00:23technomancyliebke: we use a multi-module maven build at work and it's kind of a PITA, so I've been brainstorming about how lein could make it smoother
00:23liebkethat would be great
00:24liebkemulti-module maven is indeed a PITA
00:24technomancymy idea is that the top-level project (incanter-app in your case) would declare its dependencies as normal, but then would have a "checkouts" directory that would allow you to hack multiple projects in parallel
00:24slyphonVISIBLE BLOCK!
00:25technomancyso if you wanted to hack on incanter-app and incanter-charts, you could have the changes to -charts visible in -app without performing an install in charts followed by copy-dependencies in app.
00:25liebkeinteresting, so each of incanter's modules would just be projects in the checkouts directory?
00:25technomancyyou'd put a symlink to charts in the checkouts dir of app
00:25liebkeah
00:25liebkethat sounds like it would do the trick
00:25technomancyand the build would be smart enough to add to the classpath src, classes, resources, etc from each project in checkouts
00:26technomancythe bonus there is that someone interested in hacking it would not have to build the whole project
00:26liebkeI'd be happy to test it when it's ready
00:26technomancyfor the pieces they aren't interested in actively working on, they could get them prebuild from repo.incanter.org
00:26technomancy*prebuilt
00:27liebkemakes sense
00:27technomancyit's only in the case where someone wants to hack two modules in parallel that it even comes into play
00:27technomancyso it's sort of an ad-hoc opt-in multimodule setup
00:27liebkeI do that frequently, since core and charts are in different modules
00:28technomancyrather than a top-down predefined multimodularity
00:28brian__technomancy> I put the jar file under lib and ran lein deps, I didn't see anything about ~./m
00:28technomancyliebke: I can't tell you how many times we'll edit something in src/main/resources and then restart slime only to have the changes not show up
00:28technomancysince we forgot to do process-resources, which copies things into target/classes
00:29technomancybrian__: if you just put it in lib it will get added to the classpath without having to put it in project.clj or ~/.m2... for quick hacks that may be the simplest thing
00:30brian__ok, thanks much
00:30technomancybrian__: but if you end up sharing the project with others it will be frustrating because the code relies on dependencies which aren't clearly stated
00:30technomancyso that's why it's better to get it into a maven repo in the long run
00:30brian__ok,understood
00:32technomancyliebke: I've prototyped this in the checkout-dependencies branch of leiningen, but it's just an hour or so's work and might not quite be usable yet
00:32technomancybut if you're interested in trying it out I could see about polishing it further
00:32liebketechnomancy: well, as soon as you think it's ready for me to test it out, let me know
00:33technomancysure. glad the idea makes sense to more than just me. =)
00:34liebketechnomancy: it makes sense to me :)
00:38technomancyincanter's probably the most complicated oss clojure project out there
00:38technomancyso it's a good test case
00:38liebketechnomancy: for better or worse :)
00:38KirinDaveIt's easily one of the most impressive, too.
00:39liebkeKirinDave: thanks :)
00:39KirinDaveliebke: Haha. For what it's worth
00:39liebkehaha
00:41technomancyliebke: there's a little more detail on the thread here: http://groups.google.com/group/leiningen/browse_thread/thread/f67cb42c06515e53
00:41technomancybut I'll let you know once I've got a chance to evolve it further
00:41liebketechnomancy: thanks, I'll check out the thread
00:49defnliebke: have things changed in 1.2.0? Unknown location: error: java.lang.NoClassDefFoundError: Could not initialize class incanter.core__init (analyze.clj:1)
00:49liebkedefn: I think I need more information, when did you get this error?
00:50defnC-c C-k in my REPL
00:50defnswank-clojure-project
00:50defnin my (ns ... (:use (incanter core datasets io charts stats)
00:50liebkedefn: you started swank with the bin/swank script?
00:51defnno i have swank-clojure "1.1.0" as one of my :dev-dependencies
00:51defnthen i run M-x swank-clojure-project and navigate to the project root and get my REPL
00:51liebkedefn: try the bin/swank script as a test to see if you can load incanter
00:52defnwhere is that script liebke ?
00:53liebkeah, you don't have the full project, nevermind
00:53liebkeare you using lein?
00:53MecIs there a way to walk through a recursive structure without recursion as it wont be full tail call
00:53defnliebke: yes
00:54defn [org.incanter/incanter-full "1.2.0-SNAPSHOT"]]
00:54liebketry lein swank
00:54defnyep, just did -- still no dice
00:54liebkesame error?
00:54defnoops started it from my leiningen source dir
00:54defnone sec
00:55defnthat worked
00:55KirinDaveHum, my science experiment failed. :\
00:55defnwonder why swank-clojure is being fussy -- it worked fine with 1.0
00:55KirinDaveI was trying to make enlive templates more efficient, but it turns out that some degenerate templates can't be compiled the way I was hoping.
00:55liebkedefn: no idea, sorry
00:56liebkedefn: I only use mvn clojure:swank and lein swank
00:57defnah liebke -- found the issue -- when i upgrades i had an old 1.0 version of incanter on my classpath
00:57defnupgraded*
00:57liebkeah, cool
00:57defnafter removing the lib/ dir and lein dep'ing it is all working again
01:01Raynestechnomancy: ping
01:13brian__technomancy> I tried this simple experiment, I put mongo.jar in the project lib directory, ran lein deps, then I started repl ie lein repl, then I simply did this -> (import '(com.mongodb.Mongo)) then (def m (new Mongo))
01:13brian__java.lang.IllegalArgumentException: Unable to resolve classname: Mongo (NO_SOURCE_FILE:7)
01:13tomojbrian__: you don't want to drop jars into lib/
01:13tomojlet 'lein deps' do that for you
01:14brian__do I put the ppath in the project.clj file?
01:15tomojppath?
01:15brian__where do I put the jar?
01:15brian__sorry, path to jar
01:16tomojhttp://mvnrepository.com/artifact/org.mongodb/mongo-java-driver/1.3
01:16tomojyou don't
01:16tomojit looks like that's the latest version
01:16tomojso (unless you need to build from the bleeding edge) just tell lein about this dep
01:16brian__ok
01:17brian__i'm beginning the light
01:17tomoje.g., in :dependencies, add [org.mongodb/mongo-java-driver "1.3"]
01:17brian__ok
01:17tomojthen, when you run 'lein deps', the jar will be downloaded and cached in your local maven repository
01:17tomojand also inserted into lib/
01:17brian__ic ok thanksmuch
01:17tomojthis way someone else can grab your project and build it without you having to send the dep jars along
01:18tomojand you have the option of setting up your own internal maven repository, too
01:18brian__ok, although its a private project
01:18tomojit can still be nice
01:18brian__sure
01:18tomojif you have multiple clojure projects that use eachother, for example
01:19tomojthen you don't have to build one and copy the new jar to everyone else
01:19brian__yes,sounds great
01:19tomojyou can just use 'lein install' to put the project in your local repo and other projects can get it with 'lein deps'
01:20brian__do i need to configure a maven repo?
01:20tomojunfortunately this does seem to require a jvm restart once you 'lein deps' and get the updated jar
01:20tomojbrian__: no, leiningen automatically sets up a local one in ~/.m2
01:20tomojyou would only need to set up a remote repo if you were distributing these deps to many people/boxes, I think
01:20brian__im unclear last remark about restarting jvm
01:21tomojwell, I meant that if you update one project, install the new version into your local maven repo, go to another project which is currently running, and 'lein deps' to get the updated jar
01:21tomojthe jvm that is running won't see the updated, it needs to be restarted
01:22tomojcan't update your dependencies without restarting the jvm, I mean
01:22brian__ok
01:22tomojwhich makes sense in a way I think
01:23brian__yes, i guess so ;-)
01:23tomojI mean, you've loaded one version of some java classes and you have some objects of these classes, now you update the dep and the class changes, what do you do about these old objects?
01:23tomojI guess ruby handles it ok
01:23brian__of course
01:23tomojclojure handles this fine I think when you're in one project
01:23tomojbut not across projects
01:24brian__hmm
01:41brian__tomoj> that didn't seem to work, I still get (import '(com.mongodb.Mongo))
01:41brian__nil
01:41brian__user=> (def m (new Mongo))
01:41brian__java.lang.IllegalArgumentException: Unable to resolve classname: Mongo
01:42chouser(import 'com.mongodb.Mongo)
01:43brian__chouser , thank you
01:43KirinDaveSomething I've been meaning to ask
01:43KirinDavea module like compojure
01:44KirinDavehow do I write a require that renames it?
01:44KirinDaveWith like enlive it'd be (require '(org.cgrand [enlive-html :as html]))
01:44tomojcompojure has a single-segment namespace?
01:44tomoj:/
01:45KirinDaveFor the main require, doesn't it?
01:45tomojyep, you're right
01:45tomojI don't use that
01:45tomojtry (require '[compojure :as foo])
01:45tomojor (:require [compojure :as foo]) in ns
01:46defn(require [compojure :as foo])
01:46defnyeah
01:46tomojpersonally I just :require or :use whatever I need from the actual namespaces, not the compojure namespace
01:46tomojthat way I know where it is
01:46tomojwhich version of compojure are you using? just curious
01:47KirinDaveMan that's weird
01:47KirinDaveWhy does that work with [] but not with '() ?
01:47defntomoj: lol probably one of the 100 that exist on clojars
01:47KirinDaveuser=> (require ['compojure :as 'foo])
01:47KirinDavenil
01:47KirinDaveuser=> (require '(compojure :as 'foo))
01:47KirinDavejava.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword (NO_SOURCE_FILE:0)
01:47defnclojars is a mess man -- we need to standardize as a community on naming schemes for namespaces
01:47defnor at least have best practices
01:48KirinDaveEven if you remove the 'foo with foo (just a transcription error)
01:48tomojwhat's the problem with clojars?
01:48KirinDaveIt still screws up
01:48defntomoj: i just think the repo is messy
01:48KirinDaveAren't all seqs interchangeable?
01:48tomoj(require '[clojure :as foo]) and (require '(clojure :as foo)) are different?
01:48defntomoj: lots of versions of compojure etc. are up there that need to be pruned
01:48tomojer, s/clojure/compojure/
01:48defntomoj: one works in the ns macro
01:49tomojdefn: yeah, but aren't they all named by the uploader's name?
01:49tomojin the ns macro, it's :require with no quoting
01:49defntomoj: not all, see enlive
01:49defnor incanter, etc. etc.
01:49defntomoj: oh duh, :require, my bad
01:49tomojdefn: ah, dynsel uploaded to enlive
01:49tomojincanter is old and out of date, too, then?
01:50KirinDavedefn: I just pasted showing one works and one doesn't tho?
01:50defntomoj: i just find it awfully confusing, the multiple versions of a jar. it's not an official release repo, it's like a weird mix of hacks and then some possibly official releases
01:50tomojI guess what we need is a better way for people to assert ownership of a project
01:50KirinDave(require '(compojure :as foo))
01:50defntomoj: yeah exactly
01:50KirinDaveFails
01:50tomojwhat should it be modeled after
01:50defnclojars should distinguish between the official release and other people's releases
01:50tomojgithub? rubyforge?
01:50KirinDave (require '[compojure :as foo]) works.
01:50tomojthere is a practice in place
01:50defntomoj: clojars can do this just fine -- it just needs some TLC
01:50tomojbut people don't listen all the time I guess
01:51KirinDavedefn: It's unfortunate that services like github can't provide little baby maven repos.
01:51defnKirinDave: yeah :\
01:51KirinDaveWell it's possible with github-sites.
01:51defnalthough I suppose it could
01:51defnyeah
01:51KirinDaveMaybe lein git mavenize
01:51tomojvery interesting
01:51tomojthat would create a gh-pages branch and set it up so that you can deploy maven artifacts into it?
01:52KirinDavesure
01:52defnKirinDave: the :as doesn't work in () I don't think
01:52KirinDavedefn: Why?
01:52tomojand does this work with multiple projects?
01:52tomojI'd like to know why as well
01:52defnKirinDave: i...don't know -- maybe i dont know what im talking about? ;)
01:52KirinDavetomoj: Well every project gets its own url, so you'd have to add-repo.
01:52KirinDavedefn: I mean I believe you.
01:52KirinDaveI just think it's weird.
01:52tomojI guess it thinks () means a prefix list?
01:52KirinDaveWhy does require and use care what kind of seq it is passed?
01:52defnKirinDave: Yeah, I'm just speaking anecdotally -- i use [] when I use :as :only :exclude etc
01:52defnjust because () always failed for me
01:53tomojinvestigating..
01:54KirinDaveI dunno, it seems kind of evil to use what underlying seqtype you're using as an implicit meta-language in function calls
01:54KirinDaveIn macros like (ns ... ) it is fine. I even think it's laudable.
01:54tomojyes, I see this behavior too
01:54defnwhen im doing lein compile can i tell leiningen to use -Xms512m etc.
01:54tomojKirinDave: ehh
01:54tomojKirinDave: consider destructuring
01:55KirinDavetomoj: I get that, but read the docstring.
01:55KirinDaveDoes it mention an explicit type?
01:55tomojyes
01:55tomoj"A libspec is a lib name or a vector containing a lib name..."
01:55tomojjust like you can't do (let (foo 3))
01:55KirinDaveThat seems weird to me tho.
01:55KirinDaveLike, maybe
01:56KirinDaveCan you destructure seqs?
01:56KirinDaveWithout caring about the underlying representation?
01:56tomoj,(let [[a b & rest] (iterate inc 0)] [a b (take 3 rest)])
01:56clojurebot[0 1 (2 3 4)]
01:57tomoj,(let [(a b & rest) (iterate inc 0)] [a b (take 3 rest)])
01:57clojurebotjava.lang.Exception: Unsupported binding form: (a b & rest)
01:57tomojalso, fogus had some good examples the other day
01:57KirinDaveOkay so why is destructuring an issue?
01:58tomoj,(let [{a 1, b 2} [1 2 3 4]] [a b])
01:58clojurebot[2 3]
01:59tomoj,(let [{a 1, b 2} #{1 2 3 4}] [a b])
01:59clojurebot[1 2]
01:59tomoj,(let [{a 1, b 2} '(1 2 3 4)] [a b])
01:59clojurebot[nil nil]
01:59tomojthing is, vectors aren't seq
01:59tomojvectors aren't seqs
01:59tomoj,(let [{a 1, b 2} (take 4 (iterate inc 1))] [a b])
01:59clojurebot[nil nil]
02:00tomojer, what?
02:00tomojI get different results on the last two line
02:00tomojI get [2 nil], not [nil nil]
02:13LauJensenMorning
02:19defnhi LauJensen
02:19defntomoj: let me try
02:21defnyes I get [2 nil] also
02:21defnvery interesting
02:22defn,(take 4 (iterate inc 1))
02:22clojurebot(1 2 3 4)
02:22defn,version
02:22clojurebotjava.lang.Exception: Unable to resolve symbol: version in this context
02:22defntomoj: which version of clojure are you on? 1.2.0-master-SNAP?
02:23tomojdefn: yep
02:23tomoj,*clojure-version*
02:23clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}
02:23defnding ding ding
02:23tomojwonder what changed
02:23defnmap destructuring
02:23tomojso, that very recent commit?
02:23tomojI didn't know I had it yet
02:23defni think like 2 days ago
02:24defnso maybe im not referring to the right thing
02:24defnlet me find the code sec
02:24tomojI saw the commit but didn't understand the implications of the code
02:24defnyeah im still not so hot on map destructuring
02:24defni dont "get" destructuring fully to begin with
02:25defnand maps make them quite a bit more difficult to reason about IMO
02:25defnfor me, anyway -- not in general
02:25tomojI think map destructuring has been around for a while
02:25tomojbut something changed recently with destructuring
02:26defnyeah i know where the link is i swear! :)
02:27slyphonso how long you figure before someone writes a < macro that lets you embed XML in your code?
02:27defnI don't know about < -- what is <
02:27defn,-
02:27clojurebot#<core$___4541 clojure.core$___4541@174409e>
02:27defn,<-
02:27clojurebotjava.lang.Exception: Unable to resolve symbol: <- in this context
02:27slyphonhmm
02:27defnslyphon: ohhhh nvm i see what you mean, sorry
02:27slyphonno, i mean <this-is-a-tag/>
02:27slyphonyah :)
02:28defni intentionally block XML from my mind from time to time
02:28slyphondefn: yeah, totally
02:28defnlol amen
02:28Apage43can you implement syntactic sugar as macros?
02:28slyphonApage43: uh, yeah?
02:28slyphonApage43: that's kind of what macros do
02:28Apage43well
02:28Apage43to a point
02:28slyphonindeed
02:28slyphoni dunno if that would actually work
02:29Apage43i wasn't sure you could actually usurp the paren
02:29Apage43from a macro
02:29slyphonoh, you can bind < to something
02:29Apage43within a macro
02:29Apage43but you couldn't make < itself a macro
02:29Apage43so you could be all (xml <blah/>)
02:29slyphondefmacro is a method
02:30slyphoner, function
02:30slyphonso, if you *really* wanted to, i bet you could
02:31Apage43I also don't know if you can get around the whole thing being tokenized at once
02:31defn^good point
02:31defni dont think it's possible without being able to add your own reader macro
02:31slyphonMec : most simply a macro is just a function that doesnt evaluate its args
02:31slyphondefn: yeah, that's true
02:32defni read a post about doing such a thing
02:32slyphonalso, there's no space between '<' and the word
02:32defnbut it was discouraged throughout the article
02:32Apage43slyphon: yeah
02:32Apage43that's why i brought up the tokenization
02:32Apage43you couldn't pull the < off the front
02:32defn(xml < blah />) wouldn't be so bad
02:32slyphonyuck
02:32defnhaha
02:32Apage43defn: eh.. then it gets yuckier than quoting it
02:32defn'nod
02:32defn,'nod
02:32clojurebotnod
02:36tomojthe question is, why use < and > at all?
02:36tomojwe already have sexps
02:36tomojand more than most
02:37defnhmmmm I keep getting this j.l.String cannot be cast to j.l.Number -- does (defn -main [& args] (let [n (nth args 2)] n))
02:37defnfor some reason turn its args into string values?
02:37tomojthat's what args are
02:38Apage43i'm personally fine with the way compojure does html
02:38defn?
02:38robinkI'm not touching Maven
02:38defnrobink: cemerick had a good post on why maven is a good thing
02:38tomojyou don't need lein to compile clojure-contrib, do you?
02:38defnmaven + the polyglot plugin makes it not suck
02:38robinkdefn: OK
02:39robinkdefn: Ah, OK
02:39defnHowever!
02:39robinktomoj: No, I don't
02:39defnI am of the opinion that clojure needs something like rubygems for jruby
02:39robinkI would agree
02:39robinkSomething that integrated well with Portage would be awesome
02:39defnrubygems for jruby enhances the relationship
02:39defn(with ant in jruby's case)
02:39noidihttp://clojars.org/
02:40defnnoidi: ?
02:40robinkGentoo has a rubygem eclass that makes ebuild files for gems just a few lines long.
02:40defnnoidi: what rubygems does is different from what lein + clojars do right now
02:40Apage43gems are global
02:40Apage43lein makes project-local copies of deps
02:40noidiand that's the problem with gems :P
02:40tomojI'm not sure that makes sense in the jvm
02:40noidiI think local installations per project are the way to go
02:40tomojyeah
02:41headiusgems are only as global as you let them be
02:41headiuswith jruby, they're local to the jruby dir
02:41defn^^
02:41noidiglobal gems are fine as long as you only have one project depending on them
02:41defnheadius: i would like the option to make some jars global and some local
02:41noidias soon as you have two projects that depend on different versions, you have to move to per-project dependencies
02:41headiusmvn installs are global
02:41tomojI have many projects depending on many different versions of different stuff
02:41headiusor at least as global as rubygems
02:42Apage43can you not require a specific gem version?
02:42headiusof course
02:42defnyou absolutely can require a specific gem version
02:42Apage43oh
02:43tomojso lein would have to figure out what version of each dep you want and compose a classpath pointing to the jars in the global cache?
02:43headiusyou can even use bundler to roll specific versions into your app dir directly, and not depend on the "global" installs at all
02:43Apage43but can you have multiple versions installed
02:43headiusApage43: certainly
02:43headiusI think I have 4 versions of rails installed here
02:43Apage43hmm
02:43noidiok, maybe I confused ruby and python module systems here
02:44headiustomoj: this isn't any different than multiple versions of jar files
02:44defni think there are a lot of misconceptions about mvn, ant, rubygems, etc. etc. etc. -- I really don't care *at all* which tools we end up standardizing on. what i'm concerned with: does it work? is it easy for me to start a new project and do some very basic things? can i do tons more stuff if I want to? is there a tool to facilitate the interaction?
02:44headiusthat's a problem for every packaging system
02:45defnmvn does deps well -- im not against mvn, but i think it's too much extra garbage to learn about when you first start learning clojure -- it's the icing on the cake
02:45talios'lo all
02:45defnthat's why something like lein or another tool should be around to make those first steps easy for new users to clojure
02:45Apage43yes
02:45tomojheadius: right
02:45noidiI looked into maven yesterday, after reading cemerik's blog post, and was very positively surprised
02:45Apage43i am pretty happy with lein so far
02:46tomojheadius: and maven solves it by copying into the project dir
02:46defnnoidi: same
02:46tomojwhat's the other solution?
02:46noidithe design was much cleaner than I expected for all the flak it gets
02:46taliosnoidi / defn - glad to hear you liked the maven support
02:46headiusthere is no good solution for multiple libs depending on different versions of things
02:46RaynesLeiningen has been all I've needed insofar.
02:46RaynesI don't think I want to switch to maven if I don't need what it offers.
02:46noiditalios, thanks, it works great :)
02:46tomojaren't you already using maven, really?
02:46Apage43if there's one thing i've seen clojure excel it it's wrapping things that are horriby complex to use in java and making them surprisingly friendly
02:46defnpeople who use lisp *hate* XML because it's like lisp, but is terribly ugly
02:47Apage43*excel at
02:47robinkLink to blog post?
02:47noidirobink, http://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer
02:47taliosdefn: if you hate the XML - you could always checkout the polyglot maven project - our clojure DSL reads similar to lein
02:47defntalios: oh im aware of it
02:48taliosdefn: the problem with the polyglot maven stuff tho is having to support -all- of maven, which tends to make it a bit messy when getting more complex things added
02:49Apage43feh
02:49defntalios: here's my feeling on polyglot: awesome.
02:49Apage43i hated building vimclojure git
02:49defnhowever, as a new user it's just one more thing i need to setup and understand
02:49Apage43had to download freaking -gradle-
02:49Apage43which is 26 -megs-
02:49defnwe need a community tool that just does that kind of garbage for a new user
02:49taliosheadius: OSGi or Jigsaw -might- help on that, but it also brings in its own problems
02:49RaynesYeah, screw gradle.
02:49Raynes:|
02:49defni also dont want to create my own xml file and learn the syntax and write every new project's xml file by hand
02:49defni want that to just be generated for me
02:50defnim fine with XML as long as for 90% of the things I do, I don't need to edit it
02:50taliosdefn: you could use maven archetype's for that. I think stuart (or someone) made on for the clojure plugin, which handles all the basic foo
02:50defntalios: so many choices, so little consensus
02:51headiushah, gradle
02:51defnit's a bit frustrating, which is why im sticking with leiningen until someone gives me a better solution
02:51headiusI'll keep my mouth shut on that one
02:51taliosdefn: it's a build system - EVERYONE has different requirements. That's what makes it hard.
02:51defnit's focused on our community, and i like that
02:51noidiwell, that's software development :)
02:51Apage43hah, groovy
02:51noidifirst you pick a language, then a build system, then a vcs
02:51noidioh and the editor's quite important too...
02:51headiuswhy is gradle 26MB?
02:51defnnoidi: your forgot testing frameworks!
02:51noidiif you keep second-guessing yourself you never get anything done (that's me!)
02:51defnone for BDD and one for TDD!
02:52headiusjruby's complete jar with ruby and rake and rubygems and rspec is like 9MB
02:52defnheadius: wow
02:52RaynesI think Leiningen will improve quite a bit in the future.
02:52Apage43headius: uses groovy.
02:52taliosdefn: one thing I love about maven's ecosystem is the release plugin etc. does lein support anything like that?
02:52headiusApage43: oh right :)
02:52defntalios: yes and no -- leiningen is so new -- the answer to your question is yes, you can build plugins for lein
02:52defnhowever, that process is largely undocumented, and it is still a new tool
02:52defnit will come with time i imagine
02:53taliosdefn: *nod* which is why I still prefer the maven side, I just added a compiler plugin, and the rest comes for free.
02:53taliosmaven isn't the be all and end all tho.
02:53RaynesWasn't technomancy talking about a maven adapter or something?
02:53noidithe great thing about maven is that people have been banging their heads against it for years and figured out and documented how to do all kinds of things
02:54Apage43and lein gives you the maven package system, without anyone having to actually -learn maven-
02:54defnleverage maven's long support and big user base, plugin functionality, but do it in a community-based tool that makes doing stuff *we* need to do easier
02:54tomojyeah, great
02:54defnthat's my feeling
02:55Apage43lein keeps you in clojure
02:55taliosApage43: does lein keep its deps in ~/.m2/repository ?
02:55noiditalios, yes
02:55defntalios: yes
02:55RaynesIndeed.
02:55tomojdefn: so, pmaven-clojure?
02:55defntomoj: wuzzat?
02:55taliosI was thinking a "clojure installer" that installed lein, the maven clojure plugin and a bunch of plugins/deps into .m2/repository would be great, get that initial 'download hell' out of the way
02:55tomojpolyglot stuff for clojure
02:55taliostomoj: yep?
02:56Raynesdefn: It's totally the greatest thing evar, haven't you heard?
02:56tomojhttp://polyglot.sonatype.org/clojure.html
02:56tomojtalios: I meant, does this satisfy defn's dream
02:56Apage43fun thing is
02:56defnRaynes: not sure if you're joking :)
02:56Apage43the pmaven and lein syntax for a project def
02:56Raynesdefn: I'm being sarcastic.
02:56defntomoj: not totally -- it's close
02:56Apage43arealmost exactly the same
02:56taliostomoj: oh right. close I guess
02:57noiditalios, in my experience the biggest benefit of lein is the ease of setup, so with such an installer I don't know what the benefit of lein over "plain maven" would be
02:58Apage43that's pretty much it
02:58noidiother than "mvn clojure:swank" is more characters than "lein swank" :)
02:58defnlol
02:58taliosnoidi: alias!
02:58Apage43lein is a "make maven quick and easy and throw in a couple clojure specific commands while we're at it"
02:58RaynesI like Leiningen because technomancy made it. <3
02:58defnid like to see a tool which hooks into clojars.org or some other community site that does pmaven-clojure stuff for you
02:59taliosApage43: pmaven-clojure is pretty much the same there.
02:59Apage43talios: yep
02:59Apage43Like i said
02:59Apage43you could use the exact same project def file if you didn't specify dev/test dependencies
02:59Apage43because in the two examples, that's the only thing that differs
02:59taliosdefn: the ultimate goal for polyglot maven from memory is, that it'd automatically pull in the polyglot "plugin" from maven central, from a standard maven install
03:00defntalios: that would be nice
03:00defni want a tool that ties into our community more
03:00defnleiningen was on the right track in that respect
03:00defntalking to clojars.org for example
03:00RaynesMy heavens, are we already signing Leiningen's death certificate? :p
03:01taliosget clojars.org syn'd to central - then maven would be automatic
03:01taliossync'd even
03:01defnnot the same thing
03:01noididefn, Clojure-specific convention (default configuration) over pom.xml configuration :)
03:02taliosdefn: why not? works fine for every other repo out there.
03:02taliosat least, those that are sync'd
03:02defntalios: can i search for repositories using mvn
03:02defntalios: im sort of departing from build tools and getting into community integration here
03:02taliosdefn: repositories or artifacts?
03:03defnboth
03:03defnartifacts mostly
03:03taliosYou can use http://mvnrepository.com for artifact searching.
03:03defnoh god please dont make me go there
03:03taliosI also know that IntelliJ, Eclipse, and I think Netbeans download the indexes from central for local searching
03:03defni want a rubyforge for clojure -- and we'll need a tool to talk to it, that's my opinion
03:04taliosif we're going tool route, said tool could just download the maven indexes from central, and search them ( theirs client api's for doing that already )
03:05taliosthat's something that came out of the nexus repository manager
03:05defntalios: yes that'd be fine with me
03:05defntalios: if it could also publish to our site with some metadata in a local file tacked onto the submission, that'd be nice also
03:05taliosmmm, I wonder if there's already a command line client for that, or a maven plugin
03:06taliosactually - does clojars run any form of repository manager at all? or is just a raw repo?
03:06defnraw i believe
03:06defnit's a mess
03:07taliosdefn: have you seen nexus? http://oss.sonatype.org is sonatypes Open Source repo ( where I publish the clojure plugin )
03:07defnim complaining and not doing anything about it -- but ive got a notebook dedicated to it
03:07Apage43who runs clojars anyway
03:07defnato i think
03:07defntalios: sonatype looks like something id be cool with
03:08defnbut again id really like to stamp the hell out of a similar style site with the *clojure* logo
03:08defnit's partly just a cultural identity thing for me
03:08taliosdefn: sonatype's the company behind it ( main company behind maven as well )
03:08defnwe need tools we own
03:08taliosnexus is all themeable
03:09defntalios: sure
03:09defntalios: im just thinkin out loud here
03:09talios*nod*
03:10taliosI believe nexus has a nice REST API as well, so even if the UI was kept 'away from the public' a custom site could easily integrate
03:10defni dont know the answer -- i just sort of envision a rubyforge-esque site that is the community's disclojure + planet.clojure.in + release notes for clojure + the one true place for official projects to live
03:10taliostime to a .clojure TLD? :)
03:10talios+get
03:10defnhaha
03:11talioshttp://www.clojure
03:11Apage43www.clj ;]
03:11defni just think it would be nice, you know?
03:11taliosApage43: real geeks drop the www. now don't they?
03:11Apage43now that'd get confusing
03:11Apage43talios: right
03:11taliosdefn: yep.
03:11Apage43talios: http://clj./
03:11defnwe have lots of sources of information for clojure floating around right now -- half of the official stuff i read about clojure comes from an unofficial site where tweets are the source of news
03:11Apage43well
03:12defnim not averse to that per se, i just think we need to cement some things into a community site, one of which should be project hosting, a place for "official" stuff to live
03:12Apage43there's certain folks that will tell you that dns is hierarchichal and you should identify the subservice being pointed in the name [www for http]
03:13taliosMaybe a first step would be still have all these things separate, but bring them all under the *.clojure.org domain - centralize the DNS
03:13defnthat could go a long way i think, yes
03:13taliosgetting build.clojure.org was a big win IMHO.
03:14defnidk, we're just going through growing pains i think as a community
03:14Apage43make stuff way easier to find and help prevent duplication of effort
03:14defnclojure is a young lang, our tools are evolving, hell, the core of the lang evolves every couple months
03:14Apage43s/^/it would
03:14defnApage43: yeah good plan
03:17taliosAre any of you guys using clojure-CLR at all? Is that actually getting any traction?
03:18defntalios: one other thing im sort of on the fence about with regard to mvn, and i know this isnt a good reason BUT i suppose im a little emotional about it
03:18defni want clojure to be its own language, and i dont want to sacrifice and go with what have been historically java tools because, well, we aren't java
03:19defnwhen ruby got on the jvm they didnt switch to maven
03:20defngranted they're using ant + rubygems -- but to me that's how it ought to be i guess, we have our tool which does our stuff, and we integrate with maven second
03:20noidiwell, if Clojure didn't embrace the JVM, it would have as much traction as Ruby in 1997
03:20defn:)
03:20defnthe JVM != Java -- I know that's almost a cliche at this point, but well, it's true
03:21taliosI've seen a few JRuby project use maven, simply because they integrate into a larger build system
03:21defnoh sure talios -- im just trying to suggest that jruby projects use rubygems AND maven -- i feel like we need a similar combination
03:21talios*nod*
03:21defnone of those tools facilitates the interaction
03:22taliosdefn: that fact that IDEs now support maven out of the box is a compelling reason as well.
03:22defnit's a fuzzy line because clojure projects are still .jar files -- it's not like it was with ruby where you have gems and jars
03:22taliosI think we're arguing for arguing sake now :)
03:22defnmaybe we dont need a tool
03:23taliosdefn: mmm not always .jar files tho - clojure libraries yes... what about .war files tho?
03:23defnill be sold when someone gives me 3-4 lines of stuff to put in my command line from not having clojure at all, to starting up a repl and (use)'ing a library
03:25taliosmmm, if clojure "knew" about ~/.m2/repository - and you (require 'org.clojars.compojure/1.3.2) (use 'what.ever.ns) that might get us there
03:26Apage43eeeehhh.
03:26taliosthen you'd be: apt-get install clojure, $ clj-repl
03:26defnhow do you make a new project?
03:26defn(in this scenario)
03:26Apage43hesitant to make maven a dependency of the -language-
03:27taliosApage43: not of the language, but of -a- distribution, that might bootstrap a dependency manager ns
03:27defni want to install clojure, scaffold a project directory, get a dependency from a remote repo by searching from my command line, and then open a repl and include it
03:27taliosdefn: oh - you asked for getting a REPL and (use'ing something, NOT setting up a project! :)
03:27defnso i suppose that's like 6-7 "lines"
03:27Apage43talios: maybe not hook (require then ?
03:27taliosApage43: yeh, not (require but something similar ( i was trying to think of a term to use 0
03:29taliosdefn: maybe if lein had a project init command, similar to "git init", "lein init" creates a project.clj in the current dir..
03:29taliosdefn: "apt-get install clojure leiningen && lein init repl"
03:29Apage43talios: you mean like lein new?
03:30taliosApage43: well there you go :)
03:30Apage43:)
03:30taliosI remember reading something about someone suggesting having something like ~/.clojure/lib for default jars on the classpath, like ant and groovy have, that would also help here
03:31taliosApage43: and now you mention that, I think I need to add a clojure:new to the maven plugin :)
03:31taliosNot sure if maven needs a pom.xml to bootstrap itself tho, I can only try !
03:33noiditalios, can new archetypes be defined outside the archetype plugin?
03:33noidimaybe "mvn archetype:clojure" could create a new clojure project
03:34taliosnoidi: yep - an archetype is a type of artifact, if its in your repo then it'll appear in the archetype:generate menu, other wise you have to mention the archetype type on the command line
03:34taliosnoidi: it'd not been updated lately, but http://github.com/nullstyle/clojure-quickstart is one such arcehtype
03:35defntalios: what do i need to do to get up and running with pmaven
03:36taliosdefn: looks like the download page is broken currently - so easiest way is to clone http://github.com/sonatype/polyglot-maven and build that, unzip the dist into a directory and just run maven out of there
03:38taliosdefn: once you have it installed, its just like maven: mvn install will find a pom.clj, pom.groovy etc. in the current dir and just work
03:39taliosdefn: inside the bin directory theres also a "translate" command, which you go "./bin/translate pom.xml pom.clj" to convert an existing maven project over
03:39talioscd
03:39taliosbah, wrong window :)
03:39taliosfirst time I've done that in years.
03:41defntalios: hehe -- okay i must say though that a broken install page does not help the polyglot mvn + clojure cause :)
03:41noidipolyglot maven needs a clear "getting started" page
03:42defnit should be easy enough to explain in like 3 lines of text max
03:42taliosthis is the first time in about 2-3 months I've even looked at it. I'll ping the sonatype guys about getting the download page sorted
03:42defni want it to be a brief aside in a blog post, not the whole post
03:42Apage43talios: it's not bad until you "ls" a channel to see who's in it
03:43taliosApage43: I blame that its the first time in ages I'm using a console based IRC client.
03:43taliosDayam where's my mastery of the english languge today?
03:43Apage43i am used to doing silly stuff in a terminal, since at home I use bash and from 8 to 5 at work I use ksh88
03:44Apage43key combos are all different
03:44taliosI recently switch to zsh, love it apart from the completion. Much prefer bash's completion
03:44defnim having a brain fart
03:44defn"44" -> 44
04:00defntalios: thanks for the constructive chat about this stuff
04:00taliosdefn: if you're building pmaven - ignore the last test failing on pmaven-commands, and grab the dist from pmaven-cli/target
04:00defntalios: i know im probably in the touchy feely, willfully focused on aesthetics, etc.
04:00defncamp
04:01talioswe need that touchy feely focus tho, in part
04:01taliosto keep the balance
04:01defnbut those things matter enough to make good tools suck if they're not paid attention to
04:01talios*nod*
04:01defnit's kind of a weird place to be that guy, though
04:02taliosesp. for a LISPer :)
04:02defnlots of very serious objective opinions on this matter, and i come in and say "yeah but it's not easy enough to use" and they say "well of course it is, you just build this thing from source, and then you learn the structure of the pom.xml, and then you... oh and dont forget to..."
04:02talios(wheres (the (aesthetic)))
04:03defn"and THEN, you just type this command, and boom! you're halfway there!"
04:04taliosdefn: you know, you sound like a VB developer :-)
04:04talios"point, click. make money"
04:06taliosstart labrepl on bootup, auto launch a browser etc.
04:07talioscould also be a livecd maybe
04:08tomojyou could distribute that as a vagrant box
04:08tomojer
04:08tomojnot really
04:09taliosvagrant box? I'm not familiar with that term?
04:09tomojhttp://vagrantup.com/
04:09tomojthat's all headless stuff though
04:10tomojfor headful there's not a whole lot of reason to use it unless you provision with chef
04:10taliosoo it uses chef! nice.
04:10tomojbut you could use vagrant to provision with chef, then use the regular VirtualBox gui to launch the machine headfully
04:10tomoj(that's what I'm trying to figure out now for a windows coworker)
04:11taliostrue. just use vagrant to do the build.
04:11tomojah yeah, and then distribute the big exported VMs?
04:11taliosyep
04:11tomojor if someone wants to wait around to build it themself they can
04:11taliosthey probably wouldn't be that big either
04:12tomojI wonder if vagrant can kickoff a headful gui
04:12taliosit'd just be a different set of chef recipes wouldn't it? to install gnome or something
04:12tomojguess you can just 'vagrant up', 'vagrant halt', VirtualBox
04:12tomojyeah, that's exactly what I was going to work on
04:12tomojbut not sure what my coworker uses
04:13tomojthe problem is that typically with vagrant you just get ssh access and that's it
04:13taliosmmm, you wouldn't even need the 'vagrant up' I guess, I assume 'vagrant init' makes the image, and 'up' just starts it
04:13tomojwell 'up' does the provisioning
04:14tomojcus the provisioning happens after the machine starts
04:14taliossurely that'd be on "first run"? i.e. when the end user starts it in VirtualBox GUI
04:14tomojVirtualBox GUI won't do the provisioning
04:14taliosmmm, I thought it'd run chef on boot? I guess not
04:15tomojwhat you can do is build your chef recipes, run them with 'vagrant up' (first run) and 'vagrant reload' (later runs)
04:15taliosah right
04:15tomojand then expor that
04:15tomojs/expor/export/
04:15tomojthen they can import the fully-provisioned vm
04:15tomojI wonder how well x-forwarding onto a VM works
04:16defnis it possible to get "bed sores" from sitting down too long?
04:16tomojyeah, osx is probably the most support
04:16tomojlet me know if you do work on dev recipes, I was planning to start a repository of them
04:16taliosshit - 9pm, no wonder i'm hungry! dinner time, then podcast editing for a bit, and some vagrant reading.
04:16tomojI don't care about the javaland ides though :)
04:17tomojguess I should if I want my coworkers to use clojure
04:17taliostrue, but if we're building a box for all - would be good to cater for all sorts
04:17tomojexactly
04:17taliosmust read up on chef more too. ops guy at work was looking at that as well.
04:17tomojwhat I actually planned was to build a cookbook repo for my personal dev environment
04:17tomojthen later parametrize it for others
04:18tomojI sort of secretly nominated myself to be ops guy when I discovered chef :)
04:18taliosheh
04:19taliosdoh - need to upgrade my virtual box :)
04:19tomojyeh :(
04:19tomojthe version in the ubuntu repos is too old
04:22taliosvagrant requires rails?
04:22taliosinteresting
04:24tomojuhh, I didn't know that
04:25taliosmaybe i'm just misreading the tutorial
04:25tomojthe vagrant gem does not require the rails gem
04:25talioshttp://vagrantup.com/docs/getting-started/setup.html <-talks about "rails project setup"
04:26tomojtalios: let's move to #vagrant
04:36defnhmmmm
04:36defnso if im running java -jar myjar.jar arg0 arg1 arg2
04:36defndoes it automatically make my args strings?
04:39defnnevermind i found the damn problem :)
04:39taliosyep
04:39defntalios: oh, really?
04:39taliospublic static void main(String[] args) { .... }
04:39taliosits a string array for the args
04:39defnoh, well crap
04:40defnso to get an integer for an arg i have to go through all of that trouble to coerce it to an int?
04:40taliosInteger.valueOf(arg0)
04:42defntalios: thanks buddy
04:42defni was beginning to think i was crazy
04:42taliosyou're using java - you just might be :)
04:42taliosI know I am.
04:43defnyeah i was just going to say...probably a safe bet im nuts if im talking to you! :)
04:43taliosoi
04:43talios:)
05:21defn90s to parse 300M of logfiles for IPs -- any ideas?
05:22_msttried using awk/sort/uniq? :)
05:22defnno awk -- i felt dirty and this potentially has to run on windows
05:22_mst(depressing the number of times a combination of shell programs has come up faster than some special-purpose thing I wrote myself ;) )
05:23_mstah, right :)
05:23defnyeah ive used grep and felt bad about myself :)
05:23defnmaybe this is a silly thing to be doing in the first place...
05:24defni could probably make this run unoptimized in perl faster than itll run fully optimized in clojure
05:24defnhowever once you get like 16 cores into the mix, mine could potentially kick the crap out of it
05:24defnbut...we dont have 16 cores yet :)
05:24_mstafter fighting along with _ato on widefinder I can sympathise :) Is your code online anywhere?
05:25defnno i can put it up though, just have to sanitize it for some company specific details
05:25defn1s
05:40defnthat was a one second :)
05:40defn1l
05:40defncd ~
05:40defnnow you got me! :)
05:50defn_mst: yeah ive been looking at widefinder, specifically _ato's code and I don't feel very comfortable with it just yet
05:51defn_mst: chunking would obviously do me a lot of good, and im not using any reference types
05:51defni thought id be able to do better than 90s without any optimization for 300MB of logs though
05:51defnanyway, here is the stuff..
05:52defn_mst: http://gist.github.com/345880
05:53defn_mst: it's pretty much guaranteed to be a complete mess, my function names are terrible, some of it just plain nasty :\
05:53_mstnot to worry :)
05:56defn_mst: the other thing is that i think i am taking some totally unecessary steps with the data early on -- the story of the structure is like this:
06:04defn_mst: bah sorry, busy with some work stuff for a minute
06:05defnand then i broke my repl due to no *print-length*
06:06defn:)
06:11_mstdefn: it's just one thing, but I wonder how you'd go using transients for your counting bit: http://gist.github.com/345896
06:11_mston my machine, at least, that fn spends a lot of time garbage collecting
06:11_mstand using transients seems to cut that down significantly
06:12talios'lo cemerick
06:13_mstdefn: and you could do the same thing to the add-country-codes fn, since it's doing the same sort of thing
06:23defn_mst: awesome advice
06:24defnthank you!
06:24defn_mst: how do you profile?
06:24_mstI vary a bit... sometimes I just run the JVM with "-agentlib:hprof=cpu=samples,depth=6,force=n,thread=y,verbose=n"
06:24_mstsometimes I use the profiler in jvisualvm
06:25defnthis is fantastic info
06:25_mstsometimes I just take a wild stab in the dark :)
06:25defntalios: link?
06:25talioshttp://www.yourkit.com
06:25talioscommercial - ex guys from jetbrains I believe
06:25defnruns on linux?
06:25taliosyep
06:25taliosits java ;)
06:25defncool
06:25defnit's not always a foregone conclusion :)
06:26taliosthe profiler in jvisualvm ( which is the netbeans profiler ) is good, but could be better
06:26taliosI love how yourkit till trace down to SQL statements etc. profiling to that level is darn handy
06:26_mstah, I've used jswat too... but I think that's the netbeans one too
06:27talios_mst: isn't jswat just a debugger? didn't think it had a profiler
06:27_mstoh! hm, you might be right
06:28_mstyeah, ignore me :)
06:28talioshttp://ejp.sourceforge.net looks quite cool tho. open source
06:28taliosoo thats old tho :(
06:31talioshttp://jrat.sourceforge.net is one that I've heard mentioned favorably a lot
06:31taliosI don't think it gives runtime results tho
06:32_mstprobably not the time to mention that I also like System/currentTimeMillis and println :)
06:32taliosheh
06:36taliosUg. 3 hours or so into editing this podcast and I'm only at 28mins of recorded audio :( Might give up for the night and read, or code.
06:47tomojtalios: clojure podcast?
06:48taliostomoj: http://www.illegalargument.com - java/jvm podcast mostly - but we do talk clojure a bit. greg's an old common lisp lover but does mobile stuff now (co host), and richards a freak groovy/grails lover
06:49taliostomoj: one could say its a maven hate podcast as well, as pretty much each week we discuss the "maven pain of the week" :)
06:51taliosoh and tony's a scala lover
06:51taliosso we talk languages and rant :)
06:54bsteubertalios: which podcast are you referring to?
06:54taliosbsteuber: http://www.illegalargument.com as I just linked tomoj
06:55talioswe record far more regularly than we post episodes tho - they take a surprisingly long time to edit up :( and finding time is hard.
06:55bsteuberthx - sorry, just entered the chat
06:55taliosah so you did :)
06:58tomojtalios: jvm in mobile?
06:58tomojlike J2ME? or android?
06:58taliostomoj: greg does j2me and android, and symbian
06:58tomojI need to learn android :)
06:59taliosI got as far as a Hello World app :)
06:59taliostoo many projects, not enough time
06:59tomojyeah :(
07:09defn_mst: still there?
07:10defn_mst: I get an error with your code
07:10defnclojure.lang.PersistentArrayMap$TransientArrayMap cannot be cast to clojure.lang.Associative
07:12defnoops, forgot the ! on assoc!
07:18licoresseAnyone doing Swing development with MigLayout here?
07:26defndo i need a special merge-with to wrap a (reduce (fn [a {:foo [bar baz]}] (merge-with + a {bar baz})) {} ...)
07:27defndo i need a special merge-with to wrap a (persistent! (reduce (fn [a {:foo [bar baz]}] (merge-with + a {bar baz})) (transient {}) ...)
07:34esjlicoresse: No, but I think I just changed to it :)
07:35bsteuberlicoresse: I'm at least considering it - because using netbeans just for form designing seems a bit weird
07:36licoresseJust curious how the reception was
07:36licoresseI understand that it is built on jgoodies
07:50taliosI've heard a lot of good things about MigLayout
07:50talioswasn't stuart sierra clojure/swing posts using it?
07:50LauJensentalios: Here's another approach http://www.bestinclass.dk/index.php/2009/10/functional-social-webscraping/
07:51taliosahh - looks like it was standard swing ( http://stuartsierra.com/2010/01/02/first-steps-with-clojure-swing )
07:52LauJensen(though I see that blogpost is semi broken, the link to the source at the bottom should be what u need)
07:52taliosoh yes - macswing! very nice
08:35licoressemacswing?
08:35_invishi all
08:37_invisGuys could I make colors parentheses like this http://i41.tinypic.com/f2rons.png ???
08:37_invisThis is picture from Vim
08:37_invisAnd I am work with emacs
08:37somnium_invis: like this? http://tinypic.com/view.php?pic=2urqmgl&amp;s=6
08:39_invisindeed
08:39_invisbut when you write a function paretheses are white :) why ?
08:41bsteuberI don't nee rainbow parens - just using paredit is best for me :)
08:41licoresseyeah, paredit rocks, no need for color
08:41somnium_invis: I think you want HighlightPaerentheses mode and you can customize the colors with m-x customize group
08:42_invisthanks Will try to google HighlightPaerenthese for emacs :)
08:42Chousukesomnium: they are, of course.
08:42Chousukesomnium: but since learning paredit I've never felt the need to have rainbow parens
08:43bsteuberneeding paren colors means that you actually SEE parens in the first place :)
08:43Chousukebsteuber: well, sometimes you do need to look at them
08:43licoresseworking with paredit makes the parans go away
08:44Chousukebsteuber: but I agree, they kind of disappear
08:44Chousukethey are there, and you see them, but your conscious mind ignores them
08:44somniumlicoresse: working with haskell makes them go away :P
08:44lithprlol
08:44licoresse:)
08:45licoressewell, I mean this, and I hardly use any syntax coloring either, only the function names are colored
08:45licoresse(and the comments)
08:46ChousukeI like syntax colouring still
08:46licoresse(and the strings) :/
08:46licoressebut thats it
08:46Chousukeit's useful to differentiate between strings, numbers, symbols and operators visually.
08:47somniumI think I often use keywords just for the syntax highlighting
08:47bsteubersure, sometimes you do need them :)
08:48ChousukeIt's weird though
08:49Chousukeyou can keep telling people that the parens disappear with experience, and they won't believe you until they experience it themselves
08:49Chousukeand at that point they're already convinced :/
08:50bsteuber:)
08:50somniumIm still not sure if they go away or if people in the jungle just dont notice the shrubbery
08:51licoressethey don't really go away, you just learn to like them
08:51licoressein my code each paran has a name
08:52licoressejoe, gill, john and lisa etc
08:52somniumwow, with such a relationship using paredit must feel like coaching kickball
08:53licoressehehe
08:54_invishttp://nschum.de/src/emacs/highlight-parentheses/
08:54Chousukesomnium: I think the parens are still there, but a good tool relieves you from the need to pay attention to them :)
08:55licoresse_invis: are you sure you want to give them so much attention?
08:55_inviswhy not
08:55licoresse_invis: it's true what Chousuke says
08:55ChousukeMost of the information of lisp code is in the indentation and code layout.
08:55Chousukeand of course the symbols
08:56licoresseinvis_: use M-C-q to reformat
09:22defn_mst: thank you again for that tip on persistent!/assoc!/transient -- that sped things up quite a bit, from 60s to 21s
09:23defnAnyone here use yourkit? If so, how does one test with emacs? Is that possible?
09:25bsteuberanyone used maven to deploy signed jnlp packages so far?
10:02defnanyone have any profiling setup tips for yourkit and clojure? preferably id like to steer clear of IDE integration and just use emacs
10:04defnor any profiling tools for that matter
10:12defnmaybe a silly question, but how do i add a JVM flag -- Are those just arguments to `java`?>
10:17nossyes
10:24defnwow. YourKit is awesome.
10:25MecHow do I display a JFrame so that it doesnt shut down my repl when I close the window?
10:31mattreplMec: http://java.sun.com/javase/6/docs/api/javax/swing/JFrame.html#setDefaultCloseOperation(int)
10:37MecDISPOSE_ON_CLOSE?
10:43raekMac: you could use EXIT_ON_CLOSE to shut down the whole application
10:43raekhttp://java.sun.com/javase/6/docs/api/javax/swing/JFrame.html#EXIT_ON_CLOSE
10:44defnwell -- using a profiling tool SEEMED like a good idea, heh
10:44defni have absolutely no idea what is going on
10:44MecI'm looking for one that wont kill my repl
10:49raekMec: sorry, missed the "don't" in the question...
10:50raekwhat happens if you simply don't set any close operation?
10:50MecHIDE_ON_CLOSE is default
10:51raekthat will not shut down your repl, anyway
10:53raekbtw, does anyone know how to get that green/red bar in clojure-test-mode?
10:59bsteuberraek: only did it with clojure.test so far - which went fine
11:00bsteuberso I guess the bars only come for (is ...) forms
11:00MecIs there a way to destructure the first key/val pair in a map
11:01defnMec, could you give an example of the input and your desired output
11:01defnraek: green red bar? got a link?
11:01bsteuber,(let [[[k v]] (seq {:a 42 :b 23})] [k v])
11:01clojurebot[:a 42]
11:02MecThat, but without having to use seq
11:02defnbsteuber: there should be a way to destructure maps now IIRC
11:03bsteuberdefn: oh, I thought yesterday we concluded that this just doesn't work yet
11:03bsteuberbut I'm always happy about new information :)
11:03defnbsteuber: i think we did too, but then someone showed me an example last night with something that looks like it works
11:04bsteuberic
11:04bsteubercould you recall that example?
11:04defnlet me hunt through logs, one sec
11:06bsteuber,(let [[[k v]] {:a 42 :b 23}] [k v])
11:06clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap
11:06Mectoo obvious ;p
11:07bsteuber:)
11:08defn,(let [{a 1, b 2} '(1 2 3 4)] [a b])
11:08clojurebot[nil nil]
11:08defntry that in your 1.2.0-master-SNAPSHOT repl
11:08defnit yields a different result
11:08defn,(let [{a 1, b 2} (take 4 (iterate inc 1))] [a b])
11:08clojurebot[nil nil]
11:08defnthat one also
11:09bsteuberbut that's the different thing: map destructuring on seqs
11:09defnyeah, sorry -- that's where the topic came up so I thought it might be relevant
11:09defnthe fact it didnt work in 1.1 but now works in 1.2 was interesting
11:10defni think in just the last couple of days rich committed something
11:10bsteuberi see
11:10raekdefn: http://vimeo.com/9350864
11:23defnbsteuber: http://github.com/richhickey/clojure/commit/29389970bcd41998359681d9a4a20ee391a1e07c
11:24defn#map #destructure #source #core http://github.com/richhickey/clojure/commit/29389970bcd41998359681d9a4a20ee391a1e07c
11:24defn(sorry, im parsing clojure irc and want to start tagging things I care about :)
11:28Chousukedefn: The way I understand it, that commits allows you to do keyword arguments like (foo 1 2 :op -) as (fn foo [a b & {op :op}] ..)
11:29defnChousuke: brief digression, something not easy to google... could you please explain what - is?
11:29Chousukethe - function
11:29defnwhat is that?
11:29defn,(doc -)
11:29clojurebot"([x] [x y] [x y & more]); If no ys are supplied, returns the negation of x, else subtracts the ys from x and returns the result."
11:29Chousukejust the - function
11:29Chousukenot special syntax or anything, just the argument
11:29defn,(- true)
11:29clojurebotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number
11:30defn,(- 1)
11:30clojurebot-1
11:30defnahhh
11:30Chousukethe foo function in this case would take two positional arguments and one keyword argument (:op, bound to op in the function)
11:30defn,(- -1 -1 1)
11:30clojurebot-1
11:32Chousukeyou can do things like (fn f [& {:keys [init op] :or {:init 0 :op +}}] and call (f :init 1 :op conj)
11:32defnthat's going to take me a minute to parse, let me see here
11:32Chousukebasically just ordinary map destructuring, but instead of having to pass an actual map, the map is constructed from the rest args by applying hash-map on them
11:33Chousukecompare with:
11:33Chousuke,(let [{:keys [a b]} {:a 1 :b 2}] [b a])
11:33clojurebot[2 1]
11:34defnwow i am having trouble with this, heh
11:34MecSUCCESS!
11:34Chousukebut now I need to go off for a moment
11:34defnChousuke: thank you for those examples, ill study them and hopefully in the next 20min have a eureka moment :)
11:35Chousukedefn: map destructuring looks a bit weird a first, but it's not that difficult once you find out the right way to think about them :D
11:35defnChousuke: *nod* -- ill get there -- baby steps!
11:36Chousukethe new syntax just allows a special kind of destructuring of rest args that are key-value pairs
11:37Chousukeessentially giving you keyword arguments
11:40bsteuberdefn: My memory is like Chousuke's
11:40MecIs there anything to use if I want to map over a seq but I dont care about the return
11:40bsteuber,(doc doseq)
11:40clojurebot"([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
11:41Mecoo thanks
11:41bsteuberMec: well, dosew is not exactly like map
11:41MecSo that works just like for?
11:41bsteuber*doseq
11:41bsteuberyeah
11:41bsteuberlike for
11:43Mecdoes doseq have implicit do?
11:45defnMec: yes
11:45defn,source doseq
11:45clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.contrib.repl-utils/source
11:45defnclojurebot: source doseq
11:46defnline 2141
11:51defnGod I want to go to the pragmatic studio course with Rich and Stuart
11:52defnI cannot afford 1500$, but I'm thinking about pawning some things and going without basic necessities for a couple of weeks to make it happen...
11:58raekhrm, in what situations does one need doall instead of dorun?
11:58raeki.e., in what situations does one need the whole seq to reside in memory at one time?
11:59technomancyraek: when you care about return value
11:59technomancyvs just side-effects
12:01raekah, yes... doall returns the whole seq
12:01juannoHi, I had some problems with managing state in a larger gui application and was thinking of a macrobased class system which is inspired by OOP but meant and focussed on GUI and on separating functional logic from imperative state mutation. At the moment it is not very practical but I'm working on it but before I do that I wanted to ask you if there already is a better solution for managing state in a larger ui application except for strong
12:01juannodisciplin just using datastructures?
12:02Mecmap->jtree (no selection listener yet) http://gist.github.com/345693
12:03juannoI planned on defining actions instead of methods where you can specify a logic and a ui-actor. The first one mutates a logical state map, whereas the second one get the logical state map and an ui state map.
12:04chouserjuanno: have you looked at dgraph? I don't know if it's a solution for you but it's in the same problem space.
12:05chouserhttp://github.com/gcv/dgraph
12:11juannoI'm not sure if I really understand it. It seems to address the problem if an input action is dependand of the state of another GUI object. But what if the input action is dependand on a previous input action, is that what the stores values are good for?
12:17patrkrishas anyone here experienced that Vim hangs when trying to invoke run-jetty from ring.adapter.jetty in the VimClojure REPL?
12:23patrkrisok, wasn't only the REPL in VimClojure apparently - also a REPL started with `lein repl`
12:25technomancypatrkris: try (.start (Thread. run-jetty))
12:25technomancyas long as you don't need to stop it later
12:26patrkristechnomancy: i'll give it at try - but what if I need to stop it later? Any suggestions?
12:27technomancynot sure how jetty does that
12:29patrkristechnomancy: in any case, you suggestion worked - thanks
12:36juannochouser: I'm trying to understand the concept of dgraph. Maybe you can have a look at an example of my attempt(even if it is not practical) and tell me if it's really the same problem? http://juanno.pastebin.com/7cu1470D
12:36juannowell, I don't know if my example is understandable.
12:41chouserjuanno: in your example, the widgets themselves store the cononical value for their state, right?
12:44chouserwhile dgraph wants to be in charge of computing the canonical state and triggering the copying of that state into the UI
12:46chouserSo ... My guess is that your lib and dgraph are mostly orthogonal. One could have a ui-class request that looks up a node in the dgraph, and a dgraph computed noe that triggers a ui-class action
12:46chouserI think. :-)
12:48juannochouser: the "logic" is a function which takes an implicit state argument map and returns this map. In this map there's the list(as a string) of prime numbers, so the object stores the computed list before it's getting printed. state is also an implicit argument for the actors. So the "action" specifies a logic and an actor or just an actor which get executed, the logic stores the funtionally computed value in the state map and the actor uses
12:48juannoit in an imperative way.
12:49juanno(I know that actor is not a good name for it)
12:55phren0logyquick question: how come in the repl I can do (.toUpperCase "hello"), but I can't do (map .toUpperCase my-list-of-words)? I get an error that .toUpperCase can't be found in this context.
12:57The-Kennyphren0logy: java-function aren't first-class clojure functions
12:57The-Kennytry (map #(.toUpperCase %) your-list)
12:58The-Kenny# is the reader macro for a anonymous function, % stands for the first argument
12:58The-Kenny(# is one way to do this, the more explicit fn is also available)
13:01phren0logyOK thanks
13:05juannoanother question: where do I get news about useful librarys like dgraph? is there any blog you can recommend or something like that? Should I follow the newsgroup for that or what should I do?
13:09brian__test
13:11brian__hi, anybody know mongo here? I'm calling it in clojure, when I try to load a document com.mongodb.MongoException$Network: can't say something ?
13:11brian__i don't know if its clojure or mongo, or something else
13:12The-Kennybrian__: Sounds like a network problem... but I'm not very experiences with mongo
13:13Bozhidarjuanno: try http://disclojure.org/
13:13Nathellhello all
13:14Nathelldoes anybody have a clue why the following might happen?
13:14Nathellfoo> (class kernel-link)
13:14Nathellcom.wolfram.jlink.WrappedKernelLink
13:14Nathellfoo> (instance? com.wolfram.jlink.WrappedKernelLink kernel-link)
13:14Nathellfalse
13:14Nathellfoo> (= (class kernel-link) com.wolfram.jlink.WrappedKernelLink)
13:14Nathellfalse
13:20MecI think im finally done with map->jtree now that it has listener support. Anyone mind looking it over and seeing if it can be idiomized? It's rather imperative but I dont think that can be helped. http://gist.github.com/345693
13:36ChousukeMec: Looks okay to me. The with-* naming convention is used for macros that create a context. I think you should just name it add-listener or something. Also, if you only have one branch in your if (the (if sub-nodes...) code), you should use when instead.
13:36amatosIs there any function in the standard library that creates map from 2 sequences, one sequence with the keys, another with the values? It is pretty straightforward to implement, but I was wondering if there is already something like that, since it seems pretty useful. I couldn't find anything like that in the API docs....
13:37Chousukezipmap
13:37Mecchouser: ok, thanks
13:37amatosChousuke, thanks, exactly what I was looking for! Wonder why I didn't see it before. Thanks
14:48konrI've got a nested structure that's sorta like a tree, something like {1 {:foo [1 2 3 4 5] :bar [6 7 8 9]} 2 {:bak [1 3 5] :fak [2 4 6]}}. Is there a function that updates elements with a function based on the depth of the element? Something like (my-func 3 inc struct) -> {1 :foo [2 3 4 5 6] ...
14:56raekkonr: maybe you could solve it with assoc-in
14:57raek,(update-in {:foo {:bar {:baz [1 2 3 4]}}} #(map inc %))
14:57clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$update-in
14:57raek,(update-in {:foo {:bar {:baz [1 2 3 4]}}} [:foo :bar :baz] #(map inc %))
14:57clojurebot{:foo {:bar {:baz (2 3 4 5)}}}
14:57raek...or update-in
14:58raekthe assoc/(dissoc)/update/get-in family makes "editing" deep into structures simple
14:59konrhmmm, update-in requires the exact sequence of keys to the desired element :(
14:59raek,(assoc-in {:foo [1 2 3]} [:foo 2] 4)
14:59clojurebot{:foo [1 2 4]}
14:59raek(also works with indicies)
15:00raekmaybe zippers could be useful
15:00raekhttp://richhickey.github.com/clojure/clojure.zip-api.html
15:00konrInteresting! I'll check them out. Thanks!
15:00raekhmm, not much examples there...
15:00raekhttp://clojure.org/other_libraries
15:01raekthere are some good examples
15:03raekmaybe c.c.walk can be user too http://richhickey.github.com/clojure/clojure.walk-api.html
15:04raek*used
15:09alexykhey guys -- I need to map a bunch of strings to ints. E.g. states like "NH" and cities like "Piscataway". Each class of strings maps onto its own integer sequence. Clearly there would be a "static" counter and an "add" method in an object; in clojure, how would one store the counter separately for each class but encapsulated somehow?
15:10alexykI need a "create-sequence" function which would return a map-string function and create the implicit counter for each class
15:12alexyki.e., how do we do closures in clojure?)
15:14leifwI have a function that parses an xml file, and returns a data structure of my own devising, part of which is generated by calling another function on some xml element. This second function is costly, and there are many calls to it for the whole file, so I would like to, instead of calling it to create the structure, instead place in that location a lazy call to it, in the haskell sense, so that it will be replaced with that function
15:14leifwcall's value when it is evaluated
15:14leifwis there an easy way to do this aside from leaving a closure in the data structure and replacing it later?
15:14leifwI would also like to have some parallelism in these thunks if possible
15:23The-Kennyleifw: Maybe just put it in a future?
15:23The-KennyThat would compute the value in another thread, and if you try to access it, it blocks until the function is finished. If it's finished, it just returns
15:26raekalexyk: (defn make-counter (let [counter (atom 0)] (fn [] (swap! counter inc) counter)))
15:27raek(defn make-counter [] (let [counter (atom 0)] (fn [] (swap! counter inc) (deref counter))))
15:27raekforgot arg list and to deref the atom...
15:28raek(def c (make-counter))
15:28raek(c) => 1, (c) => 2, ...
15:29Chousuke(swap! counter inc) is actually enough
15:29Chousukeswap! returns the value swapped in
15:36alexykright
15:38leifw"a" future?
15:38leifwnice
15:38leifwthanks
15:40Quiarkanyone got ccw for eclipse running?
15:41alexykhowever, in my atom there will be a map string=>int. Isn't it expensive to update the whole thing with swap!?
15:44alexykwell, I guess, just like any map
15:44alexykupdating
15:46Chousukealexyk: whole thing? what does that mean?
15:46Chousukeit's no more expensive than ordinary use of clojure maps :)
15:47alexykChousuke: my closure encompasses a map, you give it a string, it returns an int. It may need to add teh string to the map. The map may grow huge. A swap would replace one huge map with another.
15:47alexykright
15:47alexykso kinda hope it'll be smart
15:47Quiarkbut you replace just the pointers
15:47alexykas usual :)
15:47Chousukealexyk: those maps will share structure
15:47Chousukealexyk: the update operation is O(log32 n)
15:48Chousukealexyk: ie. very fast :P
15:48alexykright, so you're saying it's no more expensive than a regular (let [m (assoc m k v)]...)
15:48alexykthe swap I mean
15:48Chousukeright.
15:48Chousukeunless there is contention on the atom, in which case it might have to retry a couple times
15:49Chousukebut that's not usually a big deal :)
15:49alexykright
15:51leifwhmm, looks like the future is spawning a new thread to do the computation immediately
15:51leifwthis doesn't solve my problem, which was heap space explosion
15:51leifwis there something like futures that are truly lazy?
15:52Chousukedelay
15:52Chousukethough thay need to be explicitly dereferenced
15:52leifwok
15:52leifwthanks
15:52Chousukeand remember, that delays might hold references to data and cause a heap explosion by preventing GC
15:52alexykleifw: I didn't fully read your problem, but in lisps code is data -- you can store the functions and then somehow execute them when fetched as needed, I'd wildly speculate :)
15:53leifwalexyk: yeah, I was just hoping for an existing solution rather than trying to swap out closures for data in a thread-safe manner
15:53leifwChousuke: ok, I'll keep that in mind
15:54chouserinteresting that we don't have an 'invoke' fn.
15:54alexykyeah, where's perl's eval?
15:55raekhrm, can someone point me to where I can read about the useage of ;, ;; and ;;;
15:55Chousuke(doc eval) :P
15:55clojurebotDENIED
15:55Chousukeoh damn
15:55lithpryeah, clojure needs more perl mixed in
15:55Chousukeraek: ; end-of-line comments, ;; for commenting in the middle of code, and ;;; for top-level comments (function docs etc)
15:56alexyk,(doc inc)
15:56clojurebot"([x]); Returns a number one greater than num."
15:56alexyk(doc eval)
15:56clojurebotDENIED
15:56Chousukeit doesn't like the symbol eval :P
15:56alexyk,(doc eval)
15:56clojurebotDENIED
15:56alexykhmm
15:57alexyk,(doc hiredman(
15:57clojurebotEOF while reading
15:57Chousuke,(find-doc "eval")
15:57clojurebot------------------------- dk.bestinclass.clojureql.util/quasiquote ([form]) Macro Quote the supplied form as quote does, but evaluate unquoted parts. Example: (let [x 5] (quasiquote (+ ~x 6))) => (+ 5 6) ------------------------- dk.bestinclass.clojureql.util/self-eval? ([obj]) Check whether the given form is self-evaluating. ------------------------- clojure.contrib.fcase/fcase ([compare-fn case-value & test-expr-clauses]
15:57alexyk,(doc hiredman)
15:57clojurebotI don't understand.
15:57leifwmmm, delay/force worked beautifully
15:57leifwthanks
15:57Chousukeoh, clojureql is available...
15:57Chousukehmmmm
16:28raekis there a simple way of doing "update" (as in update-in, but with only one key)?
16:28raekexcept for (assoc m :foo (f (:foo m)))
16:41_mstdefn: good news about the speedup. Nodded off, sorry :)
16:58alexyksay I have a struct which is a strict subset of another struct. Is there a simple way to pick the one from another?
17:05raek,(let [struct-foo {:a 1, :b 2, :x 3, :y 4} struct-bar {:x 5, :y 6}] (select-keys struct-foo (keys struct-bar)))
17:05clojurebot{:y 4, :x 3}
17:06underdev,(def #^{:doc "val of x"} x 15)
17:06clojurebotDENIED
17:06raekselect-keys returns a subset of the entries of a map
17:06underdevmaybe it's my mouthwash?
17:07underdev,(def x 6)
17:07clojurebotDENIED
17:07underdevhuh.
17:07raekalexyk: does (select-keys struct-foo (keys struct-bar)) solve your problem?
17:07The-Kennydef'ing is not possible in clojurebot
17:08underdevoic
17:09underdevdid clojure lose the ability to attach metadata to symbols in 1.2?
17:10underdevno, it must not have
17:10alexykraek: indeed it does! struct-foo is a wider value, instead of struct-bar I say (struct bar) for it doesn't exist yet
17:10underdevhnmnnnnn
17:11polypus(defmacro defmodule [name params & body]
17:11polypus `(defn ~name ~params
17:11polypus (let ~(vec (apply concat (for [p params] [p 8])))
17:11polypus ~@body)))
17:11alexykdid anybody build clojure-contrib-1.2-master-SNAPSHOT from git checkout with maven? My complained that clojure-1.2-...same is not installed, although I did install it right before with maven.
17:11polypus(defmodule foo [a b] (* a b))
17:11polypus(foo 2 3)
17:11polypusalways evaluates to 6
17:11polypusi'd like it to evaluate to 64
17:13raekunderdev: do you quote the symbol?
17:13polypusthe macro expansion looks like: (clojure.core/defn foo [a b] (clojure.core/let [a 8 b 8] (* a b)))
17:14underdevoic (meta #'x)
17:14underdevraek: ty
17:15raekalso: #^{:foo "bar} 'baz attaches metadata to the (quote bar) form
17:15raek*(quote baz)
17:15raekIIRC
17:16raekunderdev: that gives you the metadata of the var named x
17:17raek(meta (var x))
17:17raek,(meta inc)
17:17clojurebotnil
17:18raek,(meta #'inc)
17:18clojurebot{:ns #<Namespace clojure.core>, :name inc, :file "clojure/core.clj", :line 640, :arglists ([x]), :inline #<core$inc__4504 clojure.core$inc__4504@e522a0>, :doc "Returns a number one greater than num."}
17:18raek,(meta (with-meta 'inc) {:foo "bar"})
17:18clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$with-meta
17:18raek,(meta (with-meta 'inc {:foo "bar"}))
17:18clojurebot{:foo "bar"}
17:18underdevraek: i'm not correcting you, i am trying to understand, is the metadata on the var x, or the symbol x?
17:18raekboth, can have metadata
17:18underdevoic
17:19raekthe metadata on the var is probably the most interesting
17:19raekthe #^{...} reader syntax attaches metadata to the form after it
17:19raeki.e. the symbol
17:19raekthat metadata is seen by the compiler
17:19underdevrt, that's what i'm trying to attach the metadata to (in this expeririment
17:20raekbut the symbol is resolved into a value, and the metadata for the symbols is not copied to the value
17:20raekyou can attach metadata in eval-time with "with-meta"
17:21underdevokay, i'll look that up
17:21raek(with-meta 'foo {...metadata...}) attaches metadata to a symbol
17:21chouserat runtime. :-)
17:22underdevi like kitties. kitties purr.
17:22underdev<sigh>, okay, i don't even understand it enough to mess around with it
17:23raek(with-meta [:kitty-1 :kitty-2 :kitty-3] {:trivia "liked by underdev"})
17:23underdevthanx rael
17:23underdevraek
17:25raekso (possibly repeating myself), metadata can be attached to data structures (maps, vectors, etc), symbols (hints to the compiler), and vars (docstring etc)
17:25raek(actually, anything that implements IMeta)
17:26chouseranything that implementes IMeta can report metadata, but may not have a way to change it.
17:27chouserreference types support changing their metadata using 'alter-meta!'
17:28chouservalue types that implement IObj support persitent "updates" of their metadata via 'with-meta' and 'vary-meta'
17:30alexykraek: after select-keys, can the map be blessed somehow at once to become a struct?
17:31underdevthanks guys, i've copied all that down as i go back to read more about the topic
17:32alexykraek: so where is your bahnhof? :)
17:32polypusmacro Q: http://paste.lisp.org/display/96969
17:33raekalexyk: 1) you can always do a (into (empty struct-object) (select-keys struct-object ...keys...))
17:33polypusforget it. figured it out
17:33raekalexyk: 2) Linköping :)
17:35raekalexyk: I checked in the source for select-keys. it always returns a hash-map
17:36raekmaybe "(loop [ret {} keys (seq keyseq)]" shoulde be changed to "(loop [ret (empty map) keys (seq keyseq)]"
17:36alexykraek: interesting!
17:37alexykraek: love town names with umlauts in them :)
18:46raekhow does error-kit/raise work inside a transaction?
18:47raekif I have a handler outside the transaction, will it revert correctly?
18:50raekhrm, looking in the source
18:51raekseems that raise will throw a java exception in order to "jump back" to the handler
18:51raekthus, the transaction should be droped
18:57chouserraek: sounds right
19:03raekchouser: great job with error-kit, btw!
19:05chouserah, thanks. Are you doing any clever error-handling, or just basic throw-catch kinda stuff?
19:06raekjust basic throw-catch
19:07chouserok. hardly anybody ever uses more than that. Did you look at clojure.contrib.condition?
19:07raekhrm, no. haven't looked at that
19:08raekreading the mail thread now
19:12raekinteresting...
19:12raekchouser: would you recommend using that instead?
19:13raekit seems to have everything I need in my case
19:15raekbtw, are there any more try-catch libs I should know about, more than error-kit, condition and except?
19:16defnchouser: ive had this answered by a couple people but i just wanted to be sure im not missing something: is it possible to do destructuring on a map?
19:16defn(without seq'ing on it)
19:17defni think i misunderstood a recent commit
19:18_ato,(let [{f :foo, b :bar} {:foo 1, :bar 2}] f)
19:18clojurebot1
19:18dnolendefn: it's been possible to destructure a map for a long time now. the commit is really about making it easy to define functions which take optional parameters
19:19dnolenoptional keyword parameters rather
19:19_ato,(let [{:keys [foo bar]} {:foo 1, :bar 2}] foo)
19:19clojurebot1
19:19_ato^ very handy shorthand form
19:19_ato(well shorted when you have more keys anyway ;-)
19:20raek,(let [[& {foo :a, bar 1}] {:a 2}] [foo bar])
19:20clojurebot[nil nil]
19:20raek,(let [[& {foo :a, bar 1}] [:a 2] [foo bar])
19:20clojurebotUnmatched delimiter: )
19:20raek,(let [[& {foo :a, bar 1}] [:a 2]] [foo bar])
19:20clojurebot[nil nil]
19:20defncool thanks
19:22raekthe thing that is (possibly) about to change is the behaviour of & {...} when passed a vector
19:22raekinstead of doing destructuring on the indices of the vector, apply hash-map on it and do destructuring on that
19:23raekhave I understood this right??
19:38raekhow should test namespaces be organized when using clojure-test-mode for emacs and a leiningen project directory layout?
19:40raekfor example, if I have foo.bar.x in src/foo/bar/x.cl, where should the test cases for that namespace go?
19:41_atotest/foo/bar/test/x.clj if I remember correctly
19:42_atoso test version of the namespace is foo.bar.test.x
19:43raekah, an extra "test" segment to make sure namespaces of tests and implementations have different names?
19:43raek_ato: thanks!
20:51leifwok, I am really getting sick of this error: I'm trying to use slime with swank-clojure. I've installed clojure-1.2.0 from git, along with clojure-contrib, and both these jars are in ~/.clojure. I've also installed swank-clojure (and slime and slime-repl) from the ELPA. When I run M-x slime, it says it cannot find swank/swank__init.class or swank/swank.clj on the classpath
20:52leifwI was assuming that the elpa install would set these correctly, but that seems not to be the case. I also saw something that made it seem as though CLASSPATH was not dynamically editable, which I suppose means that maybe I have to start emacs with CLASSPATH set to include the path where it was installed?
20:53leifwis there a way I can just compile the jar and drop it in .swank-clojure?
20:56raekI think that ELPA is supposed to be able to do this correctly
20:58raekhowever, I have no idea how the internal machinery in all this actually works...
20:59raekleifw: what does your .emacs look like?
21:02raekI have the path to swank set in mine
21:03raekleifw: here is mine: http://gist.github.com/346470
21:04raek"~/Projekt" is where I keep my clones of people's git repositories...
21:05leifwok cool, thanks
21:27alexykhow do you add/remove an element to a set #{} ?
21:29_ato,(conj #{} :a)
21:29clojurebot#{:a}
21:29_ato,(disj #{:a} :a)
21:29clojurebot#{}
21:29_atoalexyk: ^
21:30alexykcool. I grepped Stu's book to naught. What's a general way to doscover methods which work on a datastructure?
21:30alexykcould reflection or grepping of docs tell me that?
21:31talioshrm
21:34_atoalexyk: not generally -- due to the dynamic typing there's no way to know programmatically what will work on a particular data type. However, for stuff in clojure.core, if you haven't seen it before, this is very handy: http://clojure.org/cheatsheet
21:34alexykah ok, thx
21:36alexykkeeping state: so far, I found closures, with constructors returning maps with fn's. Then calls look like ((closure :fn-key) fn-params). Are there any better-looking ways? Or would just have to define a macro?
21:37dnolenalexky: creating closures to maintain state is generally not encouraged. putting fn's in maps is also not encouraged. why not just use the reference types?
21:40alexykdnolen: how do you use a ref type to have a map of string to ints, which has a method for a string to return an int, possibly adding it to the map with the next integer from 0?
21:40phren0logyb vvvvvvv
21:40leifwraek: which swank-clojure did you clone?
21:40phren0logyoops, cat on the keyboard. sorry.
21:41leifwmine doesn't have src/main/clojure, only src/swank
21:42Drakesonwith (deftype foo [a] :as this Runnable (run [] (???) "foo")), how can I set (:a this) to a value (mutate the instance)?
21:43_atoalexyk: so you have a map of strings to ints and when you access an entry that is missing you want to autoincrement a new int value and add it to the map?
21:43alexykdnolen: do you mean ref as reference type?
21:43alexyk_ato: yep
21:44_atohmm... I guess one way would be to have the map in an atom (or ref if you need transactions), attach metadata to the map of the last int value
21:46taliosmmm, could you use an agent which stores the map with a count metadata, send it a function to increment/store?
21:48taliosfrom what I know of agents, one thing that's always irked me is that it seems you can send -any- function to an agent, which could be nasty. Would be nice to have some form of pre-condition on the agent which lists acceptable functions (almost like a protocol/interface for the agent)
21:48alexyk_ato: that's what I did, http://paste.pocoo.org/show/194683/, but dnolen sternly admonishes me :)
21:49alexykshow me how to do it without a closure and mapped fn's
21:51alexyk...or forever keep your peace :)
21:51dnolenalexky: checking it out
21:51alexykkk
21:53alexykusage: (def m (make-mapper)) ((m :map) "a") ((m :map "b") ((m :map) "a") ((m :get-map))
21:56_atothis is the way the occurred to me: http://gist.github.com/346494
21:57_atoI don't know whether that's any better/worse
21:58_atoactually, if it's just based on the count
21:58_atoyou could just use (count) instead of metadata
22:01alexykinteresting
22:01dnolenalexky: this is really short
22:01dnolenhttp://gist.github.com/346500
22:01dnolenI think it does what you want
22:03_mstdo the numbers have to be sequentially assigned? Or just unique?
22:03_mst(.hashCode "mystring") for the smartass response :)
22:08_mst... I'll get my coat
22:10_atolet me be the first to say, hash collisions!
22:10JonSmithdo a sorted map
22:10JonSmithor wait
22:10JonSmithmaybe not
22:10JonSmithdepends on the use case
22:11JonSmithwhat is being done with it?
22:21_mstOK OK, maybe not .hashCode then :) But some other fangled hash function involving multiplication by primes and stuff like that :)
22:30alexyk_mst: sequentially
22:31_mstaw :)
22:34alexykdnolen: short indeed... but closure encapsulates m and I can do whatever to it. Why is it discouraged?
22:34alexykbasically it's a hand-made OO.
22:35alexykthe only thing missing is Perl's ugly syntax! $ref->{oo}
23:42DeusExPikachuis there any form of global configuration for leiningen?