Selective to-(data-type) Howto?
[1/2] from: tim:johnsons-web at: 13-Jul-2001 12:04
I can do this:
types: [to-integer to-string] ; block of data - conversion functions
== [to-integer to-string]
>> tt: get pick types 1
>> test: tt "4"
== 4
>> tt: get pick types 2
>> test: tt 4
== "4"
; this is great? It allows me to do data-conversion selectively based on indexes
; parsed from a config file.
To expand on this: Is it possible to extract a block of value-conversion functions
directly from rebol?
Thanks
Tim
[2/2] from: jeff::rebol::net at: 13-Jul-2001 15:10
Howdy, Tim:
> I can do this:
> types: [to-integer to-string] ; block of data - conversion
<<quoted lines omitted: 5>>
> extract a block of value-conversion functions directly
> from rebol?
Not sure of your question, but wanted to point out that you
can also do:
some-types: [1 [email--foo] "string" #hash u:/ []]
to some-types/1 "1"
to some-types/2 "larry"
etc...
You can use TO and a representive sampling of what you want to
convert something to.
-jeff
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted