2012-01-23
| 00:06 | ibdknox | Alright folks, I'm outta here |
| 00:08 | johnmn3 | peace |
| 00:28 | johnmn3 | randomly thought the /join #sopa. 358 people in there! |
| 00:29 | zellio | o.O |
| 02:28 | cemerick | I can't believe I hadn't noticed before now that special forms aren't hintable. :-| |
| 02:31 | muhoo | hmm that seesaw is interesting. would be cool to have a hiccup/enlive style clojure native syntax for java gui stuff |
| 02:58 | LauJensen | if I have an fn like (defn x [] (if (= "x" (System/getProperty "user.name")) x y) will the compiler optimize that so that the if is not re-run unless the environment changes or is the user.name var polled on every call? |
| 02:59 | johnmn3 | I'd guess it stays as the user that started the java process |
| 03:04 | jowag | I think it won't optimize your fn. |
| 03:28 | amalloy | LauJensen: i would be quite surprised if the compiler optimized that, but you can trivially do it yourself: (let [result (if (= "x" (System/getProperty "user.name")) x y)] (def foo (constantly result))) |
| 03:29 | Blkt | good morning everyone |
| 03:42 | AWizzArd | amalloy: though I think that Lau wants it to get evaled if the Properties change. |
| 03:43 | AWizzArd | Basically (if (and (System/propertiesUpdated) (= "x" (System/getProperty "user.name"))) …), but such a static method doesn't exist. |
| 03:57 | LauJensen | amalloy: Right - I was just curious if the compiler would work it out on its own - Would have been sweet |
| 04:22 | clj_newb | I can't find anything interesting on google for "clojure real time audio." Does Java's GC basically make this mpossible? |
| 04:23 | AWizzArd | clj_newb: did you see http://mad.emotionull.com/ or https://github.com/overtone/overtone ? They might deliver what you are looking for. |
| 04:24 | clj_newb | this is awesome |
| 04:32 | Kototama | hi, is it possible to use compojure with clojure 1.3? |
| 04:33 | Vinzent | yes |
| 04:34 | augustl | couchdb-lucene seems to include lucene itself, is that correct? |
| 04:34 | augustl | err, wrong channel |
| 04:39 | Kototama | how can I use clojure 1.3 with compojure then? |
| 04:39 | Kototama | i'm already using it but the default dependency is clojure 1.2 |
| 04:42 | AWizzArd | Kototama: you could import the Compojure dependency with an exclusion on Clojure, and manually add Clojure 1.3 as a dependency. |
| 04:43 | Vinzent | it works without excluding too |
| 04:43 | AWizzArd | Kototama: For example, in one project I include the Apache XML-RPC Client as a dependency. Unfortunately it comes with JUnit, which I don't want, so I did: [org.apache.xmlrpc/xmlrpc-client "3.1.3" :exclusions [junit]] |
| 04:49 | Kototama | ok thx i'll try that |
| 05:04 | Kototama | when alternatives are written as [org.clojure/clojure "[1.2.1],[1.3.0]"], how can I specify which version from Clojure I want? |
| 06:20 | tsdh | Why is there no documentation for definterface in the Clojure API docs? |
| 06:54 | jaley | does anyone know where clojure.contrib.mock was moved to in 1.3? Can't find the info on the wiki... |
| 07:11 | AWizzArd | jaley: sorry, I don’t know that. But one association I have with “mock” is that Midje works in that style very well: https://github.com/marick/Midje |
| 07:12 | jaley | AWizzArd: ok cool. I was starting to look at Midje actually, I guess I'll carry on down that path |
| 08:34 | mr_rm | is nrepl considered to be the best way to have a remote repl connection in clojure 1.2 and 1.3? |
| 08:35 | mr_rm | that is: https://github.com/clojure/tools.nrepl |
| 08:36 | krunaldo | mr_rm: uh, normal nailgun repl or slime repl should be enough |
| 08:36 | krunaldo | mr_rm: also protecting it with a ssh/ssl/vpn/whatever tunnel is recommended |
| 08:37 | mr_rm | sorry, i should have said this is not from emacs. my IDE is eclipse ccw and i'd also like to connect from command line |
| 08:37 | mr_rm | krunaldo: but good point about the ssl tunnel - understood on that point |
| 08:38 | krunaldo | unsure how to proceed actually. |
| 08:39 | krunaldo | mr_rm: Do you need to have the repl running inside eclipse? |
| 08:39 | mr_rm | krunaldo: that is not a requirement. |
| 08:40 | mr_rm | krunaldo: basically i just want the running clojure program to listen on a port that i can connect to for a repl |
| 08:40 | krunaldo | hmm, nrepl seems to be the best one for that |
| 08:48 | kral | hi pals |
| 08:59 | compj | hi, does someone know why a aliased macro with (def ^#{:macro true) name #'other.ns/mac) produces a warning when called after it were aot compiled? |
| 09:00 | AWizzArd | compj: what is the warning? |
| 09:00 | compj | warning is: ArityException Wrong number of args (X) passed to <other.ns/mac> |
| 09:01 | compj | can be tested with the seesaw project https://github.com/daveray/seesaw/issues/73 |
| 09:04 | AWizzArd | compj: they suggest to delete the compiled class files. Can you try a “lein clean” first and then retry your example? |
| 09:05 | compj | yes that is working but I'm wondering, why can't you aot compile such a (def...)? |
| 09:05 | compj | isn't the ^#{:macro true} meta data not intended for this, or is it a bug? |
| 09:09 | pandeiro | anyone use domina (clojurescript dom lib used by cljs one)? is there an easy way to iterate over a collection and output list items that I am missing? |
| 09:16 | compj | here, mnimal example of the bug (?) http://pastebin.com/n83uWJgu |
| 09:18 | AWizzArd | compj: can you try to clean and then aot the code and then try your test? |
| 09:19 | compj | the example I posted works outside a project, just put it in a empty dir, compile it and you can see the warning |
| 09:27 | kij | Hey, whats the state of the videos from Clojure/Conj11 ? |
| 09:28 | bhenry | kij: i saw them listed on confreaks.com but they are not available yet. |
| 09:35 | phil_ | why doesnt this work? |
| 09:35 | phil_ | (deftype Bar [a b c d e]) |
| 09:35 | phil_ | (def b (Bar 1 2 3 4 5)) |
| 09:35 | phil_ | #<CompilerException java.lang.RuntimeException: Expecting var, but Bar is mapped to class hs.base.view.Bar, compiling:(REPL:4)> |
| 09:35 | raek | phil_: you are missing a dot: (def b (Bar. 1 2 3 4 5)) |
| 09:36 | phil_ | raek: ah, did the syntax change? |
| 09:37 | raek | phil_: not since the release of 1.2, at least |
| 09:37 | kij | bhenry, Thanks. |
| 09:37 | phil_ | raek: i see, then im looking at outdated examples :) thx! |
| 09:37 | raek | Bar is a jvm class, so you use the constructor interop syntax |
| 09:51 | lucian | i have a seq of maps, i'd like to split it into several seq based on one value in the map. is there hof i could use? |
| 09:52 | joegallo | group-by, probably |
| 09:52 | lucian | joegallo: that's it, thanks |
| 09:52 | joegallo | it's not lazy, though (i mean, how could it be?) |
| 09:53 | lucian | yeah |
| 09:54 | TimMc | joegallo: It could be partially lazy. |
| 09:54 | lucian | well, i guess it could be |
| 09:54 | TimMc | The first time you iterated all the way through an inner seq, the entire source seq would be realized. |
| 09:55 | joegallo | yes |
| 09:55 | joegallo | you could do that |
| 09:55 | joegallo | quite right |
| 09:55 | TimMc | Wait, the result is a map of seqs... no, |
| 09:55 | TimMc | but if it is a seq of seqs, yes. |
| 09:55 | lucian | it'd work in something like haskell for sure, i think |
| 09:56 | lucian | semantically it's not necessarily fully eager |
| 09:59 | TimMc | You could write a lazy associative data structure in Clojure. But the first 'get on it for a key that wasn't already known would also cause a full realization. |
| 10:00 | phil_ | is it possible to pr-str deftypes? |
| 10:00 | phil_ | in the same way that i can pr-str maps for example? |
| 10:01 | phil_ | pr-str only returns the java reference, but not the contents |
| 10:03 | raek | phil_: not yet, I think |
| 10:04 | raek | something like that is in the works (at least for records) |
| 10:04 | phil_ | ok, do deftypes then offer any advantages to self-made polymorphism? |
| 10:05 | phil_ | i guess that returning closures for every newly created type may be inefficient :/ |
| 10:14 | stuartsierra | pr-str works on defrecords in 1.3 |
| 10:15 | stuartsierra | But not deftype. |
| 10:17 | phil_ | there are no defrecords in cjs though, correct? |
| 10:29 | wiseen | How do I call Java method overload that takes a vararg of byte[] ? |
| 10:29 | wiseen | usually to call overload that takes vararg it's (Foo/bar (into-array type [...]) |
| 10:30 | wiseen | but how do I get byte[] as type ? |
| 10:32 | AWizzArd | wiseen: the Class of it is "[B" |
| 10:32 | AWizzArd | You can type-hint such objects too: (SomeClass/method ^"[B" my-byte-array) |
| 10:32 | AWizzArd | wiseen: (class (byte-array 0)) |
| 10:33 | wiseen | AWizzArd, so (into-array [B [(byte-array ...) ..]) |
| 10:33 | wiseen | AWizzArd, so (into-array ^"[B" [(byte-array ...) ..]) |
| 10:33 | wiseen | ? |
| 10:34 | AWizzArd | byte-array takes a value-sequence. |
| 10:34 | wiseen | it takes varargs of byte-arrays not a byte-array |
| 10:34 | AWizzArd | ,(doc byte-array) |
| 10:34 | clojurebot | "([size-or-seq] [size init-val-or-seq]); Creates an array of bytes" |
| 10:34 | AWizzArd | ,(long-array [10 20 30]) |
| 10:34 | clojurebot | #<long[] [J@134afa4> |
| 10:34 | wiseen | AWizzArd, yeah I know, but I need an array of byte-arrays |
| 10:34 | wiseen | Java function has : wrappedBuffer(byte[]... arrays) |
| 10:35 | wiseen | that's one overload |
| 10:35 | AWizzArd | Ah okay, then make-array |
| 10:35 | AWizzArd | ,(make-array Byte/TYPE 10 20) ; a 10x20 array |
| 10:35 | clojurebot | #<byte[][] [[B@f6f949> |
| 10:35 | AWizzArd | ,(class (make-array Byte/TYPE 10 20) ; a 10x20 array) |
| 10:36 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 10:36 | AWizzArd | ,(class (make-array Byte/TYPE 10 20) ; a 10x20 array)) |
| 10:36 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 10:36 | AWizzArd | ,(class (make-array Byte/TYPE 10 20)) ; a 10x20 array |
| 10:36 | clojurebot | [[B |
| 10:36 | Kototama | isn't it more clear that a *variable-like-this* is global? Why did that get deprecated? It's harder to see the difference between local and global variables now |
| 10:37 | AWizzArd | wiseen: note that (make-array Byte 10 20) is the wrapper Byte[][], while (make-array Byte/TYPE 10 20) returns you a native byte[][] |
| 10:37 | AWizzArd | Kototama: I would also prefer if one could say: (def ^{:dynamic false} *my-var* 10) |
| 10:37 | wiseen | AWizzArd, so Byte/TYPE is a way to access value type byte |
| 10:37 | wiseen | packed |
| 10:38 | AWizzArd | Kototama: But this way it is very easy to see which are bindable (and thus “slow”) vars. |
| 10:38 | wiseen | *unpacked type |
| 10:38 | AWizzArd | wiseen: yes |
| 10:39 | TimMc | phil_: There's a multimethod you can overload for printing your type, I forget what it is. |
| 10:40 | phil_ | TimMc: but no multimethods in cljsc right? |
| 10:40 | phil_ | but defrecords work, just tested |
| 10:42 | pandeiro | phil_: there weren't but the branch of cljs used by clojurescript one has them |
| 10:42 | phil_ | pandeiro: multimethods or defrecords? |
| 10:42 | pandeiro | multimethods |
| 10:43 | phil_ | and defrecords? |
| 10:43 | pandeiro | not sure about that |
| 10:43 | phil_ | they work, but the docs say they shouldnt |
| 10:44 | phil_ | is the branch used in cljs one gonna be merged back into the main repo btw? |
| 10:44 | pandeiro | phil_: not sure, probably have to ask the crew |
| 10:44 | phil_ | pandeiro: allright, thx! |
| 10:57 | bhenry | can someone point me to a good futures resource? or tell me how to check the status of a future without blocking by deref? |
| 11:01 | TimMc | bhenry: realized? I think |
| 11:02 | TimMc | ,(realized? (future 5)) |
| 11:02 | clojurebot | false |
| 11:03 | jkkramer | ,(apropos "future-") |
| 11:03 | clojurebot | (future-done? future-call future-cancel future-cancelled?) |
| 11:04 | bhenry | future-done? thanks! |
| 11:05 | AWizzArd | Hmm, is the difference between realized? and future-done? more of a subtle nature? |
| 11:05 | AWizzArd | It seems realized? works for more than just futures. |
| 11:05 | jkkramer | yes, it's more general. also, it's 1.3+ only |
| 11:06 | LauJensen | AWizzArd: Hi buddy, its been a while, is your DB out yet? |
| 11:09 | stuartsierra | There's also a non-blocking version of `deref` now that takes a timeout argument. |
| 11:10 | exupero | @joe http://en.wikipedia.org/wiki/1967_NFL_Championship_Game |
| 11:10 | AWizzArd | LauJensen: in use, but getting more stable. |
| 11:10 | exupero | sorry, wrong irc |
| 11:10 | LauJensen | Anything on Github or something I can try out? |
| 11:10 | AWizzArd | LauJensen: on BitBucket, but in a private repo :) |
| 11:11 | LauJensen | Oh okay - You're really drawing out the suspense on this one :) |
| 11:11 | LauJensen | In other News, ClojureQL is 1.0.3 and nearly bug free :) |
| 11:12 | AWizzArd | LauJensen: you are right, I am very slow on this. And Grats to the new version of CQL. |
| 11:12 | LauJensen | Thanks :) |
| 11:12 | AWizzArd | gtg, l8rs |
| 11:18 | langmartin | I have a namespace in program called platform.util, if I load a file that depends on it (slime + lein), I get the error that the namespace isn't found in the file. |
| 11:19 | langmartin | If I open the file and load it, the namespace can be found |
| 11:19 | langmartin | if I change the namespace to platform.toolbox, the load works as expected |
| 11:19 | langmartin | us there an issue with a namespace called "util"? |
| 11:20 | Vinzent | are you sure the file is called "platform/util.clj"? if yes, I don't know |
| 11:20 | langmartin | yes, I am sure. |
| 11:21 | sritchie | technomancy: is there a way to exclude a file from a jar, but keep it around in the uberjar? |
| 11:35 | Dotan_ | hi, is there an ubuntu package for clojure for a quick start? |
| 11:37 | pjstadig | Dotan_: I think there is, but i'm not sure how recent it is |
| 11:37 | pjstadig | may be 1.2.1 |
| 11:37 | Dotan_ | i see, ok, i'll build locally. |
| 11:37 | Vinzent | Dotan_, anyway install leiningen first |
| 11:38 | jsabeaudry | Dotan_, Closest thing to q quickstart that I know of is certainly leiningen: https://github.com/technomancy/leiningen |
| 11:38 | Dotan_ | oh. i suspected installing lein first might be better but dismissed that thought |
| 11:39 | jsabeaudry | Dotan_, depending on what you intend to do, tryclj.com might be even faster |
| 11:39 | Dotan_ | yep thanks, i always like to fiddle locally despite of try* sites :) |
| 11:48 | Kototama | is there a release for math.combinatorics (formerly clojure.contrib.combinatorics) ? |
| 11:51 | babilen | Kototama: http://search.maven.org/#artifactdetails%7Corg.clojure%7Cmath.combinatorics%7C0.0.2%7Cjar comes up |
| 11:56 | Kototama | hum okay |
| 11:56 | TimMc | Dotan_: In general, Clojure is not reliably available through package managers. |
| 11:56 | Kototama | i looked on clojars |
| 11:56 | Kototama | thanks |
| 11:57 | Dotan_ | TimMc, thanks. i went the lein way, very cool. |
| 11:58 | benares_98 | :TimMc why isn't clojure reliably available through package managers? |
| 12:00 | TimMc | benares_98: Lack of maintainers, first of all -- but I think there are deeper problems with that distribution model vis-à-vis Clojure. |
| 12:00 | TimMc | (and that was supposed to be an a-with-grave-accent, but my terminal is fucked) |
| 12:01 | benares_98 | lol thanks for the insight |
| 12:01 | benares_98 | I was just curious, someone else said not to get clojure through package managers but I didn't ask why at the time. |
| 12:02 | TimMc | The reason is the unreliability. :-) |
| 12:03 | stuartsierra | There's a mismatch between the Java distribution model (every app has its own classpath of JARs) and most OS package managers. |
| 12:04 | babilen | What would need to be done to change that? What is wrong with clojure as currently packaged? Which libraries/applications need to be packaged most urgently? |
| 12:07 | dnolen | babilen: communicate to users that they should install lein via their package manager not clojure |
| 12:09 | babilen | technomancy: ^^^ Could you push a change to leiningen's README to mention Debian/Ubuntu packages? (Arch has packages as well, but I had the impression that they mostly just rely on lein's autoinstall) |
| 12:09 | wjlroe | I seem to have a value of byte[] coming from a sql query - how can I test for that - there's not bytes? method... |
| 12:10 | babilen | dnolen: But I am serious -- I am currently working on packaging most of https://github.com/clojure/ + other highly ranked libraries (compojure, ...) and am always open for suggestions. |
| 12:11 | babilen | dnolen: My long-term plan is to have everything managed by clojure/core in Debian in the newest version + backports to stable, but this is some work and any comments from the clojure community are welcomed. |
| 12:11 | algernon | babilen: midje & marginalia would be lovely to have, too. |
| 12:12 | babilen | algernon: Yeah, those are highly ranked on whatever website was mentioned on clj-user recently that provided a ranking based on dependencies. |
| 12:13 | stuartsierra | babilen: I don't want to denigrate your efforts, but I would not expect OS packages for Clojure libraries to get much use. |
| 12:13 | babilen | algernon: It's a bit hard to choose and I guess that a lot of developers will just rely on installing libraries via leiningen anyway. My dream would be that most of what is now on "Getting Started with ..." has a corresponding package in Debian/Ubuntu. |
| 12:14 | stuartsierra | Since the "packages" are just source code, there's little benefit to having them managed by an OS-level tool. |
| 12:14 | stuartsierra | Also, Clojure is a young language and the landscape of libraries and tools is likely to change rapidly for the foreseeable futuer. |
| 12:15 | babilen | stuartsierra: Which is why for now only leiningen and clojure is packaged and I am debating with myself how to proceed. I guess that the real need for packages arise as soon as users really want to install applications written in Clojure. |
| 12:16 | algernon | babilen: *nod* |
| 12:16 | stuartsierra | In the unlikely event that desktop applications are written in Clojure, they would probably be distributed as monolithic JARs containing all their dependencies, as many Java applications are toay. |
| 12:16 | stuartsierra | *today |
| 12:17 | hiredman | stuartsierra: but debian's policy is to take those monolithic jars and break them up again |
| 12:17 | stuartsierra | eh, whatever |
| 12:17 | hiredman | much like I think the debian package of clojure has(or had) asm stripped out |
| 12:18 | stuartsierra | nice trick since it was namespaced under the "clojure." package |
| 12:18 | babilen | yeah, but those monolithic JARs can and shouldn't be distributed by distributions -- I am currently trying to get most of clojure/core and other things into Debian and will merely package dependencies thereafter. I think, for example, that being able to "apt-get install clooj" and similar things would ease the life for people. |
| 12:18 | stuartsierra | go for it |
| 12:18 | babilen | hiredman: It is stripped out |
| 12:19 | hiredman | *eyeroll* |
| 12:19 | babilen | stuartsierra: Oh, I will. I just fear that this might end up in a similar situation as the Debian/Ruby disaster (developers being discouraged to use distribution packages) and would like to avoid that. |
| 12:19 | stuartsierra | too late |
| 12:20 | babilen | stuartsierra: Why? |
| 12:20 | stuartsierra | We already tell developers to use Lein. |
| 12:20 | babilen | hiredman: Huh? asm *is* packaged in Debian and used by clojure -- It is just not part of the Clojure package. |
| 12:22 | hiredman | babilen: sure, but why? |
| 12:22 | babilen | hiredman: Because there is no need to have the same library 10 times on a system. |
| 12:23 | babilen | stuartsierra: Which really makes sense right now. Just like it makes sense to target quite new and unstable libraries at this point. But clojure will (hopefully) settle down a bit eventually. As I said earlier: This will really become important once users want to use user-level applications in clojure. |
| 12:23 | hiredman | babilen: sure there is, clojure uses a specific version of asm, other tools may use other versions |
| 12:23 | stuartsierra | One dream at a time. 'Later dudes. |
| 12:24 | TimMc | It hink the question at the moment is: Does distribution via uberjars lock us in later? |
| 12:25 | TimMc | And I'm not sure what the answer is. |
| 12:25 | babilen | hiredman: Those versions will have to be packaged independently in versioned packages if they are not compatible. |
| 12:25 | TimMc | babilen: Like Java? |
| 12:25 | babilen | TimMc: For example |
| 12:26 | hiredman | babilen: for what gain? |
| 12:26 | TimMc | I could see that. |
| 12:26 | hiredman | (over just taking the existing clojure jar with asm included) |
| 12:27 | TimMc | babilen: WOuld you have clojure-1.2 or clojure-1.2.1? |
| 12:27 | TimMc | Never mind, that's irrelevant. |
| 12:27 | TimMc | Clojure 1.2 breaks API, so it is clojure-1.2 v1.2 and v1.2.1 |
| 12:28 | babilen | hiredman: There are a couple of reasons why it is undesirable. I guess the most important one is that it eases security support as you only need to update a single library and all applications that use that library are "patched" as well. If we would ship the same library in multiple packages all these packages would need to be updated. |
| 12:28 | TimMc | outside of that, you can handle it with OR statements. |
| 12:29 | babilen | TimMc: Right now we have clojure1.2 and clojure1.3 -- I expect a clojure1.4 to emerge after the release. |
| 12:29 | babilen | s/the/its |
| 12:30 | hiredman | babilen: but any security update is a new a version which may or may not work ith clojure, while the asm distributed with it is always going to work |
| 12:30 | babilen | If there would be a set of stable libraries for 1.3 and 1.4 that are individually maintained you could expect those to be packaged as something like libclojure1.2-foo -- But those are not versioned right now. |
| 12:32 | babilen | hiredman: In that case the dependencies have not been declared correctly -- software should clearly state that it works with specific versions. (say 1.5 - 1.6 or so) and security updates to a library shouldn't break backwards compatibility. (e.g. 1.6.1 shouldn't break applications written against 1.6) |
| 12:33 | hiredman | babilen: "shouldn't" |
| 12:33 | babilen | indeed |
| 12:33 | hiredman | babilen: they do all the time |
| 12:34 | hiredman | babilen: clojure has no "dependency" on an external package, because the "external" package is not external anymore |
| 12:34 | TimMc | hiredman: That takes away the entire point of a security update. |
| 12:34 | babilen | hiredman: Sure there are dependencies (you write those down in your project.clj (for example) all the time) |
| 12:34 | TimMc | Not that you can read this. |
| 12:35 | hiredman | babilen: the whole thing is such a knee-jerk stiff-necked forcing of an antiquated C view of the world |
| 12:35 | hiredman | babilen: clojure doesn't have any |
| 12:36 | hiredman | (actually clojure doesn't build with lein so there is no project.clj, and even if you have a fork that does build with lein, which I happen to have, it doesn't have any dependencies) |
| 12:36 | babilen | hiredman: I am referring to Clojure-the-ecosystem rather than specifically clojure itself. |
| 12:37 | hiredman | babilen: if you want apt to work with the ecosystem the best thing to do would just by to make apt front maven |
| 12:38 | hiredman | but that will not work well because apt with apt the default is an assumed single version of a package installed at one time, where as maven/the jvm just don't care |
| 12:39 | babilen | hiredman: We have things like that to ease packaging maven projects -- Please don't get me wrong here as my sole intent is to make it easier for Debian(-based) users/developers to use and enjoy Clojure. I do, however, strongly believe that a more stable development cycle + support for "old" versions will be a good thing in the long run. |
| 12:40 | hiredman | babilen: it is already very easy, you bootstrap yourself out of the apt nonsense and just use maven repos |
| 12:42 | hiredman | babilen: the ruby community is seeing issues with the apt/C style global global namespace of libraries and has started using tools which avoid that (rvm, bundler, recommending local installs instead of global, etc) |
| 12:45 | babilen | hiredman: Indeed, whereas it works pretty well for Python even though *developers* still use tools such as pip/virtualenv/... during their development. |
| 13:10 | phil_ | what is the function to generate an object from a string? im trying (read-string (pr-str object)) but i get an "unreadable form" error message |
| 13:11 | joegallo | you might need to play some of the ear-muffed variables that affect printing of objects |
| 13:12 | phil_ | like atoms? |
| 13:13 | joegallo | i'm thinking like http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/*print-level* |
| 13:13 | joegallo | for instance |
| 13:13 | joegallo | depending on what you're printing |
| 13:13 | phil_ | yep (read-str (pr-str (atom 6))) bombs out :/ |
| 13:13 | joegallo | i don't think you want to print and read atoms |
| 13:13 | joegallo | just my opinion |
| 13:13 | joegallo | you might want to print and read the value in the atom |
| 13:14 | joegallo | but not the atom itself |
| 13:14 | phil_ | well i was hoping that by reading the atom a new atom will be generated with the same value |
| 13:15 | joegallo | i don't think that atoms are designed to have a readabl toString, so that doesn't work |
| 13:15 | joegallo | you could probably sneak around it if you really really want to do it that way |
| 13:16 | phil_ | yea i guess, but it gets complicated... is there a reason why atoms are deemed unfit for "serialization"? |
| 13:17 | joegallo | ours not to reason why, ours not to make reply |
| 13:18 | Vinzent | phil_, there was discussion about that on the group somewhere... Why don't you save the value of your atom? |
| 13:27 | TimMc | I'm not sure what the point is of cloning transactional objects. |
| 13:46 | technomancy | has anyone had issues generating incanter charts from jdk7? |
| 13:57 | the-kenny | +1 |
| 14:12 | dnolen | jkkramer: compj: the-kenny: i see no patch in jira ;) |
| 14:13 | the-kenny | hmm shouldn't be that hard. Do I still need a contributor agreement? |
| 14:15 | technomancy | amalloy_: what's the latest on the data.xml release? still blocked on maven? |
| 14:16 | dnolen | the-kenny: yep |
| 14:16 | the-kenny | dnolen: Gnah. I should finally bring myself to do that :) |
| 14:22 | compj | can someone tell whether this is a bug? see comment: http://pastebin.com/raw.php?i=2GFGY2NW |
| 14:23 | TimMc | compj: I believe macro fns take some extra args, maybe &env and &form |
| 14:23 | Bronsa | compj: defmacro puts &env and &form as first args |
| 14:23 | hiredman | compj: it is not |
| 14:24 | Bronsa | TimMc: you were faster :) |
| 14:24 | TimMc | I'm on my work computer, which has less lag. |
| 14:24 | compj | but it works as exspected when I dont compile |
| 14:24 | jkkramer | dnolen: i'll write a patch. think i should bring it up on clojure-dev or just create a jira case? |
| 14:24 | compj | but if the module is aot compiled this warning is produced |
| 14:25 | dnolen | jkkramer: mention it in on clojure-dev just for record keeping |
| 14:25 | jkkramer | k, will do |
| 14:25 | dnolen | jkkramer: it always hard to tell how quickly people will move on such tickets since it's minor enhancement - so don't hold your breath |
| 14:25 | dnolen | jkkramer: Clojure/core only really works on CLJ on Fridays |
| 14:26 | hiredman | dnolen: really, because I am pretty sure relevence is the one with an open source friday policy, and clojure/core claims not to be relevence |
| 14:27 | dnolen | hiredman: seeing as Clojure/core is mostly relevance + rhickey, the distinction is a minor one |
| 14:27 | hiredman | well, I guess that is not true, the website says "Clojure/core is a specialized technical practice brought to you by Relevance, Inc." |
| 14:28 | hiredman | dnolen: right, I just know if you suggest they are the same on the ml you get immediately "corrected" |
| 14:30 | compj | it seems the compiler does not set the macro flag for vars defined using (def #^{:macro true}) |
| 14:31 | hiredman | compj: what version of clojure are you using? #^ has been deprecated for two releases now |
| 14:32 | nrichards | Does anyone maintain a list of clojure users groups / meetups? I can't seem to find one |
| 14:32 | technomancy | nrichards: there's one on jira |
| 14:32 | compj | I just started using clojure, I''m on version 1.3.0 but learned from older tutorials |
| 14:32 | jkkramer | dnolen: yeah, i know. i figure i shouldn't complain unless i'm willing to actually write a patch, though :) |
| 14:32 | technomancy | which is not renowned for making things easy to find |
| 14:32 | nrichards | The Austin Clojure meetup is starting up, and I was hoping to get some inspiration from what other groups are doing |
| 14:33 | nrichards | jira? OK. I'll check. thanks |
| 14:33 | di-csuehs | Austin Clojure? |
| 14:33 | nrichards | yes |
| 14:33 | dnolen | nrichards: sweet! I used to live in ATX |
| 14:33 | technomancy | nrichards: sorry, confluence |
| 14:34 | nrichards | http://www.meetup.com/Austin-Clojure-Meetup/ |
| 14:34 | hiredman | compj: metadata on the var is the only "macro flag" there is |
| 14:34 | hiredman | but you also need to stop using single segment namespaces |
| 14:34 | hiredman | ~namespace |
| 14:34 | clojurebot | It's greek to me. |
| 14:34 | hiredman | clojurebot: jerk |
| 14:34 | clojurebot | you cut me deep, man. |
| 14:35 | compj | the single namespace was just for the demo |
| 14:35 | hiredman | ~namespaces |
| 14:35 | clojurebot | namespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it |
| 14:35 | compj | so how do I add the :macro true to a var in 1.3.0? |
| 14:36 | hiredman | compj: so what makes you think the compiler is not |
| 14:36 | hiredman | compj: so what makes you think the compiler is not seeing it as a macro? |
| 14:36 | compj | see the example http://pastebin.com/raw.php?i=2GFGY2NW |
| 14:36 | hiredman | I see the example, and I don't see anything there that would lead to that conclusion |
| 14:37 | compj | i expect no warning when using (mac-alias) since it is marked to be a macro |
| 14:37 | compj | and if i do (.setMacro #'var) it works |
| 14:37 | compj | so my assumptions was the compiler does somehow drop this information |
| 14:37 | compj | while it works when you don't aot compile it |
| 14:37 | Raynes | compj: Not that it matters, but refheap.com and gist.github.com (and a couple of other ones) are pastebins that have Clojure-specific highlighting. The first one is even written in Clojure by a couple of really awesome dudes. One whose name starts with an R. |
| 14:38 | Bronsa | oh, i recall there was a problem like this for ^:dynamic |
| 14:38 | compj | raynes: tanks :) I was looking for a clojure paste service but did not find one |
| 14:38 | hiredman | compj: have you looked at what setMacro does? |
| 14:38 | TimMc | Raynes: Get on that SEO! |
| 14:39 | Raynes | TimMc: Indeed. |
| 14:41 | compj | no, I did not look what setMacro does but I think it sets a var so that the 2 args passed to macro funs are handled in a way the user expects it |
| 14:41 | hiredman | compj: nope |
| 14:41 | Raynes | TimMc: Looks like "clojure pastebin" is covered in pastebin.com. and thus destroys us. |
| 14:41 | djh_ | Can anyone tell me what the significance is of surrounding var declarations wtih *s, e.g. *database-connection*? |
| 14:42 | di-csuehs | ugh...why does it require a photo |
| 14:42 | Raynes | Those usually indicate dynamic vars that will be rebound at some point with ##(doc binding) |
| 14:42 | lazybot | ⇒ "Macro ([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before. The new bindings are made i... https://refheap.com/paste/386 |
| 14:42 | pjstadig | djh_: it generally conveys the fact that your var is meant to be bound dynamically |
| 14:42 | pjstadig | though in 1.3 you have to specifically add the dynamic metadata |
| 14:43 | Raynes | di-csuehs: Why does what require a photo? :o |
| 14:43 | compj | hiredman: but you agree the behaviour is not as expected? |
| 14:43 | djh_ | pjstadig: thanks, that's all I needed to know :) |
| 14:43 | compj | since the compiled and non-compiled version differ? |
| 14:43 | hiredman | compj: I dunno, I haven't checked, and since you are new to clojure I think it is more likely you are making a mistake somewhere |
| 14:44 | di-csuehs | nrichards Austin Clojure meetup |
| 14:44 | nrichards | di-csuehs: the group? I think that's a meetup.com thing. |
| 14:44 | nrichards | I didn't setup the group - but I can ask Sam to look at the configuration. I know he wrote the signup questions |
| 14:45 | di-csuehs | I found one...glad I had my laptop handy. See you there! |
| 14:46 | compj | yes, of course I thought of this option. but I could not find any documentation for this so I think it's possible that this might be a bug |
| 14:46 | compj | the call to setMacro was just a workaround I picked from the defmacro code |
| 14:47 | nrichards | di-csuehs: awesome! |
| 14:47 | di-csuehs | assuming the kids have been good ;) |
| 14:57 | Bronsa | chops: fwiw with this patch http://sprunge.us/KZbH it works |
| 14:58 | chops | Bronsa: I think you might be confusing me with someone else |
| 14:58 | Bronsa | yeah |
| 14:58 | Bronsa | tabfail |
| 14:58 | chops | lol :) |
| 14:58 | Bronsa | *compj |
| 15:00 | compj | Bronsa: so it's a bug? |
| 15:00 | Bronsa | it's a missing feature i guess |
| 15:00 | compj | :) |
| 15:01 | Bronsa | if somebody with a CA can submit it, it'd be great |
| 15:01 | compj | +1 |
| 15:05 | TimMc | Bronsa: You'd want to reformat with tabs. (yuck) |
| 15:05 | Bronsa | oh :( |
| 15:16 | TimMc | Bronsa: The clojure.core formatting guide is pretty heinous. |
| 15:16 | Bronsa | then i guess http://sprunge.us/bWcc this should be good |
| 15:17 | Raynes | TimMc: Have you actually looked at clojure.core's formatting? |
| 15:17 | Raynes | TimMc: It looks like it was edited by 20 different editors. |
| 15:18 | llasram | Raynes: How so? |
| 15:19 | TimMc | like someone unleashed a whitespace-randomizer on it, I know |
| 15:20 | Raynes | llasram: Well, Emacs indents non-defun-style things with one space if you put a newline before the first argument. `cond` is an example. Vim doesn't bother and puts two spaces. This sort of inconsistency is all over clojure.core. |
| 15:20 | Raynes | I don't actually care about 1 vs 2 spaces. It's just worth noting. |
| 15:21 | llasram | Raynes: Ah, I see. Interesting. I had not noticed that. And also thought you were talking about the clojure.lang Java code for some reason |
| 15:21 | Raynes | I wouldn't dare look at that. |
| 15:22 | llasram | I was put off by it at first, but after poking around, it's not bad. The formatting is unconventional, but largely consistent. There aren't many comments, but most of the code (other than the reader) is pretty clear |
| 15:27 | TimMc | Raynes: Ah, I was talking about the Java stuff. |
| 15:31 | dnolen | TimMc: blame it on IntelliJ |
| 15:35 | TimMc | dnolen: Why? Isn't it configurable? |
| 15:38 | Raynes | TimMc: Yes. It has settings "Ugly, Hideous, and Unreadable." |
| 15:38 | dnolen | Personally I have few problems with the Java source, weirdly formatted - yes. Unreadable hardly. |
| 15:41 | llasram | I wonder where rhickey (I assume?) got that formatting style from. It's very much like the formatting style McConnell recommends for C-ish code in /Code Complete/ (for pretty concrete reasons, although I still don't see it very often or use it myself) |
| 15:43 | jkkramer | http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style |
| 15:44 | llasram | Interesting. |
| 15:44 | hiredman | I like to imagine it was just an easy style to generate from a set of cl macros |
| 15:45 | llasram | heh |
| 15:45 | hiredman | the only joking part of that sentence is "cl macros" it would of course be generated by cl functions |
| 16:12 | grim_radical | is there a way to add a docstring via "defmethod"? |
| 16:13 | grim_radical | i see how to do it for defmulti, but i'd like to add some method-specific docs |
| 16:13 | phil_ | is there a way in paredit.vim to swap to expressions (or just move an expression to the right / left)? |
| 16:13 | phil_ | two* |
| 16:13 | Vinzent | grim_radical, I don't think it's possible |
| 16:14 | grim_radical | Vinzent: bummer. :( |
| 16:16 | raek | grim_radical: in defmulti/defmethod there is only one var involved (and therefore only one place for the metadata to go), namely the one that is defined by defmulti |
| 16:16 | grim_radical | raek: ah, ok |
| 16:17 | TimMc | raek: Is there a way to ask a multimethod for the implementation it would use given an argument list? |
| 16:17 | brehaut | grim_radical: if you used https://gist.github.com/432752 to install the methods so you could define the functions independently so that they each have a var to hang a doc on |
| 16:17 | grim_radical | brehaut: neat! i'll definitely take a look at that |
| 16:17 | raek | TimMc: I'm not aware of any public interface for that |
| 16:18 | brehaut | grim_radical: you wont get much advantage over just using a ;; comment |
| 16:18 | grim_radical | brehaut: yeah, that's my current fallback |
| 16:20 | raek | the defmulti docs or the ns docs where the defmethod resides are alternative locations |
| 16:21 | jsabeaudry | Is there a way to comment out "the next s-exp" ? |
| 16:21 | brehaut | ,#_ (prn "a") :foo |
| 16:21 | clojurebot | :foo |
| 16:21 | brehaut | jsabeaudry: ^ |
| 16:22 | jsabeaudry | brehaut, Excellent! Thanks! |
| 16:22 | brehaut | jsabeaudry: use it carefully. its a great way to cause you pain ;) |
| 16:23 | brehaut | jsabeaudry: not all syntax highlighters highlight it and the form thats removed as a comment |
| 16:23 | jsabeaudry | brehaut, Oh ya, clojure-mode doesn't color it :( |
| 16:23 | brehaut | indeed |
| 16:24 | brehaut | im pretty sure the JS SyntaxHighlighter brush does |
| 16:26 | brehaut | (not that that is useful when writing code) |
| 16:32 | jondot | hey guys, i've got a couple of questions while evaluating clojure |
| 16:32 | brehaut | jondot: just ask them |
| 16:32 | brehaut | ~anyone |
| 16:32 | clojurebot | Just a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..." |
| 16:32 | jondot | first, is clj good for handling low level binary structure? something like erlangs pattern matching |
| 16:33 | jondot | sorry my g/f interupted |
| 16:34 | hiredman | match (the pattern matching library) has some facilities for matching binary data, but I don't know how widespread that is in practice (I haven't used them) |
| 16:34 | brehaut | jondot: clj inherited some pain from jvm: theres no unsigned primative types which can make unpacking some stuff difficult. but beyond that binary data is fine |
| 16:35 | compj | TimMc: something happenend to the :macro pathc? |
| 16:35 | compj | |
| 16:35 | compj | *patch |
| 16:35 | hiredman | https://github.com/clojure/core.match |
| 16:36 | jondot | i see. well i planned my first project (just to get a feel for the language) to be an implementation of this, for ring: https://github.com/jondot/rack-ping |
| 16:36 | brehaut | hiredman: dnolan was suggesting yesterday that people probably shouldnt build ontop of match till it gets to beta because of some gnarly issues still being resolved |
| 16:36 | jondot | i'm wondering, if that is a good fit for a first project - it would mostly be HTTP pipework, regex and imperative style workflow |
| 16:37 | tmciver | jondot: not sure about pattern matching but gloss is supposed to be a good binary data lib: https://github.com/ztellman/gloss |
| 16:37 | hiredman | brehaut: I see |
| 16:38 | TimMc | compj: Is it deleted? Bronsa created a new one. http://sprunge.us/bWcc |
| 16:39 | compj | I mean will it be added |
| 16:39 | jondot | tmciver: thanks, that looks interesting |
| 16:40 | TimMc | compj: Oh, no idea. I'm not on the Clojure/core team (though I do have a CA), I'm not invested in the issue, and it has an easy workaround (I think). |
| 16:40 | brehaut | jondot: what does rack_ping do that needs binary eating? |
| 16:41 | jondot | brehaut: sorry, i was afraid someone would make the connection. it is unrelated, just me asking question #2. |
| 16:41 | brehaut | oh right. |
| 16:41 | brehaut | in that case, yeah ring level stuff is a fine place to get started in clojure |
| 16:42 | brehaut | jondot: i dont know rack well enough to be able to make sense of the rack ping code though |
| 16:43 | jondot | well i've also implemented the same code in javascript (node) and c# (.net) any of that make sense to you? |
| 16:43 | brehaut | i understand all the langs, but not the libraries ;) |
| 16:44 | jondot | ah! well, my question i guess is along the lines of - there is a bit of grunt work there, like opening a HTTP pipe, regex'ing the content, and 3-4 decision points. |
| 16:44 | brehaut | jondot: is it just setting up a url that will attempt to test a variety of http resources? |
| 16:44 | jondot | yes. |
| 16:44 | brehaut | jondot: thats all trivial! |
| 16:44 | brehaut | clj-http takes care of making http connections easily |
| 16:45 | brehaut | think of it as the dual of ring github.com/dakrone/clj-http/ |
| 16:45 | jondot | yes, it is very trivial, but my closest background to lisp is scheme (i've never even opened a socket in scheme) :) |
| 16:46 | brehaut | ive never opened a socket in clojure ;) not directly but ive written some xmlrpc crap which is similar to what you are doing |
| 16:46 | brehaut | just with more mess |
| 16:46 | jondot | well, great then, i'll give it a try for fun. |
| 16:46 | brehaut | jondot: https://github.com/brehaut/necessary-evil/blob/master/src/necessary_evil/core.clj |
| 16:47 | Raynes | I've opened a socket. |
| 16:47 | Raynes | I didn't like what was inside. |
| 16:47 | jondot | hehe |
| 16:47 | Raynes | https://github.com/Raynes/irclj has some socket stuff, I think. |
| 16:47 | compj | CA is quite a barrier if you just want to make a small contribution |
| 16:48 | Raynes | I agree, but it has been discussed until the end of time and they aren't going to change it. |
| 16:48 | compj | very sad but they surely have their reasons |
| 16:48 | brehaut | jondot: i dont claim that that lib is good code, but its doing the mechanical stuff you want |
| 16:49 | jondot | good, i think both of those project make a great reading for newcomers (or at least myself) |
| 16:49 | compj | isn't there a simple way to just open a ticket or point to an issue/patch? |
| 16:49 | jondot | ah!! and the last question - clj does have tail call right? courtesy of JVM? |
| 16:49 | Raynes | They use JIRA which… Sorry, I actually have no clue what they use that abomination. |
| 16:49 | Raynes | jondot: It doesn't. But it has 'recur' which works around that. |
| 16:50 | brehaut | jondot: nope. it has loop / recur to simulate self calls in the tail position |
| 16:50 | Raynes | Well, you don't need a loop for a recur. |
| 16:50 | brehaut | of course. my bad |
| 16:50 | jondot | hmm is that JVM's fault? i remember one platform which didn't have TCO that felt very weird to me. |
| 16:50 | Raynes | https://refheap.com/paste/388 |
| 16:50 | brehaut | if you want mutual recursion to be tail recursive you need a trampoline |
| 16:51 | Raynes | The JVM doesn't have anything for tail calls. |
| 16:51 | TimMc | jondot: JVM might add TCO some day, there was talk of it. |
| 16:51 | brehaut | yeah the JVM is to blame. clojure could just do its own tialcalls (like scala does) but that causes problems for interop |
| 16:51 | TimMc | Didn't make it into 7. |
| 16:51 | Raynes | jondot: See my paste above for an example of recur. |
| 16:51 | jondot | oh, well nice to know that scala does it. thanks Rayens - checking it |
| 16:51 | Raynes | jondot: You can basically just replace a tail call with recur and it magically works. |
| 16:52 | jondot | i see, well from my narrow experience, looks like good enough |
| 16:53 | jondot | thanks guys, i've learnt a lot, off to start fiddling around with ring! |
| 16:54 | technomancy | avian has TCO |
| 16:54 | Raynes | technomancy: And flu. |
| 16:54 | Raynes | ~rimshot |
| 16:54 | clojurebot | Badum, *tish* |
| 16:54 | brehaut | avian? |
| 16:54 | technomancy | Raynes: how badly do you want it? |
| 16:55 | Raynes | That sounded dirty. |
| 16:55 | technomancy | clojurebot: avian is an alternate JVM implementation that's capable of running some subset of Clojure with TCO and continuations: http://oss.readytalk.com/avian/index.html |
| 16:55 | technomancy | it also can AOT-compile straight to machine code |
| 16:55 | technomancy | clojurebot: where did you go? |
| 16:55 | clojurebot | Pardon? |
| 16:55 | brehaut | huh thats really interesting |
| 16:56 | Raynes | Yeah, it's totally stellar, dood. |
| 16:56 | technomancy | clojurebot: avian is an alternate JVM implementation that's capable of running some subset of Clojure with TCO and continuations: http://oss.readytalk.com/avian/index.html |
| 16:56 | clojurebot | Roger. |
| 16:56 | brehaut | hows its performance compared to oracle/open jdks? |
| 16:57 | clojurebot | Alles klar |
| 16:57 | technomancy | brehaut: not very good |
| 16:57 | brehaut | i guess that shouldnt be surprising |
| 16:57 | technomancy | it's intended for embedding in larger C programs a la guile IIUC |
| 16:58 | brehaut | oh right. thats interesting in its own right |
| 16:59 | arkh | is there a why to specify classpath for clojure-jack-in ? |
| 17:00 | brehaut | arkh: err, i would guess that you do so in the project.clj for the project you are jacking in to |
| 17:00 | raek | arkh: clojure-jack-in uses whatever classpath leiningen provides it. |
| 17:01 | arkh | I'm specifically running into a problem with clojurescript one and it's dependences that aren't in ./lib |
| 17:02 | arkh | maybe I just need to look at leiningen but clojurescript one has a shell script that grabs its sundry dependencies |
| 17:09 | brehaut | holy crap. international shipping on oreilly books is prohibitively expensive 30$ |
| 17:09 | kedoodek | ebooks are the future |
| 17:09 | jodaro | and the present |
| 17:11 | brehaut | no kidding |
| 17:14 | arkh | how does one add to what lein builds for a classpath? |
| 17:15 | technomancy | arkh: I think you should try the lein-cljsbuild plugin |
| 17:15 | schleyfox | hi, I'm having a bit of trouble with proxy. I'm using a lib that requires anonymous classes derived from a class, so I'm proxying it. It's two functions are the same arity and name but different types |
| 17:16 | schleyfox | I'm type hinting in my proxy, but I can't seem to get the right method called |
| 17:16 | phil_ | technomancy: ive been using cljs-watch for now but this looks great |
| 17:20 | arkh | brehaut, raek, technomancy: thank you |
| 17:24 | schleyfox | so any ideas on why proxy is ignoring my type hints and proxying the wrong function? |
| 17:24 | the-kenny | phil_: cljsbuild is awesome. I used cljs-watch some weeks ago too, cljsbuild is much better :) |
| 17:24 | the-kenny | (though not perfect) |
| 17:25 | brehaut | schleyfox: you'll probably want to paste up an example somewhere (gist, refheap etc) |
| 17:26 | emezeske_ | the-kenny: taking suggestions on how to make cljsbuild perfect. ^_^ |
| 17:26 | the-kenny | emezeske_: haha :D |
| 17:26 | the-kenny | emezeske_: I'll have to try the newest version first, I'll come back to you :) |
| 17:26 | muhoo | didn't proxy get replaced by something else? reify maybe? |
| 17:26 | emezeske_ | the-kenny: cool, thanks |
| 17:27 | technomancy | emezeske_: do you have a version that uses the canonical clojurescript artifacts yet? |
| 17:27 | brehaut | muhoo: not exactly. proxy fills a similar but different role |
| 17:27 | emezeske_ | technomancy: yep, the latest version depends on them |
| 17:27 | technomancy | great |
| 17:27 | brehaut | muhoo: in particular proxy's are fully dynamic (and can be monkey patched!) and allow you to proxy to a class, where reify is only protocols and interfaces |
| 17:27 | the-kenny | emezeske_: One thing which I found slightly annoying was the copying of the .clj files to the cljs dir in order to make crossover compilation possible. |
| 17:28 | the-kenny | emezeske: Also, lein cljsbuild auto didn't watch the crossover source-files. |
| 17:29 | emezeske | the-kenny: regarding point #2, when you try the latest version, if it doesn't do that, could you open an issue? I thought that worked. |
| 17:29 | emezeske | the-kenny: regarding point #1, would you prefer they were copied elsewhere? or just used in-place? |
| 17:30 | schleyfox | brehaut: https://gist.github.com/1665869 |
| 17:30 | schleyfox | muhoo: also reify works on protocols and interfaces |
| 17:31 | schleyfox | I need concrete class stuff |
| 17:31 | hiredman | schleyfox: type hints like that do nothing for proxies |
| 17:32 | hiredman | they work by name+arity |
| 17:32 | the-kenny | emezeske: In-Place. It's too easy to confuse the copy with the original .clj and make changes on the wrong file |
| 17:32 | schleyfox | hiredman: damn, any way to get that behavior? |
| 17:32 | the-kenny | emezeske: I'll open that ticket when it fails with the newest version :) |
| 17:32 | hiredman | so you'll need to check if ther argument is an instance of something else and forward via proxy-super |
| 17:33 | hiredman | (if (instance? … …) do-stuff (proxy-super thisMethod …)) |
| 17:33 | schleyfox | hiredman: but from the docs: "they have no other access to protected members, nor to super, as these capabilities cannot be proxied." |
| 17:33 | hiredman | ,(doc proxy-super) |
| 17:33 | clojurebot | "([meth & args]); Use to call a superclass method in the body of a proxy method. Note, expansion captures 'this" |
| 17:34 | schleyfox | yeah, I just did |
| 17:34 | kmicu | emezeske_:cljsbuild support for ":define "goog.userAgent.ASSUME_MOBILE_WEBKIT" |
| 17:34 | kmicu | " in project.clj would be great! :) |
| 17:34 | schleyfox | cool, thanks |
| 17:34 | the-kenny | emezeske: Sorry, have to go. University is so annoying :( |
| 17:35 | the-kenny | Night! |
| 17:36 | MenTaLguY | hi, so I was reading http://clojure.org/lazy, and I'm not sure I fully understand why the "step" helper function is necessary to avoid a leak |
| 17:37 | hiredman | that is old stuff |
| 17:37 | hiredman | streams are currently off the table |
| 17:37 | MenTaLguY | eh? |
| 17:37 | MenTaLguY | is lazy-seq being dropped from future versions of clojure then? |
| 17:37 | hiredman | oh, sorry that is not the streams page, forget I said anything |
| 17:37 | MenTaLguY | oh |
| 17:37 | hiredman | streams are something totally different |
| 17:38 | nickmbailey | oh i saw the streams page the other day and thought it looked interesting, not happening? |
| 17:39 | broquaint | I'm wonder if I'm getting lazy when I consider a lein plugin to add deps to project.clj e.g lein add-dep noir ... |
| 17:41 | hiredman | https://gist.github.com/a1f737bfe0d70a385d4c |
| 17:41 | emezeske | kmicu: is that a cljs compiler option? |
| 17:42 | kmicu | emezeske: yes java -jar compiler.jar --help |
| 17:42 | kmicu | emezeske: more info in Google Closure Definitive Guide |
| 17:43 | emezeske | kmicu: do you know if there's anyway to pass that option via the normal 'cljsc' command? |
| 17:43 | kmicu | emezeske: i try to run ClojureScript One on Android and now I've done several tricks like that option manually :) |
| 17:44 | emezeske | kmicu: I see. Right now, I think the options that can be passed through the clojurescript compiler into the google closure compiler are kind of limited |
| 17:45 | emezeske | kmicu: if you wouldn't mind opening an issue at https://github.com/emezeske/lein-cljsbuild/issues?sort=updated&direction=desc&state=closed , I'd appreciate it |
| 17:45 | MenTaLguY | hmm |
| 17:45 | kmicu | emezeske: no problem |
| 17:45 | MenTaLguY | so is the helper function, "step", really necessary to avoid a leak in the example on clojure.org/lazy? |
| 17:45 | emezeske | kmicu: thanks. |
| 17:45 | schleyfox | hiredman: ok, so the issue now is that my proxied method only gets called from within the method that I proxy-super to, so my proxy is removed while it executes |
| 17:45 | MenTaLguY | or is that there for some other reason |
| 17:46 | schleyfox | hiredman: I assume this is now the time to break out my diddling gloves and get real close with RT and java |
| 17:46 | broquaint | Thanks, hiredman :) |
| 17:47 | broquaint | Aha, it's elisp, time to write me a keybinding. |
| 17:50 | hiredman | schleyfox: you'll need to gen-class most likely |
| 17:51 | hiredman | broquaint: I think that gist may be missing bits like the favorite-libraries and get′ |
| 17:52 | hiredman | broquaint: https://gist.github.com/e6a92b792d43775ad615 |
| 17:57 | schleyfox | hiredman: thanks for the tips, I think I'm just going to extend the class in java to take a provided IFn and invoke it |
| 17:57 | TimMc | MenTaLguY: It does seem kind of weird, doesn't it? |
| 17:57 | MenTaLguY | yeah, I'm actually trying the example now without the helper fn, and it seems to work fine without any extra memory usage |
| 17:58 | TimMc | MenTaLguY: Actually... how do you write it without the helper? |
| 17:58 | broquaint | Thanks again, hiredman :) |
| 17:58 | MenTaLguY | (defn myfilter [pred coll] |
| 17:58 | MenTaLguY | (lazy-seq |
| 17:58 | MenTaLguY | (if (pred (first coll)) |
| 17:58 | MenTaLguY | (cons (first coll) (filter pred (rest coll))) |
| 17:58 | MenTaLguY | (filter pred (rest coll))))) |
| 17:59 | MenTaLguY | ideally you'd really want to call seq on coll and then save that in a local |
| 17:59 | TimMc | Ah, right. I've seen that style all over the place. |
| 18:01 | lpetit | MenTaLguY: when does the iteration stop in your definition ? ^^ :) |
| 18:01 | phil_ | is assoc-in copy-on-write in cljs? |
| 18:02 | aclj | hi =D |
| 18:02 | phil_ | lpetit: i assume (pred) returns nil when (first coll) returns nil |
| 18:02 | MenTaLguY | lpetit: oh, whoops, I forgot a (when) |
| 18:02 | MenTaLguY | yeah, but pred returning nil won't terminate iteration |
| 18:02 | dnolen | phil_: everything except cons'ing on a seq is copy-on-write |
| 18:02 | dnolen | in cljs |
| 18:03 | lpetit | MenTaLguY: a when-let will also store (first coll) |
| 18:03 | phil_ | MenTaLguY: if(nil) is false i think? |
| 18:03 | aclj | anyone tried to create libs in clojure and import them in android ? how is the performance ? |
| 18:03 | phil_ | dnolen: i mean "real" copy-on-write, like vectors etc, i.e. without data reuse |
| 18:04 | dnolen | phil_: maps, sets, vectors all copy-on-write |
| 18:05 | technomancy | aclj: not very good |
| 18:05 | phil_ | defrecords? or are they just maps? |
| 18:05 | lpetit | phil_: yes, any data structure provided by clojure, by default (that is, unless explicitly specified otherwise in the doc) |
| 18:06 | alg | technomancy: i mean, not develop the entire app in clojure, but only a set of lib to import in the java code of the app |
| 18:06 | technomancy | alg: you can't really trim clojure code down below a certain level; it brings the whole runtime with it |
| 18:07 | phil_ | lpetit: im not talking about persistence, the problem is that cljs copies the WHOLE vector / map etc whenever something changes, as opposed to the normal clojure data structures where only a small part is created from scratch and everything else is reused |
| 18:07 | lpetit | phil_: oh indeed, (blush) |
| 18:08 | phil_ | :) |
| 18:08 | phil_ | so im outta luck unless i patch em myself :( |
| 18:09 | TimMc | phil_: a.k.a. contribute a patch |
| 18:09 | MenTaLguY | yeah, I seem to be having a really hard time provoking the space leak that clojure.org/lazy warns about, even without using a helper fn |
| 18:10 | MenTaLguY | (myfilter #(= % 20) (map inc (range 10000000000))) has been running for a couple minutes now, and the resident size and heap size are still flatlined |
| 18:10 | phil_ | TimMc: yea, im planning on doing so anyway, just not yet... i heard there is some contributor agreement or something in place? |
| 18:10 | MenTaLguY | (more or less) |
| 18:11 | alg | teachnomancy: that's a pity, thanks |
| 18:11 | technomancy | hah; teachnomancy... nice. |
| 18:15 | TimMc | technomancy: I suppose resource-constrained platforms like Android are an argument against the uberjar distribution model. |
| 18:16 | technomancy | TimMc: I dunno, Android is already absolute crap at code-sharing |
| 18:16 | TimMc | Although... maybe two Clojure apps *wouldn't* be able to share a Clojure instance. I don't know enough about JVMs and classloaders. |
| 18:16 | TimMc | Ah, OK. |
| 18:16 | technomancy | dead-code elimination will likely be much more beneficial |
| 18:16 | TimMc | Interesting. |
| 18:17 | klutometis | Anyone have any idea how I'd quote caret? '^ doesn't work: the reader thinks I'm talking about metadata. |
| 18:18 | Chousuke | caret? as in the character? |
| 18:18 | Chousuke | \^ |
| 18:19 | klutometis | Chousuke: I'm trying to use it as a symbol, not a character. |
| 18:19 | Chousuke | you can't. |
| 18:19 | brehaut | (symbol "^") |
| 18:19 | klutometis | I guess (symbol "^") suffices, but it's ugly. |
| 18:19 | klutometis | brehaut: Thanks. |
| 18:19 | Chousuke | it's an illegal symbol though |
| 18:19 | TimMc | klutometis: Ugly things shold look ugly... |
| 18:20 | Chousuke | so you really shouldn't :P |
| 18:20 | klutometis | TimMc: Oh, Zeus; really? In Scheme, no character is ugly. |
| 18:21 | TimMc | klutometis: Shceme uses symbols differently. |
| 18:21 | Chousuke | what do you need a caret symbol for anyway? |
| 18:21 | klutometis | I'm defining a regex-like DSL, by the way, where ^ signifies ordered subsets; it's a beatiful pun, I think. |
| 18:21 | TimMc | klutometis: (^ 4 5) is gonna fail. |
| 18:21 | Chousuke | yeah, you can't use ^ for your own purposes |
| 18:21 | Chousuke | it's a reader macro |
| 18:22 | klutometis | TimMc: You're right; that sucks. Ok: maybe `!', then. Though I've got to find something else for `not'. Maybe `~'. |
| 18:22 | klutometis | Thanks. |
| 18:22 | amalloy | ~ won't make you very happy either |
| 18:22 | clojurebot | Huh? |
| 18:23 | amalloy | for similar reasons |
| 18:23 | TimMc | klutometis: Use some non-ASCII. :-P |
| 18:23 | Chousuke | well, ~ is not a reader macro |
| 18:23 | Chousuke | though I'm not sure if it works outside ` |
| 18:23 | Chousuke | ,~ |
| 18:23 | TimMc | &(let [~ 4] ~) |
| 18:23 | lazybot | java.lang.RuntimeException: Unmatched delimiter: ) |
| 18:23 | hiredman | well it is, but it isn't |
| 18:23 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading character> |
| 18:23 | Chousuke | hmm, I suppose |
| 18:23 | hiredman | like ' |
| 18:24 | brehaut | how about (💩 4 5) |
| 18:24 | Chousuke | so ~ is a reader macro outside syntax-quote but doesn't work :P |
| 18:25 | TimMc | &(let [~~ 4] ~~) |
| 18:25 | lazybot | java.lang.RuntimeException: Unmatched delimiter: ) |
| 18:25 | amalloy | jeez, brehaut, you should hang out with us on the BMP. my font doesn't have a glyph for that one :P |
| 18:25 | brehaut | amalloy: BMP ? |
| 18:25 | TimMc | Oh, I thought he was suggesting question-mark. |
| 18:25 | TimMc | Basic Multilingual Plane |
| 18:25 | brehaut | nope: unicode pile of poo |
| 18:26 | brehaut | sorry |
| 18:26 | TimMc | Pick stuff from the Emoticons block: http://www.fileformat.info/info/unicode/block/emoticons/images.htm |
| 18:27 | amalloy | i only vaguely know what the basic multilingual plane actually means, but since my client rendered that as a three-byte pile of soggy mess, i think it must be outside the two-byte BMP area |
| 18:28 | TimMc | http://www.fileformat.info/info/unicode/char/1f4a9/index.htm |
| 18:28 | TimMc | Haha, the spec actually says "poo". |
| 18:28 | brehaut | frighteningly on the mac its rendered with a little colored image and it has eyes |
| 18:30 | TimMc | haha |
| 18:30 | TimMc | It's from a block that is mostly (all?) from Japanese charsets |
| 18:30 | brehaut | the emoji set? |
| 18:30 | TimMc | Hmm, perhaps not... |
| 18:31 | TimMc | "U+1F46F WOMAN WITH BUNNY EARS" <-- well, maybe |
| 18:32 | brehaut | haha |
| 18:32 | TimMc | There's stuff in there like "blue heart", "green heart"... is this supposed to include color? o.O |
| 18:34 | amalloy | TimMc: you didn't know? unicode uses three bytes to encode RGB color, so the BMP is just all the different colors for "squarish blob" |
| 18:38 | TimMc | haha |
| 19:08 | solussd | long shot, but does anyone have any idea why my program would blow up when it tries to add a string containing a ≪ to a collection? It works fine in the repl but the same code blows up when executed from a jar |
| 19:17 | stevesj76 | debating on the use of futures vs agents when we don't care about the return value. any advice? |
| 19:17 | stevesj76 | (sending email in the background) |
| 19:21 | brehaut | futures would be my pick because its simpler |
| 19:21 | brehaut | they both use the thread pool under the hood i believe |
| 19:21 | stevesj76 | does that mean that the thread pool works like send for agents? |
| 19:22 | brehaut | yeah i believe so |
| 19:23 | hiredman | no, send uses a bounded threadpool |
| 19:23 | stevesj76 | more like send-off then? |
| 19:23 | hiredman | send-off and futures use a theoretically unbounded pool |
| 19:23 | stevesj76 | awesome thanks |
| 19:23 | hiredman | yes, future uses the same threadpool as send-off |
| 19:32 | dgrnbrg | Are records redefinable within a repl, or are they not conducive to repl debugging? |
| 19:32 | brehaut | you can redefine them |
| 19:35 | technomancy | you can redefine them, but not retroactively IIRC |
| 19:35 | brehaut | existing instances stay with the old implementation right? |
| 19:35 | technomancy | I think so; instances of the old record definition won't pick up the changes even though they will claim to be of the same class |
| 19:35 | technomancy | or rather, they will claim to be of a class which is visually indistinguishable from the current one, but actually different |
| 19:36 | brehaut | sure. that makes sense |
| 19:37 | brehaut | thats going to result in potential funny interactions with protocols right? |
| 19:37 | dgrnbrg | brehaut, technomancy: thanks |
| 19:37 | dgrnbrg | I'm currently using protocols and records and I'm getting lots of class already defined exceptions from the repl |
| 19:38 | dgrnbrg | I just want to develop rapidly, and get away from the need to constantly restart the jvm |
| 19:39 | dgrnbrg | man, there are weird rules for what goes inside (comment) blocks |
| 19:39 | dgrnbrg | No trailing colon, no number followed by 2 asterisks |
| 19:40 | hiredman | dgrnbrg: it has to be a readable form |
| 19:40 | dgrnbrg | Are those bugs or quirks? |
| 19:40 | hiredman | (comment ...) is a just a macro |
| 19:40 | hiredman | so the body has to pass through the reader |
| 19:40 | dgrnbrg | Is there a way I can make it shut up? |
| 19:40 | hiredman | use ; or #_ |
| 19:40 | dgrnbrg | just totally disable reader input |
| 19:40 | clojurebot | Titim gan éirí ort. |
| 19:40 | dgrnbrg | ; would be as effective at that? |
| 19:41 | dgrnbrg | awesome, I can prefix (comment...) lines with ; that have special characters |
| 19:41 | brehaut | dgrnbrg: comment is not magic: its roughly just (defmacro comment [& body] nil) |
| 19:42 | brehaut | ; is just like a line terminating comment in any other language |
| 19:42 | dgrnbrg | so ; is handled by the reader, while (comment) isn't? |
| 19:42 | dgrnbrg | comment being a macro |
| 19:43 | brehaut | correct |
| 19:43 | brehaut | #_ is also handled by the reader, but it behaves different (its still form oriented) |
| 19:43 | dgrnbrg | brehaut, when do I want #_ vs. ;? |
| 19:44 | brehaut | where comment results in a nil, #_ skips the form entirely |
| 19:44 | dgrnbrg | ah, i see |
| 19:44 | brehaut | ,(if #_true false :a :b) |
| 19:44 | dgrnbrg | so comment is an argument to a function potentially? |
| 19:44 | clojurebot | :b |
| 19:44 | brehaut | ,(if true false :a :b) |
| 19:44 | clojurebot | #<CompilerException java.lang.RuntimeException: Too many arguments to if, compiling:(NO_SOURCE_PATH:0)> |
| 19:44 | brehaut | ,(if (comment true) false :a :b) |
| 19:44 | clojurebot | #<CompilerException java.lang.RuntimeException: Too many arguments to if, compiling:(NO_SOURCE_PATH:0)> |
| 19:44 | brehaut | exactly |
| 19:44 | dgrnbrg | ahah |
| 19:45 | dgrnbrg | very interesting |
| 19:45 | dgrnbrg | I really like clojure |
| 19:45 | dgrnbrg | I'm using it to write an fpga programming language |
| 19:51 | brehaut | dgrnbrg: clojure is a likable language ;) |
| 19:53 | TimMc | solussd: Can you give me a minimal testcase with the string? |
| 19:58 | TimMc | I'd like to compare simple version numbers (3, 1.2.0, etc.) -- anyone have a thought on that? |
| 20:00 | brehaut | ,(compare [3] [1 2 0]) |
| 20:00 | clojurebot | -1 |
| 20:00 | TimMc | ooh |
| 20:00 | brehaut | :) |
| 20:00 | TimMc | brehaut: How do I drop trailing zeroes? |
| 20:01 | TimMc | I want 1.2 == 1.2.0 |
| 20:01 | TimMc | I guess I could preprocess with a regex. -.- |
| 20:01 | brehaut | ,(take-while (complement zero?) [1 2 0]) |
| 20:01 | clojurebot | (1 2) |
| 20:01 | technomancy | TimMc: there's a simplistic implementation in leiningen.core.main/version-satisfies? |
| 20:01 | TimMc | ,(take-while (complement zero?) [0 0 3 0 1 2 0]) |
| 20:01 | clojurebot | () |
| 20:01 | brehaut | rats |
| 20:01 | TimMc | It can't be done in the standard way. |
| 20:02 | TimMc | I mean, in a take/drop way |
| 20:02 | TimMc | With two reverses it becomes simple. |
| 20:02 | brehaut | ah yes. |
| 20:02 | brehaut | theres a name for that sort of operation |
| 20:02 | brehaut | but i cant remember it |
| 20:03 | TimMc | drop-last is close... |
| 20:04 | TimMc | technomancy: Oh, is that on master? |
| 20:04 | brehaut | TimMc: i'd just do the reverse trice |
| 20:05 | technomancy | TimMc: aye, in the leiningen-core directory |
| 20:05 | TimMc | brehaut: 3 times seems a bit excessive, no? :-P |
| 20:05 | brehaut | TimMc: conjugate is the name of that op |
| 20:06 | solussd | TimMc: I've figured out that calling out to libc/stat with a file-path that contains non-ascii characters doesn't work. Unrelated to clojure in every way. thanks though. :) |
| 20:07 | TimMc | solussd: Heh, OK. |
| 20:10 | technomancy | so... should throwing an exception be treated as a side-effect (something you should do before your return value in a when) or placed inside an if next to the return value? |
| 20:10 | technomancy | I've always done the former but haven't thought about it much |
| 20:11 | TimMc | "when" screams "side-effect". It also simplifies the visual flow of control. |
| 20:12 | brehaut | ,((fn [a b] (let [s->v (fn [vs] (vec (reverse (drop-while zero? (reverse (map #(Integer. %) (.split vs "[.]")))))))] (compare (s->v a) (s->v b))) "0.1.3.0" "0.1.3") |
| 20:12 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 20:13 | brehaut | ,((fn [a b] (let [s->v (fn [vs] (vec (reverse (drop-while zero? (reverse (map #(Integer. %) (.split vs "[.]")))))))] (compare (s->v a) (s->v b)))) "0.1.3" "0.1.3.0") |
| 20:13 | clojurebot | 0 |
| 20:14 | brehaut | technomancy: i'd treat it as a side effect i think? |
| 20:15 | TimMc | technomancy: version-satisfies? uses #"\d" instead of #"\d+" -- probably a bug. |
| 20:15 | technomancy | TimMc: oy; yes |
| 20:15 | technomancy | brehaut: yeah, I'm starting to think the only people who'd consider the alternative reasonable would be folks who have been damaged by a runtime that doesn't support exceptions. =) |
| 20:15 | brehaut | technomancy: lol :) |
| 20:16 | brehaut | is there a runtime that doesnt support exceptions? |
| 20:16 | TimMc | brehaut: Ah, I like [.] instead of \\. |
| 20:16 | brehaut | the robot eye operator |
| 20:16 | technomancy | brehaut: I mean returning integer error codes |
| 20:16 | technomancy | C |
| 20:16 | brehaut | technomancy: aha right |
| 20:17 | TimMc | brehaut: I'll end up using \d+ after seeing technomancy's impl. |
| 20:17 | brehaut | technomancy: some haskell programmers would suggest that exceptions form an implicit sum type and that you can use monads to control the flow without having to do a violent stack unwind |
| 20:17 | technomancy | I believe them; you can do anything with monads apparently. |
| 20:17 | brehaut | (eg using an Either type) |
| 20:18 | hiredman | except the stack unwind is faster |
| 20:18 | hiredman | (on the jvm) |
| 20:18 | brehaut | hiredman: sshh! |
| 20:18 | schleyfox | that just sounds painful and academic |
| 20:18 | technomancy | didn't realize they could be used to curb violence though |
| 20:18 | hiredman | technomancy: in the same way any weapon can be used to curb violence |
| 20:18 | brehaut | technomancy: only on the stack |
| 20:18 | tavis | brehaut: something's not Right |
| 20:18 | dgrnbrg | How do I set the hierarchy that a multimethod uses? I tried writing (defmulti docstring dispatch-fn :hierarchy myhier) but it failed with PersistantArrayMap cannot be cast to IRef |
| 20:19 | dgrnbrg | but if I remove ":hierarchy myhier" it works |
| 20:19 | brehaut | tavis: wait. i thought right was the error path |
| 20:19 | tavis | depends, are you left handed? |
| 20:20 | technomancy | TimMc: well here's your chance for a sticker |
| 20:20 | tavis | Left is usually the error |
| 20:20 | brehaut | tavis: so it is; apparently ive just always visuallized the type backwards in my head :P |
| 20:21 | TimMc | technomancy: I think I already qualify. |
| 20:21 | technomancy | oh, nice |
| 20:22 | tavis | brehaut: well, things are upside down in your part of the world ;) |
| 20:22 | brehaut | thats true enough |
| 20:22 | tavis | I lived in Dunedin for 5 years, btw |
| 20:22 | brehaut | oh right |
| 20:22 | tavis | was in Hamilton last year |
| 20:22 | brehaut | university? |
| 20:22 | tavis | yep |
| 20:22 | brehaut | huh |
| 20:22 | brehaut | im in hamilton this year |
| 20:23 | tavis | figured |
| 20:23 | technomancy | wow, NZ is really milking this LOTR thing for all it's worth; naming a city after the Dunedain. |
| 20:23 | brehaut | lol |
| 20:23 | amalloy | technomancy: fwiw, i prefer (... (if (broken?) (throw...) (work))) to (... (when (broken?) (throw...)) (work)) |
| 20:23 | technomancy | amalloy: exprain? |
| 20:25 | amalloy | it feels to me like two directions the computation could go: throw an exception, or work. the when-variant reads more like: "i'm going to do work, but first i may need to do this other thing as a side effect to make it work" |
| 20:25 | technomancy | you mean like ... pre-conditions? =) |
| 20:26 | technomancy | actually I should just use real preconditions for this |
| 20:26 | technomancy | derp |
| 20:26 | solussd | hmm. shouldn't I be able to create a NativeString like this: (com.sun.jna.NativeString. "myString" true), I get an exception: [Thrown class java.lang.IllegalAccessError] any ideas? |
| 20:26 | TimMc | technomancy: I'll send a pull request, mostly because I need the practice. |
| 20:27 | hiredman | solussd: my guess is nativestring's constructor is private |
| 20:27 | solussd | hiredman: hmm. docs say public: http://jna.java.net/javadoc/com/sun/jna/NativeString.html |
| 20:28 | hiredman | what does the rest of the stacktrace say? |
| 20:29 | TimMc | technomancy: Umm... should I be able to run lein 2 using lein 1.6.2? |
| 20:29 | technomancy | TimMc: you should be able to operate on leiningen-core using lein1 |
| 20:29 | technomancy | for the top-level project use the bin/lein script |
| 20:29 | TimMc | got it, thanks |
| 20:31 | TimMc | technomancy: Do you prefer people create feature branches, or just work on the target branch? |
| 20:31 | solussd | hiredman: ah ha! com.sun.jna.Native/toCharArray is what I needed. some reason, despite the docs, NativeString is not public |
| 20:32 | technomancy | TimMc: depends on the work. your regex tweak can go on master. =) |
| 20:33 | TimMc | Conditional on complexity, got it. |
| 20:38 | dgrnbrg | Can anyone show me code that uses defmulti with the :hierarchy optional argument? |
| 20:38 | dgrnbrg | I tried (defmulti name #(stuff %) :hierarchy my-hierarchy) but it doesn't compile |
| 20:40 | amalloy | you need to give it a ref of a hierarchy, so that it can be modified when you (derive) something |
| 20:41 | amalloy | &@#'clojure.core/global-hierarchy |
| 20:41 | lazybot | ⇒ {:parents {}, :descendants {}, :ancestors {}} |
| 20:41 | dgrnbrg | amalloy, could I do #'my-hierarchy if I def my hierarchy as a global var? |
| 20:42 | technomancy | amalloy: language! |
| 20:42 | amalloy | probably. i dunno, try it |
| 20:42 | dgrnbrg | so that's not a standard pattern? |
| 20:42 | dgrnbrg | I tried it, it works |
| 20:43 | amalloy | setting up hierarchies for multimethods is not very common |
| 20:43 | TimMc | It's not deprecated, though. |
| 20:44 | dgrnbrg | ok, i see |
| 20:44 | dgrnbrg | what's the function like use for namespaces that are already loaded? |
| 20:45 | TimMc | dgrnbrg: refer |
| 20:45 | dgrnbrg | thanks |
| 20:45 | technomancy | you can just keep doing use though |
| 20:46 | dgrnbrg | Is a hierarchy mutable or immutable? |
| 20:46 | dgrnbrg | Oh, I see |
| 20:46 | dgrnbrg | I'm supposed to def an atom for the hierarchy |
| 20:46 | dgrnbrg | maybe? |
| 20:46 | dgrnbrg | does derive have side effects? |
| 20:47 | dgrnbrg | derive doesn't have side effects |
| 20:47 | dgrnbrg | it seems like that should be documented |
| 20:53 | TimMc | dgrnbrg: Of course it does, it changes the hierarchy! |
| 20:54 | tavis | amalloy: I think lazybot just insulted your parents, your ancestors and descendants as a retort to &@#' |
| 20:59 | TimMc | Interesting design decision there. |
| 20:59 | TimMc | They could have written it so that you had to swap! and explicitly refer to a hierarchy. |
| 21:00 | TimMc | I suppose derive and underive are safely repeatable, though. |
| 21:25 | TheBusby | Q: Anyone have any experience effeciently serializing seq's of Clojure data structures? |
| 21:26 | brehaut | yes someone is bound to |
| 21:26 | TheBusby | currently using a combination of pr-str and java.util.zip , but having issues with custom dictionaries for dealing with longs seq's of maps |
| 21:26 | brehaut | why? |
| 21:26 | clojurebot | Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone |
| 21:27 | brehaut | ~botsnack |
| 21:27 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 21:27 | TheBusby | working with rather large amounts of data, like 100M records like {:name "bob" :age 44} |
| 21:27 | brehaut | TheBusby: building strings rather than using a string builder (or printing to *out*) is inefficient |
| 21:27 | TheBusby | it all gets converted to byte[] in the end |
| 21:28 | brehaut | TheBusby: what do you mean by " issues with custom dictionaries" |
| 21:29 | TheBusby | java.util.zip uses huffman encoding to reduce the space needed for common symbols |
| 21:30 | TheBusby | if I compress all 100M records at once, everything works fine |
| 21:30 | TheBusby | but if I want to compress a record at a time, you need to provide a "dictionary" (java API term) |
| 21:30 | TheBusby | so the compression routine knows what is common and what isn't |
| 21:31 | TheBusby | same even if ":name" only appears once in each string, the fact that it appears in 100M strings means it's a good candidate for reduction |
| 21:31 | brehaut | TheBusby: what is the exact class you are using? |
| 21:31 | TheBusby | anyways, this was just the road I was currently going down. Curious if anyone else had encountered similar issues and had other solutions |
| 21:31 | TheBusby | brehaut: class I'm using for compression? java.util.zip.deflate |
| 21:32 | TheBusby | brehaut: should I be looking at a different compression library? |
| 21:32 | brehaut | TheBusby: if you use an output stream i think you will have more luck |
| 21:33 | TheBusby | brehaut: that would be compressing all of the records at once though wouldn't it? |
| 21:33 | brehaut | TheBusby: i havent done any file IO in a while, but i recall that output streams can be stacked. *out* is an OutputStreamWriter of some description |
| 21:33 | brehaut | TheBusby: pass |
| 21:33 | TheBusby | brehaut: unfortunately I need 100M independent compressed byte[] :( |
| 21:34 | brehaut | does it have to be defalte ? |
| 21:35 | TheBusby | brehaut: no another library would work, but I need fast random access of the 100M records/elements |
| 21:35 | brehaut | TheBusby: right. zip will let you have random access (each map becomes a file) |
| 21:36 | brehaut | TheBusby: and gzip uses adaptive compression so it doesnt need to know the entire contents at once |
| 21:36 | TheBusby | brehaut: Just FYI, each map becomes a byte[], which is stored in RAM |
| 21:37 | TheBusby | isn't gzip ~= java.util.zip.Deflator? |
| 21:37 | brehaut | hmm. it might be? |
| 21:38 | brehaut | im out of my depth sorry |
| 21:39 | TheBusby | brehaut: any other ideas of how to store a large number of maps in RAM? |
| 21:39 | brehaut | TheBusby: i'd store them in a DB of some kind, perhaps with a cache in front of it |
| 21:40 | brehaut | from the sales pitch, redis sounds like it might be a good choice |
| 21:40 | TheBusby | most DB's have a significant overheard for each record |
| 21:40 | brehaut | they do |
| 21:41 | TheBusby | I looked a redis for something else a year or two back and it had an overhead of 10-20B per record |
| 21:41 | TheBusby | thank you for the advice though, I'll double check to see if they've improved things! ;) |
| 21:41 | schleyfox | TheBusby: to be fair, so do most languages |
| 21:42 | brehaut | TheBusby: the reason i would use a DB is that they have already put the hard work into managing memory and caching etc |
| 21:42 | TheBusby | if you store the whole data set in memory though, typical (non-CPU) caching isn't effective |
| 21:43 | brehaut | if you have to store the whole dataset in memory and are concerned about cpu though, compressing each record is going to eat a lot of CPU too though |
| 21:43 | brehaut | also, if its 100MB and i knew it wasnt going to grow fast, i'd just put the whole lot into a map |
| 21:43 | brehaut | map of maps that is |
| 21:43 | TheBusby | decompression is fairly fast though |
| 21:43 | brehaut | and eat the ram |
| 21:43 | clojurebot | No entiendo |
| 21:44 | TheBusby | faster than RAM access in some cases |
| 21:44 | brehaut | TheBusby: my preference is always for a simple solution first though |
| 21:45 | TheBusby | brehaut: I'm a firm believer in KISS as well. Unfortunately that isn't really suitable here. KISS in my case would probably be a Hadoop cluster... :( |
| 21:45 | brehaut | TheBusby: out of curiosity, what are you trying to solve? |
| 21:47 | TheBusby | brehaut: Building graphs to describe entities and then match them together from multiple data sets |
| 21:47 | brehaut | TheBusby: do the entities have consistent keys and change infrequently? |
| 21:48 | TheBusby | brehaut: no fairly static |
| 21:48 | brehaut | TheBusby: this is hypothetical, but you might find that records use less ram than maps |
| 21:48 | TheBusby | brehaut: an example would be taking data sets about people and matching them together (not what I'm actually doing) |
| 21:49 | TheBusby | brehaut: records or structs would be great, but unfortunately this is fairly schema-less :( |
| 21:49 | brehaut | oh :( |
| 21:49 | TheBusby | brehaut: using the people example, everyone has a name but not everyone has a dog |
| 21:57 | TheBusby | brehaut: thanks for the input, I'll see if I can put up a gist or a brief blog when I get something going. ;) |
| 21:57 | brehaut | TheBusby: id be interested to see that |
| 21:59 | schleyfox | TheBusby: I know nathanmarz is writing a book basically just about that |
| 22:00 | TheBusby | schleyfox: I hope to catch him on IRC or at the Conj then. ;) |
| 22:01 | TheBusby | appropriate link to book: http://www.manning.com/marz/ |
| 22:01 | schleyfox | I believe that's the one |
| 22:02 | TheBusby | schleyfox: thank you for pointing me to that. I may have to get the MEAP |
| 22:03 | schleyfox | it's still pretty early stage, but the second chapter does layout a graph type structure that may be along the lines of what you're thinking |
| 22:03 | TheBusby | at the moment though, I'll see if I can put together a little library for compressing a large seq |
| 22:03 | schleyfox | very hadoop/storm oriented though |
| 22:03 | schleyfox | nice |
| 22:04 | TheBusby | schleyfox: if my data set was 10x larger I'd be doing that, since I can fit everything into RAM though (< 100GB) I've found it's faster to keep everything on one box since in many cases the data sets are have links to each other everywhere |
| 22:04 | schleyfox | yeah, that makes sense |
| 22:05 | TheBusby | clojure's sequence library makes so many operations so convenient. I'd love to stick a compression/serialization library in the middle somewhere just to save on memory usage |
| 22:06 | TimMc | Man, is there any reason why ###{1 1 1} should throw? |
| 22:06 | schleyfox | that would be awesome |
| 22:06 | TimMc | &#{1 1 1} |
| 22:06 | lazybot | java.lang.IllegalArgumentException: Duplicate key: 1 |
| 22:06 | dgrnbrg | TheBusby, fyi, you can add keys to records that you didn't initially declare on them and they'll go into an augmentation map thingy |
| 22:07 | dgrnbrg | TheBusby, so if you have some common data, they can sit in records, but you can use it just like a map otherwise |
| 22:07 | TheBusby | Ooooh that sounds very valuable! |
| 22:07 | phil_ | TimMc: a hash set with duplicate keys doesnt make sense :/ or am i misunderstanding something? |
| 22:08 | TheBusby | dgrnbrg: Wouldn't I still need to serialize and compress though if I have many strings? |
| 22:08 | dgrnbrg | Yes, but for RAM utilization, you wouldn't need MapEntries for the common data |
| 22:08 | dgrnbrg | it depends on whether each record has 4 fixed keys and 100 variable keys |
| 22:08 | brehaut | TheBusby: is it possible to have keywords instead of strings? keywords are already interned for you so much lower ram usage |
| 22:09 | dgrnbrg | or 4 fixed keys and a handful of non-fixed |
| 22:09 | TheBusby | sorry, I meant strings as values not keys |
| 22:09 | dgrnbrg | strings are also interned, often |
| 22:10 | dgrnbrg | you can call String.intern() to get the interned version for certain |
| 22:10 | TimMc | phil_: Sets don't have instance count semantics, so it shouldn't matter if you specify something twice. |
| 22:10 | tmciver | ,(set [1 1 1]) |
| 22:10 | TheBusby | going off to read about String.intern() be back in a bit. Thanks all! |
| 22:10 | TimMc | (element count, whatever -- I'm making up a phrase) |
| 22:10 | clojurebot | #{1} |
| 22:10 | apwalk | ,(into #{} [1 1]) |
| 22:10 | clojurebot | #{1} |
| 22:11 | TimMc | ,(hash-set 1 1) |
| 22:11 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: 1> |
| 22:11 | phil_ | ,(into #{1} [1]) |
| 22:11 | clojurebot | #{1} |
| 22:11 | TimMc | (let [x ___] #{1 2 5 x 9}) ; might fail, who knows? |
| 22:12 | jeremyheiler | TimMc: looks like insertion is different that instantiation. |
| 22:12 | phil_ | TimMc: yea, but (int #{} [1 2 5 x 9]) won't |
| 22:12 | phil_ | into* |
| 22:13 | TimMc | Right, there are easy workarounds, but it shouldn't even be a thing you have to think of. |
| 22:13 | phil_ | but it shouldnt bomb out when making a new instance |
| 22:13 | phil_ | its unexpected |
| 22:13 | phil_ | yea |
| 22:13 | jeremyheiler | it's interesting |
| 22:14 | apwalk | is the expected way to handle it, to wrap it in a try? |
| 22:14 | TimMc | ,(import clojure.lang.PersistentHashSet) |
| 22:14 | clojurebot | clojure.lang.PersistentHashSet |
| 22:14 | TimMc | apwalk: Nah, just create it a different way. |
| 22:14 | phil_ | apwalk: that would be insane (if it was expected) |
| 22:14 | TimMc | ,(PersistentHashSet/create 1 1) |
| 22:14 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: No matching method: create, compiling:(NO_SOURCE_PATH:0)> |
| 22:15 | TimMc | ah, that's a varargs... |
| 22:15 | TimMc | ,(PersistentHashSet/create (to-array [1 1])) |
| 22:15 | clojurebot | #{1} |
| 22:16 | TimMc | ,(PersistentHashSet/createWithCheck (to-array [1 1])) |
| 22:16 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Duplicate key: 1> |
| 22:16 | phil_ | the reader bombs out, not the class itself |
| 22:16 | phil_ | (i think) |
| 22:16 | phil_ | ah |
| 22:16 | TimMc | Nah, the reader is calling createWithCheck |
| 22:16 | phil_ | ok :D |
| 22:16 | TimMc | but why? |
| 22:17 | phil_ | maybe "fail fast" philosophy? |
| 22:18 | TimMc | But it's a set! |
| 22:19 | phil_ | yea, somebody thought adding the same thing twice to a set might be an indication of a bug |
| 22:19 | phil_ | i guess |
| 22:19 | brehaut | certainly for literals |
| 22:20 | brehaut | although more so for maps than sets |
| 22:20 | dnolen | ,{1 2 1 2} |
| 22:20 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: 1> |
| 22:20 | TimMc | The semantics of (apply hash-set [x y z]) should be precisely identical to (into (hash-set) [x y z]). |
| 22:20 | jeremyheiler | phil_: the exception only goes off if the element failed to be added |
| 22:20 | brehaut | dnolen: i think (1 2, 1 3) is a better example |
| 22:21 | phil_ | are defrecords hashmaps? |
| 22:21 | TimMc | My first thought was, "Oh, someone is trying to be clever and use the provided collection directly, and is checking it first to make sure it is safe." But that's not true, it's all conses under the surface. |
| 22:22 | dnolen | phil_: not quite, you have optimized access of declared keys, an internal extension map for those that aren't |
| 22:23 | brehaut | phil_: map? says yes |
| 22:23 | brehaut | well, it says they are maps, but not necessarily hash maps |
| 22:23 | tmciver | ,#{[1 2] (1 2)} |
| 22:23 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Duplicate key: (1 2)> |
| 22:24 | tmciver | Hmm, page 94 of JoC shows that to work. |
| 22:24 | phil_ | any cljs specific differences? |
| 22:24 | brehaut | tmciver: that are in the same equality partition, so it shouldnt |
| 22:25 | brehaut | tmciver: but you are right that it does show that |
| 22:25 | tmciver | "Given two elements evaluating as equal, a set will contain only one, independent of concrete types." |
| 22:25 | tmciver | brehaut: it shouldn't what, fail? |
| 22:25 | brehaut | tmciver: joy of clojure is wrong |
| 22:26 | tmciver | But it's right here in black and white! |
| 22:26 | brehaut | it probably slipped through from an older clojure where the reader didnt check keys |
| 22:26 | TimMc | ~guards |
| 22:26 | clojurebot | SEIZE HIM! |
| 22:26 | TimMc | argh, bad timing |
| 22:26 | brehaut | 1.1 i believe |
| 22:26 | tmciver | slow connection? ;) |
| 22:27 | tmciver | I agree with TimMc, it seems like it shouldn't throw. |
| 22:27 | tmciver | (to me) |
| 22:27 | brehaut | sets at runtime shouldnt, but set literals, the ones that are baked into your source should IMO |
| 22:27 | brehaut | imagine you have |
| 22:28 | brehaut | #{1 2 3 4 5 6 7 8 9 … 1} |
| 22:28 | brehaut | later you realise you shouldnt have 1 |
| 22:28 | brehaut | so you remove it from the end of the set |
| 22:28 | brehaut | not realising its there at that start too |
| 22:28 | brehaut | thats just become an annoying bug that could have been avoided |
| 22:29 | dnolen | phil_: not beyond the slower performance of extending with non-specified keys |
| 22:30 | dgrnbrg | Where can I find a tutorial explaining how to use tests with leiningen? I seem to be doing things wrong in a very basic way. |
| 22:30 | phil_ | dnolen: so the extension map is a hashmap and theres some other, more optimized map for declared keys? |
| 22:31 | amalloy | "should" is a pretty strong word in this context, brehaut. i'd phrase it more like "given my cursory exploration of the topic, i'd be happier if ___". if sets behave the other way, the bugs that sneak in aren't eliminated; they're just replaced by different ones |
| 22:31 | dnolen | phil_: no map, the host type |
| 22:32 | amalloy | phil_: conceptually it's a more optimized map, yes: a java class with declared instance fields |
| 22:32 | phil_ | dnolen: but there are no host types in cljs |
| 22:33 | dnolen | phil_: think a bit more about that :) |
| 22:34 | phil_ | dnolen: well, everything is a hashmap in js |
| 22:34 | tmciver | brehaut: I think I agree with you. literals are called that for a reason, after all. The behavior that I was expecting is achieved with the set function. |
| 22:34 | phil_ | dnolen: or do you mean the "optimized" hosttype is a js hashmap while the extension map is a cljs hashmap? |
| 22:34 | brehaut | phil_: everything is a hashmap with an associated constructor function |
| 22:35 | brehaut | phil_: if there were no types in js,then the instanceof operator would always evaluate to false |
| 22:35 | phil_ | brehaut: yes, but why is the ctor optimizing access to the keys? |
| 22:37 | dnolen | phil_: if JS objects were really hashmaps, JS would still be dog slow. |
| 22:37 | phil_ | i think i understand |
| 22:38 | dnolen | phil_: I think it's better to think of JS Objects like Self objects, you can create slots on the fly. |
| 22:38 | dnolen | phil_: the fact that JS Objects inherits slots from prototype makes the hashmap analogy even more weak |
| 22:39 | brehaut | phil_: if you can portion off ad hoc properties in a javascript object into their own object and leave a consistent set of properties for the main type (ie, like a record does) then you maintain the 'shape' that the runtime inferencer can see, so it doesnt need to keep generating underlying types |
| 22:39 | brehaut | (because generating new underlying types also throws guards onto slow paths and causes rejitting to occur) |
| 22:40 | phil_ | so defrecord is creating a js prototype underneath? |
| 22:40 | dnolen | phil_: deftype/defrecord both create constructors functions |
| 22:41 | dnolen | phil_: when you extend a type/record to a protocol, this is done via the constructor fn's prototype property |
| 22:41 | phil_ | dnolen: ok, this clarifies things |
| 22:43 | dgrnbrg | Is there a function to check if 2 seqs are equal, or do I do a map/reduce? |
| 22:43 | dnolen | dgrnbrg: just use = |
| 22:43 | dgrnbrg | that'll work for seqs |
| 22:43 | dnolen | ,(= '(1 2 3) '(1 2 3)) |
| 22:43 | dgrnbrg | ? |
| 22:43 | clojurebot | true |
| 22:43 | dgrnbrg | ,(= '(1 2 3) [1 2 3]) |
| 22:43 | clojurebot | true |
| 22:43 | dgrnbrg | oh |
| 22:44 | adam__ | has anyone seen, https://github.com/globulon/sicp-in-clojure ? |
| 22:44 | adam__ | i was wondering if it maps to SICP well, or if its imcomplete |
| 22:45 | dnolen | adam__: I've said it once and I'll say it again. I love SICP. It's a terrible way to learn Clojure. |
| 22:45 | adam__ | okay, I have some experience with clojure, and noticed clojure does a lot of the things that SICP teaches |
| 22:45 | adam__ | like lazy sequences |
| 22:46 | adam__ | thanks |
| 22:55 | JanxSpirit | hey I imagine you guys are familiar with 4clojure? |
| 22:55 | JanxSpirit | I'm doing this one: http://www.4clojure.com/problem/21#prob-title |
| 22:56 | JanxSpirit | I came up with a function that does it |
| 22:56 | JanxSpirit | but I'm just not sure what the problem wants in terms of input |
| 22:56 | JanxSpirit | it won't let me do a (defn ...) |
| 22:57 | tmciver | JanxSpirit: you can do a (fn [] ... or a #() instead. |
| 22:57 | JanxSpirit | OK - I probably need to go look this up but what's the difference fn/defn? |
| 22:58 | tmciver | defn is a macro that def's a var, which you can't do in the 4clojure solutions |
| 22:58 | tmciver | fn returns a funtion object which can be called directly. |
| 22:59 | JanxSpirit | hmm...OK - thanks! |
| 22:59 | tmciver | ,(doc defn) |
| 22:59 | clojurebot | "([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + ...]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata" |
| 22:59 | tmciver | sure |
| 23:01 | brehaut | (comp first (partial apply drop) (comp reverse vector)) |
| 23:01 | brehaut | worst nth ever |
| 23:01 | brehaut | (comp first (partial apply drop) rseq vector) ; slightly better |
| 23:05 | tmciver | brehaut: ha! you haven't seen my solution! |
| 23:05 | brehaut | ,((comp first (partial apply drop) (juxt second first) vector) [:a :b :c :d :e] 3) |
| 23:05 | clojurebot | :d |
| 23:05 | brehaut | thats the winning solution there |
| 23:05 | brehaut | tmciver: i have not :) |
| 23:06 | tmciver | it's better that way. |
| 23:06 | brehaut | everything is better with juxt ;) |
| 23:09 | phil_ | ,((comp first (partial apply drop) (juxt second first) vector) [:a :b :c :P :e] 3) |
| 23:09 | clojurebot | :P |
| 23:09 | tmciver | That's a cool solition. It's taken me this long to understand it. |
| 23:09 | tmciver | s/solition/solution |
| 23:09 | brehaut | its the too much haskell coolaid solution |
| 23:09 | tmciver | ha! |
| 23:10 | brehaut | (which is to say i know enough haskell to be dangerous but not enough to be useful) |
| 23:10 | adam__ | yeah, i learned enough haskell to be able to understand books on functional programming written using haskell |
| 23:11 | brehaut | that amount is worth the effort |
| 23:11 | adam__ | there is a lot of great material written on FP that uses haskell from a pretty large academic community |
| 23:12 | adam__ | not all of it applies though, but a lot does |
| 23:12 | phil_ | yea but they lose me when they start using transformers on monad transformers :) |
| 23:12 | brehaut | haha |
| 23:12 | brehaut | monad transformers are much easier to grasp in clojure |
| 23:12 | adam__ | ha, learning monads is on my news years resolution list |
| 23:12 | brehaut | less type system syntax and magic to wrap your head around |
| 23:13 | adam__ | i will tackle concurrency first, then go into monads |
| 23:14 | phil_ | ive looked at clojure monads only superficially, but i have a gut feeling ill have t o adjust to working with monads without explicit types |
| 23:14 | phil_ | (not that ive done so much with monads) |
| 23:14 | JanxSpirit | what languages do most Clojure users come from? |
| 23:15 | adam__ | wasn't there a survey going around a couple weeks ago? |
| 23:18 | dnolen | http://cemerick.com/2011/07/11/results-of-the-2011-state-of-clojure-survey/ |
| 23:18 | dnolen | last survey - mostly Java / Python / Ruby |
| 23:18 | adam__ | i think its a good thing that most people are coming from imperative langauges |
| 23:19 | adam__ | no way clojure could bloom if it stayed in the lisp community |
| 23:19 | fbru02_ | hey all ! how do i do a get-in to look for a key but i don't know the intermidiate keys to get there ? |
| 23:19 | dnolen | adam__: most people in the older lisp communities either don't care or are hostile |
| 23:19 | pdk | lisp world can only grow so much from within itself |
| 23:20 | pdk | also cl guys tend to hate clojure |
| 23:20 | JanxSpirit | really? old school Lispers don't like Clojure? |
| 23:20 | phil_ | didnt think so much java programmers are so open minded tbh :) |
| 23:20 | dnolen | but cl guys tend to hate everyone even cl people |
| 23:20 | JanxSpirit | I come from Java/Scala |
| 23:20 | JanxSpirit | my first Lisp and it's very interesting - good exercise for the brain :) |
| 23:21 | adam__ | yeah, it really has opened my mind to what it is I am doing when I write a program |
| 23:21 | phil_ | JanxSpirit: wait till you come to haskell, THEN youll have an excercise for your brain :) |
| 23:22 | JanxSpirit | I read a chapter or so of my Haskell book, but it was pretty intimidating to jump into |
| 23:22 | adam__ | in Haskell, implemeting state can be a phd level topic |
| 23:22 | JanxSpirit | got Clojure doing some things right out of the gate which has been fun |
| 23:23 | phil_ | adam__: yea, you cant really do anything in haskell besides small 3 liner teasers without having understood monads at the very least |
| 23:23 | schleyfox | I did a lot of stuff in erlang, Clojure is nice because compiling and starting code using a few dependencies isn't a week long adventure during which I feel like the Swedish Alexander Graham Bell |
| 23:23 | brehaut | i disagree http://haskell.org/haskellwiki/Simple_unix_tools |
| 23:24 | phil_ | schleyfox: rly? i found erlang very easy to set up and jump into |
| 23:24 | schleyfox | phil_: oh it is. then try to use a couple libs outside of the standard distribution |
| 23:24 | fbru02_ | related : what's the best way to walk over a hash? |
| 23:25 | jeremyheiler | fbru02_: What do you need to look at? |
| 23:25 | phil_ | schleyfox: i was only using mochiweb and it wasnt such a problem to set up but cant talk about more complex project setups |
| 23:26 | schleyfox | yeah, and rebar has helped a lot |
| 23:26 | phil_ | yea rebar was awesome |
| 23:26 | fbru02_ | jeremyheiler: i have a deep nested hash and need to find a specific key that should be at the any of those sub-hashes of any given depth |
| 23:26 | schleyfox | but compared to leiningen or anything of that nature, it's basically the worst |
| 23:27 | metajack | erlang works the same as python and ruby. there's just a path to dependent libraries. |
| 23:27 | phil_ | schleyfox: yea ive been very pleasantly surprised by clojures eco system |
| 23:27 | metajack | all rebar does it set it up in a nice default way and fetch the dependencies based on git urls |
| 23:28 | metajack | in a way, clojure seems weird to me because it deals with build artifacts as dependencies. haven't really dealt with that since i spent most of my time in C |
| 23:29 | schleyfox | metajack: yeah, I mean, it's not too bad, but it just always bites me when I try and distribute applications to servers and such |
| 23:29 | metajack | if you use releases, it's kind of like an expanded uberjar. |
| 23:29 | metajack | rebar now makes that easy, but otherwise it can be a pain, sure |
| 23:29 | metajack | even easier than java, since erlang releases include the entire runtime. |
| 23:29 | schleyfox | yeah, I mean I stopped doing much erlang about the time rebar started to actually get decent |
| 23:30 | metajack | riak is a good example of releasable erlang code. you just unzip and type riak start. no muss no fuss. |
| 23:31 | schleyfox | yeah, I agree |
| 23:32 | adam__ | Erlang looks pretty interesting, but Clojure STM is alot better for me than the actor model |
| 23:33 | schleyfox | I feel like if erlang just had a bigger ecosystem, it would just be awesome |
| 23:35 | metajack | erlang could use data structure literals like clojure has :) |
| 23:35 | schleyfox | erlang could use a lot of syntactic/modernization type things that clojure has |
| 23:37 | phil_ | adam__: but clojure STM aint distributed |
| 23:38 | phil_ | there is a lib though |
| 23:38 | dnolen | damn I love logic programming |
| 23:38 | dnolen | https://gist.github.com/1667847 |
| 23:38 | phil_ | https://github.com/technomancy/die-roboter |
| 23:38 | icylisper | schleyfox: There is a nascent project on an Erlang-Clojure bridge using Chas Emerick's nREPL protocol. https://github.com/icylisper/isthmus |
| 23:39 | schleyfox | icylisper: nice |
| 23:39 | schleyfox | I think the extent of my clojure-erlang bridging though these days will be reading and writing to riak |
| 23:40 | adam__ | does anyone here have experience on using clojure's concurreny along with sun grid engine ? |
| 23:43 | nighty^ | pyr! ping |
| 23:48 | brehaut | re:distributed stm http://avout.io/ |
| 23:48 | brehaut | adam__, phil_: ^ |
| 23:49 | phil_ | brehaut: this looks very interesting, bookmarking |
| 23:49 | adam__ | brehaut, so this would allow me to distribute concurrent jobs across cluster nodes? |
| 23:50 | brehaut | adam__: i dont know the details sorry |
| 23:50 | adam__ | thanks for showing me, i'll have to read more into it! |
| 23:50 | metajack | teh think relevance podcast has an interview with the author of avout |
| 23:50 | brehaut | avout is quite new |
| 23:50 | metajack | you might start there |
| 23:50 | brehaut | metajack: good point |
| 23:59 | jeremyheiler | fbru02_: some questions: is the key in the nested structure more than once? is the value of the key another map? |