2010-10-16
| 00:01 | dpritchett | now i need to get emacs not to barf on cygwin symlinks |
| 00:16 | mabes | does clojure already have a map-tree like function? Something that does something like this: http://gist.github.com/629404 |
| 00:33 | DanielGlauser | ,(reduce and (map (fn [bool] bool)) (true true true)) |
| 00:33 | clojurebot | java.lang.Exception: Can't take value of a macro: #'clojure.core/and |
| 00:35 | mabes | ,(every? true? [true true true]) |
| 00:35 | clojurebot | true |
| 00:36 | DanielGlauser | ,(reduce + (map (fn [n] n) [1 2 3])) |
| 00:36 | clojurebot | 6 |
| 00:36 | DanielGlauser | Thanks mabes, I'll try that instead |
| 00:37 | mabes | DanielGlauser: actually, that is probably not what you want.. |
| 00:37 | mabes | ,(true? 1) |
| 00:37 | clojurebot | false |
| 00:37 | mabes | ,(true? true) |
| 00:37 | clojurebot | true |
| 00:38 | mabes | unless you are only dealing with booleans.. |
| 00:39 | DanielGlauser | In this case I am so I believe the every? example will work for me |
| 00:39 | DanielGlauser | Is the issue with (reduce + ...) vs. (reduce and ...) that "and" is a macro? |
| 00:40 | mabes | DanielGlauser: correct |
| 00:43 | DanielGlauser | mabes: Great, that was easy. Plugged into a larger example and it works like a charm. |
| 00:44 | DanielGlauser | mabes: Is there an easy way to query a function to find out if it is a macro? |
| 00:45 | mabes | if you say (doc and) it will tell you it is a macro... |
| 00:45 | mabes | ,(doc and) |
| 00:45 | clojurebot | "([] [x] [x & next]); Evaluates exprs one at a time, from left to right. If a form returns logical false (nil or false), and returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expr. (and) returns true." |
| 00:45 | mabes | well, in the repl it will |
| 00:46 | mabes | I'm not sure if there is other wise.. it seems like it would be on the meta data of the var |
| 00:46 | mabes | sorry, I don't really know |
| 00:46 | DanielGlauser | No worries, thank for your help |
| 00:50 | maravillas_ | ,(:macro (meta #'and)) |
| 00:50 | clojurebot | true |
| 00:51 | maravillas_ | There may be a better way, though. |
| 00:52 | maravillas | oh, mabes already pointed that out :) |
| 00:56 | mabes | I guess with #'and you could pass that to reduce as well if you really wanted to |
| 00:57 | mabes | apply would make more sense though |
| 00:57 | mabes | ,(apply #'and [true 1 :foo]) |
| 00:57 | clojurebot | :foo |
| 01:10 | DanielGlauser | ,(reduce #'and (map (fn [bool] bool)) (true true true)) |
| 01:10 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$map |
| 01:11 | DanielGlauser | Oops, missed on the parens |
| 01:11 | DanielGlauser | ,(reduce #'and (map (fn [bool] bool) (true true true))) |
| 01:11 | clojurebot | java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn |
| 01:12 | tufflax | '(true true true) |
| 01:13 | zkim | Hey Dan, you coming to the meetup on wed? |
| 01:14 | DanielGlauser | zkim: It's good to see you here. Not likely, with a newborn I think I'd better stay closer to home. |
| 01:15 | zkim | DanielGlauser: ah yeah, priorities and all :) |
| 01:15 | DanielGlauser | tufflax: Thanks, the problem with lists... No wonder why Rich added vectors to the language |
| 01:15 | tufflax | :p |
| 01:15 | DanielGlauser | ,(reduce #'and (map (fn [bool] bool) [true true true])) |
| 01:15 | clojurebot | true |
| 01:15 | DanielGlauser | there we go |
| 01:16 | DanielGlauser | zkim: This has been my first chance to sneak off and do some coding. I feel a bit guilty. :) |
| 01:17 | maravillas | ,(reduce #'and (map (fn [bool] bool) [true true false])) |
| 01:17 | clojurebot | true |
| 01:17 | zkim | DanielGlauser: ah the siren's call of Clojure |
| 01:18 | DanielGlauser | zkim: Do you think anyone else will be in town to lead the meeting? |
| 01:19 | zkim | DanielGlauser: I think lee and ben are coming, I'll send you directions to post to the mailing list |
| 01:19 | G0SUB | ,(reduce #(assoc %1 %2 (inc (%1 %2 0))) {} [:a :a :b :b :b :c :d :e :e]) |
| 01:19 | clojurebot | {:e 2, :d 1, :c 1, :b 3, :a 2} |
| 01:19 | zkim | DanielGlauser: I've been putting it off trying to get ClojureDocs into beta before the conj |
| 01:20 | G0SUB | zkim: hey, are you the creator of ClojureDocs? |
| 01:20 | DanielGlauser | zkim: Roger that! Good luck with ClojureDocs. I'll ask Lee to lead the meeting and Ben/Tyler as backups. |
| 01:20 | zkim | G0SUB: yeah, anything I can help you with? |
| 01:21 | zkim | DanielGlauser: sounds good |
| 01:21 | G0SUB | zkim: Hi, can I PM you? |
| 01:21 | zkim | G0SUB: sure |
| 01:22 | mabes | ,(frequencies [:a :a :b :b :b :c :d :e :e]) |
| 01:22 | clojurebot | {:a 2, :b 3, :c 1, :d 1, :e 2} |
| 01:22 | mabes | ^ G0SUB fyi.. |
| 01:23 | G0SUB | mabes: yes, I am aware of that. thank you. I was just trying out clojurebot :) |
| 01:23 | mabes | am I wrong in thinking that `take` could be rewritten to use for instead of lazy-seq? |
| 01:25 | mabes | nm... |
| 01:29 | DanielGlauser | Seems like we could use a cookbook for idioms and functions... |
| 01:30 | zkim | DanielGlauser: yeah that would be really nice |
| 01:30 | zkim | DanielGlauser: maybe a future clojuredocs feature |
| 01:40 | Derander | DanielGlauser: it would be really really nice |
| 02:07 | defn | wow. strange loop was awesome. |
| 02:08 | defn | brian marick's TDD talk on clojure was cool, the cascalog talk was awesome, jim duey's conduit was really cool |
| 02:10 | zkim | defn: Yeah, was following the tweets, sounded like a great conf |
| 02:10 | defn | chouser's talk was awesome as well |
| 02:10 | zkim | defn: which testing lib did marick use? |
| 02:10 | defn | he wrote his own: midje |
| 02:10 | defn | if you use emacs lisp, check it out |
| 02:10 | defn | err emacs |
| 02:11 | zkim | defn: they gonna post any slides / videos? |
| 02:11 | defn | it was a pretty inexpensive ticket zkim |
| 02:11 | defn | so they only recorded some of it |
| 02:11 | zkim | ah |
| 02:12 | defn | there's some /amazing/ stuff |
| 02:12 | defn | a panel with alex payne, joshua bloch, douglas crockford, guy steele, and im forgetting the other guy |
| 02:12 | defn | about the future of programming languages |
| 02:12 | zkim | awesome |
| 02:13 | defn | douglas crockford's talk was hillarious at times, and deadly inspiring at others |
| 02:13 | defn | the nosql panel is also i think a must watch |
| 02:13 | defn | lots of pearls of wisdom there -- i have a lot of notes i need to convert to blog posts over the coming weeks |
| 02:13 | defn | @devn if you wanna know about them |
| 02:14 | zkim | yeah i'll check that out |
| 02:15 | zkim | hah 100k LOC for the mysql query parser |
| 02:16 | tufflax | What's happening here? |
| 02:16 | tufflax | ,(reduce #'and [true false]) |
| 02:16 | clojurebot | true |
| 02:18 | defn | zkim: yeah pretty amazing huh |
| 02:19 | defn | zkim: they were talking about how nosql databases have like...30k LoC for the entire package |
| 02:19 | hiredman | tufflax: and is not a function |
| 02:20 | tufflax | So why does it let me use it like that? |
| 02:20 | hiredman | because you are using the var #' |
| 02:20 | hiredman | clojure is not common lisp |
| 02:20 | hiredman | ,(reduce + (range 10)) |
| 02:20 | clojurebot | 45 |
| 02:20 | hiredman | no #' |
| 02:21 | zkim | ,(apply #'and [true false]) |
| 02:21 | clojurebot | true |
| 02:22 | hiredman | ,(macroexpand '#'and) |
| 02:22 | clojurebot | (var and) |
| 02:22 | hiredman | if you want to know what means read the docs |
| 02:23 | shachaf | Wait, Clojure is a Lisp_2? |
| 02:23 | hiredman | no |
| 02:23 | hiredman | lisp 1 |
| 02:23 | shachaf | Oh. |
| 02:23 | shachaf | Ah, I didn't read up far enough. |
| 02:24 | shachaf | zkim: Is that just the query parser or the optimizer too? |
| 02:24 | zkim | you mean hiredman? |
| 02:25 | shachaf | 23:14 < zkim> hah 100k LOC for the mysql query parser |
| 02:25 | zkim | ah |
| 02:25 | zkim | one sec |
| 02:25 | zkim | http://twitter.com/#!/devn/status/27459419878 |
| 02:25 | zkim | looks like just the parser |
| 02:26 | zkim | crazy |
| 02:27 | tufflax | Thanks hiredman, I'm gonna have to read more about clojure. For now my question is why doesn't reduce, apply, map, etc. allow macros as their first argument? |
| 02:27 | tufflax | don't* |
| 02:28 | hiredman | tufflax: because reduce is a function |
| 02:28 | shachaf | tufflax: How would that work? |
| 02:28 | hiredman | function application happens at run time |
| 02:28 | tufflax | shachaf hehe I'm not sure... |
| 02:28 | hiredman | macro expansion happens before compile time |
| 02:29 | tufflax | Ah, yes, ok... thank you again. |
| 03:05 | Derander | if I want to build a regex dynamically, how do I do this? |
| 03:05 | Derander | ,(macroexpand #"") |
| 03:05 | clojurebot | #"" |
| 03:06 | Derander | I can't just do #(str "foo" var) because then it gets all functiony on me |
| 03:07 | Derander | re-pattern! |
| 03:31 | Raynes | -> (class #"") |
| 03:31 | sexpbot | ⟹ java.util.regex.Pattern |
| 03:31 | Raynes | -> (re-pattern "") |
| 03:31 | sexpbot | ⟹ #"" |
| 03:31 | Raynes | -> (class re-pattern "") |
| 03:31 | sexpbot | java.lang.IllegalArgumentException: Wrong number of args (2) passed to: core$class |
| 03:31 | Raynes | -> (class (re-pattern "")) |
| 03:31 | sexpbot | ⟹ java.util.regex.Pattern |
| 03:32 | Raynes | Derander: re-pattern |
| 03:32 | Derander | yeah, I dug it up finally :-) |
| 03:32 | Derander | thank you though |
| 03:32 | Derander | I think what I really need to be using is an html/xml parsing library, though |
| 03:44 | kmc | #"" is a reader macro for regex literals? |
| 03:49 | G0SUB | kmc: yes. |
| 03:50 | G0SUB | kmc: #"[a-zA-Z0-9]+" |
| 06:26 | fhd | Hi. What's the best way to convert a struct to a map? |
| 07:07 | raek | fhd: a struct is a map |
| 07:08 | raek | you can always assoc on other keys than the special keys |
| 07:10 | raek | but to get a map of another type (hash-map, sorted-map, struct, record), you can use into |
| 07:11 | raek | ,(let [m (into {} (sorted-map :a 1, :b 2, :c 3))] [(class m) m]) |
| 07:11 | clojurebot | [clojure.lang.PersistentArrayMap {:a 1, :b 2, :c 3}] |
| 07:11 | raek | ,(let [m (into (hash-map) (sorted-map :a 1, :b 2, :c 3))] [(class m) m]) |
| 07:11 | clojurebot | [clojure.lang.PersistentArrayMap {:a 1, :b 2, :c 3}] |
| 07:12 | raek | hrm, yeah. small hash-maps use the array-map implementation... |
| 07:18 | fhd | raek: I see, thanks :) I actually tried that, but there was another issue so I misinterpreted the exception :( |
| 07:21 | fhd | What's the most common name to name a Clojure port of a library x? clojure-x, clj-x, x-clojure, x-clj or make something up that starts with "clo" like clox? |
| 07:21 | fhd | Looking at clojars.org, it seems to be clojure-x |
| 07:23 | jaley | hey guys - is it possible/easy to pass a collection to a function as its argument list vector without a macro? i.e. the same effect as an unquote splice. |
| 07:24 | jaley | for context, i want to pass an argument list to shell/sh |
| 07:25 | carkh | ,(apply + [1 2 3]) |
| 07:25 | clojurebot | 6 |
| 07:26 | jaley | but won't that call + multiple times? |
| 07:26 | G0SUB | carkh: use reduce instead. |
| 07:26 | jaley | sh has side effects - it calls the command i'm passing it |
| 07:26 | carkh | nope |
| 07:26 | G0SUB | carkh: better perf. |
| 07:26 | jaley | ah ok, cool thanks |
| 07:26 | carkh | G0SUB: i was answering jaley's question |
| 07:26 | G0SUB | jaley: (reduce + [1 2 3]) |
| 07:27 | carkh | reduce will call + several times |
| 07:27 | G0SUB | carkh: sure. apply it is then. |
| 07:27 | G0SUB | carkh: take a look at the definition of the + function. |
| 07:27 | jaley | G0SUB: carkh: yeah got it, thanks guys |
| 07:27 | carkh | well yeah it depends on the function you call =P |
| 07:27 | carkh | buit it's not a property of apply to do so |
| 07:27 | G0SUB | carkh: :) |
| 07:28 | G0SUB | carkh: my statements are only valid for the combined usage of apply and +. |
| 07:28 | carkh | right |
| 07:28 | carkh | but (+ 1 2 3 4 5 6) does call + several times |
| 07:28 | carkh | and there's no apply |
| 07:28 | G0SUB | carkh: precisely. |
| 07:28 | carkh | i can nitpick too ! |
| 07:29 | G0SUB | carkh: you are right! |
| 07:29 | carkh | =) |
| 08:01 | raichoo | Hi, is there a good pdf on clojure you guys can recommend? |
| 08:06 | lypanov | raichoo: i love joy of clojure. |
| 08:06 | raichoo | huh? |
| 08:06 | lypanov | but not free. dunno any good free ones. plenty of presentations tho |
| 08:07 | lypanov | the first chapter of the various ebooks is usually available for free. |
| 08:07 | raichoo | ah ok. ^^. I'm actually just searching for an offline reference to peek a little into the language. |
| 08:07 | lypanov | for device good at pdfs? |
| 08:08 | lypanov | if not, i'd say just wget the site or gen the documentation yourself. |
| 08:08 | AWizzArd | raichoo: you can download the manual (html) and code for offline fun. |
| 08:08 | lypanov | clojuredocs.org is great |
| 08:10 | lypanov | anyone bored, please upvote http://clojuredocs.uservoice.com/forums/64757-general/suggestions/896859-provide-a-way-to-create-and-be-able-to-synchronis?ref=title |
| 08:11 | raichoo | Usually I don't need offline references, but my new apartment still lacks an internet connection :/ |
| 08:11 | fhd | I'm still not sure what to call my Clojure mustache library: clojure-mustache, clj-mustache or clostache? What'd you suggest? |
| 08:11 | lypanov | yay! |
| 08:11 | lypanov | fhd: library-lypanov-needed |
| 08:11 | fhd | lypanov: :P |
| 08:11 | lypanov | clostache is cute |
| 08:12 | fhd | Hm, I like it too. Not sure if it sounds silly :P |
| 08:13 | lypanov | tache is british slang for mustache... so yeah.. to me sounds completely normal |
| 08:13 | fhd | Cool, then I'll take it :) |
| 08:14 | fhd | lypanov: Do you still need the lib? I'm finished with version 0.1, although it doesn't support all of mustache |
| 08:14 | fhd | lypanov: I'm ATM in the middle of extracting it from my project |
| 08:16 | raek | fhd: fyi, there is a pretty widely known Clojure web lib called "Moustache", so I would vote for the "clostache" name. also, it sounds funnier. :) |
| 08:17 | fhd | raek: Yeah that's true, the moustache lib got my hopes up that I wouldn't have to do this :) |
| 08:17 | clojurebot | libraries is http://clojure.org/libraries |
| 08:17 | lypanov | fhd: ditto :( |
| 08:18 | raek | what is mustache for, btw? |
| 08:18 | fhd | raek: It's a template language |
| 08:18 | lypanov | like enlive but super simple |
| 08:18 | fhd | http://mustache.github.org |
| 08:19 | fhd | I wanted to use the mustache.java, a Java library, but it made me sick :P |
| 08:19 | lypanov | ;) its pretty neat tho |
| 08:19 | raek | neat. |
| 08:19 | lypanov | i'd love something like that but in clojure |
| 08:20 | raichoo | I just downloaded the wiki, seems like a good start to dive into the language :) |
| 08:20 | raichoo | well actually just one page. |
| 08:21 | raek | some parts of the wikibook is somewhat outdated |
| 08:22 | raek | outdated, as in "out of fassion, due to recent additions", rather than "not working" |
| 08:23 | raichoo | I just need a little bit to get a hold of the way of thinking in clojure. I'm learning way to many languages this year anyway. As long as it covers the basics I'm happy ^^ |
| 08:25 | jaley | should i need to add leiningen as a dependency in my project if I want to use some functions in leiningen.compile? the guidance for making plugins says not, but the jar is definitely not on my classpath :-s |
| 08:26 | raek | hrm, ok. the wikibook seems to have been updated with links to the newer getting-started pages |
| 08:26 | raek | wow. there's really *a lot* of text about the basics... |
| 08:28 | raek | jaley: plugins are ran in the lein clojure instance, which already has all the lein things on the classpath |
| 08:28 | raek | to access lein code in the project clojure instance, you'd have to add a dependency |
| 08:30 | raek | I haven't tried this, but I guess you could add [leiningen "1.3.1"] as a dep |
| 08:31 | raek | jaley: and the things your code does cannot be made as a leinginen plugin? |
| 08:31 | raek | (you don't need to make a separate project for the plugin. a file in src/leiningen/my_plugin.clj is sufficient.) |
| 08:34 | jaley | raek: my code is a leiningen plug-in, and it is within an existing project |
| 08:35 | jaley | raek: but it might be useful to others... so when (if..) it works i'll break it out to a seperate project and stick it on clojars probably |
| 08:35 | raek | then you should be able to run it with "lein my-plugin" |
| 08:36 | jaley | raek: the problem isn't running it actually, it's that i want to launch a sub-process with the project classpath settings |
| 08:36 | jaley | raek: leiningen.compile has a function, eval-in-project, which looks like it might work |
| 08:37 | raek | the lein swank plugin does something like that |
| 08:37 | raek | and lein repl, of course |
| 08:37 | jaley | raek: yeah it uses eval-in-project, that was hour i found it actually :) |
| 08:38 | jaley | raek: my problem is (use leiningen.compile) fails, no such class ...__init |
| 08:38 | jaley | raek: and i'm wondering if to fix that i have to ignore the advice about not marking leiningen as a dependency |
| 08:39 | raek | jaley: (use 'leiningen.compile) |
| 08:39 | raek | oh, but you shouldn't get the "no such class ...__init" error for that... |
| 08:39 | jaley | raek: sorry, that was a typing error |
| 08:40 | jaley | raek: it actually looks like (ns leiningen.axis (:use [leiningen.classpath :only [get-classpath]])) |
| 08:41 | jaley | raek: same error as with compile, i mean |
| 08:41 | jaley | raek: pretty sure this is what happens when the jar isn't on the classpath, right? |
| 08:42 | raek | yes, that error looks like a classpath error or a spelling error |
| 08:42 | jaley | hmm ok, i'll try adding it to dev-dependencies and see what happens |
| 08:44 | raek | jaley: http://gist.github.com/629745 this works for me |
| 08:44 | raek | no extras in project.clj |
| 08:44 | raek | also, there is a compile var in clojure.core, so you might want to require it or use+rename it instead |
| 08:45 | raek | it = leinginen.compile/compile |
| 08:45 | raek | lein foo => hello |
| 08:45 | jaley | it's leiningen.compile/eval-in-project i'm after |
| 08:46 | raek | oh. right. |
| 08:47 | jaley | yeah I pasted your gist into my repl and got the same error |
| 08:47 | raek | you cannot run it from the repl |
| 08:47 | raek | it is meant to be ran from "lein ..." |
| 08:47 | raek | since leiningen and you project might run on different clojure versions |
| 08:49 | raek | sorry, maybe I misunderstood the issue. you could try adding lein as a dependency and that should probably work |
| 08:49 | AWizzArd | When I have an EPL source, then I can not use GPL libs in it, cause EPL forces me to keep derivative work under the EPL, while GPL says it must be GPL. But is the other direction possible? When I have a GPLed program, can I then include EPLed code in it, for example linking libs like Clojure? |
| 08:49 | raek | but it isn't the way you usually make a lein plugin |
| 08:50 | jaley | raek: ah right. so I can't really develop a leiningen plug-in with swank easily? |
| 08:51 | raek | AWizzArd: GPL basically says that a project is a derivative work if it includes the GPL:ed code in the program code (including, using a GPL:ed library) |
| 08:51 | raek | and derivative works has to be under GPL, or something GPL-compatible |
| 08:52 | carkh | i thinkk the other way around is ok |
| 08:52 | raek | EPL says that a program that merely uses a EPL library is not derivative work of it |
| 08:52 | AWizzArd | Yes. |
| 08:52 | AWizzArd | So, using GPL stuff in my EPL code is no option. |
| 08:52 | carkh | so you can make a gpl program using clojure |
| 08:52 | AWizzArd | This is the point, that carkh mentions. |
| 08:53 | raek | so EPL code + GPL code is not possible, because of GPL's definition of derivative work |
| 08:53 | AWizzArd | right |
| 08:53 | AWizzArd | I agree with this. |
| 08:53 | raek | if I have understood this correctly |
| 08:53 | carkh | and yes, you cannot make an EPL program using GNU readline |
| 08:53 | AWizzArd | But GPL linking in EPL sounds okay. |
| 08:53 | AWizzArd | carkh: clisp :-) |
| 08:53 | carkh | =) |
| 08:54 | raek | GPL does not treat linking and modifications as separate things |
| 08:54 | raek | but the LGPL does |
| 08:54 | AWizzArd | And what is the difference between LGPL and the OpenJDK’s GPL+Linking Excetpion? |
| 08:55 | raek | I'm not aware of the latter |
| 08:55 | AWizzArd | The OpenJDK is GPLed, but it makes a linking exception. That is, programs that you wrote using the OpenJDK can be licenced as you wish, I think. |
| 08:56 | G0SUB | AWizzArd: basically it's an exception which applies to linked .class files. |
| 08:56 | G0SUB | AWizzArd: so using external java libs is OK. |
| 08:56 | raek | that sounds very much like the goal of LGPL |
| 08:56 | G0SUB | raek: yes, but made clearer in the context of java code. |
| 08:56 | AWizzArd | Funny that software experts today also need to be specialists in law :-) |
| 08:57 | G0SUB | there are many such exceptions, font exceptions are an example. |
| 08:57 | carkh | thanks to dear gpl =/ |
| 08:57 | AWizzArd | Or Open Office dictionary files, which are GPL and not distributed with OO. One manually has to download them. |
| 08:58 | AWizzArd | G0SUB: oh really, nice. |
| 08:58 | G0SUB | people fail to understand the importance of GPL... they think it's a virus. |
| 08:59 | carkh | G0SUB: so do you still support the FSF views ? (everything should be gpl) |
| 08:59 | carkh | it was important to get the open source movement started i think |
| 08:59 | AWizzArd | EPL also survives. |
| 08:59 | carkh | but gpl is so restrictive =/ |
| 08:59 | AWizzArd | It does not infect other modules, but won't die. |
| 08:59 | G0SUB | carkh: they have a strict stance because they have to. |
| 08:59 | carkh | and finally profiting mainly to big corporations |
| 09:00 | G0SUB | why on earth did Linux (the kernel) succeed when it was far inferior to *BSD back in the day? |
| 09:00 | G0SUB | why does Linux (the kernel) have so many awesome drivers? |
| 09:00 | carkh | why ? |
| 09:00 | lypanov | pragmatism |
| 09:01 | fhd | lypanov: I second that :) |
| 09:01 | carkh | wasn't it because it was selected as a base to the GNU ? |
| 09:01 | G0SUB | carkh: because many big corps (who otherwise would have leeched off linux) were forced to contribute their fixes back to linux. |
| 09:01 | raek | G0SUB: so, what holds about GPL + EPL? is it always impossible? |
| 09:01 | lypanov | it was just hard work on the part of the linux devels. nothing else. |
| 09:01 | G0SUB | carkh: not at all. there was no such official decision. |
| 09:01 | fhd | Pragmatism is pretty much the reason why Linux succeeded and Hurd is being rewritten again right now |
| 09:02 | G0SUB | fhd: it's linux vs freebsd not hurd |
| 09:02 | fhd | G0SUB: Yeah, but I had to mention Hurd today :) |
| 09:02 | G0SUB | fhd: heh. |
| 09:02 | lypanov | fhd: the hurd guys don't have time to code, they have to prune their beards. |
| 09:02 | fhd | G0SUB: Nah, I actually saw it as Linux VS GNU while idling |
| 09:02 | tensorpudding | FreeBSD and NetBSD had to be practically rewritten at the same time that Linux was getting popular |
| 09:02 | carkh | as a programmer (small freelance) i can't see how i would survive in a fully GPL world |
| 09:03 | G0SUB | fhd: rms has given up on hurd now and I agree with the decision. |
| 09:03 | G0SUB | carkh: you don't have to. just thank $deity that GPL is an option. |
| 09:03 | AWizzArd | G0SUB: so, what if I have a GPL program and want to use clojure.jar in it? Is this allowed? |
| 09:03 | G0SUB | carkh: don't use GPL if you don't like it, just don't spread the FUD. |
| 09:04 | fhd | Funny that you guys are discussing this right now, I was just wondering which license would be most appropriate for a Clojure lib. I usually go with LGPL |
| 09:04 | carkh | well i do thank deity that GPL exists, as i said it was instrumental |
| 09:04 | lypanov | fhd: net bsd every time. |
| 09:04 | lypanov | new* sorry |
| 09:04 | lypanov | (or better dual it) |
| 09:05 | carkh | i think rhickey made a very good decision going with EPL |
| 09:05 | lpetit | fhd: clojure's world is EPL's world :) |
| 09:05 | lypanov | thank $deity for clang and the death of gcc |
| 09:05 | G0SUB | AWizzArd: EPL would allow that. |
| 09:05 | fhd | carkh: http://github.com/clojure/clojure says its ASM |
| 09:06 | AWizzArd | Yes. The EPL seems to have no problems in being linked into a GPL projekt. So, from that perspective it sounds as if I may write GPLed clojure programs. |
| 09:06 | lypanov | fhd: it uses ASM |
| 09:06 | G0SUB | lypanov: I wouldn't say that. clang is owned by AAPL. |
| 09:06 | lypanov | oh get lost |
| 09:06 | AWizzArd | But I am not sure if there is something in the GPL that stops me from using clojure.jar and thus stop me from doing GPL clojure software. |
| 09:07 | G0SUB | lypanov: feel free... |
| 09:07 | lypanov | freaking bearded idiots. |
| 09:07 | G0SUB | lypanov: I just have a moustache. |
| 09:08 | G0SUB | when rms wrote about the Java Trap a few years back, people laughed at him. today all Java programmers are crapping their pants. |
| 09:08 | carkh | hum no |
| 09:08 | G0SUB | AWizzArd: please email licensing@fsf.org with your query. the fsf will answer. |
| 09:08 | lypanov | AWizzArd: i'd limit to apps if you use gpl. |
| 09:08 | fhd | lypanov: Beards are pretty essential actually http://bit.ly/3NwOp |
| 09:09 | G0SUB | fhd: in that case, rhickey needs to grow one (granted that he has some nice hairstyle) |
| 09:09 | lypanov | fhd: love this one. |
| 09:09 | AWizzArd | G0SUB: okay |
| 09:09 | lypanov | fhd: especially matz who grew a beard at one point :D |
| 09:10 | AWizzArd | lypanov: what do you mean by that? |
| 09:11 | lypanov | AWizzArd: unless there is a good reason i'd go with something more bsd like for libraries in general |
| 09:11 | fhd | G0SUB: The beard of the inventor of Lisp was so vast that Clojure probably inherited lots of positive energy http://bit.ly/9tL2B6 |
| 09:11 | G0SUB | fhd: +1 |
| 09:11 | lypanov | plenty of companies obviously can't touch gpl'ed code |
| 09:11 | AWizzArd | lypanov: I will EPL my Clojure libs. But I would like to know if it was possible in principle. |
| 09:11 | G0SUB | AWizzArd: see, it all depends on your lib. |
| 09:12 | AWizzArd | IF someone asks me about a GPL licence of my lib, I might do this. |
| 09:12 | lypanov | nothing wrong with dual licensing epl and gpl afaiu |
| 09:12 | G0SUB | AWizzArd: if you want widespread adoption and don't want to benefit directly from the code (but mostly from services, fame, etc.) use a very permissive license. |
| 09:12 | lypanov | (i'm very pro that) |
| 09:12 | G0SUB | AWizzArd: on the other hand, if you are creating something big and you want outside cooperation, use GPL. |
| 09:13 | AWizzArd | Yes. |
| 09:13 | carkh | well clojure has plenty cooperation with epl |
| 09:13 | carkh | eclipse does too =) |
| 09:13 | AWizzArd | Git and Mercurial are GPL. Seems okay. Though it is not clear to me how there can be a java implementation of Git *not* being gpl. |
| 09:13 | G0SUB | carkh: cooperation from companies? |
| 09:13 | AWizzArd | But most programming language implementations are not GPL. |
| 09:13 | carkh | well eclipse does yes |
| 09:14 | G0SUB | carkh: who would otherwise, steal, modify and ship? |
| 09:14 | G0SUB | AWizzArd: languages, standards, need not be gpl. simple BSD works too. |
| 09:14 | carkh | you can't steal modify ship epl |
| 09:14 | AWizzArd | Yeah, though most have something different than bsd. |
| 09:18 | raek | AWizzArd: I remember that I have seen rhickey talking about Clojure and GPL in the Clojure logs (http://clojure-log.n01se.net/) |
| 09:18 | G0SUB | carkh: does EPL mention anything about derivative works? (I can't remember) |
| 09:18 | AWizzArd | derivative works need to be EPLed |
| 09:18 | AWizzArd | The definition of what is “derivative” is different though. |
| 09:18 | AWizzArd | Linking/Using EPLed libs is not derivative. |
| 09:19 | G0SUB | AWizzArd: that's a form of ``weak copyleft''. |
| 09:19 | AWizzArd | Yes. |
| 09:19 | G0SUB | AWizzArd: which is OK for Clojure. |
| 09:19 | raek | G0SUB: the EPL does. it excplicitly says that it doesn't consider mere linking with code as derivative work |
| 09:19 | raek | *looks for link* |
| 09:20 | AWizzArd | Btw, does "linking" also include: creating an Überjar? |
| 09:20 | raek | http://www.eclipse.org/legal/eplfaq.php#DERIV |
| 09:20 | raek | "Some open source software communities specify what they mean by a "derivative work". Does the Eclipse Foundation have a position on this?" |
| 09:20 | AWizzArd | For example, may I include clojure.jar in my commercialXYZ.jar? |
| 09:20 | AWizzArd | Or is that not linking and thus forces me to EPL my code? |
| 09:20 | G0SUB | AWizzArd: as long as you tell people how to get the source of clojure.jar |
| 09:21 | carkh | AWizzArd: well that's the kind of linking that doesn't infect your code |
| 09:21 | raek | from the EPL itself: "Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program." |
| 09:21 | AWizzArd | One other option would be to *not* include clojure.jar in my source code and have it in the CP at my customer’s site. |
| 09:21 | carkh | AWizzArd: you don't need to do that |
| 09:21 | AWizzArd | ok |
| 09:23 | G0SUB | bottom-line, EPL for Clojure the language is OK. If you are building FOSS apps using Clojure, choose the license that suites you. EPL doesn't restrict you as long as you are not modifying clojure itself. |
| 09:23 | AWizzArd | Right. |
| 09:23 | AWizzArd | Even *if* I would modify clojure itself, I would only have to EPL those concrete changes. |
| 09:24 | G0SUB | AWizzArd: yes. |
| 09:24 | AWizzArd | The rest of my code can still be under licence XYZ. |
| 09:24 | raek | enough about licenses for me. time to write some code! :-) |
| 09:24 | fhd | So a Clojure lib under LGPL is fine? |
| 09:24 | fhd | raek: Sorry :P |
| 09:24 | G0SUB | fhd: I guess so. |
| 09:25 | fhd | k. It's pretty permissive, but IANAL |
| 09:25 | G0SUB | fhd: to be 100% sure, email licensing@fsf.org |
| 09:25 | jaley | fhd: dude i work for an open source foundation - we're told including LGPL code with our otherwise EPL codebase is fine by our legal team. maybe that helps you? :p |
| 09:25 | G0SUB | jaley: +1 |
| 09:25 | fhd | jaley: Does :) |
| 09:26 | fhd | I just don't want people having to consult a lawyer if they want to use my code |
| 09:26 | G0SUB | fhd: don't worry too much. most of it is FUD anyway. |
| 09:27 | jaley | fhd: people with enough money to do that will do so anyway for fear of losing it :) |
| 09:52 | jaley | when i run a java process from clojure.java.shell/sh there's a huuuuge delay in waiting for the process to terminate for some reason |
| 10:01 | carkh | jaley: maybe you have soem agetn still running ? |
| 10:01 | carkh | or a daemon thread ? |
| 10:10 | fhd | Do you guys know Polyglot Maven btw? I can't wait for it :) http://polyglot.sonatype.org/clojure.html |
| 10:11 | jaley | carkh: well, i'm just calling the function, but maybe there is somewhere |
| 10:22 | Bahman | Hi all! |
| 10:51 | lypanov | fhd: ah, neat. |
| 10:51 | lypanov | fhd: (polyglot maven) |
| 10:54 | cemerick | fhd: yup, it's been percolating for a year or so. |
| 11:14 | KLKLL | I have a question |
| 11:15 | KLKLL | if I do something like |
| 11:15 | KLKLL | (defn somefn [xlist] (fn [t] (nth xlist t))) |
| 11:16 | KLKLL | does the list I supply as a parameter get inserted into the returned function as an actual data structure? |
| 11:16 | cemerick | yup |
| 11:16 | KLKLL | so if I have a list 1 million elements long |
| 11:16 | KLKLL | I get a really longass fn |
| 11:17 | cemerick | a reference to the list is retained...it's not literally inserted |
| 11:17 | cemerick | might as well just do (partial nth xlist) though |
| 11:17 | KLKLL | ,(doc partial) |
| 11:17 | clojurebot | "([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & more]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args." |
| 11:17 | KLKLL | is partial any different to what I am doing |
| 11:17 | Raynes | -> ((partial + 3) 4) |
| 11:17 | sexpbot | ⟹ 7 |
| 11:18 | cemerick | no, but it's more general and simpler than having your dedicated somefn function |
| 11:18 | KLKLL | right...ok so a reference is passed in? |
| 11:18 | Raynes | Unless you're using somefn in several places, anyway. |
| 11:19 | cemerick | KLKLL: Yes. |
| 11:19 | KLKLL | I'm asking like if I am using partial with a really long list to create new fns am I burning memory like nuts with it? |
| 11:19 | cemerick | if the list is already allocated, no |
| 11:20 | KLKLL | cool |
| 11:20 | cemerick | ,((partial nth (range Integer/MAX_VALUE)) 5000) |
| 11:20 | clojurebot | 5000 |
| 11:20 | KLKLL | I thought clojure actually copied the list into the returned fn as a data structure so I was worried :) |
| 11:21 | cemerick | That would require a macro |
| 11:24 | KLKLL | I'm trying to make a repeat function but one that takes multiple arguments :) |
| 11:25 | tomoj | what does it do, cycle through infinitely? |
| 11:25 | KLKLL | yep |
| 11:25 | tomoj | don't want to spoil your fun |
| 11:26 | tomoj | ,(take 10 (cycle [1 2 3])) |
| 11:26 | clojurebot | (1 2 3 1 2 3 1 2 3 1) |
| 11:26 | KLKLL | ok :) |
| 11:26 | KLKLL | well I'm learning clojure :) |
| 11:26 | tomoj | even if that does what you want, still probably good to try to rewrite it yourself |
| 11:26 | KLKLL | so I have to do these little things |
| 11:27 | KLKLL | so basically I have to use a vector to prevent having terrible performance on nth |
| 11:27 | cemerick | lists are very rarely used |
| 11:27 | cemerick | and nth is unnecessary with vectors |
| 11:27 | KLKLL | really? |
| 11:28 | KLKLL | what do you use with vectors |
| 11:28 | cemerick | ,([1 2 3] 1) |
| 11:28 | clojurebot | 2 |
| 11:28 | KLKLL | ok |
| 11:28 | KLKLL | thx |
| 11:28 | cemerick | Vectors are fns of their indexes. |
| 11:28 | KLKLL | forgot about that |
| 11:28 | cemerick | Just like maps are fns of their keys |
| 11:28 | KLKLL | but what do I do if I have this param list |
| 11:28 | KLKLL | [x & others] |
| 11:29 | KLKLL | others is a sequence I think |
| 11:29 | cemerick | `others` is a seq, yes |
| 11:29 | KLKLL | which probably have terrible performance on nth |
| 11:29 | KLKLL | so I have to convert it to vector I guess |
| 11:29 | cemerick | if what you want from it is in a fixed position, just destructure it |
| 11:29 | cemerick | [x & [a b c & rest]] |
| 11:30 | KLKLL | isn't descturcturing slow too? |
| 11:30 | cemerick | nah |
| 11:30 | KLKLL | btw it's funny how java varargs are packed into a fast structure like an array |
| 11:30 | lpetit | did the policy of the n01se.net clojure logs change recently ? |
| 11:30 | lpetit | I cannot get access to past days logs anymore ... |
| 11:30 | cemerick | There are *very* limited circumstances where destructuring is the bottleneck. It's not worth worrying about. |
| 11:31 | cemerick | lpetit: ping chouser, I'm sure it's a bug |
| 11:32 | lpetit | cemerick: ok. Is yesterday's chat concerning defdynamic summarizable in one or two sentences ? |
| 11:35 | KLKLL | ,(vec (seq '(1 2 3))) |
| 11:35 | clojurebot | [1 2 3] |
| 11:35 | KLKLL | ok that works |
| 11:35 | cemerick | lpetit: def becomes static by default, dynamic rebinding only provided by defdynamic vars, scoped var root substitution available and complete redefinition still available. |
| 11:35 | cemerick | ,(vec '(1 2 3)) |
| 11:35 | clojurebot | [1 2 3] |
| 11:35 | KLKLL | I was trying to see if it works with sequences |
| 11:35 | cemerick | ah |
| 11:35 | KLKLL | not just lists |
| 11:36 | KLKLL | this clojure cheat sheet has it wrong then |
| 11:36 | G0SUB | is there any decent explanation of Pods somewhere in the tubes? |
| 11:36 | cemerick | link? |
| 11:36 | clojurebot | your link is dead |
| 11:36 | KLKLL | vec [coll] Creates new vector from another collection. |
| 11:36 | lpetit | "scoped var root substitution available" : this part I missed. Don't totally understand what it is. |
| 11:36 | KLKLL | clrearly it works with seq too |
| 11:36 | lpetit | is it for defdynamic only ? |
| 11:37 | KLKLL | http://faustus.webatu.com/clj-quick-ref.html#vector |
| 11:37 | cemerick | KLKLL: "collection" and "seq" are often interchangeable terms. |
| 11:37 | cemerick | At least in common parlance. |
| 11:38 | Raynes | And a list actually is a sequence. |
| 11:38 | lpetit | Does this change mean that trying to do "AOP-like" stuff (e.g. dynamically enhancing some vars for timing stats & al will become harder ?) |
| 11:38 | KLKLL | I know list is a sequence |
| 11:38 | cemerick | lpetit: AFAICT, think of it as alter-var-root that is reverted outside of a delimited scope. with-open-esque |
| 11:38 | KLKLL | but sequence does not implement all functionality of a collection |
| 11:39 | KLKLL | hence my assumption that is function works with collections that it doesn't work with sequences |
| 11:39 | cemerick | KLKLL: seqs *are* collections |
| 11:39 | KLKLL | really? |
| 11:39 | lpetit | cemerick: hmm, okay ... will need to read that confluence page again ... thanks! |
| 11:40 | cemerick | ,(instance? clojure.lang.IPersistentCollection (seq [1 2 3])) |
| 11:40 | clojurebot | true |
| 11:40 | KLKLL | ok got that wrong then |
| 11:40 | KLKLL | thanks for clearing that up for me |
| 11:41 | cemerick | lpetit: timing stats and such should be done with the JVM profiler, not through providing advice. |
| 11:41 | lpetit | cemerick: heh, was just a quick example out of my head |
| 11:41 | cemerick | I know :-) |
| 11:42 | cemerick | I actually don't think dynamically-bound vars have very many good use cases. |
| 11:42 | technomancy | seems like with-var-root covers most of the extensibility jobs that binding has handled so far. |
| 11:42 | lpetit | but I can see plenty of reasons why doing AOP-like stuff by rebinding vars can lead to problems in big projects, though |
| 11:42 | aav | lpetit |
| 11:43 | lpetit | aav: aav |
| 11:43 | lpetit | :) |
| 11:43 | cemerick | I suspect the first utility to come around will be a fn that will redef all static vars as dynamic ones. |
| 11:43 | technomancy | for the record, everyone going to conj should install http://github.com/toolmantim/bananajour in case the network gets choppy. |
| 11:43 | lpetit | bananajour ? |
| 11:43 | technomancy | cemerick: heh; well if it's anything like static fns that will also necessitate a recompile of all code that uses the var, so I don't think it'd be that simple. =\ |
| 11:44 | technomancy | lpetit: for publishing and broadcasting your local git repos over bonjour/zeroconf |
| 11:44 | technomancy | so you don't have to rely on an external network |
| 11:44 | cemerick | technomancy: source metadata! :-P |
| 11:44 | KLKLL | what's the difference between dynamic and static bound vars? |
| 11:44 | KLKLL | btw finished my function :P |
| 11:44 | technomancy | cemerick: you mean like serializable-fn? |
| 11:45 | cemerick | KLKLL: that's crazy bleeding-edge dev -- don't worry about it yet :-) |
| 11:45 | technomancy | I would love to see that in Clojure itself as an optional feature |
| 11:46 | technomancy | http://github.com/Seajure/serializable-fn |
| 11:46 | lpetit | cemerick, technomancy: maybe not source metadata on fns, but at least on vars (at least) |
| 11:46 | cemerick | technomancy: nah, just reloading defs as necessary from source as necessary via :file and :line metadata. |
| 11:46 | cemerick | *way* too much work, and it probably wouldn't pan out anyway |
| 11:46 | lpetit | :) |
| 11:46 | technomancy | slime already has a "who-calls" function, but it's naieve |
| 11:47 | technomancy | *swank |
| 11:47 | dentrado | Hello. If I have multiple threads that should write messages to the same output streams (that are values in a map), what's the best way to make shure that their output won't be mixed. Could I commute the writes if the map is in a ref? or can I do something equivalent to javas synchronized block? |
| 11:47 | technomancy | dentrado: you can serialize writes through an agent |
| 11:48 | cemerick | dentrado: `locking` will do you nicely |
| 11:48 | technomancy | (let [a (agent (writer "/tmp/foo"))] (future (send a #(do (.write % "blah blah blah") %)))) |
| 11:48 | cemerick | I dislike lifting IO into agents. The error handling isn't fun. |
| 11:49 | technomancy | true |
| 11:49 | KLKLL | ,(defn repeat2 [& coll] ((fn rep2 [n vect] (lazy-seq (cons (vect n) (if (= (inc n) (count vect)) (rep2 0 vect) (rep2 (inc n) vect))))) 0 (vec coll))) |
| 11:49 | clojurebot | DENIED |
| 11:49 | KLKLL | oh lol can't do that :P |
| 11:49 | technomancy | I haven't looked into the improved error queues in 1.2 though |
| 11:49 | lpetit | technomancy: noob question ('cause I'm not so much used to attend confs) = where/when would the feature of sharing a local git repo be interesting ? I need to understand the "use cases" (sorry ;) ) |
| 11:49 | cemerick | hrm, same here |
| 11:49 | cemerick | Regardless, if you want to serialize access to something like a stream, locking is hard to beat. |
| 11:49 | technomancy | lpetit: at bigger confs the wifi is often pretty unusable due to saturation |
| 11:50 | technomancy | so if you want to share without being able to push/pull from github for conference hackfests this is quite handy. |
| 11:50 | KLKLL | doesn't let me showcase my beautiful new repeat function :( :D |
| 11:50 | technomancy | maybe it won't be an issue at the conj; it's pretty small. |
| 11:50 | cemerick | If we can get people to shut off their phone wifi, I think we'll be OK. |
| 11:50 | lpetit | technomancy: ok, but I don't see why I would miss wifi, or how a github repo in an adhoc wifi of one of my mate will make me suffer less to not have wifi :) |
| 11:50 | dentrado | Ok so locking is like synchronized? |
| 11:51 | cemerick | dentrado: exactly the same thing |
| 11:51 | technomancy | lpetit: err--I should say it's not the wifi that's saturated but rather the upstream Internet connection. |
| 11:51 | lpetit | mm, it's probably the notion of "hackfest" that I don't get yet :) |
| 11:51 | KLKLL | synchronized ties a lock to an object |
| 11:51 | KLKLL | a monitor basically |
| 11:52 | cemerick | dentrado: to be used with judicious caution. Serializing access to streams is the only reliable use case I have for it. |
| 11:52 | technomancy | lpetit: I'm going to have a bonjour git URL in my slides so people can try the stuff I'm demoing on their own machine and see how it's implemented. |
| 11:52 | KLKLL | I did a paper on STM for my bachelor's degree |
| 11:52 | technomancy | lpetit: but yeah, half the fun of a conference like this is getting together and banging out some code. |
| 11:52 | KLKLL | also covered problems with locks :P |
| 11:52 | cemerick | KLKLL: you're in the right place, then :-) |
| 11:53 | KLKLL | :D |
| 11:53 | KLKLL | there's a bunch of otehr STMs too :D |
| 11:53 | technomancy | cemerick: are there any tools to serve maven repos over bonjour? |
| 11:53 | cemerick | Man, I've never once written a single line of code at a conf. |
| 11:53 | lpetit | technomancy: interesting. So if my english is too slooow, people can always play with my repo while I'm searching the words for my next sentence :-D |
| 11:53 | cemerick | technomancy: I have no idea. |
| 11:53 | KLKLL | every major player's research team has one |
| 11:53 | lpetit | technomancy: half the fun of this conference (for me) will be to survive to it :) |
| 11:53 | KLKLL | intel, microsoft, sun have their own STms |
| 11:54 | technomancy | actually... I looked into it, and there's not really a good zeroconf implementation on the JVM =\ |
| 11:54 | cemerick | KLKLL: sure, but I don't care about other impls that much ;-) |
| 11:54 | KLKLL | :D |
| 11:54 | technomancy | last I checked anyway. shame since it'd be very useful on dalvik. |
| 11:54 | lpetit | and try not to sleep during my own talk, since my body will tell me "hey, it's past midnight, you should be sleeping" :) |
| 11:55 | technomancy | though activeMQ claims to be able to use it. |
| 11:55 | cemerick | "dalvik is not Java" :-P |
| 11:55 | dentrado | Ok, thanks alot for the quick help, I will try with locking then. |
| 11:56 | KLKLL | (main problem with locking is that it doesn't compose |
| 11:56 | _ulises | afternoon all |
| 11:56 | KLKLL | so you can't build a nice airtight system from bottom up |
| 11:57 | technomancy | hm; this looks new: http://jmdns.sourceforge.net/ |
| 11:58 | technomancy | weeee; SVN! |
| 11:58 | Raynes | Could be worse. Could be CVS. |
| 11:59 | technomancy | Raynes: actually... it's the best of both worlds! |
| 11:59 | technomancy | SVN with a CVSROOT directory checked in |
| 11:59 | jaley | my axis plugin for lein totally works! i've stuck it on github, so if anyone needs soap in a clojure project soon, it might save a bit of time :p |
| 11:59 | Raynes | Oh boy. |
| 11:59 | Raynes | jaley: Awesome! Now port it to cake. :> |
| 12:00 | jaley | Raynes: meh. later :p |
| 12:02 | KLKLL | strings behave like which coll? |
| 12:03 | Raynes | Strings are Java strings. |
| 12:03 | Raynes | -> (class "") |
| 12:03 | sexpbot | ⟹ java.lang.String |
| 12:03 | Kruppe | Can anyone help me understand why this doesn't work: http://paste.lisp.org/+2H77 |
| 12:03 | KLKLL | ,(count "fafaf") |
| 12:03 | clojurebot | 5 |
| 12:03 | technomancy | KLKLL: seq on a string is just a bunch of characters |
| 12:05 | KLKLL | somehow I think that functions like count use a lot of reflection |
| 12:06 | KLKLL | (.length() "ff") |
| 12:06 | KLKLL | ,(.length() "ff") |
| 12:06 | clojurebot | java.lang.IllegalArgumentException: No matching method found: length for class clojure.lang.PersistentList$EmptyList |
| 12:06 | Raynes | ,(.length "ff") |
| 12:06 | clojurebot | 2 |
| 12:06 | KLKLL | yeah |
| 12:06 | KLKLL | fricking typo |
| 12:07 | KLKLL | I work with java :( |
| 12:07 | KLKLL | mind-numbing let me tell you |
| 12:10 | KLKLL | well I have to go... kids, don't get a job programming java, if you have any sort of talent it will drive you insane |
| 12:11 | jaley | is ["clojars" "http://clojars.org/repo"] one of the default repos in leiningen? no need to add it? |
| 12:13 | technomancy | jaley: no need |
| 12:14 | jaley | technomancy: ok thanks. seems version 0.6 of lein-clojars is not where the documentation claims, in that case |
| 12:15 | technomancy | jaley: that plugin is deprecated since there's no comprehensive SCP support for the JVM |
| 12:15 | technomancy | in particular it doesn't work with DSA keys; IME it's less failure-prone just to perform the scp manually. |
| 12:15 | jaley | technomancy: oh. what's the alternative? the "long way"? |
| 12:15 | technomancy | lein pom && lein jar && scp pom.xml *jar clojars@clojars.org: # still a one-liner, kinda |
| 12:16 | cemerick | rhickey: am I right in thinking that Util.ret1 exist to allow one to release references to heads of lazy seqs? |
| 12:16 | technomancy | I haven't tried it in nearly a year, maybe it's better now. |
| 12:16 | Raynes | technomancy: Cake has a release task built in. Not sure how it's accomplished though. |
| 12:16 | technomancy | Raynes: it probably doesn't work with DSA keys |
| 12:16 | Raynes | technomancy: ninjudd uses a DSA key. |
| 12:17 | jaley | technomancy: it's a 1 liner in a 3 lined kind of sense :) thanks for the help, i'll do that instead |
| 12:17 | technomancy | I guess it just shells out then |
| 12:17 | cemerick | technomancy: jsch is *very* comprehensive |
| 12:17 | cemerick | The API is *horrible*, but it gets the job done. |
| 12:17 | Raynes | technomancy: I don't think it does. |
| 12:18 | technomancy | cemerick: this is just heresay, but that's what the author of the plugin told me when I reported it to him. |
| 12:18 | ninjudd | yeah, i use JSch. there is no documentation so it was a pain to figure it out |
| 12:18 | ninjudd | but it works with DSA keys |
| 12:18 | technomancy | ok, I've been misinformed |
| 12:19 | cemerick | technomancy: hugod wrote clj-ssh, which wraps it |
| 12:19 | technomancy | and is probably better-documented; nice. |
| 12:19 | ninjudd | technomancy: i wouldn't be opposed to factoring the ssh code out into a clj-ssh library if you want to use it |
| 12:19 | ninjudd | oh |
| 12:19 | ninjudd | hehe |
| 12:20 | technomancy | ninjudd: appreciate the thought. =) |
| 12:20 | ninjudd | using that would have saved me some time ;) |
| 12:21 | shanmu | Hi, is there a library/contrib to generate xml in clojure |
| 12:21 | shanmu | somewhat like prxml but generating into a string instead |
| 12:21 | cemerick | All the code you've ever needed has already been written; it's just a matter of finding it. :-) |
| 12:21 | shanmu | or into the xml/parse tree structure |
| 12:21 | Raynes | -> (doc with-out-str) |
| 12:21 | sexpbot | ⟹ "Macro ([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls." |
| 12:22 | shanmu | Raynes: thanks! |
| 12:22 | Raynes | -> (with-out-str (println "blah")) |
| 12:22 | sexpbot | ⟹ "blah\n" |
| 12:23 | shanmu | cemerick: I was considering using a version of prxml in which print is redfined to put into a global string |
| 12:23 | shanmu | but it seemed a bad idea |
| 12:23 | ninjudd | cemerick: i thought i had found it by using JSch! |
| 12:23 | cemerick | shanmu: yeah, raynes is spot on with with-out-str |
| 12:25 | shanmu | cemerick: yes, thats the beauty of the community - I still a clojure n00b that I have not yet dipped into macros at all and not yet learned to navigate the clojuredocs completely |
| 12:27 | ninjudd | looks like clj-ssh doesn't have scp1 support, which is necessary for clojars. maybe i'll talk to hugod about grabbing that code from cake and i'll switch to clj-ssh |
| 12:28 | technomancy | jaley: looks like a typo in the lein-clojars plugin readme; the version is actually 0.6.0 instead of 0.6 |
| 12:28 | cemerick | ninjudd: scp1? Is that scp over ssh v1? |
| 12:29 | ninjudd | no, it is scp by running the scp command over the ssh tunnel |
| 12:29 | jaley | technomancy: ah right, thanks. |
| 12:30 | ninjudd | as opposed to using sftp |
| 12:30 | ninjudd | i believe it can happen over ssh v1 or v2 |
| 12:31 | ninjudd | clojars doesn't support sftp. i think because that would give you access to other people's files |
| 12:31 | ninjudd | cemerick: http://blogs.sun.com/janp/entry/how_the_scp_protocol_works |
| 12:32 | ninjudd | Compared to the earlier http://en.wikipedia.org/wiki/Secure_copy protocol, which allows only file transfers, the SFTP protocol allows for a range of operations on remote files – it is more like a remote http://en.wikipedia.org/wiki/File_system protocol. An SFTP http://en.wikipedia.org/wiki/Client_(computing)'s extra capabilities compared to an SCP client include resuming interrupted transfers, directory listings, and remote fil |
| 12:32 | ninjudd | removal. |
| 12:32 | cemerick | I'm blissfully ignorant. |
| 12:43 | hugod | ninjudd: I can trivially add an scp command to clj-ssh, in fact it is already written |
| 12:43 | ninjudd | hugod: you mean without using sftp? |
| 12:43 | hugod | I always thought scp was implemented on top of sftp though |
| 12:43 | ninjudd | there are two different protocols |
| 12:44 | hugod | I'll have to check if jsch supports it then |
| 12:44 | ninjudd | hugod: it doesn't |
| 12:44 | ninjudd | hugod: see the upload function here http://github.com/ninjudd/cake/blob/master/src/cake/tasks/release.clj |
| 12:45 | ninjudd | hugod: unfortunately, i duplicated a lot of your clj-ssh work because i didn't know about it |
| 12:46 | hugod | I've been meaning to do a few things with clj-ssh, mainly improving the handling of input and output streams |
| 12:48 | ninjudd | hugod: yeah, i also have code in there to print the remote output on getExtInputStream, which is what clojars uses to print status information |
| 12:51 | hugod | ninjudd: what is that scp command? I don't see -d -t in the man page |
| 12:52 | ninjudd | hugod: -t and -d are hidden options for sink mode and directory respectively |
| 12:52 | ninjudd | http://blogs.sun.com/janp/entry/how_the_scp_protocol_works |
| 12:57 | hugod | ninjudd: thanks, looks straightforward enough |
| 13:07 | ninjudd | hugod: no problem. i'll switch cake to use clj-ssh once i get some extra time |
| 13:08 | shanmu | hi, I have a question related to clj-http |
| 13:08 | shanmu | how to pass a input=value in the body of a post request? |
| 13:15 | tomoj | I just switched from clj-http to clojure-http-client |
| 13:16 | tomoj | because, I think, I needed to do x-www-form-urlencoded post bodies |
| 13:16 | tomoj | maybe clj-http can do it and my switch to clojure-http-client wasn't necessary... |
| 13:38 | chouser_ | cascalog! |
| 13:38 | chouser_ | :-) |
| 13:44 | fliebel | ,(seq? [1 2 3]) |
| 13:44 | clojurebot | false |
| 13:44 | fliebel | :( |
| 13:52 | fliebel | What is the correct way to determine if something can be treated as a list in a multimethod? |
| 13:53 | mrBliss | ,(every? sequential? [[] '() {} #{}]) |
| 13:53 | clojurebot | false |
| 13:53 | mrBliss | ,(map sequential? [[] '() {} #{}]) |
| 13:53 | clojurebot | (true true false false) |
| 13:54 | fliebel | mrBliss: Sets have no order |
| 13:54 | mrBliss | (include maps and sets for demonstration purposes) |
| 13:54 | mrBliss | s/include/included |
| 13:55 | fliebel | right, but… I'll think about it. I have a couple of more things to choose from. I'm currently just using class. |
| 13:56 | fliebel | I tried clojure.lang.ISeq for class, but I'll have to come up with something else. |
| 14:02 | TakeV | If I'm using Lein's REPL to test out my project, is there a way to reload the REPL when I change a file, instead of just restarting it? |
| 14:03 | nlogax | TakeV: there is.. but i forgot :s. something like (use foo :reload) |
| 14:04 | TakeV | Foo being the namespace I'm in? |
| 14:07 | Kruppe | Is there any reason why the last two versions in http://paste.lisp.org/+2H77 would hang? I have to be missing something. Im using clojure version 1.2.0 |
| 14:12 | tomoj | can we combine async io for lots of parallel connections to many different clients with hadoop/cascalog? |
| 14:15 | mattmitchell | could someone recommend a mongo library? i'm trying to use congomongo but no luck, i just get a not found exception, even though "lein deps" pulls it in |
| 14:19 | tomoj | mattmitchell: maybe better to just solve that? |
| 14:19 | tomoj | what does the not found exception complain about |
| 14:19 | mattmitchell | tomoj: yeah you're probably right! |
| 14:19 | tomoj | I don't know anything about the mongo libraries, but I've heard about congomongo a lot |
| 14:19 | mattmitchell | tomoj: well this is the error I get: clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate somnium/congomongo__init.class or somnium/congomongo.clj on classpath: (indexer.clj:1) |
| 14:20 | tomoj | `jar tf` the congo jar in deps/ |
| 14:20 | mattmitchell | tomoj: i'm using cake, and want to integrate congo mongo into a task |
| 14:20 | tomoj | oh, cake, hrmm |
| 14:20 | mattmitchell | tomoj: ok i'll try that |
| 14:20 | tomoj | why'd you run `lein deps`? |
| 14:21 | mattmitchell | tomoj: should i have done something else? |
| 14:21 | tomoj | I don't know cake, so I'm not sure |
| 14:21 | tomoj | but I thought cake was a replacement for lein? |
| 14:21 | MayDaniel_ | `cake deps` |
| 14:21 | _ulises | I am very confused about what symbols really are. Is it fair to say that the act as "labels" to vars? AFAIK the name of the symbol is used to look up a var of the same name and then the var is resolved |
| 14:21 | _ulises | but that suggests that if a different look up mechanism was involved, one could have symbol foo which would eval to var bar |
| 14:21 | _ulises | no? |
| 14:22 | mattmitchell | tomoj: when i run "jar tf" on the congomongo jar file, i get http://gist.github.com/630116 |
| 14:22 | mattmitchell | MayDaniel: so i should use cake deps instead of lein when using cake? |
| 14:22 | tomoj | mattmitchell: so that jar is not on your classpath |
| 14:22 | MayDaniel_ | Yes. |
| 14:22 | tomoj | cake or lein, pick one |
| 14:23 | tomoj | does cake put deps in a different place? |
| 14:23 | mattmitchell | tomoj: oh i thought cake worked with lein, making it easier to create tasks etc.. |
| 14:23 | mattmitchell | my deps with lein go into lib |
| 14:23 | tomoj | cake is pseudo-compatible with lein's project.clj |
| 14:23 | tomoj | ah, right, dunno why I said "deps/"... |
| 14:24 | mattmitchell | tomoj: no problem. what does "jar tf" do? |
| 14:24 | tomoj | the 't' says "list the contents of the archive" |
| 14:24 | tomoj | the 'f' says "I'm about to tell you which archive I mean" |
| 14:24 | tomoj | see `man jar` |
| 14:24 | mattmitchell | tomoj: cool ok. |
| 14:26 | dm3 | is there an idiom to turn nil into an empty sequence? |
| 14:27 | mattmitchell | ok so i removed my "lib" dir and used cake deps instead of lein. it pull everything in fine, but if i try to "use" congomongo in one of my namespaces i get that error |
| 14:27 | mattmitchell | so i thought cake/lein would automatically put things in the class path? |
| 14:28 | tomoj | mattmitchell: have you restarted your jvm? |
| 14:28 | mattmitchell | tomoj: no |
| 14:28 | tomoj | with lein, you need to |
| 14:28 | tomoj | since it's not working, apparently so with cake |
| 14:28 | tomoj | you shouldn't have to restart the persistent cake jvm |
| 14:28 | tomoj | but just the project jvm |
| 14:29 | mattmitchell | tomoj: interesting ok, let me try that. |
| 14:29 | tomoj | java doesn't like the classpath changing |
| 14:30 | mattmitchell | tomoj: i ran "cake restart" and still getting that error, hmm. |
| 14:31 | tomoj | check (System/getProperty "java.class.path") for the congo jar |
| 14:31 | mattmitchell | tomoj: ugh, sorry. how do i do that? |
| 14:31 | mattmitchell | oh duh, repl :) |
| 14:31 | MayDaniel_ | mattmitchell: How are you running your code? |
| 14:32 | mattmitchell | MayDaniel_: well i've been firing up "cake repl" and playing with it like that |
| 14:33 | mattmitchell | tomoj: ok i do see congo mongo in the class path |
| 14:33 | tomoj | then you should be good |
| 14:33 | tomoj | hmm |
| 14:34 | tomoj | check that the path in the notfoundexception matches the file in `jar tf` for the congo jar you see on the classpath |
| 14:34 | tomoj | if so, something is crazy |
| 14:35 | mattmitchell | tomoj: ok will try that... |
| 14:37 | mattmitchell | tomoj: yeah the same path is in listed in "jar tf" |
| 14:38 | tomoj | what is this "indexer.clj"? |
| 14:38 | Derander | do I need to restart my swank server after I load in some new deps with lein? |
| 14:38 | tomoj | Derander: yeah |
| 14:38 | Derander | that is sad :-( |
| 14:38 | tomoj | if you're working on two projects back and forth you can use checkout deps |
| 14:39 | tomoj | but for adding new deps, no help |
| 14:40 | Derander | thanks for the info |
| 14:41 | mattmitchell | tomoj: oh this is a file that has a namespace of "apij.indexer" it's my own file for creating tasks |
| 14:43 | tomoj | how are you loading the file? |
| 14:44 | mattmitchell | tomoj: I have this in my indexer.clj file: (ns apij.indexer |
| 14:44 | mattmitchell | (:use somnium.congomongo)) |
| 14:44 | mattmitchell | tomoj: and right when i run "cake help" i get the error |
| 14:44 | mattmitchell | tomoj: indexer.clj is in src/apij/indexer.clj |
| 14:44 | tomoj | that's odd |
| 14:45 | mattmitchell | tomoj: yeah i thought this would just work. but i'm new to clojure so i wasn't sure |
| 14:46 | tomoj | ninjudd: ^ |
| 14:48 | AWizzArd | rhickey: I wanted to ask you about gvec.clj. Why are IVecImpl and the ArrayManager definterfaces and not defprotocols? |
| 14:49 | ninjudd | mattmitchell: did you gist the error? |
| 14:50 | ninjudd | mattmitchell: oh, i found it |
| 14:50 | ninjudd | mattmitchell: if you want to access your project classpath in a task, you have to wrap it in the bake macro |
| 14:51 | mattmitchell | ninjudd: oh ok here is the whole error: http://gist.github.com/630151 |
| 14:51 | mattmitchell | ninjudd: oh really!? |
| 14:51 | tomoj | oh, I see, it was a task |
| 14:51 | ninjudd | mattmitchell: here's an example: http://github.com/ninjudd/cake/blob/master/src/cake/tasks/test.clj |
| 14:52 | mattmitchell | ninjudd: awesome i'll have a look |
| 14:52 | mattmitchell | tomoj: sorry for not mentioning that |
| 14:52 | ninjudd | btw, i'm seriously considering getting rid of the separate cake and project jvm. but i want to get more input on the possible ramifications before i do |
| 14:53 | tomoj | mattmitchell: I wouldn't have understood the implications anyway, that's why I pinged ninjudd :) |
| 14:53 | mattmitchell | tomoj: cool ok :) |
| 14:53 | tomoj | ninjudd: I was wondering whether the separate classloader idea could cause weird behavior |
| 14:54 | ninjudd | a separate classloader is the other option. two JVMs is not the long term plan |
| 14:54 | tomoj | oh, and another option is to just put cake stuff right in the project jvm? |
| 14:54 | ninjudd | but i'm considering just sharing a classloader and making cake itself be self-contained within the cake.* ns |
| 14:55 | tomoj | I see |
| 14:55 | ninjudd | it would mean cake has to run on all versions of clojure it supports |
| 14:55 | tomoj | ah |
| 14:55 | ninjudd | if we switch from maven to ivy, the number of jar deps for cake itself drops from 27 to 7 |
| 14:55 | tomoj | so if you start playing with edge clojure, and edge clojure breaks cake, you're hosed |
| 14:56 | ninjudd | though there could still be version conflicts with those 7 |
| 14:56 | mattmitchell | ok here is my indexer.clj file, still getting that error though: http://gist.github.com/630154 |
| 14:56 | mattmitchell | i also listed apij.indexer in my project's "tasks" setting |
| 14:56 | ninjudd | tomoj: that is the downside. if edge clojure introduces breaking changes, i will have to write compatibility code in cake |
| 14:56 | tomoj | you need to bake congo in, not just use it like normal |
| 14:57 | fhd | Is there a way to test private methods with clojure.test? |
| 14:57 | fhd | (Although I'm still not sure if that'd be a good idea, it would make stuff simpler) |
| 14:57 | mattmitchell | tomoj: omg, i didn't get an error when running "cake help" :) |
| 14:58 | ninjudd | mattmitchell: http://gist.github.com/630157 |
| 14:58 | ninjudd | tomoj: i do like the "bake in" lingo. that's a reason to keep them separate ;) |
| 14:59 | mattmitchell | ninjudd: awesome! it worked! |
| 14:59 | ninjudd | but the number of people who get hung up on this when writing tasks is considerable. for lein too with eval-in-project, i'm sure |
| 14:59 | mattmitchell | thanks to both of you for taking the time to help me, much appreciated. |
| 14:59 | ninjudd | mattmitchell: great! |
| 15:00 | mattmitchell | ninjudd: so why does that work and the way i had it before doesn't? |
| 15:00 | ninjudd | mattmitchell: if you have more questions and i'm not around, you can try asking in #cake.clj |
| 15:01 | mattmitchell | ninjudd: excellent, i'll go there next time |
| 15:01 | ninjudd | mattmitchell: bake takes ns forms to load in your project, then a set of bindings to pass over the socket to the project jvm |
| 15:04 | tomoj | ninjudd: :) |
| 15:05 | mattmitchell | ninjudd: i'll have to think on that one :) |
| 15:14 | @rhickey | so, locally I have a working version of Clojure that requires explicit (def ^:dynamic x) metadata in order to support rebinding, and denies it otherwise |
| 15:14 | @rhickey | this on the path to some perf enhancements, but also opens the door to another enhancement - transactional loading of code |
| 15:14 | @rhickey | any interest in that? |
| 15:14 | AWizzArd | totally |
| 15:15 | AWizzArd | This is important for hot updates of course. |
| 15:15 | AWizzArd | I am very interested in this. |
| 15:15 | AWizzArd | In fact, I am working on something similar, and this sounds really good. |
| 15:15 | AWizzArd | about the perf enhancements: would they target non-dynamic vars or the dynamic ones? |
| 15:16 | @rhickey | non dynamic |
| 15:16 | AWizzArd | good |
| 15:16 | @rhickey | the whole point is that dynamic entails cost |
| 15:16 | AWizzArd | So, in principle this means: I will compile my code and get errors for each binding. To fix those I tag the concrete vars with ^:dynamic. Is that correct? |
| 15:16 | @rhickey | the transactional loading can't be made perfect, ad that would require code run in transactions |
| 15:17 | AWizzArd | sure, but this can come in very handy anyway |
| 15:17 | AWizzArd | even small improvements help to get correct programs |
| 15:17 | @rhickey | AWizzArd: currently it will automatically make dynamic any *earmuff-var*, with a warning, just as a bridge |
| 15:17 | @rhickey | all rebinding attempts to non-dynamics will throw |
| 15:18 | AWizzArd | sounds fair |
| 15:18 | AWizzArd | Easy patching. |
| 15:19 | AWizzArd | Nice to see that you constantly come up with more and more catchy ideas |
| 15:19 | @rhickey | the semantics would be - a fn sees a fixed consistent set of fn vars throughout its duration. A subsequent call will get fresh values if available. The perf tradeoff is that a nested call might see newr values than the call that contains it (if they were updated during the call) |
| 15:20 | cemerick | rhickey: I've been hoping for transactional loading of namespaces for some time now; all namespaces going into a ref or something? |
| 15:21 | tomoj | so as long as updated functions have the same semantics, there will be no problem, right? |
| 15:21 | cemerick | or, I should say, *each* ns going into a ref |
| 15:21 | @rhickey | cemerick: no, vars having refs inside. Makingthe load transactional a matter of putting it (or a set of loads) in a transaction, if not, the granularity is per def |
| 15:23 | cemerick | rhickey: I guess that falls just shy of making use transactional? |
| 15:23 | tomoj | hmm, maybe "semantics" isn't the right word.. if they had the exact same semantics, would they really have been updated? |
| 15:24 | @rhickey | cemerick: you can't do that generally, as files can have side effects. I think this will be a consumer-selected thing |
| 15:24 | cemerick | damn top-levels |
| 15:24 | @rhickey | tomoj: same semantics and return types should always be fine, yes |
| 15:25 | @rhickey | cemerick: also, you want ad hoc footprint, especially for hot patches - 2 fns from this ns and 3 from that |
| 15:25 | AWizzArd | cemerick: this will be possible with my DB. Soon. |
| 15:26 | cemerick | rhickey: does anyone track patches to that level of granularity? |
| 15:26 | @rhickey | cemerick: most people don't have this kind of ability |
| 15:27 | cemerick | That's what I figured. |
| 15:27 | @rhickey | there are many other reasons not to turn a ns into a monolith |
| 15:28 | AWizzArd | rhickey: will you upload your code soon (including ^:dynamic)? |
| 15:28 | @rhickey | AWizzArd: I could, right now it only provides pain and no benefits, other than clearer intent IMO |
| 15:29 | @rhickey | but maybe people should get started on being explicit |
| 15:29 | @rhickey | I haven't had enough feedback on the other pain points for people, e.g. mockers |
| 15:30 | cemerick | rhickey: I guess I'm not clear about why putting the refs at the ns level restricts one's level of load granularity (preventing "ad hoc footprint", as you put it). If you only load a single def within a transaction, you've just defined your footprint, no? |
| 15:30 | cemerick | lol @ "mockers" |
| 15:31 | @rhickey | cemerick: by an effect to the entire ns |
| 15:32 | @rhickey | cemerick: the biggest effect of which would be to turn var deref into lookup, something CLojure has avoided thus far |
| 15:33 | AWizzArd | If the new version does not offer the perf enhancements but already spits out warnings it is worth it. |
| 15:33 | @rhickey | maybe that will matter less with caching, but that is unclear and a big risk |
| 15:34 | cemerick | OK; I was thinking that static-by-default would imply that the lookup is at compile time only. |
| 15:34 | @rhickey | cemerick: how could it be? |
| 15:35 | cemerick | eh, crap, nevermind |
| 15:35 | AWizzArd | rhickey: btw, just a fast question about gvec.clj: why are IVecImpl and the ArrayManager definterfaces and not defprotocols? |
| 15:36 | @rhickey | it should matter not at all if the vars are individual refs, the semantics of the patch transaction are the same |
| 15:36 | @rhickey | AWizzArd: because they are not abstractions, just using interfaces for primitives, since pre-primitive support in fns |
| 15:37 | AWizzArd | ok |
| 15:39 | amalloy | ,(try (vals [1 2]) (catch Exception _ 1)) |
| 15:39 | clojurebot | amalloy: Huh? |
| 15:40 | amalloy | hrm. in my repl, that throws an exception. and in clojurebot it doesn't do anything at all. why is that? |
| 15:40 | LauJensen | rhickey: So in your local version, a simple (defn tst [x] x) cannot be rebound dynamically without adding the ^:dynamic meta ? |
| 15:41 | @rhickey | LauJensen: right |
| 15:42 | LauJensen | rhickey: Im thinking typically during a day of development, I rebind things constantly, but once I go into production, I do so very rarely. Couldn't this be declared in the ns or something similar? (ns testing (:development true)) |
| 15:42 | @rhickey | LauJensen: really, rebind? not redef? |
| 15:42 | LauJensen | oh right, redef |
| 15:42 | @rhickey | redef is fine |
| 15:42 | LauJensen | ah ok |
| 15:43 | @rhickey | this is a new model that allows redef (without recompile of downstream callers, unlike old direct linking and static linking) |
| 15:45 | AWizzArd | Has "static linking" anything to do with the ^:static hint? |
| 15:46 | mattmitchell | i'm using cake and trying to run my own task. the task runs fine the first time, then i get basically this error: mongo_to_solr already refers to: #'apij.indexer/mongo_to_solr |
| 15:46 | LauJensen | AWizzArd: AFAIK its called static because its compiled to a static function |
| 15:47 | @rhickey | AWizzArd: same thing |
| 15:47 | AWizzArd | good |
| 15:48 | ninjudd | mattmitchell: hmm.. sounds like the :use in bake shouldn't complain if the symbol is already bound. you can change it to a require for now to fix it |
| 15:49 | mattmitchell | ninjudd: bingo! thanks again. |
| 15:58 | amalloy | ninjudd: but with just require, will it work the first time he does it? |
| 16:03 | ninjudd | amalloy: yeah http://gist.github.com/630157 |
| 16:05 | amalloy | ninjudd: sure, he just has to make sure to use congo/mongo! instead of plain mongo. i was pointing out that *just* changing to :require will work until he restarts his jvm, and then stop working |
| 16:06 | amalloy | mattmitchell: ^^ |
| 16:06 | ninjudd | amalloy: i see. except it should break right away because changing the task should trigger a restart |
| 16:07 | amalloy | ah. well, shows what i know about cake |
| 16:07 | ninjudd | it's strange though because i use bake with use all the time and haven't seen a problem. could be a reload problem |
| 16:10 | amalloy | apologies if this goes against etiquette or something, but i'm gonna repeat my previous question since nobody seems to have noticed it: |
| 16:10 | amalloy | ,(try (vals [1 2]) (catch Exception _ 1)) ; shouldn't this return 1? |
| 16:10 | clojurebot | amalloy: Excuse me? |
| 16:13 | LauJensen | amalloy: What a weird example |
| 16:14 | amalloy | LauJensen: well, i had an expr that would return either a map (whose keys were uninteresting) or a vector, and i wanted to get either the values or the vector |
| 16:14 | amalloy | the right solution (aside from fixing the first expr) was to use map? or similar, but i tried this first and can't see why it doesn't work |
| 16:14 | LauJensen | -> (supers java.lang.ClassCastException) |
| 16:14 | sexpbot | ⟹ #{java.lang.RuntimeException java.lang.Exception java.lang.Throwable java.lang.Object java.io.Serializable} |
| 16:15 | LauJensen | amalloy: In either case, you'd be better of doing (if (map? x) (vals x) .. |
| 16:15 | amalloy | yeah, as i said above i changed to that |
| 16:16 | LauJensen | rhickey: Any idea why the above exception isn't caught ? |
| 16:16 | LauJensen | -> (try (vals [1 2]) (catch Exception _ 1)) |
| 16:16 | sexpbot | java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Map$Entry |
| 16:16 | amalloy | ,(try 1/0 (catch Exception _ 0)) ; breaks in the reader, so i understand why *this* isn't caught |
| 16:16 | clojurebot | amalloy: No entiendo |
| 16:23 | dpritchett | does anyone know how i can figure out which elisp function is being invoked when i use a command i.e. C-c M-p? swank-clojure and vimpulse both use it for different things and I need to learn how to rebind one or the other. |
| 16:24 | LauJensen | C-h k C-c M-p |
| 16:25 | dpritchett | remind me to speak kindly of bestinclass if anyone ever asks :) |
| 16:25 | hiredman | M-x describe-key |
| 16:26 | dpritchett | excellent |
| 16:27 | LauJensen | dpritchett: Sure, I'll remind you once in a while :) |
| 16:37 | @rhickey | ,(class (vals [1 2])) |
| 16:37 | clojurebot | clojure.lang.APersistentMap$ValSeq |
| 16:37 | @rhickey | ,(first (vals [1 2])) |
| 16:37 | clojurebot | java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Map$Entry |
| 16:38 | @rhickey | amalloy: ^^ |
| 16:38 | amalloy | i see. the exception isn't thrown when i call vals, it's thrown when the repl tries to display it? |
| 16:39 | @rhickey | basically, (vals [1 2]) returns a seq that blows up when used, not when created |
| 16:39 | @rhickey | amalloy: right |
| 16:39 | amalloy | makes sense |
| 16:39 | amalloy | (for a given value of "sense") |
| 16:39 | @rhickey | vals could do more checking, ticket and patch welcome |
| 16:39 | amalloy | rhickey: one of these days i'll get around to filling out a CA |
| 16:41 | @rhickey | amalloy: you can file a report without a CA by using the support tab in Assembla |
| 16:42 | technomancy | rhickey: for the record if with-var-roots goes into core that addresses my concerns well. |
| 16:42 | AWizzArd | rhickey: is it also possible to be able to write comments? I wanted to comment a ticket, but didn't find a way to post something. |
| 16:42 | technomancy | (my concerns I raised earlier about testability) |
| 16:42 | technomancy | should know better than to butt into the middle of a conversation like that |
| 16:45 | @rhickey | technomancy: well, putting it in core will have to follow some thought about it, but it proves the point, that is preferable to binding for, e.g. mocking and testing |
| 16:46 | technomancy | sure; even with binding you still need with-var-roots for integration testing. |
| 17:26 | amalloy | is there a convenient function that will add an object to a set, unless the object is nil? |
| 17:56 | amalloy | ,((juxt filter remove) #{1 3 4} (range 5)) ; how cool is this? |
| 17:56 | clojurebot | [(1 3 4) (0 2)] |
| 17:57 | raek | juxt should have its own fanclub. |
| 17:58 | technomancy | http://p.hagelb.org/juxt.html |
| 17:58 | technomancy | (I didn't actually use the juxt version, but I like it for its own reasons) |
| 17:59 | amalloy | wow technomancy that saves so much typing and thinking :) |
| 18:00 | raek | hagelborg... sounds Swedish :) |
| 18:00 | amalloy | anyway i spent like ten minutes trying to find a function like partition but that would split a seq into [matches not-matches], before finally realizing it's just (juxt filter remove) |
| 18:01 | technomancy | amalloy: c.c.seq/separate |
| 18:01 | technomancy | but juxt is cooler |
| 18:02 | technomancy | implemented as: [(filter f s) (filter (complement f) s)] |
| 18:02 | technomancy | you should submit a patch replacing the implementation with juxt =) |
| 18:03 | amalloy | man, i never remember to look in c.contrib |
| 18:03 | technomancy | if you had you may never have developed an appreciation for juxt. |
| 18:05 | amalloy | technomancy: fantastically unlikely |
| 18:07 | amalloy | incidentally, i found what seems like an oddity in emacs's lisp indentation style: |
| 18:07 | amalloy | (filter x <newline> y) ; y lines up with x |
| 18:07 | amalloy | ((juxt filter remove) x <newline> y) ;y lines up with ( |
| 18:08 | amalloy | is that because emacs doesn't like lisp-1's? |
| 18:10 | technomancy | there are lots of edge-cases that aren't well-handled like that |
| 18:10 | technomancy | but if you came up with a list of functions that always return functions I suppose it could be done. |
| 18:10 | amalloy | technomancy: why would that matter? if it's surrounded by () and not quoted, it must be a function |
| 18:11 | amalloy | that is, if it's the first element of () |
| 18:11 | technomancy | amalloy: oh, duh. yeah. |
| 18:11 | technomancy | I dunno. I just inherited this code. =) |
| 18:12 | amalloy | technomancy: where's the code i would have to change to make it work? |
| 18:13 | technomancy | amalloy: http://github.com/technomancy/clojure-mode/blob/master/clojure-mode.el#L550 |
| 18:13 | technomancy | would be much obliged to see improvement there |
| 18:13 | technomancy | fraid I can't give you much advice about it though |
| 18:14 | amalloy | no worries, i'll have a look |
| 18:49 | lpetit | Is "motivation" (the word) idiomatic english ? |
| 18:53 | mabes | lpetit: it is a commonly used word, yes... |
| 18:53 | lpetit | mabes: ok, so it doesn't feel "foreign" if one of my conj slides is called "motivations" ? |
| 18:54 | mabes | lpetit: no, not at all |
| 18:54 | lpetit | kewl, thx |
| 18:54 | mabes | lpetit: Looking forward to it ;) |
| 18:54 | lpetit | (gulp) |
| 18:54 | mabes | heh, don't sweat it |
| 18:55 | lpetit | :) |
| 19:00 | lpetit | help: for each "kind of feature" (for example "Editor"), I want to split more detailed features into 3 sets : "usable features" (fully functional, no arguing), "existing features" (they're there, but they really need some more work to pretend being viewed as "usable"), "missing features" |
| 19:01 | lpetit | What would better english terms than [ "usable", "existing", "missing" ] ? |
| 19:01 | carkh | i'm looking into upgrading a project to 1.2, but i can't find clojure.stacktrace |
| 19:02 | carkh | does anybody know where i can find print-stack-trace in 1.2 ? |
| 19:03 | amalloy | lpetit: [stable, unstable, unimplemented]? |
| 19:03 | raek | ah, the doc page is broken again |
| 19:03 | raek | carkh: clojuredocs.org |
| 19:03 | amalloy | or incomplete instead of unimplemented maybe; i'm not sure what you mean by missing |
| 19:03 | raek | it seems like that the docs on clojure.github.com/clojure keeps getting reverted to 1.1 every now and then the last month |
| 19:04 | lpetit | amalloy: mm, you help me think more abotu what I want to convey. e.g. I don't want to list all possible unimplemented features. I want to try an honest attempt at pointing one or two "crying" missing features. |
| 19:04 | amalloy | lpetit: future work? |
| 19:05 | carkh | raek: ah it needs to be "required" now |
| 19:05 | carkh | same place as before =P |
| 19:05 | lpetit | amalloy: yes, future work is good at summarizing it |
| 19:05 | lpetit | so [stable, incomplete, future work] ? |
| 19:05 | amalloy | sounds good to me |
| 19:05 | lpetit | thx |
| 19:06 | amalloy | hooray! i may not be going to conj, but now i know at least four of the words that will be used :) |
| 19:06 | amalloy | technomancy: blech, i give up. CL is hard enough without having to know all the ins and outs of EL |
| 19:06 | lpetit | changed my mind: [stable, incomplete, around the corner] :) |
| 19:20 | amalloy | technomancy: hm, wait a minute. i found a way to make it indent every function the same wrong way; i can probably invert some logic somewhere to include fewer items instead of more in that case :P |
| 19:24 | amalloy | ,(apply assoc {} (mapcat (juxt identity inc) (range 3))) |
| 19:24 | clojurebot | {2 3, 1 2, 0 1} |
| 19:24 | amalloy | ,(into {} (mapcat (juxt identity inc) (range 3))) |
| 19:24 | clojurebot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer |
| 19:31 | amalloy | hiredman: ping? |
| 21:14 | wakeupsticky | hi all |
| 21:14 | wakeupsticky | i'm on ubuntu. Where can I get an example clojure application with a gui? Ideas? |
| 21:15 | dharma | what kind of application are you looking for? |
| 21:18 | wakeupsticky | i don't really care. i just want to see something with a decent gui written in clojure that works. preferably open source but it doesn't need to be. |
| 21:18 | amalloy | wakeupsticky: http://clojure.googlegroups.com/web/ants.clj is a classic example, if by gui you mean "draws stuff in a window". if you want something that gets user input, it's not such a great choice |
| 21:19 | wakeupsticky | and how do i go from source code to app with that? |
| 21:19 | amalloy | do you have clojure installed/running? |
| 21:20 | wakeupsticky | just a sec, i'm getting it :) |
| 21:20 | amalloy | you should be able to just copy/paste that into a repl |
| 21:21 | dharma | since you said your are in ubuntu, you could sudo apt-get install clojure |
| 21:22 | wakeupsticky | part of what i'm looking for is proof that it's fairly straightforward to deliver an application. So while I can copy/paste the source into a repl that's not what i was looking for. |
| 21:22 | amalloy | wakeupsticky: http://mikera.net/ironclad/ |
| 21:23 | amalloy | i've only glanced at it myself, but couple months ago someone posted this (his project) to the google group |
| 21:23 | wakeupsticky | amalloy, that's exactly what i was looking for |
| 21:24 | amalloy | there you go, then. i don't know how hard it was for him to put together, but it looks like there's a mailing group or something, so you could ask there |
| 21:24 | wakeupsticky | just that i'm thinking of switching from haskell to clojure primarily because i suspect deploying a gui-app would be easier in clojure |
| 21:25 | amalloy | wakeupsticky: i suspect that's true; do you have java experience? |
| 21:25 | wakeupsticky | no :\ |
| 21:25 | wakeupsticky | supposedly it's not necessary but i don't know about reality :P |
| 21:25 | bhenry | wakeupsticky i'm doing webapps with clojure and i never knew java beforehand. |
| 21:26 | wakeupsticky | cool, what sort of webapps? linky? |
| 21:26 | bhenry | intranet apps sorry. |
| 21:26 | amalloy | wakeupsticky: it's not necessary, esp for webapps, but knowing your way around the java gui frameworks is a big help - you have to call out to them eventually, and not everything has a clojure wrapper yet |
| 21:26 | wakeupsticky | oh np |
| 21:27 | wakeupsticky | hmmm, that app you linked to worked but |
| 21:27 | wakeupsticky | on java -jar clojure.jar i get the error |
| 21:28 | wakeupsticky | Unable to access jarfile clojure.jar |
| 21:28 | amalloy | http://stuartsierra.com/2010/01/02/first-steps-with-clojure-swing is series of articles by a well-known clojurian about getting started with gui in clojure |
| 21:28 | amalloy | again, i haven't read them |
| 21:29 | amalloy | wakeupsticky: the java stuff underlying clojure honestly makes it a real pain to use "raw" with java-jar. check out leiningen for a tool that will manage all that stuff for you |
| 21:29 | amalloy | clojurebot: lein? |
| 21:29 | clojurebot | the leiningen screencast is on full disclojure: http://vimeo.com/8934942 |
| 21:29 | amalloy | grr |
| 21:29 | amalloy | clojurebot: lein is http://github.com/technomancy/leiningen |
| 21:29 | clojurebot | You don't have to tell me twice. |
| 21:33 | wakeupsticky | i'm too much of a linux noob to understand the installation instructions for leiningen |
| 21:33 | amalloy | heh. you download the lein file, and then run lein self-install |
| 21:33 | amalloy | it does the rest |
| 21:34 | wakeupsticky | i don't need to add it to my path and make it executable? |
| 21:34 | amalloy | oh. well yes, i suppose you do |
| 21:35 | amalloy | *sheepish* |
| 21:35 | wakeupsticky | that's what i don't know how to do on linux |
| 22:08 | dbleyl | anyone familiar with generating local variable tables in their byte code with :gen-class? |
| 22:09 | amalloy | dbleyl: as in debug symbols? |
| 22:09 | dbleyl | yeah. |
| 22:15 | amalloy | dbleyl: it looks like http://sr3d.github.com/GithubFinder/?utm_source=bml&user_id=ninjudd&repo=cake# contains some logic about whether or not to include debug info |
| 22:15 | dbleyl | using a jar that's picky about byte code, using something like asm to instrument the gen'd classes. |
| 22:20 | amalloy | dbleyl: actually it looks like the compile-java task in there always passes lines,source |
| 22:21 | amalloy | if you modify your local cake installation to pass "source,lines,vars", it should work when you run cake compile |
| 22:24 | dbleyl | amalloy: thanks - I'm checking out defn compile-clojure, and it looks like at the end of the day, it calls (compile lib) |
| 22:24 | amalloy | yeah, i just noticed that too |
| 22:27 | amalloy | dbleyl: try javap -l on the generated .class files |
| 22:27 | amalloy | mine have local variables |
| 22:27 | amalloy | eg javap -l myproj.core\$myfunc |
| 22:29 | amalloy | i generated them with a generic call of (compile 'myproj.core), and my project doesn't even have a gen-class |
| 22:29 | dbleyl | I was getting some in an earlier version, but not anymore. |
| 22:30 | amalloy | earlier version of what? |
| 22:31 | dbleyl | of my class. |
| 22:32 | amalloy | curious. have you tried calling (compile) yourself? |
| 22:35 | dbleyl | yeah, I call it from my clj file. |
| 22:37 | steven_t | hey guys |
| 22:37 | amalloy | allo |
| 22:37 | steven_t | it seems clojure has the same problem c has in terms of needing to name local vars idx instead of index because the latter is a function |
| 22:37 | amalloy | steven_t: not at all. you can shadow functions |
| 22:38 | steven_t | chapter 1 of Programming Clojure says its bad practice to shadow though |
| 22:38 | steven_t | just like you can in c, but its bad practice to |
| 22:38 | amalloy | ,(do (print index) (let [index 1] (print index))) |
| 22:38 | clojurebot | java.lang.Exception: Unable to resolve symbol: index in this context |
| 22:39 | amalloy | ,(do (print cons) (let [cons 1] (print cons))) |
| 22:39 | clojurebot | #<core$cons clojure.core$cons@4eb98c>1 |
| 22:39 | amalloy | anyway, yes, you should avoid it for functions you might plan to use in the forseeable future |
| 22:40 | steven_t | grr |
| 22:40 | steven_t | ruby doesnt have that problem :/ |
| 22:40 | amalloy | that said, it's pretty rare to have a problem. and in a functional language you rarely want index |
| 22:40 | amalloy | steven_t: how does ruby solve it? |
| 22:43 | amalloy | (what i mean by the latter is, if you're looping over something using an index, you're usually writing java/ruby in clojure, instead of writing clojure) |
| 22:43 | dbleyl | amalloy thanks for your help. |
| 22:43 | amalloy | dbleyl: you're welcome to what little of it there is |
| 22:57 | steven_t | amalloy: im talking about the shadowing issue |
| 22:57 | amalloy | yes, and i was asking how ruby solves the shadowing issue |
| 22:58 | steven_t | i guess technically ruby has the same issue.. you cant name a variable puts without forcing later calls to puts in that method to be written as Kernel::puts |
| 22:58 | amalloy | likewise clojure.core/cons |
| 22:58 | steven_t | right |
| 22:58 | steven_t | so i guess its not a real issue. not like in C at least |
| 22:58 | amalloy | it's not really one in c either, in my experience |
| 22:59 | steven_t | okay well im on page 18.. ill be back when im not so inexperienced with cloj :) |
| 22:59 | amalloy | you should avoid globals, and if you're shadowing something from your own function inside a more deeply-nested block in the same function, your code has other problems |
| 22:59 | amalloy | enjoy it! |
| 23:04 | pdk | keeping variables within the narrowest scope appropriate for them is good practice in any language |
| 23:04 | pdk | save for those that don't really have a concept of scope like old versions of basic, there you're forced to make it all global |
| 23:35 | amalloy | ninjudd: how do i set vm args for my cake tasks? |
| 23:43 | Raynes | There is a section of the README on setting JVM options, if that's what you mean: http://github.com/ninjudd/cake |
| 23:44 | amalloy | thanks Raynes. yes, i want to adjust the stack/heap sizes |