Re: update-in! (?)

2010-01-20 Thread Gabi
Guys, I really need your expertise here. I have lots of deeply nested vectors, which i need to manipulate frequently (thousands of times) What is the most effective way to do this ? On Jan 17, 4:27 pm, Gabi wrote: > Right. I thought that transient performing deep 'transientivity'. > Here is a fix

Re: Empty defstruct

2010-01-20 Thread Andreas Wenger
> Just another option to consider: > {:type :person, :name "Bill", :age 20} Why then use defstruct at all? I think defstruct is useful, but it would be even more useful if I had nothing to fear if it "runs empty" sometime because of little design changes. It might be only experimental and later I

Re: Empty defstruct

2010-01-20 Thread Andreas Wenger
> I think your use of "workaround" is pejorative. And can it even be > called a work around if it is a best practice even when there is > nothing to work around? I just can't understand why throwing an exception should be more useful than returning some object you can actually work with. I wouldn'

Re: compojure/defservlet

2010-01-20 Thread James Reeves
Unfortunately, that Wikibook is out of date. The `defservlet On Jan 20, 1:19 am, Jeff Schwab wrote: > Hi: > > The compojure wikibook claims that compojure provides a defservlet > function, along with other syntactic conveniences that I seem to be > missing.  Grepping the git log didn't turn up an

Re: compojure/defservlet

2010-01-20 Thread James Reeves
Unfortunately, that wikibook is rather out of date by now. Compojure's documentation is generally not in the best of states; however, I'm holding off fixing it until I finish work on the next version in a couple of months. There doesn't seem much point in writing docs for a version that will soon b

Re: update-in! (?)

2010-01-20 Thread Christophe Grand
Hi Gabi! Can you tell us more about your problem, what do those deeply nested vectors represent and how are you going to update them? (are all updates batched in one part of your program?) With transients current implementation you can't write an efficient update-in! Christophe On Wed, Jan 20,

Re: update-in! (?)

2010-01-20 Thread Gabi
These vectors represent trees which need to updated very frequently. So If there was an efficient way to use transients to represent transient trees the whole process would be much more efficient (so each update to a tree would be done in place instead of creating new one.) As discussed above, naiv

Re: update-in! (?)

2010-01-20 Thread Sean Devlin
Gabi, A similar technique is used with sparse matrices. You usually have severals arrays, one for the non-zero elements, and another one for indexing the column and a third for indexing the rows. http://pasadena.wr.usgs.gov/office/baagaard/research/papers/thesis/figs/methods/sparseMatrix.gif Thi

Re: update-in! (?)

2010-01-20 Thread Gabi
I need to add/delete much more frequently than just updating actually. On Jan 20, 4:59 pm, Sean Devlin wrote: > Gabi, > A similar technique is used with sparse matrices.  You usually have > severals arrays, one for the non-zero elements, and another one for > indexing the column and a third for

Re: update-in! (?)

2010-01-20 Thread Sean Devlin
How about a sorted set w/ a custom comparator? Of course, this rules out transients, but maybe the flatness will make up for it? On Jan 20, 10:15 am, Gabi wrote: > I need to add/delete much more frequently than just updating > actually. > > On Jan 20, 4:59 pm, Sean Devlin wrote: > > > Gabi, > >

Re: update-in! (?)

2010-01-20 Thread Gabi
Can you elaborate more ? How can trees be represented in sorted sets? On Jan 20, 5:24 pm, Sean Devlin wrote: > How about a sorted set w/ a custom comparator?  Of course, this rules > out transients, but maybe the flatness will make up for it? > > On Jan 20, 10:15 am, Gabi wrote: > > > I need to

Re: update-in! (?)

2010-01-20 Thread Christophe Grand
I concur: a map (or a sorted map if you need to emulate access to a subtree) can be an option. [[1 2] [3 4]] is represented by {[0 0] 1, [0 1] 2, [1 0] 3, [1 1] 4} On Wed, Jan 20, 2010 at 4:24 PM, Sean Devlin wrote: > How about a sorted set w/ a custom comparator?  Of course, this rules > out tr

Re: update-in! (?)

2010-01-20 Thread Gabi
I posted a question on SO about it. Interesting discussion: http://stackoverflow.com/questions/2102606/algorithm-to-implement-non-binary-trees-using-1-dimensional-vector On Jan 20, 5:39 pm, Christophe Grand wrote: > I concur: a map (or a sorted map if you need to emulate access to a > subtree) ca

Re: Empty defstruct

2010-01-20 Thread Kevin Downey
"empty classes in Java" what does that mean? as I said, structs are an optimization on maps, that optimization doesn't work for empty structs, so empty structs "of course" don't make sense On Wed, Jan 20, 2010 at 12:39 AM, Andreas Wenger wrote: >> I think your use of "workaround" is pejorative.

Autodoc for the masses

2010-01-20 Thread Tom Faulhaber
Now your project can have the same documentation as Clojure, clojure- contrib, and Incanter! The standalone autodoc tool is now available. It can be run from the command line and it integrates with Leiningen and ant. (Maven still to come - let me know if you want to help.) Autodoc builds full, st

Re: deftype implementing methods with multiple argument lists

2010-01-20 Thread Konrad Hinsen
On 19 Jan 2010, at 22:32, Stuart Sierra wrote: You can include multiple definitions of the same method, with different arguments, in a deftype. (deftype Foo [f] (bar [x] ...) (bar [x y] ...)) Don't know if that's intended, but it works. Indeed, thanks! Assuming that this is an intentional

Re: Good "refs" on concurrency?

2010-01-20 Thread Raoul Duke
> These two are sufficient to convince many of the complexity of Concurrent > programming. The way I try to convince people of the benefits of Clojure is > by first explaining these 2 articles and then showing how easy life is with > Clojure. please also see CTM. http://www.info.ucl.ac.be/~pvr/Va

Re: clojure unicode on Windows

2010-01-20 Thread Lukas Lehner
Hi using directly (not jline or others) although pure REPL would be still fine, I have found how to make it work in emacs WIN32 not sure if all of this is needed though .emacs (setq locale-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (set-selec

Multimethod attribute maps

2010-01-20 Thread Jacek Generowicz
In Clojure 1.1.0, the documentation states: clojure.core/defmulti ([name docstring? attr-map? dispatch-fn & options]) Macro Creates a new multimethod with the associated dispatch function. The docstring and attribute-map are optional. Options are key-value pairs and may be one of: :defa

Re: update-in! (?)

2010-01-20 Thread brianh
Any chance you could rethink your approach & use a zipper? On Jan 20, 9:32 am, Gabi wrote: > I posted a question on SO about it. Interesting > discussion:http://stackoverflow.com/questions/2102606/algorithm-to-implement-non... > > On Jan 20, 5:39 pm, Christophe Grand wrote: > > > > > I concur:

Question about Responsiveness of Garbage Collection

2010-01-20 Thread CuppoJava
Hi, Java was my first language, and my favorite platform to work in, but I do notice (especially after buying a mac and experiencing Mac OS X) that gui programs written on the JVM are noticeably less responsive than their native counterparts. Some articles I read point to Java's use of garbage col

Re: Question about Responsiveness of Garbage Collection

2010-01-20 Thread Raoul Duke
> Thanks for your opinions for the most part, it is theoretically (and research implementations have shown) that GC can be just as responsive from an end-user perspective as manual memory management. i believe the price to pay is usually a significantly larger memory footprint. and, there is nothi

Re: Autodoc for the masses

2010-01-20 Thread liebke
That's fantastic news! I wholeheartedly recommend Autodoc, it has been great for the Incanter project. Here are examples of its output: Clojure: http://richhickey.github.com/clojure/ Clojure-contrib: http://richhickey.github.com/clojure-contrib/ Incanter: http://liebke.github.com/incanter/ David

Re: Autodoc for the masses

2010-01-20 Thread Phil Hagelberg
Tom Faulhaber writes: > Now your project can have the same documentation as Clojure, clojure- > contrib, and Incanter! > > The standalone autodoc tool is now available. It can be run from the > command line and it integrates with Leiningen and ant. (Maven still to > come - let me know if you want

Re: Autodoc for the masses

2010-01-20 Thread Timothy Pratley
Fantastic! Love it :) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group

Re: compojure/defservlet

2010-01-20 Thread Jeff Schwab
James Reeves wrote: Compojure's documentation is generally not in the best of states; however, I'm holding off fixing it until I finish work on the next version in a couple of months. Fair enough, thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" g

Re: Autodoc for the masses

2010-01-20 Thread Tom Faulhaber
> Looks great! A couple comments. Thanks! > * Adding "by unknown author" to namespaces that have no author metadata >   seems a bit superfluous. Yeah, that's on my list to clean up. I did that in the old days to shame the contrib authors into adding the metadata (and remind me to bug them), but

Re: Multimethod attribute maps

2010-01-20 Thread Timothy Pratley
2010/1/20 Jacek Generowicz : > What is the purpose of the attribute map? The attribute map is added to the meta-data of the created. Meta-data contains info which can be used at runtime or to create documentation but is not part of the object itself and does not affect equality. Specifically for d

Re: Question about Responsiveness of Garbage Collection

2010-01-20 Thread mac
If you are talking about gui's written in swing you might have more luck with AWT since that is supposed to be using native gui components rather than doing it's rendering in java. I suspect that the sluggishness of swing is due to the fact that it has to copy a lot of data between the java heap an

return value of use, requires?

2010-01-20 Thread Raoul Duke
hi, in the repl when i (use 'foo) vs. (use :foo) they both return nil, so it doesn't help me know that the former is right and the latter isn't. i think. would it be sensible for use to return true or something more positive than nil if it successfully brings in a namespace? thanks. -- You recei