Hi Bard, 

Aha.

you wrote:
>
>The problem is that I'm working with things I don't understand and I can't 
>find good documentation.  I found some code to connect to an email 
>server.  Something like this:
>----------------------
>x:     [
>           scheme: 'pop
>           user: "srad"
>           pass: "portw"
>           host: "mail.aneurosmith.com"
>       ]
>
>open x
>------------------------
>
>I don't understand this array which looks like a structure.  

What you're looking at here is a block. This block will be used by 'open to
create an object it will use to control the way it accesses srad's email
account. An object is created like so:

obj: make object! [ some-word: "some-string-value" another-word: 3 ]

Now the words in the object can be used:

>> print obj/some-word
some-string-value

>> > 0 obj/another-word
== false

>> < 0 obj/another-word
== true

As you mention, you can do a block that contains assignments:

>> value? 'some-word
== false

>> do [ some-word: "some-string-value" another-word: 3 ]
== 3

>> value? 'some-word
== true

Normally we use blocks because we want to keep a sequence of values bundled
together. We may want access the values by names (similar to a struct in C
or a record in Pascal). This is possible by using paths:

>> a: [ some-word "some-string-value" another-word 3 ]

>> print a/some-word
some-string-value

>> > 0 a/another-word
== false

>> < 0 a/another-word
== true

or by using select:

>> select a 'some-word ;- note the tick mark in front of some-word
== "some-string-value"

Hope this helps,

Elan

Reply via email to