#clojure logs

2009-11-12

00:00tomojI guess i can just do nested tests and put a binding around the main caller
00:51durka42does add-break-thread! still exist?
00:52chouserI think so, in repl-utils
00:52chouseris it not working?
00:52durka42oh, there it is
00:52durka42still useful :)
00:53chouserstill violating Java deprecation warnings :-)
02:07stephenjclojurebot: latex \sum_{now}^\{eternity} all knowledge
02:08stephenjclojurebot: latex \sum_{now}^{eternity} all knowledge
02:08stephenjclojurebot: latex \sum_{now}^{eternity} {all knowledge}
02:09stephenjclojurebot: latex \sum_{now}^{future} knowledge
02:09stephenjclojurebot: latex \sum_{past}^{future} knowledge
02:13stephenjclojurebot: latex \size=5/5 \sum_{past}^{future} knowledge
02:13_ato~latex \sum_{t=0}^{\infty} \rm{knowledge}
02:14stephenj_ato: any idea how to make a bigger image?
02:14clojurebota is b
02:15_ato\Large \LARGE
02:15_ato\huge
02:15_ato\Huge
02:16stephenjclojurebot: latex \large \sum_{past}^{future} knowledge
02:16stephenjclojurebot: latex \LARGE\sum_{past}^{future} knowledge
02:16stephenjclojurebot: latex \HUGE\sum_{past}^{future} knowledge
02:17stephenj_ato: LARGE and HUGE seem to work
02:17stephenj~latex \LARGE\sum_{t=0}^{\infty} \rm{knowledge}
02:18stephenj~latex \HUGE\sum_{t=0}^{\infty} \rm{knowledge}
02:19stephenj~latex \Red\HUGE\sum_{t=0}^{\infty} \rm{knowledge}
02:20stephenj_ato: Thanks
02:23stephenj~latex \HUGE\sum_{past}^future \rm{knowledge}
02:23stephenj~latex \HUGE\sum_{past}^{future} \rm{knowledge}
02:30hiredmanfyi you can use chs=250x100
03:39hiredman,(doc close)
03:39clojurebotTitim gan éirí ort.
03:45hiredman(-> url URL. .openConnection .getInputStream ((juxt clojure.xml/parse #(.close %))) first)
03:47ordnungswidrighi
06:01stephenj~latex \chs=250x100\sum_{t=0}^{\infty} \rm{knowledge}
06:18stephenj~latex \Huge\sum_{t=0}^{\infty} \rm{knowledge}
06:21stephenj~latex {\chs=250x100\sum_{t=0}^{\infty} \rm{knowledge}}
06:21stephenj~def slurp
06:35stephenj~latex \Huge\sum_{t=0}^{\infty} \textcolor{red}\rm{knowledge}
06:36stephenj~latex \Huge\sum_{t=0}^{\infty} \rm\textcolor{red}{knowledge}
06:37rhickeycemerick: proper deftype field name support was a one-liner - the rest of the code was using munged names already
06:37rhickeyhttp://github.com/richhickey/clojure/commit/c58a6cfaf5788a104f4a1dcb488f731ad94a2da0
06:37stephenj~latex \textcolor{red}{knowledge}
06:37cemerickrhickey: very nice :-)
06:37stephenj~clojurebot
06:37clojurebotclojurebot is not a benchmarking platform
06:38stephenj~def clojurebot
06:38clojurebotTitim gan éirí ort.
06:38stephenjclojurebot: location?
06:38clojurebotexcusez-moi
06:38stephenjclojurebot: where are you
06:38clojurebothttp://github.com/hiredman/clojurebot/tree/master
06:45AWizzArdIs there a way to do find-doc limited on a specific namespace?
06:45AWizzArdmaybe find-doc can take an optional arg which may be a string, symbol or namespace object, denoting a namespace, or a vector containing such?
06:48penthiefI'm struggling to get this working in emacs -- what should I set the infereior-lisp-program to?
06:49stephenj~latex \Huge\sum_{t=0}^{\infty} \forall\rm{knowledge}
06:52stephenj~latex \Huge\sum_{t=0}^{\infty} \exists \rm{knowledge}
06:57stephenj~latex \Huge\sum_{t=0}^{\infty} \rm\forall\Bigg\{{knowledge}\Bigg\}
07:00stephenj~latex \Huge\sum_{t=0}^{\infty} \rm\forall\Bigg\{{\color{red}{knowledge}}\Bigg\}
07:02stephenj~latex \Huge\sum_{t=0}^{\infty} \rm\forall\Bigg\{{\color{red}knowledge}\Bigg\}
07:02stephenj~latex \Huge\sum_{t=0}^{\infty} \rm\forall\Bigg\{{knowledge+learning}\Bigg\}
07:17rhickeyfor the next time someone mentions ERlang, SMP and share-nothing in the same sentence:
07:17rhickeyhttp://www.erlang.org/pipermail/erlang-questions/2008-September/038231.html
07:19stephenj~latex \Huge\sum_{t=0}^{\infty} \rm\forsome\Bigg\{{knowledge+learning}\Bigg\}
07:20stephenj~latex \Huge\sum_{t=0}^{\infty} \rm\exists\Bigg\{{knowledge+learning}\Bigg\}
07:21rysIs there any way to interact with clojurebot privately? :p
07:21rhickeyyes, please
07:21AWizzArdrhickey: interesting link, thx
07:22stephenjsorry - i am stopping now
07:23AWizzArdKenneth Lundin is convinced that Erlang is the best in class, regarding utilizing multicore machines :)
07:24rysSmells somewhat like the Python GIL in terms of problems it'd have
07:30gerry_(defprotocol display (show []))
07:30gerry_java.lang.IndexOutOfBoundsException (NO_SOURCE_FILE:0)
07:30penthiefHi, I had clojure working with SLIME just after I ran clojure-install, but when I try to (require 'slime) I get (void-variable package-activated-list)
07:34gbtpenthief: so the clojure repl ran straight after you installed, but not when you restart emacs?
07:35penthiefgbt: Yes exactly
07:36_atopenthief: did you add (clojure-slime-config) to .emacs as the install process states?
07:36gbtthats what I was thinking, I missed it when I first installed clojure-mode
07:38_atomaven's source code is bizaire, it has all this weird magical dependency injection stuff
07:39_atomakes it take like 10 times as much effort to do anything
07:40penthiefNo I've can't find that suggestion in any of the READMEs. Which (require ) should that go after?
07:41gbtpenthief: no need for a require. The clojure-mode source code has a message telling you what to do
07:41_atopenthief: after you do the insall it pops it up in a buffer, saying something like "slime will break when you restart emacs unless you add this to .emacs" :P
07:42_atopenthief: just put it after you load package.el
07:42_atopenthief: or at the end of the file
07:42gbtmine broke, I was in such a rush to try clojure I never read the install instructions hehe
07:42_atoyeah, it should add it automatically like package.el does
07:43penthiefSymbol's function definition is void: clojure-slime-config. I think I'll start again again.
07:43gbtpenthief: do you use elpa? or the emacs starter kit?
07:43penthiefI have installed elpa, yes
07:44penthiefIt works!
07:44gbtcool, happy hacking :)
07:44penthiefYes, I reread where you said AFTER you load package.el
07:45_ato:)
07:45penthiefThere is some clojure event in London I am going to tonight, and I didn't want to be sorting out my environment when I should be learning. Thanks very much!
07:46gbtnice, a clojure event. I didn't know they had started doing them over here
07:47_atooh noes.. clojurebot died
07:48penthiefYeah, it's organised by LJC - London Java Community. I signed up the other week.
07:52_atoyay! I've got all the core pieces for clojars.org done now (basic web UI, database, repo deploy, jarspec/pom parsing, ssh+nailgun magic) just got to glue it all together, test, deploy and write some docs :)
07:53gbtI imagine the docs are the hardest bit :)
07:53jgracinHi! Why is this throwing ClassCastException: Condition cannot be cast to IObj: (new clojure.contrib.condition.Condition {:type :t})
07:54jgracinin clojure-contrib 1.0-compatible
07:56jgracinin REPL, while trying to display it.
07:59gbtjgracin: I've never used the condition stuff. Are you working from an example?
08:02jgracinNo specific example. I think it might have something to do with print-method, print-dup and Condition. The problem is not the Condition per se, but trying to print it.
08:03gbtdon't know if this helps? but in the clojure/contrib/condition/example.clj code they use print-stack-trace *condition*
08:04rhickeygerry_: (defprotocol display (show [] "some doc"))
08:05rhickeygerry_: doc is, er, required right now
08:06gerry_ok
08:09chouserah, that was my first comment for this morning. need a nil in the nth
08:09chouser:-)
08:09rhickeythat code needs some new code
08:09chouseroh
08:12gerry_rhickey: can defprotocol directly use field name of type in functions?
08:13rhickeygerry_: no, those are stand-alone functions, use (:field x)
08:14rhickeyI guess that nil is enough, still ugly
08:16rhickeyok, fixed
08:16gerry_nice
08:22gerry_(extend person display {:show (fn [] (println (:name person)))})
08:22gerry_(show me)
08:22gerry_java.lang.IllegalArgumentException: Wrong number of args passed to: user$eval--30$fn--32$fn (NO_SOURCE_FILE:0)
08:22rhickey(extend person display {:show (fn [a-person] (println (:name a-person)))})
08:23rhickeyall protocol fns should take at least one arg
08:23chouserand so it begins. :-)
08:23rhickeyI can add a check and error for that
08:24rhickeychouser: are you hinting at the disparity between this and deftype methods?
08:25chouserwell, really just harking back to our earlier conversation about deftype methods, but now that you mention it ...
08:25rhickeyI have thought about it, and there are just so many ways in which these things _are_ very diffferent
08:25rhickeymethods have field scope
08:26rhickeymethods are not first-class functions or values
08:26chouserthat is true -- deftype methods are rather less like functions than any function-like thing we've had yet.
08:26rhickeyprotocol functions have no private access to class
08:27rhickeymethods connect directly to interface methods, protocol fns indirectly mapped
08:27rhickeyso, calling them different things and distinguishing is going to be important
08:27chouserthe leading . acts as a little reminder to a lot of this.
08:28rhickeybut there simply is no 'implicit this' option for protocol fns if you want extend to be ordinary fn, and mixin maps
08:28rhickeychouser: yes
08:29chouserare - allowed in protocol method names now?
08:30rhickeywere they not?
08:31rhickeythey are newly allowed for deftype fields
08:31gerry_(extend person display {:show (fn [a] (println (:name a)))})
08:32gerry_(show me)
08:32chouseroh, ok -- I was avoiding them in an excess of caution
08:32rhickeychouser: obviously they won't map to an interface method without an :on
08:32chouserah, sure.
08:33gerry_java.lang.IllegalArgumentException: No implementation of method: :show of protocol: #'user/display found for class: user.person__1 (NO_SOU
08:34rhickeygerry_: (defprotocol display (show [x]))
08:34gerry_yes ,have done that
08:34rhickeypaste please
08:34gerry_i tried it on repl
08:35lisppaste8Chouser pasted "deftype is dominating me" at http://paste.lisp.org/display/90232
08:35gerry_ok
08:35chouseroh, hey, look at that
08:35rhickey(extend ::person display {:show (fn [a-person] (println (:name a-person)))})
08:36rhickey::person is the way to refer to a deftype type
08:37rhickeyextend ::D
08:37chouserah, thanks.
08:37rhickey(consl (D 5) 6)
08:37rhickey:consl #:D{:a 5} 6
08:38gerry_rhickey: change person to ::person, it works
08:39rhickey(doc extend) has that, will change wiki
08:40gerry_but i dislike the idea of "at least one arg"
08:40rhickeydeftypes are named by keyword tags
08:40rhickeygerry_: how could it choose the right fn to call without one arg?
08:41gerry_directly use fieldname of type
08:42rhickey?
08:43gerry_defprotocol should have java "this" alike implicit arg
08:44gerry_(.show me)
08:45rhickeygerry_: protocol fns are ordinary fns
08:45rhickeydefprotocol doesn't define any fns
08:45rhickeyare you suggesting defprotocol shoud say (show []) and extend should say (show [me] ...)?
08:46rhickeyer, :show (fn [me] ...)
08:46rhickeybecause it can be - :show some-existing-fn
08:47rhickeywhere some-existing-fn has nothing to do with protocols
08:47rhickeyi.e. extend is not a macro
08:48cemerickI'm mostly uninvolved here, but FWIW, I think protocols (like deftype) should be disconnected from the constraints/expectations of any particular host.
08:49rhickeycemerick: yes, but to what are you alluding?
08:49cemerickrhickey: mostly a tangential reference to gerry_'s invocation of a java-like 'this' arg
08:49rhickeyah
08:50kjellskiHi there =)
08:51cemerickI depend on Java interop constantly, but on *this* side of the fence, the more X-isms can be avoided, the better (unless they are actually positive design decisions in their own right)
08:51gerry_yes, (defprotocol display (show [x])) what is x ? abit weird,i think
08:52rhickeycemerick: yes, that's a huge design point of reify/deftype/protocols
08:52chouserit'll be very interesting to see how well it fits into various hosts
08:52rhickeygerry_: but confusing no, when defining the fn, that it take one more arg than the spec?
08:53Bart001hey everyone, need some help concerning to interop with java. i just started with clojure, so sorry for dumb qeustion. Is it possible to create a java object in clojure, to name the object and to reuse it, maybe as a parameter in a funciton in clojure?
08:53rhickeychouser: with no :on in protocols or interfaces in deftypes, should be pretty simple
08:54chouserHaving tried Javascript, I don't expect that or other "normal" OO hosts to be a problem: clr, parrot, python, ruby
08:54cemerickto chouser's point, I think the biggest open risk right now is the unintentional slippage of java-isms into these independent entities. It would be great if someone were to pick up the task of building a backend in something decidedly not like java, just to ensure that independence.
08:55chouserBart001: yes. are you wanting to create your subclass of a Java class, or just create an instance of an existing class?
08:55rhickeycemerick: yes, with cinc that should be very doable
08:55leafwrhickey: "A pubic constructor" in http://www.assembla.com/wiki/show/clojure/Datatypes -- funny typo
08:56chousermore interesting will the ObjectiveC, C++, google go, llvm hosts
08:56gerry_rhickey: only when fn need one arg except "this", will use (show [x])
08:56rhickeyleafw: fixed -thanks
08:56leafwIIUC, a deftype/defclass will be java classes without java files, i.e. without the pain.
08:56Bart001i think only from existing classes
08:56leafwlooking forward to using them.
08:57kjellskiHow can I do this in clojure? " a = b.foo(c); a.d(e); a = b.foo(f) ; a.d(e); // so that I´ll get my a out of that?
08:57cemerickleafw: they manifest themselves as Java classes, but are far from full interop. The tradeoff is a higher-fidelity construct for use in clojure code.
08:58chouserBart001: (def my-number (Integer. 5)) ; create an instance of Integer, passing 5 to the constructor. Store the created instance in a new Var named my-number.
08:58gerry_(let [a (.foo b c)] (.d a e))
08:58leafwcemerick: I see deftype/defclass in the context of clojure-on-clojure: to become independent of the JVM. At the same time, they provide an efficient susbtitute to defstruct, even if more constrained.
08:59kjellskigerry_: Thanks!
09:00rhickeygerry_: I get the defprotocol side, but what of the extend side, (extend ... :show (fn [what?]...))
09:02gerry_rhickey: just :show (fn [] ..))
09:02rhickeygerry_: but the fn *will* be passed one argument
09:02gerry_and directly use fields of type
09:02Bart001chouser: ok, i think my question was wrong. i am working on a projec tot use a existing java programm via console. this consle is a clojure repl. so i need a function to create a java object in repl an reuse it in repl
09:02rhickey(show something)
09:04dmiles_afkhas someone makde a clojure to jstatic/jcall/jfield .. system?
09:05chouserBart001: I may still be misunderstanding you, but if not my example still stands. Replace Integer with the name of your own class you're wanting to instantiate, replace 5 with any other ctor args. But that whole 'def' line in the repl and now, in the repl, you can refer to that object by the name my-number
09:05dmiles_afkhrrm .. i need to rephgrase my Q a little
09:05froogI keep mixing up {} and #{}, thinking that a hash map should start with a hash
09:06rhickeyBart001: you want to create an object in Java and make it accessible to the Clojure REPL?
09:07dmiles_afkclojure by defualt imports allt eh methods of plan old java objects right?
09:08rhickeygerry_: that can't happen - the call (show something) needs to pass something to the protocol fn, and do so in an arg
09:08dmiles_afkclojure by defualt imports all the methods of plan old java objects right? - well the syntax allows you to call the method.. "import" is the wrong word
09:08gerry_rhickey: i'm confused with java and clojure, (show something) in clojure really has one arg,
09:09rhickeygerry_: well, I've got the code to catch the no-arg mistake, will push in a minute
09:09chouserI bet case is going to help finger-tree quite a bit
09:10rhickeychouser: could do
09:10chouserI've got (condp == x 1 (...) 2 (...) 3 (...)) in a few key places
09:11Bart001chouser, rhickey: i want to write a function which create java objects. this function is called in the clojure repl and the created objects may used as parameters for other functions, sorry for bad english..:)
09:13rhickeygerry_: ok, defprotocol will now throw if no arg in sig
09:14sh10151What's the best way to get a clojure-1.0 compatible version of the clojure-contrib JAR into a Maven repository?
09:14gerry_rhickey: good
09:14chouserI have a friend looking at google's go. from the little he's telling me they have constructs incredibly similar to deftype, defprotocol, and extends
09:15MaddasYou mean the interfaces?
09:15chouseryeah
09:16kjellskigerry_: your answer to my question had nothing to do with e and f... that was what was outside my
09:16sraderfor java interop, how do you override, for example, paint method of a JFrame in Swing? Still use proxy?
09:16kjellskigerry_: err forget the text after ...
09:16rhickeychouser: I'm not sure they have any dynamic polymorphic nature at all though
09:16sh10151Will I just need to build a clojure-1.0 compatible version of clojure-contrib locally and install it?
09:17chouserthe three independant declarations: define a data collection with no methods or interfaces. define an interface with method sigs but no impl or data. finally, tie those two together with some method bodies.
09:17chouserrhickey: probably not, nor immutable anything
09:18rhickeyi.e. they address the expression problem similarly - independent, late implementations of interface methods, but I haven't seen how that works when the explicit type of the argument is not known at compile-time. Could be I just haven't seen it
09:20chouserI'm under the impression no value has unknown type at compile time.
09:20chouseroh, "explicit type" I see what you mean.
09:23Bart001is it possible to write a function which creates an java object, to call this function in the Repl and having a refrence to this created object to use it as parameter for other function called in the repl. maybe this is the right question
09:23rhickeyok, so here's the differences
09:23rhickeygo interfaces are method sets
09:23rhickeyany type implementing the methods impements the interface
09:24chouseryeah, I thought I saw that somewhere, but didn't understand
09:24chouserany *subset* of the methods, right?
09:24rhickeyThe base type must ... be declared in the same package as the method
09:24rhickey^^ that's the key difference
09:24rhickeynot independently extensible
09:24chouserah
09:24rhickeythey do have variables of (dynamic) interface type
09:25rhickeyso, really, subject to the same limitation as interfaces - definer of class has unique capability implement interfaces
09:25rhickeydoes not solve the expression problem
09:28Bart001is there anyone who could help me?^^
09:29rhickeyugh, and because interface implementation is latent (i.e. have same method names and sigs, implement interface), then single name scope, another big problem of objects not in protocols
09:30rhickeyi.e. no problem in implementing multiple protocols that each have a 'foo' fn, because true foo functions are in namespaces and extend connects into specific protocols
09:31rhickeyso, no go for go
09:31chouserBart001: I don't think we understand yet. can you explain the way that my earlier example is insufficient?
09:33Bart001because i want to write a function which creates this object via the repl
09:33chouserI gave you code that creates an object at the repl. You just want that inside a function?
09:35Bart001yes, but there is a problem with recalling the created object
09:36Bart001i think i cant explain my problem ^^
09:36chouserWe could write a function "make-thing" that you could call like this at the repl: (def my-thing (make-thing))
09:37chouserthen you can recall the created object by using the name my-thing, like: (println my-thing)
09:37chouserI suspect you already know that, and it's still insufficient. Can you tell me in what way it is insufficient?
09:39chouserrhickey: go interfaces can mix in whole method sets from other interfaces -- you think this is not useful for protocols?
09:41Bart001i will give you an example... there is a class called Model and i want to write the function (new model [modelname]) that creats a new model referenced to modelname. so the user can create a new model and use it by calling the modelname
09:41rhickeychouser: well, they must have a compilation stage that looks at the whole package and determines what is going on. The interfaces themselves are not reified in the way that protocols are. Making a composite of specs is different from making a composite of concrete protocol objects
09:41Bart001everything via the Repl
09:41rhickeythat's really the problem, plus the name combining and namespaces issues
09:42chouserBart001: ah, you want to keep a whole collection of Model objects so that you can look them up by name?
09:42Bart001yeees..:)
09:42chouserBart001: ok!
09:43rhickeyI don't disagree there is some ease-of-ise to saying this protocol implies these others, but as we've discussed, no real change in the work of actually implement A, B, and C whether a la carte or ABCComboProtocol
09:44chouserrhickey: yes. I guess it feels like a difference to say at defprotocol time that ABCCombo is a named thing in its own right, even if its defintion is just the set of methods defined by A B and C
09:45chouserrhickey: vs. not connecting them at all with defprotocol and waiting until each extend to name the three together.
09:46rhickeychouser: because the implementation detection is a runtime thing, the biggest benefit of combining/inheriting interfaces is not present - it is a big deal to be able, in a statically type lang, to say you take an ABCCombo as an argument, unless your lang has generics or some way to say, my function takes x, where x isa A *and* x isa B *and* x isa C. Few do (Haskell does), maybe Java/Scala generics
09:46chouserBart001: there are two ways to go -- store each model object in its own Var in your namespace, or store each model as a value in a hash-map. The first is a bit easier to use, the second a bit easier to implement.
09:47rhickeychouser: my experience has been that you do this because of the limitation of having to take an arg of a single type, and then later regret it when an interface brings in more than you need, not as composable
09:47chouserrhickey: ok, I think I follow that.
09:48rhickeyi.e. I originally though every collection should have count, but it ends up being bad for some seqs. Now there's Counted
09:48rhickeyand I wish IPersistenCollection didn't have count
09:49chouserhmmmm
09:49rhickeyover time many of the Clojure abstractions have been broken up into smaller bits so only those bits could be used a la carte
09:49Bart001chouser: okay.. thank you very much! i'll try
09:49rhickeyso, protocols default to a la carte
09:50rhickeybecause there's no static typing there isn't the pressure to produce a unifying type to serve as an arg type
09:50rhickeybut there is value in being able to say, A and B and C, if only as documentation
09:51rhickey(satisfies? [A B C] x) ?
09:51chouserhm, seems reasonable. But you're out past any deep experience of mine, so my instincts aren't to be trusted. :-)
09:52rhickeythe namespace issue is an important, unheralded feature of protocols
09:52rhickeyA and B can both have foo
09:53chouserrhickey: yes, the complete independance of method namespace from type namespace and now from protocol namespace is quite interesting.
09:53rhickey(extend atype A {:foo ...} B {:foo ...}), no problem
09:54rhickeyit is a critical flaw of using classes as namespaces, and the problem with monkey-patching even in dynamic langs with open classes
09:54rhickeyx.foo can only ever mean one thing
09:54lisppaste8Chouser pasted "models for Bart001" at http://paste.lisp.org/display/90236
09:55rhickey(your-ns/foo x) (my-ns/foo x), no problem
09:55chouserand is also why we
09:55Bart001thank you chouser
09:56chouserand is also why a protocol can be on an interface, and we'll be extending Java classes with new protocol methods.
09:57rhickeythe first time you say (extend String ...) it's a lot of fun
09:58rhickeyGroovy supports a lot of that, but retains the interface model
09:58Chousukeso what will you do if two protocols define identically named functions?
09:58chouserso ... it feels like translating the persistent data structures and related interfaces will be extremely straightforward and now possible. Any reason to hold back still?
09:59Chousuke(Protocolname:foo ...)?
09:59rhickeyChousuke: there's absolutely no problem with that, protocols yield functions in namespaces, normal ns stuff applies
09:59Chousukeah, right.
10:00chouserif two protocols in the same namespace define the same method name, only one survives?
10:00chouseror do they combine?
10:00rhickeychouser: no holding back, other than impl changes - I think that trying out some of the core abstractions as protocols is the next step
10:00sh10151anyone an enclojure user? trying to get a project REPL to start but I get a timeout
10:01rhickeychouser: in the same ns they collide, last one in wins
10:01chouserok
10:02Chousukechouser: How's your finger tree effort going?
10:02rhickeychouser: one way to think about it is that your ns used to be a bunch of independent fns a b c d e, now you are going to make them extensible, placing a b in protocol X and c d in protocol Y
10:02chouserChousuke: loads through line 206 of 447. :-)
10:03rhickeyI'd like to get rid of defclass, maybe today
10:03chouserbut won't that break everyone's code!?
10:03chouseryou know, all the people use defclass.
10:03cemerickrhickey: say again? :-P
10:03Chousuke:)
10:04rhickeycemerick: we spoke about this and you agreed
10:04chouserheh
10:04Chousukeis deftype going to be able to handle all the use cases of defclass then?
10:04cemerickoh, right, right, right
10:04cemericksheesh
10:04rhickeyAOT compiled deftype === defclass
10:05rhickeythe only sticking point is the conflict between factory fn and type name
10:05cemerickbeen going in 14 directions today. Shift_JIS is not fun.
10:06rhickeyChousuke: will do, yes, subject to understanding that some of those features are static and require recompile/reload to see changes
10:21foguscemerick: Well it originates with Microsoft, so that should have given you a clue to start. ;)
10:25chouserprotocol and deftype names should be CapsCase? Caps-Case? caps-case-type?
10:27Chousukenot Caps-Case :(
10:28chouserI'm converting from Java interface types, so CapsCase looks pleasant so far.
10:40chouserrhickey: so if I want to get at a deftype field when the deftype implements its own IPersistentCollection, I either need to use .foo (which is reflective?) or provide an accessor function? But wouldn't using the accessor also use reflection?
10:41kunleyHi.
10:42kunleyAnyone noticed if ztellman, author of penumbra (OpenGL bindings) is hanging around here?
10:43rhickeychouser: no, IPersistentCollection doesn't imply ILookup. Unless you are trying to implement map/associative, then (:field x) will still be available
10:44chouseroh!
10:45rhickeythe power of non-derived interfaces :)
10:47rhickeybut we will need to expose the facilities of IDynamicType (soon to be IDeftype) .getDynamicField for cases where people are using ILookup for something else
11:02rhickeychouser: so, you are shooting for no gen-interface right?
11:02chouserright
11:02rhickeycool
11:02chouserI'm there now, just working through the consequences.
11:02rhickeyoh, those :)
11:02chouser"digit" works. :-)
11:04rhickeyone consequence should be a more dynamic dev cycle
11:04chouseryes, though it was surprisingly descent before.
11:05fogusrhickey: That's a "consequence" that I'm all for
11:05chousermostly re-loading was my file was sufficient. occasional re-start of the repl followed by (compile ...)
11:06chouserI don't even have it properly namespaced -- the compile would do it's gen and then fail to load, but then loading the .clj manually and I was off and running again.
11:06chouserthat was because of newnew's already lovely behavior
11:07rhickeyyeah, one thing I've been thinking about is - what is to protocols as reify is to interfaces?
11:07rhickeyand if there need be such a thing
11:28chouserright now my code for each deftype is split in about half between deftype methods and extend methods. as the collection interfaces move to protocols, I expect my deftypes to shrink to nothing but fields.
11:28rhickeythat's the idea
11:30chousernone of these is sitting as cleanly in "interop" vs "native" as I was expecting.
11:30chousernone of deftype, reify, defprotocol I mean
11:41replaca_kunley: ztellman is in here sometimes, but not so often
11:45Kjellskichouser: What´s that about?
11:46chouserKjellski: what's what about?
11:46Kjellskichouser : What you just wrote, what´s the context?
11:47Kjellskichouser : Or where can I find a channel log? ^^
11:47chouser~log
11:48chouserhmph. http://clojure-log.n01se.net/
11:48Kjellskichouser : thanks
11:49chouseroh, I see where you came in. I'm talking about moving my finger-tree implementation from def-interface+reify over to deftype+defprotocol+extend
11:50chouserhttp://github.com/Chouser/finger-tree/blob/master/finger_tree.clj
11:55Kjellskichouser : uff... I think that´s not my league...
11:56chousernot really mine either
11:56chouserone thing that I can do in clojure better than any other language I've yet tried: solve problems beyond my understanding.
11:57Kjellskichouser : interesting... someday I hope, that´s the case for me too
11:57foguschouser: That should be our subtitle!! Idiomatic Clojure: Solving Problems Beyond Your Understanding
11:58chouserhm!
11:58chouserpretty attractive...
11:58chouserwho wouldn't want to do that?
11:58fogusreally
12:00KjellskiI have a problem with overriding a variable, trying to translate the following java code, where this is a proxy, could someone have a short look? http://pastebin.com/m3863f96e
12:00gbtas a noob who's relied on clojure-mode to install clojure what do I need to do to get a version with the protocol's?
12:00KjellskiI would need the sipProvider at the end...
12:01Kjellski~wiki
12:02the-kennyKjellski: You can nest lets inside... But in clojure, using variables should be avoided
12:02chouser(doto (.createSipProvider sipStack tcp) (.addSipListener (proxy [] ...)))
12:02chouserlet would be fine too
12:02liwpgbt: find your clojure git checkout on disk and checkout the new (?) branch
12:02rhickeygbt: you can try clojure.jar from here: http://build.clojure.org/job/clojure%20(new)/10/
12:04KjellskiI figured out how to call the first two methods, but how could I call the second, Or should I only use a tmp name and return the last, when the first is overriden from line 3?
12:04gbtthanks, I'm getting it now :)
12:06Kjellskirhickey : I´ve got a presentation in university in about two weeks, where I wanted to talk about clojure, may I borrow the logo for my presentation title page?
12:06chouserKjellski: your java code is overwriting the sipProvider -- do you mean to be doing that?
12:06rhickeyKjellski: if it's about Clojure, sure
12:07Kjellskirhickey : Thanks, and yes, its name will be: "Clojure - concurrency revisited"
12:09Kjellskichouser : Actually it´s not my code, its from an example, but I think it could mean that... before that, sipProvider is never defined, like that is just a workarround for setting things for a factory above...
12:30hamzahey guys, i want to represent a tree structure (file folder in a directory) in a clojure application, i was thinking of doing it like the xml stuff and wrap every level in vectors? would you approach it like this or any other recommendation?
12:32the-kennyhamza: I think I would do it so. You should also have a look at: http://clojure.org/other_libraries#toc5
12:38hamzathx ill check this out.
12:56chouserif a deftype wants some pre-computed fields (based on ctor args) the only way to do that is to provide a separate factory fn that is used by convention rather than the generated factory fn?
12:59rhickeychouser: yes
12:59chouserwould it be evil to redef the generated var?
12:59rhickeythe general idea is that the 'raw' interface is for implementors, not necessarily end-user clients
13:00rhickeyyes, evi;
13:00rhickeyevil
13:00chouserok
13:00rhickeydefclass is ... gone
13:11alinphi guys
13:11alinpdoes anyone using vimclojure ?
13:13KjellskiI did, why?
13:14Kjellskialinp : What´s your question, mybe I can help...
13:14alinpI can't start the REPL no matter what I do
13:15alinpto be honest, I don't know how to use "\sr"
13:15alinpI mean, I can't start it
13:15alinpI started the nailgun server ... and all the stuff
13:15alinpdid the ant install ... etc
13:16alinpeverything went fine
13:16alinpI did everything that is written in the README
13:18KjellskiHmmm... you are sure the repl is life?
13:19alinpwhat do you mean ?
13:19KjellskiYou´ve started the nailgun server through the vimclojure command?
13:20Kjellskialinp: Just a sec, booting up my linux machine...
13:20alinpI started the nailgun from a separate console
13:21alinpjava -cp ... bla bla
13:21alinp:)
13:21alinpand started
13:22Kjellskialinp : *booting* ... sorry, that machine is a bit older then...
13:22alinpok ok ... np
13:25chousercons dispatches on the wrong arg
13:26Kjellskialinp : ... just a few seconds then...
13:26alinp:) ok
13:27duncanmrhickey: have you read the 'categories' system that mike evins wrote about a while back? http://mikelevins.livejournal.com/5060.html
13:28duncanmrhickey: also, what you said about having namespaces in protocol method names this morning reminded me of the 'explicit interface implementation' feature in C#
13:29Kjellskialinp : *figuring out how that went...
13:29rhickeyduncanm: yes, read that
13:29duncanmrhickey: mikel evins also wrote a OO system for Clojure, and he's written that he's thinking about porting his current code (in Gambit Scheme) back to Clojure
13:29rhickeyduncanm: and yes, C# did this better than Java
13:29duncanmrhickey: i haven't been able to follow all these different threads of discussion, but it seems like they're all somewhat related
13:29rhickeyduncanm: he and I had extended discussions on the list about hierarchies etc
13:30duncanmoh, that's great
13:30rhickeywe ended up disagreeing
13:30duncanmahh ;-)
13:30rhickeywhich is ok
13:30duncanmsure thing
13:30rhickeyhe more CLOS-influenced
13:30rhickeyI want to get away from hierarchy
13:30duncanmrhickey: his new post said something similar too, that he's preferring the 'flat' domain more than the c3 domain
13:31duncanmhttp://mikelevins.livejournal.com/5851.html
13:31duncanmso maybe your opinions are converging
13:35Kjellskialinp : depressing... actually I can´t figure it out. It was really simple...
13:36alinpyeah, that is how it looks like .. but ...
13:36Kjellskialinp : Sure you´ve read this right? http://kotka.de/projects/clojure/vimclojure.html
13:36alinpoh
13:36alinpmanaged to started it :o
13:37Kjellskialinp : congrats! how?
13:37alinpI had in the vimrc file :set nocp
13:37alinpand it seems that affects the plugin ...
13:37wlrWow! What lightweight analysis by Information Week: http://tinyurl.com/ygv2uy3
13:37alinpwhen pressing "\"
13:38Kjellskialinp : okay, that´s weird... should be suggested in the docs...
13:38alinpnot very sure how/why this affect it
13:38alinpsorry Kjellski and thanks for your time ;)
13:39Kjellskialinp : no problem, nevermind... reminded me on the graphics failure of my linux pc... *urgs* ATI card...
13:40alinp:)
13:40duncanmhmm
13:40duncanmchouser: is there a defprotocol/deftype implementation of fingertree?
13:41chousernot yet
13:41Kjellskiwlr: outch, that hurts hanging arround in this channel...
13:41duncanmchouser: what's the reason for using a letfn? is that kinda like a letrec in Scheme?
13:42chouserduncanm: I measured a slight performance boost using letfn over vars.
13:43chouserduncanm: but that doesn't fit with defprotocol/deftype, so I'll be walking that back.
13:43duncanmahh
13:45patrkrisdoes anyone here know if it is possible to just get indenting and syntax highlighting from VimClojure, i.e. without the REPL-in-Vim and so on?
13:46chouserpatrkris: yes, that's how I use it
13:46patrkrisOk, so what do you do? Just copy clojure.vim from indent and syntax into ~/.vim?
13:46the-kennyI want clojure-support in lejos
13:46patrkrischouser: and of course file plugin indent on and syntax on
13:47chouserpatrkris: I think I ran the ant install thing, but then just didn't set want-gorilla thing
13:47patrkrischouser: ok, thanks, i'll give it a try
13:47patrkrischouser: which version of VimClojure are you using, a recent version or an old version?
13:48chouserfairly recent, I think.
14:08leafwhow come sorted-set-by requires at least one element after the comparator? Can't one create a sorted-set with a comparator initializing it without elements?
14:12lisppaste8leafw pasted "untitled" at http://paste.lisp.org/display/90245
14:12leafwcomments on the sorted-set-by problem pasted above appreciated.
14:13chouserClojure fns implement Comparator
14:14leafwchouser: you mean the comparator could just be a simple fn ?
14:14leafwwith two args
14:14leafw?
14:16chouser,(reduce conj (sorted-set-by #(int (- (%1 :med) (%2 :med))) {:med Double/MAX_VALUE}) [{:med 1} {:med 6} {:med 10}])
14:16clojurebotjava.lang.Exception: Unable to resolve symbol: sorted-set-by in this context
14:16chouserthat's a comment, though, not a solution to your problem. :-)
14:17leafwchouser: indeed. Thanks though.
14:20AWizzArdwas so busy with work, i did not really see all updates.. so, defclass is gone now right?
14:21rhickeyAWizzArd: yes, deftype can do everything defclass did
14:21AWizzArdFine, I was using deftype exclusively anyway :)
14:21AWizzArdand i saw a mention about java naming conventions.. is it now possible to do again (:my-field my-deftype)?
14:21rhickeyyes
14:21AWizzArdThis is running into an error in my version as my-field is not a valid var name in Java
14:22AWizzArdbut my checkout is several days old
14:22chouserleafw: looks like a bug to me
14:22AWizzArdoki, sounds good, so I will checkout a fresh new branch
14:22AWizzArdthank you :-)
14:22AWizzArdoh, and protocolls are also ready
14:23AWizzArdhmm, can i use this somehow to create some kind of hierachies?
14:23headiuswhat exactly are protocols?
14:23headiusI looked at rich's patch but I didn't understand what it was for
14:23rhickeyheadius: they are like interfaces but...
14:23chouserleafw: sorted-set-by allows for an empty list of initial values, but passes that on to PersistentTreeSet/create as null, but create doesn't check for null it just blindly calls .length on it.
14:23rhickeydon't create a hierarchy
14:23AWizzArdi have tokens, very general objects, but i have word-tokens, digit-tokens, date-tokens, zip-code-tokens, etc
14:24jonase_How do I implement an interface with extends? (extend ::AType clojure.lang.Counted {:counted (fn [o] ...)}) doesn't seem to work?
14:24rhickeycan be independently implemented, not just by the type's original author
14:24headiusso it's for enforcing/ensuring that a set of operations are available?
14:24rhickeyheadius: so, they are a polymorphism mechanism
14:25rhickeybecause deftypes don't have operations other than for interop purposes
14:25chouser(sorted-set-by <) ; fails, but shouldn't
14:25rhickeyoperations are always stand-alone functions
14:25rhickeyprotocols are polymorphic on their first argument
14:25headiusok, I think I follow
14:26rhickeyso they might feel like methods, but differ in that they aren't 'in' the class
14:26AWizzArdcan i use protocols to create a function that will work for all tokens, even if i pass in an instance of (deftype zip-code-token ..)?
14:26rhickeyand from that follows that they are not in a class name scope
14:27rhickeyso unlike monkey patching, independent protocols can define operations with the same name without conflict
14:27headiusbecause you call through the protocol, I assume?
14:27AWizzArdhmm
14:27AWizzArdbest thing i will try it out tomorrow
14:27rhickeyheadius: right, the protocol ends up defining regular namespaced functions
14:28rhickeyso there's no protocol object in the call, but my-ns/foo and your-ns/foo are different functions, only one of which can be used without qualifier in another ns
14:29headiushow does this differ from just defining namespaced functions
14:29headiusthat you call through
14:29rhickeythe protocol generates these functions and embeds the dispatch logic
14:30rhickeyso the function is extensible
14:30rhickeyordinary functions are not, just redefine/replace
14:30duncanmso there's something like 'super'?
14:31headiusok...so it handles defining the protocol via namespaced functions, allowing calls in a given scope to look like regular function calls but actually be namespaced by the protocol
14:31headiusor something :)
14:32headiustwbray: what's the latest on wide finder stuff?
14:32rhickeythe function is in a namespace as usual, the protocol defines it so that inside there is dispatch on first arg
14:32leafwchouser: ok, thanks. Are you submitting a bug report?
14:32rhickeyand when it is extended, the protocol redefines the function
14:33Kjellski,(doc ->
14:33clojurebotEOF while reading
14:33twbrayheadius: I'm at the cottage hooked up via dial-up. Will be working on it again starting on Friday. At the moment, haven't figured out how to workaround the gc thrashing
14:33Kjellskihiredman : I´ve done my homeworks...
14:33Kjellski,(doc apply
14:33clojurebotEOF while reading
14:33AWizzArdrhickey: and the first argument is dispatched on what? The (class of-the-object)?
14:33rhickeyAWizzArd: type, then class
14:34AWizzArd,(doc type)
14:34clojurebot"([x]); Returns the :type metadata of x, or its Class if none"
14:34chouserleafw: I'm not -- I think such things are supposed to be posted to the google group first.
14:35headiustwbray: you might try a shorter run with -Xrunhprof to see what sort of object counts you're getting
14:35twbrayheadius: OK; any and all input welcome.
14:35headius^C it any time you're satisfied it's hit the bulk of its work and it will dump out a java.hprof.txt file with object allocation counts
14:36headiusother than tweaking your code or trying G1, however, I'm running out of ideas
14:36leafwchouser: ok
14:36twbrayheadius: it dumps when it finishes running?
14:36headiusif it's a lot of garbage, it's just a lot of garbage
14:36headiustwbray: yes
14:36lisppaste8rhickey pasted "protocol twiddling" at http://paste.lisp.org/display/90249
14:36twbrayHaven't got G1 going yet, got a query into jrose as to why my JRE doesn't seem to have it
14:37headiusrhickey: so this seems similar to what I want to do with duby for reopening classes; they'll work basically like extension methods in C# and just pass an implicit "this" argument to a static body
14:37headiusonly the extensions in scope when you compile will be available to callers
14:38rhickeyheadius: except these are not scoped things
14:38rhickeyextend is a global extension
14:38cemerickrhickey: your keynote is up: http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
14:39rhickeycemerick: that was relatively soon
14:40headiusrhickey: yes, this would just apply to the code compiled with a given extension enabled...but of course Duby can't actually modify Java classes already defined
14:41headiusI assume this all only applies to clojure types too
14:41headiusi.e. I can't add a protocol to java.lang.String?
14:41leafwchouser: can I quote you directly?
14:41chouserheadius: ah, but you can!
14:41chouserleafw: sure
14:41rhickeyheadius: sure
14:42rhickeyheadius: because protocols are not about methods inside classes - they are polymorphic functions outside of classes
14:42headiusok, so it's not far off from extension methods
14:42leafwchouser: it's done.
14:43rhickeyin the paste I just did, Number is java.lang.Number
14:43headiusbut mostly done at runtime
14:43chouserleafw: thanks
14:43headiusfoo gets defined as a normal function that ensures the target supports a given protocol and then dispatches through it
14:43headiusprotocols can be added to known types after the fact
14:43ztellmandoes anyone have experience analyzing SIGSEGV crashes?
14:44headiusI assume there's some mapping somewhere to maintain the list of protocols a given type has had glommed onto it
14:44rhickeythe things about methods is that a class/object constitutes a namespace, not so with protocols
14:44ztellmanI'm getting one in linux, with code that works perfectly fine on os x
14:44chouserztellman: the JVM is segfaulting?
14:44ztellmanchouser: yes
14:45ztellmanthere's JNI in the mix
14:45rhickeythe set of implementations is in the functions, not the objects/classes, and the functions are in namespaces
14:45chouseroh
14:45ztellmanit says the error is in libjvm.so, rather than any of the .so I'm using, though
14:45ztellmanI don't know if that's a red herring
14:45headiusrhickey: so does the protocol maintain the mapping between types and "foo" functions then?
14:46rhickeyheadius: yes
14:46headiusand it locates them based on the actual type of the first argument
14:46rhickeythere is a lookup, but caches based on class of arg
14:47rhickeythere are tagged types, then classes/interfaces of Java
14:47headiusso it's still basically namespaced
14:48headiussince it has to be associated with a type in order to locate it
14:48cemerickit just dawned on me that protocols get type reification in the jvm's backdoor, without any significant penalty
14:48headiuscemerick: how's that
14:48headiusit's just a call through with a table of type => function mappings
14:49rhickeyheadius: I don't see that, since 2 protocols can both have different foo for String
14:49headiusand how does it differentiate between the two?
14:51rhickeya protocol is in a namespace, and generates foo in that namespace. The true name of foo is that-ns/foo. A second protocol is in another namespace, that foo is another-ns/foo
14:51rhickeyyou can say (extend String AProtocol {:foo ...} BProtocol {:foo ...})
14:51headiusok, I guess I'm confused by you saying it's namespaced but then saying it's not namespaced
14:52headiusthe "magic" foo is tied to a specific namespaced foo within a given namespace
14:52rhickeyheadius: I'm not sure what to presume you know about Clojure's namespaces
14:52headiuseach foo protocol in separate namespaces keeps its own mappings of type => foo function
14:52headiusis that about right?
14:53rhickeythe protocol is a mapping of types to maps of names to functions
14:53headiusI know practically nothing of clojure's namespaces, so feel free to punt if I'm just not getting it
14:53headiusI feel like I understand though
14:53Kjellskicya =) good evening...
14:53rhickeyit places the dispatch into a function of the same name in a namespace
14:53bitbcktRubyConf should be entertaining, with all of this Clojure injection...
14:54headiusright, so foo is that-ns/foo which has a set of type => function mappings for the ultimate "foo" targets
14:54rhickeyfor users, calling protocols looks like calling ordinary function, and deciding which to use, like ordinary require/use stuff
14:54headiussure
14:55rhickeybut unlike trying to place methods in classes, there is not the limitation of one foo per type
14:55rhickeyx.foo
14:55rhickeyis not x.my-ns/foo
14:56rhickeyin most langs
14:56rhickeyc# does the right thing
14:56rhickeyjava merges
14:57headiusright, I see this as what C# does
14:57twbrayWrote a short piece on using refs in Wide Finder: http://www.tbray.org/ongoing/When/200x/2009/11/11/Clojure-References
14:57G0SUB_someone needs to write a doc explaining the protocols and types feature. with nice examples and comparisons.
14:58danlarkinG0SUB_: it's not done
14:58G0SUB_danlarkin: I know, but whatever is coming, or even the basic premise.
14:59technomancytwbray: you author your posts in Emacs, right? may I recommend the excellent htmlize package for syntax-highlighting code snippets?
14:59headiusrhickey: this basically seems like what I want to do, thanks...Duby will work like C#
14:59technomancywhen I try to read monochrome code my brain just refuses to function.
14:59headiusbut all static, of course
14:59bitbckttechnomancy: +1
15:00twbraytechnomancy: yeah, but the CSS it generates interacts toxically with mine, I have to do some horrible CSS spelunking to figure out what's happening. :(
15:00technomancytwbray: ah, bummer. there's an alternate package you might have better luck with called html-fontify, but I haven't used it myself.
15:00rhickeyheadius: but if you are talking about C# extension methods, I am not
15:01drewrI'm trying to get my head around how this is useful http://gist.github.com/233223
15:01drewrif you extend String, how would one baz get dispatched over another?
15:01bitbcktnaively, it looks last-in
15:02rhickeyI am talking about C# inheritance - if you get foo from 2 interfaces they are not merged - you can refer to A::foo and A::foo, and have different implementations. When used polymorphically as an A - you get your A::foo impl
15:02somniumhas anyone gotten the new branch working with swank?
15:02rhickeyA::foo and B::foo above
15:02chouserdrewr: you don't want to have two protocols with the same methond name in the same namespace
15:02rhickeyin Java if you inherit foo from 2 interfaces you get a single implementation
15:03headiusyeah, I don't know if I'd agree that c# does it "right" there, but I understand
15:03headiusC# does it the C++ way
15:03rhickeymerging is definitely wrong, as the semantics might be completely different, even if the signatures are the same
15:04drewrchouser: yeah, that makes sense, but even if they were in different nses the dispatching doesn't make sense
15:04headiusthen you don't use those interfaces together because they have conflicting contracts
15:04rhickeythis was a point Ola Bini and I raised re: the interface injection proposal
15:05rhickeyheadius: but you can't necessarily choose the interfaces you implement since often they are requirements of APIs with which you need to interoperate
15:05chouserdrewr: if they were in different namespaces, there would be two different baz functions, you'd pick which you mean by saying (upper/baz ...) for example.
15:05rhickeythe bottom line is that classes make crummy namespaces
15:05headiussure, no argument there
15:06headiusI can see the problem of conflicting interfaces, but I don't see that one answer is better than another
15:06rhickeybut using the C# stuff, you realize that, as an implementor of C derived from A and B, there is no conflict in supporting both semantics
15:06rhickeyand as a consumer of A interfaced passed as C, you will get yhe semantics you want, ditto B
15:07rhickeyso any problems here are strictly for people that want a global view of C, not consumers of the abstractions
15:07drewrchouser: ok, I wasn't see the demarcation line between protocols and their impls
15:08chouserrhickey: should there be a warning in drewr's case? Two differently-named protocols in the same namespace defining the same method name?
15:08rhickeychouser: how to detect?
15:08drewrthe idea is that you can have a namespace that defines and operates on a proto, and another client ns where the impl is tailored to fit
15:08headiusgotta run, bbl
15:09chousercan't Bar see that baz exists already for Foo?
15:09chouserI haven't looked at the defprotocol implementation at all yet.
15:09rhickeychouser: baz is just a fn
15:10rhickeywe could use var metadata for this
15:10chouserrhickey: stick the ... just going to say that
15:11chouserput the protocol name in the var's metadata -- if it matches, presume this is an intentional overwrite. name does not match, print a warning (not an error because maybe they're renaming the protocol or something)
15:11rhickeypatch welcome
15:11chouserwoo! Can't get to it until tonight, but I'll look then.
15:12cemericktwbray: I don't see a source link, but why use refs? If you're asynchronously processing N lines at a time from the log file, agents would be the way to go.
15:13twbraycemerick: I'm using some agents for part of the pull-lines-out-of-the-file-in-multiple-threads
15:14twbrayI suppose it could be done with agents; not obvious why that would be better. All I'm doing is calling inc on a number, hardly seems worth its own thread
15:14cemericktwbray: I'm not super-familiar with the widefinder problem, but I'd say set up some number of agents, have your primary caller chunk through each line, dispatching (sending) each line off to an agent, and then await on all agents to collect results.
15:15twbrayOnce I've killed the gc problems, I'll have a try with agents and see if that makes a difference..
15:15cemericktwbray: agents and threads are *not* 1:1
15:15cemerickand you wouldn't pay the price of transactions at all
15:15twbrayGotta go, later
15:24shooverAlso record/incr look like a race condition
15:24shooverShouldn't the transaction include the counter check?
15:44somniumtrying to try out new branch, getting error: NoSuchMethodErrror: clojure.lang.RestFn.<init>(I)V with some contrib libs from build.clojure.org, am I doing something wrong?
15:45the-kennysomnium: You have to rebuild contrib
15:47chousermight need to do ant clean first
15:49chouserrhickey: (instance? X nil) returns false. satisfies? throws NPE
16:19hiredmanI've recently noticed vim's undo is mangling my clojure source files
16:19hiredman:(
16:19hamzaemacs ftw :)
16:20hiredmanif I wanted your opinion I would have asked
16:24hamzajust joking man, no flame war intented.
16:42rhickeychouser: fixed
16:47michaeljaakapeople there are two cool options
16:48michaeljaakaclojure-mode for emacs
16:48michaeljaakaand enclojure for netbeans
16:48michaeljaakathese editors are very cool
16:48michaeljaakaespecially for netbeans if you are planning to mix your written java + just written in clojure modules
16:57chouserrhickey: thanks!
16:58chouserunfortunately that's not the only NPE I'm getting :-P
16:58rhickeysend em on!
16:59chouseryeah, I think this one's my fault.
17:07sraderrhickey: lines 5440-5441 in compiler.java are repeated from previous lines
17:09rhickeyhuh
17:13sraderlines 5437-5438 are the same as lines 5440-5441. duplicates.
17:19rhickeysrthanks
17:19rhickeysrader: thanks
17:26lisppaste8Chouser pasted "chain of agents" at http://paste.lisp.org/display/90261
17:36sraderchouser: nice!
17:37slyrus_is swank-clojure broken for others, or is it just me?
17:38somniumslyrus_: with new branch?
17:38slyrus_(going back to Sept. 28 works)
17:38slyrus_branch?
17:38somniumI have an old version, attempts to upgrade haven't worked
17:38slyrus_git branch -a doesn't show any branches
17:38somniumI ment clojure's new branch
17:39slyrus_oh... i'm using the HEAD as of last night
17:39somniumI suspect swank will need to be rebuilt to work with it, but it seems were talking about different things
17:39_atoHEAD of swank-clojure is working fine for me
17:39slyrus_how do I rebuild swank-clojure with the new maven stuff?
17:41slyrus_would have preferred keeping it that way...
17:42technomancyslyrus_: you can use the "maven" branch without using maven itself
17:42technomancyyou only need maven if you're going to hack on the swank-clojure source itself; see the readme in the maven branch
17:42slyrus_well, yeah, i figured that. but what do you mean by "use"
17:43technomancyactually at this point it's probably best to wait for it to land in elpa
17:43technomancythe install-by-hand process is tedious
17:47duncanmtechnomancy: is it gonna land soon?
17:48technomancyduncanm: unfortunately the elpa upload process is still manual... total crap shoot on how long it takes. I'll ping the maintainer later tonight.
17:51hiredman~web dev
17:51clojurebotweb dev is the worst dev
17:51somniumhiredman: struggling with facebook php?
17:52hiredmanno
17:52hiredmanfacebook clojure :P
17:53hiredmanmostly facebook and appengine
17:53hiredmanand librarything not updating rss feeds for up to 26 hours at a time
17:54somniumthe facebook api looked truly hideous, datastore didn't seem that horrible
17:54somniumhiredman: there's always slicehost :P
17:55hiredmanappengine isn't too bad, just makes debugging with println's difficult
17:55hiredmanfacebook is not too bad, as long as you don't use any of the java clients, and just make api calls directly over http
17:56chouserheh
17:56hiredmanbut all those combined + librarything's rss latency is maddening
17:57hiredmanhttp://gist.github.com/233395 <-- clojure facebook "api"
17:58duncanmhiredman: why couldn't you use the java clients?
17:58hiredmanduncanm: I suppose I could
17:58hiredmanthey just all seemed horrible
17:59hiredmanlike the client that was formerly maintained by facebook
18:00hiredmanPOSTing to restserver.php is just so much simpler
18:00hiredmanhttp://mrepo.happyfern.com/sites/facebook-java-api/facebook-java-api/apidocs/com/google/code/facebookapi/IFacebookRestClient.html
18:00hiredman^- ugh
18:01hiredmanthere are other clients, that do stuff like add servlet filters and I didn't want to mess with that and compojure
18:02hiredmanhttp://gist.github.com/233400 <-- what a call looks like
18:03duncanmi need to learn more about compojure, i just finally learned what a servlet meant the other day, i was at B&N and flipped through one of those head start books
18:03duncanmthere's all this terminology that i never bothered to learn
18:04hiredmanI still can't be bothered, which is why I didn't even try to use one of the other clients
18:05duncanmhiredman: i don't really know all the variations to the destucturing syntax, what does {:keys [uid title link description image]} mean?
18:05hiredmanit destructures a map
18:06hiredmanuid gets the value of (:uid map), titles gets (:title map), etc etc
18:06duncanmoh cool
18:06duncanmi get it now
18:06hiredmanit's very cool
18:07somniumduncanm: defnk in c.c.def uses it for keyword fns
18:07somnium(which btw seem to lose argmap metadata for some reason)
18:07duncanmyeah, coming from Scheme, i wish Scheme implementations experiemented more with these little syntactic niceties
18:07duncanmhiredman: call 'call' comes from compojure?
18:08hiredmanno
18:08hiredmancall is defined in previous gist
18:09hiredmancall turns the map into a facebook api call (a POST) and, uh, POSTs it
18:11hiredmanthe definition of call is a little mangled because I just went through a debugging session and was shoving (.info log _) everywhere
18:13duncanmhiredman: which library contains with-open?
18:13hiredmancore
18:14duncanmhiredman: i should go back and clean up some of my clojure code, i had to spend an afternoon chasing down missing close/flushes because i didn't use with-open
18:15hiredmanI really hate the pull nature of rss
18:16duncanmhiredman: that's because of HTTP, is you need notification, you could use XMPP, right?
18:18hiredmansure, but xmpp is fairly complex
18:18hiredmanwebhooks seem nice and simple
18:19hiredmanI think I might make myself a rss->webhook translator so I never have write the rss polling code again
18:20hiredmanI think protocols may have spooked headius
18:20bitbckthiredman: we'll polish him up at RC, next week ;-)
18:20hiredmanhttp://twitter.com/headius/status/5658380443
18:20bitbcktYeah, I saw.
18:27Luyt'developer ability'?
18:28LuytAre they afraid people cannot understand lisp-like languages?
18:28hiredmanhigh cognitive load? dunno, his words
18:28hiredmanI don't think it's a lisp thing
18:28bitbcktThese Go Interfaces will blow your stack, too.
18:29bitbcktLanguages sure are fun.
18:29hiredmanlike I said, seems like maybe a response to the complexity of protocols
18:29hiredmanor a crystalization of opinion brought about by exposure to same
18:33_atoeh... how are protocols any more complex than interfaces?
18:33krumholt__is there a debugger i can use from emacs for clojure?
18:34jableyhiredman: I'm not sure it's solely clojure - add in scala and others
18:34hiredman_ato: I think the logs of #clojure contain evidence that they are. but a lot of that might clear up once their are more examples
18:35hiredmanjabley: sure
18:35hiredmanscala is digustingly complex
18:36jabley"this type system goes up to 11!"
18:37hiredmannot so much the type system
18:38hiredmanthe api and the standard library (which feed back into the type system)
18:39_atoI think the logs of #clojure just contain evidence that everyone is more used to interfaces rather than protocols and there's still a few kinks to be worked out in the implementation, but the concept is no more complex IMO
18:40hiredman~logs
18:40clojurebotlogs is http://clojure-log.n01se.net/
18:41hiredman*shrug*
18:42_ato:)
18:43patrkrisQuestion: I have a ref that contains a vector. An agent needs to be awoken when something is put in the vector. The agent will set the ref to the empty vector [] and process the old vector (with elements in it). While it is processing these elements, it shouldn't be notified of new elements. When it is done processing, it should either process new elements added in the meantime or wait until new elements are added. How do I get
18:44patrkrisShould I add a watch or watcher?
18:45krumholt__patrkris, i think you want an agent instead of a ref? instead of putting something in the ref you send it of to the agent to process it
18:45patrkriskrumholt__: hmmm.... you may have a point there
18:48patrkriskrumholt__: but the thing is, I don't want an agent to process a single element at a time... it is better that it processes a batch of elements
18:48patrkriskrumholt__: btw, it is a simulation of disk scheduler
18:49krumholt__patrkris, you could save the vector as the state of the agent. when you send-off something to the agent it will add it to the vector or if there are enough items accumulated it will process them
18:51duncanmhiredman: i think it'll be interesting to ask someone like stuart halloway what he thinks about 'avg developer ability'
18:51duncanmhiredman: from the comments i see in this channel, i'm usually surprised at how fast non-Lispers seem to pick up on the language
18:51patrkriskrumholt__: yes, that is a good suggestion, except that I do not depend on a specific number of requests to have accumulated; I depend on the disk scheduler being ready (i.e. not in the midst of processing elements). The disk scheduler itself is represented by an agent and an action that takes a batch of current elements and processes them.
18:52hiredmanI think focusing on lisp/not-lisp misses the point
18:52duncanmhiredman: i agree
18:53hiredmanthe point is, when do you use alter, commute, or ref-set
18:53hiredmanor similar
18:53krumholt__patrkris, no idea then :) probably a watcher will be a good idea never used it
18:54patrkriskrumholt__: thanks for you help though
18:54hiredmanI have very limited exposure to "developers" (outside of irc) so I cannot comment on their average ability
18:56hiredmanI just remember taking a java class at the local community college (mind you this was the second java class, after taking a class that was javascript) a large number of people still couldn't figure out how to loop over an array
18:57ChousukeI once tried to teach a person some python basics.
18:57ChousukeI kind of gave up after an hour when he was just somehow unable to understand how a simple while loop worked :/
18:57hiredman:(
18:58duncanmChousuke: you should have taught tail-recursive calls instead ;-)
18:58ChousukeIt lead me to think that maybe some people are just unable to learn programming :)
18:58jableyOr logical thinking of any type!
18:58patrkrissome people simply cannot learn to program: http://www.cs.mdx.ac.uk/research/PhDArea/saeed/
18:58Chousukeit does require the ability to visualise rather abstract things.
18:59duncanmin some sense, tail-recursion is easier to understand, right? as long as you don't care about stack size, it's just calling a procedure. if they can understand (f x), they can understand (f (dec x))
19:00Chousukebut can they understand a procedure calling itself?
19:00duncanmwell, you gotta start with that, also you'd hope they learned some of that from high school math
19:00hiredmanduncanm: you also need a terminating case
19:01_atoat ANU they teach haskell first and then java... it's quite interesting how it seems to polarize the students, those that have no programming experience often cope better with haskell (as it's more like maths), while those that have imperative language experience tend to find it more difficult
19:01hiredmaninteresting
19:01duncanmi went to school where they taught PLT Scheme, and the experience there is similar to _ato's
19:02duncanmit was fun being a tutor for the 2nd year java class, and having kids write code like 'return for (int i; ...)'
19:02duncanmthat was memorable moment for me
19:02krumholt__thats my experience too people who have been "exposed" to imperative languages tend to have more problems learning a functional language
19:03DraggorIs there a way to get around clojure forcing me to define all of my functions in order?
19:03Chousukeuse declare
19:07duncanmChousuke: is there a reason why order of function definitions is not implemented like other languages? does it have to do with the reader?
19:08Chousukeyes. :P
19:08Chousukeor rather, the compiler.
19:08Chousukeor both.
19:09gbtChousuke: how is your reader going?
19:10Chousukegbt: Compiles Clojure, contrib and itself, passing all tests. I just haven't had the time to polish it up.
19:10duncanmChousuke: what are you writing?
19:10Chousukeor "compiles". I mean I can use it in place of the Clojure reader and it works.
19:11ChousukeBut it's unoptimised and undocumented and still fairly messy.
19:12chouserso, a naive port of finger trees from letfn+reify to deftype+defprotocol costs between 15% and 300% in performance, depnding on work load.
19:12Chousukehowever, since it works it'll be easy to improve. I thought about rebasing it on the 'new' branch
19:12hiredman:|
19:13hiredman300%
19:13_atoI think I must be brain damaged from writing too much C code, I actually *like* having a forced order of function definitions :p
19:13gbtduncanm: he's written a reader in clojure rather than java
19:13Chousukethe worst of the mess right now is syntax-quote though.
19:14ChousukeI put that in core.clj in my branch, intending to make it a macro... but that didn't work.
19:14Chousukeso now it's just a read-time function
19:14Chousukebut the remnants of the macro still exist in core.clj :P
19:14Chousukeand other stuff like that which needs cleaning up
19:15Chousukeit turned out that autogensyms complicate syntax-quote a fair bit.
19:16_mst_ato: I misread you for a minute there and thought you were saying that you liked having the order of evaluating function *arguments* undefined. Now I only think you're partially crazy rather than fully crazy...
19:16ChousukeI suppose a code-walker is needed to make it a real macro, but clojure.walk isn't available when syntax-quote is defined :(
19:18Chousukeor hmmh.
19:18timothypratleyI'm adding some tests for sorted-set-by and am confused by the following behavior if anyone can give me a hint:
19:18ChousukeI wonder if it is possible to just take advantage of the bootstrapping and define syntax-quote as a macro in the reader namespace, where all of clojure.core is available.
19:18timothypratley,(sorted-set 1 "a")
19:18clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
19:19timothypratley,(sorted-set-by compare 1 "a")
19:19clojurebotjava.lang.Exception: Unable to resolve symbol: sorted-set-by in this context
19:19timothypratleyoh well in head it says RuntimeException : ClassCastException
19:19timothypratleyI can't figure out why its not the same exception.
19:20Chousuke,(compare 1 "a")
19:20clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
19:20Chousukeyour comparator makes no sense it seems
19:20timothypratleyYup I want it to throw a ClassCastException
19:21timothypratleybut I'm getting a RuntimeException wrapping the ClassCastException for sorted-set-by
19:21timothypratleybut just ClassCastException for sorted-set
19:21gbtChousuke: it all sounds really interesting and I wish I understood, but you're talking well above my head :)
19:22Chousukegbt: implementing syntax-quote as a macro seems to be way above *my* head as well, so don't worry too much.
19:22Chousukebut hm
19:22Chousukenow I guess need to try out a few things...
19:25timothypratleyah I think I see what is going on... Util.compare must have a catch or something I'll look there
19:29timothypratleyNope... the util compare explicitly casts its arguments maybe that's where the exception gets triggered, whereas with a custom comparator it goes further and somehow that results in a runtime exception wrapping it, but I don't understand why or how to fix it.
19:35_ato,(sorted-set 1 2 :a)
19:35clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.Keyword
19:35_ato,(sorted-set :a "b")
19:35clojurebotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.String
19:36_atotimothypratley: does it make sense to have a sorted set of things of different types? how are 1 and "a" supposed to be ordered?
19:36_atooh wait sorry, missed that you said you're just expecting the same exception
19:44chouserhttp://tinyurl.com/yeh5fgg/finger_tree.clj
19:45chouserdunno why I pasted that, except it's passing all its tests again.
19:47_atotimothypratley: so it's line 44 in AFunction.java... not sure if there's a way to get around java's declared exceptions
19:54chouserclojure is an excersize in trying to get around java's declared exceptions
19:54chouser:-/
19:55timothypratley_ato: ah yeah thanks I should have noticed that, all compares were looking the same to me but you are quite right - totally different.
19:55timothypratleychouser: hahahaha what have I got myself into :(
19:57_atohttp://www.mail-archive.com/javaposse@googlegroups.com/msg06200.html
19:58gbtoh my, defprotocol, extend, deftype ... it may take me a while to understand, but that is an example of all the new features
19:58_atothere's that, but it's not perfect as you can't write a catch in java with a checked exception that's not declared
20:10timothypratleyHmmm _ato/chouser: n00bish question but I've discovered (sorted-map-by) and (sorted-map) has the same asymmetric exceptions, so maybe its fine to just leave it as is. Or I could easily create a RuntimeException for the compare that doesn't catch and re-throw. It seems to me that wrapping the exception is preferred? If I do that they will be the same. Or I can just make the tests ignore the fact that different exceptions ar
20:16timothypratleyI'm inclined to just remove the exception test and post about it on the group for now.
20:17timothypratleySo I don't cause any damage :)
20:19chouserI don't think the type of exception thrown is part of the promised interface of much of anything in Clojure.
20:20chouserthrowing vs. not throwing perhaps, but not the type of the exception.
20:20timothypratleyyeah good point - I'm happy with that!
20:28rhickeychouser: snazzy!
20:29rhickeylooking at your code, it looks like, when extending with fn defs inline, a macro could get rid of the maps and (fn s
20:30rhickeymaking the extend as concise as the defype inline methods
20:33Chousukerhickey: does the :private metadata work on protocols btw?
20:46rhickeyChousuke: not sure all metadata is flowing through and maintained yet
20:53alexykhi guys -- I'm trying to do mvn install in clojure-contrib, but it needs the clojure jar in maven repo. Going back to the original clojure, pom.xml has no real install targets. How do you deploy clojure itself into maven repo locally?
21:01durka42is there a way to make interleave "greedy"? i.e. if one seq runs out, just conj the rest of the other one on
21:01durka42,(interleave [1 2 3] [4 5 6])
21:01clojurebot(1 4 2 5 3 6)
21:02durka42,(interleave [1 2 3] [4 5])
21:02clojurebot(1 4 2 5)
21:06alexykok, take 2... anyone installs clojure jar into his/her own local m2 repo?
21:07hiredmanalexyk: have you looked at the deploy target in build.xml?
21:08alexykhiredman: yeah, but when I say and deploy it says not so fast. It's some macro, no such target deploy...
21:09hiredmanoh
21:10hiredman*shrug*
21:10alexykfurthermore, some projects depend on clojure-lang jar; is it the same as clojure-1.1.0-alpha-SNAPSHOT.jar?
21:11_atoalexyk: you could just add http://build.clojure.org/snapshots/ as an extra repository in your pom or settings.xml
21:11_atoalexyk: yeah clojure-lang is the same as clojure.. the pom had clojure-lang by mistake in older versions
21:12alexyk_ato: yeah, I can grab a snapshot off external repo, but I wonder how I deploy a local build.
21:13chouserrhickey: should the existing method checks happen at defprotocol macro-expand time, or be in the expansion?
21:13_atomvn install:install-file -DpomFile=pom.xml -Dfile=clojure-1.1.0-alpha-SNAPSHOT.jar
21:13_ato^ alexyk that should do it
21:14chouserif you load something that's been AOT compiled, the macros don't get called, right? So it should be in the expansion.
21:15alexyk_ato: true, too :) still I wonder why there's a pom.xml in clojure off github doing nothing, and a macro deploy in build.xml which does nothing obvious, and a "-setup-maven" target which can't be called...
21:16gilbertleunghi everyone
21:16chouserexcept this is only a problem within the same namespace. You're not going compile one namespace into separately loadable things, so checking at macro-expand time (that is, during non-AOT load or during AOT compile) should be sufficient?
21:16_atoalexyk: because Rich doesn't use maven. the stuff in build.xml is probably for auto-deployment to external repo (like for build.clojure.org to use)
21:17alexyk_ato: ah ok...
21:17gilbertleungdoes anyone kno why, even thought i've set *prxml-indent* to 10, but prxml still prints my xml structure as a one liner?
21:17chouserbut the interning of the protocol methods doesn't happen until until runtime. if you put the two conflicting defprotocols in, say, a do form, when the macros expand neither will see the other.
21:17chouserok, it clearly has to go in the expansion.
21:18chouserrhickey: I'm glad we had this little talk. ;-)
21:21_atogilbertleung: works for me, how are you setting *prxml-indent* ?
21:21gilbertleung(def *prxml-indent* 10)
21:21_ato(binding [*prxml-indent* 10] (prxml [:foo [:bar]])) <-- I did this
21:22gilbertleungoh, icic
21:25_atoif you always want to pring with indent 10, a common idiom is just to wrap the prxml function, so something like: (defn myprxml [& args] (binding [*prxml-indent* 10] (apply prxml args)))
21:26gilbertleungthx _ato
21:28rhickey_chouser: np, glad to help :) you've got it right, must be in expansion
21:34Qvintvsi'm trying to write a function that checks if its argument is in one of three vectors, returning a corresponding symbol, or nil if it's in none of them. what would be an elegant way to do this? i was going to do something like (if (in-col? str nouns) :noun (if in-col? str verbs.... in-col? is a function i wrote, im not sure if there's something like that in clojure already
21:35hiredmanyou could use a multimethod
21:35hiredmanoh
21:35hiredmannevermind
21:37hiredman((comp first first filter) second (map (juxt identity #(.contains % "foo")) v1 v2 c3))
21:37rlbQvintvs: (not-any? pred coll)?
21:38rlbQvintvs: or (some ...) depending on what you want...
21:38hiredman[v1 v2 v3]
21:46_ato,(some #(when (some (partial = :poke) (val %)) (key %)) {:nouns [:cat],:verbs [:poke]})
21:46clojurebot:verbs
21:47somniumno animals were harmed in the creation of this example
21:47_ato,(contains? [:fish] :fish)
21:47clojurebotfalse
21:47_atothat always throws me off
21:48tomoj,(contains? [:fish] 0)
21:48clojurebottrue
21:48tomoj:)
21:49_atoyeah, I'd prefer if it was called contains-key? or something like that
21:54chouserrhickey: I've got a patch, where do you want it?
22:04_ato,(condp #(%1 %2) :dog #{:cat :dog} :noun #{:chase} :verb)
22:04clojurebot:noun
22:05_atoQvintvs: better to use sets if order doesn't matter, will be faster
22:05Qvintvs_ato, ah, thx
22:05chouser,(case :dog (:cat :dog) :noun (:chase) :verb)
22:05clojurebotjava.lang.Exception: Unable to resolve symbol: case in this context
22:13ngocHi, I think Compojure is still young. Which (Java) web framework is suitable for Clojure? I heard from the mailing list that Restlet is good. But doesn't it use annotation, and Clojure does not support annotation at the moment?
22:14somniumngoc: what does compojure not do that you want it to do?
22:18ngocsomnium: Actually I do not have concrete requirements right now, so I can't answer your question. I just want to know about Compojure's alternatives beforehand. Java has a lot of web frameworks right?
22:19_atongoc: I don't think you're going to find many java web frameworks that work well with Clojure as most java frameworks are designed around classes.
22:19_atoyou could use them with gen-class but it would be painful
22:19_atoan alternative to compojure is cascade: http://wiki.github.com/hlship/cascade/
22:23rhickeychouser: email to dev ok - thanks!
22:25somniumngoc: there is also conjure, I'm not sure mature it is either. I would say that compojure does a good job of exposing http request/response to the developer, so its easy to extend it with clojure's strengths.
22:27somniumeg. its remarkably easy to imitate rails insta-routes with a macro if thats what you want
22:35Qvintvsis there a function that gives you a subset of an ordered collections based on start/end index numbers?
22:36Qvintvscollection*
22:37somnium,(take 5 (drop 5 (iterate inc 1)))
22:37clojurebot(6 7 8 9 10)
22:38_mstor if you've got a vector, subvec can do it in constant time
22:58cataskahi, (iterate inc 1) means clojure know "inc" is a function, so i don't have to quote "inc", right ?
23:00_ato,inc
23:00clojurebot#<core$inc__4430 clojure.core$inc__4430@b551e4>
23:00_ato,(type inc)
23:00clojurebotclojure.core$inc__4430
23:00_atocataska: you almost never have to quote functions
23:02cataska_ato: ok, "almost" means there are some exceptions
23:04chouser'inc evaluates to a symbol. inc evaluates to a function
23:10headiusprotocols didn't spook me
23:10headiusI just can't imagine 90% of the devs I've worked with ever getting them
23:12cataskachouser: thanks
23:12hiredmanheadius: "spook" was a poor choice of words on my part
23:13headiusit was
23:13headiusI should gush more about the good aspects of these languages
23:13headiusbut that seems less useful
23:40yacinis there a way to make clojure.xml/parse work on a string of xml?
23:40hiredmanStringReader
23:40hiredmanor whatever
23:41yacingotcha, cool
23:41hiredmanI think I used ByteArrayInputputStream or something like that
23:41hiredmanfrom java.io
23:47yacinjava.io.StringReader worked for what i needed
23:47yacinjust needed to convert it to org.xml.sax.InputSource
23:47yacinbefore i threw it to xml/parse
23:51hiredmanerm
23:51hiredman,(doc clojure.xml/parse)
23:51clojurebot"([s] [s startparse]); Parses and loads the source s, which can be a File, InputStream or String naming a URI. Returns a tree of the xml/element struct-map, which has the keys :tag, :attrs, and :content. and accessor fns tag, attrs, and content. Other parsers can be supplied by passing startparse, a fn taking a source and a ContentHandler and returning a parser"
23:51hiredmanhttp://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html
23:52hiredman,(-> "foo" .getBytes java.io.ByteArrayInputStream.clojure.xml/parse)
23:52clojurebotjava.lang.ClassNotFoundException: java.io.ByteArrayInputStream.clojure.xml
23:52hiredman,(-> "foo" .getBytes java.io.ByteArrayInputStream. clojure.xml/parse)
23:52clojurebotorg.xml.sax.SAXParseException: Content is not allowed in prolog.
23:56yacin,(-> "foo" java.io.StringReader. org.xml.sax.InputSource. clojure.xml/parse)
23:56clojurebotorg.xml.sax.SAXParseException: Content is not allowed in prolog.
23:58yacin,(-> "<test>lol</test>" java.io.StringReader. org.xml.sax.InputSource. clojure.xml/parse)
23:58clojurebot{:tag :test, :attrs nil, :content ["lol"]}