#clojure logs

2009-02-20

00:02jhawk28later, bedtime
00:20technomancyclearing up terminology: maps, sets, and vectors are all collections but not sequences... they allow you to *make* sequences from them, but they are not actually sequences, right?
00:21hiredmancorrect
00:22hiredmannow you know, and knowing is something something
00:41slashus2When playing with sorted-map, if you do (rseq (sorted-map :a 5 :b 6)) It is no longer just a sorted-map, it is a sequence. What is the idiomatic way to reverse a sorted-map and keep it a sorted-map after the reverse?
00:44xitami guess you use sorted-map-by to create a new map with an opposite comparator
00:44hiredmanwhat xitam said
00:45xitamreversing a tree is sort of an odd concept generally
00:46slashus2sorted-map is ordered by the order that they were added right?
00:47slashus2By using an opposite comparator what would you compare?
00:47xitamthey're ordered by the values of the keys, either using the default or a user-supplied comparator
00:47slashus2oooh
00:48slashus2That makes sense.
09:07AWizzArdrhickey: is it possible to make (comment ..) a special operator, with some reader magic, which eliminates it completely from the resulting sources? Currently it can crashes for things like (comment ##) and it evals to nil. So it should not be the last form in a defn/defmacro.
09:08AWizzArdor maybe a reader macro instead of comment, such as #-(this does not exist)
09:08jdz_#_
09:10AWizzArdjdz: how does it end a comment?
09:11AWizzArdI can't find it in http://clojure.org/reader
09:11jdzit does not. it is a reader macro similar to what you wanted with #-
09:11jdzit is fairly recent addition
09:11AWizzArdbut what is different compared to ; then?
09:11AWizzArdah ok, it is #_(hallo) ?
09:11jdzit cuts out the next "form"
09:12AWizzArdgood, gotcha
09:12AWizzArdthx
09:14AWizzArdalthough #_(') ==> Exception
09:14AWizzArdIt's still very good though
09:14jdzit's not a comment
09:14AWizzArdright
09:15AWizzArd,(list 1 2 #_3)
09:15clojurebot(1 2)
09:15AWizzArd,(list 1 2 (comment 3))
09:15clojurebot(1 2 nil)
09:15AWizzArd,(list 1 2 #_(#))
09:15clojurebotNo dispatch macro for: )
09:15AWizzArd,(list 1 2 #_("#"))
09:15clojurebot(1 2)
09:15AWizzArdI can do #_"..." for comments then
09:15jdzclojure reads the form after #_ and throws it away. but it still must be a valid form, otherwise clojure wouldn't know what exactly to throw away
09:16AWizzArdwell, it does not have to be a valid form, but at least it should not contain other reader macros
09:16jdzno, it *has* to be a valid form
09:17AWizzArd,(list 1 2 #_(+++++))
09:17clojurebot(1 2)
09:17AWizzArdworks
09:17AWizzArdalthough (+++++) is not a form
09:17jdzit's a valid form
09:17jdzit's a call to function +++++
09:17AWizzArdAccording to Kent Pitman it is not a form.
09:17jdzwe discussed this already
09:17AWizzArdyup
09:17jdzand that's why i said "form"
09:17jdz(see, air quotes!)
09:18AWizzArdanyway, the #_ is what I can use very well
09:18AWizzArdthx J?nis
09:18jdzusing it for comments is wrong, if you want my opinion
09:24gnuvinceWhat's #_?
09:32jdzit's magic. it makes things disappear.
09:41AWizzArdgnuvince: allows you to remove inner pieces of code
09:41AWizzArdwithout really deleting them
09:44gnuvincecute
09:45gnuvinceDidn't know about that
09:49cooldude127Bracki: you here?
09:51lisppaste8cooldude127 annotated #75813 "much better find-path" at http://paste.lisp.org/display/75813#4
09:51jbondesonoy. this swank-clojure stuff is going to be the death of me.
09:51cooldude127slime is a scary thing sometimes
09:51jwinterjbondeson: what are you working on?
09:52jwinterupdating it to lazy?
09:52jbondesonyeah
09:52jbondesongot rid of the first classcastexception
09:52jbondesonnow i have stack overflows and another classcastexception
09:52cooldude127jbondeson: it's progress :)
09:52cooldude127oh maybe not
09:52jwintercool, is there a fork on github?
09:52jbondesonwell, it's in other places, so that's nice.
09:53jbondesonjwinter: haven't pushed anything yet because i have a terrible hack to get around the first exception
09:53jbondesonfor some reason the lisp forms that are moving around are causing issues
09:54jbondeson(quote ...) stuff isn't getting "unquoted" as it were when eval'ed
09:54jbondesonso the receiving functions are trying to consume a "quote" as a value
09:56jbondesonthis totally asyc stuff is tough to debug, doubly so when you have to damn near nuke emacs to get out of some of these situations.
09:59jbondeson,(next '(#'swank.commands.contrib/swank-require (quote (:swank-package-fu :swank-fuzzy :swank-fancy-inspector :swank-arglists))))
09:59clojurebot((quote (:swank-package-fu :swank-fuzzy :swank-fancy-inspector :swank-arglists)))
09:59jbondesonthat's the other pain
10:16clojurebotsvn rev 1297; fixed lazy-seq constants
10:45cooldude127Bracki: ping
10:48tashafagood morning y'all
10:48cooldude127good morning to you
11:09cemerickI'll bet there's a good reason for this, but why are primitive values print-dup'ed as boxed values? e.g. (binding [*print-dup* true] (pr-str (float 5))) => "#=(java.lang.Float. \"5.0\")"
11:11Chouseronly boxed things can be passed around anyway. 'read' can't return a primitive.
11:11danlarkinI think because of the way the reader works with java class literals or whatever, there's no way to "read" a primitive
11:11Chouseryeah, what he said.
11:11cemerickah, right
11:11Chouser:-)
11:15Chouserok, if that's solved, I've got one...
11:15Chouserwhy can't I build a custom Fn class using proxy that implements the meta() method?
11:16Chouserhm. AFn seems to kill it.
11:16danlarkinIt's been a while since I looked at proxy, but it only lets you define methods from the interfaces you use, right?
11:16hiredmanman, I wish Chouser was, I am sure he could answer that question...
11:17hiredmanwas here
11:17Chouser,(proxy [clojure.lang.IFn] [] (invoke [] :hi) (meta [] {:some :meta}))
11:17clojurebotjava.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
11:17Chouserwhoa
11:17cemerickdanlarkin: that was my impression
11:17Chouserclojurebot can't do proxy. :-(
11:18danlarkinso if IFn doesn't define meta() then you can't do it without adding another interface
11:18Chouseryeah, but I did add it.
11:19Chouserok, for the record: (import '(clojure.lang IFn AFn IMeta))
11:19Chouserno, this works: ^(proxy [IFn IMeta] [] (invoke [] :hi) (meta [] {:some :meta}))
11:19Chouserbut this does not: ^(proxy [AFn IMeta] [] (invoke [] :hi) (meta [] {:some :meta}))
11:20Chouseryou can call either proxy with no args and get :hi, but only the first returns the map as metadata
11:20Chouserthe second returns nil
11:21Chouserand looking at AFn.java, I don't see why
11:22cemerickChouser: proxy might be adding its own meta impl?
11:23Chouserbut extending IFn instead, I'd have to do more work to get 'apply' to work.
11:23Chousercemerick: but why only in with AFn and not IFn?
11:23cemerickyeah, I dunno -- just tossing darts with that one
11:24cemerickwhoo, the protocol for deserializing print-dup'ed collections is wonderful (CollName/create items....).
11:25Chousercemerick: just make sure the stream you're reading is trustworthy
11:25cemerickand it just falls back to looking for 'create' in the com.foo.bar.CollName namespace, so I don't have to add a real static method anywhere...
11:25Chouserah, clever.
11:26cemerickChouser: Yeah. Not yet a concern on that front. We don't yet consume any serialized data from the outside world.
11:26Chouserok, good.
11:26cemerickI'm hoping to mostly depend upon the jvm's sandboxing once we get to that point.
11:26cemericks/once/if
11:26Chouser,#=(System/exit 42)
11:26clojurebotSystem
11:26Chouser,#=(java.lang.System/exit 42)
11:26cemerickoh, that's just mean! :-)
11:26clojurebotaccess denied (java.lang.RuntimePermission exitVM.42)
11:27Chouserclojurebot reads in a sandbox now
11:27Chousersince last time I tried that. :-)
11:27cemerickeh, process death isn't a big problem. snooping is, though....
11:28cemerick,(java.net.Socket. "apple.com" 80)
11:28clojurebotjava.security.AccessControlException: access denied (java.net.SocketPermission apple.com resolve)
11:28cemerick,(java.net.Socket. "17.149.160.49" 80)
11:28clojurebotjava.security.AccessControlException: access denied (java.net.SocketPermission 17.149.160.49:80 connect,resolve)
11:28cemerickgood enough for me :-)
11:29cemerickwe'll just put a big ol' klaxon around any ACE's
11:33Chouseranybody have a hint for how I can figure this out?
11:33ChouserAFn doesn't even implement meta()
11:33ChouserMaybe I don't know Java well enough, but should the derived class's implementation always win?
11:34Chousermy proxy's meta method is apparently not even called.
11:39danlarkinI'm stumped. the AFn proxy _has_ a meta method
11:39danlarkinbut it returns nil
11:41hiredmanAFn also has a constructor that calls super(meta) and Object doesn't have that, and IFn is an interface, so no contructor there
11:41ChouserAFn extends Obj
11:42hiredmanah
11:42hiredmannot Object
11:42hiredman:/
11:42Chousersuprise!
11:42hiredmanah
11:43hiredmanObj's meta is final
11:43Chouseroh!
11:43Chouserthat would do it. Thanks!
11:45Chouserand I can't seem to get to the _meta field. No declaration means it's private?
11:45hiredmanit means it is scoped to the package
11:46hiredmanso only other stuff in clojure.lang can see it
11:46Chouserhuh. ok.
11:46hiredman(I think)
11:46danlarkinfunctions will never have metadata! muhahaha
11:49Chousershoover`: hey, thanks again for doing that talk. Getting up in front of a roomful of .Net'ers and telling them they should use Clojure takes guts.
11:50shoover`Chouser: haha, you're welcome! They were there to learn!
11:50hiredmanvideo of it didn't happen
11:50hiredmanor
11:51Chouserhiredman: it didn't happen
11:51shoover`you have clojure.blip.tv, you don't need me
11:52shoover`I borrowed a lot from Rich's talk for Java programmers
11:53WizardofWestmarcthe downside to clojure.blip.tv is the current talks are all old
11:56shoover`WizardofWestmarc: true, some of the APIs have changed, but the conceptual stuff is good enough that I still point people there. maybe not the sequence one any more
11:57Chouserbut sequences rock. that's what really hooked me at first.
11:58rhickeyChouser: ^(proxy [AFn] [{:some :meta}])
11:59WizardofWestmarctrue on the conceptual stuff. The java and lisp programmer talks (depending on who you're pointing to them) were both very useful.
11:59Chouserrhickey: ah!
12:02rhickeyChouser: the problem with meta on fns is not the initial meta, it's with-meta. I can't rely on clone-ability of derivees
12:03Chouserwhich is why AFn's with-meta does nothing.
12:03Chouserbut immutable metadata works fine for me in this case.
12:04rhickeyChouser: I think it throws
12:04Chouserright again
12:06rhickeyshoover`: talk went well?
12:12gnuvincerhickey: do you know if your sessions at QCon are going to be video-taped?
12:12rhickeyI think so
12:14gnuvinceThat'd be cool
12:57nsinghalIs there any function which gives me the first not null value: such as
12:57nsinghal(first-valid (latest) (last-active) (first-visible) (first-in list))
12:57nsinghalCurrently i am doing if else logic to get my object
12:59lisppaste8cemerick pasted "puzzling NPE" at http://paste.lisp.org/display/75862
12:59WizardofWestmarc(first (filter identity list)
12:59WizardofWestmarcwith your var in list's's place
13:00cemerickrhickey: do you have any idea about the above paste? The classname in question is a gen-class emitted by my latest genbean macro.
13:00nsinghalWizardofWestmarc: thx
13:00cemerickit looks like it never gets to the point of invoking the AOT-compiled constructor
13:00WizardofWestmarcnsinghal: no problem
13:00cemerickFWIW, (foo.bar.Classname 5 5) (e.g. with the same number of args of the right type) succeeds without a problem.
13:02gnuvince,(some identity [nil nil 3 nil])
13:02clojurebot3
13:03WizardofWestmarchuh I missed some
13:10shoover`rhickey: yes. I used your traditional/lisp evaluation model comparison and we broke some ground with macros. No time to show them concurrency, unfortunately
13:11shoover`some light bulbs went off almost as soon as I drew the models
13:11hiredman,(or nil nil nil 3 nil nil nil nil)
13:11clojurebot3
13:11hiredman:D
13:14shoover`Chouser: yes, sequences rock, it just seems that of all the screencasts that one may be more out of date at the moment
13:16shoover`rhickey: turns out 90 minutes is not enough time to explain all of Clojure :)
13:16gnuvinceshoover`: did you give a talk?
13:16technomancyshoover`: man, don't tell me that.
13:17gnuvincetechnomancy: 60 minutes?
13:17shoover`technomancy: one-way communication can help you there
13:17technomancygnuvince: most of his have been 60 minutes, but I hope I can convince him to let this one go longer
13:17technomancyshoover`: you mean not getting interrupted by questions? =)
13:17slavahow do I load a source file?
13:18technomancyslava: generally "use" is what you want
13:18technomancy,(doc use)
13:18clojurebot"([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer."
13:18hiredmanwell, there is also load-file
13:18hiredman,(doc load-file)
13:18clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
13:18gnuvinceslava: if it's the mandelbrot thing, (load-file "/path/to/mandelbrot.clj")
13:18shoover`technomancy: yep. in an interactive session people consume at different speeds. also, you get to edit the pauses and throat clearings :)
13:19technomancyload-file is independent of classpath, right?
13:19gnuvincetechnomancy: yes.
13:19technomancyshoover`: yeah, the advantage of a screencast is people can pause and go back over stuff that they didn't get the first time around
13:19technomancycan't do that in real life without time travel
13:19shoover`gnuvince: yes, for the indyalt.net group
13:20slavagnuvince: load-file is what I was after, thanks
13:20gnuvinceshoover`: do you have slides of your talk? I'd also love to hear your experience talking to other programmers about Clojure.
13:20gnuvinceslava: happy to help.
13:20shoover`gnuvince: if by slides you mean an org-mode file with links to code snippets and REPL history, yes
13:20gnuvinceshoover`: :)
13:20technomancydoes load-file work with paths relative to the current file or what?
13:21gnuvincetechnomancy: yes
13:21technomancyoh, that's handy
13:21gnuvincetechnomancy: (load-file "../../foo/bar/baz.clj") should work
13:21technomancyno need to worry about the classpath then.
13:22shoover`gnuvince: my textual materials will go here this weekend or early next week: http://indyalt.net/cms/meeting/february-2009/clojure
13:23shoover`it's a fun challenege talking to other programmers. Some have never seen anything outside of C#, some started with Fortran and have seen it all. They all have different expectations and questions based on that experience
13:24shoover`This group came with an open mind, so we had awesome discussions comparing to other languages and in the context of different businesses
13:25technomancyand now it actually looks like it might be viable on .net
13:25shoover`I can't wait
13:25shoover`also, I got to meet Chouser. that was not challenging
13:26gnuvinceshoover`: very cool
13:27slavagnuvince: my dynamically-typed version that uses complex number objects in factor runs in 6.8 seconds. the clojure code runs in 2.4 seconds
13:27gnuvinceWhat I like about Clojure is that you don't need to be "defensive" when people start talking about current IT investments and things like that.
13:28technomancydanlarkin: wouldn't be too hard to have a wrapper that talks to various RT-specific backends for certain kinds of libs.
13:28gnuvinceslava: pretty impressive. Are you gonna try with just doubles and ints like the other programs?
13:29shoover`danlarkin: I will accept that code that uses libs might not be portable across VMs and just be happy that I can use Clojure's lispness, data structures, and concurrency on either VM that I happen to be on at the time
13:30slavagnuvince: that kind of defeats the point, you may as well use fortran or C if you'll be declaring machine types explicitly
13:31danlarkinwell right now we have this great ecosystem of easy interpolation with any java lib out there. But if the .net port becomes full-featured and active I think there's going to be temptation to only write pure-clojure (or clojure that only interfaces with "native" code in some yet-to-be-defined "safe" way) in the interest of compatibility
13:32slavagnuvince: if i remove type declarations from the clojure version it runs in 89 seconds :)
13:33slavagnuvince: adding a single type coercion to the factor code brings it down to 4.5 seconds. that's about as fast as it will get without low level tricks
13:35Chouserdanlarkin: I wouldn't worry about it. The existence of ClojureScript hasn't hurt Clojure much. :-D
13:35danlarkinI don't want to see, "oh sorry, this is clojure.net code only/java clojure code only" because that sucks... splinters the amount of accessible code... but I also don't want to see "oh I want this code to be cross platform so I won't use any existing non-clojure libs" because that's reinventing the wheel, and what's the point of java/.net interop if we can't use it and expect others to be able to use it
13:35danlarkinhahah maybe I'm just a miser
13:37slavaare there any plans to write an optimizing compiler for clojure?
13:38Chouserbut seriously, I think that if someone wants to try to port clojure to whatever VM, there's no real way to stop them. All you can do is deem the port "unofficial", and what does that buy you?
13:38Chouserslava: hotspot is an optimizing compiler for clojure. ;-)
13:39slavaChouser: well, clojure doesn't get very good numerics performance it seems
13:39Chouseron boxed numbers?
13:40slavaon dynamically-typed code
13:40slavawhether or not you do boxing is an implementation detail
13:41ChouserNear the top of Rich's wish-list for the JVM is that it support tagged numbers. In my understanding, that would help a great deal.
13:41slavathat wouldn't help here
13:41slavayou can't fit a float into a tagged pointer
13:42slavawhat you want is type inference of some sort
13:42Chouserdoesn't sound very dynamic
13:42technomancydanlarkin: it may be enlightening to look at how Ruby has handled the situation
13:42slavathe user shouldn't have to declare types
13:42shoover`danlarkin: or look at it another way... if I can only use .NET I will never contribute any useful Clojure libs you can use. If I'm on ClojureCLR, there's a good chance I'll interface to .NET libraries *and* break out some pure Clojure libs
13:42slavathe compiler should try to infer types where possible, and do runtime dispatch on the remainder
13:42rhickeyslava: they don't have to
13:42technomancythere's definitely breakage between the JVM and C versions, but the most popular libraries have been ported.
13:42slavainstead of boxing and dispatching for everything
13:44slavahas anyone written a version of mandelbrot for clojure that defines a complex data type with complex+ complex* etc. functions?
13:44leafwslava: I find that declaring types wherever I care for performance is rather simple.
13:44slavathat would be a good to help guide future compiler improvements
13:45slavaleafw: i'm interested in writing high-level code. sometimes I can't declare types because the code is actually polymorphic
13:46slavabut you might still want the compiler to specialize a function at different call sites, like C++ templates do
13:46danlarkintechnomancy: but it's different for clojure... take file access for instance. In ruby there's probably a file IO library or whatever, so that can be ported to the JVM so the API is identical. But in clojure the file library is java.io and that isn't going to be ported to .net -- they'll use whatever the file library there is
13:46slavathat's the trick to making dynamic code fast, you clone it and propagate types
13:47leafwslava: once I wrote a macro to decorate my code with specific types I was interested in -- had to do with processing images made of short[], float[] and double[].
13:47technomancydanlarkin: right; obviously some wrappers are needed
13:47leafwI just had to pass that as an arg.
13:47rhickeyslava: only if you want to spend your time on such things
13:48Raynesrhickey: Hi :)
13:49rhickeyhi
13:49danlarkintechnomancy: but should every class in the standard library be wrapped? and what about cases where functionality is different. I donno... like rich said, the JVM isn't an implementation detail, it is part of the language. ClojureCLR won't be a port, it'll be an entirely different language with strikingly similar syntax and semantics
13:49slavarhickey: that's fine
13:50technomancydanlarkin: I suspect stuff will get wrapped as people need it; that's usually how these things happen. =)
13:50technomancypersonally I'd prefer to use a wrapper for the standard lib stuff, though it's not onerous the way it currently is
13:50rhickeydanlarkin: I think it is more subtle than that - Clojure was designed to be hosted. From the start, it abstracted away JVM/CLR. There will be two levels of libs, those that encapsulate the host and those that expsoe/embrace it
13:51technomancyyeah, as long as you're explicit upfront about which kind of lib it is, it shouldn't be a problem.
13:51ChouserI don't expect it will be much work to make contrib portable, and the set of wrappers it provides for itself to use will be a good starting point for other libs.
13:51technomancyany more than "people are writing code in a language I'm not using" is a problem. =)
13:51Chousermost apps probably won't have to be portable at all
13:52rhickeydanlarkin: I don't see any point in trying to do portable UI for instance, but if you look at libs using Swing/SWT/QT they aren't portable either at that level
13:53danlarkinbut file access would be wrapped I assume?
13:53rhickeybut things like most of contrib, datalog etc, easily portable because written on portable core
13:53rhickeydanlarkin: I really don't think people will need to write portable applications
13:54danlarkinrhickey: but don't you think they'll want to if clojureCLR is popular enough?
13:54Chouserline-seq would have to work on both, or the port of Clojure's not complete, but are there libs that open files for themselves?
13:54rhickeybut if you've got a job to do for a .Net client, you can do it in Clojure
13:55rhickeydanlarkin: no, I see portability ending at the library level, apps working with frameworks inevitably marry them
13:55leafwdanlarkin: so clj will cross that bridge eventually. Writing for nonexisting needs never lead anywhere in my experience.
13:56technomancyapplications that need to be portable seem like a big deal, but in practice they're definitely in the minority
13:56technomancythey're mostly just sample apps that people install to play around with and learn from. =)
13:57rhickeyI was originally worried about bifurcation, now that I see the kinds of things people are doing, I'm less concerned
13:57leafwtechnomancy: you have just dismissed about the most widely used apps out there (firefox comes to mind)
13:57technomancyleafw: the most widely used apps are *definitely* in the minority
13:58danlarkinHm, well I guess we'll see what happens, hopefully y'all are right and my concerns are unwarranted :)
13:58Chouserand it's odd sort of portability anyway -- not so much about the customer's physical or OS platform as the development company's investment in a virtual platform.
13:58technomancyleafw: but C is a completely different beast. no question about it.
13:58rhickeyChouser: exactly
13:59technomancyleafw: besides, firefox is a platform, not an app. =)
13:59WizardofWestmarcyeah remember, portability across OSes already exists in clojure as is.
13:59rhickeyall the fib micro-benchmarks will be portable :)
13:59slavaWizardofWestmarc: the OSes that J2SE runs on, that is :)
13:59technomancyrhickey: so people doing uninformed "speed comparison" blog posts will have access to everything they need; that's good to know!
13:59rsynnottslava: that'd be basically all of them, surely?
13:59WizardofWestmarcwhat runs .NET and not java?
13:59leafwtechnomancy: I know, you are right
14:00rsynnott(excluding the smaller phones and things from more than two decades ago)
14:00slavarsynnott: iphone, windows ce and *bsd being the notable exceptions
14:00rsynnottwhat, there's no j2se compatible java impl for bsd?
14:00rsynnottare you sure?
14:00leafwslava: *bsd run java fine, thanks.
14:00slavawell, you have to compile openjdk from source, or something
14:00slavathere's no official java 6
14:01hiredmanuh
14:01leafwthat never stopped anyone
14:01hiredmanyes there is
14:01rsynnottno sun-issued one, perhaps
14:01rsynnottbut I'm sure there are binaries
14:01hiredmanclojurebot is running on freebsd jdk1.6
14:01rsynnottanyway, .NET certainly does not run on bsd :)
14:01rsynnott(the mono thing might, I suppose)
14:02leafwslava: http://www.freebsd.org/java/
14:02WizardofWestmarcMono's what, .NET 2 compliant?
14:02slavalooks like there aren't any binaries
14:02hiredmanslava: there are
14:02slavaand this is freebsd only, not netbsd or openbsd
14:03hiredmanwell, speaking for freebsd users, open and net kind of suck
14:04slavawell, that's just your opinion, other people like using them
14:04hiredman*couhg*
14:04slavaand there's no decent j2se on those platforms
14:05slavaand what about iphone :)
14:05hiredmanwell, in the future when saying "*bsd" inthe future just say "*bsd, except FreeBSD which runs great and cooks my emergency bacon"
14:05technomancythe iphone is hopelessly locked-down.
14:05rsynnottslava: there's certainly no .NET for iphone
14:05leafwguys: this is not about clojure anymore.
14:05Chouserbut opera runs clojurescript just fine.
14:06slavarsynnott: mono runs on the iphone
14:06rsynnott(apple have shown some signs that they may allow Sun and Adobe to put Java and Flash on it)
14:06rhickeyPeople will branch at JVM/.Net at the point they specifically want JVM/.Net, i.e. to satisfy client requirement or leverage existing knowledge/investment in a specific platform. I would recommend people without a specific investment in either use Java, which is why I chose that when I went to one
14:06rsynnottslava: oh, jailbroken
14:06hiredman~google mono on the iphone
14:06clojurebotFirst, out of 232000 results is:
14:06clojurebotMono on the iPhone - Miguel de Icaza
14:06clojurebothttp://tirania.org/blog/archive/2008/Mar-10.html
14:06slavarsynnott: nope
14:06slavamono can generate binaries so that gets around the apple store restrictions
14:07rsynnott"No iPhone APIs have been exposed, so you get the very basic foundation."
14:07rsynnottah, I see
14:11_metaperl_Clojure, the Lisp that makes the JVM dynamic.... and functional... and concurrent!
14:11_metaperl_fix that topic :)
14:12technomancy_metaperl_: don't forget the CLR too.
14:12leafw_metaperl_: JVM is already concurrent.
14:12_metaperl_CLR?
14:12_metaperl_what does that stand for?
14:13WizardofWestmarcCommon Language Runtime, aka the .NET runtime
14:13slavaalthough if you want your code to run fast, you need type declarations and its not dynamic anymore :)
14:14rsynnottslava: well, you can do so selectively
14:14rsynnottas people have been doing in lisp for some decades
14:14rsynnottwith the result that you get most of the benefit of both worlds
14:14rhickeyslava: you can save those declarations for inner loops, leaving the vast majority dynamic
14:15slavanot every program has a spiked performance profile
14:15slavathink about a web browser for example, every part has to be fast
14:15rhickeyslava: not so at all
14:15rsynnottslava: really? Tell that to Firefox :P
14:15rsynnottbut seriously, in practice most of the glue code won't need type declarations there
14:16slavarsynnott: I'd like to see how well firefox would perform were it written in a JVM language...
14:16technomancyleafw: actually, thinking about Firefox, it's a great example of non-portable code. since FF is an application written in XUL and JS (spidermonkey), but it would never run if you tried to use it on KJS or opera's JS engine.
14:16slavarsynnott: the issue is that glue code is uninteresting and easy to write anyway. you want the hairy algorithmic stuff to be high level and maintainable, and not overly inflexible from hand-coded optimization
14:16technomancythe fact that the runtime is portable is enough
14:18rsynnottslava: I would disagree
14:18rsynnottthe glue code tends to be where things break
14:19rsynnottmodules which do one specific thing break less often, and are far easier to test
14:19slavabut low-level code is harder to read and write
14:19slavaI like using abstractions to make code simpler to understand
14:19slavaso its pretty silly if abstractions run slower than hand-optimized code
14:19rhickeyslava: a lot of people will be running on multicores soon, where some compiler micro-optimization will be dwarfed by the ability to split up the job - i.e. optimization at the level you are suggesting is quickly going to become uninteresting compared with auto-parallelization
14:20slavarhickey: none of this is mutually-exclusive
14:20rhickeytrue
14:20rhickeybut it all takes time
14:20rsynnottslava: what would suggest, anyway? Just using static typing?
14:20rhickeyI am not going to spend my life on micro-optimization - life's too short
14:20slavaif program A is 10x slower than program B, but A scales across cores, well you need 10 cores at least
14:20technomancyI don't think anyone's saying they don't want inference; it's just not a priority now.
14:20rsynnottyou can use static typing in clojure/common lisp/erlang/whatever when you need it, anyway
14:21slavarsynnott: not at all, I'm talking about the opposite: making the implementation run dynamic code faster
14:21slavatechnomancy: well, people should say that, instead of trying to justify the current state of affairs
14:21slavajust say that its planned and move on :)
14:22rhickeyslava: not planned- volunteers welcome :)
14:22technomancyslava: yeah, maybe if we get you worked up about it you would submit a patch. =)
14:23danlarkinis this where we all say in unison, "hindley-milner"?
14:23hiredmanslava: I don't think anyone is justifying anything except their own use of time.
14:23slavawell, whenever I read clojure advocacy I see claims about the high performance of the JVM. but if you're not going to exploit that, its a bit disingeneous to say that clojure is a lot faster than scripting languages on one hand, but then explain that this is only the case for low-level Java-like code on the other hand
14:23rhickeybecause some of this will fall out of enhancements to the HotSpots - they can get rid of ephemeral objects, automatically generate multiple paths etc
14:24rhickeyslava: only numerics are slower than Java, Clojure _is_ a lot faster then most scripting languages, and with type hints, as fast as Java on numeric inner loops - that's a lot of range today, even if not all of it is automatic
14:25slavaso the best approach then is to just be honest and focus on Clojure's true strengths: clean semantics, concurrency, JVM integration, etc
14:25slavaperformance doesn't soundl ike something you guys care about, which is fine
14:25rhickeyslava: oh, please - I'm happy to use type declaration to get the fastest perf - that doesn't mean I don'tcare
14:26slavathen you can say that clojure offers performance comaparable to scripting languages, but if you use a Java-like subset, then you can get good performance. that's similar to the situation in CL and many people are happy with that
14:26rhickeyPeople using C++ have to do much more work
14:27slavain CL, you can use declarations and disable safety and you're basically writing C
14:27slavaand SBCL's codegen generates pretty decent code for that
14:27slavabut there's very little compile-time analysis of dynamic code to remove unused generality automatically
14:27rhickeyslava: thta's still not true, its 5x faster than Python with no declarations
14:27slavaand that's what makes high-level languages interesting, IMHO
14:28rhickeybut I don't need to say anything - people are trying it on their problems and are satisfied
14:28slavawell, not you, specifically, just bloggers and so on
14:28bitbcktrhickey: Quite.
14:29WizardofWestmarctechnomancy: to be fair, 10x faster then dirt isn't really fast <_<
14:29bitbcktOuch.
14:29technomancyWizardofWestmarc: I didn't say I had high expectations. =)
14:29technomancyfor speed anyway.
14:29WizardofWestmarcheh heh
14:29technomancyexpressivity on the other hand...
14:30WizardofWestmarcheh yeah
14:30WizardofWestmarcthough I'm still using python for the webdev stuff I'm playing with, since Compojure is still a bit new/green for my taste.
14:31WizardofWestmarcbut any background processes tied to it will be in clojure >_>
14:31rsynnottare there really that many compilers for dynamic languages which make significant improvements on the dynamic stuff?
14:32rsynnotteven mature common lisp compilers tend to rely significantly on the user giving type hints where necessary
14:37zakwilsonAnd the fact that a lot of tasks can be made parallel simply by using pmap instead of map is a huge win.
14:38leafwzakwilson: same here. But I use pure java data structures for the pixels ( ij.ImagePlus, ij.ImageProcessor and friends).
14:39gnuvinceleafw: can I get a link for that lib?
14:41leafwgnuvince: we use fiji ( http://pacific.mpi-cbg.de ) but the lib itself is ImageJ ( http://rsb.info.nih.gov/ij ), see code diectly here: http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=ImageJA.git;a=summary
14:41leafwgnuvince: there's a tutorial on using ImageJ with clojure here: http://pacific.mpi-cbg.de/wiki/index.php/Clojure_Scripting
14:42slavaare you implementing the actual image processing algorithms in clojure or just using it to glue together java code?
14:42gnuvinceWow
14:42gnuvinceThat's a long tutorial, I'm impressed
14:42leafwslava: I use clojure to use java code at high level.
14:43leafwslava: only occasionally I'd use clojure as well for low-level -- but it works very well, with type declarations. Is just that immutability is a problem with "areduce", when arrays are gigabyte-long.
14:43zakwilsonPretty fancy, leafw.
14:44slavaleafw: sounds like clojure's compiler needs to implement some fusion optimizations :)
14:44leafwgnuvince: for ImageJ itself, there is a data structure tutorial here: http://albert.rierol.net/imagej_programming_tutorials.html
14:44leafwzakwilson: thanks, took some time.
14:44slavaeliminate all those intermediate arrays
14:44zakwilsonI'm doing operations directly on a BufferedImage with getRGB/setRGB.
14:45leafwzakwilson: it's possible :) but ImageJ has all these built-in filters that are so useful, and ability to work transparently with rois.
14:46zakwilsonleafw: I'll be taking a look at it.
14:46leafwzakwilson: there's sometimes people at #fiji-devel ready to explain ImageJ basics if you need so.
14:47leafwI'm afraid they don't use clojure though : mostly jython and jruby.
14:47zakwilsonAwesome.
14:49zakwilsonNo matter - the background on imagej will be helpful if I end up using it.
14:49leafwzakwilson: we even added a clojure launcher for fiji: ./fiji --main-class clojure.lang.Repl would do it ... and ./fiji some-script.clj will launch it. All jars into the classpath automatically :)
14:50zakwilsonI'm working on a program for doing things to directories full of images. Currently, I have a greyscale filter and nothing more. My intent is to provide multiple filters, resizing, etc...
14:50hiredman,(Collections/shuffle '(a b c d))
14:50clojurebotjava.lang.UnsupportedOperationException
14:51rhickeyOne of the things that hasn't yet happened, is that people can leverage the low-level stuff inside a macro-package that makes it declaration-free, without any compiler enhancements. i.e. as long as the perf is reachable, some more abstraction can be added via macros
14:51leafwzakwilson: I'd say all of that is doable with ImageJ rather easily
14:53zakwilsonleafw: Sounds like it. Some time later, I'm going to play with it later. I'm interested in seeing if its greyscale filter is faster than mine.
15:15danlarkinrhickey: saw your post on the list, we love you too!
15:18rhickey:)
15:20gnuvinceSpeakinf of contribution, I sent my C.A. yesterday
15:21clojurebotsvn rev 1298; return unmodifiableList from ASeq.reify()
15:21Chousergnuvince: hooray! Have you talked to Stuart S. about his json lib?
15:21danlarkin:-o
15:21gnuvinceChouser: no, why?
15:21Chouserum
15:21ChouserI may be confused.
15:22Chouserdanlarkin: sorry
15:22Chousergnuvince: momentarily got you confused with danlarkin there.
15:22gnuvinceno problem :)
15:22danlarkinto answer your question, no I haven't talked to him
15:22ChouserAnd danlarkin's already got his CA in.
15:23Chouserdanlarkin: do you want me to mediate or something?
15:23danlarkinhaha
15:23danlarkinsure!
15:24danlarkinmaybe there's benefit to there being two... his is a lot simpler after all
15:25ChouserI agree that there may be benefit, but I'd hate for the efforts to be going on without any communication.
15:25Chouserthe right answer may be two json libs, but I can't imagine that the right answer is not talking to each other at all.
15:26danlarkinyeh you're probably right
15:27Chouserand if there should be two json libs, I don't know why they shouldn't both be in contrib, unless there's a licensing issue.
15:31danlarkinalright then, set it up!
15:38shoover`rhickey: proud and lucky, indeed. An indyalt.net attendee made a point of mentioning a couple times that the community support is a great feature
15:43fffejsorry, silly question coming up - what's the Clojure equivalent of importing java.util.* - i can't find a way to express * at the moment :(
15:44hiredmanthere is none
15:44hiredmanjust import what you need
15:44fffejok, that makes me feel better for not finding it - thanks
15:55slashus2no need to pollute the namespace
15:58fffejtrue, but it's useful when you're lazy and exploring code without having to look up the ns of everything
16:00lisppaste8cemerick annotated #75862 "untitled" at http://paste.lisp.org/display/75862#1
16:01WizardofWestmarcmeh, having to litter your code with crap like Funcall sucks
16:01cemerickrhickey: I tracked down the cause of the NPE I got earlier today. See the paste above for info.
16:03BrackiIs there anything that'll give me a files basename or extract the dirname from a file?
16:03jkantzWizardofWestmarc -- it's a trade-off that buys you 1) not having to worry about polluting namespaces or shadowing things unintentionally
16:03slashus2cemerick: He may be the one with double underscores in his name.
16:04cemerickslashus2: well, if we have three Riches now (rhickey, rhickey_, and rhickey__), that should help things along!
16:04cemerick;-)
16:05hiredmanwhat about "string"
16:05rhickeycemerick: ok, but if you want something other than an NPE when you pass nil and something non-nil is expected...
16:05BrackiCan duck_streams be considered as the "file utils" package for clojure?
16:06cemerickrhickey: an NPE is fine, but with some explanation of what's going on would be nice. This is a class of error that is not present in java because javac doesn't allow null to be passed as a primitive arg.
16:06cemerick(modulo whatever happens with "unboxing" a ref to a java.lang.Float, but I've never tried that)
16:06cemericka ref to a null java.lang.Float, I mean
16:08hiredman,(Float. nil)
16:08clojurebotjava.lang.NullPointerException
16:10jkantzhiredman, :) ... a better example, "avec"
16:10cemerickhiredman: that NPE is coming out of the Float(String) constructor, as it attempts to parse the null -- the presence of that stack frame makes determining the problem a lot easier than the NPE coming out of clojure-land.
16:12cemerickOK, so in Java, calling a fn that takes a float with a null Float results in a bare NPE as well (I hardly ever use boxed primitives, FWIW).
16:13cemerickI guess the only difference is the stack trace coming out of clojure, not an application source file.
16:14rhickeycemerick: if your call is in a file you'll get the source line of the failing call in the trace
16:19silkarndoes Clojure's concurreny constructs really help that much? aren't you tied to Java's way of concurrency anyhow somehow?
16:19silkarncan you ahve concurrency in Clojure without using Java threads?
16:19hiredmanuh threads are not the issue
16:20hiredmanthe issue is unsafe mutable data
16:20silkarnand refs/atoms/agents/whatnot can help you with that?
16:20hiredmanyes
16:20silkarnput a lock on a thread someow?
16:20hiredmannope
16:21hiredmanyou don't like threads
16:21silkarnwhat do you do, start a thread inside a ref?
16:21hiredmanno
16:21silkarnhow do you know i odnt like threads?
16:21silkarni dont know wyat i like
16:21silkarnid like automagic concurrency :)
16:21hiredmanI did not imply that you did
16:22hiredmanyou mentioned java threads, and I said threads are not the issue
16:22hiredmanjava threads or otherwise
16:22hiredmana ref is an indirect reference to data
16:23hiredmanyou can deref it and get the data, but in order to change the value the ref has, you have to do it inside a transaction
16:24jkantzan alternative to the evaluation rule for symbols in function position: always look for var in current namespace, if you want the lexical binding in the function position you add quote which is consistent with the way quote strips away the namespace ('lex-fn-name arg1 arg2)
16:24hiredmaneh?
16:25hiredmanI hardly see what that gains?
16:26slashus2I wonder if the default sorting algorithm will be psort in the future?
16:26slashus2I mean core, not default.
16:26hiredman~def sort
16:27hiredmanslashus2: sort just uses
16:27hiredmanjava.util.Arrays/sort
16:27jkantzyou can have functions with arguments [a & rest] and call rest from within the function
16:27slashus2psort is a parallel sort?
16:27jkantzand so on
16:28hiredmanjkantz: the fix for that is really simple, do use rest
16:28hiredmando not
16:28hiredman:P
16:28slashus2hiredman: So psort isn't better?
16:28jkantzwell yes that is one fix :)
16:29hiredmanslashus2: I have no idea
16:29hiredmanjkantz: if your functions are getting so large that you are having name collisions inside the functions it may be time to decompose into several smaller functions
16:31zakwilsonisn't rest getting replaced by next/more anyway? (I haven't kept entirely up to date on that)
16:31Chouserrest is still a builtin fn name
16:31hiredman,(doc rest)
16:31clojurebot"([coll]); Returns a possibly empty seq of the items after the first. Calls seq on its argument."
16:36jkantzno it's not a matter of function size, just a matter of getting used to no punning allowed
16:38hiredmanjkantz: you seem to be all over, punning in this channel usually refers to nil punning, which doesn't seem to have any thing to do with name collisions inside a function
16:39hiredmanso are you moving on to something else? using terminology I don't understand?
16:39jkantzsomething like (fn [list] (list (first list))) is often called punning
16:40hiredmanI see
16:40hiredmanI call it confusing, and don't do it
16:41Chouseris this a lisp 1 vs. 2 thing?
16:41jkantzyeah
16:42jkantzI bet you do it half-way at some point :)
16:42ChouserI enjoy not having to specially quote function names when passing them -- that's required in a lisp 2 usually, isn't it?
16:42jkantzif you use a library you have to know all the function names in the library and never name one of your arguments that name
16:42WizardofWestmarcnot quoting per se, but you do have to expressly indicate it's a symbol from the function NS
16:43Chouserjkantz: no, you can leave libraries in their own namespaces
16:43Chouserjkantz: or bring in just the names you want
16:43hiredman^-
16:43jkantzso is it better then to not bring in whole libraries but just pull in the symbols you want?
16:44jkantzseems like it would be the case
16:44hiredmanit is better to use :as
16:44Chouseryeah, I'm against the unqualified use of 'use'
16:44jbondesonChouser: i'd just like to say at this moment that i love you for zipfilter.xml.
16:44jbondesonjust sayin
16:44Chouserha!
16:44Chouserwell, that's nice
16:46jbondesoncourse i have to add some != functions since i need exclusions, but it has saved me a whole mess of time
16:47Chouserwell, adding functions is the main reason to not use xpath.
16:47jbondesoni've spent way too much time in xpath hell.
16:48Chouseroh, really? you prefer xquery or something?
16:48jbondesonoh no, hate it all
16:48jbondesonequal opportunity xml technology hater
16:48jbondesondon't get me wrong, xml is fine and dandy in many cases, but the tech around it all sucks
16:49jbondesonxpath2 is leaps and bounds better than xpath1, but not everything supports it.
16:49jbondesonso to be at all compatible you just suffer through xpath1
16:51Chouseri'm glad zip-filter has (so far) escaped your wrath. :-)
16:51jbondesoni'm sure that keeps you up at night ;)
16:52WizardofWestmarchey, he could be one of those devs who takes the mantra to heart "Write your code like the person who comes after you is a serial killer" >_>
16:57jbondesonnow if there one programming team i could take out it's the Microsoft XML team... those bastards have caused me so pain over the years.
16:57WizardofWestmarcdepends, are they responsible for the xml engine in SQL Server too? If so I'd like to join in <_<
17:01technomancyyou mean like this? http://achewood.com/index.php?date=07052007
17:01jbondesonyes.
17:24cp2how can i generate a map from a list, where the keys are the values returned by a method called on each member in the list (they are java objects) ?
17:24cp2eg, value x in a list would be key: (.someMethod x) value: x
17:25cp2in th emap
17:25Chouser(zipmap (map #(.someMethod %) lst) lst)
17:25cp2aye, i could have come up with that
17:25cp2thanks, i was thinking about zipmap
17:25cp2but wasnt too sure...
17:25jbondesoni think that Chouser just hovers waiting for people to give him a challenge...
17:32cp2jbondeson yeah, seems so :)
17:39Chouserhm, I would certainly think so.
17:39Chouserand maybe 'into'?
17:39Chouserthough probably not 'reduce', I guess.
17:42lisppaste8cp2 pasted "why is this happening" at http://paste.lisp.org/display/75886
17:42cp2^
17:43hiredmanyou are calling a function that takes a Set on a List
17:44hiredmanso it says "Hey, this is not a Set"
17:44shoover`Chouser: if you put 'into' in one of the data structure-specific sections, it would need to go in them all
17:44Chouseryes
17:44Chouserannoying
17:45cp2hiredman: where though?
17:45cp2i dont see it
17:45Chouserok, added zipmap
17:45cp2oh my
17:45cp2oh, nevermind
17:45shoover`but I do tend to forget that one a lot, so maybe in the general collection summary where it talks about conj?
17:45cp2(as far as my "oh my")
17:45cp2problem still stands
17:45hiredmanI am unfamilar with set functions so I am unable to say
17:45ChouserCollections probably needs a related functions section for conj, disj, into, etc.
17:46Chousercount conj and seq are there, but don't stand out if you're skimming the page.
17:46shoover`Chouser: fair enough
17:46Chousergotta go. bbl.
17:51cp2so, anyone have any ideas
17:52shoover`cp2: can you annotate with a print of @class-hierarchy?
17:52hiredmanthat would be helpful
17:53hiredmanalso a print of superclassname
17:53hiredmanprn would be best
17:53cp2ok, give me a sec
17:53cp2have to do something real quick
17:53shoover`I have to believe someone stuck a list in there
17:54hiredmanactually
17:54hiredmanare you sure that exception is even coming from that line?
17:56cp2well, the place it is thrown is in core (in disj)
17:56hiredman~def disj
17:56cp2ill give you a stack trace
17:57lisppaste8cp2 pasted "stack trace" at http://paste.lisp.org/display/75887
17:58hiredman~def clojure.set/select
17:58hiredmanwow
17:58hiredmanI am surprised that worked
17:59hiredmanyeah
17:59cp2ah, i dont think its coming from where i thought
17:59hiredmanso select takes a predicate and a set
17:59cp2just stuck a few printlns in my code to see how far it gets
17:59hiredman*tada*
17:59cp2sec
18:00hiredman,(clojure.set/select identity '(a b))
18:00clojurebot(a b)
18:00hiredman,(clojure.set/select #(not % 'a) '(a b))
18:00clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$not
18:00hiredmaner
18:00hiredman,(clojure.set/select #(not= % 'a) '(a b))
18:00clojurebotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IPersistentSet
18:01cp2nevermind, its definitely coming from where i thought, but for the wrong reason i assumed
18:01mmtHi all, gotten fairly far a long in setting up clojure & swank, ran into this snag:
18:01cp2first iteration goes as planned, but when i add a definition to the set it borks
18:01mmtjava.lang.Exception: Unable to resolve symbol: lazy-seq in this context (core.clj:70)
18:01hiredmancp2: my guess would be that it isn't a set anymore
18:02cp2it should be though, thats whats getting me
18:02cp2(dosync (commute class-hierarchy conj class)))
18:02hiredmanat some point you are performing some operation that returns a list
18:02cp2is the last thing performed before the next iteration
18:02mmtThat error comes out of (require 'swank.swank), if anyone has seen it before, please let me know :)
18:02cp2class is an instance of class-relation
18:03hiredmanplace some (doto set prn) throughout
18:03hiredmanand see if it stays a set
18:04shoover`mmt: sounds like your swank and clojure are out of sync
18:04mmtthat's what it's beginning to look like
18:05mmtWhen I launch it from emacs using M-- M-x slime, it instead complains about
18:05mmtthere being no such namespace "clojure"
18:05hiredmanuh
18:05mmtwhich apparently means I have a very old swank hanging out somewhere
18:05hiredmanI guess so
18:05hiredmanclojure got moved to clojure.core many moons ago
18:05mmtah, I think I found it
18:06mmtHad an older copy sitting earlier in the classpath, time to clean house :)
18:06shoover`hiredman: I don't quite get why your select returned different results based on the selection pred
18:07hiredmanshoover`: it has to do with disj
18:07hiredmaner
18:07shoover`hiredman: in both cases, it's receiving a list and not a set
18:07hiredmanwell, select only tries to disj if something fails the pred
18:07cp2thats interesting hiredman: after my inc-subclass-count is invoked (which looks much like update-role in http://en.wikibooks.org/wiki/Clojure_Programming/Concepts#Mutation_Facilities ), the ref points to nil
18:07cp2and then it becomes a list from the next function doing stuff
18:07cp2so, i think the problem is there :)
18:09hiredman,(doc clojure.set/union)
18:09clojurebot"([] [s1] [s1 s2] [s1 s2 & sets]); Return a set that is the union of the input sets"
18:09shoover`ah, so when the pred is identity, it never calls disj
18:09cp2yeah hiredman
18:09hiredmanshoover`: correct
18:09cp2thats what goes wrong
18:09cp2the two selects i perform before the union both return an empty set
18:09shoover`should select check and throw?
18:09cp2so union ends up returning nil
18:09hiredman*shrug*
18:10cp2and then it gets foobar'd from there
18:10cp2i think i can fix it
18:10cp2oh, that makes much sense
18:11cp2the set is empty initially so no wonder the 2 selects return an empty set
18:11leafwis anybody here using a java-only db, that would recommend? I need to embed a simple db into an app ... can't ask users to install postgres.
18:13cp2ok hiredman, im getting closer!
18:13cp2NPE now
18:13zakwilsonleafw: No, but I think BerkeleyDB is what you're looking for.
18:14hiredmanyou must be passing nil into select now
18:14Brackileafw: go for dqlite
18:14Brackisqlite
18:14hiredman,(clojure.set/select identity nil)
18:14clojurebotnil
18:14cp2yeah, this will be easier for me to track down now that i know what to look for
18:14hiredmanhuh
18:14hiredmanmaybe not
18:14cp2well, im hoping
18:15cp2this time its thrown for my code
18:15cp2no library functions
18:15cp2well, not a library function*
18:15leafw"Berkeley DB JE is not a relational engine built in Java." -- I'd rather not depend on anything else
18:16leafwhum the website contradicts itself
18:16hiredmanBerkeley DB JE is not a relational engine, built in Java
18:16zakwilsonIt doesn't contradict itself: Berkeley DB is not a relational engine.
18:16zakwilsonBerkeley DB JE is built in Java.
18:17redalastorAccording the Eclipse Public License under which Clojure is licensed I cannot distribute an app under any license other than the EPL :(
18:17hiredmanredalastor: are you sure that is correct?
18:17redalastorhttp://www.eclipse.org/legal/eplfaq.php#USEINANOTHER
18:17redalastorThe FAQ entry seems clear to me...
18:18hiredmanyou can license your code however you want though
18:18zakwilsonredalastor: I think you're misreading it. You can distribute an app under any license you want, though if your app is a modified version of Clojure itself, you must comply with the terms of the EPL.
18:19zakwilsonAnd if you bundle Clojure with your app, you're bound by the EPL, but the EPL only covers Clojure itself; it does not attach itself to code that uses Clojure.
18:19redalastorWouldn't the app technically be a derivative?
18:20redalastorLinux had to include an exception in its license that says "linking against the kernel is considered normal use and is not covered by this license".
18:20hiredmannope
18:20hiredmanwell, linux uses a different license
18:20technomancyredalastor: yeah, that's probably only relevant with the GPL
18:21redalastorAccording to the latest entry on the FAQ, linking with GPLed code is *not* okay.
18:22hiredmanwell, clojure doesn't link :P
18:23gnuvince_Does anyone else get a StackOverflow exception when starting slime?
18:23redalastorTrue and if I am the copyright holder then I can add an exception saying that it's okay for my app to link to clojure.
18:23hiredmanuh
18:23hiredmanNo
18:23hiredmanwell, actually
18:23hiredmanmaybe
18:23hiredmantalk to a lawyer
18:24hiredmanLaw is serious business
18:24redalastorIt's in the GPL, there's a section on additional terms I might want to include.
18:24cp2hiredman: i fixed, in one sense of the word "fixed" or another :)
18:24cp2fixed it*
18:25zakwilsonredalastor: I think your question is best answered by http://www.eclipse.org/legal/eplfaq.php#PROPPROD
18:25hiredmanif you picked a license that was more free, then you don't really have to worry about the clash
18:26hiredman:)
18:26redalastorFree is subjective.
18:26hiredmanSo is the GPL
18:27redalastorActually, it's pretty detailed so it doesn't leave a lot of room to interpretation.
18:27zakwilsonI think you can use the GPL for your app and bundle Clojure if you like.
18:27hiredman...
18:28hiredmanI was being a smartass, I meant the GPL
18:28hiredmansubjugates
18:30dreishI think it's pretty clear-cut that a program written in a language is not a derivative work of that language's compiler, but if you aren't comfortable you can always get yourself a lawyer.
18:32redalastordreish: Actually, according to the FSF lawyers, it can be if there is code from that language being mixed in.
18:33technomancywell of course it's possible to make a derivative if you copy code
18:33technomancythat doesn't really have anything to do with the question at hand
18:33dreishhttp://www.gnu.org/licenses/gpl-faq.html#InterpreterIncompat
18:34dreishI write in an additional permission under GNU GPL version 3 section 7, but it's probably not strictly needed.
18:34technomancythe only thing that doesn't take away rights is public domain
18:34technomancywhich isn't a license
18:34redalastorAccording to the GPL FAQ: "If you want your program to link against a library not covered by the system library exception, you need to provide permission to do that."
18:35technomancyand doesn't even exist in all jurisdictions.
18:35dreishYes, and clearly Clojure itself is covered by the system library exception.
18:35dreishContrib, probably not.
18:35hiredmandreish: clojure is interpreted
18:35p_ltechnomancy: Not necessarily. MIT is probably as close as you can get in current legal system to giving freedom and avoiding giving up your rights to the code
18:35hiredmaner
18:35hiredmandamn it
18:36hiredmandreish: clojure is not interpreted
18:36hiredmanit is compiled
18:36redalastorSystem or not, I have the option of providing the permission.
18:36dreishWho said it was interpreted, other than you?
18:36technomancyp_l: even that takes away your right to remove copyright notices etc.
18:37dreishI guess the FAQ appears to be restricted to addressing interpreted languages.
18:37p_ltechnomancy: erm, normally you don't have right to remove copyright notice from source.
18:37technomancyp_l: my point being that there's no such thing as Absolutely Free. everything must be framed in terms of trade-off
18:38hiredmandreish: well, yeah, I was assuming you had read the link you posted :P
18:38technomancyp_l: sure you do: you can remove anything you want from public domain
18:38dreish'The run-time libraries ... are "System Libraries" as GPLv3 defines them, and as such they are not considered part of the Corresponding Source.'
18:38p_ltechnomancy: Yes, I just consider GPL to be particularly non-free compared to other existing licenses :-)
18:38dreishhiredman: That's crazy talk.
18:39technomancyp_l: well why didn't you say that up front then. =)
18:39p_ltechnomancy: BTW, in countries where certain "pro-IP" activists haven't done too much damage yet, everything enters public domain after certain time
18:40technomancyp_l: right, but in some countries you don't even have the legal right to place something you have complete copyright over in the public domain.
18:40technomancyso it's all about trade-offs.
18:41mmtHi all, thanks for your help earlier. I have the latest svn/git checkouts of swank-clojure, clojure-mode and clojure...
18:41p_ltechnomancy: Everything is about tradeoffs...
18:41mmtBut I still get Unable to resolve symbol: lazy-seq
18:41mmtWhen I launch swank in Emacs
18:41hiredmanI think clojurebot has something about "tradeoffs" in one of its clojure factoids
18:41redalastorSomeone wrote the WTFPL to solve the problem of not being able to put stuff in the public domain.
18:42redalastorIt basically says "You are authorized to do whatever the fuck you want."
18:42greghheh
18:42hiredman~clojure
18:42clojurebotclojure is cheating
18:42technomancyredalastor: sure, but I bet there's some jurisdictions where even that wouldn't be honored
18:42p_lredalastor: Is it "What The Fuck Public License"? :)
18:42hiredman~clojure
18:42clojurebotclojure is far closer to perfection then python
18:42hiredman~clojure
18:42clojurebot"[Clojure ...] feels like a general-purpose language beamed back from the near future."
18:42hiredman~clojure
18:42clojurebot"[Clojure ...] feels like a general-purpose language beamed back from the near future."
18:42hiredmanbah
18:42hiredmanforget it
18:42technomancyredalastor: like maybe in some religious governments legal documents with swearing aren't admissable in court or something... =)
18:43redalastortechnomancy: You can argue in court that the intent is crystal clear :)
18:43hiredmanYANL
18:44hiredmanclojurebot: YANL is <reply>You Are Not Lawyers
18:44clojurebotIk begrijp
18:45hiredmantwo people who are not lawyers, trying to argue technical points of law, let alone international law, is just plain silly
18:45technomancyredalastor: there are some pretty crazy legal systems out there.
18:45technomancythat's all I'm saying
18:45technomancyyour assumptions probably don't hold worldwide
18:45hiredmantechnomancy: why don't you help mmt with his swank
18:45hiredmanI would, but I don't swank
18:45mmt:)
18:45technomancyhiredman: what, and be productive? why break my streak?
18:45hiredmanor emacs
18:45mmtso, is lazy-seq still part of clojure?
18:45technomancymmt: you're seeing that error when you launch emacs?
18:45technomancynot when you open a clojure file?
18:45mmtwhen I launch slime
18:46technomancyok
18:46mmtI have clojure-mode opening on load, then I run M-- M-x slime
18:46redalastortechnomancy: Yeah but I don't really have to bother with what people in crazy systems do with my code :)
18:46mmtI was following:
18:46mmthttp://bc.tech.coop/blog/081023.html
18:46technomancymmt: and it's showing up as an elisp-level error or a slime backtrace?
18:46mmtIt's a Java lang exception
18:46mmtjava.lang.Exception: Unable to resolve symbol: lazy-seq in this context (core.clj:70)
18:47technomancymmt: do you do CL at all? because those instructions are more complicated than necessary in order to support using CL and Clojure at the same time.
18:47mmtwell, I've played with CL
18:47mmtI can avoid it, is there a better set of instructions around?
18:47technomancymmt: if you don't need CL compatiblity with SLIME the easiest thing to do is M-x clojure-install with the latest clojure-mode
18:47technomancythough unfortunately I haven't gotten around to testing this with the lazy changes yet
18:48technomancyalthough I think gnuvince has?
18:48mmtsounds good
18:48mmtSo, do you think I'll need to back out of any of my .emacs changes?
18:48gnuvince_technomancy: when I try to start SLIME, StackOverflow
18:48technomancymmt: all you need is clojure-mode, you can get rid of your other changes
18:48mmtincluding swank-clojure?
18:49technomancyyes
18:49technomancymmt: though actually... unless you *need* the lazy stuff, it might be better to roll back to an older revision
18:49technomancyfor at least a week or so
18:49mmtah, these are recent changes
18:49technomancyyes, from this week
18:49mmtso, is there a simple SVN command or such to grab me an appropriate version, or should I troll around for an old zip?
18:53technomancymmt: if you've got git clones of each repository, you can easily rollback to the SHA1s mentioned in this post: http://groups.google.com/group/clojure/browse_thread/thread/2acedf58af32de77/a6a42b82442e64dd?lnk=gst&amp;q=test-is+slime#a6a42b82442e64dd
18:53technomancyjust "cd ~/src/clojure; git checkout d866f14" etc; for each of the four projects
18:53technomancy[clojure, contrib, slime, swank-clojure]
18:58schoppenhauerhello. has anybody expieriences with stringtemplate and clojure?
19:00schoppenhaueri am currently trying to create a generated list, but stringtemplate expects a class with apropriate fields set to the values it should insert. actually, i have tried to create a proxy defining getter- and setter-methods, but this doesnt work. I also considered gen-class, but i dont really understand it. is there something inverse to (bean ...)?
19:03mmttechnomancy: Is clojure hosted on git-hub now? I was using that SVN checkout
19:03technomancymmt: it's mirrored on github
19:04technomancyM-x clojure-install uses that so you have the complete history available to you
19:04technomancyvery handy in situations like this where you need to roll back easily; you could even do it w/o network
19:05mmt*nod* I'm a fan of git
19:06schoppenhauerseems like the getter- and setter-methods of my "proxy" are not even existant
19:06hiredmanschoppenhauer: proxy can only change behaviour of existing methods, not make new methods
19:07schoppenhauerhiredman: is there any other way of creating new methods and fields?
19:07hiredmanschoppenhauer: gen-class and AOT
19:07hiredmaner
19:07hiredmanAOT Compilation
19:08schoppenhauerhiredman: as I said, i dont actually understand gen-class. i only found a strange example...
19:10hiredmanclojurebot: compilation?
19:10clojurebotIt's greek to me.
19:10schoppenhauerhiredman: I think I need :factory for what I want to do. But I cannot find any example of how to use it
19:10hiredman~google clojure compilation
19:10clojurebotFirst, out of 2890 results is:
19:10clojurebotClojure � compilation
19:10clojurebothttp://clojure.org/compilation
19:10schoppenhauerhiredman: yes, I know this page, but :factory isnt explained
19:11hiredman never heard of :factory
19:11schoppenhauerhiredman: http://clojure.org/API#gen-class to me it seems like this is what I need when I want to create fields
19:11schoppenhauerhiredman: but I dont know, I could be wrong
19:12mmttechnomancy: thank you for your help! things are working now
19:12hiredmanschoppenhauer: why do you need fields?
19:12cooldude127Bracki: ping!
19:12schoppenhauerhiredman: stringtemplate seems to need them
19:12mmtoh, except now I can't edit .clj files! hah
19:13mmtWrong type argument: stringp, nil
19:13mmtin the minibuffer
19:13hiredmanew
19:13hiredmanare you sure?
19:13mmtMy .emacs contains:
19:13mmt(autoload 'clojure-mode "clojure-mode" "A major mode for Clojure" t)
19:13mmt(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
19:13mmtand:
19:14mmt(require 'swank-clojure-autoload)
19:14cooldude127that looks correct
19:14mmtI could comment those out. If I switch into clojure-mode manually there's not such error
19:14schoppenhauerhiredman: I want to access templates of the form $foo.bar$ - therefore I need a class with the field ".bar". I dont know if it also works with a setBar-Method.
19:16mmthmph, well, I have to run, thank you for your help! I'll be back later
19:26gnuvince_camperman: welcome :)
19:26technomancyweird; never seen that stringp error
19:27campermangnuvince, thank you - pretty sure I read your blog the other day :)
19:28technomancythe nice thing about a young language is that by blogging about it you can increase the amount of available material on a topic by a nontrivial percentage. =)
19:28schoppenhauerWhen I created a class using gen-class, how can I create instances of it?
19:28campermanheh - true true
19:28technomancynom nom nom
19:29campermanthe only problem I have with clojure is I've despised Java (the language) for years and now need to get to grips with the libraries
19:29technomancycamperman: same
19:30technomancyliking clojure doesn't mean you accept that Java libraries all have good APIs though. =)
19:30campermantechnomancy, sure - it's just that I'm clueless about the basics like Swing and sockets and everything else really
19:30schoppenhauerSeems like gen-class doesnt do anything
19:31technomancycamperman: there's a server-socket library in contrib is pretty nice to deal with
19:31technomancyhaven't done clients yet, but I'd search contrib first
19:31campermantechnomancy, ah thx - didn't know that
19:31hiredmanyou have to (compile ...) for gen-class to work
19:32technomancycamperman: guis are probably going to be a pain no matter what though; no real way around that
19:32schoppenhauerhiredman: wah... it does have to have its own file?
19:32schoppenhauerhiredman: cant i do this "instantly" somehow?
19:32hiredmannope
19:32campermantechnomancy, right
19:32p_ltechnomancy: GUIs in Delphi weren't that much of a PITA....
19:32schoppenhauerok, thats not sweet.
19:32campermanthis concurrent ant sim is a work of art
19:32hiredmanclojurebot: gen-class?
19:32clojurebotNo, hiredman, you want gen-interface + proxy
19:33campermanI have tried something similar years ago in C with threads and went mad
19:33technomancyC will do that to you.
19:34schoppenhauerhiredman: can I do this instantly using gen-interface?
19:34technomancycamperman: I've made a solemn oath never to manually manage memory again. It's saved my sanity countless times.
19:34technomancyI would suggest a similar thing to all programmers.
19:34campermanC + threads + deadlocks + mutable state did it to me - I was nodding and laughing all the way through the talk
19:34technomancyExcept kernel devs and hotspot maintainers, I guess.
19:34hiredmanschoppenhauer: no, but you can add methods and stuff with an interfcate then "implement" it using proxy
19:34campermanwill have to take that oath soon
19:35schoppenhauerhiredman: why should I use clojure for this? defining an interface should be easier with java.
19:36hiredmanschoppenhauer: *shrug*
19:37schoppenhauerhiredman: i just mean: defining an interface with clojure which i have to compile anyway - then I can also use java and use "proxy" with it ^^
19:37hiredmanI have only gone down the gen-interface road once
19:37hiredmanclojurebot: mkbean?
19:37clojurebotIt's greek to me.
19:37hiredmanbah
19:37schoppenhaueractually, i wonder why there is no possibility to generate classes on-the-fly.
19:37schoppenhauerafaik, this is possible
19:38hiredmanactually clojure pre-AOT compilation could
19:38schoppenhauerbut thats not the lisp-way...
19:38hiredmanbut you will have to talk to rhickey to find out why it was removed/changed/etc
19:38schoppenhaueryes,
19:38schoppenhauerits just a pity atm
19:39hiredmanlike I said, it has only every come up once
19:39hiredman(for me)
19:40schoppenhauerhm. but without it, the java-interops are not complete.
19:41hiredmanschoppenhauer: are you really sure stringtemplate needs field access?
19:41hiredmanI have heard or stringtemplate before so I assumed it was a decent lib, but requiring public field access is, uh, bad
19:41hiredmanheard of
19:48schoppenhauerhiredman: i dont know stringtemplate in detail. it should be satisfied with getter/setter-methods. but i cannot provide them "on the fly" either
19:52silkarnhow is the automatic dispatch in multimethods done in clojure? is this inside the language parser or wrtten on top of the core?
19:55hiredman~def defmulti
19:56hiredmanhuh
19:57hiredmanweird
19:58technomancyhiredman: is that like source?
19:58hiredmanshould be
19:59hiredmanI think clojurebot is out of sync right now
19:59hiredmanit uses a local svn tree to try and guess what revision of clojure it is running before it uses (:line (meta ...))
20:00technomancyI didn't really understand the usefulness of metadata until I realized you could use it to find where stuff is def'd. so handy!
20:01rockbiterholy mackerel, lotta people here
20:02rockbiterwhich rhickey is the real one
20:03hiredman~seen rhickey?
20:03clojurebotrhickey was last seen quiting IRC, 122 minutes ago
20:03rockbiteris clojurebot written in clojure?
20:03rockbiter~fessup
20:03clojurebotI don't understand.
20:03rockbiter~show me your rusty innards
20:03clojurebotshow is clojure.contrib.repl-utils/show
20:08schoppenhauerwah... clojure's way of compiling classes is really annoying.
20:09schoppenhauerhopefully, in a future version there will be a better way ^^
20:10weavejesterWhy is it annoying?
20:12schoppenhauerBecause it cannot create them on-the-fly, you have to compile your clj-file explicitly, and therefore, have to set paths so that it can find the clj-file
20:12schoppenhauerIts something you dont want to do ;-)
20:13schoppenhauerAt least I dont. There are classes to compile java-code on-the-fly (never done this, i have to admit), I wonder whats the problem with clojure, or why this was decided.
20:13weavejesterSo, you're thinking of something like Python's pyc files?
20:14schoppenhauerI dont know pythons pyc-files
20:14schoppenhauerI am thinking of generating interfaces during runtime rather than AOT
20:15weavejesterBasically Python saves its compiled bytecode so that the next time you run a Python script, it doesn't have to recompile everything.
20:15weavejesterOh, you mean genclass?
20:15schoppenhaueryes
20:15technomancyweavejester: hi
20:15weavejestertechnomancy: hi there
20:16technomancy(it's Phil from the compojure ML)
20:16schoppenhauerNo, thats not what I mean
20:16schoppenhauerthats like .fasl-files in common lisp
20:16technomancyjust wanted to let you know I haven't forgotten about compojure. =)
20:16schoppenhauerbut i dont need this
20:16weavejesterHey Phil
20:16schoppenhauers/need/mean
20:16technomancyI'm going to be headed back to web-ish stuff once I wrap up the screencast I'm working on.
20:17weavejestertechnomancy: You're not obliged to remember, but it's nice to know anyway :)
20:18weavejesterschoppenhauer, if I used genclass more than I do, I'd probably agree with you
20:19weavejestertechnomancy, what's the screencast of?
20:19schoppenhauerweavejester: well, it would be a nice feature to have something like on-the-fly-class-generating (or interface-generating). I mean the "Proxy"-command is very elegant. Having a genclass-command being as elegant as this would be nice.
20:21technomancyweavejester: just on learning clojure
20:21technomancytargeted towards users of dynamic languages
20:21technomancyhttp://peepcode.com/pages/upcoming
20:27stuhoodi miss nil punning =(
20:28weavejesterOut of all the code I've written, I've actually only nil-punned twice
20:28weavejester... that I know of
20:29schoppenhauerwhats nil-punning?
20:30schoppenhaueris it that nil behaves like the empty list?
20:30stuhoodexploiting the fact that an empty sequence used to be nil in a conditional
20:30stuhoodyea
20:30schoppenhauerhm. well, thats also something i would like to have in clojure ^^
20:31weavejesterUnfortunately, nil-punning is incompatible with lazy lists
20:31weavejesterSince you need to check whether its empty or not
20:32schoppenhauerI can live with that. What I cannot really live with is that I have to compile source Ahead of Time.
20:32schoppenhauerThats not Lisp :(
20:32cooldude127schoppenhauer: why do you have to?
20:32schoppenhauercooldude127: see backlog
20:33schoppenhauercooldude127: it seems not to be possible to create a new interface on run-time. i hope this feature will be added someday.
20:34cooldude127schoppenhauer: oh, i hadn't noticed, i only use the lispy part of clojure mostly
20:34schoppenhauercooldude127: well, its java-interop... it would be good if it was usable in a "lispy" way, too.
20:35schoppenhaueractually, I dont know much about the clojure-internals, but i am sure it has something like a JIT-Bytecode-Compiler.
20:35schoppenhauerso this shouldnt be a too big problem
20:36schoppenhauermaybe there are other reasons, dont know
20:37weavejesterDoes anyone know if there is a general-purpose REPL library for Clojure that operates over a network socket?
20:44weavejesterOh, there seems to be one in clojure.contrib.server-socket
20:53stuhoodhow does one type hint for an inner class?
20:54rockbiter"hint for an inner class"
20:54rockbiteryw
20:55stuhoodah, $
20:56stuhoodthanks
21:13cp2ah, damnit
21:13cp2no wonder this wasnt working
21:13cp2take-while only conjs while the predicate is true, i thought it added on a per-element basis (and went through the whole list)
21:14cp2i guess i should read more carefully
21:14cp2what im looking for is filter ;)
21:18silkarnhow do i do in the chnanel
21:19silkarn* silkarn jumps
21:20cp2silkarn /me i think is what you want
21:20cp2might be /action or /describe on some other clients
21:39nullman`i'm trying convert the following clisp code behaviour to clojure: (funcall (intern "my-function"))
21:39nullman`anyone know how?
21:41hiredman((symbol "inc"))
21:41hiredman,((symbol "inc"))
21:41clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: Symbol
21:41hiredman,((resolve (symbol "inc")))
21:41clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$inc
21:41hiredman,((resolve (symbol "inc")) 1)
21:41clojurebot2
21:42nullman`hiredman: thank you
23:58blbrownwhat is the opposite of take. is there a function to take the last N items from a sequence