[REBOL] Re: Types & runtime
From: gscottjones:mchsi at: 25-Aug-2002 7:31
From: "Robert M. Muench"
> Hi, can some help me with this:
>
> list: [name string! birthday date!]
>
> field: pick list 1
> type: pick list 2
>
> >> type? Type
> == word!
>
> What I want to do is to set field to a value of type 'type. Something
> like:
>
> switch type [
> string! [value: "test"]
> ]
> to-set-word field reduce[make to-type type value]
>
> Is something like this possible? Robert
Is this what you are looking for?
list: [name string! birthday date!]
foreach [field type] list [
switch type [
string! [value: "test"]
date! [value: "1-1-1"]
]
do reduce [to-set-word :field make do type value]
]
After execution, yielding:
>> name
== "test"
>> birthday
== 1-Jan-2001
Hope that helps.
--Scott Jones