#clojure logs

2009-11-30

00:01_ato,(re-pattern (str "hello" "world"))
00:01clojurebot#"helloworld"
00:01_ato:-P
00:01_msteven better :)
00:02qedah so I should just (let [regex-pattern (re-pattern s)])
00:02qedthanks
00:04qedif i have some list of strings
00:05qedhow can i search that list of strings for a regex
00:05qed(filter #"text" coll)?
00:07_ato,(filter #(re-matches #"a.*") ["apple" "cat" "dog"])
00:07clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--7967$fn
00:07_ato,(filter #(re-matches #"a.*" %) ["apple" "cat" "dog"])
00:07clojurebot("apple")
00:07_ato,(filter #(re-find #"a.*" %) ["apple" "cat" "dog"])
00:07clojurebot("apple" "cat")
00:07_atodepending on what kind of matching you need
00:09qedthanks _ato :)
00:11qed_ato: nullpointer exception
00:11qedanyway to avoid that?
00:14qedhttp://gist.github.com/245271
00:14qedwhat am i doin wrong there?
00:16_atowhat line are you getting the NPE on?
00:16qed(i should add (search-text "test" (tweet-text 100)))
00:16_ato(if SLIME is giving you some no-source file rubbish, use C-c C-k to compile)
00:16qedwhen i run (search-text "test" (twett-text 100))
00:17qedi get an NPE
00:17_atoright, but in the stack trace, where's the NPE
00:17_atoor you mean it's on that line?
00:17qedim in a repl
00:17qednot sure how to find the line
00:18_atoit should say in the stack trace
00:18_atoit should at least tell you what function it's in
00:18_atoeven if it doesn't have the line
00:18qed 17: user$eval__2442.invoke(NO_SOURCE_FILE)
00:18qedthat line i hilighted
00:18_atohuh... that doesn't sound right :/
00:18qed 0: clojure.lang.LazySeq.sval(LazySeq.java:47)
00:19_atocan you pastebin the whole stack trace?
00:19qedsure
00:20qedhttp://gist.github.com/245274
00:20_atoah
00:20_atopress "1"
00:21konrIs there any recipe to turn [1 10 100 1000] into [9 90 900]?
00:21_atodebugging Clojure 101: keep pressing "1" until pressing "1" is not an option. ;-)
00:21_atothen you'll get a more useful stack trace
00:22_ato 1: [CAUSE] Throw cause of this exception
00:22_ato^ I mean until that line isn't there anymore
00:23qed 0: java.util.regex.Matcher.getTextLength(Matcher.java:1140)
00:23_atoright
00:23_atoso it sounds like you're trying to run the regex on a null string
00:23_mst,(map #(apply - (reverse %)) (partition 2 1 [1 10 100 1000]))
00:23clojurebot(9 90 900)
00:24rzezeski,(into [] (take 3 (map #(* 9 %) [1 10 100 1000])))
00:24clojurebot[9 90 900]
00:24_atoqed: I'd guess (tweet-text) is not always returning a string
00:24_mst*laughs*
00:24qed_ato: yeah that's true
00:24_mstwe may need more information :)
00:24qedis there anyway to get rid of nils before i run it
00:25_ato(filter #(re-find regex-pattern %) (remove nil? coll))
00:25qednice
00:25qedthanks _ato
00:26_ato,(next (map #(* 9/10 %) [1 10 100 1000]))
00:26clojurebot(9 90 900)
00:27_mst,(list 9 90 900)
00:27clojurebot(9 90 900)
00:27_mstmaybe the input was just a decoy :)
00:27konroops, I forgot to say what it was supposed to mean. I want [n1 n2 n3 n4] turned into [(- n2 -n1) (- n3 n2)] etc
00:28_mstthis is good news for my first attempt :)
00:28konrah-ha, I think _mst's answer is right
00:28qedah yes, searching 10,000 tweets for "fuck"
00:28konrthanks!
00:28qedso classy
00:29qedthank god we have computers to let us search for curse words
00:32qednow i need to do something more interesting
00:35qedwow. people who use "fuck" in their tweets are generally trashy
00:35qedeither trashy or emo
00:41qedanyone know where i can find r. hickey's jvm language summit video in full?
00:44_atoqed: it's on infoq.com
00:44_atohttp://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
00:44_atoor do you mean there's something missing from that?
00:45qedfound it
00:45qedthanks
00:45qed_ato: do you teach IRL?
00:46qed_ato: if you dont you should consider it, you are one of the most supremely patient people ive met in any community
00:46qedyou seem passionate when it comes to showing others how things work
00:47_atothanks. :-)
00:48_atoand no I don't teach IRL, in fact I haven't finished undergrad yet (I'm thinking of switching to a shorter degree and just graduating though, I'm getting sick of uni, so not always so patient :-P)
00:48qedi keep failing out
00:49qedi take a course and it gets me interested in some dark corner where i work and learn, not getting credit for it
00:49qedoh well
00:49qedthe things i have learned which i have received no formal credit for
00:49qedare the most important things ive learned to-date
00:52_atoYeah, I have that problem as well. Purely theoretical stuff (like proofs of correctness and such) just bore me. That's part of the reason I'm considering changing degrees, I don't think I'm really suited to academic-style research, I like research by tinkering not research by formalism. ;-)
00:54_atoI definitely think the CS degree was worthwhile starting with though, it meant I could skip all the zaney software engineering courses and did teach me a lot of useful stuff I wouldn't have otherwise encountered (compiler theory, automata/turing machines, lambda calculus etc)
00:56rzezeskican anyone point me to a function that acts like partition but doesn't truncate the remaining items?
00:57_atorzezeski: sure, it's called 'partition' ;-)
00:57_ato,(doc partition)
00:57clojurebot"([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."
00:58_atogive it an empty "pad" argument
00:58rzezeskiI guess that's not in 1.0.0?
00:58technomancyrzezeski: maybe partition-all from seq-utils in contrib
01:00_ato,(partition 3 3 [] [1 2 3 4 5])
01:00clojurebot((1 2 3) (4 5))
01:00_ato,(partition-all 3 [1 2 3 4 5])
01:00clojurebot((1 2 3) (4 5))
01:01_atolooks like that does the trick for 1.0
01:03cgordonI'm trying to use Leiningen, so I downloaded the latest "lein" script and ran "lein self-install". That put a jar file in ~/.m2/..., but when I run "lein new some-name", I get: Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/new__init.class or leiningen/new.clj on classpath
01:04cgordonIf I do a "jar tvf ..." on the lein jar file, there is no leiningen/new.clj
01:05_atocgordon: lein new doesn't exist in 0.5.0 (the latest stable release)
01:05cgordon_ato: ah, that would explain it :)
01:05cgordonare there instructions somewhere for using lein with swank/slime from Emacs?
01:06rzezeskithat'll do it, thx guys
01:07_atocgordon: you don't need to do anything special with slime. Create a file project.clj with your dependencies (there's an example in the lein README). Create a directory "src" for your code. Run "lein deps" to grab dependencies and chuck them into "lib". Fire up emacs and hit M-x swank-clojure-project and give your project's directory path
01:08cgordonI don't seem to have a swank-clojure-project command in emacs, is that bundled with a new version of swank-clojure, or is that part of lein?
01:08_atoit's in a new swank-clojure
01:08cgordonalso, where is lein getting dependencies from? Clojars? What about regular Java jar dependencies?
01:09_atoit checks maven central, clojars and build.clojure.org/snapshots
01:09cgordon_ato: thanks!
01:09_atoyou can search maven central here: http://www.jarvana.com/
01:31G0SUBI am trying to design a very simple object store using a vector where objects expire after a while and the store is replenished with new objects.
01:31G0SUBany idea how to manage the expiration of objects?
01:41G0SUBIs clojure.org down?
01:46tomojdoesn't seem to be
02:00G0SUBtomoj: hmm, it's up now.
02:29tomojis there a way to get the arity of a fn?
02:30tomojc.c.repl-utils/show suggests not
02:33_ato,^#'inc
02:33clojurebot{:ns #<Namespace clojure.core>, :name inc, :file "clojure/core.clj", :line 618, :arglists ([x]), :inline #<core$fn__4729 clojure.core$fn__4729@1b0b0c1>, :doc "Returns a number one greater than num."}
02:33_atohmm
02:34tomojseems defn gives you :arglists
02:34tomojbut not on anonymous fns of course
02:34tomojanyway I think I've realized I don't actually need to this anyway :)
02:35_ato~count arities
02:35clojurebotcount arities is http://groups.google.com/group/clojure/msg/fb9930ba2a25d2dd
02:36tomojcool
04:36angermanI have a seq of line-no of a file. I want to extract. how would I do that in a memory friendly way?
04:49AWizzArdangerman: are you lazily reading the lines from your file? For example using duck-streams read-lines?
04:49angermanAWizzArd: that's what I'm trying
04:51konrIt's my first GUI application, how can I make it not look like crap? Take a look: http://scorciapino.com/pub/fotos/peso.jpg
04:54AWizzArdangerman: well, then it sounds that you are already on the right path. You can use (I think from Contribs seq-utils) the function indexed and then run filter over it. This would give you all those lines you want
04:55hiredmanhttp://java.sun.com/j2se/1.5.0/docs/api/java/io/RandomAccessFile.html
04:57AWizzArdOr maybe this is also ok for you: (filter (fn [[i line]] (when (your-set-of-lines-you-want i) line)) (read-lines "some-file"))
04:58AWizzArduhm, (indexed (read-lines ...))
04:58_atoangerman: if your list of line numbers is also too big to fit into memory and is sorted, you could do something like this: http://gist.github.com/245377
05:02noidikonr, you could use qt4 :)
05:02hoeckkonr: maybe use another gui toolkit, for example http://incubator.apache.org/pivot/ :)
05:03noidihttp://qt.nokia.com/doc/qtjambi-4.4/html/com/trolltech/qt/qtjambi-index.html
05:03konrinteresting, guys...
05:04konrhaha
05:04konrhttp://qt.nokia.com/doc/qtjambi-4.4/html/com/trolltech/qt/qtjambi-pathstroke.html <- This certainly looks better
05:05_atothere's also alternative widget sets for swing: http://code.google.com/p/macwidgets/
05:10konrDoes QT work flawlessly in Windows XP/Vista/7?
05:13_atoalso try: (javax.swing.UIManager/setLookAndFeel (javax.swing.UIManager/getSystemLookAndFeelClassName))
05:19Chousukekonr: well, nothing ever works flawlessly, but... with the disclaimer, yes.
05:20ChousukeI guess there always are gotchas when writing crossplatform UIs but Qt is pretty good.
05:27noidikonr, one caveat regarding qt jambi: http://qt.nokia.com/about/news/preview-of-final-qt-jambi-release-available
05:28noidiit is no longer developed by qt software, and they will end support for it next year
05:29noidiI haven't followed the project so I don't know whether an open source community has taken over the maintenance or not
05:32noidiapparently there is already a port of Jambi for the next QT release http://qt.gitorious.org/qt-jambi/community-port-to-4_6
06:23AWizzArdChousuke: funny, what you said is impossible I think. I mean your rule/law "nothing ever works flawlessly". If this rule were true then the nothing also points to itself. So the truth of your statement leads to its untruth :)
06:34AWizzArd,java.io.File/separator
06:34clojurebot"/"
06:35AWizzArdis there something like this for determine line endings on the given system, such as "\n" for Unix and Gnu, "\r\n" for Windows and "\r" for OSX?
06:37AWizzArd,(System/getProperty "line.separator")
06:37clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission line.separator read)
07:55AWizzArdrhickey: Is this a new exception? java.lang.VerifyError: (class: my/namespace/program$my_fun__2984, method: invoke signature: (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) Expecting to find integer on stack
07:56rhickey_AWizzArd: verify errors are my bad - what's the code/Clojure version?
07:56AWizzArdI get this in a loop where I have (loop [n (foo xyz)] ...) and where foo is (defn #^int foo [x] ...)
07:56AWizzArdWhen I remove the #^int return value type hint this error goes away.
07:57AWizzArdIt is {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}, from the New branch from Thursday (Nov. 26)
07:58rhickey_AWizzArd: no Clojure fn can return an int primitive
07:58rhickey_your type hint is a lie
07:59AWizzArdah okay, I und
08:01chouserrhickey_: it would be pretty easy (and apparently desirable to dysinger and other maven consumers) to use the :qualifier for the branch name.
08:03chouserrhickey_: just a one-line patch to each branch that seems worth naming (I was thinking master and new)
08:03rhickey_chouser: fine by me
08:06chouserok, thanks. I'll coordinate with dysinger
08:36AWizzArdIs it already possible to type hint deftypes?
08:36AWizzArd(deftype person [a b c]) (defn #^person foo [] ...)
08:38chouserAWizzArd: shouldn't be necessary
08:39chouser(:a (foo)) should give you field-access speed without type hints.
08:40AWizzArdHow would it be known at compile time that foo returns a person?
08:42rhickeyAWizzArd: what code need to know that or could leverage it? Also, person is not a class
08:42rhickeyat least not yet :)
08:51cemerickrhickey: does that mean finding classes loaded in sibling classloaders? (surely not?)
08:51rhickeyyup
08:51rhickeyjust the dynamic ones
08:52cemerickoh, this is only intra-clojure
08:52rhickeyalso, no-op reload of identical class, load new version of class with same name
08:52rhickeycemerick: yes, just for Clojure stuff
08:52cemerickrhickey: OK, right. Thought you were really changing the rules on us somehow. :-)
08:53rhickeycemerick: well, it should enable new features
08:54rhickeyright now I'm focusing on the underpinnings of protocols/defclass, but this could e.g. support dynamic definterface
08:55rhickeyer, deftype
08:55rhickeynot defclass
08:56AWizzArdI just liked the idea to document my code with type hints.
08:56cemerickdefclass is gone for good, right?
08:56AWizzArdinstead (defn foo [string] ...) I prefer (defn foo [#^String s] ...)
08:57rhickeycemerick: it's a naming thing, certainly there's no reason for 2, deftype covers both use cases. But it looks like deftype might be able to generate what feels like a named class even in the dynamic case, including across redefs
08:57AWizzArdWithout type hints lispers sometimes are tempted to name a var after its type.
08:58chouserAWizzArd: I see that in fully statically-typed code too
08:58cemerickrhickey: That's good, if only so that some of that naming real estate is available for people building object systems.
08:58rhickeyAWizzArd: using type hints that way is a bad idea
08:58chouserAWizzArd: either with hungarian or something less formal
08:59rhickeycemerick: the only question would be which to choose - if types no longer need the IDynamicType stucc, i.e. are classes, is defclass the better name?
09:00rhickeyAWizzArd: becasue type hints mean something, they are not just comments
09:00AWizzArdYes, and I would only pass in the right types.
09:00cemerickrhickey: the weaker the construct's support for all of the trappings of jvm/clr classes, the more I'd lean towards deftype
09:00cemerick...regardless of the underlying impl, I mean.
09:00rhickeycemerick: that's my inclination as well
09:01AWizzArdrhickey: what is the lateral class resolution to DynamicClassLoader good for? I mean, what are your grand plans? :)
09:01rhickeyanyway, seems like a clear path now to protocols/deftype/reify with no reference even to interfaces, reify of protocols
09:01rhickeyreify of interfaces and deftype implementing interfaces just about interop
09:04rhickeyAWizzArd: lateral class resolution means I can dynamically generate named classes, and find them in other dynamic classloaders, without trying to insert them in some shared root in the hierarchy (an impossible task given modular classloaders, context classloaders etc)
09:04chouserhow do the lateral class loaders find each other?
09:04rhickeylifts a prior restriction on named things being static only
09:05rhickeychouser: they don't see each other, but see the dynamic classes of all, in a shared cache
09:05rhickeynow named things need be static only for other static things
09:05AWizzArdAnd if you use a dynamic classloader, does this then mean you can gc those named classes?
09:05rhickeythe cache holds the classes in weak refs
09:06rhickeybut it also allows for no op redefs, caches the hash of the bytecode
09:06rhickeyif same, just returns existing class
09:07rhickeyso you could intermix definterface or deftypes in a file with code, reload won't invalidate unchanged classes
09:08rhickeythis also means that both deftype and reify can implement protocols based on interfaces always, not just when AOTed
09:08rhickeychouser: this is what weak refs are for, canonic caches
09:10rhickeythe upside is huge
09:11rhickeydefinterface (formerly gen-and-load-interface), no problem, including redefs
09:11rhickeydeftypes could gen named classes, with same name, all the time
09:11rhickeyprotocols can always gen a corresponding interface, not just AOT
09:12rhickeyreify can easily implement protocols
09:12chouseryeah, that's a bit stunning
09:13rhickeythe only hitch will be a true (altering) redef of a type will require a reload of client code to work with new instances, but no JVM restart ever
09:14rhickeyI basically decided following the tree design was simply too restrictive, was never intended to cover these cases, and hell, why should these modularity systems have all the fun - they do this kind of thing all the time
09:15chouserheh
09:15rhickeyit's still early, but I'm quite hopeful
09:17rhickeyso, when protocols generate interfaces I want to cover 2 things:
09:17rhickeyfirst, there needs to be name munging, as the protocols fns will become interface methods
09:17rhickeyI can hide this munging so deftype and reify use the clojure names
09:18rhickeythe second thing I want to do is allow for multiple protocols to have the same named functions, without merging or clashes
09:18rhickeythis will require that the method names in the interface have something about the protocol as a prefix or suffix
09:19rhickeyagain, as with munging, deftype and reify will hide this
09:19rhickeybut, should you want to extend the protocol from JAva, you will see these names
09:20chouserthese would be multiple protocols each in their own namespace with the same unqualified method names?
09:20rhickeyyes
09:20rhickeyright now that is a weakness of interfaces - the names merge
09:20rhickeyand can conflict if, say, only return types differ
09:21rhickeynever mind any semantic conflicts
09:22rhickeyso, if protocols Bar and Baz both define foo, would become methods: Bar__foo(), Baz__foo(), or foo__Bar(), foo__Baz()
09:22chousersemantic conflicts that could actually cause an extend to want different functionality for two methods with the same name (and args and even return type) from different protocols
09:23rhickeyyes, definitely, the functions in separate namespaces mean different things
09:24rhickeyCLR doesn't do merging anyway, it is a broken part of Java
09:24rhickeyalso a broken part of most open-class OO systems
09:24rhickeyclasses make lousy namespaces
09:24chouserCLR languages provide extra syntax to disambiguate on method calls?
09:25rhickeyso, the question is, would those pre/suffixes be bad
09:25rhickeychouser: yes, both on calls and definitions, you can define overrides for Bar::foo and Baz::foo in the same class
09:25cemerickrhickey: pretty cringe-inducing *shrug*
09:26rhickeywhich makes sense, because when calling you will be using the Bar or Baz interfaces
09:26cemericknot sure what a good alternative would be
09:26rhickeyjust like in Clojure you will be using the Bar or Baz namespaces
09:26rhickeycemerick: right, alternatives welcome
09:27cemerickrhickey: how about defining inner interfaces?
09:27chouserany chance of also generating prefix-less methods that just call the real one?
09:27rhickeychouser: when there is only one?
09:28rhickeycemerick: the problem is the method name, not the class structure
09:28chouserrhickey: right, for the probably common case of there being only one. Dunno if there's an appropriate moment to hook in order to leave it out on multiple.
09:28rhickeytwo interfaces both have a foo method, with different semantics, and you want to implement both
09:29rhickeychouser: the problem there is that, should you in the future implement another interface with an overlap, that redirector will disappear
09:29rhickeybreaking clients
09:29chouseryeah, I guess my idea won't work, since both would produce the prefix-less methods, and would just have a conflict the moment some Java code tried to implement both.
09:30chouseryeah, that too. :-(
09:30rhickeyalso, the clients will be using the interfaces, not the concrete class
09:30chouserah, right -- no redirect code allowed in interfaces.
09:30chouserbroken on so many levels! oh well.
09:30rhickeyso, protocol Baz looking for foo will be looking for foo_Baz
09:31rhickeythis aspect of JAva is broken, and I'd prefer not to have protocols be broken too. Right now the story is, same function name in different namespaces ok
09:32rhickeyand use of interfaces for speed under protocols is an implementation detail
09:32chouseralways using a prefix/suffix would dissallow the kind of "transparent" client use by Java code I'm using right now.
09:34rhickeychouser: there are slightly different requirements at play here. There, the Java interface is driving, it won't be the primary interface to the protocol
09:34rhickeyI'm thinking about designs where some substantial facility has been built in clojure on protocols, how to write new Java to work with it
09:35chouserI have Java clients doing things like RPC.newChannel("target").send(myMessage), where RPC is gen-class with static methods, and the Channel interface is from gen-interface. 'send' is implemented via proxy
09:35rhickeyJAva code can't presume all implementors of protocol implement some interface - that will never be true, since extends lets protocols reach classes with no derivation requirement
09:36rhickeychouser: so for that you might still want definterface + deftype/reify
09:36cemerickrhickey: FWIW, in that use case, I'd say that a Java-friendly API should be written using genclass or a regular interface + deftype/reify.
09:36cemerickheh
09:37chouserright. I'm fine with Java code that's aware of Clojure having to stretch a bit (munging in prefixes or whatever) to get at things that weren't intentionally made Java-friendly.
09:37rhickeyif protocols are to be clojure-like, they will have name munging too
09:37octei was thinking about creating a http loadtest program, as an exercise... make x requests using y concurrent clients
09:37octewould it be a good idea to use agents for that?
09:37rhickeybut, it could be possible, if you used compatible names and didn't get a prefix, to get a nice-looking interface from defprotocol...
09:37chouser...as long as I can still do what I'm doing as well.
09:38cemerickmy point being, I think any general solution to making clojure callable from Java will be less than what a real user would want.
09:38chouserocte: yep, probably.
09:38octei was thinking you could create Y agents with a request-coutner as a value and keep sending of request requests to them until their total count reaches X
09:38rhickeycemerick: by regular interface above do you mean JAva-defined?
09:39cemerickrhickey: yes. If you're writing Java code anyway, and you want to call some clojure lib, I think it's totally reasonable to say that the work and shape of that integration falls on the integrator, not the language.
09:40rhickeythe biggest problem of declaring 'no prefix' at the protocol side is that the clashes occur in client code doing ad-hoc extension
09:40cemericksomeone in that position will likely be doing something you're not going to anticipate anyway, so punting to interface+reify/genclass will be the rule more than the exception, I'd wager.
09:40rhickeyYou can't be both a j.u.Map and a j.u.Collection, for example, due to this problem
09:41rhickeyone thing that is key is that if you have a protocol-driven design, and want to make it reach another, more Java friendly interface, you always can
09:42rhickeybut the protocol-specific interface gets a perf benefit that can't be gotten otherwise
09:44rhickeyI guess if I leave in :on, you could make protocols where a definterface drives that, but :on is really ugly, puts a discussion of interfaces up front, has name-mapping and other required knobs...
09:45rhickeybut it is a key question - are there many cases where a pre-existing interface should be the basis for a protocol?
09:46chousermy code is already partitioned into core functions vs. clojure api (which includes macros) vs. java api (public interfaces, static factory methods, etc.) ...so I have no problem with internal clojure stuff that might look "ugly" to Java, as long as I can still wrap it up in stuff that looks pretty in Java without actually writing any Java. :-)
09:47rhickey(definterface Pretty ...) (extend Pretty MyProtocol ...)
09:47chouserrhickey: do clojure's java.util-extending classes not fit that description?
09:49rhickeychouser: no, the primary consumption on the Clojure side is via Clojure's interfaces, which will become protocols. deftypes will implement the j.util stuff so they can be passed across
09:49rhickeyusually protocolizing a java interface won't help JAva, since you can;t make a Java String a Java Collection
09:50rhickeyprotocols break free from the derivation requirement
09:51Chousukerhickey: you haven't added a seq1 function (for "unchunking" a seq) yet, have you? I suppose it would be good to have in 1.1 if people need it :/
09:52rhickeythe other route is to do name-munging only, people can easily avoid munging by using compatible names. You would be precluded from implementing protocols with overlapping functions in the same deftype, but could still reach the other protocol with an extend-type
09:53rhickeyChousuke: that's definitely something we need to look at pre 1.1, yes
09:54rhickeyso, no merging
09:54rhickeybut no prefixes
09:54rhickeynever stuck due to extend-type
09:54rhickeyhave to pick which protocol you want 'fast'
09:55rhickeythat's not so bad
09:56rhickeyif protocol is my.ns/Protocol, interface is my.ns.Protocol?
09:56rhickeyI'm trying to avoid knobs
09:57doublindirectionhello #clojure
10:06cemerickrhickey: sounds like a perfectly reasonable approach that (most importantly, IMO) doesn't try to be a general solution.
10:21konr(-> f .getName .toLowerCase (.endsWith ".jpg"))
10:21konr-> is so awesome.
10:22angermanis there a math (arrays) lib from clojure?
10:29angermanlooks like the incater matrix is pretty ncie
10:39cemerickLooks like I need to rebind a multimethod with one that temporarily contains an additional set of methods. Is there a better way to do this, short of using defmethod before (binding...) and remove-method in a finally? (Thankfully, I'm not worried about race conditions in this case.)
10:41patrkrisIs there a video available of the Clojure Experience talk (http://tinyurl.com/ygb5t8m)?
10:41patrkrisCouldn't seem to find one
10:42chousercemerick: the same defmultis, but for additional types?
10:42cemerickchouser: right
10:42chouserweird. and it's no good to just leave them in place all the time?
10:44cemerickthere's an outside chance that leaving them in place all the time will cause strange bleed-through of behaviour from one lib to another, depending on load order
10:44rhickeypatrkris: not as far as I know. It was a talk I gave recently at MIT CSAIL, and it was videotaped
10:44patrkrisrhickey: ok, would love to watch it
10:45chouserit looks like the standard clojure intro, but updated post JVM lang summit.
10:45cemerickactually, any naming collision of the keywords used as args to the multimethod will cause problems, so I definitely wouldn't want to leave in method impls
10:46rhickeythe intro stuff went by quickly. many in the audience had seen both my Boston talk (3 hrs) and ILC tutorial (5 hrs)
10:46cemerick(this calls for a persistent MultiFn impl :-P)
10:49octehmm, probably somethings stupid but.. http://paste.lisp.org/display/91271 <- why does this code end up making 25 requests?
10:50chousercemerick: add/remove is the only way I can think of, but I suppose I can imagine each methodtable living in, say, an atom in a var so that the var could get thread-local bindings.
10:50chousercemerick: still seems pretty weird to me. :-P
10:51chouserwould mess with the caching
10:54cemerickeh, dispatch table caching is not a cost relative to the rest of the app
10:54cemerickchouser: the specific situation is an indexing system where documents are {:name "val" :name2 "val"}, and different callers need to have control over how the values are indexed (tokenized or not and how, stored or not, etc). If document type A has a field :foo that should be tokenized, and document type B has a field :foo that shouldn't be tokenized, this has to be controlled in a context-sensitive way.
10:55cemerickI guess I could use a two-stage approach.
10:55chouserand multimethods have been a good fit up to this point?
10:55cemerickno, this is a new addition -- so far, indexing params have been hardcoded based on the type of the value
10:56chouserrhickey: I think at least 3 books on the way: one from APress, two from Manning
10:56rhickeyshould be interesting to see how they differ
10:56chouserindeed
10:58chousermy vague understanding is that the prag, apress, and "in action" from manning are essentially meant to be head-to-head competition, while we're making ours try to come at things from a slightly different angle.
10:59rhickeychouser: lucky you!
10:59chouserheh
10:59chouserwe'll see. :-)
10:59cemerickchouser: yeah, a 2-stage approach is better in general -- multimethod dispatching on document type returning a fn (or var that can be rebound as desired) that provides the actual configuration
11:00cemerickalthough the method-table-in-an-atom idea is a good thought :-)
11:02G0SUBwhat is a nice way to emulate expiration of data after some time?
11:03G0SUBI have some access tokens which expire after 1 hour and need to be renewed.
11:03G0SUBa thread monitoring the tokens periodically is one way.
11:04chouserG0SUB: you want renewal triggered by time, or by attempted usage after a time limit?
11:04G0SUBchouser: the latter is OK with me.
11:05G0SUBI am fine with both, actually.
11:05chouserfor the latter, you can just timestamp the object. Maybe in metadata, depending on other usage.
11:05G0SUBI get the tokens from an external system, and I have 3 api calls to create, destroy and validate the tokens
11:06G0SUBhmm
11:17AlexStoddardI have large data where I expect different instances to share a lot of structure (genetic variation in humans - representable as a vector or sequence). Clojure's structural sharing is mostly explained in terms of changes over time not changes between individuals. Any suggestions on how I might leverage structural sharing in Clojure to efficiently represent the data?
11:22ChousukeAlexStoddard: can't you just model your data as a progression of individuals instead of as progression of time? :/
11:23ChousukeAlexStoddard: if you make a "modification" to a vector, it would represent a new individual, but the structure would be shared with the parent individual.
11:26AlexStoddardChousuke: That is what I am thinking, the abstraction makes sense. What I am unsure about is how to "attach" an individual to each given state of the vector.
11:27ChousukeEach state *is* an individual. but you could have a ref to point to one of the individuals (changing over time) and call it pinnacle-of-evolution or something. Or you could have sets containing these individuals, or whatever
11:28chouserAlexStoddard: the structural sharing is pretty invisible. Just hang onto one version of a thing, do some 'assoc', 'dissoc', etc. to get to your next object, then hang onto that as well.
11:30Chousukeif genetic change can happen within one individual then you need to model them as time-dependent. eg. you need a ref to give an identity to the individual, or if that's too granular, a whole population (which "progresses" synchronously)
11:34AlexStoddardchouser: So it would be as simple as (def ind1 (load-genetic-vector)) (def ind2 (mutate ind1)) and ind1 and ind2 share structure?
11:36liebkeAlexStoddard: yes, ind1 and ind2 will share structure
11:36mattreplchouser: how should one choose bugs in assembla to work on? it's not clear what fields like "approved" mean. I'd like to help out, but not sure what's higher priority
11:37chousermattrepl: yeah, it's a bit confusing. I started on a flow chart once... ...
11:37chousermattrepl: it's generally pretty flat. "approved" is only when there's a patch attached that rhickey has examined and agrees is ready to be committed.
11:38chouser"test" means someone has submitted a patch but rhickey hasn't approved it yet.
11:39rhickeymattrepl: something useful right now would be to go through the existing tickets and set any missing Types
11:39rhickeybug vs enhancement
11:40mattreplchouser: thanks, that makes sense
11:40rhickeyhttp://twitter.com/neal4d/status/6189294802
11:40mattreplrhickey: sure thing
11:41chousereverything else is fair game for writing patches -- I guess "milestone" gives a sense of priority
11:41mattreplare tickets in the backlog ok to work on or do they need to be reviewed for relevancy?
11:41AlexStoddardliebke et al: Thanks, persistent vectors for genetics, here I come...
11:42rhickeyyes, there were a whole bunch of things slated for next release that got ignored, while others from backlog got worked on, so didn't seem to make much sense to me to keep trying to do that, but the approved backlog are things I think are more important
11:42chousermattrepl: if they exist at all it's ok to work on them, though they might need more design discussion or might not make it in anytime soon.
11:43mattreplok, thanks
11:45rhickeywow, this instant interface thing will be game changing:
11:45rhickey(defprotocol P (foo [x]) (bar ([x] [x y])))
11:45rhickey(defn baz [x] (bar x))
11:45rhickey(baz (reify [user.P] (.bar [] 42)))
11:45rhickey;will become (baz (reify [P (bar [] 42)]))?
11:46rhickeydoes beg the implicit this question again...
11:47cemerickrhickey: one thing stuck out for me in those slides that are making the rounds this morning: "composability of independent decisions e.g. thread pool sizing". That's developing into a big issue for our UIs -- e.g. running a pmap in a UI app simply kills the entire system. Definitely good utilization, but being able to say "this pmap/send/future/etc should go into this low-priority/N-thread/etc threadpool/executor" woul
11:47cemerickincredibly useful.
11:47rhickeyI hate to see all those unused thises
11:47Chousukerhickey: I'm fine with either choice as long as its applied consistently :)
11:48Chousukeproxy already has implicit this so that's one argument for it, I suppose.
11:48rhickeyChousuke: what's consistent though? - interface sigs are declared without this, protocol fns have an arg for it, and both may appear together in a single deftype
11:49rhickeyyou are bound to have one mismatch
11:49Chousukehmm, right. Java complicating things again :P
11:50rhickeycemerick: definitely want to have more pool options, but still leaves basic questions unanswered - how do independent decisions interact>
11:50rhickeythere is implicit scope already in play in deftype - unqualified access to fields
11:57notallamacemerick: i wrote a different version of future the other day that uses a daemon thread pool (http://paste.lisp.org/display/91277). that's something you can hack together yourself, if you want. for send, i think you have to change Agent.java (i didn't see another way to do it)
11:57cemerickrhickey: absolutely. The brute-force approach leads to insanity. Further, I presume that the way j.u.concurrent does things is not suitable for .NET or cocoa or js or..., so I suppose clojure needs a higher-level set of levers than all of the fiddly bits that j.u.c provides.
11:58rhickeycemerick: I think you miss my point - I consider this an unsolved problem
11:58rhickeyi.e. for which I don't yet have an answer
12:03cemerickWell, I'd think a first step of having bindable vars for the executors in Agent (as notallama's impl points towards) would be a good 80% solution.
12:03cemerickCertainly leads to proliferation with various libs potentially keeping their own pools around, but that's what thread schedulers are for.
12:04rhickeycemerick: meh, I think at least moving towards ForkJoin work-stealing.
12:05cemerickrhickey: well, that's JDK7 only, no?
12:05rhickeyworks with JDK 6
12:05rhickeybut not 5 :(
12:05cemerickoh, that's interesting. Isn't there a native component, though?
12:05rhickeyno, just JSR166y.jar
12:06rhickeysee par branch
12:06rhickeyworks today on 6
12:06cemerickhuh, I never looked at that at all because I had it in my head that it was JDK 7-only
12:06rhickeyhas a fjtask, like future, but joins any enclosing fjtask
12:38arohneris there a way to introspect a deftype to get the number and order of the args in the constructor?
12:38arohnerI'd like to pass a map literal to make a deftype instance. if I could introspect, I could write the fn to do it
12:39djorkhmm, every time I try this failing 'use' expression in my repl, it increments the line number associated with the error
12:39djorkis that a bug?
12:40djorklike, it starts at line 1, then just goes up by one each time
12:40chouserarohner: you can use the arglists of the factory fn pretty safely I think.
12:41arohnerchouser: aha, thanks
13:03rhickeyhmm, clojure.contrib.pprint.PrettyWriter has an illegal method name: col-write
13:06qedheh that was fun, i ran a search for 250,000 incoming tweets for clojure
13:06qedw/ clojure of course
13:07qedi wonder how many tweets there are in a day
13:12qedlook like ~25 million per day
13:12tmountainqed: according to this guy's blog, 27.3 million - http://www.briansolis.com/2009/11/guess-how-many-tweets-fly-across-twitter-each-day/
13:12qedhttp://popacular.com/gigatweet/
13:13tmountaintoo bad they use scala :-p
13:13qedhehe
13:13qedim gonna grab a day of tweets and see what I can do with it
13:20rhickeyso I'm left with the conflict between the name of a protocol and its implicit interface - user/P and user.P
13:23Chousukerhickey: would it be too ugly to just prefix the interface name with P or something?
13:23rhickeyChousuke: yes
13:41rhickeyok, protocols gen interfaces is up!
13:42noidihow can I drop every second item from a seq?
13:43Chousuke,(let [x (atom false)] (filter #(swap! x not) [1 2 3 4 5 6]))
13:43clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--8041$fn
13:43Chousukehmm
13:43Chousukeoops
13:44Chousuke,(let [x (atom false)] (filter (fn [_] (swap! x not)) [1 2 3 4 5 6]))
13:44clojurebot(1 3 5)
13:44noidithanks
13:44Chousukethere's probably a better way, but...
13:44noidithat works but the atom is not too pretty
13:45the-kennyChousuke: That was my first idea too.. But I'm sure there is a better way
13:45the-kennymaybe seq-utils/indexed + for or something
13:45noidiah, indexed
13:45noidithat was the thing I was looking for, but I couldn't remember the name
13:46the-kennynoidi: It's in clojure.contrib.seq-utils.
13:46noidithanks
13:46noidithat + filter odd? should probably do the trick
13:46Chousukeindexes :(
13:47esjor (map first (partition 1 2 '(1 2 3 4 5 6))) ?
13:48noidiesj, of course! brilliant! :)
13:48noidithanks
13:49esjnoidi: don't take my word for it, i'm habitually wrong.
13:50noidi,(map first (partition 2 (range 10)))
13:50clojurebot(0 2 4 6 8)
13:51noidi,(map second (partition 2 (range 10)))
13:51clojurebot(1 3 5 7 9)
13:51noidinice and simple :)
13:54esjcool.
13:55noidiweird, I can load the triangles of a 3D mesh from a COLLADA file in 13 lines of clojure
13:56noidicoming from an imperative/OO programming, functional code feels amazingly dense
13:56the-kennynoidi: That's true
13:56noididense as in little fluff, not dense as in difficult to read
13:57polypusniodi, yeah i'm rewriting a genetic programming project from ruby and it is an order of magnitude smaller
13:57polypusnoidi*
13:58polypushey do you guys know if there is any audio/video available anywhere of rhickey's semantic web talks?
13:59technomancyI wish I understood more than 20% of this, but it's a good read nonetheless: http://blogs.sun.com/jrose/entry/tailcalls_meet_invokedynamic
14:03esjanybody knows if json.write has gone away ?
14:03esj(use 'clojure.contrib.json.write) doesn't seem to work
14:03esj?
14:07rhickeynoidi: (take-nth 2 (range 10))
14:07rhickey,(take-nth 2 (range 10))
14:07clojurebot(0 2 4 6 8)
14:07esjrhickey: nice.
14:07rhickeyChousuke: shame on you for that atom stuff!
14:08noidirhickey, you win :)
14:09esjhe has an unfair advantage... and not just that he's super clever :)
14:11cemerickare tail-calls really on the table for JDK 7 now?
14:11rhickeycemerick: not as far as I know
14:12technomancycemerick: according to John Rose it's a matter of manpower
14:12cemerickthat's what I thought, though I see the post that technomancy just linked to, and there was a java.net post about first-class continuations in JDK 7 over the weekend, so I thought maybe something was afoot
14:13cemericktechnomancy: IMO: http://twitter.com/cemerick/status/5868285825
14:13rhickeyIf all this stuff is going to be in JDK7, then JDK7 is a long way away
14:13cemerickfrom a selfish user standpoint, of course ;-)
14:17shr3kst3rchange java 7 to java dnf
14:52technomancycemerick: I guess the guy working with Rose on that was doing it for his Ph.D thesis, but then he graduated. =(
14:53cemerickbah
14:53cemerickand there's a small squad of folks puttering away building the javafx stack. Awesome.
14:57djorkdoes anybody else worry about the future of Sun's JDK?
14:57djorklike, that they will be around at all?
14:57djorkare they financially sound at all?
14:57rsynnottcouldn't people just use the open-source version?
14:57rsynnottdjork: well, Oracle is supposedly buying them
14:57djorkoh great
14:57rsynnott(assuming that the EC can be satisfied)
14:58djorkI wonder how Oracle will treat the JDK
14:58djorkerr, JVM
14:58djorkwill they further its development or hinder it
14:59rsynnottprobably won't hinder it
14:59rsynnottthey're pretty java-dependent
14:59djorkyeah, I suppose so
14:59rsynnottof course, they may not be allowed to buy sun
14:59djorkright
15:00rsynnottthey will, of course, put it on a website of remarkable awfulness and make it harder to install
15:00rsynnott(that's pretty much Oracle's job)
15:00djorkyeah I can't wait for Oracle Java 9-16R Enterprise Edition
15:01lisppaste8rhickey pasted "protocols gen interfaces" at http://paste.lisp.org/display/91296
15:04chouserbar-me takes either 1 or 2 args?
15:04rhickeyright
15:04chouserI was sure for several moments that it was taking 1 arg and returning a vector length 2, and was trying to figure out where y was coming from.
15:06rhickeyso you can implement protocols in deftype, and reify protocols
15:06rhickeyall of this is dynamic
15:07chouserthat's really seamless
15:07rhickeymunging occurs on the names in deftype and reify
15:08rhickeystill not sure about (.foo [] ...) vs (foo [this] ...)
15:08rhickeyI know the crowd here wanted explicit this
15:09Chousukethe argument lists in deftype managed to throw me off somewhat already.
15:10rhickeyright now deftype and reify don't know or care that P is a protocol
15:11rhickeywhatever happens should be the same for interfaces and protocols (really, there are only interfaces in deftype and reify)
15:11rhickeyexplicit this would align better with protocols, and less well with interfaces coming from JAva
15:12rhickeythe leading dot also seems weird if you are working only with protocols and deftype
15:15lisppaste8rhickey annotated #91296 "w/explicit this" at http://paste.lisp.org/display/91296#1
15:16rhickeyexplicit this, no dots
15:16rhickeyseems a better match for protocols
15:16LauJensenrhickey, so both explicit and mandatory for each method?
15:17rhickeyLauJensen: whatever it is would be the same story for all methods, from interfaces and protocols
15:17Chousukeyeah, I like that better. it's more functional in style anyway
15:17rhickeyyou don't have to call it this, you could do [_] when you don't use it
15:17rhickeyor call it me or self or whatever
15:18Chousukeor it could be "handler" or whatever the object actually represents :P
15:18LauJensenrhickey, I think implicit this would be much more elegantly and feel quite natural in the jvm
15:18ChousukeLauJensen: looking at the previous example, I have to disagree with that :/
15:19LauJensenoh ok, np. good to have more views :)
15:19Chousukeit fits the java way where you have objects and "this" anyway, but it looks like magic in Clojure core. :P
15:19Chousukecode'
15:19arbschtI look forward to using clojure outside of the jvm. explicit would be nice ;)
15:19rhickeybasic interface use of reify would be: (reify [ActionListener] (actionPerformed [this evt] ...))
15:20LauJensenChousuke, I think ritually repeated the first argument which is a fixed ref to fixed is just ceremony in some regard
15:20ChousukeLauJensen: you don't have to always call it this.
15:20LauJensenI know
15:21ChousukeBut especially off-putting is the mismatch between defprotocol definitions and deftype definitions in the implicit this example :/
15:21ChousukeI'd rather have some ceremony than that.
15:21rhickeyI was very much in favor of implicit this when it was just about interfaces, now with protocols, alignment with protocols is primary concern
15:22rhickeypeople can use protocols, reify and deftype and never know about interfaces
15:22LauJensenSure, I didn't consider that. Consistency is supremely important
15:22LauJensenWhich reminds me, doesn't it seem odd that nth doesn't take the idx as its first arg? Or is that just a gut feeling?
15:24dnolenrhickey: interesting so do the latest changes allow you to create Java interfaces on the fly?
15:25rhickeydnolen: right now, only with defprotocol, still thinking about what definterface should look like
15:25rhickeybut the machinery is in place
15:26dnolenrhickey: crazee cool :D
15:28rhickeywhat about the parens-mean-calls folks? the leading dot seemed to ease that somewhat, without it do reify and deftype get hard to parse?
15:29LauJensenrhickey, not sure Im following, parens-mean-calls?
15:29chouserreify no worse than proxy. defprotocol and deftype somewhat better because of being rooted at the top level.
15:30rhickeychouser: I presume you like the explicit this?
15:30chouserI think 'case' is my new favorite punching bag on that front.
15:30rhickeythe dots really bother me when implementing protocols
15:31chouseryeah, I won't disagree with you there. I liked it when the only way you would call it was also with a dot, but defining with a dot and calling without just makes no sense.
15:31chouserfor explicit this, I was going to check the logs to make sure I didn't disagree with myself...
15:32rhickeytwo other niggles are - in defprotocol, multiple arity goes in same form, in reify/deftype, multiple forms
15:32notallamawith explicit this, you could destructure it, yes?
15:32chousernotallama: nice!!
15:33rhickeyand, my.ns/Protocol (the protocol itself) my.ns.Protocol (the interface we don't want to talk about but need to name in reify/deftype)
15:34rhickeynotallama: not right now, no
15:34chouserI guess you'd only be destructuring fields that you already have direct access to, right?
15:34chouseror ... wait, I'm confused. do we have direct access in all contexts?
15:34rhickeychouser: yes
15:35rhickeybut bigger issue is these methods are not fns, don't have any destructuring of any args yet
15:37chouserI'm just not keeping up.
15:37chouserbut that's ok. It's not as if me keeping up helps anyone. :-)
15:38rhickeychouser: not true!
15:38rhickeywhat's unclear?
15:38chouserI'll catch up eventually.
15:39chousermy mental construct is a fragile collection of various versions of various of these pieces. stop thinking about it for a holiday weekend and I've got hardly anything left.
15:39rhickey:)
15:40rhickeywell, if I can iron out these few details I'll finish up and modify the docs to align
15:40rhickeyseems like few people would want the dot given protocols
15:40rhickeyandfew would want implicit this either
15:41rhickeyI guess people will have to use it a bit to see if my.ns/Protocol (the protocol itself) vs my.ns.Protocol (the interface) poses a problem
15:42rhickeydestructuring support would be nice, would need to make reify a macro
15:44chouserextend still takes maps of real fns, right? so destructuring and closures are there.
15:45rhickeychouser: yes, all that is the same
15:45chouserreify now works on protocols because each protocol has a matching interface.
15:45rhickeynew today is defprotocol gens interface, opening up existing interface impl support in deftype and reify to protocols
15:46chouserI forget if reify does closures
15:46rhickeyreify is a closure essentially
15:46notallamaman. this was already my favourite type system about a week ago (when i tried new). and it keeps getting better
15:47rhickeysee x in the paste
15:47chouserok, right. the fields of the reify class are the closed-overs
15:47rhickeyright
15:48chouserthe methods of the reify class have direct access to its fields in the same way any closure does. But it also has methods as allowed by the interface as always but now also protocols.
15:49chouserdeftype has been about interfaces, but now can do protocols as well. Does it just use the interface? Does that mean it's not splitting its body into deftype/extend?
15:49rhickeychouser: right, but the trick is to come up with the story from the other direction - imagine you don't know Java, and have been shown protocols and deftype. You can etend a type to a protocol externally or internally
15:50solussdcould somebody explain the difference between send and send-off?
15:51rhickeyexternally with extend or extend-type, internally by putting ____ (called my.ns.Protocol) in square brackets and the definitions inline. The inline definitions have direct access to your fields, but are not closures over surrounding lexical scope (usually none)
15:51rhickeyadditionally, you can do one-off implementations of a protocol with reify
15:51notallamasolussd: send uses a fixed-size thread pool, send-off uses a variable-sized one. so, send can get clogged if you have slow/blocking functions, basically.
15:51SergeyDidenkoSolussd, http://clojure.org/agents
15:52rhickeynote the absence of 'interface' in the above description
15:52rhickeyperhaps interface must unavoidably go in ____ above
15:52polypusrhickey. was there any audio/video of your semantic talks ever released. google aint giving me anything. any plans for other talks on same subject?
15:53solussdthanks, http://clojure.org/agents doesn't explain the implementation difference, only usage scenarios.
15:53rhickeypolypus: not as far as I know
15:53chousernot just "protocol name" for the ____?
15:53polypusrhickey: thx
15:54rhickeychouser: yeah, the trouble is my.ns/Protocol also names the protocol object
15:54rhickeywhich is what you'll need for extend*
15:54chouseroh, I see.
15:54SergeyDidenkosolussd, indeed. I thought I saw it there.
15:55rhickeychouser: that's one of the current niggles
15:56SergeyDidenkosolussd, http://java.ociweb.com/mark/clojure/article.html#Concurrency see "Agents" section
15:56chousersurely anything that expects a protocol object my.ns/Protocol can figure out the interface name?
15:56SergeyDidenkosolussd, it's a great artcile BTW
15:56solussdSergeyDidenko: excellent, thanks. I'll read it
15:57rhickeychouser: right now deftype and reify don't know about protocols
15:57SergeyDidenkoIs the simplest way to translate '(n1 n2 n3 ...) into ((1 n1) (1 n2) (1 n3) ...) is to use "(partition 2 (interleave (repeat 1) '(n1 n2 n3 ...)))" ?
15:57rhickeybut yes, given a protocol instance P the interface name is (:on P)
15:59chouser,(map #(list 1 %) '(n1 n2 n3 ...))
15:59clojurebot((1 n1) (1 n2) (1 n3) (1 ...))
15:59rhickey,(map list (repeat 1) [2 3 4 5])
15:59clojurebot((1 2) (1 3) (1 4) (1 5))
16:00SergeyDidenkoOh, I completely forgot about map :) Thank you
16:01rhickeywe'd need to yank some innards from fn to enable destructuring in deftype and reify
16:01chouserrhickey: ok, I see. So either deftype and reify have to be taught (a little) about protocols, or users need to know about the two names for the protocol and when to use each.
16:07alexykanybody here using clojure maven plugin?
16:07konrIs there a parser generator for clojure?
16:08carkkonr : fnparse
16:09hiredmanthat is a parser, not a parser generator, innit?
16:10carkhum, at the end that's doing the same thing no ?
16:13alexykany nice wrappers around joda time?
16:15chouseralexyk: I think the consensus has been it doesn't really need a wrapper.
16:16alexykchouser: Scala adds things like < operator
16:16alexykcan you redefine < for DateTime in clojure?
16:17alexykor, define
16:17chouserno
16:17alexykhi mattrepl! I was just looking at your neo4j wrappers yesterday
16:17alexykchouser: makes it easier :)
16:18cemerickmmm, operator overloading.
16:18chouseralexyk: I can see that. I dunno if we'll get a protocol for < or not.
16:18cemerick154227134 < some-date-obj, yay ;-P
16:18mattreplhey alexyk, cool! they don't do much but hope they were useful
16:19alexykmattrepl: I was just poking around... found several. Yours is just one file, right?
16:20alexykchouser: protocol is the OO parlance, right?
16:20chouserprotocol is a Clojure feature in the "new" branch
16:20chouserBut I guess I'm referring to a future beyond that: clojure-in-clojure
16:21mattreplalexyk: yup
16:22alexykhow do I translate this Java into Clojure: DateTimeFormat.forPattern("<fmt>")?
16:22chouseralexyk: (DateTimeFormat/forPattern "<fmt>")
16:22chouseralexyk: that's the pattern for static method calls.
16:22alexykah right. I was trying (.forPattern DateTimeFormat.forPattern "...") and it was not finding it.
16:23twbrayWhile you guys were Thanksgiving-ing, I was pounding away on Clojure with big data: http://www.tbray.org/ongoing/When/200x/2009/11/26/No-Free-Lunch
16:23alexykI mean (.method Class "param")
16:24alexyktwbray: nice! I was an eager collector of the Wide Finders scripts back in the day! Are you still running any?
16:24chouseralexyk: right, that would be treating DateTimeFormat like an instance of the Class class, looking for a method Class::forPattern or something.
16:25bitbckt"back in the day"... has it been that long, already?
16:25twbrayalexyk: Yep, technology moves along.
16:25alexyktwbray: the Perl lead was mindboggling
16:26alexyktwbray: we need a Scala/Clojure shootout with agents vs actors
16:26rhickeychouser: ok, that's better, so now after doing (defprotocol P ...) you can just do (deftype Foo [a b c] [P] ...)
16:27alexyktwbray: how about a JVM-only Wide Finder?
16:28alexyktwbray: tweak your GC's, do whatever. Same Sun JDK; or may be OpenJDK and others, too.
16:28twbrayalexyk: JVM is crippled on this problem compared to systems that don't have to turn texts into UTF-16 :(.
16:28chouserrhickey: deftype will take either an interface or a protocol object?
16:29alexyktwbray: then some other problem with juicy concurrency :)
16:29hiredmanyou just need a regex engine that takes bytes
16:29alexykregex there was a weak link allowing a perl lead even
16:29twbrayhiredman: Trying to make it *easy* for programmers. They just want to see strings.
16:30chouserhiredman: that's a good point. is there no string/regex lib for java that uses utf8 internally instead of 16?
16:31alexyktwbray: UTF-16 will work on Chinese web logs :)
16:31twbraychouser: There might be, but irrelevant. You wanna live in the java ecosystem, you got to live with Java strings :(
16:32chouserhmmm
16:32twbrayAnyhow, not really relevant. The fact that Java burns CPU on this means that concurrency should be *more* valuable on a many-core system, deal the computing out.
16:35cemerickI'm a similar position as a few commenters on that post: does it matter at all, as long as wall-clock time is what it should be?
16:35alexykDmitriy talks of teams of 10 employers doing work in 1 day, very post-modern :)
16:35cemerick(outside of wattage burned, perhaps?)
16:37twbraycemeric: I'm not really sure whether or not the amount of CPU burned is significant. But it's still surprising. Anyhow, a speedup factor of four based on straightforward use of Clojure primitives without too much voodoo is obviously good.
16:38cemericktwbray: I guess my confusion is around what exactly a cpu cycle is, if not a corollary to a unit of time.
16:39twbraycemerick: In practical terms, what it means is, how many of the machines cores are in use & not available for other work.
16:39twbrayOn this computer, for every unit of time, there are 16 units of integer computing potentially available.
16:39chouserseems like it might matter a lot in a world of on-demand provisioned virtual machines billed by number of comuter-hours used.
16:39alexyktwbray: a bit offtopic, but perhaps you can shed the light. I got a box with 8 quad-core CPUs, but top never shows loads more than 800% CPU. In such setups, is it because 100% CPU is counted per each quad-core? It's a Barcelona Intel x86_64 each. Can such a system run 32 threads at once?
16:40cemerickchouser: thus my wattage remark. Thankfully a world I've no involvement in.
16:40rhickeychouser: yes, interface or protocol designators
16:40twbrayalxyk: Don't know, depends on details of processor architecture & how it reports CPU time to the OS and how the OS reports to you.
16:46tmountainalxyk: make a shell script, and put one of these per line, per core - while [ 1 ]; do :; done &
16:47tmountainalxyk: go into top after that, and you should easily be able to tell what your system reports when it's maxed out
16:50the-kennyI have a file with little-endian utf16-text. How can I read the file in clojure?
16:50bitbcktheh
16:50SergeyDidenkothe-kenny, play with *default-encoding* ?
16:51twbraythe-kenny: (def decoder java.nio.charset.Charset forName "UTF-8") newDecoder))
16:51twbrayOops, that UTF-8 should be UTF-16LE for you
16:51twbraythe-kenny: Then you can call (. decoder decode) on a buffer
16:52Chousuke(.newDecoder (java.nio.charset.Charset/forName "UTF-16LE")) would be more idiomatic. :)
16:52alexykis there any shorthand for the following two imports: (import [org.joda.time DateTime]) (import [org.joda.time.format DateTimeFormat]) -- or they have to stay separate?
16:53the-kennytwbray, Chousuke: Thanks, I'll try that :)
16:53Chousukealso (.decode decoder args) (assuming it's an instance method)
16:54ChousukeI will never stop trying to wean people away from using . directly. :)
16:56ChousukeIt is, after all, in my best insterest to have people write code that I find readable :P
16:56Chousukebut I digress.
16:57alexykChousuke: is there any alternaive to, e.g.: (.parseDateTime dtFmt "2009-06-15 04:01:00") ; ?
16:57Chousukethat's the proper sugared form I think.
16:58alexykChousuke: ah, you mean (. <space> ...)
16:58Chousukeyeah.
16:58Chousukealso, I don't think there's any way to unify those import statements
16:59Chousukethough usually you'd have them in the ns declaration
16:59Chousukeeg. (ns (:import (org.joda.time.format DateTimeFormat) (org.joda.time DateTime)))
16:59alexykChousuke: I noticed that both Clojure and Scala abbreviate importing a list from the same package, but not across e.g. nested supbpackages. Is it based on JVM innards for import?
17:00Chousukealexyk: subpackages and their parents are not actually related in any way, except by name.
17:01Chousukeit is possible to extend the ns macro to support (foo.bar subpackage.Class AnotherClass) but I don't know if that could create ambiguities.
17:02alexykChousuke: ah, I forgot it's a lisp and we got macros! would be cut to write a different ns and annoy people :)
17:02Chousukeheh.
17:03Chousuke(my-ns foo.bar (import-my-stuff))
17:03jasappis there a better way to do this?
17:03Chousukeyeah, you could do that but you shouldn't :P
17:03jasapp,(apply hash-map (list 1 2 3 4))
17:03clojurebot{1 2, 3 4}
17:04Chousuke,(hash-map 1 2 3 4); like this?
17:04clojurebot{1 2, 3 4}
17:04jasappwell, if the argument has to be a list
17:04Chousukeah, then no.
17:04alexykok, so I see two different ways to interop with Java here: (.parseDateTime dtFmt "2009-06-15 04:01:00") and (. dtFmt parseDateTime "2009-06-15 04:01:00"); but this doesn't work: (dtFmt. parseDateTime "2009-06-15 04:01:00")
17:04alexykwhen do you use the form (Class. method ...) ?
17:05Chousukethe Foo. form is short for new Foo
17:05jasappthanks
17:05alexykok
17:05ChousukeAbout Foo. and new Foo I don't really care which one you use. at least new is an informative operator, unlike . :P
17:07alexykyeah, Class. method is confusing
17:08alexyk(new Foo) is clearer
17:10ChousukeThe Foo. syntax is convenient when you need to wrap things though.
17:10the-kennyhm... looks like the text isn't utf-16.. stupid windows mobile
17:10Chousukelike (BufferedReader. (FileReader. ...))
17:11alexykright
17:12alexykcan it be done with .. though?
17:12alexykor not for nested new's?
17:12Chousukeno.
17:12Chousuke.. is for calling methods
17:12Chousukethough I prefer using -> with .methods :)
17:13alexykChousuke: how would that work in my parseDateTime example above
17:13alexyk?
17:14Chousukewell, it's not very useful in that case
17:14Chousukebut (-> dtFmt (.parseDateTime "2009-06-15 04:01:00"))
17:16alexykhmm... slightly bigger than (. ...) :)
17:16alexykcan see better :)
17:16Chousukeyeah, but the real use is when you have a pipeline of operations
17:17Chousuke,(-> "foobar" (subs 2 4) .toUpperCase); especially if you need to mix clojure functions and java methods
17:17clojurebot"OB"
17:18alexyknice
17:19Chousukeor if you need to look up something in a deep data structure
17:20Chousuke,(-> {:foo {:bar {:a 3 :b 1}}} :foo :bar :b)
17:20clojurebot1
17:20alexyknow that's useful even in clojure-only!
17:23Chousukeit's actually a macro
17:23Chousukeit just reorders the operators a bit
18:50defnhey all
18:54defnI have this silly thing where I'm searching for tweets which contain #"regex" -- I'd like to create two instances of this search, 1000 tweets each, and then combine their state
18:54defnthis is something I'd use refs for, yes?
19:00defnnvm
19:39rhickey_ok - latest deftype/reify implements all discussed - no dots, no implicit this, can use protocol directly in deftype/reify protocol/interface lists, updated docs
19:41KirinDaveIs there a special "last result" variable for the clojure repl?
19:41KirinDaveI heard there was one, but I honestly can't find it.
19:41rhickey_*1
19:41rhickey_*2 *3 too
19:41KirinDaveThanks.
19:41defnthere's also one for errors
19:41defn*e I believe
19:41defnexceptions, rather
19:41defn,*e
19:41clojurebotjava.lang.IllegalStateException: Var clojure.core/*e is unbound.
19:42KirinDave,*1
19:42clojurebotjava.lang.IllegalStateException: Var clojure.core/*1 is unbound.
19:42defnhehe, not here though :)
19:42KirinDaveHeh
19:42cemerickheh, no more dots on method impls, eh?
19:45rhickey_cemerick: no, they don't match protocols well at all
19:45cemerickah, consistency. Well, I really liked them while they lasted. :-)
19:45rhickey_I think they made sense without protocols, but I want protocols to be the primary story, since now it is so good
19:46cemerickyeah, no argument from me
19:47KirinDaveIs there a new description for protocols
19:47KirinDave?
19:47KirinDaveBesides the old thread on the list?
19:48rhickey_KirinDave: I'm tweaking the wiki now, but the inline (doc ...) should all be correct, for reify, deftype, defprotocol etc
19:48defnIs there any ongoing effort to provide real-world examples for the api documentation?
19:49KirinDaverhickey_: I will start fanatically clicking the refresh button in anticipation. :)
19:50KirinDaveI'm excited about things that make noun-y programming a bit easier.
19:51rhickey_KirinDave: I'm not sure this does that
19:52defnI'm interested in building an expanded documentation project that adds some real world examples to the api documentation.
19:52defn(where appropriate)
19:52defnFor things like (ns) it could be nice to have somewhere to document that sort of thing
19:52KirinDaverhickey_: My use case is very banal. I've been bugging people here about a foosball scoring webapp.
19:53KirinDaverhickey_: And I find it kind of tedious to have to write things like make-player and make-team.
19:53rhickey_defn: there is this: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Cookbook
19:53_mstdefn: how about http://en.wikibooks.org/wiki/Clojure_Programming?
19:55defnThat's pretty nice, I guess I would like to see something like ruby-doc.org/core
19:55rhickey_defn: not trying to discourage you, contributions welcome
19:56defnrhickey_: would it make sense to start a new project, or to submit to you additions to the current api documentation?
19:56rhickey_defn: the api doc is reference-style and is likely to stay that way
19:58KirinDaveis clojure.contrib.seq-utils open for suggestions?
19:59KirinDaveJust via the normal github process maybe?
20:00rhickey_KirinDave: there is the ggroup and contrib assembla
20:17rhickey_https://www.assembla.com/wiki/show/clojure/Datatypes and https://www.assembla.com/wiki/show/clojure/Protocols updated, feedback welcome
20:18rhickey_this all feels good to me now, please try it out
20:23bitbcktI don't think I've seen this asked, but forgive me if it has been...
20:23bitbckt"resulting functions dispatch on the type of their first argument"... why only the first?
20:24rhickey_bitbckt: there are multimethods if you want to do other than that
20:24rhickey_protocols let you reach the highest level of polymorphism perf available on the platform
20:25bitbcktI see. Multimethods are still to be preferred for multiple dispatch, then.
20:25rhickey_bitbckt: no other choice for that
20:26bitbcktOkay. Thanks. :)
21:14arohnerI have a protocol. I have a deftype that implements a method on the protocol's interface. In my deftype declaration, I'm getting clojure.lang.Var cannot be cast to java.lang.Class
21:14arohnerlisppaste8: url?
21:14lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
21:15chouserrhickey_: what about allowing (defprotocol P (bar [x] [x y])) for multiple args, rather than (bar ([x] [x y])) ?
21:15lisppaste8arohner pasted "deftype" at http://paste.lisp.org/display/91318
21:15rhickey_chouser: maybe, where do docs go?
21:16rhickey_I agree the grouping is unintuitive
21:16chouserhm, at the end I guess, where they do now.
21:17chousername, vectors, then a string.
21:18lisppaste8rhickey annotated #91318 "deftype for latest" at http://paste.lisp.org/display/91318#1
21:18chouserarohner: your deftype doesn't look quite right
21:18rhickey_see annotation ^
21:19rhickey_no dots anymore, no [] around methods
21:19arohnermy checkout is probably a week old. I'll update.
21:21rhickey_arohner: yeah, the version you are using doesn't support protocols in deftype
21:21arohnerah! that would be a problem. thanks
21:22chouserheh. This error message seems like it ought to be informative enough.
21:22chouserNo single method: foo of interface: user.Foo found for function: foo of protocol: Foo
21:23hiredmanouch
21:23chousermaybe if I used names better than "foo" it would help :-P
21:26rhickey_chouser: what were you doing?
21:27chouserooh, I can use 'show' to see the protocol methods implemented directly by a deftype
21:27chouserrhickey_: just playing at the repl
21:27chouser...and I see what I did wrong.
21:28chouserso methods defined inline in a deftype get real methods in the resulting class, right?
21:28rhickey_yes
21:28chouserbut anything added via extend doesn't?
21:29rhickey_right, can't, class is baked
21:29chouserright, makes sense.
21:31arohnerso where do methods added via extend go?
21:32rhickey_they are fns in maps
21:33rhickey_stored in protocol itself
21:34chouserso, faster than multimethods but not as fast as a case or direct method call?
21:35rhickey_as fast as call through var, given caching. Doesn't lookup every time
21:36chouserok, nice.
21:36dnolenrhickey_: so I saw that you mean somewhere that the inclusion of deftype will remove the need for type metadata pattern? or am I dreaming that up andi it's still useful? :)
21:37dnolenmean -> mention
21:37chouser(deftype Foo [a b c] [] (foo [this] <<here>>)) ; at <<here>>, 'a' is the same as '(:a this)'?
21:37rhickey_dnolen: well, protocols won't use type metadata, so I expect it to fall by the wayside
21:38rhickey_chouser: there a is the same as (.a this)
21:38hiredmanchouser: did you see my fn minus
21:39rhickey_looks like external protocol defs are broken, aargh
21:39chouserhiredman: no I didn't.
21:40dnolenrhickey_: so you expect that people that really want to define a type, will just use deftype over map plus metadata?
21:40rhickey_dnolen: yes
21:41hiredmanhttp://paste.lisp.org/display/91148#1 this was more or less sitting in my head when I woke up thanksgiving morning
21:41dnolenrhickey_: duh, I forgot that deftype creates a type tag for you. It's so magical! :)
21:44chouserhiredman: did you just toss together a little tree-walking macro!?
21:44hiredmanoh, it just uses tree-seq
21:45hiredmanvery simple, which is why I called it fn minus, I was just kind of tickled by how easy it just falls out
21:46chouserso that's an implementation of fn in terms of deftype.
21:46chouser?
21:46hiredmanwell AFn needs to be a protocol
21:47hiredmanhmmm
21:47efarraris there a mechanism to override/overload java methods from clojure? I'd sure love it if javax.swing.JContainer#setPreferredSize() took a height and a width, and not a java.awt.Dimension
21:47hiredmanIFn would be the protocol and AFn would just be a map of functions you can mix in
21:48JAS415efarrar: proxy?
21:48efarrari'll check it out
21:48efarrarthanks
21:48hiredmanchouser: so yes then
21:49efarrari thought that was just for interfaces
21:49hiredmanproxy doesn't let you create new methods
21:50hiredmanefarrar: just write a function
21:51hiredman(defn set-prefered-size [jcontainer height width] (.setPreferedSize jcontainer (Dimension. width height)))
21:53efarrarfair enough
22:01rhickey_ok, all fixed, grab latest if playing with new branch
22:08arohnerhrm, github is lying.
22:09arohnergit pull says I'm up-to-date, but the commit id doesn't match the github UI
22:09hiredmanhave to wait for the latest commit to replicate out
22:10arohnerthis time it worked
22:13BaseHi
22:15rhickey_Hi
22:21arohneris there a way to specify a default method for a protocol?
22:22arohnerfor all types
22:22rhickey_extend to Object
22:22hiredmanmaybe extend the protocol on Object?
22:23hiredmanahem
22:23hiredmanextend to
22:23rhickey_will cover everything except nil
22:23rhickey_you can also extend to nil
22:23arohnerthanks
22:25dnolenrhickey: can extend be used to add metadata support to fns?
22:25rhickey_dnolen: no
22:36dnolentechnomancy: do you have to run lein install in the lein-swank directory first?
23:10JAS415hmm
23:10JAS415i'm having trouble with the pprint package
23:10JAS415,(clojure.contrib.pprint/cl-format nil "~s" 1)
23:11clojurebotjava.lang.ClassNotFoundException: clojure.contrib.pprint
23:11alexykis there any BitSet wrapper in clojure, or just JDK BitSet?
23:13The-KennzJAS415: have you clojure-contrib.jar in your classpath?
23:14technomancydnolen-rec: I pushed out lein-swank under the leiningen group
23:14dnolentechnomancy: just now?
23:14JAS415yup
23:14JAS415been using all of the other contrib stuff
23:14technomancydnolen: no, a few days ago
23:15dnolentechnomancy: so here's the deal, lein swank only works for me from the lein-swank folder in the leiningen checkout directory
23:15dnolentechnomancy: i can't get it to work at all outside that directory.
23:16technomancydnolen: have you declared it as a dev dependency of the project you want to use it on?
23:16dnolentechnomancy: yup
23:16technomancycan you paste your project.clj?
23:16dnolen:dev-dependencies [[leiningen/lein-swank "1.0.0-SNAPSHOT"]]
23:16dnolenhttps://gist.github.com/4cefd43eca404c351f22
23:17dnolenI added the swank-clojure dependency as a debug shot in the dark, I don't think that's required
23:17technomancyno, it should get pulled in automatically
23:17technomancyah, did you run lein deps to pull in all the dependencies?
23:18dnolentechnomancy: here's the stack trace when I run lein deps
23:18dnolenhttp://gist.github.com/246047
23:19The-KennzWoho, I love lein-swank
23:19technomancywow; crazy. I'll clear it out of my local repo and try again
23:19dnolentechnomancy: should I do that as well?
23:19technomancyyou could try it.
23:19dnolenlike erase everything out of ~/.m2 ?
23:20dnolentechnomancy: erase whole directory or just the subdirectories?
23:20technomancyI can't repro. =\
23:20technomancyah: "Unable to store local copy of metadata"...
23:20technomancymaybe it's just a permissions thing
23:20technomancytry chowning and chmodding ~/.m2 first
23:22dnolentechnomancy: yup permissions
23:22dnolenthx
23:22dnolenlein rulez
23:22technomancycool; did you previously run lein as sudo or something?
23:23dnolenI probably did nonsensically at some point yes :P
23:23technomancywell if you're used to rubygems or something... =)
23:24alexykI get an error in maven witrh clojure plugin, when it tries compiling a script which feeds fine into a repl: java.lang.Exception: Unable to resolve symbol: only in this context. Points to a line which is fine in repl, no actual symbol shown... is it normal?
23:24dnolentechnomancy: yeah, Python also encourages the overly eager use of sudo.
23:25dnolentechnomancy: I started a wiki stub, is lein install necessary from the lein-swank directory at all?
23:25dnolenor does it just get pulled in?
23:28technomancydnolen: it should be able to pull it from coljars
23:28technomancy*clojars
23:28dnolentechnomancy: does lein swank work on the stable branch work, or do you have to be on the master branch?
23:29alexykhow do you replace the first space in a string by a T ?
23:30arohneralexyk: have you see clojure.contrib.str-utils2?
23:31alexykarohner: not yet!
23:31technomancydnolen: I think it might work on 0.5.0 but haven't tested it
23:32alexykwhere's the standard docs for contrib? in fact, what do you guys have instead of javadoc/scaladoc? :)
23:34the-kennyalexyk: http://richhickey.github.com/clojure-contrib/index.html
23:34alexykthe-kenny: thx!
23:35arohneralexyk: there's also (doc function-name) and (find-doc string) from the repl
23:35arohner,(doc map)
23:35clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
23:35alexykso does clojure have thingies to generate API docs a ;a javadoc?
23:35alexyka la
23:35alexyka lá
23:36cark"à la" =)
23:36arohneror (find-doc "replace")
23:37alexykcark: finally my wrong pattern is corrected by a Francophone! :)
23:38cark=)
23:38alexykcark: or should I say a Walloon? :)
23:38carkindeed
23:40alexykso how did rhickey generate those docs?
23:41carkyou mean the docs from (doc some-function) ?
23:41carkor a la javadoc ?
23:42alexykcark: the docs on the website, http://richhickey.github.com/clojure-contrib/str-utils2-api.html -- or is it just a concatenation of the doc strings from the defn's?
23:42arohneralexyk: those are just the doc strings on the defns
23:43alexykarohner: ok
23:43arohnerand on the namespace
23:46alexykhow do I import just that replace from a repl, not from ns macro?
23:46alexykrepl complains about: (use 'clojure.contrib.str-utils2 :only [replace])
23:48The-Kennzalexyk: alexyk There's already a replace in clojure.core
23:48alexykand if I want to import str-utils2 as a whole, I get: repeat already refers to: #'clojure.core/repeat in namespace: user
23:48alexykis it predefined in core too?
23:48The-Kennzalexyk: You have to import like this: (use '[clojure.core.str-utils2 :as strut]) and use like this: (strut/replace ...)
23:49KirinDaveThe-Kennz: You mean require, right?
23:49The-Kennzalexyk: But that's mentioned in the doc for str-utils2
23:49alexykah ok
23:49The-KennzKirinDave: Yes.. I always forget when I have to use which one ;)
23:50The-Kennzalexyk: (require '[clojure.contrib.str-utils2 :as s]) says the doc
23:50alexykbtw, (doc clojure.contrib.str-utils2) is nil
23:51The-Kennzalexyk: doc prints the meta-description for a var, clojure.contrib.str-utils2 isn't a var
23:51The-Kennz,(doc doc)
23:51clojurebot"([name]); Prints documentation for a var or special form given its name"
23:51alexykah ok
23:53alexykso if I have a Java BitSet as state, do I have to wrap it in any refs or atoms?
23:55tomojclojure concurrency won't help you there
23:56alexyktomoj: I wonder if I need any by law :)
23:57hiredmanalexyk: refs, atoms, agents, etc, are designed to hold immutable things
23:57alexykwhat is defn- ?
23:57notallamaprivate defn
23:57alexyknotallama: what's the private scope?
23:58the-kennyalexyk: Functions defined by defn- don't get exported from its namespace
23:58tomojI suppose if you wanted to just have a bitset as state which gets replaced with an entirely new bitset but is never changed itself, you could use refs/etc
23:59technomancydnolen: did you send that github message before you got everything sorted out?
23:59alexyktomoj: I need a map with millions of keys with small bitsets hanging off the leaves... The map may be worked in parallel, but the leaves must be updated atomically