Mercurial > repos > rhope
changeset 94:05c22ff4b4ed
Forgot to add this with a prior commit
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 02 Aug 2010 01:00:37 -0400 |
parents | 09831a71a4bc |
children | f4fd8962c385 |
files | range.rhope |
diffstat | 1 files changed, 48 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/range.rhope Mon Aug 02 01:00:37 2010 -0400 @@ -0,0 +1,48 @@ + +Blueprint Range +{ + Start + End +} + +Range[start,end:out] +{ + out <- [[Build[Range()]]Start <<[start]]End <<[end] +} + +First@Range[range:out,none] +{ + If[[[range]Start >>] < [[range]End >>]] + { + out <- [range]Start >> + }{ + none <- range + } +} + +Next@Range[range,val:out,done] +{ + next <- [val]+[1] + If[[next] < [[range]End >>]] + { + out <- Val[next] + }{ + done <- range + } +} + +Index@Range[range,index:out,notfound] +{ + If[[index] < [[range]End >>]] + { + If[[index] < [[range]Start >>]] + { + notfound <- index + }{ + out <- index + } + }{ + notfound <- index + } +} +