#clojure logs

2009-07-28

00:18durka42has anyone tried to play with clojuratica?
02:35hiredman,(eval #=(java.util.ArrayList. (+ 1 2)))
02:35clojurebotDENIED
02:35hiredmanoh
02:35hiredmanRight
02:37hiredmanI think I would like clojure to treat any java.util.List as a function call
02:49hiredman,'#=(java.util.ArrayList. (+ 1 2))
02:49clojurebot#<ArrayList [+, 1, 2]>
03:04hiredmanah
03:06hiredmanugh
03:36kylesmithAnyone else have the joy of working with clojure then having to switch to fortran? It SUCKS
03:39rysclojure to almost anything else has the same property
03:43AWizzArdkylesmith: while you are at it, prove that the saying "Lisp will make you a better programmer" is true :-)
03:47kylesmithOh, it's pretty bad. There's copy & paste all over the place. There are ~5 versions of the code (copies in people's home directories) with varying features and input/output formats.
03:48kylesmithAWizzArd: Yes, in my opinion, "good programmers use lisp, and lisp makes good programmers better."
03:53kylesmithFor example, there are ~50 places where there are nested loops with the same basic body, but minor differences. Those differences could easily be passed in as a function.
04:15angermanif I proxy a class, can I access it's private members? if so, how?
04:34tomojtrying to do a bit of lazy recursion, seems to be an infinite loop, I can't figure out why. https://gist.github.com/4317ccd3662750ec3876
04:35tomojit's supposed to be a lazy seq for the bits you get by starting with "10", then each iteration you concat the string with itself and chop off the last bit (so, "101", "10110", "101101011"...)
04:38tomojI thought wrapping the body in lazy-seq would prevent the endless recursion. hmm
04:43Chousuketomoj: I think you need (lazy-seq (cons prev-bits (bits ...)))
04:48tomojChousuke: I wasn't clear, the sequence of bits is generated many bits at a time (each iteration the sequence almost doubles in length), but I'm trying to build a lazy seq that just gives you one bit at a time
04:49Chousukehmm
04:51Chousuke,(take 10 (apply concat (iterate (fn [x] (concat x (butlast x))) [1 0]))))
04:51clojurebot(1 0 1 0 1 1 0 1 1 0)
04:52tomojstrange, that code looks right, but the answer is wrong
04:53Chousukewell, it starts with 10
04:53Chousukethen 101
04:53tomojoh, I see, the iterations are all stuck together
04:54Chousuke,(take 3 (iterate (fn [x] (concat x (butlast x))) [1 0])))
04:54clojurebot([1 0] (1 0 1) (1 0 1 1 0))
04:57tomojtrying to get (take 10 ...) to return (1 0 1 1 0 1 0 1 1 1)
05:04Chousuke,(take 10 (apply concat (iterate (fn [x] (concat x (butlast x))) [1 0 1]))))
05:04clojurebot(1 0 1 1 0 1 1 0 1 0)
05:05Chousukehmm
05:08Chousuke,(take 10 (apply concat (iterate (fn [x] (concat x (butlast (concat x (butlast x)))) [1 0 1]))))
05:08clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$iterate
05:11Chousuke,(take 10 (apply concat (iterate (fn [x] (concat x (butlast (concat x (butlast x))))) [1 0])))
05:11clojurebot(1 0 1 0 1 0 1 0 1 0)
05:12Chousukehmmh
05:37angermanhow do I access a member of a class?
05:37angerman(. myinst field) seems not to work :(
05:38Chousukeit should
05:38Chousukebut you should use (.field obj) instead
05:39Chousukeif it's a static field, Classname/field will work
05:53tomojChousuke: https://gist.github.com/4317ccd3662750ec3876
05:53tomojthat works
05:53angermanChousuke: it's a private field
05:53tomojbut I'm sure there is a prettier way to do it
05:55angermanChousuke: so what I do is: create a swing class with NetBeans
05:55angermancreate a clj file with (ns com.test.myclass :gen-class :extends Frame :post-init setup)
05:56angermanand then I define (defn -setup [inst] (prn (.textbox inst)))
05:58angermanAnd then I get No matching field found: textbox for com.test.myclass
06:01angermanok, I'm astonishingly stupid
06:02angermanprivate fields are not accessable from within the class not from subclasses as I understand
06:12AWizzArdWhen I have a public field in an instance of a Java class, how can I then access it from within Clojure?
06:12AWizzArdA public non-static field. So, not like Character/MATH_SYMBOL or something like that.
06:13AWizzArd,Character/CURRENCY_SYMBOL
06:13clojurebot26
06:13AWizzArdif there is not a getter for that non-static public field...
06:18rottcoddAWizzArd: (.instanceMember instance args*)
06:28AWizzArdthx
07:07lpetitHi all
07:07lpetitUh oh, still sleeping or just awakening in the U.S. :-)
07:46Fossihi
08:47cemerickrhickey: you'll likely find this interesting, assuming you haven't already seen it: STM.NET: http://blogs.msdn.com/somasegar/archive/2009/07/27/stm-net-in-devlabs.aspx
08:48ChouserI assume that's the kind of STM where they let you go on your merry with with mutable object fields and such?
08:49cemerickyeah. Ostensibly compatible with manual locking as well.
08:50rhickeycemerick: thanks, another entry in the slap transactions on mutable OO game
08:51cemerickwhich, hell, might work with some trickery under the covers. What I do know is that I've enjoyed not having to worry about locks and race conditions over the past year, so I'd rather not have any developer-controlled locks anywhere near my code.
08:52cemerick(maybe "userland-locks" is a better term)
08:52ChouserI think the biggest danger there is the common name with Clojure's feature. ...if such schemes succeed then why use Clojure? ...if they fail, why is Clojure using a debunked technology?
08:52cemerickChouser: you mean "STM"?
08:52Chousercemerick: right
08:52rhickeyChouser: I just had the same thought, maybe it's a misnomer in Clojure since it doesn't ever pretend its reference types are fields
08:53cemerickwell, the first time I ever heard about STM was in connection with haskell, which certainly doesn't look like anything the .NET guys are doing *shrug*
08:53rhickeyOTOH, Cliff Click, Brian Goetx et al are quick to pick up the difference in Clojure that mutable things are called out as such
08:53rhickeyGoetz
08:53ChouserTransactional Reference Types
08:54rhickeybecause in many STM designs there are holes re: what happens if you touch the field transactionally and non
08:55cemerickI remember listening to a podcast introducing the STM concept, and the interviewee said STM:locking::GC:malloc -- with that perspective, it's easy to see that there can be widely disparate approaches to STM, so if one works (or not), it doesn't indicate anything about others.
08:55rhickeycemerick: true, but that point needs to be made a lot right now, people are making broad statements about STM that simply don't apply to every approach
08:55Chouseranyway, my central reasons for choosing and loving Clojure continue to have little to do with concurrency. I hope people realize that if STM in general or even Clojure's current approach breaks down in some scenario, that's no reason to abandon Clojure's other unique features.
08:57cemerickrhickey: I'm sure there will be a period where some widely-available STM will just fall down, leading many to say that it doesn't work (the way that early Java GC made people say GC was a broken concept, despite the scads of other VMs that had GC working well years before)
08:57Chouserand of course Clojure's STM isn't terribly deeply embedded in the language implementation. A new set of reference types with some new organizing feature could live alongside and/or replace the current STM.
08:57cemerickChouser: I think as soon as an alternative STM impl is written for clojure (which seems semi-inevitable), that will clarify things.
08:58rhickeyChouser: I'm looking forward over the next year to demonstrating more of the value of the persistent data structures outside of concurrency, but that is the easiest case to make for FP - with concurrency mutability is a catastrophe
08:58cemerickhah!
08:58Chousercemerick: :-)
08:59rhickeyIt's much harder to tell people their programs are too hard to understand
08:59Chouserheh
09:00Chousukewell, it helps even with single-threaded code; you don't have to worry about some class somehow obtaining a reference to data you're using and modifying it as part of its private implementation when you call its API.
09:01Chousukebut I guess that
09:01Chousukethat's just functional programming in general*
09:01rhickeyChousuke: right
09:02Chouseruntil someone has experienced it, how can I describe the sinking feeling I get when I realize a function is written imperatively, and I'm going to have to pay a lot of attention to the order of operations, which ones mutate what, etc.
09:03rhickeythe sinking feeling when facing a method that returns void, or that takes or returns a mutable collection...
09:03Chouserthe panic climbing my spine as I realize how many different classes and methods I'm going to have to keep in my head to understand the 5 lines in front of me
09:04tomojis there already a convenient way to map with (comp fn fn ... fn) where you want n compositions?
09:04clojurebotmap is *LAZY*
09:04Chousertomoj: you have those fns in a list?
09:04tomojChouser: no, they're all the same
09:05rhickeythe pain of learning a different api for every type of information, with no ability to combine it with any other information
09:05Chousertomoj: oh! maybe 'iterate'
09:05tomojthat is, I want to map a single function multiple times, really
09:05tomojChouser: ah, yeah, I could iterate and take the nth of that lazy seq, good idea, thanks
09:05cemerickrhickey: returning to the stable-static-names topic: I had a (likely) stupid idea last night, which you've likely thought of before...
09:06cemerickCouldn't newnew produce the name of the class it generates by hashing the number and names of the fields it closes over? That's roughly what serialVersionId does automatically, and for stable data structures (like the core collections, app-level structs), that should be perfectly compatible with most if not all "ephemeral" serialization use cases.
09:06lbjhaha, why are you guys whining ?
09:07rhickeycemerick: I was thinking about automatic stable name generation yesterday, it's tricky to guarantee uniqueness
09:07rhickeyyou definitely need to capture context
09:07rhickeyas fn names do already by using nesting $ conventions
09:08cemerickwell, I'm glad I'm only 24 hours behind you ;-)
09:08rhickeybut that means renaming a creating context breaks things
09:09rhickeybut a pure content-based hash would not prevent duplicates created in different contexts
09:10cemerickI'm not really following the "context" term -- do you mean conflict between two usages of newnew in the same ns with the same fields?
09:10rhickeythere were some interesting threads about serialization of anonymous inner classes
09:10rhickeycemerick: sure, why not
09:10rhickeyor same fields in different ns
09:10rhickeyor different fns in same ns
09:10rhickeydo you include the creating fn in the name?
09:11cemerickwell, same fields in different ns are already different classnames: foo.bar.newnew1234 vs com.foo.newnew1234?
09:12rhickeygenerically, whatever you include in the context part of the name can't change without breaking serialization. The ns might be presumed stable, but I imagine the constructing fn not so much
09:13cemerickreally? That seems like a *very* reasonable restriction to me.
09:13rhickeyso, you leave out the fn, leaving ns+hash, even if you hash the supers and fields there can be dupes
09:13cemerickwe're just talking about constructing fn's name, right?
09:13rhickeycemerick: if you buy the fn-name restriction the context is much smaller
09:14rhickeyusually 1:1
09:14rhickeyso are done
09:14cemerickoff the top of my head, I'm not sure why that wouldn't be a reasonable constraint
09:15cemerickSimilar in concept to "change the Java classname, you can't deserialize previously-persisted graphs"
09:15Chouserbut this is much more subtle, surely, than a name change.
09:15rhickeycemerick: it just seems completely unrelated to the name of the type, might be something like make-foobar
09:16rhickeycom.my.ns.make_foobar$obj123456
09:16rhickeyalso, right now fn names include gensym incrementing id components...
09:16Chouser(defn [] (newnew)) vs. (defn [] (let [f (fn [] ... (newnew))] (f))
09:17cemerickwell, the definition of that fn is intrinsically bound up with the newnew instance it produces -- tying the classname to it in some way makes good sense, at least on the surface.
09:17rhickeyif they didn't you couldn't redefine the fn
09:18rhickeycemerick: but the fn could do many things, and have subfns each of which creates instances
09:19cemerickrhickey: track the fn names through each level of context...? com.foo.make_bar$make_special_bar$obj1234
09:19rhickeycemerick: in any case, I'm not sure what problem auto-generated stable names solves, they'll have the same restrictions as provided names
09:19cemerickit's hard for me to conceptualize implementation fully, as I'm sure there's stuff going on that I'm entirely unaware of
09:20Chouserhuh. I just stumbled on another context where I want to turn a series of callbacks calls into a lazy seq, just like lazy-xml does.
09:20cemerickrhickey: the point being, they'll be *stable* across builds, assuming fields/context don't change
09:20rhickey,(class ((fn [] (fn[]))))
09:20clojurebotsandbox$eval__5324$fn__5326$fn__5328
09:20rhickey,(class ((fn [] (fn[]))))
09:20clojurebotsandbox$eval__5333$fn__5335$fn__5337
09:21rhickeynot changing fn names
09:21rhickeynote
09:21cemerickrhickey: OK -- don't do that!
09:22rhickeythe reason auto-generation of names comes up in the serialization of anonymous inner classes discussions is there is no space on the syntax for a name, but there could be here
09:22cemerickseriously, that's a completely different usage than named fns
09:22rhickey,(class (fn foo []))
09:22clojurebotsandbox$eval__5342$foo__5344
09:23Chouserwell, the discussed solution for that was generating a stably-named interface, then a uniquely-named concrete implementation for each re-definition.
09:23rhickeyrhickey: ,(class (fn foo [])
09:23rhickey ,(class (fn foo [])
09:23rhickey,(class (fn foo [])
09:23clojurebotEOF while reading
09:23rhickey,(class (fn foo []))
09:23clojurebotsandbox$eval__5347$foo__5349
09:23Chouserbut that doesn't help when a serializer wants a stable name for the concrete thing, I guess.
09:23rhickeynamed fns same problem
09:24cemerickrhickey: oh, I'm not saying stable names for named fns are produces now, but it seems like that's what could happen in the future.
09:24rhickeythe conclusion I came to was that autogenerated stable names don't lift any restrictions other than the one that you provide a name
09:25rhickeyredefinition without restart would still be precluded
09:25rhickeyclassloader problems are the same
09:26cemerickI think that's pretty reasonable.
09:26rhickeyI guess they do prevent people from trying to use the name explicitly
09:26clojurebotThey found no relationship between a programmer’s amount of experience and code quality or productivity.
09:26cemerickWell, explicit usage *is* convenient (e.g. passing clojure data structures into clojure APIs from java, etc)
09:28rhickeyI guess I'm most comfortable with, if you need a name, name it, and it's AOT-only
09:28cemerickrhickey: is it possible that redefinition would be allowable given a certain (perhaps init-time) configuration (with big honking warnings for osgi users, etc)? e.g. if I've got a clojure-only production environment and I know what I'm doing, redefing named classes is a helluva feature.
09:28rhickeyredefinition requires restart would bleed into named fns if you wanted those to be stable as well, soon we're back to java-like dynamism, i.e. not much
09:30cemerickwell, the use-cases for redefinition of the things you'd want to be named (datastructures, app-level structs) are few and far between (except maybe for you, ironically enough?)
09:30rhickeycemerick: no one is really supporting redefintion without reload, they are just auto-reloading
09:30rhickeyare you proposing some 3rd party trickery?
09:31cemerickyou mean stuff like JavaRebel, etc?
09:31cemerickgah, hopefully not
09:32rhickeyok, but without something like that I don't have a way to change the definition of a named class
09:32rhickeyalready loaded
09:32rhickeyin classloaders I'm not able to toss
09:34rhickeyyou are asking me to implement Java Rebel
09:34cemerickrhickey: right, I'm throwing a hail mary towards, in a well-defined configuration, clojure doing its own classloader trickery. Clearly 180º away from your stated mission with newnew, but I'm 1 for 1 raising stupid ideas already this morning :-)
09:35cemerickJavaRebel is *extremely* crude.
09:35cemerickA clojure-only scheme would likely be far, far simpler, and in a clojure-only production environment, make life *really* pleasant.
09:35cemerickJust an idea :-D
09:35rhickeycemerick: I've never tried it, but it is certainly fighting a boatload of presumptions in the JVM core
09:36cemerickthat's why I said "in a well-defined configuration" *shrug*
09:36rhickeycemerick: even a Clojure-only scheme didn't work out - I can't force everything to use my classloader
09:37cemerickabsolutely we can, given a clojure-driven app entry point
09:37rhickeyor are you suggesting I replace the root classloader? is that even possible portably?
09:37cemerickno, no need to do that.
09:39rhickeyso how is some 3rd party library code doing serialization, calling Class.forName, going to use my loader?
09:39cemericke.g. java clojure.lang.DynReloadMain -mainclass com.foo.MyClass, where MyClass would otherwise be my main entry point, but DynReloadMain (or whatever) sets up the classloader regime. I've done the similar things long, long ago to support live application updates.
09:41cemerickrhickey: it works just like any other classloader -- the classpath just gets provided as an application-level argument (rather than via -cp)
09:43rhickeycemerick: I could see doing something like that for an app, but for a language? It will enable all kinds of things that can't be supported except when running like tht
09:43rhickeythat
09:45cemerick*if* the compiler were aware of that potential config, then it would be possible to reload classes via a REPL, rather than hard-swapping new jars, etc (which, you're right, is easily done app- or framework-level)
09:47rhickeycemerick: I'm confused, are you pitching for a dev-time or production-time feature? If the latter I don't see how it works at framework level, all the environments have their own classloading scheme in place
09:48rhickeymy current focus is on making Clojure a better citizen there, not a trickier one
09:48cemerickrhickey: Production-level, and I'm presuming an all-clojure (or, alternatively, no-framework) environment.
09:48cemerickrhickey: anyway, just an idea, and a speculative one at that
09:52rhickeycemerick: I guess the fundamental problem is basing language-level capabilities around such contexts
09:59rhickeyhrm: http://www.computerworld.com/s/article/9135958/Sun_s_JRuby_team_jumps_ship_to_Engine_Yard?taxonomyId=57&amp;pageNumber=1
10:01rhickeythat's kind of a shame
10:01Chousersounds like they'll keep working on JRuby though.
10:05rhickeyyes, good they'll be working on JRuby, but sad in that they were an alternative lang inside Sun, with access to people like John rose eager and able to enhance the JVM
10:06Chouseryeah
10:06Chouserhope they misjudged the environment, but I guess that strikes me as unlikely
10:15AWizzArdrhickey: would it in principle be possible to add a "defclass" to Clojure which would be similar to defstruct from user POV, but internally more like closures, but even more efficient?
10:15Chousermore efficient thans closures??
10:15rhickeyAWizzArd: you should just wait for newnew and try it out
10:16AWizzArdChouser: yes. I did some realistic tests, just because I need it. I prepared a posting for the Group. I already supposed that newnew can be helpful.
10:17AWizzArdChouser: anyway, what I found out is that instantiating a StructMap is slower than returning a closure, which is again slower than making an instance of a Java class.
10:18AWizzArd(defclass Foo #^String x #^clojure.lang.Keyword y) ==> public class Foo { private final String x; private final Keyword y; } plus two getters.
10:19AWizzArdIn Clojure one could then say (def bar (make-instance Foo "Hello" :clojure)) and access the elements via (:y bar) or (:x bar).
10:19rhickeyAWizzArd: this is not going to happen
10:20AWizzArdand (assoc bar :x "Yes") would create a new instance, so (make-instance Foo "Yes" (:y bar)).
10:20AWizzArdrhickey: would that have negative impact on other things?
10:20cemerickAWizzArd: you're describing what I did with gen-bean
10:21rhickeyAWizzArd: there is already gen-class, could be enhanced for inline defs
10:21AWizzArdAnd? What are your experiences with it?
10:21cemerickthough the code that's posted publicly is pretty old, and it's improved much since then
10:21clojurebotWhat is meta
10:22AWizzArdIn my code I also checked how fast read accesses are. I had 340k objects, stored in three different ways: StructMap, closure, Java class. Each object contained 4 fields/slots. Reading all 4x340k fields took 200 msecs for StructMaps and closures. It took 150 msecs for the Java class.
10:22AWizzArdrhickey: well, I am not particular in favour for a defclass operator, but a mechanism which is achieving that.
10:23AWizzArdSomething that is as simple as a defstruct and which also has the same interface would make those interchangeable.
10:24AWizzArdHowever it is called, it is nice as long it would reduce the pressure to write Java code :-)
10:24AWizzArdSuch a mechanism would widen some bottlenecks. That could be nice.
10:25AWizzArdBut rhickey, I also keep in mind what you said in one of your videos. You said you made the experience in CL that you wrote a nice algorithm with lists and later switched to some other data structure and had to rewrite bigger portions of his code.
10:26AWizzArdJust an example: if people begin with structmaps and later find out they are too slow they want to rewrite their algorithm with closures maybe. But that would not be so trivial always, because the callers are affected.
10:26AWizzArdMaybe the newnew is exactly that thing which will give very good performance for immutable throw-away objects.
10:26rhickeyAWizzArd: I recently added batch mutability and parallel ops to vectors, and am now working on newnew, so, what are you attempting to convey to me?
10:27rhickeyno offense, but this is just distracting now, I've heard your request
10:27AWizzArdNothing, I just would like to know if such an operator would be doable. Maybe some mechanisms in the JVM don't allow that.
10:29AWizzArdTha parallel stuff sounds exciting, and I am looking forward to see what newnew will bring.
10:34angerman_rhickey: as I understand gen-class does nothing when I don't compile the clj?
10:35rhickeyangerman_: right
10:37angermanrhickey: how would I go about extending a given class and overwriting some methods? just proxy it?
10:37Chouserangerman: use proxy when you can
10:38Chouserangerman: there are some things it can't do, but it's much more convenient than gen-class
10:39angermanI quite like netbeans gui builder. so I end up coding some outlets into the gui builders source and overwrite them with clojure
10:39angermanseems to be the best solution I came up with ...
10:39Chouserproxy usually works great for building callbacks or listeners
10:40angermanChouser: ha, :) too stupid is netbeans on this end though :)
10:41angermanit's guibuilder creates lots of private stuff (esp. callbacks) ... so one can't subclass it's forms straight.
10:42Chouserhm.
10:42AWizzArdangerman: you can write a public exporter method.
10:43AWizzArdThat gives you access to all gui elements from Clojure.
10:43ChouserI'm successfully using proxy to specialize a C++ class (via swig)
10:45rhickeyangerman: you can set the default access for the things it generates to public
10:45cemerickChouser: That's pretty hardcore :-)
10:46cemerickI need to figure out how to embed assembly into clojure forms. Gotta keep raising the bar.
10:46Chouserheh. swig has actually made this pretty easy.
10:47rhickeyangerman: preferences/options/guibuilder/variablesmodifier
10:47rhickeyoptions/miscellaneous/guibuilder
10:47Chouserthat is, it's take a few days to figure out the right incantations, but in the end they are short and unrepetetive.
10:48y-combinatorhello. i have a problem using clj-record. ive cloned from git and successfully compiled using 'ant jar', aded .jar to classpath(both to $CLASSPATH and to extended SLIME classpath. however i always get 'Could not initialize class clj_record.validation__init
10:48y-combinator [Thrown class java.lang.NoClassDefFoundError]' and similar errors for another clj-record members.
10:49angermanrhickey: I'll look for that in a second
10:50angermanhow do I have to understand this "Each method fn takes an additional implicit first arg, which is bound to 'this."
10:50angermanI though if my prototype was foo(String a, String b) i'd define (foo [this a b] ...)
10:50Chouserangerman: yes
10:50angermanin the proxy though it seems I get called like (foo [a b])
10:50y-combinatoror maybe someone knows another clojure persistence lib? it seems that clj-record is the only one native clojure solution.
10:51Chouserangerman: oh, in proxy?
10:51angermanyes
10:51rhickeyangerman: right, 'this' is implicit in roxy, explicit in gen-class
10:51angermanso this is just there ok
10:51cemerickangerman: this might be instructive w.r.t. 'this':
10:52Fossiy-combinator: sounds like a classpath problem. perhaps check the jar if everything is where you expect it to be
10:52cemerick,(str (proxy [Object] [] (toString [] (str "hello from" (class this)))))
10:52clojurebotjava.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
10:52cemerickah, bummer
10:52Chousery-combinator: I believe the -cp command-line option and the CLASSPATH env var don't work well together
10:52cemerickangerman: anyway, see above ^^
10:52Fossiy-combinator: and did you add the jar, or just the directory where the jar is?
10:53angermancemerick: well I think i was missguided by the line in the proxy doc
10:53rzoonlisppaste8: url
10:53lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
10:54cemerickI think the docs are correct. The 'this' argument is implicitly bound.
10:54cemerickmaybe "first" should be omitted, as that's an implementation detail
10:56Fossii found the docs aren't so easy to understand in that case as well
10:56cemerickFossi: "first" being the rough edge?
10:56cemerickor the implicit arg?
10:56Fossiit makes sense once you know what happens, but it's easy to be confused by it
10:56Fossithe implicit part i think
10:57Fossiespecially since for gen-class'ed methods you have to write it explicitly
10:57cemerickyeah, that's a worthwhile point.
10:58cemerickproxy is going a bunch of majick behind the scenes, which might be the motivation there
10:58cemerickor, perhaps just the desire to eliminate repetition of 'this' everywhere.
10:59cemerick...which definitely can't be easily done in conjunction with gen-class, short of sustaining a perf penalty.
11:01rzooni implemented ssl-server in contrib and would like some feedback if people have a minute
11:01Fossiyeah
11:01Fossior having to "defmethod" or "defmember" instead of defn
11:01angermanrhickey: ahh well, yes setting the variables protected/public that did work, but if I create outlets for ActionListener they will always be private :/
11:04cemerickinteresting that Nutter et al. bailed from Sun.
11:06AWizzArdangerman: you can write one simple getter in NetBeans which will return an array (or hashtable or whatever) with all the fields which you want to access.
11:20y-combinatorstrange thing with my clj-record problem is that if i try to include unexisting class i get FileNotFoundException, but when i try to include some class from clj-record i get NoClassDefFoundError
11:21y-combinatoruser=> (require 'clj-record.valudation)
11:21y-combinatorjava.io.FileNotFoundException: Could not locate clj_record/valudation__init.class or clj_record/valudation.clj on classpath: (NO_SOURCE_FILE:0)
11:21y-combinatoruser=> (require 'clj-record.validation)
11:21y-combinatorjava.lang.NoClassDefFoundError: Could not initialize class clj_record.validation__init (NO_SOURCE_FILE:0)
11:21y-combinatoruser=>
11:21y-combinatornotice error in first require statement
11:25y-combinatorand if i unpack clj-record.jar there is clj_record/validation__init.class inside
11:26y-combinatormaybe there is broken meta info in this jar or something...
11:28rzoom_here is the diff of the change for the ssl-server in contrib, pastebinned.
11:28lisppaste8rzoom pasted "contrib ssl-server" at http://paste.lisp.org/display/84314
11:29rzoom_not sure what to do about the ciphers
11:30Chousukewhy the weird apply args thing?
11:31rzoom_could have explicitly laid out 1,2, and 3 arg versions
11:31Chousukeit'll only work with a single arg anyway :/
11:31Chousukesince the anonymous function takes only one
11:33Chousukealso, if you're going to send patches to contrib, you should use git format-patch instead of git diff. That way it'll include the commit info.
11:34y-combinator Could someone please send me working copy of clj-record.jar?
11:37Chousukerzoom_: if you want the ciphers to be configurable maybe you could export a *ssl-ciphers* var and use that in ssl-server-socket?
11:39Chousukerzoom_: (binding [*ssl-ciphers* ["some_weird_string_here" "some_more"]] ...); not very clojurey I guess, but perhaps passable.
11:40rzoom_yeah, suggestions on that welcome. :0
11:40rzoom_erm, :)
11:40Chousukeand, function parameters are usually called just "f" :)
11:42ChousukeI usually avoid single-character names but in this case it's a convention and I can't think of a better name :P
11:45rzoom_sounds good. changing fun -> f and the apply issue
11:49rhickeyheadius: best of luck at EY
11:50headiusrhickey: thanks much...it feels like the right move to really keep jruby moving forward
11:50headiusI'll still be at JVMLS, hope to see you there
11:50rhickeyheadius: yup, I'll be there
11:51headiusI've been contemplating a thin rubygem that bundles either clojure or clojure's collections/etc for rubyists to use
11:51headiusthere's a need for a good immutable collections library in ruby, at the very least
11:51rhickeyinteresting
11:52headiusand if it was just a "clojure gem" people could use either/or at will
11:53rhickeyit would be really interesting to see an interface to clojure where you could send across code-as-data rather than strings
11:54rhickeyyou can obviously from Java, but it's a bit gross, from something like Ruby would be easier
11:54rhickeyJRuby that is
11:55headiusyeah, it would not be at all difficult to build a dsl in Ruby that produces "code as data" in a nice, compact way
11:55headiusa clojure-builder
11:57Chouserthat sounds neat.
11:59cemerickI think something like that in javascript (a simple remoting interface to a clojure backend) would be my ideal web-dev environment.
11:59headiusit could either be inside-out sexps a la foo {bar {baz 1}} or literal arrays translated behind the scenes a la [foo [bar [baz 1]]]
11:59headiuseither way the structure would be pretty simple to generate
12:00headiuswe have a few folks using jruby+clojure already, so I know there's interest
12:01Chouserjavascript literal object syntax wouldn't be sufficient for clojure literal maps. JS array -> CLJ vector should be ok. how to do literal lists though? and keywords?
12:01Chouseror am I misunderstanding the context?
12:02rhickeyChouser: no, that's the general idea
12:02ChouserI'd think ruby would have the same challenge, though it has keywords and perhaps maps covered.
12:02headiusI suppose that could be [:foo [:bar [:baz 1]]] and basically just *be* a sexp
12:02Chouserstill need to distinguish between a clojure vector and list
12:03angerman:( meh ... clojure.http is giving me Connection Reset errors
12:03rhickeyyeah, you'd ideally need list/vector/map/symbol/keyword/number/string
12:04rhickeyall are components of Clojure's 'sexprs'
12:04headiussymbol/keyword and list/vector would require differentiation, but that's not a huge issue
12:04rhickeyI guess many langs have either list or vector, but not both
12:05rhickeyas literals
12:05headiusyes
12:06headiuswouldn't be difficult as simply keyword-like methods
12:06rhickeydo JRuby collections implement the corresponding Java collection interfaces? j.u.Map etc
12:07headius[foo list(a, b, c, d)]
12:07headiusrhickey: yes
12:07headiusthere's a bit of mapping/coercion logic across the boundary, but they do impl
12:09rhickeyright now most of the compiler presumes them, because it was written before the Clojure data structures implemented j.u. interfaces
12:09headiusif we could just produce ruby structures and dump it directly into clojure's compiler, that would obviously be simplest
12:09rhickeyright
12:09rhickeyanother consideration for cinc
12:10headiuswe'd need a better way to map symbols, since our symbol type doesn't impl anything you'd find useful
12:10clojurebotmap is *LAZY*
12:10cemerick...and then another thread twiddles a mutable map passed into the compiler while the latter is doing its thing? *shudder*
12:10headiusseems like it's doable though
12:10rhickeycemerick: exactly, it's so safe and thought-free now
12:11rhickeyI really don't know that it is possible, since for Clojure code-as-data also means code as values
12:11cemericktoo bad there's no j.u.ImmutableList interface, etc.
12:12rhickeycemerick: there's a protocol for read-only but that's hardly the same
12:12rhickeyand immutable still less than persistent, I'm sure there are places where I just take some data structure handed to me and conj onto it, producing a new value with no hassles
12:13rhickeypersistent data structures spoil you forever
12:14cemerickindeed. I get very frustrated anytime I need to dig back into our java (1.4-era!) legacy bits.
12:18Chouseralso no metadata syntax in ruby/javascript
12:19Chousermaybe only needed for type hints (otherwise with-meta might be sufficient), but it'd be a shame to have to change an entire fn def over to a string just because you want to avoid reflection inside somewhere.
12:21RaynesI have a Pepperoni Pizza Calzone, and low end tornado probabilities.
13:00angermanhow would I map over a hash-map?
13:02stuartsierraSame as you map over anything else. The argument to your map fn will be Map Entries.
13:05angermanwow ... apache http components is verbose
13:13bennois there some clojure macro/function that works like ruby's flatten? that is, flattening a multi-dimensional array into a one-dimensional array?
13:13angermanyes! it works!
13:14angermanbenno: hmm like [[1 2 3] [4 5 6]] -> [1 2 3 4 5 6] ?
13:14bennoyes
13:14stuartsierrabenno: yes, in clojure.contrib.seq-utils
13:15Fossihow do you proxy gen-classes
13:17bennothanks
13:19angermanwhat's a good response code for "failed login" on the http protocol?
13:19stuartsierraangerman: Unauthorized?
13:19stuartsierraForbidden?
13:20angermanI guess Forbidden is better though still not perfect :
13:20angermanUnauthorized needs to have the challage option in the response which is not good.
13:33lisppaste8Fossi pasted "untitled" at http://paste.lisp.org/display/84326
13:34Fossiany clue as to what the dalvik vm is telling me?
13:34Fossii guess it happened as i put in the clojure-contrib jar into my deps
13:35Fossii'm verifying that, i guess then it's off to devide and conquer the contrib.jar :\
13:38fyuryunot really a Clojure question, but anyone used the asm library that comes with Clojure?
13:39stuartsierrafyuryu: I played with it a bit
13:39fyuryuI'm trying to generate simple classes (with only fields)
13:40fyuryustuartsierra: do you know how to set a final static field (not primitive type) when generating a class?
13:41stuartsierra'fraid not
13:41fyuryuthe visitField method only accepts string, integer etc.
13:42fyuryustuartsierra: I'll keep on trying
13:42stuartsierraisn't there a different visit method for static fields?
13:43fyuryufyuryu: I also tried with putStatic in a static ctor that also failed
13:43fyuryuerr, that was to stuartsierra
13:46stuartsierraside note from yesterday: (let [x 1, y 2] (fn ...)) generates a class with instance fields x and y
13:48fyuryustuartsierra: hm, that part of Clojure is implemented in java. I'll have a look
13:48dysingerwtf is headius doing in here ;)
13:48headiusshhhh
13:48dysinger:) j/k
13:49Fossigreat. no wonder this code was acting all strange. i didn't have my changes deployed for the last couple of hours
13:49Fossiand i really wondered, why it all wouldn't work
13:50headiusdysinger: how you been? doing all clojure now?
13:53lbjDoes anyone have that Java cup logo wear the vapor was a lambda ?
13:54Chouserlbj: I've got one where the vapor is a devilish face
13:54lbjOk
13:55dysingerheadius no we are converting to jruby from mri and using clojure w/ hadoop on the backend for it's functional immutable goodness :)
13:55dysinger(jruby on the front end)
13:55dysingerheadius congrats on the team move :) that's really cool
13:56Chouserlbj: http://www.zazzle.com/java_2_evil_edition_2_logos_mug-168138170629314846
13:56fyuryustuartsierra: but those fields are probably of Object type, and I can generate those
13:56fyuryuwith no problem
13:56dysingerheadius: hope it works out - I was really taken aback by the oracle tak over
13:56dysingers/tak/take
13:56lbjChouser: Thanks but no thanks, I need it to put on my website, and naturally I dont want to associate with anything evil/devilish
13:57Chouserlbj: ah, I see.
13:57stuartsierrafyuryu: no, they can be type-hinted
13:57fyuryustuartsierra: oh, right!
13:58headiusdysinger: you should find some time to wire up a clojure gem that exposes its collections and maybe provides a nice API/DSL for dumping code into clojure from Ruby
13:58headiusfor the collections alone there'd probably be a bunch of folks interested
14:05stuartsierrait's actually pretty straightforward without any conversion, since they implement the java.util interfaces
14:08headiusstuartsierra: yeah, probably true, I would only expect that a wrapper would define any additional complement of Ruby methods users would expect
14:09headiuswe do decorate List and Map and Enumerable and so on already
14:09headiusso there might not be much to do
14:09headiusbut having it in a gem would mean you could "gem install clojure" and have it just be there
14:46rzoom_ok, updated ssl-server, comments please.
14:46Raynes(comment Hi there.)
14:46Raynes:p
14:46lisppaste8rzoom pasted "ssl-server" at http://paste.lisp.org/display/84337
14:47rzoom_; nice
14:48rzoom_ugh, 'fun' in the description, should be 'f'
14:48Chousukerzoom_: I just now noticed, but what is the doto for?
14:48rzoom_to set the ciphers
14:48Chousukerzoom_: you're only doing one operation :/
14:49Chousuke(.setEnabledCipherSuites ss ciphers) would be enough :)
14:49rzoom_would that return the ss object?
14:49rzoom_or the result of the member function call?
14:49Chousukeah. probably not.
14:50Chousukebut you could explicitly return ss after it I guess.
14:50rzoom_yeah, matter of style I guess
14:51ChousukeThat repetition annoys me though. I wonder if there's a way to get rid of it :/
14:51rzoom_yeah, that was my original though with using the apply before somehow
14:51rzoom_all 3 versions are essentially identical
14:52rhickeypoll - what's the greatest number of args you have in a finite arity fn?
14:52drewrrhickey: I use defnk after about two
14:52rhickeyreally?
14:52Fossiwhat's defnk?
14:53ataggart5
14:53Fossi,(doc defnk)
14:53clojurebot"clojure.contrib.def/defnk;[[fn-name & fn-tail]]; Define a function accepting keyword arguments. Symbols up to the first keyword in the parameter list are taken as positional arguments. Then an alternating sequence of keywords and defaults values is expected. The values of the keyword arguments are available in the function body by virtue of the symbol corresponding to the keyword (cf. :keys destructuring). defnk accepts
14:53rzoom_have one with 6
14:53Chousukerzoom_: I suppose it won't work to pass nils to the three-argument version?
14:53Fossineat
14:53drewrrhickey: seems to be my pattern lately; definitely by 5 or 6 though
14:54rzoom_Chousuke: null pointer exceptions :(
14:54drewrif I'm passing in that much maybe the fn is trying to do too much
14:54stuartsierrapoll answer: 6
14:54hiredman6 sounds like a lot
14:54hiredman:P
14:55drewrunless it's a configuration-type fn, like setting up a db conn, where it makes sense to use keywords
14:55stuartsierrathat's the max, typical is 1-2
14:55rzoom_doing simulations, seem to carry around quite a bit of state
14:55rhickeycounter-poll: who would be troubled if I reduced the fixed-arity max in IFn (currently 20) to say, 10?
14:56stuartsierrawouldn't hurt me
14:56ChousukeI would be troubled if I saw a function taking 10 arguments :P
14:56ChouserI don't think I have more than 6. 10 is a sane limit
14:56Chousuketrying to cut back on the amount of copy-paste code you need? :)
14:58ataggart10 sounds sensible to me
14:58Fossii just saw the 20 limit and wondered: that seems a whole lot
14:58stuartsierraMaybe you need to implement Macros for Java (TM).
14:58Fossiso 10 is more reasonable
14:58rhickeypoll3: If I could give you the ability to declare long and double primitive args (any combination, with Object too), how many args would you really really need for fns taking primitives? (hint: 3 or 4 are good answers)
14:59hiredman4 sounds good
14:59Chousukepeople needing more should be able to emulate it with (defn foo [a whole lot of args and & [then some more]]), right?
14:59stuartsierracan't think I'd use that much, personally, but I don't do much math
15:00RaynesI think 11 sounds reasonable. Even numbers aren't my thing.
15:00hiredman4 would be nice because you could at least pass in two 2d coords
15:02RaynesI say 3 because 4 is an even number. >:|
15:02hiredmanhmmm, seafunc moved meeting locations to place that I actually sort of know where it is
15:04Drakesoncan I require A.X, A.Y, A.Z all as A?
15:05ataggartDrakeson: huh?
15:05ataggartyou want to require everything in the A ns?
15:06Drakesonataggart: yeah, almost. everything in one of A.X, A.Y, A.Z
15:06hiredmanI think he wants to agragate functions in subname spaces and make them available from a single root namespace
15:06Chouser,(let [f (fn [a b c d e f g h i j k l m n o p q r s t & [u v w x y z]] [a z])] (f 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1))
15:06clojurebotnil
15:06RaynesYou want qualified imports?
15:07ataggartah, so using :as with multiple ns
15:07ataggartnot sure if that's possible
15:07Drakeson*sad*
15:07hiredmanDrakeson: you can remove and namespace declarations from A.* and jsut have A load the files so everything shows up in the A namespace
15:07ataggartnote it's very possible I'm wrong
15:08ataggartalternately, you can use 'use and avoid the ns altogether
15:08Drakesonhiredman: I didn't get it.
15:09ataggartaliasing java packages would be teh awesome
15:09Drakesonhiredman: assume A=clojure.contrib Now, what I can do?
15:09hiredmanDrakeson: suck it up :P
15:09ataggartuse 'use
15:09hiredmanno
15:09hiredmanuse require
15:10ataggartbah
15:10ataggartuse and :only is fine
15:10hiredmanREQUIRE!
15:10ataggartlol
15:10Drakesonataggart: I cannot use USE. please.
15:10ataggartthen I echo hiredman's sentiments, re. sucking it up.
15:10Drakesonhiredman: so, is it possible with REQUIRE?
15:11hiredmannope
15:11hiredmanand don't do wnat you want to do
15:11hoeckrhickey: regarding poll3, processing (processing.org) and the clojure wrapper rosado.processing has a quad method which takes 8 primitives
15:12hiredmanDrakeson: what you seem to want to do is similar to java's import * which just makes code hard to read
15:13Drakesonhiredman: it is not *, I want to hand pick only a few of them.
15:14hiredmanwell, write a macro to set it up for you
15:14hiredmanhttp://clojure.org/namespaces has the functions you will need
15:16DrakesonI'd rather poke people until (:require [A X Y Z] :as B) starts working :p
15:17stuartsierranot going to happen
15:17hiredmanclojurebot: people?
15:17clojurebotmax people is 164
15:17hiredmanthat's what you always say!
15:18hiredman~max people is 5
15:18clojurebotYou don't have to tell me twice.
15:18stuartsierrabut somewhere in contrib there's a fn to import vars from another namespace as public symbols, so you can merge namespaces
15:19DrakesonI guess the better approach would be to not to make conflicting sub-namespaces in the first palce, and don't create too many subs.
15:20hiredmanwait
15:20hiredmanwhat?
15:20hiredmanconflicting sub-namespaces? what does that mean?
15:20clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
15:21Drakesonhiredman: i.e. if I (use '[A X Y Z]) it does not break.
15:21hiredmanclojurebot: thanks dork-ticon
15:21clojurebotNo entiendo
15:21hiredmanuse require
15:22ataggartDrakeson: what is the actual problem you're having?
15:23Fossicoming from erlang you are kinda tempted to write multimethods everywhere
15:24rhickeyhoeck: it wouldn't impact your ability to call such methods, this is about your own fns. I guess if you were trying to wrap it...
15:24Drakesonataggart: the problem is that I don't like sub-namespaces with so few symbols. They should merge them already.
15:24ataggartDrakeson: perhaps pasting the code will help, because it's not clear to me what the *actual* problem is
15:25hiredmanDrakeson: *shrug*
15:26hiredmanI don't see why namespaces that only export a few symbols are a problem
15:28Drakesonhiredman: ok, how would you call those symbols? (mylongname.mylongsubname1.foo) ?
15:29hiredman(:require (mylongname [mylongsubname1 :as subname]))
15:29hiredman(subname/foo)
15:30Drakesonhiredman: now, imagine a package where you need a few of those mylongsubname1's each contributing only a few symbols, and you have to come up with artifical names (such as `subname') that again, do not help with reading the code later.
15:31hiredmansure they do
15:32hiredmanyou have an explicit maping between the real namespace and the alias at the top of the file
15:33hiredmanso you can figure out where all these symbols come from
15:33hiredmanyou don't have to use :as
15:33hiredmanyou could just use the long name, I mean you do have an editor with completion right?
15:33Drakesonhiredman: that makes it *possible* to understand what subname/foo means. but that does not make it *easy*. you have to remember the top of the file ...
15:33lbj1rhickey: Do you have an online list of all this interesting research papers you've based Clojure on ?
15:33lbj1s/this/these
15:34ataggarthttp://www.amazon.com/gp/richpub/listmania/fullview/R3LG3ZBZS4GCTH/ref=cm_pdp_lm_title_1
15:34ataggartlbj1: I believe that was rich's list
15:35lbj1Wow - Rich reads alot :) Thanks
15:35hiredmanDrakeson: I, uh, if you can't even remember how to scroll up until the top of the file, I don't know that you can be helped
15:35lbj1I hate to see though, that Clojure is in part based on "Javascript - The definitive guide"
15:37Drakesonhiredman: please! What is so good about namespaces exporting very few names?
15:37ataggartDrakeson: why does the quantity of functions matter?
15:37ataggarteither you want them namespaced or you don't
15:39hiredmanexactly
15:39hiredmanit's about a cenceptual grouping of code
15:39Drakesonataggart: I just don't want to go too deep (foo.bar.baz/x). If the names under foo do not conflict I would rather logically consider all of them as `names coming from package foo', learn package foo, and then use them as foo/x.
15:40ataggartusing your example, there is no package "foo"
15:40hiredmanit's not about "every 24 functions needs to be split out to their own namespace, a namespace with less then 15 functions exported is under utilized"
15:40ataggartor to put this in a real context, "clojure.contrib" is not a useful namespace
15:40hiredmanare namespaces a scarce resource?
15:40hiredmanare we going to run out?
15:41hiredmanDrakeson: clojure.contrib is not a single "package"
15:42hiredmanit is a bunch of serperate namespaces because it is a bunch of seperate modules
15:44hiredmanthere is no hierarchy of namespaces
15:44hiredmanjust like there is no hierarchy of java packages
15:44hiredmanimport java.awt.* does not import java.awt.event.*
15:45Drakesonhiredman: in case of contrib, yes. that is special. but there are other packages where the package is big (using several other jar dependencies, etc.), and I understand why the designer divides them up into logical sub-spaces. But from the library user it might be easier if *unnecessary* divisions are not seen in when you call them.
15:45hiredmanDrakeson: that is a library designer's choice
15:46hiredmanfor example, core.clj has a lot of it's printing stuff implemented in core_print.clj put there is no clojure.core-print namespace
15:46ataggartsame with pprint
15:46hiredmanif you want to wrap the api the library designer provides, then you can
15:46ataggartlots of files, one ns
15:47hiredmanbut the idea that clojure.contrib.* is a super namespace is jsut wrong
15:48hiredmana namespace (or package name in java) is not a path
15:48hiredmanit is easy to confuse them as a path because of the maping to the filesystem via the classpath
15:49hiredmanbut clojure.contrib.foo and clojure.contrib.bar are distinct names
15:49hiredmanthat just happen, if you call str on them to return strings that contain a similar prefix
15:50Drakesonhiredman: I get your point about contrib.
15:51DrakesonI still stand corrected (actually annoyed!) that some library designers create too many unnecessary divisions with few symbols in each. I guess I have to suck it up and just type in as long-names as they choose ...
15:52kotarakDrakeson: that's what's :as is for...
15:52hiredmanor write them an email
15:52Drakesonhiredman: yes, that sounds like the right thing to do.
15:57hiredmanI've been thinking about plugin like mechanisms, (require 'foo.some.provider) would load the plugin and then the plugin would define some methods on a multimethod defined in some other namespace
15:57hiredmanso the plugin namespace wouldn't even export any thing
15:58Drakesonwhy that should not be `USE' ?
15:58hiredmanit could be :P
15:58hiredmanI jsut like require
15:58kotarakhiredman: used that before. Works like a charm. eg. in ClojureQL the different backends just modify multimethods in the main namespace. You just say (require 'dk.bestinclass.clojureql.backends.derby) et voila...
15:59hiredmanmaybe I should use clojureql
16:00lbj1Absolutely :)
16:00kotarakWell. I think it has some neat uses of multimethods. But it's quite a mess at the moment... :)
16:01hiredmanwell, I was thinking about this plugin stuff in the context of persistent storage, and was going to use derby
16:03lbj1ClojureQL and Derby are good friends
16:08hiredman~literal [3] scala
16:08clojurebot<reply>{((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}
16:10hiredmanooo
16:10mebaran151clojure could really use a nicer pkg management system akin to rubygmes
16:11Fossiand also not like asdf or maven ;)
16:12stuartsierramebaran151: I talked about that at Philly Lambda. The existence of AOT-compiled files and gen-class makes it harder.
16:12cemerickmebaran151: or osgi, or felix (?) or ivy or whatever netbeans uses :-)
16:12Fossii guess building on ivy/maven might not actually such a bad idea
16:12mebaran151oh come now those aren't real because you can't search them
16:12mebaran151the coolest part of rubygems is gem search and the package directory
16:12cemerickmebaran151: so you want CPAN for clojure
16:12mebaran151yeah, I think that would actually be a pretty simple thing to build, maybe straight on top of github for hosting
16:13cemerick(everyone always wants CPAN for X)
16:13stuartsierraRubygems has serious issues with dependency resolution and historical archiving.
16:13cemerickstuartsierra: it's funny that this has come up again so soon :-)
16:13mebaran151well gems was always better than python eggs (you could uninstall)
16:13stuartsierraBuilding CPAN took years.
16:13cemerickmebaran151: it's decidedly not simple, and has only ever worked for perl
16:13mebaran151no I understand the complexity
16:14cemerickwhether that has something to do with perl users' use-cases, preferred environments, or specific implementation choices is up in the air
16:14mebaran151it might be good enough even to have a web service that would index clojure porjects and build ivy or maven entries for them
16:14mebaran151that you could add to your own build scripts
16:14stuartsierraAnd it's a product of its time. Running a web server was expensive, so people all posted their code on a few public sites. Now, everyone has a web site, there are a dozen project hosts, and code could be stored anywhere.
16:15stuartsierraPlus the diversity of SVN/Git/Hg/...
16:15mebaran151that's why it might be more useful to have a centralized index that could emit the necessary dependency management codes
16:16mebaran151most sane clojure products work something like this: clone, run ant, copy jar to libs
16:16kotarakmebaran151: I think Kresimir Sojat started providing Ivy versions of a lot of libraries. I wanted to put them on my server (I provide Ivy-enabled clojure and contrib), but didn't have the time, yet.
16:17mebaran151ivy already can handle some dependency resolution
16:17mebaran151I think it's mroe an issue of building a good index and some good practices to reference external libraries
16:19cemerickmy broader puzzlement about this is, when would you use something like this in conjunction with a clojure/java project? The development process is just so far away from what's typical in conjunction with python/ruby/perl.
16:19mebaran151PLT Scheme (if they didn't insist on breaking it every day) actually has a pretty cool package management system
16:19cemerickor, more importantly, the deployment process is so different.
16:20mebaran151cemerick, I think you're emphasizing the java-ness of clojure and I'm emphasizing the schemeness
16:21cemerickmebaran151: It's hard to get away from the substrate w.r.t. deployment. You're never (or, very, *very* rarely) going to rig up a clojure app via cron, or within a lightweight deployment container like mod_python or whatever.
16:21mebaran151even Haskell has the Cabal, which is actually pretty cool
16:21cemerickI didn't know that scheme apps were deployed anywhere, so I can't speak to that.
16:21hiredmancemerick: the guy who wrote that one adware worm did it in scheme
16:22mebaran151haha, nah, that's what I told my coworker when he showed me the cool planet system they use in PLT Scheme
16:22mebaran151he's big scheme fanatic, and was actually really happy when I showed him clojure (he's enchanted with Incanter)
16:22stuartsierrahiredman: I know that guy
16:22cemerickhiredman: didn't he use something (chicken?) that compiled straight to C?
16:23hiredmanhttp://philosecurity.org/2009/01/12/interview-with-an-adware-author <-- "which probably means that I deployed more Scheme runtime than anybody else on the planet."
16:23hiredmancemerick: dunno
16:23mebaran151http://www.haskell.org/cabal/ << maybe Haskell provides a better model for a package system with ahead of time compilation
16:23cemerickhrm, C backend for clojure :-P
16:23mebaran151it seems a shame to have a new copy of compojure for every web app I write...
16:23stuartsierracemerick: just use gcj!
16:24cemerickstuartsierra: haven't looked at it in, jeez, 5 years? Does it work well these days?
16:24hiredmanmebaran151: but the compojure jar in ~jars and put ~jars in your classpath
16:24hiredmanit is pretty simple
16:24mebaran151yeah yeah yeah, but there's a reason why people moan about the CLASSPATH
16:24Fossiis there a way to return true or nil or such all the time, no matter what the called function returns without do?
16:24hiredmanmebaran151: because they don't know how to use it
16:25mebaran151I would say something like a CLASSPATH shouldn't need to be known how to be used
16:25mebaran151it should just work
16:25kotarakmebaran151: In which way is CLASSPATH different to - say - PYTHONPATH?
16:25mebaran151PYTHONPATH always seemed better managed
16:25mebaran151I've never had to fight a PYTHONPATH war
16:25mebaran151I've fought the CLASSPATH at least a couple times
16:25cemerickmebaran151: I'm gonna have to pull a red card on you for that one. :-)
16:25kotarakI've never had to fight a CLASSPATH war. :)
16:26hiredmancemerick: I call shenanigans!
16:26mebaran151by war I mean: whoops I misconfigured the CLASSPATH, something I better check
16:26cemerickheh, haven't heard that one in a while
16:26stuartsierracemerick: no idea; just joking
16:26cemerickah-ha
16:26cemerickin that case, I'll blissfully continue to assume that gcj is unusable :-D
16:28mebaran151and more importantly, the deployment option doesn't tackle what I think is the more interesting benefit of packages: knowing what other people have written
16:28hiredmanmebaran151: a packaging format (jar + some metadata) goes a long way towards solving that
16:29mebaran151that's definitely true, but you'd need a CPAN esque repo to actually index it all
16:30hiredmanmebaran151: that is easy compared to getting everyone to a. cut releases, b. release as jars and not just a source bundle and c. add whatever metadata
16:31mebaran151I see that? that's a community ethic thing though
16:31mebaran151if the backbone existed, I'd bet that those steps would just naturally arise
16:31hiredmanthe other option is a "package manager" that is just a frontend to everyone's git repo
16:31hiredmanwhich is bleh
16:32hiredmanBLEH
16:32mebaran151github might form a very good backbone
16:32mebaran151they already support most gems via gems.github.com and on some ruby projects
16:32kotarakgithub is not the end of all...
16:32mebaran151I've worked on, that was invaluable
16:32mebaran151(my team personally uses bitbucket, because of some Windows coders we have)
16:33hiredmanother the otherhand, I've never really been fond of rubygems
16:34Chousukegithub is really slow sometimes though :/
16:35kotarakAnd sometimes goes nuts eating CPU...
16:35hiredmanmy OS has a package manager, I don't want anotehr for ruby, python, clojure, haskell, etc
16:36hiredmanso everyone just cut a jar file that can be plopped in to the classpath
16:36mebaran151hiredman, cabal, which I've used actually generates distro specific packages
16:36mebaran151which is pretty sweet
16:37mebaran151they support windows deb rpm archlinux and a couple others
16:38hiredmanthat is cute
16:41cemerickthat's what the jigsaw people are trying to do
16:41cemerickwhich seems pretty sad, IMO
16:42albinoI've been wishing for dpkg on windows
16:42albinowell for like years now
16:42albinoI would be happy even with rpm
16:42mebaran151I never liked cabal that much, but it's the only pkg manager I can think of for a truly compiled language, other than the distro repos for C packages
16:42elwaywitvacalbino: I agree, but I want VFS or dmesg a little more at this point
16:43mebaran151albino, you can script add remove programs actually, but I doubt you want to do that...
16:43albinomebaran151: Is that with a WMI call?
16:44mebaran151think it might be available with just simple shell scripting
16:44mebaran151you can automate the installations of MSI's I know that much
16:44mebaran151which you can extract from most installers, but it's up to you to put the pieces together in the right order
16:44albinooh yeah with msiexec or something, I did do that a while back
16:44albinobut msi's are awful
16:44Drakesonbtw, I look at http://nixos.org/ from time to time.
16:45mebaran151that looks pretty cool, NixOS
16:46mebaran151but it seems like its aiming to solve configuration file issues, which aren't really a problem in library management
16:46Drakesonthe research papers might be useful.
16:46drewrno, nix makes *everything* immutable
16:46drewrit's awesome, just not quite mature enough
16:47mebaran151drewr, but what in a library would ever even be mutated?
16:47drewrs/immutable/persistent/
16:47drewrif you install a new bash package on most systems, /usr/bin/bash is going to be a new version
16:48drewri.e., it gets overwritten; not in nix
16:49mebaran151but usually I want to overrite old bash, because old bash has a shellcode exploit
16:49mebaran151and new bash got fixed
16:49drewryou can do that, sure
16:49drewrbut if you have something that depends on that version of bash, it won't break
16:50mebaran151hmmm, interesting, but I think that's usually handled by major minor and patch revisions in Debian and its ilk
16:50mebaran151you'd just make a separate package bash8 or what not
16:50drewrno, this is a completely different way of thinking about all that
16:50drewryou'll have to read the paper
16:50mebaran151I'll check it out
16:51mebaran151I've just had to do sysadmin, so I'm always skeptical of package management systems that promise to replace me :)
16:51Drakesonmebaran151: after you change a library, do you prefer the application to crash, or let it keep running exploitable?
16:52drewrmebaran151: don't worry; with nix you would be the only person for miles around that understands it :-)
16:52mebaran151Drakeson, I'm not sure
16:52mebaran151on a production system, I'm not likely to run an upgrade, and I'm taking snapshots anyway
16:52mebaran151but if I do run an upgrade, it would usually be reasoned a little bit
16:53mebaran151on my home machine, half the fun of unix is unbreaking what your OS breaks :)
16:53mebaran151but actually it woudl alert me I might need to recompile that package
16:53mebaran151most packages, if the revision is truly minor, normally wouldn't break anyway
16:55drewrnix helps you not have to micromanage that; a file a package expects to be there will be there
16:55drewrnone of this virtual python, python2.4, python2.5 mess, e.g.
16:56mebaran151you can do the atomic stuff they describe using a chroot too
16:57mebaran151upgrade in the chroot, rsync over, or something like that
16:57mebaran151but yeah, there are a couple compelling advantages
17:00DrakesonI haven't learned ivy; is there a commandline tool to see what is in the repository?
17:00Fossilisppaste8: url
17:00lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
17:00drewrDrakeson: with ivy, that can be anywhere; what do you mean?
17:01lisppaste8Fossi pasted "Call with optional parameter" at http://paste.lisp.org/display/84349
17:01Fossiis there a way to call a method with two params if it accepts them, otherwise just one?
17:01kotarakDrakeson: you search for maven artifacts on www.mvnrepository.com. They also work with Ivy.
17:02Drakesonassume you know the name of a package, what it takes to get it and have it "installed" in ~/.class/ ?
17:03hiredmanDrakeson: sounds good to me
17:03ChousukeFossi: try/catch? :P
17:03Drakesonhiredman: what sounds good to you?
17:03kotarak<dependency org="org.clojure" name="contrib" rev="1.0.0" conf="*->compiled"/>
17:03FossiChousuke: so that's a "no"? :(
17:03hiredmanI put everything in ~/.jars/ and have my netbook fire up a nailgun process at boot with ~/.jars/* in the classpath
17:04DrakesonI unzip everything in ~/.class/
17:05ChousukeFossi: Well, you might be able to use reflection to figure out the arities
17:05Drakeson(well, I put the jars somewhere else, and when they are updated I recreate ~/.class/ ; it is very rudimentary)
17:06hiredmanDrakeson: that would actually work better with nailgun
17:06hiredmanbecause you cannot update the classpath
17:07Drakesonkotarak: is that supposed to be placed in pom.xml ?
17:07FossiChousuke: well, it would've been nice to make the 'protocol' to take one or two params, but it's not worth any overhead
17:07kotarakDrakeson: for Ivy in the ivy.xml
17:08Drakesonkotarak: I see. Is it possible to do that from the command-line?
17:08kotarakDrakeson: one can invoke ivy from the command line. Never tried it. ant does that for me.
17:08Fossihm... i could make that a map though
17:08ChousukeFossi: well, you could do (defn foo [& [arg arg2]]) and dispatch differently if arg2 is nil
17:09Drakesonkotarak: what does ivy do to the dependencies it fetches?
17:10kotarakDrakeson: it places them in a directory. But one can also create a local "mirror" with packages, which can then be used by projects.
17:10kotarakDrakeson: I have a project relative classpath. I put everything I need for a project into lib. Works all the time.
17:10hiredmanCLASSPATH="lib/*"
17:11kotarakBingo
17:11hiredmanmakes sense
17:11Drakesonkotarak: if you have 10 projects, you download the poor jar files everytime?
17:11hiredmanyou can ln -s stuff
17:11kotarakDrakeson: no. It's cached.
17:12kotarakThen only copied (or linked if possible, IIRC)
17:12kotarakChanging to a different project folder => CLASSPATH is still correct. :)
17:16DrakesonI don't like the copying (to ./libs) involved in this. I would really prefer to have one (or very few) local repositories (like ~/.gems/, haven't used ruby much though), where things are installed, and would prefer definite install and remove commands.
17:16kotarakDrakeson: at the moment you will run into problems if you need two different versions of a library
17:16kotarakwith the lib approach that is a non-issue.
17:17kotarakJava would really need the version handling here for a central directory.
17:18hiredmanDrakeson: like I said, I just put things in ~/.jars/ set my classpath to CLASSPATH="$HOME/.jars/*" works fine
17:22Drakesonhiredman: what part of it ivy does for you?
17:23Drakeson(I mean, can you ask it to use ~/.jars/ as the place to download dependencies into?)
17:25hiredmanDrakeson: none of it
17:25hiredmanI don't use ivy
17:25kotarakDrakeson: sure, <ivy:retrieve pattern="${user.home}/.jars/[artifact].[ext]"/>
17:25kotarakNot tested, though.
17:26kotarakAnd not sure, how to do it from command line.
17:26DrakesonI don't have ivy on the command-line (debian/sid)
17:27kotarakDrakeson: http://ant.apache.org/ivy/history/latest-milestone/standalone.html
17:28angermanI cannot call the methods I created with proxy?
17:29kotarakangerman: you cannot create methods with proxy. Only implement defined methods from the Superclass/Interfaces
17:29angerman(let [o (proxy [Object] [] (tell [] (.toString this)))] (.tell o)) ?
17:29angermankotarak: hmm...
17:30Drakesonkotarak: thanks
17:30kotarakangerman: (gen-class :name my.OwnClass :methods [[tell [] String]]) (defn -tell [this] (.toString this))
17:32Drakesonkotarak: I get Failed to load Main-Class manifest attribute from ..., though. I'll see what is wrong with ivy ...
17:32angermankotarak: hmm yep ... but I was advised to try to stay away from gen-class :)
17:32angermanso I'm trying to find ways without
17:33kotarakangerman: gen-class is not evil, and necessary at certain times: you need a class name, you need to define own methods, ....
17:45angermankotarak: :)
17:45angermanhmm how do I change the 3rd element of a vector?
17:46angerman(def x (ref [a b c d]))
17:46kotarak(assoc the-vector 2 5)
17:46kotarak,(assoc [:a :b :c :d] 2 5)
17:46clojurebot[:a :b 5 :d]
17:47Anniepooanybody else using La Clojure?
17:47angermankotarak: awesome :)
17:48eyerisWhen I clone the clojure-contrib repo, why don't I get all of the branches? I only get master, but I want
17:48eyeris * clojure-1.0-compatible
17:48AnniepooI'm seeing what I strongly suspect is the background syntax checker task peg my cpu
17:48Anniepooespecially when I leave a file with an error and try to start a repl
17:48Chousukeeyeris: it's there, as origin/clojure-1.0-compatible
17:48angermankotarak: so how do I do the assoc in place? e.g. make the ref point to the new changes struct?
17:49Chousukeeyeris: git only creates a local tracking branch for master by default.
17:49Anniepoo,(doc assoc)
17:49clojurebot"([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)."
17:49kotarak,(let [x (ref [:a :b :c])] (dosync (alter x assoc 1 5)) @x)
17:49clojurebot[:a 5 :c]
17:49kotarak)
17:49angermani see
17:50kotarakangerman: auch commute, ref-set, etc.
17:50eyerisChousuke So I just 'git checkout origin/clojure-1.0-compatible'?
17:50kotarakassoc also appends
17:51kotarak,(assoc [1 2 3] 3 4)
17:51clojurebot[1 2 3 4]
17:51Chousukeeyeris: yeah. or checkout -b local-tracking-branch origin/clojure... if you want a tracking branch
17:52eyerisOkay, thanks.
17:52angermanhmmm :/
17:52angermantoo bad
17:53angerman,(let [x (ref [{:a 1 :b 2} {:a 3 c:4}])] (dosync (alter x assoc [1 :a])) @x)
17:53clojurebot3
17:54angerman,(let [x (ref [{:a 1 :b 2} {:a 3 c:4}])] (dosync (alter x assoc [1 :a] 0)) @x)
17:54clojurebot3
17:54kotarak??
17:54kotarakassoc-in?
17:55kotarak,(let [x (ref [{:a 1 :b 2} {:a 3 c:4}])] (dosync (alter x assoc-in
17:55clojurebotEOF while reading
17:55kotarak,(let [x (ref [{:a 1 :b 2} {:a 3 c:4}])] (dosync (alter x assoc-in [1 :a] 0)) @x)
17:55clojurebot3
18:00angermanwhee ... it did work :)
18:07Anniepooso, no IntelliJ users out there?
18:09RaynesAnniepoo: I use it occasionally.
18:09angermanbut didn't I remember hickey saying something on intellij? or was it idea?
18:09RaynesI do what angerman does right now.
18:09Raynesrhickey said "I just use IntelliJ"
18:09RaynesAccording to my googling.
18:10AnniepooRaynes, I'm runnning IntelliJ and La Clojure, the cpu pegs for 45 sec or so frequently
18:10Anniepoo@angerman - IntelliJ and IDEA are saeme thing
18:10Anniepooanybody remember the name of the guy who made La Clojure?
18:10Raynesllya Anniepoo
18:11Anniepoothanks
18:11RaynesI think it's llya.
18:11Drakesonhow can I turn the output of clojure.contrib.lazy-xml/parse-trim (or clojure.xml/parse) to the form clojure.contrib.prxml accepts?
18:11RaynesI'm just housing all sorts of knowledge. :3
18:11Drakeson(do these forms have names?)
18:13Raynesrhickey: I thought you used Emacs, the last I heard. You use IntelliJ now?
18:14RaynesAnniepoo: Llya Sergey
18:15AnniepooRaynes, where'd you copy that from?
18:15Rayneshttp://plugins.intellij.net/plugin/?id=4050 Project page.
18:15Anniepoothat's the la clojure download page
18:16RaynesMhm.
18:16AnniepooI'm asking where you got the quote from rich hickey
18:16RaynesOh.
18:16kotarakAnniepoo: I think he mentioned it here on IRC or on the list.
18:17Anniepoook
18:17RaynesGoogle. http://clojure-log.n01se.net/date/2008-03-31.html
18:17Drakesonclojure.xml/parse "<a>b</a>" -> {:tag :a, :attrs {}, :content ("b")} --???--> [:a "b"] --prxml--> "<a>b</a>".
18:19Anniepoocool
18:21kotarak,(clojure.xml/emit (clojure.xml/parse (java.io.StringReader. "<a>b</a>"))
18:21clojurebotEOF while reading
18:21kotarak,(clojure.xml/emit (clojure.xml/parse (java.io.StringReader. "<a>b</a>")))
18:21clojurebotjava.lang.IllegalArgumentException: No matching method found: parse for class org.apache.xerces.jaxp.SAXParserImpl
18:21kotarakpff.. Same error.
18:22kotarakDo I miss something on clojure.xml?
18:24ataggartrich uses emacs for clojure, and idea for java, iirc
18:26kotarak,(clojure.xml/emit {:tag :a :attrs {} :content ["b"]}) ; @ Drakeson
18:26clojurebot<?xml version='1.0' encoding='UTF-8'?> <a> b </a>
18:27Drakesonkotarak: I know about clojure.xml/emit. I don't like that format ({:tag :a :attrs ....}). it is too verbose.
18:27Drakesonthe vector format [:a "b"] is much easier
18:27kotarakoh ok, nevermind
18:28DrakesonI just want to know what format is that and how one converts it to the better format
18:29angermanone more sutpid question how do i append an item to the end of a vector?
18:29Drakesonconj
18:29Drakeson,(conj [1 2 3] 4)
18:29clojurebot[1 2 3 4]
18:30kotarakDrakeson: (defn c-xml->pxml [tree] (vector (:tag tree) (:attr tree) (vec (map c-xml->pxml (:content tree)))) as a first guess with missing checks for string or so....
18:30kotarak,(assoc [1 2 3] 3 4)
18:30clojurebot[1 2 3 4]
18:31kotarakBut conj is more comfortable. :)
19:02hiredman,(doc assoc)
19:02clojurebot"([map key val] [map key val & kvs]); assoc[iate]. When applied to a map, returns a new map of the same (hashed/sorted) type, that contains the mapping of key(s) to val(s). When applied to a vector, returns a new vector that contains val at index. Note - index must be <= (count vector)."
19:02hiredmanhmm
19:02hiredman<=
19:03ataggartthat = is troubling
19:04ataggartah, nvm, it appends if its one longer than the vector
19:05hiredmanyeah, which makes sense I guess
19:05hiredmanthrew me for a bit
19:37mtddoes anyone feel strongly about a clojure tutorial/document/learning aid for a python programmer (lapsed java coder) going offline for a week or so who might have 5 - 10 hours to play with clojure?
19:43blbrown_winAnyone familiar with runhprof, know why these classes show up more than once on these lines. OK, here is a better view. http://paste.lisp.org/display/84355
21:14ataggartmtd: get the pragprog book
21:15mtdataggart: thanks
23:48Drakesonhave you seen an example of using JNA in clojure?
23:51durka42Drakeson: have you seen Chouser's thing?
23:51durka42http://github.com/Chouser/clojure-jna/tree/master
23:53Drakesonoh. thanks