[Newbies] Smalltalk is a Mystery to Me
Matthew Fulmer
tapplek at gmail.com
Fri Aug 22 17:02:03 UTC 2008
On Thu, Aug 21, 2008 at 08:30:25PM -0400, Tcykgreis at aol.com wrote:
> I can't get started, and I mean zero progress, because I can't create and
> load deck. It seems like the documentation is never quit up to date. I read
> about curly braces and tried deck := {0. 1. 2. ... }. When I try to accept it,
> first deck is questioned and then after deck I get something about not
> expecting anything else.
> I know there is a word 'asByteArray:' and I assume a number would specify
> the size of the array but nowhere can I find anything about the order in which
> the information should be provided. I tried deck asByteArray: 52 but I don't
> know if it worked. If it did work, how do I load the bytes into it? How do I
> look at a byte in a particular location in the array? Can I remove a byte from
> position x and/or insert a byte at position y and everything moves to
> accommodate the change.
In a workspace, try typing these and press alt-p (print it):
#(2 3 5) at: 1. "2"
#(2 3 5) at: 2. "3"
#(2 3 5) at: 3 put: 7. "#(2 3 7)"
2 bitAnd: 3. "2"
2 bitOr: 3. "3"
2 bitXor: 3. "1"
No, you cannot insert/remove elements from Arrays. They are
fixed length objects. Use OrderedCollection if you want that.
See http://squeak.org/Documentation. I think the terse guide to
squeak will be especially helpful to you:
http://wiki.squeak.org/squeak/5699
--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
More information about the Beginners
mailing list