Mercurial > repos > rhope
comparison range.rhope @ 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 | |
children | a34a982ecd32 |
comparison
equal
deleted
inserted
replaced
93:09831a71a4bc | 94:05c22ff4b4ed |
---|---|
1 | |
2 Blueprint Range | |
3 { | |
4 Start | |
5 End | |
6 } | |
7 | |
8 Range[start,end:out] | |
9 { | |
10 out <- [[Build[Range()]]Start <<[start]]End <<[end] | |
11 } | |
12 | |
13 First@Range[range:out,none] | |
14 { | |
15 If[[[range]Start >>] < [[range]End >>]] | |
16 { | |
17 out <- [range]Start >> | |
18 }{ | |
19 none <- range | |
20 } | |
21 } | |
22 | |
23 Next@Range[range,val:out,done] | |
24 { | |
25 next <- [val]+[1] | |
26 If[[next] < [[range]End >>]] | |
27 { | |
28 out <- Val[next] | |
29 }{ | |
30 done <- range | |
31 } | |
32 } | |
33 | |
34 Index@Range[range,index:out,notfound] | |
35 { | |
36 If[[index] < [[range]End >>]] | |
37 { | |
38 If[[index] < [[range]Start >>]] | |
39 { | |
40 notfound <- index | |
41 }{ | |
42 out <- index | |
43 } | |
44 }{ | |
45 notfound <- index | |
46 } | |
47 } | |
48 |