view range.rhope @ 189:d0e3a13c1bd9 default tip

Remove old calculator example
author Mike Pavone <pavone@retrodev.com>
date Fri, 07 Oct 2011 00:24:04 -0700
parents a34a982ecd32
children
line wrap: on
line source


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
	}
}

Set@Range[range,index,val:out]
{
	out <- [[()]Concatenate[range]
	]Set[index,val]
}