2012-01-06
| 00:50 | jodaro | wow |
| 00:50 | jodaro | lamina is really nice |
| 01:42 | alexbaranosky | do any of you use lazytest? |
| 01:43 | alexbaranosky | do 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:07 | replaca | technomancy_: you there? |
| 02:09 | replaca | TimMc: looks cool! |
| 02:09 | replaca | I like the ns comment best |
| 02:14 | alexbaranosky | is there any annotation support in Clojure? I want to try using PowerMock, but I think it requires using some annotations |
| 02:25 | hiredman | alexbaranosky: yes, deftype has some kind of annotation support, not sure if anyone has used it |
| 02:26 | alexbaranosky | hiredman, 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:39 | true_droid | what's the most efficient way to append elements to the end of a sequence? |
| 05:39 | true_droid | Say, I have a function which takes a sequence and modifies it in some way. But the order of elements has to be preserved. |
| 05:39 | true_droid | Multiple alternatives come to mind: |
| 05:39 | true_droid | 1) start with an empty vector [], conj elements into it and then return (seq my-vec) |
| 05:39 | true_droid | 2) start with an empty list (), conj elements into it and then return (reverse my-list) |
| 05:39 | true_droid | 3) like the previous one, but use (into () my-list) in the end |
| 05:39 | true_droid | 4) start with a list (), append each consecutive element to it with (concat my-list (list element)) |
| 05:42 | philandstuff | not 4), that's for sure |
| 05:42 | philandstuff | afaik each concat is linear in terms of my-list |
| 05:42 | morphling | true_droid: concat is lazy, so that is good, but do you really have to add items one by one? |
| 05:42 | morphling | philandstuff: it is? |
| 05:42 | morphling | ,(doc concat) |
| 05:43 | clojurebot | "([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls." |
| 05:43 | philandstuff | morphling: ooh ta |
| 05:44 | true_droid | hm, I haven't thought about it |
| 05:44 | true_droid | so, it depends on the use-case; whether I want the whole sequence at once or not |
| 05:44 | true_droid | in each case efficiency is defined in a different way |
| 05:46 | philandstuff | morphling: 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:47 | true_droid | morphling: 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:49 | true_droid | as far as I get it, seq doesn't construct a new collection, it's merely an interface |
| 05:49 | true_droid | does the same go for 'reverse'? does it reuse the existing collection? |
| 05:54 | morphling | philandstuff: yes, but you don't have to traverse the entire first sequence |
| 05:54 | philandstuff | yes |
| 05:54 | morphling | philandstuff: so it's linear in the amount of concat calls, but not the length of the first sequence |
| 05:54 | philandstuff | yeah |
| 05:54 | philandstuff | in this situation, the two were equal, but it ain't necessarily so |
| 05:55 | philandstuff | so 4) is still a bad idea, but not for my original reason |
| 05:55 | morphling | yes |
| 05:55 | morphling | true_droid: you might want to use lazy-seq (or perhaps for) |
| 05:59 | true_droid | ok, thanks, I'll look into these |
| 05:59 | true_droid | *those |
| 06:01 | morphling | this is about the only case where I really miss lazy evaluation.. in haskell you'd just use reduce |
| 08:34 | AWizzArd | http://i.imgur.com/pAy4z.png |
| 08:52 | bsteuber | AWizzArd: rofl |
| 09:04 | AWizzArd | (: |
| 09:46 | mcrittenden | given 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:47 | tsdh | mcrittenden: It consumes stack because it has to remember n in every recursion step. |
| 09:48 | tsdh | mcrittenden: The recur version is in fact compiled to some iterative algorithm without recursion. |
| 09:48 | rabbler | The second uses recur, which gets compiled into what is basically equivelant to a "for loop" |
| 09:48 | rabbler | Iterative is a much better response, thanks tsdh. |
| 09:48 | pandeiro | When 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:48 | mcrittenden | interesting, thanks for the explanation tsdh and rabbler |
| 09:49 | tsdh | mcrittenden: Google for clojure recur, and you'll find a bunch of more elaborate explanations. |
| 09:49 | mcrittenden | tsdh yeah doing that now :) |
| 09:57 | pandeiro | Ah so Java throws the no ctor found just because the arity is off... I like clojure's error message better |
| 10:38 | AWizzArd | $seen jchoi |
| 10:38 | lazybot | I have never seen jchoi. |
| 10:51 | mcrittenden | what 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:53 | TimMc | mcrittenden: http://clojure.org/refs |
| 10:54 | mcrittenden | TimMc 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:00 | mcrittenden | TimMc: never mind, after reading through that page a couple more times, I think I mostly get it |
| 11:02 | mcrittenden | this helped as well: http://en.wikipedia.org/wiki/Software_transactional_memory |
| 11:13 | pjstadig | a "managed reference" could be an atom, a var, or a ref |
| 11:13 | pjstadig | a ref is a very specific kind of "managed reference", which is a bit confusing |
| 11:14 | mcrittenden | pjstadig: yeah that tripped me up. |
| 11:16 | TimMc | mcrittenden: Once you understand 'ensure, you're probably good. |
| 11:58 | clj_newb | why is there defn- but neither def- nor defmacro- ? |
| 12:20 | TimMc | clj_newb: More need for defn-, I guess. |
| 12:21 | TimMc | You can add ^:private as needed for the others. |
| 12:23 | cgray | and it's pretty easy to write the macro for def- and defmacro- just by looking at defn- |
| 12:30 | pandeiro | how does one handle a map key with a space in it? |
| 12:31 | hiredman | ,({"foo bar" 1} "foo bar") |
| 12:31 | clojurebot | 1 |
| 12:32 | pandeiro | ,({:character count 1} ":character count") |
| 12:32 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Map literal must contain an even number of forms> |
| 12:32 | `fogus | ,(keyword "a b") |
| 12:32 | clojurebot | :a b |
| 12:33 | hiredman | `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:33 | clojurebot | :eville |
| 12:33 | `fogus | It is a great idea! |
| 12:34 | hiredman | :( |
| 12:34 | `fogus | Although I prefer newlines and Klingon chars in my keys |
| 12:34 | pandeiro | yeah not my idea, you work with the libs you got... |
| 12:38 | DeusExPikachu | is there anything in enlive (or anything else) that converts a string to a url with the characters escaped? |
| 12:39 | ckirkendall | maybe: http://docs.oracle.com/javase/1.5.0/docs/api/java/net/URLEncoder.html |
| 12:41 | ckirkendall | (URLEncoder/encode url) |
| 12:42 | DeusExPikachu | ckirkendall: seems to work, thanks |
| 12:43 | ckirkendall | other than the obvious of posting to the IRC whats the best way to get the word out on a new library? |
| 12:43 | DeusExPikachu | ckirkendall: the mailing list I believe is the official place |
| 12:43 | ckirkendall | google-groups? |
| 12:44 | DeusExPikachu | ckirkendall: yes, the mailing list, which is the list on google-groups |
| 12:45 | ckirkendall | DeusExPikachu: I will put a post out there |
| 12:46 | ckirkendall | In 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:47 | ckirkendall | Here is the demo site: http://ckirkendall.github.com/enfocus-site/ |
| 12:49 | cgray | very cool |
| 12:53 | `fogus | ckirkendall: Have you looked at domina? |
| 12:54 | ckirkendall | `fogus: no |
| 12:55 | `fogus | https://github.com/levand/domina |
| 12:55 | ckirkendall | `fogus: similar concept but the semantics are bit diffrent |
| 12:55 | `fogus | On first glance your lib seems more mature |
| 12:56 | ckirkendall | `fogus: I was able to handle all of the standard enlive transformation |
| 12:56 | ckirkendall | `fogus: I then had to add all the stuff to deal with a dynamic dome |
| 12:56 | ckirkendall | dom |
| 12:56 | `fogus | it looks nice. |
| 12:57 | ckirkendall | `fogus: I am working on adding a good abstraction for extracting data from the dom |
| 12:57 | ckirkendall | `fogus: thanks |
| 13:00 | pandeiro | is there a :use-macros in clojurescript? |
| 13:01 | technomancy | replaca_: what's up? |
| 13:02 | arohner | does 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:03 | ckirkendall | `fogus: bundled with something like the hiccup implementation in pinot for dom creation it makes a powerful tool for creating UI widgets. |
| 13:04 | benares_98 | arohner: do you mean adia? |
| 13:05 | pandeiro | ckirkendall: have you seen hiccups? |
| 13:05 | arohner | benares_98: I don't think so. what I'm thinking of is purely a mongo library, no web stuff |
| 13:06 | ckirkendall | pandeiro: I have now nice! |
| 13:06 | jodaro | arohner: there are a couple others on github |
| 13:06 | arohner | jodaro: yes, but what are their names? or how do I find them? :-) |
| 13:06 | jodaro | monger |
| 13:06 | jodaro | karras |
| 13:07 | arohner | jodaro: monger, that's what I was thinking of! thanks |
| 13:07 | jodaro | arohner: http://bit.ly/wFeyGX |
| 13:07 | pandeiro | ckirkendall: there was a project that was sort of backbone-inspired too but it's been subsumed by something else |
| 13:07 | jodaro | i just did a search for mongo with language:clojure |
| 13:08 | arohner | jodaro: thanks. I was using google, and not being very successful |
| 13:24 | zilti | Netsplit? |
| 13:31 | solussd | why does this return a vector of two items? (re-find #"([r\-][w\-][x\-]){3}" "rwxr-xr-x") |
| 13:32 | arohner | solussd: it returns the whole match, and then the parenthesized group |
| 13:32 | solussd | ok, is there a way to say, in the regex, that I want that group 3 times without having it be a 'match group' ? |
| 13:33 | arohner | yes |
| 13:33 | arohner | (?:) |
| 13:33 | arohner | http://docs.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html |
| 13:36 | mr_rm | can someone tell me what the '-' means at the front of a function name, like (defn -main ...)? |
| 13:37 | solussd | in a genclass it is a method |
| 13:37 | clj_newb | TimMc: thanks for the tip on ^:private (re: defn- vs def- defmacro-) |
| 13:37 | solussd | (the default prefix is '-', yu can change it though) |
| 13:39 | mr_rm | solussd: 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:39 | mr_rm | https://github.com/yogthos/Noir-Eclipse-Template-Project/blob/2a91fcd8b131137e51362f6ffb3b92c4d56b349e/src/my_website/server.clj |
| 13:41 | solussd | mr_rm afaik it doesn't mean anything special, but maybe it does in the context of the noir.server library |
| 13:42 | mr_rm | solussd: ok thanks |
| 13:45 | technomancy | I love how the "not marked as dynamic" warnings don't use fully-qualified names. |
| 13:50 | yazirian | that was just irritating me too, not ten minutes ago |
| 13:50 | clj_newb | ,(type identity) |
| 13:50 | clojurebot | clojure.core$identity |
| 13:50 | clj_newb | ,(type identity) ; why does this not return function, and how can I check is a var is a function? |
| 13:50 | clojurebot | clojure.core$identity |
| 13:51 | clj_newb | ,(meta identity) |
| 13:51 | clojurebot | nil |
| 13:52 | jodaro | clj_newb: try fn? |
| 13:52 | clj_newb | jodaro: nice; thanks |
| 13:54 | metajack | clj_newb: you might also want ifn? if you want things like :foo and {} to return true |
| 13:55 | clj_newb | i can imagine :foo is a function which extracts a label |
| 13:55 | clj_newb | but how is {} a function? |
| 13:55 | metajack | maps in clojure are functions that take keys and return values |
| 13:56 | TimMc | clj_newb: In Clojure, functions are implemented as class-per-function. identity is an instance of the identity class. |
| 13:56 | metajack | ,({:foo :bar} :foo) |
| 13:56 | clojurebot | :bar |
| 13:56 | TimMc | &(class identity) |
| 13:56 | lazybot | ⇒ clojure.core$identity |
| 13:56 | TimMc | &(ancestors (class identity)) |
| 13:56 | lazybot | ⇒ #{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:57 | clj_newb | TimMc: class-per-function as in "each clojure function has a special java class created just for the function" ? |
| 13:58 | jodaro | heh |
| 13:59 | jodaro | everytime i think i've seen the radness i end up seeing more |
| 13:59 | technomancy | ,(throw (RadnessOverflowException.)) |
| 13:59 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: RadnessOverflowException, compiling:(NO_SOURCE_PATH:0)> |
| 14:00 | jodaro | like a never ending horizon of radness |
| 14:01 | clj_newb | one more dumb question: is there away in clojure, given two types, to ask " can this type be automatically converted ino that type" ? |
| 14:02 | clj_newb | ,(type 1) (type 1.0) (type 1919191919191919191919191919191919) |
| 14:02 | clojurebot | java.lang.Long |
| 14:02 | clj_newb | ,[(type 1) (type 1.0) (type 1919191919191919191919191919191919)] |
| 14:02 | clojurebot | [java.lang.Long java.lang.Double clojure.lang.BigInt] |
| 14:02 | hiredman | depends what you mean by automatically converted |
| 14:02 | clj_newb | I need someting where (f? Long Double) (f? Long BigInt) both return true |
| 14:03 | hiredman | ,(doc number?) |
| 14:03 | clojurebot | "([x]); Returns true if x is a Number" |
| 14:03 | hiredman | ,(number? 1) |
| 14:03 | clojurebot | true |
| 14:03 | clj_newb | hiredman: I'm buidlging a type system on top of Clojure via macros |
| 14:03 | clj_newb | I 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:04 | hiredman | clj_newb: hardly seems like a project for a clj_newb |
| 14:04 | hiredman | but have fun |
| 14:04 | clj_newb | hiredman: what is the right questions to ask? |
| 14:05 | clj_newb | ah; I get it |
| 14:05 | clj_newb | I don't care about types |
| 14:05 | clj_newb | I care about what protocols it satisfies. |
| 14:06 | hiredman | there 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:07 | clj_newb | hiredman: probably not |
| 14:07 | hiredman | so maybe some reading is in order |
| 14:07 | clj_newb | hiredman: what should I read? |
| 14:08 | hiredman | dunno, something about type systems, or dig into this "automatic" conversion and see what is really going on |
| 14:10 | clj_newb | hiredman: seeing how clojure does this "autoamtic" conversion is interesting; how do I grep through the source code for something ill-defined like this? |
| 14:10 | clj_newb | furthermore, does this "automatic" conversion ahppen for anything besides numbers? |
| 14:18 | TimMc | clj_newb: Correct. Each function, namespace, deftype, defrecord, proxy... each gets a class. |
| 14:20 | TimMc | clj_newb: You're probably building a precondition system, not a type system. |
| 14:22 | hiredman | clj_newb: my main point is it's not automatic, what makes you thing it is? |
| 14:22 | technomancy | is he talking about boxing? |
| 14:23 | hiredman | no |
| 14:23 | TimMc | I think he's talking about the reader. |
| 14:24 | TimMc | $findfn Long Double BigInt true |
| 14:24 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: BigInt in this context, compiling:(NO_SOURCE_PATH:0) |
| 14:24 | TimMc | $findfn Long Double clojure.lang.BigInt true ; there you go! |
| 14:24 | lazybot | [clojure.core/not= clojure.core/distinct?] |
| 14:36 | cgray | is there a way to close all open files? i made a mistake and i don't want to have to reboot clojure |
| 14:37 | amalloy | (System/exit 1), cgray |
| 14:38 | amalloy | (this kills the jvm) |
| 14:49 | zilti | Is there a library to make a clojure web app multi-lingual or would I have to implement such a thing myself? |
| 14:51 | TimMc | zilti: You mean a localization thingy? |
| 14:51 | zilti | TimMc: Yes |
| 14:58 | mcrittenden | anyone 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:58 | mcrittenden | is it just experience? |
| 15:01 | technomancy | mcrittenden: you pretty much have to read lots of code |
| 15:03 | cemerick | mcrittenden: 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:03 | TimMc | Argh, clojure/core.clj links are like rickrolling for me. |
| 15:03 | cemerick | TimMc: Noted. |
| 15:03 | TimMc | Firefox 3.6 goes gray for like half a minute. >_< |
| 15:04 | cemerick | 3.6? |
| 15:04 | mcrittenden | cemerick: 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:04 | cemerick | All enterprisey over there,huh? |
| 15:04 | TimMc | cemerick: Linux Mint. :-( |
| 15:04 | AeroNotix | is there not a native clojure file IO library? |
| 15:04 | cemerick | only about 28 of 'em. |
| 15:04 | technomancy | ff is one of two things I still install manually on debian =\ |
| 15:04 | cemerick | mcrittenden: Build a real app, then build 10 more. |
| 15:04 | technomancy | can't handle JITless 3.6 |
| 15:05 | TimMc | mcrittenden: clojure/core.clj is also full of nasty hacks because of bootstrapping. Watch out in the upper reaches. |
| 15:05 | mcrittenden | cemerick: haha, I hear you, I'm just a bit worried that I'll continue building stuff in my non-idiomatic way |
| 15:05 | technomancy | mcrittenden: I recommend browsing http://clojuresphere.herokuapp.com |
| 15:05 | cemerick | mcrittenden: Man, that's just life. :-) |
| 15:06 | mcrittenden | technomancy: nice, bookmarked, thanks! |
| 15:07 | TimMc | mcrittenden: flatten isn't totally idiomatic either -- I'd have gone with remove instead of filter and complement. |
| 15:07 | zilti | Why remove? |
| 15:07 | technomancy | so... what would you do if you had a full graph of all clojure projects anyway? |
| 15:08 | zilti | Ah, I was looking for that clojuresphere link yesterday but didn't remember its name, thanks! |
| 15:08 | TimMc | Because it's the same thing, only shorter and easier to read. |
| 15:08 | cemerick | technomancy: you don't have to be so coy ;-) |
| 15:08 | TimMc | technomancy: I don't see lein-jit in there! o\__/o |
| 15:09 | technomancy | cemerick: I'm just getting started! |
| 15:09 | technomancy | cemerick: 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:09 | technomancy | but |
| 15:10 | technomancy | certain kinds of refactorings can be automated |
| 15:10 | technomancy | and if they can be automated within your project, why not extend that downstream? |
| 15:10 | technomancy | since you can open pull requests through the github API |
| 15:11 | technomancy | (This is actually what Steve Yegge works on with the internal Google codebase apparently) |
| 15:11 | TimMc | Won't somebody please answer this page? http://clojuresphere.herokuapp.com/ring |
| 15:11 | TimMc | It keeps saying "ring/ring, ring/ring"... |
| 15:11 | technomancy | BANANAPHONE |
| 15:13 | jowag | Hi, 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:13 | pandeiro | zilti: 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:13 | zilti | pandeiro: Yes, might be the best solution. Thanks! |
| 15:14 | TimMc | pandeiro: Isn't it hard to read? |
| 15:15 | mcrittenden | how 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:15 | TimMc | mcrittenden: identity :-/ |
| 15:15 | cgray | ,(#(identity %) 1) |
| 15:16 | clojurebot | 1 |
| 15:16 | TimMc | &(identity 1) |
| 15:16 | lazybot | ⇒ 1 |
| 15:16 | mcrittenden | thanks. |
| 15:16 | TimMc | jowag: If you use a ref, you can send the io to an agent from inside the dosync. |
| 15:16 | zilti | I just offended the whole ##javascript channel :) |
| 15:17 | pandeiro | TimMc: isn't what hard to read, the other languages? :) |
| 15:17 | zilti | "Even the shittiest scripting languages can do http" Me: "like JS?" |
| 15:19 | TimMc | pandeiro: $(:blah-key) instead of "Blah blah blah: |
| 15:21 | pandeiro | TimMc: 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:22 | jowag | TimMc: thanks, nice solution. So I have to switch to refs... |
| 15:29 | TimMc | pandeiro: 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:37 | jowag | TimMc: 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:39 | jsabeaudry | What is the threading model for a noir web server? One thread / request? |
| 15:39 | jsabeaudry | (using noir web server loosely here, i mean for the noir web stack) |
| 16:14 | Somelauw | ,(String/format "%f" 5.4) |
| 16:14 | jcromartie | jsabeaudry: yes, |
| 16:14 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Double cannot be cast to [Ljava.lang.Object;> |
| 16:14 | jcromartie | ,(format "%f" 5.4) |
| 16:14 | clojurebot | "5.400000" |
| 16:14 | jcromartie | String/format expects an array of arguments |
| 16:14 | jsabeaudry | jcromartie: Great, thanks! |
| 16:14 | adiabatic | in 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:14 | jcromartie | objects, to be specific |
| 16:15 | jcromartie | ,(source format) |
| 16:15 | clojurebot | Source not found |
| 16:15 | Somelauw | jcromartie: ah, okay, I though String/format was variable |
| 16:15 | jcromartie | oh, well, anyway the source of "format" will shed more light on that |
| 16:15 | jcromartie | it is |
| 16:15 | jcromartie | but vararg Java methods don't work like that in Clojure |
| 16:15 | jcromartie | they require an array |
| 16:16 | Somelauw | So clojure doesn't support javastyle varargs |
| 16:16 | TimMc | Somelauw: Type... is just Java syntax for Type[] |
| 16:16 | jcromartie | here's your exact situation :) http://groups.google.com/group/clojure/browse_thread/thread/64b20acf76e2b687 |
| 16:16 | jcromartie | Somelauw: Clojure itself does |
| 16:16 | kumarshantanu | Hi, is (require '[clojure.string :as str]) supposed to work in ClojureScript REPL in same way it works in the Clojure REPL? |
| 16:16 | jcromartie | Somelauw: (defn [arg1 arg2 & arg3-n) …) |
| 16:16 | TimMc | Somelauw: When Type... is compiled to bytecode, it looks exactly like Type[]. |
| 16:16 | jcromartie | er, that was awful sorry |
| 16:17 | TimMc | I guess you could argue for Clojure being able to 'apply on those. |
| 16:17 | jcromartie | (defn some-vararg-fn [arg1 arg2 & more] … more is a seq here) |
| 16:17 | Somelauw | okay, thanks |
| 16:17 | jcromartie | TimMc: that would be really nice |
| 16:19 | jcromartie | TimMc: although that would definitely require reflection |
| 16:21 | TimMc | jcromartie: Not if it were explicit. |
| 16:22 | amalloy | adiabatic: you don't want the parens around accumulator |
| 16:22 | jcromartie | TimMc: at that point, though, it would be getting as verbose as any other approach |
| 16:22 | amalloy | gist is helpfully rendering it in bold-red to tell you you're calling it as a function |
| 16:24 | devinus | is there a binding to the last result in a swank REPL? |
| 16:24 | jcromartie | TimMc: although it would work if the semantics were a bit different; it would only be sort-of like Clojure's "apply" |
| 16:24 | jcromartie | devinus: *1 |
| 16:24 | devinus | thanks |
| 16:24 | adiabatic | amalloy: why do I get that exception being thrown for that screwup, though? |
| 16:24 | TimMc | devinus: *1 *2 *3 *e (exception) |
| 16:24 | amalloy | &(1) |
| 16:24 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn |
| 16:24 | devinus | thanks, i knew the book mentioend it somewhere |
| 16:25 | devinus | ,*1 |
| 16:25 | clojurebot | #<Unbound Unbound: #'clojure.core/*1> |
| 16:25 | TimMc | jcromartie: I guess it's really like the opposite of apply. |
| 16:25 | jcromartie | yeah :) |
| 16:27 | adiabatic | amalloy: and thanks a bunch for the help over the past few days |
| 16:28 | jcromartie | TimMc: I see a rather messy reflection-laden macro as the only solution… so I'll advocate for into-array |
| 16:28 | jcromartie | but it will continue to be a stumbling block for people trying to do interop |
| 16:31 | devinus | despite the obvious security implications, is there a way to eval a string in clojure? |
| 16:31 | TimMc | devinus: (eval (read-string ...))) |
| 16:32 | TimMc | devinus: and look up *read-eval* refore you use read or read-string |
| 16:32 | devinus | TimMc: hrm…okay, another question. is there a way to get the tokens clojure parses from a string? |
| 16:32 | jcromartie | devinus: the thing to remember is that Clojure (and other Lisps) evaluate data, not strings of code |
| 16:33 | jcromartie | devinus: so reading is the step that turns strings into data |
| 16:33 | jcromartie | R E P L |
| 16:33 | jcromartie | Read -> Eval -> Print loop |
| 16:33 | devinus | jcromartie: right right, i get that |
| 16:33 | TimMc | I N C E P T I O N |
| 16:33 | jcromartie | ,(read-string "[1 2 {:x 3}]") |
| 16:33 | clojurebot | [1 2 {:x 3}] |
| 16:33 | devinus | i'm just trying ot get a deeper understanding of how clojure represents reader macros |
| 16:33 | TimMc | It's data all the way down. |
| 16:33 | clojurebot | Cool story bro. |
| 16:33 | devinus | e.g. |
| 16:33 | devinus | does "; foo" === "(comment " foo") ? |
| 16:34 | TimMc | nope |
| 16:34 | jcromartie | you can find out :) |
| 16:34 | jcromartie | ,(read-string "; comments?") |
| 16:34 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 16:34 | jcromartie | ,(read-string "[1 2 ; comments?\n 3]") |
| 16:34 | clojurebot | [1 2 3] |
| 16:35 | devinus | that's odd |
| 16:35 | TimMc | &[1 2 (comment 3)] |
| 16:35 | lazybot | ⇒ [1 2 nil] |
| 16:35 | devinus | hrm |
| 16:36 | devinus | okay, so definitely not the same |
| 16:36 | TimMc | &[1 2 #_ 3 4] |
| 16:36 | lazybot | ⇒ [1 2 4] |
| 16:36 | devinus | so how is ; a reader macro |
| 16:36 | TimMc | devinus: It isn't. |
| 16:36 | jcromartie | well the reader isn't that open |
| 16:36 | devinus | TimMc: what's happening there? |
| 16:36 | jcromartie | as far as users are concerned there aren't reader macros (as that would imply you could define them) |
| 16:37 | TimMc | devinus: When the reader sees #_ it ignores the next form. |
| 16:37 | devinus | oh interesting |
| 16:37 | cgray | jcromartie: there was a package recently announced on the list that implements reader macros |
| 16:37 | devinus | wonder whne that's useful |
| 16:37 | TimMc | #_ (comment ...) is a safe wa to comment out multiple forms without leaving a nil behind |
| 16:37 | TimMc | It's a good combo. |
| 16:37 | devinus | interesting |
| 16:37 | jcromartie | cgray: a package or a patch? |
| 16:37 | cgray | jcromartie: a package |
| 16:38 | devinus | must be why str also ignores nil |
| 16:38 | jcromartie | cgray: interesting |
| 16:38 | cgray | jcromartie: https://github.com/klutometis/reader-macros/blob/master/src/reader_macros/core.clj |
| 16:38 | TimMc | devinus: I doubt that's related. |
| 16:38 | devinus | well |
| 16:38 | devinus | relaated in that |
| 16:38 | devinus | clojure does a pretty good job of keeping brittle code from being a problem |
| 16:39 | devinus | although sometimes it's inconsistent it feels like |
| 16:39 | TimMc | devinus: ##(let [x 4 (comment y 5)] x) <-- oops |
| 16:39 | lazybot | java.lang.IllegalArgumentException: let requires an even number of forms in binding vector |
| 16:39 | devinus | offtopic, but what's the diff between clojurebot and lazybot? |
| 16:40 | TimMc | Philosophical differences, feature sets, maintainers... |
| 16:40 | TimMc | security :-P |
| 16:40 | amalloy | they also have different names |
| 16:40 | devinus | haha |
| 16:40 | TimMc | trigger characters, thank goodness |
| 16:40 | devinus | i wonder what philosophical differences |
| 16:41 | jcromartie | when I am in other programming channels, I miss having a bot that evaluates code |
| 16:41 | devinus | holy crap github just updated their interface! |
| 16:41 | amalloy | again? |
| 16:42 | jcromartie | devinus: is it Friday again? |
| 16:42 | devinus | :P |
| 16:44 | devinus | does anybody know what the status is on having a blessed standalone clj ? |
| 16:45 | technomancy | thank goodness; the grey backgrounds in the readme were way too low-contrast |
| 16:45 | technomancy | devinus: there's an open ticket for it which seems to have had no progress for many months |
| 16:46 | devinus | i'd really like to see somebody address it |
| 16:46 | devinus | i was able to traverse the waters |
| 16:46 | devinus | but i see it as a huge barrier to entry for noobs |
| 16:50 | technomancy | I'd encourage you to offer to help out, but I'm too cynical to think it would work. |
| 16:51 | devinus | technomancy: why don't you think it would work? |
| 16:51 | wei_ | how do you test whether an item is an atom (in the scheme sense), e.g. not a list-like thing? |
| 16:51 | humblebot | lein repl actually worked pretty well for me, especially with rlwrap installed. |
| 16:52 | technomancy | devinus: in my experience, most patches get ignored. |
| 16:52 | TimMc | wei_: you can ask if it is a` coll? |
| 16:52 | wei_ | nevermind, I found it-- coll? is the inverse |
| 16:53 | wei_ | TimMc: thanks, just found that too |
| 16:53 | devinus | technomancy: that's…disconcerting |
| 16:54 | llasram | technomancy: Then who writes code that actually get included...? |
| 16:54 | devinus | technomancy: 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:55 | technomancy | ruby is on github |
| 16:55 | devinus | didn't know that |
| 16:55 | technomancy | apparently they actually get to use pull requests: https://github.com/ruby/ruby/pulls |
| 16:58 | devinus | technomancy: clojure.core doesn't accept pull requests? |
| 16:59 | technomancy | maybe someone who's less negative could talk about it. |
| 16:59 | zilti | Could it be that swank has a problem with leiningen projects including java sources? |
| 17:00 | simonadameit | devinus: according to http://clojure.org/contributing you have to download and sign a copyright asignment agreement and send it via real mail |
| 17:00 | devinus | technomancy: -.- |
| 17:00 | zilti | simonadameit: That's almost paranoid |
| 17:01 | amalloy | i bet seancorfield could find something nice to say about the clojure.core attitude to accepting patches |
| 17:01 | technomancy | positive thinking: the great thing about Clojure is how much you can get done without making changes to clojure itself |
| 17:02 | llasram | zilti: 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:02 | llasram | s,it's,its, |
| 17:02 | technomancy | llasram: the FSF allows patches under a certain size though. |
| 17:02 | technomancy | plus they're a much more high-profile target for legal action |
| 17:02 | llasram | Ah, right, I'd forgotten that |
| 17:03 | duck1123 | Ok, 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:03 | devinus | i'm not a lawyer, but wouldn't a CA mean Rich could one day change the license to e.g. GPLv3? |
| 17:03 | llasram | And true. But once Clojure is the most popular language in the known galaxy... :-) |
| 17:03 | jowag | this reminds me a discussion between technomancy and lau jensen a year ago :) |
| 17:03 | technomancy | jowag: that's why I'm trying to keep my mouth shut |
| 17:03 | jowag | I know :) |
| 17:04 | simonadameit | devinus: yes… although someone else could continue clojure under the existing licence, if that were to happen |
| 17:05 | simonadameit | devinus: altleast so I think :) |
| 17:05 | devinus | that's probably not a bad idea then |
| 17:05 | devinus | well, not the GPLv3, but being able to change the license :P |
| 17:06 | duck1123 | it's already happened in the early days. The CA reduces headache if changing the liscense ever becomes a good idea |
| 17:06 | jkkramer | duck1123: (def parse-params #'ring.middleware.params/parse-params) is one way (caveat coder) |
| 17:07 | duck1123 | jkkramer: could I just reference the var in the fn position? trying |
| 17:07 | hiredman | technomancy: 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:07 | jkkramer | duck1123: yes, that too |
| 17:07 | hiredman | it looks like the exec was removed around 12/30 |
| 17:08 | technomancy | hiredman: the exec had to be removed to support trampolining around plugins |
| 17:08 | hiredman | well, the exit value is incorrect now |
| 17:08 | technomancy | yeah, I broke the CI because it depends on getting the uberjar from github downloads, and github only had 1.6.3 |
| 17:08 | hiredman | it is now the result of the test call at the bottom |
| 17:11 | technomancy | ok, lemme fix the exit code |
| 17:11 | hiredman | I have a fix |
| 17:11 | hiredman | I could just push it? |
| 17:11 | technomancy | sure |
| 17:12 | technomancy | but src/leiningen/test.clj is compiling for you? |
| 17:15 | hiredman | technomancy: I believe so, I am using my lein check out for running tests |
| 17:15 | pjstadig | contributor agreements are used by corporate controlled open source projects to consolidate copyright and squash competition |
| 17:15 | hiredman | technomancy: on 1.x, haven't checked master |
| 17:15 | pjstadig | also this http://www.oscon.com/oscon2011/public/schedule/detail/19242 |
| 17:17 | pjstadig | source for my competition squashing statement: http://www.infoq.com/articles/ieee-controlling-and-steering-open-source-projects |
| 17:18 | pjstadig | also 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:20 | pjstadig | but i guess technomancy said he wanted someone less negative :) |
| 17:21 | replaca | technomancy: slamhound is crashing nastily when I try to run it on autodoc: https://gist.github.com/1572651 |
| 17:22 | replaca | technomancy: this isn't really blocking me though, since I can construct the ns to pprint by hand (or just by cutting and pasting) |
| 17:22 | technomancy | replaca: whoa; wild. |
| 17:22 | hiredman | or just read the ns form from the beginning of a file? |
| 17:23 | technomancy | if it's not blocking can you open an issue? |
| 17:23 | cemerick | Is it CA pain Fridays? :-P |
| 17:24 | pjstadig | cemerick: hehe |
| 17:24 | TimMc | cemerick: I kind of get the CA. The patches instead of pull requests thing.... that boggles me. |
| 17:24 | technomancy | cemerick: no, CA complaining is every other Tuesday; Fridays is ignored patches day. |
| 17:24 | replaca | technomancy: yup, will do |
| 17:24 | cemerick | technomancy: darn, I need to write this down! |
| 17:25 | technomancy | http://wondermark.com/506/ |
| 17:26 | djh__ | 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:27 | devinus | TimMc: i don't even remember submitting patches |
| 17:27 | pjstadig | djh__: i suppose one could compile openjdk for it |
| 17:27 | devinus | pull requests are just so damn awesome |
| 17:27 | technomancy | hiredman: are you looking at the namespaces thing? |
| 17:27 | technomancy | http://travis-ci.org/technomancy/leiningen/builds/487755 |
| 17:27 | technomancy | if you're busy I can field it |
| 17:28 | hiredman | oh |
| 17:28 | djh__ | pjstadig - thanks, I suppose it's just going to be a case of "wait and see" |
| 17:28 | hiredman | no, I know what I did wrong |
| 17:28 | technomancy | hiredman: if you hop in #leiningen you can get yelled at by the travis-ci bot with me =) |
| 17:28 | devinus | technomancy: no rush, but when do you think 1.4.0 is gonna make an appearance? |
| 17:28 | technomancy | devinus: of swank? |
| 17:29 | devinus | technomancy: yeah, sorry of swank |
| 17:29 | zilti | Could it be that swank has a problem with leiningen projects including java sources? |
| 17:29 | zilti | Oh sorry, didn't want to post that line it was my fault about 10 mins ago -.- |
| 17:29 | technomancy | devinus: it depends on the underlying cdt library. right now it's using a snapshot and its maintainer has been MIA |
| 17:29 | devinus | technomancy: that's unfortunate, that's the reason i wanted to see it |
| 17:30 | zilti | MIA? |
| 17:30 | technomancy | missing in action |
| 17:30 | technomancy | devinus: the snapshot seems to be working ok |
| 17:31 | hiredman | technomancy: "growled at" |
| 17:31 | devinus | technomancy: ugh, no offence i'm just trying to cut down on the unstable stuff i use so i think ill wait |
| 17:31 | zilti | What I btw really miss is an "Emacs plugin" that makes Emacs understand clojure. :) |
| 17:31 | devinus | offense* |
| 17:31 | solussd | what is the best way to test if something is a list or vector? |
| 17:31 | devinus | offence* lol |
| 17:32 | devinus | had it right the first time |
| 17:32 | solussd | sequential? |
| 17:32 | cgray | is there a good tutorial on extend-type et al? |
| 17:32 | zilti | solussd: There are functions for exactly that purpose |
| 17:32 | TimMc | devinus: Depends which side of the Atlantic you are on. |
| 17:32 | solussd | ,(map sequential? [] '() {}) |
| 17:32 | clojurebot | () |
| 17:32 | TimMc | solussd: list? is slightly brokenish. |
| 17:32 | solussd | ,(map sequential? [[] '() {}]) |
| 17:32 | clojurebot | (true true false) |
| 17:32 | TimMc | depending on how you view lists vs. seqs |
| 17:33 | zilti | ,(vector? []) |
| 17:33 | clojurebot | true |
| 17:33 | solussd | looks like I want sequential? |
| 17:33 | zilti | ,(vector? '()) |
| 17:33 | clojurebot | false |
| 17:33 | TimMc | solussd: Check out the Venn diagram: http://www.brainonfire.net/files/seqs-and-colls/main.html |
| 17:33 | devinus | TimMc: reminds me of when i spelled behavior as behaviour for like 8 months because of erlang |
| 17:33 | solussd | thanks! |
| 17:33 | technomancy | nothing wrong with behaviour |
| 17:34 | zilti | behaviour is british, behavior is american english |
| 17:43 | solussd | why 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:43 | hiredman | doctoring? |
| 17:43 | solussd | hiredman: osx lion autocorrect |
| 17:43 | solussd | *docstring |
| 17:43 | amalloy | &(doc defn) |
| 17:43 | lazybot | ⇒ "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:44 | amalloy | probably you have them in the wrong order |
| 17:44 | solussd | am alloy, I'm assuming pre/post go in attr-map- but how can I refer to params before I define them? |
| 17:44 | solussd | *amalloy^ |
| 17:45 | TimMc | amalloy: They go before the body, I think. |
| 17:45 | TimMc | ugh |
| 17:45 | TimMc | solussd: ^ |
| 17:45 | solussd | but that doesn't work, it ignores them if there is a docstring |
| 17:46 | solussd | using 1.3, fyi |
| 17:46 | TimMc | WORKSFORME (defn foo "hi" [] {:post [false]} 6) |
| 17:47 | TimMc | solussd: Put the doc string before the args. |
| 17:51 | solussd | ok. 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:52 | amalloy | hah. i wish more people would do that |
| 18:22 | zilti | Is 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:22 | technomancy | zilti: you need a newer clj-stacktrace; see the swank readme's "troubleshooting" section |
| 18:23 | zilti | Ok |
| 18:24 | zilti | Do I have to set a certain namespace for the .lein/init.clj? |
| 18:25 | technomancy | no, that typically gets loaded in user |
| 18:27 | zilti | Is 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:29 | technomancy | could be an older version embedded in some other plugin, maybe lein-difftest |
| 18:30 | zilti | My 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:31 | zilti | I guess I don't need lein-javac since it's inside lein too |
| 18:39 | zilti | Hmm it still doesn't work |
| 18:56 | adiabatic | ,(keep-indexed println ["spam" "eggs" "sausage" "bacon"]) |
| 18:56 | clojurebot | (0 spam |
| 18:56 | clojurebot | 1 eggs |
| 18:56 | clojurebot | 2 sausage |
| 18:56 | clojurebot | 3 bacon |
| 18:56 | clojurebot | ) |
| 19:41 | srid | any heroku people here? |
| 19:41 | pdk | (* 60 .75) |
| 19:41 | pdk | ,(* 60 .75) |
| 19:41 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: .75 in this context, compiling:(NO_SOURCE_PATH:0)> |
| 19:41 | pdk | ,(* 60 0.75) |
| 19:41 | clojurebot | 45.0 |
| 19:47 | pdk | ,(* 50 0.75) |
| 19:47 | clojurebot | 37.5 |
| 20:00 | zmaril | Next 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:01 | zmaril | Not like one by one or anything |
| 20:01 | etosch | cool! |
| 20:01 | zmaril | But point out some of the people here, clojurebot, how to ask good questions, etc. etc. |
| 20:08 | wingie | is scala used by more people than clojure? |
| 21:24 | clj_newb | is there something like doc, but shows the :pre and :post conditions? |
| 21:24 | clj_newb | I'm basically hijacking them for type checking purposes, and I want them to show up when I retrieve the doc of a function |
| 21:29 | clj_newb | ,(type (type 2)) |
| 21:30 | clojurebot | java.lang.Class |
| 21:30 | clj_newb | ,(type (type (fn []))) |
| 21:30 | clojurebot | java.lang.Class |
| 21:30 | clj_newb | is (type (type x)) <--- always Class ? |
| 21:31 | AWizzArd | clj_newb: no |
| 21:31 | AWizzArd | ,(type (type nil)) |
| 21:31 | clojurebot | nil |
| 21:31 | clj_newb | interesting |
| 21:32 | clj_newb | ,(type (type ())) |
| 21:32 | clojurebot | java.lang.Class |
| 21:32 | clj_newb | ,(type (type #false)) |
| 21:32 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: false> |
| 21:32 | clj_newb | ,(type (type f)) |
| 21:32 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: f in this context, compiling:(NO_SOURCE_PATH:0)> |
| 21:32 | clj_newb | AWizzArd: this is insightful; thanks for the counter example |
| 21:33 | chipdude | ,(#Object) |
| 21:33 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: Object> |
| 21:33 | chipdude | ,(#java.lang.Object) |
| 21:33 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unreadable constructor form starting with "#java.lang.Object)"> |
| 21:33 | chipdude | OK, never mind |
| 21:34 | clj_newb | this is somewhat off topic: anyone else feel like a genius whenever they get a defmacro to work? |
| 21:37 | AWizzArd | clj_newb: I don’t think that there is a built-in way to show the :pre or :post conditions. |
| 21:37 | TimMc | clj_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:38 | amalloy | &#java.lang.Object[] ;; chipdude |
| 21:38 | lazybot | ⇒ #<Object java.lang.Object@1e0a141> |
| 21:38 | AWizzArd | But one thing you could do is to define a macro over defn which preserves them, and adds them to the doc string. |
| 21:39 | AWizzArd | Such a macro could even save the full code of your function and make it accessible. |
| 21:39 | TimMc | $google serializable-fn |
| 21:39 | lazybot | [technomancy/serializable-fn - GitHub] https://github.com/technomancy/serializable-fn |
| 21:39 | TimMc | AWizzArd, clj_newb ^ |
| 21:40 | AWizzArd | I did that around 2005 or 2006 in CL already. |
| 21:42 | clj_newb | AWizzArd , TimMc : interesting ;thanks |
| 21:45 | clj_newb | as I build macros around defn |
| 21:45 | clj_newb | I feeel like I"mrewriting the laws of physics |
| 21:45 | TimMc | Hey, wasn't someone looking for a type checking function the other day? 'cast appears to be the thing. |
| 21:46 | clj_newb | that was me I believe |
| 21:46 | clj_newb | ,(doc cast) |
| 21:46 | clojurebot | "([c x]); Throws a ClassCastException if x is not a c, else returns x." |
| 21:47 | clj_newb | ,[ (cast (type 1.0) (type 1)), (cast (type 19191919191919) (type 1))] |
| 21:47 | clojurebot | #<ClassCastException java.lang.ClassCastException> |
| 21:48 | clj_newb | ,[ (cast (type 1.0) 1), (cast (type 19191919191919) 1)] |
| 21:48 | clojurebot | #<ClassCastException java.lang.ClassCastException> |
| 21:49 | TimMc | That's not a helpful message.... |
| 21:50 | TimMc | clj_newb: 1 is a Long, 1.0 is a Double. You can't cast between those, although you can coerce. |
| 21:52 | clj_newb | ,(doc coerce) |
| 21:52 | clojurebot | Gabh mo leithscéal? |
| 21:55 | arohner | has anyone had success with a midje (provided) in another thread? |
| 22:02 | alexbaranosky | arohner, what's the question you have? |
| 22:03 | alexbaranosky | I might be able to help you out |
| 22:06 | arohner | alexbaranosky: I'm having trouble using a (provided) against code that's called in a future |
| 22:06 | alexbaranosky | can I see a gist of your code? |
| 22:07 | arohner | i.e. (defn foo [] (future (bar))) (fact "test foo" (foo) => truthy (provided (bar) => truthy) |
| 22:08 | arohner | yeah, real gist in a second |
| 22:09 | alexbaranosky | thanks, it might need some real thought |
| 22:09 | Magnars | Given a symbol :myfn - any way of calling myfn as defined in the current namespace? |
| 22:11 | arohner | Magnars: yes, look at resolve and apply |
| 22:11 | Magnars | arohner: excellent, resolve was what I was looking for - thanks! |
| 22:11 | arohner | alexbaranosky: nvm, my simple test case works just fine. I must be doing something wrong in the real version |
| 22:12 | alexbaranosky | cool, may I ask what you're working on - is it on GitHub? |
| 22:12 | arohner | no, private project |
| 22:12 | arohner | circleci.com |
| 22:14 | arohner | oh, my future was racing. after derefing the future so it blocks, I get the expected result. |
| 22:15 | alexbaranosky | you're working on circlci.com ? neat |
| 22:15 | alexbaranosky | do you use Midje much? I love to hear feedback both good and bad |
| 22:16 | arohner | yeah, 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:17 | arohner | and sometimes invalid syntax in the macros sometimes causes infinite hangs |
| 22:18 | alexbaranosky | arohner, 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:18 | alexbaranosky | which macros in particular? I did a lot on the background and against-background |
| 22:18 | arohner | great! I'm still on 1.2.0 |
| 22:18 | arohner | that's probably it. I'll investigate more the next time it happens |
| 22:20 | alexbaranosky | I'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:21 | alexbaranosky | arohner, 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:22 | arohner | alexbaranosky: great, thanks |
| 22:25 | TimMc | [Announcer voice] "Alex Baranosky: His future... was racing" |
| 22:29 | alexbaranosky | what's up TimMc |
| 22:29 | TimMc | goin' to bed |
| 22:29 | TimMc | I used up all my Clojure yesterday. |
| 22:30 | alexbaranosky | it happens :\ |
| 22:30 | TimMc | alexbaranosky: lein-jit, check it out. It beat me up, but I finally won. |
| 22:31 | alexbaranosky | will do! |
| 22:33 | jodaro | ran out of parentheses? |
| 22:44 | clj_newb | here's some more: (repeat "()") |
| 22:55 | amalloy | &(nth (iterate list ()) 50) ;; gotta keep em balanced |
| 22:55 | lazybot | ⇒ ((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))) |
| 23:05 | pdk | ,(* 40 0.75) |
| 23:05 | clojurebot | 30.0 |
| 23:06 | jodaro | i get mine imported from antarctica |
| 23:06 | jodaro | made by penguins |
| 23:10 | pdk | ,(* 56.78 0.75) |
| 23:10 | clojurebot | 42.585 |
| 23:12 | pdk | ,(+ 35.81 7.50) |
| 23:12 | clojurebot | 43.31 |
| 23:13 | jodaro | pdk: calculating tips for the week? |
| 23:18 | humblebot | ,(+ 1 2 3 4 5 6 7 8 9 10) |
| 23:18 | clojurebot | 55 |
| 23:18 | humblebot | Cool! |
| 23:18 | humblebot | Yes, I'm new. |
| 23:21 | TimMc | technomancy: Those are bananas, you've been coding with bananas. |
| 23:23 | technomancy | as long as paredit supports 'em; I don't want to know |