Block of words
[1/6] from: dvydra2::yahoo::com at: 25-Feb-2001 12:44
Rod,
Good job! Asking and answering ones own questions is
sometimes called "working with a cardboard parter" in
pair-programming, one of the practices of
ExtremeProgramming.
Regards,
David
--- Rod Gaither <[rgaither--triad--rr--com]> wrote:
> Answering my own question, :-)
> >> my-block: make block []
<<quoted lines omitted: 21>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
=====
please reply to: [david--vydra--net]
[2/6] from: gjones05:mail:orion at: 25-Feb-2001 16:25
From: David Vydra
<snip>
> Good job! Asking and answering ones own questions is
> sometimes called "working with a cardboard parter" in
> pair-programming, one of the practices of
> ExtremeProgramming.
<snip>
and "Rubber Ducking" in The Pragmatic Programmer.
--Scott
[3/6] from: andrew:wxc at: 26-Feb-2001 15:45
> I have used the following method to get a list of name:value pairs in
practice and it is working fine.
> >> my-block: [name "Rod" age 37 profession "Developer"]
> >> print select my-block 'name
>
> To me the above doesn't feel right. The approach I would prefer is to
have the list in the block to be words themselves that could be dereferenced
to get to the value.
How about using an object? Like:
>> Person: make object! [
[ Name: "Rod"
[ Age: 37
[ Profession: "Developer"
[ ]
>>
>> person/name
== "Rod"
>> person/age
== 37
The words in a object is:
>> first person
== [self Name Age Profession]
and the values in a object is:
>> second person
== [
make object! [
Name: "Rod"
Age: 37
Profession: "Developer"
] "Rod" 37 "Developer"]
Where the first value is 'self, and the next three are name, age and
profession.
I hope that helps!
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
[4/6] from: andrew:wxc at: 26-Feb-2001 15:54
Rod wrote:
> >> my-block: [name "Rod" age 37 profession "Developer"]
Another way of doing this, is:
my-block: [
[Name Age Profession]
"Rod" 37 "Developer"
"Andrew" 40 "Rebolutionary"
]
This is more suitable for storing tables, and keeping field names intact.
Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
[5/6] from: rgaither:triad:rr at: 25-Feb-2001 22:25
Hi Andrew,
>> >> my-block: [name "Rod" age 37 profession "Developer"]
>Another way of doing this, is:
<<quoted lines omitted: 4>>
> ]
>This is more suitable for storing tables, and keeping field names intact.
Still being very new at this - how about some examples working with
the above structure?
Thanks, Rod.
Rod Gaither
Oak Ridge, NC - USA
[rgaither--triad--rr--com]
[6/6] from: rgaither:triad:rr at: 26-Feb-2001 10:47
Hi Andrew,
>How about using an object? Like:
>
>>> Person: make object! [
>[ Name: "Rod"
>[ Age: 37
>[ Profession: "Developer"
>[ ]
I am doing this for the predefined elements in my object.
What I am reaching for is a dynamically built set of
properties that are basically name:value pairs where if
possible I want the value to be its natural datatype.
Hence my desire for a block of words.
I'm not sure if you didn't get it or are working through
the mails in order :-) but I solved my problem. The key
was the use of the get function to get to the value of
a stored word in a block.
Thanks though, Rod.
Rod Gaither
Oak Ridge, NC - USA
[rgaither--triad--rr--com]
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted