Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: to/make datatype!

From: gscottjones:mchsi at: 16-Oct-2002 14:26

From: "Joel Neely" ...
> So far the most simplest way I've come up with to create a DATATYPE! > value from a STRING! value is > > to-datatype: func [s [string!]] [ > first reduce load rejoin [ > "[" s either #"!" = last s ["]"] ["!]"] > ] > ] > > >> type? to-datatype "string" == datatype! > >> make to-datatype "integer" "12" == 12 > > There's *got* to be a better way! Any suggestions?
Hi, Joel, It's kind of like the difference between shaving with a double or triple razor blade, but here is at least one other way, which is just a short cut on your version: to-datatype: func [s [string!]] [ do join s either #"!" = last s [""]["!"] ] ;where type? to-datatype "string" ;== datatype! to to-datatype "string" "12" ;== "12" --Scott Jones