aboutsummaryrefslogtreecommitdiff
path: root/IterableClass.icl
blob: 0aa2ddad743e8ada8a8e54cd969e3187dece0c7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
implementation module IterableClass

import StdEnv

stepn :: Int !a -> a | step a
stepn 0 a = a
stepn n a = stepn (n-1) (step a)

rewindn :: Int !a -> a | rewind a
rewindn 0 a = a
rewindn n a = rewindn (n-1) (rewind a)

stepOrRewindn :: Int !a -> a | step, rewind a
stepOrRewindn 0 a = a
stepOrRewindn n a
| n < 0 = rewindn (0-n) a
| n > 0 = stepn n a