<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: bounds code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 18:35:45 GMT</pubDate>
    <description>DZone Snippets: bounds code</description>
    <item>
      <title>LIMIT - Make sure val falls between lower and upper bounds, inclusive; uses length for series values.</title>
      <link>http://snippets.dzone.com/posts/show/3111</link>
      <description>&lt;code&gt;&lt;br /&gt;    limit: func [&lt;br /&gt;        "Make sure val falls between lower and upper bounds, inclusive; uses length for series values."&lt;br /&gt;        val&lt;br /&gt;        lower [integer!]&lt;br /&gt;        upper [integer!]&lt;br /&gt;        /show "For series values, show extension/truncation (dot/none for extension, 3 dots for truncation)."&lt;br /&gt;        /local fill&lt;br /&gt;    ][&lt;br /&gt;        either not series? val [max min val upper lower] [&lt;br /&gt;            either all [&lt;br /&gt;                upper &gt;= length? val&lt;br /&gt;                lower &lt;= length? val&lt;br /&gt;            ] [val] [&lt;br /&gt;                ; If extending the series, use NONE as the fill value, so the&lt;br /&gt;                ; block can still be processed easily.&lt;br /&gt;                fill: either any-string? val ["."] [none]&lt;br /&gt;                head either lower &gt;= length? val [&lt;br /&gt;                    insert/only/dup tail val fill subtract lower length? val&lt;br /&gt;                ][&lt;br /&gt;                    clear skip val upper&lt;br /&gt;                    either show [change/dup skip tail val -3 '. 3] [val]&lt;br /&gt;                ]&lt;br /&gt;            ]&lt;br /&gt;        ]&lt;br /&gt;    ]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 08 Dec 2006 22:46:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3111</guid>
      <author>gregg.irwin (Gregg Irwin)</author>
    </item>
  </channel>
</rss>
