Useful list functions » History » Version 1
iri, 12/17/2011 10:51 PM
1 | 1 | iri | h1. Useful list functions |
---|---|---|---|
2 | |||
3 | * Returns the part of a list between two given indexes. |
||
4 | |||
5 | <pre> |
||
6 | fun extractList2 (l, start, end, counter)= |
||
7 | if (counter > end) || (l == nil) then |
||
8 | nil |
||
9 | else |
||
10 | if counter < start then |
||
11 | extractList2 tl l start end counter+1 |
||
12 | else |
||
13 | (hd l) :: extractList2 tl l start end counter+1;; |
||
14 | |||
15 | fun extractList(l, start, end)= |
||
16 | extractList2 l start end 0;; |
||
17 | </pre> |
||
18 | |||
19 | Author : iri |
||
20 | Date : december 2011 |
||
21 | |||
22 | *Return to [[Examples]]* |