<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: datatype code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 22:02:42 GMT</pubDate>
    <description>DZone Snippets: datatype code</description>
    <item>
      <title>DATATYPE-NAME?</title>
      <link>http://snippets.dzone.com/posts/show/3007</link>
      <description>&lt;code&gt;&lt;br /&gt;datatype-name?: func [val [string!]] [datatype? get/any load val]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 16 Nov 2006 05:08:31 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3007</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
    <item>
      <title>CAST</title>
      <link>http://snippets.dzone.com/posts/show/3006</link>
      <description>&lt;code&gt;&lt;br /&gt;cast: func [value type] [to type value]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 16 Nov 2006 05:07:50 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3006</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
    <item>
      <title>CAN-CAST?</title>
      <link>http://snippets.dzone.com/posts/show/3005</link>
      <description>&lt;code&gt;&lt;br /&gt;can-cast?: func [value type] [not error? try [to type value]]]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 16 Nov 2006 05:07:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3005</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
    <item>
      <title>CAST function - Convert a value referenced by a word to a new datatype. Dialected</title>
      <link>http://snippets.dzone.com/posts/show/2098</link>
      <description>&lt;code&gt;&lt;br /&gt;    cast: func [ ; convert coerce&lt;br /&gt;        "Convert a value referenced by a word to a new datatype."&lt;br /&gt;        input [block!] "A word, and the target datatype."&lt;br /&gt;        /local words type val&lt;br /&gt;    ] [&lt;br /&gt;        parse input [&lt;br /&gt;            some [&lt;br /&gt;                copy words to 'to skip set type any-type! (&lt;br /&gt;                    ;while [pos: find words 'and] [remove pos]&lt;br /&gt;                    remove-each word words [word = 'and]&lt;br /&gt;                    foreach word words [&lt;br /&gt;                        val: get/any word&lt;br /&gt;                        set/any word to either word? type [get type] [type] val&lt;br /&gt;                    ]&lt;br /&gt;                )&lt;br /&gt;            ]&lt;br /&gt;        ]&lt;br /&gt;    ]&lt;br /&gt;    comment {&lt;br /&gt;        a: "A-0001"&lt;br /&gt;        b: #B002&lt;br /&gt;        c: 300&lt;br /&gt;        d: &lt;H1&gt;&lt;br /&gt;        e: 'test&lt;br /&gt;        cast [a to issue!]      print mold :a&lt;br /&gt;        cast [b to tag!]        print mold :b&lt;br /&gt;        cast [c to decimal!]    print mold :c&lt;br /&gt;        cast [a b c to string!] print remold [:a :b :c]&lt;br /&gt;        cast [a b and c to issue!] print remold [:a :b :c]&lt;br /&gt;        cast [&lt;br /&gt;            a b and c to tag!&lt;br /&gt;            and&lt;br /&gt;            d and e to issue!&lt;br /&gt;        ] print remold [:a :b :c :d :e]&lt;br /&gt;        cast [a b c to &lt;x&gt;  d e to "x"] print remold [:a :b :c :d :e]&lt;br /&gt;    } &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 25 May 2006 03:09:06 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2098</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
    <item>
      <title>Find datatype words</title>
      <link>http://snippets.dzone.com/posts/show/1190</link>
      <description>&lt;code&gt;&lt;br /&gt;datatypes: has [types attrs value word] [&lt;br /&gt;	word: 'datatype!&lt;br /&gt;	types: copy []&lt;br /&gt;	attrs: second system/words&lt;br /&gt;	foreach item first system/words [&lt;br /&gt;		if all [&lt;br /&gt;			not unset? first attrs&lt;br /&gt;			any [&lt;br /&gt;				all [string? :word find value word]&lt;br /&gt;				all [&lt;br /&gt;					not string? :word&lt;br /&gt;					datatype? get :word&lt;br /&gt;					(get :word) = type? first attrs&lt;br /&gt;				]&lt;br /&gt;			]&lt;br /&gt;		] [&lt;br /&gt;			append types item&lt;br /&gt;		]&lt;br /&gt;		attrs: next attrs&lt;br /&gt;	]&lt;br /&gt;	sort types&lt;br /&gt;]&lt;br /&gt;print mold datatypes&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 19 Jan 2006 03:00:56 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1190</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
  </channel>
</rss>
