#clojure logs

2012-01-06

00:50jodaro wow
00:50jodarolamina is really nice
01:42alexbaranoskydo any of you use lazytest?
01:43alexbaranoskydo you keep your tests in the same namespaces as your production code? I say that, because it seems like if you modify a production file, it won't run the test that goes with it, unless that test is in the same ns...
02:07replacatechnomancy_: you there?
02:09replacaTimMc: looks cool!
02:09replacaI like the ns comment best
02:14alexbaranoskyis there any annotation support in Clojure? I want to try using PowerMock, but I think it requires using some annotations
02:25hiredmanalexbaranosky: yes, deftype has some kind of annotation support, not sure if anyone has used it
02:26alexbaranoskyhiredman, thanks, I'm playing with adding support for mocking static methods, but the JAva library I was thinking of building off of requires using annotations. More research needed
05:39true_droidwhat's the most efficient way to append elements to the end of a sequence?
05:39true_droidSay, I have a function which takes a sequence and modifies it in some way. But the order of elements has to be preserved.
05:39true_droidMultiple alternatives come to mind:
05:39true_droid1) start with an empty vector [], conj elements into it and then return (seq my-vec)
05:39true_droid2) start with an empty list (), conj elements into it and then return (reverse my-list)
05:39true_droid3) like the previous one, but use (into () my-list) in the end
05:39true_droid4) start with a list (), append each consecutive element to it with (concat my-list (list element))
05:42philandstuffnot 4), that's for sure
05:42philandstuffafaik each concat is linear in terms of my-list
05:42morphlingtrue_droid: concat is lazy, so that is good, but do you really have to add items one by one?
05:42morphlingphilandstuff: it is?
05:42morphling,(doc concat)
05:43clojurebot"([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."
05:43philandstuffmorphling: ooh ta
05:44true_droidhm, I haven't thought about it
05:44true_droidso, it depends on the use-case; whether I want the whole sequence at once or not
05:44true_droidin each case efficiency is defined in a different way
05:46philandstuffmorphling: so if you build up a sequence using concat, when you call first on the resulting sequence won't that be a linear operation, because it has to go through n subsequences?
05:47true_droidmorphling: if I'm writing a compress function which removes consecutive duplicates from a sequence, is there a way to build a new list more than one element at a time?
05:49true_droidas far as I get it, seq doesn't construct a new collection, it's merely an interface
05:49true_droiddoes the same go for 'reverse'? does it reuse the existing collection?
05:54morphlingphilandstuff: yes, but you don't have to traverse the entire first sequence
05:54philandstuffyes
05:54morphlingphilandstuff: so it's linear in the amount of concat calls, but not the length of the first sequence
05:54philandstuffyeah
05:54philandstuffin this situation, the two were equal, but it ain't necessarily so
05:55philandstuffso 4) is still a bad idea, but not for my original reason
05:55morphlingyes
05:55morphlingtrue_droid: you might want to use lazy-seq (or perhaps for)
05:59true_droidok, thanks, I'll look into these
05:59true_droid*those
06:01morphlingthis is about the only case where I really miss lazy evaluation.. in haskell you'd just use reduce
08:34AWizzArdhttp://i.imgur.com/pAy4z.png
08:52bsteuberAWizzArd: rofl
09:04AWizzArd(:
09:46mcrittendengiven these two factorial defns, why would the first one throw a stack overflow and the 2nd one works fine when (factorial 10000N) is called? https://gist.github.com/1570886
09:47tsdhmcrittenden: It consumes stack because it has to remember n in every recursion step.
09:48tsdhmcrittenden: The recur version is in fact compiled to some iterative algorithm without recursion.
09:48rabblerThe second uses recur, which gets compiled into what is basically equivelant to a "for loop"
09:48rabblerIterative is a much better response, thanks tsdh.
09:48pandeiroWhen I try to instantiate a Java class, I get a "No matching ctor found for class ...", so I am using clojure.reflect/reflect to examine the class and it seems to have an eponymous method -- that signifies a constructor in Java, right?
09:48mcrittendeninteresting, thanks for the explanation tsdh and rabbler
09:49tsdhmcrittenden: Google for clojure recur, and you'll find a bunch of more elaborate explanations.
09:49mcrittendentsdh yeah doing that now :)
09:57pandeiroAh so Java throws the no ctor found just because the arity is off... I like clojure's error message better
10:38AWizzArd$seen jchoi
10:38lazybotI have never seen jchoi.
10:51mcrittendenwhat is a ref? http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/ref is that the same thing as a managed reference? this is a concept I'm unfamiliar coming from python
10:53TimMcmcrittenden: http://clojure.org/refs
10:54mcrittendenTimMc yeah found that but it's still a little fuzzy for me. so the idea is just that you don't have to worry about different threads having a different value for it, whereas with vars you do?
11:00mcrittendenTimMc: never mind, after reading through that page a couple more times, I think I mostly get it
11:02mcrittendenthis helped as well: http://en.wikipedia.org/wiki/Software_transactional_memory
11:13pjstadiga "managed reference" could be an atom, a var, or a ref
11:13pjstadiga ref is a very specific kind of "managed reference", which is a bit confusing
11:14mcrittendenpjstadig: yeah that tripped me up.
11:16TimMcmcrittenden: Once you understand 'ensure, you're probably good.
11:58clj_newbwhy is there defn- but neither def- nor defmacro- ?
12:20TimMcclj_newb: More need for defn-, I guess.
12:21TimMcYou can add ^:private as needed for the others.
12:23cgrayand it's pretty easy to write the macro for def- and defmacro- just by looking at defn-
12:30pandeirohow does one handle a map key with a space in it?
12:31hiredman,({"foo bar" 1} "foo bar")
12:31clojurebot1
12:32pandeiro,({:character count 1} ":character count")
12:32clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms>
12:32`fogus,(keyword "a b")
12:32clojurebot:a b
12:33hiredman`fogus: :( don't go doing that, people might think it's a good idea
12:33`fogus,((keyword "a b") {(keyword "a b") :eville})
12:33clojurebot:eville
12:33`fogusIt is a great idea!
12:34hiredman:(
12:34`fogusAlthough I prefer newlines and Klingon chars in my keys
12:34pandeiroyeah not my idea, you work with the libs you got...
12:38DeusExPikachuis there anything in enlive (or anything else) that converts a string to a url with the characters escaped?
12:39ckirkendallmaybe: http://docs.oracle.com/javase/1.5.0/docs/api/java/net/URLEncoder.html
12:41ckirkendall(URLEncoder/encode url)
12:42DeusExPikachuckirkendall: seems to work, thanks
12:43ckirkendallother than the obvious of posting to the IRC whats the best way to get the word out on a new library?
12:43DeusExPikachuckirkendall: the mailing list I believe is the official place
12:43ckirkendallgoogle-groups?
12:44DeusExPikachuckirkendall: yes, the mailing list, which is the list on google-groups
12:45ckirkendallDeusExPikachu: I will put a post out there
12:46ckirkendallIn case anyone is interested I created and enlive like dom manipulation library for clojurescript. It has all the standard transforms plus event handling and effects.
12:47ckirkendallHere is the demo site: http://ckirkendall.github.com/enfocus-site/
12:49cgrayvery cool
12:53`fogusckirkendall: Have you looked at domina?
12:54ckirkendall`fogus: no
12:55`fogushttps://github.com/levand/domina
12:55ckirkendall`fogus: similar concept but the semantics are bit diffrent
12:55`fogusOn first glance your lib seems more mature
12:56ckirkendall`fogus: I was able to handle all of the standard enlive transformation
12:56ckirkendall`fogus: I then had to add all the stuff to deal with a dynamic dome
12:56ckirkendalldom
12:56`fogusit looks nice.
12:57ckirkendall`fogus: I am working on adding a good abstraction for extracting data from the dom
12:57ckirkendall`fogus: thanks
13:00pandeirois there a :use-macros in clojurescript?
13:01technomancyreplaca_: what's up?
13:02arohnerdoes anyone remember seeing a new library for mongoDB? I seem to remember a new lib that claims to be better than congomongo, but I can't remember the name
13:03ckirkendall`fogus: bundled with something like the hiccup implementation in pinot for dom creation it makes a powerful tool for creating UI widgets.
13:04benares_98arohner: do you mean adia?
13:05pandeirockirkendall: have you seen hiccups?
13:05arohnerbenares_98: I don't think so. what I'm thinking of is purely a mongo library, no web stuff
13:06ckirkendallpandeiro: I have now nice!
13:06jodaroarohner: there are a couple others on github
13:06arohnerjodaro: yes, but what are their names? or how do I find them? :-)
13:06jodaromonger
13:06jodarokarras
13:07arohnerjodaro: monger, that's what I was thinking of! thanks
13:07jodaroarohner: http://bit.ly/wFeyGX
13:07pandeirockirkendall: there was a project that was sort of backbone-inspired too but it's been subsumed by something else
13:07jodaroi just did a search for mongo with language:clojure
13:08arohnerjodaro: thanks. I was using google, and not being very successful
13:24ziltiNetsplit?
13:31solussdwhy does this return a vector of two items? (re-find #"([r\-][w\-][x\-]){3}" "rwxr-xr-x")
13:32arohnersolussd: it returns the whole match, and then the parenthesized group
13:32solussdok, is there a way to say, in the regex, that I want that group 3 times without having it be a 'match group' ?
13:33arohneryes
13:33arohner(?:)
13:33arohnerhttp://docs.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html
13:36mr_rmcan someone tell me what the '-' means at the front of a function name, like (defn -main ...)?
13:37solussdin a genclass it is a method
13:37clj_newbTimMc: thanks for the tip on ^:private (re: defn- vs def- defmacro-)
13:37solussd(the default prefix is '-', yu can change it though)
13:39mr_rmsolussd: i saw someone use it on a generic function that was not using using genclass. they just defined a standalone function with the '-' in front of the name and i was wondering if hit had any special meaning in that context
13:39mr_rmhttps://github.com/yogthos/Noir-Eclipse-Template-Project/blob/2a91fcd8b131137e51362f6ffb3b92c4d56b349e/src/my_website/server.clj
13:41solussdmr_rm afaik it doesn't mean anything special, but maybe it does in the context of the noir.server library
13:42mr_rmsolussd: ok thanks
13:45technomancyI love how the "not marked as dynamic" warnings don't use fully-qualified names.
13:50yazirianthat was just irritating me too, not ten minutes ago
13:50clj_newb,(type identity)
13:50clojurebotclojure.core$identity
13:50clj_newb,(type identity) ; why does this not return function, and how can I check is a var is a function?
13:50clojurebotclojure.core$identity
13:51clj_newb,(meta identity)
13:51clojurebotnil
13:52jodaroclj_newb: try fn?
13:52clj_newbjodaro: nice; thanks
13:54metajackclj_newb: you might also want ifn? if you want things like :foo and {} to return true
13:55clj_newbi can imagine :foo is a function which extracts a label
13:55clj_newbbut how is {} a function?
13:55metajackmaps in clojure are functions that take keys and return values
13:56TimMcclj_newb: In Clojure, functions are implemented as class-per-function. identity is an instance of the identity class.
13:56metajack,({:foo :bar} :foo)
13:56clojurebot:bar
13:56TimMc&(class identity)
13:56lazybot⇒ clojure.core$identity
13:56TimMc&(ancestors (class identity))
13:56lazybot⇒ #{clojure.lang.Fn clojure.lang.IMeta java.lang.Object java.util.Comparator clojure.lang.IFn java.util.concurrent.Callable java.io.Serializable java.lang.Runnable clojure.lang.AFn clojure.lang.IObj clojure.lang.AFunction}
13:57clj_newbTimMc: class-per-function as in "each clojure function has a special java class created just for the function" ?
13:58jodaroheh
13:59jodaroeverytime i think i've seen the radness i end up seeing more
13:59technomancy,(throw (RadnessOverflowException.))
13:59clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: RadnessOverflowException, compiling:(NO_SOURCE_PATH:0)>
14:00jodarolike a never ending horizon of radness
14:01clj_newbone more dumb question: is there away in clojure, given two types, to ask " can this type be automatically converted ino that type" ?
14:02clj_newb,(type 1) (type 1.0) (type 1919191919191919191919191919191919)
14:02clojurebotjava.lang.Long
14:02clj_newb,[(type 1) (type 1.0) (type 1919191919191919191919191919191919)]
14:02clojurebot[java.lang.Long java.lang.Double clojure.lang.BigInt]
14:02hiredmandepends what you mean by automatically converted
14:02clj_newbI need someting where (f? Long Double) (f? Long BigInt) both return true
14:03hiredman,(doc number?)
14:03clojurebot"([x]); Returns true if x is a Number"
14:03hiredman,(number? 1)
14:03clojurebottrue
14:03clj_newbhiredman: I'm buidlging a type system on top of Clojure via macros
14:03clj_newbI don't want to do equality checks on types, I want to do checks of the type "A can be cast into B automatically"
14:04hiredmanclj_newb: hardly seems like a project for a clj_newb
14:04hiredmanbut have fun
14:04clj_newbhiredman: what is the right questions to ask?
14:05clj_newbah; I get it
14:05clj_newbI don't care about types
14:05clj_newbI care about what protocols it satisfies.
14:06hiredmanthere are a lot of questions, the first is "do I really know enough to implement a type system if I say things like 'automatically converted'"
14:07clj_newbhiredman: probably not
14:07hiredmanso maybe some reading is in order
14:07clj_newbhiredman: what should I read?
14:08hiredmandunno, something about type systems, or dig into this "automatic" conversion and see what is really going on
14:10clj_newbhiredman: seeing how clojure does this "autoamtic" conversion is interesting; how do I grep through the source code for something ill-defined like this?
14:10clj_newbfurthermore, does this "automatic" conversion ahppen for anything besides numbers?
14:18TimMcclj_newb: Correct. Each function, namespace, deftype, defrecord, proxy... each gets a class.
14:20TimMcclj_newb: You're probably building a precondition system, not a type system.
14:22hiredmanclj_newb: my main point is it's not automatic, what makes you thing it is?
14:22technomancyis he talking about boxing?
14:23hiredmanno
14:23TimMcI think he's talking about the reader.
14:24TimMc$findfn Long Double BigInt true
14:24lazybotjava.lang.RuntimeException: Unable to resolve symbol: BigInt in this context, compiling:(NO_SOURCE_PATH:0)
14:24TimMc$findfn Long Double clojure.lang.BigInt true ; there you go!
14:24lazybot[clojure.core/not= clojure.core/distinct?]
14:36cgrayis there a way to close all open files? i made a mistake and i don't want to have to reboot clojure
14:37amalloy(System/exit 1), cgray
14:38amalloy(this kills the jvm)
14:49ziltiIs there a library to make a clojure web app multi-lingual or would I have to implement such a thing myself?
14:51TimMczilti: You mean a localization thingy?
14:51ziltiTimMc: Yes
14:58mcrittendenanyone have any tips for learning to write more idiomatic clojure? I feel like I'm getting a decent grip on the language and I've worked my way through koans and half of 4clojure but e.g. I never would have thought to write flatten like this: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6272
14:58mcrittendenis it just experience?
15:01technomancymcrittenden: you pretty much have to read lots of code
15:03cemerickmcrittenden: I wouldn't beat yourself up after N months with the lanugage because you wouldn't consider an impl that the creator of the language wrote. :-)
15:03TimMcArgh, clojure/core.clj links are like rickrolling for me.
15:03cemerickTimMc: Noted.
15:03TimMcFirefox 3.6 goes gray for like half a minute. >_<
15:04cemerick3.6?
15:04mcrittendencemerick: oh I'm not, I feel like I'm making good progress, I'm just wondering where to go after doing koans and 4clojure to continue to progress as quickly as possible
15:04cemerickAll enterprisey over there,huh?
15:04TimMccemerick: Linux Mint. :-(
15:04AeroNotixis there not a native clojure file IO library?
15:04cemerickonly about 28 of 'em.
15:04technomancyff is one of two things I still install manually on debian =\
15:04cemerickmcrittenden: Build a real app, then build 10 more.
15:04technomancycan't handle JITless 3.6
15:05TimMcmcrittenden: clojure/core.clj is also full of nasty hacks because of bootstrapping. Watch out in the upper reaches.
15:05mcrittendencemerick: haha, I hear you, I'm just a bit worried that I'll continue building stuff in my non-idiomatic way
15:05technomancymcrittenden: I recommend browsing http://clojuresphere.herokuapp.com
15:05cemerickmcrittenden: Man, that's just life. :-)
15:06mcrittendentechnomancy: nice, bookmarked, thanks!
15:07TimMcmcrittenden: flatten isn't totally idiomatic either -- I'd have gone with remove instead of filter and complement.
15:07ziltiWhy remove?
15:07technomancyso... what would you do if you had a full graph of all clojure projects anyway?
15:08ziltiAh, I was looking for that clojuresphere link yesterday but didn't remember its name, thanks!
15:08TimMcBecause it's the same thing, only shorter and easier to read.
15:08cemericktechnomancy: you don't have to be so coy ;-)
15:08TimMctechnomancy: I don't see lein-jit in there! o\__/o
15:09technomancycemerick: I'm just getting started!
15:09technomancycemerick: my first idea is a "If I change my API in such and such a way, how will this affect the downstream consumers" plugin.
15:09technomancybut
15:10technomancycertain kinds of refactorings can be automated
15:10technomancyand if they can be automated within your project, why not extend that downstream?
15:10technomancysince you can open pull requests through the github API
15:11technomancy(This is actually what Steve Yegge works on with the internal Google codebase apparently)
15:11TimMcWon't somebody please answer this page? http://clojuresphere.herokuapp.com/ring
15:11TimMcIt keeps saying "ring/ring, ring/ring"...
15:11technomancyBANANAPHONE
15:13jowagHi, I have my state in an atom, and my function which updates this state also performs some side effects (io). How should I correctly update my state? (swap! state update-fn) can call update-fn more than once, so it is not a good solution...
15:13pandeirozilti: you asked about localization... i'm implementing it in the app i'm working on... IMO not something you need a lib for, really. Just store it all in a strings.clj and create a fn that takes a key and a lang (or reads an atom somewhere)
15:13ziltipandeiro: Yes, might be the best solution. Thanks!
15:14TimMcpandeiro: Isn't it hard to read?
15:15mcrittendenhow can (fn [x] x) be rewritten in anon func shorthand? #(%) doesn't work. or, in other words, how can I make (partition-by (fn [x] x) x) cleaner (as a solution to http://www.4clojure.com/problem/31)
15:15TimMcmcrittenden: identity :-/
15:15cgray,(#(identity %) 1)
15:16clojurebot1
15:16TimMc&(identity 1)
15:16lazybot⇒ 1
15:16mcrittendenthanks.
15:16TimMcjowag: If you use a ref, you can send the io to an agent from inside the dosync.
15:16ziltiI just offended the whole ##javascript channel :)
15:17pandeiroTimMc: isn't what hard to read, the other languages? :)
15:17zilti"Even the shittiest scripting languages can do http" Me: "like JS?"
15:19TimMcpandeiro: $(:blah-key) instead of "Blah blah blah:
15:21pandeiroTimMc: you mean, in the application code? I'm just following the pattern that Android apps use, of separating out strings into a separate file... then when I need a string I do (loc :signup-welcome-message) or something
15:22jowagTimMc: thanks, nice solution. So I have to switch to refs...
15:29TimMcpandeiro: I don't know, it can get weird when you have marked-up text. I've seen some l10n libs use format strings, actually.
15:37jowagTimMc: I'm afraid agents won't work in my case. The new value of state depends on the result of the io operations. So I have to know the result of the io operation before updating the state
15:39jsabeaudryWhat is the threading model for a noir web server? One thread / request?
15:39jsabeaudry(using noir web server loosely here, i mean for the noir web stack)
16:14Somelauw,(String/format "%f" 5.4)
16:14jcromartiejsabeaudry: yes,
16:14clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Double cannot be cast to [Ljava.lang.Object;>
16:14jcromartie,(format "%f" 5.4)
16:14clojurebot"5.400000"
16:14jcromartieString/format expects an array of arguments
16:14jsabeaudryjcromartie: Great, thanks!
16:14adiabaticin https://gist.github.com/1572428 I'm using (seq coll) as (= () coll), but I get a ClassCastException (can't cast PersistentList$EmptyList to IFn). How should I test for empty listness if destructuring assignment isn't an option?
16:14jcromartieobjects, to be specific
16:15jcromartie,(source format)
16:15clojurebotSource not found
16:15Somelauwjcromartie: ah, okay, I though String/format was variable
16:15jcromartieoh, well, anyway the source of "format" will shed more light on that
16:15jcromartieit is
16:15jcromartiebut vararg Java methods don't work like that in Clojure
16:15jcromartiethey require an array
16:16SomelauwSo clojure doesn't support javastyle varargs
16:16TimMcSomelauw: Type... is just Java syntax for Type[]
16:16jcromartiehere's your exact situation :) http://groups.google.com/group/clojure/browse_thread/thread/64b20acf76e2b687
16:16jcromartieSomelauw: Clojure itself does
16:16kumarshantanuHi, is (require '[clojure.string :as str]) supposed to work in ClojureScript REPL in same way it works in the Clojure REPL?
16:16jcromartieSomelauw: (defn [arg1 arg2 & arg3-n) …)
16:16TimMcSomelauw: When Type... is compiled to bytecode, it looks exactly like Type[].
16:16jcromartieer, that was awful sorry
16:17TimMcI guess you could argue for Clojure being able to 'apply on those.
16:17jcromartie(defn some-vararg-fn [arg1 arg2 & more] … more is a seq here)
16:17Somelauwokay, thanks
16:17jcromartieTimMc: that would be really nice
16:19jcromartieTimMc: although that would definitely require reflection
16:21TimMcjcromartie: Not if it were explicit.
16:22amalloyadiabatic: you don't want the parens around accumulator
16:22jcromartieTimMc: at that point, though, it would be getting as verbose as any other approach
16:22amalloygist is helpfully rendering it in bold-red to tell you you're calling it as a function
16:24devinusis there a binding to the last result in a swank REPL?
16:24jcromartieTimMc: although it would work if the semantics were a bit different; it would only be sort-of like Clojure's "apply"
16:24jcromartiedevinus: *1
16:24devinusthanks
16:24adiabaticamalloy: why do I get that exception being thrown for that screwup, though?
16:24TimMcdevinus: *1 *2 *3 *e (exception)
16:24amalloy&(1)
16:24lazybotjava.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn
16:24devinusthanks, i knew the book mentioend it somewhere
16:25devinus,*1
16:25clojurebot#<Unbound Unbound: #'clojure.core/*1>
16:25TimMcjcromartie: I guess it's really like the opposite of apply.
16:25jcromartieyeah :)
16:27adiabaticamalloy: and thanks a bunch for the help over the past few days
16:28jcromartieTimMc: I see a rather messy reflection-laden macro as the only solution… so I'll advocate for into-array
16:28jcromartiebut it will continue to be a stumbling block for people trying to do interop
16:31devinusdespite the obvious security implications, is there a way to eval a string in clojure?
16:31TimMcdevinus: (eval (read-string ...)))
16:32TimMcdevinus: and look up *read-eval* refore you use read or read-string
16:32devinusTimMc: hrm…okay, another question. is there a way to get the tokens clojure parses from a string?
16:32jcromartiedevinus: the thing to remember is that Clojure (and other Lisps) evaluate data, not strings of code
16:33jcromartiedevinus: so reading is the step that turns strings into data
16:33jcromartieR E P L
16:33jcromartieRead -> Eval -> Print loop
16:33devinusjcromartie: right right, i get that
16:33TimMcI N C E P T I O N
16:33jcromartie,(read-string "[1 2 {:x 3}]")
16:33clojurebot[1 2 {:x 3}]
16:33devinusi'm just trying ot get a deeper understanding of how clojure represents reader macros
16:33TimMcIt's data all the way down.
16:33clojurebotCool story bro.
16:33devinuse.g.
16:33devinusdoes "; foo" === "(comment " foo") ?
16:34TimMcnope
16:34jcromartieyou can find out :)
16:34jcromartie,(read-string "; comments?")
16:34clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
16:34jcromartie,(read-string "[1 2 ; comments?\n 3]")
16:34clojurebot[1 2 3]
16:35devinusthat's odd
16:35TimMc&[1 2 (comment 3)]
16:35lazybot⇒ [1 2 nil]
16:35devinushrm
16:36devinusokay, so definitely not the same
16:36TimMc&[1 2 #_ 3 4]
16:36lazybot⇒ [1 2 4]
16:36devinusso how is ; a reader macro
16:36TimMcdevinus: It isn't.
16:36jcromartiewell the reader isn't that open
16:36devinusTimMc: what's happening there?
16:36jcromartieas far as users are concerned there aren't reader macros (as that would imply you could define them)
16:37TimMcdevinus: When the reader sees #_ it ignores the next form.
16:37devinusoh interesting
16:37cgrayjcromartie: there was a package recently announced on the list that implements reader macros
16:37devinuswonder whne that's useful
16:37TimMc#_ (comment ...) is a safe wa to comment out multiple forms without leaving a nil behind
16:37TimMcIt's a good combo.
16:37devinusinteresting
16:37jcromartiecgray: a package or a patch?
16:37cgrayjcromartie: a package
16:38devinusmust be why str also ignores nil
16:38jcromartiecgray: interesting
16:38cgrayjcromartie: https://github.com/klutometis/reader-macros/blob/master/src/reader_macros/core.clj
16:38TimMcdevinus: I doubt that's related.
16:38devinuswell
16:38devinusrelaated in that
16:38devinusclojure does a pretty good job of keeping brittle code from being a problem
16:39devinusalthough sometimes it's inconsistent it feels like
16:39TimMcdevinus: ##(let [x 4 (comment y 5)] x) <-- oops
16:39lazybotjava.lang.IllegalArgumentException: let requires an even number of forms in binding vector
16:39devinusofftopic, but what's the diff between clojurebot and lazybot?
16:40TimMcPhilosophical differences, feature sets, maintainers...
16:40TimMcsecurity :-P
16:40amalloythey also have different names
16:40devinushaha
16:40TimMctrigger characters, thank goodness
16:40devinusi wonder what philosophical differences
16:41jcromartiewhen I am in other programming channels, I miss having a bot that evaluates code
16:41devinusholy crap github just updated their interface!
16:41amalloyagain?
16:42jcromartiedevinus: is it Friday again?
16:42devinus:P
16:44devinusdoes anybody know what the status is on having a blessed standalone clj ?
16:45technomancythank goodness; the grey backgrounds in the readme were way too low-contrast
16:45technomancydevinus: there's an open ticket for it which seems to have had no progress for many months
16:46devinusi'd really like to see somebody address it
16:46devinusi was able to traverse the waters
16:46devinusbut i see it as a huge barrier to entry for noobs
16:50technomancyI'd encourage you to offer to help out, but I'm too cynical to think it would work.
16:51devinustechnomancy: why don't you think it would work?
16:51wei_how do you test whether an item is an atom (in the scheme sense), e.g. not a list-like thing? 
16:51humblebotlein repl actually worked pretty well for me, especially with rlwrap installed.
16:52technomancydevinus: in my experience, most patches get ignored.
16:52TimMcwei_: you can ask if it is a` coll?
16:52wei_nevermind, I found it-- coll? is the inverse
16:53wei_TimMc: thanks, just found that too
16:53devinustechnomancy: that's…disconcerting
16:54llasramtechnomancy: Then who writes code that actually get included...?
16:54devinustechnomancy: i was under the impression clojure as a language was more open than e.g. ruby, with it being on github. it seemed to me to be a much more living, moving project
16:55technomancyruby is on github
16:55devinusdidn't know that
16:55technomancyapparently they actually get to use pull requests: https://github.com/ruby/ruby/pulls
16:58devinustechnomancy: clojure.core doesn't accept pull requests?
16:59technomancymaybe someone who's less negative could talk about it.
16:59ziltiCould it be that swank has a problem with leiningen projects including java sources?
17:00simonadameitdevinus: according to http://clojure.org/contributing you have to download and sign a copyright asignment agreement and send it via real mail
17:00devinustechnomancy: -.-
17:00ziltisimonadameit: That's almost paranoid
17:01amalloyi bet seancorfield could find something nice to say about the clojure.core attitude to accepting patches
17:01technomancypositive thinking: the great thing about Clojure is how much you can get done without making changes to clojure itself
17:02llasramzilti: It's not unheard of. The FSF does basically the same thing. Not doing it means that Linux is stuck with it's modified GPLv2 for all time
17:02llasrams,it's,its,
17:02technomancyllasram: the FSF allows patches under a certain size though.
17:02technomancyplus they're a much more high-profile target for legal action
17:02llasramAh, right, I'd forgotten that
17:03duck1123Ok, I can't seem to find this. What do I need to do to get around a function being private? I have a need for ring.middleware.params/parse-params
17:03devinusi'm not a lawyer, but wouldn't a CA mean Rich could one day change the license to e.g. GPLv3?
17:03llasramAnd true. But once Clojure is the most popular language in the known galaxy... :-)
17:03jowagthis reminds me a discussion between technomancy and lau jensen a year ago :)
17:03technomancyjowag: that's why I'm trying to keep my mouth shut
17:03jowagI know :)
17:04simonadameitdevinus: yes… although someone else could continue clojure under the existing licence, if that were to happen
17:05simonadameitdevinus: altleast so I think :)
17:05devinusthat's probably not a bad idea then
17:05devinuswell, not the GPLv3, but being able to change the license :P
17:06duck1123it's already happened in the early days. The CA reduces headache if changing the liscense ever becomes a good idea
17:06jkkramerduck1123: (def parse-params #'ring.middleware.params/parse-params) is one way (caveat coder)
17:07duck1123jkkramer: could I just reference the var in the fn position? trying
17:07hiredmantechnomancy: the lein script on the 1.x branch seems to be broken, missing an exec, and the exit code is always 1 on non-windows machines
17:07jkkramerduck1123: yes, that too
17:07hiredmanit looks like the exec was removed around 12/30
17:08technomancyhiredman: the exec had to be removed to support trampolining around plugins
17:08hiredmanwell, the exit value is incorrect now
17:08technomancyyeah, I broke the CI because it depends on getting the uberjar from github downloads, and github only had 1.6.3
17:08hiredmanit is now the result of the test call at the bottom
17:11technomancyok, lemme fix the exit code
17:11hiredmanI have a fix
17:11hiredmanI could just push it?
17:11technomancysure
17:12technomancybut src/leiningen/test.clj is compiling for you?
17:15hiredmantechnomancy: I believe so, I am using my lein check out for running tests
17:15pjstadigcontributor agreements are used by corporate controlled open source projects to consolidate copyright and squash competition
17:15hiredmantechnomancy: on 1.x, haven't checked master
17:15pjstadigalso this http://www.oscon.com/oscon2011/public/schedule/detail/19242
17:17pjstadigsource for my competition squashing statement: http://www.infoq.com/articles/ieee-controlling-and-steering-open-source-projects
17:18pjstadigalso there's nothing in the clojure CA that prevents using pull requests, which (IMO) are a far superior way of accepting and reviewing changes
17:20pjstadigbut i guess technomancy said he wanted someone less negative :)
17:21replacatechnomancy: slamhound is crashing nastily when I try to run it on autodoc: https://gist.github.com/1572651
17:22replacatechnomancy: this isn't really blocking me though, since I can construct the ns to pprint by hand (or just by cutting and pasting)
17:22technomancyreplaca: whoa; wild.
17:22hiredmanor just read the ns form from the beginning of a file?
17:23technomancyif it's not blocking can you open an issue?
17:23cemerickIs it CA pain Fridays? :-P
17:24pjstadigcemerick: hehe
17:24TimMccemerick: I kind of get the CA. The patches instead of pull requests thing.... that boggles me.
17:24technomancycemerick: no, CA complaining is every other Tuesday; Fridays is ignored patches day.
17:24replacatechnomancy: yup, will do
17:24cemericktechnomancy: darn, I need to write this down!
17:25technomancyhttp://wondermark.com/506/
17:26djh__naive question, when the Raspberry Pi comes out - will it be able to run Clojure/a JavaVM? It's an ARM based mini computer
17:27devinusTimMc: i don't even remember submitting patches
17:27pjstadigdjh__: i suppose one could compile openjdk for it
17:27devinuspull requests are just so damn awesome
17:27technomancyhiredman: are you looking at the namespaces thing?
17:27technomancyhttp://travis-ci.org/technomancy/leiningen/builds/487755
17:27technomancyif you're busy I can field it
17:28hiredmanoh
17:28djh__pjstadig - thanks, I suppose it's just going to be a case of "wait and see"
17:28hiredmanno, I know what I did wrong
17:28technomancyhiredman: if you hop in #leiningen you can get yelled at by the travis-ci bot with me =)
17:28devinustechnomancy: no rush, but when do you think 1.4.0 is gonna make an appearance?
17:28technomancydevinus: of swank?
17:29devinustechnomancy: yeah, sorry of swank
17:29ziltiCould it be that swank has a problem with leiningen projects including java sources?
17:29ziltiOh sorry, didn't want to post that line it was my fault about 10 mins ago -.-
17:29technomancydevinus: it depends on the underlying cdt library. right now it's using a snapshot and its maintainer has been MIA
17:29devinustechnomancy: that's unfortunate, that's the reason i wanted to see it
17:30ziltiMIA?
17:30technomancymissing in action
17:30technomancydevinus: the snapshot seems to be working ok
17:31hiredmantechnomancy: "growled at"
17:31devinustechnomancy: ugh, no offence i'm just trying to cut down on the unstable stuff i use so i think ill wait
17:31ziltiWhat I btw really miss is an "Emacs plugin" that makes Emacs understand clojure. :)
17:31devinusoffense*
17:31solussdwhat is the best way to test if something is a list or vector?
17:31devinusoffence* lol
17:32devinushad it right the first time
17:32solussdsequential?
17:32cgrayis there a good tutorial on extend-type et al?
17:32ziltisolussd: There are functions for exactly that purpose
17:32TimMcdevinus: Depends which side of the Atlantic you are on.
17:32solussd,(map sequential? [] '() {})
17:32clojurebot()
17:32TimMcsolussd: list? is slightly brokenish.
17:32solussd,(map sequential? [[] '() {}])
17:32clojurebot(true true false)
17:32TimMcdepending on how you view lists vs. seqs
17:33zilti,(vector? [])
17:33clojurebottrue
17:33solussdlooks like I want sequential?
17:33zilti,(vector? '())
17:33clojurebotfalse
17:33TimMcsolussd: Check out the Venn diagram: http://www.brainonfire.net/files/seqs-and-colls/main.html
17:33devinusTimMc: reminds me of when i spelled behavior as behaviour for like 8 months because of erlang
17:33solussdthanks!
17:33technomancynothing wrong with behaviour
17:34ziltibehaviour is british, behavior is american english
17:43solussdwhy doesn't defn work with both a doctoring and pre/post conditions? if I remove the doctoring, the pre/post are respected, otherwise they're ignored.
17:43hiredmandoctoring?
17:43solussdhiredman: osx lion autocorrect
17:43solussd*docstring
17:43amalloy&(doc defn)
17:43lazybot⇒ "Macro ([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata"
17:44amalloyprobably you have them in the wrong order
17:44solussdam alloy, I'm assuming pre/post go in attr-map- but how can I refer to params before I define them?
17:44solussd*amalloy^
17:45TimMcamalloy: They go before the body, I think.
17:45TimMcugh
17:45TimMcsolussd: ^
17:45solussdbut that doesn't work, it ignores them if there is a docstring
17:46solussdusing 1.3, fyi
17:46TimMcWORKSFORME (defn foo "hi" [] {:post [false]} 6)
17:47TimMcsolussd: Put the doc string before the args.
17:51solussdok. that works, but I swear that's what I was doing…. I'll assume the repl is deterministic and chalk it up to an error on my part. ;)
17:52amalloyhah. i wish more people would do that
18:22ziltiIs this my fault or a bug? "Exception in thread \"main\" java.lang.RuntimeException: Unable to resolve symbol: pst-elem-str in this context, compiling:(swank/core.clj:128)"
18:22technomancyzilti: you need a newer clj-stacktrace; see the swank readme's "troubleshooting" section
18:23ziltiOk
18:24ziltiDo I have to set a certain namespace for the .lein/init.clj?
18:25technomancyno, that typically gets loaded in user
18:27ziltiIs there something else I have to do besides installing the clj-stacktrace and pasting the text into init.clj? It didn't change the stacktrace
18:29technomancycould be an older version embedded in some other plugin, maybe lein-difftest
18:30ziltiMy installed plugins are clj-stacktrace-0.2.4.jar lein-clojurescript-1.0.1-SNAPSHOT.jar lein-javac-1.2.1-SNAPSHOT.jar lein-noir-1.2.1.jar lein-ring-0.5.3.jar swank-clojure-1.3.4.jar
18:31ziltiI guess I don't need lein-javac since it's inside lein too
18:39ziltiHmm it still doesn't work
18:56adiabatic,(keep-indexed println ["spam" "eggs" "sausage" "bacon"])
18:56clojurebot(0 spam
18:56clojurebot1 eggs
18:56clojurebot2 sausage
18:56clojurebot3 bacon
18:56clojurebot)
19:41sridany heroku people here?
19:41pdk(* 60 .75)
19:41pdk,(* 60 .75)
19:41clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .75 in this context, compiling:(NO_SOURCE_PATH:0)>
19:41pdk,(* 60 0.75)
19:41clojurebot45.0
19:47pdk,(* 50 0.75)
19:47clojurebot37.5
20:00zmarilNext week I am teaching clojure to a bunch of high school kids. Would it be kosher if I brought them on here and introduced them to #clojure?
20:01zmarilNot like one by one or anything
20:01etoschcool!
20:01zmarilBut point out some of the people here, clojurebot, how to ask good questions, etc. etc.
20:08wingieis scala used by more people than clojure?
21:24clj_newbis there something like doc, but shows the :pre and :post conditions?
21:24clj_newbI'm basically hijacking them for type checking purposes, and I want them to show up when I retrieve the doc of a function
21:29clj_newb,(type (type 2))
21:30clojurebotjava.lang.Class
21:30clj_newb,(type (type (fn [])))
21:30clojurebotjava.lang.Class
21:30clj_newbis (type (type x)) <--- always Class ?
21:31AWizzArdclj_newb: no
21:31AWizzArd,(type (type nil))
21:31clojurebotnil
21:31clj_newbinteresting
21:32clj_newb,(type (type ()))
21:32clojurebotjava.lang.Class
21:32clj_newb,(type (type #false))
21:32clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: false>
21:32clj_newb,(type (type f))
21:32clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: f in this context, compiling:(NO_SOURCE_PATH:0)>
21:32clj_newbAWizzArd: this is insightful; thanks for the counter example
21:33chipdude,(#Object)
21:33clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: Object>
21:33chipdude,(#java.lang.Object)
21:33clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unreadable constructor form starting with "#java.lang.Object)">
21:33chipdudeOK, never mind
21:34clj_newbthis is somewhat off topic: anyone else feel like a genius whenever they get a defmacro to work?
21:37AWizzArdclj_newb: I don’t think that there is a built-in way to show the :pre or :post conditions.
21:37TimMcclj_newb: I usually don't feel like a genius when I finally get a piece of code to work; instead, it is more like I finally emerged victorious from a protracted fight.
21:38amalloy&#java.lang.Object[] ;; chipdude
21:38lazybot⇒ #<Object java.lang.Object@1e0a141>
21:38AWizzArdBut one thing you could do is to define a macro over defn which preserves them, and adds them to the doc string.
21:39AWizzArdSuch a macro could even save the full code of your function and make it accessible.
21:39TimMc$google serializable-fn
21:39lazybot[technomancy/serializable-fn - GitHub] https://github.com/technomancy/serializable-fn
21:39TimMcAWizzArd, clj_newb ^
21:40AWizzArdI did that around 2005 or 2006 in CL already.
21:42clj_newbAWizzArd , TimMc : interesting ;thanks
21:45clj_newbas I build macros around defn
21:45clj_newbI feeel like I"mrewriting the laws of physics
21:45TimMcHey, wasn't someone looking for a type checking function the other day? 'cast appears to be the thing.
21:46clj_newbthat was me I believe
21:46clj_newb,(doc cast)
21:46clojurebot"([c x]); Throws a ClassCastException if x is not a c, else returns x."
21:47clj_newb,[ (cast (type 1.0) (type 1)), (cast (type 19191919191919) (type 1))]
21:47clojurebot#<ClassCastException java.lang.ClassCastException>
21:48clj_newb,[ (cast (type 1.0) 1), (cast (type 19191919191919) 1)]
21:48clojurebot#<ClassCastException java.lang.ClassCastException>
21:49TimMcThat's not a helpful message....
21:50TimMcclj_newb: 1 is a Long, 1.0 is a Double. You can't cast between those, although you can coerce.
21:52clj_newb,(doc coerce)
21:52clojurebotGabh mo leithscéal?
21:55arohnerhas anyone had success with a midje (provided) in another thread?
22:02alexbaranoskyarohner, what's the question you have?
22:03alexbaranoskyI might be able to help you out
22:06arohneralexbaranosky: I'm having trouble using a (provided) against code that's called in a future
22:06alexbaranoskycan I see a gist of your code?
22:07arohneri.e. (defn foo [] (future (bar))) (fact "test foo" (foo) => truthy (provided (bar) => truthy)
22:08arohneryeah, real gist in a second
22:09alexbaranoskythanks, it might need some real thought
22:09MagnarsGiven a symbol :myfn - any way of calling myfn as defined in the current namespace?
22:11arohnerMagnars: yes, look at resolve and apply
22:11Magnarsarohner: excellent, resolve was what I was looking for - thanks!
22:11arohneralexbaranosky: nvm, my simple test case works just fine. I must be doing something wrong in the real version
22:12alexbaranoskycool, may I ask what you're working on - is it on GitHub?
22:12arohnerno, private project
22:12arohnercircleci.com
22:14arohneroh, my future was racing. after derefing the future so it blocks, I get the expected result.
22:15alexbaranoskyyou're working on circlci.com ? neat
22:15alexbaranoskydo you use Midje much? I love to hear feedback both good and bad
22:16arohneryeah, I'm one of the founders. I'm pretty happy with midje. The docs quantity and quality are good, but the organization is a little hard to navigate
22:17arohnerand sometimes invalid syntax in the macros sometimes causes infinite hangs
22:18alexbaranoskyarohner, I've donea LOT of work this past month working on validations of the macros, so you get error messages instead of mysterious failures
22:18alexbaranoskywhich macros in particular? I did a lot on the background and against-background
22:18arohnergreat! I'm still on 1.2.0
22:18arohnerthat's probably it. I'll investigate more the next time it happens
22:20alexbaranoskyI've also a dded doc strings to the public api macros, so at least siome level of documentation should be available at your fingertips
22:21alexbaranoskyarohner, I also definately consider issues people care about more when choosing what to work on, so feel free to make yourself heard if you care about some feature
22:22arohneralexbaranosky: great, thanks
22:25TimMc[Announcer voice] "Alex Baranosky: His future... was racing"
22:29alexbaranoskywhat's up TimMc
22:29TimMcgoin' to bed
22:29TimMcI used up all my Clojure yesterday.
22:30alexbaranoskyit happens :\
22:30TimMcalexbaranosky: lein-jit, check it out. It beat me up, but I finally won.
22:31alexbaranoskywill do!
22:33jodaroran out of parentheses?
22:44clj_newbhere's some more: (repeat "()")
22:55amalloy&(nth (iterate list ()) 50) ;; gotta keep em balanced
22:55lazybot⇒ ((((((((((((((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))))))))))))))
23:05pdk,(* 40 0.75)
23:05clojurebot30.0
23:06jodaroi get mine imported from antarctica
23:06jodaromade by penguins
23:10pdk,(* 56.78 0.75)
23:10clojurebot42.585
23:12pdk,(+ 35.81 7.50)
23:12clojurebot43.31
23:13jodaropdk: calculating tips for the week?
23:18humblebot,(+ 1 2 3 4 5 6 7 8 9 10)
23:18clojurebot55
23:18humblebotCool!
23:18humblebotYes, I'm new.
23:21TimMctechnomancy: Those are bananas, you've been coding with bananas.
23:23technomancyas long as paredit supports 'em; I don't want to know