summaryrefslogtreecommitdiff
path: root/ipl/procs/xrotate.icn
blob: 607039002e6264ecca5879571a22da5f13fddd7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
############################################################################
#
#	File:     xrotate.icn
#
#	Subject:  Procedure to rotate values in list or record
#
#	Author:   Ralph E. Griswold
#
#	Date:     April 30, 1993
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  xrotate(X, i) rotates the values in X right by one position.  It works
#  for lists and records.
#
#  This procedure is mainly interesting as a recursive version of
#
#	x1 :=: x2 :=: x3 :=: ... xn
#
#  since a better method for lists is
#
#	push(L, pull(L))
#
############################################################################

procedure xrotate(X, i)

   /i := 1

   X[i] :=: xrotate(X, i + 1)

   return X[i]

end