2011-11-23
| 00:00 | alexbaranosky | amalloy: any interest in working on Midje? we could use your skills :) |
| 00:00 | amalloy | alexbaranosky: the case i'm concerned about is (.foo IBar b) => 10 (.bar IBar b) => 9 |
| 00:01 | alexbaranosky | amalloy: I wonder what Midje does now for the fn analog of that? Probably just uses the last defined provided |
| 00:02 | devn | midje is great. |
| 00:02 | alexbaranosky | amalloy: oop misread |
| 00:02 | alexbaranosky | hey devn |
| 00:03 | alexbaranosky | devn: I'm the dude you were talking about pair programming and philosophy with first day of the Conj |
| 00:03 | devn | oh, right! how's it going? |
| 00:03 | alexbaranosky | amalloy: I see your point now and will add it to the notes I'm accruing on the Github Issue |
| 00:03 | alexbaranosky | devn: good! |
| 00:04 | devn | alexbaranosky: working on midje, eh? |
| 00:05 | alexbaranosky | dev: yeah, I've got three features on my list of things that seem most useful: |
| 00:06 | alexbaranosky | devn: colorized console, auto/lazy-test powers, mocking java methods (including static ones) |
| 00:06 | alexbaranosky | if you've got the burning urge to do any, that could be arranged :) |
| 00:07 | devn | If I commit to anything else I think I might implode |
| 00:07 | devn | I absolutely want to, but wanting does give me extra hours :( |
| 00:07 | alexbaranosky | me too, he |
| 00:07 | reiddraper | anyone know if there's a quickcheck for clojure that's actively maintained? |
| 00:07 | reiddraper | i've found a couple but they seem abandoned |
| 00:08 | alexbaranosky | well, you can always give more feedback on GitHub issues, or to me; that stuff is really useful |
| 00:08 | devn | reiddraper: how abandoned is abandoned in your estimation? |
| 00:08 | reiddraper | devn: no commits in 2011 |
| 00:08 | amalloy | reiddraper: halloway has test.generative, which i think is similar |
| 00:08 | devn | alexbaranosky: yeah, I will definitely do that. I haven't used midje a *ton*, but when I have used it I've really enjoyed it. |
| 00:08 | devn | reiddraper: so clojurecheck is out of the picture, yes? |
| 00:09 | amalloy | and i think he's working on it |
| 00:09 | alexbaranosky | devn: we don't get enough people adding their two cents to issues imho |
| 00:09 | reiddraper | devn: that's the one i was looking at, perhaps it's great and just hasn't needed anything since 2010 |
| 00:10 | devn | alexbaranosky: i have spent a fair amount of time on the wiki for midje. next time I'll peek at issues. :) |
| 00:10 | reiddraper | amalloy: I'll look more at test.generative. It wasn't well documented and I didn't dig further than that |
| 00:11 | devn | reiddraper: haskell ports seem to have the property of standing the test of time |
| 00:11 | devn | reiddraper: but they require some care and feeding |
| 00:11 | devn | reiddraper: have you looked at test.generative? |
| 00:12 | reiddraper | devn: just enough to see there weren't many docs. should look more. |
| 00:12 | devn | reiddraper: I think you're right -- there aren't many docs, but I believe there are examples under src/ |
| 00:12 | reiddraper | devn: i coudldn't tell if it indented to be like quickcheck, or just a random input testing facility |
| 00:12 | devn | reiddraper: also, fogus' libraries clache and unk use test.generative, so that might be helpful |
| 00:13 | devn | reiddraper: honestly I don't know, but if you check out fogus' projects that might give you the answer you're looking for |
| 00:13 | reiddraper | devn: ok, will take a look at those as well. I'm particularly interested in the "simplification" of failing cases that haskell/erlang QC provide |
| 00:14 | reiddraper | I suppose there's always the possibility of using a Java lib too :) |
| 00:14 | bartj | I thought re-seq returned a sequence of matches |
| 00:15 | brehaut | ,(re-seq #"a+" "aababaabaababbbba") |
| 00:15 | clojurebot | ("aa" "a" "aa" "aa" "a" ...) |
| 00:15 | bartj | , (re-seq #"(?i)\b(Mission Road|Bangalore)\b" "45, Mission Road, Bangalore") |
| 00:15 | clojurebot | (["Mission Road" "Mission Road"] ["Bangalore" "Bangalore"]) |
| 00:15 | bartj | but, it seems to return a sequence of matches |
| 00:15 | bartj | where the matches seem to be vectors! |
| 00:16 | bartj | brehaut, ? |
| 00:16 | brehaut | bartj: its because you have capture groups |
| 00:16 | devn | ,(doc re-groups) |
| 00:16 | clojurebot | "([m]); Returns the groups from the most recent match/find. If there are no nested groups, returns a string of the entire match. If there are nested groups, returns a vector of the groups, the first element being the entire match." |
| 00:17 | devn | ,(doc re-seq) |
| 00:17 | clojurebot | "([re s]); Returns a lazy sequence of successive matches of pattern in string, using java.util.regex.Matcher.find(), each such match processed with re-groups." |
| 00:17 | devn | "each element is processed with re-groups" |
| 00:17 | brehaut | ,(map first (re-seq #"(a+)" "abaabaaa")) |
| 00:17 | clojurebot | ("a" "aa" "aaa") |
| 00:23 | bartj | brehaut, devn cool, thanks |
| 00:27 | amalloy | can i just say, this kind of "you can't predict the return type" seems pretty evil to me? |
| 00:32 | tensorpudding | how does clojure do error handling? |
| 00:32 | tensorpudding | can you specify your own errors? |
| 00:32 | amalloy | &(/ 1 0) |
| 00:32 | lazybot | java.lang.ArithmeticException: Divide by zero |
| 00:32 | amalloy | i created an error right there. awesome |
| 00:32 | tensorpudding | okay, so it uses java's exceptions |
| 00:32 | tensorpudding | how do i throw an exception |
| 00:32 | tensorpudding | how do i create new exceptions |
| 00:33 | amalloy | tensorpudding: i seem to recall you hate reading docs, right? |
| 00:33 | tensorpudding | is the only facility in java? |
| 00:34 | tensorpudding | i skimmed the clojure docs but couldn't find anything talking about exceptions |
| 00:36 | alexbaranosky | &(throw (RuntimeException. "boom")) |
| 00:36 | lazybot | java.lang.RuntimeException: boom |
| 00:37 | alexbaranosky | tensorpudding: also checkout slingshot on github |
| 00:37 | tensorpudding | where is throw defined? |
| 00:37 | choffstein | If I am trying to upgrade a project to 1.3 and have a dependency that is still on 1.2, is there anything I can do to stop some conflicts? |
| 00:37 | tensorpudding | i didn't see it in the api docs |
| 00:38 | alexbaranosky | clojure.core?? |
| 00:38 | lazybot | alexbaranosky: What are you, crazy? Of course not! |
| 00:38 | clojurebot | this is not IRC, this is #clojure. We aspire to better than that. |
| 00:38 | alexbaranosky | (doc throw) |
| 00:38 | clojurebot | It's greek to me. |
| 00:38 | amalloy | tensorpudding: the compiler |
| 00:38 | tensorpudding | sorry |
| 00:38 | tensorpudding | i meant to say, which module is it in |
| 00:39 | alexbaranosky | clojurebot is pissed man |
| 00:39 | brehaut | tensorpudding: amalloy already told you: the compiler; its a special form |
| 00:39 | tensorpudding | oh |
| 00:39 | brehaut | http://clojure.org/special_forms#Special%20Forms--(throw%20expr) |
| 00:40 | choffstein | anyone use weavejester's hiccup library? |
| 00:40 | alexbaranosky | tensorpudding: http://clojuredocs.org/clojure_core/clojure.core/throw |
| 00:40 | amalloy | choffstein: most webapps use hiccup, though not all |
| 00:41 | tensorpudding | dang |
| 00:41 | choffstein | amalloy: yeah, I realized after typing it that it was a pretty stupid question |
| 00:41 | tensorpudding | i forgot |
| 00:41 | tensorpudding | to check the clojuredocs instead of the api page on clojure.org |
| 00:41 | choffstein | I'm trying to figure out if its dependence on 1.2.0 is breaking my 1.3.0 move |
| 00:42 | amalloy | choffstein: probably not. if you have the latest hiccup you're fine |
| 00:42 | choffstein | I can't find which dependency is breaking. I'm getting a strange error: java.lang.IllegalStateException: Can't dynamically bind non-dynamic var: clojure.contrib.pprint/*format-str* |
| 00:42 | amalloy | even if it depends on 1.2, so long as it doesn't use contrib |
| 00:44 | amalloy | that's pretty much what happens to everyone who tries to upgrade (including me). |
| 00:44 | tensorpudding | why does the api page on clojure.github.com not cover throw |
| 00:44 | amalloy | some dependency uses contrib, and old-style contrib isn't 1.3 compatible |
| 00:45 | brehaut | tensorpudding: because its not part of the api, its part of the compiler? |
| 00:45 | tensorpudding | hmm |
| 00:45 | tensorpudding | i had assumed let was a special form |
| 00:45 | tensorpudding | but it's a macro? |
| 00:45 | amalloy | so you have to track down who's using contrib, and update those |
| 00:46 | tensorpudding | brehaut, except clojuredocs has it |
| 00:46 | brehaut | let is a macro that wraps let* which is a special form |
| 00:46 | amalloy | try: $ lein pom && mvn dependency:tree |
| 00:46 | amalloy | this will at least tell you about *one* of your deps that uses contrib |
| 00:46 | brehaut | tensorpudding: clojuredocs is not an autogenerated project, its a curated by humans |
| 00:48 | tensorpudding | well |
| 00:48 | tensorpudding | it'd be more helpful if the info on clojuredocs were front-and-center on the clojure.org page |
| 00:49 | choffstein | amalloy: so does that mean I either need to a) fork the dep with the contrib dependency and try to move it to 1.3, b) not use the dep, or c) something else? |
| 00:49 | devn | tensorpudding: not always. |
| 00:49 | brehaut | tensorpudding: everything that makes clojuredocs great in some areas means its very weak in others |
| 00:49 | devn | tensorpudding: i agree, but it is not always the case that I want to see potentially mediocre example code. the clojure.org docs are very clear. |
| 00:49 | devn | they describe intent, philosophy, etc. |
| 00:49 | devn | clojuredocs is icing |
| 00:49 | amalloy | choffstein: often you can (c) use a more recent version of the dep that's already updated |
| 00:50 | tensorpudding | that's a reasonable point, that clojuredocs has possibly mediocre content, but it seems clearer and more helpful |
| 00:50 | devn | tensorpudding: yes, but now you probably see the issue: not everyone is looking for API docs |
| 00:50 | choffstein | I'm confused because none of my deps seem to depend on clojure-contrib :-\ |
| 00:51 | devn | they could make relatively short documentation pages long and difficult |
| 00:51 | devn | tensorpudding: you could always create a greasemonkey script or something that adds them to the page |
| 00:51 | tensorpudding | api docs are the main thing that i want when i go there now |
| 00:51 | tensorpudding | i read the reference |
| 00:52 | devn | tensorpudding: why not just use clojure.repl? |
| 00:52 | devn | ,(doc +) |
| 00:52 | clojurebot | "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See also: +'" |
| 00:52 | tensorpudding | i use doc 99% of the time |
| 00:52 | tensorpudding | but it doesn't help if i don't know what i'm looking for |
| 00:52 | devn | tensorpudding: do you have an example? not trying to grill you, just trying to understand |
| 00:52 | tensorpudding | browsing vs. querying |
| 00:52 | tensorpudding | well, i wanted to know how to throw an exception |
| 00:53 | tensorpudding | turns out that you use throw, a special form |
| 00:53 | tensorpudding | it wasn't in the api docs, i missed it |
| 00:54 | devn | tensorpudding: so you went to clojure.org and you weren't satisfied with the documentation there, so you went to clojuredocs? |
| 00:54 | devn | tensorpudding: is that correct? |
| 00:54 | tensorpudding | well, clojuredocs was pointed out to me |
| 00:55 | tensorpudding | for the second time |
| 00:55 | tensorpudding | i had heard of it before |
| 00:56 | devn | tensorpudding: so you think clojure.org should prominently display clojuredocs.org for the purposes of additional information? |
| 00:56 | tensorpudding | no |
| 00:56 | devn | tensorpudding: sorry, I'm just trying to understand what might have made your life easier. |
| 00:57 | tensorpudding | i just really wanted throw to have appeared in the place i expected to find it, the docs |
| 00:57 | devn | tensorpudding: 1.4.0 looks like it's going to get some documentation love FWIW |
| 00:58 | devn | tensorpudding: http://dev.clojure.org/display/design/Clojure+1.4+docstrings |
| 00:58 | tensorpudding | better docstrings would be nice |
| 00:59 | tensorpudding | helpful exceptions would be a lot nicer |
| 00:59 | devn | tensorpudding: you're in luck! http://dev.clojure.org/display/design/Clojure+1.4+error+messages :) |
| 00:59 | tensorpudding | well, that's good news |
| 01:00 | devn | nothing is done yet, but those concerns have definitely been heard before and there is an effort to make people's lives a bit easier in clojure land |
| 01:01 | amalloy | we should elect devn as Chief Finder-of-Things From dev.clojure.org |
| 01:01 | devn | amalloy: I am sort of a librarian |
| 01:03 | devn | amalloy: along those lines, I have a friend who thinks the idea of "architects" as they have been traditionally defined in large software development companies is wrong, but that what a lot of projects need is someone who knows the terrain, the papers to read, etc. |
| 01:04 | devn | amalloy: it's an interesting thought. "team librarian" -- the guy who knows which library you should use because he's reviewed its code and kicked its tires. |
| 01:06 | devn | tensorpudding: in the meantime, if i could suggest to you another tool you might use to avoid a trip to clojure.org: clojuredocs-client @ http://dev.clojure.org/display/design/Clojure+1.4+error+messages |
| 01:06 | devn | woops: https://github.com/dakrone/clojuredocs-client |
| 01:06 | tensorpudding | i'll check it out |
| 01:06 | devn | you can include that in your project and query clojuredocs' api from the REPL |
| 01:08 | Raynes | $examples clojure.core/defmulti |
| 01:08 | lazybot | https://gist.github.com/1387995 |
| 01:08 | clojurebot | eg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging |
| 01:08 | Raynes | $cd defmulti |
| 01:08 | lazybot | clojure.core/defmulti: http://clojuredocs.org/v/1989 |
| 01:08 | lazybot | clojure.core/defmulti: http://clojuredocs.org/v/5452 |
| 01:08 | Raynes | Or you can just use lazybot. ;) |
| 01:10 | amalloy | Raynes: seems like you could put those on one line |
| 01:10 | Raynes | amalloy: You proposed that before and I told you no then as well. |
| 01:10 | amalloy | well, i'll get back to you in a month when you've forgotten |
| 01:37 | amalloy | ~logs |
| 01:37 | clojurebot | logs is http://clojure-log.n01se.net/ |
| 02:40 | tuubow | in clojure if (= '(1) (quote (1))) is true then why (= '(1) (first '('(1) '(2)))) is false..is this a bug or i am doing something wrong.. |
| 02:41 | hiredman | what do you think is more likely? |
| 02:42 | tuubow | i am doing something wrong i guess |
| 02:42 | hiredman | and what do you think the best way to figure out what you are doing wrong is? |
| 02:42 | tuubow | but (first '('(1) '(2))) is (quote (1)) |
| 02:43 | tuubow | so it should be true. |
| 02:43 | hiredman | tuubow: is it? |
| 02:43 | hiredman | and what is '(1)? |
| 02:43 | hiredman | ,'(1) |
| 02:43 | clojurebot | (1) |
| 02:44 | tuubow | same thing isn't '(1) is same as (quote (1)) |
| 02:44 | hiredman | thats not (quote (1)) |
| 02:44 | hiredman | yes '(1) is the same as (quote (1)), but (list 'quote (list 1)) is not the same |
| 02:44 | hiredman | neither is ''(1) |
| 02:45 | hiredman | or (first '('(1))) |
| 02:45 | Raynes | &(first '('(1))) |
| 02:45 | lazybot | ⇒ (quote (1)) |
| 02:46 | hiredman | http://en.wikipedia.org/wiki/Lisp_%28programming_language%29#Self-evaluating_forms_and_quoting |
| 02:46 | tuubow | but how come then (= '(1) (quote (1))) is true |
| 02:46 | hiredman | be cause they are equal |
| 02:47 | hiredman | look, you need to spend sometime learning about quoting and how it works, sit down with a repl somewhere |
| 02:48 | tuubow | in repl when i type this (first '('(1) '(2))) it gives (quote (1)) |
| 02:48 | hiredman | sure |
| 02:48 | hiredman | ,(= (+ 1 2) 3) |
| 02:48 | clojurebot | true |
| 02:48 | hiredman | ,(= '(+ 1 2) 3) |
| 02:48 | clojurebot | false |
| 02:48 | hiredman | ,(= '3 3) |
| 02:48 | clojurebot | true |
| 02:48 | hiredman | ,(= ''3 3) |
| 02:48 | clojurebot | false |
| 02:49 | hiredman | ,''3 |
| 02:49 | clojurebot | (quote 3) |
| 02:49 | hiredman | ,3 |
| 02:49 | clojurebot | 3 |
| 02:49 | hiredman | ,'3 |
| 02:49 | clojurebot | 3 |
| 02:49 | tuubow | (= '(1) (first '('(1) '(2)))) so if replace (first '('(1) '(2))) with (quote (1)) it should be true |
| 02:49 | hiredman | like I said, sit down with repl and figure it out, a solid understanding of quoting will serve you well |
| 02:49 | tuubow | as (= '(1) (quote (1))) is true |
| 02:50 | hiredman | ,'(1) |
| 02:50 | clojurebot | (1) |
| 02:50 | hiredman | ,(quote (1)) |
| 02:50 | clojurebot | (1) |
| 02:50 | hiredman | ,(quote '(1)) |
| 02:50 | clojurebot | (quote (1)) |
| 02:51 | hiredman | anyway, I am going to put you on ignore now |
| 02:51 | tuubow | sorry i will look at it thanks. |
| 02:59 | raek | tuubow: '<foo> is just a shorthand for (quote <foo>). quote is also a special form |
| 02:59 | raek | when you evaluate a quote expression, the value is the "content" of the quote |
| 03:00 | raek | (quote x) evaluates to the symbol x. (quote (quote x)) evaluates to (quote x), i.e. a sequence of length two where the first element is the symbol quote and the second element is the symbol x |
| 03:02 | raek | so to evaluate (= '(1) (first '('(1) '(2)))) you first eval the arguments to =, namely '(1) and '('(1) '(2)) |
| 03:02 | raek | (quote 1) evaluates to 1 |
| 03:02 | raek | sorry |
| 03:03 | raek | '(1) is (quote (1)), which evaluates to (1) |
| 03:03 | raek | '('(1) '(2)) is the same as (quote ((quote (1)) (quote (2)))), which evaluates to ((quote (1)) (quote (2)))) |
| 03:04 | raek | (1) and ((quote (1)) (quote (2))) are not the same data, so (= ...) returns false |
| 03:08 | tuubow | thanks raek |
| 03:18 | jidotnet | Hi! Anybody knows if/when the videos of the Conj will be available? |
| 03:18 | amalloy | jidotnet: they will be available, supposedly sooner than last year's were, but i don't know details |
| 03:19 | G0SUB | amalloy |
| 03:20 | jidotnet | amalloy: thanks, is there a way to get an alert when that happens? |
| 03:21 | raek | tuubow: btw, you usually use vectors as sequence literals |
| 03:21 | raek | ,(= 1 (first [1 2 3])) |
| 03:21 | clojurebot | true |
| 03:21 | amalloy | jidotnet: probably if you follow @clojure_conj and #clojure_conj on twitter you'll find out |
| 03:22 | tuubow | well i am trying to implement set with this although clojure already has it.I would have gone to scheme for doing that but preferring clojure |
| 03:23 | tuubow | so was trying to implement a member function as there is one scheme |
| 03:24 | Raynes | jidotnet: @confreaks is supposed to tweet when videos are ready. |
| 03:24 | tuubow | and as scheme doesn't have vectors so can't use it |
| 03:25 | tuubow | it is a part of the assignment i am doing |
| 03:27 | raek | tuubow: in Clojure lists and quote work the same as in Scheme, except that you cannot have "dotted pairs" |
| 03:27 | amalloy | wait, they tweet all kinds of stuff i don't care about. i'll just assume someone i follow retweets |
| 03:29 | raek | (in Clojure-land you will hear about sequences which is a generalization of lists) |
| 03:29 | tuubow | raek, cons is there so i don't think i will need dotted pair,but i would have loved to have the member function on lists but i have implemented it now.I am loving clojure |
| 03:30 | raek | tuubow: yes, but you cannot have a non-sequence as the cdr |
| 03:30 | raek | ,(cons 1 1) |
| 03:30 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long> |
| 03:31 | amalloy | clojure makes it so easy to get a generalized version of member, so you don't really need member |
| 03:31 | amalloy | &(some #{5} (range 10)) |
| 03:31 | lazybot | ⇒ 5 |
| 03:31 | amalloy | &(some #{50} (range 10)) |
| 03:31 | lazybot | ⇒ nil |
| 03:31 | amalloy | &(some #{1 5} (range 10)) |
| 03:31 | lazybot | ⇒ 1 |
| 03:33 | tuubow | &(cons 1 '(1)) |
| 03:33 | lazybot | ⇒ (1 1) |
| 03:35 | tuubow | &(defn member "Looks for the member in the lists return false if not found else return part of the list" [key list] (if (nil? (first(seq list))) false (if (= key (first list)) list (member key (rest list))))) |
| 03:35 | lazybot | java.lang.SecurityException: You tripped the alarm! def is bad! |
| 03:36 | amalloy | tuubow: (member nil '(1 nil 2)) |
| 03:36 | tuubow | sorry i didn't know the lazybot don't expect functions |
| 03:36 | G0SUB | amalloy: isn't it possible to play with lazybot in a PM window? |
| 03:36 | amalloy | G0SUB: yes? |
| 03:37 | G0SUB | amalloy: I was thinking if people could just use the bot in a private window the channel noise could be reduced |
| 03:38 | tuubow | amalloy: yeah that is the corner case. |
| 03:38 | amalloy | indeed you can do that, and if people are being super-noisy i encourage it. but it's not like we're trying to have a philosophical conversation and being drowned out by lazybot |
| 03:38 | G0SUB | amalloy: not really, was curious about the possibility. thanks. |
| 05:19 | cataska | any one has "Practical Clojure" book ? I have a question on page 160 |
| 05:21 | G0SUB | cataska: I can try. have the book. |
| 05:22 | cataska | last sentence on page 160, "..., and because the update-average involves just processing and waiting for IO" |
| 05:23 | cataska | but update-averate is only processing with no IO, right ? |
| 05:23 | cataska | update-average |
| 05:23 | G0SUB | cataska: should read "and no waiting for IO..." |
| 05:24 | cataska | G0SUB: ok, thanks |
| 05:24 | cataska | it seems not in official errata |
| 05:25 | G0SUB | cataska: if IO in involved, you're better off using send-off |
| 05:25 | G0SUB | &(doc send-off) |
| 05:25 | lazybot | java.lang.SecurityException: You tripped the alarm! send-off is bad! |
| 05:25 | G0SUB | &(doc 'send-off) |
| 05:25 | lazybot | java.lang.SecurityException: You tripped the alarm! send-off is bad! |
| 05:25 | G0SUB | :( |
| 05:26 | cataska | G0SUB: :) |
| 05:26 | G0SUB | &doc |
| 05:26 | lazybot | java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc |
| 05:27 | G0SUB | hmm, this thing is broken. |
| 05:28 | G0SUB | &(:doc (meta #'clojure.core/send-off)) |
| 05:28 | lazybot | java.lang.SecurityException: You tripped the alarm! send-off is bad! |
| 05:28 | G0SUB | amalloy: are you guys using regex on the command as well? |
| 05:28 | G0SUB | it seems the var itself is blocked somehow. |
| 05:29 | amalloy | yes, it is. not using regexes, though; i don't see why that would be relevant |
| 05:29 | G0SUB | amalloy: can't I even see the docs of all the core fns? |
| 05:30 | amalloy | evidently not. it would be nice if we could tell you're using doc, and take out the blocks in that case; patches welcome |
| 05:30 | G0SUB | &(keys (ns-publics (:ns (meta #'clojure.core/first)))) |
| 05:30 | lazybot | java.lang.SecurityException: You tripped the alarm! ns-publics is bad! |
| 05:31 | G0SUB | :-) |
| 05:31 | G0SUB | amalloy: cool |
| 05:34 | G0SUB | amalloy: what about a doc plugin? won't that be easier? |
| 05:37 | Fossi | ,(doc 'send-off) |
| 05:37 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol> |
| 05:38 | Fossi | ,(doc send-off) |
| 05:38 | clojurebot | "([a f & args]); Dispatch a potentially blocking action to an agent. Returns the agent immediately. Subsequently, in a separate thread, the state of the agent will be set to the value of: (apply action-fn state-of-agent args)" |
| 05:39 | amalloy | G0SUB: sure |
| 05:55 | fliebel | I forked and basically rewrote a small utility. Not likely to get merged back, but I'm using it in a project. How should I distribute it? |
| 05:56 | fliebel | Actually, I did this twice. |
| 05:57 | fliebel | For now I just did lein install, but one way or another, I need to get it on Clojars or something. |
| 05:59 | fbru02 | hey guys how do i make the repl/swank overshadow some function when i evaluate it ? i think it's 1.2.1 onwards that the overshadowing doesn't occur automatically |
| 06:18 | tsdh | fbru02: What do you mean with overshadowing? Can you given an example? |
| 06:18 | fbru02 | tsdh: sorry, i just meant re-writing when re-evaluating |
| 06:21 | tsdh | fbru02: I still don't get it... You want to redefine some clojure functions when you do "lein repl" or M-x clojure-jack-in? |
| 06:22 | fbru02 | what i'm doing now : i load a bunch of functions using "(use 'ns1)" one of the fns is called foo. I want now to load foo from my souce code so i step on another function called foo and evaluate it, that doesn't work i get an exception |
| 06:22 | fbru02 | is there a way no to get an exception ? |
| 06:23 | fliebel | drewr: https://github.com/drewr/postal/issues/13 |
| 06:29 | fliebel | Hm, how do I push a project to org.clojars.pepijndevos/whatever? |
| 06:30 | clgv | fliebel: create an account. add an ssh public key of your computer and copy it per scp there. |
| 06:30 | clgv | it = jar |
| 06:30 | fliebel | clgv: Yes, but the namespace. |
| 06:31 | clgv | oh right. I have no idea about that. I would have liked a description on my jar as well - but no idea ho to get it there |
| 06:31 | fliebel | clgv: Another project I pushed just ended up under foo:foo |
| 06:31 | clgv | yeah, my only project also landed there under its plain name |
| 06:32 | clgv | I miss some editing/managing functionality on clojars when you are logged in |
| 06:32 | fliebel | clgv: just, maybe puting the namespace in the project.clj or editing the po file might do the trick. let me see. |
| 06:33 | clgv | fliebel: there is a chance that you can provide metadata via project.clj, but the question is how^^ |
| 06:34 | fliebel | clgv: I'm pretty sure that if I change groupid in the pom, it'll work. |
| 06:34 | clgv | oh, I never touched the pom^^ |
| 06:35 | fliebel | clgv: ah, if I change project.clj to (defproject org.clojars.pepijndevos/ring-http-basic-auth, the pom changes its groupid to that. |
| 06:35 | clgv | ah, interesting |
| 06:37 | fliebel | clgv: What is your one project on clojars? |
| 06:37 | clgv | a leiningen plugin: lein-checkouts |
| 06:37 | clojurebot | leiningen is a build tool designed not to set your hair on fire (http://github.com/technomancy/leiningen) |
| 06:39 | clgv | fliebel: changing the project name to contain the group-id is also suggested in some tutorial I found |
| 06:39 | fliebel | clgv: As well as in my Java book :P |
| 06:40 | fliebel | clgv: Doesn't lein already do checkouts? |
| 06:40 | clgv | fliebel: I wanted to build all "checkouts" projects from the project that is using them. |
| 06:41 | clgv | like "lein checkouts uberjar" will "install" all "checkouts" and then build an uberjar of the current project |
| 06:41 | fliebel | oh, nice |
| 06:42 | clgv | yeah. that was a missing piece since I structured my main project in several libraries that I might share with students |
| 07:01 | Blkt | good day everyone |
| 07:36 | clgv | fliebel did it ;) |
| 07:36 | fliebel | clgv: ? |
| 07:36 | clgv | pushing to clojars ;) |
| 07:37 | fliebel | ,botsnack |
| 07:37 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: botsnack in this context, compiling:(NO_SOURCE_PATH:0)> |
| 07:37 | fliebel | hm |
| 07:37 | clgv | clojurebot: botsnack |
| 07:37 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 07:50 | fliebel | clgv: ? |
| 07:51 | clgv | fliebel: the pmap implementation is a nightmare briefly said - if you want to apply a function on a sequence. |
| 07:53 | clgv | I turned it into a producer-consumer scenario with a bounded queue which fits better for most parallelization purposes on sequences. |
| 07:53 | fliebel | clgv: ok, that is briefly, what is the full store? (maybe you could write it down in a Jira issue?) |
| 07:54 | fliebel | clgv: Talking about producer-consumer, seque is just as much of a nightmare. |
| 07:54 | clgv | fliebel: a jira issue does not fit. it has no bug - but is inappropriate in all cases I wanted to parallelize something. |
| 07:54 | clgv | &(doc seque) |
| 07:54 | lazybot | ⇒ ------------------------- clojure.core/seque ([s] [n-or-q s]) Creates a queued seq on another (presumably lazy) seq s. The queued seq will produce a concrete seq in the background, and can get up to n items ahead of the consumer. n-or-q can be an integer n bu... https://gist.github.com/1388585 |
| 07:55 | fliebel | Try running that with a priority queue. It makes invalid assumptions about what a que is. |
| 07:55 | clgv | &(source seque) |
| 07:55 | lazybot | ⇒ Source not found nil |
| 07:55 | fliebel | $source seque |
| 07:55 | lazybot | seque is http://is.gd/aZK2oD |
| 07:56 | clgv | I hate the slow github highlighting :( |
| 07:56 | clgv | humm lazybot linked another defn |
| 07:58 | fliebel | clgv: This is my implementation: https://gist.github.com/934781 |
| 07:59 | clgv | its hard to diff between two tabs ;) |
| 08:01 | fliebel | clgv: Basically the core version just puts and takes until it encounters itself. My version uses a second FIFO queue, to send to the other end what to do next. |
| 08:02 | clgv | ah ok |
| 08:03 | clgv | fliebel: my implementation definitely applies f to all items of the passed sequence but has a bounded queue size so that it wont run out of memory (I'll process big files with it) |
| 08:04 | fliebel | clgv: So it is basically like (pmap f (seque s limited-queue))? |
| 08:04 | fliebel | $source pmap |
| 08:04 | lazybot | pmap is http://is.gd/zPdiIH |
| 08:04 | clgv | fliebel: no pmap only processes a sliding window on consumption |
| 08:05 | fliebel | clgv: I don't get it. source? |
| 08:07 | clgv | fliebel: (lazy-)seq -> producer takes elements puts them into bounded queue -> queue -> consumer threads process items from queue and put the results in a result queue -> result queue -> returned lazy-seq reads from result queue |
| 08:07 | clgv | the producer will block when the bounded queue is full |
| 08:08 | clgv | so the entire calculation is async but you can acces already computed elements via the lazyseq as soon as they are calculated |
| 08:08 | fliebel | clgv: in order? Or just asap? |
| 08:08 | clgv | at the moment order is preserved but I also want a version where first calculated is first in result seq |
| 08:09 | clgv | I use it like (pprocess f coll :thread-count 4 :queue-size 8) |
| 08:11 | fliebel | clgv: I don't see why you have a queue for the producer. Presumably, f takes long, so the queue is just a buffer of realized items? |
| 08:12 | clgv | fliebel: to bound the items that are in memory the producer reads only as much as allowed |
| 08:12 | clgv | *many |
| 08:13 | fliebel | clgv: But if the input is a lazy seq, why realize even a buffer full of them? |
| 08:14 | clgv | fliebel: I dont understand your question |
| 08:15 | clgv | one problem there is that I cant let multiple threads access one lazy-seq like a queue |
| 08:16 | fliebel | clgv: Well, you have a lazy seq of unrealized items. You realize 8 ahead of time. Why not realize none at all? |
| 08:16 | fliebel | hmm, is that true? hm, I guess |
| 08:16 | clgv | fliebel: and how can the 4 consumer threads access the sequence like a queue? |
| 08:17 | fliebel | clgv: Not, unless you put it in an atom or something. |
| 08:18 | fliebel | ref, even |
| 08:18 | clgv | fliebel: extracting something from the lazy-seq means calculating it anyways |
| 08:18 | clgv | so I have to realize an item to pass it into a thread |
| 08:18 | fliebel | clgv: Yea, so you just go ahead and put it in a queue, I get it. |
| 08:20 | clgv | fliebel: indeed you have to be aware to put all of the expensive computation in the function and not some of it in the lazyseq |
| 08:26 | clgv | fliebel: one could think of a concurrent lazy-seq that acts like a queue by passing elements out as futures one-by one |
| 08:26 | notostraca | How do I pass the contents of a seq as arguments to a constructor that takes lots of arguments? |
| 08:26 | notostraca | Like apply, but for a constructor |
| 08:27 | clgv | notostraca: if you cant write a function for it in advance (manually or as part of a macro) you probably have to fall back to reflection |
| 08:27 | fliebel | notostraca: (apply new object seq)? |
| 08:27 | notostraca | clgv, I never quite figured out macros |
| 08:27 | notostraca | fliebel, I will try it |
| 08:27 | clgv | fliebel: that works? |
| 08:28 | fliebel | clgv: No idea... |
| 08:28 | clgv | ,(apply new java.util.Date []) |
| 08:28 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: new in this context, compiling:(NO_SOURCE_PATH:0)> |
| 08:28 | fliebel | no, new is a special form :( |
| 08:29 | clgv | I dont think it is possible. but for a defrecord you can enhance the defrecordmacro to create a factory function in 1.2 or use the automatically generated one in 1.3 |
| 08:30 | notostraca | clgv, I am using defrecord... |
| 08:30 | clgv | clojure 1.3? |
| 08:30 | notostraca | no, not yet |
| 08:30 | notostraca | I am using CCW in Eclipse, which hasn't updated yet |
| 08:31 | notostraca | is there a better way, I wonder... |
| 08:31 | clgv | notostraca: thats not an issue simply delete the clojure jars and replace them with 1.3 ones if nothing else helds you back |
| 08:31 | notostraca | so what would I use in 1.3? |
| 08:31 | notostraca | for this particular problem |
| 08:32 | notostraca | I will switch now if it fixes it... |
| 08:32 | cemerick | notostraca: you can use 1.3 in your projects with ccw without a problem |
| 08:32 | clgv | (->Rec 1 2 3) for (defrecord Rec [a b c]) |
| 08:32 | clgv | in your case: (apply ->Rec [1 2 3]) |
| 08:33 | notostraca | clgv, great |
| 08:33 | clgv | CCW: just installs default clojure 1.2 in your new project but that doesnt prevent you from switching to 1.3 |
| 08:34 | clgv | maybe it should have an option for selecting 1.2.1 or 1.3.0 |
| 08:35 | fliebel | Would it be possible to somehow proxy an instance of a class? I want to extend it, but it doesn't have a public constructor. |
| 08:35 | fliebel | omg, I can of course just define a protocol and extand that to it. |
| 08:35 | clgv | fliebel: you can call the constructor via reflection anyway and use it as aggregate |
| 08:36 | clgv | protocol approach is much better if possible ^^ |
| 08:37 | pyr | i supposed core.incubator is meant to get into core eventually |
| 08:37 | fliebel | clgv: Yea, I'll do that. I'm trying to handle java.xmail.* objects nicely, so i converted them to maps, but now I can't use the methods of the objects anymore of course. |
| 08:38 | clgv | fliebel: writing the next spambot? ;) |
| 08:39 | fliebel | clgv: Almost... more like a... web mail rss twitter client... I need to work on my elevator pitch. |
| 08:39 | clgv | "elevator pitch"? |
| 08:40 | fliebel | clgv: short introduction, like you stand in the elevator with an investor, and you have 10 seconds to explain your product. |
| 08:41 | clgv | fliebel: ah. you got a startup? |
| 08:41 | fliebel | clgv: hmmm, dunno, I guess you could call it that. A serious project at least. |
| 08:43 | clgv | fliebel: so you are still hanging out in elevators waiting for the investors? ;) |
| 08:43 | fliebel | clgv: nope, I just started building, and i want to take it to WebFWD. |
| 08:44 | clgv | didnt know about that program, yet |
| 08:45 | fliebel | clgv: Random question: where are you from? |
| 08:45 | clgv | fliebel: seems not that random. germany. |
| 08:47 | clgv | and you? |
| 08:47 | fliebel | clgv: How is it not random? Netherlands. |
| 08:49 | clgv | fliebel: scientifically speaking "cant judge since we didnt tie the model". personally, it just doesnt seem random like 11111 doesnt seem ;) |
| 08:50 | fliebel | clgv: Well, yea, it's a perfectly normal question, but one moment we're talking about clojure, the next I ask where you are from. |
| 08:51 | notostraca | OK, I'm debugging now, it is getting the wrong number of arguments somehow |
| 08:51 | fliebel | (tbh, I mostly assume everyone who speaks reasonable english is an american) |
| 08:51 | notostraca | It might be that I defined the record with 1 field? |
| 08:52 | fliebel | notostraca: paste? |
| 08:53 | notostraca | sure, it's kinda a mess and it is meant to read in a TSV table |
| 08:54 | notostraca | http://pastebin.com/AwbSxKdu |
| 08:55 | notostraca | the TSV file is pasted directly from a spreadsheet |
| 08:55 | notostraca | the column names are the first row, everything after that is data |
| 08:56 | clgv | notostraca: I have the feeling you are using defrecord strangely |
| 08:56 | notostraca | clgv, yeah |
| 08:56 | clgv | notostraca: the defrecord contains the header and the map part of the defrecord the values? |
| 08:56 | notostraca | I need to define it at runtime |
| 08:56 | clgv | notostraca: defining at runtime is not a problem |
| 08:57 | notostraca | clgv, I am calling defrecord with a vector drawn from parsing the file |
| 08:57 | notostraca | I don't know if that works |
| 08:57 | clgv | notostraca: did you have a look at incanter and how they manage their datasets? |
| 08:57 | notostraca | I don't know what incanter is |
| 08:57 | clgv | $google incanter |
| 08:57 | lazybot | [Incanter: Statistical Computing and Graphics Environment for Clojure] http://incanter.org/ |
| 08:57 | clgv | thats it^^ |
| 08:58 | clgv | if you need any visualization for your data you should consider it |
| 08:59 | notostraca | clgv, no I don't think I need that |
| 08:59 | clgv | ok, you might have a look at their dataset implementation - they have a defrecord for it as well |
| 08:59 | notostraca | I just need to get this in a hashmap of things, so I can persist it as clojure code with prn |
| 08:59 | notostraca | it doesn't need to be records |
| 09:00 | clgv | afaik they divided it into a headerfield and a rows field |
| 09:00 | notostraca | there's some old code in that paste that gets the TSV into a sorted-map of hash-maps of strings |
| 09:01 | clgv | the header contains the keywords for the columns and the rows field contains the row data with each row beaing a hashmap from column name (keyword) to value |
| 09:01 | notostraca | but ideally it would be able to take integer fields in the TSV and convert them to ints instead of strings |
| 09:01 | pyr | is there a cleaner (simpler) way to sanitize a map |
| 09:01 | clgv | that layout could work for you as well |
| 09:01 | pyr | than this: |
| 09:02 | notostraca | pyr: pastebin |
| 09:02 | pyr | (->> {:a nil, :b :foo} (filter #(val %)) (reduce merge {})) |
| 09:02 | notostraca | clgv, it doesn't seem like it needs a lib dependency honestly |
| 09:03 | clgv | yes. you can easily build it like that as well. |
| 09:03 | pyr | notostraca: i don't think it's warranted |
| 09:03 | clgv | notostraca: ^^ |
| 09:05 | clgv | pyr: you could do a reduce + dissoc approach to keep sharing structure |
| 09:06 | pyr | reduce dissoc on keys ? |
| 09:08 | clgv | pyr: (let [m {:a nil, :b :foo}] (reduce #(dissoc % %2) m (filter nil? (keys m)))) |
| 09:08 | clgv | &(let [m {:a nil, :b :foo}] (reduce #(dissoc % %2) m (filter nil? (keys m)))) |
| 09:08 | lazybot | ⇒ {:a nil, :b :foo} |
| 09:09 | fliebel | clgv: filter is wrong |
| 09:09 | clgv | damn... somehting missing. #(let [m {:a nil, :b :foo}] (reduce #(dissoc % %2) m (filter #(nil? (m %)) (keys m)))) |
| 09:09 | clgv | &(let [m {:a nil, :b :foo}] (reduce #(dissoc % %2) m (filter #(nil? (m %)) (keys m)))) |
| 09:09 | lazybot | ⇒ {:b :foo} |
| 09:10 | fliebel | clgv: ##(+ 1 1) |
| 09:10 | lazybot | ⇒ 2 |
| 09:10 | clgv | yeah. typo^^ |
| 09:10 | pyr | actually, mine should read (->> {:a nil, :b :foo} (filter val) (reduce merge {})) |
| 09:10 | pyr | ,(->> {:a nil, :b :foo} (filter val) (reduce merge {})) |
| 09:10 | clojurebot | {:b :foo} |
| 09:10 | pyr | &(->> {:a nil, :b :foo} (filter val) (reduce merge {})) |
| 09:10 | lazybot | ⇒ {:b :foo} |
| 09:11 | clgv | pyr: yours doesnt share structure with the old map. thats only not that optimal if the map is large and there are few "nil keys" |
| 09:12 | pyr | clgv: agreed |
| 09:14 | fliebel | I really wish clojure used protocols, so I could extend java.foo.Bar to clojure.lang.IBaz |
| 09:16 | notostraca | what is the equivalent of (last) that drops the last element instead of the first? |
| 09:17 | notostraca | like first, but all of the entries but the last |
| 09:17 | joegallo | butlast, drop-last |
| 09:17 | notostraca | thanks |
| 09:18 | joegallo | http://clojure.github.com/clojure/ (Ctrl+F, "last" and looked around) |
| 09:18 | joegallo | ;) |
| 09:18 | notostraca | butlast doesn't show up? |
| 09:19 | notostraca | in clojure.core |
| 09:19 | notostraca | huh, nvm |
| 09:21 | clgv | you can use lazybot as well |
| 09:21 | clgv | $findfn [1 2 3 4] [1 2 3] |
| 09:21 | lazybot | [clojure.core/butlast clojure.core/drop-last clojure.core/pop] |
| 09:22 | bendlas | wut? |
| 09:22 | bendlas | that's advanced |
| 09:25 | pyr | $findfn {:a nil :b :foo} {:b :foo} |
| 09:25 | lazybot | [] |
| 09:28 | clgv | it cant build functions compositions although that should be doable as well until the timeout strikes ;) |
| 09:29 | marchdown | hello |
| 09:31 | notostraca | hmm, maybe that's it |
| 09:32 | notostraca | can you create records with string keys? |
| 09:32 | notostraca | or do they have to be symbols? |
| 09:32 | clgv | defrecord will always have keywords of the symbols you provide |
| 09:32 | notostraca | ah |
| 09:33 | clgv | but you can easily create a keyword via ##(keyword "bla") |
| 09:33 | lazybot | ⇒ :bla |
| 09:33 | notostraca | so there's the problem |
| 09:33 | notostraca | and if there's a space in "some random phrase" ? |
| 09:33 | notostraca | ,(keyword "something happy...") |
| 09:34 | clojurebot | :something happy... |
| 09:34 | notostraca | woah what |
| 09:34 | clgv | thats probably a bad idea since it works but is not supposed to, i.e. you cant read it back |
| 09:34 | clgv | ,(read-string (with-out-str (pr (keyword "something happy...")))) |
| 09:34 | clojurebot | :something |
| 09:35 | notostraca | is there a way to format a string nicely as a symbol? |
| 09:35 | clgv | there is also ##(symbol "bla") |
| 09:35 | lazybot | ⇒ bla |
| 09:35 | clgv | &(class (symbol "bla")) |
| 09:35 | lazybot | ⇒ clojure.lang.Symbol |
| 09:35 | notostraca | (symbol "oh yeah") |
| 09:35 | notostraca | ,(symbol "oh yeah") |
| 09:35 | clojurebot | oh yeah |
| 09:36 | notostraca | ah |
| 09:36 | joegallo | ,(name 'foo) |
| 09:36 | clojurebot | "foo" |
| 09:36 | joegallo | oh, that's backwards from what you want. :) |
| 09:36 | marchdown | I'm struggling to install clojure. $ java -cp clojure.jar works, but lein barfs out an error. |
| 09:36 | notostraca | marchdown, lein should grab its own clojure |
| 09:36 | notostraca | i think it needs maven |
| 09:37 | notostraca | maybe you need to run "lein self-install" |
| 09:37 | joegallo | mmm.... i'm not sure about that. marchdown, can you gist the error you're getting? |
| 09:37 | notostraca | maybe you need to run "lein selfinstall" instead, not sure what the word is |
| 09:37 | duck1123 | lein uses maven stuff, but it doesn't actually need maven installed |
| 09:38 | marchdown | I don't know the first thing about maven, but I've run 'mvn install' in clojure repo as per instructions, and it did something. I'm on a mac with system-provided java. |
| 09:39 | joegallo | yeah, i don't think that does what you'd like it to do |
| 09:39 | joegallo | that's "install this jar into my local .m2 directory" |
| 09:39 | joegallo | which isn't quite as awesome as it sounds... :) |
| 09:39 | notostraca | marchdown, have you run lein just as "lein" ? |
| 09:39 | duck1123 | Some clojure projects use maven, also as part of lein install, a basic pom file is created |
| 09:40 | marchdown | https://gist.github.com/1388808 |
| 09:40 | joegallo | don't try to install leiningen 2.0.0 |
| 09:40 | joegallo | it's a highly experimental in-development version -- i think |
| 09:41 | notostraca | use stable -- https://raw.github.com/technomancy/leiningen/stable/bin/lein |
| 09:42 | notostraca | you can probably just wget that |
| 09:43 | notostraca | download that into somewhere on your PATH, like /usr/bin , "chmod 755 lein", "./lein" |
| 09:44 | notostraca | you may need to run the last two as sudo if you put it somewhere where you need root permission to write |
| 09:45 | duck1123 | I prefer to put mine in ~/bin or similar, that way I can upgrade without sudo |
| 09:45 | marchdown | cool, thanks. I'm feeling so stupid now for not noticing it was a plain old 404. The reason is, this is the second box I'm installing clojure on, and the first time I had an error at the same stage, but it was far more cryptic. |
| 09:45 | duck1123 | just have to make sure that dir is on PATH |
| 09:46 | marchdown | Okay. So, how'd I hook it up with emacs now? |
| 09:46 | marchdown | I need a clojure-runner script, right? |
| 09:46 | joegallo | no |
| 09:47 | notostraca | marchdown, are you familiar with emacs? Because I'm not, and there are good IDE plugins too |
| 09:47 | notostraca | and the IDE plugins probably have better support for Java, though I can't be certain |
| 09:47 | marchdown | I am. |
| 09:47 | notostraca | ok |
| 09:48 | joegallo | you need clojure-mode |
| 09:48 | marchdown | Got that. |
| 09:48 | joegallo | you need lein-swank-[latest stable version].jar in you ~/.lein/plugins/ directory. |
| 09:48 | notostraca | in that case, I imagine you will be sticking with mostly- or pure-clojure projects, which will be pleasant compared to switching your mindset from one to the other |
| 09:55 | dabl | hi all, /quit |
| 10:06 | notostraca | is there a good way to get an Integer or int or some number from a String in clojure? |
| 10:07 | kephale | ,(read-string "1") |
| 10:07 | clojurebot | 1 |
| 10:07 | notostraca | huh good to know |
| 10:07 | notostraca | ,(read-string "1 2 3 4" |
| 10:07 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading> |
| 10:07 | notostraca | ,(read-string "[1 2 3 4]") |
| 10:07 | clojurebot | [1 2 3 4] |
| 10:07 | notostraca | ,(read-string "1 2 3 4") |
| 10:07 | clojurebot | 1 |
| 10:08 | joegallo | ,(doc read-string) |
| 10:08 | clojurebot | "([s]); Reads one object from the string s" |
| 10:09 | notostraca | ,(/ (read-string "1") 3) |
| 10:09 | clojurebot | 1/3 |
| 10:10 | Wild_Cat | ,(Integer. "2") |
| 10:10 | clojurebot | 2 |
| 10:12 | clgv | notostraca: there is also Integer/parseInt |
| 10:13 | notostraca | I'm going to read-string on every value, individually -- it handles string data so I don't need to have types as part of the data |
| 10:16 | fliebel | notostraca: read-string is a bit of a security issue, I think. I don't know if that matters to you. |
| 10:18 | jcromartie | So I was playing with this on the train this morning: https://gist.github.com/1388915 |
| 10:18 | jcromartie | creating a temporary memoization context for certain functions... is there any chance that this is already idiomatic? |
| 10:18 | notostraca | fliebel, I am making the data in a spreadsheet, so it will be fine |
| 10:18 | jcromartie | it makes writing this kind of math code very nice |
| 10:19 | fliebel | notostraca: I just saw you already evaluated a list. |
| 10:19 | clgv | ,(read-string "(System/exit 0)") |
| 10:19 | clojurebot | (System/exit 0) |
| 10:20 | clgv | ,(read-string "(eval (System/exit 0))") |
| 10:20 | clojurebot | (eval (System/exit 0)) |
| 10:20 | clgv | lol |
| 10:20 | clgv | ,(eval (read-string "(System/exit 0)")) |
| 10:20 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 10:20 | clgv | hehe ok^^ |
| 10:20 | clgv | so read-string cant do any harm I guess, since it is not evaling |
| 10:21 | clgv | ,(read-string "#=(System/exit 0)") |
| 10:21 | clojurebot | #<RuntimeException java.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.> |
| 10:21 | clgv | ,(binding [*read-eval* true] (read-string "#=(System/exit 0)")) |
| 10:21 | clojurebot | #<RuntimeException java.lang.RuntimeException: java.lang.ClassNotFoundException: System> |
| 10:21 | floatboth | clgv: sandbox won't let you eval anyway |
| 10:21 | fliebel | jcromartie: You should talk to fogus, he's putting a memoization lib in contrib. |
| 10:22 | jcromartie | I got my math wrong :P |
| 10:26 | fliebel | Do there exist functions for translating and selecting keys from a map? {:foo 1 :bar 2} -> {:baz 2} |
| 10:28 | fliebel | wee, armagedom :) |
| 10:28 | fliebel | clojurebot: botsnack |
| 10:28 | clojurebot | Thanks! Can I have chocolate next time |
| 10:28 | fliebel | I'll see... |
| 10:29 | clgv | fliebel: select-keys, rename-keys |
| 10:30 | clgv | $findfn {:bar 2}{:baz 2} |
| 10:30 | lazybot | [] |
| 10:30 | clgv | $findfn {:bar :baz} {:bar 2}{:baz 2} |
| 10:30 | lazybot | [] |
| 10:30 | clgv | $findfn {:bar 2} {:bar :baz} {:baz 2} |
| 10:30 | lazybot | [clojure.set/rename-keys] |
| 10:31 | fliebel | ah, it's hiding in set... |
| 10:31 | clgv | yep, they always do ;) |
| 10:33 | fliebel | clgv: Maybe it should be named clojure.map then... |
| 10:33 | fliebel | I should revive clojure-quiz |
| 10:34 | clgv | &(keys #{1 2 3}) |
| 10:34 | lazybot | java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Map$Entry |
| 10:34 | clgv | &(rename-keys #{:a :b :c} {:a :z}) |
| 10:34 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: rename-keys in this context |
| 10:34 | clgv | &(use 'clojure.set) |
| 10:34 | lazybot | ⇒ nil |
| 10:35 | clgv | &(rename-keys #{:a :b :c} {:a :z}) |
| 10:35 | lazybot | java.lang.ClassCastException: clojure.lang.PersistentHashSet cannot be cast to clojure.lang.Associative |
| 10:35 | clgv | fliebel: yes it should be renamed indeed ^^ |
| 10:35 | fliebel | hm, what about rename-keys-in? [:foo bar] [:baz] :D |
| 10:36 | apgwoz | has anyone used the ring-netty-adapter ? |
| 10:37 | clgv | no I meant clojure.set -> clojure.map |
| 10:43 | fliebel | apgwoz: *netty*? Interesting. No, but I've used Aleph, which uses Netty. |
| 10:43 | fliebel | .. and provides a ring wrapper. |
| 10:44 | apgwoz | fliebel: might be worth finally jumping into aleph if that's the case. cool, i'll have a look |
| 10:45 | apgwoz | is there a specific ring-aleph-adapter? or were you just doing (respond! (ring-handler whateer)) like i saw in an old clojure list thread? |
| 10:46 | apgwoz | fliebel: nevermind. gonna research aleph. the answers probably sitting there waiting for me to read it |
| 10:46 | apgwoz | :) |
| 10:47 | fliebel | apgwoz: I can't remember either. |
| 10:48 | apgwoz | fliebel: looks like aleph.http has (wrap-ring-handler ...) that is the magic button |
| 10:50 | clgv | $inc aleph |
| 10:50 | lazybot | ⇒ 2 |
| 10:57 | cemerick | huh, didn't realize you didn't need a handle for that |
| 10:57 | cemerick | $inc kittens |
| 10:57 | lazybot | ⇒ 1 |
| 10:59 | jidotnet | cemerick: just had a look at your conj slides |
| 11:00 | jidotnet | cemerick: any idea when the code will be available? |
| 11:02 | cemerick | jidotnet: should have been out already. I'm running behind on about 83 different things. :-| |
| 11:02 | cemerick | I'll definitely make some noise when it's up :-) |
| 11:04 | jidotnet | cemerick: cool thanks; i'll keep whatching ;) |
| 11:16 | jweiss | can someone recommend a way to have metadata added to an object (eg, with ^{:my :meta} that doesn't overwrite the meta that is already there? |
| 11:17 | jweiss | or can i not use ^ at all, must i do (with-meta obj (merge (meta obj) newmeta)) |
| 11:25 | clgv | jweiss: there is vary-meta - see ##(doc vary-meta) |
| 11:25 | lazybot | ⇒ ------------------------- clojure.core/vary-meta ([obj f & args]) Returns an object of the same type and value as obj, with (apply f (meta obj) args) as its metadata. nil |
| 11:26 | jweiss | clgv: thanks, was hoping to be able to use ^ but that does not appear possible. i'll just make a function with a short name to make it convenient for my users :) |
| 12:02 | fliebel | Where and how do you usually store configuration? |
| 12:03 | fliebel | for a web app |
| 12:05 | duck1123 | I have a library that allows you to store config maps in the root of the project and then query them like (config :foo :bar :baz) |
| 12:05 | duck1123 | It'll merge the default environment with the specified environment |
| 12:06 | duck1123 | It works well enough for my needs |
| 12:11 | fliebel | duck1123: Nice idea. |
| 12:13 | duck1123 | fliebel: If you're interested https://github.com/duck1123/ciste/blob/master/src/ciste/config.clj |
| 12:16 | reiddraper | I'm trying to understand the difference between clojure.lang.Seqable and clojure.lang.ISeq, could just be that my java-reading skills are rubbish |
| 12:17 | cemerick | Seqables can provide an ISeq |
| 12:18 | reiddraper | cemerick: If I'm making a new type with deftype, which should I be looking to implement, both then? |
| 12:18 | cemerick | The tricky part is that `seq` provides polymorphism that isn't entirely captured by Seqable. |
| 12:18 | joegallo | sounds like iterables which can return an iterator, from java collections |
| 12:18 | cemerick | That's the right corollary. |
| 12:19 | cemerick | reiddraper: if your type *is* a seq, then implement ISeq (or some derivative). If it can provide a seq, Seqable. |
| 12:19 | cemerick | 'course, the former extends the latter |
| 12:20 | reiddraper | cemerick: ok that makes sense. I'm making a Set, so it sounds like I want to provide a seq |
| 12:20 | reiddraper | on second that, i suppose a set *is* a seq |
| 12:20 | reiddraper | s/that/thought |
| 12:21 | cemerick | how is a set a seq? |
| 12:21 | hiredman | no |
| 12:21 | reiddraper | maybe i have a poor seq definition |
| 12:21 | Chousuke | most things aren't seqs |
| 12:21 | Chousuke | but lots of things are seqable |
| 12:22 | Chousuke | in core only lists are true seqs (and lazy seqs of course) |
| 12:22 | cemerick | The only built-in that are their own seqs are lists |
| 12:22 | cemerick | hah |
| 12:22 | cemerick | oh, Cons too :-P |
| 12:24 | reiddraper | i remember coming across definitions for these before... so are all things that *are* seqs, sequential? |
| 12:28 | cemerick | for want of a reasonable class hierarchy viewer online |
| 12:28 | cemerick | oh, hah |
| 12:29 | cemerick | reiddraper: http://www.clojureatlas.com/org.clojure:clojure:1.2.0?guest=t#clojure.lang.Sequential — click on the 'i' or roll over 'Sequential' while holding down Ctrl. |
| 12:29 | reiddraper | cemerick: cool, thanks |
| 12:52 | shequo | I'm interested in learning about how clojure implements efficient creation of modified datastructures via structural sharing etc...can anyone point me in a good direction to research this? |
| 12:52 | fliebel | What kind of magic could be going on here? I have a ring handler, if I call it on the repl, I get a result, if I launch jetty with it, a weird NullPointerException. |
| 12:53 | fliebel | shequo: You could try the research papers for them. |
| 12:53 | dnolen | shequo: Okasaki - Purely Functional Data Structures |
| 13:00 | fliebel | Magic: The handler has no default route, returns nil, end of story. |
| 13:12 | antares_ | hey. I have a question: where do I need to sign up to publish jars to oss.sonatype.org? Looks like clojars.org is having some issues, my freshly published jars cannot be accessed even though project page loads fine and displays the version I pushed. |
| 13:44 | gfredericks | anybody know what's messed up if my `lein repl` goes nuts whenever I backspace? |
| 13:45 | gfredericks | by "goes nuts" I mean continues functioning properly, but deletes a bunch of characters so I can't tell what's going on |
| 13:48 | duck1123 | gfredericks: does it do this even if you open a new terminal? |
| 13:49 | gfredericks | hmm, no |
| 13:49 | gfredericks | it's been happening for a day or two now, across different terminal instances. I'm not sure what the common thread is |
| 13:50 | gfredericks | oh let me try it with this particular project... |
| 13:50 | duck1123 | are you printing out "odd" values? |
| 13:50 | gfredericks | nope |
| 13:51 | gfredericks | okay, it does do it for this project |
| 13:52 | gfredericks | maybe it's this dependency on jruby |
| 13:53 | gfredericks | yep, remove jruby dep and it's better |
| 13:53 | gfredericks | well if there's one thing you can count on ruby to do, it's magical crap in the background that you have no hope of ascertaining. |
| 13:54 | duck1123 | don't forget screwing up your UTF-8 |
| 13:55 | gfredericks | duck1123: thanks for rationally talking me through it. Being punished for backspacing can make you go batty. |
| 13:56 | duck1123 | bah! real programmers don't need backspace. Everything is perfect the first time. |
| 13:57 | gfredericks | That'd be a funny feature for an elite keyboard |
| 13:57 | moogatronic | or a mode for emacs. |
| 13:57 | amalloy | gfredericks: but ^H would still work |
| 13:58 | amalloy | gfredericks: if jruby was a problem, i bet it's because it pulls in a ruby version of readline, conflicting with the one your system wants to use |
| 13:58 | gfredericks | amalloy: holy crap this might drastically improve my life |
| 13:59 | gfredericks | by which I mean my finger pain |
| 13:59 | gfredericks | does ^H work everywhere? |
| 13:59 | amalloy | anywhere that expects emacs/readline-style stuff |
| 13:59 | amalloy | on a mac, i think that's pretty much anywhere |
| 13:59 | duck1123 | most of the emacs commands work in terminals |
| 13:59 | gfredericks | I'm on ubuntu |
| 14:00 | gfredericks | it works on irssi and in the bash terminal at least |
| 14:00 | duck1123 | I always feel so awesome when I make use of C-t correctly |
| 14:00 | moogatronic | i'd be surprised if it didn't do the same everywhere in ubuntu |
| 14:00 | amalloy | gfredericks: like i said, anyplace that uses readline |
| 14:00 | gfredericks | I bet it doesn't work in vim, but I'm sure that can be changed |
| 14:00 | amalloy | moogatronic: prepare to be surprised, bro |
| 14:00 | duck1123 | it's an option |
| 14:00 | gfredericks | is there a key shortcut for enter as well |
| 14:00 | amalloy | gfredericks: ^J |
| 14:01 | gfredericks | omg. |
| 14:01 | amalloy | *now* will you learn emacs? |
| 14:01 | gfredericks | no. |
| 14:01 | amalloy | gfredericks: you can also configure readline to use vim bindings instead of emacs bindings |
| 14:01 | amalloy | in your .inputrc i think |
| 14:02 | duck1123 | gfredericks: https://help.ubuntu.com/community/AdvancedCommandlineHowto |
| 14:02 | gfredericks | oh ^H and ^J both work in vim |
| 14:02 | gfredericks | duck1123: that looks like a good link |
| 14:02 | amalloy | it seems weird to me that you'd want to use them in vim, though. doesn't vim encourage you to go into edit-mode and then type d<something>? |
| 14:03 | duck1123 | actually, not as good as I'd hoped for the key shortcuts |
| 14:03 | amalloy | dh, i guess |
| 14:03 | gfredericks | amalloy: true, I probably don't really use backspace and enter in vim. I just expected I could get annoyed if I got used to ^H/J and then vim didn't support them |
| 14:03 | gfredericks | but you're right, probably wouldn't have mattered |
| 14:04 | gfredericks | I'll think about emacs. |
| 14:05 | gfredericks | I don't remember what my objections were. |
| 14:05 | moogatronic | also ^? .. (http://en.wikipedia.org/wiki/ASCII_code#ASCII_control_characters) |
| 14:06 | gfredericks | moogatronic: oh. that helps explain it better. |
| 14:09 | amalloy | haha that dang ^S. i've accidentally frozen a few consoles with that. i guess this was back when i had readline set up in vim mode, though, because ^S does something different normally |
| 14:22 | R4p70r | Let’s try this again. Is anyone in Canada looking for an entry-level Clojure dev? I’m in Montreal but willing to relocate. |
| 14:34 | amalloy | duck1123: thanks for that ascii link, btw. i knew most of that already, but noticing that escape characters get sent as ESC [ helped me figure out a problem i've been having, actually |
| 14:41 | gfredericks | Look maybe I'll think about emacs but not for another couple weeks. Gotta graduate first. |
| 14:44 | moogatronic | gfredericks: yeah, graduation > emacs. =) |
| 14:44 | gfredericks | huh. I just realized that ^J and ^H mirror the functionality of vim's 'j' and 'h' |
| 14:46 | gfredericks | At least in not-insert-mode |
| 14:50 | kephale | are you sure emacs doesn't have a key bind for degree completion? |
| 14:52 | gfredericks | even if it does I'm sure I'd forget it when I actually needed it |
| 15:11 | amalloy | like C-t |
| 15:13 | fliebel | amalloy: ? |
| 15:13 | kephale | never used that one |
| 15:14 | amalloy | fliebel: an emacs command you forget whenever you acutally need it (see what i did there? |
| 15:14 | kij | hey guys. Is there an form that would let me do a (dissoc { :a 1 :b 2 :c 3 } (unlist '(:b :c)) ) ... unlist would just return :b :c |
| 15:14 | amalloy | &(doc apply) |
| 15:14 | lazybot | ⇒ ------------------------- clojure.core/apply ([f args] [f x args] [f x y args] [f x y z args] [f a b c d & args]) Applies fn f to the argument list formed by prepending intervening arguments to args. nil |
| 15:14 | amalloy | &(apply dissoc {:a 1 :b 2 :c 3} [:b :c]) |
| 15:14 | lazybot | ⇒ {:a 1} |
| 15:17 | gfredericks | works because ##(dissoc {:a 1 :b 2 :c 3} :b :c) |
| 15:17 | lazybot | ⇒ {:a 1} |
| 15:18 | fliebel | amalloy: You wrote {:keys [tag attr content]}, do you mean that every node is actually a map? |
| 15:18 | amalloy | yes |
| 15:18 | kij | thanks! |
| 15:19 | kij | '(:a :b) -> :a :b, is not possible ? what should i read to understand why ? |
| 15:20 | amalloy | kij: because one thing is not two things |
| 15:20 | fliebel | amalloy: oh, ok. I'm just using sequences. |
| 15:20 | gfredericks | kij: you're saying you want dissoc to return the keys that you removed? |
| 15:21 | gfredericks | kij: if so, then it doesn't do that because you want it to return the map instead. Clojure maps are immutable, so dissoc creates a new map that doesn't have the keys. If it returned the keys, you wouldn't have the new map, so nothing would have happened. |
| 15:21 | amalloy | fliebel: hiccup uses vectors: [tag attrs & content] |
| 15:21 | kij | gfredericks: no, i would like to remove the list and get the single values. |
| 15:21 | amalloy | kij: it is not possible to return two values from a function |
| 15:21 | fliebel | amalloy: I do the same, without the attrs, which is really convenient, because of the first/rest concept in Clojure. |
| 15:22 | amalloy | just like it is not possible to do that in c, or python, or... |
| 15:22 | gfredericks | kij: I'm not sure what that means |
| 15:22 | amalloy | gfredericks: he wants (unlist [1 2]) to return both 1 and 2, but not as a list |
| 15:22 | amalloy | so that he can splice it into some function call |
| 15:22 | gfredericks | amalloy: ah, that makes some sense of it |
| 15:23 | kij | gfredericks: what amalloy says :) |
| 15:23 | Raynes | So, he wants apply? |
| 15:23 | gfredericks | kij: then amalloy's original recommendation of using 'apply' is what you want |
| 15:23 | fliebel | kij: You can use destructuring: ##(let [[a b] '(1 2)] b) |
| 15:23 | lazybot | ⇒ 2 |
| 15:23 | Raynes | But doesnt know it? |
| 15:23 | Raynes | (apply + [1 2 3]) |
| 15:23 | amalloy | Raynes: arguably he should know it, because i said that already |
| 15:23 | Raynes | &(apply + [1 2 3]) |
| 15:23 | lazybot | ⇒ 6 |
| 15:24 | kij | i understand now. Thanks! |
| 15:25 | fliebel | How can I setup, run and test a Maven Clojure project, such as data.xml? |
| 15:25 | gfredericks | mvn clojure:[compile|test]? |
| 15:26 | fliebel | gfredericks: uhm, okay. Let me try... |
| 15:26 | duck1123 | mvn test and mvn compile work as well |
| 15:26 | amalloy | fliebel: just $ mvn test |
| 15:26 | duck1123 | or mvn clojure:swank or mvn clojure:repl |
| 15:27 | amalloy | duck1123: oh, good to know. i just added a project.clj locally to get swank |
| 15:27 | duck1123 | amalloy: be careful. lein install will clobber your pom.xml (but that's what git is for) |
| 15:36 | fliebel | amalloy: Huh, weird output... It sets the namespace as an attribute? Did you setNamespaceAware, as the ticket suggested? |
| 15:37 | amalloy | fliebel: that's actually a perfectly valid way to set the xmlns of a node |
| 15:37 | fliebel | amalloy: Okay, so the test is incorrect? |
| 15:37 | amalloy | by declaring "everything from here (inclusive) on down, is implicitly in the api namespace" |
| 15:37 | amalloy | fliebel: i think the test is *probably* over-specific, but like i said i don't know a ton about namespaces |
| 15:38 | amalloy | last time i had to know anything at all about them was five years ago |
| 15:39 | fliebel | amalloy: You are using SAX for everything, right? |
| 15:39 | amalloy | fliebel: no idea |
| 15:39 | amalloy | that stuff is all chouser's - mostly i just wrote the converter from hiccup-style to enlive-style |
| 15:40 | fliebel | amalloy: Which is which? |
| 15:40 | amalloy | hiccup: [tag {attrs} & content] |
| 15:40 | amalloy | enlive: {:keys [tag attrs content]} |
| 15:41 | fliebel | ArmageDOM: ^{attrs} [tag & content] |
| 15:41 | amalloy | MADNESS |
| 15:41 | brehaut | what |
| 15:41 | amalloy | i know, right? someone tell fliebel that attrs are not metadata |
| 15:42 | amalloy | fliebel: in fairness though i can see how that would be handy, and i can't immediately think of any ways it would cause a problem or be hard |
| 15:43 | fliebel | meta = about itself, data about the data: <link rel="base">http://example.com</link> |
| 15:43 | brehaut | ,(= ^{:href "http://example.com"} ["a" "a link"] ^{:href "http://google.com"} ["a" "a link"]) |
| 15:43 | clojurebot | true |
| 15:43 | brehaut | thats why its bad |
| 15:44 | amalloy | hah |
| 15:44 | amalloy | yes, wow that's bad. thanks, brehaut |
| 15:44 | brehaut | no problem |
| 15:45 | amalloy | brehaut: if you care to follow along, the discussion started at http://groups.google.com/group/clojure-dev/browse_thread/thread/dff8e406b7502a0b/0997aaf57a2d4c75?show_docid=0997aaf57a2d4c75 when fliebel kindly volunteered to help with data.xml |
| 15:45 | fliebel | hmm, good point. |
| 15:45 | brehaut | amalloy: ah right. /me catches up |
| 15:45 | amalloy | the metadata discussion isn't really germane, i was just astonished by his choice |
| 15:46 | dnolen | fliebel: attributes are not definitely not metadata |
| 15:46 | dnolen | metadata is not just data about data, it's data about data that should never be considered under equality |
| 15:46 | amalloy | btw fliebel: "at frist glance, mine doesn't have 20-line functions." i didn't get your point here |
| 15:48 | fliebel | amalloy: I mean to say the emit code is rather ugly, if you ask me: https://github.com/clojure/data.xml/blob/master/modules/xml/src/main/clojure/clojure/data/xml.clj#L285 |
| 15:49 | fliebel | dnolen: That is indeed a detail of clojure meta data I had not considered. |
| 15:49 | brehaut | wait. core.xml is seperate to clojure.xml ? |
| 15:50 | fliebel | brehaut: According to the readme, it might become clojure.xml later. |
| 15:51 | amalloy | i'm in favor of pulling the configuration out into a separate function, fliebel, but i suspect there's a good reason the code exists (ie, you couldn't just throw half of it away) |
| 15:51 | brehaut | fliebel: thanks; ive had to hack about with clojure.xml's emit for necessary-evil (thanks python xmlrpc imp); core.xml looks like it might fix the issue for me |
| 15:51 | brehaut | (https://github.com/brehaut/necessary-evil/blob/master/src/necessary_evil/xml_utils.clj#L30-53) |
| 15:52 | fliebel | amalloy: My initial iteration of ArmageDOM looked like that, but now it's broken into small bits. |
| 15:53 | amalloy | brehaut: so is python's impl incorrect and you need to cover for it, or clojure's is incorrect and you need to send python something more-correct |
| 15:53 | brehaut | amalloy: its python's thats dodge; new lines throw it out, which i dont believe should be a problem |
| 15:54 | brehaut | amalloy: and 1.2's emit-elements hardcoded emitting new lines (with println) |
| 15:54 | amalloy | i see. so you copied the code but changed println to print. very funny |
| 15:55 | brehaut | indeed; i couldnt think of a better way to do it :P |
| 15:55 | amalloy | wow clojure.xml is *really* old |
| 15:55 | brehaut | oh! https://github.com/brehaut/necessary-evil/blob/master/src/necessary_evil/xml_utils.clj#L42 that line is important |
| 15:56 | brehaut | im not sure if i was using the xml tools wrong, or if its an actual bug |
| 15:56 | fliebel | yea, structs and all |
| 15:56 | amalloy | check out the last three lines: |
| 15:56 | amalloy | ;(export '(tag attrs content parse element emit emit-element)) |
| 15:56 | amalloy | ;(load-file "/Users/rich/dev/clojure/src/xml.clj") |
| 15:56 | amalloy | ;(def x (xml/parse "http://arstechnica.com/journals.rssx")) |
| 15:56 | brehaut | but that version of emit wasnt escaping < > and & |
| 16:22 | fliebel | amalloy: I think setting http://xml.org/sax/features/namespace-prefixes to true, would fix the test, but I can;t figure out how to do it. |
| 16:24 | fliebel | call setFeature on *something* |
| 16:25 | amalloy | fliebel: indeed, that is the crux of most of the data.xml problems. "how do we set a damn feature" |
| 16:25 | fliebel | "Turn features on or off using setFeature." |
| 16:25 | amalloy | right, but features aren't standardized |
| 16:25 | amalloy | across the various impls |
| 16:26 | fliebel | amalloy: but, but... these are "SAX2 Standard Feature Flags" |
| 16:26 | amalloy | there are *some*. did you find one for indentation/pretty-print? |
| 16:26 | fliebel | amalloy: scroll down here: http://www.saxproject.org/apidoc/org/xml/sax/package-summary.html |
| 16:29 | amalloy | fliebel: i see the one for namespaces, but not for whitespace |
| 16:29 | fliebel | amalloy: me neither.... |
| 16:32 | fliebel | amalloy: http://apache.org/xml/features/dom/include-ignorable-whitespace ? |
| 16:33 | amalloy | fliebel: that's for parsing, not output. but not relevant anyway because it's apache-specific. we already set the apache indent-amount, but not every transformer is an apache transformer |
| 16:33 | amalloy | which is why this whole thing is a mess |
| 16:34 | fliebel | amalloy: so the project is waiting for a minor whitespace issue? |
| 16:34 | amalloy | yes, absurd as i personally think that is |
| 16:34 | amalloy | that's why a number of forks have sprung up on clojars |
| 16:36 | technomancy | we should have clojars alert a library maintainer once a threshhold of forks have been created |
| 16:36 | technomancy | "hey dude, I don't know if you've been paying attention, but you might want to do something about this..." |
| 16:38 | brehaut | technomancy: thats a great idea |
| 16:42 | fliebel | meta data counter-argument: href/src is so far the only one that would matter for equality. counter-example: <content type="xhtml">foo</content> <content type="html">foo</content> <content type="text">foo</content> |
| 16:43 | amalloy | fliebel: that is so, so wrong. what about ant build files? |
| 16:43 | fliebel | amalloy: What does an ant buidl file look like... googles. |
| 16:43 | amalloy | shield your eyes |
| 16:44 | amalloy | i'm just saying, attributes are an integral, important part of an xml element |
| 16:44 | amalloy | pretending they're metadata is bizarre |
| 16:45 | amalloy | in html, if you prefer: <input type="button" name="submit" /> vs <input type="text" name="name" value="your name here" /> |
| 16:47 | brehaut | fliebel: i think what you are confusing is that in most xml applications, the attributes are treated as a kind of meta data, but in a tool that is handling xml data, then that isnt meta data, its straight data |
| 16:47 | fliebel | amalloy: well, they are metadata, only not of the same kind as clojure meta data. |
| 16:50 | fliebel | brehaut: that is true. |
| 16:52 | tolstoy | Is there a handy clojure lib to deal with uint type of issues? |
| 16:52 | brehaut | tolstoy: most people just use one size larger primatives |
| 16:53 | fliebel | Now I have a problem, because I like neither the enlive or the hiccup syntax. The one is verbose, the other ambiguous. |
| 16:53 | tolstoy | brehaut: Okay. I've done all that before. I was hoping someone had a handy lib that could read byte-buffers and Do The Right Thing. ;) |
| 16:53 | brehaut | tolstoy: i dunno sorry |
| 16:54 | amalloy | fliebel: hiccup isn't ambiguous at all, it's just a teeny bit non-trivial to parse |
| 16:54 | tolstoy | brehaut: No prob! Just curious. |
| 16:55 | brehaut | fliebel: enlive is verbose because xml is verbose :P |
| 16:56 | fliebel | brehaut: I thought the point of a DSL was to... nvm, I'll just use (format "<xml>" foo bar) ;) |
| 16:57 | brehaut | fliebel: but you almost never need to reference the node enlive structure directly in either enlive or the older clojure.xml stuff |
| 17:00 | fliebel | amalloy: [:tag {:foo 1} "bar"], now did I make an attribute, or added a map as a child? |
| 17:00 | amalloy | you can't add a map as a child, because children are always vectors |
| 17:01 | amalloy | you can't have attrs free-floating in an xml document: they're attached to a tag |
| 17:01 | amalloy | you're right that it's awkward to add an attribute to a node that might or might not have an attr-map already; you can avoid this by creating nodes that have empty attr-maps instead of no map at all |
| 17:02 | amalloy | i guess you're saying that hiccup isn't a format that's easy to modify programmatically once it's been written - i agree with that |
| 17:04 | fliebel | amalloy: What I'm saying is that tag and content map nicely to key/value or first/rest, attr is why we can't have nice things. |
| 17:05 | Chousuke | that's a fault in XML :p |
| 17:05 | Chousuke | at least regarding a Clojure DSL design |
| 17:06 | fliebel | Chousuke: true |
| 17:10 | amalloy | kephale: i rebound C-t to transpose-sexps, which is something i use a lot more often |
| 17:10 | kephale | amalloy: ooo good tip |
| 17:14 | fliebel | amalloy: What is C-t? I don't have emacs. |
| 17:15 | fliebel | btw, solution: (defn =m [& args] (and (apply = (map meta args)) (apply = args))) :P |
| 17:15 | amalloy | fliebel: transpose-characters |
| 17:16 | fliebel | amalloy: like.. rot-n? |
| 17:16 | amalloy | turns e|t into te| |
| 17:16 | amalloy | (where | is point) |
| 17:17 | amalloy | transpose-sexps turns (map (some-seq) | f) into (map f (some-seq)|) |
| 17:17 | fliebel | nice |
| 17:17 | Raynes | That makes me happy. |
| 17:20 | schaefer | hi. anyone here familiar with the insides of core.logic? i'm interested in implementing the IUnify* protocols and would like a little direction |
| 17:20 | clojurebot | http://clojure-log.n01se.net/date/2009-10-13.html#12:02 |
| 17:21 | Raynes | ambrosebs is totally not familiar with core.logic. |
| 17:21 | amalloy | well, clojurebot, i guess maybe he wanted to know about protocols in general. good try |
| 17:21 | schaefer | heh |
| 17:22 | ambrosebs | well i didn't write them :P |
| 17:22 | schaefer | ah.. i missed your nick on the list :) |
| 17:22 | ambrosebs | but I can open the source and make some sense of it |
| 17:22 | ambrosebs | what are you try ing to do? |
| 17:22 | schaefer | so, i'm looking to incorporate a database as a source of facts |
| 17:23 | schaefer | i just started looking at the code about an hour ago and it looks like i need to implement the IUnify* protocols but i'm a lost on what each one of them does |
| 17:25 | klutometis | What do you call the property of `defn' such that I can do: (let [] (def x 2)) x => 2. Doesn't that break lexical scoping in the sense that `x' shouldn't be visible outside the `let'? |
| 17:25 | klutometis | Doing e.g. `(let () (define x 2)) x' in Scheme gives me ``Error: unbound variable: x'', which is lexically consistent. |
| 17:25 | klutometis | s/defn/def/ |
| 17:26 | schaefer | i don't know if you're familiar with mandarax (a java backwards reasoning system). it defines an interface which supplies a set of constraints and return a resultset-like lthing. an RDBMS implementation simply converts the constraint parameters into SQL and returns a wrapped JDBC result set |
| 17:26 | fliebel | klutometis: clo*s*ures |
| 17:27 | fliebel | oh, no |
| 17:27 | klutometis | fliebel: That's my point, dude: x shouldn't be visible outside of that closure. Clojure is breaking lexical scoping. |
| 17:28 | fliebel | klutometis: yes, in Clojure def just defines a var outside of the let scope. Going to bed now... |
| 17:28 | technomancy | klutometis: vars are totally different things from locals; you seem to be confusing the two |
| 17:28 | klutometis | fliebel: Thanks. |
| 17:28 | aperiodic | klutometis: def doesn't create a closure, it defines a var in the namespace |
| 17:30 | klutometis | aperiodic: Oh, ok; I'm used to Scheme, where even `define' won't break lexical scoping. |
| 17:31 | amalloy | "break" is a strong word |
| 17:31 | technomancy | def doesn't create locals; it has nothing to do with lexical scope. |
| 17:31 | klutometis | technomancy: This whole locals/vars dichotomy is another way of saying: "we don't respect lexical scope." |
| 17:32 | amalloy | scheme just guarantees that if the first "chunk" of expressions in a define are themselves defined, they get given lexical scope |
| 17:32 | klutometis | amalloy: Good point. |
| 17:32 | technomancy | klutometis: lexical scope is for locals |
| 17:32 | technomancy | it's totally unrelated |
| 17:32 | gfredericks | dangit ^J won't work in the browser. |
| 17:32 | amalloy | define normally creates dynamically-scoped variables, even in scheme |
| 17:32 | klutometis | technomancy: Right; circular argument, though. |
| 17:32 | amalloy | there's just this crazy exception for if it's at the beginning of another define |
| 17:32 | amalloy | gfredericks: i think most browsers do have a shortcut for that though |
| 17:32 | klutometis | amalloy: Really? I'm trying to conjure up an example. |
| 17:33 | amalloy | in the url bar, anyway |
| 17:33 | klutometis | amalloy: Oh, in the sense that `let' reduces to `define'. |
| 17:33 | amalloy | klutometis: well, i'm not a scheme expert at all. but (define (foo x) (...blah...) (define (bar y) 10)) is undefined, i believe |
| 17:34 | amalloy | i read that in sicp, so it must be true |
| 17:35 | technomancy | that's like saying set! "breaks" variables because it changes their value. it's what it's there for. |
| 17:35 | klutometis | amalloy: Hmm; I mean, `bar' is visible within `foo' but not outside of `foo'. Is that what you mean? |
| 17:35 | klutometis | The actual return value of `define' is the value `#<unspecified>'. |
| 17:36 | amalloy | no, i mean, it's not defined by the scheme standard. your scheme implementation can do whatever it wants |
| 17:36 | klutometis | Oh, right; `unspecified'. |
| 17:36 | klutometis | Thanks, guys. |
| 17:40 | amalloy | technomancy: heh. set! *does* break variables, which is what it's there for |
| 17:40 | technomancy | amalloy: the horror |
| 17:46 | aperiodic | is there a handy way to handle posix signals in java/clojure? |
| 17:47 | Raynes | aperiodic: http://stackoverflow.com/questions/40376/handle-signals-in-the-java-virtual-machine |
| 17:49 | klutometis | technomancy: Heh, missed that the first time around. |
| 17:50 | aperiodic | Raynes: so not within the context of my application? |
| 17:52 | kd4joa | Anyone here know the Midje testing package well and could help with a question? |
| 17:54 | kd4joa | I want to test a function that returns a list of hash maps but only care that the maps have a particular key. I don't care about the rest of the map. |
| 17:54 | hiredman | contains? |
| 17:54 | clojurebot | contains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use the java method .contains |
| 17:54 | kd4joa | In other words the function returns [{:id 1 :score 1.5} {:id 2 :score 0.5}] and I only care that the maps have :id 1 and :id 2 |
| 17:55 | kd4joa | I tried contains but it didn't seem to work right. I tried [{:id 1 :score 1.5} {:id 2 :score 0.5}] => (contains [ { :id 1} {:id 2} ]) |
| 17:55 | kd4joa | and a couple other permutations of that |
| 17:56 | hiredman | well, uh, that is plainly wrong, so I suggest you read some docs |
| 17:58 | kd4joa | thanks. that's very helpful. |
| 18:00 | aperiodic | ,(contains? {:id 1} :id) |
| 18:00 | clojurebot | true |
| 18:00 | aperiodic | ,(contains? [{:id 1}] :id) |
| 18:00 | clojurebot | false |
| 18:01 | carllerche | I'm trying to write some documentation for a async / future library I'm working on. If anybody has some time, i would appreciate feedback: https://github.com/carllerche/momentum/blob/master/src/clj/momentum/core/async.clj |
| 18:06 | moogatronic | kd4joa: are you just wanting know know whether every map in your list contains :id ? |
| 18:08 | kd4joa | no, I want the maps to have the pair :id 1 and :id 2 |
| 18:08 | kd4joa | I thought the Midje contains function was for that but can't get the syntax for it right I guess |
| 18:09 | kd4joa | I don't care about what the rest of the keys and values in the maps are |
| 18:09 | alexbaranosky | k4djoa: I think you're right |
| 18:09 | alexbaranosky | what do you need to test exactly? |
| 18:09 | alexbaranosky | that a certain map contains some key-val pairs? |
| 18:10 | moogatronic | looks like he wants to test if a list of maps collectively contain given key-value pairs. |
| 18:11 | kd4joa | yes. moogatronic has it right |
| 18:11 | alexbaranosky | don't think midje has a built-in checker for that |
| 18:11 | kd4joa | ok. thanks. I thought the contains checker might work for it, but I haven't been able to get it to work so it must not |
| 18:11 | alexbaranosky | kd4joa: let me investigate further |
| 18:12 | alexbaranosky | you can just write function for it |
| 18:12 | kd4joa | yeah that's what I'll have to do then. I just thought I was being dense about the contains checker |
| 18:12 | alexbaranosky | then say: (fact (my-function-call) => (partial maps-contain { ......})) |
| 18:13 | kd4joa | thanks for the help! much better than "go read some docs" answer I got a little bit ago |
| 18:13 | alexbaranosky | kd4joa: though don't quote me on the syntax, I haven't needed to test that kind of thing |
| 18:13 | alexbaranosky | I've used aMidje a lot |
| 18:14 | alexbaranosky | kd4joa: le t me know how it goes, and if you have any more questions |
| 18:14 | moogatronic | At first i thought you were asking this: |
| 18:14 | moogatronic | (reduce #(and %1 (contains? %2 :id)) true [{:id 1 :score 1.5} {:id 2 :score 0.5}]) |
| 18:15 | moogatronic | but i think just need a function to or some internal may k/v checks |
| 18:17 | Raynes | kd4joa: Don't mind him. He means well. |
| 18:18 | Raynes | You can't have an apple tree without a few rotten apples at some point. |
| 18:18 | moogatronic | hard cider! |
| 18:18 | technomancy | moogatronic: not for Raynes; he's underaged. |
| 18:18 | technomancy | (at least in the US) |
| 18:19 | Raynes | ;) |
| 18:19 | moogatronic | I think "hard cider" is a US'ism anyway -- cider means fermented apple juice everywhere else I think. |
| 18:19 | alexbaranosky | technomancy: but there's a blue hair law - if your hair's blue you can drink at 16 |
| 18:19 | moogatronic | alexbaronsky: ONLY when operating a vehicle though, i'm pretty sure. |
| 18:20 | Raynes | I only drink when I need to drive long distances. It helps me stay focused. |
| 18:20 | kd4joa | Thanks all. I've found the clojure community very welcoming to newcomers. I know there are exceptions in every group |
| 18:21 | alexbaranosky | Raynes: but yeah totally legal in 49 states -- if your hair is blue |
| 18:21 | Raynes | I'm golden then. |
| 18:21 | alexbaranosky | ok, I'll stop polluting the airwaves with bad humor ;) |
| 18:23 | moogatronic | the uc davis cop may provide you with some sriracha to the face if you don't stop. =) |
| 18:33 | gfredericks | java interop in jruby never ceases to aggravate. |
| 18:33 | gfredericks | $inc clojure |
| 18:33 | lazybot | ⇒ 4 |
| 19:10 | yaron2343 | Anyone been playing with defrecord? I'm tearing my hear out on an issue and was hoping for some help. |
| 19:11 | brehaut | yaron2343: just ask your question, if someone can help they will |
| 19:12 | yaron2343 | I am using a trivial defrecord (defrecord connection-record [next-state conf-func]) in my clj file. I then C-c C-l the whole clj file into my repl (e.g. via swank). Any attempt to reference the record fails. I try import (e.g. (import lib-phl.core connection-record)) and that fails to. |
| 19:12 | yaron2343 | I just get class errors. |
| 19:15 | tolstoy | Is your repl in the same namespace as the file? (I got nothin.) |
| 19:16 | yaron2343 | No, it's not. That's why when I try to reference the record I use a fully qualified name (e.g. lib-phl.core/connection-record |
| 19:16 | yaron2343 | I also tried lib-phl.core.connection-record out of desperation |
| 19:16 | brehaut | yaron2343: but if you are sending the record to a different name space then its going to be created there |
| 19:18 | yaron2343 | I tried connection-record by itself and it doesn't work. Where as other functions I defined in the clj file show up just fine so long as I prefix them with lib-phl.core. For example lib-phl.core/is-connection-record? Shows up just fine. |
| 19:18 | yaron2343 | It's only the class defined with defrecord that doesn't show up. |
| 19:18 | brehaut | oh, dashes in record names is a bad idea |
| 19:18 | brehaut | try ConnectionRecord |
| 19:18 | brehaut | to avoid having name munging |
| 19:19 | brehaut | i would guess that connection-record is being name munged to connection_record for the classname |
| 19:19 | yaron2343 | I actually figured that as well and tried _ but it didn't make any difference. |
| 19:20 | yaron2343 | I also tried that with my namespace that also has a dash in it (e.g. typing in lib_phl.core instead of lib-phl.core) |
| 19:20 | yaron2343 | What's weird is that functions defined in my clj file that use the record work just fine! |
| 19:21 | brehaut | yaron2343: records are much more complex than functions |
| 19:21 | yaron2343 | Indeed, I'm seriously considering just moving all my code back to structs. At least those worked easily. :( |
| 19:21 | brehaut | try running your defrecord directly in your repl, rather than sending it to the repl from the editor |
| 19:21 | brehaut | jeez, not structs. just use maps |
| 19:22 | yaron2343 | Oh if I define the record in the REPL directly then everything works just fine. |
| 19:22 | brehaut | ok so its not a defrecord problem, its someting to do with your slime usage |
| 19:22 | yaron2343 | It's only if I try to load the file C-c C-L or the buffer segment C-c C-R that I'm in trouble. |
| 19:23 | yaron2343 | Yeah it smells strongly like a class path resolution issue |
| 19:23 | yaron2343 | It's not finding the class. |
| 19:23 | yaron2343 | For example, when I try to C-c C-l my test file I get the error lib-phl.core.connection-record ClassNotFoundException |
| 19:24 | yaron2343 | And yes, I tried changing it to (:import [lib-phl.core ConnectionRecord]) and sure enough I get lib-phl.core.ConnectionRecord ClassNotFoundException |
| 19:24 | alexbaranosky | yaron2343: you could always just use maps |
| 19:24 | yaron2343 | Yup, that's sounding like the right answer. (Just using maps) |
| 19:24 | alexbaranosky | yaron2343: does the namespace also have a dash? That becomes part of the class name I think |
| 19:25 | yaron2343 | Yes, the namespace does have a dash. |
| 19:25 | alexbaranosky | that is getting underscorified too |
| 19:25 | yaron2343 | (ns lib-phl.test.core |
| 19:25 | yaron2343 | (:use [lib-phl.core]) |
| 19:25 | yaron2343 | (:import [lib-phl.core ConnectionRecord]) |
| 19:25 | yaron2343 | (:use [clojure.test])) |
| 19:25 | alexbaranosky | but really maps are the 90+% tool |
| 19:26 | alexbaranosky | yaron2343: I ran into similar problems as you, and was told to just NOT put -'s in namespaces that contain records... It may be your problem. I just decided to screw it and use maps instead for my use case |
| 19:27 | yaron2343 | Yeah, I think you're right. Records hurt too much and don't give me enough value. I mostly wanted them because they were easier than duck typing and could catch some errors. |
| 19:28 | yaron2343 | Although before I finally throw in the towel I will recreate my project without any -s. Won't take long and I hate to give up because I'm confused as opposed to understanding the feature and deciding it doesn't work. |
| 19:29 | alexbaranosky | yaron2343: let me know how it goes, I would like to know if that fixes the issue or not |
| 19:29 | yaron2343 | Will do, am trying to throw it together now. |
| 19:34 | amalloy | (inc maps) |
| 19:34 | lazybot | ⇒ 1 |
| 19:34 | mindbender1 | I hope it's not a stupid question.. but what are the uses of closures in any language? |
| 19:36 | alexbaranosky | mindbender1: they have LOTS of uses |
| 19:37 | amalloy | consider a simple example: (let [x 10] (filter #(< % x) some-sequence)) |
| 19:38 | yaron2343 | O.k. so the good news is that removing the - did resolve the problems I was having in the main file. But not in my test file I'm getting a new error "libphl/core__init.class or libphl/core.clj on class path FileNotFoundException. |
| 19:38 | yaron2343 | I'm guessing this is because of my import |
| 19:38 | mindbender1 | alexbaranosky: please some education |
| 19:38 | yaron2343 | I have no clue if lein sets up the class path correctly so that the test files see the src files |
| 19:39 | alexbaranosky | mindbender1: use closures anytime you want to tell another function HOW - anytime you might use a Strategy pattern for example |
| 19:39 | alexbaranosky | so higher order functions need to be configured with another function -- so you might want to use a closure |
| 19:40 | alexbaranosky | (defn do-something-to-each-twice [f coll] (map f (map f coll))) |
| 19:41 | alexbaranosky | ;; better: (defn do-something-to-each-twice [f coll] (map (comp f f) coll)) |
| 19:41 | alexbaranosky | then call it with a given function aor closure |
| 19:42 | alexbaranosky | (do-something-to-each-twice inc [1 2 3]) ;=> (3 4 5) |
| 19:42 | mindbender1 | how does f tell do-something-to-each-twice HOW |
| 19:42 | alexbaranosky | mindbender1: you could replace 'inc' here with any closure |
| 19:43 | alexbaranosky | can you ask a more elaborate question? I don't know what you need to know |
| 19:44 | mindbender1 | alexbaranosky: from my understanding closures hold a kind of state right? |
| 19:45 | alexbaranosky | ahhhh, sometimes |
| 19:45 | aperiodic | they're often used that way in javascript |
| 19:46 | alexbaranosky | it just means I can create a closure, that references a local var in one context, then pass that closure to another context |
| 19:49 | amalloy | one usage of closures is to let you, basically use a variable that "belongs" to one function inside a completely unrelated function |
| 19:49 | amalloy | eg in my example, (let [x 10] (filter (fn [item] (< item 10)) (range 30))) |
| 19:49 | amalloy | how can filter, which knows nothing about x, manage to use that variable? it's because we've packaged x up inside of the function we give it |
| 19:50 | gfredericks | amalloy: you left x out there? |
| 19:50 | amalloy | hah, yes |
| 19:51 | amalloy | though it still applies equally well. how does filter, in clojure.core, know about the value 10? i didn't pass it 10 |
| 19:51 | amalloy | i passed it this function, which knows about 10 |
| 19:53 | yaron2343 | O.k. defrecord really is painful. So with a map both (:a b) and (b :a) work just fine. But with defrecord only (:a b) works. |
| 19:56 | TimMc | yaron2343: and (.a b) |
| 19:57 | gfredericks | hmmm...what's the reasoning for that? |
| 19:57 | yaron2343 | Yeah, that makes sense. Although it also argues against using defrecord. I want Clojure to get away from Oop. |
| 19:57 | yaron2343 | Because the keyword is effectively an accessor and a record is a class. |
| 19:58 | yaron2343 | So you are asking for property "a" on the record |
| 19:59 | gfredericks | but records deliberately have the map interface, so it's strange they wouldn't implement the IFn side of maps as well |
| 19:59 | brehaut | yaron2343: why have you decided to use a record over a map? |
| 19:59 | gfredericks | I guess records might want to provide their own IFn :/ |
| 19:59 | yaron2343 | The reason for going to a record was that I wanted to do type checking and equality checking and records make that much easier. |
| 20:00 | amalloy | gfredericks: more importantly calling records wouldn't be nearly as fast as caling keywords |
| 20:00 | yaron2343 | I'm also hoping that eventually clojure will make type hints enforceable |
| 20:00 | yaron2343 | Yes, I'm a typist. :) But Scala hurt too much so I'm sticking with Clojure |
| 20:00 | gfredericks | amalloy: I would think uniformity of interface would trump that consideration |
| 20:01 | yaron2343 | (F# was actually fun, much easier for me than Scala but I there isn't good IDE support on my mac) |
| 20:01 | amalloy | gfredericks: if uniformity of interface were all that mattered, we wouldn't have records or structs at all |
| 20:01 | brehaut | its fairly idiomatic in clojure maps that are used objectfully to have (:keyword map) access and maps that are used mapfully to have (map index) lookup, and records are specifically an optimized objectful map, so it makes sense that only the former is supported |
| 20:02 | yaron2343 | brehaut - How do you tell the difference between an objecfull map and a manful map? |
| 20:02 | yaron2343 | er manful I meant :) |
| 20:02 | yaron2343 | mapful |
| 20:02 | yaron2343 | (Damn you autocorrect!) |
| 20:03 | brehaut | well to start an objectful map will have all keyword keys |
| 20:03 | brehaut | quite possibly will have heterogenous values |
| 20:03 | brehaut | and as a whole represents one 'object' in the system |
| 20:03 | brehaut | where as a mapful map may have any kind of key, often has homogenous values and represents an aggregation in the system |
| 20:05 | gfredericks | amalloy: that second one is harder to imagine |
| 20:05 | gfredericks | why homogenous values? |
| 20:05 | gfredericks | amalloy: brehaut: sorry, meant to brehaut |
| 20:06 | yaron2343 | Then I'm fully guilty of being objectful |
| 20:06 | brehaut | yaron2343: objectful maps are idiomatic clojure |
| 20:06 | brehaut | gfredericks: because thats often how they are used? perhaps homogenous value _types_ would be clearer? |
| 20:06 | yaron2343 | Now if I can just figure out why C-c C-l on my core.clj file in my test directory is producing a "Could not locate libphl/core__init.class or libphl/core.clj on class path: [Thrown class java.io.FileNotFoundException] |
| 20:07 | yaron2343 | Note btw that "lein test" from the command line works just fine. |
| 20:07 | gfredericks | brehaut: do you have an example? |
| 20:07 | brehaut | gfredericks: im sure i must |
| 20:07 | yaron2343 | brehaut - Then I suppose using records makes sense for me. |
| 20:07 | yaron2343 | So whatever my issue is, it's some swank related thing |
| 20:07 | brehaut | yaron2343: but its idiomatic to use maps _until_ records are shown to be needed (for protocols, or performance) |
| 20:08 | brehaut | ,(frequencies "aababc") |
| 20:08 | clojurebot | {\a 3, \b 2, \c 1} |
| 20:08 | brehaut | gfredericks: ^ a really trivial example |
| 20:09 | yaron2343 | brehaut - What's the flag that should trip one to think about records? My use of maps is to pass around a state object. The only reason I used records at all is that it made it easy to see if someone submitted the right 'type' of map and to do automatically equality testing when I needed to compare states. |
| 20:09 | gfredericks | hmm |
| 20:09 | brehaut | yaron2343: well, typically clojure programmers dont 'check type' |
| 20:09 | gfredericks | yaron2343: why don't maps give you equality testing? |
| 20:10 | brehaut | yaron2343: if you profile your code and find map access is slow, then a record may be an option. alternatively if you need to implement a protocol, a map is probably a good choice |
| 20:10 | brehaut | yaron2343: records are surprisingly rare in clojure code |
| 20:10 | yaron2343 | brehaut - Indeed, I did actually know that. But I'm writing a distributed system where debugging is a nightmare so I need the system to be as helpful as possible in telling me where things went wrong. Checking types helps out a lot with that. |
| 20:10 | amalloy | yaron2343: just put another key in your map |
| 20:10 | brehaut | yaron2343: pre and post conditions may also help you |
| 20:10 | amalloy | {:what-kind-of-thing :my-awesome-state-type ...more keys...} |
| 20:11 | amalloy | using records has way more pitfalls than maps, and taking all of that on just so you can call .getClass for debugging is asking for pain |
| 20:11 | yaron2343 | gfredericks - Because I'm an idiot. I just realized that works. :( Thanks for pointing this out. At least now I know. |
| 20:12 | gfredericks | yaron2343: now all you need to do is loosen up about checking types and you're golden :) |
| 20:12 | yaron2343 | brehaut - Actually pre and post conditions is where I do the type checking. I use instance? |
| 20:12 | gfredericks | yaron2343: why not write a function that checks if the maps has the expected keys and such? |
| 20:13 | yaron2343 | gfredericks - That's what I originally did but records gave me that for free |
| 20:13 | gfredericks | that tells you more than calling instance? on a record, since a record could be initialized with nulls and all that |
| 20:13 | gfredericks | tells you more if you examine the values as well I mean |
| 20:13 | yaron2343 | gfredericks - Which is why the calls after instance walked through the various keys and checked if they were right. And yes, the more I type the more I realize that records were the wrong choice. Just too much overhead for very little benefit. |
| 20:14 | yaron2343 | Thankfully Clojure produces such awesomely tight code that changing everything from records to maps will be easy. |
| 20:19 | yaron2343 | BTW is something like this idiomatic? (defn |
| 20:19 | yaron2343 | create-state [state-function connections] |
| 20:19 | yaron2343 | (hash-map :state-function state-function :connections connection)) |
| 20:19 | yaron2343 | The goal is to make it easy to remember what a state is supposed to have |
| 20:19 | gfredericks | a shallow answer is you could use a map literal instead of the hash-map function |
| 20:20 | yaron2343 | Yeah, I know. But I find the short syntax makes it harder for me to read the code. That's just a personal thing for me. |
| 20:20 | yaron2343 | Does it really make any functional difference? |
| 20:20 | gfredericks | not that I know of |
| 20:20 | gfredericks | I'm like that too with new |
| 20:21 | gfredericks | so you're asking about having a map-assembler function instead of creating the maps inline everywhere |
| 20:21 | yaron2343 | Yup. Just to prevent typos and such. |
| 20:22 | gfredericks | I personally like it, but I tend to be on the type-checking-lover side of things, so I expect people around here to disagree with me |
| 20:23 | yaron2343 | gfredericks - I love type checking. The only reason I'm not using Scala is that it's type inference logic was painfully bad and the community is about as friendly as a bear trap. But that could just be me. :) |
| 20:23 | gfredericks | yaron2343: I suspect that testing instead of doing static types is probably more fruitful |
| 20:24 | yaron2343 | BTW, what is the difference between FN and IFN? |
| 20:24 | amalloy | instead, abstract it a level: (defn make-state-object [a b] (...)) (defn is-state-object? [x] (...)) |
| 20:24 | yaron2343 | I did try looking this up but I couldn't find a good answer |
| 20:24 | gfredericks | then you're reasonably sure you have your types right, but also reasonably sure the program works right, which static compilers can't tell you |
| 20:24 | yaron2343 | am alloy - That's exactly what I'm doing. I have a create-state and is-state? |
| 20:24 | gfredericks | yaron2343: FN is a class, IFN is an interface |
| 20:25 | yaron2343 | gfredericks - Bingo! Thank you! |
| 20:25 | yaron2343 | So if I want to check if a value is a callable function will IFN? give me wider coverage? |
| 20:25 | gfredericks | most of the interface names start with I, though for some reason not all of them |
| 20:26 | yaron2343 | I notice that just about everything in clojure seems to have interfaces on it |
| 20:26 | yaron2343 | I just want to check if a value is a callable function |
| 20:26 | gfredericks | &(instance? clojure.lang.IFn []) |
| 20:26 | lazybot | ⇒ true |
| 20:26 | gfredericks | depends on if you want vectors, maps, and sets to return true :) |
| 20:26 | amalloy | then you can use maps, and later use records if you truly find yourself needing them |
| 20:26 | yaron2343 | gfredericks - That's actually o.k., if it walks like a duck…. :) |
| 20:27 | gfredericks | then yep |
| 20:27 | amalloy | (hint, though: you won't find yourself needing records) |
| 20:28 | yaron2343 | :) Makes sense. Gotta run! Thanks everyone for your help! You helped move my clojure project forward. I appreciate it! |
| 20:29 | brehaut | ,@#'clojure.core/global-hierarchy |
| 20:29 | clojurebot | {:parents {}, :descendants {}, :ancestors {}} |
| 20:29 | brehaut | ,(derive ::a ::b) |
| 20:29 | clojurebot | nil |
| 20:29 | brehaut | ,(derive ::c ::a) |
| 20:29 | clojurebot | nil |
| 20:29 | brehaut | ,@#'clojure.core/global-hierarchy |
| 20:29 | clojurebot | {:parents {:sandbox/c #{:sandbox/a}, :sandbox/a #{:sandbox/b}}, :ancestors {:sandbox/c #{:sandbox/a :sandbox/b}, :sandbox/a #{:sandbox/b}}, :descendants {:sandbox/a #{:sandbox/c}, :sandbox/b #{:sandbox/a :sandbox/c}}} |
| 20:29 | brehaut | gfredericks: ^ global-hierarchy is an objectful map, but its 3 fields are mapful |
| 20:29 | brehaut | gfredericks: also, the homogenous type might be an implicit union type |
| 20:29 | brehaut | gfredericks: for instance the maps in the fields of the hierarchy have a sets of an implicit union of class and clojure.lang.Named |
| 20:29 | aperiodic | brehaut: what is the @#' prefix doing there? |
| 20:29 | brehaut | its private, so #' is avar quote to access it, and then @ to deref the var to get the actual value |
| 20:29 | brehaut | ,clojure.core/global-hierarchy |
| 20:29 | clojurebot | #<CompilerException java.lang.IllegalStateException: var: clojure.core/global-hierarchy is not public, compiling:(NO_SOURCE_PATH:0)> |
| 20:29 | brehaut | ,#'clojure.core/global-hierarchy |
| 20:29 | clojurebot | #'clojure.core/global-hierarchy |
| 20:29 | brehaut | ,(class #'clojure.core/global-hierarchy) |
| 20:29 | clojurebot | clojure.lang.Var |
| 20:29 | brehaut | aperiodic: make sense? |
| 20:29 | aperiodic | huh, i didn't know you could do that |
| 20:29 | aperiodic | brehaut: yeah, thanks! |
| 20:29 | brehaut | aperiodic: extremely useful for testing things |
| 20:29 | aperiodic | i'm still not entirely clear on how vars, environments, and namespaces interact during evaluation |
| 20:29 | brehaut | aperiodic: with a sprinkling of magic ;) |
| 20:29 | moogatronic | how much documentation does anyone reading this and wanting to reply usually put in their docstrings? |
| 20:29 | brehaut | moogatronic: err… not sure i understand what you are asking |
| 20:29 | brehaut | yaron2343: just dont ;) |
| 20:29 | brehaut | but yes |
| 20:29 | moogatronic | (defn function "docstring" [] body) how much do you write in the doc string? |
| 20:29 | brehaut | moogatronic: as much as is required to describe the intent and contract of the function |
| 20:29 | moogatronic | as much as say, a javadoc? |
| 20:29 | brehaut | moogatronic: if you use marginalia you may also write more to add to the overall narrative |
| 20:29 | moogatronic | brehaut: marginalia is on my list of things to invetigate. |
| 20:29 | brehaut | id say its similar to whats normal for python functions, thoguh not classes |
| 20:29 | brehaut | moogatronic: its extremely straight forward. |
| 20:29 | moogatronic | I just like the formalism of javadoc... Defined spot for @param @return etc.. |
| 20:29 | brehaut | moogatronic: none of that nonsense, we have metadata for that |
| 20:29 | brehaut | moogatronic: docstrings are for prose (and perhaps example usage) |
| 20:30 | amalloy | yaron2343: "free" is a huge overstatement |
| 20:30 | gfredericks | I think my IRC client just went bonkers |
| 20:30 | brehaut | gfredericks: i think you mean ifn? |
| 20:31 | brehaut | ,(ifn? []) |
| 20:31 | clojurebot | true |
| 20:31 | moogatronic | brehaut: do you have a small example demonstrating metadata as a replacement for some of the 'javadoc' ish crap? |
| 20:31 | amalloy | gfredericks: no, network issue of some kind |
| 20:31 | moogatronic | gfredericks: mine too. |
| 20:31 | gfredericks | now I'm doubting everything that happened in the last 10 minutes |
| 20:31 | brehaut | moogatronic: i have a large example? https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj |
| 20:32 | moogatronic | haha large or small, i was trying to minimize imposed burdon. |
| 20:32 | brehaut | moogatronic: be aware that :tag is the not just documentation, its used by the compiler so dont go adding it wildly |
| 20:33 | brehaut | moogatronic: overall, there is much less of that stuff than javadoc though |
| 20:34 | gfredericks | brehaut: half of the stuff you said about mapful maps came in in a lump just then |
| 20:35 | brehaut | gfredericks: huh. sorry about that |
| 20:35 | brehaut | gfredericks: i assume my internet is lagging to crap again |
| 20:35 | amalloy | brehaut: gfredericks is accusing you of causing the network issue that all of freenode just felt |
| 20:35 | gfredericks | brehaut: I doubt it's your fault :) I was just explaining any apparent lack of ACK |
| 20:35 | amalloy | no apologizing |
| 20:35 | brehaut | oh! haha |
| 20:36 | gfredericks | me and amalloy: ignorant cop, explanatory cop |
| 20:36 | amalloy | although... relevant: http://xkcd.com/945/ |
| 20:39 | gfredericks | oh there goes google wave |
| 20:41 | brehaut | gfredericks: it was still around? |
| 20:42 | gfredericks | apparently |
| 20:49 | amalloy | haha google knol too |
| 20:51 | brehaut | are they sending the old dogs to the farm? |
| 20:52 | gfredericks | dog foo is expensive |
| 20:53 | gfredericks | as is dog bar |
| 20:56 | moogatronic | .. i finally discovered what laziness is for. I feel like the world played the "you just discovered a secret room" song from "the legend of zelda"... code I wrote earlier today is now comical. |
| 20:57 | amalloy | moogatronic: well then, what is laziness for? you don't really know until you can explain it :) |
| 20:58 | moogatronic | amalloy: true enough. In my case it was that I just realized how I could utilize the lazy-sequence to accomplish some list generation tasks that I was using loop/recur for... |
| 20:59 | moogatronic | but everyone knows the answer to everything is 42. |
| 20:59 | brehaut | nah, the answer to everything is "No" |
| 20:59 | gfredericks | brehaut: is it really? |
| 20:59 | brehaut | No |
| 21:00 | gfredericks | well that explains it then, thanks! |
| 21:00 | brehaut | gfredericks: if that seems inconsistent to you, you dont know prolog ;) |
| 21:00 | gfredericks | Do I know prolog?? |
| 21:00 | lazybot | gfredericks: Definitely not. |
| 21:00 | brehaut | No |
| 21:01 | gfredericks | ~prolog |
| 21:01 | clojurebot | Pardon? |
| 21:02 | moogatronic | Are we doing the "This statement is false." thing? =) |
| 21:02 | brehaut | No |
| 21:02 | moogatronic | 42 |
| 21:02 | amalloy | moogatronic: gfredericks seems to be. near as i can tell, brehaut is enjoying saying "your statement is false, or your question has no correct answers" |
| 21:03 | brehaut | amalloy: theres also the 'none of the facts i know imply this' |
| 21:03 | amalloy | No further universes exist which satisfy all of your constraints |
| 21:03 | brehaut | exactly |
| 21:03 | brehaut | its the extent of my prolog based humour |
| 21:04 | brehaut | i guess i should at least port the joke to core.logic |
| 21:04 | amalloy | you've got em rolling in the aisles |
| 21:06 | brehaut | sorry #clojure |
| 21:07 | aperiodic | got any erlang jokes? |
| 21:08 | brehaut | i do not |
| 21:08 | gfredericks | there cannot be any erlang jokes because it has no flaws |
| 21:08 | aperiodic | that's a pretty big flaw right there |
| 21:09 | gfredericks | is nil the only argument for which type returns nil? |
| 21:09 | amalloy | uhhhh, i think that's true, yes |
| 21:09 | TimMc | ,(doc type) |
| 21:09 | clojurebot | "([x]); Returns the :type metadata of x, or its Class if none" |
| 21:10 | TimMc | ,(type ^{:type nil} [1 2 3]) |
| 21:10 | clojurebot | clojure.lang.PersistentVector |
| 21:10 | gfredericks | I've a multimethod that dispatches on type and was just curious if (defmethod nil) knew for sure the argument was nil |
| 21:10 | TimMc | ಠ_ಠ |
| 21:10 | gfredericks | ,(binding [type (constantly nil)] (type [])) |
| 21:10 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Can't dynamically bind non-dynamic var: clojure.core/type> |
| 21:10 | amalloy | TimMc: i know, i thought of that too. but i remember reading that it does (or (:type (meta x)) (class x)) |
| 21:11 | amalloy | as opposed to (:type (meta x) (class x)) |
| 21:11 | TimMc | "or its Class if none", right |
| 21:11 | gfredericks | ,(with-redefs [type (constantly nil)] (type [])) |
| 21:11 | clojurebot | nil |
| 21:11 | TimMc | hrmf |
| 21:12 | amalloy | fwiw, putting reader metadata on stuff when you want it to have metadata at runtime makes me super-nervous, TimMc |
| 21:12 | amalloy | (with-meta [1 2 3] {:type nil}) seems a lot safer to me |
| 21:13 | gfredericks | that's an interesting distinction |
| 21:13 | gfredericks | untrustworthy macros? |
| 21:13 | TimMc | I will admit to knowing basically nothing about metadata. :-) |
| 21:14 | TimMc | ,(:type ^{:type 'foo} []) |
| 21:14 | clojurebot | nil |
| 21:14 | TimMc | ,(:type (with-meta [] {:type 'foo})) |
| 21:14 | clojurebot | nil |
| 21:14 | TimMc | ugh |
| 21:15 | amalloy | gfredericks: not untrustworthy, it's just...reader metadata is for the compiler. in most cases it will leak over into your program and you can use it as runtime metadata |
| 21:15 | amalloy | but depending on that doesn't seem good |
| 21:16 | TimMc | &(meta ^{:type 'foo} []) |
| 21:16 | lazybot | ⇒ nil |
| 21:17 | TimMc | right |
| 21:18 | aperiodic | there are two kinds of metadata? |
| 21:19 | amalloy | no |
| 21:19 | amalloy | there are two times at which you could attach metadata |
| 21:19 | amalloy | (more than two, really) |
| 21:19 | aperiodic | read-time and eval-time? |
| 21:20 | amalloy | yeah, that's the distinction i was drawing |
| 21:20 | amalloy | but there's also macroexpansion time |
| 21:21 | aperiodic | you say that in most cases metadata attached during read-time exists in runtime, but could you provide an example where that doesn't happen? |
| 21:22 | amalloy | &(meta ^{:type 'foo} []) |
| 21:22 | lazybot | ⇒ nil |
| 21:22 | TimMc | ^ |
| 21:22 | aperiodic | huh |
| 21:23 | TimMc | But a macro would see it, yeah? |
| 21:23 | amalloy | yes |
| 21:23 | amalloy | &(meta ^{:type foo} [1]) |
| 21:23 | lazybot | ⇒ nil |
| 21:23 | amalloy | at the moment i can't even find an example where it *does* leak over to runtime |
| 21:24 | amalloy | &(meta ' ^{:type foo} 1) |
| 21:24 | lazybot | java.lang.IllegalArgumentException: Metadata can only be applied to IMetas |
| 21:24 | amalloy | &(meta ' ^{:type foo} (1)) |
| 21:24 | lazybot | ⇒ {:type foo, :line 1} |
| 21:25 | aperiodic | why does the metadata disappear? |
| 21:25 | amalloy | it doesn't. it was never there |
| 21:25 | amalloy | you pass the compiler an object, x, with metadata on it. it emits the bytecode necessary to reproduce x |
| 21:26 | aperiodic | up to equality? |
| 21:26 | amalloy | at runtime, that bytecode is executed to create a brand-new x |
| 21:26 | amalloy | but the metadata was for the compiler, not for you |
| 21:26 | aperiodic | ah, got it |
| 21:27 | amalloy | well, that makes one of us |
| 21:27 | amalloy | it's a confusing issue either way |
| 21:30 | aperiodic | so if i want to attach metadata visible at runtime, i should use with-meta, rather than the reader macro, because metadata attached at read-time (usually) gets eaten by the compiler? |
| 21:35 | brehaut | i pressed some magical emacs chord by accident: all my html got stripped out and left only the text |
| 21:36 | moogatronic | brehaut: -x u! |
| 21:36 | aperiodic | the compilation process for clojure is way harder for me to wrap my head around than any other language i've used |
| 21:37 | hiredman | aperiodic: do go on |
| 21:37 | brehaut | aperiodic: and yet its probably much simplier than most of them |
| 21:39 | aperiodic | hiredman: well, it seems to start with the reader, which is what takes string data and turns it into clojure forms |
| 21:39 | brehaut | aperiodic: so far so good |
| 21:40 | aperiodic | but i've seen some references to reader macros that cause evaluation (i think #=?) |
| 21:40 | hiredman | oh, well, if that is complicated then you've never used a lisp |
| 21:40 | aperiodic | how can you be doing evaluation at read-time? what's the environment? |
| 21:40 | aperiodic | i haven't |
| 21:41 | brehaut | aperiodic: question: what do you think the compilation unit of clojure is? |
| 21:41 | aperiodic | that's undoubtedly part of my woes |
| 21:41 | hiredman | which means you don't have a basis for comparison |
| 21:41 | hiredman | I suggest you go write a lisp, even a simple one |
| 21:43 | aperiodic | brehaut: unit ~ atomic to compilation? |
| 21:43 | brehaut | aperiodic: so in java the compilation unit is the class (i believe), it might be the package |
| 21:43 | brehaut | in C its the source file |
| 21:43 | aperiodic | brehaut: the first thing that popped into my head was namespace |
| 21:44 | brehaut | aperiodic: its a single form |
| 21:44 | amalloy | man, i don't even know what clojure's compilation unit is |
| 21:44 | amalloy | i'd guess top-level form |
| 21:44 | brehaut | amalloy: toplevel or eval expression i think |
| 21:44 | brehaut | which is why we have declare for forward declarations |
| 21:44 | amalloy | suuuure, but those are just top-level in a different context |
| 21:46 | brehaut | i guess you could think of it that way, but its slightly circular |
| 21:46 | brehaut | aperiodic: the key difference between macros and normal functions is when they run |
| 21:47 | aperiodic | brehaut: macros run between read and evaluation, right? |
| 21:47 | aperiodic | which is why the arguments are unevaluated forms |
| 21:48 | brehaut | aperiodic: macroexpansion is part of the evaluation or compilation process |
| 21:48 | brehaut | its not really 'between' |
| 21:48 | gfredericks | where's there a function for transforming keys of a map? |
| 21:48 | hiredman | well, it runs ahead of the first pass of the compiler |
| 21:49 | brehaut | hiredman: its more clearly seperated with a compiler than a traditional lisp evaluator though right? |
| 21:50 | hiredman | yes |
| 21:51 | aperiodic | brehaut: well, if it runs after its arguments have been read but before they've been evaluated, i'd call that between the two |
| 21:52 | brehaut | gfredericks: theres rename-keys ? but thats not an general transform, just a mapping |
| 21:53 | gfredericks | ah |
| 21:53 | aperiodic | brehaut: but i see your objection (there's evaluation happening in the macro, so they're not distinct phases) |
| 21:53 | gfredericks | well zipmap is pretty easy |
| 21:55 | alexbaranosky | gfredericks, there's a function `map-keys` in useful |
| 21:56 | gfredericks | I need to start using useful |
| 21:56 | gfredericks | but only with :only |
| 21:59 | amalloy | i kinda frown on the map-keys/values functions in useful, personally |
| 21:59 | alexbaranosky | amalloy, do you think that they're a code smell? |
| 22:00 | alexbaranosky | amalloy, I havent needed them ..... yet |
| 22:00 | amalloy | i don't have a very good reason. i just wish people would stop going map->seq->map, which gets you the worst of both worlds performance-wise |
| 22:52 | fbru02 | ehi guys i have a macro question anybody up to help? |
| 22:53 | amalloy | ~anyone |
| 22:53 | 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 ..." |
| 22:54 | fbru02 | :) |
| 22:56 | fbru02 | so i want to check on one of the arguments and recursive call the macro if one of the arguments is not of the specified type (defmacro my-macro [arg1 arg2 & rest] (if-not (map? arg2) `(mymacro arg1 {} ~@rest))) |
| 22:56 | fbru02 | so the thing is that i do a macroexpand with this and i never seem to get {} in arg2 |
| 22:57 | fbru02 | i'm confused |
| 22:58 | amalloy | well, there are a couple issues. one is you don't have an else clause for your if; it's unclear whether that's a bad copy/paste or what |
| 22:59 | amalloy | the other is, are you looking at a macroexpand-1 or what? because if you (macroexpand-1 '(my-macro foo bar baz)) from this definition, it should result in '(my-macro foo {} baz) |
| 23:01 | fbru02 | amalloy: let me try again and if not paste real code |
| 23:01 | fbru02 | thanks :) |
| 23:10 | callen | okay, you have my attention |
| 23:10 | callen | why does the current version of lein not have a "jack-in" verb? |
| 23:10 | callen | because that's what my clojure-mode.el is looking for. |
| 23:11 | callen | I need to install swank, don't I? |
| 23:11 | callen | sigh. |
| 23:11 | callen | I forget these things every time. |
| 23:16 | Raynes | callen: You don't need to install swank. |
| 23:16 | Raynes | And jack-in is definitely in the latest lein. |
| 23:33 | callen | Raynes: not by default, had to install swank-clojure plugin. |
| 23:33 | callen | Raynes: I just fetched the lein earlier from the repo. |
| 23:33 | Raynes | Oh, I thought you meant in Emacs. |
| 23:40 | callen | in Emacs? |
| 23:40 | callen | clojure-mode just invokes lein. |
| 23:40 | callen | there's little that Emacs has to do with it. |
| 23:55 | georgek | hi, I have 'clojure-mode-font-lock-setup added to 'slime-repl-mode-hook in my .emacs, but when I connect to a remote swank with slime-connect, I get error in process filter: run-hooks: Symbol's function definition is void: clojure-mode-font-lock-setup |
| 23:55 | georgek | if I just reconnect, I get the remote repl, but no highlighting |
| 23:55 | georgek | anyone come across this already? |
| 23:59 | spoon16 | technomancy around? |