#clojure logs

2010-03-28

00:27bmasonDeusExPikachu: I don't think so... what would you want to configure that wouldn't be project specific?
00:29DeusExPikachubmason, I want to use a different repository for all dependencies
00:29DeusExPikachuas an example
00:29DeusExPikachus/dependencies/projects
00:29DeusExPikachuincluding leiningen
00:30bmasondo you have a lot of projects?
00:30DeusExPikachuthe network has limited access to the outside world, would be better if I could create a repo on the intranet
00:31bmasonone thing you can probably do... since the project file is just clojure code, you could probably reference a master file that contained a definition for your desired data structures
00:31DeusExPikachudoesn't even matter if I have a lot of projects, cause even using existing projects can pull in a lot of jars
00:31bmasongotcha
00:32DeusExPikachuI'm thinking actually just having a local fork of leiningen
00:32bmasonyeah that's possible
00:32DeusExPikachuthe code is really simple
00:32DeusExPikachu<800 lines
00:33bmasonhehe gotta love clojure
00:33bmasonif you don't have a lot of projects though, why not just edit all the project.clj files to point where you want?
00:34taliosDeusExPikachu: sounds like you want to run something like http://nexus.sonatype.org - Nexus is a repository manager
00:34DeusExPikachubmason, many of those projects are not mine, and are managed by git
00:34talioscaches upstream repos, use it locally
00:34DeusExPikachutalios, the repo needs to be private cause it has private code
00:35bmasonah I see... but you control the installation of leiningen
00:35bmasonso you want to change its behavior
00:35DeusExPikachubmason, right, many people will be using whatever version of leiningen I have up
00:35taliosDeusExPikachu: yep - you dont need to make your instance of nexus public tho - have it preseeded with the outside world now and then then lock it down
00:36DeusExPikachutalios, that's true, similar to github
00:36taliosI know maven has a setting to say "use this mirror" which I point to $work's nexus install, I assume leiningen has some form of mirror support as well
00:36taliosi hope
00:36taliosDeusExPikachu: yep, altho github is source, not released artifacts
00:37taliosand github isn't running on your network - unless you pay the big $$$
00:37bmasonsomething else to consider...
00:37bmasonyou could set up a proxy that caches the packages
00:37DeusExPikachutalios, oh I was thinking nexus was a service
00:37bmasonyou can do this at a networking level and never have to mess with any of the software
00:38taliosbmason: thats effectiely what nexus is/does - a proxy cache, but with intelligence/searching ( and you can deploy to as well )
00:38DeusExPikachuI have very limited control over what happens on the server
00:38taliosbut yeh - just set up a squid proxy
00:38bmasonah, I gotcha :)
00:38taliosyou'd just need to preseed the proxy/cache with upstream/required deps
00:38DeusExPikachubasically I got ssh access and thats it
00:38DeusExPikachuevery other port is blocked
00:39DeusExPikachuI know maven supports sftp though
00:42bmasonImpressive: http://nexus.sonatype.org/allyourartifacts.png
00:43taliosthat. is. cheesey.
00:45bmasonfrom their FAQ
00:45bmasonI thought it was funny :)
00:45taliosindeed.
00:46bmasonbeats reading MSDN
00:46taliosheh - and here I was thinking I sad to have to download 6gig of MIX10 videos!
00:46taliosok, maybe I am. esp. as a java/clojure guy
00:47alexyktechnomancy: is it still not possible to specify which version of clojure to run lein repl with?
00:48bmasonMIX10?
00:48taliosbmason: http://www.microsoft.com/events/mix/ - Microsoft developer conference that was on the other week
00:49bmasongotcha
00:49bmasonyeah... I just can't get excited about silverlight
00:50bmasonand a web conference sponsored by microsoft? seems kinda doomed
00:50taliosbmason: theres actually some good sessions there, on jquery, and web security (shock to see that from MS!)
00:50bmasonhmm
00:51bmasonjquery is nice... I might be interested in that one
00:51bmasonthe more I'm reading about RESTful design though the more I really see things going that way
00:51taliosAJAX != REST tho
00:51bmasonand REST doesn't really seem to be a part of Microsoft's vision at all
00:51bmasonright :)
00:52taliosand sadly, the more I see of peoples REST APIs they more I see them failing
00:52bmasonany particular reason?
00:52bmasonso am I
00:52taliosoh really?
00:52bmasonyeah
00:53bmasonI just picked up a book that was released like 2 weeks ago...
00:53bmasonhere, I'll find a link
00:53taliosrest cookbook?
00:53bmasonyup
00:53taliosneed to get a copy of that
00:53bmasonSubbu something
00:54bmasonhere we go: http://www.amazon.com/RESTful-Web-Services-Cookbook-Scalability/dp/0596801688/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1269751923&amp;sr=8-1
00:54talioshttp://github.com/talios/wellrested is my REST sandbox project
00:54bmasonI was reading an article he wrote on infoq, I liked his explanation of HATEOAS
00:55bmasonhaha
00:55taliosit's still at the "lets explore what I want to do, API wise", now I need to clean it up
00:55bmasonyeah, me too
00:56talioshttp://github.com/talios/wellrested/blob/master/src/main/clojure/com/theoryinpractise/wellrested/webapp.clj is the main code
00:56bmasonI've been working on some multimethods to convert my resources to different formats
00:56talioscool
00:56bmasoncurrently I'm defining my resources in XML and I can convert that to HTML based on the user agent
00:57bmasonwhich is nice... I can hit my URL in a web browser and get a list of properties and links for a given resource
00:57talioscool
00:57bmasonall formatted in an HTML table, with links to the document types and such
00:57bmasonwhich in theory would work :)
00:58taliosassuming you have something which can render your media types
00:58bmasonmeaning?
00:59bmasonthe resources themselves are defined pretty generally... and I don't plan to include pictures and video or other content types directly
00:59taliosWhat's the content type of the resources you return? text/xml?
00:59bmasonthose would just be links
01:00taliosThe problem I've found with 99% of all REST frameworks is they lead you down the path of returning "application/json" or "test/xml" - which is just broken.
01:00taliosor accepting those
01:00bmasonwhat's the broken part?
01:00bmasonhaving a custom format or having a single format?
01:02taliosthe media type - if you have a resource say accepts a POST of "application/json" you have no idea what you can post to it, but it accepts "application/bmason-customer+json", you know that you can only post a document of that media type
01:02taliosother wise you could post {} [], which is valid JSON, but probably invalid data for your service ):
01:02bmasonsure
01:03taliosSimilarly, if you receive content of "application/json" all you know is you have JSON, with no idea of how to render it
01:03bmasonso the REST API's you've seen don't include custom definitions of their doc types?
01:03taliosunless the client upfront 'knows' that it requested something specific, and got it
01:04taliossome do, but they also have documentation saying "to do XXX, POST to /foo/service/xhandler" - which is wrong. As that should be discoverable at runtime
01:04bmasonright
01:05taliosthey seem to do either one side or the other right, but not both.
01:05bmasonyeah, there's some basic principles that need to be followed in order to have a well defined contract with your clients :)
01:05taliosAnd that defined contract is the media types, and link semantics
01:05bmasonwith a HATEOAS API you're essentially making the work flow a part of that contract
01:06bmasonand it's imperative to define your document types as well
01:07talios*nod* whereas things like JAX-RS seem more about mount paths, and generic serialization of your objects to application/json
01:07taliosif they made it part of the contract that you had to define a custom media type, that would be helpful
01:07bmasonyeah... really doesn't help
01:07bmasonat some point the programmer has to know how to parse that
01:08bmasonlol
01:08bmasonoh I think the REST principles are wonderful
01:08bmasonit's called not reinventing the wheel
01:08taliosthat being said - our REST API at work is still more at HTTP level 1
01:09taliosbut we're evolving that
01:09bmasonwell, I work at a Microsoft shop
01:09bmasonso my coworkers mostly think I'm crazy
01:09bmasonall those open source shenanigans are doomed to failure, right?
01:09talioshave you seen this table: http://nordsc.com/ext/classification_of_http_based_apis.html
01:10bmasonthank you sir!
01:10bmasonI had not
01:10talioswas made up about 2-3 weeks ago
01:11bmasonthat... may be useful for convincing others
01:11taliosYou might find the http://tech.groups.yahoo.com/group/rest-discuss/ list a good read too
01:12bmasonyeah I think I've found some of Subbu's posts on there
01:12bmasonhttp://www.infoq.com/articles/subbu-allamaraju-rest
01:12bmasonthat's the article I read that really enlightened me about REST
01:13taliosdon't think i'ver seen that link yet :) cheers - it's an old one too
01:13bmasonvery clear explanations... when I saw he'd written a book I did not hesitate to buy :)
01:13glogicwhoa
01:14bmasonwords immortalized by Neo
01:14glogic203 nicks
01:14glogici had no idea clojure was this popular
01:15bmasoncya talios
01:15bmasonnice talking!
01:15glogici don't get it, is clojure supposed to be more CL or more scheme, it seems more like some ohter language than a lisp
01:15taliosseeya - talk again sometime
01:15_atoglogic: neither, it is its own lisp
01:15taliosI'd probably say its neither
01:15bmasonclojure is functional programming made practical and approachable
01:16taliosbmason: that sounds like a politically correct response :)
01:16glogicbmason: that sums it up though
01:16glogictalios: no i can start there tha'ts good
01:16glogicso what is it about clojure you like
01:16glogici know that's general
01:16glogici'm just curious
01:16bmasonwell I was trying to get into FP for some time
01:16bmasonI tried Haskell and found it really arcane
01:17glogici tried it recently and i didn't quiet get it i tried defun def define and never got anything defined only to find out like an hour later you have some custom syntax for what looks like a lambda
01:17bmasonthere's some big advantages to FP, and I really wanted to take part in that
01:17glogicbmason: haskell gah
01:17glogicbmason: i agree, i was just wondering what made clojure attractive
01:18bmasonwhen a friend told me about Clojure I tried it out and was just amazed by how easy it was to pick up and how elegant the solutions were
01:18glogicthe community seems to have grown very rapidly
01:18bmasonconsider the select syntax: (select predicate dataset)
01:19bmasonyou have simplicity, and flexibility
01:19glogic(select string? '("hang" on))
01:19glogic?
01:20bmason(select string? #{"hang" :on})
01:20glogichey what's the deal with this (def sym [arg1...argn+1] ...)
01:20talios,(select string? #{"hang" :on})
01:20clojurebotjava.lang.RuntimeException: java.lang.ClassCastException: clojure.core$string_QMARK___4262 cannot be cast to java.lang.Number
01:20glogicdoh
01:20taliosinteresting
01:20bmasondoh!
01:20glogicso what' this mean #{} syntactically
01:20taliosset
01:21glogicso i'm assuming #{"hang" :on :on} is not valid?
01:21_mst,(clojure.set/select string? #{"hang" :on})
01:21clojurebot#{"hang"}
01:21glogicoh damit i could have done #{"halcyon" :on :on}
01:21bmason,(#{:foo :bar :baz} :foo)
01:21clojurebot:foo
01:21_ato,select
01:21clojurebot#<finite_distributions$fn__6788$select__6817 clojure.contrib.probabilities.finite_distributions$fn__6788$select__6817@520fa4>
01:22bmason,(#{:foo :bar :baz} :bam)
01:22clojurebotnil
01:22_atoheh, different select is imported into the bot's namespace
01:22glogicoh damit i could have done ,#{"halcyon" :on :on}
01:22taliosdoh
01:22glogic,#{"halcyon" :on :on}
01:22clojurebot#{"halcyon" :on}
01:22bmasonoh, that explains some things
01:22glogicoh neat
01:22glogicnice tha'ts what i'd expect
01:22glogic,#{"halcyon" :on :on :on}
01:22clojurebot#{"halcyon" :on}
01:22glogicoh hot
01:22_atohaha
01:22glogictha'ts a bit of magic isn't it
01:23bmasonso... anyway
01:23taliosanyway - off for a bit
01:23bmasonStuart Holloway's book uses an example of sets where each item is a hash
01:23glogicbtw wha'ts lambda
01:23bmasonso you're basically dealing with a table structure at that point
01:23glogic'lambda
01:23glogic?
01:23_ato,((fn [x] x) 2)
01:23clojurebot2
01:24bmasonand the select works like you'd expect it to in SQL
01:24glogicwha'ts fn?
01:24_atolambda
01:24bmasonexcept your WHERE clause is the predicate
01:24glogichrrm
01:24bmasonlambda calculus is the branch of math that functional programming is based on
01:24glogic,(def thing fn [x] x)
01:24clojurebotDENIED
01:24glogic(define thing (lambda (x) x))
01:25bmasonit's different from the Von Neuman architecture that almost all computer hardware today is based on
01:25_ato(def thing (fn [x] x))
01:25bmason(and most programming for that matter)
01:25_atoor (defn thing [x] x)
01:25_atobut the bot won't let you do define stuff
01:25bmasonthat may be more general than you were asking for though :)
01:27glogic,(set! xx (fn [] fn))
01:27clojurebotjava.lang.Exception: Unable to resolve symbol: xx in this context
01:27glogicok wow tha'ts implemented well
01:29bmasonalso that would be (def thing (fn [x] x))
01:29bmasonoh sorry
01:29bmasonchat wasn't scrolling :)
01:30glogicbmason: i was testing to see if xx has to exist before set! was called
01:30glogicbmason: and it does
01:31_ato,(set! inc dec)
01:31clojurebotjava.lang.IllegalStateException: Can't change/establish root binding of: inc with set
01:31_atoset! in fact only works on thread-local vars
01:31glogic_ato: so i just can't set lambda
01:32_atoyeah, and since fn is macro you'd have to actually define a lambda macro
01:32glogicwow
01:32glogicso basicaly i won't be crashing clojurebot today
01:33glogicat least not like that lol
01:33_atoheh, yeah clojurebot is battle-tested in that regard
01:33glogichah
01:33glogici know somoene who can make it go boomo
01:33_atoit's been sitting in the channel for a couple years taking all the abuse we throw at it ;-)
01:34talios,(System/exit 0)
01:34clojurebotjava.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
01:34talios:)
01:34glogicok so
01:34glogicclojure is this very strange dialect of lisp that everyone seems to be ridiciulously engrossed in
01:34glogicand apparently quite the phenomena
01:35bmasonglogic: what got you interested?
01:35glogicboredom mostly
01:35glogicspent a month on prolog
01:35glogicspent an hour on python before i wanted to throw the computer through the window
01:36bmasonoh?
01:36glogici swear that language si some kind of sick joke
01:36bmasonI never got into python either... we had to do some python for a physics class
01:36glogicintended to destroy the hands of bad typists
01:36bmasonyeah, I'm not fond of whitespace based syntax
01:37bmasonif that's what you're referring to :)
01:37glogicy
01:37glogicyes
01:37bmasonlisp syntax looked really arcane to me at first, but the benefits became quickly apparent
01:38bmasonand paredit mode in emacs makes it a breeze
01:38glogiclack of syntax is where it's at
01:38bmasonyup yup
01:38glogicand clearly everyone in here agrees or you wouldn't have spent all this time on a new dialect of lisp
01:38bmasonthrow the eccentricities out
01:38bmasonlet's get down to data structures
01:38glogicwell you half agree
01:38glogicsince i've seen intense amounts of syntactic sugaring
01:38bmason:-D
01:39bmasonclojure looks a lot prettier than most CL I've seen
01:40bmasonand I think that's part of what makes it approachable to the non-lisp community
01:40glogicyeah
01:41glogici realized that most humans actually require a certain level of complexity, it's like, having more to grab on to helps somehow
01:41glogicit's very very strange people that don't
01:41glogichang out in #porlog you'll see what i mean
01:42glogic#prolog* even
01:42bmasonyeah, I think in particular giving different syntax to the types of collections was a really good step
01:44bmasonthe reader macros are nice, but the collection types being immediately noticeable is far more important IMO
01:44bmasonthat gives the code a sense of character
01:45bmasonanyhow, I'm gonna call it a night
01:45glogicsame
01:45glogicthx
01:45bmasonenjoy your clojure :)
01:45bmasonlikewise
01:48defn,:a#
01:48clojurebot:a#
01:48defnis that a valid map key?
01:49defn,{:a# 128}
01:49clojurebot{:a# 128}
01:49defni mean -- is there any reason not to use it?
01:49_atoit's similar to autogensym, but should be okay as its keyword not a symbol, I guss
01:50defnokay cool -- it's nice to be able to use something that looks like a sharp when doing music stuff
01:57defnhow does one take (1 2 3 4), and create a map where the values are [a b c d], like: {a 1 b 2 c 3 d 4}
01:57defnerr rather "where the keys are [a b c d]"
01:58_ato,(zipmap [:a :b :c :d] (iter inc 0))
01:58clojurebotjava.lang.Exception: Unable to resolve symbol: iter in this context
01:58_ato,(zipmap [:a :b :c :d] (iterate inc 0))
01:58clojurebot{:d 3, :c 2, :b 1, :a 0}
01:58defnah yes, zipmap
01:59defnthanks _ato
02:06defn_ato: one more for you -- how do you create an infinite repeated vector from a single vector, like [1 2 3 4] => [1 2 3 4 1 2 3 4 1 2 3 4]
02:07_atocycle
02:07_ato,(take 10 (cycle [1 2 3 4]))
02:07clojurebot(1 2 3 4 1 2 3 4 1 2)
02:07defnhaha, agh!
02:07defnhow do you remember all of these
02:07defni havent used cycle in so long... i need to do some more project euler
02:08_atodunno how I remember them, guess I've just used them enough that they've stuck ;-)
02:10defn,(let [keys (cycle [:a :a# :b :c])] (zipmap keys (range 3 13)))
02:10clojurebot{:c 10, :b 9, :a# 12, :a 11}
02:14defn,(let [keys (cycle [:a :a# :b :c])] (zipmap keys (range 21 109)))
02:14clojurebot{:c 108, :b 107, :a# 106, :a 105}
02:14defnhm, why does that happen i wonder
02:19_ato,(zipmap [:a :b :c] [1 2 3 4])
02:19clojurebot{:c 3, :b 2, :a 1}
02:19_ato,(zipmap [:a :b :c] (range 21 109))
02:19clojurebot{:c 23, :b 22, :a 21}
02:20_atooh right
02:20_atoyou cycled the keys
02:20_atoso its going to pick up the last values
02:20_ato,(zipmap [:a :a :a] [1 2 3])
02:20clojurebot{:a 3}
02:23defn_ato: i was originally thinking repeatedly take (count [x y z]) [x y z]
02:23defnbut that gave me ([x y z] [x y z]) so i needed a flatten which just seems wrong
02:27talios 'lo defn
02:31defnhi talios
02:32defntalios: how goes the hacking?
02:34taliosnot so much code hacking today, been playing with vagrant/chef foo :) and found a bug in the clojure/maven plugin :(
02:42vIkSiThello all
02:43vIkSiTcould anyone point me to some docs about AOT compilation?
02:43vIkSiTsomething that talks about steps involved - I'm trying to figure out a higher level picture than just (compile 'class.name.lib)
02:43vIkSiT(for instance - paths)
02:43defnhttp://www.youtube.com/watch?v=UVbwRAtzyDU
02:43defnwoops wrong window -- sorry
02:44defntalios: finding bugs is never any fun :)
02:44taliosdefn: esp. ones you thought you'd fixed :(
02:45defnaww :(
02:45taliosthankfully I've been lazy and never really made a big announcement of that last release :)
02:46taliosvIkSiT: how higher level than http://clojure.org/compilation do you want?
02:47vIkSiTtalios, well - I've got the sample program. now - where does one enter the (compile 'class) statement?
02:47vIkSiTand which paths is it with respect to?
02:48taliosyou'd enter the (compile...) commands in the REPL. and it writes the .class files to the directory you mention in the system property when you start that REPL
02:49taliosI never liked the "compile from the REPL" thing tho, which is what led to the maven plugin ( and I guess leiningen )
02:49vIkSiTaah I see
02:49talioshttp://zef.me/2470/building-clojure-projects-with-leiningen is a good intro to lein
02:49vIkSiTwell yes, I was just trying the REPL compilation. But no matter what I do, it doesn't find the clj path on the CP
02:50vIkSiTyes I'm familiar with lein. I guess I was trying to do the equivalent of "javac foo.java; java foo" without resolving to build systems
02:50taliosright.
02:50talioshow are you starting the repl?
02:51vIkSiTusing the clj script from http://mark.reid.name/sap/setting-up-clojure.html
02:53taliosmmm, looks like that'll look for .clj files in your current directory
02:53vIkSiTyes, it also supports the .clojure file in the dir to add classpaths
02:54vIkSiTso I added /long/path/to/hello.clj to .clojure, and I run the repl using clj
02:54vIkSiTand end up with a java IO exception
02:54vIkSiT(on compile)
02:55_atotry adding /long/path/to/ to .clojure instead of /long/path/to/hello.clj
02:56taliosyou wouldn't mention a .clj file in .clojure tho, as thats classpath's, if hello.clj was in the "hello" namespace, you'd add /long/path/to
02:56taliosbah, like _ato just said :)
02:56_atoclasspath should consist of directories and jars, not individual source files
02:56vIkSiToh right. let me check
02:59vIkSiThmm now my setup looks like this:
02:59vIkSiThttp://paste.lisp.org/display/96978
02:59vIkSiTI call clj from /dir1
02:59vIkSiTer that should be /dir1* in .clojure in the paste
02:59taliossince your NS is clojure.examples.hello
03:00vIkSiTright?
03:00taliossince your NS is clojure.examples.hello you'd want to have just /dir1 in .clojure
03:00vIkSiTI've tried that as well.
03:00taliosas it takes the the NS, replaces the .'s for path separators
03:01talioswhats the behaviour that you see when you try to (compile)?
03:03vIkSiTjava.io.IOException: No such file or directory (hello.clj:1)
03:03taliosand for verification - how are you compiling? whats the actual line you're using?
03:03clojurebotthanks; that was delicious. (nom nom nom)
03:03vIkSiTsec
03:04vIkSiT(compile 'clojure.examples.hello)
03:05vIkSiTdoes the trailing slash in .clojure matter, btw?
03:05taliosit shouldn't...
03:06vIkSiTsee : http://paste.lisp.org/display/96978#1
03:08taliosare you on linux or the like?
03:09vIkSiTOS X
03:09taliosok thats goodo.
03:09taliosif you run: ps aux | grep java
03:10taliosfind the entry that mentions clojure ( you could just grep for clojure I guess ) - whats the actuall command line its running?
03:10taliosdo this whilst the repl is running
03:11_atotry making a directory: .../dir1/classes
03:11_atoand add it to your .clojure as well
03:11taliosah yes!
03:11_atoI think $PWD/classes is the default value for clojure.build.path
03:11vIkSiThmm, I did check the ps output. Looks like java is running fine, the CP is set fine
03:11vIkSiTI'm using jline.consolerunner, which seems to be running fine
03:11vIkSiTokay
03:12taliosinteresting - I don't see that mentioned on the clojure.org page about compilation anymore
03:12vIkSiTokay, this is interesting.
03:12vIkSiTLooks like the classes directory got filled up with the right classes
03:13_atoerr yeah... clojure.compile.path, not clojure.build.path
03:14vIkSiTokay, so looks like I'm running fine with the classes option. I guess I can stick to the default for now
03:15vIkSiTfrom the doc, "A loader classfile will produced in my/domain/lib__init.class, under *compile-path*, which must be in the classpath"
03:15vIkSiTbut that doesn't mention anything about it being $PWD/classes
03:16taliosone annoying thing I discovered about the compiler today - if you (compile) a namespace, the compiler outputs all namespaces to the classes dir, not just those in the namespaces you specified)
03:16taliosso any namespaces (use)'d also get written to disk
03:16vIkSiThttp://paste.lisp.org/display/96978#2
03:17vIkSiTI still don't get a lib__init.class though
03:18vIkSiThello__init.class still doesn't exist.
03:19vIkSiTok, adding /dir1/classes to .clojure helps
03:19vIkSiTwhew. finally!
03:20vIkSiTthanks talios , _ato
03:41taliosamusing - I just spotted vIkSiT's blog on AOT ;-) http://www.viksit.com/content/clojure-aot-compilation-tutorial
04:48taliosnice - someone's patch pmaven-clojure with support to make it use leiningen syntax.
06:11LauJensenHey crew
06:24esjHello Mr Lau
07:05etatehey Lau
07:10vyAren't there any list-files [http://paste.lisp.org/+22TV] in contrib or in core?
07:11LauJensenvy (file-seq (File. "/home/"))
07:11LauJensengives you all files and directories in /home/
07:12LauJensen(-> (File. "/home/") file-seq (filter #(.isFile %))) gives you only files
07:12LauJensenoops, ->>
07:12vyDamn! How did I missed that function. Thanks.
08:05gstampI noticed with slime that some errors go to the swank server console and some are reported within emacs itself. Anyone know why that might be?
08:08_atogstamp: generally output on a different thread to the one slime is running your command in will go to stdout/err of the swank process
08:09gstamphrrm. okay, thanks. that could be it.
08:10LauJensenFinally got Emacs to open URLs in a new Chrome tab!! wee :)
08:24gstampanother swank question... are the backtraces supposed to be clickable. they highlight as I move my mouse over them so it _looks_ like they should be but clicking on them only gives the message 'synchronous lisp evaluation aborted'.
08:30hoeckgstamp: the common-lisp slime implementations show some additional information when clicking on stacktraces, e.g. local variables and their contents
08:32gstamphoeck: okay so I guess it's not implemented then. sounds like it would be a nice feature to have. slime must make for a great common-lisp development environment.
08:32hoeckgstamp: but swank-clojure has no access to locals in exception stackframes
08:32hoeckgstamp: its even possible, the jvm comes with its own (java) debuginterface, JDI
08:33gstampgstamp: fair amount of work to implement I'd imagine
08:33hoeckand it comes even better, you can connect to the debug interface from a running clojure repl to debug itself, catch Exceptions as they are thrown, stop thread execution etc.
08:34hoeckthe biggest problem is the proper slime integration, and getting correct line and source-file locations
08:42LauJensenhoeck: So many hours would be saved if Clojure just kept record of what is was evaluating when something borks, so that you got the exception and the form which blew up - But I have hopes that swank-break will improve this functionality substantially
08:44hoeckswank-break?
08:44hoecka new debugger effort?
08:50LauJensenhoeck: The ability to insert break-points directly in Emacs
08:50LauJensenWITH locals inspection
08:50LauJensen:)
08:52hoeckthrough JDI?
08:52hoeckwho does this? does he need help?
08:55LauJensenHugo Duncan is working on it - I've also asked if they (he and technomancy) needed any help
09:00hoeckgood to hear, thanks for the info Lau
09:03LauJensennp
09:03hoeckLauJensen: btw, do you know how that discussion about the new names for deftype turned out?
10:03hugodLauJensen: hi, did you give swank-break a try?
10:04hugodhoeck: if you want to give it a try, swank-break is a branch in technomancy's swank-clojure repository on github
10:10hoeckhugod: thanks, will try it
10:13LauJensenhugod: Didn't test it, just got an email from phil explaining what had been done so far
10:15hugodLauJensen: the more feedback we get, the more confident we can be on merging it...
10:15hugodLauJensen: sorry for yesterdays confusion - hope everything got sorted out your end
10:16LauJensenhugod: the reason I haven't picked it up was because I sent phil an email asking for a few details and offering my help, he hasn't gotten back to me yet
10:17hugodI'm also playing with jpda/jdi locally, but that would be a much bigger change
10:55_invisHi everyone. Could you help me with labrepl ? "All the solutions above take all the numbers in range, and then exclude the ones we don't want. Go the other way and implement a solution that builds up the sequence of numbers we do want." They speak about (filter (something) (range number)). How can I make seq without filter and range ?
10:56_invisfor example. seq with numbres are multiply of 7
10:57Chousukeyou can construct lazy seqs manually of course, using lazy-seq
10:57Chousukeor you can use the iterate function
10:57_invisWhy all in clojure is lazy seq ?
10:58Chousukeeverything isn't. but most stuff is
10:58Chousukebecause lazy seqs are very convenient
10:58cp2if you're lazy
10:58cp2:)
10:58_invis:)
10:58_invisok, thanks
10:58Chousukea programmer's virtue
12:10_invisis there any macro like 'concat' which delete same sense ?
12:10_invis'(concat [1 2 3] [6 4 1])
12:10_invis,(concat [1 2 3] [6 4 1])
12:10clojurebot(1 2 3 6 4 1)
12:11_invisi need seq without last 1
12:11The-Kenny,(butlast [1 2 3 6 4 1])
12:11clojurebot(1 2 3 6 4)
12:11_invis is there any macro like 'concat' which delete same sense ?
12:12_invis,(concat [1 2 3] [6 1 4])
12:12clojurebot(1 2 3 6 1 4)
12:12The-KennyI'm not sure if (set) keeps ordering, but maybe (vec (set [1 2 3 1])) works
12:12The-Kenny,(vec (set [1 2 3 1]))
12:12clojurebot[1 2 3]
12:12The-Kenny,(vec (set [1 2 1 3 1 3 42]))
12:12clojurebot[1 2 3 42]
12:13_invishm
12:13_invisthanks
12:27_invisLook guys http://gist.github.com/346845. Could you tell me why this set is not sorted ??
12:30Chousukeorder of items in sets is random
12:31Chousukeor rather, unspecified
12:32_invisBut if it 20 in my-seq
12:32_invis(set (concat (my-seq 0 3) (my-seq 0 5)))
12:32_invis#{0 3 5 6 9 10 12 15 18}
12:33Chousukethat's a coincidence
12:33Chousukeyou want sorted-set
12:33_invisno i dont wont :)
12:33_invisjust wonder
12:33_inviswhy set sort sometimes and sometimes not
12:34Chousukethe set works by hashing
12:34Chousukesometimes, the hash order happens to correspond to sorting order
12:34Chousukebut that's not guaranteed
12:34_invisThank you.
13:10Licenserhmm there was that db entirely written in clojure, I don't remember the name so :(
13:10dnolenLicenser: fleetdb
13:13Licenserdnolen: THANK YOU!
13:28brian__hi, I'm looking for online documentation for duckstreams
13:30LauJensenbrian__: I think the source is your best bet
13:30brian__ok, i was headed there
13:44alexykso, is lein repl still inpacable of launching a specific version of clojure repl?
13:52bsteuberalexylc: it launches the clojure version you have in lib
13:52bsteuberalexyk: I mean, sorry :)
13:53alexykbsteuber: for repl, not true. It launches 1.1.0 while I have 1.1.0-master-SNAPSHOT in lib
13:54alexykfor swank, it respects version, for repl, didn't...
14:35bsteuberalexyk: oh, really! thx for pointing it out to me, then :)
15:33laynorhi, can someone recommend an editor/ide for clojure?
15:34laynorI'm used to emacs and slime, btw
15:34dsophmm and I don't get clojure-mode to run under emacs
15:34dsopemacs tells me that it cannot find the file clojure-mode
15:35laynorgoing to try that now, I'll let you know if I get it working
15:36laynoralso, what's the status of the clr port? I'd like .net better than the jvm
15:42raekdsop: do you have a (add-to-list 'load-path "/path/to/clojure-mode") in your .emacs?
15:43raeklaynor: emacs, slime and swank-clojure are great for clojure
15:44raekand since you already have experience with the two first, things should be pretty straight forward for you
15:44dsopraek: yes it works now, had to figure out somet stuff here
15:47candellerhi, got a newbie question regarding anonymous functions: lets say i define one with the shorter syntax ( #( + %1 %2) 1 2) #=> 3 - works fine, i can refer to the args via %, but what when I write it this way: ( (fn [a b] + a b) 1 2) #=> 2, it doesnt see the first arg. What to do?
15:48dnolen((fn [a b] (+ a b) 1 2) is the way to write it
15:48dnolencandeller: 6
15:48dnolen^
15:49dnolen((fn [a b] (+ a b)) 1 2) rather
15:49dnolen,((fn [a b] (+ a b)) 1 2)
15:49clojurebot3
15:49candellerdnolen: ahh thanks
15:52laynorraek: so there is slime integration for clojure? that's great! do I also get debugger integration and inspector?
15:55The-Kennylaynor: inspector yes, debugging not really
15:55raekhttp://riddell.us/ClojureWithEmacsSlimeSwankOnUbuntu.html
15:56raekthis was the guide I used when getting started
15:57raekthis can be usefull too: http://technomancy.us/126
15:59laynorraek: I'm on windows, not using linux anymore really :)
16:01raekah, ok... is ELPA available on windows?
16:02raekif so, you should be able to get swank-clojure from ELPA
16:02phren0logyI'm pretty sure elpa is on windows. I saw somebody was using clojure-box, plus emacs starter kit.
16:03laynorit seems clojure-install is working
16:04laynorbut it downloads everything lol
16:12laynorraek: how do i start slime with clojure then?
16:13vyWhat's the computation and memory complexity of the set union in Clojure?
16:13raekM-x slime when in clojure-mode, I think
16:14vyraek: I mean in terms of big-O notation.
16:14The-Kennylaynor: Either M-x swank-clojure-project (for leiningen/maven projects) or M-x slime (for an inferior repl in emacs)
16:17raekvy: dont know, but here's the source: http://github.com/richhickey/clojure/blob/76e7c4317dc3eac80c4908ac5e5fb885e302b2a4/src/clj/clojure/set.clj#L19
16:18raekfor two sets it looks like it is O(n) * conj
16:19raekI think (conj set val) is log32(n)/near-constant-time for hash-sets
16:19laynorThe-Kenny, raek: M-x slime while in clojure mode starts sbcl. Can't I have both lisps configured? :/
16:20The-Kennylaynor: You can. Try M-x slime with a prefix argument (C-u M-x slime)
16:21The-Kennylaynor: Two small utility functions: http://gist.github.com/347006 :)
16:21raekvy: so I guess set union is practically O(n) or technically O(nlog32 n)
16:23raekthis would be the computation complexity
16:23raekthe memory complexity is a bit more complicated due to the structural sharing of the sets
16:24caljuniorjust wanted to drop in to say that Clojure is the only language I don't mind hacking in on a Sunday night. Any other language would feel like work. *thanks again Rich*
16:26laynorThe-Kenny: thanks a lot, I still didn't get it working, I probably did something the wrong way, so I'm going to reinstall everything again with elpa.
16:27The-Kennylaynor: My recommendation is using lein-projects for everything. It's so much easier than fiddling around with classpaths for M-x slime etc
16:27laynorwhat's lein-projects?
16:27The-Kenny(I keep a 'test'-project if I want to try something fast)
16:28The-Kennylaynor: Leiningen is a build tool for clojure, wrote by technomancy: http://github.com/technomancy/leiningen
16:29The-KennyIt's easy, just do "lein new foo; cd foo" and you have a production-ready project. lein can also generate jars, start a repl etc. etc.
16:29The-Kenny(If you add swank-clojure to the deps, you can also just run M-x swank-clojure-project in Emacs to start a slime-repl)
16:30The-Kennywith classpaths etc. set right for this project
16:30laynordoes it work in windows?
16:30The-Kennyhm... I'm not sure, propably not
16:30The-KennyI don't have any experiences with windows, sorry
16:33laynorgoing to try it on cygwin
16:37phren0logyAHHH. Sorry, Cygwin gives me a rash. You could also make a VM and set that up just for clojure.
16:38laynorphren0logy: my disk is full and the desktop machine is broken lol
16:47phren0logylaynor: did cygwin kick you off?
16:51laynorphren0logy: yeah, while updating
16:51laynorlol
16:52phren0logySee? I feel like every time I try to solve a problem with cygwin, I have two problems. But maybe that's just my ineptitude.
16:54laynorphren0logy: I don't really like cygwin either.. but sometimes is the least ugly solution
16:54laynoror the only one
16:54laynor:/
16:54phren0logylaynor: yeah, you just gotta do what works
16:55laynora virtual machine wouldn't be that bad, but it's boring to setup
16:55laynorand no disk space at the moment
16:56laynorI just got an error from lein "could not find main class clojure.main" -_-'
16:57phren0logylaynor: If you get the space, check out vagrant - http://vagrantup.com/
16:57phren0logylaynor: it sets up VMs the easy way
16:58laynorI'll give it a try
16:58laynorgod
16:58laynorI really hate the jvm
16:59laynorit seems I don't have clojure in my classpath
16:59laynoror ...
17:02boojum,(reduce #(apply assoc %1 %2) {} '([:a 1] [:b 2] [:c 3])) ; must be a better way?
17:02clojurebot{:c 3, :b 2, :a 1}
17:08leifwI found parallel.clj while looking for things like preduce and pfilter, the one based on ForkJoin
17:08leifwit says it's DEPRECATED, but I can't find a replacement
17:09leifwis there one?
17:17vyWhy does it warn that "call to divide can't be resolved." on (defn- score [cur tmp] (/ (int cur) (int tmp)))
17:17vyWhat else should I do?
17:35chouservy: there is no divide for int,int
17:35chouser(show clojure.lang.Numbers "divide")
17:37chouserleifw: there's a par branch of clojure that has newer stuff.
17:56defn,:
17:56clojurebotInvalid token: :
17:56defn,:-)
17:56clojurebot:-
17:57joshua-choiHow can I write a function flatten-1 so that it flattens a sequence by one level? That is, (= (flatten-1 [1 2 [3 4 [5 6] 7]) [1 2 3 4 [5 6] 7])).
17:57defnjoshua-choi: good question -- there was some talk on the list about flatten awhile back fwiw
17:59Raynesjoshua-choi: There is a 'flatten' function in contrib.
18:00RaynesIn seq/seq-utils
18:00defnit's in seq-utils
18:00defni think someone may have written a flatten-1 in the list
18:01Raynesdefn: I'm aware. flatten might be a good starting point for flatten-1
18:02defnhttp://groups.google.com/group/clojure/msg/385098fabfcaad9b
18:02joshua-choiRaynes: I did look at contrib.seq/flatten's source, but it uses filter in a way so that I don't see how to restrict the recursion to one level.
18:03defnjoshua-choi: yeah i think you're gonna wanna do something with tree-seq
18:03defn,(doc tree-seq)
18:03clojurebot"([branch? children root]); Returns a lazy sequence of the nodes in a tree, via a depth-first walk. branch? must be a fn of one arg that returns true if passed a node that can have children (but may not). children must be a fn of one arg that returns a sequence of the children. Will only be called on nodes for which branch? returns true. Root is the root node of the tree."
18:03joshua-choiHmm, tree-seq always was unfamiliar to me
18:04joshua-choiIt seems so useful, but I've never...truly comprehended it
18:04joshua-choiI'll take a look at it, thanks
18:04defnjoshua-choi: ill work on it and see if i can beat you to the punch :)
18:06defnjoshua-choi: i can give you a couple tree-seq examples hopefully here
18:07leifwjoshua-choi: what's wrong with (def flatten (partial apply concat)) ?
18:07joshua-choidefn: Well, I understand what it mechanically does well enough...but I'm not yet smart enough to understand when to use it
18:07leifwoh they're heterogeneous never mind
18:08leifwchouser: thanks, I'll check that out
18:11_atonot sure tree-seq is going to help you as it can't tell the depth, although I guss you can tag it somehow
18:11_ato,(mapcat #(if (coll? %) % [%]) [1 2 [3 4 [5 6] 7]])
18:11clojurebot(1 2 3 4 [5 6] 7)
18:12woobyjoshua-choi, perhaps what you're interested in is a breadth-first walk?
18:13_atomaybe sequential? would be a better test than coll? to match flatten
18:13joshua-choi_ato: sequential? is what Hickey suggested in defn's link earlier
18:14joshua-choiwooby: How would you do that, then?
18:14joshua-choiHmm
18:14woobyjoshua-choi, http://gist.github.com/345785
18:14defnwow i suck at clojure ^^
18:14woobyjoshua-choi, bfs-seq being the lazy breadth first walk
18:15_ato,(mapcat #(if (sequential? %) % [%]) [1 2 [3 4 [5 6] 7]])
18:15clojurebot(1 2 3 4 [5 6] 7)
18:15woobyfriend and i were walking on breadth first file walking
18:16phren0logy iiiiiiiiiiiiiiiiiiiiiiiii
18:16Raynesoooooooooooooooooooooo
18:18joshua-choi_ato: Would using #(if (sequential? %) % (list %)) be more efficient than #(if (sequential? %) % [%])?
18:19phren0logybgi
18:19phren0logybi
18:19defn,(tree-seq seq? seq [[1 2 [3]] [4]]]
18:19clojurebotUnmatched delimiter: ]
18:19_atomaybe slightly
18:19defn,(tree-seq seq? seq [[1 2 [3]] [4]]])
18:19clojurebotUnmatched delimiter: ]
18:20phren0logygb
18:20defn,(tree-seq seq? seq [[1 2 [3]] [4]])
18:20clojurebot([[1 2 [3]] [4]])
18:20defn,(tree-seq vector? seq [[1 2 [3]] [4]])
18:20clojurebot([[1 2 [3]] [4]] [1 2 [3]] 1 2 [3] 3 [4] 4)
18:53defnwhat is the difference between sequential? and seq?
18:53defnI see the diff. in the doc says ISeq versus Sequential
18:53defnbut what does that mean in practice
19:26chouserdefn: a seq implements first and rest -- 'seq?' returns true for all seqs.
19:27chouserdefn: a sequential is a collection that holds things in a definite order or sequence -- 'sequential?' returns true for a subset of all sequentials.
19:36joshua-choiHow does proxy-super work? According to proxy's documentation, its methods do not have access to their super-methods.
19:45chouserproxy-super temporarily removes the derived class's method implementation, then calls the method so it "falls through" to the base class. It is not thread-safe.
19:49joshua-choiI see.
19:49joshua-choiAnother question: how would you call a method's supermethod in a function acting as a method in a gen-class namespace?
19:56chouseruse :exposes-methods
20:10joshua-choichouser: Wonderful. Thank you.
20:21erikcw1I'm trying to figure out how to add a github repo as a dependency in a lein project.clj file. I'm trying to automatically pull from here: http://github.com/kriyative/cynojure (it has a build.xml file, but doesn't have a project.clj file)
20:34talioserikcw1: I don't think lein handles source dependencies, only .jar artifact deps from a maven like repository
20:34taliossource deps could be cool tho
20:34taliosI'm not a lein guy tho so I could be wrong
20:38tomojdoes maven already have something for src deps?
20:38tomojin the worst case, you can write your own project.clj
20:38tomojand 'lein install' into your local maven repo
20:38tomojor push to clojars under your personal clojars group :/
20:39tomojif it really only depends on clojure-contrib, neither of those should be too difficult
20:39tomojyou can also build the jar however they want and install the jar itself into your local maven with no project.clj
20:39tomojhttp://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
20:46alexykis there a fn which does both filter and remove at once?
20:47tomojhmm
20:47tomojyou mean, pass two predicates?
20:49tomojif not, I think you're looking for empty :)
20:53taliostomoj: maven has -source.jar artifacts which get published along with releases, and can be pulled down, but that's mostly for single step debugging etc.
20:53taliostomoj: not sure "download source dep and build"
21:04alexyktomoj: I mean partition at once
21:06alexykah, separate from seq-utils
21:06dakronealexyk: you could use partition-by also
21:44shalesHaving trouble trying to use a DelayQueue. I'm creating the objects to add to the queue with (proxy [Delayed] ...). Implementing the getDelay method is easy enough. It closes over the target time which is in a let surrounding the proxy call. However, I can't figure out the compareTo method.
21:44shalesSomehow I need to get the target time of another Delayed proxy that is passed in
21:44chouserah, yes.
21:44shalesI tried adding a getTargetTime method to the proxy, but am getting exceptions
21:44chouseryou can't add new methods with proxy
21:45shalesfigured as much.
21:45chouseryou don't happen to be on post-1.1 do you?
21:46shalesI am. I've been looking at deftype but am a bit confused
21:46shalestried proxy first because it seemed simpler
21:46chouseryes
21:46chouseris Delayed an interface?
21:47shalesyes
21:47chouserok, so I'd recommend using reify instad of proxy -- syntax is very close to the same.
21:48chouserThen you can create a new protocol: (defprotocol MyDelayed (getTargetTime [obj]))
21:49chouserthen your reify can implement that as well.
21:51shalesok, thanks for help. I'll give that a shot
21:51shalesactually one more thing. How do reify and deftype compare. Are they similar?
21:52chouserreify is more like proxy -- a way to implement interfaces taking advantage of closures
21:53cemerickchouser: how goes it, Mr. Houser? :-)
21:54chouserdeftype is more like defstruct -- associates a type name with a set of map keys.
21:54chousercemerick: not bad. :-) how are you?
21:56cemerickchouser: Well. Working on squeezing as much as I can out of deftype. Time for optimization finally came.
21:56alexykis there a multi-set, i.e. counting set?
21:59alexykcan #(..#(..)..) be nested?
22:00chouseralexyk: nope, #() cannot be nested.
22:00alexykok
22:01alexykso I guess I have to implement multi-set with a map elem=>counts and update-in?
22:01chouserah. sure.
22:04chousercemerick: yeah, deftype should help. It's fast. ;-)
22:05cemerickchouser: Indeed. I've got these crazy spatial data structures I wrote 18 months ago that have been plugging away using straight maps, some structs here and there, etc. Yikes.
22:06cemerickThey're getting better, finally.
22:12alexykis there a simple way to subtract maps by keys?
22:12chousersubtract? like update-in dec, or dissoc?
22:13alexykchouser: like set difference, dissoc all other map's keys
22:16somnium,(apply dissoc {:a 'a :b 'b :c 'c :d 'd} (keys {:a 'x :c 'y}))
22:16clojurebot{:b b, :d d}
22:17alexykah, it takes many! ok
22:17chouserheh. I just wrote that myself, but with reduce.
22:17chouser,(reduce dissoc {:a 1 :b 2 :c 3} (keys {:b 2 :c 1 :d 0}))
22:17chouser(reduce dissoc {:a 1 :b 2 :c 3} (keys {:b 2 :c 1 :d 0}))
22:17clojurebot{:a 1}
22:17chouseroops, sorry.
22:18defn,(reduce dissoc {:langston "hughes"} (keys {:joplin "misourri"}))
22:18clojurebot{:langston "hughes"}
22:19somniumreduce seems to have the upper hand in popularity
22:19defni dont see why it wouldn't -- i had heard so much about mapreduce and such before i found clojure
22:20defnhttp://en.wikipedia.org/wiki/MapReduce
22:22tomojMapReduce is a bit different than map and reduce though, right?
22:23chouserwell, it's distributed. :-)
22:24tomojis that the only difference?
22:29mabesIt is easy to map/reduce on a small scale. It becomes difficult once you have to scale it. So MapReduce is not only distributed but it is redundant in that when workers fail (as they will once you are using many machines) the job continues without a problem.
22:30tomojI see
22:31mabesthere are a ton of rinky-dink map-reduce frameworks that sure enough do map and reduce, but they skirt the hard part of the problem...
22:31mabess/there/their/
22:36defnrinky-dink is such a great phrase
22:42tomojhttps://gist.github.com/8d3f0b775d3e2f0b4042
22:42tomojwhat do you think of this?
22:42tomojI feel like monads might help with this kind of thing
22:42tomojthe monadic values are functions and you can fmap boolean operations over them
22:45tomojmaybe it's better to stick to pointful
22:45tomoj#() is not bad
22:45defn#(some-fn %1 %2) is such a fantastic syntax
22:46tomojin this case the domain is unary functions anyway so we don't even need numbers
22:46defnhelps you think about it
22:56tylereIs the programming clojure sample code broken? Something isn't working right... after I (require 'examples.introduction), using the provided repl script...
22:56tylereuser=> (take 10 examples.introduction/fibs)
22:56tylerejava.lang.ClassNotFoundException: examples.introduction (NO_SOURCE_FILE:8)
22:58tomojhmm
22:58tomojtry (require 'examples.introduction) in the repl
22:58tomojwhat's it say?
22:58tylerenil
22:58tomojthat's right
22:59tomojnow maybe try (ns-publics 'examples.introduction)
22:59tylerejava.lang.Exception: No namespace: examples.introduction found (NO_SOURCE_FILE:0)
22:59tomojodd
22:59tomojI don't have the code
23:00tylerehttp://github.com/stuarthalloway/programming-clojure if you're curious
23:00tomojand you're using bin/repl.sh?
23:00tylereyes
23:02tomojit seems like the .class files for the examples aren't in classes
23:02tomojand also like repl.sh only puts classes on the classpath, not the example sources
23:02tomojwhy, then, (require 'examples.introduction) doesn't throw an error, I don't know
23:02tylereyea, that's what's kinda bugging me
23:03tomojoh, hmm
23:03tomojit looks like repl.sh adds . to the classpath
23:04tomojyou're running bin/repl.sh from the root of the programming-clojure clone?
23:04tylereyes
23:04tylereanywere else and it doesn't run
23:04tylerebecause it can't load the libs
23:04tomojyeah, that makes sense
23:05tomojand examples/introduction.clj is there and has (ns examples.introduction) ... hmm
23:06tomojI'll clone and see if it works for me
23:06tylerelemme try that too...I mean, I don't think I've touched anything in there but...
23:07tomojit works fine for me
23:07tylereok
23:07tomojgit clone ...programming-clojure.git
23:07tomojthen in the root bin/repl.sh, (require 'examples.introduction) returns nil
23:07tylereok, it's working for me now
23:07tomojand (take 10 examples.introduction/fibs) returns (0 1 1 2 ...)
23:07tylerevery odd
23:07tomojhmm
23:07tomojmaybe check 'git status' on the other clone?
23:08tomojsee if it's the same rev and everything I mean?
23:08tylereI deleted it ;(
23:08tomojah, oh well, glad it works now, have fun :)
23:08tylereyep, thanks
23:08tomojone note: defining fibs that way is Bad
23:08tomojit's useful for demogogic purposes I suppose
23:09tomojerr
23:09tylereClojure looks really interesting to me...did some CL a few years ago, though it was neat, but no libs for much of anything useful
23:09tomojwhatever the word is
23:09tomojyes, I love the fact that we get tons of libs for free
23:09somniumthe demeagogy of bad fibs
23:09tomojpedagogic I meant :)
23:09tylere(and where there were libs, they were always implementatin specific, not standardized)
23:10tomojtylere: but, if you care, lazy seqs like that should be defined as functions, so you'd do (take 10 (examples.introduction/fibs)) instead
23:10tomojotherwise, fibs will "hold its head", and if you try to take the millionth fib or something far down the line, you run out of memory
23:10tylereheh
23:11tomojbut it's fun to see that you can define vars that seem to point to infinite sequences :)
23:11tylereyea
23:12tylereit's kinda funny...I've done (some) CL, a decent bit of ML, a bit of haskell, so stuff like that isn't *that* odd to me, but I know almost no java
23:12tylereso learning the api might take a while
23:12tomojyeah
23:12tyleredid a bit of scala too...but that was so much to learn it was overwhelming
23:12tomojclojure's java interop is nice but learning enough of the java ecosystem can be a problem
23:12tylerethe scala book is (no lie) almost 1000 pages
23:13tomojleiningen helps I think
23:13tylereyea, ant and maven scare me..
23:13defnyeah i wanted to learn clojure without learning java
23:13tomojthen as long as you can read javadocs..
23:13defnand yeah, ant and maven are scary thing
23:13tylereyea, I've got that...not that I have anything TO build yet
23:13tomojluckily I was forced to learn java in school
23:13defnthings*
23:13tomojyou can do a lot with pure clojure, but eventually you will probably want to use some java stuff
23:13defni learned some java years ago in high school, but my school used C++
23:13defnpeople who are learning clojure are smart enough to handle some of Java
23:14defni came from ruby to clojure
23:14tomojyeah, and you probably don't need to _write_ any java
23:14tomojjust learn enough to create objects and call their methods, I think, as well as how to include a java project in your deps
23:14tylerePython has long been my tool of choice, although most of what I do for work is in PHP (stabs eyes)
23:14defnyeah just the way you interact with java -- that is sort of weird at first -- learning how to read docs was really all i had to do
23:14defnonce i got the hang of -> .. and . i was fine
23:15defntylere: i am forced to do PHP for work also -- but our production box has java and im trying to sneak some clojure in :)
23:15tylereheh
23:16defnrich had a funny interview recently where a guy asked him "so how do you justify this to the enterprise"
23:16tylereMy job is to maintain a large drupal site
23:16tomojwe're using drupal but I managed to sneak clojure into our backend plans :)
23:16defnand rich is like "you just tell them it's a java library!" ;)
23:16tyleretomoj: !
23:16defn"it's a .jar!"
23:16defnetc.
23:16tyleretomoj: Similar here, but replace clojure with python...it's what I use for all import routines and the like
23:16tomojah, interesting
23:17tomojI hadn't really considered clojure for managing drupal
23:19defnive grown a lot more comfortable with clojure lately -- i really wasnt familiar with what it meant to distribute a java application, how to manage dependencies, etc.
23:19defnbut it has all started to come together
23:20dsopsame here
23:20defnit was kind of a revelation when i realized i could just hand everyone a jar
23:20dsopjepp
23:20dsopand it's particularly challenging but in the same time enlighting if you try to mix clojure scala and java in one app :)
23:20defnwith ruby it was always like "gem install xyz", etc. etc.
23:21defnof course you could bundle all of that, but then the person receiving the thing had to have ruby
23:21dsopoh c was more like: ah yes you need a million dependencies in the right version if not you will not notice but the program will break, someday and then it'll dump
23:21defnthe other thing with java, a thing which i now realize is why the enterprise likes java is...
23:22defni can distribute a working application, and it will work for at least 5 years
23:22dsopdefn: well and you have bunch of real classy libraries
23:23defnthe one thing im totally uncomfortable with at this point is using profilers and trying to incrementally improve performance
23:23defni have a big problem with some code right now that i could have probably just handled with perl, python, or unix utils that is slow in java
23:24defnthat is disappointing -- so id like to improve its performance, but im clueless
23:24dsopis it slow in java or is it slow in clojure?
23:24defnclojure sorry
23:25dsopwell in that case profiling might help, I don't know much about performance critical things in clojure
23:25defnhttp://gist.github.com/347339
23:25dsopdefn: but as stuart always says: try to fix your algorithms before you microoptimize
23:25defndsop: yeah i think im there
23:26defn#(assoc! %1 %2 (inc (get %1 %2 0)))
23:26defnthat's the problem at this point
23:27talios'lo defn , tomoj
23:27defni get a huge list of IPs, and then i want to count the number of occurrences for each unique IP dsop
23:27defnAFAICT there's not an algorithm that's going to help
23:27taliosI hope thats not a list of torrent users :)
23:27defnwhat i need to do is chunk it and use reftypes
23:27defntalios: lol me too!
23:28defnbut i feel like chunking + reftypes seems like it's overkill, like i might be missing something more obvious, something easier
23:28RaynesIs there a core function that does nothing but discard it's input?
23:28sramsaystuck newbie asks . . .
23:29dsopdefn: sorry I don't know
23:29sramsaysuppose i have (1 2) and (5 3 4 2 3)
23:29sramsaywant to return only the latter that are in the former.
23:30sramsayfilter with for? can't get it to work.
23:31Raynes,(filter #{1 2} '(5 3 4 2 3))
23:31clojurebot(2)
23:31RaynesA set is good for this.
23:31Raynes,(filter #{1 2} '(1 5 3 4 2 3))
23:31clojurebot(1 2)
23:31sramsayHow does that work? sets can act as functions?
23:32RaynesYep. It tests to see if it's argument is in the set, and returns nil if it isn't.
23:32RaynesOtherwise, it returns the argument, I believe.
23:32sramsayWow. That is so much more beautiful than what I was doing ;)
23:33Raynes,(#{1 2} 1)
23:33clojurebot1
23:33RaynesAnything not false or nil is true, so it works out perfectly. :)
23:33sramsaythanks. that is awesome, Raynes.
23:33RaynesNo problem.
23:37tomojtalios: hey, my boss liked hearing about your vagrant/clojure idea
23:39joshua-choiI have a non-Clojure IRC question, since I'm very benighted about IRC. :( Is it possible to connect to two Freenode rooms with different names?
23:40Raynesjoshua-choi: Maybe with two IRC clients.
23:40joshua-choiRaynes: :(
23:40RaynesI don't think so.
23:40RaynesIs one allowed to be online twice with the same hostmask?
23:41RaynesI guess so, because I end up having to ghost myself all the time.
23:41joshua-choiWhat are hostmasks and ghosting?
23:41RaynesYeah, of course. My bot. Heh.
23:41Raynesjoshua-choi: /msg nickserv ghost <nick> <password>
23:41RaynesIn case you drop, but your nickname does not.
23:42Raynes(@216-164-114-53.c3-0.tlg-ubr3.atw-tlg.pa.cable.rcn.com) = hostmask
23:42RaynesI believe.
23:44joshua-choiI guess if it's not possible, I might as well change my Freenode username. Ah, well.
23:55alexykis there a single write-up summarizing the new goodness in 1.2?