final ImmutableSet.Builder<A> builder = ImmutableSet.builder()
builder.addAll(set0);
builder.add(new A());
final Set<A> set1 = builder.build();
--
guava-...@googlegroups.com.
http://groups.google.com/group/guava-discuss?hl=en
unsubscribe: guava-discus...@googlegroups.com
This list is for discussion; for help, post to Stack Overflow instead:
http://stackoverflow.com/questions/ask
Use the tag "guava".
--
guava-...@googlegroups.com.
http://groups.google.com/group/guava-discuss?hl=en
unsubscribe: guava-discus...@googlegroups.com
This list is for discussion; for help, post to Stack Overflow instead:
http://stackoverflow.com/questions/ask
Use the tag "guava".
--
guava-...@googlegroups.com.
http://groups.google.com/group/guava-discuss?hl=en
unsubscribe: guava-discus...@googlegroups.com
This list is for discussion; for help, post to Stack Overflow instead:
http://stackoverflow.com/questions/ask
Use the tag "guava".
Thank you Robert, it is definitely an option.Is there any particular reason you voted against more powerful immutable collections (add, remove, filter, ...)?
--
Thank you Robert, it is definitely an option.Is there any particular reason you voted against more powerful immutable collections (add, remove, filter, ...)?
--
guava-...@googlegroups.com.
http://groups.google.com/group/guava-discuss?hl=en
unsubscribe: guava-discus...@googlegroups.com
This list is for discussion; for help, post to Stack Overflow instead:
http://stackoverflow.com/questions/ask
Use the tag "guava".
Such as http://code.google.com/p/pcollections/
--
Johan Van den Neste
I'd love to see good persistent collections, at the quality level of guava, but probably guava would not be the proper place for this. With guava's popularity, putting these there would just encourage overusing them - and from my scala experience I learned that many people would love to start choosing suboptimal structures just for the sake of "purity". Persistent structures border (and not coincide, since classic work on persistent structures actually depends on mutations) with functional programming, which can trigger that effect.There are various graph algorithms though that cannot be implemented efficiently without persistent collections. A good example is finding k shortest paths, instead of just one (so to have some alternatives) - this needs persistent heaps. Another example is simply depth-first traversals, where persistent stacks can offer richer semantics: instead of just visiting nodes, client code can safely be visiting the whole paths from the root, basically for free.
On Thu, Dec 30, 2010 at 11:00 AM, Dimitris Andreou <jim.a...@gmail.com> wrote:
I'd love to see good persistent collections, at the quality level of guava, but probably guava would not be the proper place for this. With guava's popularity, putting these there would just encourage overusing them - and from my scala experience I learned that many people would love to start choosing suboptimal structures just for the sake of "purity". Persistent structures border (and not coincide, since classic work on persistent structures actually depends on mutations) with functional programming, which can trigger that effect.There are various graph algorithms though that cannot be implemented efficiently without persistent collections. A good example is finding k shortest paths, instead of just one (so to have some alternatives) - this needs persistent heaps. Another example is simply depth-first traversals, where persistent stacks can offer richer semantics: instead of just visiting nodes, client code can safely be visiting the whole paths from the root, basically for free.
Do you have some pointers for this?
/tobe
On Thu, Dec 30, 2010 at 2:10 AM, Torbjorn Gannholm <to...@google.com> wrote:On Thu, Dec 30, 2010 at 11:00 AM, Dimitris Andreou <jim.a...@gmail.com> wrote:
I'd love to see good persistent collections, at the quality level of guava, but probably guava would not be the proper place for this. With guava's popularity, putting these there would just encourage overusing them - and from my scala experience I learned that many people would love to start choosing suboptimal structures just for the sake of "purity". Persistent structures border (and not coincide, since classic work on persistent structures actually depends on mutations) with functional programming, which can trigger that effect.There are various graph algorithms though that cannot be implemented efficiently without persistent collections. A good example is finding k shortest paths, instead of just one (so to have some alternatives) - this needs persistent heaps. Another example is simply depth-first traversals, where persistent stacks can offer richer semantics: instead of just visiting nodes, client code can safely be visiting the whole paths from the root, basically for free.
Do you have some pointers for this?
/tobe
I'll assume that you refer to the shortest paths: this is what I had in mind: Finding the k Shortest Paths (pdf), specifically section 2.
On Thu, Dec 30, 2010 at 11:28 AM, Dimitris Andreou <jim.a...@gmail.com> wrote:
On Thu, Dec 30, 2010 at 2:10 AM, Torbjorn Gannholm <to...@google.com> wrote:On Thu, Dec 30, 2010 at 11:00 AM, Dimitris Andreou <jim.a...@gmail.com> wrote:I'd love to see good persistent collections, at the quality level of guava, but probably guava would not be the proper place for this. With guava's popularity, putting these there would just encourage overusing them - and from my scala experience I learned that many people would love to start choosing suboptimal structures just for the sake of "purity". Persistent structures border (and not coincide, since classic work on persistent structures actually depends on mutations) with functional programming, which can trigger that effect.There are various graph algorithms though that cannot be implemented efficiently without persistent collections. A good example is finding k shortest paths, instead of just one (so to have some alternatives) - this needs persistent heaps. Another example is simply depth-first traversals, where persistent stacks can offer richer semantics: instead of just visiting nodes, client code can safely be visiting the whole paths from the root, basically for free.
Do you have some pointers for this?
/tobe
I'll assume that you refer to the shortest paths: this is what I had in mind: Finding the k Shortest Paths (pdf), specifically section 2.
Thanks.
I'm still having a problem seeing that persistent collections could be useful (and used for the right reasons) in a larger context. I assume that when writing an optimal algorithm one would tend to write a specialized data structure anyway.
A persistent stack seems to give a large savings, but I'm not sure I see it being very useful
Is there any particular structure that you see as both giving a significant savings and a high utility (i.e. all other existing implementations would be a significantly worse choice)?
Just for the record, there's some good research on purely function
data structures. The Okasaki paper (and book with same name) is a
great starter:
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.62.505
Best regards,
Daniel Yokomizo.
Immutable collections in general make concurrency easy. Persistent
collections have pretty good performance characteristics -- often good
enough to suit needs. Graph and search algorithms become easier to
implement, especially when you want them to be concurrent. You might
win some by implementing specialized structures, but often it won't be
much and chances are it's just not worth it.
I'd say they typically perform much better than that. At least the
implementations used in Clojure and Scala 2.8 do.
log32(n) vs log2(n)
> As a programmer with a purely functional background, I should mention thatI'd say they typically perform much better than that. At least the
> the asymptotics and performance of well-designed persistent map
> implementations are essentially the same as those of TreeMap.
implementations used in Clojure and Scala 2.8 do.
log32(n) vs log2(n)
I'd love to see good persistent collections, at the quality level of guava, but probably guava would not be the proper place for this. With guava's popularity, putting these there would just encourage overusing them - and from my scala experience I learned that many people would love to start choosing suboptimal structures just for the sake of "purity". Persistent structures border (and not coincide, since classic work on persistent structures actually depends on mutations) with functional programming, which can trigger that effect.
>>>>>>> >>> unsubscribe: guava-discuss+unsub...@googlegroups.com
>>>>>>> >>>
>>>>>>> >>> This list is for discussion; for help, post to Stack Overflow
>>>>>>> >>> instead:
>>>>>>> >>> http://stackoverflow.com/questions/ask
>>>>>>> >>> Use the tag "guava".
>>>>>>> >>
>>>>>>> >>
>>>>>>> >>
>>>>>>> >> --
>>>>>>> >> Robert Konigsberg
>>>>>>> >> konig...@gmail.com
>>>>>>> >>
>>>>>>> >> --
>>>>>>> >> guava-...@googlegroups.com.
>>>>>>> >> http://groups.google.com/group/guava-discuss?hl=en
>>>>>>> >> unsubscribe: guava-discuss+unsub...@googlegroups.com
>>>>>>> >>
>>>>>>> >> This list is for discussion; for help, post to Stack Overflow
>>>>>>> >> instead:
>>>>>>> >> http://stackoverflow.com/questions/ask
>>>>>>> >> Use the tag "guava".
>>>>>>> >
>>>>>>> > --
>>>>>>> > guava-...@googlegroups.com.
>>>>>>> > http://groups.google.com/group/guava-discuss?hl=en
>>>>>>> > unsubscribe: guava-discuss+unsub...@googlegroups.com
>>>>>>> >
>>>>>>> > This list is for discussion; for help, post to Stack Overflow
>>>>>>> > instead:
>>>>>>> > http://stackoverflow.com/questions/ask
>>>>>>> > Use the tag "guava".
>>>>>>> >
>>>>>>>
>>>>>>> --
>>>>>>> guava-...@googlegroups.com.
>>>>>>> http://groups.google.com/group/guava-discuss?hl=en
>>>>>>> unsubscribe: guava-discuss+unsub...@googlegroups.com
>>>>>>>
>>>>>>> This list is for discussion; for help, post to Stack Overflow
>>>>>>> instead:
>>>>>>> http://stackoverflow.com/questions/ask
>>>>>>> Use the tag "guava".
>>>>>>
>>>>>> --
>>>>>> guava-...@googlegroups.com.
>>>>>> http://groups.google.com/group/guava-discuss?hl=en
>>>>>> unsubscribe: guava-discuss+unsub...@googlegroups.com
>>>>>>
>>>>>> This list is for discussion; for help, post to Stack Overflow instead:
>>>>>> http://stackoverflow.com/questions/ask
>>>>>> Use the tag "guava".
>>>>>
>>>>
>>>> --
>>>> guava-...@googlegroups.com.
>>>> http://groups.google.com/group/guava-discuss?hl=en
>>>> unsubscribe: guava-discuss+unsub...@googlegroups.com