2010-10-18
| 00:00 | cemerick | Do you see a reason why namespaced keywords are privileged? |
| 00:00 | cemerick | Or, perhaps, discriminated against? :-P |
| 00:00 | chouser | and the inverse of symbol is str |
| 00:01 | chouser | but there is no inverse of keyword |
| 00:02 | cemerick | It may be that (keyword ":user/foo") should => :user/foo |
| 00:02 | chouser | or ... something. I'm tired too, and about to do something about it. |
| 00:02 | cemerick | e.g. no one but no one is going to put a : in a namespace. |
| 00:16 | clojurebot | Alice heard the Rabbit coming. He quietly remains (in his proper place) indifferent. |
| 00:26 | LauJensen | Good morning all |
| 00:34 | yayitswei | morning! |
| 00:35 | LauJensen | yayitswei: Did you ever get your cake question answered? |
| 00:36 | yayitswei | which one? I had a bunch of them :) |
| 00:36 | yayitswei | though, I think I eventually got all of them answered |
| 00:37 | LauJensen | ok, cool. It was about threaded about from an app |
| 00:47 | cemerick | The last paragraph here is a decent observation: http://sayspy.blogspot.com/2010/10/my-thoughts-on-clojure.html |
| 00:49 | yayitswei | LauJensen: thanks |
| 00:50 | LauJensen | cemerick: O_o ? |
| 00:50 | LauJensen | To me that seems like the opposite of reality |
| 00:50 | cemerick | oh? |
| 00:51 | yayitswei | just read the article; I agree about the cryptic error messages |
| 00:51 | cemerick | yeah, that's an impl detail |
| 00:51 | cemerick | much improved in 1.3.0-SNAPSHOT, AFAIK |
| 01:09 | yayitswei | cemerick: how so? |
| 01:10 | cemerick | I don't know the details as yet, as I've only tinkered with 1.3.0 here and there so far. Rich apparently improved the stack trace reporting quite a bit a month ago or so. |
| 02:00 | notsonerdysunny | if a macro is defined in namespace x and it is used in namespace y. and the expansion contains a function corresponding to symbol f .. and f has different definitions in both namespaces x and y .. which function will be used? .. can we control this ? if so how can I do it in a nice way...? |
| 02:09 | amalloy | ,`x |
| 02:09 | clojurebot | sandbox/x |
| 02:09 | notsonerdysunny | amalloy: I just discovered that it resolves to the one in which the macro was originally defined. |
| 02:09 | amalloy | right |
| 02:09 | notsonerdysunny | not to the one where it was expanded |
| 02:10 | amalloy | yep |
| 02:10 | notsonerdysunny | that is a nice behaviour |
| 02:10 | amalloy | ,`(~'x) |
| 02:10 | clojurebot | (x) |
| 02:10 | amalloy | if you want it to use the one where it's expanded |
| 02:10 | notsonerdysunny | oh nice thanks |
| 02:10 | notsonerdysunny | I didn't know that |
| 02:11 | amalloy | it's basically the same as writing 'x |
| 02:11 | amalloy | since you're saying "quote this", and then "okay, unquote and evaluate 'x" |
| 02:12 | amalloy | did you get your mathematica thing working out satisfactorily? |
| 02:12 | notsonerdysunny | I just got back to it.. I had to run for some personal.. stuff |
| 02:12 | notsonerdysunny | I think I should be able to though |
| 02:13 | notsonerdysunny | :) |
| 02:13 | amalloy | k, sounds good |
| 02:13 | notsonerdysunny | actually I seem to have trouble with this macro thing .. |
| 02:13 | clojurebot | The rhinoceros, who finds no place on what is flimsy, dwells with the enduring and unchanging Tao. |
| 02:14 | notsonerdysunny | clojuratica seems to redefine the meaning of "intern" which is also defined in clojure.core .. I was trying to figure out which definition it is using |
| 02:28 | LauJensen | (require [clojuratica :exclude [intern]]) |
| 02:30 | zakwilson | Where did unchecked-add go in 1.3? |
| 02:31 | LauJensen | zakwilson: I think its just 'add', since it doesnt do overflow checking, and add' does |
| 02:32 | LauJensen | or, + and +' rather |
| 02:33 | zakwilson | Oh, I found it: unchecked-add-int or unchecked-add-long |
| 02:35 | LauJensen | aha |
| 02:42 | zakwilson | It seems odd that + doesn't auto-promote now and +', the non-default is the one that does. |
| 02:48 | LauJensen | Well, + lets you do fast primitive math. If you need that to overflow you should rely on BigInt contagion, ie (+ 500000000000000000N 500000000000000N) wont overflow. I doubt I'll find much use for +' |
| 02:49 | notsonerdysunny | ,::dssd |
| 02:49 | clojurebot | :sandbox/dssd |
| 02:49 | notsonerdysunny | ,:dssd |
| 02:49 | clojurebot | :dssd |
| 02:50 | notsonerdysunny | which namespace does :dssd belong to..? |
| 02:50 | notsonerdysunny | can I run functions to get their namespaces? |
| 02:51 | notsonerdysunny | can I run functions on keywords to get their namespaces? |
| 02:52 | notsonerdysunny | ,(pprint ::dssd) |
| 02:52 | clojurebot | java.lang.Exception: Unable to resolve symbol: pprint in this context |
| 02:52 | notsonerdysunny | ,(clojure.pprint/pprint ::dssd) |
| 02:52 | clojurebot | :sandbox/dssd |
| 02:53 | amalloy_ | notsonerdysunny: :dssd is in the global namespace |
| 02:54 | cemerick | there is no global namespace -- there is simply a lack of a namespace in :dssd |
| 02:55 | zakwilson | I guess throw-on-overflow as the default makes sense for speed, but how can it be faster when it's still doing a check so as to be able to throw an exception? |
| 02:55 | amalloy_ | cemerick: could you explain the difference? |
| 02:57 | cemerick | amalloy_: "global namespace" implies that an unnamed namespace exists, which isn't the case |
| 02:58 | cemerick | actually, "namespaced" keywords and symbols don't actually have a Namespace, just a string that indicates one |
| 02:58 | cemerick | (class (namespace ::foo)) |
| 02:58 | cemerick | ,(class (namespace ::foo)) |
| 02:58 | clojurebot | java.lang.String |
| 02:59 | cemerick | just to be pedantic: |
| 02:59 | cemerick | ,(find-ns 'blah42) |
| 02:59 | clojurebot | nil |
| 02:59 | cemerick | (namespace :blah42/foo) |
| 02:59 | cemerick | ,(namespace :blah42/foo) |
| 02:59 | clojurebot | "blah42" |
| 02:59 | cemerick | ,(find-ns 'blah42) |
| 02:59 | clojurebot | nil |
| 03:00 | cemerick | only create-ns (and its callers, like ns) can bring a Namespace into existence |
| 03:02 | zakwilson | The slow part of my app in marginally faster on 1.3. Yay! The web part doesn't run at all though. Boo. (some library needs an update) |
| 03:03 | cemerick | which library? |
| 03:03 | amalloy_ | i guess i don't see how "this symbol has no namespace" and "this symbol is part of the special namespace <nil>" are different, since other non-namespaced variables will conflict with it either way |
| 03:04 | zakwilson | Not sure. Part of Ring or Compojure, I think. |
| 03:05 | cemerick | amalloy_: Well, there is no namespace <nil>. Saying that there is doesn't clarify anything. But: what conflict are you talking about regardless? |
| 03:06 | amalloy | hm |
| 03:07 | amalloy | i guess what i'm talking about is mostly nonsense, except maybe in the case of keywords |
| 03:08 | cemerick | amalloy: when can keywords conflict? |
| 03:08 | cemerick | (I'm not even sure what a "conflict" would imply w.r.t. keywords or symbols. *shrug*) |
| 03:08 | amalloy | yeah, i think i'm not sure either |
| 03:09 | raek | Clojure is unlike C++, where you can declare things in the global namespace. If you define that Clojure has a global namespace, only symbols and keywords could be associated with that special namespace. Since vars are the things actually live in the namespaces, it makes sense to me to treat the question "is there a global namespace?" as "can I define a var in a global namespace?" |
| 03:09 | raek | just nitpicking... |
| 03:09 | cemerick | Symbols and keywords are really just interned strings that have special semantics and operations. |
| 03:10 | cemerick | Both of them being decidedly *not* like their namesakes from CL, for what that's worth. |
| 03:11 | LauJensen | cemerick: Didnt know you have a history with CL? |
| 03:11 | cemerick | LauJensen: Just a bit. Long time ago. I hardly remember a thing. |
| 03:11 | LauJensen | k |
| 03:12 | cemerick | Sort of like my relationship with C++, or Oracle. |
| 03:15 | LauJensen | Would actually be nice to do a little C, just as a refresher |
| 03:15 | LauJensen | I think Ive gotten a little spoiled by Clojure |
| 03:16 | cemerick | I can't say I've ever done anything in C/C++ from the ground up – only ever tweaked existing stuff, fixed bugs, added a feature here and there. |
| 03:17 | cemerick | Oh, that's not true; I wrote a Java launcher from scratch some absurd number of years ago. Surely that doesn't actually count though. |
| 03:18 | LauJensen | hehe. It sounds like the kind of thing you'd do in bash |
| 03:19 | cemerick | not so useful on windows, for displaying a splash screen before the JVM is ready to go yet, etc. |
| 03:19 | cemerick | ugh, that was a horrible project |
| 03:19 | LauJensen | true |
| 03:19 | cemerick | Java 1.2, I think. |
| 03:21 | LauJensen | Cliff said that Java 1.0 or 1.1 didnt have memory fences everywhere, so if you put it on a duo core computer, it would just break :) |
| 03:45 | notsonerdysunny | ,`(list a b) |
| 03:45 | clojurebot | (clojure.core/list sandbox/a sandbox/b) |
| 03:46 | notsonerdysunny | ,`(a b) |
| 03:46 | clojurebot | (sandbox/a sandbox/b) |
| 03:53 | notsonerdysunny | I need to quote the sexp .. when I macroexpand from the repl.. I need to remember that .. :( |
| 03:53 | notsonerdysunny | :) |
| 04:13 | clojurebot | Alice could not see anything that looked like the wind. In a time of war, it was just her right hand. |
| 04:17 | Adamant | clojurebot: one pill to make her taller, and one pill to make her small |
| 04:18 | Adamant | clojurebot: and the ones that, mother gives here, don't do anything, at all |
| 04:18 | Adamant | *her |
| 04:18 | kryft | Adamant: Is the punctuation really like that in the original? |
| 04:19 | Adamant | kryft: I think it is for the Grace Slick song |
| 04:20 | Adamant | trying to imitate that, anyway |
| 05:12 | ossareh | any thoughts on why I'd be getting: "java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn" |
| 05:12 | ossareh | I've a map with a key in it which maps to a boolean and I'm doing (if (map :key) "x" "y") |
| 05:12 | ossareh | ^ symbol is not `map` |
| 05:30 | ossareh | d'oh |
| 05:30 | ossareh | my mistake - sorry for the noise. |
| 06:03 | AWizzArd | Does reify auto-typehint methods? (reify java.awt.event.ActionListener (actionPerformed [this, e])) works fine. But how can I typehint e being a ^java.awt.event.ActionEvent ? |
| 06:04 | AWizzArd | ah okay, got it: (reify java.awt.event.ActionListener (^void actionPerformed [^java.awt.event.ActionListener this, ^java.awt.event.ActionEvent e])) |
| 06:11 | LauJensen | Glad we could help |
| 06:15 | clojurebot | The Tao is the same as "I sleep when I breathe!" It is a very curious sensation--she was beginning to grow larger again. |
| 06:17 | LauJensen | hiredman: Would be great if you could remind your singularity that this is not a philosophy channel :) |
| 06:19 | jlaskowski | Hi |
| 06:19 | LauJensen | hi |
| 06:19 | jlaskowski | how to split a string into substring separated by \space? |
| 06:19 | jlaskowski | (def s "Jacek Laskowski likes Clojure") |
| 06:19 | jlaskowski | and have it in a seq |
| 06:20 | jlaskowski | '("Jacek" "Laskowski" "likes" "Clojure")? |
| 06:20 | LauJensen | (.split s " ") |
| 06:20 | jlaskowski | huh? is this that simple?! :) |
| 06:20 | LauJensen | Well, yea. Thats a java call which returns an array, you can use that like a seq |
| 06:21 | LauJensen | ,(seq (.split "everybody like Clojure..almost" " ")) |
| 06:21 | clojurebot | ("everybody" "like" "Clojure..almost") |
| 06:21 | jlaskowski | right |
| 06:21 | jlaskowski | awesome |
| 06:21 | jlaskowski | thanks |
| 06:21 | LauJensen | np |
| 06:32 | esj | another happy customer :) |
| 07:21 | edoloughlin_ | Hi, I'm seeing strange behaviour in my program that I can't replicate in the REPL (I'm very much a noob): |
| 07:21 | edoloughlin_ | I can define and print map values ok in the REPL: |
| 07:21 | edoloughlin_ | user=> (def details {:email "ed" :password "pass"}) |
| 07:21 | edoloughlin_ | #'user/details |
| 07:21 | edoloughlin_ | user=> (println "LOGIN: email=" (details :email) ", password=" (details :password)) |
| 07:21 | edoloughlin_ | LOGIN: email= ed , password= pass |
| 07:21 | edoloughlin_ | nil |
| 07:21 | edoloughlin_ | I'm passing the same map to a fn in my program: |
| 07:21 | edoloughlin_ | (defn login [details] |
| 07:21 | edoloughlin_ | (println "details: " details) |
| 07:21 | edoloughlin_ | (println "LOGIN: email=" (details :email) ", password=" (details :password)) |
| 07:21 | edoloughlin_ | This prints: |
| 07:21 | edoloughlin_ | details: {email ed@here.com, password pass} |
| 07:21 | edoloughlin_ | LOGIN: email= nil , password= nil |
| 07:21 | edoloughlin_ | Why am I getting nils? |
| 07:27 | jarpiain | if it really prints "{email ed@here.com ..." the map you passed has the symbol 'email as key instead of the keyword :email |
| 07:28 | edoloughlin_ | Oh. I didn't get the distinction. Thanks. |
| 07:31 | edoloughlin_ | Still no luck: |
| 07:31 | edoloughlin_ | (println "LOGIN: email=" (details 'email) ", password=" (details 'password) |
| 07:31 | edoloughlin_ | prints: |
| 07:31 | edoloughlin_ | LOGIN: email= nil , password= nil |
| 07:32 | edoloughlin_ | (details "email") works, though. |
| 07:32 | Chousuke | ah, so the keys are strings |
| 07:33 | Chousuke | strings print without quotes, so they look like symbols |
| 07:33 | edoloughlin_ | They're coming in via compojure/ring |
| 07:51 | @rhickey | what's the git fu for determining if the repo you are looking at contains a particular object? |
| 08:16 | clojurebot | "Found it", said the Mouse in a voice of thunder. "I know that well enough?" said the King. People began running the kingdom. |
| 08:20 | chouser | rhickey: you can list all branches that contain a commit by: git branch --contains <SHA1> |
| 08:21 | @rhickey | chouser: thanks, but that's backwards from what I want |
| 08:23 | chouser | you have a commit and a branch and you just want true/false? |
| 08:28 | @rhickey | Yes, I am sitting a a repo at some rev and want a t/f for (contains sha) |
| 08:28 | @rhickey | I don't see why it would involve branches |
| 08:28 | @rhickey | basically I want to query the current database |
| 08:28 | @rhickey | tree whatever |
| 08:28 | chouser | yeah, like walk the log from where you are back through all parentage looking for one commit |
| 08:28 | chouser | should be easy. :-) |
| 08:30 | tobiasraeder | hey everybody :) |
| 08:31 | chouser | rhickey: I guess you could: git log --pretty=oneline | grep <sha> |
| 08:32 | @rhickey | chouser: that seems to not leverage an index that must be present |
| 08:32 | chouser | perhaps: git log <sha>..HEAD -- but I'm not sure there's anything faster than walking the parentage from the current commit back. |
| 08:34 | jarpiain | git cat-file -t <sha> seems to be the low-level command |
| 08:35 | chouser | jarpiain: well, that shows the object if it's in your repo at all, but wouldn't tell you if it's related to your current revision |
| 08:42 | Chousuke | git branch --contains <sha>? |
| 08:44 | chouser | oh dear. I just created a branch named HEAD |
| 08:44 | Chousuke | hah |
| 08:45 | chouser | Chousuke: I mentioned that, but I think rhickey may be on a non-branch rev. I guess that's the same as a "detatched HEAD"? |
| 08:45 | Chousuke | yeah |
| 09:03 | @rhickey | how do people feel about 'unchecked' ns for unchecked math ops, vs unchecked-* ? |
| 09:05 | Chousuke | Sounds like a good idea to me. |
| 09:05 | Chousuke | potentially less typing, too :) |
| 09:08 | chouser | I like it |
| 09:11 | Raynes | I like it. I like it a lot. |
| 09:15 | edoloughlin | Can anyone tell me what I'm doing wrong here? I just want to return a map… |
| 09:15 | edoloughlin | user=> (defn invalid-login [] |
| 09:15 | edoloughlin | ({:text "invalid login" |
| 09:15 | edoloughlin | :code "invalid login"})) |
| 09:15 | edoloughlin | #'user/invalid-login |
| 09:15 | edoloughlin | user=> (invalid-login) |
| 09:15 | edoloughlin | java.lang.IllegalArgumentException: Wrong number of args (0) passed to: PersistentArrayMap (NO_SOURCE_FILE:0) |
| 09:15 | edoloughlin | user=> |
| 09:16 | chouser | edoloughlin: please use a paste site for more than 1 or 2 lines |
| 09:16 | edoloughlin | Ok. Apologies |
| 09:16 | chouser | edoloughlin: why do you have parens around your literal map {:text ...} ? |
| 09:17 | edoloughlin | I had a println in the fn just before the map but removed it for posting. it was ((println "something) {:text "etc"}) |
| 09:18 | Raynes | I think you're aiming for (defn invalid-login [] (println "something") {:text "etc"}) |
| 09:18 | edoloughlin | Ok. Silly parens error. Sorry for wasting everyones' time |
| 09:19 | Raynes | It's what we're here for. <3 |
| 09:19 | chouser | edoloughlin: not a waste |
| 09:20 | chouser | edoloughlin: I trust it was a valuable investment that will one day generate generous returns. |
| 09:20 | edoloughlin | Hopefully. It's quite the long learning curve... |
| 09:21 | Raynes | chouser: "generate generous" was fun to say. Thank you. |
| 09:21 | chouser | heh |
| 09:22 | chouser | there's still no way to generate a Java class with a static main method without AOT compiling, right? |
| 09:23 | @rhickey | chouser: how would you find it without AOT? |
| 09:23 | chouser | heh. ok, good point. |
| 09:23 | chouser | I'm trying to bend clojure-maven-plugin to my will, and mostly the bending is going the other way |
| 09:24 | esj | chouser: resistance is futile... |
| 09:26 | @rhickey | so, one area of implicit cost which won't be helped by unchecked ns and will require extra code are the implicit coercions done by the compiler, esp. long->int when doing array access. Having to do (aget a (unchecked/int i)) seems tiresome |
| 09:27 | @rhickey | I've seen the overhead of the check disappear sometimes, but not always |
| 09:29 | chouser | defaulting implicit coercions to unchecked in all cases doesn't seem like a good idea |
| 09:30 | @rhickey | array bounds checking will cover a lot of errors, but not all, should the array indexes not be checked by default |
| 09:31 | chouser | as in when the too-large long wraps to land back within the valid array index range? |
| 09:31 | @rhickey | right |
| 09:32 | chouser | language design is hard! |
| 09:33 | Raynes | That's why everybody does it. |
| 09:58 | @rhickey | I wonder how real the long-used-as-index--accidentally-outside-range-of-int case is |
| 09:59 | chouser | you'd only get a bad answer when you otherwise would have gotten an exception, unlike many other uses of unchecked which could have given a correct answer if the types were different |
| 10:02 | @rhickey | I wonder how many people would hesitate to do (aget a (uc/int i)), knowing i is still array-length checked? If people end up doing that everywhere that's a waste |
| 10:02 | @rhickey | chouser: I'm not sure I appreciate the distinction here, in both cases the purpose of the checking is to prevent silent bad result |
| 10:05 | @rhickey | I guess we could have agets in unchecked too |
| 10:06 | @rhickey | but that's only one case of implicit coercion |
| 10:07 | @rhickey | the problem is we now get a lot of these due to default of long |
| 10:09 | @rhickey | most of the time the chip-level instruction parallelism makes the overhead disappear, unless your work is really small, like access array and add |
| 10:13 | clojurebot | "Sha'n't," said the Dodo, "it's the best way to keep them safe." When wealth and honours lead to arrogancy, this brings its evil on itself. |
| 10:20 | Raynes | Morning _fogus_. |
| 10:20 | _fogus_ | Raynes: Hello sir. |
| 10:24 | Once | Anyone here used fnparse to parse something like HTML, ERB, XML etc.? I'd be interested in seeing how you dealt with tags that produce no significant product (ie. comments) without resorting to pre-processing the input stream. |
| 10:25 | esj | incase anybody hasn't seen it: #5 in HN is Clojure related. |
| 10:26 | esj | but am saddened by the poor quality of the argument. |
| 10:30 | ivey | People who've never used a REPL-driven language don't understand. |
| 10:30 | ivey | It's such a strange concept until you do it. |
| 10:41 | Raynes | Once: It's relevant to note that there are some parsers available for XML and HTML. See clojure.xml and clj-tagsoup. |
| 10:43 | Once | Raynes: I don't actually need an XML or HTML parser. I'm just interested in how to handle rules that would normally produce no product. Like comments in a HTML document or a delimiter change in a templating language etc. Thanks though. |
| 10:50 | Raynes | esj: You haven't really 'arrived' as a language unless people are bitching about you on a daily basis. |
| 10:51 | esj | Raynes: Oh dear, I must be hurting Clojure by raving about it on daily basis. Should I stop ? :P |
| 10:51 | Raynes | People who don't use the language are the most important. |
| 10:51 | Raynes | If people who actually use the language are bitching about it, you might have real problems. |
| 11:03 | defn | heh -- woops |
| 11:03 | defn | apparently we didn't have to work today -- all alone at the office :( |
| 11:04 | defn | chouser: have you been thinking at all about your datalog awesomeness? |
| 11:04 | chouser | :-) |
| 11:04 | chouser | talking about it at work at this very moment |
| 11:05 | Raynes | chouser: Don't you have an option parser in contrib? |
| 11:05 | Raynes | I can't remember what the namespace is. |
| 11:05 | chouser | Raynes: command-line I think |
| 11:06 | Raynes | Thanks. |
| 11:06 | Raynes | Boy, them docs sure are useful. ;) |
| 11:06 | _fogus_ | chouser: I have a part in my presentation where I defer all Datalog questions to you. |
| 11:06 | defn | hahahaha |
| 11:07 | defn | If Nathan Marz is around you could maybe shove some off on him as well |
| 11:07 | _fogus_ | ooooo, good point! |
| 11:07 | defn | after you say it make sure to point menacingly and say: Take /that/! |
| 11:08 | defn | ...or something... |
| 11:08 | chouser | Nathan Marz won't be at the conj, unfortunately. |
| 11:08 | defn | aw bummer I thought he said he would be |
| 11:08 | tridd3ll | chouser: btw, I enjoyed your talk at Strange Loop... all of the clojure-focused talks were great... wish I could make it to conj as well |
| 11:08 | chouser | oh, well, I may be confused but I thought he said he wouldn't. |
| 11:08 | chouser | tridd3ll: thanks! |
| 11:08 | defn | chouser: my head is still spinning a little from the loop |
| 11:08 | Raynes | tridd3ll: They'll be videographed. |
| 11:09 | chouser | I missed a lot of talks I probably would have enjoyed. |
| 11:09 | defn | i have a notebook with ideas in it that just grew by about 8 pages |
| 11:09 | tridd3ll | Raynes: I think infoq will be releasing some as time goes on |
| 11:09 | defn | chouser: yeah same here -- would have liked to see more more nosql stuff |
| 11:10 | defn | and scala stuff |
| 11:11 | tridd3ll | I also thought it was great when Guy Steele recommended "clojure" as the language to learn at the future programming languages round table. |
| 11:11 | Raynes | He did? |
| 11:11 | Raynes | Oh boy. |
| 11:11 | defn | i think part of it is that he didnt want to say "fortress" |
| 11:12 | chouser | "clojure and haskell" |
| 11:12 | tridd3ll | right, the question was more about which language might open your mind about others, etc. |
| 11:12 | defn | i think the other thing is: it is sort of obvious for G. Steele to recommend the lisp with the zeitgeist |
| 11:13 | tridd3ll | but still, it was cool |
| 11:13 | defn | agreed -- i was about to yell "amen!" |
| 11:13 | dpritchett | [Meanwhile, inside Steele's head] "don't say fortress, don't say fortress, don't say fortress" |
| 11:13 | defn | but hillary mason was next to me and I was trying to be cool |
| 11:19 | notsonerdysunny | is there a way to find-out how many elements in a lazysequence have already been calculated.. |
| 11:19 | notsonerdysunny | Just out of curiosity .. I don't know if it will be usefull... |
| 11:20 | defn | (take 4 lazyseq) |
| 11:20 | defn | ;) |
| 11:20 | notsonerdysunny | defn: I know how to use a lazyseq .. |
| 11:21 | defn | notsonerdysunny: i was joking mostly because when you (take x mylazysequence), x is how many are calculated i believe |
| 11:21 | notsonerdysunny | but it caches the values it has already calculated.. due to previous accesses.. |
| 11:21 | chouser | notsonerdysunny: I came up with a thing that sorta works. let me see if I can find it. |
| 11:21 | defn | oh i see what you're saying |
| 11:23 | defn | Raynes: I'll look into cake-search :D |
| 11:24 | chouser | shoot, I have no idea where I put it. |
| 11:24 | Raynes | defn: Either you and I need to do it. If you don't feel like it, I'll certainly get around to it eventually. Let me know if you plan to do it though, so I can attach your name to the issue. |
| 11:24 | Raynes | defn: We're tagging issues with contributor names now so that we don't work on the same things. |
| 11:25 | defn | Raynes: let's work on it together -- you have more experience building a plugin for cake, would be nice to piggyback |
| 11:25 | Raynes | defn: Also, I believe ninjudd wants search functionality as core tasks. Also, I believe I should be talking to you about this in #cake.clj :p |
| 11:25 | defn | ./join #cake.clj |
| 11:26 | chouser | notsonerdysunny: http://gist.github.com/589694 |
| 11:27 | ivey | Raynes & defn: What's the difference between cake and lein? |
| 11:27 | Raynes | ivey: http://stackoverflow.com/questions/3906276/whats-the-difference-between-cake-and-leiningen |
| 11:27 | notsonerdysunny | chouser: Thanks.. I will read through your code .... |
| 11:27 | ivey | heh |
| 11:27 | ivey | thanks |
| 11:27 | Raynes | ivey: Read lancepantz answer. |
| 11:28 | chouser | notsonerdysunny: you should be able to just use it as demonstrated toward the end of that gist |
| 11:29 | FUser | ok |
| 11:30 | FUser | so how would I go about making a mechanism that waits in a separate thread for some value to change |
| 11:30 | FUser | I've tried (future #(while (= @atom false))) |
| 11:30 | FUser | but that burns CPU way too much |
| 11:31 | chouser | ew |
| 11:31 | chouser | yeah |
| 11:31 | chouser | use a watcher |
| 11:31 | FUser | I can put in a delay |
| 11:31 | FUser | but I'd rather have something that blocks |
| 11:33 | FUser | in the same line of questions |
| 11:33 | FUser | how do you have variables that are not thread local yet not global |
| 11:33 | FUser | is that even possible? |
| 11:33 | FUser | coming from java, I find the scope in clojure confusing |
| 11:34 | FUser | I end up making everything global or in a let |
| 11:34 | FUser | sometimes I desire a third option |
| 11:34 | chouser | global is still namespaced |
| 11:34 | chouser | so that's roughly like a class static scope |
| 11:35 | FUser | ok |
| 11:35 | FUser | so def is namespaced? |
| 11:35 | chouser | yep |
| 11:35 | FUser | well but it can be reached via require |
| 11:36 | FUser | so it's not actually namespace scope |
| 11:36 | chouser | what? |
| 11:36 | clojurebot | what is exceptions |
| 11:36 | FUser | :) |
| 11:37 | FUser | isn't it? |
| 11:37 | defn | (require foo [bar :as myns]) |
| 11:38 | FUser | the way I see it, def is like public in java? |
| 11:38 | FUser | scopewise |
| 11:38 | chouser | like a public static, yes. but you can also ask for it to be private it you'd like. |
| 11:38 | chouser | (def ^:private foo "Foo") |
| 11:39 | FUser | what's the scope in that case |
| 11:39 | chouser | your current namespace |
| 11:39 | Kruppe | FUser: never seen by other namespaces i think |
| 11:39 | Kruppe | FUser: there is also defn- if i remember correctly |
| 11:40 | FUser | ok |
| 11:40 | sandGorgon | i have load-file ed a clj file that has a namespace "name1". Now, "name1" itself :requires "name2". Usually all the functions of "name1" are available as name1/func1 name1/func2. Can I do name1/name2/func3 ? I dont seem to be able to do it |
| 11:40 | FUser | any shorthand for that private? |
| 11:40 | FUser | defn- is for functions |
| 11:40 | Kruppe | FUser: the def private? i don't think so |
| 11:40 | FUser | i'll make a macro then :P |
| 11:41 | Kruppe | FUser: sure thing! good ol lisp |
| 11:41 | chouser | there's a defvar- in contrib I think, but ^:private is hardly overwhelming. |
| 11:41 | Kruppe | chouser: yeah its pretty minor |
| 11:41 | FUser | I always screw up the carot |
| 11:41 | FUser | tried typing it now |
| 11:41 | FUser | $&private came out |
| 11:41 | FUser | :D |
| 11:42 | FUser | I must use # in front for it to work |
| 11:42 | Kruppe | FUser: hehe, I use vim keybindings (in emacs, i know pretty crazy) so im used to typeing carrot |
| 11:42 | Kruppe | s/typeing/typing/ |
| 11:42 | sexpbot | <Kruppe> FUser: hehe, I use vim keybindings (in emacs, i know pretty crazy) so im used to typing carrot |
| 11:43 | FUser | so now you have a substitution bot lol |
| 11:43 | FUser | s/o/a/ |
| 11:43 | sexpbot | <FUser> sa naw yau have a substitutian bat lal |
| 11:43 | sandGorgon | guys.. some help pls |
| 11:43 | FUser | southern accent there |
| 11:43 | FUser | :P |
| 11:44 | notsonerdysunny | sandGorgon: you want nested namespaces? |
| 11:44 | FUser | much like in java, namespace names dont concatenate |
| 11:44 | jarpiain | sandGorgon: namespaces aren't hierarchical like that but once you've loaded name2 with require, you can use name2/func3 from everywhere |
| 11:45 | notsonerdysunny | you can do something like name1.name2/func3 |
| 11:45 | sandGorgon | notsonerdysunny, ok lemme try that |
| 11:45 | sandGorgon | didnt know about that |
| 11:46 | Kruppe | notsonerdysunny: that works? interesting |
| 11:46 | notsonerdysunny | you need to have declared the namespace like (ns name1.name2) to be able to do what I said.. |
| 11:46 | notsonerdysunny | not just (ns name2) |
| 11:46 | Kruppe | notsonerdysunny: oh ok. |
| 11:49 | sandGorgon | notsonerdysunny, could you repeat that ? so if I required a namespace ns1 and ns1 requires ns2, can I refer to ns1.ns2/func ? |
| 11:49 | dpritchett | does anyone know where the cake gem installs its executable? my `which cake` is running the coffeescript makefile tool |
| 11:50 | Kruppe | dpritchett: mine is in /usr/bin |
| 11:50 | Kruppe | dpritchett: but i wrote my own ebuild for it so... |
| 11:50 | Kruppe | dpritchett: that might not help you |
| 11:50 | dpritchett | thanks |
| 11:51 | Kruppe | dpritchett: could always fall back to cd / && sudo find -name "cake" |
| 11:51 | cemerick | rhickey: I'd like to suggest that Keyword/intern strip off leading colons from the ns or nsname. Would you be open to a patch for that? |
| 11:51 | cemerick | (doesn't seem significant enough for a patch, but whatever) |
| 11:51 | dpritchett | it failed too but at least it's the right cake :) |
| 11:52 | Kruppe | dpritchett: which failed? find? |
| 11:52 | @rhickey | cemerick: in order to ignore them? |
| 11:52 | dpritchett | no, cake failed with this error http://github.com/ninjudd/cake/issues#issue/45 |
| 11:52 | Kruppe | dpritchett: oh |
| 11:52 | Kruppe | dpritchett: but you found it! good |
| 11:52 | dpritchett | yep, thanks |
| 11:53 | Kruppe | dpritchett: np |
| 11:55 | cemerick | rhickey: right; there seems a slight asymmetry insofar as there is no clean roundtripping option as there is for symbols, e.g. (-> :foo str keyword). |
| 11:55 | cemerick | There's read-string, but that seems like a nuclear option, and string munging, which seems silly. |
| 11:55 | defn | dpritchett: heh yes that is an issue -- i suggest you symlink cake's binary into your ~/bin and make that your first stop for PATH |
| 11:55 | @rhickey | cemerick: patch welcome |
| 11:55 | cemerick | nifty; on its way |
| 11:57 | FUser | is this supposed to fail in repl? (ns something) (require 'user) |
| 11:57 | chouser | yeah, require wants an actual file on disk to load, a .clj or .class file |
| 11:58 | cemerick | hrm; perhaps the colon-stripping should only apply to the single-string arity of intern, so people have an escape hatch in the two-arg version if need be |
| 11:59 | notsonerdysunny | sandGorgon: ns1 requires ns2 does not mean they have a nested relation ship... |
| 11:59 | @rhickey | cemerick: doesn't make sense for 2 arg version |
| 11:59 | sandGorgon | notsonerdysunny, ok.. gotcha. It would just have been convenient to refer to namespaces that way |
| 12:01 | FUser | thx |
| 12:01 | dpritchett | sweet |
| 12:01 | FUser | what's this cake stuff I keep hearing about |
| 12:01 | dpritchett | I just downloaded cake from github and then commented out the require io/wait line and now it's working |
| 12:02 | arbscht | what was the rationale for disallowing repeating colon characters in symbol names? to prevent a/::b being read, or something? |
| 12:04 | dpritchett | FUser: http://stackoverflow.com/questions/3906276/whats-the-difference-between-cake-and-leiningen |
| 12:04 | FUser | awesome, now what's leiningen :P |
| 12:05 | defn | while out to lunch i think i fielded that question a half-dozen times |
| 12:05 | defn | (at strangeloop i mean) |
| 12:05 | @rhickey | how did the Clojure folks do at StrangeLoop ? |
| 12:06 | FUser | I've read it] |
| 12:06 | FUser | interesting |
| 12:06 | chouser | rhickey: better than the perl people |
| 12:06 | dpritchett | man I wish I could've made strangeloop |
| 12:06 | dpritchett | It's only a half day's drive for me too |
| 12:06 | @rhickey | chouser: how so? |
| 12:06 | defn | heh, the programming languages panel beat up on Perl 6 pretty heavily |
| 12:07 | defn | ken sipe was the instigator if memory serves correctly |
| 12:07 | chouser | rhickey: perl got ragged on. I knew some guys on a team in St Louis that does a lot of perl to process genome data, and they left feeling pretty hang-dog |
| 12:07 | chouser | clojure at least gets respect |
| 12:07 | FUser | I've only done a single perl app over 500 lines of code. Never forget 11/27. |
| 12:07 | defn | i noticed some growth in clojure-related talks by the end of the conference -- not sure if you noticed that as well chouser |
| 12:08 | chouser | defn: no, I didn't. The cascalog talk was fantastic, but I thought there were fewer there than at some earlier ones. |
| 12:09 | chouser | I think all the clojure speakers performed well, as in people were generally complimentary of the presentations themselves. |
| 12:09 | defn | the two talks you missed had a really interesting mix of people |
| 12:10 | cemerick | arbscht: there's a large gulf between what the reader allows and what the symbol fn allows |
| 12:10 | defn | i think a lot of the folks at the conference wanted "clojure for noobs" |
| 12:11 | tridd3ll | I think I made every clojure talk and was impressed by each. |
| 12:11 | defn | tridd3ll: did we meet |
| 12:11 | defn | ? |
| 12:11 | chouser | defn: I heard that's what "ninja" was -- maybe people didn't know? |
| 12:11 | defn | chouser: i sort of just went on the assumption that ninja meant advanced... *shoulda read the description* |
| 12:12 | defn | although jim's conduit had a lot of advanced stuff so it made up for it |
| 12:12 | tridd3ll | defn: not sure.... don't think so, I also had a client issue which was taking up some of my extra time |
| 12:12 | tridd3ll | between talks |
| 12:12 | @rhickey | Wow, taking away dynamic vars as the default unblocks a ton of design issues, and allows the unification of a bunch of things - direct binding with redef, protocol updating on redef, protocol site caching, primitive arg/returns including in HOFs, transactional loading. I'm literally overwhelmed at how much better I can make all these things |
| 12:13 | hiredman | http://github.com/hiredman/conduit-irc |
| 12:13 | chouser | rhickey: wow, that's fantastic. |
| 12:13 | hiredman | whenever I get around to rewriting clojurebot I think it will be on top of conduit |
| 12:13 | cemerick | :-D |
| 12:13 | @rhickey | also daunted by the job of implementing it all, still capturing design ideas |
| 12:13 | defn | hiredman: hiredman: yeah, jim mentioned your hornet queue was it? |
| 12:13 | cemerick | rhickey: multimethod dispatch fn updating? |
| 12:14 | @rhickey | cemerick: I haven't even thought about that, but there were already things in protocols that could help multimethods |
| 12:14 | @rhickey | cemerick: the fundamental barrier to large multimethod improvements is the opacity of the dispatch function |
| 12:14 | cemerick | Right; I just happen to feel the pain of that one frequently. |
| 12:15 | hiredman | defn: I copied and pasted from jim's rabbitmq transport and massaged it until I got it talking to hornetq |
| 12:15 | tridd3ll | defn: I was the one who asked about the various conduit implementations when he mentioned hireman |
| 12:15 | defn | tridd3ll: ah-ha! it's all coming together now. I know what you look like, but that's about it. :) |
| 12:15 | arbscht | cemerick: right, but I presume the reader's behaviour is intentional in the case of treating "a::b" as invalid (and symbol is unintenioally liberal). if that's so, how come the reader doesn't like "a::b"? |
| 12:16 | @rhickey | cemerick: I don't see MMs getting call site caching any time soon |
| 12:16 | defn | tridd3ll: I was the jerk who asked about recur and if they were using it in production :X |
| 12:16 | technomancy | defn: what did he say, "that's classified"? =) |
| 12:17 | tridd3ll | defn: :-) remember that... I'm bad with faces though so I can't remember what you look like |
| 12:17 | defn | haha no, i just noticed a few functions where they were using recur to consume messages (i think thats how it was being used) |
| 12:17 | hiredman | "it's on the classpath, I mean that's classified" |
| 12:17 | defn | and was curious if, at scale, that caused any problems |
| 12:17 | clojurebot | "They who know me are few, and I give them up," Alice replied. "What's the answer?" "I haven't the slightest idea," said the King. |
| 12:17 | defn | hiredman: haha nice :) |
| 12:17 | @rhickey | cemerick: what is the use case for updating the dispatch fn? |
| 12:18 | cemerick | arbscht: I may be wrong, but I suspect all of the reader characteristics you're talking about are not intentional. |
| 12:18 | _fogus_ | rhickey: Are you leaning toward ^{dynamic true} over defdynamic? |
| 12:18 | cemerick | rhickey: Hrm...change dispatch fn (and methods as well, probably), reload file. |
| 12:18 | @rhickey | _fogus_: yes, already implemented that |
| 12:19 | cemerick | Call multimethod, strange things happen. |
| 12:19 | arbscht | cemerick: clojure.org/reader says "A symbol can contain one or more non-repeating ':'s." -- it seems to be enforced in LispReader too |
| 12:19 | _fogus_ | rhickey: Oh great! |
| 12:20 | tridd3ll | chouser: I also thought the cascalog talk was awesome (it was completely new to me.) |
| 12:20 | @rhickey | _fogus_: I could push, but waiting until I deliver some benefit as well as the upgrade pain, although there is auto-dynamic for *earmuff-vars* until release |
| 12:21 | cemerick | arbscht: I sit corrected. No idea on the motivation there. |
| 12:21 | @rhickey | cemerick: yes, well, not getting on the agenda right now |
| 12:21 | cemerick | rhickey: OK. Thanks for killing the auto-dynamic @ release-time, BTW. :-) |
| 12:22 | @rhickey | cemerick: it works great - get warnings, fix, move on. Only people doing monkey-patching/mocking via binding are likely to break a sweat with this |
| 12:23 | _fogus_ | rhickey: Sounds good to me. In the case of JoC it's just a matter of framing the discussion of ^{dynamic true} |
| 12:23 | @rhickey | _fogus_: the big benefit of the metadata is that it flows through all def-based macros. Having defdynamic do anything other than put the metadata on would engender a bunch of others, e.g. defonce-dynamic |
| 12:24 | esj | hiredman: do you know if any of the vids are up ? I'd be really keen to watch Jim's talk. |
| 12:24 | @rhickey | declare-dynamic et al |
| 12:24 | hiredman | esj: I wasn't there, so I would also be interested, but I don't know |
| 12:25 | @rhickey | Metadata on code and its interaction with macros has proven quite useful |
| 12:25 | esj | hiredman: Tnx. i'll let you know if I find em then. |
| 12:25 | hugod | ,(clojure.string/join "," nil) |
| 12:25 | clojurebot | java.lang.ClassNotFoundException: clojure.string |
| 12:27 | hugod | ->(clojure.string/join "," nil) |
| 12:27 | sexpbot | ⟹ "" |
| 12:27 | hugod | Is that expected? ^^^ |
| 12:30 | djpowell | hmm, any people intimate with pprint here? |
| 12:33 | djpowell | pprint seems to use an adventurous mix of ref-set and io |
| 12:33 | djpowell | it is behaving a bit strangely on clojure-clr |
| 12:45 | dpritchett | djpowell: how is clojure-clr working lately? I've been doing my stuff using lein and cygwin but I wouldn't mind trying the clr version |
| 12:51 | djpowell | I haven't tried it too hard, I just tried the 1.2 binary recently. Seems pretty good. Slower than the Java version. |
| 12:52 | djpowell | I have some clojure code that processes lots of data, unfortunately, it gets it from the database - so the performance of the clojure is fairly irrelevent compared to the overall io. |
| 12:52 | djpowell | It ran fine on the clr version (tho I had to port resultset-seq, which isn't currently included in clojure-clr) |
| 13:02 | _fogus_ | "Lisp seems to have become fashionable again now, thanks to Clojure." http://news.ycombinator.com/item?id=1804145 |
| 13:03 | Raynes | Go PG! |
| 13:04 | Chousuke | :) |
| 13:04 | amalloy | ,(clojure.string/join nil ",") |
| 13:04 | clojurebot | "," |
| 13:05 | esj | now that _IS_ good to hear |
| 13:05 | amalloy | oh misread, hugod. yes, your behavior is expected |
| 13:05 | esj | given that he is partially responsible for me getting all parenthised up |
| 13:05 | amalloy | (ie it's how every join implementation does it) |
| 13:07 | AWizzArd | rhickey: what do you mean by “pain”? If this means: “your code may break here and there, and there are currently no perf enhancements in” then I personally would already regard this as a benefit. It helps me to fix my code now and prepare it for one of the coming updates. |
| 13:09 | hugod | amalloy: I expected nil myself |
| 13:14 | gary_poster | If I want to merge N lazy sequences in a controlled custom way, into a new lazy sequence, do you have to use lazy-seq in your merge function? Put more concretely, here's something that merges ascending sequences of integers without producing dupes. http://paste.lisp.org/display/115669 |
| 13:14 | gary_poster | Could I have done this nicely without lazy-seq? (Other suggestions for newbie welcome too.) |
| 13:15 | amalloy | ,(seq "") |
| 13:15 | clojurebot | nil |
| 13:15 | amalloy | hugod: "" and nil look the same in a sequence context |
| 13:18 | amalloy | gary_poster: (merge-seqs [1 2] [1 3]) doesn't work for me |
| 13:18 | amalloy | ie it throws a NPE |
| 13:19 | gary_poster | hm. thanks for looking. It worked for my examples with lazy sequences locally; lemme mess around. |
| 13:20 | amalloy | also if the sequences are ascending but not *strictly* ascending it will still produce dupes, right? |
| 13:20 | amalloy | eg [1 1 2] [1 4] |
| 13:20 | gary_poster | true; that wasn't one of my use cases |
| 13:21 | amalloy | you can fix that, and simplify your implementation, by replacing the first/rest business with drop-while |
| 13:21 | amalloy | ,(doc drop-while) |
| 13:21 | clojurebot | "([pred coll]); Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns nil." |
| 13:22 | amalloy | ,(map #(drop-while (fn [x] (> x val)) %) seqs) |
| 13:22 | clojurebot | java.lang.Exception: Unable to resolve symbol: seqs in this context |
| 13:23 | amalloy | ,(let [seqs [[1 5] [2 2 4]] val 1] (map #(drop-while (fn [x] (> x val)) %) seqs)) |
| 13:23 | clojurebot | ((1 5) ()) |
| 13:23 | amalloy | oh, i guess i got it reversed. but something like that anyway |
| 13:24 | gary_poster | duped the NPE. my seqs were infinite, so I could only use take, which was why I didn't find it. (take 2 (merge-seqs [1 3 5] [1 4 8])) does work...but so anyway, that |
| 13:24 | gary_poster | 's where I'd need to fix the bug. Trying to grok the drop-while now... |
| 13:25 | gary_poster | oh I got it |
| 13:26 | gary_poster | yeah, that's prettier, thank you |
| 13:26 | gary_poster | but lazy-seq is still appropriate? |
| 13:28 | FUser | map is already lazy? |
| 13:29 | mabes | FUser: yes |
| 13:35 | amalloy | gary_poster: lazy-seq is fine, but i suspect your code would be clearer if you used iterate instead |
| 13:35 | amalloy | or...something like iterate? i haven't thought that through |
| 13:37 | gary_poster | ah! OK, thank you, amalloy, will experiment with that. saw that it existed but did not think to give it a try for this. :-) |
| 13:38 | amalloy | yeah, it may or may not be applicable. it's weird because you're iterating over one sequence but returning a different sequence |
| 13:39 | gary_poster | yeah, can't quite figure out how to make it apply here |
| 13:39 | amalloy | maybe construct a data structure like [min [seq1 seq2 etc]], iterate over that, and map the result with first |
| 13:39 | amalloy | but that's not really clearer :P |
| 13:39 | gary_poster | :-) |
| 13:40 | amalloy | you might look at http://rosettacode.org/wiki/Fibonacci_sequence#Clojure - it's really an eye-opener for this sort of thing sometimes |
| 13:41 | gary_poster | Oh, I see what you mean |
| 13:43 | gary_poster | OK, will play with a fix of the lazy-seq version and make a new iterate version and report back later. :-) Need to do other stuff now. Thank you again, amalloy. |
| 13:44 | gary_poster | BTW, not sure if anyone else in the NC Triangle area is interested in a monthly user group/meetup or some such, but I'd love to see one. |
| 13:45 | @rhickey | AWizzArd: you've already said that |
| 13:48 | defn | party at stuart's house, eh? |
| 13:50 | chouser | gary_poster: in general, if you're consuming more that one seq there are relatively few HOF that end up being clearer than direct use of lazy-seq. map, interleave, ...and I think that's about it. |
| 13:51 | chouser | consuming those two seqs at different rates based on their content strongly indicates use of lazy-seq |
| 13:52 | gary_poster | chouser: ok, awesome. filed away. :-) thank you |
| 13:53 | chouser | that of course may change as people build appropriate HOFs for multiple seqs. :-) |
| 13:53 | gary_poster | heh, of course :-) |
| 14:03 | chouser | http://news.ycombinator.com/item?id=1803627 -- "cool story" in comments on today's "Ask PG" |
| 14:04 | _fogus_ | chouser: Instant classic |
| 14:17 | clojurebot | Clay is fashioned into anything; vacant like a serpent. |
| 14:19 | dpritchett | i read that and shivered |
| 14:21 | amalloy | clojure has spoiled me. i'm now cringing as i write java code that looks like |
| 14:21 | amalloy | private static final Collection<String> myStringStuff = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList("str1", "str2"))); |
| 14:22 | dpritchett | amalloy: i had that same feeling trying to write JS a few weeks ago. i got my app up and running then immediately rewrote it in coffeescript. i thought "hey, coffeescript is great but it's still too quirky" and now i'm back in #clojure again |
| 14:23 | dpritchett | I will say that the "getting this up and running on windows" experience was a lot simpler with node+npm than clojure and i've been putzing with clojure for about a year now |
| 14:23 | amalloy | dpritchett: just three months for me |
| 14:23 | amalloy | but it's been like three years since i used java, too |
| 14:24 | dpritchett | i never did more than a few undergrad data structures problems in java so the entire ecosystem is foreign to me. my progress is pretty closely tied to leiningen hiding all the java from me |
| 14:25 | amalloy | heh |
| 14:26 | amalloy | i did like all my pre-professional work in java, and then was violently dropped into C for a few years, and now php/mysql |
| 14:26 | amalloy | so at least it's familiar to me |
| 14:29 | amalloy | but it's like meeting an old friend who's still working at mcdonalds ten years later. he's just not as cool anymore |
| 14:31 | kryft | amalloy: :D |
| 14:31 | kryft | amalloy: I love the analogy. |
| 14:33 | amalloy | grrr. my computer has stopped making noise when people use my name on irc |
| 14:33 | amalloy | ...apparently because i unchecked that box. note to self, stop blaming the computer |
| 14:34 | AWizzArd | amalloy: when I was a kid people called programming errors "computer errors" back then :) |
| 14:35 | amalloy | AWizzArd: lots of people still treat computers as magic. i bet they call em computer errors |
| 14:36 | AWizzArd | In principle I would say that computers can never make mistakes. |
| 14:36 | kotarak | On a certain level they are computer errors. There are maybe particular subset like "software errors" or "hardware errors" which comprise "computer errors" |
| 14:36 | AWizzArd | Yes okay, I can agree from a more global point of view. |
| 14:37 | AWizzArd | as in "Earth Error" or "Universe Error", or an error in the Matrix. (java.lang.MatrixException) |
| 14:39 | kotarak | AWizzArd: It's a question of abstraction level. Our customer sees HECU defect. The HECU sees ECU defekt. The ECU sees a PCU defect.... You get the idea. |
| 14:39 | kotarak | AWizzArd: An the endcustomer sees a warning lamp - a "car error". |
| 14:39 | AWizzArd | yes |
| 14:41 | dpritchett | you could spin those errors as insufficient fault tolerance/detection and in the implementation |
| 14:42 | dpritchett | my CHECK ENGINE light is pretty good at finding all kinds of weird "fix this before car explodes" issues |
| 14:44 | kotarak | dpritchett: It's because some OEMs turn on funny warning lamps which are absolutely unrelated to the actual problem. There we have the bridge to computers... |
| 15:07 | serabe | hi |
| 15:08 | serabe | I'm having a problem with "." |
| 15:09 | Raynes | seancorfield: What is your problem? |
| 15:09 | serabe | being src-out a function, (. g2 setComposite (src-out)) throws an exception, about "Can't embed object in code, maybe print-dup not defined: java.awt.AlphaComposite@b0800007" |
| 15:10 | serabe | but if i do something like (def a (src-out)) (. g2 setComposite a) it works perfectly |
| 15:10 | serabe | any idea? |
| 15:13 | amalloy | serabe: that's a bit weird. does it work if you do (.setComposite g2 (src-out))? |
| 15:14 | amalloy | man, that is a silly question. it macroexpands into the same thing |
| 15:14 | serabe | amalloy: no, it doesn't work either |
| 15:16 | jkkramer | serabe: is it being used as part of a macro? |
| 15:17 | serabe | yes, but it doesn't work on the repl |
| 15:17 | jkkramer | is that the full line that you are typing/pasting into the repl? |
| 15:18 | serabe | yes |
| 15:18 | serabe | jkkramer: i can make a gist with the repl session and the full macro if you want to |
| 15:19 | jkkramer | serabe: sure |
| 15:20 | serabe | jkkramer: http://gist.github.com/632849 |
| 15:21 | lpetit | hello |
| 15:22 | serabe | hi |
| 15:22 | serabe | jkkramer: src-out is defined this way http://gist.github.com/632852 |
| 15:32 | jkkramer | serabe: at a glance, i'm not sure what's wrong with it but generally that error shows up for incorrect unquote usage |
| 15:32 | serabe | jkkramer: but it expands correctly |
| 15:33 | FUser | where could I find some open source clojure project to join? |
| 15:33 | FUser | I need to learn this by doing] |
| 15:33 | jkkramer | serabe: sorry, i don't have time to troubleshoot at the moment. you might get better help from the mailing list |
| 15:34 | serabe | jkkramer, i'll do, thanks |
| 15:34 | serabe | FUser: if you like working with images you're welcome to join rinzelight! |
| 15:36 | serabe | the-kenny: ping! |
| 15:36 | the-kenny | serabe: pong |
| 15:36 | serabe | the-kenny: you are the one interested on rinzelight, aren't you? |
| 15:37 | FUser | why does the following code block my REPL |
| 15:37 | FUser | (let [p (promise)] (future @p)) |
| 15:38 | kotarak | Because it derefs the future to print it? |
| 15:38 | FUser | well full code is like this |
| 15:38 | the-kenny | serabe: Yeah, you're right. Unfortunately, I didn't have time to take a deeper look at rinzelight. |
| 15:38 | kotarak | FUser: please use a paste |
| 15:38 | kotarak | paste-bin |
| 15:39 | serabe | the-kenny: just wanted to let you know I'm already working on composition |
| 15:39 | FUser | (let [p (promise)] (future @p (println "something")) p) |
| 15:39 | FUser | so a let sentence that returns the promise |
| 15:39 | FUser | so you can later deliver on it |
| 15:39 | kotarak | FUser: then it probably derefs the promise to print it. |
| 15:39 | FUser | hm |
| 15:39 | kotarak | Try (def my-p (let ....)) |
| 15:40 | FUser | (ok |
| 15:40 | kotarak | Then (deliver my-p "blub") or so |
| 15:40 | FUser | but wouldn't that also deref to print the function result? |
| 15:40 | FUser | ah |
| 15:40 | the-kenny | serabe: Oh, very cool :) Can't wait to see it. |
| 15:41 | FUser | ok |
| 15:41 | FUser | how do I get out of this mess :P I need to restart repl or somthing : |
| 15:41 | FUser | in clojurebox |
| 15:41 | FUser | emacs, slime |
| 15:42 | the-kenny | FUser: Try M-x slime-list-threads. I think I implemented killing of threads some months ago. |
| 15:42 | the-kenny | Maybe you can kill the right thread and your repl gets responsive again :) |
| 15:42 | defn | howdy all |
| 15:44 | sempah | hello no clojure question, but maybe anyone knows it: what is the opposite of concatenation? |
| 15:45 | sempah | string concatenation |
| 15:45 | chouser | split |
| 15:45 | chouser | partition |
| 15:45 | sempah | hmm |
| 15:45 | tridd3ll | tokenize |
| 15:45 | chouser | subs |
| 15:45 | sempah | I need a nice "looking" word |
| 15:45 | sempah | tokenize seems to fit |
| 15:45 | sempah | thx :) |
| 15:45 | kotarak | uncat |
| 15:47 | defn | uncle |
| 15:50 | FUser | the kenny |
| 15:50 | FUser | I used slime-restart-inferior-lisp |
| 15:53 | the-kenny | FUser: ah ok. I thought you wanted to make the repl responsive again without killing the underlaying clojure instance |
| 16:00 | Raynes | Afternoon. |
| 16:00 | serabe | afternoon! |
| 16:01 | serabe | the-kenny: composition is on github! |
| 16:01 | serabe | the-kenny: which other effects do you need? |
| 16:02 | the-kenny | serabe: I think they'll fit for now :) I don't need very fancy stuff |
| 16:03 | serabe | the-kenny: ok, if you need anything, just let me know! |
| 16:03 | serabe | good night then! |
| 16:04 | the-kenny | sempah: good night :) And thanks for the quick implementation. I'm sure I'd have taken much longer |
| 16:04 | sempah | hm? |
| 16:05 | sempah | which implementation? |
| 16:07 | the-kenny | Of the composition |
| 16:08 | sempah | i didnt show it -.- |
| 16:08 | sempah | but good night |
| 16:13 | clojurebot | "Oh, please mind what you're doing!" cried Alice. Jumping up in a day is very level and easy; but people love the by-ways. |
| 16:30 | rlb | Will xml zip-filters (and lazy-xml) support pulling nodes out of very large xml files without pulling the whole doc into ram? |
| 16:36 | bsteuber | hi |
| 16:37 | bsteuber | where did the api for clojure.java namespaces go? |
| 16:38 | raek | is gone from clojure.github.com/clojure again? |
| 16:38 | raek | in the mean time, try clojuredocs.org |
| 16:38 | Raynes | Guys, stop nixing the clojure.java namespaces. :( |
| 16:39 | defn | is there any code out there already that converts <html></html> to [:html] |
| 16:39 | defn | like a reverse hiccup? |
| 16:39 | raek | wellm there's enlive, but then you get {:tag :html, :attrs {}, :content (...)} |
| 16:40 | defn | yeah id like something simpler like hiccup |
| 16:40 | defn | hmm |
| 16:40 | raek | converting between the two would be pretty simple |
| 16:41 | bsteuber | raek: thx, clojuredocs seems nice |
| 16:42 | chouser | clojure.xml/parse and clojure.contrib.lazy-xml/parse both generate the {:tag :html, :attrs {}} format |
| 16:42 | chouser | Dunno if I've seen code to reduce that to [:html ...] hiccup format, but I can't imagine it'd be hard. |
| 16:43 | raek | what is the hiccup syntax for attributes? [:html {:foo "bar"} ...]? |
| 16:43 | Raynes | Right. |
| 16:43 | defn | i think so yeah |
| 16:43 | nickik | the other way around would be cool too |
| 16:45 | defn | i want to allow people to build html templates using the hiccup syntax |
| 16:45 | defn | actually nvm i think i figured out my issue |
| 16:45 | defn | thanks for the help |
| 16:47 | nickik | i download some html5 templates but it would be better if they were hiccup syntax. |
| 16:47 | defn | that's kind of what I was going for |
| 16:47 | defn | a nice easy way to convert my HTML template to hiccup syntax so I could mold it |
| 16:52 | mattmitchell | i'd like to use the apache solr trunk code base in my clojure project, but it's not in a repo anywhere... how can i do this? |
| 16:52 | LauJensen | defn: thats already possible though, with a hiccup/enlive combo |
| 16:54 | defn | LauJensen: im not sure i follow |
| 16:54 | LauJensen | defn: You want people to build templates with hiccup right? So let hiccup emits the html and pass it to an Enlive template? |
| 16:55 | defn | tbqh im sort of mulling over a few ideas and am not sure what i want yet |
| 16:55 | defn | for some reason i got stuck on the idea of being able to read in html as hiccup and write html from hiccup |
| 16:56 | defn | what you're saying makes perfect sense |
| 16:58 | raek | http://gist.github.com/633049 <-- I hacked together an enlive->hiccup and a hiccup->enlive function |
| 16:59 | raek | can be handy to have, I thought |
| 17:00 | raek | I only tested this on some small examples |
| 17:01 | defn | raek: cool |
| 17:01 | defn | im thinking i may just deserialize the template file since it's just a clojure datastructure |
| 17:02 | defn | either way im saving that for later use just in case :) |
| 17:06 | Raynes | chouser: Where do your logs come from? (the ones on n0ise) |
| 17:07 | kotarak | From the channel? ;P |
| 17:07 | chouser | the irssi client I'm typing in right now |
| 17:07 | LauJensen | If hiccup still has that html fn which emits a string of html, hiccup>enlive should be (template (-> hicdata html htmlsnippet)) |
| 17:08 | chouser | I know, it's all very duct-tape-and-baling wire |
| 17:10 | mrBliss | Let's see if there are any Java Pros in here: What's the type of a java.util.List holding subclasses of a certain class, e.g. TheClass. But here's the catch: it should hold the *.class versions (Class objects), not some instantiated objects! So not List<? extends TheClass> but something like List<? extends TheClass.class> (which doesn't work) |
| 17:12 | Chousuke | mrBliss: just Class |
| 17:12 | Chousuke | mrBliss: I don't think you can specify it so far that the objects are class objects of a specific class. |
| 17:12 | Chousuke | mrBliss: and at runtime it's all Objects anyway |
| 17:14 | mrBliss | Chousuke: thanks. I was afraid it would the case |
| 17:14 | Raynes | chouser: Unless anybody is opposed, I also have sexpbot logging #clojure: http://acidrayne.net/logs/irc.freenode.net/clojure/ |
| 17:15 | chouser | Raynes: that's excellent. does sexpbot do a better job of staying connected that this irssi does? |
| 17:16 | Raynes | Probably not. It will once raek finishes his automatic reconnect stuff in Irclj. |
| 17:16 | chouser | ok |
| 17:16 | Raynes | Not that it drops frequently. Stuff can happen though. |
| 17:16 | chouser | I'd love to have a single process connect to the channel a writing out the .html the moment a post is made |
| 17:17 | chouser | ...instead of every 15 minutes or whatever I'm doing now |
| 17:22 | ohpauleez | hey guys, I have a quick question |
| 17:23 | ohpauleez | I'm using a less-than-stellar patch to do a string split, limiting to one split, but the last possible split |
| 17:23 | ohpauleez | ex:... |
| 17:24 | ohpauleez | "this:is:a:string" => ["this:is:a" "string] |
| 17:24 | ohpauleez | right now, I'm reversing the string, splitting, and mapping reverse back onto the strings (because it was quick and easy to do), but I'd like to do something more elegant |
| 17:25 | ohpauleez | and suugestions? |
| 17:25 | ohpauleez | s/and/any |
| 17:25 | kotarak | lastIndexOf and subs? |
| 17:26 | ohpauleez | let me try on the repl, I didn't even think to use java string stuff yet |
| 17:26 | ohpauleez | I like that idea though kotarak |
| 17:26 | rlb | Should (xml-> (xml-zip (parse-trim file)) :foo :bar text) avoid pulling all of file into RAM at once? |
| 17:26 | rlb | (So far it doesn't seem to...) |
| 17:27 | kotarak | ,(let [pos (.lastIndexOf "this:is:a:string" ":")] [(subs "this:is:a:string" 0 pos) (subs "this:is:a:string" pos)]) |
| 17:27 | clojurebot | ["this:is:a" ":string"] |
| 17:27 | kotarak | almost... |
| 17:28 | ohpauleez | yeah, I just starting toying, I added a inc in there |
| 17:30 | @rhickey | so, a few things came up in the full-time direct binding of non-dynamic vars |
| 17:30 | @rhickey | one was that the caching precludes the unbound check, so references to unbound have to return an unbound object instead of throwing an exception |
| 17:31 | @rhickey | the other was that a fn can't see it's own alter-var-roots, given the rule that a fn sees the values of vars at its start throughout its body |
| 17:31 | @rhickey | the latter only came up in some hacky tests |
| 17:32 | @rhickey | the net result though was that, e.g. wrapping some code in a fn added no overhead, neither in lookup nor the wrapper fn (presumably inlined away) |
| 17:33 | @rhickey | and the (let [afn afn] ... (afn ...)) hack is now a counter optimization - the cache is better |
| 17:37 | hiredman | excellent |
| 17:38 | ohpauleez | pretty sweet indeed |
| 17:39 | @rhickey | so this is what happens with unbounds: |
| 17:39 | @rhickey | (declare fred) |
| 17:39 | @rhickey | (defn baz [] fred) |
| 17:39 | @rhickey | (baz) |
| 17:39 | @rhickey | #<Unbound Unbound: #'user/fred> |
| 17:39 | hiredman | :/ |
| 17:39 | @rhickey | was an exception |
| 17:39 | Chousuke | what happen if you store the unbound and then define fred? |
| 17:39 | Chousuke | happens* |
| 17:39 | hiredman | could the cache through an exception if it caches an unbound? |
| 17:40 | @rhickey | Chousuke: what does that mean? |
| 17:40 | @rhickey | hiredman: no, because that can happen legitimately |
| 17:40 | Chousuke | rhickey: I mean, if you store the unbound and try to use it somehow later after it's been bound. |
| 17:41 | @rhickey | Chousuke: I don't understand that |
| 17:42 | @rhickey | hiredman: you might have access to a currently unbound var in a not-called path - it will still be in the cache set |
| 17:42 | hiredman | so it's like unitialized variables in java, the unitialized value of vars is an Unbound object |
| 17:43 | Chousuke | eg. if you do (let [x (baz)] (defn fred [] 5) (x)) given the above, what happens? |
| 17:43 | @rhickey | hiredman: no, you'll still get an exception if you deref |
| 17:43 | hiredman | wait, what? |
| 17:44 | hiredman | I thought that was what you got when you deref'ed |
| 17:45 | hiredman | fred ~= (deref (resolve 'fred)) ; but in the fred case resolution happens at compile time |
| 17:45 | @rhickey | a fn gets the values of the vars it uses when first called, and caches them until they change. In doing so it might read some unbound vars - sometimes that is an error, sometimes not. What it caches in either case is an Unbound object |
| 17:46 | @rhickey | resolution is as it always was |
| 17:46 | hiredman | ok |
| 17:46 | @rhickey | but the meaning of a var used in a fn is fixed at its entry point |
| 17:47 | @rhickey | I can't make attempting to cache an unbound var an exception, as it can happen in circumstances that would throw an error in the body anyway |
| 17:47 | @rhickey | wouldn't |
| 17:48 | hiredman | ok |
| 17:49 | @rhickey | the overwhelming majority of references to unbounds are programming time mistakes, not worth incurring runtime overhead on every fn call |
| 17:50 | @rhickey | most common will be calls to unbound fns, still thinking about how to make that error better |
| 17:51 | rlb | Answer: perhaps a known issue http://groups.google.com/group/clojure/browse_thread/thread/365ca7aaaf8d55b7?pli=1parse |
| 17:52 | rlb | Though I'd just assumed the use of parse-trim would fix that. |
| 17:52 | rlb | Somethings obviously holding on to memory. |
| 17:54 | @rhickey | this is better: |
| 17:54 | @rhickey | (declare fred) |
| 17:54 | @rhickey | (defn baz [] (fred)) |
| 17:54 | @rhickey | (baz) |
| 17:54 | @rhickey | IllegalStateException Attempting to call unbound fn: #'user/fred clojure.lang.Var$Unbound.throwArity (Var.java:43) |
| 17:58 | ohpauleez | haha |
| 18:00 | lpetit | rhickey: hmm, now that fns have caches of vars values updated (when necessary) for each call, does it mean that it could be possible to envisage not having to (declare fred) ? |
| 18:01 | @rhickey | lpetit: declaring fred is used to resolve fred, this is just about the values |
| 18:01 | lpetit | rhickey: with the "accepted" caveat (when used this way) that there may be missing type hints (and so declare still useful for these cases) |
| 18:01 | @rhickey | we could always have auto-declared fred |
| 18:03 | @rhickey | but a typo would auto-create the var ferd |
| 18:03 | AWizzArd | I prefer being explicit about it, as this catches at least some potential bugs. |
| 18:03 | lpetit | there is already a risk of typo for keywords, and it seems that everybody is used to live with that (though it's wayy more vicious) |
| 18:04 | lpetit | say i have vars bar and baz declared. A typo could make me use bar instead of baz ... |
| 18:04 | AWizzArd | yes, also for numbers, but we should not give up on this - the compiler can actually help here |
| 18:05 | lpetit | will not help with bar baz ^^^^ |
| 18:05 | AWizzArd | Although those are not the examples that fit reality most ;) |
| 18:05 | AWizzArd | (wiht-open ...) |
| 18:07 | lpetit | I'm not sure of that. I've been hunting bugs with keywords, they're subtle because they can crash wayy after having been introduced. Not generally the case for var usage. Would crash very quickly with a InvalidStateException -unbound var-, where it is used. Easy to spot, easy to correct |
| 18:07 | AWizzArd | Unfortunately this is a problem with all literals. |
| 18:07 | AWizzArd | numbers, strings, keywords, etc. |
| 18:08 | lpetit | And more dynamic. It's a pain to explain to java users that they must write their code bottom-up only. It's a very C-ish style which does not help them fall in love with clojure (at least at first sight) |
| 18:08 | lpetit | s/java users/java ruby python perl php scheme etc users/ |
| 18:08 | sexpbot | <lpetit> And more dynamic. It's a pain to explain to java ruby python perl php scheme etc users that they must write their code bottom-up only. It's a very C-ish style which does not help them fall in love with clojure (at least at first sight) |
| 18:10 | lpetit | But ok, I acknowledge it's unrelated to the enhancement under examination |
| 18:10 | defn | given ive (with-out-writer ...some-file... (binding [*print-dup* true] (prn clojure-code))), where clojure-code is (ns foo.bar (:use xyz)), can I read that in later, or would that be insane? |
| 18:11 | defn | like if I have several blocks of code in this file and I read it in, would forms I read in after the (ns...) block be placed correctly in that ns? |
| 18:14 | lpetit | rhickey: another "topic of the day" = what's your position w/r the "require namespace implictly" buzz in clojure-dev ml ? |
| 18:16 | defn | lpetit: re bottom-up I don't think it's so much the C-style or something as it is the organization of functions across a larger project, how to pull them together with the right combination of use and require |
| 18:17 | defn | that seems to be a bigger paint point than the whole "write it top-down" thing, imo. |
| 18:17 | defn | s/paint/pain |
| 18:17 | @rhickey | lpetit: I'm not in favor |
| 18:19 | @rhickey | lpetit: the analogy to Java is quite broken, as that is a language with compilation units, and Clojure/Lisp is not |
| 18:19 | lpetit | defn: I've rarely seen 1-1 relationship between namespaces and functions. And in my experience, projects grow with 1-2 namespaces first, sometimes for a long time, before being carefully split into namespaces. And last but not least, in the same namespace, when there are deps between fns of the ns, I (and I think I'm not the only one ?) find generally easier to be able to first look at the bigger picture, and in clojure ns it's generall |
| 18:19 | defn | how do i get on the clojure dev ml? |
| 18:20 | defn | lpetit: i think maybe what i need is a better expand/collapse mechanism in my editor |
| 18:20 | lpetit | rhickey: sorry for being so perversed by java :-/ . But not only java does this, even in the "dynamic languages camp", right ? |
| 18:21 | @rhickey | lpetit: right, but Clojure and Lisp are not file oriented |
| 18:21 | lpetit | defn: expand/collapse will never replace carefully hand-made fns placements. Currently, my choice is limited. |
| 18:21 | Raynes | defn: Do you have a CA accepted? If so, just sign up and someone will add you. |
| 18:22 | defn | CA? |
| 18:22 | clojurebot | CA is Contributor Agreement: http://clojure.org/contributing |
| 18:22 | defn | ah, yes I do have one of those |
| 18:22 | defn | I think I just need to be invited. |
| 18:23 | lpetit | rhickey: right. I don't remember in CL (and maybe that's not a bad thing IMO): is this allowed (to "use in a fn body", then "declare") ? |
| 18:23 | @rhickey | alright, brave new world - http://github.com/clojure/clojure/commits/master |
| 18:24 | lpetit | yepee ! |
| 18:24 | @rhickey | lpetit: CL lets you compile against undeclared things, but has a gigantic problem with symbol interning |
| 18:26 | lpetit | rhickey: well, probably what I just need to know (so it will be once and for all): is the fact that there's no auto-declare a matter of performance (cpu, memory, whatever) or a deliberate choice to prevent, in this area, users to shoot themselves in the foot ? |
| 18:27 | @rhickey | lpetit: the latter, and a cleanliness issue, so typos don't pollute the ns |
| 18:28 | lpetit | (while I know /and/ understand that the very nature of clojure is not file oriented but TLE oriented, I've yet to come across a project which, even in an incomplete "form", does not feel like file-oriented - e.g. a project with no ns, or with more than one ns per file ...) |
| 18:29 | dnolen | rhickey: so is there no longer a need to define a fn as :static? |
| 18:29 | lpetit | rhickey: ok, I thing I'll continue to live with that :) |
| 18:29 | lpetit | (as if I had choice ;-) ) |
| 18:30 | lpetit | dnolen: yes, these commits seem to be :static killers (for the greater good) |
| 18:31 | defn | who do I contact to get invited to the clojure dev ml? |
| 18:31 | ohpauleez | I just want to say, I'm really enjoying see all these great changes going into 1.3. Amazing work from everyone involved and hats off. I think the final product will be a huge leap forward from an already amazing place |
| 18:31 | AWizzArd | oh good, I will try this out tomorrow |
| 18:31 | Raynes | defn: All I did was hit the "register for this group" button, plead my case, and waited. |
| 18:31 | Raynes | They let me in in like 2 days. |
| 18:32 | coldhead | aw ohpauleez <3 |
| 18:32 | defn | Raynes: thanks |
| 18:33 | dnolen | lpetit: so does that mean you can just type hint fns and it will just work? |
| 18:33 | ohpauleez | coldhead: haha |
| 18:34 | lpetit | dnolen: I'll let Rich summarize, but as far as I understand it, yes. Use def (not defdynamic), type hint, and there you go. |
| 18:35 | @rhickey | dnolen: I'm working on that |
| 18:36 | @rhickey | the current commits give the direct linkage benefits of static without the static-ness, i.e. they can detect redefs without requiring re-eval of callers |
| 18:37 | @rhickey | wheras static was like macro in callers had to be re-evaluated to pick up changes |
| 18:37 | @rhickey | but the primitive support of :static has yet to be incorporated |
| 18:38 | lpetit | *Yaawwnn* Time to go to bed here ! cu later, all ! |
| 18:38 | lpetit | keep up the good work ! |
| 19:01 | wooby | just opened up 25 more conj after-party spots, if you weren't able to register earlier today: http://conjafterparty.eventbrite.com/ |
| 19:08 | hiredman | ,(doc bound-fn) |
| 19:08 | clojurebot | "([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place." |
| 19:21 | dharma | hello - I'm running UBUNTU. I installed clojure and clojure-contrib using package manager. I'm not able to include math libraries. Apparently, compiler is not finding math.clj. |
| 19:21 | dharma | Any pointers appreciated |
| 19:22 | dharma | How to include it in my CLASSPATH? |
| 19:30 | plathrop | What's the YAML lib of choice? I hate it but I've got a bunch of YAML I have to parse. |
| 19:30 | plathrop | I looked at http://github.com/lancepantz/clj-yaml but the installation instructions fail |
| 19:31 | lancepantz | plathrop: how so? |
| 19:32 | plathrop | lancepantz: let me construct you a big ol' gistg |
| 19:33 | petrilli_ | Anyone have an idea as to why I get NullPointerException the first time I run "lein deps" on deps on a project, then it works the second time? It's more like EXACTLY every other time. http://pastebin.com/TwK8JpeA |
| 19:34 | plathrop | lancepantz: http://gist.github.com/633299 |
| 19:37 | petrilli_ | technomancy: huzzah! I was using 1.2.1 (which is what's on your README.md BTW) |
| 19:38 | technomancy | petrilli_: must not be it; that's swank-clojure, not lein-swank. |
| 19:40 | petrilli_ | technomancy: I read it in reverse, sorry. I don't have lein-swank listed as a dep, just using whatever comes with Leiningen 1.3.1 |
| 19:40 | phobbs | How do I add a generic java jar to my dependencies in Lein? |
| 19:41 | phobbs | The readme said to upload it to clojars |
| 19:41 | petrilli_ | technomancy: Although I so have Leiningen v1.1, 1.2, 1.3 and 1.3.1 in the local Maven repository |
| 19:41 | phobbs | but I can't do that for all the jars I need |
| 19:43 | lancepantz | plathrop: if you'd like to do it go for it :) |
| 19:43 | lancepantz | there should also be a 'cd clj-yaml' before the 'lein deps' line in the dev instructions |
| 19:47 | phobbs | thanks for all your help; it's http://github.com/elopezdelara/lein-installjars |
| 19:53 | petrilli_ | technomancy: Any other ideas? even blowing away the entire Maven cache doesn't get rid of the problem.... here's my project: http://pastebin.com/jWymTWWJ |
| 19:59 | technomancy | petrilli_: one of your dependencies must be exhibiting the same problem as lein-swank. do a binary search to discover which, and see if that dep has anything in common with lein-swank. |
| 19:59 | technomancy | ,(clojure.set/difference #{:a :b} [:b :c]) |
| 19:59 | clojurebot | #{:a} |
| 19:59 | technomancy | ,(clojure.set/difference #{} [:b :c]) |
| 19:59 | clojurebot | #{} |
| 20:00 | technomancy | ,(clojure.set/union #{} [:b :c]) |
| 20:00 | clojurebot | [:b :c] |
| 20:00 | technomancy | ^ wat |
| 20:00 | petrilli_ | technomancy: set of what, though? Not sure what problem lein-swank "exhibits"? |
| 20:00 | technomancy | I guess the return value of clojure.set functions is undefined when its arguments aren't all sets? |
| 20:01 | technomancy | petrilli_: not sure; haven't gotten a chance to look at http://github.com/technomancy/leiningen/issues#issue/105 in detail yet. but it sounds like the same problem you're describing. |
| 20:02 | petrilli_ | Looking at Java tracebacks makes my eyes bleed :) I'll see what I can figure out. |
| 20:07 | plathrop | I'm deeply confused: http://gist.github.com/633331 |
| 20:07 | petrilli_ | technomancy: FWIW, it appears that native-reps blows up leiningen :) |
| 20:07 | petrilli_ | er, native-deps |
| 20:12 | plathrop | can anyone tell me what's up there? |
| 20:13 | Raynes | cemerick: Evening. |
| 20:13 | amalloy | plathrop: read-lines is lazy |
| 20:13 | cemerick | Hi :-) |
| 20:14 | amalloy | it's returning a lazy sequence that reads the input stream. then the stream goes out of scope, gets closed, and then the repl tries to print the lazy seq, which now has a ref to a closed object |
| 20:14 | plathrop | amalloy: ah |
| 20:14 | plathrop | okay, thanks |
| 20:15 | amalloy | i had a similar problem this weekend with (vals [1 2]) |
| 20:15 | amalloy | didn't throw an exception until the repl tried to print, by which time the exception made no sense |
| 20:25 | petrilli_ | And finally, Google protocol buffers + ZeroMQ goodness |
| 20:28 | plathrop | amalloy: how do you force the sequence again? |
| 20:29 | amalloy | dorun is one way, but it doesn't return anything. i don't remember the functional way to do it |
| 20:29 | amalloy | i mean, you force the sequence by actually doing something with the results. it's not clear why you want to get a line-seq and then not do anything with it, but still want it to read the file |
| 20:31 | plathrop | I do. I want to parse the yaml from the file. But nothing I do is making that loaded stuff be passable into yaml parsing functions |
| 20:31 | plathrop | I'm grasping at straws at this point |
| 20:32 | plathrop | Of course I just figured out a way to do it |
| 20:32 | plathrop | On to the next problem - these shitty yaml files were produced by ruby... *sigh* |
| 20:33 | plathrop | null; Can't construct a java object for !ruby/object:Puppet::Node::Facts; exception=Invalid tag: !ruby/object:Puppet::Node::Facts [Thrown class org.yaml.snakeyaml.constructor.ConstructorException] |
| 20:33 | plathrop | I hate ruby |
| 20:37 | tridd3ll | so, with Cake, what's the easiest way to include jars which won't be location in a maven repository... can I just put them in /lib or will they get removed when doing "cake deps"? |
| 20:39 | ninjudd | tridd3ll: they will get removed in lib |
| 20:39 | ninjudd | tridd3ll: you could install them into your local maven repo |
| 20:39 | Raynes | Or, if the jars are open source, put them on clojarsd. |
| 20:39 | Raynes | clojars* |
| 20:40 | tridd3ll | ninjudd: is that the best path then? these are proprietary jars from vendor (IBM) |
| 20:40 | ninjudd | tridd3ll: or you can put them in a dir of your choice and then add that dir to your project's classpath |
| 20:41 | tridd3ll | ninjudd: and I do that in the project.clj? |
| 20:42 | ninjudd | tridd3ll: no, .cake/config. add something like this: project.classpath = /path/to/jars/* |
| 20:42 | tridd3ll | ninjudd: ok, just found that on the cake readme |
| 20:43 | ninjudd | tridd3ll: cool |
| 20:44 | tridd3ll | ninjudd: thanks |
| 20:44 | ninjudd | tridd3ll: no problem |
| 21:01 | technomancy | ,(sort [(keys {:a :b}) (keys {:b :c})]) |
| 21:01 | clojurebot | java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.APersistentMap$KeySeq cannot be cast to java.lang.Comparable |
| 21:04 | technomancy | odd that vectors are comparable but seqs aren't |
| 21:06 | scgilardi | would it be feasible to make all sequential things comparable? |
| 21:31 | defn | tridd3ll: im glad to see that SL piqued your clojure interest. |
| 21:31 | defn | You've been in here all day :D |
| 21:33 | tridd3ll | tridd3ll: yep... I'm a long time dabbler... haven't been in IRC much lately though. SL has created more excitement though. |
| 21:33 | defn | good to hear |
| 21:34 | tomoj | what's SL got to do with clojure? |
| 21:34 | defn | SL == Strange Loop 2010 |
| 21:34 | tomoj | oh, heh |
| 21:34 | defn | not snow leopard :) |
| 21:34 | defn | how about those apple 4th quarter earnings, though, eh? |
| 21:34 | tomoj | I guessed someone wrote a clojure wrapper around second life |
| 21:34 | defn | haha |
| 21:35 | defn | when that day comes -- im switching to haskell |
| 21:48 | ossareh | what is the recommended way to create a long running process in clj? In particular I care about the ability to check on the health of the process - normally in java I'd have an object that implements runnable with some methods on it to check that it is OK. |
| 21:53 | tomoj | hmm |
| 21:53 | tomoj | why should there be an object? |
| 21:53 | jweiss | isn't that what jmx is for |
| 21:54 | jweiss | i guess that isn't clojure specific |
| 21:54 | kumarshantanu | ossareh: lifecycle-aware daemons as (def ...) ? |
| 21:55 | kumarshantanu | say (def foo (daemon ...)) |
| 21:55 | tomoj | better have to (run-daemon foo) or something |
| 21:56 | kumarshantanu | tomoj: lifecycle-aware daemons need to be polled from outside -- maybe def can give that visibility |
| 21:57 | tomoj | sure |
| 21:57 | tomoj | I just mean I wouldn't want (def foo (daemon ...)) to actually start the daemon |
| 21:58 | kumarshantanu | tomoj: yeah right....for example these use cases might be expected -- (.start foo), (.stop foo), (.suspend foo) |
| 21:59 | tomoj | sounds good for a protocol |
| 22:00 | tomoj | then you can make a daemon by implementing the protocol |
| 22:00 | tomoj | and pass it initialization config in its initializer |
| 22:01 | tomoj | what does "lifecycle-aware" mean, exactly? |
| 22:02 | ossareh | In my case I want to be able to hook a web service up to it to get status on it's progress (initially whether it is still running or not). I'm not sure if that is a lifecycle. |
| 22:02 | tomoj | a ring web service? |
| 22:03 | ossareh | sure.. could be. |
| 22:03 | kumarshantanu | lifecycle-aware = one that can be polled for lifecycle from outside -- start, stop, suspend, resume, take-a-break etc |
| 22:03 | tomoj | ah |
| 22:05 | tomoj | hmm, is your daemon a web service, or do you mean want to have http endpoints which return status info about the daemon |
| 22:05 | defn | kumarshantanu: sounds sort of like NSMP |
| 22:05 | defn | SNMP |
| 22:05 | ossareh | tomoj: it will need to update some state that can be deref form a web service call |
| 22:05 | ossareh | I think this is what agents are for, correct? |
| 22:05 | jweiss | seriously, consider jms |
| 22:05 | jweiss | jmx |
| 22:06 | ossareh | jweiss: I don't think I have access to JMX with jetty - that is more of a full app server thing, no? |
| 22:06 | jweiss | ossareh: well, i am no expert on jmx, but supposedly you can use it to monitor any kind of java object |
| 22:06 | jweiss | http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/ |
| 22:07 | ossareh | would hate to go down that road for what could be a ref protected map |
| 22:08 | tomoj | agents would work I think |
| 22:09 | tomoj | I was imagining a def(type|record) of Daemon that used agents to do its work |
| 22:09 | tomoj | but it seems kinda funny that you'd have to write the agent logic for every Daemon implementation |
| 22:09 | tomoj | maybe have some macros which generate Daemon implementations with common types of agent logic? |
| 22:12 | coldhead | that seems kinda funny in a different way |
| 22:14 | kumarshantanu | the only benefit of using JMX in this case seems that they can be tracked from the JMX console of the app server |
| 22:15 | kumarshantanu | and some integration with the "enterprise" back end services |
| 22:17 | kumarshantanu | I am interested to know if there is another advantage |
| 22:29 | tomoj | coldhead: yeah |
| 22:41 | amalloy | is there a reason max-key isn't just defined as (apply max (map f vals))? then it wouldn't have this nonsense about calling f 2N times instead of N times |
| 22:43 | hiredman | that will return the highest number, not the key for which the number is highest |
| 22:43 | amalloy | ah, right |
| 22:45 | hiredman | ,(last (last (sort-by #(get % 0) (map (fn [x] [(read-string x) x]) ["1" "2" "3"])))) |
| 22:45 | clojurebot | "3" |
| 22:47 | amalloy | hiredman: just map read-string, surely? |
| 22:47 | amalloy | oh man, nm. reading stupidly again |
| 22:48 | amalloy | yeah, i wrote something similar (http://gist.github.com/619722), but it's annoying not to have it available |
| 23:12 | polypus | anybody have any advice on using websockets in a clojure app? |
| 23:13 | polypus | is there a clojure lib? if not what would be the best bet for implementing websockets in a compojure app? |
| 23:21 | leifw | so I'm using an agent to do some simulated annealing, with processing to display the progress; processing's draw function reads the state and displays it, and I'd like to have another "thread" refining the state |
| 23:22 | leifw | what I do now is send the refining function to the state (which is an agent), and then, in the refining function, I send another message before I return |
| 23:22 | leifw | but this is ugly, and doesn't let me stop the process, for example, by redefining the refining function with slime, to not send that message |
| 23:23 | leifw | is there a reasonable way to have some kind of "thread" which will queue up another message as soon as one is done processing? |
| 23:23 | leifw | I was thinking of using a watcher, but from what I've read, it seems that if the refining function doesn't change the state (for example, if the newly generated one is not better), it won't call the watcher |
| 23:23 | leifw | but I'm not sure |
| 23:23 | leifw | how would one do this in a perfect world? |
| 23:24 | leifw | or should I switch to refs? |
| 23:29 | jkkramer | leifw: re-sending from within an agent action is pretty common. you could use an atom as a simple toggle to stop the repeated sending |
| 23:29 | leifw | that's a nice idea, thanks |
| 23:29 | leifw | additionally: |
| 23:30 | leifw | it's pretty slow, but for whatever reason I can't load clojure.contrib.profile or trace, even though the jar is definitely on my classpath |
| 23:30 | leifw | even so, would a profiler work with agents that re-send that way? |
| 23:31 | leifw | What I'd like is something that counts function calls over a period of time as the thing runs so I know what to optimize (maybe with runtimes) |
| 23:31 | leifw | profile seems to just do one function call (and all subcalls), not a period-of-time sort of thing |
| 23:32 | leifw | and trace dumps all the functions called, doesn't aggregate |
| 23:32 | leifw | suggestions? |
| 23:33 | jkkramer | i haven't used c.c.profile or trace. visualvm (jvisualvm on os x) lets you do some fancy profiling |
| 23:36 | leifw | thanks, I'll look at it |
| 23:48 | amalloy | is there a more idiomatic way to do this? |
| 23:48 | amalloy | (if-let [x (seq (this-returns-a-set))] |
| 23:48 | amalloy | (do-stuff-with (set x))) |
| 23:48 | amalloy | my problem is that empty sets aren't false, and seqs constructed from sets aren't predicates |
| 23:50 | leifw | I'd probably do this, just to get clearer code: |
| 23:50 | leifw | (let [x (this-returns-a-set)] |
| 23:50 | leifw | (if (not (empty? x)) |
| 23:50 | leifw | (do-stuff-with x))) |
| 23:51 | amalloy | leifw: i guess that's not too bad (provided i use seq instead of not empty; that's an established style standard) |
| 23:51 | leifw | otherwise maybe write your own test function: (defn set-or-nil [x] (if (empty? x) nil x)) |
| 23:51 | leifw | oh I did not know that |
| 23:51 | leifw | ok |
| 23:52 | leifw | with that you could do (if-let [x (set-or-nil (this-returns-a-set))] (do-stuff-with x)) |
| 23:52 | leifw | I just don't like converting to a seq and back, that seems ugly (but maybe it is performant and I'm just being silly) |
| 23:53 | amalloy | http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/empty? |
| 23:53 | leifw | fair enough, thanks |
| 23:54 | amalloy | i guess seq is slightly better. empty? is implemented as (not (seq coll)) |
| 23:54 | amalloy | so you're effectively calling (not (not (seq coll))) |
| 23:56 | leifw | sounds correct |
| 23:56 | amalloy | set-or-nil is cute, though. i may use that |
| 23:56 | leifw | I guess seq is lazy so it's not a bad hit |
| 23:58 | jkkramer | ,(when-let [x (not-empty #{1 2 3})] (map inc x)) |
| 23:58 | clojurebot | (2 3 4) |
| 23:58 | jkkramer | ,(when-let [x (not-empty #{})] (map inc x)) |
| 23:58 | clojurebot | nil |
| 23:58 | amalloy | jkkramer: still not a set object |
| 23:58 | amalloy | ,(doc not-empty) ; or is it? |
| 23:58 | clojurebot | "([coll]); If coll is empty, returns nil, else coll" |
| 23:58 | jkkramer | amalloy: what's not a set object? |
| 23:59 | amalloy | jkkramer: sorry, you confused me with the map - clojurebot's output was a seq |
| 23:59 | jkkramer | ,(when-let [x (not-empty #{1 2 3})] (disj x 2)) |
| 23:59 | clojurebot | #{1 3} |
| 23:59 | amalloy | yes, thanks, that's perfect |