The first version sounds like the best option. The reasons yo use streams are because a computation is expensive or consumes too much memory. If your data is in a hash table then neither of those are a concern.
--
Â
Â
--
--
Â
Â
--
Â
Â
--
I don't understand, hashtables and sets have fairly different use cases. Why use one when you want the other?  What about cores has gotten in your way too?
--
So should we just use Core's Hashtbl internally?
We can revisit what to do if we ever need to expose a Hashtbl in the API, which hasn't come up yet. I could go either way though, so if anyone else feels strongly either way please say so.
--
Â
Â
On 12/23/2012 05:37 PM, Philippe Veber wrote:I sniff you may need to use a Set.
Thanks all for your answers. Yes, my motivation was to save the time
spent in the extra pass and in allocating memory. But you're probably
right the gain is probably not much, if compared to the danger of using
[Obj.magic]. I'll stick to your recommandation :o).
My use case for hash table to stream transformation is to sort a set of
objects into categories with a hash table and stream on the categories
for further calculations (see Biocaml_accu).
    <sebastie...@gmail.com <mailto:sebastien.mondet@gmail.com>>
    wrote:
      Hi
      I also prefer the first option:
      - converting hashtables to streams does not seem useful
      enough to take
      the risk of Obj.magic: a hash-table does not keep any
      intersseting
      order, so anyway if order matters we'll end up doing
      Hashtbl.to_list
      |! List.sort, If order does not matter Hashtbl.fold is enough
      - one always ends regretting Obj.magic :)
      Maybe there is a real use case of ('a, 'b) Hashtbl.t -> ('a, 'b)
      Stream.t that I could not think of?
      On Sat, Dec 22, 2012 at 6:07 AM, Malcolm Matalka      <mmat...@gmail.com <mailto:mmat...@gmail.com>> wrote:
       > The first version sounds like the best option. The
      reasons yo use streams
       > are because a computation is expensive or consumes too
      much memory. If your
       > data is in a hash table then neither of those are a concern.
       >
       > On Dec 22, 2012 10:05 AM, "Philippe Veber"
      <philipp...@gmail.com <mailto:philippe.veber@gmail.com>>
--
--
Â
Â