On Wed, Apr 20, 2016 at 2:25 PM, Joseph Alotta <joseph.alo...@gmail.com>
wrote:

> There is a possibility of duplicates.  For example, if I go to Starbucks
> buy a coffee, then buy a second cup.  There would be two transactions same
> amount, same day.
>
> What about OrderedCollection?
>
> OrderedCollection would also work, especially if you want to see what
order they happened in. If you just care about counting the times it
happened, Bag might be better.


> How do I send #asSet to the bag, give that the bag is an instance variable
> in my larger object?
>
> In the explorer (right where you tried exploring the dictionary value in
the bag), select the bag variable.
Then, down int eh bottom pane, type in
   self asSet
and explore that.
[image: Inline image 1]

>
>
>
>
> > On Apr 20, 2016, at 2:43 PM, cbc [via Smalltalk] <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4891076&i=0>> wrote:
> >
> > HI Joe,
> > A Bag is a structure to hold multiple, possibly repeating, objects in
> it.  One of the benefits is to know how many times an object is inside of
> the bag - how many times it repeats.
> >
> > Bag is implemented with a Dictionary it in - the key is the objects that
> you put into the bag, and the value is the count of how many times it was
> put into the bag (hence all of the 1's that you see - they were probably
> just added once to the bag).
> >
> > The explorer is optimized to make Dictionary navigation fast and
> convenient for normal Dictionaries - you can see and select the key, and
> get to see the details of the values in the dictionary.
> > It is not optimized for looking at the dictionary in the Bag, where you
> care about the key (and mostly not about the value - at least for your use
> case).
> >
> > To explore the values in the Bag, I would suggest one of two ways of
> getting at the data:
> > 1> send #asSet to the bag, and explore that
> > 2> send #keys to the dictionary, and explore that
> > Either should work.
> >
> > One more thing to think about - if you aren't going to have multiples of
> your Transaction objects (or don't care to know that you have multiple of
> them) in your Bag, you might want to consider using a Set instead.
> >
> > Thanks,
> > cbc
> >
> > On Wed, Apr 20, 2016 at 12:31 PM, Joseph Alotta <[hidden email]> wrote:
> > Help!
> >
> >
> > I have a data structure as the screenshot below shows.
> >
> > There is a Bag with Transaction objects.
> >
> > I can’t see inside the Transaction objects?
> >
> > Why is there a Dictionary?
> >
> > I can see the beginning of the transaction data, but I can’t the the
> whole line?
> >
> > When I explore, it opens a window on Integer 1.  Where are all the 1s
> coming from?
> >
> >
> > Sincerely,
> >
> > Joe.
> >
> >
> > here is the link: https://www.flickr.com/photos/jalotta/26480315621/
> >
> >
> >
> > _______________________________________________
> > Beginners mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >
> >
> > _______________________________________________
> > Beginners mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >
> >
> > If you reply to this email, your message will be added to the discussion
> below:
> > http://forum.world.st/Help-can-t-see-inside-a-Bag-tp4891049p4891054.html
> > To start a new topic under Squeak - Beginners, email [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4891076&i=1>
> > To unsubscribe from Squeak - Beginners, click here.
> > NAML
>
>
> ------------------------------
> View this message in context: Re: Help! can't see inside a Bag
> <http://forum.world.st/Help-can-t-see-inside-a-Bag-tp4891049p4891076.html>
> Sent from the Squeak - Beginners mailing list archive
> <http://forum.world.st/Squeak-Beginners-f107673.html> at Nabble.com.
>
> _______________________________________________
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to