#clojure logs

2011-10-11

00:00ibdknoxit saves the day again!
00:00amalloythe unsung hero
00:00scottjI wonder if arc has ssyntax for juxt
00:20replaca_Q: what's the latest version of swank for clojure-jack-in?
00:20replaca_*swank-clojure
00:20dnolennot surprising that Dart output is so similar to ClojureScript's https://gist.github.com/1277224
00:22scottjoh I didn't realize dart was going to compile to js
00:23amalloyall the cool kids are doing it
00:24replaca_but it seems like chrome will have a native interpreter
00:24replaca_or something
00:24replaca_(maybe auto-compile on-load)
00:33cemerickdnolen: and just as large, too! :-P
00:33dnolencemerick: pre advanced optimizations, sure
00:33dnolenI just ran that through advanced mode, down to 2000 lines *pretty-printed*
00:33cemerickRight, cljs is exporting stuff it doesn't necessarily need to, right?
00:34justicefriesugh. working htrough 4clojure.
00:34justicefriesrealizing I don't "get" clojure yet.
00:35dnolenhttps://gist.github.com/1277285
00:37cemerickeh, so same magnitude as hello-world in cljs
00:37justicefriesi want my side effects and objects. ;)
00:38dnolenjusticefries: you're in luck, you have both in Clojure.
00:39justicefrieshaha! i'll be a purist at least for a little while.
00:41justicefriesi just hope by the end of joy of clojure I get FP.
00:41justicefriesand practice.
00:44symbolejusticefries: Some would say FP is a lifestyle choice, or an attitude. :-)
00:55justicefriesI'm okay with that. :)
00:55justicefriesI'd like to wrap my mind around it...
00:57pdkif you want to get fp you probably won't just by learning one functional language, learn a handful
00:57pdkhell toss prolog in there since it's technically still pretty functional
00:57justicefriesi'm switching over from Smalltalk, Ruby, and Objective-C.
00:58justicefriesabout as opposite as one would like to be.
00:59pdkruby should have stuff like lambdas/closures
00:59justicefriesyup
01:19amalloyheh. java should too
01:23mvidis there a built in function that takes a number of arguments and returns the first one that isn't nil?
01:25amalloy&(some identity [nil nli 4 8])
01:25lazybotjava.lang.Exception: Unable to resolve symbol: nli in this context
01:25amalloy&(some identity [nil nil 4 8])
01:25lazybot⇒ 4
01:25mvidcool
01:25mvidthanks
01:26justicefriespdk: I totally get lambdas/closures in Ruby.
01:27pdk(doc identity)
01:27clojurebot"([x]); Returns its argument."
01:27pdk,(doc identity)
01:27clojurebot"([x]); Returns its argument."
01:28justicefries&(identity [4 8])
01:28lazybot⇒ [4 8]
01:32mvid(or nil nil 4 8)
01:32mvid&(or nil nil 4 8)
01:32lazybot⇒ 4
01:42tarcierianyone attempted to apply STM to the DOM in ClojureScript?
01:42tarcierilike facilitating a protocol to let multiple web workers manipulate the DOM concurrently with STM semantics?
01:43amalloytarcieri: seems pretty unlikely. javascript ain't got threads, right?
01:43tarcieriit has web workers, which unfortunately are more like IPC than threads
01:44tarcieriit's the Unix model, in the browser, with text as the universal interchange format
01:44tarcieri:(
02:03TheMantishey guys, what's a good java IRC? the one here on freenode is invite only...
02:03TheMantis#java is invite only, that is
02:04amalloy##java
02:11amalloytarcieri: i didn't really know about web workers. but it looks pretty trivial to turn a web worker into an agent
02:15mrbendyHeya everyone. I would like to take a string like "Foo Bar Baz" and make it "foo_bar_baz"
02:15tarcieriamalloy: yeah web workers would map to agents nicely, aside from the fact you have to round trip all state you send them through strings
02:15mrbendyI want to replace all non-ascii characters with _'s
02:26tarcierimrbendy: (.toLowerCase str) and use a regex to replace the non-ascii characters?
02:26mrbendytarcieri: that's what I'm doing
02:27mrbendyI'm trying to find a good way to replace non-ascii characters
02:29dnolentarcieri: I don't know about the string bit moving forward, I've heard that implementation will probably leverage freeze
02:30matt00any good reason why clojure (str 'foo) -> "foo" whereas cljs (str 'foo) -> foo ?
02:31dnolensometimes I think about how awesome ClojureScript is then I read threads like this http://news.ycombinator.com/item?id=3097105, JS.fail
02:34dnolenmatt00: seems like a bug, you should file a ticket
02:40mrbendydnolen: anyone in particular
02:43devnsigh...
02:43devndnolen: the guy referencing the "stupidity" of reddit happens to have one of the dumber comments in the thread
02:44matt00dnolen - issue CLJS-84 filed
02:49dnolenmatt00: fixed in HEAD
02:49dnolensleep time for moi.
02:49tomojhttp://moo4q.com/ I found the h2's here funny
02:50tomojI bet I don't really understand what they're saying
02:50tomojbut.. "Immutable Functions #ftl / Stateful Objects #ftw"
02:56matt00w00t
02:56devntomoj: heh
02:57devntomoj: welcome to 2004
03:01tomojdammit
03:01tomojI knew I'd be disappointed by dart
03:01tomojbut I was secretly hoping..
03:32Blktgood morning everyone
03:42thorwilgood morning!
04:06Fossiwell, it's not 3 am here, so don't feel bad :>
05:30shanmuis clojure/data.xml ready for use - the readme says otherwise, is there anything I can do to help get it ready for use?
05:38shanmu\bye
05:41eiro(hello)
06:25shanmuany one have an idea reagarding the status of clojure/data.xml? Is there anyhting I can do to help it get ready for use?
06:36clgvshanmu: you might try to use it
06:36clgvI dont know it's status or why the readme discourages using it
07:16shanmuclgv: thanks! I have started using it - not yet run.. will keep the Channel posted
07:40jcromartie(= (fn [x] (+ x 1)) (fn [x] (+ x 1)))
07:40jcromartieI wish that were true
07:44babilen+1
07:44zilti,(identical? (fn [x] (+ x 1)) (fn [x] (+ x 1)))
07:44clojurebotfalse
07:45ziltimeh
07:49clgvjcromantie: it cant since these are two distinct objects, but you can compare their type
07:49clgvbut that works only for defns
07:50clgvyou could as well annotate their definition in meta-data and compare thos
07:50lucianhmm, = should work i think
07:50lucianif can just compare the s-exps
07:58zilti,(identical? '(fn [x] (+ x 1)) '(fn [x] (+ x 1)))
07:58clojurebotfalse
08:00jcromartiewell
08:00jcromartie,(= '(fn [x] (+ x 1)) '(fn [x] (+ x 1)))
08:00clojurebottrue
08:01jcromartieno problem
08:01jcromartiebut
08:01zilti???
08:01lazybotzilti: How could that be wrong?
08:01jcromartie,(doc identical?)
08:01clojurebot"([x y]); Tests if 2 arguments are the same object"
08:01zilti,(doc =))
08:01clojurebot"([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."
08:02ziltiI see. So identical? is even worse than =
08:02jcromartie"worse?"
08:02jcromartieno it's just specific
08:03jcromartie,(map #(identical? %1 %2) [[1 1] ["hi" "hi"] [:foo :foo] [{:x 1} {:x 1}] [(Object.) (Object.)]])
08:03clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval129$fn>
08:03jcromartiederp
08:03jcromartie,(map #(apply identical? %1 %2) [[1 1] ["hi" "hi"] [:foo :foo] [{:x 1} {:x 1}] [(Object.) (Object.)]])
08:03clojurebot#<ExecutionException java.util.concurrent.ExecutionException: clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox$eval159$fn>
08:03jcromartieDERP
08:03jcromartie,(map #(apply identical? %) [[1 1] ["hi" "hi"] [:foo :foo] [{:x 1} {:x 1}] [(Object.) (Object.)]])
08:03clojurebot(true true true false false)
08:46tdrgabi1reddit.clj?
10:27jcromartiewhat's so hard about "reporting" that it requires all of these big crazy libraries?
10:27jcromartie(like Crystal ReportS)
10:28mattmitchellanyone have experience with amazon's beanstalk and clojure ?
10:28jcromartie(totally off topic, sort of...)
10:32mvdirI am getting the following error: "Unable to resolve symbol: -?> in this context" when trying to use storm-deploy. Can someone help me understand how to debug this?
10:33mvdirI am in a lein repl,
10:33jcromartiemvdir: what's your current namespace?
10:33mvdirbut am unsure how to import the class to attempt to debug it.
10:33mvdirjcromartie: I am not sure.
10:34mvdirI tried doing (in-ns backtype)
10:34jcromartieit says on the line, before =>
10:34jcromartiefor example "user=?"
10:34jcromartieerr "user=>"
10:34mvdirAh, thanks.
10:34jcromartieby default
10:34mvdirIt's one I created, woo
10:34mvdirI tried doing this:
10:35mvdir(ns woo (:import backtype.storm.security))
10:35mvdirBut I got a classnotfoundexception.
10:36mvdirLike I said, I'm in the lein repl, which I thought would have all the classes automatically.
10:36mvdir:-/
10:36jcromartiehm
10:37jcromartieno
10:37jcromartieyou want (:require backtype.storm.security)
10:37mvdirjcromartie: Sorry, total n00b here.
10:37jcromartieor better: (:require [... :as foo]) so you can use the shortcut foo/whatever to refer to that namespace
10:37jcromartieto shorten it
10:38jcromartie(:use some-ns) imports *everything* in the specified namespace
10:38jcromartiewhich might be more than you need or want
10:38jcromartieor there might be collisions
10:38jcromartiewhich is why you should use require instead
10:38jcromartieand require with :as to shorten references when necessary
10:39jcromartiedoes that make any sense at all? :)
10:39mvdirDefinitely.
10:39clgvjcromartie: you can also do (:use foo :only (bar))
10:39mvdirI think a ns collision is the real problem I am trying to address.
10:39jcromartiethat's true
10:40mvdirjcromartie: Hmmm, I am still getting no source file.
10:41mvdirI tried ie. (:use pallet.compute)
10:41TimMcclgv: "Only use :use with :only" :-)
10:41TimMcas they say
10:42clgvwell sometimes thats annoying when you start implementing a new namespace ;)
10:42TimMcNothing wrong with :require :as
10:47raekmvdir: when you are in the repl, it's probably more convenient to use the require, use and in-ns functions instead of the ns macro
10:48raekmvdir: for example, to load a namespace and "enter it": (require 'the-ns) (in-ns 'the-ns)
10:48raekor (doto 'the-ns require in-ns)
10:48mvdirraek: Thanks
10:48raeknot the quote that you have to use for these functions
10:48raek*note
10:50clgvthats a good combination "note the quote" :D
10:50raekmvdir: this explains everything about require, use, import and ns: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
10:51raekheh. "note the quote"... it would be a nice name for a podcast!
10:53mvdirDoes -?> mean anything in clojure?
10:53clgvmvdir: yes
10:54jcromartiemvdir: it's not part of the standard included functions though
10:54clgvit's from clojure.contrib.core and escapes the series of function calls if a nil is encountered
10:54mvdirjcromartie: I am getting "Unable to resolve symbol: -?> in this context"
10:54mvdirHow do I include it?
10:55clgv(:use clojure.contrib.core :only (-?>))
10:55raekmvdir: do you want to use it in your own namespace, or are you trying to run someone else's code?
10:55mvdirraek someone else's code.
10:55mvdirSpecifically the jclouds 1.2.0-SNAPSHOT
10:55mvdirFor storm-deploy
10:55mvdirhttps://github.com/nathanmarz/storm-deploy
10:56raekok, and you just want to call a function in someone else's namespace?
10:56duck1123-?> is in core.incubator as well, I believe
10:56mvdirraek: Yes, I would like to fix the issue, if possible.
10:57raekI'm confused about how you are trying to run it
10:57raek(and I'm not familiar with that specific library)
10:58mvdirraek: sorry,
10:58mvdirI am trying to run some command line utilities.
10:58mvdirWhich automatically create ec2 stuff.
10:59raekall the error tells me is that you are trying to evaluate something at the repl that should be evaluated inside some file (e.g. copy-paste the contents of a file out of context)
10:59mvdirjclouds is a library which automates some of the ec2 rest calls.
10:59mvdirWhen I try to run it, I get this stack trace.
10:59raekok, so it generates the code which conatains the -?> usage?
10:59mvdirraek
11:00raekmvdir: ah, so you didn't put the -?> there?
11:00mvdirI think that code is just in a jar I am trying to use.
11:00mvdirNo
11:00mvdir,
11:00clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
11:00mvdirLet me see if I can get a link.
11:00mvdirWhoops.
11:01raek"Unable to resolve symbol" means that someone (perhaps not you in this case) tries to use a var that hasn't been used or required in the curent namespace
11:02mvdirraek: Looks like it was this commit:
11:02mvdirhttps://github.com/jclouds/jclouds/commit/9d30fde37511b0b7dad39378e93da1a88ad253fa#apis/ec2/src/main/clojure/org/jclouds/ec2/ebs.clj
11:03raekthat would explain it
11:03mvdirraek: Excellent, thanks.
11:03mvdirI will see if they can fix it in their channel.
11:04mvdirWhoof, this yak is particularly hairy when it requires you to learn a whole new lang.
11:04raekstrange that they didn't test this
11:04raeksimply loading the namespace would have signalled an error...
11:04mvdirI dunno, where I work we mostly deploy hadoop/cassandra.
11:05mvdirWhich is all << 1.0
11:05mvdirSo I guess I'm used to broken $#!7.
11:06TimMcmvdir: What has led to this yak-shaving?
11:07mvdirTimMc: trying to deploy storm (https://github.com/nathanmarz/storm-deploy)
11:09mvdirI guess my ec2 is behaving differently from what they have at twitter.
11:11raekmvdir: a simple fix is to add (:use [clojure.core.incubator :only [-?>]]) to that file (they already have the incubator lib as a dependency)
11:12mvdirraek, thanks very much.
11:12mvdirIf I were in front of my github account, I would upstream this...
11:12mvdir:-/
11:14raekif one of their devs simply requires every namespace they have, it will be clear for them what to do (this should be a really simple bug for them to analyze and fix)
11:15mvdir raek: I agree, sloppy,
11:16mvdirbut it is a development snapshot.
11:19xiaolongxiamvdir: are you still having problems?
11:20xiaolongxiaif so, why don't you come into #pallet since it seems like you are having problems more specific to pallet
11:26ljosHi - I'm having some classpath issues. I have a previous java project that I would like to continue on in Clojure. The project has two source folders one for each side of the project. I add both of the source paths in :java-source-path, but when I try to compile the clojure program I get package not found from only one of the source folders. Any ideas? I might not have made myself very clear...
11:28ljosI created a new clojure project in the same folder as the source folders for the java project.
11:28clgvljos: how does the part of the project.clj with the :java-source-path exctly look like?
11:30ljosclgv :java-source-path [["source1"] ["source2"]]
11:31ljosThe source folders are inside the same folder as the project.clj
11:32dnolenhmm, the fact that keywords and symbols are actually represented as JS Strings makes it tricky to make (str ...) work on them ...
11:33clgvljo: I dont thing the inner array brackets are needed
11:33clgv*think
11:33dnolencemerick: I'm rooting for the no ClojureScript releases. Download a dated jar or work against HEAD.
11:33ljosIt's written that way in the tutorial for lein.
11:34mvdirraek: clgv: jcromartie: Thanks for all your help!
11:34cemerickdnolen: Stone ages. Apply that to every project in central or clojars, and see what happens. :-(
11:34ljosBut maybe not needed, they don't do anything though as it still finds source1
11:34clgvljos: from a logic point of view I dont know what those additional vectors are needed for. so try removing those brackets
11:34cemerickOr, just apply it to Clojure itself, and see what happens.
11:36dnolencemerick: I do not think the world we live in today is appreciably better than pre 1.2.0, many people tracked HEAD then.
11:36ljosclgv: then I get an illegalArgumentException.
11:36cemerickdnolen: tracked HEAD via snapshot artifacts obtained via maven repositories
11:37ljosclgv, I think they are there so you can set flags if you need to.
11:37clgvljos: ok. hmm maybe they are for additional options
11:37dnolencemerick: and?
11:38ejacksonfear... and suffering :)
11:38cemerickdnolen: snapshots at least take care of distribution.
11:38cemerickIMO, releases and reasonable use of repositories have to be the null hypothesis in discussions like these.
11:39dnolencemerick: I'm just trying to figure what has actually improved? seems like most Clojure library version fragmentation and feet dragging. If you can call those improvements.
11:40cemerickdnolen: Improved since, what, 1.2 was released?
11:40ljosclgv: it seems like lein only looks in the same source folder for the packages as the class it is compiling comes from. Could this be correct?
11:41ljosclgv: The class that is being compiled references a class in the other source folder. This is where it fails and cannot find the package.
11:41cemerickClojure is in no way a role model for how to manage releases and distribution, IMO. Lots of gnarly history and hard battles have preceded where things stand today.
11:41clgvljos: oh. no idea. maybe you should file a ticket for that
11:42ljosclgv: ok. I am not sure if it is a bug. I might just be doing something wrong :P
11:42clgvljos: then you could also write to the mailing list
11:56dnolen_cemerick: good chance a principled argument will be needed ;) Google Closure Compiler tools themselves don't do releases, are widely used, and the complaints don't seem more or less pronounced.
12:00cemerickoy
12:00cemerickdnolen_: just as a thought experiment, what if clojars, maven central, and apt didn't exist? #rhetorical
12:01cemerickGoogle is widely mocked for not doing proper releases of all sorts of libraries, FWIW.
12:02dnolen_cemerick: and Maven is mocked in general.
12:02cemerickw.r.t. dependency management, it's the worst…except for all the other options.
12:03dnolen_cemerick: I'm mostly playing devil's advocate here ;) Clojars, Maven + Lein makes life much easier in the short term - but perhaps harder in the long term as we've seen.
12:04cemerickIn that case, I'll save my ammunition for larger bosses. ;-)
12:04cemerickdnolen_: what hardships though?
12:04KirinDavednolen_: Could be worse
12:04KirinDavednolen_: Could be SBT.
12:04dnolen_cemerick: dead libraries, people resolving 1.3.0 changes now.
12:04dnolen_KirinDave: heh
12:05arohnerdnolen_: IMO, 1.3 issues are due to AOT compilation, not maven/clojars/lein
12:05cemerickdnolen_: compared to tarballs and tracking HEAD? Easy choice, IMO.
12:05dnolen_arohner: binary compat for AOT was non-goal as far as Iknew.
12:05dnolen_I never heard anything mentioned about binary compat moving forward.
12:05arohnerdnolen_: sure, but whether it was chosen as a goal doesn't change whether it's a problem :-)
12:05dnolen_switching to ASM 4.0 will probably break it again.
12:06arohneronly shipping source would also work
12:06dnolen_arohner: I'd consider it a non problem. See JavaScript, only shipping source.
12:06cemerickIt's been mostly proven that source compat is not sufficient. Whether we can do anything about it is another story.
12:07arohnercemerick: why is source compat not sufficient? seems to me source-only would be just fine. It's the shipping non-compat binary that's a problem
12:07cemerickShipping source only works if you can pay the costs of loading it at runtime, and if the code doesn't actually hold much value.
12:07arohnerwhat do you mean "hold value"? everything downloading off public maven is OSS
12:08cemerickarohner: source doesn't work for e.g. android, and everything lots of people get paid for never touches a public maven repo :-)
12:08dnolen_cemerick: what costs? How long does it take load 60K of production Clojure? I can't imagine it being any amount of time worth caring about. certainly nothing to care about given Java/C/C++ compile times.
12:08dnolen_cemerick: Clojure doesn't work that well on Android in it's current form, right?
12:09cemerickright, because of the runtime code-gen and GC overhead
12:09cemerickthus, AOT is a must to cure at least half
12:09arohnercemerick: I'm not saying abandon compilation. I'm saying do AOT "privately".
12:09cemerickright
12:10cemerickWhich is what I do, exclusively.
12:10cemerickBut that doesn't mean that its problems go away — they just get seen by fewer eyes.
12:10arohnerright
12:11cemerickJust ask me sometime about the instance where a customer tried to upgrade one library of mine, but not the other. :-)
12:12cemerickPuts a real dent in that "hey, Clojure is just another .jar file" deployment/reach story.
12:43technomancylots of the problems with AOT do go away if it's solely done at the endpoints
12:43technomancy(once you have nailed down which clojure version is going to be used)
12:44technomancyanother 45% goes away when #322 is fixed
12:45hugodcemerick: fwiw, I have a pom that jars clojurescript, and another for the closure library, and have artifacts for them on clojars
12:47hugodhad to do that to get the zi-cljs maven plugin working
12:51cgrayhi, is there a function that takes multiple seqs and alternates between them? (f '(1 2 3) '(4 5 6)) => (1 4 2 5 3 6)
12:51arohner,(flatten (map vec (range 0 3) (range 4 6))
12:52clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
12:52arohner,(flatten (map vec (range 0 3) (range 4 6)))
12:52clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$vec>
12:52cgrayi see what you're going for, thanks
12:52arohner,(flatten (map vector (range 0 4) (range 4 7)))
12:52clojurebot(0 4 1 5 2 ...)
12:52arohnerthere
12:53arohnerI always get vec and vector confused
12:53Chousuke(doc interleave)
12:53clojurebot"([c1 c2] [c1 c2 & colls]); Returns a lazy seq of the first item in each coll, then the second etc."
12:54cemerickhugod: Sure. I think my bottom line in that department is, one should keep shit from running downhill to your users.
12:55cemerickEven if someone provided cljs as a dependency, there'd be many of them, and many people having to track changes and make calls from an outside perspective w.r.t. version numbers, etc.
12:57technomancydnolen_: out of curiosity, do you check clojurescript jars into git?
12:57technomancy(just trying to determine what the alternative is)
12:57hugodcemerick: I agree
12:58cemerickhugod: at least we have our coping strategy planned out!
12:58cemericka pom, a whiteboard, github, and a bottle of tequila.
12:58cemerick:-P
12:59technomancyI'm for it! http://m.assetbar.com/achewood/uuavvRhdS
12:59hugodnah, a nice single malt here please
13:00cemericktechnomancy: thanks for that :-)
13:01cemericktechnomancy: BTW, do you always have a buffer full of links to useful comics and memegenerator sites? ;-)
13:02dnolen_technomancy: I do not. it's not clear to me what the best way is to package CLJS files. I think there will be many cases where CLJ doesn't need to be involved at all.
13:02technomancycemerick: I do have some help: https://github.com/technomancy/dotfiles/blob/master/.conkerorrc#L47
13:03pjstadigtechnomancy: the truth finally comes out
13:04technomancypjstadig: well that doesn't cover penny arcade, xkcd, or smbc
13:12ibdknoxdnolen_: does that preclude just using jars?
13:13dnolen_ibdknox: not that I see no. Just haven't gotten that far as there are few libraries beyond things like Pinot that I would even want to include in a CLJS project.
13:14dnolen_shipping w/ Google Closure also means there's a lot of useful functionality you don't need to go hunting for in an external lib.
13:14ibdknoxtechnomancy: dnolen_: mkay, so far having pinot up on Clojars has worked out well
13:14ibdknoxdnolen_: true, but using those APIs directly is gross
13:16technomancythe whole "force a stable release on a project that doesn't want to do it for themselves" has worked out surprisingly well for slime; the only time it's an issue is when people want to use other things that depend upon CVS trunk, which seems very unlikely for gclosure.
13:17technomancyI guess it also depends on what gclosure's policy on backwards compatibility is. if it's like slime (everyone should use trunk always and forever) then bringing stability upon it becomes more important; if they are really good about maintaining backwards compatibility always, then it's not going to hurt so bad not having releases
13:19cemerickI don't think anyone's said anything about 'stable'.
13:20sriddoes anyone else have problems with aleph.http suppressing stacktraces?
13:21technomancycemerick: stability of clojurescript and stability of gclosure are different questions though.
13:22cemerickCertainly, but I don't think it's even up for discussion at this point.
13:23cemerickgclosure will be shipped in tarballs until the end of time; I take that as a given.
13:23cemericktarballs, with the potential for huge upheavals at any time, I should say
13:23duck1123srid: That happened to me too
13:24cemerickAnd ClojureScript is too young and is bleeding too profusely to think it's time to lock it up.
13:24ibdknoxcemerick: I hope it doesn't bleed to death :p
13:24cemerickBut distribution and repeatability are paramount.
13:25arkhfleetdb id question: is there a better way to find the next available id for a given collection than by hand? e.g. checked-write w/ (client ["select" "asdf" {"order" ["id" "desc"], "limit" 1}])
13:25dnolen_cemerick: a lot of rhetoric not many facts ;)
13:25duck1123srid: I was using the ssl patch and it was failing on me because the site I was hitting's cert was being rejected, so it was just returning nil
13:26technomancyare people able to hobble along with submodules? that at least locks you to a specific sha.
13:26cemerickdnolen_: sounds like classic irc! :-D
13:26ibdknoxtechnomancy: gclosure is svn
13:26cemericktechnomancy: git submodules are sooo sad.
13:26ibdknoxand I agree with cemerick
13:26technomancycemerick: I know =(
13:27technomancyI have been able to avoid them for 4 years, but that has come to an end this week.
13:27cemerickouch
13:27technomancythey're enough to make a man gaze fondly at hg
13:27cemerickhrm, not sure about that…
13:27technomancyapparently hg can have subrepos in a _foreign_ vcs
13:28cemerickthe last time I tried to do a checkout in an hg repo, it took _an hour_
13:28TimMcSounds not unreasonable for a fairly large repo.
13:28technomancyyou sure it wasn't bzr?
13:28cemericknope, never used bzr
13:29TimMc(a fairly large svn repo, specifically)
13:29cemerick~140MB working directory, one hour
13:29clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
13:29technomancyon the emacs-devel mailing list there's a thread every month or so going "I tried to check out Emacs and it's taken 3 hours so far and isn't done yet; what did I do wrong?" / "nothing, that's how it's supposed to work." / "..."
13:32mtmarkh: not that I'm aware of; seems like I nice feature to have for fleetdb, basically some meta-data on the collection
13:39arkhmtm: there's a meme there somewhere - 'scumbag fleetdb: requires unique id's per collection, doesn't provide them'
13:39sridduck1123: for me, no stacktraces were being printed in the console. the browser returns some ERR_NOT_FOUND or something.
13:39sridno matter what the error is
13:52licenserHas anyone managed to put static files in ring/compojure jar?
13:55amalloyarohner, cgray: augh do not use flatten for that. of course interleave is best, but if you were reinventing it flatten would be wrong. you want ##(mapcat list [1 2 3] [4 5 6])
13:55lazybot⇒ (1 4 2 5 3 6)
13:56amalloyspecifically because things like ##(flatten (map list '[[a b] [c d]] [1 2])) break
13:56lazybot⇒ (a b 1 c d 2)
13:58jcrossley3technomancy: dude, the built-in swank clojure jack in stuff is very sweet, thanks for that!
13:58justicefriesanybody using clojure in large production environments?
13:58justicefrieson a daily basis?
13:58technomancyjcrossley3: great! I'm pretty happy with the way byte-compiling works now.
13:58pjstadigseveral
14:00justicefriesnice.
14:08pdloganthe clojurescript bootstrap pulls down clojure 1.3-beta3 --- an harm changing that to the 1.3 release?
14:08pdlogan^y
14:13cemericklicenser: I just put them into the .war file where they should be, and let the app server serve up the static resources on its own.
14:14licensercemerick: hmmm thanks :) I tried that but I failed so far - but if that should work I will retry it
14:15cemericklicenser: I've personally never used ring to serve static assets.
14:16devnlicenser: for some reason I remember needing to serve static assets with moustache
14:16licenserI see, I just slapped together a compojure/ring thing and I kind keep failing ^^
14:19licenserthis ain't easy ^^
14:20gtrakpdlogan, why's it matter?
14:21pdlogangtrak - not much that I know of.
14:31devnlicenser: I might have my code around, let me look for you
14:31devnlicenser: it will be old, but it might be what you need
14:31licenserthat'd be great :)
14:32devnlicenser: ring.util.response
14:32devnyou need (file-response)
14:32devnlicenser: I also have a call to (wrap-file)
14:32devnyou may need that as well
14:33licenserwrap-file is kind of icky because it checks for the existence of the file beforehand
14:33ghiuhi, how can i call a function whose name i have in a string? is eval the only way?
14:34amalloyghiu: did you ask a question about this recently on SO? if not, you should look because someone else did
14:34licenserghiu: I know that isn't the answer, why?
14:34devnlicenser: https://gist.github.com/1278941
14:34devnlicenser: you could write your own wrap-file i suppose
14:34amalloylicenser: shouldn't compojure.route/resources Just Work?
14:34ibdknoxamalloy, yes
14:35ibdknoxor just use Noir and the whole point is moot
14:35ibdknox:)
14:35amalloy*shakes fist* damn you, noir...
14:35amalloyghiu: for reference, http://stackoverflow.com/questions/7715800/clojure-determine-if-a-function-exists
14:35ibdknoxbwahahaha
14:36ghiuyes, i'm reading
14:36licenseramalloy: I try that thanks and devn thanks too :) I will dig around that all
14:36ghiubut this seems about checking for existence, not actually calling it
14:36amalloyso what. same task
14:36ghiu(eval (symbol s))
14:37devnamalloy: this? https://github.com/weavejester/compojure/blob/master/src/compojure/route.clj#L23
14:37devnlicenser: ^^
14:37TimMcghiu: Read the first answer.
14:38ibdknox,((resolve (symbol "inc")) 1)
14:38clojurebot2
14:38devnibdknox: noir is nice, but it could use more docs ;)
14:38ibdknoxdevn, what?
14:38ibdknoxdevn, Noir is probably one of the best documented Clojure libs out there...
14:38ghiuoh, right. thank you
14:38ibdknoxdevn, http://webnoir.org/
14:38amalloymaybe the docs are too...dark to read? help me out here, i need more puns
14:39ibdknoxlolol
14:39ordnungswidrighi all
14:39ibdknoxamalloy, I'm not sure if I should inc or dec you for that...
14:39devnibdknox: i was kidding buddy, your docs are good
14:39TimMcneeds more cowbell
14:39devnibdknox: that's usually the first thing i say to anyone in the clojure community
14:39devn"i like your project. write more docs"
14:39ibdknoxhshs :)
14:39ibdknoxfail
14:39ibdknoxhaha*
14:40amalloy,(doseq [x '[inc dec]] (println (list x 'amalloy)))
14:40clojurebot(inc amalloy)
14:40lazybot⟹ 17
14:40clojurebot(dec amalloy)
14:40lazybot⟹ 16
14:40ibdknoxlol
14:40TimMccute
14:40cemerickdevn: evil :-)
14:41TimMc,(println '(inc clojurebot))
14:41clojurebot(inc clojurebot)
14:41lazybotYou can't adjust your own karma.
14:41TimMc:-)
14:41ibdknoxlol
14:41ibdknox(inc clojurebot)
14:41lazybot⟹ 4
14:43devnhaha
14:44RaynesThat arrow is almost long enough to be obnoxious in this font.
14:44RaynesNo wonder people complained about it.
14:44devnwhat arrow?
14:44ibdknoxit is kind of ugly
14:44RaynesThe unicode arrow that lazybot prints when you inc or dec karma.
14:44Raynesamalloy: New arrow, plz.
14:45amalloyRaynes: you're the one who told me you had it totally handled when you changed the arrow in clojure-mde
14:45devnI thought I was in a unicode terminal
14:45amalloyman. the clojure plugin. not clojure-mode
14:45devnapparently not
14:48licenserhussa :D
14:48licenserdevn amalloy! :) you are my heros!
14:48ibdknoxlicenser, you should check out Noir. http://webnoir.org/ ;)
14:50Raynesibdknox: Donate time and make try-clojure run on Noir.
14:50licenseribdknox: I don't have much of actual web serving to do just a few js files and a few json files :) but I will look at it
14:52ibdknoxwow it is a lot simpler than I expected :)
14:53ibdknoxRaynes, I'll do that this weekend, maybe before if I magically find some time
14:53RaynesCool. Note that I didn't actually expect you to be willing.
14:54amalloyyeah, seriously. ibdknox, how do you feel about updating 4clojure to use 1.3 too?
14:54ibdknoxIt'll be an interesting exercise, I haven't used mustache
14:54ibdknoxamalloy, hah mustache -> noir = easy.... 1.2 -> 1.3 = unknown :p
14:54RaynesDo lazybot and related projects while you're at it.
14:55RaynesI'm using moustache? I could have swore I rewrote that code to use compojure at some point.
14:55ibdknoxRaynes, we should just teach lazybot how to do it and then have him run over github when he's not busy doing important IRC things
14:55RaynesMaybe I'm a stoner and just haven't noticed.
14:55RaynesThat'd never work. The bot is lazy.
14:56ibdknoxcattle prod?
14:56RaynesWe can give it ago.
14:56Raynesa go*
14:57ibdknoxRaynes, yeah it uses Moustache
14:57ibdknoxoh
14:57ibdknoxthere's a compojure branch
14:57ibdknoxeven easier then :p
15:00Raynesibdknox: Yeah, the compojure branch appears to be more up-to-date and is likely the branch the actual site is running off of.
15:01ibdknoxibdknox, given the site fits in a single file and doesn't look ridiculous, there's probably no real benefit to moving it to Noir, except for being part of the club of course.
15:01ibdknoxdamnit
15:01ibdknoxI do that a lot
15:01ibdknoxRaynes: ^
15:01RaynesClub membership is enough of a benefit.
15:01ibdknoxamalloy is not a part of the club, so you know it has to be good ;)
15:02amalloyibdknox: your docs should include a screencast: filmed noir
15:03ibdknoxhahaha
15:04ibdknoxamalloy, I think I would have a hard time taking it seriously
15:04ibdknoxbecause that would clearly be serious business
15:04RaynesOr, srs bsns.
15:04ibdknoxindeed.
15:04justicefrieswait, templating in noir is done with a series of macros?
15:05ibdknoxjusticefries, templating is done however you want it to be done. By default my examples use hiccup
15:05justicefriesaah.
15:05justicefriesi like it.
15:05ibdknoxjusticefries, it has the lowest cognitive load
15:05ibdknoxenlive is scary at first
15:09jcromartieare there any caveats to really really really big data structures?
15:09ibdknoxblanket statement: yes
15:09jcromartiefor example: are there any limitations to the number of values in a hash-map
15:09justicefriesyeah, this is pretty cool.
15:10justicefriesit's like sinatra. :D
15:10amalloyjcromartie: try not to have more map keys than there are electrons in the universe
15:10amalloyi don't think clojure supports this usage
15:10jcromartieamalloy: good tip
15:11jcromartieI'm designing an architecture where clients (organizations) are segregated into their own refs
15:11jcromartieand the ref holds a map
15:11jcromartiethe map will need to hold potentially up to 2M invoices
15:11jcromartieinvoices being fairly small bits of data
15:12jcromartieobviously I need to be sure to set *print-length* on my REPL :P
15:12jcromartieI wish there was a good measure of object size in Clojure...
15:13ibdknoxjcromartie, you need to hold 2M items per client... in memory?
15:13jcromartiewell that is a future "worst case"
15:13amalloyjcromartie: no such thing exists in a garbage-collected language. profilers, at least, can show you shallow-size and retained-size, which are fairly close
15:14amalloybut you need to work with the internal implementation of the heap to be able to get numbers like that - you couldn't do it in a running process
15:14ibdknoxI'm not sure why you'd ever need to use that much data all at once
15:15ibdknoxit'd be a lot easier to chunk it and work on the chunks, retrieving when necessary
15:15jcromartieibdknox: potentially
15:15jcromartie(chunk it)
15:15jcromartiewell
15:16jcromartiethe system that this is replacing has served about 900K invoices over 12 years for our largest client
15:16RaynesThis is why I never visit #clojure while sick. All the talk about chunks makes me nauseous.
15:16jcromartieso that 2M might be an exaggeration
15:16ibdknoxlol
15:16ibdknox#clojure, not for the weak of stomach
15:17ibdknoxjcromartie, even if it's exaggerated by an order of magnitude, I have a feeling you'd actually be better off splitting it up and storing intermediate results if you need to aggregate them back together
15:17justicefriesi realize the more and more I play with Clojure the more and more I don't "get it" when I think I do.
15:18ibdknoxjcromartie, to be fair, I know nothing of your problem, so grain of salt and all that :)
15:18zerokarmaleftjcromartie: cgrand just posted about comparing megarefs to something more granular that might apply to your situation
15:18jcromartieyes :)
15:19jcromartiewell these aren't quite megarefs
15:21ibdknoxjusticefries, like what?
15:23mattmitchellI need to store clojure data structures and read them back later. Using eval is super slow. Is there another way?
15:23jcromartiethe system that this is replacing goes back a long way though
15:23ibdknox,(doc read-string)
15:23zerokarmaleftjcromartie: why not offload to a database so you're not having to deal with keeping 2M items in memory?
15:23clojurebot"([s]); Reads one object from the string s"
15:23ibdknoxmattmitchell, ^
15:24mattmitchellawesome thanks!
15:24jcromartiezerokarmaleft: well like I said 2M is probably a big exaggeration
15:24jcromartiewe're not building this system for the biggest client
15:24jcromartiewe're building it for the other 500
15:24brehaut(doc *read-eval*)
15:24clojurebot"; When set to logical false, the EvalReader (#=(...)) is disabled in the read/load in the thread-local binding. Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\")) Defaults to true"
15:24justicefriesibdknox: all the joys of functional, side effect free programming that isn't necessarily a feature in ruby. ;)
15:25amalloy*ponder* ibdknox, mattmitchell - aren't eval and read-string orthogonal? if he was using eval, he must have already had something parsed by the reader
15:25ibdknoxamalloy, hah
15:25ibdknoxamalloy, yes
15:26jcromartiezerokarmaleft: but interestingly, the design is quite friendly to migrating to a database later
15:26jcromartiezerokarmaleft: since I'm journaling changes, it could be adapted to write into a DB
15:27mattmitchellamalloy: i'm attempting to store simple data structures using the str function. Then bring them back to life using eval. Eval feels slow, I guess I'm trying to avoid using something like json.
15:27jcromartieanyway it's an experiment in prevalent system design
15:27amalloymattmitchell: do you have it actually working? because i don't think your description makes sense, in the sense that it shouldn't work
15:28brehautmattmitchell: eval invokes a compiler on an sexp (not text), read-string (and the other reader functions) are very similar to a json reader
15:29mattmitchellamalloy: it does seem to be working
15:30mattmitchellbrehaut: so eval would definitely have more overhead and probably not even work for what I'm trying to do?
15:30brehautmattmitchell: correct
15:30mattmitchelli see
15:31brehaut,((just read-string eval) "(+ 1 2)")
15:31clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
15:31brehauthah of course
15:31brehauttry that in your own repl
15:31mattmitchellok :)
15:31amalloybrehaut: he should also change just to juxt :P
15:31brehautgoddamn autocorrect
15:31amalloyhah. mac user?
15:31brehautyeah
15:32brehautautocorrect has double the number of typos i make
15:32mattmitchellahh that helps a lot... to illustrate what's happening. thanks.
15:32brehautmattmitchell: you should make sure you understand what is happening with *read-eval* too if you plan to employ the reader yourself
15:33mattmitchellbrehaut: well, i basically want to store simple data structures (no function calls), and de-serialize them as fast as possible. So not sure if what I'm doing is the right approach or not?
15:34brehautmattmitchell: text formats are typically not the fastest possible, but getting faster is going to crystalize data concerns much earlier than is ideal
15:36brehautmattmitchell: do you have the rest of this program written already?
15:43duck1123What library should I be using if I need to do things like list, move, delete files? c.j.io seems limited. Should I just use File? lancet?
15:45mattmitchellbrehaut: sorry had to step away... not entirely. Currently the data is stored as json in a search engine but the de-serialization from json is slow. So looking for alternatives.
15:46mattmitchelli should mention... the data stored does not need to be readable, it's only stored for retrieval
15:46cgrayis there any way to get the locals in the slime debugger?
15:46brehautmattmitchell: which json library are you using?
15:47mattmitchellbrehaut: it was clj-json, now we're trying out cheshire
15:49TimMcduck1123: Yeah, "move" seems to be missing.
15:49daniel___hi all, another evening of trying to get a repl in vim for me
15:49Bronsaduck1123: try fs
15:49TimMc(from c.j.io)
15:50mattmitchellbrehaut: actually, eval of clojure data is looking pretty good, compared to the json de-serialization
15:52jcromartieI'm playing with searching 50K records in a hash-map right now
15:53jcromartiethat covers 99.6% of our clients after 12 years of business
15:53ordnungswidrigsearch among 50k or for 50k hits
15:53ipostelniksearching over 50K shouldn't be a big deal
15:54ipostelniki've used a hierarchical map that had 350K leaf-level maps as a poor-mans DB
15:54jcromartie:P
15:54jcromartiemean # of bills: 3400
15:54jcromartiemedia: 1097
15:54jcromartiemedian*
15:54ordnungswidrigipostelnik: I use this with event sourcing and it works great
15:55jcromartieanyway, the aversion to a DB at this point is part curiosity (asking "do we need it?") and part practicality: getting a prototype up and running as fast as possible
15:55ordnungswidrigjcromartie: so it's ,(* 50 3400) orders in total?
15:56jcromartieordnungswidrig: 429 organizations, 3400 invoices (mean)
15:56jcromartiebut they will be segregated
15:56ordnungswidrigjcromartie: what's you memory footprint?
15:56jcromartieeach organization in its own collection
15:56jcromartieordnungswidrig: server is effectively unlimite
15:57jcromartie64-bit machines, we can spare any amount of RAM
15:57jcromartieand the design is highly shard-able
15:57jcromartieso the refs can actually be distributed easily
15:58jcromartiethe API can transparently map requests
15:58ordnungswidrignice. what is the scope of a ref in your case?
15:58jcromartiethe current state of an organization's data
15:59ordnungswidrigAh, I thought of clojure refs
15:59jcromartiehm?
15:59jcromartiewhat do you mean
15:59jcromartieby "ref" I mean a clojure ref
16:00ordnungswidrigok, so a ref contains an orgainsation and everything it points to?
16:00jcromartieyes
16:00duck1123TimMc: commons.io's FileUtils seems to have everything I need
16:00jcromartieone organization <--> one ref
16:00ordnungswidrigI see. Do you use event sourcing or something like that?
16:00jcromartiethat's the idea
16:01jcromartiejournaled events for each organization
16:01ordnungswidrigSo an organization is an aggregate root in DDD speach?
16:01jcromartieyes
16:01daniel___I'm getting this error after pressing \sr to start my repl:
16:01daniel___Error detected while processing BufWinEnter Auto commands for "*":
16:01daniel___E32: No file name
16:02jcromartiethe only things outside of organizations are logins and some internal reporting stats
16:03ordnungswidrigI'm building a similar system at the moment. Do you use a message bus? I don't care about sharding and distributing at the moment but I like to plan ahead.
16:03arohnerdoes lein have a flag that tells maven to "go check all snapshots, even if you already checked today"?
16:03duck1123lein pom; mvn dependency:tree -U
16:04jcromartieordnungswidrig: there's nothing actually running distributed right now :)
16:04amalloylein -D fffffuuuuuuuu_maven
16:05jcromartieit's very early
16:05ordnungswidrigjcromartie: hehe. I thought mirroring the events on multiple hosts, sharded by aggregate root / log. This would give me redundancy on storage and scale on read.
16:05jcromartieit would
16:06jcromartieyou just have to make sure they end up in sync
16:06jcromartiebut I think maybe we're both getting excited and putting the cart before the horse :P
16:06jcromartie1. make it work; 2. make it right; 2. make it fast
16:06jcromartieoops
16:06jcromartielet's try step 2 now
16:06jcromartie1. make it work; 2. make it right; 3. make it fast
16:07ordnungswidrigyes, it'd be easier to use cassandra or like that for event storeade.
16:07ordnungswidrigstorage...
16:07ordnungswidrigor whatever you're needs regarding CAP are.
16:07ordnungswidrigs/you're/your/ (damn, it's late)
16:10gtrakwhy does this happen?
16:10gtrak,1 2 3
16:10clojurebot1
16:10ordnungswidriggtrak: nice, in my repl 1 2 3 give me 3
16:11gtrakin mine it gave 1\n2\n3\n
16:11gtrakin tryclojure, it gives 1
16:12ordnungswidrigslime repl in my case
16:12gtraklein repl from windows in mine
16:12daniel___I'm getting this error after pressing \sr to start my repl:
16:12daniel___Error detected while processing BufWinEnter Auto commands for "*":
16:12daniel___E32: No file name
16:12Raynesgtrak: tryclojure evaluates the first form it sees.
16:12daniel___anyone ever had this?
16:12RaynesI think.
16:13gtrakRaynes, I'm gusesing lazybot/clojurebot does too?
16:13Raynes&1 2 3
16:13lazybot⇒ 1
16:13RaynesApparently.
16:15gtrak,()()() I was trying this one <--
16:15clojurebot()
16:20daniel___wow, i fixed my problem
16:20daniel___au BufWinEnter *.* silent loadview
16:20daniel___*.* instead of *
16:20daniel___in case anyone comes across it again ^^
16:21daniel___can i now select code and run it in the repl, or do i need to write it out again?
16:26technomancyarohner: the maven API has a flag which claims to do that.
16:26technomancyunfortunately it doesn't.
16:26arohnertechnomancy: really? I thought I just got it to work
16:26arohnermvn dependency:resolve -U
16:27technomancyarohner: I mean the maven-ant-tasks API that leiningen uses
16:27arohnerah. ok
16:27technomancyit will probably be fixed in 2.0 with Æther
16:30cemerickI should have called pomegranate "f'n aether".
16:31cemerickStupidw
16:31cemerickStupidWagonProviderAdapter
16:31cemerickthat is
16:32ordnungswidrigtechnomancy: as long a you can use them as filenames?!
16:34chousercemerick: yes!
16:35chousercompiler error if ambiguous. perfect.
16:35cemerickchouser: I wonder if I could reflect my way into modifying the reader so it works without a macro context… :-P
16:36chouserheh
16:36chouseryou know me too well
16:37amalloycemerick: c'mon, just wrap your whole codebase in (with-awesome-hacks ...)
16:38cemerickchouser: s'ok, you'll be back at it. The idea will crawl its way up your medulla when you least expect it.
16:38cemerick;-)
16:38chouseramalloy: I tinkering with a 4clojure problem submission. Because that's more important than finishing data.xml
16:38ibdknoxlol
16:40chouserwe really don't have drop-nth?
16:40devn,(doc drop-nth)
16:41clojurebotIt's greek to me.
16:41devnchouser: apparently not!
16:42chouser(defn drop-nth [i coll] (keep-indexed #(when (not= % i) %2) coll))
16:51MrMcHow do I read a file line by line I have seen examples with line-seq and what about specifying a format like utf-8
16:55daniel___whats the most elegant way of squareing a number?
16:56daniel___without writing (* x x)
16:56daniel___x in my case is a long statement
16:56amalloyum, put it in a let statement? or write a square function, which is effectively the same thing?
16:56amalloyugh, i just said "statement". someone kill me
16:57amalloyanyway, of course you *can* do it with none of these approaches, by manhandling built-in functions until they do what you want, but that's really just a lame way of reinventing a let
16:57daniel___hmm (let [x (my 'statement')] (* x x)) ?
16:58amalloyright
16:58daniel___ok, just checking...there might have been a really clever way
16:58amalloy(->> (+ 1 1 1 1 1 1 1) (repeat 2) (apply *))
16:58amalloy&(->> (+ 1 1 1 1 1 1 1) (repeat 2) (apply *))
16:58lazybot⇒ 49
16:58ibdknoxlol
16:58amalloythere are lots of clever ways. they are mostly not good ways
16:59ibdknox,(Math/pow (+ 3 3) 2)
16:59clojurebot36.0
16:59brehautgentlemen, start your peano numbers
17:00daniel___ah, i could use Math/pow, that's shorter/easier than let
17:00amalloyhope you don't mind floating-point numbers
17:01ibdknoxdaniel___, ^
17:01daniel___well i stick an int in front if need be
17:01daniel___i already have a Math/sqrt in there
17:01brehautwoo precision
17:02daniel___dont need precision
17:02brehautdaniel___: in that case, try (def square identity)
17:03brehautit'll be close enough
17:03brehaut;)
17:03amalloyhah
17:03amalloy(def square (constantly 0))
17:03ibdknoxlol
17:04amalloydaniel___: you're aware that int always rounds down, right? "sticking an int in front" doesn't cause actual useful rounding
17:04ibdknoxall of those physics problems in school would've been so much easier in a world without precision.
17:04ibdknoxI mean we already didn't have friction
17:04daniel___amalloy: thats fine
17:05daniel___i think i'm gunna have to scrap this anyway, can't work out a decent way of modifying a string by one character and making sure it's a real character....getting errors when the unicode codepoint reaches -1
17:06amalloyhave you tried hiredman's suggestion of only working with characters at the beginning/end, and working with a vector of numbers in between? it would make several steps of your algorithm a hundred times easier
17:07daniel___amalloy: how would that help if the vector of numbers don't translate to characters
17:07daniel___thats the problem im having
17:08ibdknoxanything that has an invalid char in it dies immediately
17:11amalloydaniel___: you also wouldn't have this problem if you stopped trying to get an algorithm you know to be bad to "work" before you "add complexity" by using a decent algorithm. you couldn't get characters so far away from your initial input if you threw away mutations that go in the wrong direction
17:11daniel___https://gist.github.com/1279450 - eventually i pass an int to char that it doesn't like (-1 for instance)
17:11daniel___amalloy: maybe i need to study my fitness algorithm some more, because i dont understand why it is deviating so much tbh
17:12amalloyi told you this weekend, it's because your evolve function allows mutations in the wrong direction to propagate
17:12amalloywhere's your git repo again?
17:13daniel___i don't understand why...im filtering for (<= fitness child parent), a lower fitness being better
17:14daniel___https://github.com/danielstockton/evolve/blob/master/src/evolve/core.clj
17:14daniel___if i try it in the repl: ((fitness-fn "bob") "bob") = 0 and ((fitness-fn "bob") "jim") = 221
17:15daniel___and so on in between...so it appears to work correctly
17:20amalloyyour fitness function is fine
17:28jcromartielol http://colinm.org/language_checklist.html
17:29daniel___does iterate keep pluggin the return value back in each iteration? is that the problem
17:29ibdknoxhahaha "You have reinvented Brainfuck but non-ironically"
17:30daniel___i thought iterate ran the same function over and over
17:30daniel___but it uses the return value as the new argument each time?
17:30amalloy&(take 10 (iterate inc 1))
17:30lazybot⇒ (1 2 3 4 5 6 7 8 9 10)
17:31daniel___i see
17:31daniel___that is the problem then, in this case i dont want iterate
17:32daniel___i know amalloy. does repeatedly only work for numbers? evolve.core$mutate cannot be cast to java.lang.Number
17:33amalloyits signature is different from iterate
17:33ordnungswidrigdaniel___: (take-while odd? (repeatedly #(rand-int 10)))
17:33ibdknox,(doc repeatedly)
17:33clojurebot"([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"
17:34daniel___hmm i'm passing a function with args
17:35ordnungswidrigdaniel___: you can either use partial (repeatedly (partial rand-int 10)) or an anonymous function #(rand-int 10) like above
17:36dafrain clojurescript, how to read a property of a dom node (textContent, style, etc.) ?
17:38ibdknoxdafra, you'll need to read up on the google closure library
17:38ibdknoxdafra, pinot had most of that though
17:38dafraibdknox: i already use it in javascript
17:38ibdknoxhas*
17:38ibdknoxhttps://github.com/ibdknox/pinot/blob/master/src/pinot/dom.cljs
17:39daniel___danke schoen ordnungswidrig
17:41daniel___jetzt funktioniert es wie ich wollte
17:42daniel___can i use an 'or' in my filter function? i need it to stop repeating if (= 0 (fitness %))
17:42ibdknoxlol sind Sie Deutsch?
17:42daniel___nein aber ich spreche gerne Deutsch
17:43dafraibdknox: looks like (. node property) works fine
17:43amalloyas would (.property node)
17:43daniel___I am from Burkina Faso
17:43ibdknoxdafra, yep, the only problem is crossbrowser differences
17:43ibdknoxI see
17:43dafraibdknox: just like you showed me (.body js/document) yestaerday
17:44ibdknoxIch hab's bei der Uni studiert
17:44dafraibdknox: some properties are best accessed throuh goog.dom, for sure
17:44daniel___Ich auch
17:46etoschhas anyone noticed an issue with lein run binding standard error to standard out?
17:47technomancyetosch: which version?
17:47daniel___(filter (or #(< % 5) #(= % 8)) (iterate int 1))
17:47etosch1.6.1.1
17:47daniel___,(filter (or #(< % 5) #(= % 8)) (iterate int 1))
17:48clojurebot(1 1 1 1 1 ...)
17:48daniel___oops
17:48daniel___,(filter (or #(< % 5) #(= % 8)) (iterate inc 1))
17:48technomancyetosch: that may be outside lein's control due to the JVM's crappy unix support. you could try "lein trampoline run [...]"
17:48clojurebotExecution Timed Out
17:48daniel___erm?
17:48ibdknox,(take 10 (filter (or #(< % 5) #(= % 8)) (iterate inc 1)))
17:48clojurebotExecution Timed Out
17:49ibdknoxoh wow
17:49ibdknoxI should've read the code
17:49etoschtechnomancy: ick. It's still binding out to err
17:49ibdknoxlol
17:49ordnungswidrig,(take 10 (filter #(or irc://chat.eu.freenode.net:6667/#(%3C % 5) irc://chat.eu.freenode.net:6667/#(= % 8)) (iterate inc 1)))
17:49clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 3C >
17:49ibdknox,(take 10 (filter #(or (< % 5) (= % 8)) (iterate inc 1)))
17:49clojurebotExecution Timed Out
17:51etoschtechnomancy: rather, it's still doing something I don't expect; I'll have to do a few more tests first
17:51ordnungswidrig&(take 10 (filter irc://chat.eu.freenode.net:6667/#(or (< % 5) (= % 8)) (iterate inc 1)))
17:51lazybotjava.lang.ClassNotFoundException: irc://chat.eu.freenode.net:6667
17:51ordnungswidrig???
17:51lazybotordnungswidrig: How could that be wrong?
17:51ibdknox,lol
17:51clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: lol in this context, compiling:(NO_SOURCE_PATH:0)>
17:51daniel___,(filter #(or (< % 5) (= % 8)) (iterate inc 1))
17:51clojurebotExecution Timed Out
17:52daniel___now i see why you're adding take 10
17:52dafrain cljs, how to require objects (not modules) like goog.debug.Logger ? to call getLogger*
17:52ibdknoxhah
17:52daniel___,(take 10 (filter #(or (< % 5) (= % 8)) (iterate inc 1)))
17:52ibdknoxit goes forever
17:52daniel___yeah :/
17:52ibdknoxbecause there aren't 10 values that fit that
17:52clojurebotExecution Timed Out
17:52ibdknoxso it continues looking
17:52ordnungswidrigibdknox: bingo
17:52ibdknoxdaniel___, what is it you actually want to do?
17:53daniel___well there should be only 5 values that fit that...but i imagine it keeps looking anyway just in case? :/
17:53daniel___a filter with an or
17:53ibdknoxno
17:53ibdknoxthat's a solution, not a problem :)
17:53daniel___https://github.com/danielstockton/evolve/blob/master/src/evolve/core.clj line 21/22
17:53ibdknoxa filter with an or will work over a finite set
17:54daniel___once fitness reaches 0 the iterate (actually, its now repeatedly) runs forever
17:54ibdknoxso you want an and
17:54daniel___ok, (and (blah) (!= % 0))
17:54ibdknoxyou want all values where the fitness is <= and > 0
17:55daniel___no, i want to include = 0
17:55daniel___wait
17:55ibdknoxbut you want to stop once it reaches there?
17:55daniel___what do i want? lol
17:56daniel___yeah, stop once it reaches 0
17:56ibdknox,(doc take-while)
17:56clojurebot"([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects."
17:59daniel___this is what i thought i wanted https://github.com/danielstockton/evolve/blob/master/src/evolve/core.clj
17:59daniel___anyway, its been a relatively production evening, now 1am
17:59daniel___gotta get some sleep
18:00daniel___,(println "night world")
18:00clojurebotnight world
18:01ordnungswidriggood night
18:08dafrahow to require an object like goog.debug.Logger ?
18:10etoschso what is the best way of capturing standard error to redirect into a file?
18:10etoschi can use java calls and make normal java errors redirect properly
18:10etoschbut when I rebind *out* to *err* locally, I lose information
18:11cgrayI'm having trouble upgrading my slime setup. I installed clojure-mode and have been trying to use clojure-jack-in, but I get "error in process filter: Symbol's value as variable is void: Warning:"
18:11etoschfor example, I have some test code (binding [*err* *out*] (print 'test') (/ 9 0))
18:11etoschand I run it using the direct java call
18:11etoschwhere I redirect stdout to filename out and stderr to filename err
18:12etoschbut out has 'test in it and the java error is lost
18:13etoschIf I run the script without the binding call, 'test gets printed to out and the divide by zero error gets printed to err
18:13etoschso what is the proper way of locally binding data from standard out to standard error
18:14ordnungswidrigIf it's java code that uses stdout, then you'll need to use System.setStdOut / System.setStdErr
18:18etoschit's clojure code, but I'm running it with the java call, rather than the lein call
18:18ordnungswidrighmm, then (binding [*err* *out*] …) should be ok
18:19ordnungswidrigbut if you mean the exception, this is printed by a java handler I think.
18:20etoschthat's still printing to stdout
18:20ordnungswidrigin any case it's caught outside you (binding …) form, and I think Exception.printStackTrace() will be called — which Java and does not know of *out* and *err*
18:21ordnungswidrigI'd suggest catching the Exceptions inside the binding and the stacktrace from clojure.
18:21etoschI want to bind some data to *err* and then in my shell script redirect
18:21etoschI don't care so much about the proper errors; I just threw one in there to see if I couldn't figure out what's happening to it
18:22ordnungswidrigso try if (binding … (.write *err* "goes to err")) works.
18:25ordnungswidriggood night, everyone.
18:26etoschgot it
18:30ghiul
18:31ghiui know that it's behind the dynamic nature of clojure, but is there a way to accept only a specific type as a function parameter?
18:32cgraywhen i do a C-x C-e on a form with a swank server started by "lein swank", the swank server crashes with "exception in read loop". does anyone know of a workaround for that?
18:32aaelonyselect-keys grabs the keys/vals I want but doesn't preserve the order in which I asked for them. I checked the source and tweaked it to do this, but is there a ready made function that already does this?
18:33ibdknoxaaelony, the order?
18:33aaelonyyes, for example: (select-keys {:a 1 :b 2 :c 3} [:b :c])
18:33aaelonyI wanted to see :b then :c
18:34aaelonyinstead of {:c 3, :b 2}
18:34ibdknoxmaps don't guarantee order
18:34aaelonyexactly
18:34aaelonyI cahnged it to a vector
18:34aaelonybut wondered if there is already a function out there
18:34ibdknoxah
18:35brehautwhat about using a sorted map?
18:35aaelonyis there a select-keys that returns a sorted map?
18:35brehaut,(select-keys (sorted-map :a 1 :b 2 :c 3) [:b :c])
18:35clojurebot{:c 3, :b 2}
18:35brehauthmm
18:36aaelonythat wouldn't preserve the order
18:36ibdknoxlol
18:36ibdknoxyou shouldn't be using a map if the order matters was my main point
18:36ibdknoxbuuut
18:36brehautim a little surprised; i would have thought it would maintain the map type
18:36aaelonyI'm not using the map, it is select-keys that returns it
18:37ibdknoxso you just want values?
18:37aaelonythat would work too
18:37brehautibdknox: sorted and ordered maps are useful in rare situations
18:37ibdknoxbrehaut, I agree, but not in this one :)
18:38aaelonybasically, I want to ask for specific keys from a map and I am looking for the output to be the way I asked for it to be.
18:38ibdknox,(map {:a 1 :b 2 :c 3} [:b :c] )
18:38clojurebot(2 3)
18:38aaelonyI tweaked the select-keys function, but thought there might exist something that does this too
18:38ibdknoxaaelony, ^
18:39aaelonyibdknox: that would work too
18:39aaelonybut wasn't what I was asking... :)
18:40amalloyit's really the only solution that's correct, though
18:40amalloyif you want something that has ordering, then you don't want a map
18:40ibdknox:)
18:40amalloyibdknox's solution gives you exactly what you wanted: a sequence in the order you asked for
18:41aaelonyright, I want a select-keys function that returns the order of the keys a request
18:41aaelonyits easy to write, I just thought I'd ask
18:41amalloyaaelony: what do you find unsatisfying about the solution using map?
18:42ibdknoxyou have the keys
18:42aaelonyI need the output in exactly the order I ask for...
18:42amalloyit is!
18:42ibdknoxlol
18:42aaelony:)
18:42ibdknoxit's in the exact order
18:42aaelonyI am not arguing
18:42brehautit even works if the keys have no sensible ordering
18:42sridbest way to create an one-off function that returns a hash-map? (to be used in (map ..) )
18:42srid( #(assoc {} :key "val") )
18:42srid?
18:43ibdknox,(let [my-order [:b :c] (map {:a 1 :b 2 :c 3} my-order))
18:43clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
18:43ibdknox,(let [my-order [:b :c]] (map {:a 1 :b 2 :c 3} my-order))
18:43clojurebot(2 3)
18:43bsteubersrid: (constantly {:key val})
18:43sridI mean, *create* a map
18:43ibdknox,(doc hash-map)
18:43clojurebot"([] [& keyvals]); keyval => key val Returns a new hash map with supplied mappings."
18:43sridval will differ based on what is passed to the function
18:43ibdknox,(hash-map)
18:43clojurebot{}
18:43brehautsrid: (partial hash-map key)
18:43sridmore like: ( #(assoc {} :key %) )
18:44brehauterr (partial hash-map :key)
18:44amalloyor (fn [v] {:key v})
18:44amalloywhich seems simplest to me
18:44sridok, hash-map is good enough.
18:44ibdknoxor #(hash-map :key %)
18:44ibdknoxor
18:44ibdknoxlol
18:44srid,(map #(hash-map :key %) (range 5))
18:44clojurebot({:key 0} {:key 1} {:key 2} {:key 3} {:key 4})
18:44brehautor #(-> {:key %})
18:44ibdknoxsounds like a (for) waiting to happen
18:45amalloyhaha (dec brehaut) that's horrible
18:45ibdknoxamalloy, I figured you'd be all over that :p
18:45brehautamalloy: thats from the joy of clojure, so blame fogus and chouser :P
18:45ibdknoxsrid: consider using for, it's probably cleaner
18:45ibdknox(for [x (range 5)] {:key x})
18:45sridibdknox: yup
18:50sridhttps://gist.github.com/1279714 <- is there a better way to write the (loop ... (recur ...)) pattern in this code?
18:50amalloysrid: this looks like a reduce
18:51sridfyi, "running-hosts" is an agent of hash-map of hostname -> a lazy-seq that represen\ts "tail -f /some/log/file" on that host
18:51srid(the code has a bug in that old hosts are not removed)
18:51sridamalloy: interesting
18:52sridreduce is one of those functions I tend to avoid subconsciously
18:52ibdknoxyou shouldn't :)
18:52amalloyyou're reducing hosts into newhosts, right?
18:52amalloyand sending to an agent as a side effect
18:52sridyes, but more like, reducing hosts and newhosts into (another state of) newhosts
18:53amalloymmmmnope, not really. you're reducing hosts with an initial value of newhosts
18:54sridi was confused. i take "hosts" and update the agent by adding hosts that are only in 'hosts' to the agent.
18:54sridreduce will work, let me think
18:57sjlI don't suppose anyone knows a version of lein-marginalia that will parse docstrings, as well as comments inside functions?
18:57sjlI really want to use it, but I don't have time to dive in and fix that myself...
19:00sridreduce does simplify it https://gist.github.com/1279714#gistcomment-55857
19:35jcromartieI'm really seeing the benefits of deferring changes as late as possible
19:35jcromartiei.e. functional programming in the small-to-medium
19:38jcromartiealso a cool bonus feature: I can make a "test mode" by very cheaply "pushing" the state of the system into a user's session
19:38jcromartieso you can use the system as if it were fully functional, but not make any permanent changes
19:51archaicany ideas how to (set! *print-length* 25) automatically when I start repl using clojure-jack-in?
20:39todunnew to clojure. trying to get clojure up and running in terminal, does any know of a good(easy) tutorial or steps to do this? thanks.
20:39brehauttodun: have you got leiningen?
20:39ibdknoxtodun, https://github.com/technomancy/leiningen
20:40todunbrehaut: what's that? let me google..
20:40brehauthttps://github.com/technomancy/leiningen
20:40ibdknox:p
20:40todunbrehaut: ibdknox looking at it now. thanks.
20:40brehauttodun: see also: http://dev.clojure.org/display/doc/Getting+Started
20:42technomancyhttp://dev.clojure.org/display/doc/Getting+Started+for+Beginners might be better
20:45toduntechnomancy: looking at that now. thanks.
20:46todunare there any places to find a repo of clojure solutions of concurrency problems(jumping in the deep end i know)?
20:48technomancynah, concurrency's easy.
20:48technomancythe solution to concurrency problems usually revolves around a correct understanding of state and identity: http://clojure.org/state
20:49technomancythere's no cookbook for "you're having this problem; here's a a problem to apply", it's more "design it right up-front and concurrency isn't very difficult"
20:49technomancy*pattern to apply
20:50toduntechnomancy: what else should I know? Also, where do I learn to design right by concurrency?
20:50todunat least clojure style?
20:51technomancythe state url above is the best place to start
20:52toduntechnomancy: ok. thanks.
20:54toduntechnomancy: I'm following the emacs setup here and it seems to suggest that I have to ditch my current installation of emacs if I have one(yes). Is this necessary?
20:57technomancytodun: not at all
20:57technomancyyou may have trouble if it's currently configured to connect to common lisp using slime, but that's the only conflict. just install clojure-mode and swank-clojure, and do M-x clojure-jack-in
20:58toduntechnomancy: maybe I'm misunderstanding the directions there then.
20:58technomancymaybe the directions are wrong... let me see =)
20:58todundo I have to always run clojure mode with M-x?
20:59technomancyno, clojure-mode will activate automatically when it's installed
20:59technomancyM-x clojure-jack-in is to start a repl session
20:59toduntechnomancy: they're probably right
20:59technomancyI don't see anything in the directions that indicate needing to throw away your current setup
21:00toduntechnomancy: ok.
21:00technomancyunless you use aquamacs or xemacs or some other fork
21:01toduntechnomancy: just emacs that comes with terminal
21:02brehautlets be honest, those apps are more like sporks than forks
21:02technomancyI have no idea what that means, but I like it.
21:02brehauttodun, thats possibly a very old version of emacs
21:02toduntechnomancy: what goodies does the emacs starter-kit give that the default osx emacs doesn't have?
21:03todunbrehaut: do you recommend I get the emacs starter kit then?
21:03brehauttodun: OS X lion appears to have emacs 22.1.1 ?
21:03brehauttodun: emacsformacosx.com/ and the starter kit
21:03todunbrehaut: not on lion yet, sadly.
21:03technomancytodun: hard to explain succinctly, I'd recommend just going with clojure-mode for now since you can waste a lot of time on your elisp without getting anywhere on clojure.
21:03technomancybrehaut: eep
21:04brehauttechnomancy: really?
21:04technomancythat's practically antediluvian
21:04brehautoh right, the emacs version
21:04brehautyeah. breaks horribly with the starter kit too
21:04technomancybrehaut: well, assuming he's already got an emacs config
21:05brehauttodun: the app that you get from emacsforosx has the terminal version in Emacs.app/Contents/MacOS/Emacs and if you flick it the -nw flag it runs as a terminal app. (i aliased it in my .profile)
21:06todunbrehaut: checking it out now.
21:06toduntechnomancy: emacs config?
21:07brehauttodun: just a warning, i hate emacs so take everything i say with a grain of salt
21:08technomancytodun: I mean if you haven't used emacs before you probably want the starter kit because the defaults are terrible. if you have an existing setup then I assume you're comfortable enough with it that you should just go with what you know.
21:09technomancyoh, maybe I misread your original question; you're talking about the version you have installed rather than emacs config you have already set up?
21:09todunbrehaut: ok.
21:10toduntechnomancy: I was wondering what you meant by emacs config.
21:10todunif you were referring to .emacs
21:11technomancyyeah, I just misunderstood what you were asking
21:11toduntechnomancy: np
21:12technomancy22 is pretty old (circa 07 maybe?); I would recommend upgrading
21:12technomancythe 24 pretests on http://emacsformacosx.com/builds have been very stable
21:12todunbrehaut: so in a sense this emacsformacs is just like a text-editor but with emacs mode...
21:12technomancyin fact, I've been running 24 since 23 was released, and it's never crashed, while 23 has actually crashed for me a few times.
21:13todunbrehaut: making an alias for it is what you suggest or that those commands will make the cli emacs open this emacsformacs?
21:13brehauttodun: re alias, correct
21:14brehauttodun: in every way it is a proper build of emacs, rather than a spork
21:14todunbrehaut: ok.thanks. spokr?
21:14todun*spork?
21:14brehautso calling it a text editor under sells it a little
21:15brehautsporks are half way between a spoon and a fork
21:15toduntechnomancy: ok. I'll try that.
21:15technomancy24 has the package manager built-in, so there's a bit less hassle there
21:15brehautaquamacs is halfway between emacs and a mac native application
21:16toduntechnomancy: gotten it. thanks. so does this already have clojure mode?
21:17brehauttodun: i have alias "emacs=/Applications/Emacs.app/Contents/MacOS/Emacs -nw" in my ~/.profile which means 'emacs' opens a new editor, and 'open -a emacs' opens the app version
21:17todunbrehaut: which is better?
21:18todunbrehaut: for you at least?
21:18brehauttodun: it depends
21:18brehautif you use the app, you can use the mouse to flail around if you cant remember a key chord
21:18brehautbut everything opened with the app exists within one process; its a bit harder to hive off projects
21:19brehautthe app also lets you set readable fonts differently from your terminals
21:19todunhive?
21:20brehauti cant explain it any better :/
21:20todunbrehaut: ok. thanks for the tips all the same.
21:20brehautno problem, just remember my caveat
21:20todunbrehaut: you never mentioned why you hated it.
21:21brehauti hate all text editors
21:21brehautoh, terminal emacs in lion means you can take advantage of full screen terminal to get a tiling window manager for your emacs windows (and shells and repls)
21:21todunbrehaut: I'm not sure what that means but it sounds cool.
21:23brehauthttp://haskell.org/haskellwiki/Xmonad/Screenshots#Tiled_layouts
21:24todunbrehaut: ok. thanks.
21:26jcromartiehow is Java/Clojure on Lion?
21:26brehautfine?
21:26jcromartieI assumed as much
21:26jcromartiebut I wasn't sure if there were any weird issues
21:26technomancytodun: the package manager in emacs 24 lets you easily pull from marmalade, the community package repository, which has clojure-mode
21:26brehautnot that ive encountered
21:27technomancybut it's not configured as a source out of the box
21:27toduntechnomancy: after getting emacsformacs, I try M-x clojure-mode don't find it
21:27brehautjcromartie: it might be more annoying for java programmers than clojure programmers; its 1.6.0 rather than 1.7
21:27technomancytodun: right, you can either add marmalade as a package source and install from there, or just get clojure-mode from github.
21:28jcromartiebrehaut: I'm an OS X user and what is Java 1.7? :)
21:28technomancyhttps://github.com/technomancy/clojure-mode/
21:28jcromartie:P
21:29toduntechnomancy: ok. I'll try that.
21:30toduntechnomancy: so at the repl, all I have to do is add to ~/.emacs.d/init.el ?
21:32technomancyclojure-mode gets you syntax highlighting, indentation, etc., and allows you to start a repl session with swank-clojure
21:32technomancybut that requires leiningen: https://github.com/technomancy/swank-clojure
21:34toduntechnomancy: so leinnigen first?
21:34technomancyyeah, you can spend hours on the elisp rabbit trail and not really learn anything
21:35technomancyleiningen will get you straight to writing clojure
21:35toduntechnomancy: back to the beginning of our convo with brehaut
21:35todun:)
21:35technomancyzactly
21:36toduntechnomancy: it says download the script. it is named lein. what is it's extension?
21:40amalloynil? it has no extension
21:41amalloyif you read the first line it probably says something like #!/bin/bash, which probably answers the question you actually meant to ask?
21:42amalloyjcromartie: i've heard you can run into trouble trying to run the Lion JVM in 64-bit mode
21:42jcromartieinteresting
21:43jcromartieI thought Java defaulted to 64-bit, though
21:43amalloyclojurebot: spork is <reply> <brehaut> sporks are half way between a spoon and a forkf
21:43clojurebotIk begrijp
21:43jcromartiewhat does "java -version" say?
21:43amalloydang it. stupid typo
21:43jcromartiemine (Snow Leopard) says Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
21:55toduntechnomancy: when it says place it on your path in the leiningen install directives, doesi t mean put it in say your home dir?
21:56toduntechnomancy: if so can I change the name of the file to .lein ?
22:00amalloytodun: to your second question: you can do whatever you want, but you're unlikely to be happy with the results of doing that. to your first: it's common to have a directory named bin in your home, which is on your PATH
22:00amalloythen you can just dump lein in there, and tada
22:01todunamalloy: oh ok. I don't have one. is creating it ok on osx?
22:01amalloysure, go for it
22:01todunamalloy: thanks.
22:02amalloyyou have to actually add it to your PATH, eg by editing your ~/.profile - it doesn't just magically get there.
22:02todunamalloy: for ~/bin or for lein ?
22:03amalloyfor ~/bin, if i understand your question
22:08todunamalloy: so something like this?
22:08todunexport BIN_HOME=~/bin
22:08todunexport PATH=$BIN_HOME/:$PATH
22:09amalloysure
22:17todunamalloy: by the way, what does putting it in my path do?
22:17todunie. putting bin in my path.
22:18toduntechnomancy: I've done the step 1 of leiningen, for step 2 it says Place it on your path and chmod it to be executable. how so?
22:19todundo I chmod `/bin/lein at the repl?
22:19todun* chmod ~/bin/lein
22:22amalloytodun: chmod +x ~/bin/lein
22:23amalloyanyway, putting it in your path means that when you type lein (or any command) in the shell, your OS will look in ~/bin to see if a command with that name is there, and run it if so
22:28todunamalloy: thanks. trying that now.
22:29todunamalloy: by the way, is lein like sbt?
22:29amalloy$google sbt
22:29lazybot[SBT Homepage] http://www.statebankoftravancore.com/
22:29amalloywell, it's not like that sbt, and i don't know any others
22:30todunamalloy: Simple Build Tools
22:30amalloy*shrug*
22:30todunamalloy: ok. at the repl, I've simply typed lein
22:30todunamalloy: it downloaded a bunch of stuff.
22:30amalloycool beans
22:31amalloytry lein repl
22:31todunamalloy: I'm not sure about lein but I was hoping to get the emacs-mode for clojure.
22:31todundo I now do the swank?
22:32todunat https://github.com/technomancy/clojure-mode/ , it says to update package.el
22:33todunbut then it says to ;; add to ~/.emacs.d/init.el if you aren't already using Marmalade.
22:33amalloymeh. talk to technomancy about that, not me. my emacs setup is old and crusty, and not really recommended
22:33todunamalloy: ok. thanks though.
22:33amalloytodun: does lein repl work?
22:34toduntechnomancy: having lein, how to I follow steps at clojure-mode to make my emacs have clojure-mode?
22:34todunamalloy: do you mean does typing lein in the repl do anything?
22:34amalloyno, typing lein repl into your shell
22:34todunamalloy: typing lein in the repl did soome download
22:34todunlein repl ?
22:35amalloyindeed
22:35amalloylein is, in some ways, like make, or git: a main command with subcommands
22:35todunamalloy: I get a user=> prompt
22:35amalloythere you go, you're coding clojure, hooray
22:35todunoh
22:35todunso lein is the clojure erpl?
22:35todun*repl
22:35amalloyno
22:36todunwhy call it lein?
22:36scottjread the lein readme
22:36amalloybut lein[ingen] is a convenient way to manage clojure environments, including getting a repl
22:37todunscottj: the readme is flying over my head.
22:37todunamalloy: ok. does that mean that lein[...] is like an environment for development clojure?
22:37scottjtodun: ok well it explains the name. basically lein managed dependencies for your projects and has many features including loading a repl up for a project
22:38amalloyi guess? maybe? it's not really very clear how to answer the question :P
22:39seancorfieldtodun: what languages have you worked with before? (sorry if you already said - i only just signed on) maybe we can figure out what lein is "like" in your experience...
22:40todunscottj: so this repl will treat your project as packages to its namespace?
22:40todunamalloy: ok. thanks all the same.
22:41scottjif you're inside a project when you do lein repl it will have your dependencies that are listed in project.clj on the classpath and you'll be able to reload/use them
22:41todunseancorfield: uhm..lets go with scala since it too is pseudo-functional. but I'm just familiar with it
22:41scottjif you're not in a project when you do lein repl it just gives you a clojure repl without (generally) any other libraries
22:42scottjtodun: sbt I think is similar
22:42seancorfieldtodun: did you use a build tool with scala? maven? sbt?
22:42todunscottj: I suspected.
22:42duck1123If you use Ruby, it's like using RVM with bundler
22:43todunseancorfield: I used sbt. but didn't understand many things about it expect that it was used to build the project.
22:43todunduck1123: that's news to me. but I'll check it out. thanks.
22:44todunso it's a bad idea to make lein repl have an alias of clojure ?
22:44todunmeaning, is there a clojure repl out there I can independently install?
22:44brehautamalloy_: "my emacs setup is old and crusty" thats basicly the definition of emacs isnt it?
22:45duck1123It's usually best to always have a project, even if you have a project only for random repl use
22:45seancorfieldtodun: the clojure libraries include a bare bones REPL - see http://clojure.org/getting_started
22:45seancorfieldlein repl wraps that and takes care of library dependencies and the java classpath
22:45scottjtodun: about 10 minutes after you get a bare clojure repl running you're going to realize you want a feature that lein provides so just use it :)
22:45brehauttodun: clojure has a curiously equal relationship with the rest of the language ecosystem; its less of a thing above all others
22:48todunscottj: so it's just best to make my clojure alias lein repl then, it will safe a newbie like moi allot of headache...
22:48todunbrehaut: I don't follow.
22:48brehauttodun: thats because i failed at english
22:48todunseancorfield: ok. thanks.
22:48scottjtodun: are you talking about a shell alias clojure="lein repl"?
22:48duck1123todun: just learn to love lein and all the subcommands. You'll be happier
22:48todunduck1123: having a project?
22:49brehauttodun: clojure is a library not a 'full' enviroment like you might expect with other languages
22:49brehauttodun: lein fills the common enviromental roles
22:49todunbrehaut: yes, I saw that in the docs.
22:49duck1123todun: create a project where you can set up the dependencies you want and always cd to that dir before you start a repl
22:49seancorfieldyup, you could add clojure to a scala project just by adding the clojure.jar file to the classpath
22:49todunbrehaut: that's why I can get clooj.jar, right?
22:49brehauti have no idea what clooj is
22:50brehautbut i guess so
22:50duck1123clooj is an ide in clojure
22:50seancorfieldand then in scala you could do new clojure.lang.RT and have access to the clojure runtime inside scala :)
22:50duck1123it's neat, but no emacs
22:51todunseancorfield: that's interesting. sounds like a though install for me though.
22:51brehauttodun: the thing with aliasing lein repl to clojure is that its not just clojure, its lein and it reacts differently in the presence of a project frinstance
22:51todunbrehaut: ok. how so?
22:51brehautwell if you are ina project, the repl will have the dependancies and verson of clojure that the project requests
22:52brehautwhereas if you are out of a project its just going to have clojure and whatever lein wants it to have
22:52duck1123when you're in a project directory, lein repl runs with the declared version and dependencies
22:52seancorfieldthat means you can have one project that uses clojure 1.2.1 and another project that uses clojure 1.3.0 and lein automatically manages the libraries etc
22:52brehauttodun: clojure and clojure deps is not installed system wide, but are managed per project by lein
22:53todunso if I am in ~/proj1 , I will launch lein repl then test my first_app.clj there?
22:54todunand have all the dependencies I need.
22:54duck1123if you do: lein new proj1 it'll set up everything for you
22:55todunbrb. changing internet locations...
23:04todunduck1123: ok I'll try that. thanks.
23:04todunhope I didn't miss anything.
23:04todunlast I got was duck1123 suggestion
23:09amalloytodun: http://www.raynes.me/logs/irc.freenode.net/clojure/2011-10-11.txt
23:10todunamalloy: thanks. I didn't know that was avialbale.
23:10todun*available.
23:10amalloythere are a number of public logs of this channel; that's one
23:11todunamalloy: where is the list?
23:12brehauthuh the zsh autocomplete for lein is pretty cool
23:13amalloyi can't imagine why anyone would bother to publish a list of the different logs of #clojure
23:13ibdknoxfor fame, of course
23:13clojurebotthen its perfect. but of course, there are a lot of other parts too that changes. so after I make assoc :show, is there a problem I make again (def data (assoc data :list ...)
23:14ibdknoxvery relevant clojurebot.
23:14amalloyclojurebot: ?
23:14clojurebot#<ClassCastException java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;>
23:14ibdknoxlol
23:14amalloysensible
23:17toduntrying to follow https://github.com/technomancy/clojure-mode/ do I put package.el in bin too?
23:17todunor add to ~/.emacs.d/init.el ?
23:21brehautemacs packages are managed inside emacs
23:22brehautM-x package-install starter-kit-lisp should get you there?
23:22sridthat requires emacs 24 though
23:22brehautah yes it does
23:22sridbut I agree that starter-kit is the easiest route
23:22sridstarter-kit v2
23:28todunbrehaut: ok will try
23:28todunsrid: I got that by technomancy suggestion
23:28sridtechnomancy wrote starter-kit as well
23:28todunbrehaut: srid so I should use emacs 24 or starter-kit v2?
23:29sridtodun: yes
23:29sridand, not or.
23:29brehautboth :)
23:29todunsrid: ok. let me look into starter-kit.
23:30sridstarter-kit keeps ~/.emacs from getting dirty
23:30todunsrid: actually, I downloaded stater-kit if I'm reading this right...https://github.com/technomancy/emacs-starter-kit
23:31todunI went to http://emacsformacosx.com/builds and got 24
23:35todunbrehaut: trying M-x, then package-install, then starter-kit-lisp doesn't work for me.
23:35todunit says no matcg
23:35todun*match
23:35brehautim not an emacs expert sorry
23:36brehauti just followed the instructions o nthe starter kit page
23:36todunbrehaut: oh ok. thanks all the same.
23:36amalloyprobably package-refresh-packages or something
23:37todunamalloy: ok. let me try that.
23:38todunamalloy: I do M-x, package-refreshcontents is all that shows up. should I use that instead?
23:39amalloysee "or something". that's as promising-sounding as anything else
23:42todunamalloy: in emacs or in the readme for emacs-starter-kit?
23:42amalloyhuh?
23:42todunamalloy: you said see "or something"
23:43amalloy<amalloy> probably package-refresh-packages or something
23:44todunamalloy: oh ok. thanks. I'm trying package-refresh-contents
23:45todunbrehaut: what else did you do when you followed the readme for emacs-starter-kit?
23:45brehautnothing
23:46brehautit worked fine for me
23:46sriddid you add the marmalade repo as per README?
23:46brehauti guess so
23:46brehauti just did what it said
23:47brehautoh, your probably talking to todun, my bad
23:48todunsrid: that is what was confusing
23:48todunsrid: I assumed brehaut was indicating that step by his instructions.
23:48sridadd init.el and restart emacs
23:48sridadd to*
23:49todunsrid: init.el does not exist for me in ~/.emacs.d/init.el
23:49sridcreate?
23:49todundo I put package.el into init.el?
23:50sridpackage.el? emacs 24 includes package.el.
23:50sridtodun: get the 'pretest' build from http://emacsformacosx.com/builds
23:51brehauttodun: indeed, but you need to require it
23:51sridor 'nightly'