#clojure logs

2010-10-18

00:00cemerickDo you see a reason why namespaced keywords are privileged?
00:00cemerickOr, perhaps, discriminated against? :-P
00:00chouserand the inverse of symbol is str
00:01chouserbut there is no inverse of keyword
00:02cemerickIt may be that (keyword ":user/foo") should => :user/foo
00:02chouseror ... something. I'm tired too, and about to do something about it.
00:02cemericke.g. no one but no one is going to put a : in a namespace.
00:16clojurebotAlice heard the Rabbit coming. He quietly remains (in his proper place) indifferent.
00:26LauJensenGood morning all
00:34yayitsweimorning!
00:35LauJensenyayitswei: Did you ever get your cake question answered?
00:36yayitsweiwhich one? I had a bunch of them :)
00:36yayitsweithough, I think I eventually got all of them answered
00:37LauJensenok, cool. It was about threaded about from an app
00:47cemerickThe last paragraph here is a decent observation: http://sayspy.blogspot.com/2010/10/my-thoughts-on-clojure.html
00:49yayitsweiLauJensen: thanks
00:50LauJensencemerick: O_o ?
00:50LauJensenTo me that seems like the opposite of reality
00:50cemerickoh?
00:51yayitsweijust read the article; I agree about the cryptic error messages
00:51cemerickyeah, that's an impl detail
00:51cemerickmuch improved in 1.3.0-SNAPSHOT, AFAIK
01:09yayitsweicemerick: how so?
01:10cemerickI 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:00notsonerdysunnyif 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:09amalloy,`x
02:09clojurebotsandbox/x
02:09notsonerdysunnyamalloy: I just discovered that it resolves to the one in which the macro was originally defined.
02:09amalloyright
02:09notsonerdysunnynot to the one where it was expanded
02:10amalloyyep
02:10notsonerdysunnythat is a nice behaviour
02:10amalloy,`(~'x)
02:10clojurebot(x)
02:10amalloyif you want it to use the one where it's expanded
02:10notsonerdysunnyoh nice thanks
02:10notsonerdysunnyI didn't know that
02:11amalloyit's basically the same as writing 'x
02:11amalloysince you're saying "quote this", and then "okay, unquote and evaluate 'x"
02:12amalloydid you get your mathematica thing working out satisfactorily?
02:12notsonerdysunnyI just got back to it.. I had to run for some personal.. stuff
02:12notsonerdysunnyI think I should be able to though
02:13notsonerdysunny:)
02:13amalloyk, sounds good
02:13notsonerdysunnyactually I seem to have trouble with this macro thing ..
02:13clojurebotThe rhinoceros, who finds no place on what is flimsy, dwells with the enduring and unchanging Tao.
02:14notsonerdysunnyclojuratica 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:28LauJensen(require [clojuratica :exclude [intern]])
02:30zakwilsonWhere did unchecked-add go in 1.3?
02:31LauJensenzakwilson: I think its just 'add', since it doesnt do overflow checking, and add' does
02:32LauJensenor, + and +' rather
02:33zakwilsonOh, I found it: unchecked-add-int or unchecked-add-long
02:35LauJensenaha
02:42zakwilsonIt seems odd that + doesn't auto-promote now and +', the non-default is the one that does.
02:48LauJensenWell, + 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:49notsonerdysunny,::dssd
02:49clojurebot:sandbox/dssd
02:49notsonerdysunny,:dssd
02:49clojurebot:dssd
02:50notsonerdysunnywhich namespace does :dssd belong to..?
02:50notsonerdysunnycan I run functions to get their namespaces?
02:51notsonerdysunnycan I run functions on keywords to get their namespaces?
02:52notsonerdysunny,(pprint ::dssd)
02:52clojurebotjava.lang.Exception: Unable to resolve symbol: pprint in this context
02:52notsonerdysunny,(clojure.pprint/pprint ::dssd)
02:52clojurebot:sandbox/dssd
02:53amalloy_notsonerdysunny: :dssd is in the global namespace
02:54cemerickthere is no global namespace -- there is simply a lack of a namespace in :dssd
02:55zakwilsonI 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:55amalloy_cemerick: could you explain the difference?
02:57cemerickamalloy_: "global namespace" implies that an unnamed namespace exists, which isn't the case
02:58cemerickactually, "namespaced" keywords and symbols don't actually have a Namespace, just a string that indicates one
02:58cemerick(class (namespace ::foo))
02:58cemerick,(class (namespace ::foo))
02:58clojurebotjava.lang.String
02:59cemerickjust to be pedantic:
02:59cemerick,(find-ns 'blah42)
02:59clojurebotnil
02:59cemerick(namespace :blah42/foo)
02:59cemerick,(namespace :blah42/foo)
02:59clojurebot"blah42"
02:59cemerick,(find-ns 'blah42)
02:59clojurebotnil
03:00cemerickonly create-ns (and its callers, like ns) can bring a Namespace into existence
03:02zakwilsonThe 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:03cemerickwhich library?
03:03amalloy_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:04zakwilsonNot sure. Part of Ring or Compojure, I think.
03:05cemerickamalloy_: Well, there is no namespace <nil>. Saying that there is doesn't clarify anything. But: what conflict are you talking about regardless?
03:06amalloyhm
03:07amalloyi guess what i'm talking about is mostly nonsense, except maybe in the case of keywords
03:08cemerickamalloy: when can keywords conflict?
03:08cemerick(I'm not even sure what a "conflict" would imply w.r.t. keywords or symbols. *shrug*)
03:08amalloyyeah, i think i'm not sure either
03:09raekClojure 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:09raekjust nitpicking...
03:09cemerickSymbols and keywords are really just interned strings that have special semantics and operations.
03:10cemerickBoth of them being decidedly *not* like their namesakes from CL, for what that's worth.
03:11LauJensencemerick: Didnt know you have a history with CL?
03:11cemerickLauJensen: Just a bit. Long time ago. I hardly remember a thing.
03:11LauJensenk
03:12cemerickSort of like my relationship with C++, or Oracle.
03:15LauJensenWould actually be nice to do a little C, just as a refresher
03:15LauJensenI think Ive gotten a little spoiled by Clojure
03:16cemerickI 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:17cemerickOh, 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:18LauJensenhehe. It sounds like the kind of thing you'd do in bash
03:19cemericknot so useful on windows, for displaying a splash screen before the JVM is ready to go yet, etc.
03:19cemerickugh, that was a horrible project
03:19LauJensentrue
03:19cemerickJava 1.2, I think.
03:21LauJensenCliff 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:45notsonerdysunny,`(list a b)
03:45clojurebot(clojure.core/list sandbox/a sandbox/b)
03:46notsonerdysunny,`(a b)
03:46clojurebot(sandbox/a sandbox/b)
03:53notsonerdysunnyI need to quote the sexp .. when I macroexpand from the repl.. I need to remember that .. :(
03:53notsonerdysunny:)
04:13clojurebotAlice could not see anything that looked like the wind. In a time of war, it was just her right hand.
04:17Adamantclojurebot: one pill to make her taller, and one pill to make her small
04:18Adamantclojurebot: and the ones that, mother gives here, don't do anything, at all
04:18Adamant*her
04:18kryftAdamant: Is the punctuation really like that in the original?
04:19Adamantkryft: I think it is for the Grace Slick song
04:20Adamanttrying to imitate that, anyway
05:12ossarehany thoughts on why I'd be getting: "java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn"
05:12ossarehI've a map with a key in it which maps to a boolean and I'm doing (if (map :key) "x" "y")
05:12ossareh^ symbol is not `map`
05:30ossarehd'oh
05:30ossarehmy mistake - sorry for the noise.
06:03AWizzArdDoes 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:04AWizzArdah okay, got it: (reify java.awt.event.ActionListener (^void actionPerformed [^java.awt.event.ActionListener this, ^java.awt.event.ActionEvent e]))
06:11LauJensenGlad we could help
06:15clojurebotThe Tao is the same as "I sleep when I breathe!" It is a very curious sensation--she was beginning to grow larger again.
06:17LauJensenhiredman: Would be great if you could remind your singularity that this is not a philosophy channel :)
06:19jlaskowskiHi
06:19LauJensenhi
06:19jlaskowskihow to split a string into substring separated by \space?
06:19jlaskowski(def s "Jacek Laskowski likes Clojure")
06:19jlaskowskiand have it in a seq
06:20jlaskowski'("Jacek" "Laskowski" "likes" "Clojure")?
06:20LauJensen(.split s " ")
06:20jlaskowskihuh? is this that simple?! :)
06:20LauJensenWell, yea. Thats a java call which returns an array, you can use that like a seq
06:21LauJensen,(seq (.split "everybody like Clojure..almost" " "))
06:21clojurebot("everybody" "like" "Clojure..almost")
06:21jlaskowskiright
06:21jlaskowskiawesome
06:21jlaskowskithanks
06:21LauJensennp
06:32esjanother happy customer :)
07:21edoloughlin_Hi, I'm seeing strange behaviour in my program that I can't replicate in the REPL (I'm very much a noob):
07:21edoloughlin_I can define and print map values ok in the REPL:
07:21edoloughlin_ user=> (def details {:email "ed" :password "pass"})
07:21edoloughlin_ #'user/details
07:21edoloughlin_ user=> (println "LOGIN: email=" (details :email) ", password=" (details :password))
07:21edoloughlin_ LOGIN: email= ed , password= pass
07:21edoloughlin_ nil
07:21edoloughlin_I'm passing the same map to a fn in my program:
07:21edoloughlin_ (defn login [details]
07:21edoloughlin_ (println "details: " details)
07:21edoloughlin_ (println "LOGIN: email=" (details :email) ", password=" (details :password))
07:21edoloughlin_This prints:
07:21edoloughlin_ details: {email ed@here.com, password pass}
07:21edoloughlin_ LOGIN: email= nil , password= nil
07:21edoloughlin_Why am I getting nils?
07:27jarpiainif it really prints "{email ed@here.com ..." the map you passed has the symbol 'email as key instead of the keyword :email
07:28edoloughlin_Oh. I didn't get the distinction. Thanks.
07:31edoloughlin_Still no luck:
07:31edoloughlin_ (println "LOGIN: email=" (details 'email) ", password=" (details 'password)
07:31edoloughlin_prints:
07:31edoloughlin_ LOGIN: email= nil , password= nil
07:32edoloughlin_(details "email") works, though.
07:32Chousukeah, so the keys are strings
07:33Chousukestrings print without quotes, so they look like symbols
07:33edoloughlin_They're coming in via compojure/ring
07:51@rhickeywhat's the git fu for determining if the repo you are looking at contains a particular object?
08:16clojurebot"Found it", said the Mouse in a voice of thunder. "I know that well enough?" said the King. People began running the kingdom.
08:20chouserrhickey: you can list all branches that contain a commit by: git branch --contains <SHA1>
08:21@rhickeychouser: thanks, but that's backwards from what I want
08:23chouseryou have a commit and a branch and you just want true/false?
08:28@rhickeyYes, I am sitting a a repo at some rev and want a t/f for (contains sha)
08:28@rhickeyI don't see why it would involve branches
08:28@rhickeybasically I want to query the current database
08:28@rhickeytree whatever
08:28chouseryeah, like walk the log from where you are back through all parentage looking for one commit
08:28chousershould be easy. :-)
08:30tobiasraederhey everybody :)
08:31chouserrhickey: I guess you could: git log --pretty=oneline | grep <sha>
08:32@rhickeychouser: that seems to not leverage an index that must be present
08:32chouserperhaps: git log <sha>..HEAD -- but I'm not sure there's anything faster than walking the parentage from the current commit back.
08:34jarpiaingit cat-file -t <sha> seems to be the low-level command
08:35chouserjarpiain: 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:42Chousukegit branch --contains <sha>?
08:44chouseroh dear. I just created a branch named HEAD
08:44Chousukehah
08:45chouserChousuke: 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:45Chousukeyeah
09:03@rhickeyhow do people feel about 'unchecked' ns for unchecked math ops, vs unchecked-* ?
09:05ChousukeSounds like a good idea to me.
09:05Chousukepotentially less typing, too :)
09:08chouserI like it
09:11RaynesI like it. I like it a lot.
09:15edoloughlinCan anyone tell me what I'm doing wrong here? I just want to return a map…
09:15edoloughlin user=> (defn invalid-login []
09:15edoloughlin ({:text "invalid login"
09:15edoloughlin :code "invalid login"}))
09:15edoloughlin #'user/invalid-login
09:15edoloughlin user=> (invalid-login)
09:15edoloughlin java.lang.IllegalArgumentException: Wrong number of args (0) passed to: PersistentArrayMap (NO_SOURCE_FILE:0)
09:15edoloughlin user=>
09:16chouseredoloughlin: please use a paste site for more than 1 or 2 lines
09:16edoloughlinOk. Apologies
09:16chouseredoloughlin: why do you have parens around your literal map {:text ...} ?
09:17edoloughlinI had a println in the fn just before the map but removed it for posting. it was ((println "something) {:text "etc"})
09:18RaynesI think you're aiming for (defn invalid-login [] (println "something") {:text "etc"})
09:18edoloughlinOk. Silly parens error. Sorry for wasting everyones' time
09:19RaynesIt's what we're here for. <3
09:19chouseredoloughlin: not a waste
09:20chouseredoloughlin: I trust it was a valuable investment that will one day generate generous returns.
09:20edoloughlinHopefully. It's quite the long learning curve...
09:21Rayneschouser: "generate generous" was fun to say. Thank you.
09:21chouserheh
09:22chouserthere's still no way to generate a Java class with a static main method without AOT compiling, right?
09:23@rhickeychouser: how would you find it without AOT?
09:23chouserheh. ok, good point.
09:23chouserI'm trying to bend clojure-maven-plugin to my will, and mostly the bending is going the other way
09:24esjchouser: resistance is futile...
09:26@rhickeyso, 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@rhickeyI've seen the overhead of the check disappear sometimes, but not always
09:29chouserdefaulting implicit coercions to unchecked in all cases doesn't seem like a good idea
09:30@rhickeyarray bounds checking will cover a lot of errors, but not all, should the array indexes not be checked by default
09:31chouseras in when the too-large long wraps to land back within the valid array index range?
09:31@rhickeyright
09:32chouserlanguage design is hard!
09:33RaynesThat's why everybody does it.
09:58@rhickeyI wonder how real the long-used-as-index--accidentally-outside-range-of-int case is
09:59chouseryou'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@rhickeyI 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@rhickeychouser: 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@rhickeyI guess we could have agets in unchecked too
10:06@rhickeybut that's only one case of implicit coercion
10:07@rhickeythe problem is we now get a lot of these due to default of long
10:09@rhickeymost of the time the chip-level instruction parallelism makes the overhead disappear, unless your work is really small, like access array and add
10:13clojurebot"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:20RaynesMorning _fogus_.
10:20_fogus_Raynes: Hello sir.
10:24OnceAnyone 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:25esjincase anybody hasn't seen it: #5 in HN is Clojure related.
10:26esjbut am saddened by the poor quality of the argument.
10:30iveyPeople who've never used a REPL-driven language don't understand.
10:30iveyIt's such a strange concept until you do it.
10:41RaynesOnce: It's relevant to note that there are some parsers available for XML and HTML. See clojure.xml and clj-tagsoup.
10:43OnceRaynes: 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:50Raynesesj: You haven't really 'arrived' as a language unless people are bitching about you on a daily basis.
10:51esjRaynes: Oh dear, I must be hurting Clojure by raving about it on daily basis. Should I stop ? :P
10:51RaynesPeople who don't use the language are the most important.
10:51RaynesIf people who actually use the language are bitching about it, you might have real problems.
11:03defnheh -- woops
11:03defnapparently we didn't have to work today -- all alone at the office :(
11:04defnchouser: have you been thinking at all about your datalog awesomeness?
11:04chouser:-)
11:04chousertalking about it at work at this very moment
11:05Rayneschouser: Don't you have an option parser in contrib?
11:05RaynesI can't remember what the namespace is.
11:05chouserRaynes: command-line I think
11:06RaynesThanks.
11:06RaynesBoy, 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:06defnhahahaha
11:07defnIf Nathan Marz is around you could maybe shove some off on him as well
11:07_fogus_ooooo, good point!
11:07defnafter you say it make sure to point menacingly and say: Take /that/!
11:08defn...or something...
11:08chouserNathan Marz won't be at the conj, unfortunately.
11:08defnaw bummer I thought he said he would be
11:08tridd3llchouser: 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:08chouseroh, well, I may be confused but I thought he said he wouldn't.
11:08chousertridd3ll: thanks!
11:08defnchouser: my head is still spinning a little from the loop
11:08Raynestridd3ll: They'll be videographed.
11:09chouserI missed a lot of talks I probably would have enjoyed.
11:09defni have a notebook with ideas in it that just grew by about 8 pages
11:09tridd3llRaynes: I think infoq will be releasing some as time goes on
11:09defnchouser: yeah same here -- would have liked to see more more nosql stuff
11:10defnand scala stuff
11:11tridd3llI also thought it was great when Guy Steele recommended "clojure" as the language to learn at the future programming languages round table.
11:11RaynesHe did?
11:11RaynesOh boy.
11:11defni think part of it is that he didnt want to say "fortress"
11:12chouser"clojure and haskell"
11:12tridd3llright, the question was more about which language might open your mind about others, etc.
11:12defni think the other thing is: it is sort of obvious for G. Steele to recommend the lisp with the zeitgeist
11:13tridd3llbut still, it was cool
11:13defnagreed -- i was about to yell "amen!"
11:13dpritchett[Meanwhile, inside Steele's head] "don't say fortress, don't say fortress, don't say fortress"
11:13defnbut hillary mason was next to me and I was trying to be cool
11:19notsonerdysunnyis there a way to find-out how many elements in a lazysequence have already been calculated..
11:19notsonerdysunnyJust out of curiosity .. I don't know if it will be usefull...
11:20defn(take 4 lazyseq)
11:20defn;)
11:20notsonerdysunnydefn: I know how to use a lazyseq ..
11:21defnnotsonerdysunny: i was joking mostly because when you (take x mylazysequence), x is how many are calculated i believe
11:21notsonerdysunnybut it caches the values it has already calculated.. due to previous accesses..
11:21chousernotsonerdysunny: I came up with a thing that sorta works. let me see if I can find it.
11:21defnoh i see what you're saying
11:23defnRaynes: I'll look into cake-search :D
11:24chousershoot, I have no idea where I put it.
11:24Raynesdefn: 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:24Raynesdefn: We're tagging issues with contributor names now so that we don't work on the same things.
11:25defnRaynes: let's work on it together -- you have more experience building a plugin for cake, would be nice to piggyback
11:25Raynesdefn: 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:25defn./join #cake.clj
11:26chousernotsonerdysunny: http://gist.github.com/589694
11:27iveyRaynes & defn: What's the difference between cake and lein?
11:27Raynesivey: http://stackoverflow.com/questions/3906276/whats-the-difference-between-cake-and-leiningen
11:27notsonerdysunnychouser: Thanks.. I will read through your code ....
11:27iveyheh
11:27iveythanks
11:27Raynesivey: Read lancepantz answer.
11:28chousernotsonerdysunny: you should be able to just use it as demonstrated toward the end of that gist
11:29FUserok
11:30FUserso how would I go about making a mechanism that waits in a separate thread for some value to change
11:30FUserI've tried (future #(while (= @atom false)))
11:30FUserbut that burns CPU way too much
11:31chouserew
11:31chouseryeah
11:31chouseruse a watcher
11:31FUserI can put in a delay
11:31FUserbut I'd rather have something that blocks
11:33FUserin the same line of questions
11:33FUserhow do you have variables that are not thread local yet not global
11:33FUseris that even possible?
11:33FUsercoming from java, I find the scope in clojure confusing
11:34FUserI end up making everything global or in a let
11:34FUsersometimes I desire a third option
11:34chouserglobal is still namespaced
11:34chouserso that's roughly like a class static scope
11:35FUserok
11:35FUserso def is namespaced?
11:35chouseryep
11:35FUserwell but it can be reached via require
11:36FUserso it's not actually namespace scope
11:36chouserwhat?
11:36clojurebotwhat is exceptions
11:36FUser:)
11:37FUserisn't it?
11:37defn(require foo [bar :as myns])
11:38FUserthe way I see it, def is like public in java?
11:38FUserscopewise
11:38chouserlike a public static, yes. but you can also ask for it to be private it you'd like.
11:38chouser(def ^:private foo "Foo")
11:39FUserwhat's the scope in that case
11:39chouseryour current namespace
11:39KruppeFUser: never seen by other namespaces i think
11:39KruppeFUser: there is also defn- if i remember correctly
11:40FUserok
11:40sandGorgoni 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:40FUserany shorthand for that private?
11:40FUserdefn- is for functions
11:40KruppeFUser: the def private? i don't think so
11:40FUseri'll make a macro then :P
11:41KruppeFUser: sure thing! good ol lisp
11:41chouserthere's a defvar- in contrib I think, but ^:private is hardly overwhelming.
11:41Kruppechouser: yeah its pretty minor
11:41FUserI always screw up the carot
11:41FUsertried typing it now
11:41FUser$&private came out
11:41FUser:D
11:42FUserI must use # in front for it to work
11:42KruppeFUser: hehe, I use vim keybindings (in emacs, i know pretty crazy) so im used to typeing carrot
11:42Kruppes/typeing/typing/
11:42sexpbot<Kruppe> FUser: hehe, I use vim keybindings (in emacs, i know pretty crazy) so im used to typing carrot
11:43FUserso now you have a substitution bot lol
11:43FUsers/o/a/
11:43sexpbot<FUser> sa naw yau have a substitutian bat lal
11:43sandGorgonguys.. some help pls
11:43FUsersouthern accent there
11:43FUser:P
11:44notsonerdysunnysandGorgon: you want nested namespaces?
11:44FUsermuch like in java, namespace names dont concatenate
11:44jarpiainsandGorgon: namespaces aren't hierarchical like that but once you've loaded name2 with require, you can use name2/func3 from everywhere
11:45notsonerdysunnyyou can do something like name1.name2/func3
11:45sandGorgonnotsonerdysunny, ok lemme try that
11:45sandGorgondidnt know about that
11:46Kruppenotsonerdysunny: that works? interesting
11:46notsonerdysunnyyou need to have declared the namespace like (ns name1.name2) to be able to do what I said..
11:46notsonerdysunnynot just (ns name2)
11:46Kruppenotsonerdysunny: oh ok.
11:49sandGorgonnotsonerdysunny, could you repeat that ? so if I required a namespace ns1 and ns1 requires ns2, can I refer to ns1.ns2/func ?
11:49dpritchettdoes anyone know where the cake gem installs its executable? my `which cake` is running the coffeescript makefile tool
11:50Kruppedpritchett: mine is in /usr/bin
11:50Kruppedpritchett: but i wrote my own ebuild for it so...
11:50Kruppedpritchett: that might not help you
11:50dpritchettthanks
11:51Kruppedpritchett: could always fall back to cd / && sudo find -name "cake"
11:51cemerickrhickey: 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:51cemerick(doesn't seem significant enough for a patch, but whatever)
11:51dpritchettit failed too but at least it's the right cake :)
11:52Kruppedpritchett: which failed? find?
11:52@rhickeycemerick: in order to ignore them?
11:52dpritchettno, cake failed with this error http://github.com/ninjudd/cake/issues#issue/45
11:52Kruppedpritchett: oh
11:52Kruppedpritchett: but you found it! good
11:52dpritchettyep, thanks
11:53Kruppedpritchett: np
11:55cemerickrhickey: 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:55cemerickThere's read-string, but that seems like a nuclear option, and string munging, which seems silly.
11:55defndpritchett: 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@rhickeycemerick: patch welcome
11:55cemericknifty; on its way
11:57FUseris this supposed to fail in repl? (ns something) (require 'user)
11:57chouseryeah, require wants an actual file on disk to load, a .clj or .class file
11:58cemerickhrm; 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:59notsonerdysunnysandGorgon: ns1 requires ns2 does not mean they have a nested relation ship...
11:59@rhickeycemerick: doesn't make sense for 2 arg version
11:59sandGorgonnotsonerdysunny, ok.. gotcha. It would just have been convenient to refer to namespaces that way
12:01FUserthx
12:01dpritchettsweet
12:01FUserwhat's this cake stuff I keep hearing about
12:01dpritchettI just downloaded cake from github and then commented out the require io/wait line and now it's working
12:02arbschtwhat was the rationale for disallowing repeating colon characters in symbol names? to prevent a/::b being read, or something?
12:04dpritchettFUser: http://stackoverflow.com/questions/3906276/whats-the-difference-between-cake-and-leiningen
12:04FUserawesome, now what's leiningen :P
12:05defnwhile out to lunch i think i fielded that question a half-dozen times
12:05defn(at strangeloop i mean)
12:05@rhickeyhow did the Clojure folks do at StrangeLoop ?
12:06FUserI've read it]
12:06FUserinteresting
12:06chouserrhickey: better than the perl people
12:06dpritchettman I wish I could've made strangeloop
12:06dpritchettIt's only a half day's drive for me too
12:06@rhickeychouser: how so?
12:06defnheh, the programming languages panel beat up on Perl 6 pretty heavily
12:07defnken sipe was the instigator if memory serves correctly
12:07chouserrhickey: 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:07chouserclojure at least gets respect
12:07FUserI've only done a single perl app over 500 lines of code. Never forget 11/27.
12:07defni noticed some growth in clojure-related talks by the end of the conference -- not sure if you noticed that as well chouser
12:08chouserdefn: no, I didn't. The cascalog talk was fantastic, but I thought there were fewer there than at some earlier ones.
12:09chouserI think all the clojure speakers performed well, as in people were generally complimentary of the presentations themselves.
12:09defnthe two talks you missed had a really interesting mix of people
12:10cemerickarbscht: there's a large gulf between what the reader allows and what the symbol fn allows
12:10defni think a lot of the folks at the conference wanted "clojure for noobs"
12:11tridd3llI think I made every clojure talk and was impressed by each.
12:11defntridd3ll: did we meet
12:11defn?
12:11chouserdefn: I heard that's what "ninja" was -- maybe people didn't know?
12:11defnchouser: i sort of just went on the assumption that ninja meant advanced... *shoulda read the description*
12:12defnalthough jim's conduit had a lot of advanced stuff so it made up for it
12:12tridd3lldefn: not sure.... don't think so, I also had a client issue which was taking up some of my extra time
12:12tridd3llbetween talks
12:12@rhickeyWow, 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:13hiredmanhttp://github.com/hiredman/conduit-irc
12:13chouserrhickey: wow, that's fantastic.
12:13hiredmanwhenever I get around to rewriting clojurebot I think it will be on top of conduit
12:13cemerick:-D
12:13@rhickeyalso daunted by the job of implementing it all, still capturing design ideas
12:13defnhiredman: hiredman: yeah, jim mentioned your hornet queue was it?
12:13cemerickrhickey: multimethod dispatch fn updating?
12:14@rhickeycemerick: I haven't even thought about that, but there were already things in protocols that could help multimethods
12:14@rhickeycemerick: the fundamental barrier to large multimethod improvements is the opacity of the dispatch function
12:14cemerickRight; I just happen to feel the pain of that one frequently.
12:15hiredmandefn: I copied and pasted from jim's rabbitmq transport and massaged it until I got it talking to hornetq
12:15tridd3lldefn: I was the one who asked about the various conduit implementations when he mentioned hireman
12:15defntridd3ll: ah-ha! it's all coming together now. I know what you look like, but that's about it. :)
12:15arbschtcemerick: 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@rhickeycemerick: I don't see MMs getting call site caching any time soon
12:16defntridd3ll: I was the jerk who asked about recur and if they were using it in production :X
12:16technomancydefn: what did he say, "that's classified"? =)
12:17tridd3lldefn: :-) remember that... I'm bad with faces though so I can't remember what you look like
12:17defnhaha no, i just noticed a few functions where they were using recur to consume messages (i think thats how it was being used)
12:17hiredman"it's on the classpath, I mean that's classified"
12:17defnand was curious if, at scale, that caused any problems
12:17clojurebot"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:17defnhiredman: haha nice :)
12:17@rhickeycemerick: what is the use case for updating the dispatch fn?
12:18cemerickarbscht: 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:18cemerickrhickey: Hrm...change dispatch fn (and methods as well, probably), reload file.
12:18@rhickey_fogus_: yes, already implemented that
12:19cemerickCall multimethod, strange things happen.
12:19arbschtcemerick: 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:20tridd3llchouser: 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:21cemerickarbscht: I sit corrected. No idea on the motivation there.
12:21@rhickeycemerick: yes, well, not getting on the agenda right now
12:21cemerickrhickey: OK. Thanks for killing the auto-dynamic @ release-time, BTW. :-)
12:22@rhickeycemerick: 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:24esjhiredman: do you know if any of the vids are up ? I'd be really keen to watch Jim's talk.
12:24@rhickeydeclare-dynamic et al
12:24hiredmanesj: I wasn't there, so I would also be interested, but I don't know
12:25@rhickeyMetadata on code and its interaction with macros has proven quite useful
12:25esjhiredman: Tnx. i'll let you know if I find em then.
12:25hugod,(clojure.string/join "," nil)
12:25clojurebotjava.lang.ClassNotFoundException: clojure.string
12:27hugod->(clojure.string/join "," nil)
12:27sexpbot⟹ ""
12:27hugodIs that expected? ^^^
12:30djpowellhmm, any people intimate with pprint here?
12:33djpowellpprint seems to use an adventurous mix of ref-set and io
12:33djpowellit is behaving a bit strangely on clojure-clr
12:45dpritchettdjpowell: 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:51djpowellI haven't tried it too hard, I just tried the 1.2 binary recently. Seems pretty good. Slower than the Java version.
12:52djpowellI 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:52djpowellIt 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:03RaynesGo PG!
13:04Chousuke:)
13:04amalloy,(clojure.string/join nil ",")
13:04clojurebot","
13:05esjnow that _IS_ good to hear
13:05amalloyoh misread, hugod. yes, your behavior is expected
13:05esjgiven that he is partially responsible for me getting all parenthised up
13:05amalloy(ie it's how every join implementation does it)
13:07AWizzArdrhickey: 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:09hugodamalloy: I expected nil myself
13:14gary_posterIf 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:14gary_posterCould I have done this nicely without lazy-seq? (Other suggestions for newbie welcome too.)
13:15amalloy,(seq "")
13:15clojurebotnil
13:15amalloyhugod: "" and nil look the same in a sequence context
13:18amalloygary_poster: (merge-seqs [1 2] [1 3]) doesn't work for me
13:18amalloyie it throws a NPE
13:19gary_posterhm. thanks for looking. It worked for my examples with lazy sequences locally; lemme mess around.
13:20amalloyalso if the sequences are ascending but not *strictly* ascending it will still produce dupes, right?
13:20amalloyeg [1 1 2] [1 4]
13:20gary_postertrue; that wasn't one of my use cases
13:21amalloyyou can fix that, and simplify your implementation, by replacing the first/rest business with drop-while
13:21amalloy,(doc drop-while)
13:21clojurebot"([pred coll]); Returns a lazy sequence of the items in coll starting from the first item for which (pred item) returns nil."
13:22amalloy,(map #(drop-while (fn [x] (> x val)) %) seqs)
13:22clojurebotjava.lang.Exception: Unable to resolve symbol: seqs in this context
13:23amalloy,(let [seqs [[1 5] [2 2 4]] val 1] (map #(drop-while (fn [x] (> x val)) %) seqs))
13:23clojurebot((1 5) ())
13:23amalloyoh, i guess i got it reversed. but something like that anyway
13:24gary_posterduped 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:24gary_poster's where I'd need to fix the bug. Trying to grok the drop-while now...
13:25gary_posteroh I got it
13:26gary_posteryeah, that's prettier, thank you
13:26gary_posterbut lazy-seq is still appropriate?
13:28FUsermap is already lazy?
13:29mabesFUser: yes
13:35amalloygary_poster: lazy-seq is fine, but i suspect your code would be clearer if you used iterate instead
13:35amalloyor...something like iterate? i haven't thought that through
13:37gary_posterah! OK, thank you, amalloy, will experiment with that. saw that it existed but did not think to give it a try for this. :-)
13:38amalloyyeah, it may or may not be applicable. it's weird because you're iterating over one sequence but returning a different sequence
13:39gary_posteryeah, can't quite figure out how to make it apply here
13:39amalloymaybe construct a data structure like [min [seq1 seq2 etc]], iterate over that, and map the result with first
13:39amalloybut that's not really clearer :P
13:39gary_poster:-)
13:40amalloyyou might look at http://rosettacode.org/wiki/Fibonacci_sequence#Clojure - it's really an eye-opener for this sort of thing sometimes
13:41gary_posterOh, I see what you mean
13:43gary_posterOK, 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:44gary_posterBTW, 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@rhickeyAWizzArd: you've already said that
13:48defnparty at stuart's house, eh?
13:50chousergary_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:51chouserconsuming those two seqs at different rates based on their content strongly indicates use of lazy-seq
13:52gary_posterchouser: ok, awesome. filed away. :-) thank you
13:53chouserthat of course may change as people build appropriate HOFs for multiple seqs. :-)
13:53gary_posterheh, of course :-)
14:03chouserhttp://news.ycombinator.com/item?id=1803627 -- "cool story" in comments on today's "Ask PG"
14:04_fogus_chouser: Instant classic
14:17clojurebotClay is fashioned into anything; vacant like a serpent.
14:19dpritchetti read that and shivered
14:21amalloyclojure has spoiled me. i'm now cringing as i write java code that looks like
14:21amalloyprivate static final Collection<String> myStringStuff = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList("str1", "str2")));
14:22dpritchettamalloy: 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:23dpritchettI 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:23amalloydpritchett: just three months for me
14:23amalloybut it's been like three years since i used java, too
14:24dpritchetti 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:25amalloyheh
14:26amalloyi 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:26amalloyso at least it's familiar to me
14:29amalloybut it's like meeting an old friend who's still working at mcdonalds ten years later. he's just not as cool anymore
14:31kryftamalloy: :D
14:31kryftamalloy: I love the analogy.
14:33amalloygrrr. my computer has stopped making noise when people use my name on irc
14:33amalloy...apparently because i unchecked that box. note to self, stop blaming the computer
14:34AWizzArdamalloy: when I was a kid people called programming errors "computer errors" back then :)
14:35amalloyAWizzArd: lots of people still treat computers as magic. i bet they call em computer errors
14:36AWizzArdIn principle I would say that computers can never make mistakes.
14:36kotarakOn a certain level they are computer errors. There are maybe particular subset like "software errors" or "hardware errors" which comprise "computer errors"
14:36AWizzArdYes okay, I can agree from a more global point of view.
14:37AWizzArdas in "Earth Error" or "Universe Error", or an error in the Matrix. (java.lang.MatrixException)
14:39kotarakAWizzArd: 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:39kotarakAWizzArd: An the endcustomer sees a warning lamp - a "car error".
14:39AWizzArdyes
14:41dpritchettyou could spin those errors as insufficient fault tolerance/detection and in the implementation
14:42dpritchettmy CHECK ENGINE light is pretty good at finding all kinds of weird "fix this before car explodes" issues
14:44kotarakdpritchett: 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:07serabehi
15:08serabeI'm having a problem with "."
15:09Raynesseancorfield: What is your problem?
15:09serabebeing 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:10serabebut if i do something like (def a (src-out)) (. g2 setComposite a) it works perfectly
15:10serabeany idea?
15:13amalloyserabe: that's a bit weird. does it work if you do (.setComposite g2 (src-out))?
15:14amalloyman, that is a silly question. it macroexpands into the same thing
15:14serabeamalloy: no, it doesn't work either
15:16jkkramerserabe: is it being used as part of a macro?
15:17serabeyes, but it doesn't work on the repl
15:17jkkrameris that the full line that you are typing/pasting into the repl?
15:18serabeyes
15:18serabejkkramer: i can make a gist with the repl session and the full macro if you want to
15:19jkkramerserabe: sure
15:20serabejkkramer: http://gist.github.com/632849
15:21lpetithello
15:22serabehi
15:22serabejkkramer: src-out is defined this way http://gist.github.com/632852
15:32jkkramerserabe: at a glance, i'm not sure what's wrong with it but generally that error shows up for incorrect unquote usage
15:32serabejkkramer: but it expands correctly
15:33FUserwhere could I find some open source clojure project to join?
15:33FUserI need to learn this by doing]
15:33jkkramerserabe: sorry, i don't have time to troubleshoot at the moment. you might get better help from the mailing list
15:34serabejkkramer, i'll do, thanks
15:34serabeFUser: if you like working with images you're welcome to join rinzelight!
15:36serabethe-kenny: ping!
15:36the-kennyserabe: pong
15:36serabethe-kenny: you are the one interested on rinzelight, aren't you?
15:37FUserwhy does the following code block my REPL
15:37FUser(let [p (promise)] (future @p))
15:38kotarakBecause it derefs the future to print it?
15:38FUserwell full code is like this
15:38the-kennyserabe: Yeah, you're right. Unfortunately, I didn't have time to take a deeper look at rinzelight.
15:38kotarakFUser: please use a paste
15:38kotarakpaste-bin
15:39serabethe-kenny: just wanted to let you know I'm already working on composition
15:39FUser(let [p (promise)] (future @p (println "something")) p)
15:39FUserso a let sentence that returns the promise
15:39FUserso you can later deliver on it
15:39kotarakFUser: then it probably derefs the promise to print it.
15:39FUserhm
15:39kotarakTry (def my-p (let ....))
15:40FUser(ok
15:40kotarakThen (deliver my-p "blub") or so
15:40FUserbut wouldn't that also deref to print the function result?
15:40FUserah
15:40the-kennyserabe: Oh, very cool :) Can't wait to see it.
15:41FUserok
15:41FUserhow do I get out of this mess :P I need to restart repl or somthing :
15:41FUserin clojurebox
15:41FUseremacs, slime
15:42the-kennyFUser: Try M-x slime-list-threads. I think I implemented killing of threads some months ago.
15:42the-kennyMaybe you can kill the right thread and your repl gets responsive again :)
15:42defnhowdy all
15:44sempahhello no clojure question, but maybe anyone knows it: what is the opposite of concatenation?
15:45sempahstring concatenation
15:45chousersplit
15:45chouserpartition
15:45sempahhmm
15:45tridd3lltokenize
15:45chousersubs
15:45sempahI need a nice "looking" word
15:45sempahtokenize seems to fit
15:45sempahthx :)
15:45kotarakuncat
15:47defnuncle
15:50FUserthe kenny
15:50FUserI used slime-restart-inferior-lisp
15:53the-kennyFUser: ah ok. I thought you wanted to make the repl responsive again without killing the underlaying clojure instance
16:00RaynesAfternoon.
16:00serabeafternoon!
16:01serabethe-kenny: composition is on github!
16:01serabethe-kenny: which other effects do you need?
16:02the-kennyserabe: I think they'll fit for now :) I don't need very fancy stuff
16:03serabethe-kenny: ok, if you need anything, just let me know!
16:03serabegood night then!
16:04the-kennysempah: good night :) And thanks for the quick implementation. I'm sure I'd have taken much longer
16:04sempahhm?
16:05sempahwhich implementation?
16:07the-kennyOf the composition
16:08sempahi didnt show it -.-
16:08sempahbut good night
16:13clojurebot"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:30rlbWill xml zip-filters (and lazy-xml) support pulling nodes out of very large xml files without pulling the whole doc into ram?
16:36bsteuberhi
16:37bsteuberwhere did the api for clojure.java namespaces go?
16:38raekis gone from clojure.github.com/clojure again?
16:38raekin the mean time, try clojuredocs.org
16:38RaynesGuys, stop nixing the clojure.java namespaces. :(
16:39defnis there any code out there already that converts <html></html> to [:html]
16:39defnlike a reverse hiccup?
16:39raekwellm there's enlive, but then you get {:tag :html, :attrs {}, :content (...)}
16:40defnyeah id like something simpler like hiccup
16:40defnhmm
16:40raekconverting between the two would be pretty simple
16:41bsteuberraek: thx, clojuredocs seems nice
16:42chouserclojure.xml/parse and clojure.contrib.lazy-xml/parse both generate the {:tag :html, :attrs {}} format
16:42chouserDunno if I've seen code to reduce that to [:html ...] hiccup format, but I can't imagine it'd be hard.
16:43raekwhat is the hiccup syntax for attributes? [:html {:foo "bar"} ...]?
16:43RaynesRight.
16:43defni think so yeah
16:43nickikthe other way around would be cool too
16:45defni want to allow people to build html templates using the hiccup syntax
16:45defnactually nvm i think i figured out my issue
16:45defnthanks for the help
16:47nickiki download some html5 templates but it would be better if they were hiccup syntax.
16:47defnthat's kind of what I was going for
16:47defna nice easy way to convert my HTML template to hiccup syntax so I could mold it
16:52mattmitchelli'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:52LauJensendefn: thats already possible though, with a hiccup/enlive combo
16:54defnLauJensen: im not sure i follow
16:54LauJensendefn: You want people to build templates with hiccup right? So let hiccup emits the html and pass it to an Enlive template?
16:55defntbqh im sort of mulling over a few ideas and am not sure what i want yet
16:55defnfor some reason i got stuck on the idea of being able to read in html as hiccup and write html from hiccup
16:56defnwhat you're saying makes perfect sense
16:58raekhttp://gist.github.com/633049 <-- I hacked together an enlive->hiccup and a hiccup->enlive function
16:59raekcan be handy to have, I thought
17:00raekI only tested this on some small examples
17:01defnraek: cool
17:01defnim thinking i may just deserialize the template file since it's just a clojure datastructure
17:02defneither way im saving that for later use just in case :)
17:06Rayneschouser: Where do your logs come from? (the ones on n0ise)
17:07kotarakFrom the channel? ;P
17:07chouserthe irssi client I'm typing in right now
17:07LauJensenIf hiccup still has that html fn which emits a string of html, hiccup>enlive should be (template (-> hicdata html htmlsnippet))
17:08chouserI know, it's all very duct-tape-and-baling wire
17:10mrBlissLet'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:12ChousukemrBliss: just Class
17:12ChousukemrBliss: I don't think you can specify it so far that the objects are class objects of a specific class.
17:12ChousukemrBliss: and at runtime it's all Objects anyway
17:14mrBlissChousuke: thanks. I was afraid it would the case
17:14Rayneschouser: Unless anybody is opposed, I also have sexpbot logging #clojure: http://acidrayne.net/logs/irc.freenode.net/clojure/
17:15chouserRaynes: that's excellent. does sexpbot do a better job of staying connected that this irssi does?
17:16RaynesProbably not. It will once raek finishes his automatic reconnect stuff in Irclj.
17:16chouserok
17:16RaynesNot that it drops frequently. Stuff can happen though.
17:16chouserI'd love to have a single process connect to the channel a writing out the .html the moment a post is made
17:17chouser...instead of every 15 minutes or whatever I'm doing now
17:22ohpauleezhey guys, I have a quick question
17:23ohpauleezI'm using a less-than-stellar patch to do a string split, limiting to one split, but the last possible split
17:23ohpauleezex:...
17:24ohpauleez"this:is:a:string" => ["this:is:a" "string]
17:24ohpauleezright 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:25ohpauleezand suugestions?
17:25ohpauleezs/and/any
17:25kotaraklastIndexOf and subs?
17:26ohpauleezlet me try on the repl, I didn't even think to use java string stuff yet
17:26ohpauleezI like that idea though kotarak
17:26rlbShould (xml-> (xml-zip (parse-trim file)) :foo :bar text) avoid pulling all of file into RAM at once?
17:26rlb(So far it doesn't seem to...)
17:27kotarak,(let [pos (.lastIndexOf "this:is:a:string" ":")] [(subs "this:is:a:string" 0 pos) (subs "this:is:a:string" pos)])
17:27clojurebot["this:is:a" ":string"]
17:27kotarakalmost...
17:28ohpauleezyeah, I just starting toying, I added a inc in there
17:30@rhickeyso, a few things came up in the full-time direct binding of non-dynamic vars
17:30@rhickeyone 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@rhickeythe 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@rhickeythe latter only came up in some hacky tests
17:32@rhickeythe 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@rhickeyand the (let [afn afn] ... (afn ...)) hack is now a counter optimization - the cache is better
17:37hiredmanexcellent
17:38ohpauleezpretty sweet indeed
17:39@rhickeyso 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:39hiredman:/
17:39@rhickeywas an exception
17:39Chousukewhat happen if you store the unbound and then define fred?
17:39Chousukehappens*
17:39hiredmancould the cache through an exception if it caches an unbound?
17:40@rhickeyChousuke: what does that mean?
17:40@rhickeyhiredman: no, because that can happen legitimately
17:40Chousukerhickey: I mean, if you store the unbound and try to use it somehow later after it's been bound.
17:41@rhickeyChousuke: I don't understand that
17:42@rhickeyhiredman: you might have access to a currently unbound var in a not-called path - it will still be in the cache set
17:42hiredmanso it's like unitialized variables in java, the unitialized value of vars is an Unbound object
17:43Chousukeeg. if you do (let [x (baz)] (defn fred [] 5) (x)) given the above, what happens?
17:43@rhickeyhiredman: no, you'll still get an exception if you deref
17:43hiredmanwait, what?
17:44hiredmanI thought that was what you got when you deref'ed
17:45hiredmanfred ~= (deref (resolve 'fred)) ; but in the fred case resolution happens at compile time
17:45@rhickeya 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@rhickeyresolution is as it always was
17:46hiredmanok
17:46@rhickeybut the meaning of a var used in a fn is fixed at its entry point
17:47@rhickeyI 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@rhickeywouldn't
17:48hiredmanok
17:49@rhickeythe overwhelming majority of references to unbounds are programming time mistakes, not worth incurring runtime overhead on every fn call
17:50@rhickeymost common will be calls to unbound fns, still thinking about how to make that error better
17:51rlbAnswer: perhaps a known issue http://groups.google.com/group/clojure/browse_thread/thread/365ca7aaaf8d55b7?pli=1parse
17:52rlbThough I'd just assumed the use of parse-trim would fix that.
17:52rlbSomethings obviously holding on to memory.
17:54@rhickeythis is better:
17:54@rhickey(declare fred)
17:54@rhickey(defn baz [] (fred))
17:54@rhickey(baz)
17:54@rhickeyIllegalStateException Attempting to call unbound fn: #'user/fred clojure.lang.Var$Unbound.throwArity (Var.java:43)
17:58ohpauleezhaha
18:00lpetitrhickey: 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@rhickeylpetit: declaring fred is used to resolve fred, this is just about the values
18:01lpetitrhickey: 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@rhickeywe could always have auto-declared fred
18:03@rhickeybut a typo would auto-create the var ferd
18:03AWizzArdI prefer being explicit about it, as this catches at least some potential bugs.
18:03lpetitthere 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:04lpetitsay i have vars bar and baz declared. A typo could make me use bar instead of baz ...
18:04AWizzArdyes, also for numbers, but we should not give up on this - the compiler can actually help here
18:05lpetitwill not help with bar baz ^^^^
18:05AWizzArdAlthough those are not the examples that fit reality most ;)
18:05AWizzArd(wiht-open ...)
18:07lpetitI'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:07AWizzArdUnfortunately this is a problem with all literals.
18:07AWizzArdnumbers, strings, keywords, etc.
18:08lpetitAnd 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:08lpetits/java users/java ruby python perl php scheme etc users/
18:08sexpbot<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:10lpetitBut ok, I acknowledge it's unrelated to the enhancement under examination
18:10defngiven 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:11defnlike 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:14lpetitrhickey: another "topic of the day" = what's your position w/r the "require namespace implictly" buzz in clojure-dev ml ?
18:16defnlpetit: 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:17defnthat seems to be a bigger paint point than the whole "write it top-down" thing, imo.
18:17defns/paint/pain
18:17@rhickeylpetit: I'm not in favor
18:19@rhickeylpetit: the analogy to Java is quite broken, as that is a language with compilation units, and Clojure/Lisp is not
18:19lpetitdefn: 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:19defnhow do i get on the clojure dev ml?
18:20defnlpetit: i think maybe what i need is a better expand/collapse mechanism in my editor
18:20lpetitrhickey: sorry for being so perversed by java :-/ . But not only java does this, even in the "dynamic languages camp", right ?
18:21@rhickeylpetit: right, but Clojure and Lisp are not file oriented
18:21lpetitdefn: expand/collapse will never replace carefully hand-made fns placements. Currently, my choice is limited.
18:21Raynesdefn: Do you have a CA accepted? If so, just sign up and someone will add you.
18:22defnCA?
18:22clojurebotCA is Contributor Agreement: http://clojure.org/contributing
18:22defnah, yes I do have one of those
18:22defnI think I just need to be invited.
18:23lpetitrhickey: 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@rhickeyalright, brave new world - http://github.com/clojure/clojure/commits/master
18:24lpetityepee !
18:24@rhickeylpetit: CL lets you compile against undeclared things, but has a gigantic problem with symbol interning
18:26lpetitrhickey: 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@rhickeylpetit: the latter, and a cleanliness issue, so typos don't pollute the ns
18:28lpetit(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:29dnolenrhickey: so is there no longer a need to define a fn as :static?
18:29lpetitrhickey: ok, I thing I'll continue to live with that :)
18:29lpetit(as if I had choice ;-) )
18:30lpetitdnolen: yes, these commits seem to be :static killers (for the greater good)
18:31defnwho do I contact to get invited to the clojure dev ml?
18:31ohpauleezI 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:31AWizzArdoh good, I will try this out tomorrow
18:31Raynesdefn: All I did was hit the "register for this group" button, plead my case, and waited.
18:31RaynesThey let me in in like 2 days.
18:32coldheadaw ohpauleez <3
18:32defnRaynes: thanks
18:33dnolenlpetit: so does that mean you can just type hint fns and it will just work?
18:33ohpauleezcoldhead: haha
18:34lpetitdnolen: 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@rhickeydnolen: I'm working on that
18:36@rhickeythe 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@rhickeywheras static was like macro in callers had to be re-evaluated to pick up changes
18:37@rhickeybut the primitive support of :static has yet to be incorporated
18:38lpetit*Yaawwnn* Time to go to bed here ! cu later, all !
18:38lpetitkeep up the good work !
19:01woobyjust opened up 25 more conj after-party spots, if you weren't able to register earlier today: http://conjafterparty.eventbrite.com/
19:08hiredman,(doc bound-fn)
19:08clojurebot"([& 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:21dharmahello - 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:21dharmaAny pointers appreciated
19:22dharmaHow to include it in my CLASSPATH?
19:30plathropWhat's the YAML lib of choice? I hate it but I've got a bunch of YAML I have to parse.
19:30plathropI looked at http://github.com/lancepantz/clj-yaml but the installation instructions fail
19:31lancepantzplathrop: how so?
19:32plathroplancepantz: let me construct you a big ol' gistg
19:33petrilli_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:34plathroplancepantz: http://gist.github.com/633299
19:37petrilli_technomancy: huzzah! I was using 1.2.1 (which is what's on your README.md BTW)
19:38technomancypetrilli_: must not be it; that's swank-clojure, not lein-swank.
19:40petrilli_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:40phobbsHow do I add a generic java jar to my dependencies in Lein?
19:41phobbsThe readme said to upload it to clojars
19:41petrilli_technomancy: Although I so have Leiningen v1.1, 1.2, 1.3 and 1.3.1 in the local Maven repository
19:41phobbsbut I can't do that for all the jars I need
19:43lancepantzplathrop: if you'd like to do it go for it :)
19:43lancepantzthere should also be a 'cd clj-yaml' before the 'lein deps' line in the dev instructions
19:47phobbsthanks for all your help; it's http://github.com/elopezdelara/lein-installjars
19:53petrilli_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:59technomancypetrilli_: 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:59technomancy,(clojure.set/difference #{:a :b} [:b :c])
19:59clojurebot#{:a}
19:59technomancy,(clojure.set/difference #{} [:b :c])
19:59clojurebot#{}
20:00technomancy,(clojure.set/union #{} [:b :c])
20:00clojurebot[:b :c]
20:00technomancy^ wat
20:00petrilli_technomancy: set of what, though? Not sure what problem lein-swank "exhibits"?
20:00technomancyI guess the return value of clojure.set functions is undefined when its arguments aren't all sets?
20:01technomancypetrilli_: 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:02petrilli_Looking at Java tracebacks makes my eyes bleed :) I'll see what I can figure out.
20:07plathropI'm deeply confused: http://gist.github.com/633331
20:07petrilli_technomancy: FWIW, it appears that native-reps blows up leiningen :)
20:07petrilli_er, native-deps
20:12plathropcan anyone tell me what's up there?
20:13Raynescemerick: Evening.
20:13amalloyplathrop: read-lines is lazy
20:13cemerickHi :-)
20:14amalloyit'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:14plathropamalloy: ah
20:14plathropokay, thanks
20:15amalloyi had a similar problem this weekend with (vals [1 2])
20:15amalloydidn't throw an exception until the repl tried to print, by which time the exception made no sense
20:25petrilli_And finally, Google protocol buffers + ZeroMQ goodness
20:28plathropamalloy: how do you force the sequence again?
20:29amalloydorun is one way, but it doesn't return anything. i don't remember the functional way to do it
20:29amalloyi 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:31plathropI 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:31plathropI'm grasping at straws at this point
20:32plathropOf course I just figured out a way to do it
20:32plathropOn to the next problem - these shitty yaml files were produced by ruby... *sigh*
20:33plathropnull; 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:33plathropI hate ruby
20:37tridd3llso, 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:39ninjuddtridd3ll: they will get removed in lib
20:39ninjuddtridd3ll: you could install them into your local maven repo
20:39RaynesOr, if the jars are open source, put them on clojarsd.
20:39Raynesclojars*
20:40tridd3llninjudd: is that the best path then? these are proprietary jars from vendor (IBM)
20:40ninjuddtridd3ll: or you can put them in a dir of your choice and then add that dir to your project's classpath
20:41tridd3llninjudd: and I do that in the project.clj?
20:42ninjuddtridd3ll: no, .cake/config. add something like this: project.classpath = /path/to/jars/*
20:42tridd3llninjudd: ok, just found that on the cake readme
20:43ninjuddtridd3ll: cool
20:44tridd3llninjudd: thanks
20:44ninjuddtridd3ll: no problem
21:01technomancy,(sort [(keys {:a :b}) (keys {:b :c})])
21:01clojurebotjava.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.APersistentMap$KeySeq cannot be cast to java.lang.Comparable
21:04technomancyodd that vectors are comparable but seqs aren't
21:06scgilardiwould it be feasible to make all sequential things comparable?
21:31defntridd3ll: im glad to see that SL piqued your clojure interest.
21:31defnYou've been in here all day :D
21:33tridd3lltridd3ll: yep... I'm a long time dabbler... haven't been in IRC much lately though. SL has created more excitement though.
21:33defngood to hear
21:34tomojwhat's SL got to do with clojure?
21:34defnSL == Strange Loop 2010
21:34tomojoh, heh
21:34defnnot snow leopard :)
21:34defnhow about those apple 4th quarter earnings, though, eh?
21:34tomojI guessed someone wrote a clojure wrapper around second life
21:34defnhaha
21:35defnwhen that day comes -- im switching to haskell
21:48ossarehwhat 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:53tomojhmm
21:53tomojwhy should there be an object?
21:53jweissisn't that what jmx is for
21:54jweissi guess that isn't clojure specific
21:54kumarshantanuossareh: lifecycle-aware daemons as (def ...) ?
21:55kumarshantanusay (def foo (daemon ...))
21:55tomojbetter have to (run-daemon foo) or something
21:56kumarshantanutomoj: lifecycle-aware daemons need to be polled from outside -- maybe def can give that visibility
21:57tomojsure
21:57tomojI just mean I wouldn't want (def foo (daemon ...)) to actually start the daemon
21:58kumarshantanutomoj: yeah right....for example these use cases might be expected -- (.start foo), (.stop foo), (.suspend foo)
21:59tomojsounds good for a protocol
22:00tomojthen you can make a daemon by implementing the protocol
22:00tomojand pass it initialization config in its initializer
22:01tomojwhat does "lifecycle-aware" mean, exactly?
22:02ossarehIn 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:02tomoja ring web service?
22:03ossarehsure.. could be.
22:03kumarshantanulifecycle-aware = one that can be polled for lifecycle from outside -- start, stop, suspend, resume, take-a-break etc
22:03tomojah
22:05tomojhmm, is your daemon a web service, or do you mean want to have http endpoints which return status info about the daemon
22:05defnkumarshantanu: sounds sort of like NSMP
22:05defnSNMP
22:05ossarehtomoj: it will need to update some state that can be deref form a web service call
22:05ossarehI think this is what agents are for, correct?
22:05jweissseriously, consider jms
22:05jweissjmx
22:06ossarehjweiss: I don't think I have access to JMX with jetty - that is more of a full app server thing, no?
22:06jweissossareh: well, i am no expert on jmx, but supposedly you can use it to monitor any kind of java object
22:06jweisshttp://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/
22:07ossarehwould hate to go down that road for what could be a ref protected map
22:08tomojagents would work I think
22:09tomojI was imagining a def(type|record) of Daemon that used agents to do its work
22:09tomojbut it seems kinda funny that you'd have to write the agent logic for every Daemon implementation
22:09tomojmaybe have some macros which generate Daemon implementations with common types of agent logic?
22:12coldheadthat seems kinda funny in a different way
22:14kumarshantanuthe only benefit of using JMX in this case seems that they can be tracked from the JMX console of the app server
22:15kumarshantanuand some integration with the "enterprise" back end services
22:17kumarshantanuI am interested to know if there is another advantage
22:29tomojcoldhead: yeah
22:41amalloyis 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:43hiredmanthat will return the highest number, not the key for which the number is highest
22:43amalloyah, right
22:45hiredman,(last (last (sort-by #(get % 0) (map (fn [x] [(read-string x) x]) ["1" "2" "3"]))))
22:45clojurebot"3"
22:47amalloyhiredman: just map read-string, surely?
22:47amalloyoh man, nm. reading stupidly again
22:48amalloyyeah, i wrote something similar (http://gist.github.com/619722), but it's annoying not to have it available
23:12polypusanybody have any advice on using websockets in a clojure app?
23:13polypusis there a clojure lib? if not what would be the best bet for implementing websockets in a compojure app?
23:21leifwso 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:22leifwwhat 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:22leifwbut 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:23leifwis there a reasonable way to have some kind of "thread" which will queue up another message as soon as one is done processing?
23:23leifwI 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:23leifwbut I'm not sure
23:23leifwhow would one do this in a perfect world?
23:24leifwor should I switch to refs?
23:29jkkramerleifw: 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:29leifwthat's a nice idea, thanks
23:29leifwadditionally:
23:30leifwit'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:30leifweven so, would a profiler work with agents that re-send that way?
23:31leifwWhat 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:31leifwprofile seems to just do one function call (and all subcalls), not a period-of-time sort of thing
23:32leifwand trace dumps all the functions called, doesn't aggregate
23:32leifwsuggestions?
23:33jkkrameri haven't used c.c.profile or trace. visualvm (jvisualvm on os x) lets you do some fancy profiling
23:36leifwthanks, I'll look at it
23:48amalloyis there a more idiomatic way to do this?
23:48amalloy(if-let [x (seq (this-returns-a-set))]
23:48amalloy (do-stuff-with (set x)))
23:48amalloymy problem is that empty sets aren't false, and seqs constructed from sets aren't predicates
23:50leifwI'd probably do this, just to get clearer code:
23:50leifw(let [x (this-returns-a-set)]
23:50leifw (if (not (empty? x))
23:50leifw (do-stuff-with x)))
23:51amalloyleifw: i guess that's not too bad (provided i use seq instead of not empty; that's an established style standard)
23:51leifwotherwise maybe write your own test function: (defn set-or-nil [x] (if (empty? x) nil x))
23:51leifwoh I did not know that
23:51leifwok
23:52leifwwith that you could do (if-let [x (set-or-nil (this-returns-a-set))] (do-stuff-with x))
23:52leifwI 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:53amalloyhttp://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/empty?
23:53leifwfair enough, thanks
23:54amalloyi guess seq is slightly better. empty? is implemented as (not (seq coll))
23:54amalloyso you're effectively calling (not (not (seq coll)))
23:56leifwsounds correct
23:56amalloyset-or-nil is cute, though. i may use that
23:56leifwI guess seq is lazy so it's not a bad hit
23:58jkkramer,(when-let [x (not-empty #{1 2 3})] (map inc x))
23:58clojurebot(2 3 4)
23:58jkkramer,(when-let [x (not-empty #{})] (map inc x))
23:58clojurebotnil
23:58amalloyjkkramer: still not a set object
23:58amalloy,(doc not-empty) ; or is it?
23:58clojurebot"([coll]); If coll is empty, returns nil, else coll"
23:58jkkrameramalloy: what's not a set object?
23:59amalloyjkkramer: sorry, you confused me with the map - clojurebot's output was a seq
23:59jkkramer,(when-let [x (not-empty #{1 2 3})] (disj x 2))
23:59clojurebot#{1 3}
23:59amalloyyes, thanks, that's perfect